/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 2003-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* Phong Vo <[email protected]> *19* *20***********************************************************************/21#pragma prototyped2223/*24* return the codex method for name25*/2627#include <codex.h>28#include <dlldefs.h>2930Codexmeth_t*31codexmeth(const char* name)32{33register Codexmeth_t* meth;34register const char* s;35register const char* t;36Codexmeth_t* last;37void* dll;38int plugin;39Codexlib_f lib;40char tmp[CODEX_NAME];4142if (!name)43return CODEXERROR->meth;44plugin = 0;45meth = codexstate.first;46while (meth)47{48if (!codexcmp(name, meth->name))49return meth;50last = meth;51if (!(meth = meth->next) && !plugin)52{53plugin = 1;54for (s = name, t = 0; *s && *s != '+'; s++)55if (*s == '-')56{57if (t)58break;59t = s;60}61do62{63sfsprintf(tmp, sizeof(tmp), "%-.*s", s - name, name);64if (dll = dllplug("codex", tmp, NiL, RTLD_LAZY, NiL, 0))65{66if ((lib = (Codexlib_f)dlllook(dll, "codex_lib")) && (meth = (*lib)(name)))67last->next = meth;68break;69}70} while (s != t && (s = t));71}72}73return meth;74}757677