// iosh を起動する #include "IoVM.h" void MyPrint(void *self, char *s) { IoObject* sh; IoMessage* msgPrintResult; IoObject* context; context = (IoObject *)IoState_doCString_(self, "Lobby"); sh = IoState_doCString_(self, "sh"); msgPrintResult = IoMessage_newWithName_(self, SIOSTRING("printResult")); IoMessage_addCachedArg_(msgPrintResult, SIOSTRING(s)); IoObject_perform(sh, context, msgPrintResult); IoMessage_free(msgPrintResult); } void MyExit(void *state) { exit(0); } void MyError(void *state, char *name, char *description) { printf("Error: %s - %s\n", name, description); } void IoServerInit(IoState *self, IoObject *context); void IoServerDone(void); int main(int argc, char* argv[]) { IoState *state = IoState_new(); int v; IoState_pauseGarbageCollector(state); IoServerInit(state, state->lobby); IoState_printCallback_(state, MyPrint); IoState_errorCallback_(state, MyError); IoState_exitCallback_(state, MyExit); IoObject_setSlot_to_(state->lobby, IoState_stringWithCString_(state, "distribution"), IoState_stringWithCString_(state, "IoServer")); IoState_resumeGarbageCollector(state); IoState_doFile_(state, "iosh.io"); IoState_free(state); IoServerDone(); return 0; }