n_file * tranfer_out(void) { noble_simulation *local_sim = sim_sim(); n_file *returnFile = io_file_new(); n_int loop = 0; n_string fluff[5] = {SHORT_VERSION_NAME, FULL_DATE, COPYRIGHT_DATE, COPYRIGHT_NAME, COPYRIGHT_FOLLOW }; if(returnFile == 0L) { return 0L; } if(returnFile->data == 0L) { memory_free((void**)&returnFile); return 0L; } io_write_buff(returnFile, fluff, 0L, FILE_COPYRIGHT, 0L); transfer_land(returnFile, local_sim, (noble_file_entry *)noble_file_format); while (loop < (n_int)local_sim->num) { transfer_being(returnFile, local_sim, loop, (noble_file_entry *)noble_file_format); loop++; } /* TODO: Brain block */ return returnFile; }
static IOFileUD *io_file_open(lua_State *L, const char *mode) { const char *fname = strdata(lj_lib_checkstr(L, 1)); IOFileUD *iof = io_file_new(L); iof->fp = fopen(fname, mode); if (iof->fp == NULL) luaL_argerror(L, 1, lj_str_pushf(L, "%s: %s", fname, strerror(errno))); return iof; }
n_file * obj_json(n_object * object) { n_file * output_file = io_file_new(); object_top_object(output_file, object); return output_file; }