2 * (c) Oleg Puchinin 2007
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
);
19 char * __xml_project_name
;
21 EHash
* __compile_env
;
23 char xml_project_opt (DArray
* d_opts
, int * pos
)
28 if (! d_opts
|| ! pos
)
31 count
= d_opts
->get_size ();
32 S
= d_opts
->get (*pos
);
34 if (EQ (S
, "--xml-bin") ||
35 EQ (S
, "--xml-program")) {
36 if (++(*pos
) >= count
)
38 __xml_type
= "программа";
39 __xml_project_name
= d_opts
->get (*pos
);
43 if (EQ (S
, "--xml-shared")) {
44 if (++(*pos
) >= count
)
46 __xml_type
= "шаровая_лайба";
47 __xml_project_name
= d_opts
->get (*pos
);
56 printf ("\t<модуль имя=\"%s\" тип=\"%s\">\n", __xml_project_name
, __xml_type
);
57 printf ("\t<свойство CC=\"%s\" />\n", (*__compile_env
)["CC"]);
58 printf ("\t<свойство CXX=\"%s\" />\n", (*__compile_env
)["CXX"]);
59 printf ("\t<свойство OPTS=\"%s\" />\n", (*__compile_env
)["OPTS"]);
60 printf ("\t<свойство INCLUDE=\"%s\" />\n", (*__compile_env
)["INCLUDE"]);
61 printf ("\t<свойство LIBS=\"%s\" />\n", (*__compile_env
)["LIBS"]);
62 printf ("\t<свойство LDFLAGS=\"%s\" />\n", (*__compile_env
)["LDFLAGS"]);
64 printf ("\t<исходники>\n");
65 for (int i
= 0; i
< ENV
->d_files
->get_size (); ++i
)
66 printf ("\t\t<файл имя=\"%s\" />\n", ENV
->d_files
->get (i
));
67 printf ("\t</исходники>\n");
68 printf ("\t</модуль>\n");
71 char xml_project_opt2 (DArray
* d_opts
, int * pos
)
75 if (! d_opts
|| ! pos
)
78 S
= d_opts
->get (*pos
);
79 if (EQ (S
, "--xml-bin") ||
80 EQ (S
, "--xml-program") ||
81 EQ (S
, "--xml-shared")) {
82 __compile_env
= bob_init_compile_env ();
90 void xml_project_short_info ()
92 printf ("XML Project.");
95 void xml_project_long_info ()
97 printf ("XML Project.\n");
98 printf ("Version: 1.0\n");
99 printf ("options: --xml-project --xml-bin --xml-shared\n");
102 DArray
* plugin_init (struct env_t
*env
)
105 struct mod_feature
* pm
;
108 Ret
= new DArray (1);
109 pm
= CNEW (mod_feature
, 1);
110 memset (pm
, 0, sizeof (mod_feature
));
111 pm
->mod
.Type
= TYPE_FEATURE
;
112 pm
->mod
.Version
= strdup ("1.0");
113 pm
->mod
.short_info
= xml_project_short_info
;
114 pm
->mod
.long_info
= xml_project_long_info
;
115 pm
->opt
= xml_project_opt
;
116 pm
->opt2
= xml_project_opt2
;
118 Ret
->add (LPCHAR (pm
));