/***********************************************************************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 next codex method25* call with meth==0 to get the first method26* plugins are included in the list27*/2829#include <codex.h>30#include <dlldefs.h>3132Codexmeth_t*33codexlist(Codexmeth_t* meth)34{35register Codexmeth_t* lp;36Codexmeth_t* np;37Dllscan_t* dls;38Dllent_t* dle;39void* dll;40Codexlib_f lib;4142if (!meth)43return codexstate.first;44if (!meth->next && !codexstate.scanned)45{46codexstate.scanned = 1;47lp = meth;48if (dls = dllsopen(codexstate.id, NiL, NiL))49{50while (dle = dllsread(dls))51if (dll = dlopen(dle->path, RTLD_LAZY))52{53if ((lib = (Codexlib_f)dlllook(dll, "codex_lib")) && (np = (*lib)(dle->name)))54for (lp = lp->next = np; lp->next; lp = lp->next);55else56dlclose(dll);57}58else59message((-1, "%s: %s", dle->path, dlerror()));60dllsclose(dls);61}62}63return meth->next;64}656667