[libxml2] os400: initscript make_module(): Use options instead of positional parameters.



commit 1463a91df53b46accd0cc6a544132bc0f3bea9dc
Author: Patrick Monnerat <pm datasphere ch>
Date:   Fri Apr 17 17:09:13 2015 +0200

    os400: initscript make_module(): Use options instead of positional parameters.

 os400/initscript.sh |   35 ++++++++++++++++++++++++++++++-----
 os400/make-src.sh   |   10 +++++-----
 2 files changed, 35 insertions(+), 10 deletions(-)
---
diff --git a/os400/initscript.sh b/os400/initscript.sh
index fb80507..cc52e45 100644
--- a/os400/initscript.sh
+++ b/os400/initscript.sh
@@ -165,15 +165,38 @@ action_needed()
 }
 
 
-#       make_module module_name source_name [additional_definitions]
+#       make_module [option] module_name source_name
 #
 #       Compile source name into ASCII module if needed.
 #       As side effect, append the module name to variable MODULES.
 #       Set LINK to "YES" if the module has been compiled.
+#       Options are:
+#         --define <additional definitions>
+#         --ebcdic
+#         --sysiconv
 
 make_module()
 
 {
+        DEFN=
+        EBCDIC=
+        SYSICONV=
+        while true
+        do      case "${1}" in
+                --define)
+                        DEFN="${2}"
+                        shift
+                        ;;
+                --ebcdic)
+                        EBCDIC=yes
+                        ;;
+                --sysiconv)
+                        SYSICONV=yes
+                        ;;
+                *)      break
+                esac
+                shift
+        done
         MODULES="${MODULES} ${1}"
         MODIFSNAME="${LIBIFSNAME}/${1}.MODULE"
         action_needed "${MODIFSNAME}" "${2}" || return 0;
@@ -185,7 +208,7 @@ make_module()
         #               the source file and we compile that temporary file.
 
         rm -f __tmpsrcf.c
-        if [ "${4}" != 'ebcdic' ]
+        if [ -z "${EBCDIC}" ]
         then    echo "#line 1 \"${2}\"" >> __tmpsrcf.c
                 echo "#pragma convert(819)" >> __tmpsrcf.c
                 echo '#include "wrappers.h"' >> __tmpsrcf.c
@@ -197,8 +220,10 @@ make_module()
         CMD="${CMD} OPTION(*INCDIRFIRST)"
         CMD="${CMD} SYSIFCOPT(*IFS64IO) LANGLVL(*EXTENDED) LOCALETYPE(*LOCALE)"
         CMD="${CMD} INCDIR("
-        CMD="${CMD} '${TOPDIR}/os400/iconv'"
-        if [ "${4}" != 'ebcdic' ]
+        if [  -z "${SYSICONV}" ]
+        then    CMD="${CMD} '${TOPDIR}/os400/iconv'"
+        fi
+        if [ -z "${EBCDIC}" ]
         then    CMD="${CMD} '/qibm/proddata/qadrt/include'"
         fi
         CMD="${CMD} '${TOPDIR}/os400' '${TOPDIR}/os400/dlfcn'"
@@ -211,7 +236,7 @@ make_module()
         CMD="${CMD} OUTPUT(${OUTPUT})"
         CMD="${CMD} OPTIMIZE(${OPTIMIZE})"
         CMD="${CMD} DBGVIEW(${DEBUG})"
-        CMD="${CMD} DEFINE('_REENTRANT' 'TRIO_HAVE_CONFIG_H' 'NDEBUG' ${3})"
+        CMD="${CMD} DEFINE('_REENTRANT' 'TRIO_HAVE_CONFIG_H' 'NDEBUG' ${DEFN})"
 
         system "${CMD}"
         rm -f __tmpsrcf.c
diff --git a/os400/make-src.sh b/os400/make-src.sh
index f06cfaf..62b7a36 100644
--- a/os400/make-src.sh
+++ b/os400/make-src.sh
@@ -62,11 +62,11 @@ INCLUDES="'`pwd`'"
 
 #       OS/400 specific modules first.
 
-make_module     DLFCN           "${SCRIPTDIR}/dlfcn/dlfcn.c"    ''      ebcdic
-make_module     ICONV           "${SCRIPTDIR}/iconv/iconv.c"    ''      ebcdic
-make_module     WRAPPERS        "${SCRIPTDIR}/wrappers.c"       ''      ebcdic
-make_module     TRANSCODE       "${SCRIPTDIR}/transcode.c"
-make_module     RPGSUPPORT      "${SCRIPTDIR}/rpgsupport.c"
+make_module     --ebcdic        DLFCN           "${SCRIPTDIR}/dlfcn/dlfcn.c"
+make_module     --ebcdic        ICONV           "${SCRIPTDIR}/iconv/iconv.c"
+make_module     --ebcdic        WRAPPERS        "${SCRIPTDIR}/wrappers.c"
+make_module                     TRANSCODE       "${SCRIPTDIR}/transcode.c"
+make_module                     RPGSUPPORT      "${SCRIPTDIR}/rpgsupport.c"
 
 #       Regular libxml2 modules.
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]