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
71 #include <sys/types.h>
73 #include <libcitadel.h>
75 #include "modules_init.h"
76 #include "sysdep_decls.h"
81 void upgrade_modules (void)
84 CtdlLogPrintf (CTDL_INFO, "Upgrade modules.\n");
92 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
102 #include <sys/types.h>
104 #include <libcitadel.h>
106 #include "modules_init.h"
107 #include "sysdep_decls.h"
110 void LogPrintMessages(long err);
111 extern long DetailErrorFlags;
115 void initialise_modules (int threading)
121 CtdlLogPrintf (CTDL_INFO, "Initialise modules, CtdlThreads enabled.\n");
123 CtdlLogPrintf (CTDL_INFO, "Initialise modules, CtdlThreads not yet enabled.\n");
127 #start the header file
131 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
135 #ifndef MODULES_INIT_H
136 #define MODULES_INIT_H
137 #include "ctdl_module.h"
138 extern size_t nSizErrmsg;
139 void initialise_modules (int threading);
140 void upgrade_modules(void);
145 RES
=X
`grep CTDL_MODULE_INIT $i | cut -f2 -d\( | cut -f1 -d\)`
146 if [ $RES != "X" ] ; then
147 RES_OUT
=`echo $RES | cut -b2-`
148 /usr
/bin
/printf "Found entry point in file $i\n"
150 CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
154 CTDL_MODULE_INIT($RES_OUT);
157 RES
=X
`grep CTDL_MODULE_UPGRADE $i | cut -f2 -d\( | cut -f1 -d\)`
158 if [ $RES != "X" ] ; then
159 RES_OUT
=`echo $RES | cut -b2-`
160 /usr
/bin
/printf "Found upgrade point in file $i\n"
162 CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
166 CTDL_MODULE_UPGRADE($RES_OUT);
172 if [ -d "modules" ] ; then
180 if [ -f "$k" ] ; then
181 # Add this .c file to the Makefile included list of SOURCES
182 cat <<EOF >> $SRC_FILE
183 SOURCES += modules/$j/$k
186 # Generate a .o file name
187 O_FILE
=`basename $k .c`
189 # Add this .o file to the Makefile included list of SERV_MODULES
190 cat <<EOF >> $MOD_FILE
191 SERV_MODULES += modules/$j/$O_FILE
194 RES
=X
`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
195 if [ $RES != "X" ] ; then
196 RES_OUT
=`echo $RES | cut -b2-`
197 /usr
/bin
/printf "Found entry point in file modules/$j/$k\n"
198 # Add this entry point to the .c file
200 CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
202 # Add this entry point to the .h file
204 CTDL_MODULE_INIT($RES_OUT);
207 RES
=X
`grep CTDL_MODULE_UPGRADE $k | cut -f2 -d\( | cut -f1 -d\)`
208 if [ $RES != "X" ] ; then
209 RES_OUT
=`echo $RES | cut -b2-`
210 /usr
/bin
/printf "Found upgrade point in file modules/$j/$k\n"
211 # Add this entry point to the .c file
213 CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
215 # Add this entry point to the .h file
217 CTDL_MODULE_UPGRADE($RES_OUT);
229 if [ -d "user_modules" ] ; then
237 if [ -f "$k" ] ; then
238 # Add this .c file to the Makefile included list of SOURCES
239 cat <<EOF >> $SRC_FILE
240 SOURCES=\$(SOURCES) user_modules/$j/$k
243 # Generate a .o file name
244 O_FILE
=`basename $k .c`
246 # Add this .o file to the Makefile included list of SERV_MODULES
247 cat <<EOF >> $MOD_FILE
248 SERV_MODULES += user_modules/$j/$O_FILE
251 RES
=X
`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
252 if [ $RES != "X" ] ; then
253 RES_OUT
=`echo $RES | cut -b2-`
254 /usr
/bin
/printf "Found entry point in file user_modules/$j/$k\n"
256 CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
259 CTDL_MODULE_INIT($RES_OUT);
262 RES
=X
`grep CTDL_MODULE_UPGRADE $k | cut -f2 -d\( | cut -f1 -d\)`
263 if [ $RES != "X" ] ; then
264 RES_OUT
=`echo $RES | cut -b2-`
265 /usr
/bin
/printf "Found upgrade point in file user_modules/$j/$k\n"
267 CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
270 CTDL_MODULE_UPGRADE($RES_OUT);
282 /usr
/bin
/printf "\n\n" >> $C_FILE
283 /usr
/bin
/printf "\tfor (filter = 1; filter != 0; filter = filter << 1)\n" >> $C_FILE
284 /usr
/bin
/printf "\t\tif ((filter & DetailErrorFlags) != 0)\n" >> $C_FILE
285 /usr
/bin
/printf "\t\t\tLogPrintMessages(filter);\n" >> $C_FILE
286 /usr
/bin
/printf "}\n" >> $C_FILE
288 #close the upgrade file
289 /usr
/bin
/printf "}\n" >> $U_FILE
291 /usr
/bin
/printf "\n#endif /* MODULES_INIT_H */\n" >> $H_FILE