diff --git a/AUTHORS b/AUTHORS index 34caa630..cd9e4912 100644 --- a/AUTHORS +++ b/AUTHORS @@ -223,4 +223,9 @@ conf/ Alexander R. Angas: -Win32 optimizations and updates in many files \ No newline at end of file +Win32 optimizations and updates in many files +memory function intermediate layer +scicore/ + sci_memory.c +include/ + sci_memory.h diff --git a/ChangeLog b/ChangeLog index 773b54e8..27a30803 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2001-08-18 Christoph Reichenbach + + * configure.in: Added --with-alloc option to set SCI_ALLOC + +2001-08-15 Alex Angas + + * src/scicore/sci_memory.c, src/include/sci_memory.h: Library for safe + allocation of memory and accurate reporting of where calls fail. + Includes: sci_malloc(), sci_calloc(), sci_realloc(), sci_free(), + sci_memdup(), sci_strdup(), sci_strndup(). + + * src/scicore/tools.c, src/gfx/gfx_test.c, src/scicore/console.c, + src/include/resource.h, src/scicore/resource.c, src/include/menubar.h: + Generally removed various parts and merged into the sci_memory library. + + * src/gfx/menubar.c, src/engine/cfsml.pl, src/engine/savegame.cfsml, + src/include/console.h, src/gfx/menubar.c, src/sound/sfx_save.cfsml, + src/sound/sound.c, src/include/sound.h, src/sound/soundserver_sdl.c, + src/sound/soundserver_unix.c, src/sound/tools.c: + Removed redundant code, merged some parts into sci_memory. These files + were changed to use the sci_memory library. + + * src/scicore/Makefile.am: Now compiling sci_memory.c. + + * src/win32/fsci_dll.dsp, src/win32/sciv.dsp: Now compiling + sci_memory.c. + + * ./acinclude.m4, ./aclocal.m4: Corrected Web address for dmalloc + library. + + * src/include/kernel.h (get_nsrect), src/include/sound.h: Fixed Win32 + linkage problem. + + * ./portable_howto.txt: Added message about not using #warning. + 2001-08-13 Christoph Reichenbach * src/gfx/drivers/xlib_driver.c (xlib_init): Added listing of diff --git a/acconfig.h b/acconfig.h index 72b995bc..cba1df5e 100644 --- a/acconfig.h +++ b/acconfig.h @@ -9,3 +9,4 @@ #undef HAVE_MITSHM #undef HAVE_SDL #undef HAVE_DLOPEN +#undef SCI_ALLOC diff --git a/acinclude.m4 b/acinclude.m4 index e013435d..db11db2d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -760,8 +760,8 @@ int main (int argc, char *argv[]) AC_DEFUN(AM_WITH_DMALLOC, [AC_MSG_CHECKING(if malloc debugging is wanted) AC_ARG_WITH(dmalloc, -[ --with-dmalloc use dmalloc, as in - ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz], +[ --with-dmalloc use dmalloc, available at + http://dmalloc.com], [if test "$withval" = yes; then AC_MSG_RESULT(yes) AC_DEFINE(WITH_DMALLOC,1, diff --git a/aclocal.m4 b/aclocal.m4 index ba2acf12..89eaec41 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -721,8 +721,8 @@ int main (int argc, char *argv[]) AC_DEFUN(AM_WITH_DMALLOC, [AC_MSG_CHECKING(if malloc debugging is wanted) AC_ARG_WITH(dmalloc, -[ --with-dmalloc use dmalloc, as in - ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz], +[ --with-dmalloc use dmalloc, available at + http://dmalloc.com], [if test "$withval" = yes; then AC_MSG_RESULT(yes) AC_DEFINE(WITH_DMALLOC,1, diff --git a/config.h.in b/config.h.in index a97bf454..3c52bbe9 100644 --- a/config.h.in +++ b/config.h.in @@ -24,6 +24,7 @@ #undef HAVE_MITSHM #undef HAVE_SDL #undef HAVE_DLOPEN +#undef SCI_ALLOC /* The number of bytes in a int. */ #undef SIZEOF_INT diff --git a/configure b/configure index 87965700..0034f31a 100644 --- a/configure +++ b/configure @@ -49,15 +49,20 @@ ac_help="$ac_help --with-png-includes where the png includes are. " ac_help="$ac_help --with-png-libraries where the png library is installed." +ac_help="$ac_help + --with-dmalloc use dmalloc, available at + http://dmalloc.com" +ac_help="$ac_help + --with-endianness=ARG whether big or little endianness should be used." ac_help="$ac_help --with-efence link against libefence (for debugging)" ac_help="$ac_help --with-Wall compile using -Wall" ac_help="$ac_help - --with-dmalloc use dmalloc, as in - ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz" -ac_help="$ac_help - --with-endianness=ARG whether big or little endianness should be used." + --with-alloc=M Choose alloc method: + 0: Default C functions + 1: Exit immediately if out of memory + 2: If out of memory, re-try indefinitely" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -602,7 +607,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:606: checking for a BSD compatible install" >&5 +echo "configure:611: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -655,7 +660,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:659: checking whether build environment is sane" >&5 +echo "configure:664: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -712,7 +717,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:716: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:721: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -758,7 +763,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:762: checking for working aclocal" >&5 +echo "configure:767: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -771,7 +776,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:775: checking for working autoconf" >&5 +echo "configure:780: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -784,7 +789,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:788: checking for working automake" >&5 +echo "configure:793: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -797,7 +802,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:801: checking for working autoheader" >&5 +echo "configure:806: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -810,7 +815,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:814: checking for working makeinfo" >&5 +echo "configure:819: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -827,7 +832,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:831: checking for $ac_word" >&5 +echo "configure:836: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -857,7 +862,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:861: checking for $ac_word" >&5 +echo "configure:866: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -908,7 +913,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:912: checking for $ac_word" >&5 +echo "configure:917: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -940,7 +945,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:944: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:949: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -951,12 +956,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 955 "configure" +#line 960 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -982,12 +987,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:986: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:991: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:991: checking whether we are using GNU C" >&5 +echo "configure:996: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -996,7 +1001,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1015,7 +1020,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1019: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1024: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1050,7 +1055,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1054: checking for $ac_word" >&5 +echo "configure:1059: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1080,7 +1085,7 @@ fi #AM_PROG_LIBTOOL #AC_PROG_LIBTOOL echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1084: checking how to run the C preprocessor" >&5 +echo "configure:1089: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1095,13 +1100,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1105: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1110: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1112,13 +1117,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1122: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1127: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1129,13 +1134,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1139: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1144: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1163,17 +1168,17 @@ for ac_hdr in limits.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1167: checking for $ac_hdr" >&5 +echo "configure:1172: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1203,17 +1208,17 @@ for ac_hdr in sys/uio.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1207: checking for $ac_hdr" >&5 +echo "configure:1212: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1217: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1222: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1243,17 +1248,17 @@ for ac_hdr in sys/soundcard.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1247: checking for $ac_hdr" >&5 +echo "configure:1252: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1257: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1262: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1283,17 +1288,17 @@ for ac_hdr in sys/time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1287: checking for $ac_hdr" >&5 +echo "configure:1292: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1323,17 +1328,17 @@ for ac_hdr in obstack.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1327: checking for $ac_hdr" >&5 +echo "configure:1332: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1337: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1342: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1363,17 +1368,17 @@ for ac_hdr in dirent.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1367: checking for $ac_hdr" >&5 +echo "configure:1372: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1382: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1403,17 +1408,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1407: checking for $ac_hdr" >&5 +echo "configure:1412: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1417: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1422: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1443,17 +1448,17 @@ for ac_hdr in fnmatch.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1447: checking for $ac_hdr" >&5 +echo "configure:1452: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1457: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1462: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1483,17 +1488,17 @@ for ac_hdr in getopt.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1487: checking for $ac_hdr" >&5 +echo "configure:1492: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1497: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1502: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1520,21 +1525,21 @@ fi done echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1524: checking for inline" >&5 +echo "configure:1529: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1560,7 +1565,7 @@ EOF esac echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:1564: checking size of short" >&5 +echo "configure:1569: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1568,7 +1573,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < #include @@ -1580,7 +1585,7 @@ main() exit(0); } EOF -if { (eval echo configure:1584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -1600,7 +1605,7 @@ EOF echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:1604: checking size of int" >&5 +echo "configure:1609: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1608,7 +1613,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < #include @@ -1620,7 +1625,7 @@ main() exit(0); } EOF -if { (eval echo configure:1624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -1640,7 +1645,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1644: checking size of long" >&5 +echo "configure:1649: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1648,7 +1653,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < #include @@ -1660,7 +1665,7 @@ main() exit(0); } EOF -if { (eval echo configure:1664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -1682,12 +1687,12 @@ EOF for ac_func in pipe socketpair fork sched_yield memfrob ffs getopt_long isblank usleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1686: checking for $ac_func" >&5 +echo "configure:1691: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1767,7 +1772,7 @@ fi echo $ac_n "checking for ALSA CFLAGS""... $ac_c" 1>&6 -echo "configure:1771: checking for ALSA CFLAGS" >&5 +echo "configure:1776: checking for ALSA CFLAGS" >&5 if test "$alsa_inc_prefix" != "" ; then ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" CFLAGS="$CFLAGS -I$alsa_inc_prefix" @@ -1775,7 +1780,7 @@ fi echo "$ac_t""$ALSA_CFLAGS" 1>&6 echo $ac_n "checking for ALSA LDFLAGS""... $ac_c" 1>&6 -echo "configure:1779: checking for ALSA LDFLAGS" >&5 +echo "configure:1784: checking for ALSA LDFLAGS" >&5 if test "$alsa_prefix" != "" ; then ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" LDFLAGS="$LDFLAGS $ALSA_LIBS" @@ -1787,7 +1792,7 @@ echo "$ac_t""$ALSA_LIBS" 1>&6 min_alsa_version=0.5.0 echo $ac_n "checking for libasound headers version >= $min_alsa_version""... $ac_c" 1>&6 -echo "configure:1791: checking for libasound headers version >= $min_alsa_version" >&5 +echo "configure:1796: checking for libasound headers version >= $min_alsa_version" >&5 no_alsa="" alsa_min_major_version=`echo $min_alsa_version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` @@ -1805,7 +1810,7 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext < @@ -1846,7 +1851,7 @@ exit(0); ; return 0; } EOF -if { (eval echo configure:1850: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1855: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""found." 1>&6 else @@ -1868,7 +1873,7 @@ cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking for snd_defaults_card in -lasound""... $ac_c" 1>&6 -echo "configure:1872: checking for snd_defaults_card in -lasound" >&5 +echo "configure:1877: checking for snd_defaults_card in -lasound" >&5 ac_lib_var=`echo asound'_'snd_defaults_card | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1876,7 +1881,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lasound $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1938,7 +1943,7 @@ fi echo $ac_n "checking for ggi""... $ac_c" 1>&6 -echo "configure:1942: checking for ggi" >&5 +echo "configure:1947: checking for ggi" >&5 ac_ggi_so="" @@ -1994,13 +1999,13 @@ do CPPFLAGS="$OLDCPPFLAGS $i" cat > conftest.$ac_ext < #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2004: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2034,7 +2039,7 @@ do do CFLAGS="$OLDCFLAGS $i $j $ac_ggi_includes -lgii -lgg" cat > conftest.$ac_ext < #include @@ -2042,7 +2047,7 @@ int main() { ggiInit(); ; return 0; } EOF -if { (eval echo configure:2046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wasfound="$i $j" else @@ -2141,7 +2146,7 @@ fi # Extract the first word of "sdl-config", so it can be a program name with args. set dummy sdl-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2145: checking for $ac_word" >&5 +echo "configure:2150: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SDL_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2176,7 +2181,7 @@ fi min_sdl_version=1.1.8 echo $ac_n "checking for SDL - version >= $min_sdl_version""... $ac_c" 1>&6 -echo "configure:2180: checking for SDL - version >= $min_sdl_version" >&5 +echo "configure:2185: checking for SDL - version >= $min_sdl_version" >&5 no_sdl="" if test "$SDL_CONFIG" = "no" ; then no_sdl=yes @@ -2201,7 +2206,7 @@ echo "configure:2180: checking for SDL - version >= $min_sdl_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -2262,7 +2267,7 @@ int main (int argc, char *argv[]) EOF -if { (eval echo configure:2266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2302,7 +2307,7 @@ EOF CFLAGS="$CFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" cat > conftest.$ac_ext < @@ -2312,7 +2317,7 @@ int main() { return 0; ; return 0; } EOF -if { (eval echo configure:2316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SDL or finding the wrong" @@ -2349,14 +2354,14 @@ rm -f conftest* else echo $ac_n "checking for SDL""... $ac_c" 1>&6 -echo "configure:2353: checking for SDL" >&5 +echo "configure:2358: checking for SDL" >&5 echo "$ac_t""disabled" 1>&6 # Well, we should give some kind of feedback... fsci_sdl_driver="" fi echo $ac_n "checking for (n)curses""... $ac_c" 1>&6 -echo "configure:2360: checking for (n)curses" >&5 +echo "configure:2365: checking for (n)curses" >&5 _ac_curses_includes="-I/usr/include -I/usr/local/include" _ac_curses_libraries="-L/usr/lib -L/usr/local/lib" @@ -2406,13 +2411,13 @@ do CPPFLAGS="$OLDCPPFLAGS $i" cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2421: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2448,13 +2453,13 @@ do CPPFLAGS="$OLDCPPFLAGS $i" cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2458: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2490,14 +2495,14 @@ do do CFLAGS="$OLDCFLAGS $i $j $ac_curses_includes" cat > conftest.$ac_ext < int main() { noecho(); ; return 0; } EOF -if { (eval echo configure:2501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wasfound="$i $j" else @@ -2544,17 +2549,17 @@ if test x"$ac_curses_libraries" != x; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2548: checking for $ac_hdr" >&5 +echo "configure:2553: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2558: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2563: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2586,17 +2591,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2590: checking for $ac_hdr" >&5 +echo "configure:2595: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2629,7 +2634,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:2633: checking for X" >&5 +echo "configure:2638: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -2691,12 +2696,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2700: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2765,14 +2770,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -2878,17 +2883,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:2882: checking whether -R must be followed by a space" >&5 +echo "configure:2887: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -2904,14 +2909,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -2943,7 +2948,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:2947: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:2952: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2951,7 +2956,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2984,7 +2989,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:2988: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:2993: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2992,7 +2997,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3032,12 +3037,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:3036: checking for gethostbyname" >&5 +echo "configure:3041: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -3081,7 +3086,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:3085: checking for gethostbyname in -lnsl" >&5 +echo "configure:3090: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3089,7 +3094,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3130,12 +3135,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:3134: checking for connect" >&5 +echo "configure:3139: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -3179,7 +3184,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:3183: checking for connect in -lsocket" >&5 +echo "configure:3188: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3187,7 +3192,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3222,12 +3227,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:3226: checking for remove" >&5 +echo "configure:3231: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -3271,7 +3276,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:3275: checking for remove in -lposix" >&5 +echo "configure:3280: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3279,7 +3284,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3299: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3314,12 +3319,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:3318: checking for shmat" >&5 +echo "configure:3323: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -3363,7 +3368,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:3367: checking for shmat in -lipc" >&5 +echo "configure:3372: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3371,7 +3376,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3415,7 +3420,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:3419: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:3424: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3423,7 +3428,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3464,17 +3469,17 @@ if test x"$have_x" = xyes; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3468: checking for $ac_hdr" >&5 +echo "configure:3473: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3478: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3483: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3504,17 +3509,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3508: checking for $ac_hdr" >&5 +echo "configure:3513: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3518: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3523: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3542,7 +3547,7 @@ done echo $ac_n "checking for the X11 MIT-SHM extension""... $ac_c" 1>&6 -echo "configure:3546: checking for the X11 MIT-SHM extension" >&5 +echo "configure:3551: checking for the X11 MIT-SHM extension" >&5 ac_ext=c @@ -3555,7 +3560,7 @@ cross_compiling=$ac_cv_prog_cc_cross oldLIBS="$X_LIBS" X_LIBS="$X_LIBS -lXext" cat > conftest.$ac_ext < @@ -3570,7 +3575,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3574: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""found." 1>&6 @@ -3600,9 +3605,9 @@ cross_compiling=$ac_cv_prog_cc_cross fi echo $ac_n "checking for Alpha hardware and gcc or ccc style __asm__""... $ac_c" 1>&6 -echo "configure:3604: checking for Alpha hardware and gcc or ccc style __asm__" >&5 +echo "configure:3609: checking for Alpha hardware and gcc or ccc style __asm__" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3630: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""found." 1>&6 @@ -3651,7 +3656,7 @@ if test x"$have_x" = xyes; then LIBS="-L$x_libraries $LIBS" fi echo $ac_n "checking for XGrabDevice in -lXi""... $ac_c" 1>&6 -echo "configure:3655: checking for XGrabDevice in -lXi" >&5 +echo "configure:3660: checking for XGrabDevice in -lXi" >&5 ac_lib_var=`echo Xi'_'XGrabDevice | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3659,7 +3664,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXi $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3691,7 +3696,7 @@ else fi echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 -echo "configure:3695: checking for XOpenDisplay in -lX11" >&5 +echo "configure:3700: checking for XOpenDisplay in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3699,7 +3704,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3784,7 +3789,7 @@ fi echo $ac_n "checking for libpng""... $ac_c" 1>&6 -echo "configure:3788: checking for libpng" >&5 +echo "configure:3793: checking for libpng" >&5 _ac_png_includes="-I/usr/include -I/usr/local/include" _ac_png_libraries="-L/usr/lib -L/usr/local/lib" @@ -3827,13 +3832,13 @@ do CPPFLAGS="$OLDCPPFLAGS $i" cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3837: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3842: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3867,14 +3872,14 @@ do do CFLAGS="$OLDCFLAGS $i $j $ac_png_includes" cat > conftest.$ac_ext < int main() { png_info_init(0); ; return 0; } EOF -if { (eval echo configure:3878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wasfound="$i $j" else @@ -3911,14 +3916,14 @@ do do CFLAGS="$OLDCFLAGS $i $j $ac_png_includes" cat > conftest.$ac_ext < int main() { png_info_init((png_infop)0); ; return 0; } EOF -if { (eval echo configure:3922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* wasfound="$i $j" else @@ -3965,7 +3970,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3969: checking for $ac_word" >&5 +echo "configure:3974: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3998,7 +4003,7 @@ test -n "$LEX" || LEX=""$missing_dir/missing flex"" # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4002: checking for $ac_word" >&5 +echo "configure:4007: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4032,7 +4037,7 @@ then *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:4036: checking for yywrap in -l$ac_lib" >&5 +echo "configure:4041: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4040,7 +4045,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4074,7 +4079,7 @@ fi fi echo $ac_n "checking lex output file root""... $ac_c" 1>&6 -echo "configure:4078: checking lex output file root" >&5 +echo "configure:4083: checking lex output file root" >&5 if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4095,7 +4100,7 @@ echo "$ac_t""$ac_cv_prog_lex_root" 1>&6 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 -echo "configure:4099: checking whether yytext is a pointer" >&5 +echo "configure:4104: checking whether yytext is a pointer" >&5 if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4107,14 +4112,14 @@ echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c ac_save_LIBS="$LIBS" LIBS="$LIBS $LEXLIB" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_prog_lex_yytext_pointer=yes else @@ -4140,7 +4145,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4144: checking for $ac_word" >&5 +echo "configure:4149: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4171,24 +4176,17 @@ done test -n "$YACC" || YACC="yacc" -# Check whether --with-efence or --without-efence was given. -if test "${with_efence+set}" = set; then - withval="$with_efence" - LIBS="$LIBS -lefence" -else - LIBS="$LIBS -lc" -fi +RPM_VERSION=`echo $VERSION | sed 's/\-/_/'` -# Check whether --with-Wall or --without-Wall was given. -if test "${with_Wall+set}" = set; then - withval="$with_Wall" - CFLAGS="-Wall $CFLAGS" -fi + +######################################################## +# Compile-time features +######################################################## echo $ac_n "checking if malloc debugging is wanted""... $ac_c" 1>&6 -echo "configure:4192: checking if malloc debugging is wanted" >&5 +echo "configure:4190: checking if malloc debugging is wanted" >&5 # Check whether --with-dmalloc or --without-dmalloc was given. if test "${with_dmalloc+set}" = set; then withval="$with_dmalloc" @@ -4225,14 +4223,14 @@ fi if test "$force_endian" = no; then echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:4229: checking whether byte ordering is bigendian" >&5 +echo "configure:4227: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -4243,11 +4241,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4245: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -4258,7 +4256,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4262: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -4278,7 +4276,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -4334,7 +4332,49 @@ EOF fi -RPM_VERSION=`echo $VERSION | sed 's/\-/_/'` +# Check whether --with-efence or --without-efence was given. +if test "${with_efence+set}" = set; then + withval="$with_efence" + LIBS="$LIBS -lefence" +else + LIBS="$LIBS -lc" +fi + + +# Check whether --with-Wall or --without-Wall was given. +if test "${with_Wall+set}" = set; then + withval="$with_Wall" + CFLAGS="-Wall $CFLAGS" +fi + + + +# Check whether --with-alloc or --without-alloc was given. +if test "${with_alloc+set}" = set; then + withval="$with_alloc" + : +fi + +if test x"$with_alloc" != xno; then + SCI_ALLOC = "$with_alloc" + if test $with_alloc == 1; then + cat >> confdefs.h <<\EOF +#define SCI_ALLOC 1 +EOF + + fi + if test $with_alloc == 2; then + cat >> confdefs.h <<\EOF +#define SCI_ALLOC 2 +EOF + + fi + if test $with_alloc == 0; then + { echo "configure: error: $with_alloc is not a valid alloc mode." 1>&2; exit 1; }; + fi +fi + + trap '' 1 2 15 diff --git a/configure.in b/configure.in index 30e86766..dbcf28bb 100644 --- a/configure.in +++ b/configure.in @@ -157,6 +157,19 @@ AC_SUBST(ac_png_libraries) AM_PROG_LEX AC_PROG_YACC +RPM_VERSION=`echo $VERSION | sed 's/\-/_/'` +AC_SUBST(RPM_VERSION) + + +######################################################## +# Compile-time features +######################################################## + + +AM_WITH_DMALLOC + +AC_C_PARAMETRIZED_BIGENDIAN + AC_ARG_WITH(efence, [ --with-efence link against libefence (for debugging)], [LIBS="$LIBS -lefence"], @@ -167,12 +180,26 @@ AC_ARG_WITH(Wall, [CFLAGS="-Wall $CFLAGS"], []) -AM_WITH_DMALLOC -AC_C_PARAMETRIZED_BIGENDIAN +AC_ARG_WITH(alloc, [ --with-alloc=M Choose alloc method: + 0: Default C functions + 1: Exit immediately if out of memory + 2: If out of memory, re-try indefinitely]) +if test x"$with_alloc" != xno; then + SCI_ALLOC = "$with_alloc" + if test $with_alloc == 1; then + AC_DEFINE(SCI_ALLOC, 1) + fi + if test $with_alloc == 2; then + AC_DEFINE(SCI_ALLOC, 2) + fi + if test $with_alloc == 0; then + AC_MSG_ERROR($with_alloc is not a valid alloc mode.); + fi +fi + + -RPM_VERSION=`echo $VERSION | sed 's/\-/_/'` -AC_SUBST(RPM_VERSION) AC_OUTPUT(Makefile \ debian/Makefile \ diff --git a/portable_howto.txt b/portable_howto.txt index c7f19260..78d284f2 100644 --- a/portable_howto.txt +++ b/portable_howto.txt @@ -15,4 +15,6 @@ Some tips on writing portable code for FreeSCI: - When you declare a function returning int, please make sure that it has a return statement in it. This is not an error in Visual C++, but it produces a warning that is very easy to avoid. + - Do not use the #warning pragma. This is a GNU extension not supported + by Visual C++. diff --git a/src/engine/cfsml.pl b/src/engine/cfsml.pl index 8e0dfd5b..ba6ed8a1 100644 --- a/src/engine/cfsml.pl +++ b/src/engine/cfsml.pl @@ -101,40 +101,19 @@ sub create_string_functions print <<'EOF'; #include /* We need va_lists */ +#include #ifdef CFSML_DEBUG_MALLOC -static void -_free(char *fln, char *fn, int lin, void *var) -{ - fprintf(stderr, "%s, %s, %d: Free %p\n", fln, fn, lin, var); - free(var); -} -static void * -_malloc(char *fln, char *fn, int lin, int var) -{ - void *x = malloc(var); - fprintf(stderr, "%s, %s, %d: Malloc(%d)-> %p\n", fln, fn, lin, var, x); - return x; -} -static void* -_calloc(char *fln, char *fn, int lin, int var) -{ - void *x = calloc(var, 1); - fprintf(stderr, "%s, %s, %d: Calloc(%d)-> %p\n", fln, fn, lin, var, x); - return x; -} -static void* -_realloc(char *fln, char *fn, int lin, void *var, size_t si) -{ - void *x = realloc(var, si); - fprintf(stderr, "%s, %s, %d: Realloc(%d) %p->%p\n", fln, fn, lin, var, x); - return x; -} - -#define free(var) _free(__FILE__, __FUNCTION__, __LINE__, var) -#define malloc(var) _malloc(__FILE__, __FUNCTION__, __LINE__, var) -#define calloc(var,z) _calloc(__FILE__, __FUNCTION__, __LINE__, var*z) -#define realloc(var, si) _realloc(__FILE__, __FUNCTION__, __LINE__, var, si) +/* +#define free(p) dbg_sci_free(p) +#define malloc(s) dbg_sci_malloc(s) +#define calloc(n, s) dbg_sci_calloc(n, s) +#define realloc(p, s) dbg_sci_realloc(p, s) +*/ +#define free dbg_sci_free +#define malloc dbg_sci_malloc +#define calloc dbg_sci_calloc +#define realloc dbg_sci_realloc #endif static void @@ -205,7 +184,7 @@ sub create_string_functions static void _cfsml_register_pointer(void *ptr) { - struct _cfsml_pointer_refstruct *newref = malloc(sizeof (struct _cfsml_pointer_refstruct)); + struct _cfsml_pointer_refstruct *newref = sci_malloc(sizeof (struct _cfsml_pointer_refstruct)); #ifdef CFSML_DEBUG_MALLOC SCI_MEMTEST; fprintf(stderr,"Registering ptrref %p [%p]\n", ptr, newref); @@ -221,7 +200,7 @@ sub create_string_functions { char *source = s; char c; - char *target = (char *) malloc(1 + strlen(s) * 2); /* We will probably need less than that */ + char *target = (char *) sci_malloc(1 + strlen(s) * 2); /* We will probably need less than that */ char *writer = target; while ((c = *source++)) { @@ -236,14 +215,14 @@ sub create_string_functions } *writer = 0; /* Terminate string */ - return (char *) realloc(target, strlen(target) + 1); + return (char *) sci_realloc(target, strlen(target) + 1); } static char * _cfsml_unmangle_string(char *s) { - char *target = (char *) malloc(1 + strlen(s)); + char *target = (char *) sci_malloc(1 + strlen(s)); char *writer = target; char *source = s; char c; @@ -258,7 +237,7 @@ sub create_string_functions } *writer = 0; /* Terminate string */ - return (char *) realloc(target, strlen(target) + 1); + return (char *) sci_realloc(target, strlen(target) + 1); } @@ -269,7 +248,7 @@ sub create_string_functions int mem = 32; int pos = 0; int done = 0; - char *retval = (char *) malloc(mem); + char *retval = (char *) sci_malloc(mem); if (_cfsml_last_identifier_retreived) { free(_cfsml_last_identifier_retreived); @@ -289,7 +268,7 @@ sub create_string_functions while (((c = fgetc(fd)) != EOF) && ((pos == 0) || (c != '\n')) && (c != '=')) { if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem *= 2); + retval = (char *) sci_realloc(retval, mem *= 2); if (!isspace(c)) { if (done) { @@ -327,7 +306,7 @@ sub create_string_functions } if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem += 1); + retval = (char *) sci_realloc(retval, mem += 1); retval[pos] = 0; /* Terminate string */ EOF @@ -351,7 +330,7 @@ sub create_string_functions int c; int mem = 64; int pos = 0; - char *retval = (char *) malloc(mem); + char *retval = (char *) sci_malloc(mem); if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); @@ -361,7 +340,7 @@ sub create_string_functions while (((c = fgetc(fd)) != EOF) && (c != '\n')) { if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem *= 2); + retval = (char *) sci_realloc(retval, mem *= 2); if (pos || (!isspace(c))) retval[pos++] = c; @@ -384,7 +363,7 @@ sub create_string_functions ++(*line); if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem += 1); + retval = (char *) sci_realloc(retval, mem += 1); retval[pos] = 0; /* Terminate string */ EOF2 @@ -397,7 +376,7 @@ sub create_string_functions $firstline += 4; write_line_pp($firstline, 0); print <<'EOF3'; - return (_cfsml_last_value_retreived = (char *) realloc(retval, strlen(retval) + 1)); + return (_cfsml_last_value_retreived = (char *) sci_realloc(retval, strlen(retval) + 1)); /* Re-allocate; this value might be used for quite some while (if we are ** restoring a string) */ @@ -688,7 +667,7 @@ sub create_reader print " }\n\n"; print " if (max) {\n"; - print " save_struc->$name = ($n->{'type'} *) malloc(max * sizeof($type));\n"; + print " save_struc->$name = ($n->{'type'} *) sci_malloc(max * sizeof($type));\n"; print " _cfsml_register_pointer(save_struc->$name);\n"; print " }\n"; print " else\n"; @@ -735,7 +714,7 @@ sub create_reader elsif ($reference) { write_line_pp(__LINE__, 0); print " if (strcmp(value, \"\\\\null\\\\\")) { /* null pointer? */\n"; - print " save_struc->$name = malloc(sizeof ($type));\n"; + print " save_struc->$name = sci_malloc(sizeof ($type));\n"; print " _cfsml_register_pointer(save_struc->$name);\n"; print " if ($reader(fh, save_struc->$name, value, line, hiteof))\n"; print " return CFSML_FAILURE;\n"; diff --git a/src/engine/kmenu.c b/src/engine/kmenu.c index d6067726..6f1ca6bc 100644 --- a/src/engine/kmenu.c +++ b/src/engine/kmenu.c @@ -101,6 +101,7 @@ struct { int fgcolor, bgcolor; } _about_freesci_pages[ABOUT_FREESCI_PAGES_NR] = { {"FreeSCI hackers and contributors", + "Alexander R. Angas\nWin32 fixes and generic memory handler functions\n\n" "Anders Baden Nielsen\nPPC testing\n\n" "Bas Zoetekouw\nMan pages and debian package management\n\n" "Carl Muckenhoupt\nSources to the SCI resource viewer tools that started it all\n\n" diff --git a/src/engine/savegame.c b/src/engine/savegame.c index 34645e23..b682384f 100644 --- a/src/engine/savegame.c +++ b/src/engine/savegame.c @@ -30,6 +30,7 @@ ** savegame.cfsml. If this doesn't solve your problem, contact the maintainer. */ +#include #include #include #include @@ -125,47 +126,26 @@ read_hunk_block(FILE *fh, hunk_block_t *foo, char *lastval, int *line, int *hite /* Auto-generated CFSML declaration and function block */ -#line 790 "savegame.cfsml" +#line 769 "savegame.cfsml" #define CFSML_SUCCESS 0 #define CFSML_FAILURE 1 #line 102 "savegame.cfsml" #include /* We need va_lists */ +#include #ifdef CFSML_DEBUG_MALLOC -static void -_free(char *fln, char *fn, int lin, void *var) -{ - fprintf(stderr, "%s, %s, %d: Free %p\n", fln, fn, lin, var); - free(var); -} -static void * -_malloc(char *fln, char *fn, int lin, int var) -{ - void *x = malloc(var); - fprintf(stderr, "%s, %s, %d: Malloc(%d)-> %p\n", fln, fn, lin, var, x); - return x; -} -static void* -_calloc(char *fln, char *fn, int lin, int var) -{ - void *x = calloc(var, 1); - fprintf(stderr, "%s, %s, %d: Calloc(%d)-> %p\n", fln, fn, lin, var, x); - return x; -} -static void* -_realloc(char *fln, char *fn, int lin, void *var, size_t si) -{ - void *x = realloc(var, si); - fprintf(stderr, "%s, %s, %d: Realloc(%d) %p->%p\n", fln, fn, lin, var, x); - return x; -} - -#define free(var) _free(__FILE__, __FUNCTION__, __LINE__, var) -#define malloc(var) _malloc(__FILE__, __FUNCTION__, __LINE__, var) -#define calloc(var,z) _calloc(__FILE__, __FUNCTION__, __LINE__, var*z) -#define realloc(var, si) _realloc(__FILE__, __FUNCTION__, __LINE__, var, si) +/* +#define free(p) dbg_sci_free(p) +#define malloc(s) dbg_sci_malloc(s) +#define calloc(n, s) dbg_sci_calloc(n, s) +#define realloc(p, s) dbg_sci_realloc(p, s) +*/ +#define free dbg_sci_free +#define malloc dbg_sci_malloc +#define calloc dbg_sci_calloc +#define realloc dbg_sci_realloc #endif static void @@ -236,7 +216,7 @@ _cfsml_get_current_refpointer() static void _cfsml_register_pointer(void *ptr) { - struct _cfsml_pointer_refstruct *newref = malloc(sizeof (struct _cfsml_pointer_refstruct)); + struct _cfsml_pointer_refstruct *newref = sci_malloc(sizeof (struct _cfsml_pointer_refstruct)); #ifdef CFSML_DEBUG_MALLOC SCI_MEMTEST; fprintf(stderr,"Registering ptrref %p [%p]\n", ptr, newref); @@ -252,7 +232,7 @@ _cfsml_mangle_string(char *s) { char *source = s; char c; - char *target = (char *) malloc(1 + strlen(s) * 2); /* We will probably need less than that */ + char *target = (char *) sci_malloc(1 + strlen(s) * 2); /* We will probably need less than that */ char *writer = target; while ((c = *source++)) { @@ -267,14 +247,14 @@ _cfsml_mangle_string(char *s) } *writer = 0; /* Terminate string */ - return (char *) realloc(target, strlen(target) + 1); + return (char *) sci_realloc(target, strlen(target) + 1); } static char * _cfsml_unmangle_string(char *s) { - char *target = (char *) malloc(1 + strlen(s)); + char *target = (char *) sci_malloc(1 + strlen(s)); char *writer = target; char *source = s; char c; @@ -289,7 +269,7 @@ _cfsml_unmangle_string(char *s) } *writer = 0; /* Terminate string */ - return (char *) realloc(target, strlen(target) + 1); + return (char *) sci_realloc(target, strlen(target) + 1); } @@ -300,7 +280,7 @@ _cfsml_get_identifier(FILE *fd, int *line, int *hiteof, int *assignment) int mem = 32; int pos = 0; int done = 0; - char *retval = (char *) malloc(mem); + char *retval = (char *) sci_malloc(mem); if (_cfsml_last_identifier_retreived) { free(_cfsml_last_identifier_retreived); @@ -320,7 +300,7 @@ _cfsml_get_identifier(FILE *fd, int *line, int *hiteof, int *assignment) while (((c = fgetc(fd)) != EOF) && ((pos == 0) || (c != '\n')) && (c != '=')) { if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem *= 2); + retval = (char *) sci_realloc(retval, mem *= 2); if (!isspace(c)) { if (done) { @@ -358,10 +338,10 @@ _cfsml_get_identifier(FILE *fd, int *line, int *hiteof, int *assignment) } if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem += 1); + retval = (char *) sci_realloc(retval, mem += 1); retval[pos] = 0; /* Terminate string */ -#line 343 "savegame.cfsml" +#line 322 "savegame.cfsml" return _cfsml_last_identifier_retreived = retval; } @@ -373,7 +353,7 @@ _cfsml_get_value(FILE *fd, int *line, int *hiteof) int c; int mem = 64; int pos = 0; - char *retval = (char *) malloc(mem); + char *retval = (char *) sci_malloc(mem); if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); @@ -383,7 +363,7 @@ _cfsml_get_value(FILE *fd, int *line, int *hiteof) while (((c = fgetc(fd)) != EOF) && (c != '\n')) { if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem *= 2); + retval = (char *) sci_realloc(retval, mem *= 2); if (pos || (!isspace(c))) retval[pos++] = c; @@ -406,239 +386,239 @@ _cfsml_get_value(FILE *fd, int *line, int *hiteof) ++(*line); if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem += 1); + retval = (char *) sci_realloc(retval, mem += 1); retval[pos] = 0; /* Terminate string */ -#line 400 "savegame.cfsml" - return (_cfsml_last_value_retreived = (char *) realloc(retval, strlen(retval) + 1)); +#line 379 "savegame.cfsml" + return (_cfsml_last_value_retreived = (char *) sci_realloc(retval, strlen(retval) + 1)); /* Re-allocate; this value might be used for quite some while (if we are ** restoring a string) */ } -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_container_t(FILE *fh, gfxw_container_t* save_struc); static int _cfsml_read_gfxw_container_t(FILE *fh, gfxw_container_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_menu_t(FILE *fh, menu_t* save_struc); static int _cfsml_read_menu_t(FILE *fh, menu_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_widget_t(FILE *fh, gfxw_widget_t* save_struc); static int _cfsml_read_gfxw_widget_t(FILE *fh, gfxw_widget_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_primitive_t(FILE *fh, gfxw_primitive_t* save_struc); static int _cfsml_read_gfxw_primitive_t(FILE *fh, gfxw_primitive_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_widget_types_t(FILE *fh, gfxw_widget_types_t* save_struc); static int _cfsml_read_gfxw_widget_types_t(FILE *fh, gfxw_widget_types_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_drawn_pic_t(FILE *fh, drawn_pic_t* save_struc); static int _cfsml_read_drawn_pic_t(FILE *fh, drawn_pic_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_menubar_t(FILE *fh, menubar_t* save_struc); static int _cfsml_read_menubar_t(FILE *fh, menubar_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_string(FILE *fh, char ** save_struc); static int _cfsml_read_string(FILE *fh, char ** save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_view_t(FILE *fh, gfxw_view_t* save_struc); static int _cfsml_read_gfxw_view_t(FILE *fh, gfxw_view_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_point_t(FILE *fh, point_t* save_struc); static int _cfsml_read_point_t(FILE *fh, point_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_text_t(FILE *fh, gfxw_text_t* save_struc); static int _cfsml_read_gfxw_text_t(FILE *fh, gfxw_text_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfx_pixmap_color_t(FILE *fh, gfx_pixmap_color_t* save_struc); static int _cfsml_read_gfx_pixmap_color_t(FILE *fh, gfx_pixmap_color_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_port_t(FILE *fh, gfxw_port_t* save_struc); static int _cfsml_read_gfxw_port_t(FILE *fh, gfxw_port_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_visual_t(FILE *fh, gfxw_visual_t* save_struc); static int _cfsml_read_gfxw_visual_t(FILE *fh, gfxw_visual_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_dyn_view_t(FILE *fh, gfxw_dyn_view_t* save_struc); static int _cfsml_read_gfxw_dyn_view_t(FILE *fh, gfxw_dyn_view_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfx_line_mode_t(FILE *fh, gfx_line_mode_t* save_struc); static int _cfsml_read_gfx_line_mode_t(FILE *fh, gfx_line_mode_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfx_box_shade_t(FILE *fh, gfx_box_shade_t* save_struc); static int _cfsml_read_gfx_box_shade_t(FILE *fh, gfx_box_shade_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_list_t(FILE *fh, gfxw_list_t* save_struc); static int _cfsml_read_gfxw_list_t(FILE *fh, gfxw_list_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_snapshot_t(FILE *fh, gfxw_snapshot_t* save_struc); static int _cfsml_read_gfxw_snapshot_t(FILE *fh, gfxw_snapshot_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_state_t(FILE *fh, state_t* save_struc); static int _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_menu_item_t(FILE *fh, menu_item_t* save_struc); static int _cfsml_read_menu_item_t(FILE *fh, menu_item_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfx_color_t(FILE *fh, gfx_color_t* save_struc); static int _cfsml_read_gfx_color_t(FILE *fh, gfx_color_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_long(FILE *fh, long* save_struc); static int _cfsml_read_long(FILE *fh, long* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_byte(FILE *fh, byte* save_struc); static int _cfsml_read_byte(FILE *fh, byte* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_script_t(FILE *fh, script_t* save_struc); static int _cfsml_read_script_t(FILE *fh, script_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_class_t(FILE *fh, class_t* save_struc); static int _cfsml_read_class_t(FILE *fh, class_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_synonym_t(FILE *fh, synonym_t* save_struc); static int _cfsml_read_synonym_t(FILE *fh, synonym_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_exec_stack_t(FILE *fh, exec_stack_t* save_struc); static int _cfsml_read_exec_stack_t(FILE *fh, exec_stack_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfx_line_style_t(FILE *fh, gfx_line_style_t* save_struc); static int _cfsml_read_gfx_line_style_t(FILE *fh, gfx_line_style_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gint16(FILE *fh, gint16* save_struc); static int _cfsml_read_gint16(FILE *fh, gint16* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_rect_t(FILE *fh, rect_t* save_struc); static int _cfsml_read_rect_t(FILE *fh, rect_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfx_alignment_t(FILE *fh, gfx_alignment_t* save_struc); static int _cfsml_read_gfx_alignment_t(FILE *fh, gfx_alignment_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_int(FILE *fh, int* save_struc); static int _cfsml_read_int(FILE *fh, int* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfxw_box_t(FILE *fh, gfxw_box_t* save_struc); static int _cfsml_read_gfxw_box_t(FILE *fh, gfxw_box_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_gfx_dirty_rect_t(FILE *fh, gfx_dirty_rect_t* save_struc); static int _cfsml_read_gfx_dirty_rect_t(FILE *fh, gfx_dirty_rect_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_view_object_t(FILE *fh, view_object_t* save_struc); static int _cfsml_read_view_object_t(FILE *fh, view_object_t* save_struc, char *lastval, int *line, int *hiteof); -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_container_t(FILE *fh, gfxw_container_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "magic = "); _cfsml_write_int(fh, &(save_struc->magic)); @@ -678,13 +658,13 @@ _cfsml_write_gfxw_container_t(FILE *fh, gfxw_container_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_container_t(FILE *fh, gfxw_container_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -712,65 +692,65 @@ _cfsml_read_gfxw_container_t(FILE *fh, gfxw_container_t* save_struc, char *lastv if (!value) return CFSML_FAILURE; if (!strcmp(token, "magic")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->magic), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfxw_widget_types_t(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bounds")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->bounds), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "next")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->next), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ID")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ID), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "widget_priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->widget_priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "zone")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->zone), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "dirty")) { -#line 736 "savegame.cfsml" +#line 715 "savegame.cfsml" if (strcmp(value, "\\null\\")) { /* null pointer? */ - save_struc->dirty = malloc(sizeof (gfx_dirty_rect_t)); + save_struc->dirty = sci_malloc(sizeof (gfx_dirty_rect_t)); _cfsml_register_pointer(save_struc->dirty); if (_cfsml_read_gfx_dirty_rect_t(fh, save_struc->dirty, value, line, hiteof)) return CFSML_FAILURE; } else save_struc->dirty = NULL; } else if (!strcmp(token, "contents")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->contents), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -779,14 +759,14 @@ _cfsml_read_gfxw_container_t(FILE *fh, gfxw_container_t* save_struc, char *lastv return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_menu_t(FILE *fh, menu_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "title = "); _cfsml_write_string(fh, &(save_struc->title)); @@ -801,7 +781,7 @@ _cfsml_write_menu_t(FILE *fh, menu_t* save_struc) min = max = save_struc->items_nr; if (!save_struc->items) min = max = 0; /* Don't write if it points to NULL */ -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_menu_item_t(fh, &(save_struc->items[i])); @@ -812,13 +792,13 @@ _cfsml_write_menu_t(FILE *fh, menu_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_menu_t(FILE *fh, menu_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -846,27 +826,27 @@ _cfsml_read_menu_t(FILE *fh, menu_t* save_struc, char *lastval, int *line, int * if (!value) return CFSML_FAILURE; if (!strcmp(token, "title")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_string(fh, &(save_struc->title), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "title_width")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->title_width), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "width")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->width), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "items")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } -#line 679 "savegame.cfsml" +#line 658 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -875,16 +855,16 @@ _cfsml_read_menu_t(FILE *fh, menu_t* save_struc, char *lastval, int *line, int * ; } if (max) { - save_struc->items = (menu_item_t *) malloc(max * sizeof(menu_item_t)); + save_struc->items = (menu_item_t *) sci_malloc(max * sizeof(menu_item_t)); _cfsml_register_pointer(save_struc->items); } else save_struc->items = NULL; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -897,7 +877,7 @@ _cfsml_read_menu_t(FILE *fh, menu_t* save_struc, char *lastval, int *line, int * } while (!done); save_struc->items_nr = max ; /* Set array size accordingly */ } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -906,14 +886,14 @@ _cfsml_read_menu_t(FILE *fh, menu_t* save_struc, char *lastval, int *line, int * return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_widget_t(FILE *fh, gfxw_widget_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "magic = "); _cfsml_write_int(fh, &(save_struc->magic)); @@ -942,13 +922,13 @@ _cfsml_write_gfxw_widget_t(FILE *fh, gfxw_widget_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_widget_t(FILE *fh, gfxw_widget_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -976,46 +956,46 @@ _cfsml_read_gfxw_widget_t(FILE *fh, gfxw_widget_t* save_struc, char *lastval, in if (!value) return CFSML_FAILURE; if (!strcmp(token, "magic")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->magic), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfxw_widget_types_t(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bounds")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->bounds), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "next")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->next), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ID")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ID), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "widget_priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->widget_priority), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -1024,14 +1004,14 @@ _cfsml_read_gfxw_widget_t(FILE *fh, gfxw_widget_t* save_struc, char *lastval, in return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_primitive_t(FILE *fh, gfxw_primitive_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "magic = "); _cfsml_write_int(fh, &(save_struc->magic)); @@ -1069,13 +1049,13 @@ _cfsml_write_gfxw_primitive_t(FILE *fh, gfxw_primitive_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_primitive_t(FILE *fh, gfxw_primitive_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1103,61 +1083,61 @@ _cfsml_read_gfxw_primitive_t(FILE *fh, gfxw_primitive_t* save_struc, char *lastv if (!value) return CFSML_FAILURE; if (!strcmp(token, "magic")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->magic), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfxw_widget_types_t(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bounds")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->bounds), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "next")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->next), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ID")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ID), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "widget_priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->widget_priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "color")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_color_t(fh, &(save_struc->color), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "line_mode")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_line_mode_t(fh, &(save_struc->line_mode), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "line_style")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_line_mode_t(fh, &(save_struc->line_style), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -1166,7 +1146,7 @@ _cfsml_read_gfxw_primitive_t(FILE *fh, gfxw_primitive_t* save_struc, char *lastv return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_widget_types_t(FILE *fh, gfxw_widget_types_t* save_struc) { @@ -1176,13 +1156,13 @@ _cfsml_write_gfxw_widget_types_t(FILE *fh, gfxw_widget_types_t* save_struc) fprintf(fh, "%li", (long) *save_struc); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_widget_types_t(FILE *fh, gfxw_widget_types_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 581 "savegame.cfsml" +#line 560 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if (*token != 0) { @@ -1192,14 +1172,14 @@ _cfsml_read_gfxw_widget_types_t(FILE *fh, gfxw_widget_types_t* save_struc, char return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_drawn_pic_t(FILE *fh, drawn_pic_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "nr = "); _cfsml_write_int(fh, &(save_struc->nr)); @@ -1210,13 +1190,13 @@ _cfsml_write_drawn_pic_t(FILE *fh, drawn_pic_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_drawn_pic_t(FILE *fh, drawn_pic_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1244,16 +1224,16 @@ _cfsml_read_drawn_pic_t(FILE *fh, drawn_pic_t* save_struc, char *lastval, int *l if (!value) return CFSML_FAILURE; if (!strcmp(token, "nr")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->nr), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "palette")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->palette), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -1262,20 +1242,20 @@ _cfsml_read_drawn_pic_t(FILE *fh, drawn_pic_t* save_struc, char *lastval, int *l return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_menubar_t(FILE *fh, menubar_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "menus = "); min = max = save_struc->menus_nr; if (!save_struc->menus) min = max = 0; /* Don't write if it points to NULL */ -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_menu_t(fh, &(save_struc->menus[i])); @@ -1286,13 +1266,13 @@ _cfsml_write_menubar_t(FILE *fh, menubar_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_menubar_t(FILE *fh, menubar_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1320,12 +1300,12 @@ _cfsml_read_menubar_t(FILE *fh, menubar_t* save_struc, char *lastval, int *line, if (!value) return CFSML_FAILURE; if (!strcmp(token, "menus")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } -#line 679 "savegame.cfsml" +#line 658 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -1334,16 +1314,16 @@ _cfsml_read_menubar_t(FILE *fh, menubar_t* save_struc, char *lastval, int *line, ; } if (max) { - save_struc->menus = (menu_t *) malloc(max * sizeof(menu_t)); + save_struc->menus = (menu_t *) sci_malloc(max * sizeof(menu_t)); _cfsml_register_pointer(save_struc->menus); } else save_struc->menus = NULL; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -1356,7 +1336,7 @@ _cfsml_read_menubar_t(FILE *fh, menubar_t* save_struc, char *lastval, int *line, } while (!done); save_struc->menus_nr = max ; /* Set array size accordingly */ } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -1365,14 +1345,14 @@ _cfsml_read_menubar_t(FILE *fh, menubar_t* save_struc, char *lastval, int *line, return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_string(FILE *fh, char ** save_struc) { char *token; int min, max, i; -#line 473 "savegame.cfsml" +#line 452 "savegame.cfsml" if (!(*save_struc)) fprintf(fh, "\\null\\"); else { token = _cfsml_mangle_string((char *) *save_struc); @@ -1381,13 +1361,13 @@ _cfsml_write_string(FILE *fh, char ** save_struc) } } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_string(FILE *fh, char ** save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 590 "savegame.cfsml" +#line 569 "savegame.cfsml" if (strcmp(lastval, "\\null\\")) { /* null pointer? */ if (*lastval == '"') { /* Quoted string? */ @@ -1413,14 +1393,14 @@ _cfsml_read_string(FILE *fh, char ** save_struc, char *lastval, int *line, int * } } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_view_t(FILE *fh, gfxw_view_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "magic = "); _cfsml_write_int(fh, &(save_struc->magic)); @@ -1464,13 +1444,13 @@ _cfsml_write_gfxw_view_t(FILE *fh, gfxw_view_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_view_t(FILE *fh, gfxw_view_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1498,71 +1478,71 @@ _cfsml_read_gfxw_view_t(FILE *fh, gfxw_view_t* save_struc, char *lastval, int *l if (!value) return CFSML_FAILURE; if (!strcmp(token, "magic")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->magic), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfxw_widget_types_t(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bounds")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->bounds), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "next")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->next), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ID")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ID), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "widget_priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->widget_priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "pos")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_point_t(fh, &(save_struc->pos), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "color")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_color_t(fh, &(save_struc->color), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "view")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->view), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "loop")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->loop), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "cel")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->cel), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -1571,14 +1551,14 @@ _cfsml_read_gfxw_view_t(FILE *fh, gfxw_view_t* save_struc, char *lastval, int *l return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_point_t(FILE *fh, point_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "x = "); _cfsml_write_int(fh, &(save_struc->x)); @@ -1589,13 +1569,13 @@ _cfsml_write_point_t(FILE *fh, point_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_point_t(FILE *fh, point_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1623,16 +1603,16 @@ _cfsml_read_point_t(FILE *fh, point_t* save_struc, char *lastval, int *line, int if (!value) return CFSML_FAILURE; if (!strcmp(token, "x")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->x), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "y")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->y), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -1641,14 +1621,14 @@ _cfsml_read_point_t(FILE *fh, point_t* save_struc, char *lastval, int *line, int return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_text_t(FILE *fh, gfxw_text_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "magic = "); _cfsml_write_int(fh, &(save_struc->magic)); @@ -1707,13 +1687,13 @@ _cfsml_write_gfxw_text_t(FILE *fh, gfxw_text_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_text_t(FILE *fh, gfxw_text_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1741,96 +1721,96 @@ _cfsml_read_gfxw_text_t(FILE *fh, gfxw_text_t* save_struc, char *lastval, int *l if (!value) return CFSML_FAILURE; if (!strcmp(token, "magic")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->magic), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfxw_widget_types_t(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bounds")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->bounds), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "next")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->next), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ID")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ID), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "widget_priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->widget_priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "font_nr")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->font_nr), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "text")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_string(fh, &(save_struc->text), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "halign")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_alignment_t(fh, &(save_struc->halign), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "valign")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_alignment_t(fh, &(save_struc->valign), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "color1")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_color_t(fh, &(save_struc->color1), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "color2")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_color_t(fh, &(save_struc->color2), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bgcolor")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_color_t(fh, &(save_struc->bgcolor), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "text_flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->text_flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "width")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->width), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "height")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->height), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -1839,14 +1819,14 @@ _cfsml_read_gfxw_text_t(FILE *fh, gfxw_text_t* save_struc, char *lastval, int *l return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfx_pixmap_color_t(FILE *fh, gfx_pixmap_color_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "r = "); _cfsml_write_byte(fh, &(save_struc->r)); @@ -1860,13 +1840,13 @@ _cfsml_write_gfx_pixmap_color_t(FILE *fh, gfx_pixmap_color_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfx_pixmap_color_t(FILE *fh, gfx_pixmap_color_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -1894,21 +1874,21 @@ _cfsml_read_gfx_pixmap_color_t(FILE *fh, gfx_pixmap_color_t* save_struc, char *l if (!value) return CFSML_FAILURE; if (!strcmp(token, "r")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->r), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "g")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->g), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "b")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->b), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -1917,14 +1897,14 @@ _cfsml_read_gfx_pixmap_color_t(FILE *fh, gfx_pixmap_color_t* save_struc, char *l return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_port_t(FILE *fh, gfxw_port_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "magic = "); _cfsml_write_int(fh, &(save_struc->magic)); @@ -1991,13 +1971,13 @@ _cfsml_write_gfxw_port_t(FILE *fh, gfxw_port_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_port_t(FILE *fh, gfxw_port_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2025,110 +2005,110 @@ _cfsml_read_gfxw_port_t(FILE *fh, gfxw_port_t* save_struc, char *lastval, int *l if (!value) return CFSML_FAILURE; if (!strcmp(token, "magic")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->magic), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfxw_widget_types_t(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bounds")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->bounds), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "next")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->next), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ID")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ID), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "widget_priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->widget_priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "zone")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->zone), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "dirty")) { -#line 736 "savegame.cfsml" +#line 715 "savegame.cfsml" if (strcmp(value, "\\null\\")) { /* null pointer? */ - save_struc->dirty = malloc(sizeof (gfx_dirty_rect_t)); + save_struc->dirty = sci_malloc(sizeof (gfx_dirty_rect_t)); _cfsml_register_pointer(save_struc->dirty); if (_cfsml_read_gfx_dirty_rect_t(fh, save_struc->dirty, value, line, hiteof)) return CFSML_FAILURE; } else save_struc->dirty = NULL; } else if (!strcmp(token, "contents")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->contents), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "decorations")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->decorations), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "port_bg")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->port_bg), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "color")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_color_t(fh, &(save_struc->color), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bgcolor")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_color_t(fh, &(save_struc->bgcolor), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "font_nr")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->font_nr), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "draw_pos")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_point_t(fh, &(save_struc->draw_pos), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "port_flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->port_flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "title_text")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_string(fh, &(save_struc->title_text), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "gray_text")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->gray_text), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -2137,14 +2117,14 @@ _cfsml_read_gfxw_port_t(FILE *fh, gfxw_port_t* save_struc, char *lastval, int *l return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_visual_t(FILE *fh, gfxw_visual_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "magic = "); _cfsml_write_int(fh, &(save_struc->magic)); @@ -2190,13 +2170,13 @@ _cfsml_write_gfxw_visual_t(FILE *fh, gfxw_visual_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_visual_t(FILE *fh, gfxw_visual_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2224,75 +2204,75 @@ _cfsml_read_gfxw_visual_t(FILE *fh, gfxw_visual_t* save_struc, char *lastval, in if (!value) return CFSML_FAILURE; if (!strcmp(token, "magic")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->magic), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfxw_widget_types_t(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bounds")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->bounds), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "next")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->next), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ID")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ID), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "widget_priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->widget_priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "zone")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->zone), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "dirty")) { -#line 736 "savegame.cfsml" +#line 715 "savegame.cfsml" if (strcmp(value, "\\null\\")) { /* null pointer? */ - save_struc->dirty = malloc(sizeof (gfx_dirty_rect_t)); + save_struc->dirty = sci_malloc(sizeof (gfx_dirty_rect_t)); _cfsml_register_pointer(save_struc->dirty); if (_cfsml_read_gfx_dirty_rect_t(fh, save_struc->dirty, value, line, hiteof)) return CFSML_FAILURE; } else save_struc->dirty = NULL; } else if (!strcmp(token, "contents")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->contents), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "port_refs_nr")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->port_refs_nr), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "font_nr")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->font_nr), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -2301,14 +2281,14 @@ _cfsml_read_gfxw_visual_t(FILE *fh, gfxw_visual_t* save_struc, char *lastval, in return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_dyn_view_t(FILE *fh, gfxw_dyn_view_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "magic = "); _cfsml_write_int(fh, &(save_struc->magic)); @@ -2373,13 +2353,13 @@ _cfsml_write_gfxw_dyn_view_t(FILE *fh, gfxw_dyn_view_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_dyn_view_t(FILE *fh, gfxw_dyn_view_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2407,106 +2387,106 @@ _cfsml_read_gfxw_dyn_view_t(FILE *fh, gfxw_dyn_view_t* save_struc, char *lastval if (!value) return CFSML_FAILURE; if (!strcmp(token, "magic")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->magic), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfxw_widget_types_t(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bounds")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->bounds), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "next")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->next), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ID")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ID), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "widget_priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->widget_priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "pos")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_point_t(fh, &(save_struc->pos), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "color")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_color_t(fh, &(save_struc->color), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "view")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->view), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "loop")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->loop), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "cel")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->cel), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "draw_bounds")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->draw_bounds), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "under_bitsp")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->under_bitsp), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "signalp")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->signalp), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "under_bits")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->under_bits), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "signal")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->signal), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "z")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->z), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "force_precedence")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->force_precedence), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -2515,7 +2495,7 @@ _cfsml_read_gfxw_dyn_view_t(FILE *fh, gfxw_dyn_view_t* save_struc, char *lastval return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfx_line_mode_t(FILE *fh, gfx_line_mode_t* save_struc) { @@ -2525,13 +2505,13 @@ _cfsml_write_gfx_line_mode_t(FILE *fh, gfx_line_mode_t* save_struc) fprintf(fh, "%li", (long) *save_struc); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfx_line_mode_t(FILE *fh, gfx_line_mode_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 581 "savegame.cfsml" +#line 560 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if (*token != 0) { @@ -2541,7 +2521,7 @@ _cfsml_read_gfx_line_mode_t(FILE *fh, gfx_line_mode_t* save_struc, char *lastval return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfx_box_shade_t(FILE *fh, gfx_box_shade_t* save_struc) { @@ -2551,13 +2531,13 @@ _cfsml_write_gfx_box_shade_t(FILE *fh, gfx_box_shade_t* save_struc) fprintf(fh, "%li", (long) *save_struc); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfx_box_shade_t(FILE *fh, gfx_box_shade_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 581 "savegame.cfsml" +#line 560 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if (*token != 0) { @@ -2567,14 +2547,14 @@ _cfsml_read_gfx_box_shade_t(FILE *fh, gfx_box_shade_t* save_struc, char *lastval return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_list_t(FILE *fh, gfxw_list_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "magic = "); _cfsml_write_int(fh, &(save_struc->magic)); @@ -2614,13 +2594,13 @@ _cfsml_write_gfxw_list_t(FILE *fh, gfxw_list_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_list_t(FILE *fh, gfxw_list_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2648,65 +2628,65 @@ _cfsml_read_gfxw_list_t(FILE *fh, gfxw_list_t* save_struc, char *lastval, int *l if (!value) return CFSML_FAILURE; if (!strcmp(token, "magic")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->magic), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfxw_widget_types_t(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bounds")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->bounds), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "next")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->next), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ID")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ID), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "widget_priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->widget_priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "zone")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->zone), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "dirty")) { -#line 736 "savegame.cfsml" +#line 715 "savegame.cfsml" if (strcmp(value, "\\null\\")) { /* null pointer? */ - save_struc->dirty = malloc(sizeof (gfx_dirty_rect_t)); + save_struc->dirty = sci_malloc(sizeof (gfx_dirty_rect_t)); _cfsml_register_pointer(save_struc->dirty); if (_cfsml_read_gfx_dirty_rect_t(fh, save_struc->dirty, value, line, hiteof)) return CFSML_FAILURE; } else save_struc->dirty = NULL; } else if (!strcmp(token, "contents")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->contents), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -2715,14 +2695,14 @@ _cfsml_read_gfxw_list_t(FILE *fh, gfxw_list_t* save_struc, char *lastval, int *l return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_snapshot_t(FILE *fh, gfxw_snapshot_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "serial = "); _cfsml_write_int(fh, &(save_struc->serial)); @@ -2733,13 +2713,13 @@ _cfsml_write_gfxw_snapshot_t(FILE *fh, gfxw_snapshot_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_snapshot_t(FILE *fh, gfxw_snapshot_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -2767,16 +2747,16 @@ _cfsml_read_gfxw_snapshot_t(FILE *fh, gfxw_snapshot_t* save_struc, char *lastval if (!value) return CFSML_FAILURE; if (!strcmp(token, "serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "area")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->area), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -2785,14 +2765,14 @@ _cfsml_read_gfxw_snapshot_t(FILE *fh, gfxw_snapshot_t* save_struc, char *lastval return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_state_t(FILE *fh, state_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "savegame_version = "); _cfsml_write_int(fh, &(save_struc->savegame_version)); @@ -2853,7 +2833,7 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "hunk = "); min = max = MAX_HUNK_BLOCKS; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { write_hunk_block(fh, &(save_struc->hunk[i])); @@ -2879,7 +2859,7 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) min = save_struc->pics_drawn_nr; if (!save_struc->pics) min = max = 0; /* Don't write if it points to NULL */ -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_drawn_pic_t(fh, &(save_struc->pics[i])); @@ -2905,7 +2885,7 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) min = save_struc->execution_stack_pos+1; if (!save_struc->execution_stack) min = max = 0; /* Don't write if it points to NULL */ -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_exec_stack_t(fh, &(save_struc->execution_stack[i])); @@ -2942,7 +2922,7 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "parser_nodes = "); min = max = VOCAB_TREE_NODES; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { write_PTN(fh, &(save_struc->parser_nodes[i])); @@ -2957,7 +2937,7 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) min = max = save_struc->synonyms_nr; if (!save_struc->synonyms) min = max = 0; /* Don't write if it points to NULL */ -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_synonym_t(fh, &(save_struc->synonyms[i])); @@ -2972,7 +2952,7 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) min = max = save_struc->classtable_size; if (!save_struc->classtable) min = max = 0; /* Don't write if it points to NULL */ -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_class_t(fh, &(save_struc->classtable[i])); @@ -2982,7 +2962,7 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "scripttable = "); min = max = 1000; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_script_t(fh, &(save_struc->scripttable[i])); @@ -2992,7 +2972,7 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "clone_list = "); min = max = SCRIPT_MAX_CLONES; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { write_heapptr(fh, &(save_struc->clone_list[i])); @@ -3017,7 +2997,7 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "ega_colors = "); min = max = 16; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_gfx_color_t(fh, &(save_struc->ega_colors[i])); @@ -3028,14 +3008,14 @@ _cfsml_write_state_t(FILE *fh, state_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; int reladdresses[2]; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -3063,113 +3043,113 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int if (!value) return CFSML_FAILURE; if (!strcmp(token, "savegame_version")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->savegame_version), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "restarting_flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->restarting_flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "have_mouse_flag")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->have_mouse_flag), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "pic_not_valid")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->pic_not_valid), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "pic_is_new")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->pic_is_new), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "onscreen_console")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->onscreen_console), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "game_time")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_long(fh, &(save_struc->game_time), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "save_dir")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->save_dir), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "sound_object")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->sound_object), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "sound_mute")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->sound_mute), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "sound_volume")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->sound_volume), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "mouse_pointer_nr")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->mouse_pointer_nr), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "port_serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->port_serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "dyn_views_list_serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->dyn_views_list_serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "drop_views_list_serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->drop_views_list_serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "visual")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->visual), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "pic_visible_map")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->pic_visible_map), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "pic_animate")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->pic_animate), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "animation_delay")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->animation_delay), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "hunk")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = MAX_HUNK_BLOCKS; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -3182,32 +3162,32 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int } while (!done); } else if (!strcmp(token, "menubar")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_menubar_tp(fh, &(save_struc->menubar), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "status_bar_text")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_string(fh, &(save_struc->status_bar_text), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "priority_first")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->priority_first), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "priority_last")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->priority_last), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "pics")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } -#line 679 "savegame.cfsml" +#line 658 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3216,16 +3196,16 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int ; } if (max) { - save_struc->pics = (drawn_pic_t *) malloc(max * sizeof(drawn_pic_t)); + save_struc->pics = (drawn_pic_t *) sci_malloc(max * sizeof(drawn_pic_t)); _cfsml_register_pointer(save_struc->pics); } else save_struc->pics = NULL; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -3240,32 +3220,32 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int save_struc->pics_drawn_nr = i ; /* Set number of elements */ } else if (!strcmp(token, "version_lock_flag")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->version_lock_flag), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "version")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_sci_version(fh, &(save_struc->version), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "max_version")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_sci_version(fh, &(save_struc->max_version), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "min_version")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_sci_version(fh, &(save_struc->min_version), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "execution_stack")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } -#line 679 "savegame.cfsml" +#line 658 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3274,16 +3254,16 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int ; } if (max) { - save_struc->execution_stack = (exec_stack_t *) malloc(max * sizeof(exec_stack_t)); + save_struc->execution_stack = (exec_stack_t *) sci_malloc(max * sizeof(exec_stack_t)); _cfsml_register_pointer(save_struc->execution_stack); } else save_struc->execution_stack = NULL; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -3298,63 +3278,63 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int save_struc->execution_stack_pos = i -1; /* Set number of elements */ } else if (!strcmp(token, "acc")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gint16(fh, &(save_struc->acc), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "amp_rest")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gint16(fh, &(save_struc->amp_rest), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "prev")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gint16(fh, &(save_struc->prev), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "stack_base")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->stack_base), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "stack_handle")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->stack_handle), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "parser_base")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->parser_base), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "parser_event")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->parser_event), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "global_vars")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->global_vars), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "parser_lastmatch_word")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->parser_lastmatch_word), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "parser_nodes")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = VOCAB_TREE_NODES; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -3367,17 +3347,17 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int } while (!done); } else if (!strcmp(token, "parser_valid")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->parser_valid), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "synonyms")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } -#line 679 "savegame.cfsml" +#line 658 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3386,16 +3366,16 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int ; } if (max) { - save_struc->synonyms = (synonym_t *) malloc(max * sizeof(synonym_t)); + save_struc->synonyms = (synonym_t *) sci_malloc(max * sizeof(synonym_t)); _cfsml_register_pointer(save_struc->synonyms); } else save_struc->synonyms = NULL; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -3409,17 +3389,17 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int save_struc->synonyms_nr = max ; /* Set array size accordingly */ } else if (!strcmp(token, "game_obj")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->game_obj), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "classtable")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } -#line 679 "savegame.cfsml" +#line 658 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3428,16 +3408,16 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int ; } if (max) { - save_struc->classtable = (class_t *) malloc(max * sizeof(class_t)); + save_struc->classtable = (class_t *) sci_malloc(max * sizeof(class_t)); _cfsml_register_pointer(save_struc->classtable); } else save_struc->classtable = NULL; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -3451,18 +3431,18 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int save_struc->classtable_size = max ; /* Set array size accordingly */ } else if (!strcmp(token, "scripttable")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = 1000; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -3475,18 +3455,18 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int } while (!done); } else if (!strcmp(token, "clone_list")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = SCRIPT_MAX_CLONES; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -3499,43 +3479,43 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int } while (!done); } else if (!strcmp(token, "_heap->first_free")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->_heap->first_free), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "_heap->old_ff")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->_heap->old_ff), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "_heap->base")) { -#line 658 "savegame.cfsml" +#line 637 "savegame.cfsml" if (_cfsml_read_int(fh, &(reladdresses[0]), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "game_name")) { -#line 658 "savegame.cfsml" +#line 637 "savegame.cfsml" if (_cfsml_read_int(fh, &(reladdresses[1]), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "port_ID")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->port_ID), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ega_colors")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = 16; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -3547,7 +3527,7 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int } else done = 1; } while (!done); } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -3558,14 +3538,14 @@ _cfsml_read_state_t(FILE *fh, state_t* save_struc, char *lastval, int *line, int return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_menu_item_t(FILE *fh, menu_item_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "type = "); _cfsml_write_int(fh, &(save_struc->type)); @@ -3581,7 +3561,7 @@ _cfsml_write_menu_item_t(FILE *fh, menu_item_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "said = "); min = max = MENU_SAID_SPEC_SIZE; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_byte(fh, &(save_struc->said[i])); @@ -3613,13 +3593,13 @@ _cfsml_write_menu_item_t(FILE *fh, menu_item_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_menu_item_t(FILE *fh, menu_item_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -3647,38 +3627,38 @@ _cfsml_read_menu_item_t(FILE *fh, menu_item_t* save_struc, char *lastval, int *l if (!value) return CFSML_FAILURE; if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "keytext")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_string(fh, &(save_struc->keytext), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "keytext_size")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->keytext_size), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "said")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = MENU_SAID_SPEC_SIZE; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -3691,41 +3671,41 @@ _cfsml_read_menu_item_t(FILE *fh, menu_item_t* save_struc, char *lastval, int *l } while (!done); } else if (!strcmp(token, "said_pos")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->said_pos), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "text")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_string(fh, &(save_struc->text), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "text_pos")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->text_pos), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "modifiers")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->modifiers), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "key")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->key), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "enabled")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->enabled), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "tag")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->tag), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -3734,14 +3714,14 @@ _cfsml_read_menu_item_t(FILE *fh, menu_item_t* save_struc, char *lastval, int *l return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfx_color_t(FILE *fh, gfx_color_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "visual = "); write_pixmap_color(fh, &(save_struc->visual)); @@ -3761,13 +3741,13 @@ _cfsml_write_gfx_color_t(FILE *fh, gfx_color_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfx_color_t(FILE *fh, gfx_color_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -3795,31 +3775,31 @@ _cfsml_read_gfx_color_t(FILE *fh, gfx_color_t* save_struc, char *lastval, int *l if (!value) return CFSML_FAILURE; if (!strcmp(token, "visual")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_pixmap_color(fh, &(save_struc->visual), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "alpha")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->alpha), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "control")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->control), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "mask")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_byte(fh, &(save_struc->mask), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -3828,7 +3808,7 @@ _cfsml_read_gfx_color_t(FILE *fh, gfx_color_t* save_struc, char *lastval, int *l return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_long(FILE *fh, long* save_struc) { @@ -3838,13 +3818,13 @@ _cfsml_write_long(FILE *fh, long* save_struc) fprintf(fh, "%li", (long) *save_struc); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_long(FILE *fh, long* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 581 "savegame.cfsml" +#line 560 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if (*token != 0) { @@ -3854,7 +3834,7 @@ _cfsml_read_long(FILE *fh, long* save_struc, char *lastval, int *line, int *hite return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_byte(FILE *fh, byte* save_struc) { @@ -3864,13 +3844,13 @@ _cfsml_write_byte(FILE *fh, byte* save_struc) fprintf(fh, "%li", (long) *save_struc); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_byte(FILE *fh, byte* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 581 "savegame.cfsml" +#line 560 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if (*token != 0) { @@ -3880,14 +3860,14 @@ _cfsml_read_byte(FILE *fh, byte* save_struc, char *lastval, int *line, int *hite return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_script_t(FILE *fh, script_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "heappos = "); write_heapptr(fh, &(save_struc->heappos)); @@ -3910,13 +3890,13 @@ _cfsml_write_script_t(FILE *fh, script_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_script_t(FILE *fh, script_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -3944,36 +3924,36 @@ _cfsml_read_script_t(FILE *fh, script_t* save_struc, char *lastval, int *line, i if (!value) return CFSML_FAILURE; if (!strcmp(token, "heappos")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->heappos), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "localvar_offset")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->localvar_offset), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "export_table_offset")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->export_table_offset), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "synonyms_offset")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->synonyms_offset), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "lockers")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->lockers), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "synonyms_nr")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->synonyms_nr), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -3982,14 +3962,14 @@ _cfsml_read_script_t(FILE *fh, script_t* save_struc, char *lastval, int *line, i return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_class_t(FILE *fh, class_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "script = "); _cfsml_write_int(fh, &(save_struc->script)); @@ -4000,13 +3980,13 @@ _cfsml_write_class_t(FILE *fh, class_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_class_t(FILE *fh, class_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -4034,16 +4014,16 @@ _cfsml_read_class_t(FILE *fh, class_t* save_struc, char *lastval, int *line, int if (!value) return CFSML_FAILURE; if (!strcmp(token, "script")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->script), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "class_offset")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->class_offset), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -4052,14 +4032,14 @@ _cfsml_read_class_t(FILE *fh, class_t* save_struc, char *lastval, int *line, int return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_synonym_t(FILE *fh, synonym_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "replaceant = "); _cfsml_write_int(fh, &(save_struc->replaceant)); @@ -4070,13 +4050,13 @@ _cfsml_write_synonym_t(FILE *fh, synonym_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_synonym_t(FILE *fh, synonym_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -4104,16 +4084,16 @@ _cfsml_read_synonym_t(FILE *fh, synonym_t* save_struc, char *lastval, int *line, if (!value) return CFSML_FAILURE; if (!strcmp(token, "replaceant")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->replaceant), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "replacement")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->replacement), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -4122,14 +4102,14 @@ _cfsml_read_synonym_t(FILE *fh, synonym_t* save_struc, char *lastval, int *line, return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_exec_stack_t(FILE *fh, exec_stack_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "objp = "); write_heapptr(fh, &(save_struc->objp)); @@ -4148,7 +4128,7 @@ _cfsml_write_exec_stack_t(FILE *fh, exec_stack_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "variables = "); min = max = 4; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { write_heapptr(fh, &(save_struc->variables[i])); @@ -4168,13 +4148,13 @@ _cfsml_write_exec_stack_t(FILE *fh, exec_stack_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_exec_stack_t(FILE *fh, exec_stack_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -4202,43 +4182,43 @@ _cfsml_read_exec_stack_t(FILE *fh, exec_stack_t* save_struc, char *lastval, int if (!value) return CFSML_FAILURE; if (!strcmp(token, "objp")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->objp), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "sendp")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->sendp), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "pc")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->pc), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "sp")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->sp), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "argc")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->argc), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "variables")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = 4; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -4251,21 +4231,21 @@ _cfsml_read_exec_stack_t(FILE *fh, exec_stack_t* save_struc, char *lastval, int } while (!done); } else if (!strcmp(token, "selector")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->selector), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "origin")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->origin), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -4274,7 +4254,7 @@ _cfsml_read_exec_stack_t(FILE *fh, exec_stack_t* save_struc, char *lastval, int return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfx_line_style_t(FILE *fh, gfx_line_style_t* save_struc) { @@ -4284,13 +4264,13 @@ _cfsml_write_gfx_line_style_t(FILE *fh, gfx_line_style_t* save_struc) fprintf(fh, "%li", (long) *save_struc); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfx_line_style_t(FILE *fh, gfx_line_style_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 581 "savegame.cfsml" +#line 560 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if (*token != 0) { @@ -4300,7 +4280,7 @@ _cfsml_read_gfx_line_style_t(FILE *fh, gfx_line_style_t* save_struc, char *lastv return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gint16(FILE *fh, gint16* save_struc) { @@ -4310,13 +4290,13 @@ _cfsml_write_gint16(FILE *fh, gint16* save_struc) fprintf(fh, "%li", (long) *save_struc); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gint16(FILE *fh, gint16* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 581 "savegame.cfsml" +#line 560 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if (*token != 0) { @@ -4326,14 +4306,14 @@ _cfsml_read_gint16(FILE *fh, gint16* save_struc, char *lastval, int *line, int * return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_rect_t(FILE *fh, rect_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "x = "); _cfsml_write_int(fh, &(save_struc->x)); @@ -4350,13 +4330,13 @@ _cfsml_write_rect_t(FILE *fh, rect_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_rect_t(FILE *fh, rect_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -4384,26 +4364,26 @@ _cfsml_read_rect_t(FILE *fh, rect_t* save_struc, char *lastval, int *line, int * if (!value) return CFSML_FAILURE; if (!strcmp(token, "x")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->x), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "y")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->y), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "xl")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->xl), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "yl")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->yl), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -4412,7 +4392,7 @@ _cfsml_read_rect_t(FILE *fh, rect_t* save_struc, char *lastval, int *line, int * return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfx_alignment_t(FILE *fh, gfx_alignment_t* save_struc) { @@ -4422,13 +4402,13 @@ _cfsml_write_gfx_alignment_t(FILE *fh, gfx_alignment_t* save_struc) fprintf(fh, "%li", (long) *save_struc); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfx_alignment_t(FILE *fh, gfx_alignment_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 581 "savegame.cfsml" +#line 560 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if (*token != 0) { @@ -4438,7 +4418,7 @@ _cfsml_read_gfx_alignment_t(FILE *fh, gfx_alignment_t* save_struc, char *lastval return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_int(FILE *fh, int* save_struc) { @@ -4448,13 +4428,13 @@ _cfsml_write_int(FILE *fh, int* save_struc) fprintf(fh, "%li", (long) *save_struc); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_int(FILE *fh, int* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 581 "savegame.cfsml" +#line 560 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if (*token != 0) { @@ -4464,14 +4444,14 @@ _cfsml_read_int(FILE *fh, int* save_struc, char *lastval, int *line, int *hiteof return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfxw_box_t(FILE *fh, gfxw_box_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "magic = "); _cfsml_write_int(fh, &(save_struc->magic)); @@ -4509,13 +4489,13 @@ _cfsml_write_gfxw_box_t(FILE *fh, gfxw_box_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfxw_box_t(FILE *fh, gfxw_box_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -4543,61 +4523,61 @@ _cfsml_read_gfxw_box_t(FILE *fh, gfxw_box_t* save_struc, char *lastval, int *lin if (!value) return CFSML_FAILURE; if (!strcmp(token, "magic")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->magic), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "serial")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->serial), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "flags")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->flags), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfxw_widget_types_t(fh, &(save_struc->type), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "bounds")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->bounds), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "next")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_any_widget(fh, &(save_struc->next), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ID")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ID), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "widget_priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->widget_priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "color1")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_color_t(fh, &(save_struc->color1), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "color2")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_color_t(fh, &(save_struc->color2), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "shade_type")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_gfx_box_shade_t(fh, &(save_struc->shade_type), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -4606,14 +4586,14 @@ _cfsml_read_gfxw_box_t(FILE *fh, gfxw_box_t* save_struc, char *lastval, int *lin return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_gfx_dirty_rect_t(FILE *fh, gfx_dirty_rect_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "rect = "); _cfsml_write_rect_t(fh, &(save_struc->rect)); @@ -4626,13 +4606,13 @@ _cfsml_write_gfx_dirty_rect_t(FILE *fh, gfx_dirty_rect_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_gfx_dirty_rect_t(FILE *fh, gfx_dirty_rect_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -4660,20 +4640,20 @@ _cfsml_read_gfx_dirty_rect_t(FILE *fh, gfx_dirty_rect_t* save_struc, char *lastv if (!value) return CFSML_FAILURE; if (!strcmp(token, "rect")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_rect_t(fh, &(save_struc->rect), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "next")) { -#line 736 "savegame.cfsml" +#line 715 "savegame.cfsml" if (strcmp(value, "\\null\\")) { /* null pointer? */ - save_struc->next = malloc(sizeof (gfx_dirty_rect_t)); + save_struc->next = sci_malloc(sizeof (gfx_dirty_rect_t)); _cfsml_register_pointer(save_struc->next); if (_cfsml_read_gfx_dirty_rect_t(fh, save_struc->next, value, line, hiteof)) return CFSML_FAILURE; } else save_struc->next = NULL; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -4682,14 +4662,14 @@ _cfsml_read_gfx_dirty_rect_t(FILE *fh, gfx_dirty_rect_t* save_struc, char *lastv return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_view_object_t(FILE *fh, view_object_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "obj = "); write_heapptr(fh, &(save_struc->obj)); @@ -4736,13 +4716,13 @@ _cfsml_write_view_object_t(FILE *fh, view_object_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_view_object_t(FILE *fh, view_object_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -4770,76 +4750,76 @@ _cfsml_read_view_object_t(FILE *fh, view_object_t* save_struc, char *lastval, in if (!value) return CFSML_FAILURE; if (!strcmp(token, "obj")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->obj), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "signalp")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->signalp), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "underBitsp")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (read_heapptr(fh, &(save_struc->underBitsp), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "x")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->x), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "y")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->y), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "view_nr")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->view_nr), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "loop")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->loop), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "cel")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->cel), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "nsTop")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->nsTop), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "nsLeft")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->nsLeft), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "nsRight")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->nsRight), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "nsBottom")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->nsBottom), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "underBits")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->underBits), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -4851,7 +4831,7 @@ _cfsml_read_view_object_t(FILE *fh, view_object_t* save_struc, char *lastval, in /* Auto-generated CFSML declaration and function block ends here */ /* Auto-generation performed by cfsml.pl 0.8.2 */ -#line 443 "savegame.cfsml" +#line 444 "savegame.cfsml" void write_hunk_block(FILE *fh, hunk_block_t *foo) @@ -4867,12 +4847,12 @@ write_hunk_block(FILE *fh, hunk_block_t *foo) if (foo->type == HUNK_TYPE_GFXBUFFER) { fputs(HUNK_TYPE_GFX_SNAPSHOT_STRING, fh); -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfxw_snapshot_t(fh, (*(((gfxw_snapshot_t**)foo->data)))); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 459 "savegame.cfsml" +#line 460 "savegame.cfsml" return; } else { /* Normal buffer */ @@ -4906,23 +4886,23 @@ read_hunk_block(FILE *fh, hunk_block_t *foo, char *lastval, int *line, int *hite if (lastval[0] == HUNK_TYPE_GFX_SNAPSHOT_STRING[0]) { /* Graphical buffer */ foo->type = HUNK_TYPE_GFXBUFFER; foo->size = sizeof(gfxw_snapshot_t); - foo->data = xalloc(sizeof (gfxw_snapshot_t *)); - *((gfxw_snapshot_t **)foo->data) = xalloc(sizeof (gfxw_snapshot_t)); + foo->data = sci_malloc(sizeof (gfxw_snapshot_t *)); + *((gfxw_snapshot_t **)foo->data) = sci_malloc(sizeof (gfxw_snapshot_t)); /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfxw_snapshot_t(fh, (*(gfxw_snapshot_t**)(foo->data)), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -4933,7 +4913,7 @@ read_hunk_block(FILE *fh, hunk_block_t *foo, char *lastval, int *line, int *hite } } /* End of auto-generated CFSML data reader code */ -#line 496 "savegame.cfsml" +#line 497 "savegame.cfsml" return 0; @@ -4946,7 +4926,7 @@ read_hunk_block(FILE *fh, hunk_block_t *foo, char *lastval, int *line, int *hite foo->size = lseek(hunkfile, 0, SEEK_END); lseek(hunkfile, 0, SEEK_SET); - foo->data = (char *) xalloc(foo->size); + foo->data = (char *) sci_malloc(foo->size); read(hunkfile, foo->data, foo->size); close(hunkfile); @@ -5025,81 +5005,81 @@ write_any_widget(FILE *fh, gfxw_widget_t **widget) switch ((*widget)->type) { case GFXW_BOX: -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfxw_box_t(fh, ((gfxw_box_t*)*widget)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 588 "savegame.cfsml" +#line 589 "savegame.cfsml" break; case GFXW_RECT: case GFXW_LINE: case GFXW_INVERSE_LINE: -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfxw_primitive_t(fh, ((gfxw_primitive_t*)*widget)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 594 "savegame.cfsml" +#line 595 "savegame.cfsml" break; case GFXW_VIEW: case GFXW_STATIC_VIEW: -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfxw_view_t(fh, ((gfxw_view_t*)*widget)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 599 "savegame.cfsml" +#line 600 "savegame.cfsml" break; case GFXW_DYN_VIEW: case GFXW_PIC_VIEW: -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfxw_dyn_view_t(fh, ((gfxw_dyn_view_t*)*widget)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 604 "savegame.cfsml" +#line 605 "savegame.cfsml" break; case GFXW_TEXT: -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfxw_text_t(fh, ((gfxw_text_t*)*widget)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 608 "savegame.cfsml" +#line 609 "savegame.cfsml" break; case GFXW_SORTED_LIST: case GFXW_LIST: -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfxw_list_t(fh, ((gfxw_list_t*)*widget)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 614 "savegame.cfsml" +#line 615 "savegame.cfsml" break; case GFXW_VISUAL: -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfxw_visual_t(fh, ((gfxw_visual_t*)*widget)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 618 "savegame.cfsml" +#line 619 "savegame.cfsml" break; case GFXW_PORT: -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfxw_port_t(fh, ((gfxw_port_t*)*widget)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 622 "savegame.cfsml" +#line 623 "savegame.cfsml" break; case GFXW_: @@ -5109,19 +5089,19 @@ write_any_widget(FILE *fh, gfxw_widget_t **widget) (*widget)->print((*widget), 0); if ((*widget)->type == GFXW_CONTAINER) { -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfxw_container_t(fh, ((gfxw_container_t*)*widget)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 632 "savegame.cfsml" +#line 633 "savegame.cfsml" } else { -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfxw_widget_t(fh, (*widget)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 634 "savegame.cfsml" +#line 635 "savegame.cfsml" } break; } @@ -5305,19 +5285,19 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int case GFXW_BOX: *widget = _gfxw_new_widget(sizeof(gfxw_box_t), expected_type); /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfxw_box_t(fh, ((gfxw_box_t*)*widget), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5328,7 +5308,7 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int } } /* End of auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 818 "savegame.cfsml" break; case GFXW_RECT: @@ -5336,19 +5316,19 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int case GFXW_INVERSE_LINE: *widget = _gfxw_new_widget(sizeof(gfxw_primitive_t), expected_type); /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfxw_primitive_t(fh, ((gfxw_primitive_t*)*widget), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5359,26 +5339,26 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int } } /* End of auto-generated CFSML data reader code */ -#line 824 "savegame.cfsml" +#line 825 "savegame.cfsml" break; case GFXW_VIEW: case GFXW_STATIC_VIEW: *widget = _gfxw_new_widget(sizeof(gfxw_view_t), expected_type); /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfxw_view_t(fh, ((gfxw_view_t*)*widget), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5389,26 +5369,26 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int } } /* End of auto-generated CFSML data reader code */ -#line 830 "savegame.cfsml" +#line 831 "savegame.cfsml" break; case GFXW_DYN_VIEW: case GFXW_PIC_VIEW: *widget = _gfxw_new_widget(sizeof(gfxw_dyn_view_t), expected_type); /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfxw_dyn_view_t(fh, ((gfxw_dyn_view_t*)*widget), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5419,7 +5399,7 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int } } /* End of auto-generated CFSML data reader code */ -#line 836 "savegame.cfsml" +#line 837 "savegame.cfsml" (*widget)->type = expected_type; if (FILE_VERSION == 1) ((gfxw_dyn_view_t *) widget)->force_precedence = 0; @@ -5428,19 +5408,19 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int case GFXW_TEXT: *widget = _gfxw_new_widget(sizeof(gfxw_text_t), expected_type); /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfxw_text_t(fh, ((gfxw_text_t*)*widget), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5451,7 +5431,7 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int } } /* End of auto-generated CFSML data reader code */ -#line 844 "savegame.cfsml" +#line 845 "savegame.cfsml" (*widget)->type = expected_type; break; @@ -5462,19 +5442,19 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int GFXWC(*widget)->contents = NULL; GFXWC(*widget)->dirty = NULL; /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfxw_list_t(fh, ((gfxw_list_t*)*widget), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5485,7 +5465,7 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int } } /* End of auto-generated CFSML data reader code */ -#line 854 "savegame.cfsml" +#line 855 "savegame.cfsml" (*widget)->type = expected_type; break; @@ -5494,19 +5474,19 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int GFXWC(*widget)->contents = NULL; GFXWC(*widget)->dirty = NULL; /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfxw_visual_t(fh, ((gfxw_visual_t*)*widget), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5517,7 +5497,7 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int } } /* End of auto-generated CFSML data reader code */ -#line 862 "savegame.cfsml" +#line 863 "savegame.cfsml" (*widget)->type = expected_type; full_widget_tree_traversal(*widget, NULL, NULL); @@ -5531,19 +5511,19 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int ((gfxw_port_t *) (*widget))->decorations = NULL; ((gfxw_port_t *) (*widget))->port_bg = NULL; /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfxw_port_t(fh, ((gfxw_port_t*)*widget), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5554,7 +5534,7 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int } } /* End of auto-generated CFSML data reader code */ -#line 875 "savegame.cfsml" +#line 876 "savegame.cfsml" (*widget)->type = expected_type; break; @@ -5564,19 +5544,19 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int GFXWC(*widget)->dirty = NULL; sciprintf("Warning: Restoring untyped widget container\n"); /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfxw_container_t(fh, ((gfxw_container_t*)*widget), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5587,7 +5567,7 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int } } /* End of auto-generated CFSML data reader code */ -#line 884 "savegame.cfsml" +#line 885 "savegame.cfsml" (*widget)->type = expected_type; break; @@ -5595,19 +5575,19 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int *widget = _gfxw_new_widget(sizeof(gfxw_widget_t), expected_type); sciprintf("Warning: Restoring untyped widget\n"); /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfxw_widget_t(fh, (*widget), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5618,7 +5598,7 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int } } /* End of auto-generated CFSML data reader code */ -#line 891 "savegame.cfsml" +#line 892 "savegame.cfsml" (*widget)->type = expected_type; break; @@ -5646,30 +5626,30 @@ read_any_widget(FILE *fh, gfxw_widget_t **widget, char *lastval, int *line, int void write_pixmap_color(FILE *fh, gfx_pixmap_color_t *color) { -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_gfx_pixmap_color_t(fh, (color)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 919 "savegame.cfsml" +#line 920 "savegame.cfsml" } int read_pixmap_color(FILE *fh, gfx_pixmap_color_t *color, char *lastval, int *line, int *hiteof) { /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 833 "savegame.cfsml" +#line 812 "savegame.cfsml" char *_cfsml_inp = lastval; -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_gfx_pixmap_color_t(fh, (color), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5680,7 +5660,7 @@ read_pixmap_color(FILE *fh, gfx_pixmap_color_t *color, char *lastval, int *line, } } /* End of auto-generated CFSML data reader code */ -#line 925 "savegame.cfsml" +#line 926 "savegame.cfsml" color->global_index = GFX_COLOR_INDEX_UNMAPPED; @@ -5699,12 +5679,12 @@ write_menubar_tp(FILE *fh, menubar_t **foo) { if (*foo) { -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_menubar_t(fh, (*foo)); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 944 "savegame.cfsml" +#line 945 "savegame.cfsml" } else { /* Nothing to write */ fputs("\\null\\", fh); @@ -5722,18 +5702,18 @@ read_menubar_tp(FILE *fh, menubar_t **foo, char *lastval, int *line, int *hiteof *foo = (menubar_t *) malloc(sizeof(menubar_t)); /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 833 "savegame.cfsml" +#line 812 "savegame.cfsml" char *_cfsml_inp = lastval; -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_menubar_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" *hiteof = _cfsml_error; -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5744,7 +5724,7 @@ read_menubar_tp(FILE *fh, menubar_t **foo, char *lastval, int *line, int *hiteof } } /* End of auto-generated CFSML data reader code */ -#line 961 "savegame.cfsml" +#line 962 "savegame.cfsml" } return *hiteof; @@ -5812,12 +5792,12 @@ SCI_MEMTEST; s->game_time = time(NULL) - s->game_start_time.tv_sec; SCI_MEMTEST; -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_state_t(fh, s); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 1029 "savegame.cfsml" +#line 1030 "savegame.cfsml" SCI_MEMTEST; fclose(fh); @@ -5854,7 +5834,7 @@ gamestate_restore(state_t *s, char *dirname) } } - retval = (state_t *) xalloc(sizeof(state_t)); + retval = (state_t *) sci_malloc(sizeof(state_t)); retval->_heap = heap_new(); retval->savegame_version = -1; _global_save_state = retval; @@ -5877,25 +5857,25 @@ gamestate_restore(state_t *s, char *dirname) retval->sound_volume = s->sound_volume; /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 820 "savegame.cfsml" +#line 799 "savegame.cfsml" int _cfsml_line_ctr = 0; -#line 825 "savegame.cfsml" +#line 804 "savegame.cfsml" struct _cfsml_pointer_refstruct **_cfsml_myptrrefptr = _cfsml_get_current_refpointer(); -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(_cfsml_line_ctr), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_state_t(fh, retval, _cfsml_inp, &(_cfsml_line_ctr), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" read_eof = _cfsml_error; -#line 850 "savegame.cfsml" +#line 829 "savegame.cfsml" _cfsml_free_pointer_references(_cfsml_myptrrefptr, _cfsml_error); -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -5906,7 +5886,7 @@ gamestate_restore(state_t *s, char *dirname) } } /* End of auto-generated CFSML data reader code */ -#line 1088 "savegame.cfsml" +#line 1089 "savegame.cfsml" fclose(fh); diff --git a/src/engine/savegame.cfsml b/src/engine/savegame.cfsml index c4f09e60..71c6a04a 100644 --- a/src/engine/savegame.cfsml +++ b/src/engine/savegame.cfsml @@ -30,6 +30,7 @@ ** savegame.cfsml. If this doesn't solve your problem, contact the maintainer. */ +#include #include #include #include @@ -489,8 +490,8 @@ read_hunk_block(FILE *fh, hunk_block_t *foo, char *lastval, int *line, int *hite if (lastval[0] == HUNK_TYPE_GFX_SNAPSHOT_STRING[0]) { /* Graphical buffer */ foo->type = HUNK_TYPE_GFXBUFFER; foo->size = sizeof(gfxw_snapshot_t); - foo->data = xalloc(sizeof (gfxw_snapshot_t *)); - *((gfxw_snapshot_t **)foo->data) = xalloc(sizeof (gfxw_snapshot_t)); + foo->data = sci_malloc(sizeof (gfxw_snapshot_t *)); + *((gfxw_snapshot_t **)foo->data) = sci_malloc(sizeof (gfxw_snapshot_t)); %CFSMLREAD gfxw_snapshot_t (*(gfxw_snapshot_t**)(foo->data)) FROM fh ERRVAR *hiteof LINECOUNTER *line @@ -505,7 +506,7 @@ read_hunk_block(FILE *fh, hunk_block_t *foo, char *lastval, int *line, int *hite foo->size = lseek(hunkfile, 0, SEEK_END); lseek(hunkfile, 0, SEEK_SET); - foo->data = (char *) xalloc(foo->size); + foo->data = (char *) sci_malloc(foo->size); read(hunkfile, foo->data, foo->size); close(hunkfile); @@ -1062,7 +1063,7 @@ gamestate_restore(state_t *s, char *dirname) } } - retval = (state_t *) xalloc(sizeof(state_t)); + retval = (state_t *) sci_malloc(sizeof(state_t)); retval->_heap = heap_new(); retval->savegame_version = -1; _global_save_state = retval; diff --git a/src/gfx/gfx_test.c b/src/gfx/gfx_test.c index 2ff2e055..99fada4e 100644 --- a/src/gfx/gfx_test.c +++ b/src/gfx/gfx_test.c @@ -60,7 +60,7 @@ sci_gettime(int *seconds, int *useconds) #ifdef _WIN32 timeBeginPeriod(0); #endif - + assert(!gettimeofday(&tv, NULL)); *seconds = time(NULL); *useconds = tv.tv_usec; @@ -167,14 +167,6 @@ arrdup(int *src, int count) return retval; } -byte * -memdup(byte *src, int size) -{ - byte *retval = malloc(size); - memcpy(retval, src, size); - return retval; -} - int * gfxr_interpreter_get_resources(gfx_resource_types_t type, int version, int *entries_nr) { @@ -1078,8 +1070,8 @@ do_tests(char *conf) test_f(); } -int -c_quit(void *S) +int +c_quit(void *S) { exit(0); } diff --git a/src/gfx/menubar.c b/src/gfx/menubar.c index 33e15a72..89aece64 100644 --- a/src/gfx/menubar.c +++ b/src/gfx/menubar.c @@ -29,6 +29,7 @@ ** used for any actual actions on behalf of the interpreter. */ +#include #include #include @@ -67,27 +68,6 @@ __my_free(void *origin, char *function, int line) #define free(x) __my_free(x, __PRETTY_FUNCTION__, __LINE__) */ -char * -malloc_cpy(char *source) -{ - char *tmp = malloc(strlen(source) + 1); - - strcpy(tmp, source); - return tmp; -} - -char * -malloc_ncpy(char *source, size_t length) -{ - int rlen = MIN(strlen(source), length) + 1; - char *tmp = malloc(rlen); - - strncpy(tmp, source, rlen); - tmp[rlen -1] = 0; - - return tmp; -} - menubar_t * menubar_new() { @@ -197,7 +177,7 @@ menubar_add_menu(gfx_state_t *state, menubar_t *menubar, char *title, char *entr menu = &(menubar->menus[menubar->menus_nr-1]); memset(menu, 0, sizeof(menu_t)); menu->items_nr = 0; - menu->title = malloc_cpy(title); + menu->title = sci_strdup(title); gfxop_get_text_params(state, font, menu->title, SIZE_INF, &(menu->title_width), &height); @@ -208,7 +188,7 @@ menubar_add_menu(gfx_state_t *state, menubar_t *menubar, char *title, char *entr if (tracker == '=') { /* Hit early-SCI tag assignment? */ - left = malloc_ncpy(entries - string_len - 1, string_len); + left = sci_strndup(entries - string_len - 1, string_len); tag = atoi(entries++); tracker = *entries++; } @@ -217,7 +197,7 @@ menubar_add_menu(gfx_state_t *state, menubar_t *menubar, char *title, char *entr char *inleft; if (!left) - left = malloc_ncpy(entries - string_len - 1, string_len); + left = sci_strndup(entries - string_len - 1, string_len); inleft = left; while (isspace(*inleft)) @@ -243,17 +223,17 @@ menubar_add_menu(gfx_state_t *state, menubar_t *menubar, char *title, char *entr } else if (tracker == '`') { /* Start of right string */ if (!left) - left = malloc_ncpy(left_origin = (entries - string_len - 1), string_len); + left = sci_strndup(left_origin = (entries - string_len - 1), string_len); string_len = 0; /* Continue with the right string */ - } + } else string_len++; /* Nothing special */ } else { /* Left string finished => working on right string */ if ((tracker == ':') || (tracker == 0)) { /* End of entry */ int key, modifiers = 0; - right = malloc_ncpy(entries - string_len - 1, string_len); + right = sci_strndup(entries - string_len - 1, string_len); if (right[0] == '#') { right[0] = SCI_SPECIAL_CHAR_FUNCTION; /* Function key */ @@ -335,7 +315,7 @@ menubar_add_menu(gfx_state_t *state, menubar_t *menubar, char *title, char *entr #ifdef MENU_FREESCI_BLATANT_PLUG if (add_freesci) { - + char *freesci_text = strdup ("About FreeSCI"); c_width = _menubar_add_menu_item(state, menu, MENU_TYPE_NORMAL, freesci_text, NULL, font, 0, 0, 0, 0); if (c_width > max_width) diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 35fe9d2b..f1a75e84 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -8,4 +8,4 @@ EXTRA_DIST = old_objects.h graphics_glx.h kernel.h event.h \ gfx_state_internal.h gfx_system.h gfx_tools.h \ sci_graphics.h sci_widgets.h scitypes.h sbtree.h \ gfx_drivers_list.h sciresource.h midiout.h \ - midi_device.h modules.h + midi_device.h modules.h sci_memory.h diff --git a/src/include/console.h b/src/include/console.h index a3d7d136..b2678cbb 100644 --- a/src/include/console.h +++ b/src/include/console.h @@ -33,6 +33,7 @@ #ifndef _SCI_CONSOLE_H_ #define _SCI_CONSOLE_H_ +#include #include #ifdef HAVE_CONFIG_H diff --git a/src/include/kernel.h b/src/include/kernel.h index a830d5fd..486891a9 100644 --- a/src/include/kernel.h +++ b/src/include/kernel.h @@ -288,7 +288,7 @@ set_base(struct _state *s, heap_ptr object); ** Returns : (abs_rect) The absolute base rectangle */ -abs_rect_t +extern abs_rect_t get_nsrect(struct _state *s, heap_ptr object, byte clip); /* Determines the now-seen rectangle of a view object ** Parameters: (state_t *) s: The state to use diff --git a/src/include/menubar.h b/src/include/menubar.h index f1ff4d07..3be5570d 100644 --- a/src/include/menubar.h +++ b/src/include/menubar.h @@ -126,25 +126,6 @@ struct gfx_picture; /* forward declarations for graphics.h */ /********** function definitions *********/ -char * -malloc_cpy(char *source); -/* Copies a string into a newly allocated memory part -** Parameters: (char *) source: The source string -** Returns : (char *) The resulting copy, allocated with malloc(). -** To free this string, use the standard free() command. -*/ - - -char * -malloc_ncpy(char *source, size_t length); -/* Copies a string into a newly allocated memory part, up to a certain length. -** Parameters: (char *) source: The source string -** (int) length: The maximum length of the string (not conting a trailing \0). -** Returns : (char *) The resulting copy, allocated with malloc(). -** To free this string, use the standard free() command. -*/ - - menubar_t * menubar_new(); /* Creates a new menubar struct diff --git a/src/include/resource.h b/src/include/resource.h index be1b4025..477b4b15 100644 --- a/src/include/resource.h +++ b/src/include/resource.h @@ -191,31 +191,8 @@ isblank(int foo) } #endif -void * -_XALLOC(size_t size, char *file, int line, char *funct); -#ifdef __GNUC__ -#define xalloc(size) \ - _XALLOC((size), __FILE__, __LINE__, __PRETTY_FUNCTION__) -#else /* !__GNUC__ */ -#define xalloc(size) \ - _XALLOC((size), __FILE__, __LINE__, "") -#endif /* !__GNUC__ */ -/* Tries to allocate memory, prints an error message if not successful. -** Parameters: size: Number of bytes to allocate -** Returns : (void *) The address of the allocated memory block -*/ - #define SCI_MEMTEST memtest(__FILE__ ": line %d", __LINE__) -void * -sci_memdup(void *src, size_t size); -/* Duplicates a chunk of memory -** Parameters: (void *) src: Pointer to the data to duplicate -** (size_t) size: Number of bytes to duplicate -** Returns : (void *) An appropriately allocated duplicate, or NULL on error -** Please try to avoid data duplication unless absolutely neccessary! -*/ - /*-- queues --*/ typedef struct _sci_queue_node { @@ -369,52 +346,6 @@ sci_sched_yield(); ** Returns : after a while. */ - -#ifdef SCI_SAFE_ALLOC - -void * -sci_malloc(size_t size); -/* Allocates the specified amount of memory -** Parameters: (size_t) size: Amount of bytes to allocate -** Returns : (void *) A pointer to the allocated memory chunk -** If not enough memory is available, this function suspends execution and -** waits for it to become available again. -*/ - -void * -sci_calloc(size_t nmemb, size_t count); -/* Allocates nmemb*count bytes of zeroed-out memory -** Parameters: (size_t, size_t) nmemb, count: Two factors describing the amount -** of memory -** Returns : (void *) A pointer to the allocated memory chunk -** See 'scialloc()' for more information. -*/ - -void * -sci_realloc(void *ptr, size_t size); -/* Increases the size of an allocated memory chunk -** Parameters: (void *) ptr: The original pointer -** (size_t) size: New size of the memory chunk -** Returns : (void *) A possibly new pointer, containing 'size' -** bytes of memory and everything contained in the original 'ptr' -** (possibly minus some trailing data if the new memory area is -** smaller than the old one). -** See 'scialloc()' for more information. -*/ - -#else -# define sci_malloc(size) malloc(size) -# define sci_calloc(nmemb, size) calloc(nmemb, size) -# define sci_realloc(ptr, size) realloc(ptr size) -#endif - -#define sci_free(ptr) free(ptr) -/* Frees previously allocated memory chunks -** Parameters: (void *) ptr: The pointer to free -** Returns : (void) -*/ - - /* The following was originally based on glib.h code, which was * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald */ diff --git a/src/include/sci_memory.h b/src/include/sci_memory.h new file mode 100644 index 00000000..0f6210a7 --- /dev/null +++ b/src/include/sci_memory.h @@ -0,0 +1,422 @@ +/*************************************************************************** + sci_memory.h Copyright (C) 2001 Alexander R Angas + + + This program may be modified and copied freely according to the terms of + the GNU general public license (GPL), as long as the above copyright + notice and the licensing information contained herein are preserved. + + Please refer to www.gnu.org for licensing details. + + This work is provided AS IS, without warranty of any kind, expressed or + implied, including but not limited to the warranties of merchantibility, + noninfringement, and fitness for a specific purpose. The author will not + be held liable for any damage caused by this work or derivatives of it. + + By using this source code, you agree to the licensing terms as stated + above. + + + Please contact the maintainer for bug reports or inquiries. + + Current Maintainer: + + Alexander R Angas (Alex Angas) + + History: + + 20010815 - assembled from the various memory allocation functions lying + about, namely resource.h, tools.c (for repeated allocation + attempts), menubar.h (for malloc_cpy, malloc_ncpy). + -- Alex Angas + +***************************************************************************/ + + +/** This header file defines a portable library for allocating memory safely + ** throughout FreeSCI. + ** Implementations of basic functions found here are in this file and + ** $(SRCDIR)/src/scicore/sci_memory.c + * + * Usage notes: + ************** + * + * Define SCI_ALLOC_DEBUG to output debug information whenever a memory + * allocation function is called. + * + * Make sure you #define it before any #includes. + * + * #define SCI_ALLOC_DEBUG + * #include <...> + * + ************** + * + * Define WITH_DMALLOC to use the dmalloc debug library, available from + * http://dmalloc.com/ + * + ** -- Alex Angas + ** + **/ + + +/* set optimisations for Win32: */ +/* g on: enable global optimizations */ +/* t on: use fast code */ +/* y on: suppress creation of frame pointers on stack */ +/* s off: disable minimize size code */ + +#ifdef _WIN32 +#include +#define sleep Sleep +# ifdef NDEBUG +# pragma optimize( "s", off ) +# pragma optimize( "gty", on ) +# endif +#endif + +#include +#include +#include +#include + +#ifndef _SCI_MEMORY_H +#define _SCI_MEMORY_H + +#ifndef MIN +# define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif + + +/********** #defines and macro definitions **********/ + +/* + * Sets behaviour if memory allocation call fails. + * SCI_ALLOC undefined: used standard C routine anyway + * SCI_ALLOC 1: exit immediately + * SCI_ALLOC 2: attempt to allocate memory indefinitely + */ +/* #define SCI_ALLOC 1 */ + + +/********** macros for error messages **********/ + +/* + * Prints an error message. + */ +#define PANIC(prn)\ +do {\ + fprintf prn;\ +} while (0); + +/* + * Called if memory allocation fails. + */ +#ifdef WITH_DMALLOC +#define PANIC_MEMORY(size, filename, linenum, funcname, more_info)\ +do {\ + PANIC((stderr, "Memory allocation of %lu bytes failed\n"\ + " [%s (%s) : %u]\n " #more_info "\n %s\n",\ + size, filename, funcname, linenum, dmalloc_strerror(dmalloc_errno)))\ +} while (0); +#else +#define PANIC_MEMORY(size, filename, linenum, funcname, more_info)\ +do{\ + PANIC((stderr, "Memory allocation of %lu bytes failed\n"\ + " [%s (%s) : %u]\n " #more_info "\n %s\n",\ + size, filename, funcname, linenum, strerror(errno)))\ +} while (0); +#endif + + +/********** macros for memory allocation **********/ + +#ifndef SCI_ALLOC + +#define ALLOC_MEM(alloc_statement, size, filename, linenum, funcname, debug)\ + alloc_statement; + +#else /* SCI_ALLOC */ + +#define ALLOC_MEM(alloc_statement, size, filename, linenum, funcname, debug)\ +do {\ + if (debug)\ + fprintf(stderr, "ALLOC_MEM(%lu bytes) [%s (%s) : %u] "\ + #alloc_statement "\n",\ + size, filename, funcname, linenum);\ +\ + if (size <= 0)\ + {\ + PANIC_MEMORY(size, filename, linenum, funcname, "Cannot allocate negative or zero memory!");\ + BREAKPOINT();\ + }\ +\ + alloc_statement; /* attempt to allocate the memory */\ +\ + if (res == NULL)\ + {\ + if (SCI_ALLOC == 1)\ + {\ + /* SCI_ALLOC 1: exit immediately */\ + PANIC_MEMORY(size, filename, linenum, funcname, "Exiting...");\ + BREAKPOINT();\ + }\ + else if (SCI_ALLOC == 1)\ + {\ + do\ + {\ + /* SCI_ALLOC 2: attempt to allocate memory indefinitely */\ + PANIC_MEMORY(size, filename, linenum, funcname, "Trying again...");\ + sleep(1000);\ + alloc_statement;\ + } while (res == NULL);\ + }\ + else\ + {\ + PANIC((stderr, "Unrecognised value for SCI_ALLOC!"));\ + BREAKPOINT();\ + }\ + }\ +} while (0); + +#endif /* SCI_ALLOC */ + + +/********** memory allocation routines **********/ + +extern inline void * +_SCI_MALLOC(size_t size, char *file, int line, char *funct, int debug); +/* Allocates the specified amount of memory. +** Parameters: (size_t) size: Number of bytes to allocate +** (char *) file: Filename this routine is called from +** (use __FILE__) +** (int) line: Line number this routine is called from +** (use __LINE__) +** (char *) funct: Function this routine is called from +** (use __PRETTY_FUNCTION__ if available) +** (int) debug: If true, outputs debug information +** Returns : (void *) A pointer to the allocated memory chunk +** To free this string, use the sci_free() command. +** If the call fails, behaviour is dependent on the definition of SCI_ALLOC. +*/ + +extern inline void * +_SCI_CALLOC(size_t num, size_t size, char *file, int line, char *funct, int debug); +/* Allocates num * size bytes of zeroed-out memory. +** Parameters: (size_t) num: Number of elements to allocate +** (size_t) size: Amount of memory per element to allocate +** Please see _SCI_MALLOC() for details on other parameters. +** Returns : (void *) A pointer to the allocated memory chunk +** To free this string, use the sci_free() command. +** See _SCI_MALLOC() for more information if call fails. +*/ + +extern inline void * +_SCI_REALLOC(void *ptr, size_t size, char *file, int line, char *funct, int debug); +/* Increases the size of an allocated memory chunk. +** Parameters: (void *) ptr: The original pointer +** (size_t) size: New size of the memory chunk +** Please see _SCI_MALLOC() for details on other parameters. +** Returns : (void *) A possibly new pointer, containing 'size' +** bytes of memory and everything contained in the original 'ptr' +** (possibly minus some trailing data if the new memory area is +** smaller than the old one). +** To free this string, use the sci_free() command. +** See _SCI_MALLOC() for more information if call fails. +*/ + +extern inline void +_SCI_FREE(void *ptr, char *file, int line, char *funct, int debug); +/* Frees previously allocated memory chunks +** Parameters: (void *) ptr: The pointer to free +** Please see _SCI_MALLOC() for details on other parameters. +** Returns : (void) +*/ + +extern inline void * +_SCI_MEMDUP(void *src, size_t size, char *file, int line, char *funct, int debug); +/* Duplicates a chunk of memory +** Parameters: (void *) src: Pointer to the data to duplicate +** (size_t) size: Number of bytes to duplicate +** Please see _SCI_MALLOC() for details on other parameters. +** Returns : (void *) An appropriately allocated duplicate, or NULL on error +** Please try to avoid data duplication unless absolutely neccessary! +** To free this string, use the sci_free() command. +** See _SCI_MALLOC() for more information if call fails. +*/ + +extern inline char * +_SCI_STRDUP(const char *src, char *file, int line, char *funct, int debug); +/* Duplicates a string. +** Parameters: (const char *) src: The original pointer +** Please see _SCI_MALLOC() for details on other parameters. +** Returns : (char *) a pointer to the storage location for the copied +** string. +** To free this string, use the sci_free() command. +** See _SCI_MALLOC() for more information if call fails. +*/ + + +extern inline char * +_SCI_STRNDUP(const char *src, size_t length, char *file, int line, char *funct, int debug); +/* Copies a string into a newly allocated memory part, up to a certain length. +** Parameters: (char *) src: The source string +** (int) length: The maximum length of the string (not counting +** a trailing \0). +** Please see _SCI_MALLOC() for details on other parameters. +** Returns : (char *) The resulting copy, allocated with sci_malloc(). +** To free this string, use the sci_free() command. +** See _SCI_MALLOC() for more information if call fails. +*/ + + +/********** macro definitions for routines **********/ + +#ifdef __GNUC__ +# ifndef SCI_ALLOC_DEBUG +# define sci_malloc(size)\ + _SCI_MALLOC(size, __FILE__, __LINE__, __PRETTY_FUNCTION__, 0) +# else +# define sci_malloc(size)\ + _SCI_MALLOC(size, __FILE__, __LINE__, __PRETTY_FUNCTION__, 1) +# endif +#else +# ifndef SCI_ALLOC_DEBUG +# define sci_malloc(size)\ + _SCI_MALLOC(size, __FILE__, __LINE__, "", 0) +# else +# define sci_malloc(size)\ + _SCI_MALLOC(size, __FILE__, __LINE__, "", 1) +# endif +#endif + + +#ifdef __GNUC__ +# ifndef SCI_ALLOC_DEBUG +# define sci_calloc(num, count)\ + _SCI_CALLOC(num, count, __FILE__, __LINE__, __PRETTY_FUNCTION__, 0) +# else +# define sci_calloc(num, count)\ + _SCI_CALLOC(num, count, __FILE__, __LINE__, __PRETTY_FUNCTION__, 1) +# endif +#else +# ifndef SCI_ALLOC_DEBUG +# define sci_calloc(num, count)\ + _SCI_CALLOC(num, count, __FILE__, __LINE__, "", 0) +# else +# define sci_calloc(num, count)\ + _SCI_CALLOC(num, count, __FILE__, __LINE__, "", 1) +# endif +#endif + + +#ifdef __GNUC__ +# ifndef SCI_ALLOC_DEBUG +# define sci_realloc(ptr, size)\ + _SCI_REALLOC(ptr, size, __FILE__, __LINE__, __PRETTY_FUNCTION__, 0) +# else +# define sci_realloc(ptr, size)\ + _SCI_REALLOC(ptr, size, __FILE__, __LINE__, __PRETTY_FUNCTION__, 1) +# endif +#else +# ifndef SCI_ALLOC_DEBUG +# define sci_realloc(ptr, size)\ + _SCI_REALLOC(ptr, size, __FILE__, __LINE__, "", 0) +# else +# define sci_realloc(ptr, size)\ + _SCI_REALLOC(ptr, size, __FILE__, __LINE__, "", 1) +# endif +#endif + + +#ifdef __GNUC__ +# ifndef SCI_ALLOC_DEBUG +# define sci_free(ptr)\ + _SCI_FREE(ptr, __FILE__, __LINE__, __PRETTY_FUNCTION__, 0) +# else +# define sci_free(ptr)\ + _SCI_FREE(ptr, __FILE__, __LINE__, __PRETTY_FUNCTION__, 1) +# endif +#else +# ifndef SCI_ALLOC_DEBUG +# define sci_free(ptr)\ + _SCI_FREE(ptr, __FILE__, __LINE__, "", 0) +# else +# define sci_free(ptr)\ + _SCI_FREE(ptr, __FILE__, __LINE__, "", 1) +# endif +#endif + + +#ifdef __GNUC__ +# ifndef SCI_ALLOC_DEBUG +# define sci_memdup(src, size)\ + _SCI_MEMDUP(src, size, __FILE__, __LINE__, __PRETTY_FUNCTION__, 0) +# else +# define sci_memdup(src, size)\ + _SCI_MEMDUP(src, size, __FILE__, __LINE__, __PRETTY_FUNCTION__, 1) +# endif +#else +# ifndef SCI_ALLOC_DEBUG +# define sci_memdup(src, size)\ + _SCI_MEMDUP(src, size, __FILE__, __LINE__, "", 0) +# else +# define sci_memdup(src, size)\ + _SCI_MEMDUP(src, size, __FILE__, __LINE__, "", 1) +# endif +#endif + + +#ifdef __GNUC__ +# ifndef SCI_ALLOC_DEBUG +# define sci_strdup(src)\ + _SCI_STRDUP(src, __FILE__, __LINE__, __PRETTY_FUNCTION__, 0) +# else +# define sci_strdup(src)\ + _SCI_STRDUP(src, __FILE__, __LINE__, __PRETTY_FUNCTION__, 1) +# endif +#else +# ifndef SCI_ALLOC_DEBUG +# define sci_strdup(src)\ + _SCI_STRDUP(src, __FILE__, __LINE__, "", 0) +# else +# define sci_strdup(src)\ + _SCI_STRDUP(src, __FILE__, __LINE__, "", 1) +# endif +#endif + + +#ifdef __GNUC__ +# ifndef SCI_ALLOC_DEBUG +# define sci_strndup(src, length)\ + _SCI_STRNDUP(src, length, __FILE__, __LINE__, __PRETTY_FUNCTION__, 0) +# else +# define sci_strndup(src, length)\ + _SCI_STRNDUP(src, length, __FILE__, __LINE__, __PRETTY_FUNCTION__, 1) +# endif +#else +# ifndef SCI_ALLOC_DEBUG +# define sci_strndup(src, length)\ + _SCI_STRNDUP(src, length, __FILE__, __LINE__, "", 0) +# else +# define sci_strndup(src, length)\ + _SCI_STRNDUP(src, length, __FILE__, __LINE__, "", 1) +# endif +#endif + + +/********** other memory/debug related routines **********/ + +#ifdef _WIN32 +extern void +debug_win32_memory(int dbg_setting); +/* Sets debugging for Win32 memory. +** Parameters: (bool) dbg_setting: +** 0: no debugging +** 1: call _CrtCheckMemory at every memory request +** 2: perform automatic leak checking at program exit +** 3: enable debug heap allocations +*/ +#endif + + +#endif /* _SCI_MEMORY_H */ diff --git a/src/include/sound.h b/src/include/sound.h index 38ab4258..315f3354 100644 --- a/src/include/sound.h +++ b/src/include/sound.h @@ -36,6 +36,8 @@ #include #endif /* HAVE_CONFIG_H */ +#include + #define obstack_chunk_alloc malloc #define obstack_chunk_free free @@ -57,7 +59,7 @@ typedef struct { struct _state; -extern int soundserver_dead; +extern int soundserver_dead; /* Non-zero IFF the sound server died- set by sound.c, must also be ** set by non-fork()ed sound server implementations */ @@ -173,7 +175,7 @@ makeMIDI0(const guint8 *src, int *size, guint8 flag); ** size: points to an int which is set to contain the MIDI ** block length. ** flag: The midi instrument's play flag. -** Returns : (guint8 *) The malloc()ed MIDI block, or NULL if conversion +** Returns : (guint8 *) The sci_malloc()ed MIDI block, or NULL if conversion ** failed. ** *FIXME*: Aborts in some cases if out of memory. This is OK while testing, ** but should be adjusted for the public release. diff --git a/src/scicore/Makefile.am b/src/scicore/Makefile.am index 88a558c5..537d66be 100644 --- a/src/scicore/Makefile.am +++ b/src/scicore/Makefile.am @@ -4,4 +4,5 @@ EXTRA_DIST = sci_dos.c treedef.1 treedef.2 treedef.3 hufftree.1 \ noinst_LIBRARIES = libscicore.a libscicore_a_SOURCES = console.c tools.c resource.c decompress0.c \ decompress01.c decompress1.c decompress11.c script.c \ - vocab.c vocab_debug.c old_objects.c modules.c + vocab.c vocab_debug.c old_objects.c modules.c \ + sci_memory.c diff --git a/src/scicore/console.c b/src/scicore/console.c index 6b7c8639..6fac0695 100644 --- a/src/scicore/console.c +++ b/src/scicore/console.c @@ -26,6 +26,7 @@ ***************************************************************************/ /* hooks for debug commands (mainly for the sci console) */ +#include #include #include #ifdef SCI_CONSOLE @@ -71,8 +72,6 @@ FILE *con_file = NULL; static int _lists_need_sorting = 0; -void con_init_dmalloc (); - /* Output buffer */ char con_outputbuf[SCI_CONSOLE_OUTPUT_BUFFER][SCI_CONSOLE_LINE_WIDTH]; int con_outputbufpos = 0; /* buffer line */ @@ -84,6 +83,123 @@ int con_outputlookback = 0; int cmd_paramlength; cmd_param_t *cmd_params; +/********** dmalloc functions **********/ + +#ifdef WITH_DMALLOC +int +c_dm_log_heap (state_t * s) +{ + dmalloc_log_heap_map (); + return 0; +} + +int +c_dm_stats (state_t * s) +{ + dmalloc_log_stats (); + return 0; +} + +int +c_dm_log_unfreed (state_t * s) +{ + dmalloc_log_unfreed (); + return 0; +} + +int +c_dm_verify (state_t * s) +{ + unsigned long pointer_var; + void *ptr; + + pointer_var = strtoul (cmd_params[0].str, NULL, 0); + ptr = (void *) pointer_var; + + dmalloc_verify (ptr); + + return 0; +} + +int +c_dm_debug (state_t * s) +{ + if (cmd_paramlength) + { + long newval = strtol (cmd_params[0].str, NULL, 0); + + sciprintf ("Setting dmalloc_debug(%ld)\n", newval); + dmalloc_debug (newval); + } + else + sciprintf ("dmalloc_debug is at 0x%lx\n", dmalloc_debug_current ()); + return 0; +} + +int +c_dm_mark (state_t * s) +{ + unsigned long mark = dmalloc_mark (); + + dmalloc_message ("------------- MARK 0x%lx ---------------\n", mark); + sciprintf ("mark 0x%lx\n", mark); + return 0; +} + +int +c_dm_chmark (state_t * s) +{ + unsigned long mark = strtoul (cmd_params[0].str, NULL, 0); + sciprintf ("Checking mark 0x%lx\n", mark); + dmalloc_message ("--- Mark 0x%lx:\n", mark); + dmalloc_log_changed (mark, 1, 1, 1); + return 0; +} + +int +c_dm_print (state_t * s) +{ + int i; + for (i = 0; i < cmd_paramlength; i++) + dmalloc_message ("%s\n", cmd_params[i].str); + return 0; +} + +void +con_init_dmalloc () +{ + con_hook_command (c_dm_log_heap, "dm_log_heap", "", + "Dumps the heap state to\n the dmalloc output file\n\nUSAGE\n\n dm_log_heap"); + con_hook_command (c_dm_stats, "dm_stats", "", + "Prints memory usage stats\n to the dmalloc output file\n\n dm_stats"); + con_hook_command (c_dm_log_unfreed, "dm_log_unfreed", "", + "Prints unfreed pointer\n information to the dmalloc\n output file\n\n" + "USAGE\n\n dm_log_unfreed"); + con_hook_command (c_dm_verify, "dm_verify", "s", + "Verifies one pointer,\n prints output to dmalloc file\n\nUSAGE\n\n" + " dm_verify \n dm_verify 0\n\n 'dm_verify 0' will verify\n ALL current pointers.\n"); + con_hook_command (c_dm_debug, "dm_debug", "s*", + "Sets the dmalloc debug\n state or displays it\n\nUSAGE\n\n dm_debug \n dm_debug"); + con_hook_command (c_dm_mark, "dm_mark", "", + "Gets a mark describing\n the current heap state\n\nUSAGE\n\n dm_mark\n\n" + " The mark is written to the\n dmalloc output file and\n to sci output.\n\nSEE ALSO\n\n cm_chmark"); + con_hook_command (c_dm_chmark, "dm_chmark", "s", + "Checks changes in the\n heap state since a certain\n mark was retreived\n\n" + "USAGE\n\n c_dm_chmark \n\n Output is written to the\n dmalloc output file.\n\n Use dm_mark to retreive a\n" + " mark.\n\nSEE ALSO\n\n c_dm_mark"); + con_hook_command (c_dm_print, "dm_print", "s*", + "Prints something to the\n dmalloc output.\n\nUSAGE\n\n dm_print "); +} +#else /* WITH_DMALLOC */ + +void +con_init_dmalloc () +{ +} + +#endif /* WITH_DMALLOC */ + + void _cmd_exit (void) { @@ -94,18 +210,6 @@ _cmd_exit (void) free (_cmd_vars); } -void * -_xrealloc (void *oldp, size_t size) -{ - void *retval = (void *) realloc (oldp, size); - if (!retval) - { - fprintf (stderr, "Out of memory!\n"); - exit (1); - } - return retval; -} - static int _comp_command (const void *a, const void *b) { @@ -135,7 +239,7 @@ con_init (void) if (!_cmd_command_mem) { _cmd_commands = - _xrealloc (NULL, sizeof (cmd_command_t) * (_cmd_command_mem = 32)); + sci_realloc(_cmd_commands, sizeof (cmd_command_t) * (_cmd_command_mem = 32)); atexit (_cmd_exit); /* Hook up some commands */ @@ -195,7 +299,7 @@ con_parse (state_t * s, char *command) cdone = 0; pos = 0; - /* cmd_params = _xrealloc(cmd_params, parammem); */ + /* cmd_params = sci_realloc(cmd_params, parammem); */ cmd_paramlength = 0; while (*cmd == ' ') @@ -227,7 +331,7 @@ con_parse (state_t * s, char *command) { onvar = 1; if (cmd_paramlength == parammem) - cmd_params = _xrealloc (cmd_params, + cmd_params = sci_realloc(cmd_params, sizeof (cmd_param_t) * (parammem += 8)); cmd_params[cmd_paramlength].str = cmd + pos; @@ -360,7 +464,7 @@ con_hook_command (int command (state_t *), char *name, char *param, if (!_cmd_command_mem) con_init (); if (_cmd_command_mem == _cmd_command_count) - _cmd_commands = _xrealloc (_cmd_commands, + _cmd_commands = sci_realloc(_cmd_commands, sizeof (cmd_command_t) * (_cmd_command_mem <<= 1)); @@ -414,7 +518,7 @@ con_hook_int (int *pointer, char *name, char *description) int i; if (_cmd_var_mem == _cmd_var_count) - _cmd_vars = _xrealloc (_cmd_vars, + _cmd_vars = sci_realloc(_cmd_vars, sizeof (cmd_var_t) * (_cmd_var_mem += 16)); if (pointer == NULL) @@ -925,120 +1029,6 @@ c_dissectscript (state_t * s) return 0; } - -#ifdef WITH_DMALLOC -int -c_dm_log_heap (state_t * s) -{ - dmalloc_log_heap_map (); - return 0; -} - -int -c_dm_stats (state_t * s) -{ - dmalloc_log_stats (); - return 0; -} - -int -c_dm_log_unfreed (state_t * s) -{ - dmalloc_log_unfreed (); - return 0; -} - -int -c_dm_verify (state_t * s) -{ - unsigned long pointer_var; - void *ptr; - - pointer_var = strtoul (cmd_params[0].str, NULL, 0); - ptr = (void *) pointer_var; - - dmalloc_verify (ptr); - - return 0; -} - -int -c_dm_debug (state_t * s) -{ - if (cmd_paramlength) - { - long newval = strtol (cmd_params[0].str, NULL, 0); - - sciprintf ("Setting dmalloc_debug(%ld)\n", newval); - dmalloc_debug (newval); - } - else - sciprintf ("dmalloc_debug is at 0x%lx\n", dmalloc_debug_current ()); - return 0; -} - -int -c_dm_mark (state_t * s) -{ - unsigned long mark = dmalloc_mark (); - - dmalloc_message ("------------- MARK 0x%lx ---------------\n", mark); - sciprintf ("mark 0x%lx\n", mark); - return 0; -} - -int -c_dm_chmark (state_t * s) -{ - unsigned long mark = strtoul (cmd_params[0].str, NULL, 0); - sciprintf ("Checking mark 0x%lx\n", mark); - dmalloc_message ("--- Mark 0x%lx:\n", mark); - dmalloc_log_changed (mark, 1, 1, 1); - return 0; -} - -int -c_dm_print (state_t * s) -{ - int i; - for (i = 0; i < cmd_paramlength; i++) - dmalloc_message ("%s", cmd_params[i].str); - return 0; -} - -void -con_init_dmalloc () -{ - con_hook_command (c_dm_log_heap, "dm_log_heap", "", - "Dumps the heap state to\n the dmalloc output file\n\nUSAGE\n\n dm_log_heap"); - con_hook_command (c_dm_stats, "dm_stats", "", - "Prints memory usage stats\n to the dmalloc output file\n\n dm_stats"); - con_hook_command (c_dm_log_unfreed, "dm_log_unfreed", "", - "Prints unfreed pointer\n information to the dmalloc\n output file\n\n" - "USAGE\n\n dm_log_unfreed"); - con_hook_command (c_dm_verify, "dm_verify", "s", - "Verifies one pointer,\n prints output to dmalloc file\n\nUSAGE\n\n" - " dm_verify \n dm_verify 0\n\n 'dm_verify 0' will verify\n ALL current pointers.\n"); - con_hook_command (c_dm_debug, "dm_debug", "s*", - "Sets the dmalloc debug\n state or displays it\n\nUSAGE\n\n dm_debug \n dm_debug"); - con_hook_command (c_dm_mark, "dm_mark", "", - "Gets a mark describing\n the current heap state\n\nUSAGE\n\n dm_mark\n\n" - " The mark is written to the\n dmalloc output file and\n to sci output.\n\nSEE ALSO\n\n cm_chmark"); - con_hook_command (c_dm_chmark, "dm_chmark", "s", - "Checks changes in the\n heap state since a certain\n mark was retreived\n\n" - "USAGE\n\n c_dm_chmark \n\n Output is written to the\n dmalloc output file.\n\n Use dm_mark to retreive a\n" - " mark.\n\nSEE ALSO\n\n c_dm_mark"); - con_hook_command (c_dm_print, "dm_print", "s*", - "Prints something to the\n dmalloc output.\n\nUSAGE\n\n dm_print "); -} -#else /* !DMALLOC */ - -void -con_init_dmalloc () -{ -} -#endif - #endif /* SCI_CONSOLE */ diff --git a/src/scicore/resource.c b/src/scicore/resource.c index 3468e3a1..fcbd9724 100644 --- a/src/scicore/resource.c +++ b/src/scicore/resource.c @@ -220,7 +220,7 @@ resourceLoader(int decompress(resource_t *result, int resh), int autodetect, int #ifdef _SCI_RESOURCE_DEBUG fprintf(stderr,"SCI Error: %s in '%s'!\n", SCI_Error_Types[decomperr], filename); -#endif +#endif killlist(&base); /* Free resources */ max_resource = 0; return decomperr; @@ -406,10 +406,10 @@ int loadResourcePatches(struct singly_linked_resources_struct *resourcelist) int resourcecmp (const void *first, const void *second) { - if (((resource_t *)first)->type == + if (((resource_t *)first)->type == ((resource_t *)second)->type) - return (((resource_t *)first)->number < - ((resource_t *)second)->number)? -1 : + return (((resource_t *)first)->number < + ((resource_t *)second)->number)? -1 : !(((resource_t *)first)->number == ((resource_t *)second)->number); else @@ -446,20 +446,3 @@ void freeResources() return; } } - - -void * -_XALLOC(size_t size, char *file, int line, char *funct) -{ - void *memblock; - - if (!(memblock = malloc(size))) { - fprintf(stderr,"file %s %d (%s): XALLOC(%ld) failed.\n", - file, line, funct, (long) size); - exit(-1); - } - - return memblock; -} - - diff --git a/src/scicore/sci_memory.c b/src/scicore/sci_memory.c new file mode 100644 index 00000000..a71174ff --- /dev/null +++ b/src/scicore/sci_memory.c @@ -0,0 +1,163 @@ +/*************************************************************************** + sci_memory.c Copyright (C) 2001 Alexander R Angas + + + This program may be modified and copied freely according to the terms of + the GNU general public license (GPL), as long as the above copyright + notice and the licensing information contained herein are preserved. + + Please refer to www.gnu.org for licensing details. + + This work is provided AS IS, without warranty of any kind, expressed or + implied, including but not limited to the warranties of merchantibility, + noninfringement, and fitness for a specific purpose. The author will not + be held liable for any damage caused by this work or derivatives of it. + + By using this source code, you agree to the licensing terms as stated + above. + + + Please contact the maintainer for bug reports or inquiries. + + Current Maintainer: + + Alexander R Angas (Alex Angas) + + History: + + 20010807 - assembled from the various memory allocation functions lying + about, namely console.c (extra dmalloc stuff), menubar.c + (for malloc_cpy -> strdup, malloc_ncpy -> strndup). + -- Alex Angas + +***************************************************************************/ + +#include "sci_memory.h" + +#ifdef WITH_DMALLOC +#include +#endif + +#ifdef _WIN32 +#include +#pragma intrinsic( memcpy, strlen ) +#endif + + +inline void * +_SCI_MALLOC(size_t size, char *file, int line, char *funct, int debug) +{ + void *res; + ALLOC_MEM((res = malloc(size)), size, file, line, funct, debug) + return res; +} + + +inline void * +_SCI_CALLOC(size_t num, size_t size, char *file, int line, char *funct, int debug) +{ + void *res; + ALLOC_MEM((res = calloc(num, size)), num * size, file, line, funct, debug) + return res; +} + + +inline void * +_SCI_REALLOC(void *ptr, size_t size, char *file, int line, char *funct, int debug) +{ + void *res; + ALLOC_MEM((res = realloc(ptr, size)), size, file, line, funct, debug) + return res; +} + + +inline void +_SCI_FREE(void *ptr, char *file, int line, char *funct, int debug) +{ + void *res; + if (debug) + fprintf(stderr, "_SCI_FREE() [%s:(%s)%u]\n", + file, funct, line); + assert(ptr); + free(ptr); +} + + +inline void * +_SCI_MEMDUP(void *ptr, size_t size, char *file, int line, char *funct, int debug) +{ + void *res; + ALLOC_MEM((res = malloc(size)), size, file, line, funct, debug) + memcpy(res, ptr, size); + return res; +} + + +inline char * +_SCI_STRDUP(const char *src, char *file, int line, char *funct, int debug) +{ + void *res; + ALLOC_MEM((res = strdup(src)), strlen(src), file, line, funct, debug) + return res; +} + + +inline char * +_SCI_STRNDUP(const char *src, size_t length, char *file, int line, char *funct, int debug) +{ + void *res; + char *strres; + int rlen = MIN(strlen(src), length) + 1; + ALLOC_MEM((res = malloc(rlen)), rlen, file, line, funct, debug) + + strres = res; + strncpy(strres, src, rlen); + strres[rlen - 1] = 0; + + return strres; +} + + +/********** Win32 functions **********/ + +#ifdef _WIN32 +void +debug_win32_memory(int dbg_setting) +{ + int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); + +#ifdef NDEBUG + fprintf(stderr, + "WARNING: Cannot debug Win32 memory when not in debug mode.\n"); +#endif + + if (dbg_setting > 0) + tmpFlag |= _CRTDBG_CHECK_ALWAYS_DF; + /* call _CrtCheckMemory at every request */ + + if (dbg_setting > 1) + tmpFlag |= _CRTDBG_LEAK_CHECK_DF; + /* perform automatic leak checking at program exit */ + + if (dbg_setting > 2) + tmpFlag |= _CRTDBG_DELAY_FREE_MEM_DF; + /* enable debug heap allocations */ + + if (dbg_setting > 3) + { + PANIC((stderr, "Invalid value for debug_win32_memory!\n")); + BREAKPOINT(); + } + + if (dbg_setting <= 0) + { + /* turn off above */ + tmpFlag &= ~_CRTDBG_CHECK_ALWAYS_DF; + tmpFlag &= ~_CRTDBG_DELAY_FREE_MEM_DF; + tmpFlag &= ~_CRTDBG_LEAK_CHECK_DF; + } + + /* set new state for flag */ + _CrtSetDbgFlag( tmpFlag ); +} +#endif diff --git a/src/scicore/tools.c b/src/scicore/tools.c index 24b8c88e..98d7e9c6 100644 --- a/src/scicore/tools.c +++ b/src/scicore/tools.c @@ -119,7 +119,7 @@ int sci_ffs(int _mask) retval++; _mask >>= 1; } - + return retval; } @@ -221,7 +221,7 @@ sci_gettime(int *seconds, int *useconds) void sci_gettime(int *seconds, int *useconds) { DWORD tm; - + timeBeginPeriod(0); if (TIMERR_NOERROR != timeBeginPeriod(1)) { @@ -290,18 +290,18 @@ sci_find_first(sci_dir_t *dir, char *mask) case ENOENT: { printf("_findfirst errno = ENOENT: no match\n"); - break; + break; } - case EINVAL: - { + case EINVAL: + { printf("_findfirst errno = EINVAL: invalid filename\n"); - break; + break; } default: printf("_findfirst errno = unknown (%d)", errno); } } - + return NULL; } @@ -315,7 +315,7 @@ sci_find_next(sci_dir_t *dir) _findclose(dir->search); dir->search = -1; return NULL; - } + } if (strcmp(dir->fileinfo.name, ".") == 0 || strcmp(dir->fileinfo.name, "..") == 0) @@ -410,27 +410,6 @@ sci_get_homedir() } -void * -sci_memdup(void *src, size_t size) -{ - void *rei; /* The clone */ - - if (size <= 0) { - fprintf(stderr,"Attempt to memdup %d bytes!\n", size); - BREAKPOINT(); - return NULL; /* For archs where BREAKPOINT() fails */ - } - - rei = malloc(size); - - if (!rei) - return NULL; - - memcpy(rei, src, size); - return rei; -} - - sci_queue_t * sci_init_queue(sci_queue_t *queue) { @@ -578,44 +557,3 @@ sci_open(char *fname, int flags) return file; } - - -/*-- Safe memory allocation --*/ - -#ifdef SCI_SAFE_ALLOC - -# define SAFE_ALLOC_FUN(f) \ -{ \ - int print = 1; \ - void *retval = NULL; \ - \ - while (!retval) { \ - retval = f; \ - \ - if (!retval) { \ - if (print) { \ - fprintf(stderr,"Low on memory; waiting...\n"); \ - print = 0; \ - } \ - sleep(1); \ - } \ - } \ - \ - return retval; \ -} - -void * -sci_malloc(size_t size) - SAFE_ALLOC_FUN(malloc(size)) - -void * -sci_calloc(size_t nmemb, size_t count) - SAFE_ALLOC_FUN(calloc(nmemb, count)) - -void * -sci_realloc(void *ptr, size_t size) - SAFE_ALLOC_FUN(realloc(ptr, size)) - -# undef SAFE_ALLOC_FUN - -#endif diff --git a/src/sound/sfx_save.c b/src/sound/sfx_save.c index ffe9f541..df71fa85 100644 --- a/src/sound/sfx_save.c +++ b/src/sound/sfx_save.c @@ -32,6 +32,7 @@ #include #include #include +#include #ifndef O_BINARY #define O_BINARY 0 @@ -61,47 +62,26 @@ typedef struct { /* Auto-generated CFSML declaration and function block */ -#line 790 "savegame.cfsml" +#line 769 "savegame.cfsml" #define CFSML_SUCCESS 0 #define CFSML_FAILURE 1 #line 102 "savegame.cfsml" #include /* We need va_lists */ +#include #ifdef CFSML_DEBUG_MALLOC -static void -_free(char *fln, char *fn, int lin, void *var) -{ - fprintf(stderr, "%s, %s, %d: Free %p\n", fln, fn, lin, var); - free(var); -} -static void * -_malloc(char *fln, char *fn, int lin, int var) -{ - void *x = malloc(var); - fprintf(stderr, "%s, %s, %d: Malloc(%d)-> %p\n", fln, fn, lin, var, x); - return x; -} -static void* -_calloc(char *fln, char *fn, int lin, int var) -{ - void *x = calloc(var, 1); - fprintf(stderr, "%s, %s, %d: Calloc(%d)-> %p\n", fln, fn, lin, var, x); - return x; -} -static void* -_realloc(char *fln, char *fn, int lin, void *var, size_t si) -{ - void *x = realloc(var, si); - fprintf(stderr, "%s, %s, %d: Realloc(%d) %p->%p\n", fln, fn, lin, var, x); - return x; -} - -#define free(var) _free(__FILE__, __FUNCTION__, __LINE__, var) -#define malloc(var) _malloc(__FILE__, __FUNCTION__, __LINE__, var) -#define calloc(var,z) _calloc(__FILE__, __FUNCTION__, __LINE__, var*z) -#define realloc(var, si) _realloc(__FILE__, __FUNCTION__, __LINE__, var, si) +/* +#define free(p) dbg_sci_free(p) +#define malloc(s) dbg_sci_malloc(s) +#define calloc(n, s) dbg_sci_calloc(n, s) +#define realloc(p, s) dbg_sci_realloc(p, s) +*/ +#define free dbg_sci_free +#define malloc dbg_sci_malloc +#define calloc dbg_sci_calloc +#define realloc dbg_sci_realloc #endif static void @@ -172,7 +152,7 @@ _cfsml_get_current_refpointer() static void _cfsml_register_pointer(void *ptr) { - struct _cfsml_pointer_refstruct *newref = malloc(sizeof (struct _cfsml_pointer_refstruct)); + struct _cfsml_pointer_refstruct *newref = sci_malloc(sizeof (struct _cfsml_pointer_refstruct)); #ifdef CFSML_DEBUG_MALLOC SCI_MEMTEST; fprintf(stderr,"Registering ptrref %p [%p]\n", ptr, newref); @@ -188,7 +168,7 @@ _cfsml_mangle_string(char *s) { char *source = s; char c; - char *target = (char *) malloc(1 + strlen(s) * 2); /* We will probably need less than that */ + char *target = (char *) sci_malloc(1 + strlen(s) * 2); /* We will probably need less than that */ char *writer = target; while ((c = *source++)) { @@ -203,14 +183,14 @@ _cfsml_mangle_string(char *s) } *writer = 0; /* Terminate string */ - return (char *) realloc(target, strlen(target) + 1); + return (char *) sci_realloc(target, strlen(target) + 1); } static char * _cfsml_unmangle_string(char *s) { - char *target = (char *) malloc(1 + strlen(s)); + char *target = (char *) sci_malloc(1 + strlen(s)); char *writer = target; char *source = s; char c; @@ -225,7 +205,7 @@ _cfsml_unmangle_string(char *s) } *writer = 0; /* Terminate string */ - return (char *) realloc(target, strlen(target) + 1); + return (char *) sci_realloc(target, strlen(target) + 1); } @@ -236,7 +216,7 @@ _cfsml_get_identifier(FILE *fd, int *line, int *hiteof, int *assignment) int mem = 32; int pos = 0; int done = 0; - char *retval = (char *) malloc(mem); + char *retval = (char *) sci_malloc(mem); if (_cfsml_last_identifier_retreived) { free(_cfsml_last_identifier_retreived); @@ -256,7 +236,7 @@ _cfsml_get_identifier(FILE *fd, int *line, int *hiteof, int *assignment) while (((c = fgetc(fd)) != EOF) && ((pos == 0) || (c != '\n')) && (c != '=')) { if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem *= 2); + retval = (char *) sci_realloc(retval, mem *= 2); if (!isspace(c)) { if (done) { @@ -294,10 +274,10 @@ _cfsml_get_identifier(FILE *fd, int *line, int *hiteof, int *assignment) } if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem += 1); + retval = (char *) sci_realloc(retval, mem += 1); retval[pos] = 0; /* Terminate string */ -#line 343 "savegame.cfsml" +#line 322 "savegame.cfsml" return _cfsml_last_identifier_retreived = retval; } @@ -309,7 +289,7 @@ _cfsml_get_value(FILE *fd, int *line, int *hiteof) int c; int mem = 64; int pos = 0; - char *retval = (char *) malloc(mem); + char *retval = (char *) sci_malloc(mem); if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); @@ -319,7 +299,7 @@ _cfsml_get_value(FILE *fd, int *line, int *hiteof) while (((c = fgetc(fd)) != EOF) && (c != '\n')) { if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem *= 2); + retval = (char *) sci_realloc(retval, mem *= 2); if (pos || (!isspace(c))) retval[pos++] = c; @@ -342,57 +322,57 @@ _cfsml_get_value(FILE *fd, int *line, int *hiteof) ++(*line); if (pos == mem - 1) /* Need more memory? */ - retval = (char *) realloc(retval, mem += 1); + retval = (char *) sci_realloc(retval, mem += 1); retval[pos] = 0; /* Terminate string */ -#line 400 "savegame.cfsml" - return (_cfsml_last_value_retreived = (char *) realloc(retval, strlen(retval) + 1)); +#line 379 "savegame.cfsml" + return (_cfsml_last_value_retreived = (char *) sci_realloc(retval, strlen(retval) + 1)); /* Re-allocate; this value might be used for quite some while (if we are ** restoring a string) */ } -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_song_t(FILE *fh, song_t* save_struc); static int _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_string(FILE *fh, char ** save_struc); static int _cfsml_read_string(FILE *fh, char ** save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_sound_lib_file_t(FILE *fh, sound_lib_file_t* save_struc); static int _cfsml_read_sound_lib_file_t(FILE *fh, sound_lib_file_t* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_int(FILE *fh, int* save_struc); static int _cfsml_read_int(FILE *fh, int* save_struc, char *lastval, int *line, int *hiteof); -#line 452 "savegame.cfsml" +#line 431 "savegame.cfsml" static void _cfsml_write_word(FILE *fh, word* save_struc); static int _cfsml_read_word(FILE *fh, word* save_struc, char *lastval, int *line, int *hiteof); -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_song_t(FILE *fh, song_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "flags = "); min = max = MIDI_CHANNELS; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_int(fh, &(save_struc->flags[i])); @@ -402,7 +382,7 @@ _cfsml_write_song_t(FILE *fh, song_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "instruments = "); min = max = MIDI_CHANNELS; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_int(fh, &(save_struc->instruments[i])); @@ -412,7 +392,7 @@ _cfsml_write_song_t(FILE *fh, song_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "velocity = "); min = max = MIDI_CHANNELS; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_int(fh, &(save_struc->velocity[i])); @@ -422,7 +402,7 @@ _cfsml_write_song_t(FILE *fh, song_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "pressure = "); min = max = MIDI_CHANNELS; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_int(fh, &(save_struc->pressure[i])); @@ -432,7 +412,7 @@ _cfsml_write_song_t(FILE *fh, song_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "pitch = "); min = max = MIDI_CHANNELS; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_int(fh, &(save_struc->pitch[i])); @@ -442,7 +422,7 @@ _cfsml_write_song_t(FILE *fh, song_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "channel_map = "); min = max = MIDI_CHANNELS; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_int(fh, &(save_struc->channel_map[i])); @@ -473,7 +453,7 @@ _cfsml_write_song_t(FILE *fh, song_t* save_struc) fprintf(fh, "\n"); fprintf(fh, "polyphony = "); min = max = MIDI_CHANNELS; -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_int(fh, &(save_struc->polyphony[i])); @@ -499,13 +479,13 @@ _cfsml_write_song_t(FILE *fh, song_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -533,18 +513,18 @@ _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int * if (!value) return CFSML_FAILURE; if (!strcmp(token, "flags")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = MIDI_CHANNELS; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -557,18 +537,18 @@ _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int * } while (!done); } else if (!strcmp(token, "instruments")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = MIDI_CHANNELS; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -581,18 +561,18 @@ _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int * } while (!done); } else if (!strcmp(token, "velocity")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = MIDI_CHANNELS; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -605,18 +585,18 @@ _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int * } while (!done); } else if (!strcmp(token, "pressure")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = MIDI_CHANNELS; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -629,18 +609,18 @@ _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int * } while (!done); } else if (!strcmp(token, "pitch")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = MIDI_CHANNELS; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -653,18 +633,18 @@ _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int * } while (!done); } else if (!strcmp(token, "channel_map")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = MIDI_CHANNELS; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -677,53 +657,53 @@ _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int * } while (!done); } else if (!strcmp(token, "size")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->size), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "pos")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->pos), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "loopmark")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->loopmark), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "fading")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->fading), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "reverb")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->reverb), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "maxfade")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->maxfade), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "resetflag")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->resetflag), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "polyphony")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } /* Prepare to restore static array */ max = MIDI_CHANNELS; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -736,31 +716,31 @@ _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int * } while (!done); } else if (!strcmp(token, "file_nr")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->file_nr), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "priority")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->priority), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "loops")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->loops), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "status")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->status), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "handle")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_word(fh, &(save_struc->handle), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -769,14 +749,14 @@ _cfsml_read_song_t(FILE *fh, song_t* save_struc, char *lastval, int *line, int * return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_string(FILE *fh, char ** save_struc) { char *token; int min, max, i; -#line 473 "savegame.cfsml" +#line 452 "savegame.cfsml" if (!(*save_struc)) fprintf(fh, "\\null\\"); else { token = _cfsml_mangle_string((char *) *save_struc); @@ -785,13 +765,13 @@ _cfsml_write_string(FILE *fh, char ** save_struc) } } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_string(FILE *fh, char ** save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 590 "savegame.cfsml" +#line 569 "savegame.cfsml" if (strcmp(lastval, "\\null\\")) { /* null pointer? */ if (*lastval == '"') { /* Quoted string? */ @@ -817,14 +797,14 @@ _cfsml_read_string(FILE *fh, char ** save_struc, char *lastval, int *line, int * } } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_sound_lib_file_t(FILE *fh, sound_lib_file_t* save_struc) { char *token; int min, max, i; -#line 483 "savegame.cfsml" +#line 462 "savegame.cfsml" fprintf(fh, "{\n"); fprintf(fh, "sound_version = "); _cfsml_write_int(fh, &(save_struc->sound_version)); @@ -833,7 +813,7 @@ _cfsml_write_sound_lib_file_t(FILE *fh, sound_lib_file_t* save_struc) min = max = save_struc->songs_nr; if (!save_struc->songs) min = max = 0; /* Don't write if it points to NULL */ -#line 509 "savegame.cfsml" +#line 488 "savegame.cfsml" fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_song_t(fh, &(save_struc->songs[i])); @@ -859,13 +839,13 @@ _cfsml_write_sound_lib_file_t(FILE *fh, sound_lib_file_t* save_struc) fprintf(fh, "}"); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_sound_lib_file_t(FILE *fh, sound_lib_file_t* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 612 "savegame.cfsml" +#line 591 "savegame.cfsml" int assignment, closed, done; if (strcmp(lastval, "{")) { @@ -893,17 +873,17 @@ _cfsml_read_sound_lib_file_t(FILE *fh, sound_lib_file_t* save_struc, char *lastv if (!value) return CFSML_FAILURE; if (!strcmp(token, "sound_version")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->sound_version), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "songs")) { -#line 669 "savegame.cfsml" +#line 648 "savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; ; } -#line 679 "savegame.cfsml" +#line 658 "savegame.cfsml" /* Prepare to restore dynamic array */ max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -912,16 +892,16 @@ _cfsml_read_sound_lib_file_t(FILE *fh, sound_lib_file_t* save_struc, char *lastv ; } if (max) { - save_struc->songs = (song_t *) malloc(max * sizeof(song_t)); + save_struc->songs = (song_t *) sci_malloc(max * sizeof(song_t)); _cfsml_register_pointer(save_struc->songs); } else save_struc->songs = NULL; -#line 702 "savegame.cfsml" +#line 681 "savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) -#line 710 "savegame.cfsml" +#line 689 "savegame.cfsml" return 1; if (strcmp(value, "]")) { if (i == max) { @@ -935,31 +915,31 @@ _cfsml_read_sound_lib_file_t(FILE *fh, sound_lib_file_t* save_struc, char *lastv save_struc->songs_nr = max ; /* Set array size accordingly */ } else if (!strcmp(token, "active_song")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->active_song), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "soundcue")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->soundcue), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "usecs_to_sleep")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->usecs_to_sleep), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ticks_to_wait")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ticks_to_wait), value, line, hiteof)) return CFSML_FAILURE; } else if (!strcmp(token, "ticks_to_fade")) { -#line 745 "savegame.cfsml" +#line 724 "savegame.cfsml" if (_cfsml_read_int(fh, &(save_struc->ticks_to_fade), value, line, hiteof)) return CFSML_FAILURE; } else -#line 752 "savegame.cfsml" +#line 731 "savegame.cfsml" { _cfsml_error("Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; } @@ -968,7 +948,7 @@ _cfsml_read_sound_lib_file_t(FILE *fh, sound_lib_file_t* save_struc, char *lastv return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_int(FILE *fh, int* save_struc) { @@ -978,13 +958,13 @@ _cfsml_write_int(FILE *fh, int* save_struc) fprintf(fh, "%li", (long) *save_struc); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_int(FILE *fh, int* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 581 "savegame.cfsml" +#line 560 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if (*token != 0) { @@ -994,7 +974,7 @@ _cfsml_read_int(FILE *fh, int* save_struc, char *lastval, int *line, int *hiteof return CFSML_SUCCESS; } -#line 465 "savegame.cfsml" +#line 444 "savegame.cfsml" static void _cfsml_write_word(FILE *fh, word* save_struc) { @@ -1004,13 +984,13 @@ _cfsml_write_word(FILE *fh, word* save_struc) fprintf(fh, "%li", (long) *save_struc); } -#line 557 "savegame.cfsml" +#line 536 "savegame.cfsml" static int _cfsml_read_word(FILE *fh, word* save_struc, char *lastval, int *line, int *hiteof) { char *token; int min, max, i; -#line 581 "savegame.cfsml" +#line 560 "savegame.cfsml" *save_struc = strtol(lastval, &token, 0); if (*token != 0) { @@ -1023,7 +1003,7 @@ _cfsml_read_word(FILE *fh, word* save_struc, char *lastval, int *line, int *hite /* Auto-generated CFSML declaration and function block ends here */ /* Auto-generation performed by cfsml.pl 0.8.2 */ -#line 108 "savegame.cfsml" +#line 109 "savegame.cfsml" /* Sound state saving reference implementation */ @@ -1068,7 +1048,7 @@ soundsrv_save_state(FILE *debugstream, char *dir, songlib_t songlib, song_t *cur write_rec.songs_nr = songctr; write_rec.active_song = curr_song_nr; - write_rec.songs = malloc(sizeof(song_t) * songctr); + write_rec.songs = sci_malloc(sizeof(song_t) * songctr); /* Now memcpy those songs into a row and write their song data to a file */ songctr = -1; @@ -1108,12 +1088,12 @@ soundsrv_save_state(FILE *debugstream, char *dir, songlib_t songlib, song_t *cur fh = fopen("sound", "w"); -#line 871 "savegame.cfsml" +#line 850 "savegame.cfsml" /* Auto-generated CFSML data writer code */ _cfsml_write_sound_lib_file_t(fh, &write_rec); fprintf(fh, "\n"); /* End of auto-generated CFSML data writer code */ -#line 193 "savegame.cfsml" +#line 194 "savegame.cfsml" fclose(fh); fprintf(stderr,"Finished all writing.\n"); @@ -1173,25 +1153,25 @@ soundsrv_restore_state(FILE *debugstream, char *dir, songlib_t songlib, song_t * read_rec.sound_version = 0; read_rec.master_volume = *master_volume; /* Auto-generated CFSML data reader code */ -#line 817 "savegame.cfsml" +#line 796 "savegame.cfsml" { -#line 820 "savegame.cfsml" +#line 799 "savegame.cfsml" int _cfsml_line_ctr = 0; -#line 825 "savegame.cfsml" +#line 804 "savegame.cfsml" struct _cfsml_pointer_refstruct **_cfsml_myptrrefptr = _cfsml_get_current_refpointer(); -#line 828 "savegame.cfsml" +#line 807 "savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; int dummy; -#line 836 "savegame.cfsml" +#line 815 "savegame.cfsml" char *_cfsml_inp = _cfsml_get_identifier(fh, &(_cfsml_line_ctr), &_cfsml_eof, &dummy); -#line 841 "savegame.cfsml" +#line 820 "savegame.cfsml" _cfsml_error = _cfsml_read_sound_lib_file_t(fh, &read_rec, _cfsml_inp, &(_cfsml_line_ctr), &_cfsml_eof); -#line 846 "savegame.cfsml" +#line 825 "savegame.cfsml" error = _cfsml_error; -#line 850 "savegame.cfsml" +#line 829 "savegame.cfsml" _cfsml_free_pointer_references(_cfsml_myptrrefptr, _cfsml_error); -#line 853 "savegame.cfsml" +#line 832 "savegame.cfsml" if (_cfsml_last_value_retreived) { free(_cfsml_last_value_retreived); _cfsml_last_value_retreived = NULL; @@ -1202,7 +1182,7 @@ soundsrv_restore_state(FILE *debugstream, char *dir, songlib_t songlib, song_t * } } /* End of auto-generated CFSML data reader code */ -#line 252 "savegame.cfsml" +#line 253 "savegame.cfsml" if (read_rec.sound_version == 0) recover_version0(&read_rec); @@ -1234,7 +1214,7 @@ soundsrv_restore_state(FILE *debugstream, char *dir, songlib_t songlib, song_t * return 1; } - if (read(fd, read_rec.songs[i].data = (byte *) malloc(size), size) < size) { + if (read(fd, read_rec.songs[i].data = (byte *) sci_malloc(size), size) < size) { int j; for (j = 0; i < i; j++) free(read_rec.songs[i].data); @@ -1254,7 +1234,7 @@ soundsrv_restore_state(FILE *debugstream, char *dir, songlib_t songlib, song_t * for (i = 0; i < read_rec.songs_nr; i++) { - next = malloc(sizeof(song_t)); + next = sci_malloc(sizeof(song_t)); memcpy(next, &(read_rec.songs[i]), sizeof(song_t)); next->next = NULL; if (i > 0) diff --git a/src/sound/sfx_save.cfsml b/src/sound/sfx_save.cfsml index c035b521..8209c93c 100644 --- a/src/sound/sfx_save.cfsml +++ b/src/sound/sfx_save.cfsml @@ -32,6 +32,7 @@ #include #include #include +#include #ifndef O_BINARY #define O_BINARY 0 @@ -149,7 +150,7 @@ soundsrv_save_state(FILE *debugstream, char *dir, songlib_t songlib, song_t *cur write_rec.songs_nr = songctr; write_rec.active_song = curr_song_nr; - write_rec.songs = malloc(sizeof(song_t) * songctr); + write_rec.songs = sci_malloc(sizeof(song_t) * songctr); /* Now memcpy those songs into a row and write their song data to a file */ songctr = -1; @@ -280,7 +281,7 @@ soundsrv_restore_state(FILE *debugstream, char *dir, songlib_t songlib, song_t * return 1; } - if (read(fd, read_rec.songs[i].data = (byte *) malloc(size), size) < size) { + if (read(fd, read_rec.songs[i].data = (byte *) sci_malloc(size), size) < size) { int j; for (j = 0; i < i; j++) free(read_rec.songs[i].data); @@ -300,7 +301,7 @@ soundsrv_restore_state(FILE *debugstream, char *dir, songlib_t songlib, song_t * for (i = 0; i < read_rec.songs_nr; i++) { - next = malloc(sizeof(song_t)); + next = sci_malloc(sizeof(song_t)); memcpy(next, &(read_rec.songs[i]), sizeof(song_t)); next->next = NULL; if (i > 0) diff --git a/src/sound/sound.c b/src/sound/sound.c index bca88f50..874a300e 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -25,6 +25,7 @@ ***************************************************************************/ +#include #include #include #include @@ -109,7 +110,7 @@ _sound_expect_answer(char *timeoutmessage, int def_value) int size; sound_get_data((byte **)&success,&size,sizeof(int)); - + retval = *success; free(success); return retval; @@ -171,7 +172,7 @@ sound_command(state_t *s, int command, int handle, int parameter) " returned < count\n"); } - + return 0; } @@ -217,15 +218,15 @@ sound_command(state_t *s, int command, int handle, int parameter) case SOUND_COMMAND_GET_VOLUME: if (s->sound_mute) return s->sound_mute; - else + else return s->sound_volume; - + /* set the mute status */ case SOUND_COMMAND_SET_MUTE: - if (parameter == 0) { + if (parameter == 0) { s->sound_mute = s->sound_volume; s->sound_volume = 0; - } else { + } else { if (s->sound_mute > 0) s->sound_volume = s->sound_mute; s->sound_mute = 0; @@ -237,7 +238,7 @@ sound_command(state_t *s, int command, int handle, int parameter) /* deliberate fallthrough */ /* return the mute status */ case SOUND_COMMAND_GET_MUTE: - if (s->sound_mute) + if (s->sound_mute) return 0; else return 1; @@ -245,13 +246,13 @@ sound_command(state_t *s, int command, int handle, int parameter) case SOUND_COMMAND_TEST: { int *retval = NULL; int len = 0; - + sound_queue_command(event.handle, event.signal, event.value); sound_get_data((byte **)&retval,&len,sizeof(int)); len = *retval ; free(retval); return len; /* should be the polyphony */ - } + } default: sciprintf("Unknown sound command %d\n", command); return 1; @@ -304,7 +305,7 @@ song_next_wakeup_time(GTimeVal *lastslept, int ticks) song_t * song_new(word handle, byte *data, int size, int priority) { - song_t *retval = xalloc(sizeof(song_t)); + song_t *retval = sci_malloc(sizeof(song_t)); unsigned int i; retval->data = data; @@ -321,7 +322,7 @@ song_new(word handle, byte *data, int size, int priority) retval->reverb = 0; /* what reverb setting to use */ retval->resetflag = 0; /* don't reset position on SoundStop */ - + memset(retval->instruments, 0, sizeof(int) * MIDI_CHANNELS); memset(retval->velocity, 0, sizeof(int) * MIDI_CHANNELS); memset(retval->pressure, 0, sizeof(int) * MIDI_CHANNELS); @@ -329,7 +330,7 @@ song_new(word handle, byte *data, int size, int priority) memset(retval->channel_map, 1, sizeof(int) * MIDI_CHANNELS); for (i = 0; i < MIDI_CHANNELS; i++) { - retval->polyphony[i] = data[1 + (i << 1)]; + retval->polyphony[i] = data[1 + (i << 1)]; retval->flags[i] = data[2 + (i << 1)]; } return retval; @@ -348,7 +349,7 @@ song_lib_add(songlib_t songlib, song_t *song) return; } - if (*songlib == NULL) + if (*songlib == NULL) { *songlib = song; song->next = NULL; @@ -445,7 +446,7 @@ song_lib_remove(songlib_t songlib, word handle) void song_lib_resort(songlib_t songlib, song_t *song) -{ +{ if (*songlib == song) *songlib = song->next; else { @@ -474,8 +475,8 @@ sound_eq_queue_event(sound_eq_t *queue, int handle, int signal, int value) sound_eq_node_t *node; sound_event_t *evt; - evt = xalloc(sizeof(sound_event_t)); - node = xalloc(sizeof(sound_eq_node_t)); + evt = sci_malloc(sizeof(sound_event_t)); + node = sci_malloc(sizeof(sound_eq_node_t)); evt->handle = handle; evt->signal = signal; @@ -563,12 +564,12 @@ remove_note_playing(playing_notes_t *playing, int note) int cmdlen[16] = {0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 2, 0}; /* Taken from playmidi */ -void sci_midi_command(song_t *song, guint8 command, - guint8 param, guint8 param2, +void sci_midi_command(song_t *song, guint8 command, + guint8 param, guint8 param2, int *ccc, FILE *ds, playing_notes_t *playing) { - + if (SCI_MIDI_CONTROLLER(command)) { switch (param) { @@ -603,7 +604,7 @@ void sci_midi_command(song_t *song, guint8 command, case 0x40: /* hold */ case 0x79: /* reset all */ midi_event(command, param, param2); - break; + break; default: fprintf(ds, "Unrecognised MIDI event %02x %02x %02x for handle %04x\n", command, param, param2, song->handle); break; @@ -617,10 +618,10 @@ void sci_midi_command(song_t *song, guint8 command, sound_queue_event(song->handle, SOUND_SIGNAL_ABSOLUTE_CUE, param); } - } else { + } else { /* just your regular midi event.. */ - if (song->flags[command & 0x0f] & midi_playflag) { + if (song->flags[command & 0x0f] & midi_playflag) { switch (command & 0xf0) { case 0xc0: /* program change */ @@ -653,10 +654,10 @@ void sci_midi_command(song_t *song, guint8 command, if (song->fading != -1) { /* is the song fading? */ if (song->maxfade == 0) song->maxfade = 1; - + param2 = (param2 * (song->fading)) / (song->maxfade); /* scale the velocity */ /* printf("fading %d %d\n", song->fading, song->maxfade);*/ - + } case 0xb0: /* program control */ @@ -668,7 +669,7 @@ void sci_midi_command(song_t *song, guint8 command, fprintf(ds, "Unrecognised MIDI event %02x %02x %02x for handle %04x\n", command, param, param2, song->handle); } } - } + } } void @@ -687,27 +688,27 @@ song_lib_dump(songlib_t songlib, int line) fprintf(stderr,"\n"); } while (seeker); fprintf(stderr,"\n"); - + } int init_midi_device (state_t *s) { resource_t *midi_patch; midi_patch = findResource(9,midi_patchfile); - + if (midi_patch == NULL) { sciprintf(" Patch (%03d) could not be loaded. Initializing with defaults...\n", midi_patchfile); - + if (midi_open(NULL, -1) < 0) { sciprintf(" The MIDI device failed to open cleanly.\n"); return -1; } - + } else if (midi_open(midi_patch->data, midi_patch->length) < 0) { sciprintf(" The MIDI device failed to open cleanly.\n"); return -1; } - + s->sound_volume = 0xc; s->sound_mute = 0; diff --git a/src/sound/soundserver_sdl.c b/src/sound/soundserver_sdl.c index ca31e6ac..29a69af8 100644 --- a/src/sound/soundserver_sdl.c +++ b/src/sound/soundserver_sdl.c @@ -17,6 +17,7 @@ ***************************************************************************/ +#include #include #include #include @@ -54,8 +55,8 @@ static sound_eq_t inqueue; /* The in-event queue */ static sound_eq_t ev_queue; /* The event queue */ -int -sdl_soundserver_init(void *args) +int +sdl_soundserver_init(void *args) { sci0_soundserver(sdl_reverse_stereo); return 0; @@ -95,7 +96,7 @@ sound_sdl_init(state_t *s, int flags) bulk_mutices[i] = SDL_CreateMutex(); } - ds = stderr; + ds = stderr; sound_eq_init(&inqueue); sound_eq_init(&ev_queue); @@ -121,7 +122,7 @@ sound_sdl_get_event(state_t *s) fprintf(stderr, "sound_sdl_get_event(): SDL_LockMutex() returned -1\n"); } - if (!sound_eq_peek_event(&ev_queue)) + if (!sound_eq_peek_event(&ev_queue)) { if (-1 == SDL_UnlockMutex(out_mutex)) { @@ -145,7 +146,7 @@ sound_sdl_get_event(state_t *s) return event; } -void +void sound_sdl_queue_event(int handle, int signal, int value) { if (-1 == SDL_LockMutex(out_mutex)) @@ -162,7 +163,7 @@ sound_sdl_queue_event(int handle, int signal, int value) SDL_UnlockMutex(out_mutex); } -void +void sound_sdl_queue_command(int handle, int signal, int value) { @@ -172,7 +173,7 @@ sound_sdl_queue_command(int handle, int signal, int value) } sound_eq_queue_event(&inqueue, handle, signal, value); - + if (-1 == SDL_UnlockMutex(in_mutex)) { fprintf(stderr, "sound_sdl_queue_command(): SDL_UnlockMutex() returned -1\n"); @@ -229,7 +230,7 @@ sound_sdl_get_data(byte **data_ptr, int *size, int maxlen) } - while (!(data = sci_get_from_queue(queue, size))) + while (!(data = sci_get_from_queue(queue, size))) SDL_CondWait(cond, mutex); if (-1 == SDL_UnlockMutex(mutex)) @@ -243,7 +244,7 @@ sound_sdl_get_data(byte **data_ptr, int *size, int maxlen) } int -sound_sdl_send_data(byte *data_ptr, int maxsend) +sound_sdl_send_data(byte *data_ptr, int maxsend) { int index = 1 - (SDL_ThreadID() == master); SDL_mutex *mutex = bulk_mutices[index]; @@ -270,8 +271,8 @@ sound_sdl_send_data(byte *data_ptr, int maxsend) return maxsend; } -void -sound_sdl_exit(state_t *s) +void +sound_sdl_exit(state_t *s) { int i; @@ -282,7 +283,7 @@ sound_sdl_exit(state_t *s) SDL_DestroyMutex(out_mutex); SDL_DestroyMutex(in_mutex); SDL_DestroyCond(in_cond); - + for (i = 0; i < 2; i++) { void *data = NULL; SDL_DestroyCond(bulk_conds[i]); diff --git a/src/sound/soundserver_unix.c b/src/sound/soundserver_unix.c index b7a451e5..d02f7c28 100644 --- a/src/sound/soundserver_unix.c +++ b/src/sound/soundserver_unix.c @@ -1,5 +1,5 @@ /*************************************************************************** - sounderver_unix.c Copyright (C) 1999 Christoph Reichenbach + soundserver_unix.c Copyright (C) 1999 Christoph Reichenbach This program may be modified and copied freely according to the terms of @@ -159,7 +159,7 @@ sound_unix_init(state_t *s, int flags) if (init_midi_device(s) < 0) return -1; - + child_pid = fork(); if (child_pid < 0) { @@ -210,7 +210,7 @@ sound_unix_configure(state_t *s, char *option, char *value) return 1; /* No options apply to this driver */ } -void +void sound_unix_queue_event(int handle, int signal, int value) { sound_event_t event; @@ -233,7 +233,7 @@ sound_unix_get_event(state_t *s) int success; GTimeVal waittime = {0, 0}; char debug_buf[65]; - sound_event_t *event = xalloc(sizeof(sound_event_t)); + sound_event_t *event = sci_malloc(sizeof(sound_event_t)); sound_unix_server_verify_ppid(); @@ -242,12 +242,12 @@ sound_unix_get_event(state_t *s) FD_SET(x_fd_debug, &inpfds); while ((select(x_fd_debug + 1, &inpfds, NULL, NULL, (struct timeval *)&waittime) && (inplen = read(x_fd_debug, debug_buf, 64)) > 0)) { - + debug_buf[inplen] = 0; /* Terminate string */ sciprintf(debug_buf); /* Transfer debug output */ waittime.tv_sec = 0; waittime.tv_usec = 0; - + FD_ZERO(&inpfds); FD_SET(x_fd_debug, &inpfds); } @@ -257,20 +257,20 @@ sound_unix_get_event(state_t *s) FD_ZERO(&inpfds); FD_SET(x_fd_events, &inpfds); - + success = select(x_fd_events + 1, &inpfds, NULL, NULL, (struct timeval *)&waittime); - + if (success && read(x_fd_events, event, sizeof(sound_event_t)) == sizeof(sound_event_t)) { - + return event; - + } else { free(event); return NULL; } } -void +void sound_unix_queue_command(int handle, int signal, int value) { sound_event_t event; @@ -296,11 +296,11 @@ sound_unix_get_command(GTimeVal *wait_tvp) FD_ZERO(&input_fds); FD_SET(x_fd_in, &input_fds); - + if(select(x_fd_in + 1, &input_fds, NULL, NULL, (struct timeval *)wait_tvp)) { - event = xalloc(sizeof(sound_event_t)); + event = sci_malloc(sizeof(sound_event_t)); if (read(x_fd_in, event, sizeof(sound_event_t)) != sizeof(sound_event_t)) { free(event); event = NULL; @@ -327,7 +327,7 @@ sound_unix_get_data(byte **data_ptr, int *size, int maxlen) sound_unix_server_verify_ppid(); FD_ZERO(&fds); - FD_SET(fd, &fds); + FD_SET(fd, &fds); select(fd +1, &fds, NULL, NULL, (struct timeval *) &timeout); @@ -340,13 +340,13 @@ sound_unix_get_data(byte **data_ptr, int *size, int maxlen) fflush(stdout); remaining_size = *size; - data_ptr_pos = *data_ptr = xalloc(*size); + data_ptr_pos = *data_ptr = sci_malloc(*size); while (remaining_size) { GTimeVal timeout = {0, SOUND_SERVER_TIMEOUT}; - + FD_ZERO(&fds); - FD_SET(fd, &fds); + FD_SET(fd, &fds); select(fd +1, &fds, NULL, NULL, (struct timeval *) &timeout); len = read(fd, data_ptr_pos, remaining_size); @@ -369,7 +369,7 @@ sound_unix_get_data(byte **data_ptr, int *size, int maxlen) } int -sound_unix_send_data(byte *data_ptr, int maxsend) +sound_unix_send_data(byte *data_ptr, int maxsend) { int len; int fd = x_fd_out; diff --git a/src/win32/fsci_dll.dsp b/src/win32/fsci_dll.dsp index fb6e1ec0..97b7ed64 100644 --- a/src/win32/fsci_dll.dsp +++ b/src/win32/fsci_dll.dsp @@ -1,587 +1,591 @@ -# Microsoft Developer Studio Project File - Name="fsci_dll" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=fsci_dll - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "fsci_dll.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "fsci_dll.mak" CFG="fsci_dll - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "fsci_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "fsci_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "fsci_dll - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "fsci_dll_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FSCI_DLL_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O1 /Ob2 /I "..\..\..\SDL-1.2.2\include" /I "..\include" /I "..\include\win32" /D PACKAGE=\"FreeSCI\" /D VERSION=__TIMESTAMP__ /D "HAVE_DDRAW" /D "X_DISPLAY_MISSING" /D "HAVE_SDL" /D "HAVE_STRING_H" /D "_CONSOLE" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FREESCI_EXPORTS" /D "NDEBUG" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc09 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 ..\..\..\SDL-1.2.2\lib\SDL.lib ddraw.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /map:"..\..\bin\fsci.map" /debug /machine:I386 /out:"..\..\bin\fsci.dll" -# SUBTRACT LINK32 /profile /pdb:none - -!ELSEIF "$(CFG)" == "fsci_dll - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "fsci_dll_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FSCI_DLL_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GR /GX /ZI /Od /I "..\..\..\SDL-1.2.2\include" /I "..\include" /I "..\include\win32" /D PACKAGE=\"FreeSCI\" /D VERSION=__TIMESTAMP__ /D "HAVE_DDRAW" /D "X_DISPLAY_MISSING" /D "HAVE_SDL" /D "HAVE_STRING_H" /D "_CONSOLE" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FREESCI_EXPORTS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc09 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\..\SDL-1.2.2\lib\SDL.lib ddraw.lib winmm.lib kernel32.lib user32.lib gdi32.lib advapi32.lib uuid.lib /nologo /dll /pdb:none /debug /machine:I386 /out:"Debug/fsci.dll" - -!ENDIF - -# Begin Target - -# Name "fsci_dll - Win32 Release" -# Name "fsci_dll - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Group "engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\engine\game.c -# End Source File -# Begin Source File - -SOURCE=..\engine\grammar.c -# End Source File -# Begin Source File - -SOURCE=..\engine\heap.c -# End Source File -# Begin Source File - -SOURCE=..\engine\kernel.c -# End Source File -# Begin Source File - -SOURCE=..\engine\kevent.c -# End Source File -# Begin Source File - -SOURCE=..\engine\kfile.c -# End Source File -# Begin Source File - -SOURCE=..\engine\kgraphics.c -# End Source File -# Begin Source File - -SOURCE=..\engine\klists.c -# End Source File -# Begin Source File - -SOURCE=..\engine\kmath.c -# End Source File -# Begin Source File - -SOURCE=..\engine\kmenu.c -# End Source File -# Begin Source File - -SOURCE=..\engine\kmovement.c -# End Source File -# Begin Source File - -SOURCE=..\engine\kscripts.c -# End Source File -# Begin Source File - -SOURCE=..\engine\ksound.c -# End Source File -# Begin Source File - -SOURCE=..\engine\kstring.c -# End Source File -# Begin Source File - -SOURCE=..\engine\said.c -# End Source File -# Begin Source File - -SOURCE=..\engine\savegame.c -# End Source File -# Begin Source File - -SOURCE=..\engine\savegame.cfsml -# End Source File -# Begin Source File - -SOURCE=..\engine\scriptdebug.c -# End Source File -# Begin Source File - -SOURCE=..\engine\simplesaid.c -# End Source File -# Begin Source File - -SOURCE=..\engine\vm.c -# End Source File -# End Group -# Begin Group "gfx" - -# PROP Default_Filter "" -# Begin Group "resource" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\gfx\resource\sci_cursor_0.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\resource\sci_font.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\resource\sci_pal_1.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\resource\sci_pic_0.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\resource\sci_resmgr.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\resource\sci_view_0.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\resource\sci_view_1.c -# End Source File -# End Group -# Begin Group "drivers" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\gfx\drivers\dd_driver.cpp -# End Source File -# Begin Source File - -SOURCE=..\gfx\drivers\dd_driver_line.cpp -# End Source File -# Begin Source File - -SOURCE=..\gfx\drivers\gfx_drivers.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\drivers\sdl_driver.c -# End Source File -# End Group -# Begin Source File - -SOURCE=..\gfx\alpha_mvi_crossblit.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\antialias.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\font.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\gfx_crossblit.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=..\gfx\gfx_line.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=..\gfx\gfx_pixmap_scale.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=..\gfx\gfx_resource.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\gfx_support.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\gfx_tools.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\menubar.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\operations.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\resmgr.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\sbtree.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\sci_widgets.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\widgets.c -# End Source File -# Begin Source File - -SOURCE=..\gfx\wrapper.c -# End Source File -# End Group -# Begin Group "scicore" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\scicore\console.c -# End Source File -# Begin Source File - -SOURCE=..\scicore\decompress0.c -# End Source File -# Begin Source File - -SOURCE=..\scicore\decompress01.c -# End Source File -# Begin Source File - -SOURCE=..\scicore\decompress1.c -# End Source File -# Begin Source File - -SOURCE=..\scicore\decompress11.c -# End Source File -# Begin Source File - -SOURCE=..\scicore\old_objects.c -# End Source File -# Begin Source File - -SOURCE=..\scicore\resource.c -# End Source File -# Begin Source File - -SOURCE=..\scicore\resourcecheck.c -# End Source File -# Begin Source File - -SOURCE=..\scicore\script.c -# End Source File -# Begin Source File - -SOURCE=..\scicore\tools.c -# End Source File -# Begin Source File - -SOURCE=..\scicore\vocab.c -# End Source File -# Begin Source File - -SOURCE=..\scicore\vocab_debug.c -# End Source File -# End Group -# Begin Group "sound" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\sound\midi_adlib.c -# End Source File -# Begin Source File - -SOURCE=..\sound\midi_device.c -# End Source File -# Begin Source File - -SOURCE=..\sound\midi_mt32.c -# End Source File -# Begin Source File - -SOURCE=..\sound\midi_mt32gm.c -# End Source File -# Begin Source File - -SOURCE=..\sound\midiout.c -# End Source File -# Begin Source File - -SOURCE=..\sound\midiout_win32mci.c -# End Source File -# Begin Source File - -SOURCE=..\sound\oldmidi.c -# End Source File -# Begin Source File - -SOURCE=..\sound\sfx_save.c -# End Source File -# Begin Source File - -SOURCE=..\sound\sound.c -# End Source File -# Begin Source File - -SOURCE=..\sound\soundserver.c -# End Source File -# Begin Source File - -SOURCE=..\sound\soundserver_sdl.c -# End Source File -# End Group -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\include\console.h -# End Source File -# Begin Source File - -SOURCE=..\gfx\drivers\dd_driver.h -# End Source File -# Begin Source File - -SOURCE=..\include\engine.h -# End Source File -# Begin Source File - -SOURCE=..\include\event.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_driver.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_drivers_list.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_operations.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_options.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_resmgr.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_resource.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_state.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_state_internal.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_system.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_tools.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_widgets.h -# End Source File -# Begin Source File - -SOURCE=..\include\graphics.h -# End Source File -# Begin Source File - -SOURCE=..\include\graphics_ddraw.h -# End Source File -# Begin Source File - -SOURCE=..\include\graphics_ggi.h -# End Source File -# Begin Source File - -SOURCE=..\include\graphics_glx.h -# End Source File -# Begin Source File - -SOURCE=..\include\graphics_png.h -# End Source File -# Begin Source File - -SOURCE=..\include\heap.h -# End Source File -# Begin Source File - -SOURCE=..\include\kdebug.h -# End Source File -# Begin Source File - -SOURCE=..\include\kernel.h -# End Source File -# Begin Source File - -SOURCE=..\include\menubar.h -# End Source File -# Begin Source File - -SOURCE=..\include\midi_device.h -# End Source File -# Begin Source File - -SOURCE=..\include\midiout.h -# End Source File -# Begin Source File - -SOURCE=..\include\modules.h -# End Source File -# Begin Source File - -SOURCE=..\include\old_objects.h -# End Source File -# Begin Source File - -SOURCE=..\include\resource.h -# End Source File -# Begin Source File - -SOURCE=..\include\sbtree.h -# End Source File -# Begin Source File - -SOURCE=..\include\sci_conf.h -# End Source File -# Begin Source File - -SOURCE=..\include\sci_dos.h -# End Source File -# Begin Source File - -SOURCE=..\include\sci_graphics.h -# End Source File -# Begin Source File - -SOURCE=..\include\sci_widgets.h -# End Source File -# Begin Source File - -SOURCE=..\include\sciresource.h -# End Source File -# Begin Source File - -SOURCE=..\include\scitypes.h -# End Source File -# Begin Source File - -SOURCE=..\include\script.h -# End Source File -# Begin Source File - -SOURCE=..\include\sound.h -# End Source File -# Begin Source File - -SOURCE=..\include\soundserver.h -# End Source File -# Begin Source File - -SOURCE=..\include\uinput.h -# End Source File -# Begin Source File - -SOURCE=..\include\util.h -# End Source File -# Begin Source File - -SOURCE=..\include\versions.h -# End Source File -# Begin Source File - -SOURCE=..\include\vm.h -# End Source File -# Begin Source File - -SOURCE=..\include\vocabulary.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\freesci.def -# End Source File -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="fsci_dll" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=fsci_dll - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "fsci_dll.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "fsci_dll.mak" CFG="fsci_dll - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "fsci_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "fsci_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "fsci_dll - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "fsci_dll_Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FSCI_DLL_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O1 /Ob2 /I "..\..\..\SDL-1.2.2\include" /I "..\include" /I "..\include\win32" /D PACKAGE=\"FreeSCI\" /D VERSION=__TIMESTAMP__ /D "HAVE_DDRAW" /D "X_DISPLAY_MISSING" /D "HAVE_SDL" /D "HAVE_STRING_H" /D "_CONSOLE" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FREESCI_EXPORTS" /D "NDEBUG" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0xc09 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 ..\..\..\SDL-1.2.2\lib\SDL.lib ddraw.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /map:"..\..\bin\fsci.map" /debug /machine:I386 /out:"..\..\bin\fsci.dll" +# SUBTRACT LINK32 /profile /pdb:none + +!ELSEIF "$(CFG)" == "fsci_dll - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "fsci_dll_Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FSCI_DLL_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /Gi /GR /GX /ZI /Od /I "..\..\..\SDL-1.2.2\include" /I "..\include" /I "..\include\win32" /D PACKAGE=\"FreeSCI\" /D "X_DISPLAY_MISSING" /D "HAVE_SDL" /D "_WINDOWS" /D "_USRDLL" /D "FREESCI_EXPORTS" /D "_DEBUG" /D VERSION=__TIMESTAMP__ /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_STRING_H" /FR /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0xc09 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 ..\..\..\SDL-1.2.2\lib\SDL.lib winmm.lib kernel32.lib user32.lib gdi32.lib advapi32.lib uuid.lib /nologo /dll /pdb:none /debug /machine:I386 /out:"Debug/fsci.dll" + +!ENDIF + +# Begin Target + +# Name "fsci_dll - Win32 Release" +# Name "fsci_dll - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Group "engine" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\engine\game.c +# End Source File +# Begin Source File + +SOURCE=..\engine\grammar.c +# End Source File +# Begin Source File + +SOURCE=..\engine\heap.c +# End Source File +# Begin Source File + +SOURCE=..\engine\kernel.c +# End Source File +# Begin Source File + +SOURCE=..\engine\kevent.c +# End Source File +# Begin Source File + +SOURCE=..\engine\kfile.c +# End Source File +# Begin Source File + +SOURCE=..\engine\kgraphics.c +# End Source File +# Begin Source File + +SOURCE=..\engine\klists.c +# End Source File +# Begin Source File + +SOURCE=..\engine\kmath.c +# End Source File +# Begin Source File + +SOURCE=..\engine\kmenu.c +# End Source File +# Begin Source File + +SOURCE=..\engine\kmovement.c +# End Source File +# Begin Source File + +SOURCE=..\engine\kscripts.c +# End Source File +# Begin Source File + +SOURCE=..\engine\ksound.c +# End Source File +# Begin Source File + +SOURCE=..\engine\kstring.c +# End Source File +# Begin Source File + +SOURCE=..\engine\said.c +# End Source File +# Begin Source File + +SOURCE=..\engine\savegame.c +# End Source File +# Begin Source File + +SOURCE=..\engine\savegame.cfsml +# End Source File +# Begin Source File + +SOURCE=..\engine\scriptdebug.c +# End Source File +# Begin Source File + +SOURCE=..\engine\simplesaid.c +# End Source File +# Begin Source File + +SOURCE=..\engine\vm.c +# End Source File +# End Group +# Begin Group "gfx" + +# PROP Default_Filter "" +# Begin Group "resource" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\gfx\resource\sci_cursor_0.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\resource\sci_font.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\resource\sci_pal_1.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\resource\sci_pic_0.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\resource\sci_resmgr.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\resource\sci_view_0.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\resource\sci_view_1.c +# End Source File +# End Group +# Begin Group "drivers" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\gfx\drivers\dd_driver.cpp +# End Source File +# Begin Source File + +SOURCE=..\gfx\drivers\dd_driver_line.cpp +# End Source File +# Begin Source File + +SOURCE=..\gfx\drivers\gfx_drivers.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\drivers\sdl_driver.c +# End Source File +# End Group +# Begin Source File + +SOURCE=..\gfx\alpha_mvi_crossblit.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\antialias.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\font.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\gfx_crossblit.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=..\gfx\gfx_line.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=..\gfx\gfx_pixmap_scale.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=..\gfx\gfx_resource.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\gfx_support.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\gfx_tools.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\menubar.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\operations.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\resmgr.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\sbtree.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\sci_widgets.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\widgets.c +# End Source File +# Begin Source File + +SOURCE=..\gfx\wrapper.c +# End Source File +# End Group +# Begin Group "scicore" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\scicore\console.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\decompress0.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\decompress01.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\decompress1.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\decompress11.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\old_objects.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\resource.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\resourcecheck.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\sci_memory.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\script.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\tools.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\vocab.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\vocab_debug.c +# End Source File +# End Group +# Begin Group "sound" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\sound\midi_adlib.c +# End Source File +# Begin Source File + +SOURCE=..\sound\midi_device.c +# End Source File +# Begin Source File + +SOURCE=..\sound\midi_mt32.c +# End Source File +# Begin Source File + +SOURCE=..\sound\midi_mt32gm.c +# End Source File +# Begin Source File + +SOURCE=..\sound\midiout.c +# End Source File +# Begin Source File + +SOURCE=..\sound\midiout_win32mci.c +# End Source File +# Begin Source File + +SOURCE=..\sound\oldmidi.c +# End Source File +# Begin Source File + +SOURCE=..\sound\sfx_save.c +# End Source File +# Begin Source File + +SOURCE=..\sound\sound.c +# End Source File +# Begin Source File + +SOURCE=..\sound\soundserver.c +# End Source File +# Begin Source File + +SOURCE=..\sound\soundserver_sdl.c +# End Source File +# End Group +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\include\console.h +# End Source File +# Begin Source File + +SOURCE=..\gfx\drivers\dd_driver.h +# End Source File +# Begin Source File + +SOURCE=..\include\engine.h +# End Source File +# Begin Source File + +SOURCE=..\include\event.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_driver.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_drivers_list.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_operations.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_options.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_resmgr.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_resource.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_state.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_state_internal.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_system.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_tools.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_widgets.h +# End Source File +# Begin Source File + +SOURCE=..\include\graphics.h +# End Source File +# Begin Source File + +SOURCE=..\include\graphics_ddraw.h +# End Source File +# Begin Source File + +SOURCE=..\include\graphics_ggi.h +# End Source File +# Begin Source File + +SOURCE=..\include\graphics_glx.h +# End Source File +# Begin Source File + +SOURCE=..\include\graphics_png.h +# End Source File +# Begin Source File + +SOURCE=..\include\heap.h +# End Source File +# Begin Source File + +SOURCE=..\include\kdebug.h +# End Source File +# Begin Source File + +SOURCE=..\include\kernel.h +# End Source File +# Begin Source File + +SOURCE=..\include\menubar.h +# End Source File +# Begin Source File + +SOURCE=..\include\midi_device.h +# End Source File +# Begin Source File + +SOURCE=..\include\midiout.h +# End Source File +# Begin Source File + +SOURCE=..\include\modules.h +# End Source File +# Begin Source File + +SOURCE=..\include\old_objects.h +# End Source File +# Begin Source File + +SOURCE=..\include\resource.h +# End Source File +# Begin Source File + +SOURCE=..\include\sbtree.h +# End Source File +# Begin Source File + +SOURCE=..\include\sci_conf.h +# End Source File +# Begin Source File + +SOURCE=..\include\sci_dos.h +# End Source File +# Begin Source File + +SOURCE=..\include\sci_graphics.h +# End Source File +# Begin Source File + +SOURCE=..\include\sci_widgets.h +# End Source File +# Begin Source File + +SOURCE=..\include\sciresource.h +# End Source File +# Begin Source File + +SOURCE=..\include\scitypes.h +# End Source File +# Begin Source File + +SOURCE=..\include\script.h +# End Source File +# Begin Source File + +SOURCE=..\include\sound.h +# End Source File +# Begin Source File + +SOURCE=..\include\soundserver.h +# End Source File +# Begin Source File + +SOURCE=..\include\uinput.h +# End Source File +# Begin Source File + +SOURCE=..\include\util.h +# End Source File +# Begin Source File + +SOURCE=..\include\versions.h +# End Source File +# Begin Source File + +SOURCE=..\include\vm.h +# End Source File +# Begin Source File + +SOURCE=..\include\vocabulary.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\freesci.def +# End Source File +# End Target +# End Project diff --git a/src/win32/sciv.dsp b/src/win32/sciv.dsp index deaa9bff..1be977c1 100644 --- a/src/win32/sciv.dsp +++ b/src/win32/sciv.dsp @@ -1,241 +1,245 @@ -# Microsoft Developer Studio Project File - Name="sciv" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=sciv - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "sciv.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "sciv.mak" CFG="sciv - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "sciv - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "sciv - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "sciv - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "sciv_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /Zi /O1 /Ob2 /I "..\..\..\SDL-1.2.2\include" /I "..\include" /I "..\include\win32" /D "HAVE_SDL" /D "NDEBUG" /D PACKAGE=\"FreeSCI\" /D VERSION=\"pre-0.3.3\" /D "HAVE_GETOPT_H" /D "HAVE_USLEEP" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_DDRAW" /FD /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 Release\fsci.lib ..\..\..\SDL-1.2.2\lib\SDL.lib winmm.lib kernel32.lib user32.lib gdi32.lib advapi32.lib uuid.lib ddraw.lib /nologo /subsystem:console /map:"..\..\bin\freesci.map" /debug /machine:I386 /out:"..\..\bin\freesci.exe" /FIXED:NO -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "sciv - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "sciv___Win32_Debug" -# PROP BASE Intermediate_Dir "sciv___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "sciv_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /Gi /GR /GX /ZI /Od /I "..\..\..\SDL-1.2.2\include" /I "..\include" /I "..\include\win32" /D "_DEBUG" /D PACKAGE=\"freesci\" /D VERSION=__TIMESTAMP__ /D "HAVE_DDRAW" /D "HAVE_GETOPT_H" /D "HAVE_LIBPNG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_STRING_H" /FR /YX /FD /GZ /c -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ddraw.lib winmm.lib Debug\fsci.lib kernel32.lib user32.lib gdi32.lib advapi32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBC" /out:"Debug\freesci.exe" -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "sciv - Win32 Release" -# Name "sciv - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\config.c -# End Source File -# Begin Source File - -SOURCE=.\getopt.c -# End Source File -# Begin Source File - -SOURCE=..\main.c -# End Source File -# Begin Source File - -SOURCE=.\usleep.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\include\console.h -# End Source File -# Begin Source File - -SOURCE=..\include\engine.h -# End Source File -# Begin Source File - -SOURCE=..\include\event.h -# End Source File -# Begin Source File - -SOURCE=..\include\win32\getopt.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_driver.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_operations.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_options.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_resmgr.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_resource.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_state_internal.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_system.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_tools.h -# End Source File -# Begin Source File - -SOURCE=..\include\gfx_widgets.h -# End Source File -# Begin Source File - -SOURCE=..\include\graphics.h -# End Source File -# Begin Source File - -SOURCE=..\include\heap.h -# End Source File -# Begin Source File - -SOURCE=..\include\kdebug.h -# End Source File -# Begin Source File - -SOURCE=..\include\kernel.h -# End Source File -# Begin Source File - -SOURCE=..\include\menubar.h -# End Source File -# Begin Source File - -SOURCE=..\include\midi_device.h -# End Source File -# Begin Source File - -SOURCE=..\include\midiout.h -# End Source File -# Begin Source File - -SOURCE=..\include\resource.h -# End Source File -# Begin Source File - -SOURCE=..\include\sbtree.h -# End Source File -# Begin Source File - -SOURCE=..\include\sci_conf.h -# End Source File -# Begin Source File - -SOURCE=..\include\sciresource.h -# End Source File -# Begin Source File - -SOURCE=..\include\scitypes.h -# End Source File -# Begin Source File - -SOURCE=..\include\script.h -# End Source File -# Begin Source File - -SOURCE=..\include\sound.h -# End Source File -# Begin Source File - -SOURCE=..\include\soundserver.h -# End Source File -# Begin Source File - -SOURCE=..\include\uinput.h -# End Source File -# Begin Source File - -SOURCE=..\include\versions.h -# End Source File -# Begin Source File - -SOURCE=..\include\vm.h -# End Source File -# Begin Source File - -SOURCE=..\include\vocabulary.h -# End Source File -# End Group -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="sciv" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=sciv - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "sciv.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sciv.mak" CFG="sciv - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "sciv - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "sciv - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "sciv - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "sciv_Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /Zi /O1 /Ob2 /I "..\..\..\SDL-1.2.2\include" /I "..\include" /I "..\include\win32" /D "HAVE_SDL" /D "NDEBUG" /D PACKAGE=\"FreeSCI\" /D "HAVE_GETOPT_H" /D "HAVE_USLEEP" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_DDRAW" /FD /D VERSION=\"0.3.2-devel\" /c +# SUBTRACT CPP /Fr +# ADD BASE RSC /l 0x419 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 Release\fsci.lib ..\..\..\SDL-1.2.2\lib\SDL.lib winmm.lib kernel32.lib user32.lib gdi32.lib advapi32.lib uuid.lib ddraw.lib /nologo /subsystem:console /map:"..\..\bin\freesci.map" /debug /machine:I386 /out:"..\..\bin\freesci.exe" /FIXED:NO +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "sciv - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "sciv___Win32_Debug" +# PROP BASE Intermediate_Dir "sciv___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "sciv_Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /Gi /GR /GX /ZI /Od /I "..\..\..\SDL-1.2.2\include" /I "..\include" /I "..\include\win32" /D PACKAGE=\"freesci\" /D "HAVE_GETOPT_H" /D "HAVE_LIBPNG" /D "_DEBUG" /D VERSION=__TIMESTAMP__ /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_STRING_H" /FR /YX /FD /GZ /c +# ADD BASE RSC /l 0x419 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 Debug\fsci.lib winmm.lib kernel32.lib user32.lib gdi32.lib advapi32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBC" /out:"Debug\freesci.exe" +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "sciv - Win32 Release" +# Name "sciv - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\config.c +# End Source File +# Begin Source File + +SOURCE=.\getopt.c +# End Source File +# Begin Source File + +SOURCE=..\main.c +# End Source File +# Begin Source File + +SOURCE=..\scicore\sci_memory.c +# End Source File +# Begin Source File + +SOURCE=.\usleep.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\include\console.h +# End Source File +# Begin Source File + +SOURCE=..\include\engine.h +# End Source File +# Begin Source File + +SOURCE=..\include\event.h +# End Source File +# Begin Source File + +SOURCE=..\include\win32\getopt.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_driver.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_operations.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_options.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_resmgr.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_resource.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_state_internal.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_system.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_tools.h +# End Source File +# Begin Source File + +SOURCE=..\include\gfx_widgets.h +# End Source File +# Begin Source File + +SOURCE=..\include\graphics.h +# End Source File +# Begin Source File + +SOURCE=..\include\heap.h +# End Source File +# Begin Source File + +SOURCE=..\include\kdebug.h +# End Source File +# Begin Source File + +SOURCE=..\include\kernel.h +# End Source File +# Begin Source File + +SOURCE=..\include\menubar.h +# End Source File +# Begin Source File + +SOURCE=..\include\midi_device.h +# End Source File +# Begin Source File + +SOURCE=..\include\midiout.h +# End Source File +# Begin Source File + +SOURCE=..\include\resource.h +# End Source File +# Begin Source File + +SOURCE=..\include\sbtree.h +# End Source File +# Begin Source File + +SOURCE=..\include\sci_conf.h +# End Source File +# Begin Source File + +SOURCE=..\include\sciresource.h +# End Source File +# Begin Source File + +SOURCE=..\include\scitypes.h +# End Source File +# Begin Source File + +SOURCE=..\include\script.h +# End Source File +# Begin Source File + +SOURCE=..\include\sound.h +# End Source File +# Begin Source File + +SOURCE=..\include\soundserver.h +# End Source File +# Begin Source File + +SOURCE=..\include\uinput.h +# End Source File +# Begin Source File + +SOURCE=..\include\versions.h +# End Source File +# Begin Source File + +SOURCE=..\include\vm.h +# End Source File +# Begin Source File + +SOURCE=..\include\vocabulary.h +# End Source File +# End Group +# End Target +# End Project