CIRCA_EXPORT caWorld* circa_initialize() { bootstrap_kernel(); caWorld* world = global_world(); Block* builtins = global_builtins_block(); //dump(builtins); // Make sure there are no static errors in builtins. This shouldn't happen. #if 0 if (has_static_errors(builtins)) { std::cout << "Static errors found in kernel:" << std::endl; dump(builtins); Value msg; print_static_errors_formatted(builtins, &msg); dump(&msg); } #endif // Load library paths from CIRCA_LIB_PATH const char* libPathEnv = getenv("CIRCA_LIB_PATH"); if (libPathEnv != NULL) { Value libPathStr; set_string(&libPathStr, libPathEnv); Value libPaths; string_split(&libPathStr, ';', &libPaths); for (int i=0; i < list_length(&libPaths); i++) { Value* path = list_get(&libPaths, i); if (string_equals(path, "")) continue; module_add_search_path(world, as_cstring(path)); } } log_msg(0, "finished circa_initialize"); world->bootstrapStatus = s_Done; return world; }
CIRCA_EXPORT caWorld* circa_initialize() { memset(&FUNCS, 0, sizeof(FUNCS)); memset(&TYPES, 0, sizeof(TYPES)); bootstrap_kernel(); caWorld* world = global_world(); Block* kernel = global_root_block(); // Make sure there are no static errors in the kernel. This shouldn't happen. if (has_static_errors(kernel)) { std::cout << "Static errors found in kernel:" << std::endl; print_static_errors_formatted(kernel, std::cout); internal_error("circa fatal: static errors found in kernel"); } // Load library paths from CIRCA_LIB_PATH const char* libPathEnv = getenv("CIRCA_LIB_PATH"); if (libPathEnv != NULL) { Value libPathStr; set_string(&libPathStr, libPathEnv); Value libPaths; string_split(&libPathStr, ';', &libPaths); for (int i=0; i < list_length(&libPaths); i++) { caValue* path = list_get(&libPaths, i); if (string_eq(path, "")) continue; module_add_search_path(world, as_cstring(path)); } } log_msg(0, "finished circa_initialize"); world->bootstrapStatus = sym_Done; return world; }