3 # Script to generate $C_FILE
8 #MINUS_e=X`$ECHO -n -e`
9 #if [ $MINUS_e != "X" ] ; then
15 #MINUS_E=X`$ECHO -n -E`
16 #if [ $MINUS_E != "X" ] ; then
24 C_FILE="$CUR_DIR/modules_init.c"
25 H_FILE="$CUR_DIR/modules_init.h"
26 MOD_FILE="$CUR_DIR/Make_modules"
27 SRC_FILE="$CUR_DIR/Make_sources"
28 U_FILE="$CUR_DIR/modules_upgrade.c"
30 /usr/bin/printf "Scanning extension modules for entry points.\n"
33 #start of the files which inturn removes any existing file
36 # start the Makefile included file for $SERV_MODULES
40 # This file is to be included by Makefile to dynamically add modules to the build process
41 # THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE
46 # start the Makefile included file for $SOURCES
50 # This file is to be included by Makefile to dynamically add modules to the build process
51 # THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE
56 # start the upgrade file
60 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
70 #include <sys/types.h>
73 #include "modules_init.h"
74 #include "sysdep_decls.h"
79 void upgrade_modules (void)
82 CtdlLogPrintf (CTDL_INFO, "Upgrade modules.\n");
90 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
100 #include <sys/types.h>
103 #include "modules_init.h"
104 #include "sysdep_decls.h"
107 void LogPrintMessages(long err);
108 extern long DetailErrorFlags;
112 void initialise_modules (int threading)
118 CtdlLogPrintf (CTDL_INFO, "Initialise modules, CtdlThreads enabled.\n");
120 CtdlLogPrintf (CTDL_INFO, "Initialise modules, CtdlThreads not yet enabled.\n");
124 #start the header file
128 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
132 #ifndef MODULES_INIT_H
133 #define MODULES_INIT_H
134 #include "ctdl_module.h"
135 extern size_t nSizErrmsg;
136 void initialise_modules (int threading);
137 void upgrade_modules(void);
142 RES=X`grep CTDL_MODULE_INIT $i | cut -f2 -d\( | cut -f1 -d\)`
143 if [ $RES != "X" ] ; then
144 RES_OUT=`echo $RES | cut -b2-`
145 /usr/bin/printf "Found entry point in file $i\n"
147 lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
151 CTDL_MODULE_INIT($RES_OUT);
154 RES=X`grep CTDL_MODULE_UPGRADE $i | cut -f2 -d\( | cut -f1 -d\)`
155 if [ $RES != "X" ] ; then
156 RES_OUT=`echo $RES | cut -b2-`
157 /usr/bin/printf "Found upgrade point in file $i\n"
159 lprintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
163 CTDL_MODULE_UPGRADE($RES_OUT);
169 if [ -d "modules" ] ; then
177 if [ -f "$k" ] ; then
178 # Add this .c file to the Makefile included list of SOURCES
179 cat <<EOF >> $SRC_FILE
180 SOURCES += modules/$j/$k
183 # Generate a .o file name
184 O_FILE=`basename $k .c`
186 # Add this .o file to the Makefile included list of SERV_MODULES
187 cat <<EOF >> $MOD_FILE
188 SERV_MODULES += modules/$j/$O_FILE
191 RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
192 if [ $RES != "X" ] ; then
193 RES_OUT=`echo $RES | cut -b2-`
194 /usr/bin/printf "Found entry point in file modules/$j/$k\n"
195 # Add this entry point to the .c file
197 lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
199 # Add this entry point to the .h file
201 CTDL_MODULE_INIT($RES_OUT);
204 RES=X`grep CTDL_MODULE_UPGRADE $k | cut -f2 -d\( | cut -f1 -d\)`
205 if [ $RES != "X" ] ; then
206 RES_OUT=`echo $RES | cut -b2-`
207 /usr/bin/printf "Found upgrade point in file modules/$j/$k\n"
208 # Add this entry point to the .c file
210 lprintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
212 # Add this entry point to the .h file
214 CTDL_MODULE_UPGRADE($RES_OUT);
226 if [ -d "user_modules" ] ; then
234 if [ -f "$k" ] ; then
235 # Add this .c file to the Makefile included list of SOURCES
236 cat <<EOF >> $SRC_FILE
237 SOURCES=\$(SOURCES) user_modules/$j/$k
240 # Generate a .o file name
241 O_FILE=`basename $k .c`
243 # Add this .o file to the Makefile included list of SERV_MODULES
244 cat <<EOF >> $MOD_FILE
245 SERV_MODULES += user_modules/$j/$O_FILE
248 RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
249 if [ $RES != "X" ] ; then
250 RES_OUT=`echo $RES | cut -b2-`
251 /usr/bin/printf "Found entry point in file user_modules/$j/$k\n"
253 lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
256 CTDL_MODULE_INIT($RES_OUT);
259 RES=X`grep CTDL_MODULE_UPGRADE $k | cut -f2 -d\( | cut -f1 -d\)`
260 if [ $RES != "X" ] ; then
261 RES_OUT=`echo $RES | cut -b2-`
262 /usr/bin/printf "Found upgrade point in file user_modules/$j/$k\n"
264 lprintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
267 CTDL_MODULE_UPGRADE($RES_OUT);
279 /usr/bin/printf "\n\n" >> $C_FILE
280 /usr/bin/printf "\tfor (filter = 1; filter != 0; filter = filter << 1)\n" >> $C_FILE
281 /usr/bin/printf "\t\tif ((filter & DetailErrorFlags) != 0)\n" >> $C_FILE
282 /usr/bin/printf "\t\t\tLogPrintMessages(filter);\n" >> $C_FILE
283 /usr/bin/printf "}\n" >> $C_FILE
285 #close the upgrade file
286 /usr/bin/printf "}\n" >> $U_FILE
288 /usr/bin/printf "\n#endif /* MODULES_INIT_H */\n" >> $H_FILE