static void fold_hood_plus_step_filter(Machine & machine){ machine.environment.pop(1); Data import = machine.stack.pop(); machine.environment.push(*result); machine.environment.push(import); machine.call(fuse,fold_hood_plus_step_fuse); }
static void fold_hood_filter_next(Machine & machine){ *result = machine.stack.pop(); if (++machine.current_neighbour != machine.hood.end()){ machine.environment.push(machine.current_neighbour->imports[export_index]); machine.call(filter,fold_hood_plus_step_filter); } else { machine.stack.push(*result); } }
static void fold_hood_step(Machine & machine) { machine.environment.pop(2); *result = machine.stack.pop(); if (++machine.current_neighbour != machine.hood.end()){ machine.environment.push(*result); machine.environment.push(machine.current_neighbour->imports[export_index]); machine.call(fuse,fold_hood_step); } else { machine.stack.push(*result); } }
/** * \note A state variable will be reset when no feedback instruction is used on it in a single run. * It will be reinitialized by the next time INIT_FEEDBACK is executed. * * \param Int The index of the state variable. * \param Address The function to give the initial value, if not yet set. * * \return Data The value of the state variable. */ void INIT_FEEDBACK(Machine & machine){ Index state_index = machine.nextInt(); Address initialization_function = machine.stack.popAddress(); machine.state[state_index].is_executed = true; machine.state[state_index].thread = machine.currentThreadId(); if (machine.state[state_index].data.isSet()){ machine.stack.push(machine.state[state_index].data); } else { machine.stack.push(Number(state_index)); machine.call(initialization_function, INIT_FEEDBACK_set_state); } }
static void fold_hood_plus(Machine & machine, Data & result) { Index export_index = machine.nextInt8(); Data export_value = machine.stack.pop(); Address filter = machine.stack.popAddress(); Address fuse = machine.stack.popAddress(); HoodInstructions::export_index = export_index; HoodInstructions::result = &result; HoodInstructions::filter = filter; HoodInstructions::fuse = fuse; machine.thisMachine().imports[export_index] = export_value; machine.current_neighbour = machine.hood.begin(); machine.environment.push(export_value); machine.call(filter,fold_hood_plus_first_filter); }