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

Diff of /m4/modules/perl.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 29  Line 29 
29    
30  #define m4_builtin_table        perl_LTX_m4_builtin_table  #define m4_builtin_table        perl_LTX_m4_builtin_table
31  #define m4_macro_table          perl_LTX_m4_macro_table  #define m4_macro_table          perl_LTX_m4_macro_table
 #define m4_init_module          perl_LTX_m4_init_module  
 #define m4_finish_module        perl_LTX_m4_finish_module  
   
 void m4_init_module     M4_PARAMS((struct obstack *obs));  
 void m4_finish_module   M4_PARAMS((void));  
32    
33  /*              function        macros  blind */  /*              function        macros  blind */
34  #define builtin_functions                       \  #define builtin_functions                       \
# Line 62  m4_macro m4_macro_table[] = Line 57  m4_macro m4_macro_table[] =
57    { 0, 0 },    { 0, 0 },
58  };  };
59    
60    
61    
62  static PerlInterpreter *my_perl;  static PerlInterpreter *my_perl;
63    
64  extern void xs_init (void);  extern void xs_init (void);
65    
66  void  M4INIT_HANDLER (perl)
 m4_init_module (struct obstack *obs)  
67  {  {
68      const lt_dlinfo *info = 0;
69    char *embedding[] = { "", "-e", "0" };    char *embedding[] = { "", "-e", "0" };
70    
71    my_perl = perl_alloc ();    if (handle)
72    perl_construct (my_perl);      info = lt_dlgetinfo (handle);
73    
74    perl_parse (my_perl, xs_init, 3, embedding, NULL);    /* Start up a perl parser, when loaded for the first time.  */
75    perl_run (my_perl);    if (info && (info->ref_count == 1))
76        {
77          my_perl = perl_alloc ();
78          perl_construct (my_perl);
79    
80          perl_parse (my_perl, xs_init, 3, embedding, NULL);
81          perl_run (my_perl);
82        }
83  }  }
84    
85  void  M4FINISH_HANDLER (perl)
 m4_finish_module(void)  
86  {  {
87    perl_destruct (my_perl);    const lt_dlinfo *info = 0;
88    perl_free (my_perl);  
89      if (handle)
90        info = lt_dlgetinfo (handle);
91    
92      /* Recycle the perl parser, when unloaded for the last time.  */
93      if (info && (info->ref_count == 1))
94        {
95          perl_destruct (my_perl);
96          perl_free (my_perl);
97        }
98  }  }
99    
100    

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