/[m4]/m4/m4/builtin.c
ViewVC logotype

Diff of /m4/m4/builtin.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by gary, Tue Jun 17 15:17:45 2003 UTC revision 1.21 by gary, Tue Aug 12 15:33:56 2003 UTC
# Line 23  Line 23 
23  #include "m4.h"  #include "m4.h"
24  #include "m4private.h"  #include "m4private.h"
25    
26  /* Find the builtin, which has NAME.  If BP argument is supplied  /* Find the builtin which has NAME.  If HANDLE argument is supplied
27     then search only in table BP.  */     then search only in HANDLE's builtin table.  */
28  const m4_builtin *  const m4_builtin *
29  m4_builtin_find_by_name (const m4_builtin *bp, const char *name)  m4_builtin_find_by_name (lt_dlhandle handle, const char *name)
30  {  {
31    lt_dlhandle   handle  = NULL;    lt_dlhandle cur = handle ? handle : lt_dlhandle_next (0);
32    
33    while ((handle = lt_dlhandle_next (handle)))    do
34      {      {
35        m4_builtin *builtin = m4_get_module_builtin_table (handle);        const m4_builtin *builtin =
36            (const m4_builtin *) lt_dlsym (cur, BUILTIN_SYMBOL);
37    
38        if (builtin && (bp == NULL || bp == builtin))        if (builtin)
39          {          {
40            for (; builtin->name != NULL; builtin++)            for (; builtin->name != NULL; builtin++)
41              if (strcmp (builtin->name, name) == 0)              if (!strcmp (builtin->name, name))
42                return builtin;                return builtin;
43          }          }
44      }      }
45      while (!handle && (cur = lt_dlhandle_next (cur)));
46    
47    return NULL;    return 0;
48  }  }
49    
50    /* Find the builtin which has FUNC.  If HANDLE argument is supplied
51       then search only in HANDLE's builtin table.  */
52  const m4_builtin *  const m4_builtin *
53  m4_builtin_find_by_func (const m4_builtin *bp, m4_builtin_func *func)  m4_builtin_find_by_func (lt_dlhandle handle, m4_builtin_func *func)
54  {  {
55    lt_dlhandle   handle  = NULL;    lt_dlhandle cur = handle ? handle : lt_dlhandle_next (0);
56    
57    while ((handle = lt_dlhandle_next (handle)))    do
58      {      {
59        m4_builtin *builtin = m4_get_module_builtin_table (handle);        const m4_builtin *builtin =
60            (const m4_builtin *) lt_dlsym (cur, BUILTIN_SYMBOL);
61    
62        if (builtin && (bp == NULL || bp == builtin))        if (builtin)
63          {          {
64            for (; builtin->name != NULL; builtin++)            for (; builtin->name != NULL; builtin++)
65              if (builtin->func == func)              if (builtin->func == func)
66                return builtin;                return builtin;
67          }          }
68      }      }
69      while (!handle && (cur = lt_dlhandle_next (cur)));
70    
71    return NULL;    return 0;
72  }  }

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26