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

Diff of /m4/modules/load.c

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

revision 1.5 by akim, Tue Aug 7 10:41:11 2001 UTC revision 1.6 by gary, Thu Aug 16 22:21:30 2001 UTC
# Line 27  Line 27 
27  /* Rename exported symbols for dlpreload()ing.  */  /* Rename exported symbols for dlpreload()ing.  */
28  #define m4_builtin_table        load_LTX_m4_builtin_table  #define m4_builtin_table        load_LTX_m4_builtin_table
29  #define m4_macro_table          load_LTX_m4_macro_table  #define m4_macro_table          load_LTX_m4_macro_table
 #define m4_resident_module      load_LTX_m4_resident_module  
30    
31    
32  /* Maintain each of the builtins implemented in this modules along  /* Maintain each of the builtins implemented in this modules along
# Line 66  m4_macro m4_macro_table[] = Line 65  m4_macro m4_macro_table[] =
65    { 0, 0 },    { 0, 0 },
66  };  };
67    
68    
69  /* This module cannot be safely unloaded from memory, incase the unload  /* This module cannot be safely unloaded from memory, incase the unload
70     is triggered by the unload builtin, and the module is removed while     is triggered by the unload builtin, and the module is removed while
71     unload is in progress.  */     unload is in progress.  */
72  boolean m4_resident_module = TRUE;  M4INIT_HANDLER (load)
73    {
74      if (handle)
75        if (lt_dlmakeresident (handle) != 0)
76          {
77            M4ERROR ((warning_status, 0,
78                      _("Warning: cannot make module `%s' resident: %s"),
79                      m4_module_name (handle), lt_dlerror ()));
80          }
81    }
82    
83    
84    
# Line 83  boolean m4_resident_module = TRUE; Line 92  boolean m4_resident_module = TRUE;
92     loaded modules.  */     loaded modules.  */
93  M4BUILTIN_HANDLER (modules)  M4BUILTIN_HANDLER (modules)
94  {  {
95    List *p = m4_modules;    lt_dlhandle handle = lt_dlhandle_next (NULL);
96    
97    if (m4_bad_argc (argv[0], argc, 1, 1))    if (m4_bad_argc (argv[0], argc, 1, 1))
98      return;      return;
99    
100    while (p)    if (handle)
101      {      do
102        m4_shipout_string (obs, m4_module_name ((m4_module *) p), 0, TRUE);        {
103        p = LIST_NEXT (p);          m4_shipout_string (obs, m4_module_name (handle), 0, TRUE);
104    
105        if (p)          if ((handle = lt_dlhandle_next (handle)))
106          obstack_1grow (obs, ',');            obstack_1grow (obs, ',');
107      }        }
108        while (handle);
109  }  }
110    
111  /* Load the named module and install the builtins and macros  /* Load the named module and install the builtins and macros
112     exported by that module.  */     exported by that module.  */
113  M4BUILTIN_HANDLER (load)  M4BUILTIN_HANDLER (load)
114  {  {
   const m4_module *module;  
   
115    if (m4_bad_argc (argv[0], argc, 2, 2))    if (m4_bad_argc (argv[0], argc, 2, 2))
116      return;      return;
117    
118    module = m4_module_load (M4ARG(1), obs);    m4_module_load (M4ARG(1), obs);
   
   if (module && module->ref_count == 1)  
     {  
       const m4_builtin *bp      = m4_module_builtins (module);  
       const m4_macro *mp        = m4_module_macros (module);  
   
       /* Install the builtin functions.  */  
       if (bp)  
         m4_builtin_table_install (module, bp);  
   
       /* Install the user macros. */  
       if (mp)  
         m4_macro_table_install (module, mp);  
     }  
119  }  }
120    
121  /* Remove all builtins and macros installed by the named module,  /* Remove all builtins and macros installed by the named module,

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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