hp48cc-1.3/0040755000076500001450000000000007337716663012034 5ustar sandrosandrohp48cc-1.3/acconfig.h0100644000076500001450000000036506365670522013750 0ustar sandrosandro@BOTTOM@ #include "version.h" #include #ifndef HAVE_XMALLOC extern void *xmalloc(size_t); #endif #ifndef HAVE_XREALLOC extern void *xrealloc(void *, size_t); #endif #ifndef HAVE_XSTRDUP extern char *xstrdup(const char *); #endif hp48cc-1.3/config.h.in0100644000076500001450000000262006363407430014037 0ustar sandrosandro/* config.h.in. Generated automatically from configure.in by autoheader. */ /* Define to empty if the keyword does not work. */ #undef const /* Define if you don't have vprintf but do have _doprnt. */ #undef HAVE_DOPRNT /* Define if you have the vprintf function. */ #undef HAVE_VPRINTF /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if lex declares yytext as a char * by default, not a char[]. */ #undef YYTEXT_POINTER /* Define if you have the err function. */ #undef HAVE_ERR /* Define if you have the strerror function. */ #undef HAVE_STRERROR /* Define if you have the xmalloc function. */ #undef HAVE_XMALLOC /* Define if you have the xrealloc function. */ #undef HAVE_XREALLOC /* Define if you have the xstrdup function. */ #undef HAVE_XSTRDUP /* Define if you have the header file. */ #undef HAVE_DIRENT_H /* Define if you have the header file. */ #undef HAVE_NDIR_H /* Define if you have the header file. */ #undef HAVE_SYS_DIR_H /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H #include "version.h" #include #ifndef HAVE_XMALLOC extern void *xmalloc(size_t); #endif #ifndef HAVE_XREALLOC extern void *xrealloc(void *, size_t); #endif #ifndef HAVE_XSTRDUP extern char *xstrdup(const char *); #endif hp48cc-1.3/configure0100755000076500001450000017457207334771714013753 0ustar sandrosandro#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=version.h # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= 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:530: 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 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi 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:560: 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 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then case "`uname -s`" in *win32* | *WIN32*) # 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:611: 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 if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi ;; esac fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:643: 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. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF #line 654 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:659: \"$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 ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 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:685: 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:690: 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 cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi 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:718: 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 echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # 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:780: 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 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # 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:835: 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 if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="ranlib" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" fi fi RANLIB="$ac_cv_prog_RANLIB" if test -n "$RANLIB"; then echo "$ac_t""$RANLIB" 1>&6 else echo "$ac_t""no" 1>&6 fi # 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:865: 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 if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_LEX="flex" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" fi fi LEX="$ac_cv_prog_LEX" if test -n "$LEX"; then echo "$ac_t""$LEX" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$LEXLIB" then case "$LEX" in flex*) ac_lib=fl ;; *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 echo "configure:899: 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 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 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LEXLIB="-l$ac_lib" else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:941: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # 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:962: \"$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 : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 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:979: \"$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 : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 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:996: \"$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 : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking lex output file root""... $ac_c" 1>&6 echo "configure:1021: 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 # The minimal lex program is just a single line: %%. But some broken lexes # (Solaris, I think it was) want two %% lines, so accommodate them. echo '%% %%' | $LEX if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; } fi fi 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:1042: 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 # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no 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 rm -rf conftest* ac_cv_prog_lex_yytext_pointer=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* LIBS="$ac_save_LIBS" rm -f "${LEX_OUTPUT_ROOT}.c" fi echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6 if test $ac_cv_prog_lex_yytext_pointer = yes; then cat >> confdefs.h <<\EOF #define YYTEXT_POINTER 1 EOF fi for ac_prog in 'bison -y' byacc 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:1087: 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 if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_YACC="$ac_prog" break fi done IFS="$ac_save_ifs" fi fi YACC="$ac_cv_prog_YACC" if test -n "$YACC"; then echo "$ac_t""$YACC" 1>&6 else echo "$ac_t""no" 1>&6 fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" for ac_func in err xmalloc xrealloc xstrdup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:1121: 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 < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:1149: \"$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 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" fi done ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 echo "configure:1181: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> int main() { DIR *dirp = 0; ; return 0; } EOF if { (eval echo configure:1194: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 echo "configure:1219: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="$LIBS -ldir" else echo "$ac_t""no" 1>&6 fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 echo "configure:1260: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="$LIBS -lx" else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 echo "configure:1302: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1315: \"$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* ac_cv_header_stdc=yes else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF if { (eval echo configure:1382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_header_stdc=no fi rm -fr conftest* fi fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 if test $ac_cv_header_stdc = yes; then cat >> confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi 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:1409: 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:1419: \"$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* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done echo $ac_n "checking for working const""... $ac_c" 1>&6 echo "configure:1447: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } ; return 0; } EOF if { (eval echo configure:1501: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_const=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_c_const" 1>&6 if test $ac_cv_c_const = no; then cat >> confdefs.h <<\EOF #define const EOF fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 echo "configure:1523: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_func_memcmp_clean=no fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" echo $ac_n "checking for vprintf""... $ac_c" 1>&6 echo "configure:1559: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char vprintf(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_vprintf) || defined (__stub___vprintf) choke me #else vprintf(); #endif ; return 0; } EOF if { (eval echo configure:1587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_vprintf=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_VPRINTF 1 EOF else echo "$ac_t""no" 1>&6 fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 echo "configure:1611: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char _doprnt(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub__doprnt) || defined (__stub____doprnt) choke me #else _doprnt(); #endif ; return 0; } EOF if { (eval echo configure:1639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func__doprnt=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_DOPRNT 1 EOF else echo "$ac_t""no" 1>&6 fi fi for ac_func in strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:1666: 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 < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:1694: \"$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 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile lib/Makefile src/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@CC@%$CC%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@RANLIB@%$RANLIB%g s%@LEX@%$LEX%g s%@LEXLIB@%$LEXLIB%g s%@CPP@%$CPP%g s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g s%@YACC@%$YACC%g s%@LIBOBJS@%$LIBOBJS%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: # Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF sed -n -f conftest.hdr confdefs.h > conftest.vals rm -f conftest.hdr # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >> conftest.vals <<\EOF s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write a limited-size here document to conftest.frag. echo ' cat > conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF sed -f conftest.frag conftest.in > conftest.out rm -f conftest.in mv conftest.out conftest.in ' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 hp48cc-1.3/configure.in0100644000076500001450000000113106363407430014321 0ustar sandrosandrodnl Process this file with autoconf to produce a configure script. AC_INIT(version.h) AC_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_RANLIB AC_PROG_LEX AC_DECL_YYTEXT AC_PROG_YACC dnl Checks for libraries. AC_REPLACE_FUNCS(err xmalloc xrealloc xstrdup) dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST dnl Checks for library functions. AC_FUNC_MEMCMP AC_FUNC_VPRINTF AC_CHECK_FUNCS(strerror) AC_OUTPUT(Makefile lib/Makefile src/Makefile) hp48cc-1.3/COPYING0100644000076500001450000004307607337575123013070 0ustar sandrosandro GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. hp48cc-1.3/COPYRIGHT0100644000076500001450000000172507337713433013321 0ustar sandrosandroThis program was initially based on the `g48' compiler written by M. Andreoli but has been rewritten from scratch by Sandro Sigala . Old code and idea copyright (c) 1997 Michele Andreoli. All rights reserved. New code copyright (c) 1997-2001 Sandro Sigala. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. hp48cc-1.3/examples/0040755000076500001450000000000007337716663013652 5ustar sandrosandrohp48cc-1.3/examples/accuracy.hpc0100644000076500001450000000052407336521165016124 0ustar sandrosandro// accuracy.hpc -- Test the HP48 accuracy -*- C -*- // Calculate the number of significant bits in the mantissa // of a floating number and the number of significant digits // in a decimal number. x = 2; j = 0; for (x = 2; x + 1 != x; x = x * 2) j = j + 1; MSGBOX("Mantissa bits: " + j + "\nDecimal bits: " + 0.30103*j); PURGE(@{x, j}); hp48cc-1.3/examples/astro.hpc0100644000076500001450000000473507337716351015476 0ustar sandrosandro// astro.hpc -- Some astronomical algorithms -*- C -*- // Convert an integer to a two-digit string. // For example: // twodigits(3) returns "03" // twodigits(12) returns "12" declare twodigits(x) { if (x < 10) "0" + \\\-\>STR(x); else \\\-\>STR(x); } // Convert degrees, minutes, seconds to degrees (fractional). declare dms2d(d, m, s) { d + (m + s / 60) / 60; } // Convert hours, minutes, seconds to degrees (fractional). declare hms2d(h, m, s) { (h + (m + s / 60) / 60) * 15; } // Format degrees to string. // For example, d2s(10.5) returns "10°30'00"" declare d2s(x) : d(0), m(0), s(0) { d = twodigits(IP(x)); x = 60*FP(x); m = twodigits(IP(x)); x = 60*FP(x); s = twodigits(RND(x, 0)); d + "\\^o" + m + "'" + s + CHR(34); // Return value } // Format hours to string. // For example, h2s(9.25) returns "09h15m00s" declare h2s(x) : h(0), m(0), s(0) { h = twodigits(IP(x)); x = 60*FP(x); m = twodigits(IP(x)); x = 60*FP(x); s = twodigits(RND(x, 0)); h + "h" + m + "m" + s + "s"; // Return value } // Format degrees to string. // For example, dms2s(10, 2, 5) returns "10°02'05"" declare dms2s(d, m, s) { d2s(dms2d(d, m, s)); } // Format hours to string. // For example, hms2s(10, 2, 5) returns "10h02m05s" declare hms2s(h, m, s) { h2s(dms2d(h, m, s)); } // Calculate the date of Easter Sunday in the Gregorian calendar // (hence valid from the year 1583 on). // Algorithm by Spencer Jones, General Astronomy, 1922. // Returns: // 1: number of the month (1 = January, 2 = February, ...) // 2: day of that month upon which Easter Sunday falls declare easter(year) : a(0), b(0), c(0), d(0), e(0), f(0), g(0), h(0), j(0), k(0), l(0), m(0), n(0), p(0) { a = year % 19; b = IP(year / 100); c = year % 100; d = IP(b / 4); e = b % 4; f = IP((b + 8) / 25); g = IP((b - f + 1) / 3); h = (19*a + b - d - g + 15) % 30; j = IP(c / 4); k = c % 4; l = (32 + 2*e + 2*j - h - k) % 7; m = IP((a + 11*h + 22*l) / 451); n = IP((h + l - 7*m + 114) / 31); p = (h + l - 7*m + 114) % 31; n; // Return month p + 1; // Return day } // Calculate the date of Easter Sunday in the Julian calendar. // Returns: // 1: number of the month (1 = January, 2 = February, ...) // 2: day of that month upon which Easter Sunday falls declare jeaster(year) : a(0), b(0), c(0), d(0), e(0), f(0), g(0) { a = year % 4; b = year % 7; c = year % 19; d = (19*c + 15) % 30; e = (2*a + 4*b - d + 34) % 7; f = IP((d + e + 114) / 31); g = (d + e + 114) % 31; f; // Return month g + 1; // Return day } hp48cc-1.3/examples/fact.hpc0100644000076500001450000000020007336521165015236 0ustar sandrosandro// fact.hpc -- Calculate the factorial -*- C -*- declare fact(i) : s(1) { for (; i > 1; --i) s *= i; s; // Return value } hp48cc-1.3/examples/gcd.hpc0100644000076500001450000000045107336521165015066 0ustar sandrosandro// gcd.hpc -- Finds greatest common denominators -*- C -*- // // Based on a version written by Jay Kominek declare gcd(m, n) : z(0) { if (n > m) { // Swap values z = m; m = n; n = z; } do { z = m % n; m = n; n = z; } while (z != 0); m; // Return value } hp48cc-1.3/examples/hello.hpc0100644000076500001450000000036707336521165015442 0ustar sandrosandro// hello.hpc -- Produces a familiar, friendly greeting -*- C -*- // Define main function declare main() { // Call HP48 built-in function `MSGBOX' MSGBOX("Hello world!"); } // Call main function main(); // Remove main function PURGE(@{main}); hp48cc-1.3/examples/inform.hpc0100644000076500001450000000045707336521165015631 0ustar sandrosandro// inform.hpc -- Example of INFORM usage -*- C -*- def = @{}; for (;;) { r = INFORM( "Menu test", @{ @{"1:", "Red", 1}, @{"2:", "Blue", 2}, @{"3:", "Yellow", 3} }, @{1, 1}, @{}, def ); if (r == 0) { MSGBOX("Quitting"); PURGE(@{def, r}); KILL(); } } PURGE(@{def}); hp48cc-1.3/examples/pi1.hpc0100644000076500001450000000027407336521165015025 0ustar sandrosandro// pi1.hpc -- Calculate the pi (Algorithm 1) -*- C -*- // k is the number of iterations declare pi1(k): s(0) { for (; k >= 0; --k) s += (-1)**k/(2 * k + 1); s * 4; // Return value } hp48cc-1.3/examples/pi2.hpc0100644000076500001450000000031407336521165015021 0ustar sandrosandro// pi2.hpc -- Calculate the pi (Algorithm 2) -*- C -*- // k is the number of iterations declare pi2(k) : s(0), x(0) { for (x = -k; x <= k; x += .5) s += EXP(-(x**2)) * .5; s ** 2; // Return value } hp48cc-1.3/examples/README0100644000076500001450000000351507337716351014525 0ustar sandrosandroCertain HP48 symbols are not available in ASCII and are encoded into a sequence of ASCII characters. In hp48cc strings, you should use the ASCII translation (duplicating existing backslashes), while in identifier, where you cannot use symbols like <, > or -, you should use the translation found in the latest column. Example1: The HP48 OBJ-> built-in function should be called as OBJ\-\>(parameter) while the string "->" (where -> is the right arrow symbol) should be written as "this is the right arrow symbol: \\->" Example2: The HP48 square root built-in function should be called as \\v\/(parameter) while in strings the square root symbol can be written as in "this is the square root symbol: \\v/" Note: If you want to insert a double quote character `"' into a string, you might use the following trick: s = "double quote symbol: " + CHR(34); Code HP48 symbol ASCII trans identifier trans 128 angle \<) \\\<\) 129 median \x- \\x\- 130 \.V \\\.V 131 square root \v/ \\v\/ 132 integral \.S \\\.S 133 sum \GS \\GS 134 \|> \\\|\> 135 pi \pi \\pi 136 delta \.d \\\.d 137 less or equal to \<= \\\<\= 138 greaten or equal to \>= \\\>\= 139 not equal to \=/ \\\=\/ 140 alpha \Ga \\Ga 141 right arrow -> \-> \\\-\> 142 left arrow <- \<- \\\<\- 143 down arrow \|v \\\|v 144 up arrow \|^ \\\|\^ 145 gamma \Gg \\Gg 146 delta \Gd \\Gd 147 epsilon \Ge \\Ge 148 eta \Gn \\Gn 149 phi \Gh \\Gh 150 lambda \Gl \\Gl 151 rho \Gr \\Gr 152 sigma \Gs \\Gs 153 tau \Gt \\Gt 154 omega \Gw \\Gw 155 upper case delta \GD \\GD 156 upper case pi \PI \\PI 157 upper case omega \GW \\GW 158 \[] \\\[\] 159 infinity \oo \\oo 171 << \<< \\\<\< 176 degrees symbol ° \^o \\\^o 181 mu \Gm \\Gm 187 >> \>> \\\>\> 215 x \.x \\\.x 216 \O/ \\O\/ 223 beta \Gb \\Gb 247 div \:- \\\:\- hp48cc-1.3/examples/sort.hpc0100644000076500001450000000131607336521226015317 0ustar sandrosandro// sort.hpc -- Sorting algorithms -*- C -*- // Operates on lists only; for example, try: // ssort(@{3, 9, 1, 5, 8, 2}); // Simple sort declare ssort(l) : n(0), x(1), y(0), kx(0), ky(0) { n = SIZE(l); for (x = 1; x < n; ++x) for (y = x + 1; y <= n; ++y) { kx = GET(l, x); ky = GET(l, y); if (ky < kx) // Swap values l = PUT(PUT(l, x, ky), y, kx); } l; // Return value } // Simple sort 2 declare ssort2(l) : n(0), x(1), y(0), m(0), k(0), kx(0), ky(0) { n = SIZE(l); for (x = 1; x < n; ++x) { m = GET(l, x); k = x; for (y = x + 1; y <= n; ++y) { ky = GET(l, y); if (ky < m) { m = ky; k = y; } } kx = GET(l, x); l = PUT(PUT(l, x, m), k, kx); } l; // Return value } hp48cc-1.3/examples/tutorial.hpc0100644000076500001450000000565207337716351016210 0ustar sandrosandro// tutorial.hpc -- Summary of the basic hp48cc syntax -*- C -*- // You can insert the code right there; you will // not need a main() function. // Push the string onto the stack and call the built-in // function MSGBOX. MSGBOX("Hello"); // Declare a new variable and assign a value. foo = 1; // Increment variable value. ++foo; // Declare a new variable. bar = foo + 5; // Call the HP48 built-in function PURGE to remove // the two variables. @{} is the HP48 built-in list. PURGE(@{foo, bar}); // ------------------------------------------------------------------- // Define a new function MYSUM with two paramenters. declare mysum(a, b) { // Create a new variable and assign the sum // of a and b. s = a + b; // Push the value of s into the stack s; // Remove s from HP48 variables. PURGE(@{s}); } // The previous function is exactly equal to the // following, but this is faster. declare mysum2(a, b) { // Push the sum into the stack a + b; } // We defined two functions, now we can call them. a = mysum(1, 2); b = mysum2(4, 5); c = "The value of a is " + a + "."; d = "The value of b is " + b + "."; MSGBOX(c); MSGBOX(d); // Clean up PURGE(@{mysum, mysum2, a, b, c, d}); // ------------------------------------------------------------------- // If you wish, you can specify the variables local to the // function. Local variables have automatically assigned a value and // are automatically removed at function exit. // Local variables are really useful and should be used instead // of hand-defined variables (as in function mysum), because: // * Variables defined by hand and then PURGEd may collide with // external variables; // * If the function causes an error, variables defined by hand // are not removed; // * Local variables always have a value assigned; // * No need to call PURGE; // * Programs using local variables are faster. declare area(h, w): a(0) { a = h * w; // Calculate area a; // Return value } MSGBOX("Area of 23x45: " + area(23, 45)); PURGE(@{area}); // ------------------------------------------------------------------- // Define a new function CKSUM that returns // a sorta of checksum of the argument. declare cksum(s) : k(0) { // Force string type; uses STR-> built-in s = \\\-\>STR(s); while (SIZE(s) > 0) { k += NUM(HEAD(s)); s = TAIL(s); } k; // Return value } MSGBOX("Checksum 1: " + cksum("Hello")); MSGBOX("Checksum 2: " + cksum("Foo")); MSGBOX("Checksum 3: " + cksum(@{a, b, c})); // Clean up PURGE(@{cksum}); // ------------------------------------------------------------------- // Calculate the distance between (x0, y0) and (x1, y1). declare distance(x0, y0, x1, y1) { // \\v\/ is traslated by hp48cc to \v/, than translated // by HP48 into the square root symbol (see README for more info). // x**y means x raised to y. \\v\/((x1 - x0)**2 + (y1 - y0)**2); } MSGBOX("Distance between (2, 3) and (5, 7): " + distance(2, 3, 5, 7)); // Clean up PURGE(@{distance}); hp48cc-1.3/examples/xcos.hpc0100644000076500001450000000023607336521165015306 0ustar sandrosandro// xcos.hpc -- Calculate the cosine -*- C -*- declare xcos(x) : s(0), n(0) { for (; n < 20; ++n) s += (-1)**n * x**(2*n) / (2*n)!; s; // Return value } hp48cc-1.3/examples/xexp.hpc0100644000076500001450000000022307336521165015312 0ustar sandrosandro// xexp.hpc -- Calculate the exponential -*- C -*- declare xexp(x) : s(0), n(0) { for (; n < 20; ++n) s += x**n / (n)!; s; // Return value } hp48cc-1.3/examples/xsin.hpc0100644000076500001450000000025107336521165015310 0ustar sandrosandro// xsin.hpc -- Calculate the sine -*- C -*- declare xsin(x) : s(0), n(0) { for (n = 0; n < 20; ++n) s += (-1)**n * x**(2*n + 1) / (2*n + 1)!; s; // Return value } hp48cc-1.3/hp48cc.lsm0100644000076500001450000000065007337713433013630 0ustar sandrosandroBegin4 Title: hp48cc Version: 1.3 Entered-date: 19AUG01 Description: HP48 C Compiler (C -> RPN) Keywords: hp hp48 C compiler RPN Author: sandro@sigala.it (Sandro Sigala) Maintained-by: sandro@sigala.it (Sandro Sigala) Primary-site: sunsite.unc.edu /pub/Linux/devel/lang/c 32k hp48cc-1.3.tar.gz Alternate-site: http://www.sigala.it/sandro/files/ 32k hp48cc-1.3.tar.gz Platforms: ANSI C compiler Copying-policy: GPL End hp48cc-1.3/INSTALL0100644000076500001450000001723006367460555013063 0ustar sandrosandroBasic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. hp48cc-1.3/install.sh0100755000076500001450000000421206363407430014020 0ustar sandrosandro#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5; it is not part of GNU. # # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ # # This script is compatible with the BSD install script, but was written # from scratch. # # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" instcmd="$mvprog" chmodcmd="" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; *) if [ x"$src" = x ] then src=$1 else dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` fi # Make a temp file name in the proper directory. dstdir=`dirname $dst` dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp # and set any options; do chmod last to preserve setuid bits if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi # Now rename the file to the real destination. $doit $rmcmd $dst $doit $mvcmd $dsttmp $dst exit 0 hp48cc-1.3/lib/0040755000076500001450000000000007337716663012602 5ustar sandrosandrohp48cc-1.3/lib/err.c0100644000076500001450000000547207335001720013516 0ustar sandrosandro/* $Id: err.c,v 1.3 2001/08/10 15:54:56 sandro Exp $ */ /* * Copyright (c) 1997-2001 Sandro Sigala. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * 4.4BSD err(), warn() functions reimplementation. */ #include #include #include #include #include #include "err.h" /* The name of the running program. */ extern char *progname; void err(int status, const char *fmt, ...) { va_list ap; va_start(ap, fmt); verr(status, fmt, ap); va_end(ap); } void verr(int status, const char *fmt, va_list ap) { int olderrno = errno; fprintf(stderr, "%s: ", progname); if (fmt != NULL) { vfprintf(stderr, fmt, ap); fprintf(stderr, ": "); } fprintf(stderr, "%s\n", strerror(olderrno)); exit(status); } void errx(int status, const char *fmt, ...) { va_list ap; va_start(ap, fmt); verrx(status, fmt, ap); va_end(ap); } void verrx(int status, const char *fmt, va_list ap) { fprintf(stderr, "%s: ", progname); if (fmt != NULL) vfprintf(stderr, fmt, ap); fputc('\n', stderr); exit(status); } void warn(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vwarn(fmt, ap); va_end(ap); } void vwarn(const char *fmt, va_list ap) { int olderrno = errno; fprintf(stderr, "%s: ", progname); if (fmt != NULL) { vfprintf(stderr, fmt, ap); fprintf(stderr, ": "); } fprintf(stderr, "%s\n", strerror(olderrno)); } void warnx(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vwarnx(fmt, ap); va_end(ap); } void vwarnx(const char *fmt, va_list ap) { fprintf(stderr, "%s: ", progname); if (fmt != NULL) vfprintf(stderr, fmt, ap); fputc('\n', stderr); } hp48cc-1.3/lib/err.h0100644000076500001450000000347207335001720013521 0ustar sandrosandro/* $Id: err.h,v 1.3 2001/08/10 15:54:56 sandro Exp $ */ /* * Copyright (c) 1997-2001 Sandro Sigala. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef ERR_H #define ERR_H #include extern void err(int status, const char *fmt, ...); extern void verr(int status, const char *fmt, va_list ap); extern void errx(int status, const char *fmt, ...); extern void verrx(int status, const char *fmt, va_list ap); extern void warn(const char *fmt, ...); extern void vwarn(const char *fmt, va_list ap); extern void warnx(const char *fmt, ...); extern void vwarnx(const char *fmt, va_list ap); #endif /* !ERR_H */ hp48cc-1.3/lib/Makefile.in0100644000076500001450000000105307334776757014652 0ustar sandrosandro# $Id: Makefile.in,v 1.2 2001/08/10 15:29:51 sandro Exp $ srcdir = @srcdir@ VPATH = $(srcdir) CC = @CC@ CFLAGS = -I.. @CFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ RANLIB = @RANLIB@ LIB = libhp48cc.a OBJS = @LIBOBJS@ .c.o: $(CC) -c -I. -I$(srcdir) -I$(srcdir)/.. $(CFLAGS) $< all: $(LIB) $(LIB): $(OBJS) rm -f $(LIB) ar rc $(LIB) $(OBJS) $(RANLIB) $(LIB) .PHONY: install uninstall clean realclean distclean mostlyclean install: uninstall: clean: -rm -f $(LIB) *.o distclean: clean -rm -f Makefile realclean: distclean mostlyclean: clean hp48cc-1.3/lib/xmalloc.c0100644000076500001450000000041207334771714014372 0ustar sandrosandro#include "config.h" #include #include #include /* * Return an allocated memory area. */ void *xmalloc(size_t size) { void *ptr; assert(size > 0); if ((ptr = malloc(size)) == NULL) err(1, NULL); return ptr; } hp48cc-1.3/lib/xrealloc.c0100644000076500001450000000047607334771714014556 0ustar sandrosandro#include "config.h" #include #include #include /* * Resize an allocated memory area. */ void *xrealloc(void *ptr, size_t size) { void *newptr; assert(ptr != NULL); assert(size > 0); if ((newptr = realloc(ptr, size)) == NULL) err(1, NULL); return newptr; } hp48cc-1.3/lib/xstrdup.c0100644000076500001450000000022707334771714014450 0ustar sandrosandro#include "config.h" #include /* * Duplicate a string. */ char *xstrdup(const char *s) { return strcpy(xmalloc(strlen(s) + 1), s); } hp48cc-1.3/Makefile.in0100644000076500001450000000051707334776757014110 0ustar sandrosandro# $Id: Makefile.in,v 1.2 2001/08/10 15:29:51 sandro Exp $ subdirs = lib src all install uninstall clean realclean mostlyclean: @for f in $(subdirs); do \ (cd $$f && $(MAKE) $@) \ done distclean: @for f in $(subdirs); do \ (cd $$f && $(MAKE) $@) \ done -rm -f Makefile -rm -f config.h config.cache config.status config.log hp48cc-1.3/mkinsdir.sh0100755000076500001450000000113606363407430014174 0ustar sandrosandro#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d in ${1+"$@"} ; do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 mkdir "$pathcomp" || errstatus=$? fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here hp48cc-1.3/NEWS0100644000076500001450000000067307337713433012526 0ustar sandrosandroChanges between hp48cc 1.2 - hp48cc 1.3 * Added more examples. * Minor bug fixes. Changes between hp48cc 1.1 - hp48cc 1.2 * Added a lot of examples. * Added local variables to language. * Added support for non-alphanumeric HP48 symbols in strings and identifiers. * Minor fixes to the language syntax. * Added raise to power operator `**'. Changes between hp48cc 1.0 - hp48cc 1.1 * Fixes to documentation and package. * Fixed minor bugs. hp48cc-1.3/README0100644000076500001450000000146007337575123012704 0ustar sandrosandroThis package is written in ANSI C and was tested only under SuSE Linux 7.2, but should compile with little or no change under any other UNIX OS. `hp48cc' is a C-like compiler that translates input code into the HP48 RPN language. The language recognized by the compiler is only a small subset of the C language with some non-standard extensions. However, the language is powerful enough to write complex programs simply. Please take a look at the examples contained into the `examples' directory for learning the syntax of this compiler. ------------------------------------------------------------------------------ Latest version can be found at my homepage: http://www.sigala.it/sandro/ Any questions, comments, or bug reports should be sent to the author at the Internet email address . hp48cc-1.3/src/0040755000076500001450000000000007337716663012623 5ustar sandrosandrohp48cc-1.3/src/hp48cc.10100644000076500001450000000133707336521165013765 0ustar sandrosandro.\" $Id: hp48cc.1,v 1.5 2001/08/15 16:25:25 sandro Exp $ .Dd August 15, 2001 .Os .Dt HP48CC 1 .Sh NAME .Nm hp48cc .Nd C to HP48 RPN compiler .Sh SYNOPSIS .Nm hp48cc .Op Fl V .Op Fl o Ar file .Op Ar .Sh DESCRIPTION .Nm Hp48cc is a C-like compiler that translates input code into the HP48 RPN language. The language recognized by the compiler is only a small subset of the C language with some non-standard extensions. However, the language is powerful enough to write complex programs simply. .Pp The options are as follows: .Bl -tag -width indent .It Fl o Set the output destination to .Ar file . .It Fl V Print version information on standard output then exit. .El .Sh SEE ALSO .Xr cc 1 .Sh AUTHORS Sandro Sigala hp48cc-1.3/src/hp48cc.c0100644000076500001450000000241507337575123014051 0ustar sandrosandro/* $Id: hp48cc.c,v 1.6 2001/08/18 23:29:23 sandro Exp $ */ #include #include #include #include #include #include "config.h" extern int lineno; extern FILE *yyin; extern int yyparse(void); FILE *output_file; static void process_file(char *filename) { if (filename != NULL && strcmp(filename, "-") != 0) { if ((yyin = fopen(filename, "r")) == NULL) err(1, "%s", filename); } else yyin = stdin; lineno = 1; yyparse(); if (yyin != stdin) fclose(yyin); } /* * Output the program syntax then exit. */ static void usage(void) { fprintf(stderr, "usage: hp48cc [-V] [-o file] [file ...]\n"); exit(1); } /* * Used by the err() functions. */ char *progname; int main(int argc, char **argv) { int c; progname = argv[0]; output_file = stdout; while ((c = getopt(argc, argv, "o:V")) != -1) switch (c) { case 'o': if (output_file != stdout) fclose(output_file); if ((output_file = fopen(optarg, "w")) == NULL) err(1, "%s", optarg); break; case 'V': fprintf(stderr, "%s\n", HP48CC_VERSION); exit(0); case '?': default: usage(); /* NOTREACHED */ } argc -= optind; argv += optind; if (argc < 1) process_file(NULL); else while (*argv) process_file(*argv++); return 0; } hp48cc-1.3/src/lexer.l0100644000076500001450000000435307337575123014113 0ustar sandrosandro/* $Id: lexer.l,v 1.7 2001/08/18 23:29:23 sandro Exp $ */ Digit [0-9] Literal (\\.)|[a-zA-Z\$\.] Exp [Ee][+-]?{Digit}+ %{ #include #include #include #include #include #include "parser.h" static void comment(void); static void skip_until_eol(void); static int yywrap(void) { return 1; } int lineno; %} %% "/*" { comment(); } "//" { skip_until_eol(); } "#" { skip_until_eol(); } "assign" { return ASSIGN; } "case" { return CASE; } "declare" { return DECLARE; } "default" { return DEFAULT; } "do" { return DO; } "else" { return ELSE; } "for" { return FOR; } "if" { return IF; } "switch" { return SWITCH; } "while" { return WHILE; } {Literal}({Literal}|{Digit})* { return IDENTIFIER; } {Digit}+ { return CONSTANT; } {Digit}*\.{Digit}+({Exp})? { return CONSTANT; } {Digit}+\.?{Digit}*({Exp})? { return CONSTANT; } \'[^']*\' { return CONST_QUOTED; } \`[^`]*\` { return CONST_RPN; } \"((\\.)|[^"])*\" { return CONST_STRING; } "@<<"(.)*">>" { return CONST_RPN_PROG; } "@[" { return HP_OBRACKET; } "@]" { return HP_CBRACKET; } "@{" { return HP_OBRACE; } "@}" { return HP_CBRACE; } "@(" { return HP_OPAREN; } "@)" { return HP_CPAREN; } ">>=" { return SR_ASSIGN; } "<<=" { return SL_ASSIGN; } "+=" { return SUM_ASSIGN; } "-=" { return SUB_ASSIGN; } "*=" { return MUL_ASSIGN; } "/=" { return DIV_ASSIGN; } "%=" { return MOD_ASSIGN; } "&=" { return AND_ASSIGN; } "^=" { return XOR_ASSIGN; } "|=" { return OR_ASSIGN; } "**" { return POW; } ">>" { return SR; } "<<" { return SL; } "++" { return INC; } "--" { return DEC; } "&&" { return LOG_AND; } "||" { return LOG_OR; } "<=" { return LE; } ">=" { return GE; } "==" { return EQ; } "!=" { return NE; } \n { lineno++; } [ \t\v\f] { /* Skip whitespace. */ } . { return yytext[0]; } %% static void comment(void) { int c; while ((c = input()) != EOF) { resync: if (c == '\n') lineno++; else if (c == '*') if ((c = input()) == '/') return; else goto resync; } } static void skip_until_eol(void) { int c; while ((c = input()) != EOF && c != '\n') ; lineno++; } hp48cc-1.3/src/Makefile.in0100644000076500001450000000240407334776757014674 0ustar sandrosandro# $Id: Makefile.in,v 1.4 2001/08/10 15:29:51 sandro Exp $ srcdir = @srcdir@ VPATH = $(srcdir) DESTDIR = prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@/man1 INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL = @INSTALL@ CC = @CC@ CFLAGS = -I.. -I$(srcdir)/../lib @CFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = ../lib/libhp48cc.a @LIBS@ LEX = @LEX@ YACC = @YACC@ PROG = hp48cc OBJS = hp48cc.o parser.o lexer.o .c.o: $(CC) -c -I. -I$(srcdir) -I$(srcdir)/.. $(CFLAGS) $< all: $(PROG) $(PROG): $(OBJS) $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) parser.c parser.h: parser.y $(YACC) -d $(srcdir)/parser.y mv y.tab.c parser.c mv y.tab.h parser.h parser.o lexer.o: parser.h lexer.c: lexer.l $(LEX) $(srcdir)/lexer.l mv lex.yy.c lexer.c .PHONY: install uninstall clean realclean distclean mostlyclean install: $(PROG) $(srcdir)/../mkinsdir.sh $(DESTDIR)$(bindir) $(DESTDIR)$(mandir) $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(bindir) $(INSTALL_DATA) $(srcdir)/$(PROG).1 $(DESTDIR)$(mandir)/$(PROG).1 uninstall: rm -f $(DESTDIR)$(bindir)/$(PROG) rm -f $(DESTDIR)$(mandir)/$(PROG).1 clean: -rm -f $(PROG) *.o -rm -f parser.c parser.h lexer.c distclean: clean -rm -f Makefile realclean: distclean mostlyclean: clean hp48cc-1.3/src/parser.y0100644000076500001450000003210407337575123014300 0ustar sandrosandro/* $Id: parser.y,v 1.9 2001/08/18 23:29:23 sandro Exp $ */ /* * This grammar should generate one shift-reduce conflict. * This is the tipical "dangling ELSE" conflict, and is resolved * correctly with a shift. */ %{ #include #include #include #include #include #include "config.h" extern int lineno; #ifdef YYTEXT_POINTER extern char *yytext; #else extern char yytext[]; #endif extern FILE *output_file; static void yyerror(char *); static int count_arguments(const char *); static void output(char *); static char *declare_function(char *id, char *arg, char *stmt); static char *emit(const char *, ...); static char *cat(char *, ...); #define MAX_LOCAL_VARS 128 static struct { char *name; char *value; } local_vars[MAX_LOCAL_VARS]; int local_vars_num; #define dup(s) xstrdup(s) #define EPSILON dup("") %} %union { char *string; } %token ASSIGN CASE DECLARE DEFAULT DO ELSE FOR IF SWITCH WHILE %token HP_OBRACKET HP_CBRACKET HP_OBRACE HP_CBRACE HP_OPAREN HP_CPAREN %token IDENTIFIER CONSTANT %token CONST_QUOTED CONST_RPN CONST_STRING CONST_RPN_PROG %token SR_ASSIGN SL_ASSIGN SUM_ASSIGN SUB_ASSIGN MUL_ASSIGN DIV_ASSIGN %token MOD_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN POW SR SL INC DEC %token LOG_AND LOG_OR LE GE EQ NE %type expression_opt switch_statement switch_statement_list %type expression statement statement_list statement_list_opt %type argument_expression_list identifier string constant %type primary_expression postfix_expression unary_expression %type power_expression %type multiplicative_expression additive_expression %type shift_expression relational_expression equality_expression %type exclusive_or_expression inclusive_or_expression %type and_expression logical_and_expression logical_or_expression %type conditional_expression assignment_expression %% file: /* epsilon */ { warnx("no output is produced, since no input was provided"); } | statement_list { output($1); } ; statement_list: statement { $$ = $1; } | statement_list statement { $$ = cat($1, $2, NULL); } ; statement_list_opt: /* epsilon */ { $$ = EPSILON; } | statement_list { $$ = $1; } ; local_vars_opt: /* epsilon */ | local_vars ; local_vars: ':' local_vars_list ; local_vars_list: local_vars_list ',' local_var | local_var ; local_var: identifier '(' constant ')' { local_vars[local_vars_num].name = $1; local_vars[local_vars_num].value = $3; ++local_vars_num; } ; declare: DECLARE { local_vars_num = 0; } ; statement: declare identifier '(' argument_expression_list ')' local_vars_opt '{' statement_list_opt '}' { $$ = declare_function($2, $4, $8); } | declare identifier '(' ')' local_vars_opt '{' statement_list_opt '}' { $$ = declare_function($2, NULL, $7); } | IF '(' expression ')' statement { $$ = emit("IF %s\nTHEN %s\nEND\n", $3, $5); } | IF '(' expression ')' statement ELSE statement { $$ = emit("IF %s\nTHEN %s\nELSE %s\nEND\n", $3, $5, $7); } | FOR '(' expression_opt ';' expression ';' expression_opt ')' statement { $$ = emit("%s WHILE %s\nREPEAT %s %s\nEND\n", $3, $5, $9, $7); } | FOR '(' expression_opt ';' ';' expression_opt ')' statement { $$ = emit("%s WHILE 1\nREPEAT %s %s\nEND\n", $3, $8, $6); } | WHILE '(' expression ')' statement { $$ = emit("WHILE %s\nREPEAT %s\nEND\n", $3, $5); } | DO statement WHILE '(' expression ')' ';' { $$ = emit("DO %s UNTIL %s NOT\nEND\n", $2, $5); } | SWITCH '(' expression ')' '{' switch_statement_list '}' { $$ = emit("%s \\-> $\n\\<>", $3, $6); } | expression ';' { $$ = emit("%s\n", $1); } | '{' statement_list_opt '}' { $$ = $2; } | ASSIGN identifier '[' argument_expression_list ']' '=' expression ';' { $$ = emit("%s '%s(%s)' STO\n", $7, $2, $4); } | ASSIGN HP_OBRACE argument_expression_list '}' '=' expression ';' { char buf[16]; sprintf(buf, "%d", count_arguments($3)); $$ = emit("%s %s \\->LIST {%s} 2 \\<> DOLIST\n", $6, dup(buf), $3); } | ';' /* Null statement. */ { $$ = EPSILON; } ; switch_statement_list: switch_statement { $$ = $1; } | switch_statement_list switch_statement { $$ = cat($1, $2, NULL); } ; switch_statement: CASE expression ':' statement { $$ = emit("\n$ %s == THEN\n%s END\n", $2, $4); } | DEFAULT ':' statement { $$ = emit("\n%s", $3); } ; primary_expression: identifier { $$ = $1; } | constant { $$ = $1; } | '(' expression ')' { $$ = $2; } | '(' expression ')' '!' { $$ = emit("%s !", $2); } | HP_OBRACKET argument_expression_list ']' { $$ = emit("[%s]", $2); } | HP_OBRACE argument_expression_list '}' { $$ = emit("{%s}", $2); } | HP_OBRACE '}' { $$ = dup("{}"); } | HP_OPAREN assignment_expression ',' assignment_expression ')' { $$ = emit("(%s,%s)", $2, $4); } ; argument_expression_list: assignment_expression { $$ = $1; } | argument_expression_list ',' assignment_expression { $$ = emit("%s,%s", $1, $3); } ; postfix_expression: primary_expression { $$ = $1; } | postfix_expression '[' expression ']' { $$ = emit("'%s(%s)' EVAL", $1, $3); } | postfix_expression '(' ')' { $$ = emit(" %s", $1); } | postfix_expression '(' argument_expression_list ')' { $$ = emit(" %s %s", $3, $1); } | postfix_expression INC { $$ = emit("'%s' 1 STO+", $1); } | postfix_expression DEC { $$ = emit("'%s' 1 STO-", $1); } ; unary_expression: postfix_expression { $$ = $1; } | INC unary_expression { $$ = emit("'%s' 1 STO+", $2); } | DEC unary_expression { $$ = emit("'%s' 1 STO-", $2); } | '+' unary_expression { $$ = $2; } | '-' unary_expression { $$ = emit("%s NEG", $2); } | '~' unary_expression { $$ = emit("%s NOT", $2); } | '!' unary_expression { $$ = emit("%s NOT", $2); } ; power_expression: unary_expression { $$ = $1; } | power_expression POW unary_expression { $$ = emit("%s %s ^", $1, $3); } ; multiplicative_expression: power_expression { $$ = $1; } | multiplicative_expression '*' power_expression { $$ = emit("%s %s *", $1, $3); } | multiplicative_expression '/' power_expression { $$ = emit("%s %s /", $1, $3); } | multiplicative_expression '%' power_expression { $$ = emit("%s %s MOD", $1, $3); } ; additive_expression: multiplicative_expression { $$ = $1; } | additive_expression '+' multiplicative_expression { $$ = emit("%s %s +", $1, $3); } | additive_expression '-' multiplicative_expression { $$ = emit("%s %s -", $1, $3); } ; shift_expression: additive_expression { $$ = $1; } /* XXX to implement shift | shift_expression SL additive_expression { $$ = emit("%s %s SL", $1, $3); } | shift_expression SR additive_expression { $$ = emit("%s %s SR", $1, $3); } */ ; relational_expression: shift_expression { $$ = $1; } | relational_expression '<' shift_expression { $$ = emit("%s %s <", $1, $3); } | relational_expression '>' shift_expression { $$ = emit("%s %s >", $1, $3); } | relational_expression LE shift_expression { $$ = emit("%s %s \\<=", $1, $3); } | relational_expression GE shift_expression { $$ = emit("%s %s \\>=", $1, $3); } ; equality_expression: relational_expression { $$ = $1; } | equality_expression EQ relational_expression { $$ = emit("%s %s ==", $1, $3); } | equality_expression NE relational_expression { $$ = emit("%s %s \\=/", $1, $3); } ; and_expression: equality_expression { $$ = $1; } | and_expression '&' equality_expression { $$ = emit("%s %s &", $1, $3); } ; exclusive_or_expression: and_expression { $$ = $1; } | exclusive_or_expression '^' and_expression { $$ = emit("%s %s ^", $1, $3); } /* XXX */ ; inclusive_or_expression: exclusive_or_expression { $$ = $1; } | inclusive_or_expression '|' exclusive_or_expression { $$ = emit("%s %s |", $1, $3); } ; logical_and_expression: inclusive_or_expression { $$ = $1; } | logical_and_expression LOG_AND inclusive_or_expression { $$ = emit("%s %s AND", $1, $3); } ; logical_or_expression: logical_and_expression { $$ = $1; } | logical_or_expression LOG_OR logical_and_expression { $$ = emit("%s %s OR", $1, $3); } ; conditional_expression: logical_or_expression { $$ = $1; } | logical_or_expression '?' expression ':' conditional_expression { $$ = emit("IF %s\nTHEN %s\nELSE %s\nEND\n", $1, $3, $5); } ; assignment_expression: conditional_expression { $$ = $1; } | unary_expression '=' assignment_expression { $$ = emit("%s '%s' STO", $3, $1); } | unary_expression SUM_ASSIGN assignment_expression { $$ = emit("%s '%s' STO+", $3, $1); } | unary_expression SUB_ASSIGN assignment_expression { $$ = emit("%s '%s' STO-", $3, $1); } | unary_expression MUL_ASSIGN assignment_expression { $$ = emit("%s '%s' STO*", $3, $1); } | unary_expression DIV_ASSIGN assignment_expression { $$ = emit("%s '%s' STO/", $3, $1); } | unary_expression MOD_ASSIGN assignment_expression { $$ = emit("%s %s MOD '%s' STO", dup($1), $3, $1); } /* XXX to implement shift | unary_expression SL_ASSIGN assignment_expression { $$ = emit("%s %s SL '%s' STO", dup($1), $3, $1); } | unary_expression SR_ASSIGN assignment_expression { $$ = emit("%s %s SR '%s' STO", dup($1), $3, $1); } */ | unary_expression AND_ASSIGN assignment_expression { $$ = emit("%s %s & '%s' STO", dup($1), $3, $1); } | unary_expression XOR_ASSIGN assignment_expression { $$ = emit("%s %s ^ '%s' STO", dup($1), $3, $1); } | unary_expression OR_ASSIGN assignment_expression { $$ = emit("%s %s | '%s' STO", dup($1), $3, $1); } ; expression: assignment_expression { $$ = $1; } | expression ',' assignment_expression { $$ = emit("%s,%s", $1, $3); } ; expression_opt: /* epsilon */ { $$ = EPSILON; } | expression { $$ = $1; } ; identifier: IDENTIFIER { char *p; /* Filter strings like "foo\-\>" to "foo->" */ for (p = yytext; *p != '\0'; ++p) if (*p == '\\') { strcpy(p, p + 1); if (*p == '\0') break; } $$ = dup(yytext); } ; constant: CONSTANT { $$ = dup(yytext); } | CONST_QUOTED { $$ = dup(yytext); } | CONST_RPN { $$ = dup(yytext+1); $$[strlen($$)-1] = '\0'; } | CONST_RPN_PROG { char *p = dup(yytext+3); p[strlen(p)-2] = '\0'; $$ = emit("\\<<%s\\>>", p); } | string { $$ = $1; } ; string: CONST_STRING { char *p; /* Filter escape characters. */ for (p = yytext; *p != '\0'; ++p) if (*p == '\\') { if (*(p + 1) == 'n') { *p = '\n'; strcpy(p + 1, p + 2); } else strcpy(p, p + 1); if (*p == '\0') break; } $$ = dup(yytext); } ; %% static void yyerror(char *s) { errx(1, "%d: %s", lineno, s); } static int count_arguments(const char *s) { int i = 0; for (; *s != '\0'; s++) if (*s == ',') i++; return i+1; } static void output(char *s) { fprintf(output_file, "%%%%HP: T(3)A(R)F(.);\n\\<<\n%s\\>>\n", s); } static char *declare_function(char *id, char *arg, char *stmt) { if (arg != NULL || local_vars_num > 0) { char buf[128], i; strcpy(buf, "\\<< "); for (i = 0; i < local_vars_num; ++i) { if (i > 0) strcat(buf, ","); strcat(buf, local_vars[i].value); free(local_vars[i].value); } strcat(buf, " \\-> "); if (arg != NULL) { strcat(buf, arg); if (local_vars_num > 0) strcat(buf, ","); } for (i = 0; i < local_vars_num; ++i) { if (i > 0) strcat(buf, ","); strcat(buf, local_vars[i].name); free(local_vars[i].name); } strcat(buf, " \\<< %s \\>> \\>> '%s' STO"); return emit(buf, stmt, id); } else return emit("\\<<%s\\>> '%s' STO", stmt, id); } /* * Format the string into an allocated buffer according to the '%' escapes, * and return the buffer. The arguments memory is automatically released. * Two successive newlines are replaced by one only. * * Supported escapes: * Escape Output * %% % * %s (include the next available string argument) */ static char *emit(const char *fmt, ...) { va_list ap; char *buf, *p, *str, *sp; int bufmax; va_start(ap, fmt); bufmax = strlen(fmt); p = buf = (char *)xmalloc(bufmax); while (*fmt != '\0') { if (p - buf + 1 >= bufmax) { int off = p - buf; bufmax += 10; buf = (char *)xrealloc(buf, bufmax); p = buf + off; } if (*fmt == '%') { switch (*++fmt) { case '%': *p++ = '%'; break; case 's': str = sp = va_arg(ap, char *); while (*sp != '\0') { if (p - buf + 1 >= bufmax) { int off = p - buf; bufmax += 10; buf = (char *)xrealloc(buf, bufmax); p = buf + off; } *p++ = *sp; sp++; } free(str); } } else *p++ = *fmt; ++fmt; } *p = '\0'; va_end(ap); return buf; } /* * Catenate the null-terminated strings into a newly allocated string. * The parameter list is terminated by a NULL pointer. * The parameters are deallocated after copy. */ static char *cat(char *s, ...) { va_list ap; int size; char *p, *newstr; size = strlen(s) + 1; va_start(ap, s); while ((p = va_arg(ap, char *)) != NULL) size += strlen(p) + 1; va_end(ap); newstr = (char *)xmalloc(size); va_start(ap, s); strcpy(newstr, s); free(s); while ((p = va_arg(ap, char *)) != NULL) { strcat(newstr, p); free(p); } va_end(ap); return newstr; } hp48cc-1.3/version.h0100644000076500001450000000004407337713433013655 0ustar sandrosandro#define HP48CC_VERSION "hp48cc 1.3"