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

Diff of /m4/modules/m4.c

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

revision 1.7 by akim, Tue Aug 7 10:41:11 2001 UTC revision 1.8 by gary, Thu Aug 16 22:21:30 2001 UTC
# Line 42  extern int errno; Line 42  extern int errno;
42    
43  /* Rename exported symbols for dlpreload()ing.  */  /* Rename exported symbols for dlpreload()ing.  */
44  #define m4_builtin_table        m4_LTX_m4_builtin_table  #define m4_builtin_table        m4_LTX_m4_builtin_table
 #define m4_resident_module      m4_LTX_m4_resident_module  
45    
46  /* Maintain each of the builtins implemented in this modules along  /* Maintain each of the builtins implemented in this modules along
47     with their details in a single table for easy maintenance.     with their details in a single table for easy maintenance.
# Line 99  m4_builtin m4_builtin_table[] = Line 98  m4_builtin m4_builtin_table[] =
98    { 0, 0, FALSE, FALSE },    { 0, 0, FALSE, FALSE },
99  };  };
100    
101    
102    
103  /* This module cannot be safely unloaded from memory, incase the unload  /* This module cannot be safely unloaded from memory, incase the unload
104     is triggered by m4exit, and the module is removed while m4exit is in     is triggered by m4exit, and the module is removed while m4exit is in
105     progress.  */     progress.  */
106  boolean m4_resident_module = TRUE;  M4INIT_HANDLER (m4)
107    {
108      if (handle)
109        if (lt_dlmakeresident (handle) != 0)
110          {
111            M4ERROR ((warning_status, 0,
112                      _("Warning: cannot make module `%s' resident: %s"),
113                      m4_module_name (handle), lt_dlerror ()));
114          }
115    }
116    
117    
118    
119  /* The rest of this file is code for builtins and expansion of user  /* The rest of this file is code for builtins and expansion of user
120     defined macros.  All the functions for builtins have a prototype as:     defined macros.  All the functions for builtins have a prototype as:
121    
122          void m4_MACRONAME (struct obstack *obs, int argc, char *argv[]);          void builtin_MACRONAME (struct obstack *obs, int argc, char *argv[]);
123    
124     The function are expected to leave their expansion on the obstack OBS,     The function are expected to leave their expansion on the obstack OBS,
125     as an unfinished object.  ARGV is a table of ARGC pointers to the     as an unfinished object.  ARGV is a table of ARGC pointers to the
# Line 129  macro_install (argc, argv, mode) Line 139  macro_install (argc, argv, mode)
139       m4_token_data **argv;       m4_token_data **argv;
140       m4_symbol_lookup mode;       m4_symbol_lookup mode;
141  {  {
   const m4_builtin *bp;  
   
142    if (m4_bad_argc (argv[0], argc, 2, 3))    if (m4_bad_argc (argv[0], argc, 2, 3))
143      return;      return;
144    
# Line 150  macro_install (argc, argv, mode) Line 158  macro_install (argc, argv, mode)
158        break;        break;
159    
160      case M4_TOKEN_FUNC:      case M4_TOKEN_FUNC:
161        bp = m4_builtin_find_by_func (NULL, M4_TOKEN_DATA_FUNC (argv[2]));        {
162        if (bp)          lt_dlhandle  handle  = M4_TOKEN_DATA_HANDLE (argv[2]);
163          m4_builtin_define (NULL, M4ARG (1), bp, mode,          const m4_builtin  *builtin = 0;
164    
165            /* If we find a TOKEN_FUNC with no defining module, then
166               somewhere along the way we have lost the module handle.  */
167            assert (handle);
168    
169            builtin = m4_builtin_find_by_func (m4_module_builtins (handle),
170                                               M4_TOKEN_DATA_FUNC (argv[2]));
171    
172            m4_builtin_define (handle, M4ARG (1), builtin, mode,
173                             M4_TOKEN_DATA_FUNC_TRACED (argv[2]));                             M4_TOKEN_DATA_FUNC_TRACED (argv[2]));
174          }
175        break;        break;
176    
177      default:      default:
# Line 326  M4BUILTIN_HANDLER (defn) Line 344  M4BUILTIN_HANDLER (defn)
344        break;        break;
345    
346      case M4_TOKEN_FUNC:      case M4_TOKEN_FUNC:
347        m4_push_macro (SYMBOL_FUNC (symbol), SYMBOL_TRACED (symbol));        m4_push_macro (SYMBOL_FUNC (symbol), SYMBOL_HANDLE (symbol),
348                         SYMBOL_TRACED (symbol));
349        break;        break;
350    
351      case M4_TOKEN_VOID:      case M4_TOKEN_VOID:
# Line 626  M4BUILTIN_HANDLER (m4exit) Line 645  M4BUILTIN_HANDLER (m4exit)
645    if (argc == 2  && !m4_numeric_arg (argv[0], M4ARG (1), &exit_code))    if (argc == 2  && !m4_numeric_arg (argv[0], M4ARG (1), &exit_code))
646      exit_code = 0;      exit_code = 0;
647    
648    m4_module_unload_all();    m4_module_close_all (obs);
649    
650    exit (exit_code);    exit (exit_code);
651  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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