1 /*********************************************************************** 2 * * 3 * This software is part of the ast package * 4 * Copyright (c) 2003-2011 AT&T Intellectual Property * 5 * and is licensed under the * 6 * Eclipse Public License, Version 1.0 * 7 * by AT&T Intellectual Property * 8 * * 9 * A copy of the License is available at * 10 * http://www.eclipse.org/org/documents/epl-v10.html * 11 * (with md5 checksum b35adb5213ca9657e911e9befb180842) * 12 * * 13 * Information and Software Systems Research * 14 * AT&T Research * 15 * Florham Park NJ * 16 * * 17 * Glenn Fowler <gsf@research.att.com> * 18 * David Korn <dgk@research.att.com> * 19 * Phong Vo <kpv@research.att.com> * 20 * * 21 ***********************************************************************/ 22 #pragma prototyped 23 24 /* 25 * return the next codex method 26 * call with meth==0 to get the first method 27 * plugins are included in the list 28 */ 29 30 #include <codex.h> 31 #include <dlldefs.h> 32 33 Codexmeth_t* codexlist(Codexmeth_t * meth)34codexlist(Codexmeth_t* meth) 35 { 36 register Codexmeth_t* lp; 37 Codexmeth_t* np; 38 Dllscan_t* dls; 39 Dllent_t* dle; 40 void* dll; 41 Codexlib_f lib; 42 43 if (!meth) 44 return codexstate.first; 45 if (!meth->next && !codexstate.scanned) 46 { 47 codexstate.scanned = 1; 48 lp = meth; 49 if (dls = dllsopen(codexstate.id, NiL, NiL)) 50 { 51 while (dle = dllsread(dls)) 52 if (dll = dlopen(dle->path, RTLD_LAZY)) 53 { 54 if ((lib = (Codexlib_f)dlllook(dll, "codex_lib")) && (np = (*lib)(dle->name))) 55 for (lp = lp->next = np; lp->next; lp = lp->next); 56 else 57 dlclose(dll); 58 } 59 else 60 message((-1, "%s: %s", dle->path, dlerror())); 61 dllsclose(dls); 62 } 63 } 64 return meth->next; 65 } 66