2 * (c) Oleg Puchinin 2008
3 * graycardinalster@gmail.com
11 #include <gclib/gclib.h>
12 #include <gclib/gclib_c.h>
17 extern "C" DArray
* plugin_init (struct env_t
*env
);
20 void ruby_create_class (int pos
)
27 className
= ENV
->d_opts
->get (pos
);
31 printf ("class %s\n\n", className
);
32 printf ("\tdef initialize\n\tend\n\n");
35 size
= ENV
->d_opts
->get_size ();
36 for (; pos
< size
; ++pos
) {
37 S
= ENV
->d_opts
->get (pos
);
38 printf ("\tdef %s\n", S
);
44 char ruby_opt (DArray
* d_opts
, int * pos
)
46 if (! d_opts
|| ! pos
)
49 if (EQ (ENV
->language
, "Ruby") && (EQ(d_opts
->get (*pos
), "--new-class")
50 || EQ(d_opts
->get (*pos
), "-nc"))) {
51 ruby_create_class (*pos
);
58 void ruby_short_info ()
60 printf ("Ruby new class plugin.");
63 void ruby_long_info ()
65 printf ("Ruby new class plugin.\n");
66 printf ("Version: 1.0\n");
67 printf ("options: --ruby --new-class\n");
68 printf ("Usage: bob --ruby --new-class <classname> <class functions>\n");
71 DArray
* plugin_init (struct env_t
*env
)
77 plug
= CNEW (mod_t
, 1);
78 memset (plug
, 0, sizeof (mod_t
));
80 plug
->Version
= strdup ("1.0");
81 plug
->short_info
= ruby_short_info
;
82 plug
->long_info
= ruby_long_info
;
85 ENV
->listOptions
->add ("--new-class");
86 ENV
->listOptions
->add ("-nc");
88 Ret
->add (LPCHAR (plug
));