int my_node_id_tau (void *msg) { ssize_t rc; rc = pread(Msg_fd, msg, sizeof(msg_s), MSG_NODE_ID); RTN(rc); }
int send_key_tau (ki_t key, void *msg) { ssize_t rc; rc = pread(Msg_fd, msg, sizeof(msg_s), MAKE_ARG(key, MSG_SEND)); RTN(rc); }
int destroy_key_tau (ki_t key) { ssize_t rc; rc = pread(Msg_fd, NULL, 0, MAKE_ARG(key, MSG_DESTROY_KEY)); RTN(rc); }
int init_msg_tau (const char *name) { ssize_t rc; msg_s m; if (Msg_fd) { fprintf(stderr, "Message system already initialized %d\n", Msg_fd); return EBUSY; } Msg_fd = open(Dev_name, O_RDWR); if (Msg_fd == -1) { Msg_fd = 0; fprintf(stderr, "Couldn't open %s to initalize message system %s\n", Dev_name, strerror(errno)); return errno; } strncpy(Process_name, file_path(name), TAU_NAME); Process_name[TAU_NAME-1] = '\0'; strncpy(m.my_name, Process_name, TAU_NAME); rc = pread(Msg_fd, &m, sizeof(msg_s), MSG_NAME); if (rc != 0) { shutdown_msg_tau(); } RTN(rc); }
int stat_key_tau (ki_t key, void *msg) { ssize_t rc; rc = pread(Msg_fd, msg, sizeof(msg_s), MAKE_ARG(key, MSG_STAT_KEY)); RTN(rc); }
int receive_tau (void *msg) { ssize_t rc; rc = pread(Msg_fd, msg, sizeof(msg_s), MSG_RECEIVE); RTN(rc); }
int duplicate_key_tau (ki_t key, void *msg) { ssize_t rc; rc = pread(Msg_fd, msg, sizeof(msg_s), MAKE_ARG(key, MSG_DUPLICATE_KEY)); RTN(rc); }
int plug_key_tau (unint plug, void *msg) { ssize_t rc; rc = pread(Msg_fd, msg, sizeof(msg_s), MAKE_ARG(plug, MSG_PLUG_KEY)); RTN(rc); }
int node_died_tau (u64 node_no) { msg_s msg; ssize_t rc; rc = pread(Msg_fd, &msg, sizeof(msg_s), MAKE_ARG(node_no, MSG_NODE_DIED)); RTN(rc); }
int destroy_gate_tau (u64 id) { msg_s m; ssize_t rc; m.cr_id = id; rc = pread(Msg_fd, &m, sizeof(m), MSG_DESTROY_GATE); RTN(rc); }
int create_gate_tau (void *msg) { ssize_t rc; ZERO_PADDING(msg, tag); ZERO_PADDING(msg, start); rc = pread(Msg_fd, msg, sizeof(msg_s), MSG_CREATE_GATE); RTN(rc); }
int call_tau (ki_t key, void *msg) { msg_s *m = msg; ssize_t rc; m->q.q_type = 0; rc = pread(Msg_fd, msg, sizeof(msg_s), MAKE_ARG(key, MSG_CALL)); RTN(rc); }
int send_tau (ki_t key, void *msg) { msg_s *m = msg; ssize_t rc; m->q.q_passed_key = 0; rc = pread(Msg_fd, msg, sizeof(msg_s), MAKE_ARG(key, MSG_SEND)); RTN(rc); }
int change_index_tau (ki_t key, ki_t std_key) { msg_s m; ssize_t rc; m.q.q_type = 0; m.q.q_passed_key = std_key; rc = pread(Msg_fd, &m, sizeof(m), MAKE_ARG(key, MSG_CHANGE_INDEX)); RTN(rc); }
int write_data_tau (ki_t key, unint length, const void *start, unint offset) { msg_s m; ssize_t rc; ZERO_PADDING( &m, start); m.q.q_start = (void *)start; m.q.q_length = length; m.q.q_offset = offset; rc = pread(Msg_fd, &m, sizeof(m), MAKE_ARG(key, MSG_WRITE_DATA)); RTN(rc); }
int read_data_tau (ki_t key, unint length, void *start, unint offset) { msg_s m; ssize_t rc; ZERO_PADDING( &m, start); m.q.q_start = start; m.q.q_length = length; m.q.q_offset = offset; rc = pread(Msg_fd, &m, sizeof(m), MAKE_ARG(key, MSG_READ_DATA)); RTN(rc); }
int putdata_tau (ki_t key, void *msg, unint length, const void *start) { msg_s *m = msg; ssize_t rc; ZERO_PADDING(msg, start); m->q.q_type = READ_DATA; m->q.q_start = (void *)start; m->q.q_length = length; rc = pread(Msg_fd, msg, sizeof(msg_s), MAKE_ARG(key, MSG_CALL)); RTN(rc); }
Elem & Machine::execute(std::ostream &out) { Instruction *command; std::shared_ptr<Elem> command_ptr; Elem *ADD(new Instruction("ADD")); Elem *MUL(new Instruction("MUL")); Elem *SUB(new Instruction("SUB")); Elem *DIV(new Instruction("DIV")); Elem *REM(new Instruction("REM")); Elem *EQ(new Instruction("EQ")); Elem *LEQ(new Instruction("LEQ")); Elem *SEL(new Instruction("SEL")); Elem *LD(new Instruction("LD")); Elem *LDC(new Instruction("LDC")); Elem *LDF(new Instruction("LDF")); Elem *CAR(new Instruction("CAR")); Elem *CDR(new Instruction("CDR")); Elem *CONS(new Instruction("CONS")); Elem *NIL(new Instruction("NIL")); Elem *DUM(new Instruction("DUM")); Elem *AP(new Instruction("AP")); Elem *RAP(new Instruction("RAP")); Elem *RTN(new Instruction("RTN")); Elem *JOIN(new Instruction("JOIN")); Elem *STOP(new Instruction("STOP")); while (!C->empty()) { if (out != 0x0) { print_S(out); print_E(out); print_C(out); out << std::endl; } command_ptr = C->pop_ret(); command = dynamic_cast<Instruction*>(&*command_ptr); if (command == nullptr) throw Exception("Execute", "FatalError"); if (*command == *ADD) this->ADD(); else if (*command == *MUL) this->MUL(); else if (*command == *SUB) this->SUB(); else if (*command == *DIV) this->DIV(); else if (*command == *REM) this->REM(); else if (*command == *EQ) this->EQ(); else if (*command == *LEQ) this->LEQ(); else if (*command == *SEL) this->SEL(); else if (*command == *LD) this->LD(); else if (*command == *LDC) this->LDC(); else if (*command == *LDF) this->LDF(); else if (*command == *CAR) this->CAR(); else if (*command == *CDR) this->CDR(); else if (*command == *CONS) this->CONS(); else if (*command == *NIL) this->NIL(); else if (*command == *DUM) this->DUM(); else if (*command == *AP) this->AP(); else if (*command == *RAP) this->RAP(); else if (*command == *RTN) this->RTN(); else if (*command == *JOIN) this->JOIN(); else if (*command == *STOP) { return (*(this->STOP()));} else throw Exception("Execute", "Expected 'instruction' but greeted constant."); } throw Exception("Execute", "FatalError"); }