2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
11 #include <gclib/gclib.h>
16 #include <the_fly.hpp>
18 extern "C" DArray
* plugin_init (struct env_t
*env
);
19 char t_op2 (char ** d_in
, char ** d_prev
);
21 void __perl_files (char * f_name
)
24 sblib_find ("./", "*.pm", f_name
);
25 sblib_find ("./", "*.pl", f_name
);
26 sblib_find ("./", "*.ph", f_name
);
29 void plpkg_one (struct tt_state_t
* tt
)
31 char * d_out
, *d_ptr
; // for t_op2
40 ch
= t_op2 (&d_ptr
, &d_out
);
48 if (! block_depth
&& !strncmp (S
, "package ", 8))
66 struct tt_state_t
* tt
;
69 d_files
= ENV
->d_files
;
70 if (d_files
->get_size () == 0) {
71 __perl_files (ENV
->tmp_files
);
72 d_files
->from_file (ENV
->tmp_files
);
73 d_files
->foreach ((Dfunc_t
)chomp
);
74 unlink (ENV
->tmp_files
);
77 for (i
= 0; i
< d_files
->get_size (); i
++) {
78 tt
= CNEW (tt_state_t
, 1);
80 memset (tt
, 0, sizeof (struct tt_state_t
));
81 if (! d_files
->get (i
))
84 tt
->fileName
= strdup (d_files
->get (i
));
85 THE_FLY::fly_for_file (tt
);
91 char pl_opt (DArray
* d_opts
, int * i
)
96 if (EQ (d_opts
->get (*i
), "--packages")) {
97 if (EQ (ENV
->language
, "Perl")) {
106 void plug_short_info ()
108 printf ("Perl packages.");
111 void plug_long_info ()
113 printf ("Perl packages.\n");
114 printf ("Version: 1.0\n");
115 printf ("options: --perl --packages\n");
118 DArray
* plugin_init (struct env_t
* env
)
124 Ret
= new DArray (32);
125 plug
= CNEW (mod_t
, 1);
126 memset (plug
, 0, sizeof (mod_t
));
127 plug
->Version
= strdup ("1.0");
128 plug
->short_info
= plug_short_info
;
129 plug
->long_info
= plug_long_info
;
132 ENV
->listOptions
->add ("--packages");
133 ENV
->listOptions
->add ("--perl");
135 Ret
->add (LPCHAR (plug
));