charptr32 filename
bool32.rising load
bool32.rising save
int32.positive offset
int32.positive start
int32.positive length
None
objref table
objref SDapi
bool trig;
bool load;
bool save;
uint32_t length;
uint32_t offset;
uint8_t bytes;
int rem_sz;
bytes = sizeof(*attr_table.array);
if (inlet_load && !trig) {
trig = 1;
load = 1;
}
if (inlet_save && !trig) {
trig = 1;
save = 1;
}
if (load) {
load = 0;
int filesize = attr_SDapi.fsize(inlet_filename) / bytes;
rem_sz = (((filesize + inlet_offset) > attr_table.LENGTH) ? attr_table.LENGTH
: filesize) *
bytes;
attr_SDapi.fload(inlet_filename, (char *)&attr_table.array[0],
inlet_offset * bytes, rem_sz);
}
if (save) {
save = 0;
rem_sz = (((inlet_length + inlet_start) > attr_table.LENGTH)
? attr_table.LENGTH - inlet_start
: inlet_length) *
bytes;
attr_SDapi.fsave(inlet_filename, (char *)&attr_table.array[0],
inlet_start * bytes, rem_sz);
}
if (!inlet_load && !inlet_save)
trig = 0;