int lkaddr(void *addr, int margin) { if (!margin) margin=5; cexpSymLkAddr(addr, margin, stdout, 0); return 0; }
/* currently, we have only very rudimentary support; just enough * for 'HELP' */ static char * symHelp(CexpTypedVal returnVal, CexpSym sym, va_list ap) { CexpTypedVal v; char *newhelp=0; int verbose=0; returnVal->type=TUCharP; returnVal->tv.p=sym->help; if ((v=va_arg(ap,CexpTypedVal))) { switch (v->type) { case TUCharP: newhelp = v->tv.p; break; case TUInt: verbose = v->tv.i; break; case TULong: verbose = v->tv.l; break; default: return "Cexp Help: Warning, invalid argument"; } } if (newhelp) { if (sym->flags & CEXP_SYMFLG_MALLOC_HELP) free(sym->help); #if defined(CONFIG_STRINGS_LIVE_FOREVER) && 0 /* might come from another module; we better make a copy */ /* the help storage is probably an 'eternal' string */ sym->help=newhelp; #else sym->help=strdup(newhelp); sym->flags |= CEXP_SYMFLG_MALLOC_HELP; #endif } else { if (verbose || !sym->help) { CexpSym s; CexpModule m; if ((s=cexpSymLkAddr(sym->value.ptv,0,0,&m)) && s==sym && m) { fprintf(stdout,"In module %s:\n",cexpModuleName(m)); } else if ((s=cexpVarLookup(sym->name,0)) && s==sym) { fprintf(stdout,"User Variable:\n"); } cexpSymPrintInfo(sym,stdout); } if (sym->help) fprintf(stdout,"%s\n",sym->help); else fprintf(stdout,"No help available\n"); } return 0; }