find empty slot

Author: Robert Schirmer
License: BSD
Github: rbrt/lpr/find empty slot.axo

Inlets

int32.positive slot

bool32.rising findEmpty

Outlets

bool32 full

bool32.pulse found

int32.positive slot

Attributes

objref lpr

Declaration
bool strig;
uint8_t slot;
bool full;
Control Rate
outlet_found = 0;
if (inlet_findEmpty && !strig) {
  full = 1;
  strig = 1;
  if (!attr_lpr.array[(inlet_slot << 2) + 2]) {
    slot = inlet_slot;
    outlet_found = 1;
    full = 0;
  } else {
    int i;
    for (i = 0; i < attr_lpr.LENGTH; i += 4)
      if (!attr_lpr.array[i + 2]) {
        slot = i >> 2;
        outlet_found = 1;
        full = 0;
        break;
      }
  }
}

if (!inlet_findEmpty)
  strig = 0;
outlet_full = full;
outlet_slot = slot;

Privacy

© 2024 Zrna Research