📄 search.c
字号:
/* *---------------------------------------------------------------------- * T-Kernel / Standard Extension * * Copyright (C) 2006 by Ken Sakamura. All rights reserved. * T-Kernel / Standard Extension is distributed * under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * * Version: 1.00.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* * @(#)search.c (libdl) * * DLL support library * Shared object search */#include "libdl.h"#include <tcode.h>#define TM_DEBUG(s)/* * Standard library file */LOCAL TC STDLIB[] = { TC_FDLM, TK_S, TK_Y, TK_S, TC_FDLM, TK_l, TK_i, TK_b, TNULL };/* * Search of the shared object file * Return the "LINK" to "ink" after searching of the library file(shared object file) specified at "path". * Search the location specified at "mode" when "path" is the relative path specification. * * mode = [DL_BASE] | [DL_WORK] | [DL_PROC] | [DL_STDLIB] * * DL_BASE (0x08) The file specified at "lnk" * DL_WORK (0x04) Current working file * DL_PROC (0x02) The invoking process program file * DL_STDLIB (0x01) Standard library file /SYS/lib * * Search in this order (DL_BASE -> DL_STDLIB) * * Also, search is done according to the file name only. No concern with the content of the file. * Return "E_NOEXS" when file is not found. */EXPORT ER tkse_dlsearch( TC *path, LINK *lnk, W mode ){static W order[] = { DL_BASE, DL_WORK, DL_PROC, DL_STDLIB }; LINK slnk; W smode, i; ER err; TM_DEBUG("tkse_dlsearch() entry\n"); if ( path[0] == TC_FDLM ) { TM_DEBUG("tkse_dlsearch() 1\n"); /* Absolute pass specification */ err = tkse_get_lnk(path, lnk, F_NORM); if ( err < E_OK ) { goto err_ret; } return E_OK; } /* Relative path specification */ TM_DEBUG("tkse_dlsearch() 2\n"); err = E_PAR; for ( i = 0; i < (W)(sizeof(order)/sizeof(W)); ++i ) { switch ( mode & order[i] ) { case DL_BASE: /* Search "lnk" */ TM_DEBUG("tkse_dlsearch() 3\n"); slnk = *lnk; smode = F_BASED; break; case DL_WORK: /* Search the current working file */ TM_DEBUG("tkse_dlsearch() 4\n"); smode = F_NORM; break; case DL_PROC: /* Search the invoking program file */ TM_DEBUG("tkse_dlsearch() 5\n"); err = tkse_prc_inf(0, PI_LINK, &slnk, sizeof(slnk)); if ( err < E_OK ) { goto err_ret; } smode = F_BASED; break; case DL_STDLIB: /* Search the standard library file */ TM_DEBUG("tkse_dlsearch() 6\n"); err = tkse_get_lnk(STDLIB, &slnk, F_NORM); if ( err < E_OK ) { goto err_ret; } smode = F_BASED; break; default: TM_DEBUG("tkse_dlsearch() 7\n"); continue; } TM_DEBUG("tkse_dlsearch() 8\n"); TM_DEBUG(path); err = tkse_get_lnk(path, &slnk, smode); if ( err >= 0 ) { break; } } TM_DEBUG("tkse_dlsearch() 9\n"); if ( err < E_OK ) { goto err_ret; } *lnk = slnk; return E_OK;err_ret: DEBUG_PRINT(("tkse_dlsearch err = %d\n", err)); return err;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -