1 # Copyright (C) 2006-2016 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # This awk program generates the catalog for C++ components
24 # file name generation
25 catalog_file="catalog.xml"
26 print "<?xml version='1.0' encoding='us-ascii' ?>\n" > catalog_file
28 print "<!-- XML component catalog -->\n"\
30 " <component-list>" >> catalog_file
32 print " <component>\n"\
33 " <component-name>"class_name"</component-name>\n"\
34 " <component-username>"class_name"</component-username>\n"\
35 " <component-type>Solver</component-type>\n"\
36 " <component-author>""</component-author>\n"\
37 " <component-version>1.0</component-version>\n"\
38 " <component-comment></component-comment>\n"\
39 " <component-multistudy>1</component-multistudy>\n"\
40 " <component-icone>"class_name".png</component-icone>\n"\
41 " <component-impltype>1</component-impltype>\n"\
42 " <component-interface-list>" >> catalog_file
44 print " <component-interface-name>"class_name"</component-interface-name>\n"\
45 " <component-interface-comment>No comment</component-interface-comment>\n"\
46 " <component-service-list>"\
52 type_arg["int"]= type_in
53 type_arg["double"]= type_in
54 type_arg["float"]= type_in
55 type_arg["long"]= type_in
56 type_arg["short"]= type_in
57 type_arg["unsigned"]= type_in
58 type_arg["const char*"]= type_in
59 type_arg["const std::string&"]= type_in
60 type_arg["const std::vector<double>&"]= type_in
62 type_arg["int&"]= type_out
63 type_arg["double&"]= type_out
64 type_arg["float&"]= type_out
65 type_arg["long&"]= type_out
66 type_arg["short&"]= type_out
67 type_arg["unsigned&"]= type_out
68 type_arg["std::string&"]= type_out
69 type_arg["std::vector<double>&"]= type_out
73 # record sep is ");\n" whith blanks all around, and optional "(" at the beginning
74 RS="[(]?[ ]*[)][ ]*;[ ]*\n?"
75 FS="[ ]*[(,][ ]*" # field sep is either "(" or "," surrounded by blanks
78 # --------------------- treatment 1 ----------------------------------
80 # extract from fields types, function name, and argument's names
83 nitems = split($0, items);
84 for (i=1; i<=nitems; i++) {
85 split(items[i], j, " ");
86 l=0; for (k in j) {l++;}
88 for (ll=2; ll<l; ll++) k=k " " j[ll];
94 print " <component-service>\n"\
95 " <service-name>"name[1]"</service_name>\n"\
96 " <service-author></service-author>\n"\
97 " <service-version></service-version>\n"\
98 " <service-comment></service-comment>\n"\
99 " <service-by-default>0</service-by-default>\n"\
102 print " <inParameter-list>" >> catalog_file
103 for (i=2; i<=nitems; i++)
104 if (way[i] == type_in) {
105 print " <inParameter>\n"\
106 " <inParameter-name>"name[i]"</inParameter-name>\n"\
107 " <inParameter-type>"type[i]"</inParameter-type>\n"\
108 " <inParameter-comment></inParameter-comment>\n"\
109 " </inParameter>" >> catalog_file
111 print " <inParameter-list>\n" >> catalog_file
113 print " <outParameter-list>" >> catalog_file
115 if (type[1] != "void")
116 print " <outParameter>\n"\
117 " <outParameter-name>return</outParameter-name>\n"\
118 " <outParameter-type>"type[1]"</outParameter-type>\n"\
119 " <outParameter-comment></outParameter-comment>\n"\
120 " </outParameter>" >> catalog_file
122 for (i=2; i<=nitems; i++)
123 if (way[i] == type_out) {
124 print " <outParameter>\n"\
125 " <outParameter-name>"name[i]"</outParameter-name>\n"\
126 " <outParameter-type>"type[i]"</outParameter-type>\n"\
127 " <outParameter-comment></outParameter-comment>\n"\
128 " </outParameter>" >> catalog_file
130 print " <outParameter-list>\n" >> catalog_file
132 print " </component-service>\n" >> catalog_file
136 print " </component-service-list>\n"\
137 " </component-interface-list>\n"\
139 " </component-list>\n"\
140 "</begin-catalog>" >> catalog_file