/[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.18 by gary, Mon Jun 16 10:43:45 2003 UTC revision 1.19 by gary, Mon Jun 16 16:29:06 2003 UTC
# Line 38  m4_builtin_find_by_name (const m4_builti Line 38  m4_builtin_find_by_name (const m4_builti
38    
39    while ((handle = lt_dlhandle_next (handle)))    while ((handle = lt_dlhandle_next (handle)))
40      {      {
41        m4_builtin *builtin = m4_module_builtins (handle);        m4_builtin *builtin = m4_get_module_builtin_table (handle);
42    
43        if (builtin && (bp == NULL || bp == builtin))        if (builtin && (bp == NULL || bp == builtin))
44          {          {
# Line 58  m4_builtin_find_by_func (const m4_builti Line 58  m4_builtin_find_by_func (const m4_builti
58    
59    while ((handle = lt_dlhandle_next (handle)))    while ((handle = lt_dlhandle_next (handle)))
60      {      {
61        m4_builtin *builtin = m4_module_builtins (handle);        m4_builtin *builtin = m4_get_module_builtin_table (handle);
62    
63        if (builtin && (bp == NULL || bp == builtin))        if (builtin && (bp == NULL || bp == builtin))
64          {          {
# Line 198  m4_arg_signature_parse (const char *name Line 198  m4_arg_signature_parse (const char *name
198    
199    return arg_signature;    return arg_signature;
200  }  }
   
 void  
 m4_builtin_table_install (m4 *context, lt_dlhandle handle,  
                           const m4_builtin *table)  
 {  
   const m4_builtin *bp;  
   m4_token token;  
   
   assert (handle);  
   assert (table);  
   
   bzero (&token, sizeof (m4_token));  
   TOKEN_TYPE (&token)           = M4_TOKEN_FUNC;  
   TOKEN_HANDLE (&token)         = handle;  
   
   for (bp = table; bp->name != NULL; bp++)  
     {  
       int flags = 0;  
       char *name;  
   
       if (prefix_all_builtins)  
         {  
           static const char prefix[] = "m4_";  
           size_t len = strlen (prefix) + strlen (bp->name);  
   
           name = (char *) xmalloc (1+ len);  
           snprintf (name, 1+ len, "%s%s", prefix, bp->name);  
         }  
       else  
         name = (char *) bp->name;  
   
       if (bp->groks_macro_args) BIT_SET (flags, TOKEN_MACRO_ARGS_BIT);  
       if (bp->blind_if_no_args) BIT_SET (flags, TOKEN_BLIND_ARGS_BIT);  
   
       TOKEN_FUNC (&token)       = bp->func;  
       TOKEN_FLAGS (&token)      = flags;  
       TOKEN_MIN_ARGS (&token)   = bp->min_args;  
       TOKEN_MAX_ARGS (&token)   = bp->max_args;  
   
       m4_builtin_pushdef (context, name, &token);  
   
       if (prefix_all_builtins)  
         xfree (name);  
     }  
 }  
   
 void  
 m4_macro_table_install (m4 *context, lt_dlhandle handle, const m4_macro *table)  
 {  
   const m4_macro *mp;  
   m4_token token;  
   
   bzero (&token, sizeof (m4_token));  
   TOKEN_TYPE (&token)           = M4_TOKEN_TEXT;  
   TOKEN_HANDLE (&token)         = handle;  
   
   for (mp = table; mp->name != NULL; mp++)  
     {  
       TOKEN_TEXT (&token)       = (char *) mp->value;  
       m4_macro_pushdef (context, mp->name, &token);  
     }  
 }  

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

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