/** * updates compiler with the module's keywords */ void slib_setup_comp(int mid) { #if defined(LNX_EXTLIB) || defined(WIN_EXTLIB) int i; for (i = 0; i < extproccount; i++) { if (extproctable[i].lib_id == mid) { comp_add_external_proc(extproctable[i].name, mid); } } for (i = 0; i < extfunccount; i++) { if (extfunctable[i].lib_id == mid) { comp_add_external_func(extfunctable[i].name, mid); } } #endif }
/** * imports unit's names * * @param uid unit's handle * @return 0 on success */ int import_unit(int uid) { char buf[SB_KEYWORD_SIZE + 1];int i; if (uid >= 0) { unit_t *u; u = &units[uid]; if (u->status == unit_loaded) { for (i = 0; i < u->hdr.sym_count; i++) { // build the name // with any path component removed from the name char *dir_sep = strrchr(u->hdr.base, OS_DIRSEP); sprintf(buf, "%s.%s", dir_sep ? dir_sep + 1 : u->hdr.base, u->symbols[i].symbol); switch (u->symbols[i].type) { case stt_function: comp_add_external_func(buf, uid | UID_UNIT_BIT); break; case stt_procedure: comp_add_external_proc(buf, uid | UID_UNIT_BIT); break; case stt_variable: comp_add_external_var(buf, uid | UID_UNIT_BIT); break; }; } } else { return -2; } } else { return -1; } return 0; }