c_cpp_reference-2.0.2/0000777000076400001440000000000007474405211010366 5c_cpp_reference-2.0.2/admin/0000777000076400001440000000000007474405027011463 5c_cpp_reference-2.0.2/admin/CVS/0000777000076400001440000000000007474405033012113 5c_cpp_reference-2.0.2/admin/CVS/Root0000644000076400001440000000005007474404611012671 :pserver:tasin@lma.ee.fhm.edu:/home/cvs c_cpp_reference-2.0.2/admin/CVS/Repository0000644000076400001440000000002607474404611014130 c_cpp_reference/admin c_cpp_reference-2.0.2/admin/CVS/Entries0000644000076400001440000000170007474405033013361 /ChangeLog/1.1/Mon May 27 10:26:05 2002// /depcomp/1.1/Mon May 27 10:26:05 2002// /install-sh/1.1/Mon May 27 10:26:05 2002// /ltcf-c.sh/1.1/Mon May 27 10:26:05 2002// /ltcf-cxx.sh/1.1/Mon May 27 10:26:05 2002// /ltcf-gcj.sh/1.1/Mon May 27 10:26:05 2002// /ltconfig/1.1/Mon May 27 10:26:05 2002// /ltmain.sh/1.1/Mon May 27 10:26:05 2002// /Makefile.common/1.2/Mon May 27 10:26:05 2002// /acinclude.m4.in/1.2/Mon May 27 10:26:05 2002// /am_edit/1.2/Mon May 27 10:26:52 2002// /am_edit.py/1.2/Mon May 27 10:26:52 2002// /conf.change.pl/1.2/Mon May 27 10:26:05 2002// /config.guess/1.2/Mon May 27 10:26:05 2002// /config.pl/1.2/Mon May 27 10:26:05 2002// /config.sub/1.2/Mon May 27 10:26:05 2002// /configure.in.min/1.2/Mon May 27 10:26:05 2002// /debianrules/1.2/Mon May 27 10:26:05 2002// /libtool.m4.in/1.2/Mon May 27 10:26:05 2002// /missing/1.2/Mon May 27 10:26:05 2002// /mkinstalldirs/1.2/Mon May 27 10:26:52 2002// /ylwrap/1.2/Mon May 27 10:26:05 2002// D c_cpp_reference-2.0.2/admin/depcomp0000644000076400001440000002465607474404675012776 #! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 Free Software Foundation, Inc. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # Originally written by Alexandre Oliva . if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! if "$@" -MT "$object" -MF "$tmpdepfile" -MD -MP; then : else stat=$? rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi if "$@" -Wp,"$gccflag$tmpdepfile"; then : else stat=$? rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). tr ' ' ' ' < "$tmpdepfile" | sed 's/^[^\.]*\.o://' | tr ' ' ' ' >> $depfile tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. tmpdepfile=`echo "$object" | sed 's/\(.*\)\..*$/\1.u/'` if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). tr ' ' ' ' < "$tmpdepfile" | sed 's/^[^\.]*\.o://' | tr ' ' ' ' >> $depfile tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. test -z "$dashmflag" && dashmflag=-M ( IFS=" " case " $* " in *" --mode=compile "*) # this is libtool, let us make it quiet for arg do # cycle over the arguments case "$arg" in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) # X makedepend ( shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift;; -*) ;; *) set fnord "$@" "$arg"; shift;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tail +3 "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 c_cpp_reference-2.0.2/admin/Makefile.common0000644000076400001440000002563507474404675014351 SHELL=/bin/sh cvs: @if grep '$$(top_srcdir)/acinclude.m4:' Makefile.am >/dev/null; then \ echo "*** Creating acinclude.m4" ;\ rm -f acinclude.m4 configure.files ;\ $(MAKE) -f Makefile.am top_srcdir=. acinclude.m4 ;\ fi @echo "!!! If you get recursion errors from autoconf, it is advisable to set the" @echo " environment variable M4 to something including \"--nesting-limit=500\"" @if test -r configure.in.in; then \ rm -f subdirs configure.in ;\ echo "*** Creating list of subdirectories" ;\ $(MAKE) -f Makefile.am top_srcdir=. subdirs ;\ echo "*** Creating configure.in" ;\ $(MAKE) -f Makefile.am top_srcdir=. configure.in ;\ fi @echo "*** Creating aclocal.m4" @aclocal @echo "*** Creating configure" @autoconf @if test -r configure.in.in ; then \ perl -pi -e 'print "if test \"x\$$with_fast_perl\" = \"xyes\" ;\ then\n perl -i.bak \$$ac_aux_dir/conf.change.pl \$$CONFIG_STATUS\ || mv \$$CONFIG_STATUS.bak \$$CONFIG_STATUS;\ \n rm -f \$$CONFIG_STATUS.bak;\nfi\ \n" if /^\s*chmod\s+.*\+x\s+.*CONFIG_STATUS/;' configure ;\ fi @if grep '} \$$ac_kw foo' configure >/dev/null 2>&1; then perl -p -i -e "s/ac_kw foo/ac_kw int foo/" configure; fi #David's hack for autoconf bug when $INSTALL is set @perl -pi -e 'if (/\[\/\$$\]\*. INSTALL=/) { print $$_ ; $$_ = "\"\") ;;\n"; }' configure @if egrep "^AM_CONFIG_HEADER" configure.in >/dev/null 2>&1; then \ echo "*** Creating config.h template" ;\ autoheader ;\ fi @echo "*** Creating Makefile templates" @automake @echo "*** Postprocessing Makefile templates" @perl admin/am_edit @if egrep "^cvs-local:" Makefile.am >/dev/null; then \ $(MAKE) -f Makefile.am cvs-local ;\ fi @echo "*** Creating date/time stamp" @touch stamp-h.in @echo "*** Finished" @echo " Don't forget to run ./configure" @echo " If you haven't done so in a while, run ./configure --help" dist: @if grep -e '$$(top_srcdir)/acinclude.m4:' Makefile.am >/dev/null; then \ $(MAKE) -f Makefile.am top_srcdir=. acinclude.m4 ;\ fi @if test -r configure.in.in; then \ $(MAKE) -f Makefile.am top_srcdir=. subdirs configure.in; \ fi ;\ aclocal; \ autoheader; \ automake --foreign --include-deps; \ perl admin/am_edit; \ autoconf; \ if test -r configure.in.in ; then \ perl -pi -e 'print "if test \"x\$$with_fast_perl\" = \"xyes\" ;\ then\n perl -i.bak \$$ac_aux_dir/conf.change.pl \$$CONFIG_STATUS\ || mv \$$CONFIG_STATUS.bak \$$CONFIG_STATUS;\ \n rm -f \$$CONFIG_STATUS.bak;\nfi\ \n" if /^\s*chmod\s+.*\+x\s+.*CONFIG_STATUS/;' configure ;\ fi ;\ touch stamp-h.in; \ if grep -e "^cvs-local:" Makefile.am >/dev/null; then \ $(MAKE) -f Makefile.am cvs-local ;\ fi ;\ if grep "ac_kw foo" configure >/dev/null 2>&1; then perl -p -i -e "s/ac_kw foo/ac_kw int foo/" configure; fi ;\ if test -d po; then \ LIST=`find ./po -name "*.po"`; \ for i in $$LIST; do \ file2=`echo $$i | sed -e "s#\.po#\.gmo#"`; \ msgfmt -o $$file2 $$i || touch $$file2; \ done ;\ fi @if grep -e "^cvs-dist-local:" Makefile.am >/dev/null; then \ $(MAKE) -f Makefile.am cvs-dist-local ;\ fi cvs-clean: @if test ! -d CVS; then \ echo "You don't have a toplevel CVS directory."; \ echo "You most certainly didn't use cvs to get these sources."; \ echo "But this function depends on cvs's information."; \ exit 1 ;\ fi;\ pwd=`pwd` ;\ dirs=`find . -type d | grep -v CVS | sed -e "s#^./##"` ;\ for i in $$dirs; do \ if test ! -d "$$pwd/$$i/CVS"; then \ echo "D $$i" ;\ rm -rf "$$pwd/$$i"; \ continue; \ fi ;\ cd $$pwd/$$i ;\ for f in * .*; do \ if test ! -d "$$f"; then \ if grep "^/$$f/" CVS/Entries > /dev/null; then \ a="b"; \ else \ echo "F $$i/$$f"; \ rm -f "$$pwd/$$i/$$f"; \ fi; \ fi ; \ done; \ done # The Makefiles have to be sorted for slashes, since configure creates # only one directory per Makefile not the whole hierarchy configure.in: configure.files $(shell test -f configure.files && cat configure.files) subdirs @rm -f configure.in configure.in.new ;\ cat `cat configure.files | egrep -v "^configure.in.bot"` >> configure.in.new ;\ echo "KDE_CREATE_SUBDIRSLIST" >> configure.in.new ;\ echo "AC_OUTPUT( \\" >> configure.in.new ;\ mfs=`find . -type d -print | fgrep -v "/." | sed -e "s#\./##" -e "/^debian/d" | sort`; \ for i in $$mfs; do \ topleveldir=`echo $$i| sed -e "s#/.*##"`; \ if test -f $$topleveldir/configure.in; then \ continue; \ fi ;\ if test ! -f $$i/Makefile.am; then \ continue; \ fi ;\ if test -s inst-apps; then \ if test -z "`grep \"^$$topleveldir\" inst-apps`"; then \ continue; \ fi ;\ fi ;\ echo "$$i/Makefile \\" >> configure.in.new ;\ done ;\ egrep '^dnl AC_OUTPUT\(.*\)' `cat configure.files` | sed -e "s#^.*dnl AC_OUTPUT(\(.*\))#\1 \\\\#" >> configure.in.new ;\ echo ")" >> configure.in.new @modulename= ;\ if test -f configure.in.in; then \ if head -2 configure.in.in | egrep "^#MIN_CONFIG$$" > /dev/null; then \ line=`egrep "^AM_INIT_AUTOMAKE\(" configure.in.in` ;\ if test -n "$$line"; then \ modulename=`echo $$line | sed -e "s#AM_INIT_AUTOMAKE(\([^,]*\),.*#\1#"` ;\ VERSION=`echo $$line | sed -e "s#AM_INIT_AUTOMAKE([^,]*, *\([^)]*\)).*#\1#"` ;\ fi ;\ sed -e "s#AM_INIT_AUTOMAKE([^@].*#dnl PACKAGE set before#" configure.in.new > configure.in \ && mv configure.in configure.in.new ;\ fi ;\ fi ;\ if test -z "$$modulename" || test "$$modulename" = "@MODULENAME@"; then \ modulename=`pwd`; modulename=`basename $$modulename`; \ fi ;\ if test -z "$$VERSION" || test "$$VERSION" = "@VERSION@"; then \ VERSION="\"2.2.2\""; \ fi ;\ sed -e "s#@MODULENAME@#$$modulename#" configure.in.new | \ sed -e "s#@VERSION@#$$VERSION#" > configure.in @if test -f configure.in.bot ; then cat configure.in.bot >> configure.in ; fi @rm -f configure.in.new configure.files: subdirs @admindir=NO ;\ for i in . .. ../.. ../../..; do \ if test -x $$i/admin; then admindir=$$i/admin; break; fi; \ done ;\ rm -rf configure.files ;\ if test -f configure.in.in && head -2 configure.in.in | egrep "^#MIN_CONFIG$$" > /dev/null; then \ echo $$admindir/configure.in.min >> configure.files ;\ fi @test -f configure.in.in && echo configure.in.in >> configure.files @list=`find . -name "configure.in.in" | sort`; \ for i in $$list; do if test -f $$i && test ! `dirname $$i` = "." ; then \ echo $$i >> configure.files ;\ fi; done @if test -f configure.in.mid ; then echo configure.in.mid >> configure.files ; fi @if test -f configure.in.bot ; then echo configure.in.bot >> configure.files ; fi subdirs: @files=`ls -1 | sort`; \ dirs= ;\ lib_dirs= ;\ first_dirs= ;\ last_dirs= ;\ compilefirst=`grep '^COMPILE_FIRST[ ]*=' Makefile.am | \ sed -e 's#^COMPILE_FIRST[ ]*=[ ]*#|#' | sed -e 's#$$#|#' | sed -e 's# #|#g'`;\ compilelast=`grep '^COMPILE_LAST[ ]*=' Makefile.am | \ sed -e 's#^COMPILE_LAST[ ]*=[ ]*#|#' | sed -e 's#$$#|#' | sed -e 's# #|#g'`;\ for i in $$files; do if test -d $$i; then \ if test -f $$i/Makefile.am; then \ if echo $$compilefirst | grep "|$$i|" >/dev/null; then \ first_dirs="$$first_dirs $$i" ;\ elif echo $$compilelast | grep "|$$i|" >/dev/null; then \ last_dirs="$$last_dirs $$i" ; \ else dirs="$$dirs $$i" ;\ fi ;\ fi ;\ fi; \ done ;\ rm -f SUBDIRS ;\ for i in $$dirs; do \ echo $$i >> ./SUBDIRS; \ done @if test -r subdirs && diff subdirs SUBDIRS > /dev/null; then \ rm -f SUBDIRS; \ fi @test -r SUBDIRS && mv SUBDIRS subdirs || true package-merge: @catalogs='$(POFILES)'; \ for cat in $$catalogs; do \ echo $$cat $$name; \ msgmerge -o $$cat.new $$cat $(PACKAGE).pot ; \ if test -s $$cat.new; then \ grep -v "\"POT-Creation" $$cat.new > $$cat.new.2 ; \ grep -v "\"POT-Creation" $$cat >> $$cat.new.1; \ if diff $$cat.new.1 $$cat.new.2; then \ rm $$cat.new; \ else \ mv $$cat.new $$cat ; \ fi; \ rm -f $$cat.new.1 $$cat.new.2 ;\ fi ;\ done package-messages: @rm -rf po.backup ;\ mkdir po.backup ;\ for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do \ egrep -v '^#([^:]|$)' po/$$i | egrep '^.*[^ ]+.*$$' | grep -v "\"POT-Creation" > po.backup/$$i ; \ cp po/$$i po.backup/backup_$$i ; \ touch -r po/$$i po.backup/backup_$$i ;\ rm po/$$i ;\ done @podir=$${podir:-$$PWD/po} ;\ files=`find . -name Makefile.am | xargs egrep -l '^messages:' `; \ dirs=`for i in $$files; do echo \`dirname $$i\`; done`; \ tmpname="$$PWD/messages.log" ;\ if test -z "$$EXTRACTRC"; then EXTRACTRC=extractrc ; fi ;\ if test -z "$$PREPARETIPS"; then PREPARETIPS=preparetips ; fi ;\ export EXTRACTRC PREPARETIPS ;\ for subdir in $$dirs; do \ test -z "$$VERBOSE" || echo "Making messages in $$subdir"; \ (cd $$subdir ;\ if test -n "`grep -e '^messages:.*rc.cpp' Makefile.am`"; then \ $$EXTRACTRC *.rc *.ui > rc.cpp ;\ else \ candidates=`ls -1 *.rc *.ui 2>/dev/null` ;\ if test -n "$$candidates"; then \ echo "$$subdir has *.rc or *.ui files, but not correct messages line" ;\ fi ;\ fi ;\ if test -n "`grep -r KAboutData *.c* *.C* 2>/dev/null`"; then \ echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > _translatorinfo.cpp ;\ else echo " " > _translatorinfo.cpp ;\ fi; \ perl -e '$$mes=0; while () { if (/^messages:/) { $$mes=1; print $$_; next; } if ($$mes) { if (/$$\\(XGETTEXT\)/ && / -o/) { s/ -o \$$\(podir\)/ _translatorinfo.cpp -o \$$\(podir\)/ } print $$_; } else { print $$_; } }' < Makefile.am > _transMakefile ;\ $(MAKE) -s -f _transMakefile podir=$$podir EXTRACTRC="$$EXTRACTRC" PREPARETIPS="$$PREPARETIPS" \ XGETTEXT="$${XGETTEXT:-xgettext} -C -ki18n \ -kI18N_NOOP -ktranslate -kaliasLocale \ -x $${includedir:-$$KDEDIR/include}/kde.pot" \ messages ) >$$tmpname 2>&1 ;\ test -s $$tmpname && (echo $$subdir ; cat $$tmpname) ;\ test ! -f $$subdir/rc.cpp || rm -f $$subdir/rc.cpp ;\ rm -f $$subdir/_translatorinfo.cpp ;\ rm -f $$subdir/_transMakefile ;\ done rm -f $$tmpname @for i in `ls -1 po.backup/*.pot 2>/dev/null | sed -e "s#po.backup/##" | egrep -v '^backup_'`; do \ if test ! -f po/$$i; then echo "disappeared: $$i"; fi ;\ done @for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do \ egrep -v '^#([^:]|$)' po/$$i | egrep '^.*[^ ]+.*$$' | grep -v "\"POT-Creation" > temp.pot ;\ if test -f po.backup/$$i && test -n "`diff temp.pot po.backup/$$i`"; then \ echo "will update $$i"; \ msgmerge -q po.backup/backup_$$i po/$$i > temp.pot ;\ mv temp.pot po/$$i; \ else \ if test -f po.backup/backup_$$i; then \ test -z "$$VERBOSE" || echo "I'm restoring $$i" ;\ mv po.backup/backup_$$i po/$$i; \ rm po.backup/$$i; \ else \ echo "will add $$i" ;\ fi ;\ fi ;\ done @rm -f temp.pot @rm -rf po.backup test: perl -e '$$mes=0; while () { if (/^messages:/) { $$mes=1; print $$_; next; } if ($$mes) { if (! /^\t/) { exit(0); } if (/$$\\(XGETTEXT\)/ && / -o/) { s/ -o/ _translatorinfo.cpp -o/ } print $$_; } }' < Makefile.am .SILENT: c_cpp_reference-2.0.2/admin/ltmain.sh0000644000076400001440000045330507474404675013241 # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun ltconfig. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then echo "$modename: not configured to build any kind of library" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" # Parse our command line options once, thoroughly. while test $# -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) echo "$progname: invalid tag name: $tagname" 1>&2 exit 1 ;; esac if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" else echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" exit 0 ;; --config) sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0" # Now print the configurations for the tags. for tagname in $taglist; do sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" done exit 0 ;; --debug) echo "$progname: enabling shell trace mode" set -x ;; --dry-run | -n) run=: ;; --features) echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit 0 ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --quiet | --silent) show=: ;; --tag) prevopt="--tag" prev=tag ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit 1 ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then case $nonopt in *cc | *++ | gcc* | *-gcc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit 1 fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= prev= lastarg= srcfile="$nonopt" suppress_output= user_target=no for arg do case $prev in "") ;; xcompiler) # Aesthetically quote the previous argument. prev= lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac # Add the previous argument to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi continue ;; esac # Accept any command-line options. case $arg in -o) if test "$user_target" != "no"; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit 1 fi user_target=next ;; -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; -Xcompiler) prev=xcompiler continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi continue ;; esac case $user_target in next) # The next one is the -o target name user_target=yes continue ;; yes) # We got the output file user_target=set libobj="$arg" continue ;; esac # Accept the current argument as the source file. lastarg="$srcfile" srcfile="$arg" # Aesthetically quote the previous argument. # Backslashify any backslashes, double quotes, and dollar signs. # These are the only characters that are still specially # interpreted inside of double-quoted scrings. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $lastarg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac # Add the previous argument to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi done case $user_target in set) ;; no) # Get the name of the library object. libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; *) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit 1 ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSfmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit 1 ;; esac # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. if test -n "$available_tags" && test -z "$tagname"; then case $base_compile in "$CC "*) ;; # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when ltconfig was run. "`$echo $CC` "*) ;; *) for z in $available_tags; do if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then # Evaluate the configuration. eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" case $base_compile in "$CC "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; "`$echo $CC` "*) tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then echo "$modename: unable to infer tagged configuration" echo "$modename: specify a tag with \`--tag'" 1>&2 exit 1 # else # echo "$modename: using $tagname tagged configuration" fi ;; esac fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit 1" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test $# -gt 0; do arg="$1" base_compile="$base_compile $arg" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit 1 fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit 1 fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit 1 else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit 1 fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: not more than one -exported-symbols argument allowed" exit 1 fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 exit 1 fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "$arg" = "-lc"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # These systems don't actually have c library (as such) continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" continue ;; esac elif test "$arg" = "-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have math library (as such) continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody math library is in the System framework deplibs="$deplibs -framework System" continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit 1 fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit 1 else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base link # command doesn't match the default compiler. if test -n "$available_tags" && test -z "$tagname"; then case $base_compile in "$CC "*) ;; # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when ltconfig was run. "`$echo $CC` "*) ;; *) for z in $available_tags; do if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then # Evaluate the configuration. eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" case $base_compile in "$CC "*) # The compiler in $compile_command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; "`$echo $CC` "*) tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then echo "$modename: unable to infer tagged configuration" echo "$modename: specify a tag with \`--tag'" 1>&2 exit 1 # else # echo "$modename: using $tagname tagged configuration" fi ;; esac fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d $output_objdir; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit 1 ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac libs="$libs $deplib" done if test $linkmode = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries uninst_deplibs= # uninstalled libtool libraries uninst_path= # paths that contain uninstalled libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit 1 ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test $linkmode = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test $pass = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -l*) if test $linkmode != lib && test $linkmode != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi if test $pass = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do # Search the libtool library lib="$searchdir/lib${name}.la" if test -f "$lib"; then found=yes break fi done if test "$found" != yes; then if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test $pass = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test $pass = conv; then deplibs="$deplib $deplibs" continue fi if test $pass = scan; then deplibs="$deplib $deplibs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac continue ;; -R*) if test $pass = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test $pass = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) if test "$deplibs_check_method" != pass_all; then echo echo "*** Warning: This library needs some functionality provided by $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." else echo echo "*** Warning: Linking the shared library $output against the" echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test $pass != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac ;; *.lo | *.$objext) if test $pass = conv; then deplibs="$deplib $deplibs" elif test $linkmode = prog; then if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac if test $found = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 exit 1 fi # Check to see that this really is a libtool archive. if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variable installed. installed=yes # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test $linkmode != prog && test $linkmode != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test $pass = conv; then # only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac tmp_libs="$tmp_libs $deplib" done elif test $linkmode != prog && test $linkmode != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit 1 fi continue fi # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi # This library was specified with -dlopen. if test $pass = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit 1 fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later uninst_path="$uninst_path $abs_ladir" fi name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test $pass = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit 1 fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi if test -z "$libdir"; then # link the convenience library if test $linkmode = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test $linkmode = prog && test $pass != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test $linkalldeplibs = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac tmp_libs="$tmp_libs $deplib" done continue fi if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then uninst_deplibs="$uninst_deplibs $lib" need_relink=yes fi # This is a shared library if test $linkmode = lib && test "$hardcode_into_libs" = all; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`echo $soroot | sed -e 's/^.*\///'` newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' eval cmds=\"$extract_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' eval cmds=\"$old_archive_from_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi if test $linkmode = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit 1 fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test $linkmode = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test $linkmode = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" add="-l$name" fi if test $linkmode = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test $linkmode = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo echo "*** Warning: This library needs some functionality provided by $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi if test $linkmode = lib; then if test -n "$dependency_libs" && { test $hardcode_into_libs != yes || test $build_old_libs = yes || test $link_static = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac tmp_libs="$tmp_libs $deplib" done if test $link_all_deplibs != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="-L$absdir/$objdir" else eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="-L$absdir" fi ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi fi done dependency_libs="$newdependency_libs" if test $pass = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test $pass != dlopen; then if test $pass != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Make sure that $var contains only unique libraries # and add them in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do case "$deplib" in -L*) new_libs="$deplib $new_libs" ;; *) case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done fi done if test $linkmode = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit 1 else echo echo "*** Warning: Linking the shared library $output against the non-libtool" echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test $# -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit 1 fi current="$2" revision="$3" age="$4" # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case $revision in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case $age in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac if test $age -gt $current; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix) major=`expr $current - $age + 1` verstring="sgi$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test $loop != 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="sgi$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test $loop != 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= verstring="0.0" if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $uninst_path; do lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test $hardcode_into_libs != yes || test $build_old_libs = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *) # Add libc to deplibs on all other systems if necessary. if test $build_libtool_need_lc = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behaviour. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | sed 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | sed 10q \ | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done if test -n "$a_deplib" ; then droppeddeps=yes echo echo "*** Warning: This library needs some functionality provided by $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | grep . >/dev/null; then echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" echo "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test $allow_undefined = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test $hardcode_into_libs = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test x$dlname = x; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # # Ensure that we have .o objects for linkers which dislike .lo # # (e.g. aix) in case we are running --disable-static # for obj in $libobjs; do # xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` # if test "X$xdir" = "X$obj"; then # xdir="." # else # xdir="$xdir" # fi # baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` # if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then # $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" # $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? # fi # done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "$mkdir $xdir" $run $mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink && test "$hardcode_into_libs" = all; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" else eval cmds=\"$archive_cmds\" fi if len=`expr "X$cmds" : ".*"` && test $len -le $max_cmd_len; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$save_output-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test $len -le $max_cmd_len; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test $k -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$save_output-${k}.$objext k=`expr $k + 1` output=$output_objdir/$save_output-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" # Set up a command to remove the reloadale object files # after they are used. i=0 while test $i -lt $k do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" else eval cmds=\"$archive_cmds\" fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~$rm $delfiles\" fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink && test "$hardcode_into_libs" = all; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? exit 0 fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "$mkdir $xdir" $run $mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" eval cmds=\"$reload_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit 0 fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" eval cmds=\"$reload_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # else # # Just create a symlink. # $show $rm $libobj # $run $rm $libobj # xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` # if test "X$xdir" = "X$libobj"; then # xdir="." # else # xdir="$xdir" # fi # baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` # $show "(cd $xdir && $LN_S $oldobj $baseobj)" # $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 ;; prog) case $host in *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles="$objs$old_deplibs" for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`echo "$arg" | sed -e 's%^.*/%%'` $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = {\ " sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr_t) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit 1 ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi # AIX runtime linking requires linking programs with -Wl,-brtl and libs with -Wl,-G # Also add -bnolibpath to the beginning of the link line, to clear the hardcoded runpath. # Otherwise, things like the -L path to libgcc.a are accidentally hardcoded by ld. # This does not apply on AIX for ia64, which uses a SysV linker. case "$host" in ia64-*-aix5*) ;; *-*-aix4* | *-*-aix5*) compile_command=`$echo "X$compile_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"` finalize_command=`$echo "X$finalize_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"` ;; esac if test $need_relink = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit 0 fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="cd `pwd`; $relink_command" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then case $0 in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`echo $output|sed 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe ;; *) exeext= ;; esac $rm $output trap "$rm $output; exit 1" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: uninst_deplibs='$uninst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if (eval \$relink_command); then : else $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # win32 systems need to use the prog path for dll # lookup to work *-*-cygwin* | *-*-pw32*) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ # Export the path to the program. PATH=\"\$progdir:\$PATH\" export PATH exec \$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit 0 ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$objs$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" # Add in members from convenience archives. for xlib in $addlibs; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "$mkdir $xdir" $run $mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP` done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then eval cmds=\"$old_archive_from_new_cmds\" else # # Ensure that we have .o objects in place in case we decided # # not to build a shared library, and have fallen back to building # # static libs even though --disable-static was passed! # for oldobj in $oldobjs; do # if test ! -f $oldobj; then # xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` # if test "X$xdir" = "X$oldobj"; then # xdir="." # else # xdir="$xdir" # fi # baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` # obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` # $show "(cd $xdir && ${LN_S} $obj $baseobj)" # $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? # fi # done eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test $len -le $max_cmd_len; then : else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test $len -le $max_cmd_len; then : else # the above command should be used before it gets too long oldobjs=$objlist test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist eval cmds=\"\$concat_cmds~$old_archive_cmds\" fi fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test $hardcode_into_libs = all && test "$installed" = no && test $need_relink = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit 0 ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit 1 fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test $# -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit 1 fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test "$hardcode_into_libs" = all && test -n "$relink_command"; then $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 continue fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test "$hardcode_into_libs" = all && test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test $# -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" eval cmds=\"$postinstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit 0 ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then uninst_deplibs= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Check the variables that should have been set. if test -z "$uninst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 exit 1 fi finalize=yes for lib in $uninst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`echo $destfile | sed -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. eval cmds=\"$old_postinstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec $SHELL $0 --finish$current_libdirs exit 1 fi exit 0 ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. eval cmds=\"$finish_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. exit 0 echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do echo " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" echo "more information, such as the ld(1) and ld.so(8) manual pages." echo "----------------------------------------------------------------------" exit 0 ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit 1 fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit 1 fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit 1 fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now actually exec the command. eval "exec \$cmd$args" $echo "$modename: cannot exec \$cmd$args" exit 1 else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit 0 fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit 1 fi rmdirs= for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$objdir" else objdir="$dir/$objdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test $mode = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test $mode = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test $mode = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. eval cmds=\"$postuninstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. eval cmds=\"$old_postuninstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) # Do a test to see if this is a libtool program. if test $mode = clean && (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$file rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit 0 ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit 1 ;; esac $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit 1 fi # test -z "$show_help" # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE." exit 0 ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac echo $echo "Try \`$modename --help' for more information about other modes." exit 0 # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes ### END LIBTOOL TAG CONFIG: disable-shared ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: c_cpp_reference-2.0.2/admin/config.pl0000644000076400001440000001423607474404675013217 #!/usr/bin/perl # a script for use by autoconf to make the Makefiles # from the Makefile.in's # # the original autoconf mechanism first splits all substitutions into groups # of ca. 90, and than invokes sed for _every_ Makefile.in and every group # (so around 2-3 times per Makefile.in). So this takes forever, as sed # has to recompile the regexps every time. # # this script does better. It changes all Makefile.ins in one process. # in kdelibs the time for building Makefile went down from 2:59 min to 13 sec! # # written by Michael Matz # adapted by Dirk Mueller # # the first part was done by looking at the config.status files generated # by configure. # my $ac_subs=$ARGV[0]; my $ac_sacfiles = $ARGV[1]; my $ac_given_srcdir=$ARGV[2]; my $ac_given_INSTALL=$ARGV[3]; #print "ac_subs=$ac_subs\n"; #print "ac_sacfiles=$ac_sacfiles\n"; #print "ac_given_srcdir=$ac_given_srcdir\n"; #print "ac_given_INSTALL=$ac_given_INSTALL\n"; my ($srcdir, $top_srcdir); my $INSTALL; my $bad_perl = ($] < 5.005); open(CF, "< $ac_subs") || die "can't open $ac_subs: $!"; my @subs = ; close(CF); chomp @subs; @comp_match=(); @comp_subs=(); if ($bad_perl) { print "Using perl older than version 5.005\n"; foreach my $pat (@subs) { if ( ($pat =~ /s%([^%]*)%([^%]*)%g/ ) || ($pat =~ m%/([^/]*)/([^/]*)/g% ) || ($pat =~ /s%([^%]*)%([^%]*)%;t/ ) || ($pat =~ m%/([^/]*)/([^/]*)/;t% ) || ($pat =~ /s,([^,]*),(.*),;t/) ) { # form : s%bla%blubb%g # or s%bla%blubb%;t t (autoconf > 2.13 and < 2.52 ?) # or s,bla,blubb,;t t (autoconf 2.52) my $srch = $1; my $repl = $2; $repl =~ s/\\(.)/$1/g; push @comp_subs, make_closure($srch, $repl); } elsif ( ($pat =~ /%([^%]*)%d/ ) || ($pat =~ m%/([^/]*)/d% ) ) { push @comp_subs, make_closure($1, ""); } else { die "Uhh. Malformed pattern in $ac_subs ($pat)" unless ( $pat =~ /^\s*$/ ); # ignore white lines } } } else { foreach my $pat (@subs) { if ( ($pat =~ /s%([^%]*)%([^%]*)%g/ ) || ($pat =~ /s%([^%]*)%([^%]*)%;t/ ) || ($pat =~ /s,([^,]*),(.*),;t/) ) { # form : s%bla%blubb%g # or s%bla%blubb%;t t (autoconf > 2.13 and < 2.52 ?) # or s,bla,blubb,;t t (autoconf 2.52) my $srch = $1; my $repl = $2; push @comp_match, eval "qr/\Q$srch\E/"; # compile match pattern $repl =~ s/\\(.)/$1/g; push @comp_subs, $repl; } elsif ( ($pat =~ /%([^%]*)%d/ ) || ($pat =~ m%/([^/]*)/d% ) ) { push @comp_match, eval "qr/\Q$1\E/"; push @comp_subs, ""; } else { die "Uhh. Malformed pattern in $ac_cs_root.subs ($pat)" unless ( $pat =~ /^\s*$/ ); # ignore white lines } } } undef @subs; # read the list of files to be patched, form: # ./Makefile arts/Makefile arts/examples/Makefile arts/flow/Makefile open(CF, "< $ac_sacfiles") || die "can't open $ac_sacfiles: $!"; my @ac_files = ; close(CF); chomp @ac_files; my $ac_file; foreach $ac_file (@ac_files) { next if $ac_file =~ /\.\./; next if $ac_file =~ /^\s*$/; my $ac_file_in; my ($ac_dir, $ac_dots, $ac_dir_suffix); if ($ac_file =~ /.*:.*/ ) { ($ac_file_in = $ac_file) =~ s%[^:]*:%%; $ac_file =~ s%:.*%%; } else { $ac_file_in = $ac_file.".in"; } # 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 = $ac_file) =~ s%/[^/][^/]*$%%; if ( ($ac_dir ne $ac_file) && ($ac_dir ne ".")) { # The file is in a subdirectory. if (! -d "$ac_dir") { mkdir "$ac_dir", 0777; } ($ac_dir_suffix = $ac_dir) =~ s%^./%%; $ac_dir_suffix="/".$ac_dir_suffix; # A "../" for each directory in $ac_dir_suffix. ($ac_dots = $ac_dir_suffix) =~ s%/[^/]*%../%g; } else { $ac_dir_suffix=""; $ac_dots=""; } if ($ac_given_srcdir eq ".") { $srcdir="."; if ($ac_dots) { ( $top_srcdir = $ac_dots) =~ s%/$%%; } else { $top_srcdir="."; } } elsif ($ac_given_srcdir =~ m%^/%) { $srcdir=$ac_given_srcdir.$ac_dir_suffix; $top_srcdir = $ac_given_srcdir; } else { $srcdir = $ac_dots.$ac_given_srcdir.$ac_dir_suffix; $top_srcdir = $ac_dots.$ac_given_srcdir; } if ($ac_given_INSTALL) { if ($ac_given_INSTALL =~ m%^/% ) { $INSTALL = $ac_given_INSTALL; } else { $INSTALL = $ac_dots.$ac_given_INSTALL; } } print "fast creating $ac_file\n"; unlink $ac_file; my $ac_comsub=""; my $fname=$ac_file_in; $fname =~ s%.*/%%; my $configure_input="Generated automatically from $fname by config.pl."; if ($ac_file =~ /.*[Mm]akefile.*/) { $ac_comsub="# ".$configure_input."\n"; # for the first line in $ac_file } my $ac_file_inputs; ($ac_file_inputs = $ac_file_in) =~ s%^%$ac_given_srcdir/%; $ac_file_inputs =~ s%:% $ac_given_srcdir/%g; patch_file($ac_file, $ac_file_inputs, $ac_comsub); } sub patch_file { my ($outf, $infiles, $firstline) = @_; my $filedata; my @infiles=split(' ', $infiles); my $i=0; if ($firstline) { $filedata = $firstline; } foreach my $name (@infiles) { if (open(CF, "< $name")) { while () { $filedata .= $_; } close(CF); } else { print STDERR "can't open $name: $!"."\n"; } } $filedata =~ s%\@configure_input\@%$configure_input%g; $filedata =~ s%\@srcdir\@%$srcdir%g; $filedata =~ s%\@top_srcdir\@%$top_srcdir%g; $filedata =~ s%\@INSTALL\@%$INSTALL%g; if ($bad_perl) { while ($i <= $#comp_subs) { my $ref = $comp_subs[$i]; &$ref(\$filedata); $i++; } } else { while ($i <= $#comp_match) { $filedata =~ s/$comp_match[$i]/$comp_subs[$i]/g; $i++; } } open(CF, "> $outf") || die "can't create $outf: $!"; print CF $filedata; close(CF); } sub make_closure { my ($pat, $sub) = @_; $pat =~ s/\@/\\@/g; # @bla@ -> \@bla\@ $pat =~ s/\$/\\\$/g; # $bla -> \$bla $sub =~ s/\@/\\@/g; $sub =~ s/\$/\\\$/g; my $ret = eval "return sub { my \$ref=shift; \$\$ref =~ s%$pat%$sub%g; }"; if ($@) { print "can't create CODE: $@\n"; } return $ret; } c_cpp_reference-2.0.2/admin/configure.in.min0000644000076400001440000000356107474404675014507 dnl This file is part of the KDE libraries/packages dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org) dnl This file is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Library General Public dnl License as published by the Free Software Foundation; either dnl version 2 of the License, or (at your option) any later version. dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Library General Public License for more details. dnl You should have received a copy of the GNU Library General Public License dnl along with this library; see the file COPYING.LIB. If not, write to dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, dnl Boston, MA 02111-1307, USA. # Original Author was Kalle@kde.org # I lifted it in some mater. (Stephan Kulow) # I used much code from Janos Farkas dnl Process this file with autoconf to produce a configure script. AC_INIT(acinclude.m4) dnl a source file from your sub dir dnl This is so we can use kde-common AC_CONFIG_AUX_DIR(admin) dnl This ksh/zsh feature conflicts with `cd blah ; pwd` unset CDPATH dnl Checking host/target/build systems, for make, install etc. AC_CANONICAL_SYSTEM dnl Perform program name transformation AC_ARG_PROGRAM dnl Automake doc recommends to do this only here. (Janos) AM_INIT_AUTOMAKE(@MODULENAME@, @VERSION@) dnl searches for some needed programs KDE_SET_PREFIX dnl generate the config header AM_CONFIG_HEADER(config.h) dnl at the distribution this done dnl Checks for programs. AC_CHECK_COMPILERS AC_ENABLE_SHARED(yes) AC_ENABLE_STATIC(no) KDE_PROG_LIBTOOL dnl for NLS support. Call them in this order! dnl WITH_NLS is for the po files AM_KDE_WITH_NLS AC_PATH_KDE c_cpp_reference-2.0.2/admin/config.guess0000644000076400001440000011302007474404675013721 #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-08-21' # This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . # Please send patches to . # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 ; do ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # Netbsd (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # Determine the machine/vendor (is the vendor relevant). case "${UNAME_MACHINE}" in amiga) machine=m68k-unknown ;; arm32) machine=arm-unknown ;; atari*) machine=m68k-atari ;; sun3*) machine=m68k-sun ;; mac68k) machine=m68k-apple ;; macppc) machine=powerpc-apple ;; hp3[0-9][05]) machine=m68k-hp ;; ibmrt|romp-ibm) machine=romp-ibm ;; *) machine=${UNAME_MACHINE}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE}" in i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hkmips:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; sparc*:NetBSD:*) echo `uname -p`-unknown-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) case "${HPUX_REV}" in 11.[0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; esac ;; esac fi ;; esac if [ "${HP_ARCH}" = "" ]; then sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF eval $set_cc_for_build (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; hppa*:OpenBSD:*:*) echo hppa-unknown-openbsd exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in big) echo mips-unknown-linux-gnu && exit 0 ;; little) echo mipsel-unknown-linux-gnu && exit 0 ;; esac ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. ld_supported_targets=`cd /; ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf cat >$dummy.c < #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-pc-linux-gnu\n", argv[1]); # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) if test "${UNAME_MACHINE}" = "x86pc"; then UNAME_MACHINE=pc fi echo `uname -p`-${UNAME_MACHINE}-nto-qnx exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[KW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: c_cpp_reference-2.0.2/admin/acinclude.m4.in0000644000076400001440000033514507474404675014220 ## -*- autoconf -*- dnl This file is part of the KDE libraries/packages dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org) dnl This file is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Library General Public dnl License as published by the Free Software Foundation; either dnl version 2 of the License, or (at your option) any later version. dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Library General Public License for more details. dnl You should have received a copy of the GNU Library General Public License dnl along with this library; see the file COPYING.LIB. If not, write to dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, dnl Boston, MA 02111-1307, USA. dnl IMPORTANT NOTE: dnl Please do not modify this file unless you expect your modifications to be dnl carried into every other module in the repository. If you decide that you dnl really want to modify it, contact coolo@kde.org mentioning that you have dnl and that the modified file should be committed to every module. dnl dnl Single-module modifications are best placed in configure.in for kdelibs dnl and kdebase or configure.in.in if present. dnl ------------------------------------------------------------------------ dnl Forward compatibility macros (make autoconf 2.13 look like 2.50), dnl thanks to Raja R Harinath. dnl ------------------------------------------------------------------------ dnl ifdef([_AC_PATH_X_XMKMF],[], [AC_DEFUN([_AC_PATH_X_XMKMF],[AC_PATH_X_XMKMF])]) ifdef([AC_OUTPUT_SUBDIRS],[], [AC_DEFUN([AC_OUTPUT_SUBDIRS],[subdirs=$1; _AC_OUTPUT_SUBDIRS])]) ifdef([AM_PROG_AS],[], [AC_DEFUN([AM_PROG_AS,[])]) # KDE_PATH_X_DIRECT dnl Internal subroutine of AC_PATH_X. dnl Set ac_x_includes and/or ac_x_libraries. AC_DEFUN(KDE_PATH_X_DIRECT, [if test "$ac_x_includes" = NO; then # Guess where to find include files, by looking for this one X11 .h file. test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h # First, try using that file with no special directory specified. AC_TRY_CPP([#include <$x_direct_test_include>], [# We can compile using X headers with no special include directory. ac_x_includes=], [# Look for the header file in a standard set of common directories. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in \ /usr/X11/include \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/include \ /usr/local/include \ /usr/unsupported/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include \ ; \ do if test -r "$ac_dir/$x_direct_test_include"; then ac_x_includes=$ac_dir break fi done]) fi # $ac_x_includes = NO if test "$ac_x_libraries" = NO; then # Check for the libraries. test -z "$x_direct_test_library" && x_direct_test_library=Xt test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" AC_TRY_LINK(, [${x_direct_test_function}()], [LIBS="$ac_save_LIBS" # We can link X programs with no special library path. ac_x_libraries=], [LIBS="$ac_save_LIBS" # First see if replacing the include by lib works. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ /usr/X11/lib \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ /usr/lib/X11 \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ /usr/local/X11/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ /usr/local/lib/X11 \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ /lib/usr/lib/X11 \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ ; \ do dnl Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done]) fi # $ac_x_libraries = NO ]) dnl ------------------------------------------------------------------------ dnl Find a file (or one of more files in a list of dirs) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_FIND_FILE, [ $3=NO for i in $2; do for j in $1; do echo "configure: __oline__: $i/$j" >&AC_FD_CC if test -r "$i/$j"; then echo "taking that" >&AC_FD_CC $3=$i break 2 fi done done ]) dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, dnl if-not-found, test-parameter) AC_DEFUN(KDE_FIND_PATH, [ AC_MSG_CHECKING([for $1]) if test -n "$$2"; then kde_cv_path="$$2"; else kde_cache=`echo $1 | sed 'y%./+-%__p_%'` AC_CACHE_VAL(kde_cv_path_$kde_cache, [ kde_cv_path="NONE" dirs="$3" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/$1"; then if test -n "$5" then evalstr="$dir/$1 $5 2>&1 " if eval $evalstr; then kde_cv_path="$dir/$1" break fi else kde_cv_path="$dir/$1" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" ]) eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then AC_MSG_RESULT(not found) $4 else AC_MSG_RESULT($kde_cv_path) $2=$kde_cv_path fi ]) AC_DEFUN(KDE_MOC_ERROR_MESSAGE, [ AC_MSG_ERROR([No Qt meta object compiler (moc) found! Please check whether you installed Qt correctly. You need to have a running moc binary. configure tried to run $ac_cv_path_moc and the test didn't succeed. If configure shouldn't have tried this one, set the environment variable MOC to the right one before running configure. ]) ]) AC_DEFUN(KDE_UIC_ERROR_MESSAGE, [ AC_MSG_WARN([No Qt ui compiler (uic) found! Please check whether you installed Qt correctly. You need to have a running uic binary. configure tried to run $ac_cv_path_uic and the test didn't succeed. If configure shouldn't have tried this one, set the environment variable UIC to the right one before running configure. ]) ]) dnl ------------------------------------------------------------------------ dnl Find the meta object compiler and the ui compiler in the PATH, dnl in $QTDIR/bin, and some more usual places dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_PATH_QT_MOC_UIC, [ qt_bindirs="" for dir in $kde_qt_dirs; do qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" done qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" if test ! "$ac_qt_bindir" = "NO"; then qt_bindirs="$ac_qt_bindir $qt_bindirs" fi KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE]) if test -z "$UIC_NOT_NEEDED"; then KDE_FIND_PATH(uic, UIC, [$qt_bindirs], [UIC=""]) if test -z "$UIC" ; then KDE_UIC_ERROR_MESSAGE exit 1 fi else UIC="echo uic not available: " fi AC_SUBST(MOC) AC_SUBST(UIC) UIC_TR="i18n" if test $kde_qtver = 3; then UIC_TR="QT_KDE_I18N" fi AC_SUBST(UIC_TR) ]) AC_DEFUN(KDE_1_CHECK_PATHS, [ KDE_1_CHECK_PATH_HEADERS KDE_TEST_RPATH= if test -n "$USE_RPATH"; then if test -n "$kde_libraries"; then KDE_TEST_RPATH="-R $kde_libraries" fi if test -n "$qt_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" fi if test -n "$x_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" fi KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" fi AC_MSG_CHECKING([for KDE libraries installed]) ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' if AC_TRY_EVAL(ac_link) && test -s conftest; then AC_MSG_RESULT(yes) else AC_MSG_ERROR([your system fails at linking a small KDE application! Check, if your compiler is installed correctly and if you have used the same compiler to compile Qt and kdelibs as you did use now. For more details about this problem, look at the end of config.log.]) fi if eval `KDEDIR= ./conftest 2>&5`; then kde_result=done else kde_result=problems fi KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log kde_have_all_paths=yes KDE_SET_PATHS($kde_result) ]) AC_DEFUN(KDE_SET_PATHS, [ kde_cv_all_paths="kde_have_all_paths=\"yes\" \ kde_htmldir=\"$kde_htmldir\" \ kde_appsdir=\"$kde_appsdir\" \ kde_icondir=\"$kde_icondir\" \ kde_sounddir=\"$kde_sounddir\" \ kde_datadir=\"$kde_datadir\" \ kde_locale=\"$kde_locale\" \ kde_cgidir=\"$kde_cgidir\" \ kde_confdir=\"$kde_confdir\" \ kde_mimedir=\"$kde_mimedir\" \ kde_toolbardir=\"$kde_toolbardir\" \ kde_wallpaperdir=\"$kde_wallpaperdir\" \ kde_templatesdir=\"$kde_templatesdir\" \ kde_bindir=\"$kde_bindir\" \ kde_servicesdir=\"$kde_servicesdir\" \ kde_servicetypesdir=\"$kde_servicetypesdir\" \ kde_moduledir=\"$kde_moduledir\" \ kde_result=$1" ]) AC_DEFUN(KDE_SET_DEFAULT_PATHS, [ if test "$1" = "default"; then if test -z "$kde_htmldir"; then kde_htmldir='\${prefix}/share/doc/HTML' fi if test -z "$kde_appsdir"; then kde_appsdir='\${prefix}/share/applnk' fi if test -z "$kde_icondir"; then kde_icondir='\${prefix}/share/icons' fi if test -z "$kde_sounddir"; then kde_sounddir='\${prefix}/share/sounds' fi if test -z "$kde_datadir"; then kde_datadir='\${prefix}/share/apps' fi if test -z "$kde_locale"; then kde_locale='\${prefix}/share/locale' fi if test -z "$kde_cgidir"; then kde_cgidir='\${exec_prefix}/cgi-bin' fi if test -z "$kde_confdir"; then kde_confdir='\${prefix}/share/config' fi if test -z "$kde_mimedir"; then kde_mimedir='\${prefix}/share/mimelnk' fi if test -z "$kde_toolbardir"; then kde_toolbardir='\${prefix}/share/toolbar' fi if test -z "$kde_wallpaperdir"; then kde_wallpaperdir='\${prefix}/share/wallpapers' fi if test -z "$kde_templatesdir"; then kde_templatesdir='\${prefix}/share/templates' fi if test -z "$kde_bindir"; then kde_bindir='\${exec_prefix}/bin' fi if test -z "$kde_servicesdir"; then kde_servicesdir='\${prefix}/share/services' fi if test -z "$kde_servicetypesdir"; then kde_servicetypesdir='\${prefix}/share/servicetypes' fi if test -z "$kde_moduledir"; then kde_moduledir='\${exec_prefix}/lib/kde2' fi KDE_SET_PATHS(defaults) else if test $kde_qtver = 1; then AC_MSG_RESULT([compiling]) KDE_1_CHECK_PATHS else AC_MSG_ERROR([path checking not yet supported for KDE 2]) fi fi ]) AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS, [ if test -z "$kde_htmldir" || test -z "$kde_appsdir" || test -z "$kde_icondir" || test -z "$kde_sounddir" || test -z "$kde_datadir" || test -z "$kde_locale" || test -z "$kde_cgidir" || test -z "$kde_confdir" || test -z "$kde_mimedir" || test -z "$kde_toolbardir" || test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || test -z "$kde_bindir" || test -z "$kde_servicesdir" || test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || test "$kde_have_all_paths" != "yes"; then kde_have_all_paths=no fi ]) AC_DEFUN(KDE_MISSING_PROG_ERROR, [ AC_MSG_ERROR([The important program $1 was not found! Please check whether you installed KDE correctly. ]) ]) AC_DEFUN(KDE_SUBST_PROGRAMS, [ kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde2/bin /usr/kde/bin /usr/local/kde/bin" if test -n "$KDEDIRS"; then kde_save_IFS=$IFS IFS=: for dir in $KDEDIRS; do kde_default_bindirs="$dir/bin $kde_default_bindirs " done IFS=$kde_save_IFS fi kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs" KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)]) KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)]) KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(mcopidl)]) KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(artsc-config)]) KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs]) KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs]) if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde2/share /opt/kde/share $prefix/share" test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET) if test "$KDE_XSL_STYLESHEET" = "NO"; then KDE_XSL_STYLESHEET="" else KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" fi fi DCOP_DEPENDENCIES='$(DCOPIDL)' AC_SUBST(DCOPIDL) AC_SUBST(DCOPIDL2CPP) AC_SUBST(DCOP_DEPENDENCIES) AC_SUBST(MCOPIDL) AC_SUBST(ARTSCCONFIG) AC_SUBST(KDECONFIG) AC_SUBST(MEINPROC) AC_SUBST(KDE_XSL_STYLESHEET) if test -x "$KDECONFIG"; then # it can be "compiled" kde_libs_prefix=`$KDECONFIG --prefix` if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. This means it has been moved since you installed it. This won't work. Please recompile kdelibs for the new prefix. ]) fi kde_libs_htmldir=`$KDECONFIG --install html --expandvars` else kde_libs_prefix='$(prefix)' kde_libs_htmldir='$(kde_htmldir)' fi AC_SUBST(kde_libs_prefix) AC_SUBST(kde_libs_htmldir) ])dnl AC_DEFUN(AC_CREATE_KFSSTND, [ AC_REQUIRE([AC_CHECK_RPATH]) AC_MSG_CHECKING([for KDE paths]) kde_result="" kde_cached_paths=yes AC_CACHE_VAL(kde_cv_all_paths, [ KDE_SET_DEFAULT_PATHS($1) kde_cached_paths=no ]) eval "$kde_cv_all_paths" KDE_CHECK_PATHS_FOR_COMPLETENESS if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then # wrong values were cached, may be, we can set better ones kde_result= kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= kde_have_all_paths= KDE_SET_DEFAULT_PATHS($1) eval "$kde_cv_all_paths" KDE_CHECK_PATHS_FOR_COMPLETENESS kde_result="$kde_result (cache overridden)" fi if test "$kde_have_all_paths" = "no"; then AC_MSG_ERROR([configure could not run a little KDE program to test the environment. Since it had compiled and linked before, it must be a strange problem on your system. Look at config.log for details. If you are not able to fix this, look at http://www.kde.org/faq/installation.html or any www.kde.org mirror. (If you're using an egcs version on Linux, you may update binutils!) ]) else rm -f conftest* AC_MSG_RESULT($kde_result) fi bindir=$kde_bindir KDE_SUBST_PROGRAMS ]) AC_DEFUN(AC_SUBST_KFSSTND, [ AC_SUBST(kde_htmldir) AC_SUBST(kde_appsdir) AC_SUBST(kde_icondir) AC_SUBST(kde_sounddir) AC_SUBST(kde_datadir) AC_SUBST(kde_locale) AC_SUBST(kde_confdir) AC_SUBST(kde_mimedir) AC_SUBST(kde_wallpaperdir) AC_SUBST(kde_bindir) dnl for KDE 2 AC_SUBST(kde_templatesdir) AC_SUBST(kde_servicesdir) AC_SUBST(kde_servicetypesdir) AC_SUBST(kde_moduledir) if test "$kde_qtver" = 1; then kde_minidir="$kde_icondir/mini" else # for KDE 1 - this breaks KDE2 apps using minidir, but # that's the plan ;-/ kde_minidir="/dev/null" fi dnl AC_SUBST(kde_minidir) dnl AC_SUBST(kde_cgidir) dnl AC_SUBST(kde_toolbardir) ]) AC_DEFUN(KDE_MISC_TESTS, [ AC_LANG_C dnl Checks for libraries. AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD AC_SUBST(LIBUTIL) AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD AC_SUBST(LIBCOMPAT) kde_have_crypt= AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ AC_MSG_WARN([you have no crypt in either libcrypt or libc. You should install libcrypt from another source or configure with PAM support]) kde_have_crypt=no ])) AC_SUBST(LIBCRYPT) if test $kde_have_crypt = yes; then AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) fi AC_CHECK_SOCKLEN_T AC_LANG_C AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) if test $ac_cv_lib_dnet_dnet_ntoa = no; then AC_CHECK_LIB(dnet_stub, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) fi AC_CHECK_FUNC(inet_ntoa) if test $ac_cv_func_inet_ntoa = no; then AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") fi AC_CHECK_FUNC(connect) if test $ac_cv_func_connect = no; then AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , $X_EXTRA_LIBS) fi AC_CHECK_FUNC(remove) if test $ac_cv_func_remove = no; then AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. AC_CHECK_FUNC(shmat, , AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")) # Solaris 2.6 and others need -lresolv for res_init AC_CHECK_FUNCS(res_init, , [ kde_libs_safe="$LIBS" LIBS="$LIBS $X_EXTRA_LIBS -lresolv" AC_TRY_LINK( [ #include ], [ res_init(); ], LIBRESOLV="-lresolv" X_EXTRA_LIBS="$X_EXTRA_LIBS $LIBRESOLV" AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) ) LIBS=$kde_libs_safe ]) LIBSOCKET="$X_EXTRA_LIBS" AC_SUBST(LIBSOCKET) AC_SUBST(LIBRESOLV) AC_SUBST(X_EXTRA_LIBS) AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 AC_SUBST(LIBUCB) case $host in dnl this *is* LynxOS specific *-*-lynxos* ) AC_MSG_CHECKING([LynxOS header file wrappers]) [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] AC_MSG_RESULT(disabled) AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS ;; esac KDE_CHECK_TYPES KDE_CHECK_LIBDL ]) dnl ------------------------------------------------------------------------ dnl Find the header files and libraries for X-Windows. Extended the dnl macro AC_PATH_X dnl ------------------------------------------------------------------------ dnl AC_DEFUN(K_PATH_X, [ AC_REQUIRE([AC_PROG_CPP])dnl AC_REQUIRE([KDE_MISC_TESTS])dnl AC_MSG_CHECKING(for X) AC_LANG_SAVE AC_LANG_C AC_CACHE_VAL(kde_cv_have_x, [# One or both of the vars are not set, and there is no cached value. if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then kde_x_includes=NO else kde_x_includes=$x_includes fi if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then kde_x_libraries=NO else kde_x_libraries=$x_libraries fi # below we use the standard autoconf calls ac_x_libraries=$kde_x_libraries ac_x_includes=$kde_x_includes KDE_PATH_X_DIRECT dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries. dnl Unfortunately, if compiling with the N32 ABI, this is not the correct dnl location. The correct location is /usr/lib32 or an undefined value dnl (the linker is smart enough to pick the correct default library). dnl Things work just fine if you use just AC_PATH_X_DIRECT. dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to dnl /usr/openwin/include, which doesn't work. /usr/include does work, so dnl x_includes should be left alone. case "$host" in mips-sgi-irix6*) ;; *-*-solaris*) ;; *) _AC_PATH_X_XMKMF if test -z "$ac_x_includes"; then ac_x_includes="." fi if test -z "$ac_x_libraries"; then ac_x_libraries="/usr/lib" fi esac #from now on we use our own again # when the user already gave --x-includes, we ignore # what the standard autoconf macros told us. if test "$kde_x_includes" = NO; then kde_x_includes=$ac_x_includes fi # for --x-libraries too if test "$kde_x_libraries" = NO; then kde_x_libraries=$ac_x_libraries fi if test "$kde_x_includes" = NO; then AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) fi if test "$kde_x_libraries" = NO; then AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) fi # Record where we found X for the cache. kde_cv_have_x="have_x=yes \ kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" ])dnl eval "$kde_cv_have_x" if test "$have_x" != yes; then AC_MSG_RESULT($have_x) no_x=yes else AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes]) fi if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then X_INCLUDES="" x_includes="."; dnl better than nothing :- else x_includes=$kde_x_includes X_INCLUDES="-I$x_includes" fi if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then X_LDFLAGS="" x_libraries="/usr/lib"; dnl better than nothing :- else x_libraries=$kde_x_libraries X_LDFLAGS="-L$x_libraries" fi all_includes="$X_INCLUDES" all_libraries="$X_LDFLAGS" AC_SUBST(X_INCLUDES) AC_SUBST(X_LDFLAGS) AC_SUBST(x_libraries) AC_SUBST(x_includes) # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $X_LDFLAGS" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. AC_CHECK_LIB(ICE, IceConnectionNumber, [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS) AC_SUBST(LIBSM) LDFLAGS="$ac_save_LDFLAGS" AC_SUBST(X_PRE_LIBS) LIB_X11='-lX11 $(LIBSOCKET)' AC_SUBST(LIB_X11) AC_MSG_CHECKING(for libXext) AC_CACHE_VAL(kde_cv_have_libXext, [ kde_ldflags_safe="$LDFLAGS" kde_libs_safe="$LIBS" LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" LIBS="-lXext -lX11 $LIBSOCKET" AC_TRY_LINK([ #include #ifdef STDC_HEADERS # include #endif ], [ printf("hello Xext\n"); ], kde_cv_have_libXext=yes, kde_cv_have_libXext=no ) LDFLAGS=$kde_ldflags_safe LIBS=$kde_libs_safe ]) AC_MSG_RESULT($kde_cv_have_libXext) if test "$kde_cv_have_libXext" = "no"; then AC_MSG_ERROR([We need a working libXext to proceed. Since configure can't find it itself, we stop here assuming that make wouldn't find them either.]) fi AC_MSG_CHECKING(for Xinerama) AC_ARG_WITH(xinerama, [ --with-xinerama enable support for Xinerama ], [ no_xinerama=no ], [ no_xinerama=yes ] ) kde_save_LDFLAGS="$LDFLAGS" kde_save_CFLAGS="$CFLAGS" kde_save_LIBS="$LIBS" LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" CFLAGS="$CFLAGS -I$x_includes" LIBS="-lXinerama -lXext" if test "x$no_xinerama" = "xno"; then AC_CACHE_VAL(ac_cv_have_xinerama, [ AC_TRY_LINK([#include #include ], [XineramaIsActive(NULL);], [ac_cv_have_xinerama="yes"], [ac_cv_have_xinerama="no"]) ]) else ac_cv_have_xinerama=no; fi AC_MSG_RESULT($ac_cv_have_xinerama) LIBXINERAMA="" if test "$ac_cv_have_xinerama" = "yes"; then AC_DEFINE(HAVE_XINERAMA, 1, [Define if you want Xinerama support]) LIBXINERAMA="-lXinerama" fi AC_SUBST(LIBXINERAMA) LDFLAGS="$kde_save_LDFLAGS" CFLAGS="$kde_save_CFLAGS" LIBS="$kde_save_LIBS" AC_LANG_RESTORE ]) AC_DEFUN(KDE_PRINT_QT_PROGRAM, [ AC_REQUIRE([KDE_USE_QT]) cat > conftest.$ac_ext < #include EOF if test "$kde_qtver" != "1"; then cat >> conftest.$ac_ext < #include #include EOF if test $kde_qtsubver -gt 0; then cat >> conftest.$ac_ext < EOF fi fi echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext cat >> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <&AC_FD_CC cat conftest.$ac_ext >&AC_FD_CC fi rm -f conftest* CXXFLAGS="$ac_cxxflags_safe" LDFLAGS="$ac_ldflags_safe" LIBS="$ac_libs_safe" LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" export LD_LIBRARY_PATH LIBRARY_PATH="$ac_LIBRARY_PATH" export LIBRARY_PATH AC_LANG_RESTORE ]) if test "$kde_cv_qt_direct" = "yes"; then AC_MSG_RESULT(yes) $1 else AC_MSG_RESULT(no) $2 fi ]) dnl ------------------------------------------------------------------------ dnl Try to find the Qt headers and libraries. dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_PATH_QT_1_3, [ AC_REQUIRE([K_PATH_X]) AC_REQUIRE([KDE_USE_QT]) dnl ------------------------------------------------------------------------ dnl Add configure flag to enable linking to MT version of Qt library. dnl ------------------------------------------------------------------------ AC_ARG_ENABLE( mt, [ --enable-mt link to threaded Qt (experimental)], kde_use_qt_mt=$enableval, kde_use_qt_mt=no ) USING_QT_MT="" dnl ------------------------------------------------------------------------ dnl If we got --enable-qt-mt then adjust some vars for the host. dnl ------------------------------------------------------------------------ if test "x$kde_use_qt_mt" = "xyes"; then case $host in *-*-linux-*) if test "x$GCC" = "xyes"; then CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT -pthread" X_EXTRA_LIBS="$X_EXTRA_LIBS -pthread" else AC_MSG_WARN([Compiler is not gcc. MT support disabled.]) fi ;; *) AC_MSG_WARN([MT not yet supported on $host - disabled.]) ;; esac fi kde_qt_was_given=yes dnl ------------------------------------------------------------------------ dnl If we haven't been told how to link to Qt, we work it out for ourselves. dnl ------------------------------------------------------------------------ if test -z "$LIBQT_GLOB"; then LIBQT_GLOB="libqt.*" fi if test -z "$LIBQT"; then LIBQT="-lqt" kde_int_qt="-lqt" dnl ------------------------------------------------------------------------ dnl If we got --enable-qt-mt then adjust the Qt library name for the host. dnl ------------------------------------------------------------------------ if test "x$kde_use_qt_mt" = "xyes"; then case $host in *-*-linux-*) if test "x$GCC" = "xyes"; then LIBQT="-lqt-mt" kde_int_qt="-lqt-mt" LIBQT_GLOB="libqt-mt.*" USING_QT_MT="using -mt" fi ;; esac fi kde_qt_was_given=no else kde_int_qt="$LIBQT" fi if test $kde_qtver != 1; then AC_REQUIRE([AC_FIND_PNG]) AC_REQUIRE([AC_FIND_JPEG]) LIBQT="$LIBQT $LIBPNG $LIBJPEG" fi AC_MSG_CHECKING([for Qt]) LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO qt_libraries="" qt_includes="" AC_ARG_WITH(qt-dir, [ --with-qt-dir=DIR where the root of Qt is installed ], [ ac_qt_includes="$withval"/include ac_qt_libraries="$withval"/lib ac_qt_bindir="$withval"/bin ]) AC_ARG_WITH(qt-includes, [ --with-qt-includes=DIR where the Qt includes are. ], [ ac_qt_includes="$withval" ]) kde_qt_libs_given=no AC_ARG_WITH(qt-libraries, [ --with-qt-libraries=DIR where the Qt library is installed.], [ ac_qt_libraries="$withval" kde_qt_libs_given=yes ]) AC_CACHE_VAL(ac_cv_have_qt, [#try to guess Qt locations qt_incdirs="" for dir in $kde_qt_dirs; do qt_incdirs="$qt_incdirs $dir/include $dir" done qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 $x_includes" if test ! "$ac_qt_includes" = "NO"; then qt_incdirs="$ac_qt_includes $qt_incdirs" fi if test "$kde_qtver" != "1"; then kde_qt_header=qstyle.h else kde_qt_header=qglobal.h fi AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) ac_qt_includes="$qt_incdir" qt_libdirs="" for dir in $kde_qt_dirs; do qt_libdirs="$qt_libdirs $dir/lib $dir" done qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" if test ! "$ac_qt_libraries" = "NO"; then qt_libdir=$ac_qt_libraries else qt_libdirs="$ac_qt_libraries $qt_libdirs" # if the Qt was given, the chance is too big that libqt.* doesn't exist qt_libdir=NONE for dir in $qt_libdirs; do try="ls -1 $dir/${LIBQT_GLOB}" if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi done fi ac_qt_libraries="$qt_libdir" AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_cxxflags_safe="$CXXFLAGS" ac_ldflags_safe="$LDFLAGS" ac_libs_safe="$LIBS" CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS" LIBS="$LIBS $LIBQT" KDE_PRINT_QT_PROGRAM if AC_TRY_EVAL(ac_link) && test -s conftest; then rm -f conftest* else echo "configure: failed program was:" >&AC_FD_CC cat conftest.$ac_ext >&AC_FD_CC ac_qt_libraries="NO" fi rm -f conftest* CXXFLAGS="$ac_cxxflags_safe" LDFLAGS="$ac_ldflags_safe" LIBS="$ac_libs_safe" AC_LANG_RESTORE if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then ac_cv_have_qt="have_qt=no" ac_qt_notfound="" if test "$ac_qt_includes" = NO; then if test "$ac_qt_libraries" = NO; then ac_qt_notfound="(headers and libraries)"; else ac_qt_notfound="(headers)"; fi else ac_qt_notfound="(libraries)"; fi AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! For more details about this problem, look at the end of config.log.]) else have_qt="yes" fi ]) eval "$ac_cv_have_qt" if test "$have_qt" != yes; then AC_MSG_RESULT([$have_qt]); else ac_cv_have_qt="have_qt=yes \ ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT]) qt_libraries="$ac_qt_libraries" qt_includes="$ac_qt_includes" fi if test ! "$kde_qt_libs_given" = "yes"; then KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) fi AC_SUBST(qt_libraries) AC_SUBST(qt_includes) if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then QT_INCLUDES=""; else QT_INCLUDES="-I$qt_includes" all_includes="$QT_INCLUDES $all_includes" fi if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then QT_LDFLAGS="" else QT_LDFLAGS="-L$qt_libraries" all_libraries="$all_libraries $QT_LDFLAGS" fi AC_SUBST(QT_INCLUDES) AC_SUBST(QT_LDFLAGS) AC_PATH_QT_MOC_UIC LIB_QT="$kde_int_qt "'$(LIBPNG) $(LIBJPEG) -lXext $(LIB_X11) $(LIBSM)' AC_SUBST(LIB_QT) AC_SUBST(kde_qtver) ]) AC_DEFUN(AC_PATH_QT, [ AC_PATH_QT_1_3 ]) AC_DEFUN(KDE_CHECK_FINAL, [ AC_ARG_ENABLE(final, [ --enable-final build size optimized apps (experimental - needs lots of memory)], kde_use_final=$enableval, kde_use_final=no) KDE_COMPILER_REPO if test "x$kde_use_final" = "xyes"; then KDE_USE_FINAL_TRUE="" KDE_USE_FINAL_FALSE="#" else KDE_USE_FINAL_TRUE="#" KDE_USE_FINAL_FALSE="" fi AC_SUBST(KDE_USE_FINAL_TRUE) AC_SUBST(KDE_USE_FINAL_FALSE) AC_ARG_ENABLE(closure, [ --disable-closure don't delay template instantiation], kde_use_closure=$enableval, kde_use_closure=yes) if test "x$kde_use_closure" = "xyes"; then KDE_USE_CLOSURE_TRUE="" KDE_USE_CLOSURE_FALSE="#" # CXXFLAGS="$CXXFLAGS $REPO" else KDE_USE_CLOSURE_TRUE="#" KDE_USE_CLOSURE_FALSE="" fi AC_SUBST(KDE_USE_CLOSURE_TRUE) AC_SUBST(KDE_USE_CLOSURE_FALSE) ]) dnl ------------------------------------------------------------------------ dnl Now, the same with KDE dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) dnl and $(kde_includes) will be the kdehdrlocation (if needed) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_BASE_PATH_KDE, [ AC_PREREQ([2.13]) AC_REQUIRE([AC_PATH_QT])dnl AC_CHECK_RPATH AC_MSG_CHECKING([for KDE]) if test "${prefix}" != NONE; then kde_includes=${prefix}/include ac_kde_includes=$prefix/include if test "${exec_prefix}" != NONE; then kde_libraries=${exec_prefix}/lib ac_kde_libraries=$exec_prefix/lib else kde_libraries=${prefix}/lib ac_kde_libraries=$prefix/lib fi else ac_kde_includes= ac_kde_libraries= kde_libraries="" kde_includes="" fi AC_CACHE_VAL(ac_cv_have_kde, [#try to guess kde locations if test "$kde_qtver" = 1; then kde_check_header="ksock.h" kde_check_lib="libkdecore.la" else kde_check_header="ksharedptr.h" kde_check_lib="libkio.la" fi if test -z "$1"; then kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde2/include /opt/kde/include $x_includes $qt_includes" test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" kde_incdirs="$ac_kde_includes $kde_incdirs" AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) ac_kde_includes="$kde_incdir" if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then AC_MSG_ERROR([ in the prefix, you've chosen, are no KDE headers installed. This will fail. So, check this please and use another prefix!]) fi kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde2/lib /opt/kde/lib /usr/X11R6/kde/lib" test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs" kde_libdirs="$ac_kde_libraries $kde_libdirs" AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) ac_kde_libraries="$kde_libdir" if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then AC_MSG_ERROR([ in the prefix, you've chosen, are no KDE libraries installed. This will fail. So, check this please and use another prefix!]) fi ac_kde_libraries="$kde_libdir" if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then ac_cv_have_kde="have_kde=no" else ac_cv_have_kde="have_kde=yes \ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" fi else dnl test -z $1 ac_cv_have_kde="have_kde=no" fi ])dnl eval "$ac_cv_have_kde" if test "$have_kde" != "yes"; then if test "${prefix}" = NONE; then ac_kde_prefix="$ac_default_prefix" else ac_kde_prefix="$prefix" fi if test "$exec_prefix" = NONE; then ac_kde_exec_prefix="$ac_kde_prefix" AC_MSG_RESULT([will be installed in $ac_kde_prefix]) else ac_kde_exec_prefix="$exec_prefix" AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) fi kde_libraries="${ac_kde_exec_prefix}/lib" kde_includes=${ac_kde_prefix}/include else ac_cv_have_kde="have_kde=yes \ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) kde_libraries="$ac_kde_libraries" kde_includes="$ac_kde_includes" fi AC_SUBST(kde_libraries) AC_SUBST(kde_includes) if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then KDE_INCLUDES="" else KDE_INCLUDES="-I$kde_includes" all_includes="$KDE_INCLUDES $all_includes" fi KDE_LDFLAGS="-L$kde_libraries" if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then all_libraries="$all_libraries $KDE_LDFLAGS" fi AC_SUBST(KDE_LDFLAGS) AC_SUBST(KDE_INCLUDES) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) all_libraries="$all_libraries $USER_LDFLAGS" all_includes="$all_includes $USER_INCLUDES" AC_SUBST(all_includes) AC_SUBST(all_libraries) AC_SUBST(AUTODIRS) ]) AC_DEFUN(KDE_CHECK_EXTRA_LIBS, [ AC_MSG_CHECKING(for extra includes) AC_ARG_WITH(extra-includes, [ --with-extra-includes=DIR adds non standard include paths], kde_use_extra_includes="$withval", kde_use_extra_includes=NONE ) kde_extra_includes= if test -n "$kde_use_extra_includes" && \ test "$kde_use_extra_includes" != "NONE"; then ac_save_ifs=$IFS IFS=':' for dir in $kde_use_extra_includes; do kde_extra_includes="$kde_extra_includes $dir" USER_INCLUDES="$USER_INCLUDES -I$dir" done IFS=$ac_save_ifs kde_use_extra_includes="added" else kde_use_extra_includes="no" fi AC_SUBST(USER_INCLUDES) AC_MSG_RESULT($kde_use_extra_includes) kde_extra_libs= AC_MSG_CHECKING(for extra libs) AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR adds non standard library paths], kde_use_extra_libs=$withval, kde_use_extra_libs=NONE ) if test -n "$kde_use_extra_libs" && \ test "$kde_use_extra_libs" != "NONE"; then ac_save_ifs=$IFS IFS=':' for dir in $kde_use_extra_libs; do kde_extra_libs="$kde_extra_libs $dir" KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" USER_LDFLAGS="$USER_LDFLAGS -L$dir" done IFS=$ac_save_ifs kde_use_extra_libs="added" else kde_use_extra_libs="no" fi AC_SUBST(USER_LDFLAGS) AC_MSG_RESULT($kde_use_extra_libs) ]) AC_DEFUN(KDE_1_CHECK_PATH_HEADERS, [ AC_MSG_CHECKING([for KDE headers installed]) AC_LANG_SAVE AC_LANG_CPLUSPLUS cat > conftest.$ac_ext < #endif #include #include "confdefs.h" #include int main() { printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); printf("kde_wallpaperdir=\\"%s\\"\n", KApplication::kde_wallpaperdir().data()); printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); printf("kde_moduledir=\\"/tmp/dummy\\"\n"); return 0; } EOF ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext' if AC_TRY_EVAL(ac_compile); then AC_MSG_RESULT(yes) else AC_MSG_ERROR([your system is not able to compile a small KDE application! Check, if you installed the KDE header files correctly. For more details about this problem, look at the end of config.log.]) fi AC_LANG_RESTORE ]) AC_DEFUN(KDE_CHECK_KDEQTADDON, [ AC_MSG_CHECKING(for kde-qt-addon) AC_CACHE_VAL(kde_cv_have_kdeqtaddon, [ kde_ldflags_safe="$LDFLAGS" kde_libs_safe="$LIBS" kde_cxxflags_safe="$CXXFLAGS" LIBS="-lkde-qt-addon $LIBQT $LIBS" CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" AC_TRY_LINK([ #include ], [ QDomDocument doc; ], kde_cv_have_kdeqtaddon=yes, kde_cv_have_kdeqtaddon=no ) LDFLAGS=$kde_ldflags_safe LIBS=$kde_libs_safe kde_cxxflags_safe="$CXXFLAGS" ]) AC_MSG_RESULT($kde_cv_have_kdeqtaddon) if test "$kde_cv_have_kdeqtaddon" = "no"; then AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first. It is a separate package (and CVS module) named kde-qt-addon.]) fi ]) AC_DEFUN(KDE_CHECK_KIMGIO, [ AC_REQUIRE([AC_BASE_PATH_KDE]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_REQUIRE([AC_FIND_TIFF]) AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([AC_FIND_PNG]) AC_REQUIRE([KDE_CREATE_LIBS_ALIASES]) if test "$1" = "existance"; then AC_LANG_SAVE AC_LANG_CPLUSPLUS kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm" AC_CHECK_LIB(kimgio, kimgioRegister, [ LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no) LIBS="$kde_save_LIBS" AC_LANG_RESTORE else LIBKIMGIO_EXISTS=yes fi if test "$LIBKIMGIO_EXISTS" = "yes"; then LIB_KIMGIO='-lkimgio' else LIB_KIMGIO='' fi AC_SUBST(LIB_KIMGIO) ]) AC_DEFUN(KDE_CREATE_LIBS_ALIASES, [ AC_REQUIRE([KDE_MISC_TESTS]) AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([K_PATH_X]) if test $kde_qtver != 1; then LIB_KDECORE='-lkdecore' AC_SUBST(LIB_KDECORE) LIB_KDEUI='-lkdeui' AC_SUBST(LIB_KDEUI) LIB_KFORMULA='-lkformula' AC_SUBST(LIB_KFORMULA) LIB_KIO='-lkio' AC_SUBST(LIB_KIO) LIB_KSYCOCA='-lksycoca' AC_SUBST(LIB_KSYCOCA) LIB_SMB='-lsmb' AC_SUBST(LIB_SMB) LIB_KFILE='-lkfile' AC_SUBST(LIB_KFILE) LIB_KAB='-lkab' AC_SUBST(LIB_KAB) LIB_KHTML='-lkhtml' AC_SUBST(LIB_KHTML) LIB_KSPELL='-lkspell' AC_SUBST(LIB_KSPELL) LIB_KPARTS='-lkparts' AC_SUBST(LIB_KPARTS) LIB_KWRITE='-lkwrite' AC_SUBST(LIB_KWRITE) else LIB_KDECORE='-lkdecore -lXext $(LIB_QT)' AC_SUBST(LIB_KDECORE) LIB_KDEUI='-lkdeui $(LIB_KDECORE)' AC_SUBST(LIB_KDEUI) LIB_KFM='-lkfm $(LIB_KDECORE)' AC_SUBST(LIB_KFM) LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)' AC_SUBST(LIB_KFILE) LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)' AC_SUBST(LIB_KAB) fi ]) AC_DEFUN(AC_PATH_KDE, [ AC_BASE_PATH_KDE AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install], [ if test "$enableval" = "no"; then ac_use_path_checking="default" else ac_use_path_checking="" fi ], [ if test "$kde_qtver" = 1; then ac_use_path_checking="" else ac_use_path_checking="default" fi ] ) AC_CREATE_KFSSTND($ac_use_path_checking) AC_SUBST_KFSSTND KDE_CREATE_LIBS_ALIASES ]) dnl obsolete AC_DEFUN(AC_CHECK_SETENV, [ AC_OBSOLETE([$0], [; instead use AC_CHECK_FUNCS([setenv unsetenv])])dnl AC_CHECK_FUNCS([setenv unsetenv]) ]) AC_DEFUN(AC_CHECK_GETDOMAINNAME, [ AC_MSG_CHECKING(for getdomainname) AC_CACHE_VAL(ac_cv_func_getdomainname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS save_CXXFLAGS="$CXXFLAGS" kde_safe_LIBS="$LIBS" LIBS="$LIBS $X_EXTRA_LIBS" if test "$GCC" = "yes"; then CXXFLAGS="$CXXFLAGS -pedantic-errors" fi AC_TRY_COMPILE([ #include #include ], [ char buffer[200]; getdomainname(buffer, 200); ], ac_cv_func_getdomainname=yes, ac_cv_func_getdomainname=no) CXXFLAGS="$save_CXXFLAGS" LIBS=$kde_safe_LIBS AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_getdomainname) AC_MSG_CHECKING([if getdomainname needs custom prototype]) AC_CACHE_VAL(ac_cv_proto_getdomainname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then ac_cv_proto_getdomainname=no else kde_safe_libs=$LIBS LIBS="$LIBS $X_EXTRA_LIBS" AC_TRY_LINK([ #include #include extern "C" int getdomainname (char *, int); ], [ char buffer[200]; getdomainname(buffer, 200); ], ac_cv_func_getdomainname=yes ac_cv_proto_getdomainname=yes, AC_MSG_RESULT([fatal error]) AC_MSG_ERROR([getdomainname unavailable])) fi LIBS=$kde_safe_libs AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_proto_getdomainname) if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname]) fi if eval "test \"`echo $ac_cv_proto_getdomainname`\" = no"; then AC_DEFINE(HAVE_GETDOMAINNAME_PROTO, 1, [Define if you have getdomainname prototype]) fi ]) AC_DEFUN(AC_CHECK_GETHOSTNAME, [ AC_MSG_CHECKING([for gethostname]) AC_CACHE_VAL(ac_cv_func_gethostname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS save_CXXFLAGS="$CXXFLAGS" if test "$GCC" = "yes"; then CXXFLAGS="$CXXFLAGS -pedantic-errors" fi AC_TRY_LINK([ #include #include ], [ char buffer[200]; gethostname(buffer, 200); ], ac_cv_func_gethostname=yes, ac_cv_func_gethostname=no) CXXFLAGS="$save_CXXFLAGS" AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_gethostname) AC_MSG_CHECKING([if gethostname needs custom prototype]) AC_CACHE_VAL(ac_cv_proto_gethostname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then ac_cv_proto_gethostname=no else AC_TRY_LINK([ #include #include extern "C" int gethostname (char *, int); ], [ char buffer[200]; gethostname(buffer, 200); ], ac_cv_func_gethostname=yes ac_cv_proto_gethostname=yes, AC_MSG_RESULT([fatal error]) AC_MSG_ERROR(gethostname unavailable)) fi AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_proto_gethostname) if eval "test \"`echo $ac_cv_proto_gethostname`\" = no"; then AC_DEFINE(HAVE_GETHOSTNAME_PROTO, 1, [Define if you have gethostname prototype]) fi if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have gethostname]) fi ]) AC_DEFUN(AC_CHECK_USLEEP, [ AC_MSG_CHECKING([for usleep]) AC_CACHE_VAL(ac_cv_func_usleep, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_libs_safe="$LIBS" LIBS="$LIBS $LIBUCB" AC_TRY_LINK([ #include #include ], [ usleep(200); ], ac_cv_func_usleep=yes, ac_cv_func_usleep=no) LIBS="$ac_libs_safe" AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_usleep) if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function]) fi ]) AC_DEFUN(AC_CHECK_RANDOM, [ AC_MSG_CHECKING([for random]) AC_CACHE_VAL(ac_cv_func_random, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_libs_safe="$LIBS" LIBS="$LIBS $LIBUCB" AC_TRY_LINK([ #include ], [ random(); ], ac_cv_func_random=yes, ac_cv_func_random=no) LIBS="$ac_libs_safe" AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_random) if eval "test \"`echo $ac_cv_func_random`\" = yes"; then AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random]) fi ]) AC_DEFUN(AC_FIND_GIF, [AC_MSG_CHECKING([for giflib]) AC_CACHE_VAL(ac_cv_lib_gif, [ac_save_LIBS="$LIBS" LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" AC_TRY_LINK(dnl [ #ifdef __cplusplus extern "C" { #endif int GifLastError(void); #ifdef __cplusplus } #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ], [return GifLastError();], eval "ac_cv_lib_gif=yes", eval "ac_cv_lib_gif=no") LIBS="$ac_save_LIBS" ])dnl if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) else AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) fi ]) AC_DEFUN(KDE_FIND_JPEG_HELPER, [ AC_MSG_CHECKING([for libjpeg$2]) AC_CACHE_VAL(ac_cv_lib_jpeg_$1, [ AC_LANG_C ac_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" AC_TRY_LINK( [/* Override any gcc2 internal prototype to avoid an error. */ struct jpeg_decompress_struct; typedef struct jpeg_decompress_struct * j_decompress_ptr; typedef int size_t; #ifdef __cplusplus extern "C" { #endif void jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, size_t structsize); #ifdef __cplusplus } #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ], [jpeg_CreateDecompress(0L, 0, 0);], eval "ac_cv_lib_jpeg_$1=-ljpeg$2", eval "ac_cv_lib_jpeg_$1=no") LIBS="$ac_save_LIBS" CFLAGS="$ac_save_CFLAGS" ]) if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then LIBJPEG="$ac_cv_lib_jpeg_$1" AC_MSG_RESULT($ac_cv_lib_jpeg_$1) else AC_MSG_RESULT(no) $3 fi ]) AC_DEFUN(AC_FIND_JPEG, [ dnl first look for libraries KDE_FIND_JPEG_HELPER(6b, 6b, KDE_FIND_JPEG_HELPER(normal, [], [ LIBJPEG= ] ) ) dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h dnl requires system dependent includes loaded before it) jpeg_incdirs="/usr/include /usr/local/include $kde_extra_includes" AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir) test "x$jpeg_incdir" = xNO && jpeg_incdir= dnl if headers _and_ libraries are missing, this is no error, and we dnl continue with a warning (the user will get no jpeg support in khtml) dnl if only one is missing, it means a configuration error, but we still dnl only warn if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) else if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then AC_MSG_WARN([ There is an installation error in jpeg support. You seem to have only one of either the headers _or_ the libraries installed. You may need to either provide correct --with-extra-... options, or the development package of libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ Disabling JPEG support. ]) else AC_MSG_WARN([libjpeg not found. disable JPEG support.]) fi jpeg_incdir= LIBJPEG= fi AC_SUBST(LIBJPEG) ]) AC_DEFUN(AC_FIND_ZLIB, [ AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_MSG_CHECKING([for libz]) AC_CACHE_VAL(ac_cv_lib_z, [ AC_LANG_C kde_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" kde_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" AC_TRY_LINK(dnl [ #include ], [return (zlibVersion() == ZLIB_VERSION); ], eval "ac_cv_lib_z='-lz'", eval "ac_cv_lib_z=no") LIBS="$kde_save_LIBS" CFLAGS="$kde_save_CFLAGS" ])dnl if test ! "$ac_cv_lib_z" = no; then AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) LIBZ="$ac_cv_lib_z" AC_SUBST(LIBZ) AC_MSG_RESULT($ac_cv_lib_z) else AC_MSG_ERROR(not found. Check your installation and look into config.log) LIBZ="" AC_SUBST(LIBZ) fi ]) AC_DEFUN(KDE_TRY_TIFFLIB, [ AC_MSG_CHECKING([for libtiff $1]) AC_CACHE_VAL(kde_cv_libtiff_$1, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS kde_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" kde_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" AC_TRY_LINK(dnl [ #include ], [return (TIFFOpen( "", "r") == 0); ], [ kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" ], [ kde_cv_libtiff_$1=no ]) LIBS="$kde_save_LIBS" CXXFLAGS="$kde_save_CXXFLAGS" AC_LANG_RESTORE ]) if test "$kde_cv_libtiff_$1" = "no"; then AC_MSG_RESULT(no) LIBTIFF="" $3 else LIBTIFF="$kde_cv_libtiff_$1" AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) $2 fi ]) AC_DEFUN(AC_FIND_TIFF, [ AC_REQUIRE([K_PATH_X]) AC_REQUIRE([AC_FIND_ZLIB]) AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) KDE_TRY_TIFFLIB(tiff, [], KDE_TRY_TIFFLIB(tiff34)) AC_SUBST(LIBTIFF) ]) AC_DEFUN(AC_FIND_PNG, [ AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_REQUIRE([AC_FIND_ZLIB]) AC_MSG_CHECKING([for libpng]) AC_CACHE_VAL(ac_cv_lib_png, [ kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" kde_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" AC_LANG_C AC_TRY_LINK(dnl [ #include ], [ png_structp png_ptr = png_create_read_struct( /* image ptr */ PNG_LIBPNG_VER_STRING, 0, 0, 0 ); return( png_ptr != 0 ); ], eval "ac_cv_lib_png='-lpng $LIBZ -lm'", eval "ac_cv_lib_png=no" ) LIBS="$kde_save_LIBS" CFLAGS="$kde_save_CFLAGS" ])dnl if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) LIBPNG="$ac_cv_lib_png" AC_SUBST(LIBPNG) AC_MSG_RESULT($ac_cv_lib_png) else AC_MSG_RESULT(no) LIBPNG="" AC_SUBST(LIBPNG) fi ]) AC_DEFUN(AC_CHECK_BOOL, [ AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool]) ]) AC_DEFUN(AC_CHECK_GNU_EXTENSIONS, [ AC_MSG_CHECKING(if you need GNU extensions) AC_CACHE_VAL(ac_cv_gnu_extensions, [ cat > conftest.c << EOF #include #ifdef __GNU_LIBRARY__ yes #endif EOF if (eval "$ac_cpp conftest.c") 2>&5 | egrep "yes" >/dev/null 2>&1; then rm -rf conftest* ac_cv_gnu_extensions=yes else ac_cv_gnu_extensions=no fi ]) AC_MSG_RESULT($ac_cv_gnu_extensions) if test "$ac_cv_gnu_extensions" = "yes"; then AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) fi ]) AC_DEFUN(KDE_CHECK_COMPILER_FLAG, [ dnl AC_REQUIRE([AC_CHECK_COMPILERS]) <- breaks with autoconf 2.50 AC_MSG_CHECKING(whether $CXX supports -$1) kde_cache=`echo $1 | sed 'y%.=/+-%___p_%'` AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, [ echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then if test -z "`$CXX -$1 -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* ]) if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then AC_MSG_RESULT(yes) : $2 else AC_MSG_RESULT(no) : $3 fi ]) dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever]) dnl it's all white-space separated AC_DEFUN(AC_REMOVE_FORBIDDEN, [ __val=$$1 __forbid=" $2 " if test -n "$__val"; then __new="" ac_save_IFS=$IFS IFS=" " for i in $__val; do case "$__forbid" in *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;; *) # Careful to not add spaces, where there were none, because otherwise # libtool gets confused, if we change e.g. CXX if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; esac done IFS=$ac_save_IFS $1=$__new fi ]) dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given AC_DEFUN(AC_VALIDIFY_CXXFLAGS, [dnl AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath]) AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath]) ]) AC_DEFUN(AC_CHECK_COMPILERS, [ AC_ARG_ENABLE(debug,[ --enable-debug enables debug symbols [default=no]], [ if test $enableval = "no"; dnl then kde_use_debug_code="no" kde_use_debug_define=yes else kde_use_debug_code="yes" kde_use_debug_define=no fi ], [kde_use_debug_code="no" kde_use_debug_define=no ]) dnl Just for configure --help AC_ARG_ENABLE(dummyoption,[ --disable-debug disables debug output and debug symbols [default=no]],[],[]) AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)], [ if test $enableval = "no"; then kde_use_strict_options="no" else kde_use_strict_options="yes" fi ], [kde_use_strict_options="no"]) AC_ARG_ENABLE(profile,[ --enable-profile creates profiling infos [default=no]], [kde_use_profiling=$enableval], [kde_use_profiling="no"] ) dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS CFLAGS=" $CFLAGS" AC_PROG_CC if test "$GCC" = "yes"; then if test "$kde_use_debug_code" = "yes"; then CFLAGS="-g -O2 $CFLAGS" case $host in *-*-linux-gnu) CFLAGS="-ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" ;; esac else CFLAGS="-O2 $CFLAGS" fi fi if test "$kde_use_debug_define" = "yes"; then CFLAGS="-DNDEBUG $CFLAGS" fi case "$host" in *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; esac if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then LDFLAGS="" fi CXXFLAGS=" $CXXFLAGS" AC_PROG_CXX if test "$GXX" = "yes"; then if test "$kde_use_debug_code" = "yes"; then CXXFLAGS="-g -O2 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS" KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"]) KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"]) KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"]) case $host in dnl *-*-linux-gnu) CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wbad-function-cast -Wcast-align -Wundef -Wconversion $CXXFLAGS" ;; esac if test "$kde_use_strict_options" = "yes"; then CXXFLAGS="-Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align $CXXFLAGS" fi if test "$kde_very_strict" = "yes"; then CXXFLAGS="-Wold-style-cast -Wredundant-decls -Wconversion $CXXFLAGS" fi else CXXFLAGS="-O2 $CXXFLAGS" fi fi if test "$kde_use_debug_define" = "yes"; then CXXFLAGS="-DNDEBUG $CXXFLAGS" fi if test "$kde_use_profiling" = "yes"; then KDE_CHECK_COMPILER_FLAG(pg, [ CFLAGS="-pg $CFLAGS" CXXFLAGS="-pg $CXXFLAGS" ]) fi KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"]) KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"]) KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= ) AC_SUBST(USE_EXCEPTIONS) dnl obsolete macro - provided to keep things going USE_RTTI= AC_SUBST(USE_RTTI) case "$host" in *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; *-*-solaris*) if test "$GXX" = yes; then libstdcpp=`$CXX -print-file-name=libstdc++.so` if test ! -f $libstdcpp; then AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so]) fi fi ;; esac AC_VALIDIFY_CXXFLAGS AC_PROG_CXXCPP # the following is to allow programs, that are known to # have problems when compiled with -O2 if test -n "$CXXFLAGS"; then kde_safe_IFS=$IFS IFS=" " NOOPT_CXXFLAGS="" for i in $CXXFLAGS; do case $i in -O*) ;; *) NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i" ;; esac done IFS=$kde_safe_IFS fi AC_SUBST(NOOPT_CXXFLAGS) KDE_CHECK_FINAL ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) KDE_CXXFLAGS= AC_SUBST(KDE_CXXFLAGS) ]) AC_DEFUN(KDE_ADD_DEPENDENCIES, [ [A]M_DEPENDENCIES(CC) [A]M_DEPENDENCIES(CXX) ]) dnl just a wrapper to clean up configure.in AC_DEFUN(KDE_PROG_LIBTOOL, [ AC_REQUIRE([AC_CHECK_COMPILERS]) AC_REQUIRE([AC_ENABLE_SHARED]) AC_REQUIRE([AC_ENABLE_STATIC]) AC_REQUIRE([AC_LIBTOOL_DLOPEN]) AC_LANG_SAVE AC_LANG_C AC_OBJEXT AC_EXEEXT AC_LANG_RESTORE AM_PROG_LIBTOOL AC_LIBTOOL_CXX LIBTOOL_SHELL="/bin/sh ./libtool" # LIBTOOL="$LIBTOOL --silent" KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_RPATH)" AC_SUBST(KDE_PLUGIN) AC_ARG_ENABLE(objprelink, [ --enable-objprelink prelink apps using objprelink (experimental [only tested on linux/386])], kde_use_objprelink=$enableval, kde_use_objprelink=no) if test "x$kde_use_objprelink" = "xyes"; then KDE_FIND_PATH(objprelink, OBJPRELINK, [], [kde_use_objprelink=no]) if test "x$kde_use_objprelink" = "xyes"; then AC_MSG_CHECKING([Patching libtool to run objprelink.]) mv libtool libtool.orig cat > libtool <<\EOF #! /bin/sh for n ; do case $n in *.o) test -r $n && echo objprelink $n && objprelink $n ;; *.lo) m=`basename $n .lo`".o" && test -r $m && echo objprelink $m && objprelink $m m=".libs/$m" && test -r $m && echo objprelink $m && objprelink $m ;; esac; done EOF cat >> libtool libtool.orig rm libtool.orig chmod a+x libtool AC_MSG_RESULT(done) fi fi ]) AC_DEFUN(KDE_CHECK_TYPES, [ AC_CHECK_SIZEOF(int, 4)dnl AC_CHECK_SIZEOF(long, 4)dnl AC_CHECK_SIZEOF(char *, 4)dnl AC_CHECK_SIZEOF(char, 1)dnl ])dnl AC_DEFUN(KDE_DO_IT_ALL, [ AC_CANONICAL_SYSTEM AC_ARG_PROGRAM AM_INIT_AUTOMAKE($1, $2) AM_DISABLE_LIBRARIES AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) AC_CHECK_COMPILERS KDE_PROG_LIBTOOL AM_KDE_WITH_NLS AC_PATH_KDE ]) AC_DEFUN(AC_CHECK_RPATH, [ AC_MSG_CHECKING(for rpath) AC_ARG_ENABLE(rpath, [ --disable-rpath do not use the rpath feature of ld], USE_RPATH=$enableval, USE_RPATH=yes) if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then KDE_RPATH="-R \$(kde_libraries)" if test -n "$qt_libraries"; then KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" fi dnl $x_libraries is set to /usr/lib in case if test -n "$X_LDFLAGS"; then KDE_RPATH="$KDE_RPATH -R \$(x_libraries)" fi if test -n "$KDE_EXTRA_RPATH"; then KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" fi fi AC_SUBST(KDE_EXTRA_RPATH) AC_SUBST(KDE_RPATH) AC_MSG_RESULT($USE_RPATH) ]) dnl Check for the type of the third argument of getsockname AC_DEFUN(AC_CHECK_SOCKLEN_T, [ AC_MSG_CHECKING(for socklen_t) AC_CACHE_VAL(ac_cv_socklen_t, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ #include #include ],[ socklen_t a=0; getsockname(0,(struct sockaddr*)0, &a); ], ac_cv_socklen_t=socklen_t, AC_TRY_COMPILE([ #include #include ],[ int a=0; getsockname(0,(struct sockaddr*)0, &a); ], ac_cv_socklen_t=int, ac_cv_socklen_t=size_t ) ) AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_socklen_t) if test "$ac_cv_socklen_t" != "socklen_t"; then AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t, [Define the real type of socklen_t]) fi AC_DEFINE_UNQUOTED(ksize_t, socklen_t, [Compatibility define]) ]) dnl This is a merge of some macros out of the gettext aclocal.m4 dnl since we don't need anything, I took the things we need dnl the copyright for them is: dnl > dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. dnl This Makefile.in is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. dnl > dnl for this file it is relicensed under LGPL AC_DEFUN(AM_KDE_WITH_NLS, [ dnl If we use NLS figure out what method AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) GMSGFMT=":" fi MSGFMT=$GMSGFMT AC_SUBST(GMSGFMT) AC_SUBST(MSGFMT) AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) dnl Test whether we really found GNU xgettext. if test "$XGETTEXT" != ":"; then dnl If it is no GNU xgettext we define it as : so that the dnl Makefiles still can work. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else AC_MSG_RESULT( [found xgettext programs is not GNU xgettext; ignore it]) XGETTEXT=":" fi fi AC_SUBST(XGETTEXT) ]) # Search path for a program which passes the given test. # Ulrich Drepper , 1996. # serial 1 # Stephan Kulow: I appended a _KDE against name conflicts dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE, [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in /*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in ifelse([$5], , $PATH, [$5]); do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test -n "[$]$1"; then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) # Check whether LC_MESSAGES is available in . # Ulrich Drepper , 1995. # serial 1 AC_DEFUN(AM_LC_MESSAGES, [if test $ac_cv_header_locale_h = yes; then AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) if test $am_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES]) fi fi]) dnl From Jim Meyering. dnl FIXME: migrate into libit. AC_DEFUN([AM_FUNC_OBSTACK], [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, [AC_TRY_LINK([#include "obstack.h"], [struct obstack *mem;obstack_free(mem,(char *) 0)], am_cv_func_obstack=yes, am_cv_func_obstack=no)]) if test $am_cv_func_obstack = yes; then AC_DEFINE(HAVE_OBSTACK) else LIBOBJS="$LIBOBJS obstack.o" fi ]) dnl From Jim Meyering. Use this if you use the GNU error.[ch]. dnl FIXME: Migrate into libit AC_DEFUN([AM_FUNC_ERROR_AT_LINE], [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], am_cv_lib_error_at_line=yes, am_cv_lib_error_at_line=no)]) if test $am_cv_lib_error_at_line = no; then LIBOBJS="$LIBOBJS error.o" fi AC_SUBST(LIBOBJS)dnl ]) # Macro to add for using GNU gettext. # Ulrich Drepper , 1995. # serial 1 # Stephan Kulow: I put a KDE in it to avoid name conflicts AC_DEFUN(AM_KDE_GNU_GETTEXT, [AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_TYPE_OFF_T])dnl AC_REQUIRE([AC_TYPE_SIZE_T])dnl AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl AC_REQUIRE([AM_KDE_WITH_NLS])dnl AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h string.h values.h alloca.h]) AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ __argz_count __argz_stringify __argz_next]) AC_MSG_CHECKING(for stpcpy) AC_CACHE_VAL(kde_cv_func_stpcpy, [ kde_safe_cxxflags=$CXXFLAGS CXXFLAGS="-Wmissing-prototypes -Werror" AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ #include ], [ char buffer[200]; stpcpy(buffer, buffer); ], kde_cv_func_stpcpy=yes, kde_cv_func_stpcpy=no) AC_LANG_RESTORE CXXFLAGS=$kde_safe_cxxflags ]) AC_MSG_RESULT($kde_cv_func_stpcpy) if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) fi AM_LC_MESSAGES if test "x$CATOBJEXT" != "x"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else AC_MSG_CHECKING(for catalogs to be installed) NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; esac done LINGUAS=$NEW_LINGUAS AC_MSG_RESULT($LINGUAS) fi dnl Construct list of names of catalog files to be constructed. if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi fi ]) AC_DEFUN(AC_HAVE_XPM, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= test -z "$XPM_INCLUDE" && XPM_INCLUDE= AC_ARG_WITH(xpm, [ --without-xpm disable color pixmap XPM tests], xpm_test=$withval, xpm_test="yes") if test "x$xpm_test" = xno; then ac_cv_have_xpm=no else AC_MSG_CHECKING(for XPM) AC_CACHE_VAL(ac_cv_have_xpm, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES" test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" AC_TRY_LINK([#include ],[], ac_cv_have_xpm="yes",ac_cv_have_xpm="no") LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" ])dnl if test "$ac_cv_have_xpm" = no; then AC_MSG_RESULT(no) XPM_LDFLAGS="" XPMINC="" $2 else AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) if test "$XPM_LDFLAGS" = ""; then XPMLIB='-lXpm $(LIB_X11)' else XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' fi if test "$XPM_INCLUDE" = ""; then XPMINC="" else XPMINC="-I$XPM_INCLUDE" fi AC_MSG_RESULT(yes) $1 fi fi AC_SUBST(XPMINC) AC_SUBST(XPMLIB) ]) AC_DEFUN(AC_HAVE_DPMS, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= DPMS_LIB= AC_ARG_WITH(dpms, [ --without-dpms disable DPMS power saving], dpms_test=$withval, dpms_test="yes") if test "x$dpms_test" = xno; then ac_cv_have_dpms=no else AC_MSG_CHECKING(for DPMS) dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms. dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms". AC_CACHE_VAL(ac_cv_have_dpms, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" ac_save_libs="$LIBS" LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES" test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" AC_TRY_LINK([ #include #include #include #include int foo_test_dpms() { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], ac_cv_have_dpms="yes", [ LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" LIBS="$LIBS -lXdpms" CFLAGS="$CFLAGS $X_INCLUDES" test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" AC_TRY_LINK([ #include #include #include #include int foo_test_dpms() { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], [ ac_cv_have_dpms="-lXdpms" ],ac_cv_have_dpms="no") ]) LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" LIBS="$ac_save_libs" ])dnl if test "$ac_cv_have_dpms" = no; then AC_MSG_RESULT(no) DPMS_LDFLAGS="" DPMSINC="" $2 else AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) if test "$ac_cv_have_dpms" = "-lXdpms"; then DPMS_LIB="-lXdpms" fi if test "$DPMS_LDFLAGS" = ""; then DPMSLIB="$DPMS_LIB "'$(LIB_X11)' else DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)' fi if test "$DPMS_INCLUDE" = ""; then DPMSINC="" else DPMSINC="-I$DPMS_INCLUDE" fi AC_MSG_RESULT(yes) $1 fi fi AC_SUBST(DPMSINC) AC_SUBST(DPMSLIB) ]) AC_DEFUN(AC_HAVE_GL, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$GL_LDFLAGS" && GL_LDFLAGS= test -z "$GL_INCLUDE" && GL_INCLUDE= AC_ARG_WITH(gl, [ --without-gl disable 3D GL modes], gl_test=$withval, gl_test="yes") if test "x$gl_test" = xno; then ac_cv_have_gl=no else AC_MSG_CHECKING(for GL) AC_CACHE_VAL(ac_cv_have_gl, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES" test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" AC_TRY_LINK([#include #include ], [], ac_cv_have_gl="mesa", ac_cv_have_gl="no") if test "x$ac_cv_have_gl" = "xno"; then LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGL -lGLU -lX11 -lXext -lm $LIBSOCKET" CFLAGS="$ac_save_cflags $X_INCLUDES" test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" AC_TRY_LINK([#include #include ], [], ac_cv_have_gl="yes", ac_cv_have_gl="no") fi LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" ])dnl if test "$ac_cv_have_gl" = "no"; then AC_MSG_RESULT(no) GL_LDFLAGS="" GLINC="" $2 else AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) if test "$GL_LDFLAGS" = ""; then if test "$ac_cv_have_gl" = "mesa"; then GLLIB='-lMesaGL -lMesaGLU $(LIB_X11)' else GLLIB='-lGL -lGLU $(LIB_X11)' fi else if test "$ac_cv_have_gl" = "mesa"; then GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU "'$(LIB_X11)' else GLLIB="$GL_LDFLAGS -lGL -lGLU "'$(LIB_X11)' fi fi if test "$GL_INCLUDE" = ""; then GLINC="" else GLINC="-I$GL_INCLUDE" fi AC_MSG_RESULT($ac_cv_have_gl) $1 fi fi AC_SUBST(GLINC) AC_SUBST(GLLIB) ]) dnl shadow password and PAM magic - maintained by ossi@kde.org AC_DEFUN(KDE_PAM, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_ARG_WITH(pam, [ --with-pam[=ARG] enable support for PAM: ARG=[yes|no|service name]], [ if test "x$withval" = "xyes"; then use_pam=yes pam_service=kde elif test "x$withval" = "xno"; then use_pam=no else use_pam=yes pam_service=$withval fi ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" ], [ AC_CACHE_VAL(ac_cv_path_pam, [ use_pam=no AC_CHECK_LIB(pam, pam_start, [ AC_CHECK_HEADER(security/pam_appl.h, [ use_pam=yes pam_service=kde ]) ], , $LIBDL) ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" ]) ]) eval "$ac_cv_path_pam" AC_MSG_CHECKING(for PAM) if test "x$use_pam" = xno; then AC_MSG_RESULT(no) PAMLIBS="" else AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)]) PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL" dnl test whether struct pam_message is const (Linux) or not (Sun) AC_MSG_CHECKING(for const pam_message) AC_EGREP_HEADER([struct pam_message], security/pam_appl.h, [ AC_EGREP_HEADER([const struct pam_message], security/pam_appl.h, [AC_MSG_RESULT([const: Linux-type PAM])], [AC_MSG_RESULT([nonconst: Sun-type PAM]) AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] )], [AC_MSG_RESULT([not found - assume const, Linux-type PAM])]) fi AC_SUBST(PAMLIBS) ]) dnl DEF_PAM_SERVICE(arg name, full name, define name) AC_DEFUN(DEF_PAM_SERVICE, [ AC_ARG_WITH($1-pam, [ --with-$1-pam=[val] override PAM service from --with-pam for $2], [ if test "x$use_pam" = xyes; then $3_PAM_SERVICE="$withval" else AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected. You may want to enforce it by using --with-pam.]) fi ], [ if test "x$use_pam" = xyes; then $3_PAM_SERVICE="$pam_service" fi ]) if test -n "$$3_PAM_SERVICE"; then AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE]) AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2]) fi AC_SUBST($3_PAM_SERVICE) ]) AC_DEFUN(KDE_SHADOWPASSWD, [ AC_REQUIRE([KDE_PAM]) AC_CHECK_LIB(shadow, getspent, [ LIBSHADOW="-lshadow" ac_use_shadow=yes ], [ dnl for UnixWare AC_CHECK_LIB(gen, getspent, [ LIBGEN="-lgen" ac_use_shadow=yes ], [ AC_CHECK_FUNC(getspent, [ ac_use_shadow=yes ], [ ac_use_shadow=no ]) ]) ]) AC_SUBST(LIBSHADOW) AC_SUBST(LIBGEN) AC_MSG_CHECKING([for shadow passwords]) AC_ARG_WITH(shadow, [ --with-shadow If you want shadow password support ], [ if test "x$withval" != "xno"; then use_shadow=yes else use_shadow=no fi ], [ use_shadow="$ac_use_shadow" ]) if test "x$use_shadow" = xyes; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords]) else AC_MSG_RESULT(no) LIBSHADOW= LIBGEN= fi dnl finally make the relevant binaries setuid root, if we have shadow passwds. dnl this still applies, if we could use it indirectly through pam. if test "x$use_shadow" = xyes || ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then case $host in *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) SETUIDFLAGS="-m 4755 -o root";; *) SETUIDFLAGS="-m 4755";; esac fi AC_SUBST(SETUIDFLAGS) ]) AC_DEFUN(KDE_PASSWDLIBS, [ AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT AC_REQUIRE([KDE_PAM]) AC_REQUIRE([KDE_SHADOWPASSWD]) if test "x$use_pam" = "xyes"; then PASSWDLIBS="$PAMLIBS" else PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN" fi AC_SUBST(PASSWDLIBS) ]) AC_DEFUN(KDE_CHECK_LIBDL, [ AC_CHECK_LIB(dl, dlopen, [ LIBDL="-ldl" ac_cv_have_dlfcn=yes ]) AC_CHECK_LIB(dld, shl_unload, [ LIBDL="-ldld" ac_cv_have_shload=yes ]) AC_SUBST(LIBDL) ]) AC_DEFUN(KDE_CHECK_DLOPEN, [ KDE_CHECK_LIBDL AC_CHECK_HEADERS(dlfcn.h dl.h) if test "$ac_cv_header_dlfcn_h" = "no"; then ac_cv_have_dlfcn=no fi if test "$ac_cv_header_dl_h" = "no"; then ac_cv_have_shload=no fi dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE dnl (MM) AC_ARG_ENABLE(dlopen, [ --disable-dlopen link statically [default=no]] , enable_dlopen=$enableval, enable_dlopen=yes) # override the user's opinion, if we know it better ;) if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then enable_dlopen=no fi if test "$ac_cv_have_dlfcn" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) fi if test "$ac_cv_have_shload" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) fi if test "$enable_dlopen" = no ; then test -n "$1" && eval $1 else test -n "$2" && eval $2 fi ]) AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING, [ KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) KDE_PROG_LIBTOOL AC_MSG_CHECKING([dynamic loading]) eval "`egrep '^build_libtool_libs=' libtool`" if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then dynamic_loading=yes AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) else dynamic_loading=no fi AC_MSG_RESULT($dynamic_loading) if test "$dynamic_loading" = "yes"; then $1 else $2 fi ]) AC_DEFUN(KDE_ADD_INCLUDES, [ if test -z "$1"; then test_include="Pix.h" else test_include="$1" fi AC_MSG_CHECKING([for libg++ ($test_include)]) AC_CACHE_VAL(kde_cv_libgpp_includes, [ kde_cv_libgpp_includes=no for ac_dir in \ \ /usr/include/g++ \ /usr/include \ /usr/unsupported/include \ /opt/include \ $extra_include \ ; \ do if test -r "$ac_dir/$test_include"; then kde_cv_libgpp_includes=$ac_dir break fi done ]) AC_MSG_RESULT($kde_cv_libgpp_includes) if test "$kde_cv_libgpp_includes" != "no"; then all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES" fi ]) ]) AC_DEFUN(KDE_CHECK_MICO, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([KDE_MISC_TESTS]) AC_MSG_CHECKING(for MICO) if test -z "$MICODIR"; then kde_micodir=/usr/local else kde_micodir="$MICODIR" fi AC_ARG_WITH(micodir, [ --with-micodir=micodir where mico is installed ], kde_micodir=$withval, kde_micodir=$kde_micodir ) AC_CACHE_VAL(kde_cv_mico_incdir, [ mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes" AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir) ]) kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'` if test ! -r $kde_micodir/include/CORBA.h; then AC_MSG_ERROR([No CORBA.h found, specify another micodir]) fi AC_MSG_RESULT($kde_micodir) MICO_INCLUDES=-I$kde_micodir/include AC_SUBST(MICO_INCLUDES) MICO_LDFLAGS=-L$kde_micodir/lib AC_SUBST(MICO_LDFLAGS) micodir=$kde_micodir AC_SUBST(micodir) AC_MSG_CHECKING([for MICO version]) AC_CACHE_VAL(kde_cv_mico_version, [ AC_LANG_C cat >conftest.$ac_ext < #include int main() { printf("MICO_VERSION=%s\n",MICO_VERSION); return (0); } EOF ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest' if AC_TRY_EVAL(ac_compile); then if eval `./conftest 2>&5`; then kde_cv_mico_version=$MICO_VERSION else AC_MSG_ERROR([your system is not able to execute a small application to find MICO version! Check $kde_micodir/include/mico/version.h]) fi else AC_MSG_ERROR([your system is not able to compile a small application to find MICO version! Check $kde_micodir/include/mico/version.h]) fi ]) dnl installed MICO version mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` if test "x$1" = "x"; then req_version="2.3.0" else req_version=$1 fi dnl required MICO version req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` if test "$mico_v_maj" -lt "$req_v_maj" || \ ( test "$mico_v_maj" -eq "$req_v_maj" && \ test "$mico_v_mid" -lt "$req_v_mid" ) || \ ( test "$mico_v_mid" -eq "$req_v_mid" && \ test "$mico_v_min" -lt "$req_v_min" ) then AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \ at least is required. You should upgrade MICO.]) else AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)]) fi LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL" AC_SUBST(LIBMICO) if test -z "$IDL"; then IDL='$(kde_bindir)/cuteidl' fi AC_SUBST(IDL) IDL_DEPENDENCIES='$(kde_includes)/CUTE.h' AC_SUBST(IDL_DEPENDENCIES) idldir="\$(includedir)/idl" AC_SUBST(idldir) ]) AC_DEFUN(KDE_CHECK_MINI_STL, [ AC_REQUIRE([KDE_CHECK_MICO]) AC_MSG_CHECKING(if we use mico's mini-STL) AC_CACHE_VAL(kde_cv_have_mini_stl, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS kde_save_cxxflags="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $MICO_INCLUDES" AC_TRY_COMPILE( [ #include ], [ #ifdef HAVE_MINI_STL #error "nothing" #endif ], kde_cv_have_mini_stl=no, kde_cv_have_mini_stl=yes) CXXFLAGS="$kde_save_cxxflags" AC_LANG_RESTORE ]) if test "x$kde_cv_have_mini_stl" = "xyes"; then AC_MSG_RESULT(yes) $1 else AC_MSG_RESULT(no) $2 fi ]) ]) AC_DEFUN(KDE_CHECK_LIBPTHREAD, [ AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] ) AC_SUBST(LIBPTHREAD) ]) AC_DEFUN(KDE_CHECK_PTHREAD_OPTION, [ AC_ARG_ENABLE(kernel-threads, [ --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.], kde_use_kernthreads=$enableval, kde_use_kernthreads=no) if test "$kde_use_kernthreads" = "yes"; then ac_save_CXXFLAGS="$CXXFLAGS" ac_save_CFLAGS="$CXXFLAGS" CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS" CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS" AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h) CXXFLAGS="$ac_save_CXXFLAGS" CFLAGS="$ac_save_CFLAGS" if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then kde_use_kernthreads=no else dnl Add proper -I and -l statements AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD if test "x$LIBPTHREAD" = "x"; then kde_use_kernthreads=no else USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads" fi fi else USE_THREADS="" if test -z "$LIBPTHREAD"; then KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] ) fi fi case $host_os in solaris*) KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"]) CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4" echo "Setting Solaris pthread compilation options" ;; freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" echo "Setting FreeBSD pthread compilation options" ;; aix*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" LIBPTHREAD="$LIBPTHREAD -lc_r" echo "Setting AIX pthread compilation options" ;; linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" USE_THREADS="$USE_THREADS -DPIC -fPIC" echo "Setting Linux pthread compilation options" ;; *) ;; esac AC_SUBST(USE_THREADS) AC_SUBST(LIBPTHREAD) ]) AC_DEFUN(KDE_CHECK_THREADING, [ AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION]) dnl default is yes if libpthread is found and no if no libpthread is available if test -z "$LIBPTHREAD"; then kde_check_threading_default=no else kde_check_threading_default=yes fi AC_ARG_ENABLE(threading, [ --disable-threading disables threading even if libpthread found ], kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default) if test "x$kde_use_threading" = "xyes"; then AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)]) fi ]) AC_DEFUN(KDE_TRY_LINK_PYTHON, [ if test "$kde_python_link_found" = no; then if test "$1" = normal; then AC_MSG_CHECKING(if a Python application links) else AC_MSG_CHECKING(if Python depends on $2) fi AC_CACHE_VAL(kde_cv_try_link_python_$1, [ AC_LANG_SAVE AC_LANG_C kde_save_cflags="$CFLAGS" CFLAGS="$CFLAGS $PYTHONINC" kde_save_libs="$LIBS" LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" kde_save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS $PYTHONLIB" AC_TRY_LINK( [ #include ],[ PySys_SetArgv(1, 0); ], [kde_cv_try_link_python_$1=yes], [kde_cv_try_link_python_$1=no] ) CFLAGS="$kde_save_cflags" LIBS="$kde_save_libs" LDFLAGS="$kde_save_ldflags" ]) if test "$kde_cv_try_link_python_$1" = "yes"; then AC_MSG_RESULT(yes) kde_python_link_found=yes if test ! "$1" = normal; then LIBPYTHON="$LIBPYTHON $2" fi $3 else AC_MSG_RESULT(no) $4 fi AC_LANG_RESTORE fi ]) AC_DEFUN(KDE_CHECK_PYTHON_DIR, [ AC_MSG_CHECKING([for Python directory]) AC_CACHE_VAL(kde_cv_pythondir, [ if test -z "$PYTHONDIR"; then kde_cv_pythondir=/usr/local else kde_cv_pythondir="$PYTHONDIR" fi ]) AC_ARG_WITH(pythondir, [ --with-pythondir=pythondir use python installed in pythondir ], [ ac_python_dir=$withval ], ac_python_dir=$kde_cv_pythondir ) AC_MSG_RESULT($ac_python_dir) ]) AC_DEFUN(KDE_CHECK_PYTHON_INTERN, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) AC_REQUIRE([KDE_CHECK_PYTHON_DIR]) if test -z "$1"; then version="1.5" else version="$1" fi AC_MSG_CHECKING([for Python$version]) python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) if test ! -r $python_incdir/Python.h; then AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) python_incdir=$python_incdir/python$version if test ! -r $python_incdir/Python.h; then python_incdir=no fi fi PYTHONINC=-I$python_incdir python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) if test ! -r $python_libdir/libpython$version.a; then AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) python_libdir=$python_libdir/python$version/config if test ! -r $python_libdir/libpython$version.a; then python_libdir=no fi fi PYTHONLIB=-L$python_libdir kde_orig_LIBPYTHON=$LIBPYTHON if test -z "$LIBPYTHON"; then LIBPYTHON=-lpython$version fi python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir) python_moddir=$python_moddir/python$version if test ! -r $python_moddir/copy.py; then python_moddir=no fi PYTHONMODDIR=$python_moddir AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir) if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then LIBPYTHON=$kde_orig_LIBPYTHON test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB="" test "x$PYTHONINC" = "x-Ino" && PYTHONINC="" $2 else dnl Note: this test is very weak kde_python_link_found=no KDE_TRY_LINK_PYTHON(normal) KDE_TRY_LINK_PYTHON(m, -lm) KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) KDE_TRY_LINK_PYTHON(tcl, -ltcl) KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm]) KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil]) KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil]) KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3]) KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil]) KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [], [AC_MSG_WARN([it seems, Python depends on another library. Pleae use \"make LIBPYTHON='-lpython$version -lotherlib'\" to fix this and contact the authors to let them know about this problem]) ]) LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" AC_SUBST(PYTHONINC) AC_SUBST(PYTHONLIB) AC_SUBST(LIBPYTHON) AC_SUBST(PYTHONMODDIR) AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python]) fi ]) AC_DEFUN(KDE_CHECK_PYTHON, [ KDE_CHECK_PYTHON_INTERN("2.1", [KDE_CHECK_PYTHON_INTERN("2.0", [ KDE_CHECK_PYTHON_INTERN($1, $2) ]) ]) ]) AC_DEFUN(KDE_CHECK_STL_SGI, [ AC_MSG_CHECKING([if STL implementation is SGI like]) AC_CACHE_VAL(kde_cv_stl_type_sgi, [ AC_TRY_COMPILE([ #include using namespace std; ],[ string astring="Hallo Welt."; astring.erase(0, 6); // now astring is "Welt" return 0; ], kde_cv_stl_type_sgi=yes, kde_cv_stl_type_sgi=no) ]) AC_MSG_RESULT($kde_cv_stl_type_sgi) if test "$kde_cv_stl_type_sgi" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) fi ]) AC_DEFUN(KDE_CHECK_STL_HP, [ AC_MSG_CHECKING([if STL implementation is HP like]) AC_CACHE_VAL(kde_cv_stl_type_hp, [ AC_TRY_COMPILE([ #include using namespace std; ],[ string astring="Hello World"; astring.remove(0, 6); // now astring is "World" return 0; ], kde_cv_stl_type_hp=yes, kde_cv_stl_type_hp=no) ]) AC_MSG_RESULT($kde_cv_stl_type_hp) if test "$kde_cv_stl_type_hp" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by HP]) fi ]) AC_DEFUN(KDE_CHECK_STL, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`" KDE_CHECK_STL_SGI if test "$kde_cv_stl_type_sgi" = "no"; then KDE_CHECK_STL_HP if test "$kde_cv_stl_type_hp" = "no"; then AC_MSG_ERROR("no known STL type found") fi fi CXXFLAGS="$ac_save_CXXFLAGS" AC_LANG_RESTORE ]) AC_DEFUN(AC_FIND_QIMGIO, [AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_MSG_CHECKING([for qimgio]) AC_CACHE_VAL(ac_cv_lib_qimgio, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_save_LIBS="$LIBS" ac_save_CXXFLAGS="$CXXFLAGS" LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" AC_TRY_RUN(dnl [ #include #include int main() { QString t = "hallo"; t.fill('t'); qInitImageIO(); } ], ac_cv_lib_qimgio=yes, ac_cv_lib_qimgio=no, ac_cv_lib_qimgio=no) LIBS="$ac_save_LIBS" CXXFLAGS="$ac_save_CXXFLAGS" AC_LANG_RESTORE ])dnl if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) AC_SUBST(LIBQIMGIO) else AC_MSG_RESULT(not found) fi ]) AC_DEFUN(KDE_CHECK_ANSI, [ ]) AC_DEFUN(KDE_CHECK_INSURE, [ AC_ARG_ENABLE(insure, [ --enable-insure use insure++ for debugging [default=no]], [ if test $enableval = "no"; dnl then ac_use_insure="no" else ac_use_insure="yes" fi ], [ac_use_insure="no"]) AC_MSG_CHECKING(if we will use Insure++ to debug) AC_MSG_RESULT($ac_use_insure) if test "$ac_use_insure" = "yes"; dnl then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "???? fi ]) AC_DEFUN(AM_DISABLE_LIBRARIES, [ AC_PROVIDE([AM_ENABLE_STATIC]) AC_PROVIDE([AM_ENABLE_SHARED]) enable_static=no enable_shared=yes ]) AC_DEFUN(AC_CHECK_UTMP_FILE, [ AC_MSG_CHECKING([for utmp file]) AC_CACHE_VAL(kde_cv_utmp_file, [ kde_cv_utmp_file=no for ac_file in \ \ /var/run/utmp \ /var/adm/utmp \ /etc/utmp \ ; \ do if test -r "$ac_file"; then kde_cv_utmp_file=$ac_file break fi done ]) if test "$kde_cv_utmp_file" != "no"; then AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) $1 AC_MSG_RESULT($kde_cv_utmp_file) else $2 AC_MSG_RESULT([non found]) fi ]) AC_DEFUN(KDE_CREATE_SUBDIRSLIST, [ DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" if test ! -s $srcdir/subdirs; then dnl Note: Makefile.common creates subdirs, so this is just a fallback TOPSUBDIRS="" files=`cd $srcdir && ls -1` dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` for i in $dirs; do echo $i >> $srcdir/subdirs done fi if test -s $srcdir/inst-apps; then ac_topsubdirs="`cat $srcdir/inst-apps`" else ac_topsubdirs="`cat $srcdir/subdirs`" fi for i in $ac_topsubdirs; do AC_MSG_CHECKING([if $i should be compiled]) if test -d $srcdir/$i; then install_it="yes" for j in $DO_NOT_COMPILE; do if test $i = $j; then install_it="no" fi done else install_it="no" fi AC_MSG_RESULT($install_it) if test $install_it = "yes"; then TOPSUBDIRS="$TOPSUBDIRS $i" fi done AC_SUBST(TOPSUBDIRS) ]) AC_DEFUN(KDE_CHECK_NAMESPACES, [ AC_MSG_CHECKING(whether C++ compiler supports namespaces) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ ], [ namespace Foo { extern int i; namespace Bar { extern int i; } } int Foo::i = 0; int Foo::Bar::i = 1; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NAMESPACES) ], [ AC_MSG_RESULT(no) ]) AC_LANG_RESTORE ]) AC_DEFUN(KDE_CHECK_NEWLIBS, [ ]) dnl ------------------------------------------------------------------------ dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_CHECK_S_ISSOCK, [ AC_MSG_CHECKING(for S_ISSOCK) AC_CACHE_VAL(ac_cv_have_s_issock, [ AC_LANG_SAVE AC_LANG_C AC_TRY_LINK( [ #include ], [ struct stat buff; int b = S_ISSOCK( buff.st_mode ); ], ac_cv_have_s_issock=yes, ac_cv_have_s_issock=no) AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_have_s_issock) if test "$ac_cv_have_s_issock" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) fi ]) dnl ------------------------------------------------------------------------ dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_CHECK_KDEMAXPATHLEN, [ AC_MSG_CHECKING(for MAXPATHLEN) AC_CACHE_VAL(ac_cv_maxpathlen, [ AC_LANG_C cat > conftest.$ac_ext < #endif #include #include #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif KDE_HELLO MAXPATHLEN EOF ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" if AC_TRY_EVAL(ac_try) && test -s conftest.out; then ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` else ac_cv_maxpathlen=1024 fi rm conftest.* ]) AC_MSG_RESULT($ac_cv_maxpathlen) AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] ) ]) dnl ------------------------------------------------------------------------- dnl See if the compiler supports a template repository bero@redhat.de dnl ------------------------------------------------------------------------- AC_DEFUN(KDE_COMPILER_REPO, [ REPO="" NOREPO="" KDE_CHECK_COMPILER_FLAG(frepo, [ REPO="-frepo" NOREPO="-fno-repo" ]) if test -z "$REPO"; then KDE_CHECK_COMPILER_FLAG(instances=explicit, [ REPO="-instances=explicit" NOREPO="-instances=extern" ]) fi if test -n "$REPO"; then AC_DEFINE_UNQUOTED(HAVE_TEMPLATE_REPOSITORY, 1, [C++ compiler supports template repository]) $1 fi AC_SUBST(REPO) AC_SUBST(NOREPO) ]) AC_DEFUN(KDE_CHECK_HEADER, [ AC_LANG_SAVE kde_safe_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $all_includes" AC_LANG_CPLUSPLUS AC_CHECK_HEADER($1, $2, $3) CPPFLAGS=$kde_safe_cppflags AC_LANG_RESTORE ]) AC_DEFUN(KDE_FAST_CONFIGURE, [ dnl makes configure fast (needs perl) AC_ARG_ENABLE(fast-perl, [ --disable-fast-perl disable fast Makefile generation (needs perl)], with_fast_perl=$enableval, with_fast_perl=yes) ]) AC_DEFUN(KDE_CONF_FILES, [ val= if test -f $srcdir/configure.files ; then val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files` fi CONF_FILES= if test -n "$val" ; then for i in $val ; do CONF_FILES="$CONF_FILES $i" done fi AC_SUBST(CONF_FILES) ])dnl AC_DEFUN(KDE_SET_PREFIX, [ unset CDPATH dnl make $KDEDIR the default for the installation AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix ac_configure_args="$ac_configure_args --prefix $prefix" fi KDE_FAST_CONFIGURE KDE_CONF_FILES ]) pushdef([AC_PROG_INSTALL], [ dnl our own version, testing for a -p flag popdef([AC_PROG_INSTALL]) dnl as AC_PROG_INSTALL works as it works we first have dnl to save if the user didn't specify INSTALL, as the dnl autoconf one overwrites INSTALL and we have no chance to find dnl out afterwards test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT AC_PROG_INSTALL if test -z "$kde_save_INSTALL_given" ; then # OK, user hasn't given any INSTALL, autoconf found one for us # now we test, if it supports the -p flag AC_MSG_CHECKING(for -p flag to install) rm -f confinst.$$.* > /dev/null 2>&1 echo "Testtest" > confinst.$$.orig ac_res=no if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then if test -f confinst.$$.new ; then # OK, -p seems to do no harm to install INSTALL="${INSTALL} -p" ac_res=yes fi fi rm -f confinst.$$.* AC_MSG_RESULT($ac_res) fi dnl the following tries to resolve some signs and wonders coming up dnl with different autoconf/automake versions dnl e.g.: dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS) dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the dnl install-@DIR@PROGRAMS targets to explicitly use that flag dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as dnl INSTALL_SCRIPT, which breaks with automake <= 1.4 dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from dnl automake (due to broken Makefile.am or whatever) to install programs, dnl and so does not see the -s flag in automake > 1.4 dnl to clean up that mess we: dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG dnl which cleans KDE's program with automake > 1.4; dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems dnl with automake<=1.4 dnl note that dues to this sometimes two '-s' flags are used (if KDE dnl properly uses install-@DIR@PROGRAMS, but I don't care dnl dnl And to all this comes, that I even can't write in comments variable dnl names used by automake, because it is so stupid to think I wanted to dnl _use_ them, therefor I have written A_M_... instead of AM_ dnl hmm, I wanted to say something ... ahh yes: Arghhh. if test -z "$kde_save_INSTALL_PROGRAM_given" ; then INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' fi if test -z "$kde_save_INSTALL_SCRIPT_given" ; then INSTALL_SCRIPT='${INSTALL}' fi ])dnl AC_DEFUN(KDE_LANG_CPLUSPLUS, [AC_LANG_CPLUSPLUS ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS]) ]) pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS ]) AC_DEFUN(KDE_CHECK_LONG_LONG, [ AC_MSG_CHECKING(for long long) AC_CACHE_VAL(kde_cv_c_long_long, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_LINK([], [ long long foo = 0; foo = foo+1; ], kde_cv_c_long_long=yes, kde_cv_c_long_long=no) ]) AC_MSG_RESULT($kde_cv_c_long_long) if test "$kde_cv_c_long_long" = yes; then AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype]) fi ]) AC_DEFUN(KDE_CHECK_LIB, [ kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries" case $host_os in aix*) LIBS="-brtl $LIBS" test "$GCC" = yes && LIBS="-Wl,$LIBS" ;; esac AC_CHECK_LIB($1, $2, $3, $4, $5) LIBS="$kde_save_LIBS" ]) AC_DEFUN(KDE_CHECK_INITGROUPS, [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS(initgroups) if test "x$ac_cv_func_initgroups" = "xyes"; then case $host_os in aix*) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_MSG_CHECKING([for initgroups prototype]) AC_CACHE_VAL(kde_cv_check_initgroups_proto, [ AC_TRY_COMPILE( [ #include ], [ char buffer[10]; gid_t id; int x = initgroups(buffer,id); ], kde_cv_check_initgroups_proto=yes, kde_cv_check_initgroups_proto=no) ]) AC_MSG_RESULT($kde_cv_check_initgroups_proto) AC_LANG_RESTORE ;; *) kde_cv_check_initgroups_proto=yes ;; esac else kde_cv_check_initgroups_proto=no fi if test "x$kde_cv_check_initgroups_proto" = "xyes"; then kde_check_initgroups_proto=1 else kde_check_initgroups_proto=0 fi AC_DEFINE_UNQUOTED(HAVE_INITGROUPS_PROTO,$kde_check_initgroups_proto, [initgroups may exist but not its prototype (e.g. AIX<4.3.3:8)]) ]) AC_DEFUN(KDE_CHECK_JAVA_DIR, [ AC_MSG_CHECKING([for Java directory]) AC_ARG_WITH(java, [ --with-java=javadir use java installed in javadir, --without-java disables ], [ ac_java_dir=$withval ], ac_java_dir="" ) dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH if test "x$ac_java_dir" = xno; then kde_cv_java_bindir=no kde_cv_java_includedir=no kde_java_libjvmdir=no kde_java_libhpidir=no else if test "x$ac_java_dir" = x; then dnl No option set -> look in $PATH AC_CACHE_VAL(kde_cv_java_bindir, [ dnl First look for javac in $PATH. If not found we'll look at the option. KDE_FIND_PATH(javac, JAVAC, [], []) if test -n "$JAVAC"; then kde_cv_java_bindir=`echo $JAVAC | sed -e 's,/javac$,/,'` dnl this substitution might not work - well, we test for jni.h below kde_cv_java_includedir=`echo $kde_cv_java_bindir | sed -e 's,bin/$,include/,'` else kde_cv_java_bindir=no fi ]) else dnl config option set kde_cv_java_bindir=$ac_java_dir/bin kde_cv_java_includedir=$ac_java_dir/include fi fi dnl At this point kde_cv_java_bindir and kde_cv_java_includedir are either set or "no" if test ! "x$kde_cv_java_bindir" = xno; then dnl Look for libjvm.so kde_java_libjvmdir=`find $kde_cv_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` dnl Look for libhpi.so and avoid green threads kde_java_libhpidir=`find $kde_cv_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,'` dnl Now check everything's fine under there if test ! -x "$kde_cv_java_bindir/javac"; then AC_MSG_ERROR([javac not found under $kde_cv_java_bindir - it seems you passed a wrong --with-java.]) fi if test ! -x "$kde_cv_java_bindir/javah"; then AC_MSG_ERROR([javah not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.]) fi if test ! -x "$kde_cv_java_bindir/jar"; then AC_MSG_ERROR([jar not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.]) fi if test ! -r "$kde_cv_java_includedir/jni.h"; then AC_MSG_ERROR([jni.h not found under $kde_cv_java_includedir. Use --with-java or --without-java.]) fi if test ! -r "$kde_java_libjvmdir/libjvm.so"; then AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.]) fi if test ! -r "$kde_java_libhpidir/libhpi.so"; then AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.]) fi jni_includes="-I$kde_cv_java_includedir" dnl Strange thing, jni.h requires jni_md.h which is under genunix here.. dnl and under linux here.. test -d "$kde_cv_java_includedir/linux" && jni_includes="$jni_includes -I$kde_cv_java_includedir/linux" test -d "$kde_cv_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_cv_java_includedir/genunix" dnl Check for JNI version AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_cxxflags_safe="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $all_includes $jni_includes" AC_TRY_COMPILE([ #include ], [ #ifndef JNI_VERSION_1_2 Syntax Error #endif ],[ kde_jni_works=yes ], [ kde_jni_works=no ]) if test $kde_jni_works = no; then AC_MSG_ERROR([Incorrect version of $kde_cv_java_includedir/jni.h. You need to have Java Development Kit (JDK) version 1.2. Use --with-java to specify another location. Use --without-java to configure without java support. Or download a newer JDK and try again. See e.g. http://java.sun.com/products/jdk/1.2 ]) fi CXXFLAGS="$ac_cxxflags_safe" AC_LANG_RESTORE dnl All tests ok, inform and subst the variables AC_MSG_RESULT([javac/javah/jar in $kde_cv_java_bindir, jni.h in $kde_cv_java_includedir]) JAVAC=$kde_cv_java_bindir/javac AC_SUBST(JAVAC) JAVAH=$kde_cv_java_bindir/javah AC_SUBST(JAVAH) JAR=$kde_cv_java_bindir/jar AC_SUBST(JAR) AC_SUBST(jni_includes) JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_cv_java_libhpidir -lhpi" AC_SUBST(JVMLIBS) fi ]) c_cpp_reference-2.0.2/admin/install-sh0000644000076400001440000001273607474404675013421 #!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # 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}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true 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;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true 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` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 c_cpp_reference-2.0.2/admin/config.sub0000644000076400001440000006700507474404675013377 #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-08-13' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dsp16xx \ | fr30 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | m32r | m68000 | m68k | m88k | mcore \ | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el | mips64vr4300 \ | mips64vr4300el | mips64vr5000 | mips64vr5000el \ | mipsbe | mipsel | mipsle | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | ns16k | ns32k \ | openrisc \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | s390 | s390x \ | sh | sh[34] | sh[34]eb | shbe | shle \ | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 \ | we32k \ | x86 | xscale \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alphapca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armv*-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ | clipper-* | cray2-* | cydra-* \ | d10v-* | d30v-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | m32r-* \ | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipsel-* \ | mipsle-* | mipstx39-* | mipstx39el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | s390-* | s390x-* \ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \ | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ | v850-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [cjt]90) basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=t3e-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; windows32) basic_machine=i386-pc os=-windows32-msvcrt ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh3eb | sh4eb) basic_machine=sh-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto*) os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: c_cpp_reference-2.0.2/admin/missing0000644000076400001440000002123107474404675013002 #! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.3 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar ${1+"$@"} && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar ${1+"$@"} && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 c_cpp_reference-2.0.2/admin/ltconfig0000644000076400001440000024547407474404675013157 #! /bin/sh # ltconfig - Create a system-specific libtool. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A lot of this script is taken from autoconf-2.10. # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} echo=echo if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell. exec "$SHELL" "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`} case X$UNAME in *-DOS) PATH_SEPARATOR=';' ;; *) PATH_SEPARATOR=':' ;; esac fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string="`eval $cmd`") 2>/dev/null && echo_test_string="`eval $cmd`" && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH /usr/ucb; do if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running ltconfig again with it. ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec "${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}}" "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # The name of this program. progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` # Constants: PROGRAM=ltconfig PACKAGE=libtool VERSION=1.4a TIMESTAMP=" (1.641.2.206mm 2001/04/03 21:47:47)" ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' rm="rm -f" help="Try \`$progname --help' for more information." # Global variables: default_ofile=libtool can_build_shared=yes enable_shared=yes # All known linkers require a `.a' archive for static linking (except M$VC, # which needs '.lib'). enable_static=yes enable_fast_install=yes enable_dlopen=unknown enable_win32_dll=no pic_mode=default ltmain= silent= srcdir= ac_config_guess= ac_config_sub= host= build=NONE nonopt=NONE ofile="$default_ofile" verify_host=yes tagname= with_gcc=no with_gnu_ld=no need_locks=yes ac_ext=c libext=a cache_file= max_cmd_len= ## Dependencies to place before and after the object being linked: predep_objects= postdep_objects= predeps= postdeps= compiler_lib_search_path= ## Link characteristics: allow_undefined_flag= no_undefined_flag= need_lib_prefix=unknown need_version=unknown # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments archive_cmds= archive_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= striplib= old_striplib= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_into_libs=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported runpath_var= link_all_deplibs=unknown always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an egrep regular expression of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= ## Tools: old_AR="$AR" old_AR_FLAGS="$AR_FLAGS" old_CC="$CC" old_CFLAGS="$CFLAGS" old_CPPFLAGS="$CPPFLAGS" old_LDFLAGS="$LDFLAGS" old_LIBS="$LIBS" old_MAGIC_CMD="$MAGIC_CMD" old_LD="$LD" old_LN_S="$LN_S" old_LTCC="$LTCC" old_NM="$NM" old_RANLIB="$RANLIB" old_STRIP="$STRIP" old_AS="$AS" old_DLLTOOL="$DLLTOOL" old_OBJDUMP="$OBJDUMP" old_OBJEXT="$OBJEXT" old_EXEEXT="$EXEEXT" old_reload_flag="$reload_flag" old_deplibs_check_method="$deplibs_check_method" old_file_magic_cmd="$file_magic_cmd" # Parse the command line options. args= prev= for option do case $option in -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then eval "$prev=\$option" prev= continue fi case $option in --help) cat <&2 echo "$help" 1>&2 exit 1 ;; *) if test -z "$ltmain"; then ltmain="$option" elif test -z "$host"; then # This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 # if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then # echo "$progname: warning \`$option' is not a valid host type" 1>&2 # fi host="$option" else echo "$progname: too many arguments" 1>&2 echo "$help" 1>&2 exit 1 fi ;; esac done if test -z "$ltmain"; then echo "$progname: you must specify a LTMAIN file" 1>&2 echo "$help" 1>&2 exit 1 fi if test ! -f "$ltmain"; then echo "$progname: \`$ltmain' does not exist" 1>&2 echo "$help" 1>&2 exit 1 fi if test -n "$tagname"; then # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's/[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]//g'` in "") ;; *) echo "$progname: invalid tag name: $tagname" 1>&2 exit 1 ;; esac if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$ofile" > /dev/null; then echo "$progname: tag name $tagname already exists" 1>&2 exit 1 fi if test ! -f "$ofile"; then echo "$progname: warning: output file \`$ofile' does not exist" 1>&2 fi if test -z "$LTCC"; then eval "`$SHELL $ofile --config | grep '^LTCC='`" if test -z "$LTCC"; then echo "$progname: warning: output file \`$ofile' does not look like a libtool script" 1>&2 else echo "$progname: warning: using \`LTCC=$LTCC', extracted from \`$ofile'" 1>&2 fi fi fi # Quote any args containing shell metacharacters. ltconfig_args= for arg do case $arg in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ltconfig_args="$ltconfig_args '$arg'" ;; *) ltconfig_args="$ltconfig_args $arg" ;; esac done # A relevant subset of AC_INIT. # 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 # 5 compiler messages saved in config.log # 6 checking for... messages and results if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>>./config.log # NLS nuisances. # Only set LANG and LC_ALL to C if already set. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi if test -n "$cache_file" && test -r "$cache_file" && test -f "$cache_file"; then echo "loading cache $cache_file within ltconfig" . $cache_file fi 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 if test -z "$srcdir"; then # Assume the source directory is the same one as the path to LTMAIN. srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` test "$srcdir" = "$ltmain" && srcdir=. fi trap "$rm conftest*; exit 1" 1 2 15 if test "$verify_host" = yes; then # Check for config.guess and config.sub. ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/config.guess; then ac_aux_dir=$ac_dir break fi done if test -z "$ac_aux_dir"; then echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 echo "$help" 1>&2 exit 1 fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub # Make sure we can run config.sub. if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : else echo "$progname: cannot run $ac_config_sub" 1>&2 echo "$help" 1>&2 exit 1 fi echo $ac_n "checking host system type""... $ac_c" 1>&6 host_alias=$host case $host_alias in "") # Force config.guess to use the C compiler. # CC_FOR_BUILD overrides the CC variable in config.guess but I had # problems with it so do it this way for now. CC="$LTCC" if host_alias=`$SHELL $ac_config_guess`; then : else echo "$progname: cannot guess host type; you must specify one" 1>&2 echo "$help" 1>&2 exit 1 fi # Restore the C compiler. CC="$old_CC" ;; esac host=`$SHELL $ac_config_sub $host_alias` echo "$ac_t$host" 1>&6 # Make sure the host verified. test -z "$host" && exit 1 # Check for the build system type echo $ac_n "checking build system type... $ac_c" 1>&6 build_alias=$build case $build_alias in NONE) case $nonopt in NONE) build_alias=$host_alias ;; *) build_alias=$nonopt ;; esac ;; esac build=`$SHELL $ac_config_sub $build_alias` build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$build" 1>&6 elif test -z "$host"; then echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 echo "$help" 1>&2 exit 1 else host_alias=$host build_alias=$host_alias build=$host fi if test x"$host" != x"$build"; then ac_tool_prefix=${host_alias}- else ac_tool_prefix= fi host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # Transform linux* to *-*-linux-gnu*, to support old configure scripts. case $host_os in linux-gnu*) ;; linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` esac case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" fi # Source the script associated with the $tagname tag configuration. if test -n "$tagname"; then . $ltmain else # FIXME: We should use a variable here # Configure for a C compiler . $srcdir/ltcf-c.sh fi # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$NM" && NM=nm test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$objext" && objext=o echo $ac_n "checking for objdir... $ac_c" 1>&6 rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. objdir=_libs fi rmdir .libs 2>/dev/null echo "$ac_t$objdir" 1>&6 # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # Allow CC to be a program name with arguments. set dummy $CC compiler="$2" # We assume here that the value for ac_cv_prog_cc_pic will not be cached # in isolation, and that seeing it set (from the cache) indicates that # the associated values are set (in the cache) correctly too. echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 echo "$progname:678:checking for $compiler option to produce PIC" 1>&5 if test -z "$ac_cv_prog_cc_pic"; then echo "$ac_t"none 1>&6 else echo "$ac_t""$ac_cv_prog_cc_pic" 1>&6 # Check to make sure the pic_flag actually works. echo $ac_n "checking if $compiler PIC flag $ac_cv_prog_cc_pic works... $ac_c" 1>&6 echo "$progname:687:checking that $compiler PIC flag $ac_cv_prog_cc_pic works." 1>&5 if test "X${ac_cv_prog_cc_pic_works+set}" = Xset && \ test "X${ac_cv_prog_cc_pic_works}" != X; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_prog_cc_pic_works=yes $rm conftest* echo $lt_simple_compile_test_code > conftest.$ac_ext save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $ac_cv_prog_cc_pic -DPIC" if { (eval echo $progname:697: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then # Append any warnings to the config.log. cat conftest.err 1>&5 case $host_os in hpux9* | hpux10* | hpux11*) # On HP-UX, both CC and GCC only warn that PIC is supported... then # they create non-PIC objects. So, if there were any warnings, we # assume that PIC is not supported. if test -s conftest.err; then ac_cv_prog_cc_pic_works=no ac_cv_prog_cc_can_build_shared=no ac_cv_prog_cc_pic= else ac_cv_prog_cc_pic_works=yes ac_cv_prog_cc_pic=" $ac_cv_prog_cc_pic" fi ;; *) ac_cv_prog_cc_pic_works=yes ac_cv_prog_cc_pic=" $ac_cv_prog_cc_pic" ;; esac else # Append any errors to the config.log. cat conftest.err 1>&5 ac_cv_prog_cc_pic_works=no ac_cv_prog_cc_can_build_shared=no ac_cv_prog_cc_pic= fi CFLAGS="$save_CFLAGS" $rm conftest* fi # Belt *and* braces to stop my trousers falling down: if test "X$ac_cv_prog_cc_pic_works" = Xno; then ac_cv_prog_cc_pic= ac_cv_prog_cc_can_build_shared=no fi echo "$ac_t""$ac_cv_prog_cc_pic_works" 1>&6 fi # Check for any special shared library compilation flags. if test -n "$ac_cv_prog_cc_shlib"; then echo "$progname: warning: \`$CC' requires \`$ac_cv_prog_cc_shlib' to build shared libraries" 1>&2 if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$ac_cv_prog_cc_shlib[ ]" >/dev/null; then : else echo "$progname: add \`$ac_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" 1>&2 ac_cv_prog_cc_can_build_shared=no fi fi echo $ac_n "checking if $compiler static flag $ac_cv_prog_cc_static works... $ac_c" 1>&6 echo "$progname:749: checking if $compiler static flag $ac_cv_prog_cc_static works" >&5 if test "X${ac_cv_prog_cc_static_works+set}" = Xset && \ test "X${ac_cv_prog_cc_static_works}" != X; then echo $ac_n "(cached) $ac_c" 1>&6 else $rm conftest* echo $lt_simple_link_test_code > conftest.$ac_ext save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $ac_cv_prog_cc_static" if { (eval echo $progname:758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_static_works=yes else ac_cv_prog_cc_static_works=no ac_cv_prog_cc_static= fi LDFLAGS="$save_LDFLAGS" $rm conftest* fi # Belt *and* braces to stop my trousers falling down: if test "X$ac_cv_prog_cc_static_works" = Xno; then ac_cv_prog_cc_static= fi echo "$ac_t""$ac_cv_prog_cc_static_works" 1>&6 pic_flag="$ac_cv_prog_cc_pic" special_shlib_compile_flags="$ac_cv_prog_cc_shlib" wl="$ac_cv_prog_cc_wl" link_static_flag="$ac_cv_prog_cc_static" no_builtin_flag="$ac_cv_prog_cc_no_builtin" can_build_shared="$ac_cv_prog_cc_can_build_shared" # find the maximum length of command line arguments echo "$progname:780: finding the maximum length of command line arguments" 1>&5 echo $ac_n "finding the maximum length of command line arguments... $ac_c" 1>&6 if test "${lt_cv_sys_max_cmd_len+set}" = set; then echo $ac_n "(cached) $ac_c" 1>&6 else i=0 testring="ABCDEF" while test `$CONFIG_SHELL $0 --fallback-echo "X$testring" >/dev/null 2>&1` == `echo "X$testring" >/dev/null 2>&1` && new_result=`expr "X$testring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 32 # 1 MB should be enough do i=`expr $i + 1` testring=$testring$testring done testring= # add a significant safety factor because C++ compilers can tack on massive amounts # of additional arguments before passing them to the linker. 1/4 should be good. len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len - $len` fi echo "$progname:@lineno@: result: $lt_cv_sys_max_cmd_len" 1>&5 echo "${ac_t}$lt_cv_sys_max_cmd_len" 1>&6 if test -n $lt_cv_sys_max_cmd_len ; then max_cmd_len=$lt_cv_sys_max_cmd_len else max_cmd_len=none fi # Check to see if options -o and -c are simultaneously supported by compiler echo $ac_n "checking if $compiler supports -c -o file.$objext... $ac_c" 1>&6 if test "${lt_cv_compiler_c_o+set}" = set; then echo $ac_n "(cached) $ac_c" 1>&6 else $rm -r conftest 2>/dev/null mkdir conftest cd conftest $rm conftest* echo $lt_simple_compile_test_code > conftest.$ac_ext mkdir out # According to Tom Tromey, Ian Lance Taylor reported there are C compilers # that will create temporary files in the current directory regardless of # the output directory. Thus, making CWD read-only will cause this test # to fail, enabling locking or at least warning the user not to do parallel # builds. chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.$objext" echo "$progname:829: checking if $compiler supports -c -o file.$objext" >&5 if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$objext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then lt_cv_compiler_c_o=no else lt_cv_compiler_c_o=yes fi else # Append any errors to the config.log. cat out/conftest.err 1>&5 lt_cv_compiler_c_o=no fi CFLAGS="$save_CFLAGS" chmod u+w . $rm conftest* out/* rmdir out cd .. rmdir conftest $rm -r conftest 2>/dev/null fi compiler_c_o=$lt_cv_compiler_c_o echo "${ac_t}$compiler_c_o" 1>&6 # Check to see if we can do hard links to lock some files if needed hard_links="nottested" if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$ac_t$hard_links" 1>&6 $rm conftest* if test "$hard_links" = no; then echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 need_locks=warn fi else need_locks=no fi if test "$with_gcc" = yes; then # Check to see if options -fno-rtti -fno-exceptions are supported by compiler echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 $rm conftest* echo $lt_simple_compile_test_code > conftest.$ac_ext save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" echo "$progname:883: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 if { (eval echo $progname:884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then echo "$ac_t"no 1>&6 compiler_rtti_exceptions=no else echo "$ac_t"yes 1>&6 compiler_rtti_exceptions=yes fi else # Append any errors to the config.log. cat conftest.err 1>&5 compiler_rtti_exceptions=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* if test "$compiler_rtti_exceptions" = "yes"; then no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' else no_builtin_flag=' -fno-builtin' fi fi # See if the linker supports building shared libraries. echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 echo "$ac_t$ld_shlibs" 1>&6 test "$ld_shlibs" = no && can_build_shared=no # Check hardcoding attributes. echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var"; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$hardcode_shlibpath_var" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$ac_t$hardcode_action" 1>&6 echo $ac_n "checking whether stripping libraries is possible... $ac_c" 1>&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" echo "${ac_t}yes" 1>&6 else echo "${ac_t}no" 1>&6 fi case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' test -z "$deplibs_check_method" && deplibs_check_method=unknown # PORTME Fill in your ld.so characteristics library_names_spec= libname_spec='lib$name' soname_spec= postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}.so$major' ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH else # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. # We preserve .a as extension for shared libraries though AIX4.2 # and later linker supports .so if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so instead of # lib.a to let people know that these are not typical AIX shared libraries. library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' # We want symlinks to be created for the different names. version_type=linux else # We preserve .a as extension for shared libraries though AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}.so$major.o' fi # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | egrep '(GNU)' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' fi shlibpath_var=LIBPATH deplibs_check_method=pass_all # Put the right runpath into libraries. hardcode_into_libs=yes case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. can_build_shared=no fi ;; esac fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; bsdi4*) version_type=linux need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows need_version=no need_lib_prefix=no case $with_gcc,$host_os in yes,cygwin*) library_names_spec='$libname.dll.a' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll' postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog .libs/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll; $rm \$dlpath' ;; yes,mingw*) library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` ;; yes,pw32*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' ;; *) library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}.`test .$module = .yes && echo so || echo dylib` ${libname}${release}${major}.$`test .$module = .yes && echo so || echo dylib` ${libname}.`test .$module = .yes && echo so || echo dylib`' soname_spec='${libname}${release}${major}.`test .$module = .yes && echo so || echo dylib`' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; *) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; irix5* | irix6*) version_type=irix need_lib_prefix=no need_version=no soname_spec='${libname}${release}.so$major' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' case $host_os in irix5*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" ;; # No shared lib support for Linux oldld, aout, or coff. linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. linux-gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' need_version=yes else library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos if test "$with_gnu_ld" = yes; then need_lib_prefix=no need_version=no fi library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH # OpenBSD 2.7 the overriding is needed for fast-install shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' need_lib_prefix=no library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_version=no soname_spec='${libname}${release}.so' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; sco3.2v5*) version_type=osf soname_spec='${libname}${release}.so$major' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; uts4*) version_type=linux library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; *) dynamic_linker=no ;; esac echo "$ac_t$dynamic_linker" 1>&6 test "$dynamic_linker" = no && can_build_shared=no # Check for command to grab the raw symbol name followed by C symbol from nm. echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform the above into a raw symbol and a C symbol. symxfrm='\1 \2\3 \3' # Transform an extracted symbol line into a proper C declaration global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" ;; irix*) symcode='[BCDEGRST]' ;; solaris* | sysv5*) symcode='[BDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $host_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then symcode='[ABCDGISTW]' fi # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Write the raw and C identifiers. global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no $rm conftest* cat > conftest.$ac_ext <&5 if { (eval echo $progname:1424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then # Now try to grab the symbols. nlist=conftest.nm if { echo "$progname:1427: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if egrep ' nm_test_var$' "$nlist" >/dev/null; then if egrep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$objext conftstm.$objext save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="conftstm.$objext" CFLAGS="$CFLAGS$no_builtin_flag" if { (eval echo $progname:1479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then pipe_works=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi LIBS="$save_LIBS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi $rm conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else global_symbol_pipe= fi done if test "$pipe_works" = yes; then echo "${ac_t}ok" 1>&6 else echo "${ac_t}failed" 1>&6 fi if test -z "$global_symbol_pipe"; then global_symbol_to_cdecl= fi # Report the final consequences. echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 # Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in # configure.in, otherwise build static only libraries. case $host_os in cygwin* | mingw* | pw32* | os2*) if test x$can_build_shared = xyes; then test x$enable_win32_dll = xno && can_build_shared=no echo "checking if package supports dlls... $can_build_shared" 1>&6 fi ;; esac echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) test "$enable_shared" = yes && enable_static=no ;; esac echo "$ac_t$enable_shared" 1>&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "checking whether to build static libraries... $enable_static" 1>&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$with_gcc" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi # Check whether we must set pic_mode to default test -z "$pic_flag" && pic_mode=default if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else if test "X${lt_cv_dlopen+set}" != Xset; then lt_cv_dlopen=no lt_cv_dlopen_libs= echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 echo "$progname:1583: checking for dlopen in -ldl" >&5 if test "X${ac_cv_lib_dl_dlopen+set}" = Xset; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_lib_dl_dlopen=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_lib_dl_dlopen=no fi rm -f conftest* LIBS="$ac_save_LIBS" fi if test "X$ac_cv_lib_dl_dlopen" = Xyes; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen""... $ac_c" 1>&6 echo "$progname:1622: checking for dlopen" >&5 if test "X${ac_cv_func_dlopen+set}" = Xset; 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. */ #ifdef __cplusplus extern "C" #endif char dlopen(); 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_dlopen) || defined (__stub___dlopen) choke me #else dlopen(); #endif ; return 0; } EOF if { (eval echo $progname:1652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_dlopen=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_func_dlopen=no fi rm -f conftest* fi if test "X$ac_cv_func_dlopen" = Xyes; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dlopen" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6 echo "$progname:1669: checking for dlopen in -lsvld" >&5 if test "X${ac_cv_lib_svld_dlopen+set}" = Xset; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lsvld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_lib_svld_dlopen=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_lib_svld_dlopen=no fi rm -f conftest* LIBS="$ac_save_LIBS" fi if test "X$ac_cv_lib_svld_dlopen" = Xyes; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 echo "$progname:1708: checking for dld_link in -ldld" >&5 if test "X${ac_cv_lib_dld_dld_link+set}" = Xset; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_lib_dld_dld_link=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_lib_dld_dld_link=no fi rm -f conftest* LIBS="$ac_save_LIBS" fi if test "X$ac_cv_lib_dld_dld_link" = Xyes; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for shl_load""... $ac_c" 1>&6 echo "$progname:1747: checking for shl_load" >&5 if test "X${ac_cv_func_shl_load+set}" = Xset; 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. */ #ifdef __cplusplus extern "C" #endif char shl_load(); 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_shl_load) || defined (__stub___shl_load) choke me #else shl_load(); #endif ; return 0; } EOF if { (eval echo $progname:1777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_shl_load=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_func_shl_load=no fi rm -f conftest* fi if test "X$ac_cv_func_shl_load" = Xyes; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="shl_load" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 echo "$progname:1795: checking for shl_load in -ldld" >&5 if test "X${ac_cv_lib_dld_shl_load+set}" = Xset; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_lib_dld_shl_load=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_lib_dld_shl_load=no fi rm -f conftest* LIBS="$ac_save_LIBS" fi if test "X$ac_cv_lib_dld_shl_load" = Xyes; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else echo "$ac_t""no" 1>&6 fi fi fi fi fi fi fi if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) for ac_hdr in dlfcn.h; do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "$progname:1863: checking for $ac_hdr" >&5 if eval "test \"`echo 'X$''{'ac_cv_header_$ac_safe'+set}'`\" = Xset"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int fnord = 0; int main () { return(0); } EOF ac_try="$ac_compile >/dev/null 2>conftest.out" { (eval echo $progname:1874: \"$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 "$progname: 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 else echo "$ac_t""no" 1>&6 fi done if test "x$ac_cv_header_dlfcn_h" = xyes; then CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" fi eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" LIBS="$lt_cv_dlopen_libs $LIBS" echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 echo "$progname:1902: checking whether a program can dlopen itself" >&5 if test "X${lt_cv_dlopen_self+set}" = Xset; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then lt_cv_dlopen_self=cross else cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LTDL_GLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LTDL_GLOBAL DL_GLOBAL # else # define LTDL_GLOBAL 0 # endif #endif /* We may have to define LTDL_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LTDL_LAZY_OR_NOW # ifdef RTLD_LAZY # define LTDL_LAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LTDL_LAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LTDL_LAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LTDL_LAZY_OR_NOW DL_NOW # else # define LTDL_LAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42; } int main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); return 1;} EOF if { (eval echo $progname:1957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then lt_cv_dlopen_self=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* lt_cv_dlopen_self=no fi rm -fr conftest* fi fi echo "$ac_t""$lt_cv_dlopen_self" 1>&6 if test "$lt_cv_dlopen_self" = yes; then LDFLAGS="$LDFLAGS $link_static_flag" echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 echo "$progname:1976: checking whether a statically linked program can dlopen itself" >&5 if test "X${lt_cv_dlopen_self_static+set}" = Xset; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then lt_cv_dlopen_self_static=cross else cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LTDL_GLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LTDL_GLOBAL DL_GLOBAL # else # define LTDL_GLOBAL 0 # endif #endif /* We may have to define LTDL_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LTDL_LAZY_OR_NOW # ifdef RTLD_LAZY # define LTDL_LAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LTDL_LAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LTDL_LAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LTDL_LAZY_OR_NOW DL_NOW # else # define LTDL_LAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42; } int main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); return 1; } EOF if { (eval echo $progname:2031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then lt_cv_dlopen_self_static=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* lt_cv_dlopen_self_static=no fi rm -fr conftest* fi fi echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 fi ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Copy echo and quote the copy, instead of the original, because it is # used later. ltecho="$echo" if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then ltecho="$CONFIG_SHELL \$0 --fallback-echo" fi LTSHELL="$SHELL" LTCONFIG_VERSION="$VERSION" # Only quote variables if we're using ltmain.sh. case $ltmain in *.sh) # Now quote all the things that may contain metacharacters. for var in ltecho old_AR old_AR_FLAGS old_CC old_LTCC old_CFLAGS old_CPPFLAGS \ old_MAGIC_CMD old_LD old_LDFLAGS old_LIBS \ old_LN_S old_NM old_RANLIB old_STRIP \ old_AS old_DLLTOOL old_OBJDUMP \ old_OBJEXT old_EXEEXT old_reload_flag \ old_deplibs_check_method old_file_magic_cmd \ AR AR_FLAGS CC LTCC LD LN_S NM LTSHELL LTCONFIG_VERSION \ reload_flag reload_cmds wl \ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ thread_safe_flag_spec whole_archive_flag_spec libname_spec \ library_names_spec soname_spec \ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ predep_objects postdep_objects predeps postdeps compiler_lib_search_path \ old_striplib striplib file_magic_cmd export_symbols_cmds \ deplibs_check_method allow_undefined_flag no_undefined_flag \ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ compiler_c_o need_locks exclude_expsyms include_expsyms; do case $var in reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ postinstall_cmds | postuninstall_cmds | \ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ### testsuite: skip nested quoting test ;; *) eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ### testsuite: skip nested quoting test ;; esac done case $ltecho in *'\$0 --fallback-echo"') ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac if test -z "$tagname"; then trap "$rm \"$ofile\"; exit 1" 1 2 15 echo "creating $ofile" $rm "$ofile" cat < "$ofile" #! $SHELL # `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. # # Copyright (C) 1996-2000 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="sed -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi # The names of the tagged configurations supported by this script. available_tags= ### BEGIN LIBTOOL CONFIG EOF else echo "appending configuration tag \"$tagname\" to $ofile" echo "### BEGIN LIBTOOL TAG CONFIG: $tagname" >> "$ofile" fi cfgfile="$ofile" ;; *) # Double-quote the variables that need it (for aesthetics). for var in old_AR old_AR_FLAGS old_CC old_LTCC old_CFLAGS old_CPPFLAGS \ old_MAGIC_CMD old_LD old_LDFLAGS old_LIBS \ old_LN_S old_NM old_RANLIB old_STRIP \ old_AS old_DLLTOOL old_OBJDUMP \ old_OBJEXT old_EXEEXT old_reload_flag \ old_deplibs_check_method old_file_magic_cmd; do eval "$var=\\\"\$var\\\"" done # Just create a config file. cfgfile="$ofile.cfg" if test -z "$tagname"; then trap "$rm \"$cfgfile\"; exit 1" 1 2 15 echo "creating $cfgfile" $rm "$cfgfile" cat < "$cfgfile" # `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) ### BEGIN LIBTOOL CONFIG EOF else echo "appending to $cfgfile" echo "### BEGIN LIBTOOL TAG CONFIG: $tagname" >> "$ofile" fi ;; esac cat <> "$cfgfile" # Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # # AR=$old_AR AR_FLAGS=$old_AR_FLAGS LTCC=$old_LTCC CC=$old_CC \\ # CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ # MAGIC_CMD=$old_MAGIC_CMD LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ # LN_S=$old_LN_S NM=$old_NM RANLIB=$old_RANLIB STRIP=$old_STRIP \\ # AS=$old_AS DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP \\ # objext=$old_OBJEXT exeext=$old_EXEEXT reload_flag=$old_reload_flag \\ # deplibs_check_method=$old_deplibs_check_method \\ # file_magic_cmd=$old_file_magic_cmd \\ # $0$ltconfig_args # # Compiler and other test output produced by $progname, useful for # debugging $progname, is in ./config.log if it exists. # The version of $progname that generated this script. LTCONFIG_VERSION=$LTCONFIG_VERSION # Shell to use when invoking shell scripts. SHELL=$LTSHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$need_lc # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host # An echo program that does not interpret backslashes. echo=$ltecho # The archiver. AR=$AR AR_FLAGS=$AR_FLAGS # A C compiler. LTCC=$LTCC # A language-specific compiler. CC=$CC # Is the compiler the GNU C compiler? with_gcc=$with_gcc # The linker used to build libraries. LD=$LD # Whether we need hard or soft links. LN_S=$LN_S # A BSD-compatible nm program. NM=$NM # A symbol stripping program STRIP=$STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$reload_flag reload_cmds=$reload_cmds # How to pass a linker flag through the compiler. wl=$wl # Object file suffix (normally "o"). objext="$objext" # Old archive suffix (normally "a"). libext="$libext" # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$pic_flag pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$compiler_c_o # Must we lock files when doing compilation ? need_locks=$need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$link_static_flag # Compiler flag to turn off builtin functions. no_builtin_flag=$no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$library_names_spec # The coded name of the library, if different from the real name. soname_spec=$soname_spec # Commands used to build and install an old-style archive. RANLIB=$RANLIB old_archive_cmds=$old_archive_cmds old_postinstall_cmds=$old_postinstall_cmds old_postuninstall_cmds=$old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. archive_cmds=$archive_cmds archive_expsym_cmds=$archive_expsym_cmds postinstall_cmds=$postinstall_cmds postuninstall_cmds=$postuninstall_cmds # Commands to strip libraries. old_striplib=$old_striplib striplib=$striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$predep_objects # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$postdep_objects # Dependencies to place before the objects being linked to create a # shared library. predeps=$predeps # Dependencies to place after the objects being linked to create a # shared library. postdeps=$postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$compiler_lib_search_path # Method to check whether dependent libraries are shared objects. deplibs_check_method=$deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$global_symbol_to_cdecl # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$hardcode_libdir_separator # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$exclude_expsyms # Symbols that must always be exported. include_expsyms=$include_expsyms EOF if test -z "$tagname"; then echo '### END LIBTOOL CONFIG' >> "$ofile" else echo "### END LIBTOOL TAG CONFIG: $tagname" >> "$ofile" fi case $ltmain in *.sh) echo >> "$ofile" if test -z "$tagname"; then case $host_os in aix3*) cat <<\EOF >> "$ofile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) cat <<'EOF' >> "$ofile" # This is a source program that is used to create dlls on Windows # Don't remove nor modify the starting and closing comments # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include # #undef WIN32_LEAN_AND_MEAN # #include # # #ifndef __CYGWIN__ # # ifdef __CYGWIN32__ # # define __CYGWIN__ __CYGWIN32__ # # endif # #endif # # #ifdef __cplusplus # extern "C" { # #endif # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); # #ifdef __cplusplus # } # #endif # # #ifdef __CYGWIN__ # #include # DECLARE_CYGWIN_DLL( DllMain ); # #endif # HINSTANCE __hDllInstance_base; # # BOOL APIENTRY # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) # { # __hDllInstance_base = hInst; # return TRUE; # } # /* ltdll.c ends here */ # This is a source program that is used to create import libraries # on Windows for dlls which lack them. Don't remove nor modify the # starting and closing comments # /* impgen.c starts here */ # /* Copyright (C) 1999-2000 Free Software Foundation, Inc. # # This file is part of GNU libtool. # # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # */ # # #include /* for printf() */ # #include /* for open(), lseek(), read() */ # #include /* for O_RDONLY, O_BINARY */ # #include /* for strdup() */ # # /* O_BINARY isn't required (or even defined sometimes) under Unix */ # #ifndef O_BINARY # #define O_BINARY 0 # #endif # # static unsigned int # pe_get16 (fd, offset) # int fd; # int offset; # { # unsigned char b[2]; # lseek (fd, offset, SEEK_SET); # read (fd, b, 2); # return b[0] + (b[1]<<8); # } # # static unsigned int # pe_get32 (fd, offset) # int fd; # int offset; # { # unsigned char b[4]; # lseek (fd, offset, SEEK_SET); # read (fd, b, 4); # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); # } # # static unsigned int # pe_as32 (ptr) # void *ptr; # { # unsigned char *b = ptr; # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); # } # # int # main (argc, argv) # int argc; # char *argv[]; # { # int dll; # unsigned long pe_header_offset, opthdr_ofs, num_entries, i; # unsigned long export_rva, export_size, nsections, secptr, expptr; # unsigned long name_rvas, nexp; # unsigned char *expdata, *erva; # char *filename, *dll_name; # # filename = argv[1]; # # dll = open(filename, O_RDONLY|O_BINARY); # if (dll < 1) # return 1; # # dll_name = filename; # # for (i=0; filename[i]; i++) # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') # dll_name = filename + i +1; # # pe_header_offset = pe_get32 (dll, 0x3c); # opthdr_ofs = pe_header_offset + 4 + 20; # num_entries = pe_get32 (dll, opthdr_ofs + 92); # # if (num_entries < 1) /* no exports */ # return 1; # # export_rva = pe_get32 (dll, opthdr_ofs + 96); # export_size = pe_get32 (dll, opthdr_ofs + 100); # nsections = pe_get16 (dll, pe_header_offset + 4 +2); # secptr = (pe_header_offset + 4 + 20 + # pe_get16 (dll, pe_header_offset + 4 + 16)); # # expptr = 0; # for (i = 0; i < nsections; i++) # { # char sname[8]; # unsigned long secptr1 = secptr + 40 * i; # unsigned long vaddr = pe_get32 (dll, secptr1 + 12); # unsigned long vsize = pe_get32 (dll, secptr1 + 16); # unsigned long fptr = pe_get32 (dll, secptr1 + 20); # lseek(dll, secptr1, SEEK_SET); # read(dll, sname, 8); # if (vaddr <= export_rva && vaddr+vsize > export_rva) # { # expptr = fptr + (export_rva - vaddr); # if (export_rva + export_size > vaddr + vsize) # export_size = vsize - (export_rva - vaddr); # break; # } # } # # expdata = (unsigned char*)malloc(export_size); # lseek (dll, expptr, SEEK_SET); # read (dll, expdata, export_size); # erva = expdata - export_rva; # # nexp = pe_as32 (expdata+24); # name_rvas = pe_as32 (expdata+32); # # printf ("EXPORTS\n"); # for (i = 0; i> "$ofile" || (rm -f "$ofile"; exit 1) # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? chmod +x "$ofile" fi ;; *) # Compile the libtool program. echo "FIXME: would compile $ltmain" ;; esac # Update the list of available tags. if test -n "$tagname"; then # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" $ofile | sed -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` # Append the new tag name to the list of available tags. available_tags="$available_tags $tagname" # Now substitute the updated of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' ${ofile} > ${ofile}.new"; then mv ${ofile}.new ${ofile} chmod +x "$ofile" else rm -f ${ofile}.new echo "$progname: unable to update list of available tagged configurations." exit 1 fi fi # Don't cache tagged configuration! test -n "$cache_file" && test -z "$tagname" || exit 0 # AC_CACHE_SAVE 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 exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: c_cpp_reference-2.0.2/admin/mkinstalldirs0000644000076400001440000000132307474404754014207 #! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.2 2002/05/27 10:26:52 tasin Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here c_cpp_reference-2.0.2/admin/am_edit.py0000644000076400001440000002731707474404754013373 import getopt, string, posixpath, sys, os, os.path, re # Some global globals... verbose = 0 thisProg = posixpath.basename(sys.argv[0]) if not thisProg: # happy only when running in xemacs ;/ thisProg = 'am_edit.py' cppsuffixes = ['cpp', 'cc', 'cxx', 'C', 'c++'] hExt = ['h', 'H', 'hh', 'hxx', 'h++'] progId = "KDE tags expanded automatically by " + thisProg use_final = 1 dryrun = 0 pathoption = 0 topdir = os.path.abspath(os.curdir) + "/" foreigndirs = [] class Makefile: def __init__(self, file): # some useful globals for the subroutines called here self.headerdirs = ['.'] self.haveAutomocTag = 0 self.programs = [] # lists the objects compiled into $program self.realobjs = {} # lists the sources used for $program self.sources = {} # lists the objects compiled when final self.finalObjs = {} # the binary name of program variable self.realname = {} # lists the idl files used for $program self.idlfiles = {} # lists all idl generated files for cleantarget self.idl_output = "" self.depedmocs = {} self.dep_files = "" self.dep_finals = "" # the targets to add self.target_adds = {} self.kdelang = "" self.makefile = file self.makefileDir = os.path.dirname(self.makefile) self.options = {} NoMakefileAmFound = "found Makefile.in without Makefile.am" def findLine(self, line): import types if type(line) is types.StringType: regexp = re.compile(line) else: regexp = line for line in self.lines: match = regexp.match(line) if match: return match def substituteLine(self, old, new): import types if type(old) is types.StringType: regexp = re.compile(old) else: regexp = old for index in range(len(self.lines)): line = self.lines[index] match = regexp.match(line) if match: line = '#>- ' + line newlines = string.split(new, '\n') self.lines[index:index+1] = [line, '#>+ %d' % len(newlines)] + newlines return def addTarget(self, target, dependson): if not self.target_adds.has_key(target): self.target_adds[target] = [dependson] else: self.target_adds[target].append(dependson) def appendLines(self, newlines): lines = string.split(newlines, '\n') + ['\n'] self.lines.extend(['#>+ %d' % len(lines)] + lines) def restore(self): index = 0 while index < len(self.lines): line = self.lines[index] if line[0:3] == '#>+': # the +1 is the comment itself linec = string.atoi(line[3:]) + 1 del self.lines[index:index+linec] continue if line[0:3] == '#>-': self.lines[index] = self.lines[index][4:] index = index + 1 def initialize(self): global foreigndirs os.chdir(self.makefileDir) self.printname = string.replace(self.makefile, topdir, "") self.makefile = os.path.basename(self.makefile) if not posixpath.exists("Makefile.am"): raise self.NoMakefileAmFound, self.makefileDir for dir in foreigndirs: if dir.match(self.makefileDir): print 'leaving ' + self.makefileDir return 0 f = open(self.makefile) self.lines = [] while 1: line = f.readline() if not line: break self.lines.append(string.rstrip(line)) f.close() # take out the self.restore() optionline = re.compile('^\s*(\w+)\s*=\s*([^\n]*)$') linecontinued = re.compile('\\\s*\n') lastline = '' index = 0 while index < len(self.lines): line = self.lines[index] if linecontinued.search(line): self.lines[index] = linecontinued.sub(' ', line) + self.lines[index+1] continue else: index = index + 1 match = optionline.search(line) if match: self.options[match.group(1)] = match.group(2) if self.options.has_key('KDE_OPTIONS'): options = string.split(self.options['KDE_OPTIONS']) if 'foreign' in options: foreigndirs.append(re.compile(self.makefileDir + "/.*")) return 0 self.cxxsuffix = "" suffixes = re.compile('^\.SUFFIXES:(.*)$') for line in self.lines: match = suffixes.match(line) if match: existing_suffixes = string.split(match.group(1)) for suffix in existing_suffixes: # leave out the . if suffix[1:] in cppsuffixes: self.cxxsuffix = suffix[1:] break if self.cxxsuffix: break search_real_programs = {} for option in self.options.keys(): if string.rfind(option, '_OBJECTS') > 0: program = option[0:string.find(option, '_OBJECTS')] objs = self.options[option] variable_in_objects = 0 objlist = string.split(objs) variable = re.compile('\$\((\w+)\)') for obj in objlist: match = variable.match(obj) if match and not match.group(1) == 'OBJEXT': variable_in_objects = 1 break if variable_in_objects: continue if len(program) > 3 and program[3] == 'am_': program = program[3:] if verbose: print "found program " + program self.programs.append(program) self.realobjs[program] = objs if self.options.has_key(program + "_SOURCES"): self.sources[program] = self.options[program + "_SOURCES"] else: self.sources[program] = "" sys.stderr.write("found program with no _SOURCES: " + program + '\n') # unmask to regexp realprogram = string.replace(program, '_', '.') search_real_programs[program] = re.compile('.*(' + realprogram + ')(\$\(EXEEXT\)?)?:.*\$\(' + program + '_OBJECTS\).*') self.realname[program] = ""; for line in self.lines: if string.find(line, '_OBJECTS') > 0: # just a random piece to not use at _every_ line for program in self.programs: match = search_real_programs[program].match(line) if match: self.realname[program] = match.group(1) def finalTouch(self): if self.options.has_key('DEPDIR'): sys.stderr.write(self.printname + " defines DEPDIR. This means you're using automake > 1.4 - this is not supported!") else: # taken out a random variable self.substituteLine('bindir\s*=.*', 'DEPDIR = .deps\nbindir = ' + self.options['bindir']) self.appendLines('cvs-clean:\n' + '\t$(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean') self.appendLines('kde-rpo-clean:\n'+ '\t-rm -f *.rpo') self.addTarget('clean', 'kde-rpo-clean') self.addAllTargets() def addAllTargets(self): for target in self.target_adds.keys(): match = self.findLine(target + ':\s*(.*)') if match: self.substituteLine(match.re, target + ': ' + string.join(self.target_adds[target]) + ' ' + match.group(1)) def writeback(self): f = open(self.makefile, 'w') for line in self.lines: f.write(line) f.write('\n') f.close() def tag_automake(self): match = self.findLine('^(.*cd \$\(top_srcdir\)\s+&&\s+\$\(AUTOMAKE\).*)$') if not match: return 1 self.substituteLine(match.re, match.group(1) + '\n' + '\tcd $(top_srcdir) && python ' + thisProg + ' ' + self.printname) def main(): global use_final, dryrun, pathoption, thisProg, verbose optlist, makefiles = getopt.getopt(sys.argv[1:], 'vhp:n', [ 'version', 'verbose', 'path=', 'help', 'no-final']) for option, param in optlist: if option == '--version': print "\n" print thisProg + "$Revision: 1.2 $" print "This is really free software, unencumbered by the GPL." print "You can do anything you like with it except sueing me." print "Copyright 1998 Kalle Dalheimer " print "Concept, design and unnecessary questions about perl" print " by Matthias Ettrich " print "" print "Making it useful by Stephan Kulow and" print "Harri Porten " print "Updated (Feb-1999), John Birch " print "Current Maintainer Stephan Kulow" sys.exit(0) if option == '--verbose' or option == '-v': verbose = 1 if option == '-p' or option == '--path': thisProg = param + "/" + thisProg if (not posixpath.exists(thisProg)): sys.stderr.write(thisProg + " doesn't exist\n") pathoption=1 if option == '--help' or option == '-h': print "Usage " + thisProg + " [OPTION] ... [dir/Makefile.in]..." print "Patches dir/Makefile.in generated from automake" print "(where dir can be a full or relative directory name)" print " -v, --verbose verbosely list files processed" print " -h, --help print this help, then exit" print " --version print version number, then exit" print " -p, --path= use the path to am_edit if the path" print " --no-final don't patch for --enable-final" print " called from is not the one to be used" sys.exit(0) if option == '--no-final': use_final = 0 if option == '-n': dryrun = 1 if not use_final: thisProg = thisProg + " --no-final" if thisProg[0] == '/' and not pathoption: sys.stderr.write( "Illegal full pathname call performed...\n" "The call to \"" + thisProg + "\"\n" "would be inserted in some Makefile.in.\n" "Please use option --path.\n") sys.exit(1) if len(makefiles) == 0: import find makefiles = find.find('Makefile.in') for index in range(len(makefiles)): if not makefiles[index][0] == '/': makefiles[index] = os.path.normcase(os.path.abspath(makefiles[index])) makefiles.sort() for file in makefiles: makefile = Makefile(file) try: makefile.initialize() makefile.tag_automake() makefile.finalTouch() makefile.writeback() except Makefile.NoMakefileAmFound, param: if verbose: print Makefile.NoMakefileAmFound + ' in ' + param main() c_cpp_reference-2.0.2/admin/ltcf-cxx.sh0000644000076400001440000011201507474404675013473 #### This script is meant to be sourced by ltconfig. # ltcf-cxx.sh - Create a C++ compiler specific configuration # # Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # Original C++ support by:Gary V. Vaughan # Alexandre Oliva # Ossama Othman # Thomas Thanner # # This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Source file extension for C++ test sources. ac_ext=cc # Object file extension for compiled C++ test sources. objext=o # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return (0); }' # C++ compiler CXX=${CXX-c++} # ltmain only uses $CC for tagged configurations so make sure $CC is set. CC=${CC-"$CXX"} CFLAGS=${CFLAGS-"$CXXFLAGS"} # Allow CC (or CXX) to be a program name with arguments. set dummy $CC compiler=$2 cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # we are optimistic. (Too optimistic if you ask me, down there we switch it # off again for most platforms ;) (MM) ld_shlibs=yes # Check if we are using GNU gcc (taken/adapted from configure script) # We need to check here since "--with-gcc" is set at configure time, # not ltconfig time! cat > conftest.$ac_ext <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then with_gcc=yes # Set up default GNU C++ configuration # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if eval "`$CC -print-prog-name=ld` --version 2>&1" | \ egrep 'GNU ld' > /dev/null; then with_gnu_ld=yes archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ egrep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' else with_gcc=no with_gnu_ld=no wlarc= fi echo "ltcf-cxx: with_gcc=$with_gcc ; with_gnu_ld=$with_gnu_ld" # PORTME: fill in a description of your system's C++ link characteristics case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs=no ;; aix4* | aix5*) archive_cmds='' hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. if test "$with_gcc" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # KDE requires run time linking. Make it the default. aix_use_runtimelinking=yes exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # Let the compiler handle the export list. always_export_symbols=no if test "$aix_use_runtimelinking" = yes; then allow_undefined_flag=' ${wl}-berok' # The following three lines along with hardcode_into_libs=yes put the correct path into libraries. hardcode_libdir_flag_spec='${wl}-blibpath:$libdir${libdir:+:}/usr/lib:/lib' archive_cmds='$CC '"$shared_flag"' $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G '"$hardcode_libdir_flag_spec"' -o $lib' archive_expsym_cmds='$CC '"$shared_flag"' $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-G '"$hardcode_libdir_flag_spec"' ${wl}'"$exp_sym_flag"':$export_symbols -o $lib' else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir${libdir:+:}/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_cmds='$CC '"$shared_flag"' $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags '"$hardcode_libdir_flag_spec"' -o $lib' archive_expsym_cmds='$CC '"$shared_flag"' $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags '"$hardcode_libdir_flag_spec"' ${wl}'"$exp_sym_flag"':$export_symbols -o $lib' else hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' # Warning - without using the other run time loading flags, -berok will # link without error, but may produce a broken library. no_undefined_flag='${wl}-bnoerok' allow_undefined_flag='${wl}-berok" # -bexpall does not export symbols beginning with underscore (_) always_export_symbols=yes # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec=' ' build_libtool_need_lc=yes # This is similar to how AIX traditionally builds it's shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs=no ;; esac ;; dgux*) case $cc_basename in ec++) # FIXME: insert proper C++ library support ld_shlibs=no ;; ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs=no ;; *) # FIXME: insert proper C++ library support ld_shlibs=no ;; esac ;; freebsd*) # FreeBSD uses GNU C++ and GNU ld skip_need_lc_check=yes remove_lgcc=yes ;; hpux*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_minus_L=yes # Not in the search PATH, but as the default # location of the library. export_dynamic_flag_spec='${wl}-E' case $cc_basename in CC) # FIXME: insert proper C++ library support ld_shlibs=no ;; aCC) case $host_os in hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmds='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$with_gcc" = yes && test "$with_gnu_ld" = no ; then # MM: for HP-UX and g++ -fPIC is needed to link pic objects together case $host_os in hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac output_verbose_link_cmds='$CC -shared -fPIC $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' remove_lgcc=yes fi if test "$with_gcc" = no ; then # FIXME: insert proper C++ library support ld_shlibs=no fi ;; esac ;; irix5* | irix6*) case $cc_basename in CC) # SGI C++ archive_cmds='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$with_gcc" = yes; then if test "$with_gnu_ld" = no; then archive_cmds='$CC -D_LANGUAGE_C_CPLUS_PLUS -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib' fi fi ;; esac hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; linux*) case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmds='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest.so 2>&1 | egrep "ld"`; rm -f libconftest.so; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' hardcode_libdir_flag_spec='${wl}--rpath,$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs' ;; cxx) # Compaq C++ archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='-rpath $libdir' hardcode_libdir_separator=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; insure) if test "$with_gcc" = yes; then # Insure++ together with gcc probably means also GNU ld # only -whole-archive isn't supported whole_archive_flag_spec="" # and we can't use -nostdlib, because bloody insure has no way to # output the linkline (-Zvm isn't working as documented), so we don't # know the depending libs. So we hope, insure gets it right anyway. archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' output_verbose_link_cmds="" fi esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs=no ;; mvs*) case $cc_basename in cxx) # FIXME: insert proper C++ library support ld_shlibs=no ;; *) # FIXME: insert proper C++ library support ld_shlibs=no ;; esac ;; netbsd*) if test "$with_gcc" = no || test "$with_gnu_ld" = no; then # This should only be triggered for NetBSD/a.out # Add in C++ constructor/destructor support if test -f /usr/pkg/lib/c++rt0/c++rt0.o.PIC; then cppopts="/usr/pkg/lib/c++rt0/c++rt0.o.PIC" elif test -f /usr/lib/c++rt0.o; then cppopts="/usr/lib/c++rt0.o" fi archive_cmds='ld -Bshareable -o $lib '"$cppopts"' $libobjs $deplibs $linkopts' fi ;; openbsd*) if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then # MM: OpenBSD 2.7 uses G++, but not GNU ld archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' old_archive_cmds="$old_archive_cmds~"'$RANLIB $oldlib' hardcode_libdir_flag_spec='${wl}-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no whole_archive_flag_spec='${wl}-Bforcearchive' remove_lgcc=yes fi ;; osf3*) if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' else case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' hardcode_libdir_separator=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs=no ;; cxx) allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) # FIXME: insert proper C++ library support ld_shlibs=no ;; esac fi ;; osf4* | osf5*) if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' no_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' archive_cmds='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"' else case $cc_basename in KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' hardcode_libdir_separator=: # Archives containing C++ object files must be created using # the KAI C++ compiler. old_archive_cmds='$CC -o $oldlib $oldobjs' ;; RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs=no ;; cxx) allow_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' no_undefined_flag=' -Wl,-expect_unresolved -Wl,\*' archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -update_registry ${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='-rpath $libdir' hardcode_libdir_separator=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) # FIXME: insert proper C++ library support ld_shlibs=no ;; esac fi ;; psos*) # FIXME: insert proper C++ library support ld_shlibs=no ;; sco*) case $cc_basename in CC) # FIXME: insert proper C++ library support ld_shlibs=no ;; *) # FIXME: insert proper C++ library support ld_shlibs=no ;; esac ;; sunos4*) case $cc_basename in CC) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs=no ;; lcc) # Lucid # FIXME: insert proper C++ library support ld_shlibs=no ;; *) # FIXME: insert proper C++ library support ld_shlibs=no ;; esac ;; solaris*) case $cc_basename in CC) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag=' -ztext' archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs=yes # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmds='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep "\-R|\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds='$CC -xar -o $oldlib $oldobjs' ;; gcx) # Green Hills C++ Compiler archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then if $CC --version | egrep -v '^2\.7' > /dev/null; then archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\"" fi hardcode_libdir_flag_spec='${wl}-R $wl$libdir' fi ;; esac ;; tandem*) case $cc_basename in NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs=no ;; *) # FIXME: insert proper C++ library support ld_shlibs=no ;; esac ;; unixware*) # FIXME: insert proper C++ library support ld_shlibs=no ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs=no ;; *) # FIXME: insert proper C++ library support ld_shlibs=no ;; esac ## Compiler Characteristics: PIC flags, static flags, etc # We don't use cached values here since only the C compiler # characteristics should be cached. ac_cv_prog_cc_pic= ac_cv_prog_cc_shlib= ac_cv_prog_cc_wl= ac_cv_prog_cc_static= ac_cv_prog_cc_no_builtin= ac_cv_prog_cc_can_build_shared=$can_build_shared ac_cv_prog_cc_pic_works= ac_cv_prog_cc_static_works= if test "$with_gcc" = yes; then ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_cv_prog_cc_static='-Bstatic' else lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; cygwin* | mingw* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). ac_cv_prog_cc_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_cv_prog_cc_pic='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all ac_cv_prog_cc_pic= ;; sysv4*MP*) if test -d /usr/nec; then ac_cv_prog_cc_pic=-Kconform_pic fi ;; *) ac_cv_prog_cc_pic='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_cv_prog_cc_static='-Bstatic' else lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68) # Green Hills C++ Compiler # ac_cv_prog_cc_static="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++) ac_cv_prog_cc_pic='-KPIC' ;; ghcx) # Green Hills C++ Compiler ac_cv_prog_cc_pic='-pic' ;; *) ;; esac ;; freebsd*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC) ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" ac_cv_prog_cc_pic='+Z' ;; aCC) ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" ac_cv_prog_cc_pic='+Z' ;; *) ;; esac ;; irix5* | irix6*) case $cc_basename in CC) ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static='-non_shared' ac_cv_prog_cc_pic='-KPIC' ;; *) ;; esac ;; linux*) case $cc_basename in KCC) # KAI C++ Compiler ac_cv_prog_cc_wl='--backend -Wl,' ac_cv_prog_cc_pic='-fPIC' ;; cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. ac_cv_prog_cc_pic= ac_cv_prog_cc_static='-non_shared' ;; *) ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx) ac_cv_prog_cc_pic='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC) ac_cv_prog_cc_wl='--backend -Wl,' ;; RCC) # Rational C++ 2.4.1 ac_cv_prog_cc_pic='-pic' ;; cxx) # Digital/Compaq C++ ac_cv_prog_cc_wl='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. ac_cv_prog_cc_pic= ac_cv_prog_cc_static='-non_shared' ;; *) ;; esac ;; psos*) ;; sco*) case $cc_basename in CC) ac_cv_prog_cc_pic='-fPIC' ;; *) ;; esac ;; solaris*) case $cc_basename in CC) # Sun C++ 4.2, 5.x and Centerline C++ ac_cv_prog_cc_pic='-KPIC' ac_cv_prog_cc_static='-Bstatic' ac_cv_prog_cc_wl='-Qoption ld ' ;; gcx) # Green Hills C++ Compiler ac_cv_prog_cc_pic='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC) # Sun C++ 4.x ac_cv_prog_cc_pic='-pic' ac_cv_prog_cc_static='-Bstatic' ;; lcc) # Lucid ac_cv_prog_cc_pic='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC) # NonStop-UX NCC 3.20 ac_cv_prog_cc_pic='-KPIC' ;; *) ;; esac ;; unixware*) ;; vxworks*) ;; *) ac_cv_prog_cc_can_build_shared=no ;; esac fi case "$host_os" in # Platforms which do not suport PIC and -DPIC is meaningless # on them: *djgpp*) ac_cv_prog_cc_pic= ;; *) ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC" ;; esac # Figure out "hidden" C++ library dependencies from verbose # compiler output whening linking a shared library. cat > conftest.$ac_ext <&5; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval $output_verbose_link_cmds`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" \ || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path"; then compiler_lib_search_path="${prev}${p}" else compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else add="${prev}${p}" if test "x$remove_lgcc" = "xyes" ; then case "$add" in -lgcc ) add="" ;; esac fi if test -n "$add" ; then if test -z "$postdeps"; then postdeps="$add" else postdeps="${postdeps} ${add}" fi fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects"; then predep_objects="$p" else predep_objects="$predep_objects $p" fi else if test -z "$postdep_objects"; then postdep_objects="$p" else postdep_objects="$postdep_objects $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out else echo "ltcf-cxx.sh: error: problem compiling test program" fi $rm -f confest.$objext if test "x$skip_need_lc_check" = "xyes" ; then need_lc=no else case " $postdeps " in *" -lc "*) need_lc=no ;; *) need_lc=yes ;; esac fi c_cpp_reference-2.0.2/admin/ltcf-gcj.sh0000644000076400001440000006411707474404675013445 #### This script is meant to be sourced by ltconfig. # ltcf-gcj.sh - Create a GCJ compiler specific configuration # # Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # Original GCJ support by: # Alexandre Oliva # # This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }' ## Linker Characteristics case $host_os in cygwin* | mingw*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$with_gcc" != yes; then with_gnu_ld=no fi ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4*) # On AIX, the GNU linker is very broken ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=yes extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~ test -f $output_objdir/impgen.exe || (cd $output_objdir && \ if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ else $CC -o impgen impgen.c ; fi)~ $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' # cygwin and mingw dlls have different entry points and sets of symbols # to exclude. # FIXME: what about values for MSVC? dll_entry=__cygwin_dll_entry@12 dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ case $host_os in mingw*) # mingw values dll_entry=_DllMainCRTStartup@12 dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ ;; esac # mingw and cygwin differ, and it's simplest to just exclude the union # of the two symbol sets. dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 # recent cygwin and mingw systems supply a stub DllMain which the user # can override, but on older systems we have to supply one (in ltdll.c) if test "x$lt_cv_need_dllmain" = "xyes"; then ltdll_obj='$output_objdir/$soname-ltdll.'"$objext " ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~ test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' else ltdll_obj= ltdll_cmds= fi # Extract the symbol export list from an `--export-all' def file, # then regenerate the def file from the symbol export list, so that # the compiled dll only exports the symbol export list. # Be careful not to strip the DATA tag left be newer dlltools. export_symbols_cmds="$ltdll_cmds"' $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is. # If DATA tags from a recent dlltool are present, honour them! archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname-def; else echo EXPORTS > $output_objdir/$soname-def; _lt_hint=1; cat $export_symbols | while read symbol; do set dummy \$symbol; case \[$]# in 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; esac; _lt_hint=`expr 1 + \$_lt_hint`; done; fi~ '"$ltdll_cmds"' $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris* | sysv5*) if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = yes; then runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' case $host_os in cygwin* | mingw*) # dlltool doesn't understand --whole-archive et. al. whole_archive_flag_spec= ;; *) # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi ;; esac fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$with_gcc" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. if test "$with_gcc" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # Test if we are trying to use run time linking, or normal AIX style linking. # If -brtl is somewhere in LDFLAGS, we need to do run time linking. aix_use_runtimelinking=no for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then aix_use_runtimelinking=yes break fi done exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # -bexpall does not export symbols beginning with underscore (_) always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other run time loading flags (-brtl), -berok will # link without error, but may produce a broken library. allow_undefined_flag=' ${wl}-berok' hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else allow_undefined_flag=' ${wl}-berok' # -bexpall does not export symbols beginning with underscore (_) always_export_symbols=yes # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec=' ' build_libtool_need_lc=yes hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' # This is similar to how AIX traditionally builds it's shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; cygwin* | mingw*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9* | hpux10* | hpux11*) case $host_os in hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; esac hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_minus_L=yes # Not in the search PATH, but as the default # location of the library. export_dynamic_flag_spec='${wl}-E' ;; irix5* | irix6*) if test "$with_gcc" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='${wl}-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; openbsd*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs=yes ;; sunos4*) archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv5*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' hardcode_libdir_flag_spec= hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4.2uw2*) archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=no hardcode_shlibpath_var=no hardcode_runpath_var=yes runpath_var=LD_RUN_PATH ;; unixware7*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi ## Compiler Characteristics: PIC flags, static flags, etc # We don't use cached values here since only the C compiler # characteristics should be cached. ac_cv_prog_cc_pic= ac_cv_prog_cc_shlib= ac_cv_prog_cc_wl= ac_cv_prog_cc_static= ac_cv_prog_cc_no_builtin= ac_cv_prog_cc_can_build_shared=$can_build_shared ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static='-static' case $host_os in beos* | irix5* | irix6* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; aix*) # Below there is a dirty hack to force normal static linking with -ldl # The problem is because libdl dynamically linked with both libc and # libC (AIX C++ library), which obviously doesn't included in libraries # list by gcc. This cause undefined symbols with -static flags. # This hack allows C programs to be linked with "-static -ldl", but # we not sure about C++ programs. ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC" ;; *djgpp*) # DJGPP does not suppot shared libraries at all ac_cv_prog_cc_pic= ;; cygwin* | mingw* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). ac_cv_prog_cc_pic='-DDLL_EXPORT' ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' ;; sysv4*MP*) if test -d /usr/nec; then ac_cv_prog_cc_pic=-Kconform_pic fi ;; *) ac_cv_prog_cc_pic='-fPIC' ;; esac # GCJ did not exist at the time GCC didn't implicitly link libc in. need_lc=no # All existing releases of GCJ support `-c -o'. lt_cv_compiler_c_o=yes c_cpp_reference-2.0.2/admin/conf.change.pl0000644000076400001440000001024007474404675014112 #!/usr/bin/perl -w # this script patches a config.status file, to use our own perl script # in the main loop # we do it this way to circumvent hacking (and thereby including) # autoconf function (which are GPL) into our LGPL acinclude.m4.in # written by Michael Matz # adapted by Dirk Mueller # we have to change two places # 1. the splitting of the substitutions into chunks of 90 (or even 48 in # later autoconf's # 2. the big main loop which patches all Makefile.in's use File::Basename; my $ac_aux_dir = dirname($0); my ($flag); local $ac_version = 0; my $vpath_seen = 0; $flag = 0; while (<>) { # usage of $flag: 0 -- we have seen nothing yet # 1 -- we are in (1) # 2 -- we have ended (1) # 3 -- we are in (2) # 4 -- we ended (2) if ($flag == 4) { print; } elsif ($flag == 0) { # 1. begins with (including): "ac_max_sed_\S+\s*=\s*[0-9]+..." # ends with (excluding) "CONFIG_FILE=..." # in later autoconf (2.14.1) there is no CONFIG_FILES= line, # but instead the (2) directly follow (1) if (/^\s*ac_max_sed_([a-z]+).*=\s*([0-9]+)/ ) { $flag = 1; if ($1 eq 'lines') { # lets hope its different with 2141, # wasn't able to verify that if ($2 eq '48') { $ac_version = 250; } else { $ac_version = 2141; } } elsif ($1 eq 'cmds') { $ac_version = 213; } # hmm, we don't know the autoconf version, but we try anyway } else { print; } } elsif ($flag == 1) { if (/^\s*CONFIG_FILES=/ && ($ac_version != 250)) { print; $flag = 2; } elsif (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) { $flag = 3; } } elsif ($flag == 2) { # 2. begins with: "for ac_file in.*CONFIG_FILES" (the next 'for' after (1)) # end with: "rm -f conftest.s\*" # on autoconf 250, it ends with '# CONFIG_HEADER section' if (/^\s*for\s+ac_file\s+in\s+.*CONFIG_FILES/ ) { $flag = 3; } else { print; } } elsif ($flag == 3) { if (/^\s*rm\s+-f\s+conftest/ ) { $flag = 4; &insert_main_loop(); } elsif (/^\s*rm\s+-f\s+.*ac_cs_root/ ) { $flag = 4; &insert_main_loop(); #die "hhhhhhh"; if ($ac_version != 2141) { print STDERR "hmm, don't know autoconf version\n"; } } elsif (/^\#\s*CONFIG_HEADER section.*/) { $flag = 4; &insert_main_loop(); if($ac_version != 250) { print STDERR "hmm, something went wrong :-(\n"; } } elsif (/VPATH/ ) { $vpath_seen = 1; } } } die "wrong input (flag != 4)" unless $flag == 4; print STDERR "hmm, don't know autoconf version\n" unless $ac_version; sub insert_main_loop { if ($ac_version == 250) { &insert_main_loop_250(); } else { &insert_main_loop_213(); } } sub insert_main_loop_250 { print <>\$tmp/subs.sed EOF } print <> \$tmp/subs.files fi done if test -f \$tmp/subs.files ; then perl $ac_aux_dir/config.pl "\$tmp/subs.sed" "\$tmp/subs.files" "\$srcdir" "\$INSTALL" fi rm -f \$tmp/subs.files fi EOF return; } sub insert_main_loop_213 { print <> \$ac_cs_root.subs EOF } print <> \$ac_cs_root.sacfiles fi done if test -f \$ac_cs_root.sacfiles ; then perl $ac_aux_dir/config.pl "\$ac_cs_root.subs" "\$ac_cs_root.sacfiles" "\$ac_given_srcdir" "\$ac_given_INSTALL" fi rm -f \$ac_cs_root.s* EOF return; } c_cpp_reference-2.0.2/admin/am_edit0000644000076400001440000020166107474404754012740 #!/usr/bin/perl -w # Expands the specialised KDE tags in Makefile.in to (hopefully) valid # make syntax. # When called without file parameters, we work recursively on all Makefile.in # in and below the current subdirectory. When called with file parameters, # only those Makefile.in are changed. # The currently supported tags are # # {program}_METASOURCES # where you have a choice of two styles # {program}_METASOURCES = name1.moc name2.moc ... [\] # {program}_METASOURCES = AUTO # The second style requires other tags as well. # # To install icons : # KDE_ICON = iconname iconname2 ... # KDE_ICON = AUTO # # For documentation : # ... # # and more new tags TBD! # # The concept (and base code) for this program came from automoc, # supplied by the following # # Matthias Ettrich (The originator) # Kalle Dalheimer (The original implementator) # Harri Porten # Alex Zepeda # David Faure # Stephan Kulow use Cwd; use File::Find; use File::Basename; # Prototype the functions sub initialise (); sub processMakefile ($); sub updateMakefile (); sub restoreMakefile (); sub removeLine ($$); sub appendLines ($); sub substituteLine ($$); sub findMocCandidates (); sub pruneMocCandidates ($); sub checkMocCandidates (); sub addMocRules (); sub tag_AUTOMAKE (); sub tag_META_INCLUDES (); sub tag_METASOURCES (); sub tag_POFILES (); sub tag_DOCFILES (); sub tag_LOCALINSTALL(); sub tag_IDLFILES(); sub tag_UIFILES(); sub tag_SUBDIRS(); sub tag_ICON(); sub tag_CLOSURE(); sub tag_DIST(); # Some global globals... $verbose = 0; # a debug flag $thisProg = "$0"; # This programs name $topdir = cwd(); # The current directory @makefiles = (); # Contains all the files we'll process @foreignfiles = (); $start = (times)[0]; # some stats for testing - comment out for release $version = "v0.2"; $errorflag = 0; $cppExt = "(cpp|cc|cxx|C|c\\+\\+)"; $hExt = "(h|H|hh|hxx|hpp|h\\+\\+)"; $progId = "KDE tags expanded automatically by " . basename($thisProg); $automkCall = "\n"; $printname = ""; # used to display the directory the Makefile is in $use_final = 1; # create code for --enable-final $cleantarget = "clean"; $dryrun = 0; $pathoption = 0; while (defined ($ARGV[0])) { $_ = shift; if (/^--version$/) { print STDOUT "\n"; print STDOUT basename($thisProg), " $version\n", "This is really free software, unencumbered by the GPL.\n", "You can do anything you like with it except sueing me.\n", "Copyright 1998 Kalle Dalheimer \n", "Concept, design and unnecessary questions about perl\n", " by Matthias Ettrich \n\n", "Making it useful by Stephan Kulow and\n", "Harri Porten \n", "Updated (Feb-1999), John Birch \n", "Current Maintainer Stephan Kulow\n\n"; exit 0; } elsif (/^--verbose$|^-v$/) { $verbose = 1; # Oh is there a problem...? } elsif (/^-p(.+)$|^--path=(.+)$/) { $thisProg = "$1/".basename($thisProg) if($1); $thisProg = "$2/".basename($thisProg) if($2); warn ("$thisProg doesn't exist\n") if (!(-f $thisProg)); $pathoption=1; } elsif (/^--help$|^-h$/) { print STDOUT "Usage $thisProg [OPTION] ... [dir/Makefile.in]...\n", "\n", "Patches dir/Makefile.in generated from automake\n", "(where dir can be a full or relative directory name)", "\n", " -v, --verbose verbosely list files processed\n", " -h, --help print this help, then exit\n", " --version print version number, then exit\n", " -p, --path= use the path to am_edit if the path\n", " --no-final don't patch for --enable-final\n", " called from is not the one to be used\n"; exit 0; } elsif (/^--no-final$/) { $use_final = 0; $thisProg .= " --no-final"; } elsif (/^-n$/) { $dryrun = 1; } else { # user selects what input files to check # add full path if relative path is given $_ = cwd()."/".$_ if (! /^\//); print "User wants $_\n" if ($verbose); push (@makefiles, $_); } } if ($thisProg =~ /^\// && !$pathoption ) { print STDERR "Illegal full pathname call performed...\n", "The call to \"$thisProg\"\nwould be inserted in some Makefile.in.\n", "Please use option --path.\n"; exit 1; } # Only scan for files when the user hasn't entered data if (!@makefiles) { print STDOUT "Scanning for Makefile.in\n" if ($verbose); find (\&add_makefile, cwd()); #chdir('$topdir'); } else { print STDOUT "Using user enter input files\n" if ($verbose); } foreach $makefile (sort(@makefiles)) { processMakefile ($makefile); last if ($errorflag); } # Just some debug statistics - comment out for release as it uses printf. printf STDOUT "Time %.2f CPU sec\n", (times)[0] - $start if ($verbose); exit $errorflag; # causes make to fail if erroflag is set #----------------------------------------------------------------------------- # In conjunction with the "find" call, this builds the list of input files sub add_makefile () { push (@makefiles, $File::Find::name) if (/Makefile.in$/); } #----------------------------------------------------------------------------- # Processes a single make file # The parameter contains the full path name of the Makefile.in to use sub processMakefile ($) { # some useful globals for the subroutines called here local ($makefile) = @_; local @headerdirs = ('.'); local $haveAutomocTag = 0; local $MakefileData = ""; local $cxxsuffix = "KKK"; local @programs = (); # lists the names of programs and libraries local $program = ""; local %realObjs = (); # lists the objects compiled into $program local %sources = (); # lists the sources used for $program local %finalObjs = (); # lists the objects compiled when final local %realname = (); # the binary name of program variable local %idlfiles = (); # lists the idl files used for $program local %globalmocs = ();# list of all mocfiles (in %mocFiles format) local %important = (); # list of files to be generated asap local %uiFiles = (); local $allidls = ""; local $idl_output = "";# lists all idl generated files for cleantarget local $ui_output = "";# lists all uic generated files for cleantarget local %depedmocs = (); local $metasourceTags = 0; local $dep_files = ""; local $dep_finals = ""; local %target_adds = (); # the targets to add local $kdelang = ""; local @cleanfiles = (); local $cleanMoc = ""; local $closure_output = ""; $makefileDir = dirname($makefile); chdir ($makefileDir); $printname = $makefile; $printname =~ s/^\Q$topdir\E\///; $makefile = basename($makefile); print STDOUT "Processing makefile $printname\n" if ($verbose); # Setup and see if we need to do this. return if (!initialise()); tag_AUTOMAKE (); # Allows a "make" to redo the Makefile.in tag_META_INCLUDES (); # Supplies directories for src locations foreach $program (@programs) { $sources_changed{$program} = 0; $depedmocs{$program} = ""; $important{$program} = ""; tag_IDLFILES(); # Sorts out idl rules tag_CLOSURE(); tag_UIFILES(); # Sorts out ui rules tag_METASOURCES (); # Sorts out the moc rules if ($sources_changed{$program}) { my $lookup = "$program" . '_SOURCES\s*=\s*(.*)'; substituteLine($lookup, "$program\_SOURCES=" . $sources{$program}); } if ($important{$program}) { local %source_dict = (); for $source (split(/[\034\s]+/, $sources{$program})) { $source_dict{$source} = 1; } for $source (@cleanfiles) { $source_dict{$source} = 0; } for $source (keys %source_dict) { next if (!$source); if ($source_dict{$source}) { # sanity check if (! -f $source) { print STDERR "Error: $source is listed in a _SOURCE line in $printname, but doesn't exist yet. Put it in DISTCLEANFILES!\n"; } else { $target_adds{"\$(srcdir)/$source"} .= $important{$program}; } } } } } if ($cleanMoc) { # Always add dist clean tag # Add extra *.moc.cpp files created for USE_AUTOMOC because they # aren't included in the normal *.moc clean rules. appendLines ("$cleantarget-metasources:\n\t-rm -f $cleanMoc\n"); $target_adds{"$cleantarget-am"} .= "$cleantarget-metasources "; } tag_DIST(); if ($idl_output) { appendLines ("$cleantarget-idl:\n\t-rm -f $idl_output\n"); $target_adds{"$cleantarget-am"} .= "$cleantarget-idl "; } if ($ui_output) { appendLines ("$cleantarget-ui:\n\t-rm -f $ui_output\n"); $target_adds{"$cleantarget-am"} .= "$cleantarget-ui "; } if ($closure_output) { appendLines ("$cleantarget-closures:\n\t-rm -f $closure_output\n"); $target_adds{"$cleantarget-am"} .= "$cleantarget-closures "; } if ($MakefileData =~ /\nKDE_LANG\s*=\s*(\S*)\s*\n/) { $kdelang = '$(KDE_LANG)' } else { $kdelang = ''; } tag_POFILES (); # language rules for po directory tag_DOCFILES (); # language rules for doc directories tag_LOCALINSTALL(); # add $(DESTDIR) before all kde_ dirs tag_ICON(); tag_SUBDIRS(); my $tmp = "force-reedit:\n"; $tmp .= "\t$automkCall\n\tcd \$(top_srcdir) && perl $thisProg $printname\n\n"; appendLines($tmp); make_meta_classes(); tag_FINAL() if (!$kdeopts{"nofinal"}); my $final_lines = "final:\n\t\$(MAKE) "; my $final_install_lines = "final-install:\n\t\$(MAKE) "; my $nofinal_lines = "no-final:\n\t\$(MAKE) "; my $nofinal_install_lines = "no-final-install:\n\t\$(MAKE) "; foreach $program (@programs) { my $lookup = "$program\_OBJECTS.*=[^\n]*"; my $new = ""; my @list = split(/[\034\s]+/, $realObjs{$program}); if (!$kdeopts{"nofinal"} && @list > 1 && $finalObjs{$program}) { $new .= "$program\_final\_OBJECTS = " . $finalObjs{$program}; $new .= "\n$program\_nofinal\_OBJECTS = " . $realObjs{$program}; $new .= "\n\@KDE_USE_FINAL_FALSE\@$program\_OBJECTS = \$($program\_nofinal\_OBJECTS)"; $new .= "\n\@KDE_USE_FINAL_TRUE\@$program\_OBJECTS = \$($program\_final\_OBJECTS)"; $final_lines .= "$program\_OBJECTS=\"\$($program\_final_OBJECTS)\" "; $final_install_lines .= "$program\_OBJECTS=\"\$($program\_final_OBJECTS)\" "; $nofinal_lines .= "$program\_OBJECTS=\"\$($program\_nofinal\_OBJECTS)\" "; $nofinal_install_lines .= "$program\_OBJECTS=\"\$($program\_nofinal_OBJECTS)\" "; } else { $new = "$program\_OBJECTS = " . $realObjs{$program}; } substituteLine ($lookup, $new); } appendLines($final_lines . "all-am"); appendLines($final_install_lines . "install-am"); appendLines($nofinal_lines . "all-am"); appendLines($nofinal_install_lines . "install-am"); my $lookup = 'DEP_FILES\s*=([^\n]*)'; if ($MakefileData =~ /\n$lookup\n/o) { $depfiles = $1; if ($dep_finals) { $lines = "\@KDE_USE_FINAL_TRUE\@DEP_FILES = $dep_files $dep_finals \034\t$depfiles\n"; $lines .= "\@KDE_USE_FINAL_FALSE\@DEP_FILES = $dep_files $depfiles\n"; } else { $lines = "DEP_FILES = $dep_files $depfiles\n"; } substituteLine($lookup, $lines); } my $cvs_lines = "cvs-clean:\n"; $cvs_lines .= "\t\$(MAKE) -f \$(top_srcdir)/admin/Makefile.common cvs-clean\n"; appendLines($cvs_lines); $cvs_lines = "kde-rpo-clean:\n"; $cvs_lines .= "\t-rm -f *.rpo\n"; appendLines($cvs_lines); $target_adds{"clean"} .= "kde-rpo-clean "; # some strange people like to do a install-exec, and expect that also # all modules are installed. automake doesn't know this, so we need to move # this here from install-data to install-exec. if ($MakefileData =~ m/\nkde_module_LTLIBRARIES\s*=/) { $target_adds{"install-exec-am"} .= "install-kde_moduleLTLIBRARIES"; my $lookup = 'install-data-am:\s*(.*)'; if ($MakefileData =~ /\n$lookup\n/) { my $newdeps = $1; $newdeps =~ s/\s*install-kde_moduleLTLIBRARIES\s*/ /g; substituteLine($lookup, "install-data-am: " . $newdeps); } } my $lines = ""; foreach $add (keys %target_adds) { my $lookup = quotemeta($add) . ':([^\n]*)'; if ($MakefileData =~ /\n$lookup\n/) { substituteLine($lookup, "$add: " . $target_adds{$add} . $1); } else { $lines .= "$add: " . $target_adds{$add} . "\n"; } } if ($lines) { appendLines($lines); } my $found = 1; while ($found) { if ($MakefileData =~ m/\n(.*)\$\(CXXFLAGS\)(.*)\n/) { my $vor = $1; # "vor" means before in German my $nach = $2; # "nach" means after in German my $lookup = quotemeta("$1\$(CXXFLAGS)$2"); my $replacement = "$1\$(KCXXFLAGS)$2"; $MakefileData =~ s/$lookup/$replacement/; $lookup =~ s/\\\$\\\(CXXFLAGS\\\)/\\\$\\\(KCXXFLAGS\\\)/; $replacement = "$vor\$(KCXXFLAGS) \$(KDE_CXXFLAGS)$nach"; substituteLine($lookup, $replacement); } else { $found = 0; } } $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=link) (\$\(CXXLD\).*\$\(KCXXFLAGS\))'; if ($MakefileData =~ m/$lookup/ ) { $MakefileData =~ s/$lookup/$1 --tag=CXX $2/; } $lookup = '(\n[^#].*\$\(LIBTOOL\) --mode=compile) (\$\(CXX\).*\$\(KCXXFLAGS\))'; if ($MakefileData =~ m/$lookup/ ) { $MakefileData =~ s/$lookup/$1 --tag=CXX $2/; } $MakefileData =~ s/\$\(KCXXFLAGS\)/\$\(CXXFLAGS\)/g; $lookup = '(.*)cp -pr \$\$/\$\$file \$\(distdir\)/\$\$file(.*)'; if ($MakefileData =~ m/\n$lookup\n/) { substituteLine($lookup, "$1cp -pr \$\$d/\$\$file \$(distdir)/\$\$file$2"); } # Always update the Makefile.in updateMakefile (); return; } #----------------------------------------------------------------------------- # Check to see whether we should process this make file. # This is where we look for tags that we need to process. # A small amount of initialising on the tags is also done here. # And of course we open and/or create the needed make files. sub initialise () { if (! -r "Makefile.am") { print STDOUT "found Makefile.in without Makefile.am\n" if ($verbose); return 0; } # Checking for files to process... open (FILEIN, $makefile) || die "Could not open $makefileDir/$makefile: $!\n"; # Read the file # stat(FILEIN)[7] might look more elegant, but is slower as it # requires stat'ing the file seek(FILEIN, 0, 2); my $fsize = tell(FILEIN); seek(FILEIN, 0, 0); read FILEIN, $MakefileData, $fsize; close FILEIN; print "DOS CRLF within $makefileDir/$makefile!\n" if($MakefileData =~ y/\r//d); # Remove the line continuations, but keep them marked # Note: we lose the trailing spaces but that's ok. $MakefileData =~ s/\\\s*\n\s*/\034/g; # If we've processed the file before... restoreMakefile () if ($MakefileData =~ /$progId/); foreach $dir (@foreignfiles) { if (substr($makefileDir,0,length($dir)) eq $dir) { return 0; } } %kdeopts = (); $kdeopts{"foreign"} = 0; $kdeopts{"qtonly"} = 0; $kdeopts{"nofinal"} = !$use_final; # default if ($MakefileData =~ /\nKDE_OPTIONS\s*=\s*([^\n]*)\n/) { local @kde_options = split(/[\s\034]/, $1); if (grep(/^foreign$/, @kde_options)) { push(@foreignfiles, $makefileDir . "/"); return 0; # don't touch me } for $opt (@kde_options) { if (!defined $kdeopts{$opt}) { print STDERR "Warning: unknown option $opt in $printname\n"; } else { $kdeopts{$opt} = 1; } } } # Look for the tags that mean we should process this file. $metasourceTags = 0; $metasourceTags++ while ($MakefileData =~ /\n[^=\#]*METASOURCES\s*=/g); my $pofileTag = 0; $pofileTag++ while ($MakefileData =~ /\nPOFILES\s*=/g); if ($pofileTag > 1) { print STDERR "Error: Only one POFILES tag allowed\n"; $errorflag = 1; } while ($MakefileData =~ /\n\.SUFFIXES:([^\n]+)\n/g) { my @list=split(' ', $1); foreach $ext (@list) { if ($ext =~ /^\.$cppExt$/) { $cxxsuffix = $ext; $cxxsuffix =~ s/\.//g; print STDOUT "will use suffix $cxxsuffix\n" if ($verbose); last; } } } while ($MakefileData =~ /\n(\S*)_OBJECTS\s*=[ \t\034]*([^\n]*)\n/g) { my $program = $1; my $objs = $2; # safe them my $ocv = 0; my @objlist = split(/[\s\034]+/, $objs); foreach $obj (@objlist) { if ($obj =~ /\$\((\S+)\)/ ) { my $variable = $1; if ($variable !~ 'OBJEXT') { $ocv = 1; } } } next if ($ocv); $program =~ s/^am_// if ($program =~ /^am_/); my $sourceprogram = $program; $sourceprogram =~ s/\@am_/\@/ if($sourceprogram =~ /^.*\@am_.+/); print STDOUT "found program $program\n" if ($verbose); push(@programs, $program); $realObjs{$program} = $objs; if ($MakefileData =~ /\n$sourceprogram\_SOURCES\s*=\s*(.*)\n/) { $sources{$program} = $1; } else { $sources{$program} = ""; print STDERR "found program with no _SOURCES: $program\n"; } my $realprogram = $program; $realprogram =~ s/_/./g; # unmask to regexp if ($MakefileData =~ /\n($realprogram)(\$\(EXEEXT\)?)?:.*\$\($program\_OBJECTS\)/) { $realname{$program} = $1; } else { # not standard Makefile - nothing to worry about $realname{$program} = ""; } } my $lookup = '\nDEPDIR\s*=.*'; if ($MakefileData !~ /($lookup)\n/o) { $lookup = '\nbindir\s*=.*'; if ($MakefileData =~ /($lookup)\n/) { substituteLine ($lookup, "DEPDIR = .deps\n$1"); } } my @marks = ('MAINTAINERCLEANFILES', 'CLEANFILES', 'DISTCLEANFILES'); foreach $mark (@marks) { while ($MakefileData =~ /\n($mark)\s*=\s*([^\n]*)/g) { foreach $file (split('[\034\s]', $2)) { $file =~ s/\.\///; push(@cleanfiles, $file); } } } my $localTag = 0; $localTag++ if ($MakefileData =~ /\ninstall-\S+-local:/); return (!$errorflag); } #----------------------------------------------------------------------------- # Gets the list of user defined directories - relative to $srcdir - where # header files could be located. sub tag_META_INCLUDES () { my $lookup = '[^=\n]*META_INCLUDES\s*=\s*(.*)'; return 1 if ($MakefileData !~ /($lookup)\n/o); print STDOUT "META_INCLUDE processing <$1>\n" if ($verbose); my $headerStr = $2; removeLine ($lookup, $1); $headerStr =~ tr/\034/ /; my @headerlist = split(' ', $headerStr); foreach $dir (@headerlist) { $dir =~ s#\$\(srcdir\)#.#; if (! -d $dir) { print STDERR "Warning: $dir can't be found. ", "Must be a relative path to \$(srcdir)\n"; } else { push (@headerdirs, $dir); } } return 0; } #----------------------------------------------------------------------------- sub tag_FINAL() { my @final_names = (); foreach $program (@programs) { if ($sources{$program} =~ /\(/) { print STDOUT "found ( in $program\_SOURCES. skipping\n" if ($verbose); next; } my $mocsources = ""; my @progsources = split(/[\s\034]+/, $sources{$program}); my %sourcelist = (); foreach $source (@progsources) { my $suffix = $source; $suffix =~ s/^.*\.([^\.]+)$/$1/; if (defined($sourcelist{$suffix})) { $sourcelist{$suffix} .= " " . $source; } else { $sourcelist{$suffix} .= $source; } } foreach $suffix (keys %sourcelist) { # See if this file contains c++ code. (ie Just check the files suffix against my $suffix_is_cxx = 0; if($suffix =~ /($cppExt)$/) { $cxxsuffix = $1; $suffix_is_cxx = 1; } my $mocfiles_in = ($suffix eq $cxxsuffix) && defined($depedmocs{$program}); my @sourcelist = split(/[\s\034]+/, $sourcelist{$suffix}); if ((@sourcelist == 1 && !$mocfiles_in) || $suffix_is_cxx != 1 ) { # we support IDL on our own if ($suffix =~ /^skel$/ || $suffix =~ /^stub/ || $suffix =~ /^h$/ || $suffix =~ /^ui$/ ) { next; } foreach $file (@sourcelist) { $file =~ s/\Q$suffix\E$//; $finalObjs{$program} .= $file; if ($program =~ /_la$/) { $finalObjs{$program} .= "lo "; } else { $finalObjs{$program} .= "o "; } } next; # suffix } my $source_deps = ""; foreach $source (@sourcelist) { if (-f $source) { $source_deps .= "\$(srcdir)/$source "; } else { $source_deps .= "$source "; } } $handling = "$program.all_$suffix.$suffix: \$(srcdir)/Makefile.in " . $source_deps . " "; if ($mocfiles_in) { $handling .= $depedmocs{$program}; foreach $mocfile (split(' ', $depedmocs{$program})) { if ($mocfile =~ m/\.$suffix$/) { $mocsources .= " " . $mocfile; } } } $handling .= "\n"; $handling .= "\t\@echo 'creating $program.all_$suffix.$suffix ...'; \\\n"; $handling .= "\trm -f $program.all_$suffix.files $program.all_$suffix.final; \\\n"; $handling .= "\techo \"#define KDE_USE_FINAL 1\" >> $program.all_$suffix.final; \\\n"; $handling .= "\tfor file in " . $sourcelist{$suffix} . " $mocsources; do \\\n"; $handling .= "\t echo \"#include \\\"\$\$file\\\"\" >> $program.all_$suffix.files; \\\n"; $handling .= "\t test ! -f \$\(srcdir\)/\$\$file || egrep '^#pragma +implementation' \$\(srcdir\)/\$\$file >> $program.all_$suffix.final; \\\n"; $handling .= "\tdone; \\\n"; $handling .= "\tcat $program.all_$suffix.final $program.all_$suffix.files > $program.all_$suffix.$suffix; \\\n"; $handling .= "\trm -f $program.all_$suffix.final $program.all_$suffix.files\n"; appendLines($handling); push(@final_names, "$program.all_$suffix.$suffix"); $finalObjs{$program} .= "$program.all_$suffix."; if ($program =~ /_la$/) { $finalObjs{$program} .= "lo "; } else { $finalObjs{$program} .= "o "; } } } if (!$kdeopts{"nofinal"} && @final_names >= 1) { # add clean-final target my $lines = "$cleantarget-final:\n"; $lines .= "\t-rm -f " . join(' ', @final_names) . "\n" if (@final_names); appendLines($lines); $target_adds{"$cleantarget-am"} .= "$cleantarget-final "; foreach $finalfile (@final_names) { $finalfile =~ s/\.[^.]*$/.P/; $dep_finals .= " \$(DEPDIR)/$finalfile"; } } } # Organises the list of headers that we'll use to produce moc files # from. sub tag_METASOURCES () { local @newObs = (); # here we add to create object files local @deped = (); # here we add to create moc files local $mocExt = ".moc"; local %mocFiles = (); my $line = ""; my $postEqual = ""; my $lookup; my $found = ""; if ($metasourceTags > 1) { $lookup = $program . '_METASOURCES\s*=\s*(.*)'; return 1 if ($MakefileData !~ /\n($lookup)\n/); $found = $1; } else { $lookup = $program . '_METASOURCES\s*=\s*(.*)'; if ($MakefileData !~ /\n($lookup)\n/) { $lookup = 'METASOURCES\s*=\s*(.*)'; return 1 if ($MakefileData !~ /\n($lookup)\n/o); $found = $1; $metasourceTags = 0; # we can use the general target only once } else { $found = $1; } } print STDOUT "METASOURCE processing <$found>)\n" if ($verbose); $postEqual = $found; $postEqual =~ s/[^=]*=//; removeLine ($lookup, $found); # Always find the header files that could be used to "moc" return 1 if (findMocCandidates ()); if ($postEqual =~ /AUTO\s*(\S*)|USE_AUTOMOC\s*(\S*)/) { print STDERR "$printname: the argument for AUTO|USE_AUTOMOC is obsolete" if ($+); $mocExt = ".moc.$cxxsuffix"; $haveAutomocTag = 1; } else { # Not automoc so read the list of files supplied which # should be .moc files. $postEqual =~ tr/\034/ /; # prune out extra headers - This also checks to make sure that # the list is valid. pruneMocCandidates ($postEqual); } checkMocCandidates (); if (@newObs) { my $ext = ($program =~ /_la$/) ? ".moc.lo " : ".moc.o "; $realObjs{$program} .= "\034" . join ($ext, @newObs) . $ext; $depedmocs{$program} = join (".moc.$cxxsuffix " , @newObs) . ".moc.$cxxsuffix"; foreach $file (@newObs) { $dep_files .= " \$(DEPDIR)/$file.moc.P" if($dep_files !~/$file.moc.P/); } } if (@deped) { $depedmocs{$program} .= " "; $depedmocs{$program} .= join('.moc ', @deped) . ".moc"; $depedmocs{$program} .= " "; } addMocRules (); @globalmocs{keys %mocFiles}=values %mocFiles; } #----------------------------------------------------------------------------- # Returns 0 if the line was processed - 1 otherwise. # Errors are logged in the global $errorflags sub tag_AUTOMAKE () { my $lookup = '.*cd \$\(top_srcdir\)\s+&&[\s\034]+\$\(AUTOMAKE\)(.*)'; return 1 if ($MakefileData !~ /\n($lookup)\n/); print STDOUT "AUTOMAKE processing <$1>\n" if ($verbose); my $newLine = $1."\n\tcd \$(top_srcdir) && perl $thisProg $printname"; substituteLine ($lookup, $newLine); $automkCall = $1; return 0; } #----------------------------------------------------------------------------- sub handle_TOPLEVEL() { my $pofiles = ""; my @restfiles = (); opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if (-d $entry); next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/ || $entry =~ /.gmo$/); if ($entry =~ /\.po$/) { next; } push(@restfiles, $entry); } closedir (THISDIR); if (@restfiles) { $target_adds{"install-data-am"} .= "install-nls-files "; $lines = "install-nls-files:\n"; $lines .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/$kdelang\n"; for $file (@restfiles) { $lines .= "\t\$(INSTALL_DATA) \$\(srcdir\)/$file \$(DESTDIR)\$(kde_locale)/$kdelang/$file\n"; } $target_adds{"uninstall"} .= "uninstall-nls-files "; $lines .= "uninstall-nls-files:\n"; for $file (@restfiles) { $lines .= "\t-rm -f \$(DESTDIR)\$(kde_locale)/$kdelang/$file\n"; } appendLines($lines); } return 0; } #----------------------------------------------------------------------------- sub tag_SUBDIRS () { if ($MakefileData !~ /\nSUBDIRS\s*=\s*\$\(AUTODIRS\)\s*\n/) { return 1; } my $subdirs = "."; opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if ($entry eq "CVS" || $entry =~ /^\./); if (-d $entry && -f $entry . "/Makefile.am") { $subdirs .= " $entry"; next; } } closedir (THISDIR); my $lines = "SUBDIRS =$subdirs\n"; substituteLine('SUBDIRS\s*=.*', $lines); return 0; } sub tag_IDLFILES () { my @psources = split(/[\034\s]+/, $sources{$program}); my $dep_lines = ""; my @cppFiles = (); foreach $source (@psources) { my $skel = ($source =~ m/\.skel$/); if ($source =~ m/\.stub$/ || $skel) { my $qs = quotemeta($source); $sources{$program} =~ s/$qs//; $sources_changed{$program} = 1; print STDOUT "adding IDL file $source\n" if ($verbose); $source =~ s/\.(stub|skel)$//; my $sourcename; if ($skel) { $sourcename = "$source\_skel"; } else { $sourcename = "$source\_stub"; } my $sourcedir = ''; if (-f "$makefileDir/$source.h") { $sourcedir = '$(srcdir)/'; } else { if ($MakefileData =~ /\n$source\_DIR\s*=\s*(\S+)\n/) { $sourcedir = $1; $sourcedir .= "/" if ($sourcedir !~ /\/$/); } } if ($allidls !~ /$source\_kidl/) { $dep_lines .= "$source.kidl: $sourcedir$source.h \$(DCOPIDL_DEPENDENCIES)\n"; $dep_lines .= "\t\$(DCOPIDL) $sourcedir$source.h > $source.kidl || ( rm -f $source.kidl ; /bin/false )\n"; $allidls .= $source . "_kidl "; } if ($allidls !~ /$sourcename/) { if ($skel) { $dep_lines .= "$sourcename.$cxxsuffix: $source.kidl\n"; $dep_lines .= "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-stub $source.kidl\n"; } else { $target_adds{"$sourcename.$cxxsuffix"} .= "$sourcename.h "; $dep_lines .= "$sourcename.h: $source.kidl\n"; $dep_lines .= "\t\$(DCOPIDL2CPP) --c++-suffix $cxxsuffix --no-skel $source.kidl\n"; } $allidls .= $sourcename . " "; } $idlfiles{$program} .= $sourcename . " "; if ($program =~ /_la$/) { $realObjs{$program} .= " $sourcename.lo"; } else { $realObjs{$program} .= " $sourcename.\$(OBJEXT)"; } $sources{$program} .= " $sourcename.$cxxsuffix"; $sources_changed{$program} = 1; $important{$program} .= "$sourcename.h " if (!$skel); $idl_output .= "\\\n\t$sourcename.$cxxsuffix $sourcename.h $source.kidl "; push(@cleanfiles, "$sourcename.$cxxsuffix"); push(@cleanfiles, "$sourcename.h"); push(@cleanfiles, "$sourcename.kidl"); $dep_files .= " \$(DEPDIR)/$sourcename.P" if ($dep_files !~/$sourcename.P/); } } if ($dep_lines) { appendLines($dep_lines); } if (0) { my $lookup = "($program)"; $lookup .= '(|\$\(EXEEXT\))'; $lookup =~ s/\_/./g; $lookup .= ":(.*..$program\_OBJECTS..*)"; # $lookup = quotemeta($lookup); if ($MakefileData =~ /\n$lookup\n/) { my $line = "$1$2: "; foreach $file (split(' ', $idlfiles{$program})) { $line .= "$file.$cxxsuffix "; } $line .= $3; substituteLine($lookup, $line); } else { print STDERR "no built dependency found $lookup\n"; } } } sub tag_UIFILES () { my @psources = split(/[\034\s]+/, $sources{$program}); my $dep_lines = ""; my @depFiles = (); foreach $source (@psources) { if ($source =~ m/\.ui$/) { print STDERR "adding UI file $source\n" if ($verbose); my $qs = quotemeta($source); $sources{$program} =~ s/$qs//; $sources_changed{$program} = 1; $source =~ s/\.ui$//; my $sourcedir = ''; if (-f "$makefileDir/$source.ui") { $sourcedir = '$(srcdir)/'; } if (!$uiFiles{$source}) { $dep_lines .= "$source.$cxxsuffix: $sourcedir$source.ui $source.h $source.moc\n"; $dep_lines .= "\trm -f $source.$cxxsuffix\n"; if (!$kdeopts{"qtonly"}) { $dep_lines .= "\techo '#include ' > $source.$cxxsuffix\n"; $dep_lines .= "\t\$(UIC) -tr \${UIC_TR} -i $source.h $sourcedir$source.ui | sed -e \"s,\${UIC_TR}( \\\"\\\" ),QString::null,g\" | sed -e \"s,\${UIC_TR}( \\\"\\\"\\, \\\"\\\" ),QString::null,g\" >> $source.$cxxsuffix || rm -f $source.$cxxsuffix\n"; } else { $dep_lines .= "\t\$(UIC) -i $source.h $sourcedir$source.ui > $source.$cxxsuffix || rm -f $source.$cxxsuffix\n"; } $dep_lines .= "\techo '#include \"$source.moc\"' >> $source.$cxxsuffix\n\n"; $dep_lines .= "$source.h: $sourcedir$source.ui\n"; $dep_lines .= "\t\$(UIC) -o $source.h $sourcedir$source.ui\n\n"; $dep_lines .= "$source.moc: $source.h\n"; $dep_lines .= "\t\$(MOC) $source.h -o $source.moc\n"; $uiFiles{$source} = 1; $depedmocs{$program} .= " $source.moc"; $globalmocs{$source} = "\035$source.h\035$source.cpp"; } if ($program =~ /_la$/) { $realObjs{$program} .= " $source.lo"; } else { $realObjs{$program} .= " $source.\$(OBJEXT)"; } $sources{$program} .= " $source.$cxxsuffix"; $sources_changed{$program} = 1; $important{$program} .= "$source.h "; $ui_output .= "\\\n\t$source.$cxxsuffix $source.h $source.moc "; push(@cleanfiles, "$source.$cxxsuffix"); push(@cleanfiles, "source.h"); push(@cleanfiles, "$source.moc"); $dep_files .= " \$(DEPDIR)/$source.P" if($dep_files !~/$source.P/ ); } } if ($dep_lines) { appendLines($dep_lines); } } sub tag_ICON() { my $lookup = '([^\s]*)_ICON\s*=\s*([^\n]*)'; my $install = ""; my $uninstall = ""; while ($MakefileData =~ /\n$lookup/og) { my $destdir; if ($1 eq "KDE") { $destdir = "kde_icondir"; } else { $destdir = $1 . "dir"; } my $iconauto = ($2 =~ /AUTO\s*$/); my @appnames = (); if ( ! $iconauto ) { my @_appnames = split(" ", $2); print STDOUT "KDE_ICON processing <@_appnames>\n" if ($verbose); foreach $appname (@_appnames) { push(@appnames, quotemeta($appname)); } } else { print STDOUT "KDE_ICON processing \n" if ($verbose); } my @files = (); opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); next if (! -f $entry); if ( $iconauto ) { push(@files, $entry) if ($entry =~ /\.xpm/ || $entry =~ /\.png/); } else { foreach $appname (@appnames) { push(@files, $entry) if ($entry =~ /-$appname\.xpm/ || $entry =~ /-$appname\.png/); } } } closedir (THISDIR); my %directories = (); foreach $file (@files) { my $newfile = $file; my $prefix = $file; $prefix =~ s/\.(png|xpm)$//; my $appname = $prefix; $appname =~ s/^[^-]+-// if ($appname =~ /-/) ; $appname =~ s/^[^-]+-// if ($appname =~ /-/) ; $appname = quotemeta($appname); $prefix =~ s/$appname$//; $prefix =~ s/-$//; $prefix = 'lo16-app' if ($prefix eq 'mini'); $prefix = 'lo32-app' if ($prefix eq 'lo'); $prefix = 'hi48-app' if ($prefix eq 'large'); $prefix .= '-app' if ($prefix =~ m/^...$/); my $type = $prefix; $type =~ s/^.*-([^-]+)$/$1/; $prefix =~ s/^(.*)-[^-]+$/$1/; my %type_hash = ( 'action' => 'actions', 'app' => 'apps', 'device' => 'devices', 'filesys' => 'filesystems', 'mime' => 'mimetypes' ); if (! defined $type_hash{$type} ) { print STDERR "unknown icon type $type in $printname ($file)\n"; next; } my %dir_hash = ( 'los' => 'locolor/16x16', 'lom' => 'locolor/32x32', 'him' => 'hicolor/32x32', 'hil' => 'hicolor/48x48', 'lo16' => 'locolor/16x16', 'lo22' => 'locolor/22x22', 'lo32' => 'locolor/32x32', 'hi16' => 'hicolor/16x16', 'hi22' => 'hicolor/22x22', 'hi32' => 'hicolor/32x32', 'hi48' => 'hicolor/48x48', 'hi64' => 'hicolor/64x64', 'hisc' => 'hicolor/scalable' ); $newfile =~ s@.*-($appname\.(png|xpm?))@$1@; if (! defined $dir_hash{$prefix}) { print STDERR "unknown icon prefix $prefix in $printname\n"; next; } my $dir = $dir_hash{$prefix} . "/" . $type_hash{$type}; if ($newfile =~ /-[^\.]/) { my $tmp = $newfile; $tmp =~ s/^([^-]+)-.*$/$1/; $dir = $dir . "/" . $tmp; $newfile =~ s/^[^-]+-//; } if (!defined $directories{$dir}) { $install .= "\t\$(mkinstalldirs) \$(DESTDIR)\$($destdir)/$dir\n"; $directories{$dir} = 1; } $install .= "\t\$(INSTALL_DATA) \$(srcdir)/$file \$(DESTDIR)\$($destdir)/$dir/$newfile\n"; $uninstall .= "\t-rm -f \$(DESTDIR)\$($destdir)/$dir/$newfile\n"; } } if (length($install)) { $target_adds{"install-data-am"} .= "install-kde-icons "; $target_adds{"uninstall-am"} .= "uninstall-kde-icons "; appendLines("install-kde-icons:\n" . $install . "\nuninstall-kde-icons:\n" . $uninstall); } } sub handle_POFILES($$) { my @pofiles = split(" ", $_[0]); my $lang = $_[1]; # Build rules for creating the gmo files my $tmp = ""; my $allgmofiles = ""; my $pofileLine = "POFILES ="; foreach $pofile (@pofiles) { $pofile =~ /(.*)\.[^\.]*$/; # Find name minus extension $tmp .= "$1.gmo: $pofile\n"; $tmp .= "\trm -f $1.gmo; \$(GMSGFMT) -o $1.gmo \$(srcdir)/$pofile\n"; $tmp .= "\ttest ! -f $1.gmo || touch $1.gmo\n"; $allgmofiles .= " $1.gmo"; $pofileLine .= " $1.po"; } appendLines ($tmp); my $lookup = 'POFILES\s*=([^\n]*)'; if ($MakefileData !~ /\n$lookup/o) { appendLines("$pofileLine\nGMOFILES =$allgmofiles"); } else { substituteLine ($lookup, "$pofileLine\nGMOFILES =$allgmofiles"); } if ($allgmofiles) { # Add the "clean" rule so that the maintainer-clean does something appendLines ("clean-nls:\n\t-rm -f $allgmofiles\n"); $target_adds{"maintainer-clean"} .= "clean-nls "; $lookup = 'DISTFILES\s*=\s*(.*)'; if ($MakefileData =~ /\n$lookup\n/o) { $tmp = "DISTFILES = \$(GMOFILES) \$(POFILES) $1"; substituteLine ($lookup, $tmp); } } $target_adds{"install-data-am"} .= "install-nls "; $tmp = "install-nls:\n"; if ($lang) { $tmp .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES\n"; } $tmp .= "\t\@for base in "; foreach $pofile (@pofiles) { $pofile =~ /(.*)\.[^\.]*$/; # Find name minus extension $tmp .= "$1 "; } $tmp .= "; do \\\n"; if ($lang) { $tmp .= "\t echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n"; $tmp .= "\t test ! -f \$\$base.gmo || \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/\$\$base.mo ;\\\n" } else { $tmp .= "\t echo \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n"; $tmp .= "\t \$(mkinstalldirs) \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES ; \\\n"; $tmp .= "\t test ! -f \$\$base.gmo || \$(INSTALL_DATA) \$\$base.gmo \$(DESTDIR)\$(kde_locale)/\$\$base/LC_MESSAGES/\$(PACKAGE).mo ;\\\n"; } $tmp .= "\tdone\n\n"; appendLines ($tmp); $target_adds{"uninstall"} .= "uninstall-nls "; $tmp = "uninstall-nls:\n"; foreach $pofile (@pofiles) { $pofile =~ /(.*)\.[^\.]*$/; # Find name minus extension if ($lang) { $tmp .= "\trm -f \$(DESTDIR)\$(kde_locale)/$lang/LC_MESSAGES/$1.mo\n"; } else { $tmp .= "\trm -f \$(DESTDIR)\$(kde_locale)/$1/LC_MESSAGES/\$(PACKAGE).mo\n"; } } appendLines($tmp); $target_adds{"all"} .= "all-nls "; $tmp = "all-nls: \$(GMOFILES)\n"; appendLines($tmp); $target_adds{"distdir"} .= "distdir-nls "; $tmp = "distdir-nls:\$(GMOFILES)\n"; $tmp .= "\tfor file in \$(POFILES); do \\\n"; $tmp .= "\t cp \$(srcdir)/\$\$file \$(distdir); \\\n"; $tmp .= "\tdone\n"; $tmp .= "\tfor file in \$(GMOFILES); do \\\n"; $tmp .= "\t cp \$(srcdir)/\$\$file \$(distdir); \\\n"; $tmp .= "\tdone\n"; appendLines ($tmp); if (!$lang) { appendLines("merge:\n\t\$(MAKE) -f \$(top_srcdir)/admin/Makefile.common package-merge POFILES=\"\${POFILES}\" PACKAGE=\${PACKAGE}\n\n"); } } #----------------------------------------------------------------------------- # Returns 0 if the line was processed - 1 otherwise. # Errors are logged in the global $errorflags sub tag_POFILES () { my $lookup = 'POFILES\s*=([^\n]*)'; return 1 if ($MakefileData !~ /\n$lookup/o); print STDOUT "POFILES processing <$1>\n" if ($verbose); my $tmp = $1; # make sure these are all gone. if ($MakefileData =~ /\n\.po\.gmo:\n/) { print STDERR "Warning: Found old .po.gmo rules in $printname. New po rules not added\n"; return 1; } # Either find the pofiles in the directory (AUTO) or use # only the specified po files. my $pofiles = ""; if ($tmp =~ /^\s*AUTO\s*$/) { opendir (THISDIR, "."); $pofiles = join(" ", grep(/\.po$/, readdir(THISDIR))); closedir (THISDIR); print STDOUT "pofiles found = $pofiles\n" if ($verbose); if (-f "charset" && -f "kdelibs.po") { handle_TOPLEVEL(); } } else { $tmp =~ s/\034/ /g; $pofiles = $tmp; } return 1 if (!$pofiles); # Nothing to do handle_POFILES($pofiles, $kdelang); return 0; } sub helper_LOCALINSTALL($) { my $lookup = "\n" . $_[0] . ":"; if ($MakefileData =~ /($lookup)/) { my $install = $MakefileData; $install =~ s/\n/\035/g; $install =~ s/.*\035$_[0]:[^\035]*\035//; my $emptyline = 0; while (! $emptyline) { if ($install =~ /([^\035]*)\035(.*)/) { local $line = $1; $install = $2; if ($line !~ /^\s*$/ && $line !~ /^(\@.*\@)*\t/) { $emptyline = 1; } else { replaceDestDir($line); } } else { $emptyline = 1; } } } } sub tag_LOCALINSTALL () { helper_LOCALINSTALL('install-exec-local'); helper_LOCALINSTALL('install-data-local'); helper_LOCALINSTALL('uninstall-local'); return 0; } sub replaceDestDir($) { local $line = $_[0]; if ( $line =~ /^\s*(\@.*\@)*\s*\$\(mkinstalldirs\)/ || $line =~ /^\s*(\@.*\@)*\s*\$\(INSTALL\S*\)/ || $line =~ /^\s*(\@.*\@)*\s*(-?rm.*) \S*$/) { $line =~ s/^(.*) ([^\s]*)\s*$/$1 \$(DESTDIR)$2/ if ($line !~ /\$\(DESTDIR\)/); } if ($line ne $_[0]) { $_[0] = quotemeta $_[0]; substituteLine($_[0], $line); } } #--------------------------------------------------------------------------- sub tag_CLOSURE () { return if ($program !~ /_la$/); my $lookup = quotemeta($realname{$program}) . ":.*?\n\t.*?\\((.*?)\\) .*\n"; $MakefileData =~ m/$lookup/; return if ($1 !~ /CXXLINK/); if ($MakefileData !~ /\n$program\_LDFLAGS\s*=.*-no-undefined/ && $MakefileData !~ /\n$program\_LDFLAGS\s*=.*KDE_PLUGIN/ ) { print STDERR "Report: $program contains undefined in $printname\n" if ($program =~ /^lib/ && $dryrun); return; } my $closure = $realname{$program} . ".closure"; my $lines = "$closure: \$($program\_OBJECTS) \$($program\_DEPENDENCIES)\n"; $lines .= "\t\@echo \"int main() {return 0;}\" > $program\_closure.$cxxsuffix\n"; $lines .= "\t\@\$\(LTCXXCOMPILE\) -c $program\_closure.$cxxsuffix\n"; $lines .= "\t\$\(CXXLINK\) $program\_closure.lo \$($program\_LDFLAGS) \$($program\_OBJECTS) \$($program\_LIBADD) \$(LIBS)\n"; $lines .= "\t\@rm -f $program\_closure.* $closure\n"; $lines .= "\t\@echo \"timestamp\" > $closure\n"; $lines .= "\n"; appendLines($lines); $lookup = $realname{$program} . ": (.*)"; if ($MakefileData =~ /\n$lookup\n/) { $lines = "\@KDE_USE_CLOSURE_TRUE@". $realname{$program} . ": $closure $1"; $lines .= "\n\@KDE_USE_CLOSURE_FALSE@" . $realname{$program} . ": $1"; substituteLine($lookup, $lines); } $closure_output .= " $closure"; } sub tag_DIST () { my %foundfiles = (); opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile$$/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); next if (! -f $entry); next if ($entry =~ /\.moc/ || $entry =~ /\.lo$/ || $entry =~ /\.la$/ || $entry =~ /\.o/); next if ($entry =~ /.+meta_unload.$cppExt$/ || $entry =~ /\.all_$cppExt\.$cppExt$/); $foundfiles{$entry} = 1; } closedir (THISDIR); my @marks = ("EXTRA_DIST", "DIST_COMMON", '\S*_SOURCES', '\S*_HEADERS', 'MAINTAINERCLEANFILES', 'CLEANFILES', 'DISTCLEANFILES', '\S*_OBJECTS'); foreach $mark (@marks) { while ($MakefileData =~ /\n($mark)\s*=\s*([^\n]*)/g) { foreach $file (split('[\034\s]', $2)) { $file =~ s/\.\///; $foundfiles{$file} = 0 if (defined $foundfiles{$file}); } } } my @files = ("Makefile", "config.cache", "config.log", "stamp-h", "stamp-h1", "stamp-h1", "config.h", "Makefile", "config.status", "config.h", "libtool"); foreach $file (@files) { $foundfiles{$file} = 0 if (defined $foundfiles{$file}); } my $KDE_DIST = ""; foreach $file (keys %foundfiles) { if ($foundfiles{$file} == 1) { $KDE_DIST .= "$file "; } } if ($KDE_DIST) { print "KDE_DIST $printname $KDE_DIST\n" if ($verbose); my $lookup = "DISTFILES *=(.*)"; if ($MakefileData =~ /\n$lookup\n/o) { substituteLine($lookup, "KDE_DIST=$KDE_DIST\n\nDISTFILES=$1 \$(KDE_DIST)\n"); } } } #----------------------------------------------------------------------------- # Returns 0 if the line was processed - 1 otherwise. # Errors are logged in the global $errorflags sub tag_DOCFILES () { # if ($MakefileData =~ /\nSUBDIRS\s*=/) { # subdirs # $MakefileData =~ /\n(.*-recursive:\s*)\n/; # my $orig_rules = $1; # my $rules = $orig_rules; # $rules =~ s/:\s*$//; # substituteLine($orig_rules, "$rules docs-recursive:"); # appendLines("docs: docs-recursive docs-am\n"); # } else { # appendLines("docs: docs-am\n"); # } $target_adds{"all"} .= "docs-am "; my $lookup = 'KDE_DOCS\s*=\s*([^\n]*)'; goto nodocs if ($MakefileData !~ /\n$lookup/o); print STDOUT "KDE_DOCS processing <$1>\n" if ($verbose); my $tmp = $1; # Either find the files in the directory (AUTO) or use # only the specified po files. my $files = ""; my $appname = $tmp; $appname =~ s/^(\S*)\s*.*$/$1/; if ($appname =~ /AUTO/) { $appname = basename($makefileDir); if ("$appname" eq "en") { print STDERR "Error: KDE_DOCS = AUTO relies on the directory name. Yours is 'en' - you most likely want something else, e.g. KDE_DOCS = myapp\n"; exit(1); } } if ($tmp !~ / - /) { opendir (THISDIR, "."); foreach $entry (readdir(THISDIR)) { next if ($entry eq "CVS" || $entry =~ /^\./ || $entry =~ /^Makefile/ || $entry =~ /~$/ || $entry =~ /^\#.*\#$/); next if (! -f $entry); $files .= "$entry "; } closedir (THISDIR); print STDOUT "docfiles found = $files\n" if ($verbose); } else { $tmp =~ s/\034/ /g; $tmp =~ s/^\S*\s*-\s*//; $files = $tmp; } goto nodocs if (!$files); # Nothing to do if ($files =~ /(^| )index\.docbook($| )/) { my $lines = ""; my $lookup = 'MEINPROC\s*='; if ($MakefileData !~ /\n($lookup)/) { $lines = "MEINPROC=/\$(kde_bindir)/meinproc\n"; } $lookup = 'KDE_XSL_STYLESHEET\s*='; if ($MakefileData !~ /\n($lookup)/) { $lines .= "KDE_XSL_STYLESHEET=/\$(kde_datadir)/ksgmltools2/customization/kde-chunk.xsl\n"; } $lookup = '\nindex.cache.bz2:'; if ($MakefileData !~ /\n($lookup)/) { $lines .= "index.cache.bz2: \$(srcdir)/index.docbook \$(KDE_XSL_STYLESHEET) $files\n"; $lines .= "\t-\@if test -n \"\$(MEINPROC)\"; then echo \$(MEINPROC) --check --cache index.cache.bz2 \$(srcdir)/index.docbook; \$(MEINPROC) --check --cache index.cache.bz2 \$(srcdir)/index.docbook; fi\n"; $lines .= "\n"; } $lines .= "docs-am: index.cache.bz2\n"; $lines .= "\n"; $lines .= "install-docs: docs-am install-nls\n"; $lines .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname\n"; $lines .= "\t\@if test -f index.cache.bz2; then \\\n"; $lines .= "\techo \$(INSTALL_DATA) index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n"; $lines .= "\t\$(INSTALL_DATA) index.cache.bz2 \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/; \\\n"; $lines .= "\tfi\n"; $lines .= "\t-rm -f \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/common\n"; $lines .= "\t\$(LN_S) \$(kde_libs_htmldir)/$kdelang/common \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/common\n"; $lines .= "\n"; $lines .= "uninstall-docs:\n"; $lines .= "\t-rm -rf \$(kde_htmldir)/$kdelang/$appname\n"; $lines .= "\n"; $lines .= "clean-docs:\n"; $lines .= "\t-rm -f index.cache.bz2\n"; $lines .= "\n"; $target_adds{"install-data-am"} .= "install-docs "; $target_adds{"uninstall"} .= "uninstall-docs "; $target_adds{"clean-am"} .= "clean-docs "; appendLines ($lines); } else { appendLines("docs-am: $files\n"); } $target_adds{"install-data-am"} .= "install-nls"; $target_adds{"uninstall"} .= "uninstall-nls "; $tmp = "install-nls:\n"; $tmp .= "\t\$(mkinstalldirs) \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname\n"; $tmp .= "\t\@for base in $files; do \\\n"; $tmp .= "\t echo \$(INSTALL_DATA) \$\$base \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n"; $tmp .= "\t \$(INSTALL_DATA) \$(srcdir)/\$\$base \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n"; $tmp .= "\tdone\n"; if ($appname eq 'common') { $tmp .= "\t\@echo \"merging common and language specific dir\" ;\\\n"; $tmp .= "\tif test ! -e \$(kde_htmldir)/en/common/kde-common.css; then echo 'no english docs found in \$(kde_htmldir)/en/common/'; exit 1; fi \n"; $tmp .= "\t\@com_files=`cd \$(kde_htmldir)/en/common && echo *` ;\\\n"; $tmp .= "\tcd \$(DESTDIR)\$(kde_htmldir)/$kdelang/common ;\\\n"; $tmp .= "\tif test -n \"\$\$com_files\"; then for p in \$\$com_files ; do \\\n"; $tmp .= "\t case \" $files \" in \\\n"; $tmp .= "\t *\" \$\$p \"*) ;; \\\n"; $tmp .= "\t *) test ! -e \$\$p && echo \$(LN_S) ../../en/common/\$\$p \$(DESTDIR)\$(kde_htmldir)/$kdelang/common/\$\$p && \$(LN_S) ../../en/common/\$\$p \$\$p ;; \\\n"; $tmp .= "\t esac ; \\\n"; $tmp .= "\tdone ; fi ; true\n"; } $tmp .= "\n"; $tmp .= "uninstall-nls:\n"; $tmp .= "\tfor base in $files; do \\\n"; $tmp .= "\t rm -f \$(DESTDIR)\$(kde_htmldir)/$kdelang/$appname/\$\$base ;\\\n"; $tmp .= "\tdone\n\n"; appendLines ($tmp); $target_adds{"distdir"} .= "distdir-nls "; $tmp = "distdir-nls:\n"; $tmp .= "\tfor file in $files; do \\\n"; $tmp .= "\t cp \$(srcdir)/\$\$file \$(distdir); \\\n"; $tmp .= "\tdone\n"; appendLines ($tmp); return 0; nodocs: appendLines("docs-am:\n"); return 1; } #----------------------------------------------------------------------------- # Find headers in any of the source directories specified previously, that # are candidates for "moc-ing". sub findMocCandidates () { foreach $dir (@headerdirs) { my @list = (); opendir (SRCDIR, "$dir"); @hFiles = grep { /.+\.$hExt$/o } readdir(SRCDIR); closedir SRCDIR; foreach $hf (@hFiles) { next if ($hf =~ /^\.\#/); $hf =~ /(.*)\.[^\.]*$/; # Find name minus extension next if ($uiFiles{$1}); open (HFIN, "$dir/$hf") || die "Could not open $dir/$hf: $!\n"; my $hfsize = 0; seek(HFIN, 0, 2); $hfsize = tell(HFIN); seek(HFIN, 0, 0); read HFIN, $hfData, $hfsize; close HFIN; # push (@list, $hf) if(index($hfData, "Q_OBJECT") >= 0); ### fast but doesn't handle //Q_OBJECT if ( $hfData =~ /{([^}]*)Q_OBJECT/s ) { ## handle " { friend class blah; Q_OBJECT " push (@list, $hf) unless $1 =~ m://[^\n]*Q_OBJECT[^\n]*$:s; ## handle "// Q_OBJECT" } } # The assoc array of root of headerfile and header filename foreach $hFile (@list) { $hFile =~ /(.*)\.[^\.]*$/; # Find name minus extension if ($mocFiles{$1}) { print STDERR "Warning: Multiple header files found for $1\n"; next; # Use the first one } $mocFiles{$1} = "$dir\035$hFile"; # Add relative dir } } return 0; } #----------------------------------------------------------------------------- # The programmer has specified a moc list. Prune out the moc candidates # list that we found based on looking at the header files. This generates # a warning if the programmer gets the list wrong, but this doesn't have # to be fatal here. sub pruneMocCandidates ($) { my %prunedMoc = (); local @mocList = split(' ', $_[0]); foreach $mocname (@mocList) { $mocname =~ s/\.moc$//; if ($mocFiles{$mocname}) { $prunedMoc{$mocname} = $mocFiles{$mocname}; } else { my $print = $makefileDir; $print =~ s/^\Q$topdir\E\\//; # They specified a moc file but we can't find a header that # will generate this moc file. That's possible fatal! print STDERR "Warning: No moc-able header file for $print/$mocname\n"; } } undef %mocFiles; %mocFiles = %prunedMoc; } #----------------------------------------------------------------------------- # Finds the cpp files (If they exist). # The cpp files get appended to the header file separated by \035 sub checkMocCandidates () { my @cppFiles; my $cpp2moc; # which c++ file includes which .moc files my $moc2cpp; # which moc file is included by which c++ files return unless (keys %mocFiles); opendir(THISDIR, ".") || return; @cppFiles = grep { /.+\.$cppExt$/o && !/.+\.moc\.$cppExt$/o && !/.+\.all_$cppExt\.$cppExt$/o } readdir(THISDIR); closedir THISDIR; return unless (@cppFiles); my $files = join (" ", @cppFiles); $cpp2moc = {}; $moc2cpp = {}; foreach $cxxf (@cppFiles) { open (CXXFIN, $cxxf) || die "Could not open $cxxf: $!\n"; seek(CXXFIN, 0, 2); my $cxxfsize = tell(CXXFIN); seek(CXXFIN, 0, 0); read CXXFIN, $cxxfData, $cxxfsize; close CXXFIN; while(($cxxfData =~ m/^[ \t]*\#include\s*[<\"](.*\.moc)[>\"]/gm)) { $cpp2moc->{$cxxf}->{$1} = 1; $moc2cpp->{$1}->{$cxxf} = 1; } } foreach my $mocFile (keys (%mocFiles)) { @cppFiles = keys %{$moc2cpp->{"$mocFile.moc"}}; if (@cppFiles == 1) { $mocFiles{$mocFile} .= "\035" . $cppFiles[0]; push(@deped, $mocFile); } elsif (@cppFiles == 0) { push (@newObs, $mocFile); # Produce new object file next if ($haveAutomocTag); # This is expected... # But this is an error we can deal with - let them know print STDERR "Warning: No c++ file that includes $mocFile.moc\n"; } else { # We can't decide which file to use, so it's fatal. Although as a # guess we could use the mocFile.cpp file if it's in the list??? print STDERR "Error: Multiple c++ files that include $mocFile.moc\n"; print STDERR "\t",join ("\t", @cppFiles),"\n"; $errorflag = 1; delete $mocFiles{$mocFile}; # Let's continue and see what happens - They have been told! } } } #----------------------------------------------------------------------------- # Add the rules for generating moc source from header files # For Automoc output *.moc.cpp but normally we'll output *.moc # (We must compile *.moc.cpp separately. *.moc files are included # in the appropriate *.cpp file by the programmer) sub addMocRules () { my $cppFile; my $hFile; foreach $mocFile (keys (%mocFiles)) { undef $cppFile; ($dir, $hFile, $cppFile) = split ("\035", $mocFiles{$mocFile}, 3); $dir =~ s#^\.#\$(srcdir)#; if (defined ($cppFile)) { $target_adds{"\$(srcdir)/$cppFile"} .= "$mocFile.moc "; appendLines ("$mocFile.moc: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile.moc\n"); $cleanMoc .= " $mocFile.moc"; } else { appendLines ("$mocFile$mocExt: $dir/$hFile\n\t\$(MOC) $dir/$hFile -o $mocFile$mocExt\n"); $cleanMoc .= " $mocFile$mocExt"; } } } sub make_meta_classes () { return if ($kdeopts{"qtonly"}); my $cppFile; my $hFile; my $moc_class_headers = ""; foreach $program (@programs) { my $mocs = ""; my @progsources = split(/[\s\034]+/, $sources{$program}); my @depmocs = split(' ', $depedmocs{$program}); my %shash = (), %mhash = (); @shash{@progsources} = 1; # we are only interested in the existence @mhash{@depmocs} = 1; print STDOUT "program=$program\n" if ($verbose); print STDOUT "psources=[".join(' ', keys %shash)."]\n" if ($verbose); print STDOUT "depmocs=[".join(' ', keys %mhash)."]\n" if ($verbose); print STDOUT "globalmocs=[".join(' ', keys(%globalmocs))."]\n" if ($verbose); foreach my $mocFile (keys (%globalmocs)) { undef $cppFile; ($dir, $hFile, $cppFile) = split ("\035", $globalmocs{$mocFile}, 3); $dir =~ s#^\.#\$(srcdir)#; if (defined ($cppFile)) { $mocs .= " $mocFile.moc" if exists $shash{$cppFile}; } else { # Bah. This is the case, if no C++ file includes the .moc # file. We make a .moc.cpp file for that. Unfortunately this # is not included in the %sources hash, but rather is mentioned # in %depedmocs. If the user wants to use AUTO he can't just # use an unspecific METAINCLUDES. Instead he must use # program_METAINCLUDES. Anyway, it's not working real nicely. # E.g. Its not clear what happens if user specifies two # METAINCLUDES=AUTO in the same Makefile.am. $mocs .= " $mocFile.moc.$cxxsuffix" if exists $mhash{$mocFile.".moc.$cxxsuffix"}; } } if ($mocs) { print STDOUT "==> mocs=[".$mocs."]\n" if ($verbose); my $sourcename = $program."_meta_unload"; my $ext = ($program =~ /_la$/) ? ".lo" : ".o"; my $srcfile = $sourcename.".$cxxsuffix"; my $objfile = $sourcename.$ext; $moc_class_headers .= " $srcfile"; my $appl; $appl = "$srcfile: $mocs\n"; $appl .= "\t\@echo 'creating $srcfile'\n"; $appl .= "\t\@-rm -f $srcfile\n"; $appl .= "\t\@if test \${kde_qtver} = 2; then \\\n"; $appl .= "\t\techo 'static const char * _metalist_$program\[\] = {' > $srcfile ;\\\n"; $appl .= "\t\tcat $mocs | grep 'char.*className' | "; $appl .= "sed -e 's/.*[^A-Za-z0-9_:]\\([A-Za-z0-9_:]*\\)::className.*\$\$/\\\"\\1\\\",/' | sort | uniq >> $srcfile ;\\\n"; $appl .= "\t\techo '0};' >> $srcfile ;\\\n"; $appl .= "\t\techo '#include ' >> $srcfile ;\\\n"; $appl .= "\t\techo '_UNLOAD($program)' >> $srcfile ;\\\n"; $appl .= "\telse echo > $srcfile; fi\n"; $appl .= "\n"; $realObjs{$program} .= " \034" . $objfile . " "; $sources{$program} .= " $srcfile"; $sources_changed{$program} = 1; $dep_files .= " \$(DEPDIR)/$sourcename.P" if($dep_files !~/$sourcename.P/); appendLines ($appl); } print STDOUT "\n" if $verbose; } if ($moc_class_headers) { appendLines ("$cleantarget-moc-classes:\n\t-rm -f $moc_class_headers\n"); $target_adds{"$cleantarget-am"} .= "$cleantarget-moc-classes "; } } #----------------------------------------------------------------------------- sub updateMakefile () { return if ($dryrun); open (FILEOUT, "> $makefile") || die "Could not create $makefile: $!\n"; print FILEOUT "\# $progId - " . '$Revision: 1.2 $ ' . "\n"; $MakefileData =~ s/\034/\\\n\t/g; # Restore continuation lines print FILEOUT $MakefileData; close FILEOUT; } #----------------------------------------------------------------------------- # The given line needs to be removed from the makefile # Do this by adding the special "removed line" comment at the line start. sub removeLine ($$) { my ($lookup, $old) = @_; $old =~ s/\034/\\\n#>- /g; # Fix continuation lines $MakefileData =~ s/\n$lookup/\n#>\- $old/; } #----------------------------------------------------------------------------- # Replaces the old line with the new line # old line(s) are retained but tagged as removed. The new line(s) have the # "added" tag placed before it. sub substituteLine ($$) { my ($lookup, $new) = @_; if ($MakefileData =~ /\n($lookup)/) { $old = $1; $old =~ s/\034/\\\n#>\- /g; # Fix continuation lines $new =~ s/\034/\\\n\t/g; my $newCount = ($new =~ tr/\n//) + 1; $MakefileData =~ s/\n$lookup/\n#>- $old\n#>\+ $newCount\n$new/; } else { print STDERR "Warning: substitution of \"$lookup\" in $printname failed\n"; } } #----------------------------------------------------------------------------- # Slap new lines on the back of the file. sub appendLines ($) { my ($new) = @_; $new =~ s/\034/\\\n\t/g; # Fix continuation lines my $newCount = ($new =~ tr/\n//) + 1; $MakefileData .= "\n#>\+ $newCount\n$new"; } #----------------------------------------------------------------------------- # Restore the Makefile.in to the state it was before we fiddled with it sub restoreMakefile () { $MakefileData =~ s/# $progId[^\n\034]*[\n\034]*//g; # Restore removed lines $MakefileData =~ s/([\n\034])#>\- /$1/g; # Remove added lines while ($MakefileData =~ /[\n\034]#>\+ ([^\n\034]*)/) { my $newCount = $1; my $removeLines = ""; while ($newCount--) { $removeLines .= "[^\n\034]*([\n\034]|)"; } $MakefileData =~ s/[\n\034]#>\+.*[\n\034]$removeLines/\n/; } } #----------------------------------------------------------------------------- c_cpp_reference-2.0.2/admin/libtool.m4.in0000644000076400001440000007220007474404675013723 ## libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- ## Copyright 1996, 1997, 1998, 1999, 2000, 2001 ## Free Software Foundation, Inc. ## Originally by Gordon Matzigkeit , 1996 ## ## 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ## ## As a special exception to the GNU General Public License, if you ## distribute this file as part of a program that contains a ## configuration script generated by Autoconf, you may include it under ## the same distribution terms that you use for the rest of that program. # serial 46 AC_PROG_LIBTOOL AC_DEFUN([AC_PROG_LIBTOOL], [AC_REQUIRE([_AC_PROG_LIBTOOL])dnl dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. AC_PROVIDE_IFELSE([AC_PROG_CXX], [AC_LIBTOOL_CXX], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX ])]) dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [ifdef([AC_PROG_GCJ], [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ ])]) ifdef([A][M_PROG_GCJ], [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ ])]) ifdef([LT_AC_PROG_GCJ], [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ ])])])])])]) AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # Save cache, so that ltconfig can load it AC_CACHE_SAVE # Actually configure libtool. ac_aux_dir is where install-sh is found. AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ || AC_MSG_ERROR([libtool configure failed]) # Reload cache, that may have been modified by ltconfig AC_CACHE_LOAD # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) AC_DEFUN([AC_LIBTOOL_SETUP], [AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! AC_REQUIRE([AC_OBJEXT])dnl AC_REQUIRE([AC_EXEEXT])dnl dnl # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then AC_PATH_MAGIC fi ;; esac AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(STRIP, strip, :) # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], [libtool_flags="$libtool_flags --enable-dlopen"]) ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [libtool_flags="$libtool_flags --enable-win32-dll"]) AC_ARG_ENABLE(libtool-lock, [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" AC_ARG_WITH(pic, [ --with-pic try to use only PIC/non-PIC objects [default=use both]], pic_mode="$withval", pic_mode=default) test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_SAVE AC_LANG_C AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_RESTORE]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw* | *-*-pw32*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) # recent cygwin and mingw systems supply a stub DllMain which the user # can override, but on older systems we have to supply one AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, [AC_TRY_LINK([], [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); DllMain (0, 0, 0);], [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) case $host/$CC in *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) # old mingw systems require "-dll" to link a DLL, while more recent ones # require "-mdll" SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -mdll" AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) CFLAGS="$SAVE_CFLAGS" ;; *-*-cygwin* | *-*-pw32*) # cygwin systems need to pass --dll to the linker, and not link # crt.o which will require a WinMain@16 definition. lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; esac ;; ]) esac ]) # AC_LIBTOOL_DLOPEN - enable checks for dlopen support AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN([AC_ENABLE_SHARED], [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac], enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) # AC_DISABLE_SHARED - set the default shared flag to --disable-shared AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no)]) # AC_ENABLE_STATIC - implement the --enable-static flag # Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN([AC_ENABLE_STATIC], [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac], enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) # AC_DISABLE_STATIC - set the default static flag to --disable-static AC_DEFUN([AC_DISABLE_STATIC], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no)]) # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(fast-install, changequote(<<, >>)dnl << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac], enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl ]) # AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no)]) # AC_LIBTOOL_PICMODE - implement the --with-pic flag # Usage: AC_LIBTOOL_PICMODE[(MODE)] # Where MODE is either `yes' or `no'. If omitted, it defaults to # `both'. AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl pic_mode=ifelse($#,1,$1,default)]) # AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in /*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; ?:/*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. ;; *) ac_save_MAGIC_CMD="$MAGIC_CMD" IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="ifelse([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | egrep "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$ac_save_ifs" MAGIC_CMD="$ac_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi ]) # AC_PATH_MAGIC - find a file program which can recognise a shared library AC_DEFUN([AC_PATH_MAGIC], [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) else MAGIC_CMD=: fi fi ]) # AC_PROG_LD - find the path to the GNU or non-GNU linker AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]* | [A-Za-z]:[\\/]*)] re_direlt=['/[^/][^/]*/\.\./'] # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else lt_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$lt_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_PROG_LD_GNU ]) AC_DEFUN([AC_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then lt_cv_prog_gnu_ld=yes else lt_cv_prog_gnu_ld=no fi]) with_gnu_ld=$lt_cv_prog_gnu_ld ]) # AC_PROG_LD_RELOAD_FLAG - find reload flag for linker # -- PORTME Some linkers may need a different reload flag. AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], [AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, [lt_cv_ld_reload_flag='-r']) reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" ]) # AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], [AC_CACHE_CHECK([how to recognise dependant libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [regex]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given egrep regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi4*) lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin* | mingw* |pw32*) lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in rhapsody* | darwin1.[012]) lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' ;; *) # Darwin 1.3 on lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' ;; esac ;; freebsd* ) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20*|hpux11*) lt_cv_deplibs_check_method=['file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; irix5* | irix6*) case $host_os in irix5*) # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" ;; *) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] ;; esac lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux-gnu*) case $host_cpu in alpha* | i*86 | powerpc* | sparc* | ia64* | s390* | m68k* | arm* | mips* | hppa* | sh* ) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; esac lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then [lt_cv_deplibs_check_method='file_magic NetBSD/[a-z0-9]* demand paged shared library'] else [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'] fi lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; openbsd* ) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case "$host_cpu" in i*86 ) changequote(,)dnl lt_cv_deplibs_check_method='file_magic OpenBSD/i[3-9]86 demand paged shared library' changequote([, ])dnl lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; newsos6) [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; osf3* | osf4* | osf5*) # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' lt_cv_file_magic_test_file=/shlib/libc.so lt_cv_deplibs_check_method=pass_all ;; sco3.2v5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all lt_cv_file_magic_test_file=/lib/libc.so ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) case $host_vendor in ncr) lt_cv_deplibs_check_method=pass_all ;; motorola) lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; esac ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method ]) # AC_PROG_NM - find the path to a BSD-compatible name lister AC_DEFUN([AC_PROG_NM], [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/${ac_tool_prefix}nm if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then lt_cv_path_NM="$tmp_nm -B" break elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then lt_cv_path_NM="$tmp_nm -p" break else lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi]) NM="$lt_cv_path_NM" AC_MSG_RESULT([$NM]) ]) # AC_CHECK_LIBM - check for math library AC_DEFUN([AC_CHECK_LIBM], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32*) # These system don't have libm ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, main, LIBM="-lm") ;; esac ]) # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-convenience to the # configure arguments. Note that LIBLTDL and INCLTDL are not # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not # provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed # with '${top_builddir}/' and INCLTDL will be prefixed with # '${top_srcdir}/' (note the single quotes!). If your package is not # flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case $enable_ltdl_convenience in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for # the libltdl installable library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-install to the configure # arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is # AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed # libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed # with '${top_srcdir}/' (note the single quotes!). If your package is # not flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, main, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" INCLTDL= fi ]) # If this macro is not defined by Autoconf, define it here. ifdef([AC_PROVIDE_IFELSE], [], [define([AC_PROVIDE_IFELSE], [ifdef([AC_PROVIDE_$1], [$2], [$3])])]) # AC_LIBTOOL_CXX - enable support for C++ libraries AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) AC_DEFUN([_AC_LIBTOOL_CXX], [AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" lt_save_CC="$CC" lt_save_CFLAGS="$CFLAGS" dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC dnl is set to the C++ compiler. AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" \ file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ --build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ || AC_MSG_ERROR([libtool tag configuration failed]) CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) # AC_LIBTOOL_GCJ - enable support for GCJ libraries AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) AC_DEFUN([_AC_LIBTOOL_GCJ], [AC_REQUIRE([AC_PROG_LIBTOOL]) AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" lt_save_CC="$CC" lt_save_CFLAGS="$CFLAGS" dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC dnl is set to the C++ compiler. AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" \ file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ --build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ || AC_MSG_ERROR([libtool tag configuration failed]) CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) dnl old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) dnl This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL])dnl AC_DEFUN([LT_AC_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj, no) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS) ]) c_cpp_reference-2.0.2/admin/ylwrap0000644000076400001440000000764407474404675012663 #! /bin/sh # ylwrap - wrapper for lex/yacc invocations. # Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: # ylwrap INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... # * INPUT is the input file # * OUTPUT is file PROG generates # * DESIRED is file we actually want # * PROGRAM is program to run # * ARGS are passed to PROG # Any number of OUTPUT,DESIRED pairs may be used. # The input. input="$1" shift case "$input" in [\\/]* | ?:[\\/]*) # Absolute path; do nothing. ;; *) # Relative path. Make it absolute. input="`pwd`/$input" ;; esac # The directory holding the input. input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` # Quote $INPUT_DIR so we can use it in a regexp. # FIXME: really we should care about more than `.' and `\'. input_rx=`echo "$input_dir" | sed -e 's,\\\\,\\\\\\\\,g' -e 's,\\.,\\\\.,g'` echo "got $input_rx" pairlist= while test "$#" -ne 0; do if test "$1" = "--"; then shift break fi pairlist="$pairlist $1" shift done # The program to run. prog="$1" shift # Make any relative path in $prog absolute. case "$prog" in [\\/]* | ?:[\\/]*) ;; *[\\/]*) prog="`pwd`/$prog" ;; esac # FIXME: add hostname here for parallel makes that run commands on # other machines. But that might take us over the 14-char limit. dirname=ylwrap$$ trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 mkdir $dirname || exit 1 cd $dirname $prog ${1+"$@"} "$input" status=$? if test $status -eq 0; then set X $pairlist shift first=yes # Since DOS filename conventions don't allow two dots, # the DOS version of Bison writes out y_tab.c instead of y.tab.c # and y_tab.h instead of y.tab.h. Test to see if this is the case. y_tab_nodot="no" if test -f y_tab.c || test -f y_tab.h; then y_tab_nodot="yes" fi while test "$#" -ne 0; do from="$1" # Handle y_tab.c and y_tab.h output by DOS if test $y_tab_nodot = "yes"; then if test $from = "y.tab.c"; then from="y_tab.c" else if test $from = "y.tab.h"; then from="y_tab.h" fi fi fi if test -f "$from"; then # If $2 is an absolute path name, then just use that, # otherwise prepend `../'. case "$2" in [\\/]* | ?:[\\/]*) target="$2";; *) target="../$2";; esac # Edit out `#line' or `#' directives. We don't want the # resulting debug information to point at an absolute srcdir; # it is better for it to just mention the .y file with no # path. sed -e "/^#/ s,$input_rx,," "$from" > "$target" || status=$? else # A missing file is only an error for the first file. This # is a blatant hack to let us support using "yacc -d". If -d # is not specified, we don't want an error when the header # file is "missing". if test $first = yes; then status=1 fi fi shift shift first=no done else status=$? fi # Remove the directory. cd .. rm -rf $dirname exit $status c_cpp_reference-2.0.2/admin/ltcf-c.sh0000644000076400001440000007511107474404675013120 #### This script is meant to be sourced by ltconfig. # ltcf-c.sh - Create a C compiler specific configuration # # Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This file 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='main(){return(0);}' ## Linker Characteristics case $host_os in cygwin* | mingw*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$with_gcc" != yes; then with_gnu_ld=no fi ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX, the GNU linker is very broken ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=yes extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~ test -f $output_objdir/impgen.exe || (cd $output_objdir && \ if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ else $CC -o impgen impgen.c ; fi)~ $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' # cygwin and mingw dlls have different entry points and sets of symbols # to exclude. # FIXME: what about values for MSVC? dll_entry=__cygwin_dll_entry@12 dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ case $host_os in mingw*) # mingw values dll_entry=_DllMainCRTStartup@12 dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ ;; esac # mingw and cygwin differ, and it's simplest to just exclude the union # of the two symbol sets. dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 # recent cygwin and mingw systems supply a stub DllMain which the user # can override, but on older systems we have to supply one (in ltdll.c) if test "x$lt_cv_need_dllmain" = "xyes"; then ltdll_obj='$output_objdir/$soname-ltdll.'"$objext " ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~ test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' else ltdll_obj= ltdll_cmds= fi # Extract the symbol export list from an `--export-all' def file, # then regenerate the def file from the symbol export list, so that # the compiled dll only exports the symbol export list. # Be careful not to strip the DATA tag left be newer dlltools. export_symbols_cmds="$ltdll_cmds"' $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is. # If DATA tags from a recent dlltool are present, honour them! archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname-def; else echo EXPORTS > $output_objdir/$soname-def; _lt_hint=1; cat $export_symbols | while read symbol; do set dummy \$symbol; case \[$]# in 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; esac; _lt_hint=`expr 1 + \$_lt_hint`; done; fi~ '"$ltdll_cmds"' $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' ;; darwin* | rhapsody*) allow_undefined_flag='-undefined suppress' archive_cmds='$CC `test .$module = .yes && echo -bundle || echo -dynamiclib` $allow_undefined_flag -o $lib $libobjs $deplibs $linkopts -install_name $rpath/$soname `test -n "$verstring" -a x$verstring != x0.0 && echo $verstring`' # We need to add '_' to the symbols in $export_symbols first #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' hardcode_direct=yes hardcode_shlibpath_var=no whole_archive_flag_spec='-all_load $convenience' ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris* | sysv5*) if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac case "$host_os" in freebsd*) skip_need_lc_check=yes ;; esac if test "$ld_shlibs" = yes; then runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' case $host_os in cygwin* | mingw*) # dlltool doesn't understand --whole-archive et. al. whole_archive_flag_spec= ;; *) # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi ;; esac fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$with_gcc" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. if test "$with_gcc" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # KDE requires run time linking. Make it the default. aix_use_runtimelinking=yes exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # Let the compiler handle the export list. always_export_symbols=no if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other run time loading flags (-brtl), -berok will # link without error, but may produce a broken library. allow_undefined_flag=' ${wl}-berok' # The following three lines along with hardcode_into_libs=yes put the correct path into libraries. hardcode_libdir_flag_spec='${wl}-blibpath:$libdir${libdir:+:}/usr/lib:/lib' archive_cmds='$CC '"$shared_flag"' $libobjs $deplibs $linker_flags ${wl}-G '"$hardcode_libdir_flag_spec"' -o $lib' archive_expsym_cmds='$CC '"$shared_flag"' $libobjs $deplibs $linker_flags ${wl}-G '"$hardcode_libdir_flag_spec"' ${wl}'"$exp_sym_flag"':$export_symbols -o $lib' else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir${libdir:+:}/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_cmds='$CC '"$shared_flag"' $libobjs $deplibs $linker_flags '"$hardcode_libdir_flag_spec"' -o $lib' archive_expsym_cmds='$CC '"$shared_flag"' $libobjs $deplibs $linker_flags '"$hardcode_libdir_flag_spec"' ${wl}'"$exp_sym_flag"':$export_symbols -o $lib' else allow_undefined_flag=' ${wl}-berok' # -bexpall does not export symbols beginning with underscore (_) always_export_symbols=yes # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec=' ' build_libtool_need_lc=yes hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' # This is similar to how AIX traditionally builds it's shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; cygwin* | mingw*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no skip_need_lc_check=yes ;; hpux9* | hpux10* | hpux11*) case $host_os in hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; esac hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_minus_L=yes # Not in the search PATH, but as the default # location of the library. export_dynamic_flag_spec='${wl}-E' ;; irix5* | irix6*) if test "$with_gcc" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; openbsd*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' fi hardcode_libdir_flag_spec='-rpath $libdir' hardcode_libdir_separator=: ;; sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs=yes ;; sunos4*) archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv5*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' hardcode_libdir_flag_spec= hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4.2uw2*) archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=no hardcode_shlibpath_var=no hardcode_runpath_var=yes runpath_var=LD_RUN_PATH ;; unixware7*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi ## Compiler Characteristics: PIC flags, static flags, etc if test "X${ac_cv_prog_cc_pic+set}" = Xset; then : else ac_cv_prog_cc_pic= ac_cv_prog_cc_shlib= ac_cv_prog_cc_wl= ac_cv_prog_cc_static= ac_cv_prog_cc_no_builtin= ac_cv_prog_cc_can_build_shared=$can_build_shared if test "$with_gcc" = yes; then ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_cv_prog_cc_static='-Bstatic' else lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; cygwin* | mingw* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). ac_cv_prog_cc_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_cv_prog_cc_pic='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all ac_cv_prog_cc_pic= ;; sysv4*MP*) if test -d /usr/nec; then ac_cv_prog_cc_pic=-Kconform_pic fi ;; *) ac_cv_prog_cc_pic='-fPIC' ;; esac else # PORTME Check for PIC flags for the system compiler. case $host_os in aix*) # All AIX code is PIC. ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC" ;; hpux9* | hpux10* | hpux11*) # Is there a better ac_cv_prog_cc_static that works with the bundled CC? ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" ac_cv_prog_cc_pic='+Z' ;; irix5* | irix6*) ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static='-non_shared' # PIC (with -KPIC) is the default. ;; cygwin* | mingw* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). ac_cv_prog_cc_pic='-DDLL_EXPORT' ;; newsos6) ac_cv_prog_cc_pic='-KPIC' ac_cv_prog_cc_static='-Bstatic' ;; osf3* | osf4* | osf5*) # All OSF/1 code is PIC. ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static='-non_shared' ;; sco3.2v5*) ac_cv_prog_cc_pic='-Kpic' ac_cv_prog_cc_static='-dn' ac_cv_prog_cc_shlib='-belf' ;; solaris*) ac_cv_prog_cc_pic='-KPIC' ac_cv_prog_cc_static='-Bstatic' ac_cv_prog_cc_wl='-Wl,' ;; sunos4*) ac_cv_prog_cc_pic='-PIC' ac_cv_prog_cc_static='-Bstatic' ac_cv_prog_cc_wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ac_cv_prog_cc_pic='-KPIC' ac_cv_prog_cc_static='-Bstatic' ac_cv_prog_cc_wl='-Wl,' ;; uts4*) ac_cv_prog_cc_pic='-pic' ac_cv_prog_cc_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then ac_cv_prog_cc_pic='-Kconform_pic' ac_cv_prog_cc_static='-Bstatic' fi ;; *) ac_cv_prog_cc_can_build_shared=no ;; esac fi case "$host_os" in # Platforms which do not suport PIC and -DPIC is meaningless # on them: *djgpp*) ac_cv_prog_cc_pic= ;; *) ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC" ;; esac fi need_lc=yes if test "$enable_shared" = yes && test "$with_gcc" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 need_lc=$ac_cv_archive_cmds_needs_lc elif test "x$skip_need_lc_check" = "xyes" ; then echo $ac_n "(skipping, using no) $ac_c" 1>&6 need_lc=no else $rm conftest* echo "static int dummy;" > conftest.$ac_ext if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then # Append any warnings to the config.log. cat conftest.err 1>&5 soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$ac_cv_prog_cc_wl compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then need_lc=no fi allow_undefined_flag=$save_allow_undefined_flag else cat conftest.err 1>&5 fi fi $rm conftest* echo "$ac_t$need_lc" 1>&6 ;; esac fi ac_cv_archive_cmds_needs_lc=$need_lc c_cpp_reference-2.0.2/admin/debianrules0000644000076400001440000000727007474404675013635 #!/usr/bin/perl -w use Shell qw(mv cp mkdir rm) ; use File::Find; use Cwd; $origPwd = `pwd`; chomp $origPwd; if (@ARGV && $ARGV[0] eq 'cleanup') { if (-d "debian/tmp/usr/share/config") { if (! -d "debian/tmp/$kde_confdir") { system("mv debian/tmp/usr/share/config debian/tmp/$kde_confdir"); } } system("rm -f `find debian/ -name \".anchors\"`"); system("chmod 755 debian/*preinst debian/*postinst"); exit; } $QTDIR="/usr/share/qt"; $kde_prefix="/usr"; $kde_htmldir="$kde_prefix/share/doc/kde/HTML"; $kde_icondir="$kde_prefix/share/icons"; $kde_sounddir="$kde_prefix/share/sounds"; $kde_datadir="$kde_prefix/share/apps"; $kde_locale="$kde_prefix/share/locale"; $kde_confdir="/etc/kde2"; $kde_cgidir="$kde_prefix/lib/cgi-bin"; $kde_appsdir="$kde_prefix/share/applnk"; $kde_mimedir="$kde_prefix/share/mimelnk"; $kde_wallpaperdir="$kde_prefix/share/wallpapers"; $kde_bindir="$kde_prefix/bin"; $kde_servicesdir="$kde_prefix/share/services"; $kde_servicetypesdir="$kde_prefix/share/servicetypes"; $kde_templatesdir="$kde_prefix/share/templates"; $kde_includedir="$kde_prefix/include/kde"; $kde_libdir="$kde_prefix/lib"; $kde_moduledir="$kde_prefix/lib/kde2"; $mandir="$kde_prefix/share/man"; $infodir="$kde_prefix/share/info"; $IDL="$kde_bindir/cuteidl"; $DCOPIDL="$kde_bindir/dcopidl"; $DCOPIDL2CPP="$kde_bindir/dcopidl2cpp"; $KDB2HTML="$kde_bindir/kdb2html"; $MCOPIDL="$kde_bindir/mcopidl"; $ARTSCCONFIG="$kde_bindir/artsc-config"; if (@ARGV && $ARGV[0] eq 'echodirs') { print STDOUT "export kde_htmldir=$kde_htmldir\n"; print STDOUT "export kde_appsdir=$kde_appsdir\n"; print STDOUT "export kde_icondir=$kde_icondir\n"; print STDOUT "export kde_sounddir=$kde_sounddir\n"; print STDOUT "export kde_datadir=$kde_datadir\n"; print STDOUT "export kde_cgidir=$kde_cgidir\n"; print STDOUT "export kde_locale=$kde_locale\n"; print STDOUT "export kde_confdir=$kde_confdir\n"; print STDOUT "export kde_mimedir=$kde_mimedir\n"; print STDOUT "export kde_wallpaperdir=$kde_wallpaperdir\n"; print STDOUT "export kde_bindir=$kde_bindir\n"; print STDOUT "export kde_servicesdir=$kde_servicesdir\n"; print STDOUT "export kde_servicetypesdir=$kde_servicetypesdir\n"; print STDOUT "export kde_templatesdir=$kde_templatesdir\n"; print STDOUT "export kde_includedir=$kde_includedir\n"; print STDOUT "export kde_libdir=$kde_libdir\n"; print STDOUT "export kde_moduledir=$kde_moduledir\n"; print STDOUT "export mandir=$mandir\n"; print STDOUT "export infodir=$infodir\n"; print STDOUT "export QTDIR=$QTDIR\n"; print STDOUT "export kde_prefix=$kde_prefix\n"; print STDOUT "export INSTALL_DATA=/usr/bin/install -c -p -m 644\n"; print STDOUT "export IDL=$IDL\n"; print STDOUT "export DCOPIDL=$DCOPIDL\n"; print STDOUT "export DCOPIDL2CPP=$DCOPIDL2CPP\n"; print STDOUT "export KDB2HTML=$KDB2HTML\n"; print STDOUT "export MCOPIDL=$MCOPIDL\n"; print STDOUT "export ARTSCCONFIG=$ARTSCCONFIG\n"; print STDOUT "configkde=--disable-debug --disable-rpath --prefix=\$(kde_prefix) --libexecdir=\$(kde_bindir) --libdir=\$(kde_libdir) --includedir=\$(kde_includedir) --with-qt-includes=/usr/include/qt --mandir=\$(mandir) --infodir=\$(infodir)\n"; print STDOUT "configkdevelop=--disable-debug --enable-docbase --enable-kdoc2 --disable-rpath --libdir=\$(kde_libdir) --includedir=\$(kde_includedir) --with-qt-includes=/usr/include/qt --mandir=\$(mandir) --with-kdelibsdoc-dir=/usr/share/doc/libkdecore-doc/html\n"; print STDOUT "configkdepim=--disable-debug --with-extra-includes=/usr/include/libpisock --enable-shared --disable-rpath --libdir=\$(kde_libdir) --includedir=\$(kde_includedir) --prefix=\$(kde_prefix) --libexecdir=\$(kde_bindir) --with-qt-includes=/usr/include/qt --mandir=\$(mandir) --infodir=\$(infodir)\n"; exit } c_cpp_reference-2.0.2/admin/ChangeLog0000644000076400001440000005367407474404675013200 2000-11-30 David Faure * acinclude.m4.in: Added kde_moduledir which points to $prefix/lib/kde2/ 2000-07-24 Alex Zepeda * acinclude.m4.in: Remove the test for malloc.h 2000-04-05 Michael Matz * config.pl : added kludge for compiling regexp's even if perl < 5.005 is installed * conf.change.pl : added support for autoconf 2.14.1 2000-03-27 David Faure * acinclude.m4.in, Makefile.common: changed inst-apps semantics If present, only the subdirs it lists will be configured and compiled. If absent, then subdirs is used (and inst-apps isn't generated anymore) 2000-03-22 David Faure * am_edit: Added support for KDE_ICON = AUTO 2000-03-18 David Faure * Makefile.common: Rewrote the list-of-Makefiles generation to make it simpler and nicer, using create_makefiles' way of doing it. Added support for COMPILE_LAST and COMPILE_FIRST in toplevel Makefile.am 2000-01-05 David Faure * Makefile.common: hacked around autoconf bug (setting INSTALL to ".." when calling a subconfigure and INSTALL is already set). 1999-12-15 Waldo Bastian * acinclude.m4.in: Test whether Qt compiles AND LINKS without flags. 1999-06-24 Stephan Kulow * am_edit: generate correct Makefile entries for kde-i18n toplevel directories * am_edit: 1999-06-14 Stephan Kulow * am_edit: remove idl generated files on make clean 1999-06-09 Stephan Kulow * am_edit: skipping programs with variables in sources for final 1999-06-07 Stephan Kulow * am_edit: added support for idl files 1999-06-02 Stephan Kulow * Makefile.common: preserve comments in .pot files to make it possible for programmers and translators to comment them 1999-06-02 Simon Hausmann * acinclude.m4.in: added kde_servicetypesdir 1999-06-02 David Faure * acinclude.m4.in: removed LIB_KFM and LIB_KDEUTIL aliases 1999-05-28 Simon Hausmann * acinclude.m4.in: added kde_servicesdir 1999-05-27 Stephan Kulow * am_edit: lots of changes for better support of --enable-final 1999-05-22 Stephan Kulow * acinclude.m4.in: added support for --with-dmalloc 1999-05-19 Stephan Kulow * acinclude.m4.in: added support for --enable-final * am_edit: added support for --enable-final 1999-05-06 Stephan Kulow * acinclude.m4.in: change the meaning of --disable-debug 1999-05-04 Helge Deller * acinclude.m4.in: the test for the X-includes/directories failed, when compile & link work without special directories (as on HP-UX). 1999-04-20 Stephan Kulow * am_edit: adding DESTDIR replacement for rm and uninstall-local too. Seems very useless, but makes testing for uninstall easier 1999-04-01 David Faure * acinclude.m4.in: Added -lkfile to $(LIB_KIO) 1999-03-30 David Faure * acinclude.m4.in: Added AC_CHECK_KDEMAXPATHLEN, which defines KDEMAXPATHLEN. 1999-03-29 David Faure * acinclude.m4.in: added LIB_X11 to XPMLIB and GLLIB, because on SCO, they need it _after_ themselves. 1999-03-28 David Faure * acinclude.m4.in: added LIB_KFM to LIB_KAB alias 1999-03-26 David Faure * acinclude.m4.in: made LIB_KFILE use LIB_KIO instead of LIB_KFM added LIB_KFORMULA 1999-03-20 Stephan Kulow * acinclude.m4.in: check for libXext - for Russel :) 1999-03-16 Stephan Kulow * acinclud3.m4.in: extend the MICO test with a list of possible places where to find CORBA.h 1999-03-15 Stephan Kulow * acinclude.m4.in: move $QTINC and $QTLIB in search path 1999-03-14 Stephan Kulow * am_edit: install-root is obsolute. Use DESTDIR always 1999-03-03 Stephan Kulow * acinclude.m4.in: fixing a bug, that $QTDIR was taken before --with-qt* * acinclude.m4.in: added KDE_USE_QT, that you can choose if to use QT 2.0 or KDE 1.0 * Makefile.common: added target package-merge * am_edit: many fixes to the POFILES handeling of am_edit 1999-03-02 Stephan Kulow * acinclude.m4.in: first look at libjpeg6b (from kdesupport) then for libjpeg * config.*, libtool.*: update to the latest FSF tools 1999-02-23 Stephan Kulow * acinclude.m4.in: error when Sparc CC is used. Better use it in configure and tell him the story then letting him find it while compiling * acinclude.m4.in: adding KDE_CHECK_EXTRA_LIBS to all possible tests, so that --with-extra-includes is used when needed. * acinclude.m4.in: configure looks for giflib30, so it should say so * acinclude.m4.in: don't overwrite x include parameters. Patch by Ari Lemmke (bug report 741) 1999-02-20 Stephan Kulow * acinclude.m4.in: fixing KDE_CHECK_PATHS for rechecking. In case of defaults (kdelibs) configure didn't cache the results 1999-02-18 David Faure * acinclude.m4.in: added AC_CHECK_S_ISSOCK, to fix #706. 1999-02-17 David Faure * acinclude.m4.in: added AC_CHECK_RANDOM, just like AC_CHECK_USLEEP, to enable the fake if necessary. 1999-02-13 Kurt Granroth * acinclude.m4.in: look for QT-2.0 1999-02-05 Stephan Kulow * acinclude.m4.in: in macro KDE_FIND_PATH treat user given dirs and $PATH dirs the same. Added seperate test for to find binary ($5) to replace findperl 1999-01-28 Stephan Kulow * automoc: added patch by jbb to be a little bit more precise about the number of sourcefiles that include the moc file if it's != 1. Besides that automoc will fail with exit code, so the Makefile.cvs process does stop in case a problem accoured. * automoc: don't hardcode header suffix, but allow *.h, *.hh and *.H 1999-01-27 Stephan Kulow * acinclude.m4.in: try qobjcoll.h and qapplication.h before saying OK to qt headers. (I could kill SuSE for splitting into qt-dev and qt-compat) 1991-01-23 Stephan Kulow * automoc: added fixes by JB 1999-01-21 Stephan Kulow * automoc: added --help and --path (for use in dist-hook) 1999-01-20 Alex Zepeda * ltconfig: added entries for FreeBSD 4.x 1999-01-19 Stephan Kulow * automoc: added a distclean-metasources target which deletes all moc files and let distclean depend on it 1999-01-18 Stephan Kulow * automoc: several fixes (ignore comment lines + join lines with \ ) * automoc: support META_INCLUDES in case the header files are not in the same dir as the sources. 1999-01-17 Stephan Kulow * automoc: several fixes. 1999-01-16 Stephan Kulow * automoc: added support for included MOC files. * acinclude.m4.in: use srcdir for the subdirs stuff as well * automoc: added better command line parsing and some preparation for handling "normal" moc files * acinclude.m4.in: added aliases for libkio and libkdeutil 1999-01-15 Harri Porten * automoc: Carved in stone syntax for Makefile.in: {program}_METASOURCES = USE_AUTOMOC [{suffix}] 1999-01-15 Stephan Kulow * Makefile.common: set top_srcdir to . 1999-01-14 Stephan Kulow * acinclude.m4.in: don't use config.h.bot any longer 1999-01-08 Stephan Kulow * acinclude.m4.in: added KDE_CHECK_NEWLIBS * acinclude.m4.in: test for Qt even if both --with-qt-headers and --with-qt-libraries are given. They may be wrong. 1999-01-06 Stephan Kulow * acinclude.m4.in: change the MOC test so it can be used for other tools as well 1998-12-28 Stephan Kulow * acinclude.m4.in: look for QT-1.42 since kpanel needs it 1998-12-27 Stephan Kulow * acinclude.m4.in: added /usr/lib for libpython test * acinclude.m4.in: take my email address out of it and added a reference to www.kde.org/faq * acinclude.m4.in: use Qt >= 1.4 * acinclude.m4.in: added KDE_CHECK_NAMESPACES 1998-12-18 Stephan Kulow * acinclude.m4.in: test for directories to exist before saying yes to compilation :) 1998-12-14 Stephan Kulow * acinclude.m4.in: added CPLUSPLUS for the kimgio test. It's only important for shaman right now, but at least there it is :) 1998-12-12 Stephan Kulow * Makefile.cvs: added common Makefile.cvs * acinclude.m4.in: Thomas.Schwarz@pro-sieben.de reported a very ugly bug in AC_PROG_CXXCPP, so I added my own version * acinclude.m4.in: added KDE_CREATE_SUBDIRS_LIST to simplify most toplevel configures 1998-12-11 Stephan Kulow * acinclude.m4.in: added call to AC_PROG_CXXCPP. Not really sure why it never caused problems * acinclude.m4.in: moved LIBTIFF alias * acinclude.m4.in: only test for the existance of libkimgio if the user wants to. For 99% of the applications it doesn't matter if configure can find libkimgio :) 1998-12-10 Stephan Kulow * acinclude.m4.in: some changes to the python check to handle $LIBDL 1998-12-09 Stephan Kulow * acinclude.m4.in: make Alex's tiff test a real one * acinclude.m4.in: fix the LIB_TIFF alias to really expand 1998-12-08 Alex Zepeda * acinclude.m4.in: Fix tiff test to use libtiff34 if it exists. This is what the FreeBSD port installs to for whatever reason. * acinclude.m4.in: s/kde/KDE/ (at least in some of the descriptions, obviously no variable names were touched. 1998-12-08 Stephan Kulow * acinclude.m4.in: moved the LIB_QT alias to the Qt check * acinclude.m4.in: unset KDEDIR before running conftest * acinclude.m4.in: fixed mean typo * acinclude.m4.in: added the copyright header for the gettext tests, so that people know we're legal ;) * acinclude.m4.in: set language to C++ before testing QIMGIO 1998-12-07 Alex Zepeda * acinclude.m4.in: Fix PNG test to use correct ANSI C code, and not trip up gcc. 1998-12-07 Stephan Kulow * acinclude.m4.in: don't hardcode -ldl * acinclude.m4.in: move the LIB_X11 alias to the X test to make it useful for kdesupport as well * acinclude.m4.in: give the word CHECK_KIMGIO a meaning in really checking for it * acinclude.m4.in: simple fix to prevent kimgio test from compiling KDE application in kdelibs 1998-12-05 Stephan Kulow * acinclude.m4.in: let KDE_CHECK_KIMGIO depend on AC_PATH_KDE, otherwise most tests fail. It didn't mean anything to 90% of the packages since they test for KDE before kimgio, but for shaman it does * ltconfig: the real fix for the Solaris && gcc problem. Thanks Kurt for reporting it and Alexandre for fixing it :) 1998-12-04 Stephan Kulow * libtool.*: update again * acinclude.m4.in: changed the function to test for libnsl to inet_ntoa since UnixWare 7's version did not have gethostbyname, but needs libnsl 1998-12-02 Stephan Kulow * acinclude.m4.in: fixed the MOC test (again) to use the PATH variable correctly (with the correct seperator) * config.guess: update from the soon to be released autoconf-2.13 1998-12-01 Stephan Kulow * acinclude.m4.in: fixes for the MOC test. Use PATH now when found 1998-11-30 Stephan Kulow * acinclude.m4.in: extended the MOC test. It checks now for the first line of the output of "moc --help" and looks for Qt in it. 1998-11-27 Stephan Kulow * ltconfig: another libtool update. Fixes an ugly bug on Solaris, when GNU ld is in path before Solaris ld, but gcc uses the later 1998-11-26 Stephan Kulow * acinclude.m4.in: made the Qt test more advance to check for qt 1.41 - I still need to make it better, but there shouldn't be too many qt releases in a row, would there? ;) * ltconfig: libtool update with better BSD/OS support 1998-11-22 Stephan Kulow * ltconfig: cool - libtool uses g++ now to link libraries on Solaris. This means, static objects become usuable on that plattforms (some others as well). 1998-11-20 Stephan Kulow * ltmain.sh: updated libtool from their CVS - fixes bugs we haven't found and adds some more features, that we do not need ;-) 1998-11-19 David Faure * acinclude.m4.in: added AC_CHECK_UTMP_FILE, taken from kdebase 1998-11-16 Harri Porten * automoc: take care of "ar" object files, too. 1998-11-16 Stephan Kulow * libtool.m4.in: revised my --silent patch. The solution Alexandre suggested is much better. 1998-11-15 Stephan Kulow * ltconfig.in: done some tweakings to support -export-dynamic with egcs * config.sub: wow - BeOS support :) 1998-11-14 Stephan Kulow * acinclude.m4.in: don't use rpath for test program, if rpath is disabled for applications * ltconfig: patched libtool to make it silent without making ltconfig silent * acinclude.m4.in: make libtool silent again * libtool.m4.in: update to libtool-981114 (untested stuff, but we have to test it to make it tested - sounds that logical? :-) * libtool.m4.in: moved the self stricked libtool tests to "our" file. * acinclude.m4.in: moved ChangeLog of kdebase which I used to maintain acinclude.m4.in logs to kde-common/admin. Hopefully I will maintain it more often from now on :) 1998-07-27 Stephan Kulow * acinclude.m4.in: fixed some things in the MOC test * acinclude.m4.in: fixed this damn msgfmt test 1998-06-02 Stephan Kulow * acinclude.m4.in: ignore msgfmt, if not GNU gettext 1998-05-28 Stephan Kulow * acinclude.m4.in: fixed KDE_CHECK_STL. Checks for HP and SGI type * acinclude.m4.in: embraced every variable with "" to make it consistent * acinclude.m4.in: various fixes for the koffice checks (mico, ministl and python) 1998-05-16 Stephan Kulow * acinclude.m4.in: don't use KDE_CHECK_QT_DIRECT, when --with-qt-libs are given 1998-04-21 Stephan Kulow * acinclude.m4.in: cool, I found the trick to suppress the ls errors 1998-04-20 Stephan Kulow * acinclude.m4.in: rewrote the qt checking test, since it didn't work under FreeBSD, since it relied on the .so link. The new version is a little bit buggy, but I need some testing to make it perfect * acinclude.m4.in: fixed the side effects of the PAM test 1998-04-18 Stephan Kulow * acinclude.m4.in: hopefully fixed the PAM test (I rewrote it) 1998-04-16 Stephan Kulow * acinclude.m4.in: extended the getsockname test inspired by a patch by Martin Baulig * configure.in: added test for utmp file * acinclude.m4.in: made --without-pam default 1998-04-06 Stephan Kulow * acinclude.m4.in: don't test compiling, linking, running in one step. This proved to be too dangerous for my mail box. 1998-03-21 Stephan Kulow * libtool.m4.in: created some new macros to work around this ugly (because long) help of configure --enable-shared/static 1998-03-05 Stephan Kulow * acinclude.m4.in: set language to C++ before trying the ksize_t test * configure.in: sorted the Makefile entries alphabeticly (and all together: we love xemacs! we love xemacs! ;) * configure.in: added sk * acinclude.m4.in: substitute x_libraries to fix the empty -rpath 1998-03-03 Stephan Kulow * acinclude.m4.in: add a rpath for every shared library, that is linked too (especially X11 libraries) Tue Feb 24 22:04:59 1998 Stephan Kulow * acinclude.m4.in: added kde_sounddir and set kde_minidir to kde_icondir/mini to break not too much Sun Feb 15 18:25:50 1998 Stephan Kulow * configure.in: added bugfix by Bob Miller (correct reset of IFS) Wed Feb 11 00:53:11 1998 Stephan Kulow * configure.in: made shadow under Linux default, since the binaries will work also under non-shadow systems. The only problem left is PAM, so I disabled shadow in case, PAM is present Tue Feb 10 16:46:32 1998 Stephan Kulow * configure.in: added test for nice to find out, if the option -nice works for the screensavers * acinclude.m4.in: port to LynxOS. For this I moved all library search routines in KDE_MISC_TESTS, so I don't need to write this in every package * README: some grammar fixes * acinclude.m4.in: search for the libs in the exec_prefix, when it's present Sun Feb 8 14:07:23 1998 Stephan Kulow * acinclude.m4.in: updated all packages * libtool.m4.in: applied patch for libtool.m4.in to show the correct default for shared and static Sat Feb 7 10:56:00 1998 Stephan Kulow * configure.in: good news - KDE is relocatable again. * libtool.m4.in: updated to latest libtool 1.0i Fri Feb 6 21:26:51 1998 Stephan Kulow * acinclude.m4.in: added a AC_PROVIDE for AC_PROG_CC and AC_PROG_CPP to KDE_CHECK_COMPILERS Thu Feb 5 16:27:47 1998 Stephan Kulow * acinclude.m4.in: put $QTDIR/bin before /usr/bin in the path to look for moc. I don't know why, but I got a report, that configure found /usr/bin/moc under Solaris Fri Jan 30 15:47:50 1998 Stephan Kulow * acinclude.m4.in: export LIBRARY_PATH after reset to the saved value * acinclude.m4.in: unset the LIBRARY_PATH to get a relieable result when trying to find, if Qt compiles without -L Sat Jan 24 00:45:52 1998 Stephan Kulow * acinclude.m4.in: fixed another bug in AC_PATH_KDE Thu Jan 22 14:46:15 1998 Stephan Kulow * configure.in: fixed an ugly bug in AC_BASE_PATH_KDE * kappfinder/kappfinder.in: let kappfinder create by configure to allow the use of the kde_ paths Wed Jan 21 22:19:35 1998 Stephan Kulow * acinclude.m4.in: - added a install_root prefix to all paths, if set, to enable package managers to move the whole installation at once - added --with-install-root to set the install_root prefix Tue Jan 20 22:41:04 1998 Stephan Kulow * configure.in: added NOOPT_CXXFLAGS to allow kioslave to be compiled without -O2 Mon Jan 19 21:55:21 1998 Stephan Kulow * configure.in: some little fixes for the Makefiles * acinclude.m4.in: --prefix will no longer override the search for libraries. If they are present somewhere, they are used (through the methodes in KApplication) Mon Jan 12 00:30:36 1998 Stephan Kulow * acinclude.m4.in fixed an ugly bug, that accoured, when qt_libraries is not set (empty/equals X11/not necessary) * acinclude.m4.in moved the remove of the files after the error detection Sun Jan 11 17:27:53 1998 Stephan Kulow * acinclude.m4.in added a new macro KDE_CHECK_QT_DIRECT to unset the Qt library path, if a Qt program compiles without them * acinclude.m4.in added a return value in the CREATE_KFSSTND macro. Perhaps this has caused the problems Sat Jan 10 17:40:44 1998 Stephan Kulow * ChangeLog started to maintain a ChangeLog file again * acinclude.m4.in the AC_CREATE_KFSSTND to get better debug output to find the problem Old logs, Stephan Kulow made: 0.1 : first steps with libkde 0.2 : first release with libkde, khtmlw, kdehelp, acli, kwm, kpanel 0.3 : added kfm and bugfixes 0.4 : updated khtmlw, kdehelp, kwm, changed install in all subdirs 0.5 : support libtool (chooseable shared libs) 0.6 : split libkde in kdecore and kdeui 0.6.1 : Bugfixes 0.7 : added code from Janos Farkas (configure) : added @{kde,qt}_{includes,libraries}@ 0.7.1: Bugfixes 0.7.2: Bugfixes 0.7.3: added @all_includes@ and @all_libraries@ replaced all incompatible flags like $(CC) and -DHAVE_UNISTD_H 0.7.4: changed support for libkde (back in it's own) added kpat updated kpanel, kwm, kghostview 0.8: removed a bug in kghostview lifted installation process of several apps splitt kdebase into kdelibs and kdeapps updated khtmlw, kfm and kdehelp added kcalc and kpaint updated kdisplay added kscreensaver added --enable-kscreensaver added --enable-debug (and @CXXFLAGS@ to all Makefile.ins) updated kwm to 0.4.7 added make uninstall to every app added kvt added khexdit added .kdelnk for kmines, kedit, ktetris put kwm, kfind's .kdelnk in the right directories replaced --enable-kscreensaver by --disable-kscreensaver updated kpanel to 0.15 some bugfixes (thanks Marco) some bugfixes (thanks Martin) changed acinclude.m4, because aclocal won't updated kwm to 0.4.8 (patched it again for Qt-1.2) updated kvt to 0.13 (patch from Matthias) patched kvt and kwm updated kwm to 0.5.0 updated kvt for 0.14 (again and again :-) updated kview to 0.10 updated kfm to 0.6.3 patched kscreensaver for FreeBSD (thanks Marc) 0.9: updated kdisplay to 0.5.3 added klogout patches from Matthias updated kfm to 0.6.4 updated kghostview to 0.4 added QTINC and QTLIB updated kdehelp to 0.4.11 patched kfm to support ktoolbar updated kedit to kedit+ added kfontmanager 0.2.1 0.9.1: changed kpaint's make style bugfixing updated kmines to 0.6.5 updated ktetris to 0.2.4 changed to Makefiles to depend on Makefile.in changed the Makefiles to let install depend on all added kjots-0.2.2 updated kjots-0.2.3 updated kfm to 0.6.6 updated kjots-0.2.4 updated kpaint-0.2 updated kedit to 0.5 updated kfontmanager to 0.2.2 updated kfm to 0.6.7 updated ktetris to 0.2.5 updated kjots to 0.2.5 0.10: added HAVE_SQRTL added HAVE_CRYPT_H updated kfind updated kfm to kfm-0.8.1 re-introduced automake to kdebase bugfixes for the configure.in added XPM, GL and PAM tests to configure added morph3d to kscreensavers updated kfind to 0.3.2 added some patches for SGI ... lost the time to maintain a Changelog ;) c_cpp_reference-2.0.2/aclocal.m40000644000076400001440000047203507474405113012156 # aclocal.m4 generated automatically by aclocal 1.5 # Copyright 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. dnl This file is part of the KDE libraries/packages dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org) dnl This file is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Library General Public dnl License as published by the Free Software Foundation; either dnl version 2 of the License, or (at your option) any later version. dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Library General Public License for more details. dnl You should have received a copy of the GNU Library General Public License dnl along with this library; see the file COPYING.LIB. If not, write to dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, dnl Boston, MA 02111-1307, USA. dnl IMPORTANT NOTE: dnl Please do not modify this file unless you expect your modifications to be dnl carried into every other module in the repository. If you decide that you dnl really want to modify it, contact coolo@kde.org mentioning that you have dnl and that the modified file should be committed to every module. dnl dnl Single-module modifications are best placed in configure.in for kdelibs dnl and kdebase or configure.in.in if present. dnl ------------------------------------------------------------------------ dnl Forward compatibility macros (make autoconf 2.13 look like 2.50), dnl thanks to Raja R Harinath. dnl ------------------------------------------------------------------------ dnl ifdef([_AC_PATH_X_XMKMF],[], [AC_DEFUN([_AC_PATH_X_XMKMF],[AC_PATH_X_XMKMF])]) ifdef([AC_OUTPUT_SUBDIRS],[], [AC_DEFUN([AC_OUTPUT_SUBDIRS],[subdirs=$1; _AC_OUTPUT_SUBDIRS])]) ifdef([AM_PROG_AS],[], [AC_DEFUN([AM_PROG_AS,[])]) # KDE_PATH_X_DIRECT dnl Internal subroutine of AC_PATH_X. dnl Set ac_x_includes and/or ac_x_libraries. AC_DEFUN(KDE_PATH_X_DIRECT, [if test "$ac_x_includes" = NO; then # Guess where to find include files, by looking for this one X11 .h file. test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h # First, try using that file with no special directory specified. AC_TRY_CPP([#include <$x_direct_test_include>], [# We can compile using X headers with no special include directory. ac_x_includes=], [# Look for the header file in a standard set of common directories. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in \ /usr/X11/include \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/include \ /usr/local/include \ /usr/unsupported/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include \ ; \ do if test -r "$ac_dir/$x_direct_test_include"; then ac_x_includes=$ac_dir break fi done]) fi # $ac_x_includes = NO if test "$ac_x_libraries" = NO; then # Check for the libraries. test -z "$x_direct_test_library" && x_direct_test_library=Xt test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" AC_TRY_LINK(, [${x_direct_test_function}()], [LIBS="$ac_save_LIBS" # We can link X programs with no special library path. ac_x_libraries=], [LIBS="$ac_save_LIBS" # First see if replacing the include by lib works. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ /usr/X11/lib \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ /usr/lib/X11 \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ /usr/local/X11/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ /usr/local/lib/X11 \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ /lib/usr/lib/X11 \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ ; \ do dnl Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done]) fi # $ac_x_libraries = NO ]) dnl ------------------------------------------------------------------------ dnl Find a file (or one of more files in a list of dirs) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_FIND_FILE, [ $3=NO for i in $2; do for j in $1; do echo "configure: __oline__: $i/$j" >&AC_FD_CC if test -r "$i/$j"; then echo "taking that" >&AC_FD_CC $3=$i break 2 fi done done ]) dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, dnl if-not-found, test-parameter) AC_DEFUN(KDE_FIND_PATH, [ AC_MSG_CHECKING([for $1]) if test -n "$$2"; then kde_cv_path="$$2"; else kde_cache=`echo $1 | sed 'y%./+-%__p_%'` AC_CACHE_VAL(kde_cv_path_$kde_cache, [ kde_cv_path="NONE" dirs="$3" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/$1"; then if test -n "$5" then evalstr="$dir/$1 $5 2>&1 " if eval $evalstr; then kde_cv_path="$dir/$1" break fi else kde_cv_path="$dir/$1" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" ]) eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then AC_MSG_RESULT(not found) $4 else AC_MSG_RESULT($kde_cv_path) $2=$kde_cv_path fi ]) AC_DEFUN(KDE_MOC_ERROR_MESSAGE, [ AC_MSG_ERROR([No Qt meta object compiler (moc) found! Please check whether you installed Qt correctly. You need to have a running moc binary. configure tried to run $ac_cv_path_moc and the test didn't succeed. If configure shouldn't have tried this one, set the environment variable MOC to the right one before running configure. ]) ]) AC_DEFUN(KDE_UIC_ERROR_MESSAGE, [ AC_MSG_WARN([No Qt ui compiler (uic) found! Please check whether you installed Qt correctly. You need to have a running uic binary. configure tried to run $ac_cv_path_uic and the test didn't succeed. If configure shouldn't have tried this one, set the environment variable UIC to the right one before running configure. ]) ]) dnl ------------------------------------------------------------------------ dnl Find the meta object compiler and the ui compiler in the PATH, dnl in $QTDIR/bin, and some more usual places dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_PATH_QT_MOC_UIC, [ qt_bindirs="" for dir in $kde_qt_dirs; do qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" done qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" if test ! "$ac_qt_bindir" = "NO"; then qt_bindirs="$ac_qt_bindir $qt_bindirs" fi KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE]) if test -z "$UIC_NOT_NEEDED"; then KDE_FIND_PATH(uic, UIC, [$qt_bindirs], [UIC=""]) if test -z "$UIC" ; then KDE_UIC_ERROR_MESSAGE exit 1 fi else UIC="echo uic not available: " fi AC_SUBST(MOC) AC_SUBST(UIC) UIC_TR="i18n" if test $kde_qtver = 3; then UIC_TR="QT_KDE_I18N" fi AC_SUBST(UIC_TR) ]) AC_DEFUN(KDE_1_CHECK_PATHS, [ KDE_1_CHECK_PATH_HEADERS KDE_TEST_RPATH= if test -n "$USE_RPATH"; then if test -n "$kde_libraries"; then KDE_TEST_RPATH="-R $kde_libraries" fi if test -n "$qt_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" fi if test -n "$x_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" fi KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" fi AC_MSG_CHECKING([for KDE libraries installed]) ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' if AC_TRY_EVAL(ac_link) && test -s conftest; then AC_MSG_RESULT(yes) else AC_MSG_ERROR([your system fails at linking a small KDE application! Check, if your compiler is installed correctly and if you have used the same compiler to compile Qt and kdelibs as you did use now. For more details about this problem, look at the end of config.log.]) fi if eval `KDEDIR= ./conftest 2>&5`; then kde_result=done else kde_result=problems fi KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log kde_have_all_paths=yes KDE_SET_PATHS($kde_result) ]) AC_DEFUN(KDE_SET_PATHS, [ kde_cv_all_paths="kde_have_all_paths=\"yes\" \ kde_htmldir=\"$kde_htmldir\" \ kde_appsdir=\"$kde_appsdir\" \ kde_icondir=\"$kde_icondir\" \ kde_sounddir=\"$kde_sounddir\" \ kde_datadir=\"$kde_datadir\" \ kde_locale=\"$kde_locale\" \ kde_cgidir=\"$kde_cgidir\" \ kde_confdir=\"$kde_confdir\" \ kde_mimedir=\"$kde_mimedir\" \ kde_toolbardir=\"$kde_toolbardir\" \ kde_wallpaperdir=\"$kde_wallpaperdir\" \ kde_templatesdir=\"$kde_templatesdir\" \ kde_bindir=\"$kde_bindir\" \ kde_servicesdir=\"$kde_servicesdir\" \ kde_servicetypesdir=\"$kde_servicetypesdir\" \ kde_moduledir=\"$kde_moduledir\" \ kde_result=$1" ]) AC_DEFUN(KDE_SET_DEFAULT_PATHS, [ if test "$1" = "default"; then if test -z "$kde_htmldir"; then kde_htmldir='\${prefix}/share/doc/HTML' fi if test -z "$kde_appsdir"; then kde_appsdir='\${prefix}/share/applnk' fi if test -z "$kde_icondir"; then kde_icondir='\${prefix}/share/icons' fi if test -z "$kde_sounddir"; then kde_sounddir='\${prefix}/share/sounds' fi if test -z "$kde_datadir"; then kde_datadir='\${prefix}/share/apps' fi if test -z "$kde_locale"; then kde_locale='\${prefix}/share/locale' fi if test -z "$kde_cgidir"; then kde_cgidir='\${exec_prefix}/cgi-bin' fi if test -z "$kde_confdir"; then kde_confdir='\${prefix}/share/config' fi if test -z "$kde_mimedir"; then kde_mimedir='\${prefix}/share/mimelnk' fi if test -z "$kde_toolbardir"; then kde_toolbardir='\${prefix}/share/toolbar' fi if test -z "$kde_wallpaperdir"; then kde_wallpaperdir='\${prefix}/share/wallpapers' fi if test -z "$kde_templatesdir"; then kde_templatesdir='\${prefix}/share/templates' fi if test -z "$kde_bindir"; then kde_bindir='\${exec_prefix}/bin' fi if test -z "$kde_servicesdir"; then kde_servicesdir='\${prefix}/share/services' fi if test -z "$kde_servicetypesdir"; then kde_servicetypesdir='\${prefix}/share/servicetypes' fi if test -z "$kde_moduledir"; then kde_moduledir='\${exec_prefix}/lib/kde2' fi KDE_SET_PATHS(defaults) else if test $kde_qtver = 1; then AC_MSG_RESULT([compiling]) KDE_1_CHECK_PATHS else AC_MSG_ERROR([path checking not yet supported for KDE 2]) fi fi ]) AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS, [ if test -z "$kde_htmldir" || test -z "$kde_appsdir" || test -z "$kde_icondir" || test -z "$kde_sounddir" || test -z "$kde_datadir" || test -z "$kde_locale" || test -z "$kde_cgidir" || test -z "$kde_confdir" || test -z "$kde_mimedir" || test -z "$kde_toolbardir" || test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || test -z "$kde_bindir" || test -z "$kde_servicesdir" || test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || test "$kde_have_all_paths" != "yes"; then kde_have_all_paths=no fi ]) AC_DEFUN(KDE_MISSING_PROG_ERROR, [ AC_MSG_ERROR([The important program $1 was not found! Please check whether you installed KDE correctly. ]) ]) AC_DEFUN(KDE_SUBST_PROGRAMS, [ kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde2/bin /usr/kde/bin /usr/local/kde/bin" if test -n "$KDEDIRS"; then kde_save_IFS=$IFS IFS=: for dir in $KDEDIRS; do kde_default_bindirs="$dir/bin $kde_default_bindirs " done IFS=$kde_save_IFS fi kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs" KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)]) KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)]) KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(mcopidl)]) KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(artsc-config)]) KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs]) KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs]) if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde2/share /opt/kde/share $prefix/share" test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET) if test "$KDE_XSL_STYLESHEET" = "NO"; then KDE_XSL_STYLESHEET="" else KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" fi fi DCOP_DEPENDENCIES='$(DCOPIDL)' AC_SUBST(DCOPIDL) AC_SUBST(DCOPIDL2CPP) AC_SUBST(DCOP_DEPENDENCIES) AC_SUBST(MCOPIDL) AC_SUBST(ARTSCCONFIG) AC_SUBST(KDECONFIG) AC_SUBST(MEINPROC) AC_SUBST(KDE_XSL_STYLESHEET) if test -x "$KDECONFIG"; then # it can be "compiled" kde_libs_prefix=`$KDECONFIG --prefix` if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. This means it has been moved since you installed it. This won't work. Please recompile kdelibs for the new prefix. ]) fi kde_libs_htmldir=`$KDECONFIG --install html --expandvars` else kde_libs_prefix='$(prefix)' kde_libs_htmldir='$(kde_htmldir)' fi AC_SUBST(kde_libs_prefix) AC_SUBST(kde_libs_htmldir) ])dnl AC_DEFUN(AC_CREATE_KFSSTND, [ AC_REQUIRE([AC_CHECK_RPATH]) AC_MSG_CHECKING([for KDE paths]) kde_result="" kde_cached_paths=yes AC_CACHE_VAL(kde_cv_all_paths, [ KDE_SET_DEFAULT_PATHS($1) kde_cached_paths=no ]) eval "$kde_cv_all_paths" KDE_CHECK_PATHS_FOR_COMPLETENESS if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then # wrong values were cached, may be, we can set better ones kde_result= kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= kde_have_all_paths= KDE_SET_DEFAULT_PATHS($1) eval "$kde_cv_all_paths" KDE_CHECK_PATHS_FOR_COMPLETENESS kde_result="$kde_result (cache overridden)" fi if test "$kde_have_all_paths" = "no"; then AC_MSG_ERROR([configure could not run a little KDE program to test the environment. Since it had compiled and linked before, it must be a strange problem on your system. Look at config.log for details. If you are not able to fix this, look at http://www.kde.org/faq/installation.html or any www.kde.org mirror. (If you're using an egcs version on Linux, you may update binutils!) ]) else rm -f conftest* AC_MSG_RESULT($kde_result) fi bindir=$kde_bindir KDE_SUBST_PROGRAMS ]) AC_DEFUN(AC_SUBST_KFSSTND, [ AC_SUBST(kde_htmldir) AC_SUBST(kde_appsdir) AC_SUBST(kde_icondir) AC_SUBST(kde_sounddir) AC_SUBST(kde_datadir) AC_SUBST(kde_locale) AC_SUBST(kde_confdir) AC_SUBST(kde_mimedir) AC_SUBST(kde_wallpaperdir) AC_SUBST(kde_bindir) dnl for KDE 2 AC_SUBST(kde_templatesdir) AC_SUBST(kde_servicesdir) AC_SUBST(kde_servicetypesdir) AC_SUBST(kde_moduledir) if test "$kde_qtver" = 1; then kde_minidir="$kde_icondir/mini" else # for KDE 1 - this breaks KDE2 apps using minidir, but # that's the plan ;-/ kde_minidir="/dev/null" fi dnl AC_SUBST(kde_minidir) dnl AC_SUBST(kde_cgidir) dnl AC_SUBST(kde_toolbardir) ]) AC_DEFUN(KDE_MISC_TESTS, [ AC_LANG_C dnl Checks for libraries. AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD AC_SUBST(LIBUTIL) AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD AC_SUBST(LIBCOMPAT) kde_have_crypt= AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ AC_MSG_WARN([you have no crypt in either libcrypt or libc. You should install libcrypt from another source or configure with PAM support]) kde_have_crypt=no ])) AC_SUBST(LIBCRYPT) if test $kde_have_crypt = yes; then AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) fi AC_CHECK_SOCKLEN_T AC_LANG_C AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) if test $ac_cv_lib_dnet_dnet_ntoa = no; then AC_CHECK_LIB(dnet_stub, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) fi AC_CHECK_FUNC(inet_ntoa) if test $ac_cv_func_inet_ntoa = no; then AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") fi AC_CHECK_FUNC(connect) if test $ac_cv_func_connect = no; then AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , $X_EXTRA_LIBS) fi AC_CHECK_FUNC(remove) if test $ac_cv_func_remove = no; then AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. AC_CHECK_FUNC(shmat, , AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")) # Solaris 2.6 and others need -lresolv for res_init AC_CHECK_FUNCS(res_init, , [ kde_libs_safe="$LIBS" LIBS="$LIBS $X_EXTRA_LIBS -lresolv" AC_TRY_LINK( [ #include ], [ res_init(); ], LIBRESOLV="-lresolv" X_EXTRA_LIBS="$X_EXTRA_LIBS $LIBRESOLV" AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) ) LIBS=$kde_libs_safe ]) LIBSOCKET="$X_EXTRA_LIBS" AC_SUBST(LIBSOCKET) AC_SUBST(LIBRESOLV) AC_SUBST(X_EXTRA_LIBS) AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 AC_SUBST(LIBUCB) case $host in dnl this *is* LynxOS specific *-*-lynxos* ) AC_MSG_CHECKING([LynxOS header file wrappers]) [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] AC_MSG_RESULT(disabled) AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS ;; esac KDE_CHECK_TYPES KDE_CHECK_LIBDL ]) dnl ------------------------------------------------------------------------ dnl Find the header files and libraries for X-Windows. Extended the dnl macro AC_PATH_X dnl ------------------------------------------------------------------------ dnl AC_DEFUN(K_PATH_X, [ AC_REQUIRE([AC_PROG_CPP])dnl AC_REQUIRE([KDE_MISC_TESTS])dnl AC_MSG_CHECKING(for X) AC_LANG_SAVE AC_LANG_C AC_CACHE_VAL(kde_cv_have_x, [# One or both of the vars are not set, and there is no cached value. if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then kde_x_includes=NO else kde_x_includes=$x_includes fi if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then kde_x_libraries=NO else kde_x_libraries=$x_libraries fi # below we use the standard autoconf calls ac_x_libraries=$kde_x_libraries ac_x_includes=$kde_x_includes KDE_PATH_X_DIRECT dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries. dnl Unfortunately, if compiling with the N32 ABI, this is not the correct dnl location. The correct location is /usr/lib32 or an undefined value dnl (the linker is smart enough to pick the correct default library). dnl Things work just fine if you use just AC_PATH_X_DIRECT. dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to dnl /usr/openwin/include, which doesn't work. /usr/include does work, so dnl x_includes should be left alone. case "$host" in mips-sgi-irix6*) ;; *-*-solaris*) ;; *) _AC_PATH_X_XMKMF if test -z "$ac_x_includes"; then ac_x_includes="." fi if test -z "$ac_x_libraries"; then ac_x_libraries="/usr/lib" fi esac #from now on we use our own again # when the user already gave --x-includes, we ignore # what the standard autoconf macros told us. if test "$kde_x_includes" = NO; then kde_x_includes=$ac_x_includes fi # for --x-libraries too if test "$kde_x_libraries" = NO; then kde_x_libraries=$ac_x_libraries fi if test "$kde_x_includes" = NO; then AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) fi if test "$kde_x_libraries" = NO; then AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) fi # Record where we found X for the cache. kde_cv_have_x="have_x=yes \ kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" ])dnl eval "$kde_cv_have_x" if test "$have_x" != yes; then AC_MSG_RESULT($have_x) no_x=yes else AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes]) fi if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then X_INCLUDES="" x_includes="."; dnl better than nothing :- else x_includes=$kde_x_includes X_INCLUDES="-I$x_includes" fi if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then X_LDFLAGS="" x_libraries="/usr/lib"; dnl better than nothing :- else x_libraries=$kde_x_libraries X_LDFLAGS="-L$x_libraries" fi all_includes="$X_INCLUDES" all_libraries="$X_LDFLAGS" AC_SUBST(X_INCLUDES) AC_SUBST(X_LDFLAGS) AC_SUBST(x_libraries) AC_SUBST(x_includes) # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $X_LDFLAGS" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. AC_CHECK_LIB(ICE, IceConnectionNumber, [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS) AC_SUBST(LIBSM) LDFLAGS="$ac_save_LDFLAGS" AC_SUBST(X_PRE_LIBS) LIB_X11='-lX11 $(LIBSOCKET)' AC_SUBST(LIB_X11) AC_MSG_CHECKING(for libXext) AC_CACHE_VAL(kde_cv_have_libXext, [ kde_ldflags_safe="$LDFLAGS" kde_libs_safe="$LIBS" LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" LIBS="-lXext -lX11 $LIBSOCKET" AC_TRY_LINK([ #include #ifdef STDC_HEADERS # include #endif ], [ printf("hello Xext\n"); ], kde_cv_have_libXext=yes, kde_cv_have_libXext=no ) LDFLAGS=$kde_ldflags_safe LIBS=$kde_libs_safe ]) AC_MSG_RESULT($kde_cv_have_libXext) if test "$kde_cv_have_libXext" = "no"; then AC_MSG_ERROR([We need a working libXext to proceed. Since configure can't find it itself, we stop here assuming that make wouldn't find them either.]) fi AC_MSG_CHECKING(for Xinerama) AC_ARG_WITH(xinerama, [ --with-xinerama enable support for Xinerama ], [ no_xinerama=no ], [ no_xinerama=yes ] ) kde_save_LDFLAGS="$LDFLAGS" kde_save_CFLAGS="$CFLAGS" kde_save_LIBS="$LIBS" LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" CFLAGS="$CFLAGS -I$x_includes" LIBS="-lXinerama -lXext" if test "x$no_xinerama" = "xno"; then AC_CACHE_VAL(ac_cv_have_xinerama, [ AC_TRY_LINK([#include #include ], [XineramaIsActive(NULL);], [ac_cv_have_xinerama="yes"], [ac_cv_have_xinerama="no"]) ]) else ac_cv_have_xinerama=no; fi AC_MSG_RESULT($ac_cv_have_xinerama) LIBXINERAMA="" if test "$ac_cv_have_xinerama" = "yes"; then AC_DEFINE(HAVE_XINERAMA, 1, [Define if you want Xinerama support]) LIBXINERAMA="-lXinerama" fi AC_SUBST(LIBXINERAMA) LDFLAGS="$kde_save_LDFLAGS" CFLAGS="$kde_save_CFLAGS" LIBS="$kde_save_LIBS" AC_LANG_RESTORE ]) AC_DEFUN(KDE_PRINT_QT_PROGRAM, [ AC_REQUIRE([KDE_USE_QT]) cat > conftest.$ac_ext < #include EOF if test "$kde_qtver" != "1"; then cat >> conftest.$ac_ext < #include #include EOF if test $kde_qtsubver -gt 0; then cat >> conftest.$ac_ext < EOF fi fi echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext cat >> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <&AC_FD_CC cat conftest.$ac_ext >&AC_FD_CC fi rm -f conftest* CXXFLAGS="$ac_cxxflags_safe" LDFLAGS="$ac_ldflags_safe" LIBS="$ac_libs_safe" LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" export LD_LIBRARY_PATH LIBRARY_PATH="$ac_LIBRARY_PATH" export LIBRARY_PATH AC_LANG_RESTORE ]) if test "$kde_cv_qt_direct" = "yes"; then AC_MSG_RESULT(yes) $1 else AC_MSG_RESULT(no) $2 fi ]) dnl ------------------------------------------------------------------------ dnl Try to find the Qt headers and libraries. dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_PATH_QT_1_3, [ AC_REQUIRE([K_PATH_X]) AC_REQUIRE([KDE_USE_QT]) dnl ------------------------------------------------------------------------ dnl Add configure flag to enable linking to MT version of Qt library. dnl ------------------------------------------------------------------------ AC_ARG_ENABLE( mt, [ --enable-mt link to threaded Qt (experimental)], kde_use_qt_mt=$enableval, kde_use_qt_mt=no ) USING_QT_MT="" dnl ------------------------------------------------------------------------ dnl If we got --enable-qt-mt then adjust some vars for the host. dnl ------------------------------------------------------------------------ if test "x$kde_use_qt_mt" = "xyes"; then case $host in *-*-linux-*) if test "x$GCC" = "xyes"; then CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT -pthread" X_EXTRA_LIBS="$X_EXTRA_LIBS -pthread" else AC_MSG_WARN([Compiler is not gcc. MT support disabled.]) fi ;; *) AC_MSG_WARN([MT not yet supported on $host - disabled.]) ;; esac fi kde_qt_was_given=yes dnl ------------------------------------------------------------------------ dnl If we haven't been told how to link to Qt, we work it out for ourselves. dnl ------------------------------------------------------------------------ if test -z "$LIBQT_GLOB"; then LIBQT_GLOB="libqt.*" fi if test -z "$LIBQT"; then LIBQT="-lqt" kde_int_qt="-lqt" dnl ------------------------------------------------------------------------ dnl If we got --enable-qt-mt then adjust the Qt library name for the host. dnl ------------------------------------------------------------------------ if test "x$kde_use_qt_mt" = "xyes"; then case $host in *-*-linux-*) if test "x$GCC" = "xyes"; then LIBQT="-lqt-mt" kde_int_qt="-lqt-mt" LIBQT_GLOB="libqt-mt.*" USING_QT_MT="using -mt" fi ;; esac fi kde_qt_was_given=no else kde_int_qt="$LIBQT" fi if test $kde_qtver != 1; then AC_REQUIRE([AC_FIND_PNG]) AC_REQUIRE([AC_FIND_JPEG]) LIBQT="$LIBQT $LIBPNG $LIBJPEG" fi AC_MSG_CHECKING([for Qt]) LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO qt_libraries="" qt_includes="" AC_ARG_WITH(qt-dir, [ --with-qt-dir=DIR where the root of Qt is installed ], [ ac_qt_includes="$withval"/include ac_qt_libraries="$withval"/lib ac_qt_bindir="$withval"/bin ]) AC_ARG_WITH(qt-includes, [ --with-qt-includes=DIR where the Qt includes are. ], [ ac_qt_includes="$withval" ]) kde_qt_libs_given=no AC_ARG_WITH(qt-libraries, [ --with-qt-libraries=DIR where the Qt library is installed.], [ ac_qt_libraries="$withval" kde_qt_libs_given=yes ]) AC_CACHE_VAL(ac_cv_have_qt, [#try to guess Qt locations qt_incdirs="" for dir in $kde_qt_dirs; do qt_incdirs="$qt_incdirs $dir/include $dir" done qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 $x_includes" if test ! "$ac_qt_includes" = "NO"; then qt_incdirs="$ac_qt_includes $qt_incdirs" fi if test "$kde_qtver" != "1"; then kde_qt_header=qstyle.h else kde_qt_header=qglobal.h fi AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) ac_qt_includes="$qt_incdir" qt_libdirs="" for dir in $kde_qt_dirs; do qt_libdirs="$qt_libdirs $dir/lib $dir" done qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" if test ! "$ac_qt_libraries" = "NO"; then qt_libdir=$ac_qt_libraries else qt_libdirs="$ac_qt_libraries $qt_libdirs" # if the Qt was given, the chance is too big that libqt.* doesn't exist qt_libdir=NONE for dir in $qt_libdirs; do try="ls -1 $dir/${LIBQT_GLOB}" if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi done fi ac_qt_libraries="$qt_libdir" AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_cxxflags_safe="$CXXFLAGS" ac_ldflags_safe="$LDFLAGS" ac_libs_safe="$LIBS" CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS" LIBS="$LIBS $LIBQT" KDE_PRINT_QT_PROGRAM if AC_TRY_EVAL(ac_link) && test -s conftest; then rm -f conftest* else echo "configure: failed program was:" >&AC_FD_CC cat conftest.$ac_ext >&AC_FD_CC ac_qt_libraries="NO" fi rm -f conftest* CXXFLAGS="$ac_cxxflags_safe" LDFLAGS="$ac_ldflags_safe" LIBS="$ac_libs_safe" AC_LANG_RESTORE if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then ac_cv_have_qt="have_qt=no" ac_qt_notfound="" if test "$ac_qt_includes" = NO; then if test "$ac_qt_libraries" = NO; then ac_qt_notfound="(headers and libraries)"; else ac_qt_notfound="(headers)"; fi else ac_qt_notfound="(libraries)"; fi AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! For more details about this problem, look at the end of config.log.]) else have_qt="yes" fi ]) eval "$ac_cv_have_qt" if test "$have_qt" != yes; then AC_MSG_RESULT([$have_qt]); else ac_cv_have_qt="have_qt=yes \ ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT]) qt_libraries="$ac_qt_libraries" qt_includes="$ac_qt_includes" fi if test ! "$kde_qt_libs_given" = "yes"; then KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) fi AC_SUBST(qt_libraries) AC_SUBST(qt_includes) if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then QT_INCLUDES=""; else QT_INCLUDES="-I$qt_includes" all_includes="$QT_INCLUDES $all_includes" fi if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then QT_LDFLAGS="" else QT_LDFLAGS="-L$qt_libraries" all_libraries="$all_libraries $QT_LDFLAGS" fi AC_SUBST(QT_INCLUDES) AC_SUBST(QT_LDFLAGS) AC_PATH_QT_MOC_UIC LIB_QT="$kde_int_qt "'$(LIBPNG) $(LIBJPEG) -lXext $(LIB_X11) $(LIBSM)' AC_SUBST(LIB_QT) AC_SUBST(kde_qtver) ]) AC_DEFUN(AC_PATH_QT, [ AC_PATH_QT_1_3 ]) AC_DEFUN(KDE_CHECK_FINAL, [ AC_ARG_ENABLE(final, [ --enable-final build size optimized apps (experimental - needs lots of memory)], kde_use_final=$enableval, kde_use_final=no) KDE_COMPILER_REPO if test "x$kde_use_final" = "xyes"; then KDE_USE_FINAL_TRUE="" KDE_USE_FINAL_FALSE="#" else KDE_USE_FINAL_TRUE="#" KDE_USE_FINAL_FALSE="" fi AC_SUBST(KDE_USE_FINAL_TRUE) AC_SUBST(KDE_USE_FINAL_FALSE) AC_ARG_ENABLE(closure, [ --disable-closure don't delay template instantiation], kde_use_closure=$enableval, kde_use_closure=yes) if test "x$kde_use_closure" = "xyes"; then KDE_USE_CLOSURE_TRUE="" KDE_USE_CLOSURE_FALSE="#" # CXXFLAGS="$CXXFLAGS $REPO" else KDE_USE_CLOSURE_TRUE="#" KDE_USE_CLOSURE_FALSE="" fi AC_SUBST(KDE_USE_CLOSURE_TRUE) AC_SUBST(KDE_USE_CLOSURE_FALSE) ]) dnl ------------------------------------------------------------------------ dnl Now, the same with KDE dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) dnl and $(kde_includes) will be the kdehdrlocation (if needed) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_BASE_PATH_KDE, [ AC_PREREQ([2.13]) AC_REQUIRE([AC_PATH_QT])dnl AC_CHECK_RPATH AC_MSG_CHECKING([for KDE]) if test "${prefix}" != NONE; then kde_includes=${prefix}/include ac_kde_includes=$prefix/include if test "${exec_prefix}" != NONE; then kde_libraries=${exec_prefix}/lib ac_kde_libraries=$exec_prefix/lib else kde_libraries=${prefix}/lib ac_kde_libraries=$prefix/lib fi else ac_kde_includes= ac_kde_libraries= kde_libraries="" kde_includes="" fi AC_CACHE_VAL(ac_cv_have_kde, [#try to guess kde locations if test "$kde_qtver" = 1; then kde_check_header="ksock.h" kde_check_lib="libkdecore.la" else kde_check_header="ksharedptr.h" kde_check_lib="libkio.la" fi if test -z "$1"; then kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde2/include /opt/kde/include $x_includes $qt_includes" test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" kde_incdirs="$ac_kde_includes $kde_incdirs" AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) ac_kde_includes="$kde_incdir" if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then AC_MSG_ERROR([ in the prefix, you've chosen, are no KDE headers installed. This will fail. So, check this please and use another prefix!]) fi kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde2/lib /opt/kde/lib /usr/X11R6/kde/lib" test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs" kde_libdirs="$ac_kde_libraries $kde_libdirs" AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) ac_kde_libraries="$kde_libdir" if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then AC_MSG_ERROR([ in the prefix, you've chosen, are no KDE libraries installed. This will fail. So, check this please and use another prefix!]) fi ac_kde_libraries="$kde_libdir" if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then ac_cv_have_kde="have_kde=no" else ac_cv_have_kde="have_kde=yes \ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" fi else dnl test -z $1 ac_cv_have_kde="have_kde=no" fi ])dnl eval "$ac_cv_have_kde" if test "$have_kde" != "yes"; then if test "${prefix}" = NONE; then ac_kde_prefix="$ac_default_prefix" else ac_kde_prefix="$prefix" fi if test "$exec_prefix" = NONE; then ac_kde_exec_prefix="$ac_kde_prefix" AC_MSG_RESULT([will be installed in $ac_kde_prefix]) else ac_kde_exec_prefix="$exec_prefix" AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) fi kde_libraries="${ac_kde_exec_prefix}/lib" kde_includes=${ac_kde_prefix}/include else ac_cv_have_kde="have_kde=yes \ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) kde_libraries="$ac_kde_libraries" kde_includes="$ac_kde_includes" fi AC_SUBST(kde_libraries) AC_SUBST(kde_includes) if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then KDE_INCLUDES="" else KDE_INCLUDES="-I$kde_includes" all_includes="$KDE_INCLUDES $all_includes" fi KDE_LDFLAGS="-L$kde_libraries" if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then all_libraries="$all_libraries $KDE_LDFLAGS" fi AC_SUBST(KDE_LDFLAGS) AC_SUBST(KDE_INCLUDES) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) all_libraries="$all_libraries $USER_LDFLAGS" all_includes="$all_includes $USER_INCLUDES" AC_SUBST(all_includes) AC_SUBST(all_libraries) AC_SUBST(AUTODIRS) ]) AC_DEFUN(KDE_CHECK_EXTRA_LIBS, [ AC_MSG_CHECKING(for extra includes) AC_ARG_WITH(extra-includes, [ --with-extra-includes=DIR adds non standard include paths], kde_use_extra_includes="$withval", kde_use_extra_includes=NONE ) kde_extra_includes= if test -n "$kde_use_extra_includes" && \ test "$kde_use_extra_includes" != "NONE"; then ac_save_ifs=$IFS IFS=':' for dir in $kde_use_extra_includes; do kde_extra_includes="$kde_extra_includes $dir" USER_INCLUDES="$USER_INCLUDES -I$dir" done IFS=$ac_save_ifs kde_use_extra_includes="added" else kde_use_extra_includes="no" fi AC_SUBST(USER_INCLUDES) AC_MSG_RESULT($kde_use_extra_includes) kde_extra_libs= AC_MSG_CHECKING(for extra libs) AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR adds non standard library paths], kde_use_extra_libs=$withval, kde_use_extra_libs=NONE ) if test -n "$kde_use_extra_libs" && \ test "$kde_use_extra_libs" != "NONE"; then ac_save_ifs=$IFS IFS=':' for dir in $kde_use_extra_libs; do kde_extra_libs="$kde_extra_libs $dir" KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" USER_LDFLAGS="$USER_LDFLAGS -L$dir" done IFS=$ac_save_ifs kde_use_extra_libs="added" else kde_use_extra_libs="no" fi AC_SUBST(USER_LDFLAGS) AC_MSG_RESULT($kde_use_extra_libs) ]) AC_DEFUN(KDE_1_CHECK_PATH_HEADERS, [ AC_MSG_CHECKING([for KDE headers installed]) AC_LANG_SAVE AC_LANG_CPLUSPLUS cat > conftest.$ac_ext < #endif #include #include "confdefs.h" #include int main() { printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); printf("kde_wallpaperdir=\\"%s\\"\n", KApplication::kde_wallpaperdir().data()); printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); printf("kde_moduledir=\\"/tmp/dummy\\"\n"); return 0; } EOF ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext' if AC_TRY_EVAL(ac_compile); then AC_MSG_RESULT(yes) else AC_MSG_ERROR([your system is not able to compile a small KDE application! Check, if you installed the KDE header files correctly. For more details about this problem, look at the end of config.log.]) fi AC_LANG_RESTORE ]) AC_DEFUN(KDE_CHECK_KDEQTADDON, [ AC_MSG_CHECKING(for kde-qt-addon) AC_CACHE_VAL(kde_cv_have_kdeqtaddon, [ kde_ldflags_safe="$LDFLAGS" kde_libs_safe="$LIBS" kde_cxxflags_safe="$CXXFLAGS" LIBS="-lkde-qt-addon $LIBQT $LIBS" CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" AC_TRY_LINK([ #include ], [ QDomDocument doc; ], kde_cv_have_kdeqtaddon=yes, kde_cv_have_kdeqtaddon=no ) LDFLAGS=$kde_ldflags_safe LIBS=$kde_libs_safe kde_cxxflags_safe="$CXXFLAGS" ]) AC_MSG_RESULT($kde_cv_have_kdeqtaddon) if test "$kde_cv_have_kdeqtaddon" = "no"; then AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first. It is a separate package (and CVS module) named kde-qt-addon.]) fi ]) AC_DEFUN(KDE_CHECK_KIMGIO, [ AC_REQUIRE([AC_BASE_PATH_KDE]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_REQUIRE([AC_FIND_TIFF]) AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([AC_FIND_PNG]) AC_REQUIRE([KDE_CREATE_LIBS_ALIASES]) if test "$1" = "existance"; then AC_LANG_SAVE AC_LANG_CPLUSPLUS kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm" AC_CHECK_LIB(kimgio, kimgioRegister, [ LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no) LIBS="$kde_save_LIBS" AC_LANG_RESTORE else LIBKIMGIO_EXISTS=yes fi if test "$LIBKIMGIO_EXISTS" = "yes"; then LIB_KIMGIO='-lkimgio' else LIB_KIMGIO='' fi AC_SUBST(LIB_KIMGIO) ]) AC_DEFUN(KDE_CREATE_LIBS_ALIASES, [ AC_REQUIRE([KDE_MISC_TESTS]) AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([K_PATH_X]) if test $kde_qtver != 1; then LIB_KDECORE='-lkdecore' AC_SUBST(LIB_KDECORE) LIB_KDEUI='-lkdeui' AC_SUBST(LIB_KDEUI) LIB_KFORMULA='-lkformula' AC_SUBST(LIB_KFORMULA) LIB_KIO='-lkio' AC_SUBST(LIB_KIO) LIB_KSYCOCA='-lksycoca' AC_SUBST(LIB_KSYCOCA) LIB_SMB='-lsmb' AC_SUBST(LIB_SMB) LIB_KFILE='-lkfile' AC_SUBST(LIB_KFILE) LIB_KAB='-lkab' AC_SUBST(LIB_KAB) LIB_KHTML='-lkhtml' AC_SUBST(LIB_KHTML) LIB_KSPELL='-lkspell' AC_SUBST(LIB_KSPELL) LIB_KPARTS='-lkparts' AC_SUBST(LIB_KPARTS) LIB_KWRITE='-lkwrite' AC_SUBST(LIB_KWRITE) else LIB_KDECORE='-lkdecore -lXext $(LIB_QT)' AC_SUBST(LIB_KDECORE) LIB_KDEUI='-lkdeui $(LIB_KDECORE)' AC_SUBST(LIB_KDEUI) LIB_KFM='-lkfm $(LIB_KDECORE)' AC_SUBST(LIB_KFM) LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)' AC_SUBST(LIB_KFILE) LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)' AC_SUBST(LIB_KAB) fi ]) AC_DEFUN(AC_PATH_KDE, [ AC_BASE_PATH_KDE AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install], [ if test "$enableval" = "no"; then ac_use_path_checking="default" else ac_use_path_checking="" fi ], [ if test "$kde_qtver" = 1; then ac_use_path_checking="" else ac_use_path_checking="default" fi ] ) AC_CREATE_KFSSTND($ac_use_path_checking) AC_SUBST_KFSSTND KDE_CREATE_LIBS_ALIASES ]) dnl obsolete AC_DEFUN(AC_CHECK_SETENV, [ AC_OBSOLETE([$0], [; instead use AC_CHECK_FUNCS([setenv unsetenv])])dnl AC_CHECK_FUNCS([setenv unsetenv]) ]) AC_DEFUN(AC_CHECK_GETDOMAINNAME, [ AC_MSG_CHECKING(for getdomainname) AC_CACHE_VAL(ac_cv_func_getdomainname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS save_CXXFLAGS="$CXXFLAGS" kde_safe_LIBS="$LIBS" LIBS="$LIBS $X_EXTRA_LIBS" if test "$GCC" = "yes"; then CXXFLAGS="$CXXFLAGS -pedantic-errors" fi AC_TRY_COMPILE([ #include #include ], [ char buffer[200]; getdomainname(buffer, 200); ], ac_cv_func_getdomainname=yes, ac_cv_func_getdomainname=no) CXXFLAGS="$save_CXXFLAGS" LIBS=$kde_safe_LIBS AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_getdomainname) AC_MSG_CHECKING([if getdomainname needs custom prototype]) AC_CACHE_VAL(ac_cv_proto_getdomainname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then ac_cv_proto_getdomainname=no else kde_safe_libs=$LIBS LIBS="$LIBS $X_EXTRA_LIBS" AC_TRY_LINK([ #include #include extern "C" int getdomainname (char *, int); ], [ char buffer[200]; getdomainname(buffer, 200); ], ac_cv_func_getdomainname=yes ac_cv_proto_getdomainname=yes, AC_MSG_RESULT([fatal error]) AC_MSG_ERROR([getdomainname unavailable])) fi LIBS=$kde_safe_libs AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_proto_getdomainname) if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname]) fi if eval "test \"`echo $ac_cv_proto_getdomainname`\" = no"; then AC_DEFINE(HAVE_GETDOMAINNAME_PROTO, 1, [Define if you have getdomainname prototype]) fi ]) AC_DEFUN(AC_CHECK_GETHOSTNAME, [ AC_MSG_CHECKING([for gethostname]) AC_CACHE_VAL(ac_cv_func_gethostname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS save_CXXFLAGS="$CXXFLAGS" if test "$GCC" = "yes"; then CXXFLAGS="$CXXFLAGS -pedantic-errors" fi AC_TRY_LINK([ #include #include ], [ char buffer[200]; gethostname(buffer, 200); ], ac_cv_func_gethostname=yes, ac_cv_func_gethostname=no) CXXFLAGS="$save_CXXFLAGS" AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_gethostname) AC_MSG_CHECKING([if gethostname needs custom prototype]) AC_CACHE_VAL(ac_cv_proto_gethostname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then ac_cv_proto_gethostname=no else AC_TRY_LINK([ #include #include extern "C" int gethostname (char *, int); ], [ char buffer[200]; gethostname(buffer, 200); ], ac_cv_func_gethostname=yes ac_cv_proto_gethostname=yes, AC_MSG_RESULT([fatal error]) AC_MSG_ERROR(gethostname unavailable)) fi AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_proto_gethostname) if eval "test \"`echo $ac_cv_proto_gethostname`\" = no"; then AC_DEFINE(HAVE_GETHOSTNAME_PROTO, 1, [Define if you have gethostname prototype]) fi if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have gethostname]) fi ]) AC_DEFUN(AC_CHECK_USLEEP, [ AC_MSG_CHECKING([for usleep]) AC_CACHE_VAL(ac_cv_func_usleep, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_libs_safe="$LIBS" LIBS="$LIBS $LIBUCB" AC_TRY_LINK([ #include #include ], [ usleep(200); ], ac_cv_func_usleep=yes, ac_cv_func_usleep=no) LIBS="$ac_libs_safe" AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_usleep) if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function]) fi ]) AC_DEFUN(AC_CHECK_RANDOM, [ AC_MSG_CHECKING([for random]) AC_CACHE_VAL(ac_cv_func_random, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_libs_safe="$LIBS" LIBS="$LIBS $LIBUCB" AC_TRY_LINK([ #include ], [ random(); ], ac_cv_func_random=yes, ac_cv_func_random=no) LIBS="$ac_libs_safe" AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_random) if eval "test \"`echo $ac_cv_func_random`\" = yes"; then AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random]) fi ]) AC_DEFUN(AC_FIND_GIF, [AC_MSG_CHECKING([for giflib]) AC_CACHE_VAL(ac_cv_lib_gif, [ac_save_LIBS="$LIBS" LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" AC_TRY_LINK(dnl [ #ifdef __cplusplus extern "C" { #endif int GifLastError(void); #ifdef __cplusplus } #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ], [return GifLastError();], eval "ac_cv_lib_gif=yes", eval "ac_cv_lib_gif=no") LIBS="$ac_save_LIBS" ])dnl if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) else AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) fi ]) AC_DEFUN(KDE_FIND_JPEG_HELPER, [ AC_MSG_CHECKING([for libjpeg$2]) AC_CACHE_VAL(ac_cv_lib_jpeg_$1, [ AC_LANG_C ac_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" AC_TRY_LINK( [/* Override any gcc2 internal prototype to avoid an error. */ struct jpeg_decompress_struct; typedef struct jpeg_decompress_struct * j_decompress_ptr; typedef int size_t; #ifdef __cplusplus extern "C" { #endif void jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, size_t structsize); #ifdef __cplusplus } #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ], [jpeg_CreateDecompress(0L, 0, 0);], eval "ac_cv_lib_jpeg_$1=-ljpeg$2", eval "ac_cv_lib_jpeg_$1=no") LIBS="$ac_save_LIBS" CFLAGS="$ac_save_CFLAGS" ]) if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then LIBJPEG="$ac_cv_lib_jpeg_$1" AC_MSG_RESULT($ac_cv_lib_jpeg_$1) else AC_MSG_RESULT(no) $3 fi ]) AC_DEFUN(AC_FIND_JPEG, [ dnl first look for libraries KDE_FIND_JPEG_HELPER(6b, 6b, KDE_FIND_JPEG_HELPER(normal, [], [ LIBJPEG= ] ) ) dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h dnl requires system dependent includes loaded before it) jpeg_incdirs="/usr/include /usr/local/include $kde_extra_includes" AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir) test "x$jpeg_incdir" = xNO && jpeg_incdir= dnl if headers _and_ libraries are missing, this is no error, and we dnl continue with a warning (the user will get no jpeg support in khtml) dnl if only one is missing, it means a configuration error, but we still dnl only warn if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) else if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then AC_MSG_WARN([ There is an installation error in jpeg support. You seem to have only one of either the headers _or_ the libraries installed. You may need to either provide correct --with-extra-... options, or the development package of libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ Disabling JPEG support. ]) else AC_MSG_WARN([libjpeg not found. disable JPEG support.]) fi jpeg_incdir= LIBJPEG= fi AC_SUBST(LIBJPEG) ]) AC_DEFUN(AC_FIND_ZLIB, [ AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_MSG_CHECKING([for libz]) AC_CACHE_VAL(ac_cv_lib_z, [ AC_LANG_C kde_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" kde_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" AC_TRY_LINK(dnl [ #include ], [return (zlibVersion() == ZLIB_VERSION); ], eval "ac_cv_lib_z='-lz'", eval "ac_cv_lib_z=no") LIBS="$kde_save_LIBS" CFLAGS="$kde_save_CFLAGS" ])dnl if test ! "$ac_cv_lib_z" = no; then AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) LIBZ="$ac_cv_lib_z" AC_SUBST(LIBZ) AC_MSG_RESULT($ac_cv_lib_z) else AC_MSG_ERROR(not found. Check your installation and look into config.log) LIBZ="" AC_SUBST(LIBZ) fi ]) AC_DEFUN(KDE_TRY_TIFFLIB, [ AC_MSG_CHECKING([for libtiff $1]) AC_CACHE_VAL(kde_cv_libtiff_$1, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS kde_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" kde_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" AC_TRY_LINK(dnl [ #include ], [return (TIFFOpen( "", "r") == 0); ], [ kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" ], [ kde_cv_libtiff_$1=no ]) LIBS="$kde_save_LIBS" CXXFLAGS="$kde_save_CXXFLAGS" AC_LANG_RESTORE ]) if test "$kde_cv_libtiff_$1" = "no"; then AC_MSG_RESULT(no) LIBTIFF="" $3 else LIBTIFF="$kde_cv_libtiff_$1" AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) $2 fi ]) AC_DEFUN(AC_FIND_TIFF, [ AC_REQUIRE([K_PATH_X]) AC_REQUIRE([AC_FIND_ZLIB]) AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) KDE_TRY_TIFFLIB(tiff, [], KDE_TRY_TIFFLIB(tiff34)) AC_SUBST(LIBTIFF) ]) AC_DEFUN(AC_FIND_PNG, [ AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_REQUIRE([AC_FIND_ZLIB]) AC_MSG_CHECKING([for libpng]) AC_CACHE_VAL(ac_cv_lib_png, [ kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" kde_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" AC_LANG_C AC_TRY_LINK(dnl [ #include ], [ png_structp png_ptr = png_create_read_struct( /* image ptr */ PNG_LIBPNG_VER_STRING, 0, 0, 0 ); return( png_ptr != 0 ); ], eval "ac_cv_lib_png='-lpng $LIBZ -lm'", eval "ac_cv_lib_png=no" ) LIBS="$kde_save_LIBS" CFLAGS="$kde_save_CFLAGS" ])dnl if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) LIBPNG="$ac_cv_lib_png" AC_SUBST(LIBPNG) AC_MSG_RESULT($ac_cv_lib_png) else AC_MSG_RESULT(no) LIBPNG="" AC_SUBST(LIBPNG) fi ]) AC_DEFUN(AC_CHECK_BOOL, [ AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool]) ]) AC_DEFUN(AC_CHECK_GNU_EXTENSIONS, [ AC_MSG_CHECKING(if you need GNU extensions) AC_CACHE_VAL(ac_cv_gnu_extensions, [ cat > conftest.c << EOF #include #ifdef __GNU_LIBRARY__ yes #endif EOF if (eval "$ac_cpp conftest.c") 2>&5 | egrep "yes" >/dev/null 2>&1; then rm -rf conftest* ac_cv_gnu_extensions=yes else ac_cv_gnu_extensions=no fi ]) AC_MSG_RESULT($ac_cv_gnu_extensions) if test "$ac_cv_gnu_extensions" = "yes"; then AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) fi ]) AC_DEFUN(KDE_CHECK_COMPILER_FLAG, [ dnl AC_REQUIRE([AC_CHECK_COMPILERS]) <- breaks with autoconf 2.50 AC_MSG_CHECKING(whether $CXX supports -$1) kde_cache=`echo $1 | sed 'y%.=/+-%___p_%'` AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, [ echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then if test -z "`$CXX -$1 -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* ]) if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then AC_MSG_RESULT(yes) : $2 else AC_MSG_RESULT(no) : $3 fi ]) dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever]) dnl it's all white-space separated AC_DEFUN(AC_REMOVE_FORBIDDEN, [ __val=$$1 __forbid=" $2 " if test -n "$__val"; then __new="" ac_save_IFS=$IFS IFS=" " for i in $__val; do case "$__forbid" in *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;; *) # Careful to not add spaces, where there were none, because otherwise # libtool gets confused, if we change e.g. CXX if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; esac done IFS=$ac_save_IFS $1=$__new fi ]) dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given AC_DEFUN(AC_VALIDIFY_CXXFLAGS, [dnl AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath]) AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath]) ]) AC_DEFUN(AC_CHECK_COMPILERS, [ AC_ARG_ENABLE(debug,[ --enable-debug enables debug symbols [default=no]], [ if test $enableval = "no"; dnl then kde_use_debug_code="no" kde_use_debug_define=yes else kde_use_debug_code="yes" kde_use_debug_define=no fi ], [kde_use_debug_code="no" kde_use_debug_define=no ]) dnl Just for configure --help AC_ARG_ENABLE(dummyoption,[ --disable-debug disables debug output and debug symbols [default=no]],[],[]) AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)], [ if test $enableval = "no"; then kde_use_strict_options="no" else kde_use_strict_options="yes" fi ], [kde_use_strict_options="no"]) AC_ARG_ENABLE(profile,[ --enable-profile creates profiling infos [default=no]], [kde_use_profiling=$enableval], [kde_use_profiling="no"] ) dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS CFLAGS=" $CFLAGS" AC_PROG_CC if test "$GCC" = "yes"; then if test "$kde_use_debug_code" = "yes"; then CFLAGS="-g -O2 $CFLAGS" case $host in *-*-linux-gnu) CFLAGS="-ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" ;; esac else CFLAGS="-O2 $CFLAGS" fi fi if test "$kde_use_debug_define" = "yes"; then CFLAGS="-DNDEBUG $CFLAGS" fi case "$host" in *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; esac if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then LDFLAGS="" fi CXXFLAGS=" $CXXFLAGS" AC_PROG_CXX if test "$GXX" = "yes"; then if test "$kde_use_debug_code" = "yes"; then CXXFLAGS="-g -O2 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS" KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"]) KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"]) KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"]) case $host in dnl *-*-linux-gnu) CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wbad-function-cast -Wcast-align -Wundef -Wconversion $CXXFLAGS" ;; esac if test "$kde_use_strict_options" = "yes"; then CXXFLAGS="-Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align $CXXFLAGS" fi if test "$kde_very_strict" = "yes"; then CXXFLAGS="-Wold-style-cast -Wredundant-decls -Wconversion $CXXFLAGS" fi else CXXFLAGS="-O2 $CXXFLAGS" fi fi if test "$kde_use_debug_define" = "yes"; then CXXFLAGS="-DNDEBUG $CXXFLAGS" fi if test "$kde_use_profiling" = "yes"; then KDE_CHECK_COMPILER_FLAG(pg, [ CFLAGS="-pg $CFLAGS" CXXFLAGS="-pg $CXXFLAGS" ]) fi KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"]) KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"]) KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= ) AC_SUBST(USE_EXCEPTIONS) dnl obsolete macro - provided to keep things going USE_RTTI= AC_SUBST(USE_RTTI) case "$host" in *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; *-*-solaris*) if test "$GXX" = yes; then libstdcpp=`$CXX -print-file-name=libstdc++.so` if test ! -f $libstdcpp; then AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so]) fi fi ;; esac AC_VALIDIFY_CXXFLAGS AC_PROG_CXXCPP # the following is to allow programs, that are known to # have problems when compiled with -O2 if test -n "$CXXFLAGS"; then kde_safe_IFS=$IFS IFS=" " NOOPT_CXXFLAGS="" for i in $CXXFLAGS; do case $i in -O*) ;; *) NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i" ;; esac done IFS=$kde_safe_IFS fi AC_SUBST(NOOPT_CXXFLAGS) KDE_CHECK_FINAL ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) KDE_CXXFLAGS= AC_SUBST(KDE_CXXFLAGS) ]) AC_DEFUN(KDE_ADD_DEPENDENCIES, [ [A]M_DEPENDENCIES(CC) [A]M_DEPENDENCIES(CXX) ]) dnl just a wrapper to clean up configure.in AC_DEFUN(KDE_PROG_LIBTOOL, [ AC_REQUIRE([AC_CHECK_COMPILERS]) AC_REQUIRE([AC_ENABLE_SHARED]) AC_REQUIRE([AC_ENABLE_STATIC]) AC_REQUIRE([AC_LIBTOOL_DLOPEN]) AC_LANG_SAVE AC_LANG_C AC_OBJEXT AC_EXEEXT AC_LANG_RESTORE AM_PROG_LIBTOOL AC_LIBTOOL_CXX LIBTOOL_SHELL="/bin/sh ./libtool" # LIBTOOL="$LIBTOOL --silent" KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_RPATH)" AC_SUBST(KDE_PLUGIN) AC_ARG_ENABLE(objprelink, [ --enable-objprelink prelink apps using objprelink (experimental [only tested on linux/386])], kde_use_objprelink=$enableval, kde_use_objprelink=no) if test "x$kde_use_objprelink" = "xyes"; then KDE_FIND_PATH(objprelink, OBJPRELINK, [], [kde_use_objprelink=no]) if test "x$kde_use_objprelink" = "xyes"; then AC_MSG_CHECKING([Patching libtool to run objprelink.]) mv libtool libtool.orig cat > libtool <<\EOF #! /bin/sh for n ; do case $n in *.o) test -r $n && echo objprelink $n && objprelink $n ;; *.lo) m=`basename $n .lo`".o" && test -r $m && echo objprelink $m && objprelink $m m=".libs/$m" && test -r $m && echo objprelink $m && objprelink $m ;; esac; done EOF cat >> libtool libtool.orig rm libtool.orig chmod a+x libtool AC_MSG_RESULT(done) fi fi ]) AC_DEFUN(KDE_CHECK_TYPES, [ AC_CHECK_SIZEOF(int, 4)dnl AC_CHECK_SIZEOF(long, 4)dnl AC_CHECK_SIZEOF(char *, 4)dnl AC_CHECK_SIZEOF(char, 1)dnl ])dnl AC_DEFUN(KDE_DO_IT_ALL, [ AC_CANONICAL_SYSTEM AC_ARG_PROGRAM AM_INIT_AUTOMAKE($1, $2) AM_DISABLE_LIBRARIES AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) AC_CHECK_COMPILERS KDE_PROG_LIBTOOL AM_KDE_WITH_NLS AC_PATH_KDE ]) AC_DEFUN(AC_CHECK_RPATH, [ AC_MSG_CHECKING(for rpath) AC_ARG_ENABLE(rpath, [ --disable-rpath do not use the rpath feature of ld], USE_RPATH=$enableval, USE_RPATH=yes) if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then KDE_RPATH="-R \$(kde_libraries)" if test -n "$qt_libraries"; then KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" fi dnl $x_libraries is set to /usr/lib in case if test -n "$X_LDFLAGS"; then KDE_RPATH="$KDE_RPATH -R \$(x_libraries)" fi if test -n "$KDE_EXTRA_RPATH"; then KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" fi fi AC_SUBST(KDE_EXTRA_RPATH) AC_SUBST(KDE_RPATH) AC_MSG_RESULT($USE_RPATH) ]) dnl Check for the type of the third argument of getsockname AC_DEFUN(AC_CHECK_SOCKLEN_T, [ AC_MSG_CHECKING(for socklen_t) AC_CACHE_VAL(ac_cv_socklen_t, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ #include #include ],[ socklen_t a=0; getsockname(0,(struct sockaddr*)0, &a); ], ac_cv_socklen_t=socklen_t, AC_TRY_COMPILE([ #include #include ],[ int a=0; getsockname(0,(struct sockaddr*)0, &a); ], ac_cv_socklen_t=int, ac_cv_socklen_t=size_t ) ) AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_socklen_t) if test "$ac_cv_socklen_t" != "socklen_t"; then AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t, [Define the real type of socklen_t]) fi AC_DEFINE_UNQUOTED(ksize_t, socklen_t, [Compatibility define]) ]) dnl This is a merge of some macros out of the gettext aclocal.m4 dnl since we don't need anything, I took the things we need dnl the copyright for them is: dnl > dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. dnl This Makefile.in is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. dnl > dnl for this file it is relicensed under LGPL AC_DEFUN(AM_KDE_WITH_NLS, [ dnl If we use NLS figure out what method AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) GMSGFMT=":" fi MSGFMT=$GMSGFMT AC_SUBST(GMSGFMT) AC_SUBST(MSGFMT) AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) dnl Test whether we really found GNU xgettext. if test "$XGETTEXT" != ":"; then dnl If it is no GNU xgettext we define it as : so that the dnl Makefiles still can work. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else AC_MSG_RESULT( [found xgettext programs is not GNU xgettext; ignore it]) XGETTEXT=":" fi fi AC_SUBST(XGETTEXT) ]) # Search path for a program which passes the given test. # Ulrich Drepper , 1996. # serial 1 # Stephan Kulow: I appended a _KDE against name conflicts dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE, [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in /*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in ifelse([$5], , $PATH, [$5]); do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test -n "[$]$1"; then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) # Check whether LC_MESSAGES is available in . # Ulrich Drepper , 1995. # serial 1 AC_DEFUN(AM_LC_MESSAGES, [if test $ac_cv_header_locale_h = yes; then AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) if test $am_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES]) fi fi]) dnl From Jim Meyering. dnl FIXME: migrate into libit. AC_DEFUN([AM_FUNC_OBSTACK], [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, [AC_TRY_LINK([#include "obstack.h"], [struct obstack *mem;obstack_free(mem,(char *) 0)], am_cv_func_obstack=yes, am_cv_func_obstack=no)]) if test $am_cv_func_obstack = yes; then AC_DEFINE(HAVE_OBSTACK) else LIBOBJS="$LIBOBJS obstack.o" fi ]) dnl From Jim Meyering. Use this if you use the GNU error.[ch]. dnl FIXME: Migrate into libit AC_DEFUN([AM_FUNC_ERROR_AT_LINE], [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], am_cv_lib_error_at_line=yes, am_cv_lib_error_at_line=no)]) if test $am_cv_lib_error_at_line = no; then LIBOBJS="$LIBOBJS error.o" fi AC_SUBST(LIBOBJS)dnl ]) # Macro to add for using GNU gettext. # Ulrich Drepper , 1995. # serial 1 # Stephan Kulow: I put a KDE in it to avoid name conflicts AC_DEFUN(AM_KDE_GNU_GETTEXT, [AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_TYPE_OFF_T])dnl AC_REQUIRE([AC_TYPE_SIZE_T])dnl AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl AC_REQUIRE([AM_KDE_WITH_NLS])dnl AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h string.h values.h alloca.h]) AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ __argz_count __argz_stringify __argz_next]) AC_MSG_CHECKING(for stpcpy) AC_CACHE_VAL(kde_cv_func_stpcpy, [ kde_safe_cxxflags=$CXXFLAGS CXXFLAGS="-Wmissing-prototypes -Werror" AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ #include ], [ char buffer[200]; stpcpy(buffer, buffer); ], kde_cv_func_stpcpy=yes, kde_cv_func_stpcpy=no) AC_LANG_RESTORE CXXFLAGS=$kde_safe_cxxflags ]) AC_MSG_RESULT($kde_cv_func_stpcpy) if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) fi AM_LC_MESSAGES if test "x$CATOBJEXT" != "x"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else AC_MSG_CHECKING(for catalogs to be installed) NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; esac done LINGUAS=$NEW_LINGUAS AC_MSG_RESULT($LINGUAS) fi dnl Construct list of names of catalog files to be constructed. if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi fi ]) AC_DEFUN(AC_HAVE_XPM, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= test -z "$XPM_INCLUDE" && XPM_INCLUDE= AC_ARG_WITH(xpm, [ --without-xpm disable color pixmap XPM tests], xpm_test=$withval, xpm_test="yes") if test "x$xpm_test" = xno; then ac_cv_have_xpm=no else AC_MSG_CHECKING(for XPM) AC_CACHE_VAL(ac_cv_have_xpm, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES" test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" AC_TRY_LINK([#include ],[], ac_cv_have_xpm="yes",ac_cv_have_xpm="no") LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" ])dnl if test "$ac_cv_have_xpm" = no; then AC_MSG_RESULT(no) XPM_LDFLAGS="" XPMINC="" $2 else AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) if test "$XPM_LDFLAGS" = ""; then XPMLIB='-lXpm $(LIB_X11)' else XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' fi if test "$XPM_INCLUDE" = ""; then XPMINC="" else XPMINC="-I$XPM_INCLUDE" fi AC_MSG_RESULT(yes) $1 fi fi AC_SUBST(XPMINC) AC_SUBST(XPMLIB) ]) AC_DEFUN(AC_HAVE_DPMS, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= DPMS_LIB= AC_ARG_WITH(dpms, [ --without-dpms disable DPMS power saving], dpms_test=$withval, dpms_test="yes") if test "x$dpms_test" = xno; then ac_cv_have_dpms=no else AC_MSG_CHECKING(for DPMS) dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms. dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms". AC_CACHE_VAL(ac_cv_have_dpms, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" ac_save_libs="$LIBS" LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES" test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" AC_TRY_LINK([ #include #include #include #include int foo_test_dpms() { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], ac_cv_have_dpms="yes", [ LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" LIBS="$LIBS -lXdpms" CFLAGS="$CFLAGS $X_INCLUDES" test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" AC_TRY_LINK([ #include #include #include #include int foo_test_dpms() { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], [ ac_cv_have_dpms="-lXdpms" ],ac_cv_have_dpms="no") ]) LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" LIBS="$ac_save_libs" ])dnl if test "$ac_cv_have_dpms" = no; then AC_MSG_RESULT(no) DPMS_LDFLAGS="" DPMSINC="" $2 else AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) if test "$ac_cv_have_dpms" = "-lXdpms"; then DPMS_LIB="-lXdpms" fi if test "$DPMS_LDFLAGS" = ""; then DPMSLIB="$DPMS_LIB "'$(LIB_X11)' else DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)' fi if test "$DPMS_INCLUDE" = ""; then DPMSINC="" else DPMSINC="-I$DPMS_INCLUDE" fi AC_MSG_RESULT(yes) $1 fi fi AC_SUBST(DPMSINC) AC_SUBST(DPMSLIB) ]) AC_DEFUN(AC_HAVE_GL, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$GL_LDFLAGS" && GL_LDFLAGS= test -z "$GL_INCLUDE" && GL_INCLUDE= AC_ARG_WITH(gl, [ --without-gl disable 3D GL modes], gl_test=$withval, gl_test="yes") if test "x$gl_test" = xno; then ac_cv_have_gl=no else AC_MSG_CHECKING(for GL) AC_CACHE_VAL(ac_cv_have_gl, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES" test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" AC_TRY_LINK([#include #include ], [], ac_cv_have_gl="mesa", ac_cv_have_gl="no") if test "x$ac_cv_have_gl" = "xno"; then LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGL -lGLU -lX11 -lXext -lm $LIBSOCKET" CFLAGS="$ac_save_cflags $X_INCLUDES" test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" AC_TRY_LINK([#include #include ], [], ac_cv_have_gl="yes", ac_cv_have_gl="no") fi LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" ])dnl if test "$ac_cv_have_gl" = "no"; then AC_MSG_RESULT(no) GL_LDFLAGS="" GLINC="" $2 else AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) if test "$GL_LDFLAGS" = ""; then if test "$ac_cv_have_gl" = "mesa"; then GLLIB='-lMesaGL -lMesaGLU $(LIB_X11)' else GLLIB='-lGL -lGLU $(LIB_X11)' fi else if test "$ac_cv_have_gl" = "mesa"; then GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU "'$(LIB_X11)' else GLLIB="$GL_LDFLAGS -lGL -lGLU "'$(LIB_X11)' fi fi if test "$GL_INCLUDE" = ""; then GLINC="" else GLINC="-I$GL_INCLUDE" fi AC_MSG_RESULT($ac_cv_have_gl) $1 fi fi AC_SUBST(GLINC) AC_SUBST(GLLIB) ]) dnl shadow password and PAM magic - maintained by ossi@kde.org AC_DEFUN(KDE_PAM, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_ARG_WITH(pam, [ --with-pam[=ARG] enable support for PAM: ARG=[yes|no|service name]], [ if test "x$withval" = "xyes"; then use_pam=yes pam_service=kde elif test "x$withval" = "xno"; then use_pam=no else use_pam=yes pam_service=$withval fi ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" ], [ AC_CACHE_VAL(ac_cv_path_pam, [ use_pam=no AC_CHECK_LIB(pam, pam_start, [ AC_CHECK_HEADER(security/pam_appl.h, [ use_pam=yes pam_service=kde ]) ], , $LIBDL) ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" ]) ]) eval "$ac_cv_path_pam" AC_MSG_CHECKING(for PAM) if test "x$use_pam" = xno; then AC_MSG_RESULT(no) PAMLIBS="" else AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)]) PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL" dnl test whether struct pam_message is const (Linux) or not (Sun) AC_MSG_CHECKING(for const pam_message) AC_EGREP_HEADER([struct pam_message], security/pam_appl.h, [ AC_EGREP_HEADER([const struct pam_message], security/pam_appl.h, [AC_MSG_RESULT([const: Linux-type PAM])], [AC_MSG_RESULT([nonconst: Sun-type PAM]) AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] )], [AC_MSG_RESULT([not found - assume const, Linux-type PAM])]) fi AC_SUBST(PAMLIBS) ]) dnl DEF_PAM_SERVICE(arg name, full name, define name) AC_DEFUN(DEF_PAM_SERVICE, [ AC_ARG_WITH($1-pam, [ --with-$1-pam=[val] override PAM service from --with-pam for $2], [ if test "x$use_pam" = xyes; then $3_PAM_SERVICE="$withval" else AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected. You may want to enforce it by using --with-pam.]) fi ], [ if test "x$use_pam" = xyes; then $3_PAM_SERVICE="$pam_service" fi ]) if test -n "$$3_PAM_SERVICE"; then AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE]) AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2]) fi AC_SUBST($3_PAM_SERVICE) ]) AC_DEFUN(KDE_SHADOWPASSWD, [ AC_REQUIRE([KDE_PAM]) AC_CHECK_LIB(shadow, getspent, [ LIBSHADOW="-lshadow" ac_use_shadow=yes ], [ dnl for UnixWare AC_CHECK_LIB(gen, getspent, [ LIBGEN="-lgen" ac_use_shadow=yes ], [ AC_CHECK_FUNC(getspent, [ ac_use_shadow=yes ], [ ac_use_shadow=no ]) ]) ]) AC_SUBST(LIBSHADOW) AC_SUBST(LIBGEN) AC_MSG_CHECKING([for shadow passwords]) AC_ARG_WITH(shadow, [ --with-shadow If you want shadow password support ], [ if test "x$withval" != "xno"; then use_shadow=yes else use_shadow=no fi ], [ use_shadow="$ac_use_shadow" ]) if test "x$use_shadow" = xyes; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords]) else AC_MSG_RESULT(no) LIBSHADOW= LIBGEN= fi dnl finally make the relevant binaries setuid root, if we have shadow passwds. dnl this still applies, if we could use it indirectly through pam. if test "x$use_shadow" = xyes || ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then case $host in *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) SETUIDFLAGS="-m 4755 -o root";; *) SETUIDFLAGS="-m 4755";; esac fi AC_SUBST(SETUIDFLAGS) ]) AC_DEFUN(KDE_PASSWDLIBS, [ AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT AC_REQUIRE([KDE_PAM]) AC_REQUIRE([KDE_SHADOWPASSWD]) if test "x$use_pam" = "xyes"; then PASSWDLIBS="$PAMLIBS" else PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN" fi AC_SUBST(PASSWDLIBS) ]) AC_DEFUN(KDE_CHECK_LIBDL, [ AC_CHECK_LIB(dl, dlopen, [ LIBDL="-ldl" ac_cv_have_dlfcn=yes ]) AC_CHECK_LIB(dld, shl_unload, [ LIBDL="-ldld" ac_cv_have_shload=yes ]) AC_SUBST(LIBDL) ]) AC_DEFUN(KDE_CHECK_DLOPEN, [ KDE_CHECK_LIBDL AC_CHECK_HEADERS(dlfcn.h dl.h) if test "$ac_cv_header_dlfcn_h" = "no"; then ac_cv_have_dlfcn=no fi if test "$ac_cv_header_dl_h" = "no"; then ac_cv_have_shload=no fi dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE dnl (MM) AC_ARG_ENABLE(dlopen, [ --disable-dlopen link statically [default=no]] , enable_dlopen=$enableval, enable_dlopen=yes) # override the user's opinion, if we know it better ;) if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then enable_dlopen=no fi if test "$ac_cv_have_dlfcn" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) fi if test "$ac_cv_have_shload" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) fi if test "$enable_dlopen" = no ; then test -n "$1" && eval $1 else test -n "$2" && eval $2 fi ]) AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING, [ KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) KDE_PROG_LIBTOOL AC_MSG_CHECKING([dynamic loading]) eval "`egrep '^build_libtool_libs=' libtool`" if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then dynamic_loading=yes AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) else dynamic_loading=no fi AC_MSG_RESULT($dynamic_loading) if test "$dynamic_loading" = "yes"; then $1 else $2 fi ]) AC_DEFUN(KDE_ADD_INCLUDES, [ if test -z "$1"; then test_include="Pix.h" else test_include="$1" fi AC_MSG_CHECKING([for libg++ ($test_include)]) AC_CACHE_VAL(kde_cv_libgpp_includes, [ kde_cv_libgpp_includes=no for ac_dir in \ \ /usr/include/g++ \ /usr/include \ /usr/unsupported/include \ /opt/include \ $extra_include \ ; \ do if test -r "$ac_dir/$test_include"; then kde_cv_libgpp_includes=$ac_dir break fi done ]) AC_MSG_RESULT($kde_cv_libgpp_includes) if test "$kde_cv_libgpp_includes" != "no"; then all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES" fi ]) ]) AC_DEFUN(KDE_CHECK_MICO, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([KDE_MISC_TESTS]) AC_MSG_CHECKING(for MICO) if test -z "$MICODIR"; then kde_micodir=/usr/local else kde_micodir="$MICODIR" fi AC_ARG_WITH(micodir, [ --with-micodir=micodir where mico is installed ], kde_micodir=$withval, kde_micodir=$kde_micodir ) AC_CACHE_VAL(kde_cv_mico_incdir, [ mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes" AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir) ]) kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'` if test ! -r $kde_micodir/include/CORBA.h; then AC_MSG_ERROR([No CORBA.h found, specify another micodir]) fi AC_MSG_RESULT($kde_micodir) MICO_INCLUDES=-I$kde_micodir/include AC_SUBST(MICO_INCLUDES) MICO_LDFLAGS=-L$kde_micodir/lib AC_SUBST(MICO_LDFLAGS) micodir=$kde_micodir AC_SUBST(micodir) AC_MSG_CHECKING([for MICO version]) AC_CACHE_VAL(kde_cv_mico_version, [ AC_LANG_C cat >conftest.$ac_ext < #include int main() { printf("MICO_VERSION=%s\n",MICO_VERSION); return (0); } EOF ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest' if AC_TRY_EVAL(ac_compile); then if eval `./conftest 2>&5`; then kde_cv_mico_version=$MICO_VERSION else AC_MSG_ERROR([your system is not able to execute a small application to find MICO version! Check $kde_micodir/include/mico/version.h]) fi else AC_MSG_ERROR([your system is not able to compile a small application to find MICO version! Check $kde_micodir/include/mico/version.h]) fi ]) dnl installed MICO version mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` if test "x$1" = "x"; then req_version="2.3.0" else req_version=$1 fi dnl required MICO version req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` if test "$mico_v_maj" -lt "$req_v_maj" || \ ( test "$mico_v_maj" -eq "$req_v_maj" && \ test "$mico_v_mid" -lt "$req_v_mid" ) || \ ( test "$mico_v_mid" -eq "$req_v_mid" && \ test "$mico_v_min" -lt "$req_v_min" ) then AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \ at least is required. You should upgrade MICO.]) else AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)]) fi LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL" AC_SUBST(LIBMICO) if test -z "$IDL"; then IDL='$(kde_bindir)/cuteidl' fi AC_SUBST(IDL) IDL_DEPENDENCIES='$(kde_includes)/CUTE.h' AC_SUBST(IDL_DEPENDENCIES) idldir="\$(includedir)/idl" AC_SUBST(idldir) ]) AC_DEFUN(KDE_CHECK_MINI_STL, [ AC_REQUIRE([KDE_CHECK_MICO]) AC_MSG_CHECKING(if we use mico's mini-STL) AC_CACHE_VAL(kde_cv_have_mini_stl, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS kde_save_cxxflags="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $MICO_INCLUDES" AC_TRY_COMPILE( [ #include ], [ #ifdef HAVE_MINI_STL #error "nothing" #endif ], kde_cv_have_mini_stl=no, kde_cv_have_mini_stl=yes) CXXFLAGS="$kde_save_cxxflags" AC_LANG_RESTORE ]) if test "x$kde_cv_have_mini_stl" = "xyes"; then AC_MSG_RESULT(yes) $1 else AC_MSG_RESULT(no) $2 fi ]) ]) AC_DEFUN(KDE_CHECK_LIBPTHREAD, [ AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] ) AC_SUBST(LIBPTHREAD) ]) AC_DEFUN(KDE_CHECK_PTHREAD_OPTION, [ AC_ARG_ENABLE(kernel-threads, [ --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.], kde_use_kernthreads=$enableval, kde_use_kernthreads=no) if test "$kde_use_kernthreads" = "yes"; then ac_save_CXXFLAGS="$CXXFLAGS" ac_save_CFLAGS="$CXXFLAGS" CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS" CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS" AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h) CXXFLAGS="$ac_save_CXXFLAGS" CFLAGS="$ac_save_CFLAGS" if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then kde_use_kernthreads=no else dnl Add proper -I and -l statements AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD if test "x$LIBPTHREAD" = "x"; then kde_use_kernthreads=no else USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads" fi fi else USE_THREADS="" if test -z "$LIBPTHREAD"; then KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] ) fi fi case $host_os in solaris*) KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"]) CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4" echo "Setting Solaris pthread compilation options" ;; freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" echo "Setting FreeBSD pthread compilation options" ;; aix*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" LIBPTHREAD="$LIBPTHREAD -lc_r" echo "Setting AIX pthread compilation options" ;; linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" USE_THREADS="$USE_THREADS -DPIC -fPIC" echo "Setting Linux pthread compilation options" ;; *) ;; esac AC_SUBST(USE_THREADS) AC_SUBST(LIBPTHREAD) ]) AC_DEFUN(KDE_CHECK_THREADING, [ AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION]) dnl default is yes if libpthread is found and no if no libpthread is available if test -z "$LIBPTHREAD"; then kde_check_threading_default=no else kde_check_threading_default=yes fi AC_ARG_ENABLE(threading, [ --disable-threading disables threading even if libpthread found ], kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default) if test "x$kde_use_threading" = "xyes"; then AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)]) fi ]) AC_DEFUN(KDE_TRY_LINK_PYTHON, [ if test "$kde_python_link_found" = no; then if test "$1" = normal; then AC_MSG_CHECKING(if a Python application links) else AC_MSG_CHECKING(if Python depends on $2) fi AC_CACHE_VAL(kde_cv_try_link_python_$1, [ AC_LANG_SAVE AC_LANG_C kde_save_cflags="$CFLAGS" CFLAGS="$CFLAGS $PYTHONINC" kde_save_libs="$LIBS" LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" kde_save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS $PYTHONLIB" AC_TRY_LINK( [ #include ],[ PySys_SetArgv(1, 0); ], [kde_cv_try_link_python_$1=yes], [kde_cv_try_link_python_$1=no] ) CFLAGS="$kde_save_cflags" LIBS="$kde_save_libs" LDFLAGS="$kde_save_ldflags" ]) if test "$kde_cv_try_link_python_$1" = "yes"; then AC_MSG_RESULT(yes) kde_python_link_found=yes if test ! "$1" = normal; then LIBPYTHON="$LIBPYTHON $2" fi $3 else AC_MSG_RESULT(no) $4 fi AC_LANG_RESTORE fi ]) AC_DEFUN(KDE_CHECK_PYTHON_DIR, [ AC_MSG_CHECKING([for Python directory]) AC_CACHE_VAL(kde_cv_pythondir, [ if test -z "$PYTHONDIR"; then kde_cv_pythondir=/usr/local else kde_cv_pythondir="$PYTHONDIR" fi ]) AC_ARG_WITH(pythondir, [ --with-pythondir=pythondir use python installed in pythondir ], [ ac_python_dir=$withval ], ac_python_dir=$kde_cv_pythondir ) AC_MSG_RESULT($ac_python_dir) ]) AC_DEFUN(KDE_CHECK_PYTHON_INTERN, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) AC_REQUIRE([KDE_CHECK_PYTHON_DIR]) if test -z "$1"; then version="1.5" else version="$1" fi AC_MSG_CHECKING([for Python$version]) python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) if test ! -r $python_incdir/Python.h; then AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) python_incdir=$python_incdir/python$version if test ! -r $python_incdir/Python.h; then python_incdir=no fi fi PYTHONINC=-I$python_incdir python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) if test ! -r $python_libdir/libpython$version.a; then AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) python_libdir=$python_libdir/python$version/config if test ! -r $python_libdir/libpython$version.a; then python_libdir=no fi fi PYTHONLIB=-L$python_libdir kde_orig_LIBPYTHON=$LIBPYTHON if test -z "$LIBPYTHON"; then LIBPYTHON=-lpython$version fi python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir) python_moddir=$python_moddir/python$version if test ! -r $python_moddir/copy.py; then python_moddir=no fi PYTHONMODDIR=$python_moddir AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir) if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then LIBPYTHON=$kde_orig_LIBPYTHON test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB="" test "x$PYTHONINC" = "x-Ino" && PYTHONINC="" $2 else dnl Note: this test is very weak kde_python_link_found=no KDE_TRY_LINK_PYTHON(normal) KDE_TRY_LINK_PYTHON(m, -lm) KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) KDE_TRY_LINK_PYTHON(tcl, -ltcl) KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm]) KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil]) KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil]) KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3]) KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil]) KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [], [AC_MSG_WARN([it seems, Python depends on another library. Pleae use \"make LIBPYTHON='-lpython$version -lotherlib'\" to fix this and contact the authors to let them know about this problem]) ]) LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" AC_SUBST(PYTHONINC) AC_SUBST(PYTHONLIB) AC_SUBST(LIBPYTHON) AC_SUBST(PYTHONMODDIR) AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python]) fi ]) AC_DEFUN(KDE_CHECK_PYTHON, [ KDE_CHECK_PYTHON_INTERN("2.1", [KDE_CHECK_PYTHON_INTERN("2.0", [ KDE_CHECK_PYTHON_INTERN($1, $2) ]) ]) ]) AC_DEFUN(KDE_CHECK_STL_SGI, [ AC_MSG_CHECKING([if STL implementation is SGI like]) AC_CACHE_VAL(kde_cv_stl_type_sgi, [ AC_TRY_COMPILE([ #include using namespace std; ],[ string astring="Hallo Welt."; astring.erase(0, 6); // now astring is "Welt" return 0; ], kde_cv_stl_type_sgi=yes, kde_cv_stl_type_sgi=no) ]) AC_MSG_RESULT($kde_cv_stl_type_sgi) if test "$kde_cv_stl_type_sgi" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) fi ]) AC_DEFUN(KDE_CHECK_STL_HP, [ AC_MSG_CHECKING([if STL implementation is HP like]) AC_CACHE_VAL(kde_cv_stl_type_hp, [ AC_TRY_COMPILE([ #include using namespace std; ],[ string astring="Hello World"; astring.remove(0, 6); // now astring is "World" return 0; ], kde_cv_stl_type_hp=yes, kde_cv_stl_type_hp=no) ]) AC_MSG_RESULT($kde_cv_stl_type_hp) if test "$kde_cv_stl_type_hp" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by HP]) fi ]) AC_DEFUN(KDE_CHECK_STL, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`" KDE_CHECK_STL_SGI if test "$kde_cv_stl_type_sgi" = "no"; then KDE_CHECK_STL_HP if test "$kde_cv_stl_type_hp" = "no"; then AC_MSG_ERROR("no known STL type found") fi fi CXXFLAGS="$ac_save_CXXFLAGS" AC_LANG_RESTORE ]) AC_DEFUN(AC_FIND_QIMGIO, [AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_MSG_CHECKING([for qimgio]) AC_CACHE_VAL(ac_cv_lib_qimgio, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_save_LIBS="$LIBS" ac_save_CXXFLAGS="$CXXFLAGS" LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" AC_TRY_RUN(dnl [ #include #include int main() { QString t = "hallo"; t.fill('t'); qInitImageIO(); } ], ac_cv_lib_qimgio=yes, ac_cv_lib_qimgio=no, ac_cv_lib_qimgio=no) LIBS="$ac_save_LIBS" CXXFLAGS="$ac_save_CXXFLAGS" AC_LANG_RESTORE ])dnl if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) AC_SUBST(LIBQIMGIO) else AC_MSG_RESULT(not found) fi ]) AC_DEFUN(KDE_CHECK_ANSI, [ ]) AC_DEFUN(KDE_CHECK_INSURE, [ AC_ARG_ENABLE(insure, [ --enable-insure use insure++ for debugging [default=no]], [ if test $enableval = "no"; dnl then ac_use_insure="no" else ac_use_insure="yes" fi ], [ac_use_insure="no"]) AC_MSG_CHECKING(if we will use Insure++ to debug) AC_MSG_RESULT($ac_use_insure) if test "$ac_use_insure" = "yes"; dnl then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "???? fi ]) AC_DEFUN(AM_DISABLE_LIBRARIES, [ AC_PROVIDE([AM_ENABLE_STATIC]) AC_PROVIDE([AM_ENABLE_SHARED]) enable_static=no enable_shared=yes ]) AC_DEFUN(AC_CHECK_UTMP_FILE, [ AC_MSG_CHECKING([for utmp file]) AC_CACHE_VAL(kde_cv_utmp_file, [ kde_cv_utmp_file=no for ac_file in \ \ /var/run/utmp \ /var/adm/utmp \ /etc/utmp \ ; \ do if test -r "$ac_file"; then kde_cv_utmp_file=$ac_file break fi done ]) if test "$kde_cv_utmp_file" != "no"; then AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) $1 AC_MSG_RESULT($kde_cv_utmp_file) else $2 AC_MSG_RESULT([non found]) fi ]) AC_DEFUN(KDE_CREATE_SUBDIRSLIST, [ DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" if test ! -s $srcdir/subdirs; then dnl Note: Makefile.common creates subdirs, so this is just a fallback TOPSUBDIRS="" files=`cd $srcdir && ls -1` dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` for i in $dirs; do echo $i >> $srcdir/subdirs done fi if test -s $srcdir/inst-apps; then ac_topsubdirs="`cat $srcdir/inst-apps`" else ac_topsubdirs="`cat $srcdir/subdirs`" fi for i in $ac_topsubdirs; do AC_MSG_CHECKING([if $i should be compiled]) if test -d $srcdir/$i; then install_it="yes" for j in $DO_NOT_COMPILE; do if test $i = $j; then install_it="no" fi done else install_it="no" fi AC_MSG_RESULT($install_it) if test $install_it = "yes"; then TOPSUBDIRS="$TOPSUBDIRS $i" fi done AC_SUBST(TOPSUBDIRS) ]) AC_DEFUN(KDE_CHECK_NAMESPACES, [ AC_MSG_CHECKING(whether C++ compiler supports namespaces) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ ], [ namespace Foo { extern int i; namespace Bar { extern int i; } } int Foo::i = 0; int Foo::Bar::i = 1; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NAMESPACES) ], [ AC_MSG_RESULT(no) ]) AC_LANG_RESTORE ]) AC_DEFUN(KDE_CHECK_NEWLIBS, [ ]) dnl ------------------------------------------------------------------------ dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_CHECK_S_ISSOCK, [ AC_MSG_CHECKING(for S_ISSOCK) AC_CACHE_VAL(ac_cv_have_s_issock, [ AC_LANG_SAVE AC_LANG_C AC_TRY_LINK( [ #include ], [ struct stat buff; int b = S_ISSOCK( buff.st_mode ); ], ac_cv_have_s_issock=yes, ac_cv_have_s_issock=no) AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_have_s_issock) if test "$ac_cv_have_s_issock" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) fi ]) dnl ------------------------------------------------------------------------ dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_CHECK_KDEMAXPATHLEN, [ AC_MSG_CHECKING(for MAXPATHLEN) AC_CACHE_VAL(ac_cv_maxpathlen, [ AC_LANG_C cat > conftest.$ac_ext < #endif #include #include #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif KDE_HELLO MAXPATHLEN EOF ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" if AC_TRY_EVAL(ac_try) && test -s conftest.out; then ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` else ac_cv_maxpathlen=1024 fi rm conftest.* ]) AC_MSG_RESULT($ac_cv_maxpathlen) AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] ) ]) dnl ------------------------------------------------------------------------- dnl See if the compiler supports a template repository bero@redhat.de dnl ------------------------------------------------------------------------- AC_DEFUN(KDE_COMPILER_REPO, [ REPO="" NOREPO="" KDE_CHECK_COMPILER_FLAG(frepo, [ REPO="-frepo" NOREPO="-fno-repo" ]) if test -z "$REPO"; then KDE_CHECK_COMPILER_FLAG(instances=explicit, [ REPO="-instances=explicit" NOREPO="-instances=extern" ]) fi if test -n "$REPO"; then AC_DEFINE_UNQUOTED(HAVE_TEMPLATE_REPOSITORY, 1, [C++ compiler supports template repository]) $1 fi AC_SUBST(REPO) AC_SUBST(NOREPO) ]) AC_DEFUN(KDE_CHECK_HEADER, [ AC_LANG_SAVE kde_safe_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $all_includes" AC_LANG_CPLUSPLUS AC_CHECK_HEADER($1, $2, $3) CPPFLAGS=$kde_safe_cppflags AC_LANG_RESTORE ]) AC_DEFUN(KDE_FAST_CONFIGURE, [ dnl makes configure fast (needs perl) AC_ARG_ENABLE(fast-perl, [ --disable-fast-perl disable fast Makefile generation (needs perl)], with_fast_perl=$enableval, with_fast_perl=yes) ]) AC_DEFUN(KDE_CONF_FILES, [ val= if test -f $srcdir/configure.files ; then val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files` fi CONF_FILES= if test -n "$val" ; then for i in $val ; do CONF_FILES="$CONF_FILES $i" done fi AC_SUBST(CONF_FILES) ])dnl AC_DEFUN(KDE_SET_PREFIX, [ unset CDPATH dnl make $KDEDIR the default for the installation AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix ac_configure_args="$ac_configure_args --prefix $prefix" fi KDE_FAST_CONFIGURE KDE_CONF_FILES ]) pushdef([AC_PROG_INSTALL], [ dnl our own version, testing for a -p flag popdef([AC_PROG_INSTALL]) dnl as AC_PROG_INSTALL works as it works we first have dnl to save if the user didn't specify INSTALL, as the dnl autoconf one overwrites INSTALL and we have no chance to find dnl out afterwards test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT AC_PROG_INSTALL if test -z "$kde_save_INSTALL_given" ; then # OK, user hasn't given any INSTALL, autoconf found one for us # now we test, if it supports the -p flag AC_MSG_CHECKING(for -p flag to install) rm -f confinst.$$.* > /dev/null 2>&1 echo "Testtest" > confinst.$$.orig ac_res=no if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then if test -f confinst.$$.new ; then # OK, -p seems to do no harm to install INSTALL="${INSTALL} -p" ac_res=yes fi fi rm -f confinst.$$.* AC_MSG_RESULT($ac_res) fi dnl the following tries to resolve some signs and wonders coming up dnl with different autoconf/automake versions dnl e.g.: dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS) dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the dnl install-@DIR@PROGRAMS targets to explicitly use that flag dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as dnl INSTALL_SCRIPT, which breaks with automake <= 1.4 dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from dnl automake (due to broken Makefile.am or whatever) to install programs, dnl and so does not see the -s flag in automake > 1.4 dnl to clean up that mess we: dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG dnl which cleans KDE's program with automake > 1.4; dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems dnl with automake<=1.4 dnl note that dues to this sometimes two '-s' flags are used (if KDE dnl properly uses install-@DIR@PROGRAMS, but I don't care dnl dnl And to all this comes, that I even can't write in comments variable dnl names used by automake, because it is so stupid to think I wanted to dnl _use_ them, therefor I have written A_M_... instead of AM_ dnl hmm, I wanted to say something ... ahh yes: Arghhh. if test -z "$kde_save_INSTALL_PROGRAM_given" ; then INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' fi if test -z "$kde_save_INSTALL_SCRIPT_given" ; then INSTALL_SCRIPT='${INSTALL}' fi ])dnl AC_DEFUN(KDE_LANG_CPLUSPLUS, [AC_LANG_CPLUSPLUS ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS]) ]) pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS ]) AC_DEFUN(KDE_CHECK_LONG_LONG, [ AC_MSG_CHECKING(for long long) AC_CACHE_VAL(kde_cv_c_long_long, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_LINK([], [ long long foo = 0; foo = foo+1; ], kde_cv_c_long_long=yes, kde_cv_c_long_long=no) ]) AC_MSG_RESULT($kde_cv_c_long_long) if test "$kde_cv_c_long_long" = yes; then AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype]) fi ]) AC_DEFUN(KDE_CHECK_LIB, [ kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries" case $host_os in aix*) LIBS="-brtl $LIBS" test "$GCC" = yes && LIBS="-Wl,$LIBS" ;; esac AC_CHECK_LIB($1, $2, $3, $4, $5) LIBS="$kde_save_LIBS" ]) AC_DEFUN(KDE_CHECK_INITGROUPS, [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS(initgroups) if test "x$ac_cv_func_initgroups" = "xyes"; then case $host_os in aix*) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_MSG_CHECKING([for initgroups prototype]) AC_CACHE_VAL(kde_cv_check_initgroups_proto, [ AC_TRY_COMPILE( [ #include ], [ char buffer[10]; gid_t id; int x = initgroups(buffer,id); ], kde_cv_check_initgroups_proto=yes, kde_cv_check_initgroups_proto=no) ]) AC_MSG_RESULT($kde_cv_check_initgroups_proto) AC_LANG_RESTORE ;; *) kde_cv_check_initgroups_proto=yes ;; esac else kde_cv_check_initgroups_proto=no fi if test "x$kde_cv_check_initgroups_proto" = "xyes"; then kde_check_initgroups_proto=1 else kde_check_initgroups_proto=0 fi AC_DEFINE_UNQUOTED(HAVE_INITGROUPS_PROTO,$kde_check_initgroups_proto, [initgroups may exist but not its prototype (e.g. AIX<4.3.3:8)]) ]) AC_DEFUN(KDE_CHECK_JAVA_DIR, [ AC_MSG_CHECKING([for Java directory]) AC_ARG_WITH(java, [ --with-java=javadir use java installed in javadir, --without-java disables ], [ ac_java_dir=$withval ], ac_java_dir="" ) dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH if test "x$ac_java_dir" = xno; then kde_cv_java_bindir=no kde_cv_java_includedir=no kde_java_libjvmdir=no kde_java_libhpidir=no else if test "x$ac_java_dir" = x; then dnl No option set -> look in $PATH AC_CACHE_VAL(kde_cv_java_bindir, [ dnl First look for javac in $PATH. If not found we'll look at the option. KDE_FIND_PATH(javac, JAVAC, [], []) if test -n "$JAVAC"; then kde_cv_java_bindir=`echo $JAVAC | sed -e 's,/javac$,/,'` dnl this substitution might not work - well, we test for jni.h below kde_cv_java_includedir=`echo $kde_cv_java_bindir | sed -e 's,bin/$,include/,'` else kde_cv_java_bindir=no fi ]) else dnl config option set kde_cv_java_bindir=$ac_java_dir/bin kde_cv_java_includedir=$ac_java_dir/include fi fi dnl At this point kde_cv_java_bindir and kde_cv_java_includedir are either set or "no" if test ! "x$kde_cv_java_bindir" = xno; then dnl Look for libjvm.so kde_java_libjvmdir=`find $kde_cv_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` dnl Look for libhpi.so and avoid green threads kde_java_libhpidir=`find $kde_cv_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,'` dnl Now check everything's fine under there if test ! -x "$kde_cv_java_bindir/javac"; then AC_MSG_ERROR([javac not found under $kde_cv_java_bindir - it seems you passed a wrong --with-java.]) fi if test ! -x "$kde_cv_java_bindir/javah"; then AC_MSG_ERROR([javah not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.]) fi if test ! -x "$kde_cv_java_bindir/jar"; then AC_MSG_ERROR([jar not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.]) fi if test ! -r "$kde_cv_java_includedir/jni.h"; then AC_MSG_ERROR([jni.h not found under $kde_cv_java_includedir. Use --with-java or --without-java.]) fi if test ! -r "$kde_java_libjvmdir/libjvm.so"; then AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.]) fi if test ! -r "$kde_java_libhpidir/libhpi.so"; then AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.]) fi jni_includes="-I$kde_cv_java_includedir" dnl Strange thing, jni.h requires jni_md.h which is under genunix here.. dnl and under linux here.. test -d "$kde_cv_java_includedir/linux" && jni_includes="$jni_includes -I$kde_cv_java_includedir/linux" test -d "$kde_cv_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_cv_java_includedir/genunix" dnl Check for JNI version AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_cxxflags_safe="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $all_includes $jni_includes" AC_TRY_COMPILE([ #include ], [ #ifndef JNI_VERSION_1_2 Syntax Error #endif ],[ kde_jni_works=yes ], [ kde_jni_works=no ]) if test $kde_jni_works = no; then AC_MSG_ERROR([Incorrect version of $kde_cv_java_includedir/jni.h. You need to have Java Development Kit (JDK) version 1.2. Use --with-java to specify another location. Use --without-java to configure without java support. Or download a newer JDK and try again. See e.g. http://java.sun.com/products/jdk/1.2 ]) fi CXXFLAGS="$ac_cxxflags_safe" AC_LANG_RESTORE dnl All tests ok, inform and subst the variables AC_MSG_RESULT([javac/javah/jar in $kde_cv_java_bindir, jni.h in $kde_cv_java_includedir]) JAVAC=$kde_cv_java_bindir/javac AC_SUBST(JAVAC) JAVAH=$kde_cv_java_bindir/javah AC_SUBST(JAVAH) JAR=$kde_cv_java_bindir/jar AC_SUBST(JAR) AC_SUBST(jni_includes) JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_cv_java_libhpidir -lhpi" AC_SUBST(JVMLIBS) fi ]) # serial 46 AC_PROG_LIBTOOL AC_DEFUN([AC_PROG_LIBTOOL], [AC_REQUIRE([_AC_PROG_LIBTOOL])dnl dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. AC_PROVIDE_IFELSE([AC_PROG_CXX], [AC_LIBTOOL_CXX], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX ])]) dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [ifdef([AC_PROG_GCJ], [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ ])]) ifdef([A][M_PROG_GCJ], [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ ])]) ifdef([LT_AC_PROG_GCJ], [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ ])])])])])]) AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # Save cache, so that ltconfig can load it AC_CACHE_SAVE # Actually configure libtool. ac_aux_dir is where install-sh is found. AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ || AC_MSG_ERROR([libtool configure failed]) # Reload cache, that may have been modified by ltconfig AC_CACHE_LOAD # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) AC_DEFUN([AC_LIBTOOL_SETUP], [AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! AC_REQUIRE([AC_OBJEXT])dnl AC_REQUIRE([AC_EXEEXT])dnl dnl # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then AC_PATH_MAGIC fi ;; esac AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(STRIP, strip, :) # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], [libtool_flags="$libtool_flags --enable-dlopen"]) ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [libtool_flags="$libtool_flags --enable-win32-dll"]) AC_ARG_ENABLE(libtool-lock, [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" AC_ARG_WITH(pic, [ --with-pic try to use only PIC/non-PIC objects [default=use both]], pic_mode="$withval", pic_mode=default) test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_SAVE AC_LANG_C AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_RESTORE]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw* | *-*-pw32*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) # recent cygwin and mingw systems supply a stub DllMain which the user # can override, but on older systems we have to supply one AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, [AC_TRY_LINK([], [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); DllMain (0, 0, 0);], [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) case $host/$CC in *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) # old mingw systems require "-dll" to link a DLL, while more recent ones # require "-mdll" SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -mdll" AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) CFLAGS="$SAVE_CFLAGS" ;; *-*-cygwin* | *-*-pw32*) # cygwin systems need to pass --dll to the linker, and not link # crt.o which will require a WinMain@16 definition. lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; esac ;; ]) esac ]) # AC_LIBTOOL_DLOPEN - enable checks for dlopen support AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN([AC_ENABLE_SHARED], [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac], enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) # AC_DISABLE_SHARED - set the default shared flag to --disable-shared AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no)]) # AC_ENABLE_STATIC - implement the --enable-static flag # Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN([AC_ENABLE_STATIC], [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac], enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) # AC_DISABLE_STATIC - set the default static flag to --disable-static AC_DEFUN([AC_DISABLE_STATIC], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no)]) # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(fast-install, changequote(<<, >>)dnl << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac], enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl ]) # AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no)]) # AC_LIBTOOL_PICMODE - implement the --with-pic flag # Usage: AC_LIBTOOL_PICMODE[(MODE)] # Where MODE is either `yes' or `no'. If omitted, it defaults to # `both'. AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl pic_mode=ifelse($#,1,$1,default)]) # AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in /*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; ?:/*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. ;; *) ac_save_MAGIC_CMD="$MAGIC_CMD" IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="ifelse([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | egrep "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$ac_save_ifs" MAGIC_CMD="$ac_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi ]) # AC_PATH_MAGIC - find a file program which can recognise a shared library AC_DEFUN([AC_PATH_MAGIC], [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) else MAGIC_CMD=: fi fi ]) # AC_PROG_LD - find the path to the GNU or non-GNU linker AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]* | [A-Za-z]:[\\/]*)] re_direlt=['/[^/][^/]*/\.\./'] # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else lt_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$lt_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_PROG_LD_GNU ]) AC_DEFUN([AC_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then lt_cv_prog_gnu_ld=yes else lt_cv_prog_gnu_ld=no fi]) with_gnu_ld=$lt_cv_prog_gnu_ld ]) # AC_PROG_LD_RELOAD_FLAG - find reload flag for linker # -- PORTME Some linkers may need a different reload flag. AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], [AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, [lt_cv_ld_reload_flag='-r']) reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" ]) # AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], [AC_CACHE_CHECK([how to recognise dependant libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [regex]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given egrep regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi4*) lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin* | mingw* |pw32*) lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in rhapsody* | darwin1.[012]) lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' ;; *) # Darwin 1.3 on lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' ;; esac ;; freebsd* ) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20*|hpux11*) lt_cv_deplibs_check_method=['file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; irix5* | irix6*) case $host_os in irix5*) # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" ;; *) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] ;; esac lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux-gnu*) case $host_cpu in alpha* | i*86 | powerpc* | sparc* | ia64* | s390* | m68k* | arm* | mips* | hppa* | sh* ) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; esac lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then [lt_cv_deplibs_check_method='file_magic NetBSD/[a-z0-9]* demand paged shared library'] else [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'] fi lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; openbsd* ) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case "$host_cpu" in i*86 ) changequote(,)dnl lt_cv_deplibs_check_method='file_magic OpenBSD/i[3-9]86 demand paged shared library' changequote([, ])dnl lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; newsos6) [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; osf3* | osf4* | osf5*) # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' lt_cv_file_magic_test_file=/shlib/libc.so lt_cv_deplibs_check_method=pass_all ;; sco3.2v5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all lt_cv_file_magic_test_file=/lib/libc.so ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) case $host_vendor in ncr) lt_cv_deplibs_check_method=pass_all ;; motorola) lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; esac ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method ]) # AC_PROG_NM - find the path to a BSD-compatible name lister AC_DEFUN([AC_PROG_NM], [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/${ac_tool_prefix}nm if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then lt_cv_path_NM="$tmp_nm -B" break elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then lt_cv_path_NM="$tmp_nm -p" break else lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi]) NM="$lt_cv_path_NM" AC_MSG_RESULT([$NM]) ]) # AC_CHECK_LIBM - check for math library AC_DEFUN([AC_CHECK_LIBM], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32*) # These system don't have libm ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, main, LIBM="-lm") ;; esac ]) # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-convenience to the # configure arguments. Note that LIBLTDL and INCLTDL are not # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not # provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed # with '${top_builddir}/' and INCLTDL will be prefixed with # '${top_srcdir}/' (note the single quotes!). If your package is not # flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case $enable_ltdl_convenience in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for # the libltdl installable library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-install to the configure # arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is # AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed # libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed # with '${top_srcdir}/' (note the single quotes!). If your package is # not flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, main, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" INCLTDL= fi ]) # If this macro is not defined by Autoconf, define it here. ifdef([AC_PROVIDE_IFELSE], [], [define([AC_PROVIDE_IFELSE], [ifdef([AC_PROVIDE_$1], [$2], [$3])])]) # AC_LIBTOOL_CXX - enable support for C++ libraries AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) AC_DEFUN([_AC_LIBTOOL_CXX], [AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" lt_save_CC="$CC" lt_save_CFLAGS="$CFLAGS" dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC dnl is set to the C++ compiler. AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" \ file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ --build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ || AC_MSG_ERROR([libtool tag configuration failed]) CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) # AC_LIBTOOL_GCJ - enable support for GCJ libraries AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) AC_DEFUN([_AC_LIBTOOL_GCJ], [AC_REQUIRE([AC_PROG_LIBTOOL]) AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" lt_save_CC="$CC" lt_save_CFLAGS="$CFLAGS" dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC dnl is set to the C++ compiler. AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" \ file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ --build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ || AC_MSG_ERROR([libtool tag configuration failed]) CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) dnl old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) dnl This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL])dnl AC_DEFUN([LT_AC_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj, no) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS) ]) # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. # serial 5 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # We require 2.13 because we rely on SHELL being computed by configure. AC_PREREQ([2.13]) # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) # ----------------------------------------------------------- # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED. # The purpose of this macro is to provide the user with a means to # check macros which are provided without letting her know how the # information is coded. # If this macro is not defined by Autoconf, define it here. ifdef([AC_PROVIDE_IFELSE], [], [define([AC_PROVIDE_IFELSE], [ifdef([AC_PROVIDE_$1], [$2], [$3])])]) # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE]) # ---------------------------------------------- AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first]) fi # Define the identity of the package. PACKAGE=$1 AC_SUBST(PACKAGE)dnl VERSION=$2 AC_SUBST(VERSION)dnl ifelse([$3],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow # the ones we care about. ifdef([m4_pattern_allow], [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl # Autoconf 2.50 always computes EXEEXT. However we need to be # compatible with 2.13, for now. So we always define EXEEXT, but we # don't compute it. AC_SUBST(EXEEXT) # Similar for OBJEXT -- only we only use OBJEXT if the user actually # requests that it be used. This is a bit dumb. : ${OBJEXT=o} AC_SUBST(OBJEXT) # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_DEP_TRACK])dnl AC_REQUIRE([AM_SET_DEPDIR])dnl AC_PROVIDE_IFELSE([AC_PROG_][CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_][CC], defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_][CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_][CXX], defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) # # Check to make sure that the build environment is sane. # # serial 3 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # serial 2 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= am_backtick='`' AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) fi ]) # AM_AUX_DIR_EXPAND # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [ # expand $ac_aux_dir to an absolute path am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` ]) # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # serial 4 -*- Autoconf -*- # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # --------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX" or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'] [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_$1_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type" AC_SUBST([$1DEPMODE]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null AC_SUBST(DEPDIR) ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) pushdef([subst], defn([AC_SUBST])) subst(AMDEPBACKSLASH) popdef([subst]) ]) # Generate code to set up dependency tracking. # This macro should only be invoked once -- use via AC_REQUIRE. # Usage: # AM_OUTPUT_DEPENDENCY_COMMANDS # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[ AC_OUTPUT_COMMANDS([ test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do case "$mf" in Makefile) dirpart=.;; */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; *) continue;; esac grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`echo "$file" | sed -e 's|/[^/]*$||'` $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])]) # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include='#' am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote='"' _am_result=BSD fi fi AC_SUBST(am__include) AC_SUBST(am__quote) AC_MSG_RESULT($_am_result) rm -f confinc confmf ]) # serial 3 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. # # FIXME: Once using 2.50, use this: # m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl AC_DEFUN([AM_CONDITIONAL], [ifelse([$1], [TRUE], [errprint(__file__:__line__: [$0: invalid condition: $1 ])dnl m4exit(1)])dnl ifelse([$1], [FALSE], [errprint(__file__:__line__: [$0: invalid condition: $1 ])dnl m4exit(1)])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi]) # Like AC_CONFIG_HEADER, but automatically create stamp file. # serial 3 # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. We must strip everything past the first ":", # and everything past the last "/". AC_PREREQ([2.12]) AC_DEFUN([AM_CONFIG_HEADER], [ifdef([AC_FOREACH],dnl [dnl init our file count if it isn't already m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0])) dnl prepare to store our destination file list for use in config.status AC_FOREACH([_AM_File], [$1], [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*])) m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index)) dnl and add it to the list of files AC keeps track of, along dnl with our hook AC_CONFIG_HEADERS(_AM_File, dnl COMMANDS, [, INIT-CMDS] [# update the timestamp echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index[" ][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS m4_popdef([_AM_Dest])])],dnl [AC_CONFIG_HEADER([$1]) AC_OUTPUT_COMMANDS( ifelse(patsubst([$1], [[^ ]], []), [], [test -z "$CONFIG_HEADERS" || echo timestamp >dnl patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl [am_indx=1 for am_file in $1; do case " \$CONFIG_HEADERS " in *" \$am_file "*) am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\` if test -n "\$am_dir"; then am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\` for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do am_tmpdir=\$am_tmpdir\$am_subdir/ if test ! -d \$am_tmpdir; then mkdir \$am_tmpdir fi done fi echo timestamp > "\$am_dir"stamp-h\$am_indx ;; esac am_indx=\`expr \$am_indx + 1\` done]) ])]) # AM_CONFIG_HEADER # _AM_DIRNAME(PATH) # ----------------- # Like AS_DIRNAME, only do it during macro expansion AC_DEFUN([_AM_DIRNAME], [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1, m4_if(m4_regexp([$1], [^/.*]), -1, [.], m4_patsubst([$1], [^\(/\).*], [\1])), m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl ]) # _AM_DIRNAME c_cpp_reference-2.0.2/configure0000755000076400001440000116100507474405116012221 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} ac_unique_file="acinclude.m4" ac_default_prefix=${KDEDIR:-/usr/local/kde} # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. 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' # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= 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 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # 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_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$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 ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) 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 | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$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_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } 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 "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. build=$build_alias host=$host_alias target=$target_alias # FIXME: should be removed in autoconf 3.0. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # 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 "$as_me: error: cannot find sources in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_CXXCPP_set=${CXXCPP+set} ac_env_CXXCPP_value=$CXXCPP ac_cv_env_CXXCPP_set=${CXXCPP+set} ac_cv_env_CXXCPP_value=$CXXCPP ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # 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 < if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. EOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue cd $ac_subdir # A "../" for each directory in /$ac_subdir. ac_dots=`echo $ac_subdir | sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` case $srcdir in .) # No --srcdir option. We are building in place. ac_sub_srcdir=$srcdir ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_sub_srcdir=$srcdir/$ac_subdir ;; *) # Relative path. ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; esac # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_sub_srcdir/configure.gnu; then echo $SHELL $ac_sub_srcdir/configure.gnu --help=recursive elif test -f $ac_sub_srcdir/configure; then echo $SHELL $ac_sub_srcdir/configure --help=recursive elif test -f $ac_sub_srcdir/configure.ac || test -f $ac_sub_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\EOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. EOF exit 0 fi exec 5>config.log cat >&5 </dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` PATH = $PATH _ASUNAME } >&5 cat >&5 <\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" ac_sep=" " ;; *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" ac_sep=" " ;; esac # Get rid of the leading space. done # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. trap 'exit_status=$? # Save into config.log some information that might help in debugging. echo >&5 echo "## ----------------- ##" >&5 echo "## Cache variables. ##" >&5 echo "## ----------------- ##" >&5 echo >&5 # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } >&5 sed "/^$/d" confdefs.h >conftest.log if test -s conftest.log; then echo >&5 echo "## ------------ ##" >&5 echo "## confdefs.h. ##" >&5 echo "## ------------ ##" >&5 echo >&5 cat conftest.log >&5 fi (echo; echo) >&5 test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" >&5 echo "$as_me: exit $exit_status" >&5 rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # 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 # Let the site file select an alternate cache file if it wants to. # 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 "$as_me:915: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:926: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:934: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:950: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:954: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:960: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:962: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:964: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. It doesn't matter if # we pass some twice (in addition to the command line arguments). if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:983: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:985: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh if { (echo "$as_me:1005: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? echo "$as_me:1008: \$? = $ac_status" >&5 (exit $ac_status); }; then ac_path_separator=';' else ac_path_separator=: fi PATH_SEPARATOR="$ac_path_separator" rm -f conftest.sh ac_aux_dir= for ac_dir in admin $srcdir/admin; 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 elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:1034: error: cannot find install-sh or install.sh in admin $srcdir/admin" >&5 echo "$as_me: error: cannot find install-sh or install.sh in admin $srcdir/admin" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. unset CDPATH # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:1046: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:1050: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:1059: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:1063: error: $ac_config_sub $ac_cv_build_alias failed." >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:1068: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` test -z "$build_alias" && build_alias=$ac_cv_build echo "$as_me:1078: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:1087: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:1092: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` test -z "$host_alias" && host_alias=$ac_cv_host echo "$as_me:1102: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6 if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_target_alias=$target_alias test "x$ac_cv_target_alias" = "x" && ac_cv_target_alias=$ac_cv_host_alias ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || { { echo "$as_me:1111: error: $ac_config_sub $ac_cv_target_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:1116: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6 target=$ac_cv_target target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- test -z "$target_alias" && target_alias=$ac_cv_target test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT # 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 # AmigaOS /C/install, which installs bootblocks on floppy discs # 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 "$as_me:1160: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_IFS=$IFS; IFS=$ac_path_separator for ac_dir in $PATH; do IFS=$ac_save_IFS # Account for people who put trailing slashes in PATH elements. case $ac_dir/ in / | ./ | .// | /cC/* \ | /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 $as_executable_p "$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. : elif test $ac_prog = install && grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done 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 "$as_me:1209: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&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}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test -z "$kde_save_INSTALL_given" ; then # OK, user hasn't given any INSTALL, autoconf found one for us # now we test, if it supports the -p flag echo "$as_me:1223: checking for -p flag to install" >&5 echo $ECHO_N "checking for -p flag to install... $ECHO_C" >&6 rm -f confinst.$$.* > /dev/null 2>&1 echo "Testtest" > confinst.$$.orig ac_res=no if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then if test -f confinst.$$.new ; then # OK, -p seems to do no harm to install INSTALL="${INSTALL} -p" ac_res=yes fi fi rm -f confinst.$$.* echo "$as_me:1236: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6 fi if test -z "$kde_save_INSTALL_PROGRAM_given" ; then INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' fi if test -z "$kde_save_INSTALL_SCRIPT_given" ; then INSTALL_SCRIPT='${INSTALL}' fi echo "$as_me:1247: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:1271: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:1284: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:1290: result: yes" >&5 echo "${ECHO_T}yes" >&6 # expand $ac_aux_dir to an absolute path am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= am_backtick='`' { echo "$as_me:1303: WARNING: ${am_backtick}missing' script is too old or missing" >&5 echo "$as_me: WARNING: ${am_backtick}missing' script is too old or missing" >&2;} fi for ac_prog in mawk gawk nawk awk 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 "$as_me:1311: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_AWK="$ac_prog" echo "$as_me:1326: found $ac_dir/$ac_word" >&5 break done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:1334: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:1337: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:1344: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:1364: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:1368: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null # test to see if srcdir already configured if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:1404: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # Define the identity of the package. PACKAGE=c_cpp_reference VERSION=2.0.2 cat >>confdefs.h <>confdefs.h < confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. echo "$as_me:1489: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include='#' am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote='"' _am_result=BSD fi fi echo "$as_me:1516: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" if test $enableval = "no"; then kde_use_debug_code="no" kde_use_debug_define=yes else kde_use_debug_code="yes" kde_use_debug_define=no fi else kde_use_debug_code="no" kde_use_debug_define=no fi; # Check whether --enable-dummyoption or --disable-dummyoption was given. if test "${enable_dummyoption+set}" = set; then enableval="$enable_dummyoption" fi; # Check whether --enable-strict or --disable-strict was given. if test "${enable_strict+set}" = set; then enableval="$enable_strict" if test $enableval = "no"; then kde_use_strict_options="no" else kde_use_strict_options="yes" fi else kde_use_strict_options="no" fi; # Check whether --enable-profile or --disable-profile was given. if test "${enable_profile+set}" = set; then enableval="$enable_profile" kde_use_profiling=$enableval else kde_use_profiling="no" fi; CFLAGS=" $CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:1577: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:1592: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1600: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1603: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:1612: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:1627: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1635: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1638: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:1651: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:1666: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1674: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1677: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:1686: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" echo "$as_me:1701: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1709: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1712: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi 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 "$as_me:1725: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:1745: found $ac_dir/$ac_word" >&5 break done 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 $# != 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" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1767: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1770: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:1781: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:1796: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1804: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1807: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl 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 "$as_me:1820: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:1835: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1843: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1846: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:1858: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:1863:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:1866: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:1869: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1871: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:1874: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1876: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:1879: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line 1883 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:1899: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:1902: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:1905: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. for ac_file in `ls a.exe conftest.exe 2>/dev/null; ls a.out conftest 2>/dev/null; ls a.* conftest.* 2>/dev/null`; do case $ac_file in *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; a.out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:1928: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:1934: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1939: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:1945: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1948: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:1955: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:1963: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1970: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:1972: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:1975: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 if { (eval echo "$as_me:1977: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:1980: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:1996: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:2002: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:2008: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2014 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:2026: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2029: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:2041: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:2048: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:2052: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2058 "configure" #include "confdefs.h" int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2073: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2076: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2079: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2082: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:2094: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:2100: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2106 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2118: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2121: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2124: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2127: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:2137: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&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 # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2164: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2167: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2170: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2173: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line 2185 "configure" #include "confdefs.h" #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2198: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2201: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2204: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2207: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line 2217 "configure" #include "confdefs.h" $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2229: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2232: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2235: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2238: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= echo "$as_me:2267: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_CC_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:2329: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE="depmode=$am_cv_CC_dependencies_compiler_type" if test "$GCC" = "yes"; then if test "$kde_use_debug_code" = "yes"; then CFLAGS="-g -O2 $CFLAGS" case $host in *-*-linux-gnu) CFLAGS="-ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" ;; esac else CFLAGS="-O2 $CFLAGS" fi fi if test "$kde_use_debug_define" = "yes"; then CFLAGS="-DNDEBUG $CFLAGS" fi case "$host" in *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; esac if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then LDFLAGS="" fi CXXFLAGS=" $CXXFLAGS" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:2371: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:2386: found $ac_dir/$ac_word" >&5 break done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:2394: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:2397: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC 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 "$as_me:2410: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:2425: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:2433: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:2436: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:2448:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:2451: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:2454: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:2456: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:2459: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:2461: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:2464: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:2467: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2473 "configure" #include "confdefs.h" int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2488: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2491: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2494: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2497: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:2509: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:2515: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2521 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2533: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2536: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2539: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2542: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:2552: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line 2579 "configure" #include "confdefs.h" #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2592: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2595: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2598: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2601: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line 2611 "configure" #include "confdefs.h" $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2623: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2626: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2629: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2632: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= echo "$as_me:2656: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_CXX_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi echo "$as_me:2718: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 CXXDEPMODE="depmode=$am_cv_CXX_dependencies_compiler_type" if test "$GXX" = "yes"; then if test "$kde_use_debug_code" = "yes"; then CXXFLAGS="-g -O2 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS" echo "$as_me:2726: checking whether $CXX supports -Wno-long-long" >&5 echo $ECHO_N "checking whether $CXX supports -Wno-long-long... $ECHO_C" >&6 kde_cache=`echo Wno-long-long | sed 'y%.=/+-%___p_%'` if eval "test \"\${kde_cv_prog_cxx_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -Wno-long-long -c conftest.cc 2>&1`"; then if test -z "`$CXX -Wno-long-long -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* fi if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then echo "$as_me:2745: result: yes" >&5 echo "${ECHO_T}yes" >&6 : CXXFLAGS="-Wno-long-long $CXXFLAGS" else echo "$as_me:2750: result: no" >&5 echo "${ECHO_T}no" >&6 : fi echo "$as_me:2756: checking whether $CXX supports -Wnon-virtual-dtor" >&5 echo $ECHO_N "checking whether $CXX supports -Wnon-virtual-dtor... $ECHO_C" >&6 kde_cache=`echo Wnon-virtual-dtor | sed 'y%.=/+-%___p_%'` if eval "test \"\${kde_cv_prog_cxx_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -Wnon-virtual-dtor -c conftest.cc 2>&1`"; then if test -z "`$CXX -Wnon-virtual-dtor -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* fi if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then echo "$as_me:2775: result: yes" >&5 echo "${ECHO_T}yes" >&6 : CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS" else echo "$as_me:2780: result: no" >&5 echo "${ECHO_T}no" >&6 : fi echo "$as_me:2786: checking whether $CXX supports -fno-builtin" >&5 echo $ECHO_N "checking whether $CXX supports -fno-builtin... $ECHO_C" >&6 kde_cache=`echo fno-builtin | sed 'y%.=/+-%___p_%'` if eval "test \"\${kde_cv_prog_cxx_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -fno-builtin -c conftest.cc 2>&1`"; then if test -z "`$CXX -fno-builtin -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* fi if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then echo "$as_me:2805: result: yes" >&5 echo "${ECHO_T}yes" >&6 : CXXFLAGS="-fno-builtin $CXXFLAGS" else echo "$as_me:2810: result: no" >&5 echo "${ECHO_T}no" >&6 : fi case $host in *-*-linux-gnu) CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wbad-function-cast -Wcast-align -Wundef -Wconversion $CXXFLAGS" ;; esac if test "$kde_use_strict_options" = "yes"; then CXXFLAGS="-Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align $CXXFLAGS" fi if test "$kde_very_strict" = "yes"; then CXXFLAGS="-Wold-style-cast -Wredundant-decls -Wconversion $CXXFLAGS" fi else CXXFLAGS="-O2 $CXXFLAGS" fi fi if test "$kde_use_debug_define" = "yes"; then CXXFLAGS="-DNDEBUG $CXXFLAGS" fi if test "$kde_use_profiling" = "yes"; then echo "$as_me:2839: checking whether $CXX supports -pg" >&5 echo $ECHO_N "checking whether $CXX supports -pg... $ECHO_C" >&6 kde_cache=`echo pg | sed 'y%.=/+-%___p_%'` if eval "test \"\${kde_cv_prog_cxx_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -pg -c conftest.cc 2>&1`"; then if test -z "`$CXX -pg -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* fi if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then echo "$as_me:2858: result: yes" >&5 echo "${ECHO_T}yes" >&6 : CFLAGS="-pg $CFLAGS" CXXFLAGS="-pg $CXXFLAGS" else echo "$as_me:2866: result: no" >&5 echo "${ECHO_T}no" >&6 : fi fi echo "$as_me:2874: checking whether $CXX supports -fno-exceptions" >&5 echo $ECHO_N "checking whether $CXX supports -fno-exceptions... $ECHO_C" >&6 kde_cache=`echo fno-exceptions | sed 'y%.=/+-%___p_%'` if eval "test \"\${kde_cv_prog_cxx_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -fno-exceptions -c conftest.cc 2>&1`"; then if test -z "`$CXX -fno-exceptions -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* fi if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then echo "$as_me:2893: result: yes" >&5 echo "${ECHO_T}yes" >&6 : CXXFLAGS="$CXXFLAGS -fno-exceptions" else echo "$as_me:2898: result: no" >&5 echo "${ECHO_T}no" >&6 : fi echo "$as_me:2904: checking whether $CXX supports -fno-check-new" >&5 echo $ECHO_N "checking whether $CXX supports -fno-check-new... $ECHO_C" >&6 kde_cache=`echo fno-check-new | sed 'y%.=/+-%___p_%'` if eval "test \"\${kde_cv_prog_cxx_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -fno-check-new -c conftest.cc 2>&1`"; then if test -z "`$CXX -fno-check-new -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* fi if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then echo "$as_me:2923: result: yes" >&5 echo "${ECHO_T}yes" >&6 : CXXFLAGS="$CXXFLAGS -fno-check-new" else echo "$as_me:2928: result: no" >&5 echo "${ECHO_T}no" >&6 : fi echo "$as_me:2934: checking whether $CXX supports -fexceptions" >&5 echo $ECHO_N "checking whether $CXX supports -fexceptions... $ECHO_C" >&6 kde_cache=`echo fexceptions | sed 'y%.=/+-%___p_%'` if eval "test \"\${kde_cv_prog_cxx_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -fexceptions -c conftest.cc 2>&1`"; then if test -z "`$CXX -fexceptions -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* fi if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then echo "$as_me:2953: result: yes" >&5 echo "${ECHO_T}yes" >&6 : USE_EXCEPTIONS="-fexceptions" else echo "$as_me:2958: result: no" >&5 echo "${ECHO_T}no" >&6 : USE_EXCEPTIONS= fi USE_RTTI= case "$host" in *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; *-*-solaris*) if test "$GXX" = yes; then libstdcpp=`$CXX -print-file-name=libstdc++.so` if test ! -f $libstdcpp; then { { echo "$as_me:2974: error: You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so" >&5 echo "$as_me: error: You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so" >&2;} { (exit 1); exit 1; }; } fi fi ;; esac __val=$CXX __forbid=" -fno-rtti -rpath " if test -n "$__val"; then __new="" ac_save_IFS=$IFS IFS=" " for i in $__val; do case "$__forbid" in *" $i "*) { echo "$as_me:2990: WARNING: found forbidden $i in CXX, removing it" >&5 echo "$as_me: WARNING: found forbidden $i in CXX, removing it" >&2;} ;; *) # Careful to not add spaces, where there were none, because otherwise # libtool gets confused, if we change e.g. CXX if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; esac done IFS=$ac_save_IFS CXX=$__new fi __val=$CXXFLAGS __forbid=" -fno-rtti -rpath " if test -n "$__val"; then __new="" ac_save_IFS=$IFS IFS=" " for i in $__val; do case "$__forbid" in *" $i "*) { echo "$as_me:3009: WARNING: found forbidden $i in CXXFLAGS, removing it" >&5 echo "$as_me: WARNING: found forbidden $i in CXXFLAGS, removing it" >&2;} ;; *) # Careful to not add spaces, where there were none, because otherwise # libtool gets confused, if we change e.g. CXX if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; esac done IFS=$ac_save_IFS CXXFLAGS=$__new fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:3025: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line 3042 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:3047: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:3053: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 3076 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:3080: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:3086: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi echo "$as_me:3123: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6 ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line 3133 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:3138: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:3144: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 3167 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:3171: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:3177: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:3205: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # the following is to allow programs, that are known to # have problems when compiled with -O2 if test -n "$CXXFLAGS"; then kde_safe_IFS=$IFS IFS=" " NOOPT_CXXFLAGS="" for i in $CXXFLAGS; do case $i in -O*) ;; *) NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i" ;; esac done IFS=$kde_safe_IFS fi # Check whether --enable-final or --disable-final was given. if test "${enable_final+set}" = set; then enableval="$enable_final" kde_use_final=$enableval else kde_use_final=no fi; REPO="" NOREPO="" echo "$as_me:3245: checking whether $CXX supports -frepo" >&5 echo $ECHO_N "checking whether $CXX supports -frepo... $ECHO_C" >&6 kde_cache=`echo frepo | sed 'y%.=/+-%___p_%'` if eval "test \"\${kde_cv_prog_cxx_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -frepo -c conftest.cc 2>&1`"; then if test -z "`$CXX -frepo -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* fi if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then echo "$as_me:3264: result: yes" >&5 echo "${ECHO_T}yes" >&6 : REPO="-frepo" NOREPO="-fno-repo" else echo "$as_me:3272: result: no" >&5 echo "${ECHO_T}no" >&6 : fi if test -z "$REPO"; then echo "$as_me:3280: checking whether $CXX supports -instances=explicit" >&5 echo $ECHO_N "checking whether $CXX supports -instances=explicit... $ECHO_C" >&6 kde_cache=`echo instances=explicit | sed 'y%.=/+-%___p_%'` if eval "test \"\${kde_cv_prog_cxx_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -instances=explicit -c conftest.cc 2>&1`"; then if test -z "`$CXX -instances=explicit -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* fi if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then echo "$as_me:3299: result: yes" >&5 echo "${ECHO_T}yes" >&6 : REPO="-instances=explicit" NOREPO="-instances=extern" else echo "$as_me:3307: result: no" >&5 echo "${ECHO_T}no" >&6 : fi fi if test -n "$REPO"; then cat >>confdefs.h <&5 echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo "$as_me:3458: checking for GNU ld" >&5 echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else echo "$as_me:3461: checking for non-GNU ld" >&5 echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else lt_cv_path_LD="$LD" # Let the user override the test with a path. fi fi LD="$lt_cv_path_LD" if test -n "$LD"; then echo "$as_me:3491: result: $LD" >&5 echo "${ECHO_T}$LD" >&6 else echo "$as_me:3494: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -z "$LD" && { { echo "$as_me:3497: error: no acceptable ld found in \$PATH" >&5 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} { (exit 1); exit 1; }; } echo "$as_me:3500: checking if the linker ($LD) is GNU ld" >&5 echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then lt_cv_prog_gnu_ld=yes else lt_cv_prog_gnu_ld=no fi fi echo "$as_me:3512: result: $lt_cv_prog_gnu_ld" >&5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld echo "$as_me:3516: checking for $LD option to reload object files" >&5 echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 if test "${lt_cv_ld_reload_flag+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi echo "$as_me:3523: result: $lt_cv_ld_reload_flag" >&5 echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo "$as_me:3528: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 if test "${lt_cv_path_NM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/${ac_tool_prefix}nm if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then lt_cv_path_NM="$tmp_nm -B" break elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then lt_cv_path_NM="$tmp_nm -p" break else lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi NM="$lt_cv_path_NM" echo "$as_me:3564: result: $NM" >&5 echo "${ECHO_T}$NM" >&6 echo "$as_me:3567: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:3571: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:3574: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi echo "$as_me:3578: checking how to recognise dependant libraries" >&5 echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6 if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [regex]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given egrep regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi4*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin* | mingw* |pw32*) lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in rhapsody* | darwin1.012) lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' ;; *) # Darwin 1.3 on lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' ;; esac ;; freebsd* ) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20*|hpux11*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; irix5* | irix6*) case $host_os in irix5*) # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" ;; *) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" ;; esac lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux-gnu*) case $host_cpu in alpha* | i*86 | powerpc* | sparc* | ia64* | s390* | m68k* | arm* | mips* | hppa* | sh* ) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; esac lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='file_magic NetBSD/[a-z0-9]* demand paged shared library' else lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' fi lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; openbsd* ) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case "$host_cpu" in i*86 ) lt_cv_deplibs_check_method='file_magic OpenBSD/i[3-9]86 demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; newsos6) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; osf3* | osf4* | osf5*) # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' lt_cv_file_magic_test_file=/shlib/libc.so lt_cv_deplibs_check_method=pass_all ;; sco3.2v5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all lt_cv_file_magic_test_file=/lib/libc.so ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) case $host_vendor in ncr) lt_cv_deplibs_check_method=pass_all ;; motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; esac ;; esac fi echo "$as_me:3749: result: $lt_cv_deplibs_check_method" >&5 echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo "$as_me:3760: checking for ${ac_tool_prefix}file" >&5 echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in /*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; ?:/*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. ;; *) ac_save_MAGIC_CMD="$MAGIC_CMD" IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="/usr/bin:$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | egrep "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$ac_save_ifs" MAGIC_CMD="$ac_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:3815: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:3818: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo "$as_me:3824: checking for file" >&5 echo $ECHO_N "checking for file... $ECHO_C" >&6 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in /*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; ?:/*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. ;; *) ac_save_MAGIC_CMD="$MAGIC_CMD" IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="/usr/bin:$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | egrep "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$ac_save_ifs" MAGIC_CMD="$ac_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then echo "$as_me:3879: result: $MAGIC_CMD" >&5 echo "${ECHO_T}$MAGIC_CMD" >&6 else echo "$as_me:3882: result: no" >&5 echo "${ECHO_T}no" >&6 fi else MAGIC_CMD=: fi fi fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:3898: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:3913: found $ac_dir/$ac_word" >&5 break done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:3921: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:3924: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:3933: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:3948: found $ac_dir/$ac_word" >&5 break done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:3957: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:3960: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:3972: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:3987: found $ac_dir/$ac_word" >&5 break done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:3995: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:3998: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:4007: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:4022: found $ac_dir/$ac_word" >&5 break done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:4031: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:4034: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" libtool_flags="$libtool_flags --enable-dlopen" # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" fi; test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Check whether --with-pic or --without-pic was given. if test "${with_pic+set}" = set; then withval="$with_pic" pic_mode="$withval" else pic_mode=default fi; test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in *-*-irix6*) # Find out which ABI we are using. echo '#line 4075 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:4076: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4079: \$? = $ac_status" >&5 (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo "$as_me:4100: checking whether the C compiler needs -belf" >&5 echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF #line 4113 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:4125: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:4128: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:4131: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4134: \$? = $ac_status" >&5 (exit $ac_status); }; }; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:4150: result: $lt_cv_cc_needs_belf" >&5 echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; esac # Save cache, so that ltconfig can load it cat >confcache <<\_ACEOF # 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, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overriden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # 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 \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache # Actually configure libtool. ac_aux_dir is where install-sh is found. AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ || { { echo "$as_me:4225: error: libtool configure failed" >&5 echo "$as_me: error: libtool configure failed" >&2;} { (exit 1); exit 1; }; } # Reload cache, that may have been modified by ltconfig if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:4234: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:4242: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" lt_save_CC="$CC" lt_save_CFLAGS="$CFLAGS" AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" \ file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ --build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ || { { echo "$as_me:4269: error: libtool tag configuration failed" >&5 echo "$as_me: error: libtool tag configuration failed" >&2;} { (exit 1); exit 1; }; } CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu LIBTOOL_SHELL="/bin/sh ./libtool" # LIBTOOL="$LIBTOOL --silent" KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_RPATH)" # Check whether --enable-objprelink or --disable-objprelink was given. if test "${enable_objprelink+set}" = set; then enableval="$enable_objprelink" kde_use_objprelink=$enableval else kde_use_objprelink=no fi; if test "x$kde_use_objprelink" = "xyes"; then echo "$as_me:4304: checking for objprelink" >&5 echo $ECHO_N "checking for objprelink... $ECHO_C" >&6 if test -n "$OBJPRELINK"; then kde_cv_path="$OBJPRELINK"; else kde_cache=`echo objprelink | sed 'y%./+-%__p_%'` if eval "test \"\${kde_cv_path_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else kde_cv_path="NONE" dirs="" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/objprelink"; then if test -n "" then evalstr="$dir/objprelink 2>&1 " if eval $evalstr; then kde_cv_path="$dir/objprelink" break fi else kde_cv_path="$dir/objprelink" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" fi eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then echo "$as_me:4349: result: not found" >&5 echo "${ECHO_T}not found" >&6 kde_use_objprelink=no else echo "$as_me:4353: result: $kde_cv_path" >&5 echo "${ECHO_T}$kde_cv_path" >&6 OBJPRELINK=$kde_cv_path fi if test "x$kde_use_objprelink" = "xyes"; then echo "$as_me:4360: checking Patching libtool to run objprelink." >&5 echo $ECHO_N "checking Patching libtool to run objprelink.... $ECHO_C" >&6 mv libtool libtool.orig cat > libtool <<\EOF #! /bin/sh for n ; do case $n in *.o) test -r $n && echo objprelink $n && objprelink $n ;; *.lo) m=`basename $n .lo`".o" && test -r $m && echo objprelink $m && objprelink $m m=".libs/$m" && test -r $m && echo objprelink $m && objprelink $m ;; esac; done EOF cat >> libtool libtool.orig rm libtool.orig chmod a+x libtool echo "$as_me:4374: result: done" >&5 echo "${ECHO_T}done" >&6 fi fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo "$as_me:4381: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_MSGFMT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$MSGFMT" in /*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"; then ac_cv_path_MSGFMT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" if test -n "$MSGFMT"; then echo "$as_me:4408: result: $MSGFMT" >&5 echo "${ECHO_T}$MSGFMT" >&6 else echo "$as_me:4411: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo "$as_me:4417: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GMSGFMT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; *) ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_GMSGFMT="$ac_dir/$ac_word" echo "$as_me:4434: found $ac_dir/$ac_word" >&5 break fi done test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then echo "$as_me:4446: result: $GMSGFMT" >&5 echo "${ECHO_T}$GMSGFMT" >&6 else echo "$as_me:4449: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then echo "$as_me:4454: result: found msgfmt program is not GNU msgfmt; ignore it" >&5 echo "${ECHO_T}found msgfmt program is not GNU msgfmt; ignore it" >&6 GMSGFMT=":" fi MSGFMT=$GMSGFMT # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo "$as_me:4462: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_XGETTEXT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$XGETTEXT" in /*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then ac_cv_path_XGETTEXT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test -n "$XGETTEXT"; then echo "$as_me:4489: result: $XGETTEXT" >&5 echo "${ECHO_T}$XGETTEXT" >&6 else echo "$as_me:4492: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$XGETTEXT" != ":"; then if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else echo "$as_me:4500: result: found xgettext programs is not GNU xgettext; ignore it" >&5 echo "${ECHO_T}found xgettext programs is not GNU xgettext; ignore it" >&6 XGETTEXT=":" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:4511: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line 4532 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:4537: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:4543: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 4566 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:4570: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:4576: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:4613: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line 4623 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:4628: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:4634: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 4657 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:4661: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:4667: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:4695: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:4706: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 4712 "configure" #include "confdefs.h" #include #include #include #include _ACEOF if { (eval echo "$as_me:4720: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:4726: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line 4748 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else 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 <<_ACEOF #line 4766 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else 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 <<_ACEOF #line 4787 "configure" #include "confdefs.h" #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #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); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:4813: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:4816: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:4818: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4821: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:4834: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:4850: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 4856 "configure" #include "confdefs.h" $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:4862: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4865: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:4868: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4871: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:4881: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for main in -lutil... $ECHO_C" >&6 if test "${ac_cv_lib_util_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 4905 "configure" #include "confdefs.h" int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:4917: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:4920: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:4923: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4926: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_util_main=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_util_main=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:4937: result: $ac_cv_lib_util_main" >&5 echo "${ECHO_T}$ac_cv_lib_util_main" >&6 if test $ac_cv_lib_util_main = yes; then LIBUTIL="-lutil" fi echo "$as_me:4943: checking for main in -lcompat" >&5 echo $ECHO_N "checking for main in -lcompat... $ECHO_C" >&6 if test "${ac_cv_lib_compat_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcompat $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 4951 "configure" #include "confdefs.h" int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:4963: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:4966: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:4969: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4972: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_compat_main=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_compat_main=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:4983: result: $ac_cv_lib_compat_main" >&5 echo "${ECHO_T}$ac_cv_lib_compat_main" >&6 if test $ac_cv_lib_compat_main = yes; then LIBCOMPAT="-lcompat" fi kde_have_crypt= echo "$as_me:4990: checking for crypt in -lcrypt" >&5 echo $ECHO_N "checking for crypt in -lcrypt... $ECHO_C" >&6 if test "${ac_cv_lib_crypt_crypt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypt $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 4998 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char crypt (); int main () { crypt (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5017: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5020: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5023: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5026: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_crypt_crypt=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_crypt_crypt=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:5037: result: $ac_cv_lib_crypt_crypt" >&5 echo "${ECHO_T}$ac_cv_lib_crypt_crypt" >&6 if test $ac_cv_lib_crypt_crypt = yes; then LIBCRYPT="-lcrypt"; kde_have_crypt=yes else echo "$as_me:5042: checking for crypt in -lc" >&5 echo $ECHO_N "checking for crypt in -lc... $ECHO_C" >&6 if test "${ac_cv_lib_c_crypt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 5050 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char crypt (); int main () { crypt (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5069: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5072: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5075: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5078: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_c_crypt=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_c_crypt=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:5089: result: $ac_cv_lib_c_crypt" >&5 echo "${ECHO_T}$ac_cv_lib_c_crypt" >&6 if test $ac_cv_lib_c_crypt = yes; then kde_have_crypt=yes else { echo "$as_me:5095: WARNING: you have no crypt in either libcrypt or libc. You should install libcrypt from another source or configure with PAM support" >&5 echo "$as_me: WARNING: you have no crypt in either libcrypt or libc. You should install libcrypt from another source or configure with PAM support" >&2;} kde_have_crypt=no fi fi if test $kde_have_crypt = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 if test "${ac_cv_socklen_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cat >conftest.$ac_ext <<_ACEOF #line 5130 "configure" #include "confdefs.h" #include #include int main () { socklen_t a=0; getsockname(0,(struct sockaddr*)0, &a); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:5148: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5151: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:5154: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5157: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_socklen_t=socklen_t else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF #line 5165 "configure" #include "confdefs.h" #include #include int main () { int a=0; getsockname(0,(struct sockaddr*)0, &a); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:5183: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5186: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:5189: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5192: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_socklen_t=int else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_socklen_t=size_t fi rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:5213: result: $ac_cv_socklen_t" >&5 echo "${ECHO_T}$ac_cv_socklen_t" >&6 if test "$ac_cv_socklen_t" != "socklen_t"; then cat >>confdefs.h <>confdefs.h <&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 5241 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5260: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5263: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5266: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5269: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_dnet_dnet_ntoa=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:5280: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo "$as_me:5287: checking for dnet_ntoa in -ldnet_stub" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 5295 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5314: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5317: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5320: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5323: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:5334: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi echo "$as_me:5341: checking for inet_ntoa" >&5 echo $ECHO_N "checking for inet_ntoa... $ECHO_C" >&6 if test "${ac_cv_func_inet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 5347 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char inet_ntoa (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_ntoa (); char (*f) (); 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_inet_ntoa) || defined (__stub___inet_ntoa) choke me #else f = inet_ntoa; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5378: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5381: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5384: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5387: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_inet_ntoa=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_func_inet_ntoa=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:5397: result: $ac_cv_func_inet_ntoa" >&5 echo "${ECHO_T}$ac_cv_func_inet_ntoa" >&6 if test $ac_cv_func_inet_ntoa = no; then echo "$as_me:5401: checking for inet_ntoa in -lnsl" >&5 echo $ECHO_N "checking for inet_ntoa in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_inet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 5409 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_ntoa (); int main () { inet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5428: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5431: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5434: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5437: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_inet_ntoa=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_nsl_inet_ntoa=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:5448: result: $ac_cv_lib_nsl_inet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_inet_ntoa" >&6 if test $ac_cv_lib_nsl_inet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi fi echo "$as_me:5455: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6 if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 5461 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); char (*f) (); 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_connect) || defined (__stub___connect) choke me #else f = connect; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5492: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5495: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5498: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5501: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_func_connect=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:5511: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 if test $ac_cv_func_connect = no; then echo "$as_me:5515: checking for connect in -lsocket" >&5 echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 5523 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); int main () { connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5542: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5545: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5548: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5551: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_connect=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:5562: result: $ac_cv_lib_socket_connect" >&5 echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi echo "$as_me:5570: checking for remove" >&5 echo $ECHO_N "checking for remove... $ECHO_C" >&6 if test "${ac_cv_func_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 5576 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); char (*f) (); 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_remove) || defined (__stub___remove) choke me #else f = remove; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5607: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5610: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5613: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5616: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_remove=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_func_remove=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:5626: result: $ac_cv_func_remove" >&5 echo "${ECHO_T}$ac_cv_func_remove" >&6 if test $ac_cv_func_remove = no; then echo "$as_me:5630: checking for remove in -lposix" >&5 echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 if test "${ac_cv_lib_posix_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 5638 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); int main () { remove (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5657: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5660: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5663: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5666: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_posix_remove=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_posix_remove=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:5677: result: $ac_cv_lib_posix_remove" >&5 echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo "$as_me:5686: checking for shmat" >&5 echo $ECHO_N "checking for shmat... $ECHO_C" >&6 if test "${ac_cv_func_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 5692 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); char (*f) (); 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_shmat) || defined (__stub___shmat) choke me #else f = shmat; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5723: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5726: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5729: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5732: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shmat=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_func_shmat=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:5742: result: $ac_cv_func_shmat" >&5 echo "${ECHO_T}$ac_cv_func_shmat" >&6 if test $ac_cv_func_shmat = yes; then : else echo "$as_me:5747: checking for shmat in -lipc" >&5 echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 if test "${ac_cv_lib_ipc_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 5755 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); int main () { shmat (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5774: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5777: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5780: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5783: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ipc_shmat=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_ipc_shmat=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:5794: result: $ac_cv_lib_ipc_shmat" >&5 echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi # Solaris 2.6 and others need -lresolv for res_init for ac_func in res_init do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:5807: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 5813 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* 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 (); char (*f) (); 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 f = $ac_func; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5844: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5847: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5850: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5853: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:5863: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <conftest.$ac_ext <<_ACEOF #line 5875 "configure" #include "confdefs.h" #include int main () { res_init(); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5891: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5894: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5897: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5900: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBRESOLV="-lresolv" X_EXTRA_LIBS="$X_EXTRA_LIBS $LIBRESOLV" cat >>confdefs.h <<\EOF #define HAVE_RES_INIT 1 EOF else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$kde_libs_safe fi done LIBSOCKET="$X_EXTRA_LIBS" echo "$as_me:5921: checking for killpg in -lucb" >&5 echo $ECHO_N "checking for killpg in -lucb... $ECHO_C" >&6 if test "${ac_cv_lib_ucb_killpg+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lucb $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 5929 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char killpg (); int main () { killpg (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:5948: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:5951: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:5954: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5957: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ucb_killpg=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_ucb_killpg=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:5968: result: $ac_cv_lib_ucb_killpg" >&5 echo "${ECHO_T}$ac_cv_lib_ucb_killpg" >&6 if test $ac_cv_lib_ucb_killpg = yes; then LIBUCB="-lucb" fi case $host in *-*-lynxos* ) echo "$as_me:5975: checking LynxOS header file wrappers" >&5 echo $ECHO_N "checking LynxOS header file wrappers... $ECHO_C" >&6 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__" echo "$as_me:5978: result: disabled" >&5 echo "${ECHO_T}disabled" >&6 echo "$as_me:5980: checking for gethostbyname in -lbsd" >&5 echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 5988 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:6007: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6010: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:6013: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6016: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gethostbyname=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_bsd_gethostbyname=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:6027: result: $ac_cv_lib_bsd_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 if test $ac_cv_lib_bsd_gethostbyname = yes; then LIBSOCKET="-lbsd" fi ;; esac echo "$as_me:6035: checking for int" >&5 echo $ECHO_N "checking for int... $ECHO_C" >&6 if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 6041 "configure" #include "confdefs.h" $ac_includes_default int main () { if ((int *) 0) return 0; if (sizeof (int)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6056: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6059: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6062: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6065: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_int=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_type_int=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:6075: result: $ac_cv_type_int" >&5 echo "${ECHO_T}$ac_cv_type_int" >&6 echo "$as_me:6078: checking size of int" >&5 echo $ECHO_N "checking size of int... $ECHO_C" >&6 if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_int" = yes; then if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF #line 6087 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (int)) >= 0)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6099: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6102: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6105: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6108: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF #line 6113 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (int)) <= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6125: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6128: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6131: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6134: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1`; ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF #line 6150 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (int)) >= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6162: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6165: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6168: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6171: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_hi=`expr $ac_mid - 1`; ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.$ac_objext conftest.$ac_ext done fi rm -f conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF #line 6187 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (int)) <= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6199: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6202: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6205: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6208: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done ac_cv_sizeof_int=$ac_lo else if test "$cross_compiling" = yes; then { { echo "$as_me:6221: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line 6226 "configure" #include "confdefs.h" $ac_includes_default int main () { FILE *f = fopen ("conftest.val", "w"); if (!f) exit (1); fprintf (f, "%d", (sizeof (int))); fclose (f); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:6242: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6245: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:6247: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6250: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_int=0 fi fi echo "$as_me:6266: result: $ac_cv_sizeof_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_int" >&6 cat >>confdefs.h <&5 echo $ECHO_N "checking for long... $ECHO_C" >&6 if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 6278 "configure" #include "confdefs.h" $ac_includes_default int main () { if ((long *) 0) return 0; if (sizeof (long)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6293: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6296: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6299: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6302: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_type_long=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:6312: result: $ac_cv_type_long" >&5 echo "${ECHO_T}$ac_cv_type_long" >&6 echo "$as_me:6315: checking size of long" >&5 echo $ECHO_N "checking size of long... $ECHO_C" >&6 if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_long" = yes; then if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF #line 6324 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (long)) >= 0)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6336: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6339: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6342: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6345: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF #line 6350 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (long)) <= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6362: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6365: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6368: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6371: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1`; ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF #line 6387 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (long)) >= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6399: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6402: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6405: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6408: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_hi=`expr $ac_mid - 1`; ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.$ac_objext conftest.$ac_ext done fi rm -f conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF #line 6424 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (long)) <= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6436: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6439: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6442: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6445: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done ac_cv_sizeof_long=$ac_lo else if test "$cross_compiling" = yes; then { { echo "$as_me:6458: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line 6463 "configure" #include "confdefs.h" $ac_includes_default int main () { FILE *f = fopen ("conftest.val", "w"); if (!f) exit (1); fprintf (f, "%d", (sizeof (long))); fclose (f); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:6479: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6482: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:6484: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6487: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_long=0 fi fi echo "$as_me:6503: result: $ac_cv_sizeof_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long" >&6 cat >>confdefs.h <&5 echo $ECHO_N "checking for char *... $ECHO_C" >&6 if test "${ac_cv_type_char_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 6515 "configure" #include "confdefs.h" $ac_includes_default int main () { if ((char * *) 0) return 0; if (sizeof (char *)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6530: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6533: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6536: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6539: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_char_p=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_type_char_p=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:6549: result: $ac_cv_type_char_p" >&5 echo "${ECHO_T}$ac_cv_type_char_p" >&6 echo "$as_me:6552: checking size of char *" >&5 echo $ECHO_N "checking size of char *... $ECHO_C" >&6 if test "${ac_cv_sizeof_char_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_char_p" = yes; then if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF #line 6561 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (char *)) >= 0)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6573: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6576: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6579: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6582: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF #line 6587 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (char *)) <= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6599: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6602: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6605: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6608: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1`; ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF #line 6624 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (char *)) >= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6636: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6639: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6642: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6645: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_hi=`expr $ac_mid - 1`; ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.$ac_objext conftest.$ac_ext done fi rm -f conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF #line 6661 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (char *)) <= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6673: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6676: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6679: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6682: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done ac_cv_sizeof_char_p=$ac_lo else if test "$cross_compiling" = yes; then { { echo "$as_me:6695: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line 6700 "configure" #include "confdefs.h" $ac_includes_default int main () { FILE *f = fopen ("conftest.val", "w"); if (!f) exit (1); fprintf (f, "%d", (sizeof (char *))); fclose (f); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:6716: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6719: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:6721: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6724: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_char_p=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_char_p=0 fi fi echo "$as_me:6740: result: $ac_cv_sizeof_char_p" >&5 echo "${ECHO_T}$ac_cv_sizeof_char_p" >&6 cat >>confdefs.h <&5 echo $ECHO_N "checking for char... $ECHO_C" >&6 if test "${ac_cv_type_char+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 6752 "configure" #include "confdefs.h" $ac_includes_default int main () { if ((char *) 0) return 0; if (sizeof (char)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6767: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6770: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6773: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6776: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_char=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_type_char=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:6786: result: $ac_cv_type_char" >&5 echo "${ECHO_T}$ac_cv_type_char" >&6 echo "$as_me:6789: checking size of char" >&5 echo $ECHO_N "checking size of char... $ECHO_C" >&6 if test "${ac_cv_sizeof_char+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_char" = yes; then if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF #line 6798 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (char)) >= 0)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6810: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6813: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6816: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6819: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF #line 6824 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (char)) <= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6836: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6839: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6842: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6845: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1`; ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF #line 6861 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (char)) >= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6873: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6876: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6879: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6882: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_hi=`expr $ac_mid - 1`; ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.$ac_objext conftest.$ac_ext done fi rm -f conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF #line 6898 "configure" #include "confdefs.h" $ac_includes_default int main () { int _array_ [1 - 2 * !((sizeof (char)) <= $ac_mid)] ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:6910: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6913: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:6916: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6919: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done ac_cv_sizeof_char=$ac_lo else if test "$cross_compiling" = yes; then { { echo "$as_me:6932: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line 6937 "configure" #include "confdefs.h" $ac_includes_default int main () { FILE *f = fopen ("conftest.val", "w"); if (!f) exit (1); fprintf (f, "%d", (sizeof (char))); fclose (f); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:6953: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6956: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:6958: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6961: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_char=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_char=0 fi fi echo "$as_me:6977: result: $ac_cv_sizeof_char" >&5 echo "${ECHO_T}$ac_cv_sizeof_char" >&6 cat >>confdefs.h <&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 6991 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:7010: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7013: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:7016: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7019: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:7030: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then LIBDL="-ldl" ac_cv_have_dlfcn=yes fi echo "$as_me:7039: checking for shl_unload in -ldld" >&5 echo $ECHO_N "checking for shl_unload in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_shl_unload+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 7047 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_unload (); int main () { shl_unload (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:7066: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7069: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:7072: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7075: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_shl_unload=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_dld_shl_unload=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:7086: result: $ac_cv_lib_dld_shl_unload" >&5 echo "${ECHO_T}$ac_cv_lib_dld_shl_unload" >&6 if test $ac_cv_lib_dld_shl_unload = yes; then LIBDL="-ldld" ac_cv_have_shload=yes fi echo "$as_me:7095: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6 ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "${kde_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then kde_x_includes=NO else kde_x_includes=$x_includes fi if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then kde_x_libraries=NO else kde_x_libraries=$x_libraries fi # below we use the standard autoconf calls ac_x_libraries=$kde_x_libraries ac_x_includes=$kde_x_includes if test "$ac_x_includes" = NO; then # Guess where to find include files, by looking for this one X11 .h file. test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF #line 7129 "configure" #include "confdefs.h" #include <$x_direct_test_include> _ACEOF if { (eval echo "$as_me:7133: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:7139: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Look for the header file in a standard set of common directories. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in \ /usr/X11/include \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/include \ /usr/local/include \ /usr/unsupported/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include \ ; \ do if test -r "$ac_dir/$x_direct_test_include"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = NO if test "$ac_x_libraries" = NO; then # Check for the libraries. test -z "$x_direct_test_library" && x_direct_test_library=Xt test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 7213 "configure" #include "confdefs.h" int main () { ${x_direct_test_function}() ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:7225: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7228: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:7231: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7234: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS="$ac_save_LIBS" # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 LIBS="$ac_save_LIBS" # First see if replacing the include by lib works. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ /usr/X11/lib \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ /usr/lib/X11 \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ /usr/local/X11/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ /usr/local/lib/X11 \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ /lib/usr/lib/X11 \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ ; \ do for ac_extension in a so sl; do if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = NO case "$host" in mips-sgi-irix6*) ;; *-*-solaris*) ;; *) rm -fr conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'EOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' EOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -fr conftest.dir fi if test -z "$ac_x_includes"; then ac_x_includes="." fi if test -z "$ac_x_libraries"; then ac_x_libraries="/usr/lib" fi esac #from now on we use our own again # when the user already gave --x-includes, we ignore # what the standard autoconf macros told us. if test "$kde_x_includes" = NO; then kde_x_includes=$ac_x_includes fi # for --x-libraries too if test "$kde_x_libraries" = NO; then kde_x_libraries=$ac_x_libraries fi if test "$kde_x_includes" = NO; then { { echo "$as_me:7354: error: Can't find X includes. Please check your installation and add the correct paths!" >&5 echo "$as_me: error: Can't find X includes. Please check your installation and add the correct paths!" >&2;} { (exit 1); exit 1; }; } fi if test "$kde_x_libraries" = NO; then { { echo "$as_me:7360: error: Can't find X libraries. Please check your installation and add the correct paths!" >&5 echo "$as_me: error: Can't find X libraries. Please check your installation and add the correct paths!" >&2;} { (exit 1); exit 1; }; } fi # Record where we found X for the cache. kde_cv_have_x="have_x=yes \ kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" fi eval "$kde_cv_have_x" if test "$have_x" != yes; then echo "$as_me:7374: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6 no_x=yes else echo "$as_me:7378: result: libraries $kde_x_libraries, headers $kde_x_includes" >&5 echo "${ECHO_T}libraries $kde_x_libraries, headers $kde_x_includes" >&6 fi if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then X_INCLUDES="" x_includes="."; else x_includes=$kde_x_includes X_INCLUDES="-I$x_includes" fi if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then X_LDFLAGS="" x_libraries="/usr/lib"; else x_libraries=$kde_x_libraries X_LDFLAGS="-L$x_libraries" fi all_includes="$X_INCLUDES" all_libraries="$X_LDFLAGS" # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $X_LDFLAGS" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo "$as_me:7407: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 7415 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char IceConnectionNumber (); int main () { IceConnectionNumber (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:7434: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7437: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:7440: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7443: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:7454: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then LIBSM="-lSM -lICE" fi LDFLAGS="$ac_save_LDFLAGS" LIB_X11='-lX11 $(LIBSOCKET)' echo "$as_me:7464: checking for libXext" >&5 echo $ECHO_N "checking for libXext... $ECHO_C" >&6 if test "${kde_cv_have_libXext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else kde_ldflags_safe="$LDFLAGS" kde_libs_safe="$LIBS" LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" LIBS="-lXext -lX11 $LIBSOCKET" cat >conftest.$ac_ext <<_ACEOF #line 7477 "configure" #include "confdefs.h" #include #ifdef STDC_HEADERS # include #endif int main () { printf("hello Xext\n"); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:7496: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7499: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:7502: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7505: \$? = $ac_status" >&5 (exit $ac_status); }; }; then kde_cv_have_libXext=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 kde_cv_have_libXext=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LDFLAGS=$kde_ldflags_safe LIBS=$kde_libs_safe fi echo "$as_me:7521: result: $kde_cv_have_libXext" >&5 echo "${ECHO_T}$kde_cv_have_libXext" >&6 if test "$kde_cv_have_libXext" = "no"; then { { echo "$as_me:7525: error: We need a working libXext to proceed. Since configure can't find it itself, we stop here assuming that make wouldn't find them either." >&5 echo "$as_me: error: We need a working libXext to proceed. Since configure can't find it itself, we stop here assuming that make wouldn't find them either." >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:7534: checking for Xinerama" >&5 echo $ECHO_N "checking for Xinerama... $ECHO_C" >&6 # Check whether --with-xinerama or --without-xinerama was given. if test "${with_xinerama+set}" = set; then withval="$with_xinerama" no_xinerama=no else no_xinerama=yes fi; kde_save_LDFLAGS="$LDFLAGS" kde_save_CFLAGS="$CFLAGS" kde_save_LIBS="$LIBS" LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" CFLAGS="$CFLAGS -I$x_includes" LIBS="-lXinerama -lXext" if test "x$no_xinerama" = "xno"; then if test "${ac_cv_have_xinerama+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 7563 "configure" #include "confdefs.h" #include #include int main () { XineramaIsActive(NULL); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:7576: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7579: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:7582: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7585: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_xinerama="yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_have_xinerama="no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi else ac_cv_have_xinerama=no; fi echo "$as_me:7601: result: $ac_cv_have_xinerama" >&5 echo "${ECHO_T}$ac_cv_have_xinerama" >&6 LIBXINERAMA="" if test "$ac_cv_have_xinerama" = "yes"; then cat >>confdefs.h <<\EOF #define HAVE_XINERAMA 1 EOF LIBXINERAMA="-lXinerama" fi LDFLAGS="$kde_save_LDFLAGS" CFLAGS="$kde_save_CFLAGS" LIBS="$kde_save_LIBS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -z ""; then kde_qtver=2 kde_qtsubver=1 else kde_qtsubver=`echo "" | sed -e 's#[0-9]\+\.\([0-9]\+\).*#\1#'` # following is the check if subversion isnt found in passed argument if test "$kde_qtsubver" = ""; then kde_qtsubver=1 fi kde_qtver=`echo "" | sed -e 's#^\([0-9]\+\)\..*#\1#'` if test "$kde_qtver" = "1"; then kde_qtsubver=42 else # this is the version number fallback to 2.1, unless major version is 1 or 2 if test "$kde_qtver" != "2"; then kde_qtver=2 kde_qtsubver=1 fi fi fi if test -z ""; then if test $kde_qtver = 2; then if test $kde_qtsubver -gt 0; then kde_qt_minversion=">= Qt 2.2.2" else kde_qt_minversion=">= Qt 2.0.2" fi elif test $kde_qtver = 3; then kde_qt_minversion=">= 3.0" else kde_qt_minversion=">= 1.42 and < 2.0" fi else kde_qt_minversion= fi if test -z ""; then if test $kde_qtver = 2; then if test $kde_qtsubver -gt 0; then kde_qt_verstring="QT_VERSION >= 222" else kde_qt_verstring="QT_VERSION >= 200" fi elif test $kde_qtver = 3; then kde_qt_verstring="QT_VERSION >= 300" else kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200" fi else kde_qt_verstring= fi if test $kde_qtver = 2; then kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt" else kde_qt_dirs="$QTDIR /usr/lib/qt" fi echo "$as_me:7684: checking for extra includes" >&5 echo $ECHO_N "checking for extra includes... $ECHO_C" >&6 # Check whether --with-extra-includes or --without-extra-includes was given. if test "${with_extra_includes+set}" = set; then withval="$with_extra_includes" kde_use_extra_includes="$withval" else kde_use_extra_includes=NONE fi; kde_extra_includes= if test -n "$kde_use_extra_includes" && \ test "$kde_use_extra_includes" != "NONE"; then ac_save_ifs=$IFS IFS=':' for dir in $kde_use_extra_includes; do kde_extra_includes="$kde_extra_includes $dir" USER_INCLUDES="$USER_INCLUDES -I$dir" done IFS=$ac_save_ifs kde_use_extra_includes="added" else kde_use_extra_includes="no" fi echo "$as_me:7711: result: $kde_use_extra_includes" >&5 echo "${ECHO_T}$kde_use_extra_includes" >&6 kde_extra_libs= echo "$as_me:7715: checking for extra libs" >&5 echo $ECHO_N "checking for extra libs... $ECHO_C" >&6 # Check whether --with-extra-libs or --without-extra-libs was given. if test "${with_extra_libs+set}" = set; then withval="$with_extra_libs" kde_use_extra_libs=$withval else kde_use_extra_libs=NONE fi; if test -n "$kde_use_extra_libs" && \ test "$kde_use_extra_libs" != "NONE"; then ac_save_ifs=$IFS IFS=':' for dir in $kde_use_extra_libs; do kde_extra_libs="$kde_extra_libs $dir" KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" USER_LDFLAGS="$USER_LDFLAGS -L$dir" done IFS=$ac_save_ifs kde_use_extra_libs="added" else kde_use_extra_libs="no" fi echo "$as_me:7742: result: $kde_use_extra_libs" >&5 echo "${ECHO_T}$kde_use_extra_libs" >&6 echo "$as_me:7745: checking for libz" >&5 echo $ECHO_N "checking for libz... $ECHO_C" >&6 if test "${ac_cv_lib_z+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu kde_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" kde_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" cat >conftest.$ac_ext <<_ACEOF #line 7762 "configure" #include "confdefs.h" #include int main () { return (zlibVersion() == ZLIB_VERSION); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:7776: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7779: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:7782: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7785: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "ac_cv_lib_z='-lz'" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "ac_cv_lib_z=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS="$kde_save_LIBS" CFLAGS="$kde_save_CFLAGS" fi if test ! "$ac_cv_lib_z" = no; then cat >>confdefs.h <&5 echo "${ECHO_T}$ac_cv_lib_z" >&6 else { { echo "$as_me:7809: error: not found. Check your installation and look into config.log" >&5 echo "$as_me: error: not found. Check your installation and look into config.log" >&2;} { (exit 1); exit 1; }; } LIBZ="" fi echo "$as_me:7816: checking for libpng" >&5 echo $ECHO_N "checking for libpng... $ECHO_C" >&6 if test "${ac_cv_lib_png+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" kde_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF #line 7833 "configure" #include "confdefs.h" #include int main () { png_structp png_ptr = png_create_read_struct( /* image ptr */ PNG_LIBPNG_VER_STRING, 0, 0, 0 ); return( png_ptr != 0 ); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:7851: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7854: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:7857: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7860: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "ac_cv_lib_png='-lpng $LIBZ -lm'" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "ac_cv_lib_png=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS="$kde_save_LIBS" CFLAGS="$kde_save_CFLAGS" fi if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then cat >>confdefs.h <&5 echo "${ECHO_T}$ac_cv_lib_png" >&6 else echo "$as_me:7885: result: no" >&5 echo "${ECHO_T}no" >&6 LIBPNG="" fi echo "$as_me:7891: checking for libjpeg6b" >&5 echo $ECHO_N "checking for libjpeg6b... $ECHO_C" >&6 if test "${ac_cv_lib_jpeg_6b+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -ljpeg6b -lm" ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" cat >conftest.$ac_ext <<_ACEOF #line 7908 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ struct jpeg_decompress_struct; typedef struct jpeg_decompress_struct * j_decompress_ptr; typedef int size_t; #ifdef __cplusplus extern "C" { #endif void jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, size_t structsize); #ifdef __cplusplus } #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ int main () { jpeg_CreateDecompress(0L, 0, 0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:7934: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:7937: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:7940: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:7943: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "ac_cv_lib_jpeg_6b=-ljpeg6b" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "ac_cv_lib_jpeg_6b=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" CFLAGS="$ac_save_CFLAGS" fi if eval "test ! \"`echo $ac_cv_lib_jpeg_6b`\" = no"; then LIBJPEG="$ac_cv_lib_jpeg_6b" echo "$as_me:7959: result: $ac_cv_lib_jpeg_6b" >&5 echo "${ECHO_T}$ac_cv_lib_jpeg_6b" >&6 else echo "$as_me:7962: result: no" >&5 echo "${ECHO_T}no" >&6 echo "$as_me:7965: checking for libjpeg" >&5 echo $ECHO_N "checking for libjpeg... $ECHO_C" >&6 if test "${ac_cv_lib_jpeg_normal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -ljpeg -lm" ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" cat >conftest.$ac_ext <<_ACEOF #line 7982 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ struct jpeg_decompress_struct; typedef struct jpeg_decompress_struct * j_decompress_ptr; typedef int size_t; #ifdef __cplusplus extern "C" { #endif void jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, size_t structsize); #ifdef __cplusplus } #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ int main () { jpeg_CreateDecompress(0L, 0, 0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:8008: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:8011: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:8014: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:8017: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "ac_cv_lib_jpeg_normal=-ljpeg" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "ac_cv_lib_jpeg_normal=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" CFLAGS="$ac_save_CFLAGS" fi if eval "test ! \"`echo $ac_cv_lib_jpeg_normal`\" = no"; then LIBJPEG="$ac_cv_lib_jpeg_normal" echo "$as_me:8033: result: $ac_cv_lib_jpeg_normal" >&5 echo "${ECHO_T}$ac_cv_lib_jpeg_normal" >&6 else echo "$as_me:8036: result: no" >&5 echo "${ECHO_T}no" >&6 LIBJPEG= fi fi jpeg_incdirs="/usr/include /usr/local/include $kde_extra_includes" jpeg_incdir=NO for i in $jpeg_incdirs; do for j in jpeglib.h; do echo "configure: 8052: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 jpeg_incdir=$i break 2 fi done done test "x$jpeg_incdir" = xNO && jpeg_incdir= if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then cat >>confdefs.h <&5 echo "$as_me: WARNING: There is an installation error in jpeg support. You seem to have only one of either the headers _or_ the libraries installed. You may need to either provide correct --with-extra-... options, or the development package of libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ Disabling JPEG support. " >&2;} else { echo "$as_me:8086: WARNING: libjpeg not found. disable JPEG support." >&5 echo "$as_me: WARNING: libjpeg not found. disable JPEG support." >&2;} fi jpeg_incdir= LIBJPEG= fi # Check whether --enable-mt or --disable-mt was given. if test "${enable_mt+set}" = set; then enableval="$enable_mt" kde_use_qt_mt=$enableval else kde_use_qt_mt=no fi; USING_QT_MT="" if test "x$kde_use_qt_mt" = "xyes"; then case $host in *-*-linux-*) if test "x$GCC" = "xyes"; then CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT -pthread" X_EXTRA_LIBS="$X_EXTRA_LIBS -pthread" else { echo "$as_me:8112: WARNING: Compiler is not gcc. MT support disabled." >&5 echo "$as_me: WARNING: Compiler is not gcc. MT support disabled." >&2;} fi ;; *) { echo "$as_me:8117: WARNING: MT not yet supported on $host - disabled." >&5 echo "$as_me: WARNING: MT not yet supported on $host - disabled." >&2;} ;; esac fi kde_qt_was_given=yes if test -z "$LIBQT_GLOB"; then LIBQT_GLOB="libqt.*" fi if test -z "$LIBQT"; then LIBQT="-lqt" kde_int_qt="-lqt" if test "x$kde_use_qt_mt" = "xyes"; then case $host in *-*-linux-*) if test "x$GCC" = "xyes"; then LIBQT="-lqt-mt" kde_int_qt="-lqt-mt" LIBQT_GLOB="libqt-mt.*" USING_QT_MT="using -mt" fi ;; esac fi kde_qt_was_given=no else kde_int_qt="$LIBQT" fi if test $kde_qtver != 1; then LIBQT="$LIBQT $LIBPNG $LIBJPEG" fi echo "$as_me:8162: checking for Qt" >&5 echo $ECHO_N "checking for Qt... $ECHO_C" >&6 LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO qt_libraries="" qt_includes="" # Check whether --with-qt-dir or --without-qt-dir was given. if test "${with_qt_dir+set}" = set; then withval="$with_qt_dir" ac_qt_includes="$withval"/include ac_qt_libraries="$withval"/lib ac_qt_bindir="$withval"/bin fi; # Check whether --with-qt-includes or --without-qt-includes was given. if test "${with_qt_includes+set}" = set; then withval="$with_qt_includes" ac_qt_includes="$withval" fi; kde_qt_libs_given=no # Check whether --with-qt-libraries or --without-qt-libraries was given. if test "${with_qt_libraries+set}" = set; then withval="$with_qt_libraries" ac_qt_libraries="$withval" kde_qt_libs_given=yes fi; if test "${ac_cv_have_qt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else #try to guess Qt locations qt_incdirs="" for dir in $kde_qt_dirs; do qt_incdirs="$qt_incdirs $dir/include $dir" done qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 $x_includes" if test ! "$ac_qt_includes" = "NO"; then qt_incdirs="$ac_qt_includes $qt_incdirs" fi if test "$kde_qtver" != "1"; then kde_qt_header=qstyle.h else kde_qt_header=qglobal.h fi qt_incdir=NO for i in $qt_incdirs; do for j in $kde_qt_header; do echo "configure: 8222: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 qt_incdir=$i break 2 fi done done ac_qt_includes="$qt_incdir" qt_libdirs="" for dir in $kde_qt_dirs; do qt_libdirs="$qt_libdirs $dir/lib $dir" done qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" if test ! "$ac_qt_libraries" = "NO"; then qt_libdir=$ac_qt_libraries else qt_libdirs="$ac_qt_libraries $qt_libdirs" # if the Qt was given, the chance is too big that libqt.* doesn't exist qt_libdir=NONE for dir in $qt_libdirs; do try="ls -1 $dir/${LIBQT_GLOB}" if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&5 ; fi done fi ac_qt_libraries="$qt_libdir" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' ac_cxxflags_safe="$CXXFLAGS" ac_ldflags_safe="$LDFLAGS" ac_libs_safe="$LIBS" CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS" LIBS="$LIBS $LIBQT" cat > conftest.$ac_ext < #include EOF if test "$kde_qtver" != "1"; then cat >> conftest.$ac_ext < #include #include EOF if test $kde_qtsubver -gt 0; then cat >> conftest.$ac_ext < EOF fi fi echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext cat >> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:8317: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest; then rm -f conftest* else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_qt_libraries="NO" fi rm -f conftest* CXXFLAGS="$ac_cxxflags_safe" LDFLAGS="$ac_ldflags_safe" LIBS="$ac_libs_safe" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then ac_cv_have_qt="have_qt=no" ac_qt_notfound="" if test "$ac_qt_includes" = NO; then if test "$ac_qt_libraries" = NO; then ac_qt_notfound="(headers and libraries)"; else ac_qt_notfound="(headers)"; fi else ac_qt_notfound="(libraries)"; fi { { echo "$as_me:8349: error: Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! For more details about this problem, look at the end of config.log." >&5 echo "$as_me: error: Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! For more details about this problem, look at the end of config.log." >&2;} { (exit 1); exit 1; }; } else have_qt="yes" fi fi eval "$ac_cv_have_qt" if test "$have_qt" != yes; then echo "$as_me:8363: result: $have_qt" >&5 echo "${ECHO_T}$have_qt" >&6; else ac_cv_have_qt="have_qt=yes \ ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" echo "$as_me:8368: result: libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT" >&5 echo "${ECHO_T}libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT" >&6 qt_libraries="$ac_qt_libraries" qt_includes="$ac_qt_includes" fi if test ! "$kde_qt_libs_given" = "yes"; then echo "$as_me:8377: checking if Qt compiles without flags" >&5 echo $ECHO_N "checking if Qt compiles without flags... $ECHO_C" >&6 if test "${kde_cv_qt_direct+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH ac_LIBRARY_PATH="$LIBRARY_PATH" ac_cxxflags_safe="$CXXFLAGS" ac_ldflags_safe="$LDFLAGS" ac_libs_safe="$LIBS" CXXFLAGS="$CXXFLAGS -I$qt_includes" LDFLAGS="$LDFLAGS $X_LDFLAGS" LIBS="$LIBQT -lXext -lX11 $LIBSOCKET" LD_LIBRARY_PATH= export LD_LIBRARY_PATH LIBRARY_PATH= export LIBRARY_PATH cat > conftest.$ac_ext < #include EOF if test "$kde_qtver" != "1"; then cat >> conftest.$ac_ext < #include #include EOF if test $kde_qtsubver -gt 0; then cat >> conftest.$ac_ext < EOF fi fi echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext cat >> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:8454: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest; then kde_cv_qt_direct="yes" else kde_cv_qt_direct="no" echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* CXXFLAGS="$ac_cxxflags_safe" LDFLAGS="$ac_ldflags_safe" LIBS="$ac_libs_safe" LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" export LD_LIBRARY_PATH LIBRARY_PATH="$ac_LIBRARY_PATH" export LIBRARY_PATH ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi if test "$kde_cv_qt_direct" = "yes"; then echo "$as_me:8481: result: yes" >&5 echo "${ECHO_T}yes" >&6 qt_libraries= else echo "$as_me:8485: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then QT_INCLUDES=""; else QT_INCLUDES="-I$qt_includes" all_includes="$QT_INCLUDES $all_includes" fi if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then QT_LDFLAGS="" else QT_LDFLAGS="-L$qt_libraries" all_libraries="$all_libraries $QT_LDFLAGS" fi qt_bindirs="" for dir in $kde_qt_dirs; do qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" done qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" if test ! "$ac_qt_bindir" = "NO"; then qt_bindirs="$ac_qt_bindir $qt_bindirs" fi echo "$as_me:8515: checking for moc" >&5 echo $ECHO_N "checking for moc... $ECHO_C" >&6 if test -n "$MOC"; then kde_cv_path="$MOC"; else kde_cache=`echo moc | sed 'y%./+-%__p_%'` if eval "test \"\${kde_cv_path_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else kde_cv_path="NONE" dirs="$qt_bindirs" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/moc"; then if test -n "" then evalstr="$dir/moc 2>&1 " if eval $evalstr; then kde_cv_path="$dir/moc" break fi else kde_cv_path="$dir/moc" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" fi eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then echo "$as_me:8560: result: not found" >&5 echo "${ECHO_T}not found" >&6 { { echo "$as_me:8563: error: No Qt meta object compiler (moc) found! Please check whether you installed Qt correctly. You need to have a running moc binary. configure tried to run $ac_cv_path_moc and the test didn't succeed. If configure shouldn't have tried this one, set the environment variable MOC to the right one before running configure. " >&5 echo "$as_me: error: No Qt meta object compiler (moc) found! Please check whether you installed Qt correctly. You need to have a running moc binary. configure tried to run $ac_cv_path_moc and the test didn't succeed. If configure shouldn't have tried this one, set the environment variable MOC to the right one before running configure. " >&2;} { (exit 1); exit 1; }; } else echo "$as_me:8582: result: $kde_cv_path" >&5 echo "${ECHO_T}$kde_cv_path" >&6 MOC=$kde_cv_path fi if test -z "$UIC_NOT_NEEDED"; then echo "$as_me:8590: checking for uic" >&5 echo $ECHO_N "checking for uic... $ECHO_C" >&6 if test -n "$UIC"; then kde_cv_path="$UIC"; else kde_cache=`echo uic | sed 'y%./+-%__p_%'` if eval "test \"\${kde_cv_path_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else kde_cv_path="NONE" dirs="$qt_bindirs" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/uic"; then if test -n "" then evalstr="$dir/uic 2>&1 " if eval $evalstr; then kde_cv_path="$dir/uic" break fi else kde_cv_path="$dir/uic" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" fi eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then echo "$as_me:8635: result: not found" >&5 echo "${ECHO_T}not found" >&6 UIC="" else echo "$as_me:8639: result: $kde_cv_path" >&5 echo "${ECHO_T}$kde_cv_path" >&6 UIC=$kde_cv_path fi if test -z "$UIC" ; then { echo "$as_me:8647: WARNING: No Qt ui compiler (uic) found! Please check whether you installed Qt correctly. You need to have a running uic binary. configure tried to run $ac_cv_path_uic and the test didn't succeed. If configure shouldn't have tried this one, set the environment variable UIC to the right one before running configure. " >&5 echo "$as_me: WARNING: No Qt ui compiler (uic) found! Please check whether you installed Qt correctly. You need to have a running uic binary. configure tried to run $ac_cv_path_uic and the test didn't succeed. If configure shouldn't have tried this one, set the environment variable UIC to the right one before running configure. " >&2;} exit 1 fi else UIC="echo uic not available: " fi UIC_TR="i18n" if test $kde_qtver = 3; then UIC_TR="QT_KDE_I18N" fi LIB_QT="$kde_int_qt "'$(LIBPNG) $(LIBJPEG) -lXext $(LIB_X11) $(LIBSM)' echo "$as_me:8677: checking for rpath" >&5 echo $ECHO_N "checking for rpath... $ECHO_C" >&6 # Check whether --enable-rpath or --disable-rpath was given. if test "${enable_rpath+set}" = set; then enableval="$enable_rpath" USE_RPATH=$enableval else USE_RPATH=yes fi; if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then KDE_RPATH="-R \$(kde_libraries)" if test -n "$qt_libraries"; then KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" fi if test -n "$X_LDFLAGS"; then KDE_RPATH="$KDE_RPATH -R \$(x_libraries)" fi if test -n "$KDE_EXTRA_RPATH"; then KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" fi fi echo "$as_me:8702: result: $USE_RPATH" >&5 echo "${ECHO_T}$USE_RPATH" >&6 echo "$as_me:8705: checking for KDE" >&5 echo $ECHO_N "checking for KDE... $ECHO_C" >&6 if test "${prefix}" != NONE; then kde_includes=${prefix}/include ac_kde_includes=$prefix/include if test "${exec_prefix}" != NONE; then kde_libraries=${exec_prefix}/lib ac_kde_libraries=$exec_prefix/lib else kde_libraries=${prefix}/lib ac_kde_libraries=$prefix/lib fi else ac_kde_includes= ac_kde_libraries= kde_libraries="" kde_includes="" fi if test "${ac_cv_have_kde+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else #try to guess kde locations if test "$kde_qtver" = 1; then kde_check_header="ksock.h" kde_check_lib="libkdecore.la" else kde_check_header="ksharedptr.h" kde_check_lib="libkio.la" fi if test -z ""; then kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde2/include /opt/kde/include $x_includes $qt_includes" test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" kde_incdirs="$ac_kde_includes $kde_incdirs" kde_incdir=NO for i in $kde_incdirs; do for j in $kde_check_header; do echo "configure: 8750: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 kde_incdir=$i break 2 fi done done ac_kde_includes="$kde_incdir" if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then { { echo "$as_me:8762: error: in the prefix, you've chosen, are no KDE headers installed. This will fail. So, check this please and use another prefix!" >&5 echo "$as_me: error: in the prefix, you've chosen, are no KDE headers installed. This will fail. So, check this please and use another prefix!" >&2;} { (exit 1); exit 1; }; } fi kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde2/lib /opt/kde/lib /usr/X11R6/kde/lib" test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs" kde_libdirs="$ac_kde_libraries $kde_libdirs" kde_libdir=NO for i in $kde_libdirs; do for j in $kde_check_lib; do echo "configure: 8780: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 kde_libdir=$i break 2 fi done done ac_kde_libraries="$kde_libdir" if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then { { echo "$as_me:8792: error: in the prefix, you've chosen, are no KDE libraries installed. This will fail. So, check this please and use another prefix!" >&5 echo "$as_me: error: in the prefix, you've chosen, are no KDE libraries installed. This will fail. So, check this please and use another prefix!" >&2;} { (exit 1); exit 1; }; } fi ac_kde_libraries="$kde_libdir" if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then ac_cv_have_kde="have_kde=no" else ac_cv_have_kde="have_kde=yes \ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" fi else ac_cv_have_kde="have_kde=no" fi fi eval "$ac_cv_have_kde" if test "$have_kde" != "yes"; then if test "${prefix}" = NONE; then ac_kde_prefix="$ac_default_prefix" else ac_kde_prefix="$prefix" fi if test "$exec_prefix" = NONE; then ac_kde_exec_prefix="$ac_kde_prefix" echo "$as_me:8826: result: will be installed in $ac_kde_prefix" >&5 echo "${ECHO_T}will be installed in $ac_kde_prefix" >&6 else ac_kde_exec_prefix="$exec_prefix" echo "$as_me:8830: result: will be installed in $ac_kde_prefix and $ac_kde_exec_prefix" >&5 echo "${ECHO_T}will be installed in $ac_kde_prefix and $ac_kde_exec_prefix" >&6 fi kde_libraries="${ac_kde_exec_prefix}/lib" kde_includes=${ac_kde_prefix}/include else ac_cv_have_kde="have_kde=yes \ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" echo "$as_me:8840: result: libraries $ac_kde_libraries, headers $ac_kde_includes" >&5 echo "${ECHO_T}libraries $ac_kde_libraries, headers $ac_kde_includes" >&6 kde_libraries="$ac_kde_libraries" kde_includes="$ac_kde_includes" fi if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then KDE_INCLUDES="" else KDE_INCLUDES="-I$kde_includes" all_includes="$KDE_INCLUDES $all_includes" fi KDE_LDFLAGS="-L$kde_libraries" if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then all_libraries="$all_libraries $KDE_LDFLAGS" fi all_libraries="$all_libraries $USER_LDFLAGS" all_includes="$all_includes $USER_INCLUDES" # Check whether --enable-path-check or --disable-path-check was given. if test "${enable_path_check+set}" = set; then enableval="$enable_path_check" if test "$enableval" = "no"; then ac_use_path_checking="default" else ac_use_path_checking="" fi else if test "$kde_qtver" = 1; then ac_use_path_checking="" else ac_use_path_checking="default" fi fi; echo "$as_me:8880: checking for KDE paths" >&5 echo $ECHO_N "checking for KDE paths... $ECHO_C" >&6 kde_result="" kde_cached_paths=yes if test "${kde_cv_all_paths+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_use_path_checking" = "default"; then if test -z "$kde_htmldir"; then kde_htmldir='\${prefix}/share/doc/HTML' fi if test -z "$kde_appsdir"; then kde_appsdir='\${prefix}/share/applnk' fi if test -z "$kde_icondir"; then kde_icondir='\${prefix}/share/icons' fi if test -z "$kde_sounddir"; then kde_sounddir='\${prefix}/share/sounds' fi if test -z "$kde_datadir"; then kde_datadir='\${prefix}/share/apps' fi if test -z "$kde_locale"; then kde_locale='\${prefix}/share/locale' fi if test -z "$kde_cgidir"; then kde_cgidir='\${exec_prefix}/cgi-bin' fi if test -z "$kde_confdir"; then kde_confdir='\${prefix}/share/config' fi if test -z "$kde_mimedir"; then kde_mimedir='\${prefix}/share/mimelnk' fi if test -z "$kde_toolbardir"; then kde_toolbardir='\${prefix}/share/toolbar' fi if test -z "$kde_wallpaperdir"; then kde_wallpaperdir='\${prefix}/share/wallpapers' fi if test -z "$kde_templatesdir"; then kde_templatesdir='\${prefix}/share/templates' fi if test -z "$kde_bindir"; then kde_bindir='\${exec_prefix}/bin' fi if test -z "$kde_servicesdir"; then kde_servicesdir='\${prefix}/share/services' fi if test -z "$kde_servicetypesdir"; then kde_servicetypesdir='\${prefix}/share/servicetypes' fi if test -z "$kde_moduledir"; then kde_moduledir='\${exec_prefix}/lib/kde2' fi kde_cv_all_paths="kde_have_all_paths=\"yes\" \ kde_htmldir=\"$kde_htmldir\" \ kde_appsdir=\"$kde_appsdir\" \ kde_icondir=\"$kde_icondir\" \ kde_sounddir=\"$kde_sounddir\" \ kde_datadir=\"$kde_datadir\" \ kde_locale=\"$kde_locale\" \ kde_cgidir=\"$kde_cgidir\" \ kde_confdir=\"$kde_confdir\" \ kde_mimedir=\"$kde_mimedir\" \ kde_toolbardir=\"$kde_toolbardir\" \ kde_wallpaperdir=\"$kde_wallpaperdir\" \ kde_templatesdir=\"$kde_templatesdir\" \ kde_bindir=\"$kde_bindir\" \ kde_servicesdir=\"$kde_servicesdir\" \ kde_servicetypesdir=\"$kde_servicetypesdir\" \ kde_moduledir=\"$kde_moduledir\" \ kde_result=defaults" else if test $kde_qtver = 1; then echo "$as_me:8961: result: compiling" >&5 echo "${ECHO_T}compiling" >&6 echo "$as_me:8964: checking for KDE headers installed" >&5 echo $ECHO_N "checking for KDE headers installed... $ECHO_C" >&6 ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cat > conftest.$ac_ext < #endif #include #include "confdefs.h" #include int main() { printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); printf("kde_wallpaperdir=\\"%s\\"\n", KApplication::kde_wallpaperdir().data()); printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); printf("kde_moduledir=\\"/tmp/dummy\\"\n"); return 0; } EOF ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext' if { (eval echo "$as_me:9006: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9009: \$? = $ac_status" >&5 (exit $ac_status); }; then echo "$as_me:9011: result: yes" >&5 echo "${ECHO_T}yes" >&6 else { { echo "$as_me:9014: error: your system is not able to compile a small KDE application! Check, if you installed the KDE header files correctly. For more details about this problem, look at the end of config.log." >&5 echo "$as_me: error: your system is not able to compile a small KDE application! Check, if you installed the KDE header files correctly. For more details about this problem, look at the end of config.log." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu KDE_TEST_RPATH= if test -n "$USE_RPATH"; then if test -n "$kde_libraries"; then KDE_TEST_RPATH="-R $kde_libraries" fi if test -n "$qt_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" fi if test -n "$x_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" fi KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" fi echo "$as_me:9048: checking for KDE libraries installed" >&5 echo $ECHO_N "checking for KDE libraries installed... $ECHO_C" >&6 ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' if { (eval echo "$as_me:9052: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:9055: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest; then echo "$as_me:9057: result: yes" >&5 echo "${ECHO_T}yes" >&6 else { { echo "$as_me:9060: error: your system fails at linking a small KDE application! Check, if your compiler is installed correctly and if you have used the same compiler to compile Qt and kdelibs as you did use now. For more details about this problem, look at the end of config.log." >&5 echo "$as_me: error: your system fails at linking a small KDE application! Check, if your compiler is installed correctly and if you have used the same compiler to compile Qt and kdelibs as you did use now. For more details about this problem, look at the end of config.log." >&2;} { (exit 1); exit 1; }; } fi if eval `KDEDIR= ./conftest 2>&5`; then kde_result=done else kde_result=problems fi KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log kde_have_all_paths=yes kde_cv_all_paths="kde_have_all_paths=\"yes\" \ kde_htmldir=\"$kde_htmldir\" \ kde_appsdir=\"$kde_appsdir\" \ kde_icondir=\"$kde_icondir\" \ kde_sounddir=\"$kde_sounddir\" \ kde_datadir=\"$kde_datadir\" \ kde_locale=\"$kde_locale\" \ kde_cgidir=\"$kde_cgidir\" \ kde_confdir=\"$kde_confdir\" \ kde_mimedir=\"$kde_mimedir\" \ kde_toolbardir=\"$kde_toolbardir\" \ kde_wallpaperdir=\"$kde_wallpaperdir\" \ kde_templatesdir=\"$kde_templatesdir\" \ kde_bindir=\"$kde_bindir\" \ kde_servicesdir=\"$kde_servicesdir\" \ kde_servicetypesdir=\"$kde_servicetypesdir\" \ kde_moduledir=\"$kde_moduledir\" \ kde_result=$kde_result" else { { echo "$as_me:9100: error: path checking not yet supported for KDE 2" >&5 echo "$as_me: error: path checking not yet supported for KDE 2" >&2;} { (exit 1); exit 1; }; } fi fi kde_cached_paths=no fi eval "$kde_cv_all_paths" if test -z "$kde_htmldir" || test -z "$kde_appsdir" || test -z "$kde_icondir" || test -z "$kde_sounddir" || test -z "$kde_datadir" || test -z "$kde_locale" || test -z "$kde_cgidir" || test -z "$kde_confdir" || test -z "$kde_mimedir" || test -z "$kde_toolbardir" || test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || test -z "$kde_bindir" || test -z "$kde_servicesdir" || test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || test "$kde_have_all_paths" != "yes"; then kde_have_all_paths=no fi if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then # wrong values were cached, may be, we can set better ones kde_result= kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= kde_have_all_paths= if test "$ac_use_path_checking" = "default"; then if test -z "$kde_htmldir"; then kde_htmldir='\${prefix}/share/doc/HTML' fi if test -z "$kde_appsdir"; then kde_appsdir='\${prefix}/share/applnk' fi if test -z "$kde_icondir"; then kde_icondir='\${prefix}/share/icons' fi if test -z "$kde_sounddir"; then kde_sounddir='\${prefix}/share/sounds' fi if test -z "$kde_datadir"; then kde_datadir='\${prefix}/share/apps' fi if test -z "$kde_locale"; then kde_locale='\${prefix}/share/locale' fi if test -z "$kde_cgidir"; then kde_cgidir='\${exec_prefix}/cgi-bin' fi if test -z "$kde_confdir"; then kde_confdir='\${prefix}/share/config' fi if test -z "$kde_mimedir"; then kde_mimedir='\${prefix}/share/mimelnk' fi if test -z "$kde_toolbardir"; then kde_toolbardir='\${prefix}/share/toolbar' fi if test -z "$kde_wallpaperdir"; then kde_wallpaperdir='\${prefix}/share/wallpapers' fi if test -z "$kde_templatesdir"; then kde_templatesdir='\${prefix}/share/templates' fi if test -z "$kde_bindir"; then kde_bindir='\${exec_prefix}/bin' fi if test -z "$kde_servicesdir"; then kde_servicesdir='\${prefix}/share/services' fi if test -z "$kde_servicetypesdir"; then kde_servicetypesdir='\${prefix}/share/servicetypes' fi if test -z "$kde_moduledir"; then kde_moduledir='\${exec_prefix}/lib/kde2' fi kde_cv_all_paths="kde_have_all_paths=\"yes\" \ kde_htmldir=\"$kde_htmldir\" \ kde_appsdir=\"$kde_appsdir\" \ kde_icondir=\"$kde_icondir\" \ kde_sounddir=\"$kde_sounddir\" \ kde_datadir=\"$kde_datadir\" \ kde_locale=\"$kde_locale\" \ kde_cgidir=\"$kde_cgidir\" \ kde_confdir=\"$kde_confdir\" \ kde_mimedir=\"$kde_mimedir\" \ kde_toolbardir=\"$kde_toolbardir\" \ kde_wallpaperdir=\"$kde_wallpaperdir\" \ kde_templatesdir=\"$kde_templatesdir\" \ kde_bindir=\"$kde_bindir\" \ kde_servicesdir=\"$kde_servicesdir\" \ kde_servicetypesdir=\"$kde_servicetypesdir\" \ kde_moduledir=\"$kde_moduledir\" \ kde_result=defaults" else if test $kde_qtver = 1; then echo "$as_me:9206: result: compiling" >&5 echo "${ECHO_T}compiling" >&6 echo "$as_me:9209: checking for KDE headers installed" >&5 echo $ECHO_N "checking for KDE headers installed... $ECHO_C" >&6 ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cat > conftest.$ac_ext < #endif #include #include "confdefs.h" #include int main() { printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); printf("kde_wallpaperdir=\\"%s\\"\n", KApplication::kde_wallpaperdir().data()); printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); printf("kde_moduledir=\\"/tmp/dummy\\"\n"); return 0; } EOF ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext' if { (eval echo "$as_me:9251: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:9254: \$? = $ac_status" >&5 (exit $ac_status); }; then echo "$as_me:9256: result: yes" >&5 echo "${ECHO_T}yes" >&6 else { { echo "$as_me:9259: error: your system is not able to compile a small KDE application! Check, if you installed the KDE header files correctly. For more details about this problem, look at the end of config.log." >&5 echo "$as_me: error: your system is not able to compile a small KDE application! Check, if you installed the KDE header files correctly. For more details about this problem, look at the end of config.log." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu KDE_TEST_RPATH= if test -n "$USE_RPATH"; then if test -n "$kde_libraries"; then KDE_TEST_RPATH="-R $kde_libraries" fi if test -n "$qt_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" fi if test -n "$x_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" fi KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" fi echo "$as_me:9293: checking for KDE libraries installed" >&5 echo $ECHO_N "checking for KDE libraries installed... $ECHO_C" >&6 ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' if { (eval echo "$as_me:9297: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:9300: \$? = $ac_status" >&5 (exit $ac_status); } && test -s conftest; then echo "$as_me:9302: result: yes" >&5 echo "${ECHO_T}yes" >&6 else { { echo "$as_me:9305: error: your system fails at linking a small KDE application! Check, if your compiler is installed correctly and if you have used the same compiler to compile Qt and kdelibs as you did use now. For more details about this problem, look at the end of config.log." >&5 echo "$as_me: error: your system fails at linking a small KDE application! Check, if your compiler is installed correctly and if you have used the same compiler to compile Qt and kdelibs as you did use now. For more details about this problem, look at the end of config.log." >&2;} { (exit 1); exit 1; }; } fi if eval `KDEDIR= ./conftest 2>&5`; then kde_result=done else kde_result=problems fi KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log kde_have_all_paths=yes kde_cv_all_paths="kde_have_all_paths=\"yes\" \ kde_htmldir=\"$kde_htmldir\" \ kde_appsdir=\"$kde_appsdir\" \ kde_icondir=\"$kde_icondir\" \ kde_sounddir=\"$kde_sounddir\" \ kde_datadir=\"$kde_datadir\" \ kde_locale=\"$kde_locale\" \ kde_cgidir=\"$kde_cgidir\" \ kde_confdir=\"$kde_confdir\" \ kde_mimedir=\"$kde_mimedir\" \ kde_toolbardir=\"$kde_toolbardir\" \ kde_wallpaperdir=\"$kde_wallpaperdir\" \ kde_templatesdir=\"$kde_templatesdir\" \ kde_bindir=\"$kde_bindir\" \ kde_servicesdir=\"$kde_servicesdir\" \ kde_servicetypesdir=\"$kde_servicetypesdir\" \ kde_moduledir=\"$kde_moduledir\" \ kde_result=$kde_result" else { { echo "$as_me:9345: error: path checking not yet supported for KDE 2" >&5 echo "$as_me: error: path checking not yet supported for KDE 2" >&2;} { (exit 1); exit 1; }; } fi fi eval "$kde_cv_all_paths" if test -z "$kde_htmldir" || test -z "$kde_appsdir" || test -z "$kde_icondir" || test -z "$kde_sounddir" || test -z "$kde_datadir" || test -z "$kde_locale" || test -z "$kde_cgidir" || test -z "$kde_confdir" || test -z "$kde_mimedir" || test -z "$kde_toolbardir" || test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || test -z "$kde_bindir" || test -z "$kde_servicesdir" || test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || test "$kde_have_all_paths" != "yes"; then kde_have_all_paths=no fi kde_result="$kde_result (cache overridden)" fi if test "$kde_have_all_paths" = "no"; then { { echo "$as_me:9368: error: configure could not run a little KDE program to test the environment. Since it had compiled and linked before, it must be a strange problem on your system. Look at config.log for details. If you are not able to fix this, look at http://www.kde.org/faq/installation.html or any www.kde.org mirror. (If you're using an egcs version on Linux, you may update binutils!) " >&5 echo "$as_me: error: configure could not run a little KDE program to test the environment. Since it had compiled and linked before, it must be a strange problem on your system. Look at config.log for details. If you are not able to fix this, look at http://www.kde.org/faq/installation.html or any www.kde.org mirror. (If you're using an egcs version on Linux, you may update binutils!) " >&2;} { (exit 1); exit 1; }; } else rm -f conftest* echo "$as_me:9383: result: $kde_result" >&5 echo "${ECHO_T}$kde_result" >&6 fi bindir=$kde_bindir kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde2/bin /usr/kde/bin /usr/local/kde/bin" if test -n "$KDEDIRS"; then kde_save_IFS=$IFS IFS=: for dir in $KDEDIRS; do kde_default_bindirs="$dir/bin $kde_default_bindirs " done IFS=$kde_save_IFS fi kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs" echo "$as_me:9400: checking for dcopidl" >&5 echo $ECHO_N "checking for dcopidl... $ECHO_C" >&6 if test -n "$DCOPIDL"; then kde_cv_path="$DCOPIDL"; else kde_cache=`echo dcopidl | sed 'y%./+-%__p_%'` if eval "test \"\${kde_cv_path_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else kde_cv_path="NONE" dirs="$kde_default_bindirs" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/dcopidl"; then if test -n "" then evalstr="$dir/dcopidl 2>&1 " if eval $evalstr; then kde_cv_path="$dir/dcopidl" break fi else kde_cv_path="$dir/dcopidl" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" fi eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then echo "$as_me:9445: result: not found" >&5 echo "${ECHO_T}not found" >&6 { { echo "$as_me:9448: error: The important program dcopidl was not found! Please check whether you installed KDE correctly. " >&5 echo "$as_me: error: The important program dcopidl was not found! Please check whether you installed KDE correctly. " >&2;} { (exit 1); exit 1; }; } else echo "$as_me:9457: result: $kde_cv_path" >&5 echo "${ECHO_T}$kde_cv_path" >&6 DCOPIDL=$kde_cv_path fi echo "$as_me:9463: checking for dcopidl2cpp" >&5 echo $ECHO_N "checking for dcopidl2cpp... $ECHO_C" >&6 if test -n "$DCOPIDL2CPP"; then kde_cv_path="$DCOPIDL2CPP"; else kde_cache=`echo dcopidl2cpp | sed 'y%./+-%__p_%'` if eval "test \"\${kde_cv_path_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else kde_cv_path="NONE" dirs="$kde_default_bindirs" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/dcopidl2cpp"; then if test -n "" then evalstr="$dir/dcopidl2cpp 2>&1 " if eval $evalstr; then kde_cv_path="$dir/dcopidl2cpp" break fi else kde_cv_path="$dir/dcopidl2cpp" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" fi eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then echo "$as_me:9508: result: not found" >&5 echo "${ECHO_T}not found" >&6 { { echo "$as_me:9511: error: The important program dcopidl2cpp was not found! Please check whether you installed KDE correctly. " >&5 echo "$as_me: error: The important program dcopidl2cpp was not found! Please check whether you installed KDE correctly. " >&2;} { (exit 1); exit 1; }; } else echo "$as_me:9520: result: $kde_cv_path" >&5 echo "${ECHO_T}$kde_cv_path" >&6 DCOPIDL2CPP=$kde_cv_path fi echo "$as_me:9526: checking for mcopidl" >&5 echo $ECHO_N "checking for mcopidl... $ECHO_C" >&6 if test -n "$MCOPIDL"; then kde_cv_path="$MCOPIDL"; else kde_cache=`echo mcopidl | sed 'y%./+-%__p_%'` if eval "test \"\${kde_cv_path_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else kde_cv_path="NONE" dirs="$kde_default_bindirs" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/mcopidl"; then if test -n "" then evalstr="$dir/mcopidl 2>&1 " if eval $evalstr; then kde_cv_path="$dir/mcopidl" break fi else kde_cv_path="$dir/mcopidl" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" fi eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then echo "$as_me:9571: result: not found" >&5 echo "${ECHO_T}not found" >&6 { { echo "$as_me:9574: error: The important program mcopidl was not found! Please check whether you installed KDE correctly. " >&5 echo "$as_me: error: The important program mcopidl was not found! Please check whether you installed KDE correctly. " >&2;} { (exit 1); exit 1; }; } else echo "$as_me:9583: result: $kde_cv_path" >&5 echo "${ECHO_T}$kde_cv_path" >&6 MCOPIDL=$kde_cv_path fi echo "$as_me:9589: checking for artsc-config" >&5 echo $ECHO_N "checking for artsc-config... $ECHO_C" >&6 if test -n "$ARTSCCONFIG"; then kde_cv_path="$ARTSCCONFIG"; else kde_cache=`echo artsc-config | sed 'y%./+-%__p_%'` if eval "test \"\${kde_cv_path_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else kde_cv_path="NONE" dirs="$kde_default_bindirs" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/artsc-config"; then if test -n "" then evalstr="$dir/artsc-config 2>&1 " if eval $evalstr; then kde_cv_path="$dir/artsc-config" break fi else kde_cv_path="$dir/artsc-config" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" fi eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then echo "$as_me:9634: result: not found" >&5 echo "${ECHO_T}not found" >&6 { { echo "$as_me:9637: error: The important program artsc-config was not found! Please check whether you installed KDE correctly. " >&5 echo "$as_me: error: The important program artsc-config was not found! Please check whether you installed KDE correctly. " >&2;} { (exit 1); exit 1; }; } else echo "$as_me:9646: result: $kde_cv_path" >&5 echo "${ECHO_T}$kde_cv_path" >&6 ARTSCCONFIG=$kde_cv_path fi echo "$as_me:9652: checking for kde-config" >&5 echo $ECHO_N "checking for kde-config... $ECHO_C" >&6 if test -n "$KDECONFIG"; then kde_cv_path="$KDECONFIG"; else kde_cache=`echo kde-config | sed 'y%./+-%__p_%'` if eval "test \"\${kde_cv_path_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else kde_cv_path="NONE" dirs="$kde_default_bindirs" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/kde-config"; then if test -n "" then evalstr="$dir/kde-config 2>&1 " if eval $evalstr; then kde_cv_path="$dir/kde-config" break fi else kde_cv_path="$dir/kde-config" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" fi eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then echo "$as_me:9697: result: not found" >&5 echo "${ECHO_T}not found" >&6 else echo "$as_me:9701: result: $kde_cv_path" >&5 echo "${ECHO_T}$kde_cv_path" >&6 KDECONFIG=$kde_cv_path fi echo "$as_me:9707: checking for meinproc" >&5 echo $ECHO_N "checking for meinproc... $ECHO_C" >&6 if test -n "$MEINPROC"; then kde_cv_path="$MEINPROC"; else kde_cache=`echo meinproc | sed 'y%./+-%__p_%'` if eval "test \"\${kde_cv_path_$kde_cache+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else kde_cv_path="NONE" dirs="$kde_default_bindirs" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/meinproc"; then if test -n "" then evalstr="$dir/meinproc 2>&1 " if eval $evalstr; then kde_cv_path="$dir/meinproc" break fi else kde_cv_path="$dir/meinproc" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" fi eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then echo "$as_me:9752: result: not found" >&5 echo "${ECHO_T}not found" >&6 else echo "$as_me:9756: result: $kde_cv_path" >&5 echo "${ECHO_T}$kde_cv_path" >&6 MEINPROC=$kde_cv_path fi if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde2/share /opt/kde/share $prefix/share" test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" KDE_XSL_STYLESHEET=NO for i in $kde_sharedirs; do for j in apps/ksgmltools2/customization/kde-chunk.xsl; do echo "configure: 9771: $i/$j" >&5 if test -r "$i/$j"; then echo "taking that" >&5 KDE_XSL_STYLESHEET=$i break 2 fi done done if test "$KDE_XSL_STYLESHEET" = "NO"; then KDE_XSL_STYLESHEET="" else KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" fi fi DCOP_DEPENDENCIES='$(DCOPIDL)' if test -x "$KDECONFIG"; then # it can be "compiled" kde_libs_prefix=`$KDECONFIG --prefix` if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then { { echo "$as_me:9792: error: $KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. This means it has been moved since you installed it. This won't work. Please recompile kdelibs for the new prefix. " >&5 echo "$as_me: error: $KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. This means it has been moved since you installed it. This won't work. Please recompile kdelibs for the new prefix. " >&2;} { (exit 1); exit 1; }; } fi kde_libs_htmldir=`$KDECONFIG --install html --expandvars` else kde_libs_prefix='$(prefix)' kde_libs_htmldir='$(kde_htmldir)' fi if test "$kde_qtver" = 1; then kde_minidir="$kde_icondir/mini" else # for KDE 1 - this breaks KDE2 apps using minidir, but # that's the plan ;-/ kde_minidir="/dev/null" fi if test $kde_qtver != 1; then LIB_KDECORE='-lkdecore' LIB_KDEUI='-lkdeui' LIB_KFORMULA='-lkformula' LIB_KIO='-lkio' LIB_KSYCOCA='-lksycoca' LIB_SMB='-lsmb' LIB_KFILE='-lkfile' LIB_KAB='-lkab' LIB_KHTML='-lkhtml' LIB_KSPELL='-lkspell' LIB_KPARTS='-lkparts' LIB_KWRITE='-lkwrite' else LIB_KDECORE='-lkdecore -lXext $(LIB_QT)' LIB_KDEUI='-lkdeui $(LIB_KDECORE)' LIB_KFM='-lkfm $(LIB_KDECORE)' LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)' LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)' fi #MIN_CONFIG DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" if test ! -s $srcdir/subdirs; then TOPSUBDIRS="" files=`cd $srcdir && ls -1` dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` for i in $dirs; do echo $i >> $srcdir/subdirs done fi if test -s $srcdir/inst-apps; then ac_topsubdirs="`cat $srcdir/inst-apps`" else ac_topsubdirs="`cat $srcdir/subdirs`" fi for i in $ac_topsubdirs; do echo "$as_me:9874: checking if $i should be compiled" >&5 echo $ECHO_N "checking if $i should be compiled... $ECHO_C" >&6 if test -d $srcdir/$i; then install_it="yes" for j in $DO_NOT_COMPILE; do if test $i = $j; then install_it="no" fi done else install_it="no" fi echo "$as_me:9886: result: $install_it" >&5 echo "${ECHO_T}$install_it" >&6 if test $install_it = "yes"; then TOPSUBDIRS="$TOPSUBDIRS $i" fi done ac_config_files="$ac_config_files ./Makefile reference/Makefile reference/C/Makefile reference/C/CONCEPT/Makefile reference/C/CONTRIB/Makefile reference/C/CONTRIB/OR_PRACTICAL_C/Makefile reference/C/CONTRIB/OR_USING_C/Makefile reference/C/CONTRIB/SAWTELL/Makefile reference/C/CONTRIB/SNIP/Makefile reference/C/CONTRIB/YABL/Makefile reference/C/EXAMPLES/Makefile reference/C/FUNCTIONS/Makefile reference/C/GDB/Makefile reference/C/LIBRARIES/Makefile reference/C/MAN/Makefile reference/C/MISC/Makefile reference/C/MISC/CLASSES/Makefile reference/C/PROBLEMS/Makefile reference/C/SYNTAX/Makefile reference/C/TECHNIC/Makefile reference/C/X_EXAMPLES/Makefile reference/C/backup/Makefile reference/CPLUSPLUS/Makefile reference/CPLUSPLUS/CONCEPT/Makefile reference/CPLUSPLUS/CONTRIB/Makefile reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/Makefile reference/CPLUSPLUS/EXAMPLES/Makefile reference/CPLUSPLUS/FUNCTIONS/Makefile reference/CPLUSPLUS/GDB/Makefile reference/CPLUSPLUS/LIBRARIES/Makefile reference/CPLUSPLUS/MISC/Makefile reference/CPLUSPLUS/PROBLEMS/Makefile reference/CPLUSPLUS/SYNTAX/Makefile reference/CPLUSPLUS/TECHNIC/Makefile reference/CPLUSPLUS/X_EXAMPLES/Makefile reference/GRAPHICS/Makefile" cat >confcache <<\_ACEOF # 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, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overriden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # 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 \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:9973: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated automatically by configure. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false SHELL=\${CONFIG_SHELL-$SHELL} ac_cs_invocation="\$0 \$@" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } exec 6>&1 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\EOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` shift set dummy "$ac_option" "$ac_optarg" ${1+"$@"} shift ;; -*);; *) # This is not an option, so the user has probably given explicit # arguments. ac_need_defaults=false;; esac case $1 in # Handling of the options. EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:10149: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) shift CONFIG_FILES="$CONFIG_FILES $1" ac_need_defaults=false;; --header | --heade | --head | --hea ) shift CONFIG_HEADERS="$CONFIG_HEADERS $1" ac_need_defaults=false;; # This is an error. -*) { { echo "$as_me:10168: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done exec 5>>config.log cat >&5 << _ACEOF ## ----------------------- ## ## Running config.status. ## ## ----------------------- ## This file was extended by $as_me 2.52, executed with CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS > $ac_cs_invocation on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "./Makefile" ) CONFIG_FILES="$CONFIG_FILES ./Makefile" ;; "reference/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/Makefile" ;; "reference/C/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/Makefile" ;; "reference/C/CONCEPT/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/CONCEPT/Makefile" ;; "reference/C/CONTRIB/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/CONTRIB/Makefile" ;; "reference/C/CONTRIB/OR_PRACTICAL_C/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/CONTRIB/OR_PRACTICAL_C/Makefile" ;; "reference/C/CONTRIB/OR_USING_C/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/CONTRIB/OR_USING_C/Makefile" ;; "reference/C/CONTRIB/SAWTELL/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/CONTRIB/SAWTELL/Makefile" ;; "reference/C/CONTRIB/SNIP/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/CONTRIB/SNIP/Makefile" ;; "reference/C/CONTRIB/YABL/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/CONTRIB/YABL/Makefile" ;; "reference/C/EXAMPLES/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/EXAMPLES/Makefile" ;; "reference/C/FUNCTIONS/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/FUNCTIONS/Makefile" ;; "reference/C/GDB/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/GDB/Makefile" ;; "reference/C/LIBRARIES/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/LIBRARIES/Makefile" ;; "reference/C/MAN/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/MAN/Makefile" ;; "reference/C/MISC/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/MISC/Makefile" ;; "reference/C/MISC/CLASSES/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/MISC/CLASSES/Makefile" ;; "reference/C/PROBLEMS/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/PROBLEMS/Makefile" ;; "reference/C/SYNTAX/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/SYNTAX/Makefile" ;; "reference/C/TECHNIC/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/TECHNIC/Makefile" ;; "reference/C/X_EXAMPLES/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/X_EXAMPLES/Makefile" ;; "reference/C/backup/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/C/backup/Makefile" ;; "reference/CPLUSPLUS/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/Makefile" ;; "reference/CPLUSPLUS/CONCEPT/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/CONCEPT/Makefile" ;; "reference/CPLUSPLUS/CONTRIB/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/CONTRIB/Makefile" ;; "reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/Makefile" ;; "reference/CPLUSPLUS/EXAMPLES/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/EXAMPLES/Makefile" ;; "reference/CPLUSPLUS/FUNCTIONS/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/FUNCTIONS/Makefile" ;; "reference/CPLUSPLUS/GDB/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/GDB/Makefile" ;; "reference/CPLUSPLUS/LIBRARIES/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/LIBRARIES/Makefile" ;; "reference/CPLUSPLUS/MISC/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/MISC/Makefile" ;; "reference/CPLUSPLUS/PROBLEMS/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/PROBLEMS/Makefile" ;; "reference/CPLUSPLUS/SYNTAX/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/SYNTAX/Makefile" ;; "reference/CPLUSPLUS/TECHNIC/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/TECHNIC/Makefile" ;; "reference/CPLUSPLUS/X_EXAMPLES/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/CPLUSPLUS/X_EXAMPLES/Makefile" ;; "reference/GRAPHICS/Makefile" ) CONFIG_FILES="$CONFIG_FILES reference/GRAPHICS/Makefile" ;; "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:10251: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. : ${TMPDIR=/tmp} { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=$TMPDIR/cs$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } EOF cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@DEFS@,$DEFS,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@target@,$target,;t t s,@target_cpu@,$target_cpu,;t t s,@target_vendor@,$target_vendor,;t t s,@target_os@,$target_os,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@DEPDIR@,$DEPDIR,;t t s,@CONF_FILES@,$CONF_FILES,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@CXXDEPMODE@,$CXXDEPMODE,;t t s,@USE_EXCEPTIONS@,$USE_EXCEPTIONS,;t t s,@USE_RTTI@,$USE_RTTI,;t t s,@CXXCPP@,$CXXCPP,;t t s,@NOOPT_CXXFLAGS@,$NOOPT_CXXFLAGS,;t t s,@REPO@,$REPO,;t t s,@NOREPO@,$NOREPO,;t t s,@KDE_USE_FINAL_TRUE@,$KDE_USE_FINAL_TRUE,;t t s,@KDE_USE_FINAL_FALSE@,$KDE_USE_FINAL_FALSE,;t t s,@KDE_USE_CLOSURE_TRUE@,$KDE_USE_CLOSURE_TRUE,;t t s,@KDE_USE_CLOSURE_FALSE@,$KDE_USE_CLOSURE_FALSE,;t t s,@KDE_CXXFLAGS@,$KDE_CXXFLAGS,;t t s,@LN_S@,$LN_S,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@KDE_PLUGIN@,$KDE_PLUGIN,;t t s,@MSGFMT@,$MSGFMT,;t t s,@GMSGFMT@,$GMSGFMT,;t t s,@XGETTEXT@,$XGETTEXT,;t t s,@CPP@,$CPP,;t t s,@LIBUTIL@,$LIBUTIL,;t t s,@LIBCOMPAT@,$LIBCOMPAT,;t t s,@LIBCRYPT@,$LIBCRYPT,;t t s,@LIBSOCKET@,$LIBSOCKET,;t t s,@LIBRESOLV@,$LIBRESOLV,;t t s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t s,@LIBUCB@,$LIBUCB,;t t s,@LIBDL@,$LIBDL,;t t s,@X_INCLUDES@,$X_INCLUDES,;t t s,@X_LDFLAGS@,$X_LDFLAGS,;t t s,@x_libraries@,$x_libraries,;t t s,@x_includes@,$x_includes,;t t s,@LIBSM@,$LIBSM,;t t s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t s,@LIB_X11@,$LIB_X11,;t t s,@LIBXINERAMA@,$LIBXINERAMA,;t t s,@USER_INCLUDES@,$USER_INCLUDES,;t t s,@USER_LDFLAGS@,$USER_LDFLAGS,;t t s,@LIBZ@,$LIBZ,;t t s,@LIBPNG@,$LIBPNG,;t t s,@LIBJPEG@,$LIBJPEG,;t t s,@qt_libraries@,$qt_libraries,;t t s,@qt_includes@,$qt_includes,;t t s,@QT_INCLUDES@,$QT_INCLUDES,;t t s,@QT_LDFLAGS@,$QT_LDFLAGS,;t t s,@MOC@,$MOC,;t t s,@UIC@,$UIC,;t t s,@UIC_TR@,$UIC_TR,;t t s,@LIB_QT@,$LIB_QT,;t t s,@kde_qtver@,$kde_qtver,;t t s,@KDE_EXTRA_RPATH@,$KDE_EXTRA_RPATH,;t t s,@KDE_RPATH@,$KDE_RPATH,;t t s,@kde_libraries@,$kde_libraries,;t t s,@kde_includes@,$kde_includes,;t t s,@KDE_LDFLAGS@,$KDE_LDFLAGS,;t t s,@KDE_INCLUDES@,$KDE_INCLUDES,;t t s,@all_includes@,$all_includes,;t t s,@all_libraries@,$all_libraries,;t t s,@AUTODIRS@,$AUTODIRS,;t t s,@DCOPIDL@,$DCOPIDL,;t t s,@DCOPIDL2CPP@,$DCOPIDL2CPP,;t t s,@DCOP_DEPENDENCIES@,$DCOP_DEPENDENCIES,;t t s,@MCOPIDL@,$MCOPIDL,;t t s,@ARTSCCONFIG@,$ARTSCCONFIG,;t t s,@KDECONFIG@,$KDECONFIG,;t t s,@MEINPROC@,$MEINPROC,;t t s,@KDE_XSL_STYLESHEET@,$KDE_XSL_STYLESHEET,;t t s,@kde_libs_prefix@,$kde_libs_prefix,;t t s,@kde_libs_htmldir@,$kde_libs_htmldir,;t t s,@kde_htmldir@,$kde_htmldir,;t t s,@kde_appsdir@,$kde_appsdir,;t t s,@kde_icondir@,$kde_icondir,;t t s,@kde_sounddir@,$kde_sounddir,;t t s,@kde_datadir@,$kde_datadir,;t t s,@kde_locale@,$kde_locale,;t t s,@kde_confdir@,$kde_confdir,;t t s,@kde_mimedir@,$kde_mimedir,;t t s,@kde_wallpaperdir@,$kde_wallpaperdir,;t t s,@kde_bindir@,$kde_bindir,;t t s,@kde_templatesdir@,$kde_templatesdir,;t t s,@kde_servicesdir@,$kde_servicesdir,;t t s,@kde_servicetypesdir@,$kde_servicetypesdir,;t t s,@kde_moduledir@,$kde_moduledir,;t t s,@LIB_KDECORE@,$LIB_KDECORE,;t t s,@LIB_KDEUI@,$LIB_KDEUI,;t t s,@LIB_KFORMULA@,$LIB_KFORMULA,;t t s,@LIB_KIO@,$LIB_KIO,;t t s,@LIB_KSYCOCA@,$LIB_KSYCOCA,;t t s,@LIB_SMB@,$LIB_SMB,;t t s,@LIB_KFILE@,$LIB_KFILE,;t t s,@LIB_KAB@,$LIB_KAB,;t t s,@LIB_KHTML@,$LIB_KHTML,;t t s,@LIB_KSPELL@,$LIB_KSPELL,;t t s,@LIB_KPARTS@,$LIB_KPARTS,;t t s,@LIB_KWRITE@,$LIB_KWRITE,;t t s,@LIB_KFM@,$LIB_KFM,;t t s,@TOPSUBDIRS@,$TOPSUBDIRS,;t t 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_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # 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" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" EOF cat >>$CONFIG_STATUS <<\EOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } 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 $srcdir in .) ac_srcdir=. if test -z "$ac_dots"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_dots$srcdir$ac_dir_suffix ac_top_srcdir=$ac_dots$srcdir ;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_dots$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:10592: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated automatically by config.status. */ configure_input="Generated automatically from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:10610: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:10623: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done EOF cat >>$CONFIG_STATUS <<\EOF # # CONFIG_HEADER section. # # 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=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:10684: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:10695: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:10708: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in EOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # 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.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\EOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end EOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # 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.undefs <<\EOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, EOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # egrep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\EOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated automatically by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated automatically by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then { echo "$as_me:10825: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } fi rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Run the commands associated with the file. case $ac_file in config.h ) # update the timestamp echo timestamp >"./stamp-h1" ;; esac done EOF cat >>$CONFIG_STATUS <<\EOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` case $ac_dest in default-1 ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do case "$mf" in Makefile) dirpart=.;; */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; *) continue;; esac grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`echo "$file" | sed -e 's|/[^/]*$||'` $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done EOF cat >>$CONFIG_STATUS <<\EOF { (exit 0); exit 0; } EOF if test "x$with_fast_perl" = "xyes" ; then perl -i.bak $ac_aux_dir/conf.change.pl $CONFIG_STATUS || mv $CONFIG_STATUS.bak $CONFIG_STATUS; rm -f $CONFIG_STATUS.bak; fi chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: exec 5>/dev/null $SHELL $CONFIG_STATUS || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi c_cpp_reference-2.0.2/configure.in0000644000076400001440000000621307474405112012615 dnl This file is part of the KDE libraries/packages dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org) dnl This file is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Library General Public dnl License as published by the Free Software Foundation; either dnl version 2 of the License, or (at your option) any later version. dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Library General Public License for more details. dnl You should have received a copy of the GNU Library General Public License dnl along with this library; see the file COPYING.LIB. If not, write to dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, dnl Boston, MA 02111-1307, USA. # Original Author was Kalle@kde.org # I lifted it in some mater. (Stephan Kulow) # I used much code from Janos Farkas dnl Process this file with autoconf to produce a configure script. AC_INIT(acinclude.m4) dnl a source file from your sub dir dnl This is so we can use kde-common AC_CONFIG_AUX_DIR(admin) dnl This ksh/zsh feature conflicts with `cd blah ; pwd` unset CDPATH dnl Checking host/target/build systems, for make, install etc. AC_CANONICAL_SYSTEM dnl Perform program name transformation AC_ARG_PROGRAM dnl Automake doc recommends to do this only here. (Janos) AM_INIT_AUTOMAKE(c_cpp_reference, 2.0.2) dnl searches for some needed programs KDE_SET_PREFIX dnl generate the config header AM_CONFIG_HEADER(config.h) dnl at the distribution this done dnl Checks for programs. AC_CHECK_COMPILERS AC_ENABLE_SHARED(yes) AC_ENABLE_STATIC(no) KDE_PROG_LIBTOOL dnl for NLS support. Call them in this order! dnl WITH_NLS is for the po files AM_KDE_WITH_NLS AC_PATH_KDE #MIN_CONFIG dnl PACKAGE set before KDE_CREATE_SUBDIRSLIST AC_OUTPUT( \ ./Makefile \ reference/Makefile \ reference/C/Makefile \ reference/C/CONCEPT/Makefile \ reference/C/CONTRIB/Makefile \ reference/C/CONTRIB/OR_PRACTICAL_C/Makefile \ reference/C/CONTRIB/OR_USING_C/Makefile \ reference/C/CONTRIB/SAWTELL/Makefile \ reference/C/CONTRIB/SNIP/Makefile \ reference/C/CONTRIB/YABL/Makefile \ reference/C/EXAMPLES/Makefile \ reference/C/FUNCTIONS/Makefile \ reference/C/GDB/Makefile \ reference/C/LIBRARIES/Makefile \ reference/C/MAN/Makefile \ reference/C/MISC/Makefile \ reference/C/MISC/CLASSES/Makefile \ reference/C/PROBLEMS/Makefile \ reference/C/SYNTAX/Makefile \ reference/C/TECHNIC/Makefile \ reference/C/X_EXAMPLES/Makefile \ reference/C/backup/Makefile \ reference/CPLUSPLUS/Makefile \ reference/CPLUSPLUS/CONCEPT/Makefile \ reference/CPLUSPLUS/CONTRIB/Makefile \ reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/Makefile \ reference/CPLUSPLUS/EXAMPLES/Makefile \ reference/CPLUSPLUS/FUNCTIONS/Makefile \ reference/CPLUSPLUS/GDB/Makefile \ reference/CPLUSPLUS/LIBRARIES/Makefile \ reference/CPLUSPLUS/MISC/Makefile \ reference/CPLUSPLUS/PROBLEMS/Makefile \ reference/CPLUSPLUS/SYNTAX/Makefile \ reference/CPLUSPLUS/TECHNIC/Makefile \ reference/CPLUSPLUS/X_EXAMPLES/Makefile \ reference/GRAPHICS/Makefile \ ) c_cpp_reference-2.0.2/acinclude.m4.in0000644000076400001440000024246607244431672013123 ## -*- autoconf -*- dnl This file is part of the KDE libraries/packages dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org) dnl This file is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Library General Public dnl License as published by the Free Software Foundation; either dnl version 2 of the License, or (at your option) any later version. dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Library General Public License for more details. dnl You should have received a copy of the GNU Library General Public License dnl along with this library; see the file COPYING.LIB. If not, write to dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, dnl Boston, MA 02111-1307, USA. dnl IMPORTANT NOTE: dnl Please do not modify this file unless you expect your modifications to be dnl carried into every other module in the repository. If you decide that you dnl really want to modify it, contact coolo@kde.org mentioning that you have dnl and that the modified file should be committed to every module. dnl dnl Single-module modifications are best placed in configure.in for kdelibs dnl and kdebase or configure.in.in if present. dnl ------------------------------------------------------------------------ dnl Find a file (or one of more files in a list of dirs) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_FIND_FILE, [ $3=NO for i in $2; do for j in $1; do if test -r "$i/$j"; then $3=$i break 2 fi done done ]) dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, dnl if-not-found, test-parameter) AC_DEFUN(KDE_FIND_PATH, [ AC_MSG_CHECKING([for $1]) kde_cache=`echo $1 | sed 'y%./+-%__p_%'` AC_CACHE_VAL(kde_cv_path_$kde_cache, [ kde_cv_path="NONE" if test -n "$$2"; then kde_cv_path="$$2"; else dirs="$3" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/$1"; then if test -n "$5" then evalstr="$dir/$1 $5 2>&1 " if eval $evalstr; then kde_cv_path="$dir/$1" break fi else kde_cv_path="$dir/$1" break fi fi done fi eval "kde_cv_path_$kde_cache=$kde_cv_path" ]) eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then AC_MSG_RESULT(not found) $4 else AC_MSG_RESULT($kde_cv_path) $2=$kde_cv_path fi ]) AC_DEFUN(KDE_MOC_ERROR_MESSAGE, [ AC_MSG_ERROR([No Qt meta object compiler (moc) found! Please check whether you installed Qt correctly. You need to have a running moc binary. configure tried to run $ac_cv_path_moc and the test didn't succeed. If configure shouldn't have tried this one, set the environment variable MOC to the right one before running configure. ]) ]) dnl ------------------------------------------------------------------------ dnl Find the meta object compiler in the PATH, in $QTDIR/bin, and some dnl more usual places dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_PATH_QT_MOC, [ KDE_FIND_PATH(moc, MOC, [$ac_qt_bindir $QTDIR/bin $QTDIR/src/moc \ /usr/bin /usr/X11R6/bin /usr/lib/qt/bin /usr/lib/qt2/bin \ /usr/local/qt/bin], [KDE_MOC_ERROR_MESSAGE]) if test -z "$MOC"; then if test -n "$ac_cv_path_moc"; then output=`eval "$ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt"` fi echo "configure:__oline__: tried to call $ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt" >&AC_FD_CC echo "configure:__oline__: moc output: $output" >&AC_FD_CC if test -z "$output"; then KDE_MOC_ERROR_MESSAGE fi fi AC_SUBST(MOC) ]) AC_DEFUN(KDE_1_CHECK_PATHS, [ KDE_1_CHECK_PATH_HEADERS KDE_TEST_RPATH= if test -n "$USE_RPATH"; then if test -n "$kde_libraries"; then KDE_TEST_RPATH="-rpath $kde_libraries" fi if test -n "$qt_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $qt_libraries" fi if test -n "$x_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $x_libraries" fi KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" fi AC_MSG_CHECKING([for KDE libraries installed]) ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' if AC_TRY_EVAL(ac_link) && test -s conftest; then AC_MSG_RESULT(yes) else AC_MSG_ERROR([your system fails at linking a small KDE application! Check, if your compiler is installed correctly and if you have used the same compiler to compile Qt and kdelibs as you did use now]) fi if eval `KDEDIR= ./conftest 2>&5`; then kde_result=done else kde_result=problems fi KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log kde_have_all_paths=yes AC_LANG_CPLUSPLUS KDE_SET_PATHS($kde_result) ]) AC_DEFUN(KDE_SET_PATHS, [ kde_cv_all_paths="kde_have_all_paths=\"yes\" \ kde_htmldir=\"$kde_htmldir\" \ kde_appsdir=\"$kde_appsdir\" \ kde_icondir=\"$kde_icondir\" \ kde_sounddir=\"$kde_sounddir\" \ kde_datadir=\"$kde_datadir\" \ kde_locale=\"$kde_locale\" \ kde_cgidir=\"$kde_cgidir\" \ kde_confdir=\"$kde_confdir\" \ kde_mimedir=\"$kde_mimedir\" \ kde_toolbardir=\"$kde_toolbardir\" \ kde_wallpaperdir=\"$kde_wallpaperdir\" \ kde_bindir=\"$kde_bindir\" \ kde_servicesdir=\"$kde_servicesdir\" \ kde_servicetypesdir=\"$kde_servicetypesdir\" \ kde_result=$1" ]) AC_DEFUN(AC_CREATE_KFSSTND, [ AC_REQUIRE([AC_CHECK_RPATH]) AC_MSG_CHECKING([for KDE paths]) kde_result="" AC_CACHE_VAL(kde_cv_all_paths, [ if test "$1" = "default"; then if test -z "$kde_htmldir"; then kde_htmldir='\$(prefix)/share/doc/HTML' fi if test -z "$kde_appsdir"; then kde_appsdir='\$(prefix)/share/applnk' fi if test -z "$kde_icondir"; then kde_icondir='\$(prefix)/share/icons' fi if test -z "$kde_sounddir"; then kde_sounddir='\$(prefix)/share/sounds' fi if test -z "$kde_datadir"; then kde_datadir='\$(prefix)/share/apps' fi if test -z "$kde_locale"; then kde_locale='\$(prefix)/share/locale' fi if test -z "$kde_cgidir"; then kde_cgidir='\$(exec_prefix)/cgi-bin' fi if test -z "$kde_confdir"; then kde_confdir='\$(prefix)/share/config' fi if test -z "$kde_mimedir"; then kde_mimedir='\$(prefix)/share/mimelnk' fi if test -z "$kde_toolbardir"; then kde_toolbardir='\$(prefix)/share/toolbar' fi if test -z "$kde_wallpaperdir"; then kde_wallpaperdir='\$(prefix)/share/wallpapers' fi if test -z "$kde_bindir"; then kde_bindir='\$(exec_prefix)/bin' fi if test -z "$kde_servicesdir"; then kde_servicesdir='\$(prefix)/share/services' fi if test -z "$kde_servicetypesdir"; then kde_servicetypesdir='\$(prefix)/share/servicetypes' fi KDE_SET_PATHS(defaults) else if test $kde_qtver = 1; then AC_MSG_RESULT([compiling]) KDE_1_CHECK_PATHS else AC_MSG_ERROR([path checking not yet supported for KDE 2]) fi fi ]) eval "$kde_cv_all_paths" if test -z "$kde_htmldir" || test -z "$kde_appsdir" || test -z "$kde_icondir" || test -z "$kde_sounddir" || test -z "$kde_datadir" || test -z "$kde_locale" || test -z "$kde_cgidir" || test -z "$kde_confdir" || test -z "$kde_mimedir" || test -z "$kde_toolbardir" || test -z "$kde_wallpaperdir" || test -z "$kde_bindir" || test -z "$kde_servicesdir" || test -z "$kde_servicetypesdir" || test "$kde_have_all_paths" != "yes"; then kde_have_all_paths=no AC_MSG_ERROR([configure could not run a little KDE program to test the environment. Since it had compiled and linked before, it must be a strange problem on your system. Look at config.log for details. If you are not able to fix this, look at http://www.kde.org/faq/installation.html or any www.kde.org mirror. (If you're using an egcs version on Linux, you may update binutils!) ]) else rm -f conftest* AC_MSG_RESULT($kde_result) fi bindir=$kde_bindir ]) AC_DEFUN(AC_SUBST_KFSSTND, [ AC_SUBST(kde_htmldir) AC_SUBST(kde_appsdir) AC_SUBST(kde_icondir) AC_SUBST(kde_sounddir) AC_SUBST(kde_datadir) AC_SUBST(kde_locale) AC_SUBST(kde_cgidir) AC_SUBST(kde_confdir) AC_SUBST(kde_mimedir) AC_SUBST(kde_toolbardir) AC_SUBST(kde_wallpaperdir) AC_SUBST(kde_bindir) dnl for KDE 2 AC_SUBST(kde_servicesdir) AC_SUBST(kde_servicetypesdir) if test "$kde_qtver" = 1; then kde_minidir="$kde_icondir/mini" else # for KDE 1 - this breaks KDE2 apps using minidir, but # that's the plan ;-/ kde_minidir="/dev/null" fi AC_SUBST(kde_minidir) ]) AC_DEFUN(KDE_MISC_TESTS, [ AC_LANG_C dnl Checks for libraries. AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD AC_SUBST(LIBCOMPAT) kde_have_crypt= AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ AC_MSG_WARN([you have no crypt in either libcrypt or libc. You should install libcrypt from another source or configure with PAM support]) kde_have_crypt=no ])) AC_SUBST(LIBCRYPT) if test $kde_have_crypt = yes; then AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) fi AC_CHECK_KSIZE_T AC_LANG_C AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) if test $ac_cv_lib_dnet_dnet_ntoa = no; then AC_CHECK_LIB(dnet_stub, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) fi AC_CHECK_FUNC(inet_ntoa) if test $ac_cv_func_inet_ntoa = no; then AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") fi AC_CHECK_FUNC(connect) if test $ac_cv_func_connect = no; then AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , $X_EXTRA_LIBS) fi AC_CHECK_FUNC(remove) if test $ac_cv_func_remove = no; then AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. AC_CHECK_FUNC(shmat) if test $ac_cv_func_shmat = no; then AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc") fi LIBSOCKET="$X_EXTRA_LIBS" AC_SUBST(LIBSOCKET) AC_SUBST(X_EXTRA_LIBS) AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 AC_SUBST(LIBUCB) case $host in dnl this *is* LynxOS specific *-*-lynxos* ) AC_MSG_CHECKING([LynxOS header file wrappers]) [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] AC_MSG_RESULT(disabled) AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS ;; esac AC_REQUIRE([KDE_CHECK_LIBDL]) AC_CHECK_BOOL ]) dnl ------------------------------------------------------------------------ dnl Find the header files and libraries for X-Windows. Extended the dnl macro AC_PATH_X dnl ------------------------------------------------------------------------ dnl AC_DEFUN(K_PATH_X, [ AC_REQUIRE([AC_PROG_CPP]) AC_MSG_CHECKING(for X) AC_LANG_SAVE AC_LANG_C AC_CACHE_VAL(ac_cv_have_x, [# One or both of the vars are not set, and there is no cached value. if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then kde_x_includes=NO else kde_x_includes=$x_includes fi if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then kde_x_libraries=NO else kde_x_libraries=$x_libraries fi # below we use the standard autoconf calls ac_x_libraries=$kde_x_libraries ac_x_includes=$kde_x_includes AC_PATH_X_DIRECT AC_PATH_X_XMKMF if test -z "$ac_x_includes"; then ac_x_includes="." fi if test -z "$ac_x_libraries"; then ac_x_libraries="/usr/lib" fi #from now on we use our own again # when the user already gave --x-includes, we ignore # what the standard autoconf macros told us. if test "$kde_x_includes" = NO; then kde_x_includes=$ac_x_includes fi if test "$kde_x_includes" = NO; then AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) fi if test "$ac_x_libraries" = NO; then AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) fi # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ kde_x_includes=$kde_x_includes ac_x_libraries=$ac_x_libraries" ])dnl eval "$ac_cv_have_x" if test "$have_x" != yes; then AC_MSG_RESULT($have_x) no_x=yes else AC_MSG_RESULT([libraries $ac_x_libraries, headers $kde_x_includes]) fi if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then X_INCLUDES="" x_includes="."; dnl better than nothing :- else x_includes=$kde_x_includes X_INCLUDES="-I$x_includes" fi if test -z "$ac_x_libraries" || test "x$ac_x_libraries" = xNONE; then X_LDFLAGS="" x_libraries="/usr/lib"; dnl better than nothing :- else x_libraries=$ac_x_libraries X_LDFLAGS="-L$x_libraries" fi all_includes="$X_INCLUDES" all_libraries="$X_LDFLAGS" AC_SUBST(X_INCLUDES) AC_SUBST(X_LDFLAGS) AC_SUBST(x_libraries) AC_SUBST(x_includes) # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS="$LDFLAGS" test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. AC_CHECK_LIB(ICE, IceConnectionNumber, [LIBSM="$X_PRELIBS -lSM"], , $X_EXTRA_LIBS) AC_SUBST(LIBSM) LDFLAGS="$ac_save_LDFLAGS" AC_SUBST(X_PRE_LIBS) LIB_X11='-lX11 $(LIBSOCKET)' AC_SUBST(LIB_X11) AC_MSG_CHECKING(for libXext) AC_CACHE_VAL(kde_cv_have_libXext, [ kde_ldflags_safe="$LDFLAGS" kde_libs_safe="$LIBS" LDFLAGS="$X_LDFLAGS $USER_LDFLAGS" LIBS="-lXext -lX11 $LIBSOCKET" AC_TRY_LINK([ #include ], [ printf("hello Xext\n"); ], kde_cv_have_libXext=yes, kde_cv_have_libXext=no ) LDFLAGS=$kde_ldflags_safe LIBS=$kde_libs_safe ]) AC_MSG_RESULT($kde_cv_have_libXext) if test "kde_cv_have_libXext" = "no"; then AC_MSG_ERROR([We need a working libXext to proceed. Since configure can't find it itself, we stop here assuming that make wouldn't find them either.]) fi ]) AC_LANG_RESTORE ]) AC_DEFUN(KDE_PRINT_QT_PROGRAM, [ AC_REQUIRE([KDE_USE_QT]) cat > conftest.$ac_ext < #include #include #include EOF if test "$kde_qtver" = "2"; then cat >> conftest.$ac_ext < #include EOF if test $kde_qtsubver -gt 0; then cat >> conftest.$ac_ext < EOF fi fi echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext cat >> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <&AC_FD_CC cat conftest.$ac_ext >&AC_FD_CC fi rm -f conftest* CXXFLAGS="$ac_cxxflags_safe" LDFLAGS="$ac_ldflags_safe" LIBS="$ac_libs_safe" LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" export LD_LIBRARY_PATH LIBRARY_PATH="$ac_LIBRARY_PATH" export LIBRARY_PATH AC_LANG_RESTORE ]) if test "$kde_cv_qt_direct" = "yes"; then AC_MSG_RESULT(yes) $1 else AC_MSG_RESULT(no) $2 fi ]) dnl ------------------------------------------------------------------------ dnl Try to find the Qt headers and libraries. dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_PATH_QT_1_3, [ AC_REQUIRE([K_PATH_X]) AC_REQUIRE([KDE_USE_QT]) LIBQT="-lqt" if test $kde_qtver = 2; then AC_REQUIRE([AC_FIND_PNG]) LIBQT="$LIBQT $LIBPNG" fi AC_MSG_CHECKING([for Qt]) LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSOCKET" ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO qt_libraries="" qt_includes="" AC_ARG_WITH(qt-dir, [ --with-qt-dir=DIR where the root of Qt is installed ], [ ac_qt_includes="$withval"/include ac_qt_libraries="$withval"/lib ac_qt_bindir="$withval"/bin ]) AC_ARG_WITH(qt-includes, [ --with-qt-includes=DIR where the Qt includes are. ], [ ac_qt_includes="$withval" ]) kde_qt_libs_given=no AC_ARG_WITH(qt-libraries, [ --with-qt-libraries=DIR where the Qt library is installed.], [ ac_qt_libraries="$withval" kde_qt_libs_given=yes ]) AC_CACHE_VAL(ac_cv_have_qt, [#try to guess Qt locations qt_incdirs="$QTINC /usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/lib/qt2/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt $x_includes" test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs" qt_incdirs="$ac_qt_includes $qt_incdirs" if test "$kde_qtver" = "2"; then kde_qt_header=qstyle.h else kde_qt_header=qglobal.h fi AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) ac_qt_includes="$qt_incdir" qt_libdirs="$QTLIB /usr/lib/qt/lib /usr/X11R6/lib /usr/lib /usr/local/qt/lib /usr/lib/qt /usr/lib/qt2/lib $x_libraries" test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs" if test ! "$ac_qt_libraries" = "NO"; then qt_libdirs="$ac_qt_libraries $qt_libdirs" fi test=NONE qt_libdir=NONE for dir in $qt_libdirs; do try="ls -1 $dir/libqt.*" if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi done ac_qt_libraries="$qt_libdir" AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_cxxflags_safe="$CXXFLAGS" ac_ldflags_safe="$LDFLAGS" ac_libs_safe="$LIBS" CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" LDFLAGS="-L$qt_libdir $all_libraries $USER_LDFLAGS" LIBS="$LIBS $LIBQT" KDE_PRINT_QT_PROGRAM if AC_TRY_EVAL(ac_link) && test -s conftest; then rm -f conftest* else echo "configure: failed program was:" >&AC_FD_CC cat conftest.$ac_ext >&AC_FD_CC ac_qt_libraries="NO" fi rm -f conftest* CXXFLAGS="$ac_cxxflags_safe" LDFLAGS="$ac_ldflags_safe" LIBS="$ac_libs_safe" AC_LANG_RESTORE if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then ac_cv_have_qt="have_qt=no" ac_qt_notfound="" if test "$ac_qt_includes" = NO; then if test "$ac_qt_libraries" = NO; then ac_qt_notfound="(headers and libraries)"; else ac_qt_notfound="(headers)"; fi else ac_qt_notfound="(libraries)"; fi AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! ]); else have_qt="yes" fi ]) eval "$ac_cv_have_qt" if test "$have_qt" != yes; then AC_MSG_RESULT([$have_qt]); else ac_cv_have_qt="have_qt=yes \ ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes]) qt_libraries="$ac_qt_libraries" qt_includes="$ac_qt_includes" fi if test ! "$kde_qt_libs_given" = "yes"; then KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) fi AC_SUBST(qt_libraries) AC_SUBST(qt_includes) if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then QT_INCLUDES=""; else QT_INCLUDES="-I$qt_includes" all_includes="$QT_INCLUDES $all_includes" fi if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then QT_LDFLAGS="" else QT_LDFLAGS="-L$qt_libraries" all_libraries="$all_libraries $QT_LDFLAGS" fi AC_SUBST(QT_INCLUDES) AC_SUBST(QT_LDFLAGS) AC_PATH_QT_MOC LIB_QT='-lqt $(LIBPNG) -lXext $(LIB_X11) $(X_PRE_LIBS)' AC_SUBST(LIB_QT) ]) AC_DEFUN(AC_PATH_QT, [ AC_PATH_QT_1_3 ]) AC_DEFUN(KDE_CHECK_FINAL, [ AC_ARG_ENABLE(final, [ --enable-final build size optimized apps (needs lots of memory)], kde_use_final=$enableval, kde_use_final=no) if test "x$kde_use_final" = "xyes"; then KDE_USE_FINAL_TRUE="" KDE_USE_FINAL_FALSE="#" KDE_CHECK_REPO else KDE_USE_FINAL_TRUE="#" KDE_USE_FINAL_FALSE="" fi AC_SUBST(KDE_USE_FINAL_TRUE) AC_SUBST(KDE_USE_FINAL_FALSE) AC_ARG_ENABLE(closure, [ --disable-closure do not compile link tests], kde_use_closure=$enableval, kde_use_closure=yes) if test "x$kde_use_closure" = "xyes"; then KDE_USE_CLOSURE_TRUE="" KDE_USE_CLOSURE_FALSE="#" KDE_COMPILER_REPO # CXXFLAGS="$CXXFLAGS $REPO" else KDE_USE_CLOSURE_TRUE="#" KDE_USE_CLOSURE_FALSE="" fi AC_SUBST(KDE_USE_CLOSURE_TRUE) AC_SUBST(KDE_USE_CLOSURE_FALSE) ]) dnl ------------------------------------------------------------------------ dnl Now, the same with KDE dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) dnl and $(kde_includes) will be the kdehdrlocation (if needed) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_BASE_PATH_KDE, [ AC_PREREQ([2.13]) AC_REQUIRE([KDE_MISC_TESTS]) AC_REQUIRE([AC_PATH_QT])dnl AC_CHECK_RPATH AC_MSG_CHECKING([for KDE]) if test "${prefix}" != NONE; then kde_includes=${prefix}/include ac_kde_includes=$prefix/include if test "${exec_prefix}" != NONE; then kde_libraries=${exec_prefix}/lib ac_kde_libraries=$exec_prefix/lib else kde_libraries=${prefix}/lib ac_kde_libraries=$prefix/lib fi else ac_kde_includes= ac_kde_libraries= kde_libraries="" kde_includes="" fi AC_CACHE_VAL(ac_cv_have_kde, [#try to guess kde locations if test -z "$1"; then kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/kde/include /usr/include/kde /usr/include /opt/kde/include $x_includes $qt_includes" test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR $kde_incdirs" kde_incdirs="$ac_kde_includes $kde_incdirs" AC_FIND_FILE(ksock.h, $kde_incdirs, kde_incdir) ac_kde_includes="$kde_incdir" if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/ksock.h"; then AC_MSG_ERROR([ in the prefix, you've chosen, are no KDE headers installed. This will fail. So, check this please and use another prefix!]) fi kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /opt/kde/lib /usr/X11R6/kde/lib" test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs" kde_libdirs="$ac_kde_libraries $kde_libdirs" AC_FIND_FILE(libkdecore.la, $kde_libdirs, kde_libdir) ac_kde_libraries="$kde_libdir" if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/libkdecore.la"; then AC_MSG_ERROR([ in the prefix, you've chosen, are no KDE libraries installed. This will fail. So, check this please and use another prefix!]) fi ac_kde_libraries="$kde_libdir" if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then ac_cv_have_kde="have_kde=no" else ac_cv_have_kde="have_kde=yes \ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" fi else dnl test -z $1 ac_cv_have_kde="have_kde=no" fi ])dnl eval "$ac_cv_have_kde" if test "$have_kde" != "yes"; then if test "${prefix}" = NONE; then ac_kde_prefix="$ac_default_prefix" else ac_kde_prefix="$prefix" fi if test "$exec_prefix" = NONE; then ac_kde_exec_prefix="$ac_kde_prefix" AC_MSG_RESULT([will be installed in $ac_kde_prefix]) else ac_kde_exec_prefix="$exec_prefix" AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) fi kde_libraries="${ac_kde_exec_prefix}/lib" kde_includes=${ac_kde_prefix}/include else ac_cv_have_kde="have_kde=yes \ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) kde_libraries="$ac_kde_libraries" kde_includes="$ac_kde_includes" fi AC_SUBST(kde_libraries) AC_SUBST(kde_includes) if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then KDE_INCLUDES="" else KDE_INCLUDES="-I$kde_includes" all_includes="$KDE_INCLUDES $all_includes" fi if test "$kde_libraries" = "$x_libraries" || test "$kde_libraries" = "$qt_libraries" ; then KDE_LDFLAGS="" else KDE_LDFLAGS="-L$kde_libraries" all_libraries="$all_libraries $KDE_LDFLAGS" fi AC_SUBST(KDE_LDFLAGS) AC_SUBST(KDE_INCLUDES) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) all_libraries="$all_libraries $USER_LDFLAGS" all_includes="$all_includes $USER_INCLUDES" AC_SUBST(all_includes) AC_SUBST(all_libraries) AC_SUBST(AUTODIRS) if test -z "$DCOPIDL"; then DCOPIDL='$(kde_bindir)/dcopidl' fi if test -z "$DCOPIDL2CPP"; then DCOPIDL2CPP='$(kde_bindir)/dcopidl2cpp' fi DCOP_DEPENDENCIES='$(DCOPIDL)' AC_SUBST(DCOPIDL) AC_SUBST(DCOPIDL2CPP) AC_SUBST(DCOP_DEPENDENCIES) ]) AC_DEFUN(KDE_CHECK_EXTRA_LIBS, [ AC_MSG_CHECKING(for extra includes) AC_ARG_WITH(extra-includes, [ --with-extra-includes=DIR adds non standard include paths], kde_use_extra_includes="$withval", kde_use_extra_includes=NONE ) kde_extra_includes= if test -n "$kde_use_extra_includes" && \ test "$kde_use_extra_includes" != "NONE"; then ac_save_ifs=$IFS IFS=':' for dir in $kde_use_extra_includes; do kde_extra_includes="$kde_extra_includes $dir" USER_INCLUDES="$USER_INCLUDES -I$dir" done IFS=$ac_save_ifs kde_use_extra_includes="added" else kde_use_extra_includes="no" fi AC_SUBST(USER_INCLUDES) AC_MSG_RESULT($kde_use_extra_includes) kde_extra_libs= AC_MSG_CHECKING(for extra libs) AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR adds non standard library paths], kde_use_extra_libs=$withval, kde_use_extra_libs=NONE ) if test -n "$kde_use_extra_libs" && \ test "$kde_use_extra_libs" != "NONE"; then ac_save_ifs=$IFS IFS=':' for dir in $kde_use_extra_libs; do kde_extra_libs="$kde_extra_libs $dir" KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -rpath $dir" USER_LDFLAGS="$USER_LDFLAGS -L$dir" done IFS=$ac_save_ifs kde_use_extra_libs="added" else kde_use_extra_libs="no" fi AC_SUBST(USER_LDFLAGS) AC_MSG_RESULT($kde_use_extra_libs) ]) AC_DEFUN(KDE_1_CHECK_PATH_HEADERS, [ AC_MSG_CHECKING([for KDE headers installed]) AC_LANG_CPLUSPLUS cat > conftest.$ac_ext < #include "confdefs.h" #include int main() { printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); printf("kde_wallpaperdir=\\"%s\\"\n", KApplication::kde_wallpaperdir().data()); printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); return 0; } EOF ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext' if AC_TRY_EVAL(ac_compile); then AC_MSG_RESULT(yes) else AC_MSG_ERROR([your system is not able to compile a small KDE application! Check, if you installed the KDE header files correctly.]) fi ]) AC_DEFUN(KDE_CHECK_KIMGIO, [ AC_REQUIRE([AC_BASE_PATH_KDE]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_REQUIRE([AC_FIND_TIFF]) AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([AC_FIND_PNG]) AC_REQUIRE([KDE_CREATE_LIBS_ALIASES]) if test "$1" = "existance"; then AC_LANG_SAVE AC_LANG_CPLUSPLUS kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm" AC_CHECK_LIB(kimgio, kimgioRegister, [ LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no) LIBS="$kde_save_LIBS" AC_LANG_RESTORE else LIBKIMGIO_EXISTS=yes fi if test "$LIBKIMGIO_EXISTS" = "yes"; then LIB_KIMGIO='-lkimgio' else LIB_KIMGIO='' fi AC_SUBST(LIB_KIMGIO) ]) AC_DEFUN(KDE_CREATE_LIBS_ALIASES, [ AC_REQUIRE([KDE_MISC_TESTS]) AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([K_PATH_X]) if test $kde_qtver = 2; then LIB_KDECORE='-lkdecore' AC_SUBST(LIB_KDECORE) LIB_KDEUI='-lkdeui' AC_SUBST(LIB_KDEUI) LIB_KFORMULA='-lkformula' AC_SUBST(LIB_KFORMULA) LIB_KIO='-lkio' AC_SUBST(LIB_KIO) LIB_KSYCOCA='-lksycoca' AC_SUBST(LIB_KSYCOCA) LIB_SMB='-lsmb' AC_SUBST(LIB_SMB) LIB_KFILE='-lkfile' AC_SUBST(LIB_KFILE) LIB_KAB='-lkab' AC_SUBST(LIB_KAB) LIB_MEDIATOOL='-lmediatool' AC_SUBST(LIB_MEDIATOOL) LIB_KHTML='-lkhtml' AC_SUBST(LIB_KHTML) LIB_KSPELL='-lkspell' AC_SUBST(LIB_KSPELL) LIB_KPARTS='-lkparts' AC_SUBST(LIB_KPARTS) else LIB_KDECORE='-lkdecore -lXext $(LIB_QT)' AC_SUBST(LIB_KDECORE) LIB_KDEUI='-lkdeui $(LIB_KDECORE)' AC_SUBST(LIB_KDEUI) LIB_KFM='-lkfm $(LIB_KDECORE)' AC_SUBST(LIB_KFM) LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)' AC_SUBST(LIB_KFILE) LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)' AC_SUBST(LIB_KAB) LIB_MEDIATOOL='-lmediatool $(LIB_KDECORE)' AC_SUBST(LIB_MEDIATOOL) fi ]) AC_DEFUN(AC_PATH_KDE, [ AC_BASE_PATH_KDE AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install], [ if test "$enableval" = "no"; then ac_use_path_checking="default" else ac_use_path_checking="" fi ], [ if test "$kde_qtver" = 1; then ac_use_path_checking="" else ac_use_path_checking="default" fi ] ) AC_CREATE_KFSSTND($ac_use_path_checking) AC_SUBST_KFSSTND KDE_CREATE_LIBS_ALIASES ]) dnl slightly changed version of AC_CHECK_FUNC(setenv) AC_DEFUN(AC_CHECK_SETENV, [AC_MSG_CHECKING([for setenv]) AC_CACHE_VAL(ac_cv_func_setenv, [AC_LANG_C AC_TRY_LINK( dnl Don't include because on OSF/1 3.0 it includes dnl which includes which contains a prototype for dnl select. Similarly for bzero. [#include ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus extern "C" #endif ])dnl [/* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ #include ], [ /* 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_$1) || defined (__stub___$1) choke me #else setenv("TEST", "alle", 1); #endif ], eval "ac_cv_func_setenv=yes", eval "ac_cv_func_setenv=no")]) if test "$ac_cv_func_setenv" = "yes"; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_FUNC_SETENV, 1, [Define if you have setenv]) else AC_MSG_RESULT(no) fi ]) AC_DEFUN(AC_CHECK_GETDOMAINNAME, [ AC_LANG_CPLUSPLUS save_CXXFLAGS="$CXXFLAGS" if test "$GCC" = "yes"; then CXXFLAGS="$CXXFLAGS -pedantic-errors" fi AC_MSG_CHECKING(for getdomainname) AC_CACHE_VAL(ac_cv_func_getdomainname, [ AC_TRY_COMPILE([ #include #include ], [ char buffer[200]; getdomainname(buffer, 200); ], ac_cv_func_getdomainname=yes, ac_cv_func_getdomainname=no) ]) AC_MSG_RESULT($ac_cv_func_getdomainname) if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname]) fi CXXFLAGS="$save_CXXFLAGS" ]) AC_DEFUN(AC_CHECK_GETHOSTNAME, [ AC_LANG_CPLUSPLUS save_CXXFLAGS="$CXXFLAGS" if test "$GCC" = "yes"; then CXXFLAGS="$CXXFLAGS -pedantic-errors" fi AC_MSG_CHECKING([for gethostname]) AC_CACHE_VAL(ac_cv_func_gethostname, [ AC_TRY_COMPILE([ #include #include ], [ char buffer[200]; gethostname(buffer, 200); ], ac_cv_func_gethostname=yes, ac_cv_func_gethostname=no) ]) AC_MSG_RESULT($ac_cv_func_gethostname) if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have getdomainname]) fi CXXFLAGS="$save_CXXFLAGS" ]) AC_DEFUN(AC_CHECK_USLEEP, [ AC_LANG_CPLUSPLUS AC_MSG_CHECKING([for usleep]) AC_CACHE_VAL(ac_cv_func_usleep, [ ac_libs_safe="$LIBS" LIBS="$LIBS $LIBUCB" AC_TRY_LINK([ #include #include ], [ usleep(200); ], ac_cv_func_usleep=yes, ac_cv_func_usleep=no) ]) AC_MSG_RESULT($ac_cv_func_usleep) if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function]) fi LIBS="$ac_libs_safe" ]) AC_DEFUN(AC_CHECK_RANDOM, [ AC_LANG_CPLUSPLUS AC_MSG_CHECKING([for random]) AC_CACHE_VAL(ac_cv_func_random, [ ac_libs_safe="$LIBS" LIBS="$LIBS $LIBUCB" AC_TRY_LINK([ #include ], [ random(); ], ac_cv_func_random=yes, ac_cv_func_random=no) ]) AC_MSG_RESULT($ac_cv_func_random) if eval "test \"`echo $ac_cv_func_random`\" = yes"; then AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random]) fi LIBS="$ac_libs_safe" ]) AC_DEFUN(AC_FIND_GIF, [AC_MSG_CHECKING([for giflib]) AC_CACHE_VAL(ac_cv_lib_gif, [ac_save_LIBS="$LIBS" LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" AC_TRY_LINK(dnl [ #ifdef __cplusplus extern "C" { #endif int GifLastError(void); #ifdef __cplusplus } #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ], [return GifLastError();], eval "ac_cv_lib_gif=yes", eval "ac_cv_lib_gif=no") LIBS="$ac_save_LIBS" ])dnl if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) else AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) fi ]) AC_DEFUN(KDE_FIND_JPEG_HELPER, [ AC_MSG_CHECKING([for libjpeg$2]) AC_CACHE_VAL(ac_cv_lib_jpeg_$1, [ AC_LANG_C ac_save_LIBS="$LIBS" LIBS="$all_libraries -ljpeg$2 -lm" AC_TRY_LINK( [/* Override any gcc2 internal prototype to avoid an error. */ struct jpeg_decompress_struct; typedef struct jpeg_decompress_struct * j_decompress_ptr; typedef int size_t; #ifdef __cplusplus extern "C" { #endif void jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, size_t structsize); #ifdef __cplusplus } #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ], [jpeg_CreateDecompress(0L, 0, 0);], eval "ac_cv_lib_jpeg_$1=-ljpeg$2", eval "ac_cv_lib_jpeg_$1=no") LIBS="$ac_save_LIBS" ]) if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then LIBJPEG="$ac_cv_lib_jpeg_$1" AC_MSG_RESULT($ac_cv_lib_jpeg_$1) else AC_MSG_RESULT(no) $3 fi ]) AC_DEFUN(AC_FIND_JPEG, [ KDE_FIND_JPEG_HELPER(6b, 6b, KDE_FIND_JPEG_HELPER(normal, [], [ dnl what to do, if the normal way fails: if test -f "$kde_libraries/libjpeg.so"; then test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so ac_cv_lib_jpeg="-L\${topdir} -ljpegkde" else if test -f "$kde_libraries/libjpeg.sl"; then test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl ac_cv_lib_jpeg="-L\${topdir} -ljpegkde" else if test -f "$kde_libraries/libjpeg.a"; then test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a ac_cv_lib_jpeg="-L\${topdir} -ljpegkde" else AC_MSG_ERROR([ You need the development package of libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ ]) fi fi fi LIBJPEG=$ac_cv_lib_jpeg ])) AC_SUBST(LIBJPEG) AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) ]) AC_DEFUN(AC_FIND_ZLIB, [ AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_MSG_CHECKING([for libz]) AC_CACHE_VAL(ac_cv_lib_z, [ AC_LANG_C kde_save_LIBS="$LIBS" LIBS="$all_libraries -lz $LIBSOCKET" kde_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes" AC_TRY_LINK(dnl [ #include ], [return (zlibVersion() == ZLIB_VERSION); ], eval "ac_cv_lib_z='-lz'", eval "ac_cv_lib_z=no") LIBS="$kde_save_LIBS" CFLAGS="$kde_save_CFLAGS" ])dnl if eval "test ! \"`echo $ac_cv_lib_z`\" = no"; then AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) LIBZ="$ac_cv_lib_z" AC_SUBST(LIBZ) AC_MSG_RESULT($ac_cv_lib_z) else AC_MSG_RESULT(no) LIBZ="" AC_SUBST(LIBZ) fi ]) AC_DEFUN(KDE_TRY_TIFFLIB, [ AC_MSG_CHECKING([for libtiff $1]) AC_CACHE_VAL(kde_cv_libtiff_$1, [ AC_LANG_CPLUSPLUS kde_save_LIBS="$LIBS" LIBS="$all_libraries -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" kde_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $all_includes" AC_TRY_LINK(dnl [ #include ], [return (TIFFOpen( "", "r") == 0); ], [ kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" ], [ kde_cv_libtiff_$1=no ]) LIBS="$kde_save_LIBS" CXXFLAGS="$kde_save_CXXFLAGS" ]) if test "$kde_cv_libtiff_$1" = "no"; then AC_MSG_RESULT(no) LIBTIFF="" $3 else LIBTIFF="$kde_cv_libtiff_$1" AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) $2 fi ]) AC_DEFUN(AC_FIND_TIFF, [ AC_REQUIRE([K_PATH_X]) AC_REQUIRE([AC_FIND_ZLIB]) AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) KDE_TRY_TIFFLIB(tiff, [], KDE_TRY_TIFFLIB(tiff34)) AC_SUBST(LIBTIFF) ]) AC_DEFUN(AC_FIND_PNG, [ AC_REQUIRE([AC_FIND_ZLIB]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_MSG_CHECKING([for libpng]) AC_CACHE_VAL(ac_cv_lib_png, [ kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" kde_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" AC_LANG_C AC_TRY_LINK(dnl [ #include ], [ png_structp png_ptr = png_create_read_struct( /* image ptr */ PNG_LIBPNG_VER_STRING, 0, 0, 0 ); return( png_ptr != 0 ); ], eval "ac_cv_lib_png='-lpng $LIBZ -lm'", eval "ac_cv_lib_png=no" ) LIBS="$kde_save_LIBS" CFLAGS="$kde_save_CFLAGS" ])dnl if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) LIBPNG="$ac_cv_lib_png" AC_SUBST(LIBPNG) AC_MSG_RESULT($ac_cv_lib_png) else AC_MSG_RESULT(no) LIBPNG="" AC_SUBST(LIBPNG) fi ]) AC_DEFUN(AC_CHECK_BOOL, [ AC_MSG_CHECKING([for bool]) AC_CACHE_VAL(ac_cv_have_bool, [ AC_LANG_CPLUSPLUS AC_TRY_COMPILE([], [bool aBool = true;], [ac_cv_have_bool="yes"], [ac_cv_have_bool="no"]) ]) dnl end AC_CHECK_VAL AC_MSG_RESULT($ac_cv_have_bool) if test "$ac_cv_have_bool" = "yes"; then AC_DEFINE(HAVE_BOOL, 1, [Define if the C++ compiler supports BOOL]) fi ]) AC_DEFUN(AC_CHECK_GNU_EXTENSIONS, [ AC_MSG_CHECKING(if you need GNU extensions) AC_CACHE_VAL(ac_cv_gnu_extensions, [ cat > conftest.c << EOF #include #ifdef __GNU_LIBRARY__ yes #endif EOF if (eval "$ac_cpp conftest.c") 2>&5 | egrep "yes" >/dev/null 2>&1; then rm -rf conftest* ac_cv_gnu_extensions=yes else ac_cv_gnu_extensions=no fi ]) AC_MSG_RESULT($ac_cv_gnu_extensions) if test "$ac_cv_gnu_extensions" = "yes"; then AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) fi ]) AC_DEFUN(KDE_CHECK_COMPILER_FLAG, [ AC_REQUIRE([AC_CHECK_COMPILERS]) AC_MSG_CHECKING(whether $CXX supports -$1) kde_cache=`echo $1 | sed 'y%.=/+-%___p_%'` AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, [ echo 'void f(){}' >conftest.cc if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" else eval "kde_cv_prog_cxx_$kde_cache=no" fi rm -f conftest* ]) if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then AC_MSG_RESULT(yes) : $2 else AC_MSG_RESULT(no) : $3 fi ]) AC_DEFUN(AC_CHECK_COMPILERS, [ dnl this is somehow a fat lie, but prevents other macros from double checking AC_PROVIDE([AC_PROG_CC]) AC_PROVIDE([AC_PROG_CPP]) AC_ARG_ENABLE(debug,[ --enable-debug creates debugging code [default=no]], [ if test $enableval = "no"; dnl then kde_use_debug_code="no" kde_use_debug_define=yes else kde_use_debug_code="yes" kde_use_debug_define=no fi ], [kde_use_debug_code="no" kde_use_debug_define=no ]) AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)], [ if test $enableval = "no"; then kde_use_strict_options="no" else kde_use_strict_options="yes" fi ], [kde_use_strict_options="no"]) dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it AC_MSG_CHECKING(for a C-Compiler) dnl if there is one, print out. if not, don't matter AC_MSG_RESULT($CC) if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) AC_PROG_CC_WORKS AC_PROG_CC_GNU if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi if test -z "$CFLAGS"; then if test "$kde_use_debug_code" = "yes"; then AC_PROG_CC_G if test $ac_cv_prog_cc_g = yes; then CFLAGS="-g" fi else if test "$GCC" = "yes"; then CFLAGS="-O2" else CFLAGS="" fi if test "$kde_use_debug_define" = "yes"; then CFLAGS="$CFLAGS -DNDEBUG" fi fi if test "$GCC" = "yes"; then CFLAGS="$CFLAGS" if test "$kde_use_strict_options" = "yes"; then CFLAGS="$CFLAGS -W -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings" fi fi fi case "$host" in *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";; esac if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then LDFLAGS="-s" fi dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?) AC_MSG_CHECKING(how to run the C preprocessor) # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then AC_CACHE_VAL(ac_cv_prog_CPP, [ # 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. dnl Use a header file that comes with gcc, so configuring glibc dnl with a fresh cross-compiler works. AC_TRY_CPP([#include Syntax Error], , CPP="${CC-cc} -E -traditional-cpp" AC_TRY_CPP([#include Syntax Error], , CPP=/lib/cpp)) ac_cv_prog_CPP="$CPP"])dnl CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi AC_MSG_RESULT($CPP) AC_SUBST(CPP)dnl AC_MSG_CHECKING(for a C++-Compiler) dnl if there is one, print out. if not, don't matter AC_MSG_RESULT($CXX) if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH]) AC_PROG_CXX_WORKS AC_PROG_CXX_GNU if test $ac_cv_prog_gxx = yes; then GXX=yes fi if test -z "$CXXFLAGS"; then if test "$kde_use_debug_code" = "yes"; then AC_PROG_CXX_G if test $ac_cv_prog_cxx_g = yes; then CXXFLAGS="-g" fi else if test "$GXX" = "yes"; then CXXFLAGS="-O2" fi if test "$kde_use_debug_define" = "yes"; then CXXFLAGS="$CXXFLAGS -DNDEBUG" fi fi KDE_CHECK_COMPILER_FLAG(fno-exceptions, [ CXXFLAGS="$CXXFLAGS -fno-exceptions" ]) KDE_CHECK_COMPILER_FLAG(fno-rtti, [ CXXFLAGS="$CXXFLAGS -fno-rtti" ]) KDE_CHECK_COMPILER_FLAG(fno-check-new, [ CXXFLAGS="$CXXFLAGS -fno-check-new" ]) if test "$GXX" = "yes"; then CXXFLAGS="$CXXFLAGS" if test "$kde_use_debug_code" = "yes"; then CXXFLAGS="$CXXFLAGS -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings" KDE_CHECK_COMPILER_FLAG(Wno-long-long, [ CXXFLAGS="$CXXFLAGS -Wno-long-long" ]) KDE_CHECK_COMPILER_FLAG(fno-builtin, [ CXXFLAGS="$CXXFLAGS -fno-builtin" ]) fi if test "$kde_use_strict_options" = "yes"; then CXXFLAGS="$CXXFLAGS -Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align -Woverloaded-virtual" fi if test "$kde_very_strict" = "yes"; then CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wredundant-decls -Wconversion" fi fi fi KDE_CHECK_COMPILER_FLAG(fexceptions, [ USE_EXCEPTIONS="-fexceptions" ], USE_EXCEPTIONS= ) AC_SUBST(USE_EXCEPTIONS) KDE_CHECK_COMPILER_FLAG(frtti, [ USE_RTTI="-frtti" ], USE_RTTI= ) AC_SUBST(USE_RTTI) case "$host" in *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";; esac AC_PROVIDE(AC_PROG_CXXCPP) AC_MSG_CHECKING(how to run the C++ preprocessor) if test -z "$CXXCPP"; then AC_CACHE_VAL(ac_cv_prog_CXXCPP, [ AC_LANG_SAVE[]dnl AC_LANG_CPLUSPLUS[]dnl CXXCPP="${CXX-g++} -E" AC_TRY_CPP([#include ], , CXXCPP=/lib/cpp) ac_cv_prog_CXXCPP="$CXXCPP" AC_LANG_RESTORE[]dnl ])dnl CXXCPP="$ac_cv_prog_CXXCPP" fi AC_MSG_RESULT($CXXCPP) AC_SUBST(CXXCPP)dnl # the following is to allow programs, that are known to # have problems when compiled with -O2 if test -n "$CXXFLAGS"; then kde_safe_IFS=$IFS IFS=" " NOOPT_CXXFLAGS="" for i in $CXXFLAGS; do if test ! "$i" = "-O2"; then NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i" fi done IFS=$kde_safe_IFS fi AC_SUBST(NOOPT_CXXFLAGS) KDE_CHECK_FINAL ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) KDE_CXXFLAGS= AC_SUBST(KDE_CXXFLAGS) ]) AC_DEFUN(KDE_ADD_DEPENDENCIES, [ [A]M_DEPENDENCIES(CC) [A]M_DEPENDENCIES(CXX) ]) dnl just a wrapper to clean up configure.in AC_DEFUN(KDE_PROG_LIBTOOL, [ AC_REQUIRE([AC_CHECK_COMPILERS]) AC_REQUIRE([AC_ENABLE_SHARED]) AC_REQUIRE([AC_ENABLE_STATIC]) if test -z "$LIBTOOL"; then dnl libtool is only for C, so I must force him dnl to find the correct flags for C++ kde_save_cc=$CC kde_save_cflags="$CFLAGS" CC=$CXX CFLAGS="$CXXFLAGS" AC_LANG_SAVE AC_LANG_C AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL # LIBTOOL="$LIBTOOL --silent" dnl AC_SUBST(LIBTOOL) AC_LANG_RESTORE CC=$kde_save_cc CFLAGS="$kde_save_cflags" LIBTOOL_SHELL='/bin/sh ./libtool' else LIBTOOL_SHELL=$LIBTOOL fi ]) AC_DEFUN(KDE_DO_IT_ALL, [ AC_CANONICAL_SYSTEM AC_ARG_PROGRAM AM_INIT_AUTOMAKE($1, $2) AM_DISABLE_LIBRARIES AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) AC_CHECK_COMPILERS KDE_PROG_LIBTOOL AM_KDE_WITH_NLS AC_PATH_KDE ]) AC_DEFUN(AC_CHECK_RPATH, [ AC_MSG_CHECKING(for rpath) AC_ARG_ENABLE(rpath, [ --disable-rpath do not use the rpath feature of ld], USE_RPATH=$enableval, USE_RPATH=yes) if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then KDE_RPATH="-rpath \$(kde_libraries)" if test -n "$qt_libraries"; then KDE_RPATH="$KDE_RPATH -rpath \$(qt_libraries)" fi dnl $x_libraries is set to /usr/lib in case if test -n "$X_LDFLAGS"; then KDE_RPATH="$KDE_RPATH -rpath \$(x_libraries)" fi if test -n "$KDE_EXTRA_RPATH"; then KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" fi fi AC_SUBST(KDE_EXTRA_RPATH) AC_SUBST(KDE_RPATH) AC_MSG_RESULT($USE_RPATH) ]) dnl Check for the type of the third argument of getsockname AC_DEFUN(AC_CHECK_KSIZE_T, [AC_MSG_CHECKING(for the third argument of getsockname) AC_CACHE_VAL(ac_cv_ksize_t, AC_LANG_SAVE AC_LANG_CPLUSPLUS [AC_TRY_COMPILE([ #include #include ],[ socklen_t a=0; getsockname(0,(struct sockaddr*)0, &a); ], ac_cv_ksize_t=socklen_t, ac_cv_ksize_t=) if test -z "$ac_cv_ksize_t"; then ac_safe_cxxflags="$CXXFLAGS" if test "$GCC" = "yes"; then CXXFLAGS="-Werror $CXXFLAGS" fi AC_TRY_COMPILE([ #include #include ],[ int a=0; getsockname(0,(struct sockaddr*)0, &a); ], ac_cv_ksize_t=int, ac_cv_ksize_t=size_t) CXXFLAGS="$ac_safe_cxxflags" fi AC_LANG_RESTORE ]) if test -z "$ac_cv_ksize_t"; then ac_cv_ksize_t=int fi AC_MSG_RESULT($ac_cv_ksize_t) AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t, [Define the type of the third argument for getsockname] ) ]) dnl This is a merge of some macros out of the gettext aclocal.m4 dnl since we don't need anything, I took the things we need dnl the copyright for them is: dnl > dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. dnl This Makefile.in is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. dnl > dnl for this file it is relicensed under LGPL AC_DEFUN(AM_KDE_WITH_NLS, [AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) AC_MSG_RESULT($USE_NLS) AC_SUBST(USE_NLS) dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then AC_DEFINE(ENABLE_NLS, 1, [Define if NLS is requested]) AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) GMSGFMT=":" fi MSGFMT=$GMSGFMT AC_SUBST(GMSGFMT) AC_SUBST(MSGFMT) AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) dnl Test whether we really found GNU xgettext. if test "$XGETTEXT" != ":"; then dnl If it is no GNU xgettext we define it as : so that the dnl Makefiles still can work. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else AC_MSG_RESULT( [found xgettext programs is not GNU xgettext; ignore it]) XGETTEXT=":" fi fi AC_SUBST(XGETTEXT) fi ]) # Search path for a program which passes the given test. # Ulrich Drepper , 1996. # serial 1 # Stephan Kulow: I appended a _KDE against name conflicts dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE, [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in /*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in ifelse([$5], , $PATH, [$5]); do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test -n "[$]$1"; then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) # Check whether LC_MESSAGES is available in . # Ulrich Drepper , 1995. # serial 1 AC_DEFUN(AM_LC_MESSAGES, [if test $ac_cv_header_locale_h = yes; then AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) if test $am_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES]) fi fi]) dnl From Jim Meyering. dnl FIXME: migrate into libit. AC_DEFUN(AM_FUNC_OBSTACK, [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, [AC_TRY_LINK([#include "obstack.h"], [struct obstack *mem;obstack_free(mem,(char *) 0)], am_cv_func_obstack=yes, am_cv_func_obstack=no)]) if test $am_cv_func_obstack = yes; then AC_DEFINE(HAVE_OBSTACK) else LIBOBJS="$LIBOBJS obstack.o" fi ]) dnl From Jim Meyering. Use this if you use the GNU error.[ch]. dnl FIXME: Migrate into libit AC_DEFUN(AM_FUNC_ERROR_AT_LINE, [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], am_cv_lib_error_at_line=yes, am_cv_lib_error_at_line=no)]) if test $am_cv_lib_error_at_line = no; then LIBOBJS="$LIBOBJS error.o" fi AC_SUBST(LIBOBJS)dnl ]) # Macro to add for using GNU gettext. # Ulrich Drepper , 1995. # serial 1 # Stephan Kulow: I put a KDE in it to avoid name conflicts AC_DEFUN(AM_KDE_GNU_GETTEXT, [AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_C_INLINE])dnl AC_REQUIRE([AC_TYPE_OFF_T])dnl AC_REQUIRE([AC_TYPE_SIZE_T])dnl AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl AC_REQUIRE([AM_KDE_WITH_NLS])dnl AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ unistd.h values.h alloca.h]) AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ __argz_count __argz_stringify __argz_next]) AC_MSG_CHECKING(for stpcpy) AC_CACHE_VAL(kde_cv_func_stpcpy, [ kde_safe_cxxflags=$CXXFLAGS CXXFLAGS="-Wmissing-prototypes -Werror" AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ #include ], [ char buffer[200]; stpcpy(buffer, buffer); ], kde_cv_func_stpcpy=yes, kde_cv_func_stpcpy=no) AC_LANG_RESTORE CXXFLAGS=$kde_safe_cxxflags ]) AC_MSG_RESULT($kde_cv_func_stpcpy) if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) fi AM_LC_MESSAGES if test "x$CATOBJEXT" != "x"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else AC_MSG_CHECKING(for catalogs to be installed) NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; esac done LINGUAS=$NEW_LINGUAS AC_MSG_RESULT($LINGUAS) fi dnl Construct list of names of catalog files to be constructed. if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi fi ]) AC_DEFUN(AC_HAVE_XPM, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= test -z "$XPM_INCLUDE" && XPM_INCLUDE= AC_ARG_WITH(xpm, [ --without-xpm disable color pixmap XPM tests], xpm_test=$withval, xpm_test="yes") if test "x$xpm_test" = xno; then ac_cv_have_xpm=no else AC_MSG_CHECKING(for XPM) AC_CACHE_VAL(ac_cv_have_xpm, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" LDFLAGS="$LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES" test ! -z "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" AC_TRY_LINK([#include ],[], ac_cv_have_xpm="yes",ac_cv_have_xpm="no") LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" ])dnl if test "$ac_cv_have_xpm" = no; then AC_MSG_RESULT(no) XPM_LDFLAGS="" XPMINC="" $2 else AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) if test "$XPM_LDFLAGS" = ""; then XPMLIB='-lXpm $(LIB_X11)' else XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' fi if test "$XPM_INCLUDE" = ""; then XPMINC="" else XPMINC="-I$XPM_INCLUDE" fi AC_MSG_RESULT(yes) $1 fi fi AC_SUBST(XPMINC) AC_SUBST(XPMLIB) ]) AC_DEFUN(AC_HAVE_DPMS, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= AC_ARG_WITH(dpms, [ --without-dpms disable DPMS power saving], dpms_test=$withval, dpms_test="yes") if test "x$dpms_test" = xno; then ac_cv_have_dpms=no else AC_MSG_CHECKING(for DPMS) AC_CACHE_VAL(ac_cv_have_dpms, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES" test ! -z "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" AC_TRY_LINK([#include ],[], ac_cv_have_dpms="yes",ac_cv_have_dpms="no") LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" ])dnl if test "$ac_cv_have_dpms" = no; then AC_MSG_RESULT(no) DPMS_LDFLAGS="" DPMSINC="" $2 else AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) if test "$DPMS_LDFLAGS" = ""; then DPMSLIB='-lXdpms $(LIB_X11)' else DPMSLIB="-L$DPMS_LDFLAGS -lXdpms "'$(LIB_X11)' fi if test "$DPMS_INCLUDE" = ""; then DPMSINC="" else DPMSINC="-I$DPMS_INCLUDE" fi AC_MSG_RESULT(yes) $1 fi fi AC_SUBST(DPMSINC) AC_SUBST(DPMSLIB) ]) AC_DEFUN(AC_HAVE_GL, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$GL_LDFLAGS" && GL_LDFLAGS= test -z "$GL_INCLUDE" && GL_INCLUDE= AC_ARG_WITH(gl, [ --without-gl disable 3D GL modes], gl_test=$withval, gl_test="yes") if test "x$gl_test" = xno; then ac_cv_have_gl=no else AC_MSG_CHECKING(for GL) AC_CACHE_VAL(ac_cv_have_gl, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES" test ! -z "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" AC_TRY_LINK([],[], ac_cv_have_gl="mesa", ac_cv_have_gl="no") if test "x$ac_cv_have_gl" = "xno"; then LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGL -lGLU -lX11 -lXext -lm $LIBSOCKET" CFLAGS="$ac_save_cflags $X_INCLUDES" test ! -z "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" AC_TRY_LINK([],[], ac_cv_have_gl="yes", ac_cv_have_gl="no") fi LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" ])dnl if test "$ac_cv_have_gl" = "no"; then AC_MSG_RESULT(no) GL_LDFLAGS="" GLINC="" $2 else AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) if test "$GL_LDFLAGS" = ""; then if test "$ac_cv_have_gl" = "mesa"; then GLLIB='-lMesaGL -lMesaGLU $(LIB_X11)' else GLLIB='-lGL -lGLU $(LIB_X11)' fi else if test "$ac_cv_have_gl" = "mesa"; then GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU "'$(LIB_X11)' else GLLIB="$GL_LDFLAGS -lGL -lGLU "'$(LIB_X11)' fi fi if test "$GL_INCLUDE" = ""; then GLINC="" else GLINC="-I$GL_INCLUDE" fi AC_MSG_RESULT($ac_cv_have_gl) $1 fi fi AC_SUBST(GLINC) AC_SUBST(GLLIB) ]) dnl PAM pam dnl Should test for PAM (Pluggable Authentication Modules) AC_DEFUN(AC_PATH_PAM_DIRECT, [ test -z "$pam_direct_test_library" && pam_direct_test_library=pam test -z "$pam_direct_test_include" && pam_direct_test_include=security/pam_appl.h for ac_dir in \ \ /usr/local/include \ /usr/include \ /usr/unsupported/include \ /opt/include \ /usr/pam/include \ /usr/local/pam/include \ /usr/lib/pam/include \ \ $extra_include \ ; \ do if test -r "$ac_dir/$pam_direct_test_include"; then no_pam= ac_pam_includes=$ac_dir break fi done # First see if replacing the include by lib works. for ac_dir in `echo "$ac_pam_includes" | sed s/include/lib/` \ \ /lib \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /lib/security \ /usr/security/lib \ $extra_lib \ ; \ do for ac_extension in a so sl; do if test -r $ac_dir/lib${pam_direct_test_library}.$ac_extension; then no_pam= ac_pam_libraries=$ac_dir break 2 fi done done ]) AC_DEFUN(AC_PATH_PAM, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE_CPP()dnl AC_CHECK_LIB(pam_misc, main, [PAM_MISC_LIB="-lpam_misc" AC_DEFINE_UNQUOTED(HAVE_PAM_MISC, 1, [Define if you have a PAM implementation with the pam_misc library])], [], [-lpam $LIBDL]) AC_MSG_CHECKING(for PAM) AC_ARG_WITH(pam, [ --with-pam[=ARG] enable support for PAM: ARG=[yes|no|service name]], [ if test "x$withval" = "xyes"; then no_pam= default_pam=yes elif test "x$withval" = "xno"; then no_pam=yes else no_pam= pam_service="$withval" if test -z "$pam_service"; then default_pam=yes else default_pam= fi fi ], no_pam=yes ) if test ! "$no_pam" = yes; then AC_CACHE_VAL(ac_cv_path_pam, [ ac_pam_includes=NONE ac_pam_libraries=NONE if test -z "$pam_libraries"; then pam_libraries=NONE fi if test -z "$pam_includes"; then pam_includes=NONE fi AC_PATH_PAM_DIRECT test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries if test ! "x$pam_includes" = xNONE && test ! "x$pam_libraries" = xNONE; then ac_pam_libs="-lpam $PAM_MISC_LIB $LIBDL" ac_cv_path_pam="no_pam= ac_pam_includes=$ac_pam_includes ac_pam_libraries=$ac_pam_libraries ac_pam_libs=\"$ac_pam_libs\"" else ac_cv_path_pam="no_pam=yes" fi ]) eval "$ac_cv_path_pam" fi if test "$no_pam" = yes; then AC_MSG_RESULT(no) else AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules); Redhat-Users!]) PAMLIBS="$ac_pam_libs" test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries AC_MSG_RESULT([libraries $pam_libraries, headers $pam_includes]) if test "$default_pam" = yes; then AC_MSG_RESULT(["default pam service name will be used"]) else AC_DEFINE_UNQUOTED(KDE_PAM_SERVICE,"$pam_service", [Define to change the default name of the PAM service used by KDE]) AC_MSG_RESULT(["pam service name will be: " $pam_service]) fi dnl test whether struct pam_message is const (Linux) or not (Sun) pam_appl_h="$ac_pam_includes/security/pam_appl.h" AC_MSG_CHECKING(for const pam_message) AC_EGREP_HEADER([struct pam_message], $pam_appl_h, [ AC_EGREP_HEADER([const struct pam_message], $pam_appl_h, [AC_MSG_RESULT(["const: Linux-type PAM"]) ], [AC_MSG_RESULT(["nonconst: Sun-type PAM"]) AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] )], [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])] ) fi if test "x$pam_libraries" != x && test "x$pam_libraries" != xNONE ; then PAMLIBPATHS="-L$pam_libraries" fi if test "x$pam_includes" != x && test "x$pam_includes" != xNONE ; then PAMINC="-I$pam_includes" fi AC_SUBST(PAMINC) AC_SUBST(PAMLIBS) AC_SUBST(PAMLIBPATHS) ]) AC_DEFUN(KDE_CHECK_LIBDL, [ AC_CHECK_LIB(dl, dlopen, [ LIBDL="-ldl" ac_cv_have_dlfcn=yes ]) AC_CHECK_LIB(dld, shl_unload, [ LIBDL="-ldld" ac_cv_have_shload=yes ]) AC_SUBST(LIBDL) ]) AC_DEFUN(KDE_CHECK_DLOPEN, [ KDE_CHECK_LIBDL AC_CHECK_HEADERS(dlfcn.h dl.h) if test "$ac_cv_header_dlfcn_h" = "no"; then ac_cv_have_dlfcn=no fi if test "$ac_cv_header_dl_h" = "no"; then ac_cv_have_shload=no fi enable_dlopen=no AC_ARG_ENABLE(dlopen, [ --disable-dlopen link staticly [default=no]] , [if test "$enableval" = yes; then enable_dlopen=yes fi], enable_dlopen=yes) # override the user's opinion, if we know it better ;) if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then enable_dlopen=no fi if test "$ac_cv_have_dlfcn" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) fi if test "$ac_cv_have_shload" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) fi if test "$enable_dlopen" = no ; then test -n "$1" && eval $1 else test -n "$2" && eval $2 fi ]) AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING, [ KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) KDE_PROG_LIBTOOL AC_MSG_CHECKING([dynamic loading]) eval "`egrep '^build_libtool_libs=' libtool`" if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then dynamic_loading=yes AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) else dynamic_loading=no fi AC_MSG_RESULT($dynamic_loading) if test "$dynamic_loading" = "yes"; then $1 else $2 fi ]) AC_DEFUN(KDE_ADD_INCLUDES, [ if test -z "$1"; then test_include="Pix.h" else test_include="$1" fi AC_MSG_CHECKING([for libg++ ($test_include)]) AC_CACHE_VAL(kde_cv_libgpp_includes, [ kde_cv_libgpp_includes=no for ac_dir in \ \ /usr/include/g++ \ /usr/include \ /usr/unsupported/include \ /opt/include \ $extra_include \ ; \ do if test -r "$ac_dir/$test_include"; then kde_cv_libgpp_includes=$ac_dir break fi done ]) AC_MSG_RESULT($kde_cv_libgpp_includes) if test "$kde_cv_libgpp_includes" != "no"; then all_includes="-I$kde_cv_libgpp_includes $all_includes" fi ]) ]) AC_DEFUN(KDE_CHECK_MICO, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([KDE_MISC_TESTS]) AC_MSG_CHECKING(for MICO) if test -z "$MICODIR"; then kde_micodir=/usr/local else kde_micodir="$MICODIR" fi AC_ARG_WITH(micodir, [ --with-micodir=micodir where mico is installed ], kde_micodir=$withval, kde_micodir=$kde_micodir ) AC_CACHE_VAL(kde_cv_mico_incdir, [ mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes" AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir) ]) kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'` if test ! -r $kde_micodir/include/CORBA.h; then AC_MSG_ERROR([No CORBA.h found, specify another micodir]) fi AC_MSG_RESULT($kde_micodir) MICO_INCLUDES=-I$kde_micodir/include AC_SUBST(MICO_INCLUDES) MICO_LDFLAGS=-L$kde_micodir/lib AC_SUBST(MICO_LDFLAGS) micodir=$kde_micodir AC_SUBST(micodir) AC_MSG_CHECKING([for MICO version]) AC_CACHE_VAL(kde_cv_mico_version, [ AC_LANG_C cat >conftest.$ac_ext < #include int main() { printf("MICO_VERSION=%s\n",MICO_VERSION); return (0); } EOF ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest' if AC_TRY_EVAL(ac_compile); then if eval `./conftest 2>&5`; then kde_cv_mico_version=$MICO_VERSION else AC_MSG_ERROR([your system is not able to execute a small application to find MICO version! Check $kde_micodir/include/mico/version.h]) fi else AC_MSG_ERROR([your system is not able to compile a small application to find MICO version! Check $kde_micodir/include/mico/version.h]) fi ]) dnl installed MICO version mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` if test "x$1" = "x"; then req_version="2.3.0" else req_version=$1 fi dnl required MICO version req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` if test "$mico_v_maj" -lt "$req_v_maj" || \ ( test "$mico_v_maj" -eq "$req_v_maj" && \ test "$mico_v_mid" -lt "$req_v_mid" ) || \ ( test "$mico_v_mid" -eq "$req_v_mid" && \ test "$mico_v_min" -lt "$req_v_min" ) then AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \ at least is required. You should upgrade MICO.]) else AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)]) fi LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL" AC_SUBST(LIBMICO) if test -z "$IDL"; then IDL='$(kde_bindir)/cuteidl' fi AC_SUBST(IDL) IDL_DEPENDENCIES='$(kde_includes)/CUTE.h' AC_SUBST(IDL_DEPENDENCIES) idldir="\$(includedir)/idl" AC_SUBST(idldir) ]) AC_DEFUN(KDE_CHECK_MINI_STL, [ AC_REQUIRE([KDE_CHECK_MICO]) AC_MSG_CHECKING(if we use mico's mini-STL) AC_CACHE_VAL(kde_cv_have_mini_stl, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS kde_save_cxxflags="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $MICO_INCLUDES" AC_TRY_COMPILE( [ #include ], [ #ifdef HAVE_MINI_STL #error "nothing" #endif ], kde_cv_have_mini_stl=no, kde_cv_have_mini_stl=yes) CXXFLAGS="$kde_save_cxxflags" AC_LANG_RESTORE ]) if test "x$kde_cv_have_mini_stl" = "xyes"; then AC_MSG_RESULT(yes) $1 else AC_MSG_RESULT(no) $2 fi ]) ]) AC_DEFUN(KDE_CHECK_LIBPTHREAD, [ AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"], LIBPTHREAD= ) AC_SUBST(LIBPTHREAD) ]) AC_DEFUN(KDE_TRY_LINK_PYTHON, [ if test "$kde_python_link_found" = no; then if test "$1" = normal; then AC_MSG_CHECKING(if a Python application links) else AC_MSG_CHECKING(if Python depends on $2) fi AC_CACHE_VAL(kde_cv_try_link_python_$1, [ AC_LANG_SAVE AC_LANG_C kde_save_cflags="$CFLAGS" CFLAGS="$CFLAGS $PYTHONINC" kde_save_libs="$LIBS" LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" kde_save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS $PYTHONLIB" AC_TRY_LINK( [ #include ],[ PySys_SetArgv(1, 0); ], [kde_cv_try_link_python_$1=yes], [kde_cv_try_link_python_$1=no] ) CFLAGS="$kde_save_cflags" LIBS="$kde_save_libs" LDFLAGS="$kde_save_ldflags" ]) if test "$kde_cv_try_link_python_$1" = "yes"; then AC_MSG_RESULT(yes) kde_python_link_found=yes if test ! "$1" = normal; then LIBPYTHON="$LIBPYTHON $2" fi $3 else AC_MSG_RESULT(no) $4 fi AC_LANG_RESTORE fi ]) AC_DEFUN(KDE_CHECK_PYTHON, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) AC_MSG_CHECKING([for Python directory]) AC_CACHE_VAL(kde_cv_pythondir, [ if test -z "$PYTHONDIR"; then kde_cv_pythondir=/usr/local else kde_cv_pythondir="$PYTHONDIR" fi ]) AC_ARG_WITH(pythondir, [ --with-pythondir=pythondir use python installed in pythondir ], [ ac_python_dir=$withval ], ac_python_dir=$kde_cv_pythondir ) AC_MSG_RESULT($ac_python_dir) if test -z "$1"; then version="1.5" else version="$1" fi AC_MSG_CHECKING([for Python$version]) python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) if test ! -r $python_incdir/Python.h; then AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) python_incdir=$python_incdir/python$version if test ! -r $python_incdir/Python.h; then AC_MSG_ERROR(Python.h not found.) fi fi PYTHONINC=-I$python_incdir python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) if test ! -r $python_libdir/libpython$version.a; then AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) python_libdir=$python_libdir/python$version/config if test ! -r $python_libdir/libpython$version.a; then AC_MSG_ERROR(libpython$version.a not found.) fi fi PYTHONLIB=-L$python_libdir if test -z "$LIBPYTHON"; then LIBPYTHON=-lpython$version fi AC_MSG_RESULT(header $python_incdir library $python_libdir) dnl Note: this test is very weak kde_python_link_found=no KDE_TRY_LINK_PYTHON(normal) KDE_TRY_LINK_PYTHON(m, -lm) KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) KDE_TRY_LINK_PYTHON(tcl, -ltcl) KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm], [], [AC_MSG_WARN([it seems, Python depends on another library. Pleae use \"make LIBPTYHON='-lpython$version -lotherlib'\" to fix this and contact the authors to let them know about this problem]) ]) LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" AC_SUBST(PYTHONINC) AC_SUBST(PYTHONLIB) AC_SUBST(LIBPYTHON) ]) AC_DEFUN(KDE_CHECK_STL_SGI, [ AC_MSG_CHECKING([if STL implementation is SGI like]) AC_CACHE_VAL(kde_cv_stl_type_sgi, [ AC_TRY_COMPILE([ #include using namespace std; ],[ string astring="Hallo Welt."; astring.erase(0, 6); // now astring is "Welt" return 0; ], kde_cv_stl_type_sgi=yes, kde_cv_stl_type_sgi=no) ]) AC_MSG_RESULT($kde_cv_stl_type_sgi) if test "$kde_cv_stl_type_sgi" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) fi ]) AC_DEFUN(KDE_CHECK_STL_HP, [ AC_MSG_CHECKING([if STL implementation is HP like]) AC_CACHE_VAL(kde_cv_stl_type_hp, [ AC_TRY_COMPILE([ #include using namespace std; ],[ string astring="Hello World"; astring.remove(0, 6); // now astring is "World" return 0; ], kde_cv_stl_type_hp=yes, kde_cv_stl_type_hp=no) ]) AC_MSG_RESULT($kde_cv_stl_type_hp) if test "$kde_cv_stl_type_hp" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by SGI]) fi ]) AC_DEFUN(KDE_CHECK_STL, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS KDE_CHECK_STL_SGI if test "$kde_cv_stl_type_sgi" = "no"; then KDE_CHECK_STL_HP if test "$kde_cv_stl_type_hp" = "no"; then AC_MSG_ERROR("no known STL type found") fi fi AC_LANG_RESTORE ]) AC_DEFUN(AC_FIND_QIMGIO, [AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_MSG_CHECKING([for qimgio]) AC_CACHE_VAL(ac_cv_lib_qimgio, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_save_LIBS="$LIBS" ac_save_CXXFLAGS="$CXXFLAGS" LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" AC_TRY_RUN(dnl [ #include #include int main() { QString t = "hallo"; t.fill('t'); qInitImageIO(); } ], ac_cv_lib_qimgio=yes, ac_cv_lib_qimgio=no, ac_cv_lib_qimgio=no) LIBS="$ac_save_LIBS" CXXFLAGS="$ac_save_CXXFLAGS" AC_LANG_RESTORE ])dnl if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) AC_SUBST(LIBQIMGIO) else AC_MSG_RESULT(not found) fi ]) AC_DEFUN(KDE_CHECK_ANSI, [ ]) AC_DEFUN(KDE_CHECK_INSURE, [ AC_ARG_ENABLE(insure, [ --enable-insure use insure++ for debugging [default=no]], [ if test $enableval = "no"; dnl then ac_use_insure="no" else ac_use_insure="yes" fi ], [ac_use_insure="no"]) AC_MSG_CHECKING(if we will use Insure++ to debug) AC_MSG_RESULT($ac_use_insure) if test "$ac_use_insure" = "yes"; dnl then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "???? fi ]) AC_DEFUN(AM_DISABLE_LIBRARIES, [ AC_PROVIDE([AM_ENABLE_STATIC]) AC_PROVIDE([AM_ENABLE_SHARED]) enable_static=no enable_shared=yes ]) AC_DEFUN(AC_CHECK_UTMP_FILE, [ AC_MSG_CHECKING([for utmp file]) AC_CACHE_VAL(kde_cv_utmp_file, [ kde_cv_utmp_file=no for ac_file in \ \ /var/run/utmp \ /var/adm/utmp \ /etc/utmp \ ; \ do if test -r "$ac_file"; then kde_cv_utmp_file=$ac_file break fi done ]) AC_MSG_RESULT($kde_cv_utmp_file) if test "$kde_cv_utmp_file" != "no"; then AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) fi ]) AC_DEFUN(KDE_CREATE_SUBDIRSLIST, [ DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" if test ! -s $srcdir/inst-apps && test -s $srcdir/subdirs; then cp $srcdir/subdirs $srcdir/inst-apps fi if test ! -s $srcdir/inst-apps; then TOPSUBDIRS="" files=`cd $srcdir && ls -1` dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` for i in $dirs; do echo $i >> $srcdir/subdirs done cp $srcdir/subdirs $srcdir/inst-apps fi if test -s $srcdir/inst-apps; then ac_topsubdirs="`cat $srcdir/inst-apps`" fi for i in $ac_topsubdirs; do AC_MSG_CHECKING([if $i should be compiled]) if test -d $srcdir/$i; then install_it="yes" for j in $DO_NOT_COMPILE; do if test $i = $j; then install_it="no" fi done else install_it="no" fi AC_MSG_RESULT($install_it) if test $install_it = "yes"; then TOPSUBDIRS="$TOPSUBDIRS $i" fi done AC_SUBST(TOPSUBDIRS) ]) AC_DEFUN(KDE_CHECK_NAMESPACES, [ AC_MSG_CHECKING(whether C++ compiler supports namespaces) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ ], [ namespace Foo { extern int i; namespace Bar { extern int i; } } int Foo::i = 0; int Foo::Bar::i = 1; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NAMESPACES) ], [ AC_MSG_RESULT(no) ]) AC_LANG_RESTORE ]) AC_DEFUN(KDE_CHECK_NEWLIBS, [ ]) dnl ------------------------------------------------------------------------ dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_CHECK_S_ISSOCK, [ AC_MSG_CHECKING(for S_ISSOCK) AC_CACHE_VAL(ac_cv_have_s_issock, [ AC_LANG_SAVE AC_LANG_C AC_TRY_LINK( [ #include ], [ struct stat buff; int b = S_ISSOCK( buff.st_mode ); ], ac_cv_have_s_issock=yes, ac_cv_have_s_issock=no) AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_have_s_issock) if test "$ac_cv_have_s_issock" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) fi ]) dnl ------------------------------------------------------------------------ dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_CHECK_KDEMAXPATHLEN, [ AC_MSG_CHECKING(for MAXPATHLEN) AC_CACHE_VAL(ac_cv_maxpathlen, [ AC_LANG_C cat > conftest.$ac_ext < #include #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif KDE_HELLO MAXPATHLEN EOF ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" if AC_TRY_EVAL(ac_try) && test -s conftest.out; then ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` else ac_cv_maxpathlen=1024 fi rm conftest.* ]) AC_MSG_RESULT($ac_cv_maxpathlen) AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXLENPATH] ) ]) dnl ------------------------------------------------------------------------- dnl See if the compiler supports a template repository bero@redhat.de dnl ------------------------------------------------------------------------- AC_DEFUN(KDE_COMPILER_REPO, [ REPO="" NOREPO="" KDE_CHECK_COMPILER_FLAG(frepo, [ REPO="-frepo" NOREPO="-fno-repo" ]) if test -z "$REPO"; then KDE_CHECK_COMPILER_FLAG(instances=explicit, [ REPO="-instances=explicit" NOREPO="-instances=extern" ]) fi if test -n "$REPO"; then AC_DEFINE_UNQUOTED(HAVE_TEMPLATE_REPOSITORY, 1, [C++ compiler supports template repository]) $1 fi AC_SUBST(REPO) AC_SUBST(NOREPO) ]) AC_DEFUN(KDE_CHECK_HEADER, [ AC_LANG_SAVE kde_safe_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $all_includes" AC_LANG_CPLUSPLUS AC_CHECK_HEADER($1, $2, $3) CPPFLAGS=$kde_safe_cppflags AC_LANG_RESTORE ]) AC_DEFUN(KDE_CHECK_QWSPRITEFIELD, [ KDE_CHECK_HEADER(QwSpriteField.h, , [ AC_MSG_WARN([you don't have QwSpriteField.h somewhere. Please install QwSpriteField out of kdesupport.]) $1 ]) ]) AC_DEFUN(KDE_SET_PREFIX, [ dnl make $KDEDIR the default for the installation AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix ac_configure_args="$ac_configure_args --prefix $prefix" fi ]) c_cpp_reference-2.0.2/install-sh0000755000076400001440000001272007244431673012316 #!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # 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}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true 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;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true 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` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 c_cpp_reference-2.0.2/missing0000755000076400001440000001637507055333347011722 #! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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, 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.2 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # we have already tried tar in the generic part gnutar ${1+"$@"} && exit 0 gtar ${1+"$@"} && exit 0 firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 c_cpp_reference-2.0.2/subdirs0000644000076400001440000000001207474405112011671 reference c_cpp_reference-2.0.2/mkinstalldirs0000755000076400001440000000132307244431673013115 #! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.2 2001/02/20 09:07:07 tasin Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here c_cpp_reference-2.0.2/Makefile.am0000644000076400001440000000076707406407514012353 EXTRA_DIST = admin AUTOMAKE_OPTIONS = foreign DISTCLEANFILES =inst-apps SUBDIRS = reference $(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; $(top_srcdir)/subdirs: cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs $(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 c_cpp_reference-2.0.2/Makefile.in0000644000076400001440000004236007474405126012361 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = admin AUTOMAKE_OPTIONS = foreign DISTCLEANFILES = inst-apps SUBDIRS = reference subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = DIST_SOURCES = RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = ./stamp-h.in AUTHORS INSTALL Makefile.am Makefile.in \ acinclude.m4 aclocal.m4 admin/ChangeLog admin/config.guess \ admin/config.sub admin/depcomp admin/install-sh admin/ltcf-c.sh \ admin/ltcf-cxx.sh admin/ltcf-gcj.sh admin/ltconfig \ admin/ltmain.sh admin/missing admin/mkinstalldirs admin/ylwrap \ config.h.in configure configure.in install-sh missing \ mkinstalldirs DIST_SUBDIRS = $(SUBDIRS) #>- all: config.h #>+ 1 all: docs-am config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --foreign ./Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Makefile cd $(top_srcdir) && perl admin/am_edit Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$@ $(SHELL) ./config.status $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): configure.in acinclude.m4 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h @if test ! -f $@; then \ rm -f stamp-h; \ $(MAKE) stamp-h; \ else :; fi stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h stamp-hT @echo timestamp > stamp-hT 2> /dev/null cd $(top_builddir) \ && CONFIG_FILES= CONFIG_HEADERS=config.h \ $(SHELL) ./config.status @mv stamp-hT stamp-h $(srcdir)/config.h.in: $(srcdir)/./stamp-h.in @if test ! -f $@; then \ rm -f $(srcdir)/./stamp-h.in; \ $(MAKE) $(srcdir)/./stamp-h.in; \ else :; fi $(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) @rm -f $(srcdir)/./stamp-h.in $(srcdir)/./stamp-h.inT @echo timestamp > $(srcdir)/./stamp-h.inT 2> /dev/null cd $(top_srcdir) && $(AUTOHEADER) @mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in distclean-hdr: -rm -f config.h uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) GTAGS: here=`CDPATH=: && cd $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=Makefile.cvs subdirs configure.in.in acinclude.m4.in configure.files libtool.m4.in DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = . # Avoid unsightly `./'. distdir = $(PACKAGE)-$(VERSION) GZIP_ENV = --best distdir: $(DISTFILES) -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) mkdir $(distdir) $(mkinstalldirs) $(distdir)/admin @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done for subdir in $(SUBDIRS); do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/=build mkdir $(distdir)/=inst chmod a-w $(distdir) dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \ && cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ || (echo "Error: files left after uninstall" 1>&2; \ exit 1) ) \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && $(MAKE) $(AM_MAKEFLAGS) distclean \ && rm -f $(distdir).tar.gz \ && (test `find . -type f -print | wc -l` -eq 0 \ || (echo "Error: files left after distclean" 1>&2; \ exit 1) ) -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) @echo "$(distdir).tar.gz is ready for distribution" | \ sed 'h;s/./=/g;p;x;p;x' check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-recursive #>+ 1 clean: kde-rpo-clean clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am dist-all: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) distclean: distclean-recursive -rm -f config.status config.cache config.log distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-generic clean-libtool clean-recursive dist dist-all \ distcheck distclean distclean-generic distclean-hdr \ distclean-libtool distclean-recursive distclean-tags distdir \ dvi dvi-am dvi-recursive info info-am info-recursive install \ install-am install-data install-data-am install-data-recursive \ install-exec install-exec-am install-exec-recursive \ install-info install-info-am install-info-recursive install-man \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-libtool mostlyclean-recursive tags tags-recursive \ uninstall uninstall-am uninstall-info-am \ uninstall-info-recursive uninstall-recursive $(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; $(top_srcdir)/subdirs: cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs $(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Makefile cd $(top_srcdir) && perl admin/am_edit Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/configure.files0000644000076400001440000000005107474405112013303 ./admin/configure.in.min configure.in.in c_cpp_reference-2.0.2/configure.in.in0000644000076400001440000000006607474404751013232 #MIN_CONFIG AM_INIT_AUTOMAKE(c_cpp_reference,2.0.2) c_cpp_reference-2.0.2/config.h.in0000644000076400001440000000333007474405121012324 /* config.h.in. Generated automatically from configure.in by autoheader. */ /* Defines if your system has the crypt function */ #undef HAVE_CRYPT /* Define if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if you have libjpeg */ #undef HAVE_LIBJPEG /* Define if you have libpng */ #undef HAVE_LIBPNG /* Define if you have libz */ #undef HAVE_LIBZ /* Define if you have the header file. */ #undef HAVE_MEMORY_H /* Define if you have the res_init function */ #undef HAVE_RES_INIT /* Define if you have the header file. */ #undef HAVE_STDINT_H /* Define if you have the header file. */ #undef HAVE_STDLIB_H /* Define if you have the header file. */ #undef HAVE_STRINGS_H /* Define if you have the header file. */ #undef HAVE_STRING_H /* Define if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H /* C++ compiler supports template repository */ #undef HAVE_TEMPLATE_REPOSITORY /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you want Xinerama support */ #undef HAVE_XINERAMA /* Name of package */ #undef PACKAGE /* The size of a `char', as computed by sizeof. */ #undef SIZEOF_CHAR /* The size of a `char *', as computed by sizeof. */ #undef SIZEOF_CHAR_P /* The size of a `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Compatibility define */ #undef ksize_t /* Define the real type of socklen_t */ #undef socklen_t c_cpp_reference-2.0.2/Makefile.cvs0000644000076400001440000000070207406402660012533 all: @echo "This Makefile is only for the CVS repository" @echo "This will be deleted before making the distribution" @echo "" @if test ! -d admin; then \ echo "Please recheckout this module!" ;\ echo "for cvs: use checkout once and after that update again" ;\ echo "for cvsup: checkout kde-common from cvsup and" ;\ echo " link kde-common/admin to ./admin" ;\ exit 1 ;\ fi $(MAKE) -f admin/Makefile.common cvs .SILENT: c_cpp_reference-2.0.2/acinclude.m40000644000076400001440000042734507474405112012512 ## -*- autoconf -*- dnl This file is part of the KDE libraries/packages dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org) dnl This file is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Library General Public dnl License as published by the Free Software Foundation; either dnl version 2 of the License, or (at your option) any later version. dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Library General Public License for more details. dnl You should have received a copy of the GNU Library General Public License dnl along with this library; see the file COPYING.LIB. If not, write to dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, dnl Boston, MA 02111-1307, USA. dnl IMPORTANT NOTE: dnl Please do not modify this file unless you expect your modifications to be dnl carried into every other module in the repository. If you decide that you dnl really want to modify it, contact coolo@kde.org mentioning that you have dnl and that the modified file should be committed to every module. dnl dnl Single-module modifications are best placed in configure.in for kdelibs dnl and kdebase or configure.in.in if present. dnl ------------------------------------------------------------------------ dnl Forward compatibility macros (make autoconf 2.13 look like 2.50), dnl thanks to Raja R Harinath. dnl ------------------------------------------------------------------------ dnl ifdef([_AC_PATH_X_XMKMF],[], [AC_DEFUN([_AC_PATH_X_XMKMF],[AC_PATH_X_XMKMF])]) ifdef([AC_OUTPUT_SUBDIRS],[], [AC_DEFUN([AC_OUTPUT_SUBDIRS],[subdirs=$1; _AC_OUTPUT_SUBDIRS])]) ifdef([AM_PROG_AS],[], [AC_DEFUN([AM_PROG_AS,[])]) # KDE_PATH_X_DIRECT dnl Internal subroutine of AC_PATH_X. dnl Set ac_x_includes and/or ac_x_libraries. AC_DEFUN(KDE_PATH_X_DIRECT, [if test "$ac_x_includes" = NO; then # Guess where to find include files, by looking for this one X11 .h file. test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h # First, try using that file with no special directory specified. AC_TRY_CPP([#include <$x_direct_test_include>], [# We can compile using X headers with no special include directory. ac_x_includes=], [# Look for the header file in a standard set of common directories. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in \ /usr/X11/include \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/include \ /usr/local/include \ /usr/unsupported/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include \ ; \ do if test -r "$ac_dir/$x_direct_test_include"; then ac_x_includes=$ac_dir break fi done]) fi # $ac_x_includes = NO if test "$ac_x_libraries" = NO; then # Check for the libraries. test -z "$x_direct_test_library" && x_direct_test_library=Xt test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" AC_TRY_LINK(, [${x_direct_test_function}()], [LIBS="$ac_save_LIBS" # We can link X programs with no special library path. ac_x_libraries=], [LIBS="$ac_save_LIBS" # First see if replacing the include by lib works. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ /usr/X11/lib \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ /usr/lib/X11 \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ /usr/local/X11/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ /usr/local/lib/X11 \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ /lib/usr/lib/X11 \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ ; \ do dnl Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done]) fi # $ac_x_libraries = NO ]) dnl ------------------------------------------------------------------------ dnl Find a file (or one of more files in a list of dirs) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_FIND_FILE, [ $3=NO for i in $2; do for j in $1; do echo "configure: __oline__: $i/$j" >&AC_FD_CC if test -r "$i/$j"; then echo "taking that" >&AC_FD_CC $3=$i break 2 fi done done ]) dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, dnl if-not-found, test-parameter) AC_DEFUN(KDE_FIND_PATH, [ AC_MSG_CHECKING([for $1]) if test -n "$$2"; then kde_cv_path="$$2"; else kde_cache=`echo $1 | sed 'y%./+-%__p_%'` AC_CACHE_VAL(kde_cv_path_$kde_cache, [ kde_cv_path="NONE" dirs="$3" kde_save_IFS=$IFS IFS=':' for dir in $PATH; do dirs="$dirs $dir" done IFS=$kde_save_IFS for dir in $dirs; do if test -x "$dir/$1"; then if test -n "$5" then evalstr="$dir/$1 $5 2>&1 " if eval $evalstr; then kde_cv_path="$dir/$1" break fi else kde_cv_path="$dir/$1" break fi fi done eval "kde_cv_path_$kde_cache=$kde_cv_path" ]) eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" fi if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then AC_MSG_RESULT(not found) $4 else AC_MSG_RESULT($kde_cv_path) $2=$kde_cv_path fi ]) AC_DEFUN(KDE_MOC_ERROR_MESSAGE, [ AC_MSG_ERROR([No Qt meta object compiler (moc) found! Please check whether you installed Qt correctly. You need to have a running moc binary. configure tried to run $ac_cv_path_moc and the test didn't succeed. If configure shouldn't have tried this one, set the environment variable MOC to the right one before running configure. ]) ]) AC_DEFUN(KDE_UIC_ERROR_MESSAGE, [ AC_MSG_WARN([No Qt ui compiler (uic) found! Please check whether you installed Qt correctly. You need to have a running uic binary. configure tried to run $ac_cv_path_uic and the test didn't succeed. If configure shouldn't have tried this one, set the environment variable UIC to the right one before running configure. ]) ]) dnl ------------------------------------------------------------------------ dnl Find the meta object compiler and the ui compiler in the PATH, dnl in $QTDIR/bin, and some more usual places dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_PATH_QT_MOC_UIC, [ qt_bindirs="" for dir in $kde_qt_dirs; do qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" done qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" if test ! "$ac_qt_bindir" = "NO"; then qt_bindirs="$ac_qt_bindir $qt_bindirs" fi KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE]) if test -z "$UIC_NOT_NEEDED"; then KDE_FIND_PATH(uic, UIC, [$qt_bindirs], [UIC=""]) if test -z "$UIC" ; then KDE_UIC_ERROR_MESSAGE exit 1 fi else UIC="echo uic not available: " fi AC_SUBST(MOC) AC_SUBST(UIC) UIC_TR="i18n" if test $kde_qtver = 3; then UIC_TR="QT_KDE_I18N" fi AC_SUBST(UIC_TR) ]) AC_DEFUN(KDE_1_CHECK_PATHS, [ KDE_1_CHECK_PATH_HEADERS KDE_TEST_RPATH= if test -n "$USE_RPATH"; then if test -n "$kde_libraries"; then KDE_TEST_RPATH="-R $kde_libraries" fi if test -n "$qt_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" fi if test -n "$x_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" fi KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" fi AC_MSG_CHECKING([for KDE libraries installed]) ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' if AC_TRY_EVAL(ac_link) && test -s conftest; then AC_MSG_RESULT(yes) else AC_MSG_ERROR([your system fails at linking a small KDE application! Check, if your compiler is installed correctly and if you have used the same compiler to compile Qt and kdelibs as you did use now. For more details about this problem, look at the end of config.log.]) fi if eval `KDEDIR= ./conftest 2>&5`; then kde_result=done else kde_result=problems fi KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log kde_have_all_paths=yes KDE_SET_PATHS($kde_result) ]) AC_DEFUN(KDE_SET_PATHS, [ kde_cv_all_paths="kde_have_all_paths=\"yes\" \ kde_htmldir=\"$kde_htmldir\" \ kde_appsdir=\"$kde_appsdir\" \ kde_icondir=\"$kde_icondir\" \ kde_sounddir=\"$kde_sounddir\" \ kde_datadir=\"$kde_datadir\" \ kde_locale=\"$kde_locale\" \ kde_cgidir=\"$kde_cgidir\" \ kde_confdir=\"$kde_confdir\" \ kde_mimedir=\"$kde_mimedir\" \ kde_toolbardir=\"$kde_toolbardir\" \ kde_wallpaperdir=\"$kde_wallpaperdir\" \ kde_templatesdir=\"$kde_templatesdir\" \ kde_bindir=\"$kde_bindir\" \ kde_servicesdir=\"$kde_servicesdir\" \ kde_servicetypesdir=\"$kde_servicetypesdir\" \ kde_moduledir=\"$kde_moduledir\" \ kde_result=$1" ]) AC_DEFUN(KDE_SET_DEFAULT_PATHS, [ if test "$1" = "default"; then if test -z "$kde_htmldir"; then kde_htmldir='\${prefix}/share/doc/HTML' fi if test -z "$kde_appsdir"; then kde_appsdir='\${prefix}/share/applnk' fi if test -z "$kde_icondir"; then kde_icondir='\${prefix}/share/icons' fi if test -z "$kde_sounddir"; then kde_sounddir='\${prefix}/share/sounds' fi if test -z "$kde_datadir"; then kde_datadir='\${prefix}/share/apps' fi if test -z "$kde_locale"; then kde_locale='\${prefix}/share/locale' fi if test -z "$kde_cgidir"; then kde_cgidir='\${exec_prefix}/cgi-bin' fi if test -z "$kde_confdir"; then kde_confdir='\${prefix}/share/config' fi if test -z "$kde_mimedir"; then kde_mimedir='\${prefix}/share/mimelnk' fi if test -z "$kde_toolbardir"; then kde_toolbardir='\${prefix}/share/toolbar' fi if test -z "$kde_wallpaperdir"; then kde_wallpaperdir='\${prefix}/share/wallpapers' fi if test -z "$kde_templatesdir"; then kde_templatesdir='\${prefix}/share/templates' fi if test -z "$kde_bindir"; then kde_bindir='\${exec_prefix}/bin' fi if test -z "$kde_servicesdir"; then kde_servicesdir='\${prefix}/share/services' fi if test -z "$kde_servicetypesdir"; then kde_servicetypesdir='\${prefix}/share/servicetypes' fi if test -z "$kde_moduledir"; then kde_moduledir='\${exec_prefix}/lib/kde2' fi KDE_SET_PATHS(defaults) else if test $kde_qtver = 1; then AC_MSG_RESULT([compiling]) KDE_1_CHECK_PATHS else AC_MSG_ERROR([path checking not yet supported for KDE 2]) fi fi ]) AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS, [ if test -z "$kde_htmldir" || test -z "$kde_appsdir" || test -z "$kde_icondir" || test -z "$kde_sounddir" || test -z "$kde_datadir" || test -z "$kde_locale" || test -z "$kde_cgidir" || test -z "$kde_confdir" || test -z "$kde_mimedir" || test -z "$kde_toolbardir" || test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || test -z "$kde_bindir" || test -z "$kde_servicesdir" || test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || test "$kde_have_all_paths" != "yes"; then kde_have_all_paths=no fi ]) AC_DEFUN(KDE_MISSING_PROG_ERROR, [ AC_MSG_ERROR([The important program $1 was not found! Please check whether you installed KDE correctly. ]) ]) AC_DEFUN(KDE_SUBST_PROGRAMS, [ kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde2/bin /usr/kde/bin /usr/local/kde/bin" if test -n "$KDEDIRS"; then kde_save_IFS=$IFS IFS=: for dir in $KDEDIRS; do kde_default_bindirs="$dir/bin $kde_default_bindirs " done IFS=$kde_save_IFS fi kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs" KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)]) KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)]) KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(mcopidl)]) KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(artsc-config)]) KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs]) KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs]) if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde2/share /opt/kde/share $prefix/share" test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET) if test "$KDE_XSL_STYLESHEET" = "NO"; then KDE_XSL_STYLESHEET="" else KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" fi fi DCOP_DEPENDENCIES='$(DCOPIDL)' AC_SUBST(DCOPIDL) AC_SUBST(DCOPIDL2CPP) AC_SUBST(DCOP_DEPENDENCIES) AC_SUBST(MCOPIDL) AC_SUBST(ARTSCCONFIG) AC_SUBST(KDECONFIG) AC_SUBST(MEINPROC) AC_SUBST(KDE_XSL_STYLESHEET) if test -x "$KDECONFIG"; then # it can be "compiled" kde_libs_prefix=`$KDECONFIG --prefix` if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. This means it has been moved since you installed it. This won't work. Please recompile kdelibs for the new prefix. ]) fi kde_libs_htmldir=`$KDECONFIG --install html --expandvars` else kde_libs_prefix='$(prefix)' kde_libs_htmldir='$(kde_htmldir)' fi AC_SUBST(kde_libs_prefix) AC_SUBST(kde_libs_htmldir) ])dnl AC_DEFUN(AC_CREATE_KFSSTND, [ AC_REQUIRE([AC_CHECK_RPATH]) AC_MSG_CHECKING([for KDE paths]) kde_result="" kde_cached_paths=yes AC_CACHE_VAL(kde_cv_all_paths, [ KDE_SET_DEFAULT_PATHS($1) kde_cached_paths=no ]) eval "$kde_cv_all_paths" KDE_CHECK_PATHS_FOR_COMPLETENESS if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then # wrong values were cached, may be, we can set better ones kde_result= kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= kde_have_all_paths= KDE_SET_DEFAULT_PATHS($1) eval "$kde_cv_all_paths" KDE_CHECK_PATHS_FOR_COMPLETENESS kde_result="$kde_result (cache overridden)" fi if test "$kde_have_all_paths" = "no"; then AC_MSG_ERROR([configure could not run a little KDE program to test the environment. Since it had compiled and linked before, it must be a strange problem on your system. Look at config.log for details. If you are not able to fix this, look at http://www.kde.org/faq/installation.html or any www.kde.org mirror. (If you're using an egcs version on Linux, you may update binutils!) ]) else rm -f conftest* AC_MSG_RESULT($kde_result) fi bindir=$kde_bindir KDE_SUBST_PROGRAMS ]) AC_DEFUN(AC_SUBST_KFSSTND, [ AC_SUBST(kde_htmldir) AC_SUBST(kde_appsdir) AC_SUBST(kde_icondir) AC_SUBST(kde_sounddir) AC_SUBST(kde_datadir) AC_SUBST(kde_locale) AC_SUBST(kde_confdir) AC_SUBST(kde_mimedir) AC_SUBST(kde_wallpaperdir) AC_SUBST(kde_bindir) dnl for KDE 2 AC_SUBST(kde_templatesdir) AC_SUBST(kde_servicesdir) AC_SUBST(kde_servicetypesdir) AC_SUBST(kde_moduledir) if test "$kde_qtver" = 1; then kde_minidir="$kde_icondir/mini" else # for KDE 1 - this breaks KDE2 apps using minidir, but # that's the plan ;-/ kde_minidir="/dev/null" fi dnl AC_SUBST(kde_minidir) dnl AC_SUBST(kde_cgidir) dnl AC_SUBST(kde_toolbardir) ]) AC_DEFUN(KDE_MISC_TESTS, [ AC_LANG_C dnl Checks for libraries. AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD AC_SUBST(LIBUTIL) AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD AC_SUBST(LIBCOMPAT) kde_have_crypt= AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ AC_MSG_WARN([you have no crypt in either libcrypt or libc. You should install libcrypt from another source or configure with PAM support]) kde_have_crypt=no ])) AC_SUBST(LIBCRYPT) if test $kde_have_crypt = yes; then AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) fi AC_CHECK_SOCKLEN_T AC_LANG_C AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) if test $ac_cv_lib_dnet_dnet_ntoa = no; then AC_CHECK_LIB(dnet_stub, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) fi AC_CHECK_FUNC(inet_ntoa) if test $ac_cv_func_inet_ntoa = no; then AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") fi AC_CHECK_FUNC(connect) if test $ac_cv_func_connect = no; then AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , $X_EXTRA_LIBS) fi AC_CHECK_FUNC(remove) if test $ac_cv_func_remove = no; then AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. AC_CHECK_FUNC(shmat, , AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")) # Solaris 2.6 and others need -lresolv for res_init AC_CHECK_FUNCS(res_init, , [ kde_libs_safe="$LIBS" LIBS="$LIBS $X_EXTRA_LIBS -lresolv" AC_TRY_LINK( [ #include ], [ res_init(); ], LIBRESOLV="-lresolv" X_EXTRA_LIBS="$X_EXTRA_LIBS $LIBRESOLV" AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) ) LIBS=$kde_libs_safe ]) LIBSOCKET="$X_EXTRA_LIBS" AC_SUBST(LIBSOCKET) AC_SUBST(LIBRESOLV) AC_SUBST(X_EXTRA_LIBS) AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 AC_SUBST(LIBUCB) case $host in dnl this *is* LynxOS specific *-*-lynxos* ) AC_MSG_CHECKING([LynxOS header file wrappers]) [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] AC_MSG_RESULT(disabled) AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS ;; esac KDE_CHECK_TYPES KDE_CHECK_LIBDL ]) dnl ------------------------------------------------------------------------ dnl Find the header files and libraries for X-Windows. Extended the dnl macro AC_PATH_X dnl ------------------------------------------------------------------------ dnl AC_DEFUN(K_PATH_X, [ AC_REQUIRE([AC_PROG_CPP])dnl AC_REQUIRE([KDE_MISC_TESTS])dnl AC_MSG_CHECKING(for X) AC_LANG_SAVE AC_LANG_C AC_CACHE_VAL(kde_cv_have_x, [# One or both of the vars are not set, and there is no cached value. if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then kde_x_includes=NO else kde_x_includes=$x_includes fi if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then kde_x_libraries=NO else kde_x_libraries=$x_libraries fi # below we use the standard autoconf calls ac_x_libraries=$kde_x_libraries ac_x_includes=$kde_x_includes KDE_PATH_X_DIRECT dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries. dnl Unfortunately, if compiling with the N32 ABI, this is not the correct dnl location. The correct location is /usr/lib32 or an undefined value dnl (the linker is smart enough to pick the correct default library). dnl Things work just fine if you use just AC_PATH_X_DIRECT. dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to dnl /usr/openwin/include, which doesn't work. /usr/include does work, so dnl x_includes should be left alone. case "$host" in mips-sgi-irix6*) ;; *-*-solaris*) ;; *) _AC_PATH_X_XMKMF if test -z "$ac_x_includes"; then ac_x_includes="." fi if test -z "$ac_x_libraries"; then ac_x_libraries="/usr/lib" fi esac #from now on we use our own again # when the user already gave --x-includes, we ignore # what the standard autoconf macros told us. if test "$kde_x_includes" = NO; then kde_x_includes=$ac_x_includes fi # for --x-libraries too if test "$kde_x_libraries" = NO; then kde_x_libraries=$ac_x_libraries fi if test "$kde_x_includes" = NO; then AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) fi if test "$kde_x_libraries" = NO; then AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) fi # Record where we found X for the cache. kde_cv_have_x="have_x=yes \ kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" ])dnl eval "$kde_cv_have_x" if test "$have_x" != yes; then AC_MSG_RESULT($have_x) no_x=yes else AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes]) fi if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then X_INCLUDES="" x_includes="."; dnl better than nothing :- else x_includes=$kde_x_includes X_INCLUDES="-I$x_includes" fi if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then X_LDFLAGS="" x_libraries="/usr/lib"; dnl better than nothing :- else x_libraries=$kde_x_libraries X_LDFLAGS="-L$x_libraries" fi all_includes="$X_INCLUDES" all_libraries="$X_LDFLAGS" AC_SUBST(X_INCLUDES) AC_SUBST(X_LDFLAGS) AC_SUBST(x_libraries) AC_SUBST(x_includes) # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $X_LDFLAGS" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. AC_CHECK_LIB(ICE, IceConnectionNumber, [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS) AC_SUBST(LIBSM) LDFLAGS="$ac_save_LDFLAGS" AC_SUBST(X_PRE_LIBS) LIB_X11='-lX11 $(LIBSOCKET)' AC_SUBST(LIB_X11) AC_MSG_CHECKING(for libXext) AC_CACHE_VAL(kde_cv_have_libXext, [ kde_ldflags_safe="$LDFLAGS" kde_libs_safe="$LIBS" LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" LIBS="-lXext -lX11 $LIBSOCKET" AC_TRY_LINK([ #include #ifdef STDC_HEADERS # include #endif ], [ printf("hello Xext\n"); ], kde_cv_have_libXext=yes, kde_cv_have_libXext=no ) LDFLAGS=$kde_ldflags_safe LIBS=$kde_libs_safe ]) AC_MSG_RESULT($kde_cv_have_libXext) if test "$kde_cv_have_libXext" = "no"; then AC_MSG_ERROR([We need a working libXext to proceed. Since configure can't find it itself, we stop here assuming that make wouldn't find them either.]) fi AC_MSG_CHECKING(for Xinerama) AC_ARG_WITH(xinerama, [ --with-xinerama enable support for Xinerama ], [ no_xinerama=no ], [ no_xinerama=yes ] ) kde_save_LDFLAGS="$LDFLAGS" kde_save_CFLAGS="$CFLAGS" kde_save_LIBS="$LIBS" LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" CFLAGS="$CFLAGS -I$x_includes" LIBS="-lXinerama -lXext" if test "x$no_xinerama" = "xno"; then AC_CACHE_VAL(ac_cv_have_xinerama, [ AC_TRY_LINK([#include #include ], [XineramaIsActive(NULL);], [ac_cv_have_xinerama="yes"], [ac_cv_have_xinerama="no"]) ]) else ac_cv_have_xinerama=no; fi AC_MSG_RESULT($ac_cv_have_xinerama) LIBXINERAMA="" if test "$ac_cv_have_xinerama" = "yes"; then AC_DEFINE(HAVE_XINERAMA, 1, [Define if you want Xinerama support]) LIBXINERAMA="-lXinerama" fi AC_SUBST(LIBXINERAMA) LDFLAGS="$kde_save_LDFLAGS" CFLAGS="$kde_save_CFLAGS" LIBS="$kde_save_LIBS" AC_LANG_RESTORE ]) AC_DEFUN(KDE_PRINT_QT_PROGRAM, [ AC_REQUIRE([KDE_USE_QT]) cat > conftest.$ac_ext < #include EOF if test "$kde_qtver" != "1"; then cat >> conftest.$ac_ext < #include #include EOF if test $kde_qtsubver -gt 0; then cat >> conftest.$ac_ext < EOF fi fi echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext cat >> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <&AC_FD_CC cat conftest.$ac_ext >&AC_FD_CC fi rm -f conftest* CXXFLAGS="$ac_cxxflags_safe" LDFLAGS="$ac_ldflags_safe" LIBS="$ac_libs_safe" LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" export LD_LIBRARY_PATH LIBRARY_PATH="$ac_LIBRARY_PATH" export LIBRARY_PATH AC_LANG_RESTORE ]) if test "$kde_cv_qt_direct" = "yes"; then AC_MSG_RESULT(yes) $1 else AC_MSG_RESULT(no) $2 fi ]) dnl ------------------------------------------------------------------------ dnl Try to find the Qt headers and libraries. dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_PATH_QT_1_3, [ AC_REQUIRE([K_PATH_X]) AC_REQUIRE([KDE_USE_QT]) dnl ------------------------------------------------------------------------ dnl Add configure flag to enable linking to MT version of Qt library. dnl ------------------------------------------------------------------------ AC_ARG_ENABLE( mt, [ --enable-mt link to threaded Qt (experimental)], kde_use_qt_mt=$enableval, kde_use_qt_mt=no ) USING_QT_MT="" dnl ------------------------------------------------------------------------ dnl If we got --enable-qt-mt then adjust some vars for the host. dnl ------------------------------------------------------------------------ if test "x$kde_use_qt_mt" = "xyes"; then case $host in *-*-linux-*) if test "x$GCC" = "xyes"; then CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT -pthread" X_EXTRA_LIBS="$X_EXTRA_LIBS -pthread" else AC_MSG_WARN([Compiler is not gcc. MT support disabled.]) fi ;; *) AC_MSG_WARN([MT not yet supported on $host - disabled.]) ;; esac fi kde_qt_was_given=yes dnl ------------------------------------------------------------------------ dnl If we haven't been told how to link to Qt, we work it out for ourselves. dnl ------------------------------------------------------------------------ if test -z "$LIBQT_GLOB"; then LIBQT_GLOB="libqt.*" fi if test -z "$LIBQT"; then LIBQT="-lqt" kde_int_qt="-lqt" dnl ------------------------------------------------------------------------ dnl If we got --enable-qt-mt then adjust the Qt library name for the host. dnl ------------------------------------------------------------------------ if test "x$kde_use_qt_mt" = "xyes"; then case $host in *-*-linux-*) if test "x$GCC" = "xyes"; then LIBQT="-lqt-mt" kde_int_qt="-lqt-mt" LIBQT_GLOB="libqt-mt.*" USING_QT_MT="using -mt" fi ;; esac fi kde_qt_was_given=no else kde_int_qt="$LIBQT" fi if test $kde_qtver != 1; then AC_REQUIRE([AC_FIND_PNG]) AC_REQUIRE([AC_FIND_JPEG]) LIBQT="$LIBQT $LIBPNG $LIBJPEG" fi AC_MSG_CHECKING([for Qt]) LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO qt_libraries="" qt_includes="" AC_ARG_WITH(qt-dir, [ --with-qt-dir=DIR where the root of Qt is installed ], [ ac_qt_includes="$withval"/include ac_qt_libraries="$withval"/lib ac_qt_bindir="$withval"/bin ]) AC_ARG_WITH(qt-includes, [ --with-qt-includes=DIR where the Qt includes are. ], [ ac_qt_includes="$withval" ]) kde_qt_libs_given=no AC_ARG_WITH(qt-libraries, [ --with-qt-libraries=DIR where the Qt library is installed.], [ ac_qt_libraries="$withval" kde_qt_libs_given=yes ]) AC_CACHE_VAL(ac_cv_have_qt, [#try to guess Qt locations qt_incdirs="" for dir in $kde_qt_dirs; do qt_incdirs="$qt_incdirs $dir/include $dir" done qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 $x_includes" if test ! "$ac_qt_includes" = "NO"; then qt_incdirs="$ac_qt_includes $qt_incdirs" fi if test "$kde_qtver" != "1"; then kde_qt_header=qstyle.h else kde_qt_header=qglobal.h fi AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) ac_qt_includes="$qt_incdir" qt_libdirs="" for dir in $kde_qt_dirs; do qt_libdirs="$qt_libdirs $dir/lib $dir" done qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" if test ! "$ac_qt_libraries" = "NO"; then qt_libdir=$ac_qt_libraries else qt_libdirs="$ac_qt_libraries $qt_libdirs" # if the Qt was given, the chance is too big that libqt.* doesn't exist qt_libdir=NONE for dir in $qt_libdirs; do try="ls -1 $dir/${LIBQT_GLOB}" if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi done fi ac_qt_libraries="$qt_libdir" AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_cxxflags_safe="$CXXFLAGS" ac_ldflags_safe="$LDFLAGS" ac_libs_safe="$LIBS" CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS" LIBS="$LIBS $LIBQT" KDE_PRINT_QT_PROGRAM if AC_TRY_EVAL(ac_link) && test -s conftest; then rm -f conftest* else echo "configure: failed program was:" >&AC_FD_CC cat conftest.$ac_ext >&AC_FD_CC ac_qt_libraries="NO" fi rm -f conftest* CXXFLAGS="$ac_cxxflags_safe" LDFLAGS="$ac_ldflags_safe" LIBS="$ac_libs_safe" AC_LANG_RESTORE if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then ac_cv_have_qt="have_qt=no" ac_qt_notfound="" if test "$ac_qt_includes" = NO; then if test "$ac_qt_libraries" = NO; then ac_qt_notfound="(headers and libraries)"; else ac_qt_notfound="(headers)"; fi else ac_qt_notfound="(libraries)"; fi AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! For more details about this problem, look at the end of config.log.]) else have_qt="yes" fi ]) eval "$ac_cv_have_qt" if test "$have_qt" != yes; then AC_MSG_RESULT([$have_qt]); else ac_cv_have_qt="have_qt=yes \ ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT]) qt_libraries="$ac_qt_libraries" qt_includes="$ac_qt_includes" fi if test ! "$kde_qt_libs_given" = "yes"; then KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) fi AC_SUBST(qt_libraries) AC_SUBST(qt_includes) if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then QT_INCLUDES=""; else QT_INCLUDES="-I$qt_includes" all_includes="$QT_INCLUDES $all_includes" fi if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then QT_LDFLAGS="" else QT_LDFLAGS="-L$qt_libraries" all_libraries="$all_libraries $QT_LDFLAGS" fi AC_SUBST(QT_INCLUDES) AC_SUBST(QT_LDFLAGS) AC_PATH_QT_MOC_UIC LIB_QT="$kde_int_qt "'$(LIBPNG) $(LIBJPEG) -lXext $(LIB_X11) $(LIBSM)' AC_SUBST(LIB_QT) AC_SUBST(kde_qtver) ]) AC_DEFUN(AC_PATH_QT, [ AC_PATH_QT_1_3 ]) AC_DEFUN(KDE_CHECK_FINAL, [ AC_ARG_ENABLE(final, [ --enable-final build size optimized apps (experimental - needs lots of memory)], kde_use_final=$enableval, kde_use_final=no) KDE_COMPILER_REPO if test "x$kde_use_final" = "xyes"; then KDE_USE_FINAL_TRUE="" KDE_USE_FINAL_FALSE="#" else KDE_USE_FINAL_TRUE="#" KDE_USE_FINAL_FALSE="" fi AC_SUBST(KDE_USE_FINAL_TRUE) AC_SUBST(KDE_USE_FINAL_FALSE) AC_ARG_ENABLE(closure, [ --disable-closure don't delay template instantiation], kde_use_closure=$enableval, kde_use_closure=yes) if test "x$kde_use_closure" = "xyes"; then KDE_USE_CLOSURE_TRUE="" KDE_USE_CLOSURE_FALSE="#" # CXXFLAGS="$CXXFLAGS $REPO" else KDE_USE_CLOSURE_TRUE="#" KDE_USE_CLOSURE_FALSE="" fi AC_SUBST(KDE_USE_CLOSURE_TRUE) AC_SUBST(KDE_USE_CLOSURE_FALSE) ]) dnl ------------------------------------------------------------------------ dnl Now, the same with KDE dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) dnl and $(kde_includes) will be the kdehdrlocation (if needed) dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_BASE_PATH_KDE, [ AC_PREREQ([2.13]) AC_REQUIRE([AC_PATH_QT])dnl AC_CHECK_RPATH AC_MSG_CHECKING([for KDE]) if test "${prefix}" != NONE; then kde_includes=${prefix}/include ac_kde_includes=$prefix/include if test "${exec_prefix}" != NONE; then kde_libraries=${exec_prefix}/lib ac_kde_libraries=$exec_prefix/lib else kde_libraries=${prefix}/lib ac_kde_libraries=$prefix/lib fi else ac_kde_includes= ac_kde_libraries= kde_libraries="" kde_includes="" fi AC_CACHE_VAL(ac_cv_have_kde, [#try to guess kde locations if test "$kde_qtver" = 1; then kde_check_header="ksock.h" kde_check_lib="libkdecore.la" else kde_check_header="ksharedptr.h" kde_check_lib="libkio.la" fi if test -z "$1"; then kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde2/include /opt/kde/include $x_includes $qt_includes" test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" kde_incdirs="$ac_kde_includes $kde_incdirs" AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) ac_kde_includes="$kde_incdir" if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then AC_MSG_ERROR([ in the prefix, you've chosen, are no KDE headers installed. This will fail. So, check this please and use another prefix!]) fi kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde2/lib /opt/kde/lib /usr/X11R6/kde/lib" test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs" kde_libdirs="$ac_kde_libraries $kde_libdirs" AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) ac_kde_libraries="$kde_libdir" if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then AC_MSG_ERROR([ in the prefix, you've chosen, are no KDE libraries installed. This will fail. So, check this please and use another prefix!]) fi ac_kde_libraries="$kde_libdir" if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then ac_cv_have_kde="have_kde=no" else ac_cv_have_kde="have_kde=yes \ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" fi else dnl test -z $1 ac_cv_have_kde="have_kde=no" fi ])dnl eval "$ac_cv_have_kde" if test "$have_kde" != "yes"; then if test "${prefix}" = NONE; then ac_kde_prefix="$ac_default_prefix" else ac_kde_prefix="$prefix" fi if test "$exec_prefix" = NONE; then ac_kde_exec_prefix="$ac_kde_prefix" AC_MSG_RESULT([will be installed in $ac_kde_prefix]) else ac_kde_exec_prefix="$exec_prefix" AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) fi kde_libraries="${ac_kde_exec_prefix}/lib" kde_includes=${ac_kde_prefix}/include else ac_cv_have_kde="have_kde=yes \ ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) kde_libraries="$ac_kde_libraries" kde_includes="$ac_kde_includes" fi AC_SUBST(kde_libraries) AC_SUBST(kde_includes) if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then KDE_INCLUDES="" else KDE_INCLUDES="-I$kde_includes" all_includes="$KDE_INCLUDES $all_includes" fi KDE_LDFLAGS="-L$kde_libraries" if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then all_libraries="$all_libraries $KDE_LDFLAGS" fi AC_SUBST(KDE_LDFLAGS) AC_SUBST(KDE_INCLUDES) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) all_libraries="$all_libraries $USER_LDFLAGS" all_includes="$all_includes $USER_INCLUDES" AC_SUBST(all_includes) AC_SUBST(all_libraries) AC_SUBST(AUTODIRS) ]) AC_DEFUN(KDE_CHECK_EXTRA_LIBS, [ AC_MSG_CHECKING(for extra includes) AC_ARG_WITH(extra-includes, [ --with-extra-includes=DIR adds non standard include paths], kde_use_extra_includes="$withval", kde_use_extra_includes=NONE ) kde_extra_includes= if test -n "$kde_use_extra_includes" && \ test "$kde_use_extra_includes" != "NONE"; then ac_save_ifs=$IFS IFS=':' for dir in $kde_use_extra_includes; do kde_extra_includes="$kde_extra_includes $dir" USER_INCLUDES="$USER_INCLUDES -I$dir" done IFS=$ac_save_ifs kde_use_extra_includes="added" else kde_use_extra_includes="no" fi AC_SUBST(USER_INCLUDES) AC_MSG_RESULT($kde_use_extra_includes) kde_extra_libs= AC_MSG_CHECKING(for extra libs) AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR adds non standard library paths], kde_use_extra_libs=$withval, kde_use_extra_libs=NONE ) if test -n "$kde_use_extra_libs" && \ test "$kde_use_extra_libs" != "NONE"; then ac_save_ifs=$IFS IFS=':' for dir in $kde_use_extra_libs; do kde_extra_libs="$kde_extra_libs $dir" KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" USER_LDFLAGS="$USER_LDFLAGS -L$dir" done IFS=$ac_save_ifs kde_use_extra_libs="added" else kde_use_extra_libs="no" fi AC_SUBST(USER_LDFLAGS) AC_MSG_RESULT($kde_use_extra_libs) ]) AC_DEFUN(KDE_1_CHECK_PATH_HEADERS, [ AC_MSG_CHECKING([for KDE headers installed]) AC_LANG_SAVE AC_LANG_CPLUSPLUS cat > conftest.$ac_ext < #endif #include #include "confdefs.h" #include int main() { printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); printf("kde_wallpaperdir=\\"%s\\"\n", KApplication::kde_wallpaperdir().data()); printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); printf("kde_moduledir=\\"/tmp/dummy\\"\n"); return 0; } EOF ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext' if AC_TRY_EVAL(ac_compile); then AC_MSG_RESULT(yes) else AC_MSG_ERROR([your system is not able to compile a small KDE application! Check, if you installed the KDE header files correctly. For more details about this problem, look at the end of config.log.]) fi AC_LANG_RESTORE ]) AC_DEFUN(KDE_CHECK_KDEQTADDON, [ AC_MSG_CHECKING(for kde-qt-addon) AC_CACHE_VAL(kde_cv_have_kdeqtaddon, [ kde_ldflags_safe="$LDFLAGS" kde_libs_safe="$LIBS" kde_cxxflags_safe="$CXXFLAGS" LIBS="-lkde-qt-addon $LIBQT $LIBS" CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" AC_TRY_LINK([ #include ], [ QDomDocument doc; ], kde_cv_have_kdeqtaddon=yes, kde_cv_have_kdeqtaddon=no ) LDFLAGS=$kde_ldflags_safe LIBS=$kde_libs_safe kde_cxxflags_safe="$CXXFLAGS" ]) AC_MSG_RESULT($kde_cv_have_kdeqtaddon) if test "$kde_cv_have_kdeqtaddon" = "no"; then AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first. It is a separate package (and CVS module) named kde-qt-addon.]) fi ]) AC_DEFUN(KDE_CHECK_KIMGIO, [ AC_REQUIRE([AC_BASE_PATH_KDE]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_REQUIRE([AC_FIND_TIFF]) AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([AC_FIND_PNG]) AC_REQUIRE([KDE_CREATE_LIBS_ALIASES]) if test "$1" = "existance"; then AC_LANG_SAVE AC_LANG_CPLUSPLUS kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm" AC_CHECK_LIB(kimgio, kimgioRegister, [ LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no) LIBS="$kde_save_LIBS" AC_LANG_RESTORE else LIBKIMGIO_EXISTS=yes fi if test "$LIBKIMGIO_EXISTS" = "yes"; then LIB_KIMGIO='-lkimgio' else LIB_KIMGIO='' fi AC_SUBST(LIB_KIMGIO) ]) AC_DEFUN(KDE_CREATE_LIBS_ALIASES, [ AC_REQUIRE([KDE_MISC_TESTS]) AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([K_PATH_X]) if test $kde_qtver != 1; then LIB_KDECORE='-lkdecore' AC_SUBST(LIB_KDECORE) LIB_KDEUI='-lkdeui' AC_SUBST(LIB_KDEUI) LIB_KFORMULA='-lkformula' AC_SUBST(LIB_KFORMULA) LIB_KIO='-lkio' AC_SUBST(LIB_KIO) LIB_KSYCOCA='-lksycoca' AC_SUBST(LIB_KSYCOCA) LIB_SMB='-lsmb' AC_SUBST(LIB_SMB) LIB_KFILE='-lkfile' AC_SUBST(LIB_KFILE) LIB_KAB='-lkab' AC_SUBST(LIB_KAB) LIB_KHTML='-lkhtml' AC_SUBST(LIB_KHTML) LIB_KSPELL='-lkspell' AC_SUBST(LIB_KSPELL) LIB_KPARTS='-lkparts' AC_SUBST(LIB_KPARTS) LIB_KWRITE='-lkwrite' AC_SUBST(LIB_KWRITE) else LIB_KDECORE='-lkdecore -lXext $(LIB_QT)' AC_SUBST(LIB_KDECORE) LIB_KDEUI='-lkdeui $(LIB_KDECORE)' AC_SUBST(LIB_KDEUI) LIB_KFM='-lkfm $(LIB_KDECORE)' AC_SUBST(LIB_KFM) LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)' AC_SUBST(LIB_KFILE) LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)' AC_SUBST(LIB_KAB) fi ]) AC_DEFUN(AC_PATH_KDE, [ AC_BASE_PATH_KDE AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install], [ if test "$enableval" = "no"; then ac_use_path_checking="default" else ac_use_path_checking="" fi ], [ if test "$kde_qtver" = 1; then ac_use_path_checking="" else ac_use_path_checking="default" fi ] ) AC_CREATE_KFSSTND($ac_use_path_checking) AC_SUBST_KFSSTND KDE_CREATE_LIBS_ALIASES ]) dnl obsolete AC_DEFUN(AC_CHECK_SETENV, [ AC_OBSOLETE([$0], [; instead use AC_CHECK_FUNCS([setenv unsetenv])])dnl AC_CHECK_FUNCS([setenv unsetenv]) ]) AC_DEFUN(AC_CHECK_GETDOMAINNAME, [ AC_MSG_CHECKING(for getdomainname) AC_CACHE_VAL(ac_cv_func_getdomainname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS save_CXXFLAGS="$CXXFLAGS" kde_safe_LIBS="$LIBS" LIBS="$LIBS $X_EXTRA_LIBS" if test "$GCC" = "yes"; then CXXFLAGS="$CXXFLAGS -pedantic-errors" fi AC_TRY_COMPILE([ #include #include ], [ char buffer[200]; getdomainname(buffer, 200); ], ac_cv_func_getdomainname=yes, ac_cv_func_getdomainname=no) CXXFLAGS="$save_CXXFLAGS" LIBS=$kde_safe_LIBS AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_getdomainname) AC_MSG_CHECKING([if getdomainname needs custom prototype]) AC_CACHE_VAL(ac_cv_proto_getdomainname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then ac_cv_proto_getdomainname=no else kde_safe_libs=$LIBS LIBS="$LIBS $X_EXTRA_LIBS" AC_TRY_LINK([ #include #include extern "C" int getdomainname (char *, int); ], [ char buffer[200]; getdomainname(buffer, 200); ], ac_cv_func_getdomainname=yes ac_cv_proto_getdomainname=yes, AC_MSG_RESULT([fatal error]) AC_MSG_ERROR([getdomainname unavailable])) fi LIBS=$kde_safe_libs AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_proto_getdomainname) if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname]) fi if eval "test \"`echo $ac_cv_proto_getdomainname`\" = no"; then AC_DEFINE(HAVE_GETDOMAINNAME_PROTO, 1, [Define if you have getdomainname prototype]) fi ]) AC_DEFUN(AC_CHECK_GETHOSTNAME, [ AC_MSG_CHECKING([for gethostname]) AC_CACHE_VAL(ac_cv_func_gethostname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS save_CXXFLAGS="$CXXFLAGS" if test "$GCC" = "yes"; then CXXFLAGS="$CXXFLAGS -pedantic-errors" fi AC_TRY_LINK([ #include #include ], [ char buffer[200]; gethostname(buffer, 200); ], ac_cv_func_gethostname=yes, ac_cv_func_gethostname=no) CXXFLAGS="$save_CXXFLAGS" AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_gethostname) AC_MSG_CHECKING([if gethostname needs custom prototype]) AC_CACHE_VAL(ac_cv_proto_gethostname, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then ac_cv_proto_gethostname=no else AC_TRY_LINK([ #include #include extern "C" int gethostname (char *, int); ], [ char buffer[200]; gethostname(buffer, 200); ], ac_cv_func_gethostname=yes ac_cv_proto_gethostname=yes, AC_MSG_RESULT([fatal error]) AC_MSG_ERROR(gethostname unavailable)) fi AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_proto_gethostname) if eval "test \"`echo $ac_cv_proto_gethostname`\" = no"; then AC_DEFINE(HAVE_GETHOSTNAME_PROTO, 1, [Define if you have gethostname prototype]) fi if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have gethostname]) fi ]) AC_DEFUN(AC_CHECK_USLEEP, [ AC_MSG_CHECKING([for usleep]) AC_CACHE_VAL(ac_cv_func_usleep, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_libs_safe="$LIBS" LIBS="$LIBS $LIBUCB" AC_TRY_LINK([ #include #include ], [ usleep(200); ], ac_cv_func_usleep=yes, ac_cv_func_usleep=no) LIBS="$ac_libs_safe" AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_usleep) if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function]) fi ]) AC_DEFUN(AC_CHECK_RANDOM, [ AC_MSG_CHECKING([for random]) AC_CACHE_VAL(ac_cv_func_random, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_libs_safe="$LIBS" LIBS="$LIBS $LIBUCB" AC_TRY_LINK([ #include ], [ random(); ], ac_cv_func_random=yes, ac_cv_func_random=no) LIBS="$ac_libs_safe" AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_func_random) if eval "test \"`echo $ac_cv_func_random`\" = yes"; then AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random]) fi ]) AC_DEFUN(AC_FIND_GIF, [AC_MSG_CHECKING([for giflib]) AC_CACHE_VAL(ac_cv_lib_gif, [ac_save_LIBS="$LIBS" LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" AC_TRY_LINK(dnl [ #ifdef __cplusplus extern "C" { #endif int GifLastError(void); #ifdef __cplusplus } #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ], [return GifLastError();], eval "ac_cv_lib_gif=yes", eval "ac_cv_lib_gif=no") LIBS="$ac_save_LIBS" ])dnl if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) else AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) fi ]) AC_DEFUN(KDE_FIND_JPEG_HELPER, [ AC_MSG_CHECKING([for libjpeg$2]) AC_CACHE_VAL(ac_cv_lib_jpeg_$1, [ AC_LANG_C ac_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" AC_TRY_LINK( [/* Override any gcc2 internal prototype to avoid an error. */ struct jpeg_decompress_struct; typedef struct jpeg_decompress_struct * j_decompress_ptr; typedef int size_t; #ifdef __cplusplus extern "C" { #endif void jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, size_t structsize); #ifdef __cplusplus } #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ ], [jpeg_CreateDecompress(0L, 0, 0);], eval "ac_cv_lib_jpeg_$1=-ljpeg$2", eval "ac_cv_lib_jpeg_$1=no") LIBS="$ac_save_LIBS" CFLAGS="$ac_save_CFLAGS" ]) if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then LIBJPEG="$ac_cv_lib_jpeg_$1" AC_MSG_RESULT($ac_cv_lib_jpeg_$1) else AC_MSG_RESULT(no) $3 fi ]) AC_DEFUN(AC_FIND_JPEG, [ dnl first look for libraries KDE_FIND_JPEG_HELPER(6b, 6b, KDE_FIND_JPEG_HELPER(normal, [], [ LIBJPEG= ] ) ) dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h dnl requires system dependent includes loaded before it) jpeg_incdirs="/usr/include /usr/local/include $kde_extra_includes" AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir) test "x$jpeg_incdir" = xNO && jpeg_incdir= dnl if headers _and_ libraries are missing, this is no error, and we dnl continue with a warning (the user will get no jpeg support in khtml) dnl if only one is missing, it means a configuration error, but we still dnl only warn if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) else if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then AC_MSG_WARN([ There is an installation error in jpeg support. You seem to have only one of either the headers _or_ the libraries installed. You may need to either provide correct --with-extra-... options, or the development package of libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ Disabling JPEG support. ]) else AC_MSG_WARN([libjpeg not found. disable JPEG support.]) fi jpeg_incdir= LIBJPEG= fi AC_SUBST(LIBJPEG) ]) AC_DEFUN(AC_FIND_ZLIB, [ AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_MSG_CHECKING([for libz]) AC_CACHE_VAL(ac_cv_lib_z, [ AC_LANG_C kde_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" kde_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" AC_TRY_LINK(dnl [ #include ], [return (zlibVersion() == ZLIB_VERSION); ], eval "ac_cv_lib_z='-lz'", eval "ac_cv_lib_z=no") LIBS="$kde_save_LIBS" CFLAGS="$kde_save_CFLAGS" ])dnl if test ! "$ac_cv_lib_z" = no; then AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) LIBZ="$ac_cv_lib_z" AC_SUBST(LIBZ) AC_MSG_RESULT($ac_cv_lib_z) else AC_MSG_ERROR(not found. Check your installation and look into config.log) LIBZ="" AC_SUBST(LIBZ) fi ]) AC_DEFUN(KDE_TRY_TIFFLIB, [ AC_MSG_CHECKING([for libtiff $1]) AC_CACHE_VAL(kde_cv_libtiff_$1, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS kde_save_LIBS="$LIBS" LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" kde_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" AC_TRY_LINK(dnl [ #include ], [return (TIFFOpen( "", "r") == 0); ], [ kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" ], [ kde_cv_libtiff_$1=no ]) LIBS="$kde_save_LIBS" CXXFLAGS="$kde_save_CXXFLAGS" AC_LANG_RESTORE ]) if test "$kde_cv_libtiff_$1" = "no"; then AC_MSG_RESULT(no) LIBTIFF="" $3 else LIBTIFF="$kde_cv_libtiff_$1" AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) $2 fi ]) AC_DEFUN(AC_FIND_TIFF, [ AC_REQUIRE([K_PATH_X]) AC_REQUIRE([AC_FIND_ZLIB]) AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) KDE_TRY_TIFFLIB(tiff, [], KDE_TRY_TIFFLIB(tiff34)) AC_SUBST(LIBTIFF) ]) AC_DEFUN(AC_FIND_PNG, [ AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_REQUIRE([AC_FIND_ZLIB]) AC_MSG_CHECKING([for libpng]) AC_CACHE_VAL(ac_cv_lib_png, [ kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" kde_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" AC_LANG_C AC_TRY_LINK(dnl [ #include ], [ png_structp png_ptr = png_create_read_struct( /* image ptr */ PNG_LIBPNG_VER_STRING, 0, 0, 0 ); return( png_ptr != 0 ); ], eval "ac_cv_lib_png='-lpng $LIBZ -lm'", eval "ac_cv_lib_png=no" ) LIBS="$kde_save_LIBS" CFLAGS="$kde_save_CFLAGS" ])dnl if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) LIBPNG="$ac_cv_lib_png" AC_SUBST(LIBPNG) AC_MSG_RESULT($ac_cv_lib_png) else AC_MSG_RESULT(no) LIBPNG="" AC_SUBST(LIBPNG) fi ]) AC_DEFUN(AC_CHECK_BOOL, [ AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool]) ]) AC_DEFUN(AC_CHECK_GNU_EXTENSIONS, [ AC_MSG_CHECKING(if you need GNU extensions) AC_CACHE_VAL(ac_cv_gnu_extensions, [ cat > conftest.c << EOF #include #ifdef __GNU_LIBRARY__ yes #endif EOF if (eval "$ac_cpp conftest.c") 2>&5 | egrep "yes" >/dev/null 2>&1; then rm -rf conftest* ac_cv_gnu_extensions=yes else ac_cv_gnu_extensions=no fi ]) AC_MSG_RESULT($ac_cv_gnu_extensions) if test "$ac_cv_gnu_extensions" = "yes"; then AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) fi ]) AC_DEFUN(KDE_CHECK_COMPILER_FLAG, [ dnl AC_REQUIRE([AC_CHECK_COMPILERS]) <- breaks with autoconf 2.50 AC_MSG_CHECKING(whether $CXX supports -$1) kde_cache=`echo $1 | sed 'y%.=/+-%___p_%'` AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, [ echo 'int main() { return 0; }' >conftest.cc eval "kde_cv_prog_cxx_$kde_cache=no" if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then if test -z "`$CXX -$1 -o conftest conftest.o 2>&1`"; then eval "kde_cv_prog_cxx_$kde_cache=yes" fi fi rm -f conftest* ]) if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then AC_MSG_RESULT(yes) : $2 else AC_MSG_RESULT(no) : $3 fi ]) dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever]) dnl it's all white-space separated AC_DEFUN(AC_REMOVE_FORBIDDEN, [ __val=$$1 __forbid=" $2 " if test -n "$__val"; then __new="" ac_save_IFS=$IFS IFS=" " for i in $__val; do case "$__forbid" in *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;; *) # Careful to not add spaces, where there were none, because otherwise # libtool gets confused, if we change e.g. CXX if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; esac done IFS=$ac_save_IFS $1=$__new fi ]) dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given AC_DEFUN(AC_VALIDIFY_CXXFLAGS, [dnl AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath]) AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath]) ]) AC_DEFUN(AC_CHECK_COMPILERS, [ AC_ARG_ENABLE(debug,[ --enable-debug enables debug symbols [default=no]], [ if test $enableval = "no"; dnl then kde_use_debug_code="no" kde_use_debug_define=yes else kde_use_debug_code="yes" kde_use_debug_define=no fi ], [kde_use_debug_code="no" kde_use_debug_define=no ]) dnl Just for configure --help AC_ARG_ENABLE(dummyoption,[ --disable-debug disables debug output and debug symbols [default=no]],[],[]) AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)], [ if test $enableval = "no"; then kde_use_strict_options="no" else kde_use_strict_options="yes" fi ], [kde_use_strict_options="no"]) AC_ARG_ENABLE(profile,[ --enable-profile creates profiling infos [default=no]], [kde_use_profiling=$enableval], [kde_use_profiling="no"] ) dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS CFLAGS=" $CFLAGS" AC_PROG_CC if test "$GCC" = "yes"; then if test "$kde_use_debug_code" = "yes"; then CFLAGS="-g -O2 $CFLAGS" case $host in *-*-linux-gnu) CFLAGS="-ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" ;; esac else CFLAGS="-O2 $CFLAGS" fi fi if test "$kde_use_debug_define" = "yes"; then CFLAGS="-DNDEBUG $CFLAGS" fi case "$host" in *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; esac if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then LDFLAGS="" fi CXXFLAGS=" $CXXFLAGS" AC_PROG_CXX if test "$GXX" = "yes"; then if test "$kde_use_debug_code" = "yes"; then CXXFLAGS="-g -O2 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS" KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"]) KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"]) KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"]) case $host in dnl *-*-linux-gnu) CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wbad-function-cast -Wcast-align -Wundef -Wconversion $CXXFLAGS" ;; esac if test "$kde_use_strict_options" = "yes"; then CXXFLAGS="-Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align $CXXFLAGS" fi if test "$kde_very_strict" = "yes"; then CXXFLAGS="-Wold-style-cast -Wredundant-decls -Wconversion $CXXFLAGS" fi else CXXFLAGS="-O2 $CXXFLAGS" fi fi if test "$kde_use_debug_define" = "yes"; then CXXFLAGS="-DNDEBUG $CXXFLAGS" fi if test "$kde_use_profiling" = "yes"; then KDE_CHECK_COMPILER_FLAG(pg, [ CFLAGS="-pg $CFLAGS" CXXFLAGS="-pg $CXXFLAGS" ]) fi KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"]) KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"]) KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= ) AC_SUBST(USE_EXCEPTIONS) dnl obsolete macro - provided to keep things going USE_RTTI= AC_SUBST(USE_RTTI) case "$host" in *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; *-*-solaris*) if test "$GXX" = yes; then libstdcpp=`$CXX -print-file-name=libstdc++.so` if test ! -f $libstdcpp; then AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so]) fi fi ;; esac AC_VALIDIFY_CXXFLAGS AC_PROG_CXXCPP # the following is to allow programs, that are known to # have problems when compiled with -O2 if test -n "$CXXFLAGS"; then kde_safe_IFS=$IFS IFS=" " NOOPT_CXXFLAGS="" for i in $CXXFLAGS; do case $i in -O*) ;; *) NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i" ;; esac done IFS=$kde_safe_IFS fi AC_SUBST(NOOPT_CXXFLAGS) KDE_CHECK_FINAL ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) KDE_CXXFLAGS= AC_SUBST(KDE_CXXFLAGS) ]) AC_DEFUN(KDE_ADD_DEPENDENCIES, [ [A]M_DEPENDENCIES(CC) [A]M_DEPENDENCIES(CXX) ]) dnl just a wrapper to clean up configure.in AC_DEFUN(KDE_PROG_LIBTOOL, [ AC_REQUIRE([AC_CHECK_COMPILERS]) AC_REQUIRE([AC_ENABLE_SHARED]) AC_REQUIRE([AC_ENABLE_STATIC]) AC_REQUIRE([AC_LIBTOOL_DLOPEN]) AC_LANG_SAVE AC_LANG_C AC_OBJEXT AC_EXEEXT AC_LANG_RESTORE AM_PROG_LIBTOOL AC_LIBTOOL_CXX LIBTOOL_SHELL="/bin/sh ./libtool" # LIBTOOL="$LIBTOOL --silent" KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_RPATH)" AC_SUBST(KDE_PLUGIN) AC_ARG_ENABLE(objprelink, [ --enable-objprelink prelink apps using objprelink (experimental [only tested on linux/386])], kde_use_objprelink=$enableval, kde_use_objprelink=no) if test "x$kde_use_objprelink" = "xyes"; then KDE_FIND_PATH(objprelink, OBJPRELINK, [], [kde_use_objprelink=no]) if test "x$kde_use_objprelink" = "xyes"; then AC_MSG_CHECKING([Patching libtool to run objprelink.]) mv libtool libtool.orig cat > libtool <<\EOF #! /bin/sh for n ; do case $n in *.o) test -r $n && echo objprelink $n && objprelink $n ;; *.lo) m=`basename $n .lo`".o" && test -r $m && echo objprelink $m && objprelink $m m=".libs/$m" && test -r $m && echo objprelink $m && objprelink $m ;; esac; done EOF cat >> libtool libtool.orig rm libtool.orig chmod a+x libtool AC_MSG_RESULT(done) fi fi ]) AC_DEFUN(KDE_CHECK_TYPES, [ AC_CHECK_SIZEOF(int, 4)dnl AC_CHECK_SIZEOF(long, 4)dnl AC_CHECK_SIZEOF(char *, 4)dnl AC_CHECK_SIZEOF(char, 1)dnl ])dnl AC_DEFUN(KDE_DO_IT_ALL, [ AC_CANONICAL_SYSTEM AC_ARG_PROGRAM AM_INIT_AUTOMAKE($1, $2) AM_DISABLE_LIBRARIES AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) AC_CHECK_COMPILERS KDE_PROG_LIBTOOL AM_KDE_WITH_NLS AC_PATH_KDE ]) AC_DEFUN(AC_CHECK_RPATH, [ AC_MSG_CHECKING(for rpath) AC_ARG_ENABLE(rpath, [ --disable-rpath do not use the rpath feature of ld], USE_RPATH=$enableval, USE_RPATH=yes) if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then KDE_RPATH="-R \$(kde_libraries)" if test -n "$qt_libraries"; then KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" fi dnl $x_libraries is set to /usr/lib in case if test -n "$X_LDFLAGS"; then KDE_RPATH="$KDE_RPATH -R \$(x_libraries)" fi if test -n "$KDE_EXTRA_RPATH"; then KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" fi fi AC_SUBST(KDE_EXTRA_RPATH) AC_SUBST(KDE_RPATH) AC_MSG_RESULT($USE_RPATH) ]) dnl Check for the type of the third argument of getsockname AC_DEFUN(AC_CHECK_SOCKLEN_T, [ AC_MSG_CHECKING(for socklen_t) AC_CACHE_VAL(ac_cv_socklen_t, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ #include #include ],[ socklen_t a=0; getsockname(0,(struct sockaddr*)0, &a); ], ac_cv_socklen_t=socklen_t, AC_TRY_COMPILE([ #include #include ],[ int a=0; getsockname(0,(struct sockaddr*)0, &a); ], ac_cv_socklen_t=int, ac_cv_socklen_t=size_t ) ) AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_socklen_t) if test "$ac_cv_socklen_t" != "socklen_t"; then AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t, [Define the real type of socklen_t]) fi AC_DEFINE_UNQUOTED(ksize_t, socklen_t, [Compatibility define]) ]) dnl This is a merge of some macros out of the gettext aclocal.m4 dnl since we don't need anything, I took the things we need dnl the copyright for them is: dnl > dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. dnl This Makefile.in is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. dnl > dnl for this file it is relicensed under LGPL AC_DEFUN(AM_KDE_WITH_NLS, [ dnl If we use NLS figure out what method AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) GMSGFMT=":" fi MSGFMT=$GMSGFMT AC_SUBST(GMSGFMT) AC_SUBST(MSGFMT) AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) dnl Test whether we really found GNU xgettext. if test "$XGETTEXT" != ":"; then dnl If it is no GNU xgettext we define it as : so that the dnl Makefiles still can work. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else AC_MSG_RESULT( [found xgettext programs is not GNU xgettext; ignore it]) XGETTEXT=":" fi fi AC_SUBST(XGETTEXT) ]) # Search path for a program which passes the given test. # Ulrich Drepper , 1996. # serial 1 # Stephan Kulow: I appended a _KDE against name conflicts dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE, [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in /*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in ifelse([$5], , $PATH, [$5]); do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test -n "[$]$1"; then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) # Check whether LC_MESSAGES is available in . # Ulrich Drepper , 1995. # serial 1 AC_DEFUN(AM_LC_MESSAGES, [if test $ac_cv_header_locale_h = yes; then AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) if test $am_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES]) fi fi]) dnl From Jim Meyering. dnl FIXME: migrate into libit. AC_DEFUN([AM_FUNC_OBSTACK], [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, [AC_TRY_LINK([#include "obstack.h"], [struct obstack *mem;obstack_free(mem,(char *) 0)], am_cv_func_obstack=yes, am_cv_func_obstack=no)]) if test $am_cv_func_obstack = yes; then AC_DEFINE(HAVE_OBSTACK) else LIBOBJS="$LIBOBJS obstack.o" fi ]) dnl From Jim Meyering. Use this if you use the GNU error.[ch]. dnl FIXME: Migrate into libit AC_DEFUN([AM_FUNC_ERROR_AT_LINE], [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], am_cv_lib_error_at_line=yes, am_cv_lib_error_at_line=no)]) if test $am_cv_lib_error_at_line = no; then LIBOBJS="$LIBOBJS error.o" fi AC_SUBST(LIBOBJS)dnl ]) # Macro to add for using GNU gettext. # Ulrich Drepper , 1995. # serial 1 # Stephan Kulow: I put a KDE in it to avoid name conflicts AC_DEFUN(AM_KDE_GNU_GETTEXT, [AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_TYPE_OFF_T])dnl AC_REQUIRE([AC_TYPE_SIZE_T])dnl AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl AC_REQUIRE([AM_KDE_WITH_NLS])dnl AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h string.h values.h alloca.h]) AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ __argz_count __argz_stringify __argz_next]) AC_MSG_CHECKING(for stpcpy) AC_CACHE_VAL(kde_cv_func_stpcpy, [ kde_safe_cxxflags=$CXXFLAGS CXXFLAGS="-Wmissing-prototypes -Werror" AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ #include ], [ char buffer[200]; stpcpy(buffer, buffer); ], kde_cv_func_stpcpy=yes, kde_cv_func_stpcpy=no) AC_LANG_RESTORE CXXFLAGS=$kde_safe_cxxflags ]) AC_MSG_RESULT($kde_cv_func_stpcpy) if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) fi AM_LC_MESSAGES if test "x$CATOBJEXT" != "x"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else AC_MSG_CHECKING(for catalogs to be installed) NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; esac done LINGUAS=$NEW_LINGUAS AC_MSG_RESULT($LINGUAS) fi dnl Construct list of names of catalog files to be constructed. if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi fi ]) AC_DEFUN(AC_HAVE_XPM, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= test -z "$XPM_INCLUDE" && XPM_INCLUDE= AC_ARG_WITH(xpm, [ --without-xpm disable color pixmap XPM tests], xpm_test=$withval, xpm_test="yes") if test "x$xpm_test" = xno; then ac_cv_have_xpm=no else AC_MSG_CHECKING(for XPM) AC_CACHE_VAL(ac_cv_have_xpm, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES" test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" AC_TRY_LINK([#include ],[], ac_cv_have_xpm="yes",ac_cv_have_xpm="no") LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" ])dnl if test "$ac_cv_have_xpm" = no; then AC_MSG_RESULT(no) XPM_LDFLAGS="" XPMINC="" $2 else AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) if test "$XPM_LDFLAGS" = ""; then XPMLIB='-lXpm $(LIB_X11)' else XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' fi if test "$XPM_INCLUDE" = ""; then XPMINC="" else XPMINC="-I$XPM_INCLUDE" fi AC_MSG_RESULT(yes) $1 fi fi AC_SUBST(XPMINC) AC_SUBST(XPMLIB) ]) AC_DEFUN(AC_HAVE_DPMS, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= DPMS_LIB= AC_ARG_WITH(dpms, [ --without-dpms disable DPMS power saving], dpms_test=$withval, dpms_test="yes") if test "x$dpms_test" = xno; then ac_cv_have_dpms=no else AC_MSG_CHECKING(for DPMS) dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms. dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms". AC_CACHE_VAL(ac_cv_have_dpms, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" ac_save_libs="$LIBS" LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES" test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" AC_TRY_LINK([ #include #include #include #include int foo_test_dpms() { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], ac_cv_have_dpms="yes", [ LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" LIBS="$LIBS -lXdpms" CFLAGS="$CFLAGS $X_INCLUDES" test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" AC_TRY_LINK([ #include #include #include #include int foo_test_dpms() { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], [ ac_cv_have_dpms="-lXdpms" ],ac_cv_have_dpms="no") ]) LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" LIBS="$ac_save_libs" ])dnl if test "$ac_cv_have_dpms" = no; then AC_MSG_RESULT(no) DPMS_LDFLAGS="" DPMSINC="" $2 else AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) if test "$ac_cv_have_dpms" = "-lXdpms"; then DPMS_LIB="-lXdpms" fi if test "$DPMS_LDFLAGS" = ""; then DPMSLIB="$DPMS_LIB "'$(LIB_X11)' else DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)' fi if test "$DPMS_INCLUDE" = ""; then DPMSINC="" else DPMSINC="-I$DPMS_INCLUDE" fi AC_MSG_RESULT(yes) $1 fi fi AC_SUBST(DPMSINC) AC_SUBST(DPMSLIB) ]) AC_DEFUN(AC_HAVE_GL, [AC_REQUIRE_CPP()dnl AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) test -z "$GL_LDFLAGS" && GL_LDFLAGS= test -z "$GL_INCLUDE" && GL_INCLUDE= AC_ARG_WITH(gl, [ --without-gl disable 3D GL modes], gl_test=$withval, gl_test="yes") if test "x$gl_test" = xno; then ac_cv_have_gl=no else AC_MSG_CHECKING(for GL) AC_CACHE_VAL(ac_cv_have_gl, [ AC_LANG_C ac_save_ldflags="$LDFLAGS" ac_save_cflags="$CFLAGS" LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET" CFLAGS="$CFLAGS $X_INCLUDES" test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" AC_TRY_LINK([#include #include ], [], ac_cv_have_gl="mesa", ac_cv_have_gl="no") if test "x$ac_cv_have_gl" = "xno"; then LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGL -lGLU -lX11 -lXext -lm $LIBSOCKET" CFLAGS="$ac_save_cflags $X_INCLUDES" test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" AC_TRY_LINK([#include #include ], [], ac_cv_have_gl="yes", ac_cv_have_gl="no") fi LDFLAGS="$ac_save_ldflags" CFLAGS="$ac_save_cflags" ])dnl if test "$ac_cv_have_gl" = "no"; then AC_MSG_RESULT(no) GL_LDFLAGS="" GLINC="" $2 else AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) if test "$GL_LDFLAGS" = ""; then if test "$ac_cv_have_gl" = "mesa"; then GLLIB='-lMesaGL -lMesaGLU $(LIB_X11)' else GLLIB='-lGL -lGLU $(LIB_X11)' fi else if test "$ac_cv_have_gl" = "mesa"; then GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU "'$(LIB_X11)' else GLLIB="$GL_LDFLAGS -lGL -lGLU "'$(LIB_X11)' fi fi if test "$GL_INCLUDE" = ""; then GLINC="" else GLINC="-I$GL_INCLUDE" fi AC_MSG_RESULT($ac_cv_have_gl) $1 fi fi AC_SUBST(GLINC) AC_SUBST(GLLIB) ]) dnl shadow password and PAM magic - maintained by ossi@kde.org AC_DEFUN(KDE_PAM, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_ARG_WITH(pam, [ --with-pam[=ARG] enable support for PAM: ARG=[yes|no|service name]], [ if test "x$withval" = "xyes"; then use_pam=yes pam_service=kde elif test "x$withval" = "xno"; then use_pam=no else use_pam=yes pam_service=$withval fi ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" ], [ AC_CACHE_VAL(ac_cv_path_pam, [ use_pam=no AC_CHECK_LIB(pam, pam_start, [ AC_CHECK_HEADER(security/pam_appl.h, [ use_pam=yes pam_service=kde ]) ], , $LIBDL) ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" ]) ]) eval "$ac_cv_path_pam" AC_MSG_CHECKING(for PAM) if test "x$use_pam" = xno; then AC_MSG_RESULT(no) PAMLIBS="" else AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)]) PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL" dnl test whether struct pam_message is const (Linux) or not (Sun) AC_MSG_CHECKING(for const pam_message) AC_EGREP_HEADER([struct pam_message], security/pam_appl.h, [ AC_EGREP_HEADER([const struct pam_message], security/pam_appl.h, [AC_MSG_RESULT([const: Linux-type PAM])], [AC_MSG_RESULT([nonconst: Sun-type PAM]) AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] )], [AC_MSG_RESULT([not found - assume const, Linux-type PAM])]) fi AC_SUBST(PAMLIBS) ]) dnl DEF_PAM_SERVICE(arg name, full name, define name) AC_DEFUN(DEF_PAM_SERVICE, [ AC_ARG_WITH($1-pam, [ --with-$1-pam=[val] override PAM service from --with-pam for $2], [ if test "x$use_pam" = xyes; then $3_PAM_SERVICE="$withval" else AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected. You may want to enforce it by using --with-pam.]) fi ], [ if test "x$use_pam" = xyes; then $3_PAM_SERVICE="$pam_service" fi ]) if test -n "$$3_PAM_SERVICE"; then AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE]) AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2]) fi AC_SUBST($3_PAM_SERVICE) ]) AC_DEFUN(KDE_SHADOWPASSWD, [ AC_REQUIRE([KDE_PAM]) AC_CHECK_LIB(shadow, getspent, [ LIBSHADOW="-lshadow" ac_use_shadow=yes ], [ dnl for UnixWare AC_CHECK_LIB(gen, getspent, [ LIBGEN="-lgen" ac_use_shadow=yes ], [ AC_CHECK_FUNC(getspent, [ ac_use_shadow=yes ], [ ac_use_shadow=no ]) ]) ]) AC_SUBST(LIBSHADOW) AC_SUBST(LIBGEN) AC_MSG_CHECKING([for shadow passwords]) AC_ARG_WITH(shadow, [ --with-shadow If you want shadow password support ], [ if test "x$withval" != "xno"; then use_shadow=yes else use_shadow=no fi ], [ use_shadow="$ac_use_shadow" ]) if test "x$use_shadow" = xyes; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords]) else AC_MSG_RESULT(no) LIBSHADOW= LIBGEN= fi dnl finally make the relevant binaries setuid root, if we have shadow passwds. dnl this still applies, if we could use it indirectly through pam. if test "x$use_shadow" = xyes || ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then case $host in *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) SETUIDFLAGS="-m 4755 -o root";; *) SETUIDFLAGS="-m 4755";; esac fi AC_SUBST(SETUIDFLAGS) ]) AC_DEFUN(KDE_PASSWDLIBS, [ AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT AC_REQUIRE([KDE_PAM]) AC_REQUIRE([KDE_SHADOWPASSWD]) if test "x$use_pam" = "xyes"; then PASSWDLIBS="$PAMLIBS" else PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN" fi AC_SUBST(PASSWDLIBS) ]) AC_DEFUN(KDE_CHECK_LIBDL, [ AC_CHECK_LIB(dl, dlopen, [ LIBDL="-ldl" ac_cv_have_dlfcn=yes ]) AC_CHECK_LIB(dld, shl_unload, [ LIBDL="-ldld" ac_cv_have_shload=yes ]) AC_SUBST(LIBDL) ]) AC_DEFUN(KDE_CHECK_DLOPEN, [ KDE_CHECK_LIBDL AC_CHECK_HEADERS(dlfcn.h dl.h) if test "$ac_cv_header_dlfcn_h" = "no"; then ac_cv_have_dlfcn=no fi if test "$ac_cv_header_dl_h" = "no"; then ac_cv_have_shload=no fi dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE dnl (MM) AC_ARG_ENABLE(dlopen, [ --disable-dlopen link statically [default=no]] , enable_dlopen=$enableval, enable_dlopen=yes) # override the user's opinion, if we know it better ;) if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then enable_dlopen=no fi if test "$ac_cv_have_dlfcn" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) fi if test "$ac_cv_have_shload" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) fi if test "$enable_dlopen" = no ; then test -n "$1" && eval $1 else test -n "$2" && eval $2 fi ]) AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING, [ KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) KDE_PROG_LIBTOOL AC_MSG_CHECKING([dynamic loading]) eval "`egrep '^build_libtool_libs=' libtool`" if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then dynamic_loading=yes AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) else dynamic_loading=no fi AC_MSG_RESULT($dynamic_loading) if test "$dynamic_loading" = "yes"; then $1 else $2 fi ]) AC_DEFUN(KDE_ADD_INCLUDES, [ if test -z "$1"; then test_include="Pix.h" else test_include="$1" fi AC_MSG_CHECKING([for libg++ ($test_include)]) AC_CACHE_VAL(kde_cv_libgpp_includes, [ kde_cv_libgpp_includes=no for ac_dir in \ \ /usr/include/g++ \ /usr/include \ /usr/unsupported/include \ /opt/include \ $extra_include \ ; \ do if test -r "$ac_dir/$test_include"; then kde_cv_libgpp_includes=$ac_dir break fi done ]) AC_MSG_RESULT($kde_cv_libgpp_includes) if test "$kde_cv_libgpp_includes" != "no"; then all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES" fi ]) ]) AC_DEFUN(KDE_CHECK_MICO, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([KDE_MISC_TESTS]) AC_MSG_CHECKING(for MICO) if test -z "$MICODIR"; then kde_micodir=/usr/local else kde_micodir="$MICODIR" fi AC_ARG_WITH(micodir, [ --with-micodir=micodir where mico is installed ], kde_micodir=$withval, kde_micodir=$kde_micodir ) AC_CACHE_VAL(kde_cv_mico_incdir, [ mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes" AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir) ]) kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'` if test ! -r $kde_micodir/include/CORBA.h; then AC_MSG_ERROR([No CORBA.h found, specify another micodir]) fi AC_MSG_RESULT($kde_micodir) MICO_INCLUDES=-I$kde_micodir/include AC_SUBST(MICO_INCLUDES) MICO_LDFLAGS=-L$kde_micodir/lib AC_SUBST(MICO_LDFLAGS) micodir=$kde_micodir AC_SUBST(micodir) AC_MSG_CHECKING([for MICO version]) AC_CACHE_VAL(kde_cv_mico_version, [ AC_LANG_C cat >conftest.$ac_ext < #include int main() { printf("MICO_VERSION=%s\n",MICO_VERSION); return (0); } EOF ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest' if AC_TRY_EVAL(ac_compile); then if eval `./conftest 2>&5`; then kde_cv_mico_version=$MICO_VERSION else AC_MSG_ERROR([your system is not able to execute a small application to find MICO version! Check $kde_micodir/include/mico/version.h]) fi else AC_MSG_ERROR([your system is not able to compile a small application to find MICO version! Check $kde_micodir/include/mico/version.h]) fi ]) dnl installed MICO version mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` if test "x$1" = "x"; then req_version="2.3.0" else req_version=$1 fi dnl required MICO version req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` if test "$mico_v_maj" -lt "$req_v_maj" || \ ( test "$mico_v_maj" -eq "$req_v_maj" && \ test "$mico_v_mid" -lt "$req_v_mid" ) || \ ( test "$mico_v_mid" -eq "$req_v_mid" && \ test "$mico_v_min" -lt "$req_v_min" ) then AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \ at least is required. You should upgrade MICO.]) else AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)]) fi LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL" AC_SUBST(LIBMICO) if test -z "$IDL"; then IDL='$(kde_bindir)/cuteidl' fi AC_SUBST(IDL) IDL_DEPENDENCIES='$(kde_includes)/CUTE.h' AC_SUBST(IDL_DEPENDENCIES) idldir="\$(includedir)/idl" AC_SUBST(idldir) ]) AC_DEFUN(KDE_CHECK_MINI_STL, [ AC_REQUIRE([KDE_CHECK_MICO]) AC_MSG_CHECKING(if we use mico's mini-STL) AC_CACHE_VAL(kde_cv_have_mini_stl, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS kde_save_cxxflags="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $MICO_INCLUDES" AC_TRY_COMPILE( [ #include ], [ #ifdef HAVE_MINI_STL #error "nothing" #endif ], kde_cv_have_mini_stl=no, kde_cv_have_mini_stl=yes) CXXFLAGS="$kde_save_cxxflags" AC_LANG_RESTORE ]) if test "x$kde_cv_have_mini_stl" = "xyes"; then AC_MSG_RESULT(yes) $1 else AC_MSG_RESULT(no) $2 fi ]) ]) AC_DEFUN(KDE_CHECK_LIBPTHREAD, [ AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] ) AC_SUBST(LIBPTHREAD) ]) AC_DEFUN(KDE_CHECK_PTHREAD_OPTION, [ AC_ARG_ENABLE(kernel-threads, [ --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.], kde_use_kernthreads=$enableval, kde_use_kernthreads=no) if test "$kde_use_kernthreads" = "yes"; then ac_save_CXXFLAGS="$CXXFLAGS" ac_save_CFLAGS="$CXXFLAGS" CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS" CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS" AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h) CXXFLAGS="$ac_save_CXXFLAGS" CFLAGS="$ac_save_CFLAGS" if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then kde_use_kernthreads=no else dnl Add proper -I and -l statements AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD if test "x$LIBPTHREAD" = "x"; then kde_use_kernthreads=no else USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads" fi fi else USE_THREADS="" if test -z "$LIBPTHREAD"; then KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] ) fi fi case $host_os in solaris*) KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"]) CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4" echo "Setting Solaris pthread compilation options" ;; freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" echo "Setting FreeBSD pthread compilation options" ;; aix*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" LIBPTHREAD="$LIBPTHREAD -lc_r" echo "Setting AIX pthread compilation options" ;; linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" USE_THREADS="$USE_THREADS -DPIC -fPIC" echo "Setting Linux pthread compilation options" ;; *) ;; esac AC_SUBST(USE_THREADS) AC_SUBST(LIBPTHREAD) ]) AC_DEFUN(KDE_CHECK_THREADING, [ AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION]) dnl default is yes if libpthread is found and no if no libpthread is available if test -z "$LIBPTHREAD"; then kde_check_threading_default=no else kde_check_threading_default=yes fi AC_ARG_ENABLE(threading, [ --disable-threading disables threading even if libpthread found ], kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default) if test "x$kde_use_threading" = "xyes"; then AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)]) fi ]) AC_DEFUN(KDE_TRY_LINK_PYTHON, [ if test "$kde_python_link_found" = no; then if test "$1" = normal; then AC_MSG_CHECKING(if a Python application links) else AC_MSG_CHECKING(if Python depends on $2) fi AC_CACHE_VAL(kde_cv_try_link_python_$1, [ AC_LANG_SAVE AC_LANG_C kde_save_cflags="$CFLAGS" CFLAGS="$CFLAGS $PYTHONINC" kde_save_libs="$LIBS" LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" kde_save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS $PYTHONLIB" AC_TRY_LINK( [ #include ],[ PySys_SetArgv(1, 0); ], [kde_cv_try_link_python_$1=yes], [kde_cv_try_link_python_$1=no] ) CFLAGS="$kde_save_cflags" LIBS="$kde_save_libs" LDFLAGS="$kde_save_ldflags" ]) if test "$kde_cv_try_link_python_$1" = "yes"; then AC_MSG_RESULT(yes) kde_python_link_found=yes if test ! "$1" = normal; then LIBPYTHON="$LIBPYTHON $2" fi $3 else AC_MSG_RESULT(no) $4 fi AC_LANG_RESTORE fi ]) AC_DEFUN(KDE_CHECK_PYTHON_DIR, [ AC_MSG_CHECKING([for Python directory]) AC_CACHE_VAL(kde_cv_pythondir, [ if test -z "$PYTHONDIR"; then kde_cv_pythondir=/usr/local else kde_cv_pythondir="$PYTHONDIR" fi ]) AC_ARG_WITH(pythondir, [ --with-pythondir=pythondir use python installed in pythondir ], [ ac_python_dir=$withval ], ac_python_dir=$kde_cv_pythondir ) AC_MSG_RESULT($ac_python_dir) ]) AC_DEFUN(KDE_CHECK_PYTHON_INTERN, [ AC_REQUIRE([KDE_CHECK_LIBDL]) AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) AC_REQUIRE([KDE_CHECK_PYTHON_DIR]) if test -z "$1"; then version="1.5" else version="$1" fi AC_MSG_CHECKING([for Python$version]) python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) if test ! -r $python_incdir/Python.h; then AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) python_incdir=$python_incdir/python$version if test ! -r $python_incdir/Python.h; then python_incdir=no fi fi PYTHONINC=-I$python_incdir python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) if test ! -r $python_libdir/libpython$version.a; then AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) python_libdir=$python_libdir/python$version/config if test ! -r $python_libdir/libpython$version.a; then python_libdir=no fi fi PYTHONLIB=-L$python_libdir kde_orig_LIBPYTHON=$LIBPYTHON if test -z "$LIBPYTHON"; then LIBPYTHON=-lpython$version fi python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir) python_moddir=$python_moddir/python$version if test ! -r $python_moddir/copy.py; then python_moddir=no fi PYTHONMODDIR=$python_moddir AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir) if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then LIBPYTHON=$kde_orig_LIBPYTHON test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB="" test "x$PYTHONINC" = "x-Ino" && PYTHONINC="" $2 else dnl Note: this test is very weak kde_python_link_found=no KDE_TRY_LINK_PYTHON(normal) KDE_TRY_LINK_PYTHON(m, -lm) KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) KDE_TRY_LINK_PYTHON(tcl, -ltcl) KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm]) KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil]) KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil]) KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3]) KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil]) KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [], [AC_MSG_WARN([it seems, Python depends on another library. Pleae use \"make LIBPYTHON='-lpython$version -lotherlib'\" to fix this and contact the authors to let them know about this problem]) ]) LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" AC_SUBST(PYTHONINC) AC_SUBST(PYTHONLIB) AC_SUBST(LIBPYTHON) AC_SUBST(PYTHONMODDIR) AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python]) fi ]) AC_DEFUN(KDE_CHECK_PYTHON, [ KDE_CHECK_PYTHON_INTERN("2.1", [KDE_CHECK_PYTHON_INTERN("2.0", [ KDE_CHECK_PYTHON_INTERN($1, $2) ]) ]) ]) AC_DEFUN(KDE_CHECK_STL_SGI, [ AC_MSG_CHECKING([if STL implementation is SGI like]) AC_CACHE_VAL(kde_cv_stl_type_sgi, [ AC_TRY_COMPILE([ #include using namespace std; ],[ string astring="Hallo Welt."; astring.erase(0, 6); // now astring is "Welt" return 0; ], kde_cv_stl_type_sgi=yes, kde_cv_stl_type_sgi=no) ]) AC_MSG_RESULT($kde_cv_stl_type_sgi) if test "$kde_cv_stl_type_sgi" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) fi ]) AC_DEFUN(KDE_CHECK_STL_HP, [ AC_MSG_CHECKING([if STL implementation is HP like]) AC_CACHE_VAL(kde_cv_stl_type_hp, [ AC_TRY_COMPILE([ #include using namespace std; ],[ string astring="Hello World"; astring.remove(0, 6); // now astring is "World" return 0; ], kde_cv_stl_type_hp=yes, kde_cv_stl_type_hp=no) ]) AC_MSG_RESULT($kde_cv_stl_type_hp) if test "$kde_cv_stl_type_hp" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by HP]) fi ]) AC_DEFUN(KDE_CHECK_STL, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`" KDE_CHECK_STL_SGI if test "$kde_cv_stl_type_sgi" = "no"; then KDE_CHECK_STL_HP if test "$kde_cv_stl_type_hp" = "no"; then AC_MSG_ERROR("no known STL type found") fi fi CXXFLAGS="$ac_save_CXXFLAGS" AC_LANG_RESTORE ]) AC_DEFUN(AC_FIND_QIMGIO, [AC_REQUIRE([AC_FIND_JPEG]) AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) AC_MSG_CHECKING([for qimgio]) AC_CACHE_VAL(ac_cv_lib_qimgio, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_save_LIBS="$LIBS" ac_save_CXXFLAGS="$CXXFLAGS" LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" AC_TRY_RUN(dnl [ #include #include int main() { QString t = "hallo"; t.fill('t'); qInitImageIO(); } ], ac_cv_lib_qimgio=yes, ac_cv_lib_qimgio=no, ac_cv_lib_qimgio=no) LIBS="$ac_save_LIBS" CXXFLAGS="$ac_save_CXXFLAGS" AC_LANG_RESTORE ])dnl if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) AC_SUBST(LIBQIMGIO) else AC_MSG_RESULT(not found) fi ]) AC_DEFUN(KDE_CHECK_ANSI, [ ]) AC_DEFUN(KDE_CHECK_INSURE, [ AC_ARG_ENABLE(insure, [ --enable-insure use insure++ for debugging [default=no]], [ if test $enableval = "no"; dnl then ac_use_insure="no" else ac_use_insure="yes" fi ], [ac_use_insure="no"]) AC_MSG_CHECKING(if we will use Insure++ to debug) AC_MSG_RESULT($ac_use_insure) if test "$ac_use_insure" = "yes"; dnl then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "???? fi ]) AC_DEFUN(AM_DISABLE_LIBRARIES, [ AC_PROVIDE([AM_ENABLE_STATIC]) AC_PROVIDE([AM_ENABLE_SHARED]) enable_static=no enable_shared=yes ]) AC_DEFUN(AC_CHECK_UTMP_FILE, [ AC_MSG_CHECKING([for utmp file]) AC_CACHE_VAL(kde_cv_utmp_file, [ kde_cv_utmp_file=no for ac_file in \ \ /var/run/utmp \ /var/adm/utmp \ /etc/utmp \ ; \ do if test -r "$ac_file"; then kde_cv_utmp_file=$ac_file break fi done ]) if test "$kde_cv_utmp_file" != "no"; then AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) $1 AC_MSG_RESULT($kde_cv_utmp_file) else $2 AC_MSG_RESULT([non found]) fi ]) AC_DEFUN(KDE_CREATE_SUBDIRSLIST, [ DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" if test ! -s $srcdir/subdirs; then dnl Note: Makefile.common creates subdirs, so this is just a fallback TOPSUBDIRS="" files=`cd $srcdir && ls -1` dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` for i in $dirs; do echo $i >> $srcdir/subdirs done fi if test -s $srcdir/inst-apps; then ac_topsubdirs="`cat $srcdir/inst-apps`" else ac_topsubdirs="`cat $srcdir/subdirs`" fi for i in $ac_topsubdirs; do AC_MSG_CHECKING([if $i should be compiled]) if test -d $srcdir/$i; then install_it="yes" for j in $DO_NOT_COMPILE; do if test $i = $j; then install_it="no" fi done else install_it="no" fi AC_MSG_RESULT($install_it) if test $install_it = "yes"; then TOPSUBDIRS="$TOPSUBDIRS $i" fi done AC_SUBST(TOPSUBDIRS) ]) AC_DEFUN(KDE_CHECK_NAMESPACES, [ AC_MSG_CHECKING(whether C++ compiler supports namespaces) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ ], [ namespace Foo { extern int i; namespace Bar { extern int i; } } int Foo::i = 0; int Foo::Bar::i = 1; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NAMESPACES) ], [ AC_MSG_RESULT(no) ]) AC_LANG_RESTORE ]) AC_DEFUN(KDE_CHECK_NEWLIBS, [ ]) dnl ------------------------------------------------------------------------ dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_CHECK_S_ISSOCK, [ AC_MSG_CHECKING(for S_ISSOCK) AC_CACHE_VAL(ac_cv_have_s_issock, [ AC_LANG_SAVE AC_LANG_C AC_TRY_LINK( [ #include ], [ struct stat buff; int b = S_ISSOCK( buff.st_mode ); ], ac_cv_have_s_issock=yes, ac_cv_have_s_issock=no) AC_LANG_RESTORE ]) AC_MSG_RESULT($ac_cv_have_s_issock) if test "$ac_cv_have_s_issock" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) fi ]) dnl ------------------------------------------------------------------------ dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org dnl ------------------------------------------------------------------------ dnl AC_DEFUN(AC_CHECK_KDEMAXPATHLEN, [ AC_MSG_CHECKING(for MAXPATHLEN) AC_CACHE_VAL(ac_cv_maxpathlen, [ AC_LANG_C cat > conftest.$ac_ext < #endif #include #include #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif KDE_HELLO MAXPATHLEN EOF ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" if AC_TRY_EVAL(ac_try) && test -s conftest.out; then ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` else ac_cv_maxpathlen=1024 fi rm conftest.* ]) AC_MSG_RESULT($ac_cv_maxpathlen) AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] ) ]) dnl ------------------------------------------------------------------------- dnl See if the compiler supports a template repository bero@redhat.de dnl ------------------------------------------------------------------------- AC_DEFUN(KDE_COMPILER_REPO, [ REPO="" NOREPO="" KDE_CHECK_COMPILER_FLAG(frepo, [ REPO="-frepo" NOREPO="-fno-repo" ]) if test -z "$REPO"; then KDE_CHECK_COMPILER_FLAG(instances=explicit, [ REPO="-instances=explicit" NOREPO="-instances=extern" ]) fi if test -n "$REPO"; then AC_DEFINE_UNQUOTED(HAVE_TEMPLATE_REPOSITORY, 1, [C++ compiler supports template repository]) $1 fi AC_SUBST(REPO) AC_SUBST(NOREPO) ]) AC_DEFUN(KDE_CHECK_HEADER, [ AC_LANG_SAVE kde_safe_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $all_includes" AC_LANG_CPLUSPLUS AC_CHECK_HEADER($1, $2, $3) CPPFLAGS=$kde_safe_cppflags AC_LANG_RESTORE ]) AC_DEFUN(KDE_FAST_CONFIGURE, [ dnl makes configure fast (needs perl) AC_ARG_ENABLE(fast-perl, [ --disable-fast-perl disable fast Makefile generation (needs perl)], with_fast_perl=$enableval, with_fast_perl=yes) ]) AC_DEFUN(KDE_CONF_FILES, [ val= if test -f $srcdir/configure.files ; then val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files` fi CONF_FILES= if test -n "$val" ; then for i in $val ; do CONF_FILES="$CONF_FILES $i" done fi AC_SUBST(CONF_FILES) ])dnl AC_DEFUN(KDE_SET_PREFIX, [ unset CDPATH dnl make $KDEDIR the default for the installation AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix ac_configure_args="$ac_configure_args --prefix $prefix" fi KDE_FAST_CONFIGURE KDE_CONF_FILES ]) pushdef([AC_PROG_INSTALL], [ dnl our own version, testing for a -p flag popdef([AC_PROG_INSTALL]) dnl as AC_PROG_INSTALL works as it works we first have dnl to save if the user didn't specify INSTALL, as the dnl autoconf one overwrites INSTALL and we have no chance to find dnl out afterwards test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT AC_PROG_INSTALL if test -z "$kde_save_INSTALL_given" ; then # OK, user hasn't given any INSTALL, autoconf found one for us # now we test, if it supports the -p flag AC_MSG_CHECKING(for -p flag to install) rm -f confinst.$$.* > /dev/null 2>&1 echo "Testtest" > confinst.$$.orig ac_res=no if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then if test -f confinst.$$.new ; then # OK, -p seems to do no harm to install INSTALL="${INSTALL} -p" ac_res=yes fi fi rm -f confinst.$$.* AC_MSG_RESULT($ac_res) fi dnl the following tries to resolve some signs and wonders coming up dnl with different autoconf/automake versions dnl e.g.: dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS) dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the dnl install-@DIR@PROGRAMS targets to explicitly use that flag dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as dnl INSTALL_SCRIPT, which breaks with automake <= 1.4 dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from dnl automake (due to broken Makefile.am or whatever) to install programs, dnl and so does not see the -s flag in automake > 1.4 dnl to clean up that mess we: dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG dnl which cleans KDE's program with automake > 1.4; dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems dnl with automake<=1.4 dnl note that dues to this sometimes two '-s' flags are used (if KDE dnl properly uses install-@DIR@PROGRAMS, but I don't care dnl dnl And to all this comes, that I even can't write in comments variable dnl names used by automake, because it is so stupid to think I wanted to dnl _use_ them, therefor I have written A_M_... instead of AM_ dnl hmm, I wanted to say something ... ahh yes: Arghhh. if test -z "$kde_save_INSTALL_PROGRAM_given" ; then INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' fi if test -z "$kde_save_INSTALL_SCRIPT_given" ; then INSTALL_SCRIPT='${INSTALL}' fi ])dnl AC_DEFUN(KDE_LANG_CPLUSPLUS, [AC_LANG_CPLUSPLUS ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS]) ]) pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS ]) AC_DEFUN(KDE_CHECK_LONG_LONG, [ AC_MSG_CHECKING(for long long) AC_CACHE_VAL(kde_cv_c_long_long, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_LINK([], [ long long foo = 0; foo = foo+1; ], kde_cv_c_long_long=yes, kde_cv_c_long_long=no) ]) AC_MSG_RESULT($kde_cv_c_long_long) if test "$kde_cv_c_long_long" = yes; then AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype]) fi ]) AC_DEFUN(KDE_CHECK_LIB, [ kde_save_LIBS="$LIBS" LIBS="$LIBS $all_libraries" case $host_os in aix*) LIBS="-brtl $LIBS" test "$GCC" = yes && LIBS="-Wl,$LIBS" ;; esac AC_CHECK_LIB($1, $2, $3, $4, $5) LIBS="$kde_save_LIBS" ]) AC_DEFUN(KDE_CHECK_INITGROUPS, [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS(initgroups) if test "x$ac_cv_func_initgroups" = "xyes"; then case $host_os in aix*) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_MSG_CHECKING([for initgroups prototype]) AC_CACHE_VAL(kde_cv_check_initgroups_proto, [ AC_TRY_COMPILE( [ #include ], [ char buffer[10]; gid_t id; int x = initgroups(buffer,id); ], kde_cv_check_initgroups_proto=yes, kde_cv_check_initgroups_proto=no) ]) AC_MSG_RESULT($kde_cv_check_initgroups_proto) AC_LANG_RESTORE ;; *) kde_cv_check_initgroups_proto=yes ;; esac else kde_cv_check_initgroups_proto=no fi if test "x$kde_cv_check_initgroups_proto" = "xyes"; then kde_check_initgroups_proto=1 else kde_check_initgroups_proto=0 fi AC_DEFINE_UNQUOTED(HAVE_INITGROUPS_PROTO,$kde_check_initgroups_proto, [initgroups may exist but not its prototype (e.g. AIX<4.3.3:8)]) ]) AC_DEFUN(KDE_CHECK_JAVA_DIR, [ AC_MSG_CHECKING([for Java directory]) AC_ARG_WITH(java, [ --with-java=javadir use java installed in javadir, --without-java disables ], [ ac_java_dir=$withval ], ac_java_dir="" ) dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH if test "x$ac_java_dir" = xno; then kde_cv_java_bindir=no kde_cv_java_includedir=no kde_java_libjvmdir=no kde_java_libhpidir=no else if test "x$ac_java_dir" = x; then dnl No option set -> look in $PATH AC_CACHE_VAL(kde_cv_java_bindir, [ dnl First look for javac in $PATH. If not found we'll look at the option. KDE_FIND_PATH(javac, JAVAC, [], []) if test -n "$JAVAC"; then kde_cv_java_bindir=`echo $JAVAC | sed -e 's,/javac$,/,'` dnl this substitution might not work - well, we test for jni.h below kde_cv_java_includedir=`echo $kde_cv_java_bindir | sed -e 's,bin/$,include/,'` else kde_cv_java_bindir=no fi ]) else dnl config option set kde_cv_java_bindir=$ac_java_dir/bin kde_cv_java_includedir=$ac_java_dir/include fi fi dnl At this point kde_cv_java_bindir and kde_cv_java_includedir are either set or "no" if test ! "x$kde_cv_java_bindir" = xno; then dnl Look for libjvm.so kde_java_libjvmdir=`find $kde_cv_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` dnl Look for libhpi.so and avoid green threads kde_java_libhpidir=`find $kde_cv_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,'` dnl Now check everything's fine under there if test ! -x "$kde_cv_java_bindir/javac"; then AC_MSG_ERROR([javac not found under $kde_cv_java_bindir - it seems you passed a wrong --with-java.]) fi if test ! -x "$kde_cv_java_bindir/javah"; then AC_MSG_ERROR([javah not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.]) fi if test ! -x "$kde_cv_java_bindir/jar"; then AC_MSG_ERROR([jar not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.]) fi if test ! -r "$kde_cv_java_includedir/jni.h"; then AC_MSG_ERROR([jni.h not found under $kde_cv_java_includedir. Use --with-java or --without-java.]) fi if test ! -r "$kde_java_libjvmdir/libjvm.so"; then AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.]) fi if test ! -r "$kde_java_libhpidir/libhpi.so"; then AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.]) fi jni_includes="-I$kde_cv_java_includedir" dnl Strange thing, jni.h requires jni_md.h which is under genunix here.. dnl and under linux here.. test -d "$kde_cv_java_includedir/linux" && jni_includes="$jni_includes -I$kde_cv_java_includedir/linux" test -d "$kde_cv_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_cv_java_includedir/genunix" dnl Check for JNI version AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_cxxflags_safe="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $all_includes $jni_includes" AC_TRY_COMPILE([ #include ], [ #ifndef JNI_VERSION_1_2 Syntax Error #endif ],[ kde_jni_works=yes ], [ kde_jni_works=no ]) if test $kde_jni_works = no; then AC_MSG_ERROR([Incorrect version of $kde_cv_java_includedir/jni.h. You need to have Java Development Kit (JDK) version 1.2. Use --with-java to specify another location. Use --without-java to configure without java support. Or download a newer JDK and try again. See e.g. http://java.sun.com/products/jdk/1.2 ]) fi CXXFLAGS="$ac_cxxflags_safe" AC_LANG_RESTORE dnl All tests ok, inform and subst the variables AC_MSG_RESULT([javac/javah/jar in $kde_cv_java_bindir, jni.h in $kde_cv_java_includedir]) JAVAC=$kde_cv_java_bindir/javac AC_SUBST(JAVAC) JAVAH=$kde_cv_java_bindir/javah AC_SUBST(JAVAH) JAR=$kde_cv_java_bindir/jar AC_SUBST(JAR) AC_SUBST(jni_includes) JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_cv_java_libhpidir -lhpi" AC_SUBST(JVMLIBS) fi ]) ## libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- ## Copyright 1996, 1997, 1998, 1999, 2000, 2001 ## Free Software Foundation, Inc. ## Originally by Gordon Matzigkeit , 1996 ## ## 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ## ## As a special exception to the GNU General Public License, if you ## distribute this file as part of a program that contains a ## configuration script generated by Autoconf, you may include it under ## the same distribution terms that you use for the rest of that program. # serial 46 AC_PROG_LIBTOOL AC_DEFUN([AC_PROG_LIBTOOL], [AC_REQUIRE([_AC_PROG_LIBTOOL])dnl dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. AC_PROVIDE_IFELSE([AC_PROG_CXX], [AC_LIBTOOL_CXX], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX ])]) dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [ifdef([AC_PROG_GCJ], [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ ])]) ifdef([A][M_PROG_GCJ], [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ ])]) ifdef([LT_AC_PROG_GCJ], [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ ])])])])])]) AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # Save cache, so that ltconfig can load it AC_CACHE_SAVE # Actually configure libtool. ac_aux_dir is where install-sh is found. AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ || AC_MSG_ERROR([libtool configure failed]) # Reload cache, that may have been modified by ltconfig AC_CACHE_LOAD # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) AC_DEFUN([AC_LIBTOOL_SETUP], [AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! AC_REQUIRE([AC_OBJEXT])dnl AC_REQUIRE([AC_EXEEXT])dnl dnl # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then AC_PATH_MAGIC fi ;; esac AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(STRIP, strip, :) # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], [libtool_flags="$libtool_flags --enable-dlopen"]) ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [libtool_flags="$libtool_flags --enable-win32-dll"]) AC_ARG_ENABLE(libtool-lock, [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" AC_ARG_WITH(pic, [ --with-pic try to use only PIC/non-PIC objects [default=use both]], pic_mode="$withval", pic_mode=default) test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_SAVE AC_LANG_C AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_RESTORE]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw* | *-*-pw32*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) # recent cygwin and mingw systems supply a stub DllMain which the user # can override, but on older systems we have to supply one AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, [AC_TRY_LINK([], [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); DllMain (0, 0, 0);], [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) case $host/$CC in *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) # old mingw systems require "-dll" to link a DLL, while more recent ones # require "-mdll" SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -mdll" AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) CFLAGS="$SAVE_CFLAGS" ;; *-*-cygwin* | *-*-pw32*) # cygwin systems need to pass --dll to the linker, and not link # crt.o which will require a WinMain@16 definition. lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; esac ;; ]) esac ]) # AC_LIBTOOL_DLOPEN - enable checks for dlopen support AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN([AC_ENABLE_SHARED], [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac], enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) # AC_DISABLE_SHARED - set the default shared flag to --disable-shared AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no)]) # AC_ENABLE_STATIC - implement the --enable-static flag # Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN([AC_ENABLE_STATIC], [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac], enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) # AC_DISABLE_STATIC - set the default static flag to --disable-static AC_DEFUN([AC_DISABLE_STATIC], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no)]) # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(fast-install, changequote(<<, >>)dnl << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac], enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl ]) # AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no)]) # AC_LIBTOOL_PICMODE - implement the --with-pic flag # Usage: AC_LIBTOOL_PICMODE[(MODE)] # Where MODE is either `yes' or `no'. If omitted, it defaults to # `both'. AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl pic_mode=ifelse($#,1,$1,default)]) # AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in /*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; ?:/*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. ;; *) ac_save_MAGIC_CMD="$MAGIC_CMD" IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="ifelse([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | egrep "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$ac_save_ifs" MAGIC_CMD="$ac_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi ]) # AC_PATH_MAGIC - find a file program which can recognise a shared library AC_DEFUN([AC_PATH_MAGIC], [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) else MAGIC_CMD=: fi fi ]) # AC_PROG_LD - find the path to the GNU or non-GNU linker AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]* | [A-Za-z]:[\\/]*)] re_direlt=['/[^/][^/]*/\.\./'] # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else lt_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$lt_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_PROG_LD_GNU ]) AC_DEFUN([AC_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then lt_cv_prog_gnu_ld=yes else lt_cv_prog_gnu_ld=no fi]) with_gnu_ld=$lt_cv_prog_gnu_ld ]) # AC_PROG_LD_RELOAD_FLAG - find reload flag for linker # -- PORTME Some linkers may need a different reload flag. AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], [AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, [lt_cv_ld_reload_flag='-r']) reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" ]) # AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], [AC_CACHE_CHECK([how to recognise dependant libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [regex]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given egrep regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi4*) lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin* | mingw* |pw32*) lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in rhapsody* | darwin1.[012]) lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' ;; *) # Darwin 1.3 on lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' ;; esac ;; freebsd* ) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20*|hpux11*) lt_cv_deplibs_check_method=['file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; irix5* | irix6*) case $host_os in irix5*) # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" ;; *) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] ;; esac lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux-gnu*) case $host_cpu in alpha* | i*86 | powerpc* | sparc* | ia64* | s390* | m68k* | arm* | mips* | hppa* | sh* ) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; esac lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then [lt_cv_deplibs_check_method='file_magic NetBSD/[a-z0-9]* demand paged shared library'] else [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'] fi lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; openbsd* ) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case "$host_cpu" in i*86 ) changequote(,)dnl lt_cv_deplibs_check_method='file_magic OpenBSD/i[3-9]86 demand paged shared library' changequote([, ])dnl lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; newsos6) [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; osf3* | osf4* | osf5*) # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' lt_cv_file_magic_test_file=/shlib/libc.so lt_cv_deplibs_check_method=pass_all ;; sco3.2v5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all lt_cv_file_magic_test_file=/lib/libc.so ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) case $host_vendor in ncr) lt_cv_deplibs_check_method=pass_all ;; motorola) lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; esac ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method ]) # AC_PROG_NM - find the path to a BSD-compatible name lister AC_DEFUN([AC_PROG_NM], [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/${ac_tool_prefix}nm if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then lt_cv_path_NM="$tmp_nm -B" break elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then lt_cv_path_NM="$tmp_nm -p" break else lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi]) NM="$lt_cv_path_NM" AC_MSG_RESULT([$NM]) ]) # AC_CHECK_LIBM - check for math library AC_DEFUN([AC_CHECK_LIBM], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32*) # These system don't have libm ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, main, LIBM="-lm") ;; esac ]) # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-convenience to the # configure arguments. Note that LIBLTDL and INCLTDL are not # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not # provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed # with '${top_builddir}/' and INCLTDL will be prefixed with # '${top_srcdir}/' (note the single quotes!). If your package is not # flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case $enable_ltdl_convenience in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for # the libltdl installable library and INCLTDL to the include flags for # the libltdl header and adds --enable-ltdl-install to the configure # arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is # AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed # libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed # with '${top_srcdir}/' (note the single quotes!). If your package is # not flat and you're not using automake, define top_builddir and # top_srcdir appropriately in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, main, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" INCLTDL= fi ]) # If this macro is not defined by Autoconf, define it here. ifdef([AC_PROVIDE_IFELSE], [], [define([AC_PROVIDE_IFELSE], [ifdef([AC_PROVIDE_$1], [$2], [$3])])]) # AC_LIBTOOL_CXX - enable support for C++ libraries AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) AC_DEFUN([_AC_LIBTOOL_CXX], [AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" lt_save_CC="$CC" lt_save_CFLAGS="$CFLAGS" dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC dnl is set to the C++ compiler. AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" \ file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ --build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ || AC_MSG_ERROR([libtool tag configuration failed]) CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) # AC_LIBTOOL_GCJ - enable support for GCJ libraries AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) AC_DEFUN([_AC_LIBTOOL_GCJ], [AC_REQUIRE([AC_PROG_LIBTOOL]) AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" lt_save_CC="$CC" lt_save_CFLAGS="$CFLAGS" dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC dnl is set to the C++ compiler. AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" \ file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ --build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ || AC_MSG_ERROR([libtool tag configuration failed]) CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) dnl old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) dnl This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL])dnl AC_DEFUN([LT_AC_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj, no) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS) ]) c_cpp_reference-2.0.2/stamp-h.in0000644000076400001440000000000007474405126012176 c_cpp_reference-2.0.2/reference/0000777000076400001440000000000007474405232012327 5c_cpp_reference-2.0.2/reference/C/0000777000076400001440000000000007474405230012507 5c_cpp_reference-2.0.2/reference/C/GDB/0000777000076400001440000000000007474405225013107 5c_cpp_reference-2.0.2/reference/C/GDB/gdb.html0000644000076400001440000000355307055334537014455 GDB Debugger

GDB Debugger


The other common debug programs on Unix systems are dbx and dbxtool.

Before a program can be processed by the debugger, it must be compiled with the debugger option.

	gcc -ggdb -o pipe pipe.c
The program can then be passed to the debugger with
	gdb pipe
To pass command line parameters to the program use:
	set args -size big
This is equivalent to saying:
	pipe -size big
To single step:
	break
	run
	step
The step command stops execution at the next source statement, if that statement is a function call, gdb will single step into the function.
A simular command is next this will also single step source statements but when a it meets a function call, the function is executed and gdb stops when it reaches a new source statement in the calling function.

step can be abreviated to s
next can be abreviated to n

To set break points:

	break 48	<-- Program will stop BEFORE executing line 48
	break FuncName  <-- Program will stop when entering the function
	run
To display the contents of a variable:
	print ant[0]
To change the value of a variable:
	set ant[0] = 4
	set char = 'z'


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/GDB/Makefile.am0000644000076400001440000000015307055334537015060 EXTRA_DIST = $(wildcard *.html) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/GDB/Makefile.in0000644000076400001440000002357607474405126015105 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/GDB mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/GDB/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/GDB/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/GDB/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=gdb.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/GDB/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/GDB/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/MAN/0000777000076400001440000000000007474405227013130 5c_cpp_reference-2.0.2/reference/C/MAN/setlocale.htm0000644000076400001440000000555207055335006015530 setlocale





SETLOCALE(3) Linux Programmer's Manual SETLOCALE(3)

NAME

setlocale - set the current locale.

SYNOPSIS

#include <locale.h> char *setlocale(int category, const char * locale);

DESCRIPTION

The setlocale() function is used to set or query the pro- gram's current locale. If locale is "C" or "POSIX", the current locale is set to the portable locale. If locale is "", the locale is set to the default locale which is selected from the environment variable LANG. On startup of the main program, the portable "C" locale is selected as default. The argument category determines which functions are influenced by the new locale: LC_ALL for all of the locale. LC_COLLATE for the functions strcoll() and strxfrm(). LC_CTYPE for the character classification and conversion routines. LC_MONETARY for localeconv(). LC_NUMERIC for the decimal character. LC_TIME for strftime(). NULL if the request cannot not be honored. This string may be allocated in static storage. A program may be made portable to all locales by calling setlocale(LC_ALL, "" ) after program initialization, by using the values returned from a localeconv() call for locale - dependent information and by using strcoll() or strxfrm() to compare strings.

CONFORMS TO

ANSI C, POSIX.1 Linux supports the portable locales "C" and "POSIX" and also the European Latin-1 "ISO-8859-1" , and Russian "KOI-8" locales.

GNU April 18, 1993 1

SETLOCALE(3) Linux Programmer's Manual SETLOCALE(3)

The printf() family of functions may or may not honor the current locale.

SEE ALSO

locale, localedef, strcoll, isalpha, conv, strftime, locale,




















































GNU April 18, 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/test0000644000076400001440000000002607055335024013734 .htm .htm c_cpp_reference-2.0.2/reference/C/MAN/va_start.htm0000644000076400001440000001156307055335011015373 va_start



STDARG(3) Linux Programmer's Manual STDARG(3)

NAME

stdarg - variable argument lists

SYNOPSIS

#include <stdarg.h> void va_start( va_list ap, last); typeva_arg( va_list ap, type); void va_end( va_list ap);

DESCRIPTION

A function may be called with a varying number of argu- ments of varying types. The include file stdarg.h declares a type va_list and defines three macros for step- ping through a list of arguments whose number and types are not known to the called function. The called function must declare an object of type va_list which is used by the macros va_start, va_arg, and va_end. The va_start macro initializes ap for subsequent use by va_arg and va_end, and must be called first. The parameter last is the name of the last parameter before the variable argument list, i.e., the last parame- ter of which the calling function knows the type. Because the address of this parameter is used in the va_start macro, it should not be declared as a register variable, or as a function or an array type. The va_start macro returns no value. The va_arg macro expands to an expression that has the type and value of the next argument in the call. The parameter ap is the va_list ap initialized by va_start. Each call to va_arg modifies ap so that the next call returns the next argument. The parameter type is a type name specified so that the type of a pointer to an object that has the specified type can be obtained simply by adding a * to type. If there is no next argument, or if type is not compatible with the type of the actual next argument (as promoted according to the default argument promotions), random errors will occur. The first use of the va_arg macro after that of the va_start macro returns the argument after last. Succes- sive invocations return the values of the remaining argu- ments. The va_end macro handles a normal return from the function whose variable argument list was initialized by va_start.

BSD MANPAGE 29 November 1993 1

STDARG(3) Linux Programmer's Manual STDARG(3)

The va_end macro returns no value.

EXAMPLES

The function foo takes a string of format characters and prints out the argument associated with each format char- acter based on the type. void foo(char *fmt, ...) { va_list ap; int d; char c, *p, *s; va_start(ap, fmt); while (*fmt) switch(*fmt++) { case 's': /* string */ s = va_arg(ap, char *); printf("string %s\n", s); break; case 'd': /* int */ d = va_arg(ap, int); printf("int %d\n", d); break; case 'c': /* char */ c = va_arg(ap, char); printf("char %c\n", c); break; } va_end(ap); }

STANDARDS

The va_start, va_arg, and va_end macros conform to ANSI C3.159-1989 (``ANSI C'').

COMPATIBILITY

These macros are not compatible with the historic macros they replace. A backward compatible version can be found in the include file varargs.h.

BUGS

Unlike the varargs macros, the stdarg macros do not permit programmers to code a function with no fixed arguments. This problem generates work mainly when converting varargs code to stdarg code, but it also creates difficulties for variadic functions that wish to pass all of their argu- ments on to a function that takes a va_list argument, such as vfprintf(3).

BSD MANPAGE 29 November 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/scandir.htm0000644000076400001440000000453707055334762015212 scandir



SCANDIR(3) Linux Programmer's Manual SCANDIR(3)

NAME

scandir, alphasort - scan a directory for matching entries

SYNOPSIS

#include <dirent.h> int scandir(const char *dir, struct dirent ***namelist, int (*select)(const struct dirent *), int (*compar)(const void *, const void *)); int alphasort(const struct dirent *a, const struct dirent *b);

DESCRIPTION

The scandir() function scans the directory dir, calling select() on each directory entry. Entries for which select() returns non-zero are stored in strings allocated via malloc(), sorted using qsort() with the comparison function compar(), and collected in array namelist which is allocated via malloc(). The alphasort() function can be used as the comparison function for the scandir() function to sort the directory entries into alphabetical order. Its parameters are the two directory entries, a and b, to compare.

RETURN VALUE

The scandir() function returns the number of directory entries selected or -1 if an error occurs. The alphasort() function returns an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

ERRORS

ENOMEM Insufficient memory to complete the operation.

CONFORMING TO

BSD 4.3

SEE ALSO

opendir, readdir, closedir, rewinddir, telldir, seekdir,















GNU March 31, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/strtod.htm0000644000076400001440000000501107055334764015074 strtod



STRTOD(3) Linux Programmer's Manual STRTOD(3)

NAME

strtod - convert ASCII string to double

SYNOPSIS

#include <stdlib.h> double strtod(const char *nptr, char **endptr

DESCRIPTION

The strtod function converts the initial portion of the string pointed to by nptr to double representation. The expected form of the string is an optional plus (``+'') or minus sign (``-'') followed by a sequence of digits optionally containing a decimal-point character, optionally followed by an exponent. An exponent consists of an ``E'' or ``e'', followed by an optional plus or minus sign, followed by a sequence of digits. Leading white-space characters in the string (as defined by the isspace(3) function) are skipped.

RETURN VALUES

The strtod function returns the converted value, if any. If endptr is not NULL, a pointer to the character after the last character used in the conversion is stored in the location referenced by endptr. If no conversion is performed, zero is returned and the value of nptr is stored in the location referenced by endptr. If the correct value would cause overflow, plus or minus HUGE_VAL is returned (according to the sign of the value), and ERANGE is stored in errno. If the correct value would cause underflow, zero is returned and ERANGE is stored in errno.

ERRORS

ERANGE Overflow or underflow occurred.

SEE ALSO

atof, atoi, atol, strtol, strtoul,


STANDARDS

The strtod function conforms to ANSI-C.

BUGS

This is a BSD manual page and may not reflect the current Linux implementation.

BSD Man Page 21 Aug 1994 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/strftime.htm0000644000076400001440000001372607055335033015414 strftime



STRFTIME(3) Linux Programmer's Manual STRFTIME(3)

NAME

strftime - format date and time

SYNOPSIS

#include <time.h> size_t strftime(char *s, size_t max, const char *format, const struct tm *tm);

DESCRIPTION

The strftime() function formats the broken-down time tm according to the format specification format and places the result in the character array s of size max. Ordinary characters placed in the format string are copied to s without conversion. Conversion specifiers are intro- duced by a `%' character, and are replaced in s as fol- lows: %a The abbreviated weekday name according to the cur- rent locale. %A The full weekday name according to the current locale. %b The abbreviated month name according to the current locale. %B The full month name according to the current locale. %c The preferred date and time representation for the current locale. %d The day of the month as a decimal number (range 0 to 31). %H The hour as a decimal number using a 24-hour clock (range 00 to 23). %I The hour as a decimal number using a 12-hour clock (range 01 to 12). %j The day of the year as a decimal number (range 001 to 366). %m The month as a decimal number (range 10 to 12). %M The minute as a decimal number. %p Either `am' or `pm' according to the given time value, or the corresponding strings for the current locale.

GNU July 2, 1993 1

STRFTIME(3) Linux Programmer's Manual STRFTIME(3)

%S The second as a decimal number. %U The week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week. %W The week number of the current year as a decimal number, starting with the first Monday as the first day of the first week. %w The day of the week as a decimal, Sunday being 0. %x The preferred date representation for the current locale without the time. %X The preferred time representation for the current locale without the date. %y The year as a decimal number without a century (range 00 to 99). %Y The year as a decimal number including the century. %Z The time zone or name or abbreviation. %% A literal `%' character. The broken-down time structure tm is defined in <time.h> as follows: struct tm { int tm_sec; /* seconds */ int tm_min; /* minutes */ int tm_hour; /* hours */ int tm_mday; /* day of the month */ int tm_mon; /* month */ int tm_year; /* year */ int tm_wday; /* day of the week */ int tm_yday; /* day in the year */ int tm_isdst; /* daylight saving time */ }; The members of the tm structure are: tm_sec The number of seconds after the minute, normally in the range 0 to 59, but can be up to 61 to allow for leap seconds. tm_min The number of minutes after the hour, in the range 0 to 59. tm_hour The number of hours past midnight, in the range 0

GNU July 2, 1993 2

STRFTIME(3) Linux Programmer's Manual STRFTIME(3)

to 23. tm_mday The day of the month, in the range 1 to 31. tm_mon The number of months since January, in the range 0 to 11. tm_year The number of years since 1900. tm_wday The number of days since Sunday, in the range 0 to 6. tm_yday The number of days since January 1, in the range 0 to 365. tm_isdst A flag that indicates whether daylight saving time is in effect at the time described. The value is positive if daylight saving time is in effect, zero if it is not, and negative if the information is not available.

RETURN VALUE

The strftime() function returns the number of characters placed in the array s, not including the terminating NULL character. If the value equals max, it means that the array was too small.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

date, time, ctime, setlocale, sprintf,


NOTES

The function supports only those locales specified in locale(7)

GNU July 2, 1993 3


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/cos.htm0000644000076400001440000000234007055335014014330 cos



COS(3) Linux Programmer's Manual COS(3)

NAME

cos - cosine function

SYNOPSIS

#include <math.h> double cos(double x);

DESCRIPTION

The cos() function returns the cosine of x, where x is given in radians.

RETURN VALUE

The cos() function returns a value between -1 and 1.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acos, asin, atan, atan2, sin, tan,






































                           June 8, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/setbuf.htm0000644000076400001440000001064607055335046015051 setbuf



SETBUF(3) Linux Programmer's Manual SETBUF(3)

NAME

setbuf, setbuffer, setlinebuf, setvbuf - stream buffering operations

SYNOPSIS

#include <stdio.h> int setbuf( FILE *stream, char *buf); int setbuffer( FILE *stream, char *buf, size_tsize); int setlinebuf( FILE *stream); int setvbuf( FILE *stream, char *buf, int mode , size_t size);

DESCRIPTION

The three types of buffering available are unbuffered, block buffered, and line buffered. When an output stream is unbuffered, information appears on the destination file or terminal as soon as written; when it is block buffered many characters are saved up and written as a block; when it is line buffered characters are saved up until a new- line is output or input is read from any stream attached to a terminal device (typically stdin). The function fflush(3) may be used to force the block out early. (See fclose(3).) Normally all files are block buffered. When the first I/O operation occurs on a file, malloc(3) is called, and a buffer is obtained. If a stream refers to a terminal (as stdout normally does) it is line buffered. The standard error stream stderr is always unbuffered. The setvbuf function may be used at any time on any open stream to change its buffer. The mode parameter must be one of the following three macros: _IONBF unbuffered _IOLBF line buffered _IOFBF fully buffered Except for unbuffered files, the buf argument should point to a buffer at least size bytes long; this buffer will be used instead of the current buffer. If the argument buf is NULL, only the mode is affected; a new buffer will be allocated on the next read or write operation. The setvbuf function may be used at any time, but can only change the mode of a stream when it is not ``active'': that is, before any I/O, or immediately after a call to fflush. The other three calls are, in effect, simply aliases for calls to setvbuf. The setbuf function is exactly equiva- lent to the call setvbuf(stream, buf, buf _IOFBF : _IONBF,

BSD MANPAGE 29 November 1993 1

SETBUF(3) Linux Programmer's Manual SETBUF(3)

BUFSIZ); The setbuffer function is the same, except that the size of the buffer is up to the caller, rather than being determined by the default BUFSIZ. The setlinebuf function is exactly equivalent to the call: setvbuf(stream, (char *)NULL, _IOLBF, 0);

SEE ALSO

fopen, fclose, fread, malloc, puts, printf,


STANDARDS

The setbuf and setvbuf functions conform to ANSI C3.159-1989 (``ANSI C'').

BUGS

The setbuffer and setlinebuf functions are not portable to versions of BSD before 4.2BSD, and may not be available under Linux. On 4.2BSD and 4.3BSD systems, setbuf always uses a suboptimal buffer size and should be avoided. You must make sure that both buf and the space it points to still exist by the time stream is closed, which also happens at program termination. For example, the following is illegal: #include <stdio.h> int main() { char buf[BUFSIZ]; setbuf(stdin, buf); printf("Hello, world!\n"); return 0; }

BSD MANPAGE 29 November 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/fabs.htm0000644000076400001440000000222707055335015014464 fabs



FABS(3) Linux Programmer's Manual FABS(3)

NAME

fabs - absolute value of floating-point number

SYNOPSIS

#include <math.h> double fabs(double x);

DESCRIPTION

The fabs() function returns the absolute value of the floating-point number x.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

abs, ceil, floor, , rint,









































                          June 25, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/gethostname.htm0000644000076400001440000000423207055334777016103 gethostname



GETHOSTNAME(2) Linux Programmer's Manual GETHOSTNAME(2)

NAME

gethostname, sethostname - get/set host name

SYNOPSIS

#include <unistd.h> int gethostname(char *name, size_t len); int sethostname(const char *name, size_t len);

DESCRIPTION

These functions are used to access or to change the host name of the current processor.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EINVAL len is negative or, for sethostname, len is larger than the maximum allowed size, or, for gethostname on Linux/i386, len is smaller than the actual size. EPERM For sethostname, the caller was not the superuser. EFAULT name is an invalid address.

CONFORMING TO

POSIX.1 does not define these functions, but ISO/IEC 9945-1:1990 mentions them in B.4.4.1.

BUGS

Some other implementations of gethostname successfully return len bytes even if name is longer. Linux/Alpha com- plies with this behaviour. Linux/i386, however, returns EINVAL in this case (as of DLL 4.6.27 libraries).

NOTES

Under Linux/Alpha, gethostname is a system call. Under Linux/i386, gethostname is implemented at the library level by calling uname(2).

SEE ALSO

getdomainname, setdomainname, uname,















Linux 1.3.6 22 July 1995 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/unsetenv.htm0000644000076400001440000000313007055334770015421 unsetenv



SETENV(3) Linux Programmer's Manual SETENV(3)

NAME

setenv - change or add an environment variable

SYNOPSIS

#include <stdlib.h> int setenv(const char *name, const char *value, int overwrite); void unsetenv(const char *name);

DESCRIPTION

The setenv() function adds the variable name to the envi- ronment with the value value, if name does not already exist. If name does exist in the environment, then its value is changed to value if overwrite is non-zero; if overwrite is zero, then the value of name is not changed. The unsetenv() function deletes the variable name from the environment.

RETURN VALUE

The setenv() function returns zero on success, or -1 if there was insufficient space in the environment.

CONFORMING TO

BSD 4.3

SEE ALSO

getenv, putenv,





























BSD April 4, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/mkdir.htm0000644000076400001440000001010407055334754014661 mkdir



MKDIR(2) Linux Programmer's Manual MKDIR(2)

NAME

mkdir - create a directory

SYNOPSIS

#include <sys/types.h> #include <fcntl.h> #include <unistd.h> int mkdir(const char *pathname, mode_t mode);

DESCRIPTION

mkdir attempts to create a directory named pathname. mode specifies the permissions to use. It is modified by the process's umask in the usual way: the permissions of the created file are (mode & ~umask). The newly created directory will be owned by the effective uid of the process. If the directory containing the file has the set group id bit set, or if the filesystem is mounted with BSD group semantics, the new directory will inherit the group ownership from its parent; otherwise it will be owned by the effective gid of the process. If the parent directory has the set group id bit set then so will the newly created directory.

RETURN VALUE

mkdir returns zero on success, or -1 if an error occurred (in which case, errno is set appropriately).

ERRORS

EEXIST pathname already exists (not necessarily as a directory). EFAULT pathname points outside your accessible address space. EACCES The parent directory does not allow write permis- sion to the process, or one of the directories in pathname did not allow search (execute) permission. ENAMETOOLONG pathname was too long. ENOENT A directory component in pathname does not exist or is a dangling symbolic link. ENOTDIR A component used as a directory in pathname is not, in fact, a directory. ENOMEM Insufficient kernel memory was available.

Linux 1.0 29 March 1994 1

MKDIR(2) Linux Programmer's Manual MKDIR(2)

EROFS pathname refers to a file on a read-only filesystem and write access was requested. ELOOP pathname contains a reference to a circular sym- bolic link, ie a symbolic link whose expansion con- tains a reference to itself. ENOSPC The device containing pathname has no room for the new directory. ENOSPC The new directory cannot be created because the user's disk quota is exhausted.

CONFORMING TO

BUGS

In some older versions of Linux (for example, 0.99pl7) all the normal filesystems sometime allow the creation of two files in the same directory with the same name. This occurs only rarely and only on a heavily loaded system. It is believed that this bug was fixed in the Minix filesystem in Linux 0.99pl8 pre-release; and it is hoped that it was fixed in the other filesystems shortly after- wards. There are many infelicities in the protocol underlying NFS.

SEE ALSO

read, write, fcntl, close, unlink, open, mknod, stat, umask, mount, socket, socket,





























Linux 1.0 29 March 1994 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/longjmp.htm0000644000076400001440000000362707055335013015222 longjmp



LONGJMP(3) Library functions LONGJMP(3)

NAME

longjmp - non-local jump to a saved stack context

SYNOPSIS

#include <setjmp.h> void longjmp(jmp_buf env, int val);

DESCRIPTION

longjmp() and setjmp(3) are useful for dealing with errors and interrupts encountered in a low-level subroutine of a program. longjmp() restores the environment saved by the last call of setjmp() with the corresponding env argument. After longjmp() is completed, program execution continues as if the corresponding call of setjmp() had just returned the value val. longjmp() cannot cause 0 to be returned. If longjmp is invoked with a second argument of 0, 1 will be returned instead.

RETURN VALUE

This function never returns.

CONFORMING TO

POSIX

NOTES

POSIX does not specify if the signal context will be restored or not. If you want to save restore signal masks, use siglongjmp(3) longjmp() makes programs hard to understand and maintain. If possible an alternative should be used.

SEE ALSO

setjmp, sigsetjmp, siglongjmp,
























                        November 25, 1994                       1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/div.htm0000644000076400001440000000234007055335022014325 div



DIV(3) Linux Programmer's Manual DIV(3)

NAME

div - computes the quotient and remainder of integer divi- sion

SYNOPSIS

#include <stdlib.h> div_t div(int numer, int denom);

DESCRIPTION

The div() function computes the value numer/denom and returns the quotient and remainder in a structure named div_t that contains two integer members named quot and rem.

RETURN VALUE

The div_t structure.

CONFORMING TO

SVID 3, BSD 4.3, ISO 9899

SEE ALSO

,



































                           June 6, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/getdid.htm0000644000076400001440000000252707055335062015016 getgid



GETGID(2) Linux Programmer's Manual GETGID(2)

NAME

getgid, getegid - get group identity

SYNOPSIS

#include <unistd.h> gid_t getgid(void); gid_t getegid(void);

DESCRIPTION

getgid returns the real group ID of the current process. getegid returns the effective group ID of the current pro- cess. The real ID corresponds to the ID of the calling process. The effective ID corresponds to the set ID bit on the file being executed.

ERRORS

These functions are always successful.

CONFORMS TO

POSIX, BSD 4.3

SEE ALSO

setregid, setgid,































Linux 0.99.11 23 July 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/setpgid.htm0000644000076400001440000000551007055335070015207 setpgid



SETPGID(2) Linux Programmer's Manual SETPGID(2)

NAME

setpgid, getpgid, setpgrp, getpgrp - set/get process group

SYNOPSIS

#include <unistd.h> int setpgid(pid_t pid, pid_t pgid); pid_t getpgid(pid_t pid); int setpgrp(void); pid_t getpgrp(void);

DESCRIPTION

setpgid sets the process group ID of the process specified by pid to pgid. If pid is zero, the process ID of the current process is used. If pgid is zero, the process ID of the process specified by pid is used. getpgid returns the process group ID of the process speci- fied by pid. If pid is zero, the process ID of the cur- rent process is used. In the Linux DLL 4.4.1 library, setpgrp simply calls setpgid(0,0). getpgrp is equivalent to getpgid(0). Process groups are used for distribution of signals, and by terminals to arbitrate requests for their input: pro- cesses that have the same process group as the terminal are foreground and may read, while others will block with a signal if they attempt to read. These calls are thus used by programs such as csh(1) to create process groups in implementing job control. The TIOCGPGRP and TIOCSPGRP calls described in termios(4) are used to get/set the process group of the control terminal.

RETURN VALUE

On success, setpgid and setpgrp return zero. On error, -1 is returned, and errno is set appropriately. getpgid returns a process group on success. On error, -1 is returned, and errno is set appropriately. getpgrp always returns the current process group.

ERRORS

EINVAL pgid is less than 0. EPERM Various permission violations. ESRCH pid does not match any process.

Linux 1.2.4 15 April 1995 1

SETPGID(2) Linux Programmer's Manual SETPGID(2)


SEE ALSO

getuid, setsid, tcsetpgrp, termios,
























































Linux 1.2.4 15 April 1995 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/setjmp.htm0000644000076400001440000000336107055335012015050 setjmp



SETJMP(3) Library functions SETJMP(3)

NAME

setjmp - save stack context for non-local goto

SYNOPSIS

#include <setjmp.h> int setjmp(jmp_buf env );

DESCRIPTION

setjmp and longjmp(3) are useful for dealing with errors and interrupts encountered in a low-level subroutine of a program. setjmp() saves the stack context/environment in env for later use by longjmp(). The stack context will be invalidated if the function which called setjmp() returns.

RETURN VALUE

It returns the value 0 if returning directly and non-zero when returning from longjmp() using the saved context.

CONFORMING TO

POSIX

NOTES

POSIX does not specify if the signal context will be saved or not. If you want to save signal masks, use sigsetjmp(3). setjmp() makes programs hard to understand and maintain. If possible an alternative should be used.

SEE ALSO

, sigsetjmp, siglongjmp,




























                        November 25, 1994                       1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/perlembed.htm0000644000076400001440000006015707055335105015516 perlembed



PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

NAME

perlembed - how to embed perl in your C program

DESCRIPTION

PREAMBLE Do you want to: Use C from Perl? Read the perlcall manpage and the perlxs manpage. Use a UNIX program from Perl? Read about backquotes and the system entry in the perlfunc manpage and the exec entry in the perlfunc manpage. Use Perl from Perl? Read about the do entry in the perlfunc manpage and the eval entry in the perlfunc manpage and the use entry in the perlmod manpage and the require entry in the perlmod manpage. Use C from C? Rethink your design. Use Perl from C? Read on... ROADMAP the section on Compiling your C program There's one example in each of the five sections: the section on Adding a Perl interpreter to your C program the section on Calling a Perl subroutine from your C program the section on Evaluating a Perl statement from your C program the section on Performing Perl pattern matches and substitutions from your C program the section on Fiddling with the Perl stack from your C program This documentation is UNIX specific. Compiling your C program Every C program that uses Perl must link in the perl library.

30/Jan/96 perl 5.003 with 1

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

What's that, you ask? Perl is itself written in C; the perl library is the collection of compiled C programs that were used to create your perl executable (/usr/bin/perl or equivalent). (Corollary: you can't use Perl from your C program unless Perl has been compiled on your machine, or installed properly--that's why you shouldn't blithely copy Perl executables from machine to machine without also copying the lib directory.) Your C program will--usually--allocate, "run", and deallocate a PerlInterpreter object, which is defined in the perl library. If your copy of Perl is recent enough to contain this documentation (5.002 or later), then the perl library (and EXTERN.h and perl.h, which you'll also need) will reside in a directory resembling this: /usr/local/lib/perl5/your_architecture_here/CORE or perhaps just /usr/local/lib/perl5/CORE or maybe something like /usr/opt/perl5/CORE Execute this statement for a hint about where to find CORE: perl -e 'use Config; print $Config{archlib}' Here's how you might compile the example in the next section, the section on Adding a Perl interpreter to your C program, on a DEC Alpha running the OSF operating system: % cc -o interp interp.c -L/usr/local/lib/perl5/alpha-dec_osf/CORE -I/usr/local/lib/perl5/alpha-dec_osf/CORE -lperl -lm You'll have to choose the appropriate compiler (cc, gcc, et al.) and library directory (/usr/local/lib/...) for your machine. If your compiler complains that certain functions are undefined, or that it can't locate -lperl, then you need to change the path following the -L. If it complains that it can't find EXTERN.h or perl.h, you need to change the path following the -I. You may have to add extra libraries as well. Which ones? Perhaps those printed by perl -e 'use Config; print $Config{libs}'

30/Jan/96 perl 5.003 with 2

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

Adding a Perl interpreter to youur C program In a sense, perl (the C program) is a good example of embedding Perl (the language), so I'll demonstrate embedding with miniperlmain.c, from the source distribution. Here's a bastardized, non-portable version of miniperlmain.c containing the essentials of embedding: #include <stdio.h> #include <EXTERN.h> /* from the Perl distribution */ #include <perl.h> /* from the Perl distribution */ static PerlInterpreter *my_perl; /*** The Perl interpreter ***/ int main(int argc, char **argv, char **env) { my_perl = perl_alloc(); perl_construct(my_perl); perl_parse(my_perl, NULL, argc, argv, env); perl_run(my_perl); perl_destruct(my_perl); perl_free(my_perl); } Now compile this program (I'll call it interp.c) into an executable: % cc -o interp interp.c -L/usr/local/lib/perl5/alpha-dec_osf/CORE -I/usr/local/lib/perl5/alpha-dec_osf/CORE -lperl -lm After a successful compilation, you'll be able to use interp just like perl itself: % interp print "Pretty Good Perl \n"; print "10890 - 9801 is ", 10890 - 9801; <CTRL-D> Pretty Good Perl 10890 - 9801 is 1089 or % interp -e 'printf("%x", 3735928559)' deadbeef You can also read and execute Perl statements from a file while in the midst of your C program, by placing the filename in argv[1] before calling perl_run(). Calling a Perl subroutine from yyour C program To call individual Perl subroutines, you'll need to remove the call to perl_run() and replace it with a call to perl_call_argv().

30/Jan/96 perl 5.003 with 3

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

That's shown below, in a program I'll call showtime.c. #include <stdio.h> #include <EXTERN.h> #include <perl.h> static PerlInterpreter *my_perl; int main(int argc, char **argv, char **env) { my_perl = perl_alloc(); perl_construct(my_perl); perl_parse(my_perl, NULL, argc, argv, env); /*** This replaces perl_run() ***/ perl_call_argv("showtime", G_DISCARD | G_NOARGS, argv); perl_destruct(my_perl); perl_free(my_perl); } where showtime is a Perl subroutine that takes no arguments (that's the G_NOARGS) and for which I'll ignore the return value (that's the G_DISCARD). Those flags, and others, are discussed in the perlcall manpage. I'll define the showtime subroutine in a file called showtime.pl: print "I shan't be printed."; sub showtime { print time; } Simple enough. Now compile and run: % cc -o showtime showtime.c -L/usr/local/lib/perl5/alpha-dec_osf/CORE -I/usr/local/lib/perl5/alpha-dec_osf/CORE -lperl -lm % showtime showtime.pl 818284590 yielding the number of seconds that elapsed between January 1, 1970 (the beginning of the UNIX epoch), and the moment I began writing this sentence. If you want to pass some arguments to the Perl subroutine, or you want to access the return value, you'll need to manipulate the Perl stack, demonstrated in the last section of this document: the section on Fiddling with the Perl stack from your C program

30/Jan/96 perl 5.003 with 4

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

Evaluating a Perl statement fr

om your C program

NOTE: This section, and the next, employ some very brittle techniques for evaluting strings of Perl code. Perl 5.002 contains some nifty features that enable A Better Way (such as with the perl_eval_sv entry in the perlguts manpage). Look for updates to this document soon. One way to evaluate a Perl string is to define a function (we'll call ours perl_eval()) that wraps around Perl's the eval entry in the perlfunc manpage. Arguably, this is the only routine you'll ever need to execute snippets of Perl code from within your C program. Your string can be as long as you wish; it can contain multiple statements; it can use the require entry in the perlmod manpage or the do entry in the perlfunc manpage to include external Perl files. Our perl_eval() lets us evaluate individual Perl strings, and then extract variables for coercion into C types. The following program, string.c, executes three Perl strings, extracting an int from the first, a float from the second, and a char * from the third.

30/Jan/96 perl 5.003 with 5

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

#include <stdio.h> #include <EXTERN.h> #include <perl.h> static PerlInterpreter *my_perl; int perl_eval(char *string) { char *argv[2]; argv[0] = string; argv[1] = NULL; perl_call_argv("_eval_", 0, argv); } main (int argc, char **argv, char **env) { char *embedding[] = { "", "-e", "sub _eval_ { eval $_[0] }" }; STRLEN length; my_perl = perl_alloc(); perl_construct( my_perl ); perl_parse(my_perl, NULL, 3, embedding, env); /** Treat $a as an integer **/ perl_eval("$a = 3; $a **= 2"); printf("a = %d\n", SvIV(perl_get_sv("a", FALSE))); /** Treat $a as a float **/ perl_eval("$a = 3.14; $a **= 2"); printf("a = %f\n", SvNV(perl_get_sv("a", FALSE))); /** Treat $a as a string **/ perl_eval("$a = 'rekcaH lreP rehtonA tsuJ'; $a = reverse($a); "); printf("a = %s\n", SvPV(perl_get_sv("a", FALSE), length)); perl_destruct(my_perl); perl_free(my_perl); } All of those strange functions with sv in their names help convert Perl scalars to C types. They're described in the perlguts manpage. If you compile and run string.c, you'll see the results of using SvIV() to create an int, SvNV() to create a float, and SvPV() to create a string: a = 9 a = 9.859600 a = Just Another Perl Hacker

30/Jan/96 perl 5.003 with 6

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

Performing Perl pattern matche

s and substitutions from

your C program Our perl_eval() lets us evaluate strings of Perl code, so we can define some functions that use it to "specialize" in matches and substitutions: match(), substitute(), and matches(). char match(char *string, char *pattern); Given a string and a pattern (e.g. "m/clasp/" or "/\b\w*\b/", which in your program might be represented as "/\\b\\w*\\b/"), returns 1 if the string matches the pattern and 0 otherwise. int substitute(char *string[], char *pattern); Given a pointer to a string and an "=~" operation (e.g. "s/bob/robert/g" or "tr[A-Z][a-z]"), modifies the string according to the operation, returning the number of substitutions made. int matches(char *string, char *pattern, char **matches[]); Given a string, a pattern, and a pointer to an empty array of strings, evaluates $string =~ $pattern in an array context, and fills in matches with the array elements (allocating memory as it does so), returning the number of matches found. Here's a sample program, match.c, that uses all three:

30/Jan/96 perl 5.003 with 7

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

#include <stdio.h> #include <EXTERN.h> #include <perl.h> static PerlInterpreter *my_perl; int eval(char *string) { char *argv[2]; argv[0] = string; argv[1] = NULL; perl_call_argv("_eval_", 0, argv); } /** match(string, pattern) ** ** Used for matches in a scalar context. ** ** Returns 1 if the match was successful; 0 otherwise. **/ char match(char *string, char *pattern) { char *command; command = malloc(sizeof(char) * strlen(string) + strlen(pattern) + 37); sprintf(command, "$string = '%s'; $return = $string =~ %s", string, pattern); perl_eval(command); free(command); return SvIV(perl_get_sv("return", FALSE)); } /** substitute(string, pattern) ** ** Used for =~ operations that modify their left-hand side (s/// and tr///) ** ** Returns the number of successful matches, and ** modifies the input string if there were any. **/ int substitute(char *string[], char *pattern) { char *command; STRLEN length; command = malloc(sizeof(char) * strlen(*string) + strlen(pattern) + 35); sprintf(command, "$string = '%s'; $ret = ($string =~ %s)", *string, pattern); perl_eval(command); free(command); *string = SvPV(perl_get_sv("string", FALSE), length); return SvIV(perl_get_sv("ret", FALSE)); } /** matches(string, pattern, matches) ** ** Used for matches in an array context.

30/Jan/96 perl 5.003 with 8

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

** ** Returns the number of matches, ** and fills in **matches with the matching substrings (allocates memory!) **/ int matches(char *string, char *pattern, char **matches[]) { char *command; SV *current_match; AV *array; I32 num_matches; STRLEN length; int i; command = malloc(sizeof(char) * strlen(string) + strlen(pattern) + 38); sprintf(command, "$string = '%s'; @array = ($string =~ %s)", string, pattern); perl_eval(command); free(command); array = perl_get_av("array", FALSE); num_matches = av_len(array) + 1; /** assume $[ is 0 **/ *matches = (char **) malloc(sizeof(char *) * num_matches); for (i = 0; i <= num_matches; i++) { current_match = av_shift(array); (*matches)[i] = SvPV(current_match, length); } return num_matches; } main (int argc, char **argv, char **env) { char *embedding[] = { "", "-e", "sub _eval_ { eval $_[0] }" }; char *text, **matches; int num_matches, i; int j; my_perl = perl_alloc(); perl_construct( my_perl ); perl_parse(my_perl, NULL, 3, embedding, env); text = (char *) malloc(sizeof(char) * 486); /** A long string follows! **/ sprintf(text, "%s", "When he is at a convenience store and the bill comes to some amount like 76 cents, Maynard is aware that there is something he *should* do, something that will enable him to get back a quarter, but he has no idea *what*. He fumbles through his red squeezey changepurse and gives the boy three extra pennies with his dollar, hoping that he might luck into the corre

ct amount. The boy gives him back two of his own pennies and then the big shiny quarter that is his prize. -RICHH");

if (perl_match(text, "m/quarter/")) /** Does text contain 'quarter'? **/ printf("perl_match: Text contains the word 'quarter'.\n\n"); else printf("perl_match: Text doesn't contain the word 'quarter'.\n\n"); if (perl_match(text, "m/eighth/")) /** Does text contain 'eighth'? **/ printf("perl_match: Text contains the word 'eighth'.\n\n"); else printf("perl_match: Text doesn't contain the word 'eighth'.\n\n"); /** Match all occurrences of /wi../ **/

30/Jan/96 perl 5.003 with 9

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

num_matches = perl_matches(text, "m/(wi..)/g", &matches); printf("perl_matches: m/(wi..)/g found %d matches...\n", num_matches); for (i = 0; i < num_matches; i++) printf("match: %s\n", matches[i]); printf("\n"); for (i = 0; i < num_matches; i++) { free(matches[i]); } free(matches); /** Remove all vowels from text **/ num_matches = perl_substitute(&text, "s/[aeiou]//gi"); if (num_matches) { printf("perl_substitute: s/[aeiou]//gi...%d substitutions made.\n", num_matches); printf("Now text is: %s\n\n", text); } /** Attempt a substitution if (!perl_substitute(&text, "s/Perl/C/")) { printf("perl_substitute: s/Perl/C...No substitution made.\n\n"); } free(text); perl_destruct(my_perl); perl_free(my_perl); } which produces the output perl_match: Text contains the word 'quarter'. perl_match: Text doesn't contain the word 'eighth'. perl_matches: m/(wi..)/g found 2 matches... match: will match: with perl_substitute: s/[aeiou]//gi...139 substitutions made. Now text is: Whn h s t cnvnnc str nd th bll cms t sm mnt lk 76 cnts, Mynrd s wr tht thr s smthng h *shld* d, smthng tht wll nbl hm t gt bck qrtr, bt h hs n d *wht*. H fmbls thrgh hs rd s

qzy chngprs nd gvs th by thr xtr pnns wth hs dllr, hpng tht h mght lck nt th crrct mnt. Th by gvs hm bck tw f hs wn pnns nd thn th bg shny qrtr tht s hs prz. -RCHH

perl_substitute: s/Perl/C...No substitution made. =head2 Fiddling with the Perl stack from your C program When trying to explain stacks, most computer science textbooks mumble something about spring-loaded columns of cafeteria plates: the last thing you pushed on the stack is the first thing you pop off. That'll do for our purposes: your C program will push some arguments onto "the Perl stack", shut its eyes while some magic happens, and then pop the results--the return value of your Perl

30/Jan/96 perl 5.003 with 10

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

subroutine--off the stack. First you'll need to know how to convert between C types and Perl types, with newSViv() and sv_setnv() and newAV() and all their friends. They're described in the perlguts manpage. Then you'll need to know how to manipulate the Perl stack. That's described in the perlcall manpage. Once you've understood those, embedding Perl in C is easy. Since C has no built-in function for integer exponentiation, let's make Perl's ** operator available to it (this is less useful than it sounds, since Perl implements ** with C's pow() function). First I'll create a stub exponentiation function in power.pl: sub expo { my ($a, $b) = @_; return $a ** $b; } Now I'll create a C program, power.c, with a function PerlPower() that contains all the perlguts necessary to push the two arguments into expo() and to pop the return value out. Take a deep breath...

30/Jan/96 perl 5.003 with 11

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

#include <stdio.h> #include <EXTERN.h> #include <perl.h> static PerlInterpreter *my_perl; static void PerlPower(int a, int b) { dSP; /* initialize stack pointer */ ENTER; /* everything created after here */ SAVETMPS; /* ...is a temporary variable. */ PUSHMARK(sp); /* remember the stack pointer */ XPUSHs(sv_2mortal(newSViv(a))); /* push the base onto the stack */ XPUSHs(sv_2mortal(newSViv(b))); /* push the exponent onto stack */ PUTBACK; /* make local stack pointer global */ perl_call_pv("expo", G_SCALAR); /* call the function */ SPAGAIN; /* refresh stack pointer */ /* pop the return value from stack */ printf ("%d to the %dth power is %d.\n", a, b, POPi); PUTBACK; FREETMPS; /* free that return value */ LEAVE; /* ...and the XPUSHed "mortal" args.*/ } int main (int argc, char **argv, char **env) { char *my_argv[2]; my_perl = perl_alloc(); perl_construct( my_perl ); my_argv[1] = (char *) malloc(10); sprintf(my_argv[1], "power.pl"); perl_parse(my_perl, NULL, argc, my_argv, env); PerlPower(3, 4); /*** Compute 3 ** 4 ***/ perl_destruct(my_perl); perl_free(my_perl); } Compile and run: % cc -o power power.c -L/usr/local/lib/perl5/alpha-dec_osf/CORE -I/usr/local/lib/perl5/alpha-dec_osf/CORE -lperl -lm % power 3 to the 4th power is 81.

30/Jan/96 perl 5.003 with 12

PERLEMBED(1) Perl Programmers Reference Guide PERLEMBED(1)

MORAL

You can sometimes write faster code in C, but you can always write code faster in Perl. Since you can use each from the other, combine them as you wish.

AUTHOR

Jon Orwant <orwant@media.mit.edu>, with contributions from Tim Bunce, Tom Christiansen, Dov Grobgeld, and Ilya Zakharevich. December 18, 1995 Some of this material is excerpted from my book: Perl 5 Interactive, Waite Group Press, 1996 (ISBN 1-57169-064-6) and appears courtesy of Waite Group Press.

30/Jan/96 perl 5.003 with 13


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/uname.htm0000644000076400001440000000320007055334777014664 uname



UNAME(2) Linux Programmer's Manual UNAME(2)

NAME

uname - get name and information about current kernel

SYNOPSIS

#include <sys/utsname.h> int uname(struct utsname *buf);

DESCRIPTION

uname returns system information in buf. The utsname struct is as defined in /usr/include/sys/utsname.h : struct utsname { char sysname[65]; char nodename[65]; char release[65]; char version[65]; char machine[65]; char domainname[65]; };

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EFAULT buf is not valid.

CONFORMING TO

SVID, AT&T, POSIX, X/OPEN

SEE ALSO

uname, getdomainname, gethostname,


























Linux 0.99.11 24 July 93 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/strcoll.htm0000644000076400001440000000376407055335004015240 strcoll



STRCOLL(3) Linux Programmer's Manual STRCOLL(3)

NAME

strcoll - compare two strings using the current locale

SYNOPSIS

#include <string.h> int strcoll(const char *s1, const char *s2);

DESCRIPTION

The strcoll() function compares the two strings s1 and s2. It returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2. The comparison is based on strings interpreted as appropriate for the program's cur- rent locale for category LC_COLLATE. (See setlocale(3)).

RETURN VALUE

The strcoll() function returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2, when both are interpreted as appropriate for the current locale.

CONFORMING TO

SVID 3, BSD 4.3, ISO 9899

NOTES

The Linux C Library currently hasn't implemented the com- plete POSIX-collating. In the "POSIX" or "C" locales strcoll() is equivalent to strcmp().

SEE ALSO

bcmp, memcmp, strcasecmp, strcmp, strxfrm, setlocale,























GNU April 12, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/fflush.htm0000644000076400001440000000434607055335043015045 fflush



FFLUSH(3) Linux Programmer's Manual FFLUSH(3)

NAME

fflush, fpurge - flush a stream

SYNOPSIS

#include <stdio.h> int fflush( FILE *stream); int fpurge( FILE *stream);

DESCRIPTION

The function fflush forces a write of all buffered data for the given output or update stream via the stream's underlying write function. The open status of the stream is unaffected. If the stream argument is NULL, fflush flushes all open output streams. (Does this happen under Linux) The function fpurge erases any input or output buffered in the given stream. For output streams this discards any unwritten output. For input streams this discards any input read from the underlying object but not yet obtained via getc(3); this includes any text pushed back via ungetc.

RETURN VALUES

Upon successful completion 0 is returned. Otherwise, EOF is returned and the global variable errno is set to indi- cate the error.

ERRORS

EBADF Stream is not an open stream, or, in the case of fflush, not a stream open for writing. The function fflush may also fail and set errno for any of the errors specified for the routine write(2).

BUGS

Linux may not support fpurge.

SEE ALSO

write, fopen, fclose, setbuf,


STANDARDS

The fflush function conforms to ANSI C3.159-1989 (``ANSI C'').

BSD MANPAGE 29 November 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/memchr.htm0000644000076400001440000000311007055335001015007 memchr



MEMCHR(3) Linux Programmer's Manual MEMCHR(3)

NAME

memchr - scan memory for a character

SYNOPSIS

#include <string.h> void *memchr(const void *s, int c, size_t n);

DESCRIPTION

The memchr() function scans the first n bytes of the mem- ory area pointed to by s for the character c. The first byte to match c (interpreted as an unsigned character) stops the operation.

RETURN VALUE

The memchr() function returns a pointer to the matching byte or NULL if the character does not occur in the given memory area.

CONFORMING TO

SVID 3, BSD 4.3, ISO 9899

SEE ALSO

index, rindex, strchr, strpbrk, strrchr, strsep, strspn, strstr,

































GNU April 12, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/toupper.htm0000644000076400001440000000334607055334744015262 toupper



TOUPPER(3) Linux Programmer's Manual TOUPPER(3)

NAME

toupper, tolower - convert letter to upper or lower case

SYNOPSIS

#include <ctype.h> int toupper (int c); int tolower (int c);

DESCRIPTION

toupper() converts the letter c to upper case, if possi- ble. tolower() converts the letter c to lower case, if possi- ble.

RETURN VALUE

The value returned is that of the converted letter, or c if the conversion was not possible.

CONFORMS TO

ANSI - C, BSD 4.3

BUGS

The details of what constitutes an uppercase or lowercase letter depend on the current locale. For example, the default "C" locale does not know about umlauts, so no con- version is done for them. In some non - English locales, there are lowercase letters with no corresponding uppercase equivalent; the German sharp s is one example.

SEE ALSO

isalpha, setlocale, locale,























GNU April 4, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/ldiv.htm0000644000076400001440000000237707055335023014514 ldiv



LDIV(3) Linux Programmer's Manual LDIV(3)

NAME

ldiv - computes the quotient and remainder of long integer division.

SYNOPSIS

#include <stdlib.h> ldiv_t ldiv(long int numer, long int denom);

DESCRIPTION

The ldiv() function computes the value numer/denom and returns the quotient and remainder in a structure named ldiv_t that contains two long integer members named quot and rem.

RETURN VALUE

The ldiv_t structure.

CONFORMING TO

SVID 3, BSD 4.3, ISO 9899

SEE ALSO

div,



































GNU March 29, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/strpbrk.htm0000644000076400001440000000273307055334776015257 strpbrk



STRPBRK(3) Linux Programmer's Manual STRPBRK(3)

NAME

strpbrk - search a string for any of a set of characters

SYNOPSIS

#include <string.h> char *strpbrk(const char *s, const char *accept);

DESCRIPTION

The strpbrk() function locates the first occurrence in the string s of any of the characters in the string accept.

RETURN VALUE

The strpbrk() function returns a pointer to the character in s that matches one of the characters in accept.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

index, memchr, rindex, strchr, strsep, spn, strstr, strtok,




































                          April 12, 1993                        1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/memmove.htm0000644000076400001440000000245007055335003015211 memmove



MEMMOVE(3) Linux Programmer's Manual MEMMOVE(3)

NAME

memmove - copy memory area

SYNOPSIS

#include <string.h> void *memmove(void *dest, const void *src, size_t n);

DESCRIPTION

The memmove() function copies n bytes from memory area src to memory area dest. The memory areas may overlap.

RETURN VALUE

The memmove() function returns a pointer to dest.

CONFORMING TO

SVID 3, BSD 4.3, ISO 9899

SEE ALSO

bcopy, memccpy, memcpy, strcpy, strncpy,






































GNU April 10, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/calloc.htm0000644000076400001440000000512207055335022015001 calloc



MALLOC(3) Linux Programmer's Manual MALLOC(3)

NAME

calloc, malloc, free, realloc - Allocate and free dynamic memory

SYNOPSIS

#include <stdlib.h> void *calloc(size_t nmemb, size_t size); void *malloc(size_t size); void free(void *ptr); void *realloc(void *ptr, size_t size);

DESCRIPTION

calloc() allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. malloc() allocates size bytes and returns a pointer to the allocated memory. The memory is not cleared. free() frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() or realloc(). If ptr is NULL, no operation is performed. realloc() changes the size of the memory block pointed to by ptr to size bytes. The contents will be unchanged to the minimum of the old an new sizes; newly allocated mem- ory will be uninitialized. If ptr is NULL, the call is equivalent to malloc(size); if size is equal to zero, the call is equivalent to free(ptr). Unless ptr is NULL, it must have been returned by an earlier call to malloc(), calloc() or realloc().

RETURN VALUES

For calloc() and malloc(), the value returned is a pointer to the allocated memory, which is suitably aligned for any kind of variable, or NULL if the request fails. free() returns no value. realloc() returns a pointer to the newly allocated memory, which is suitably aligned for any kind of variable and may be different from ptr, or NULL if the request fails or if size was equal to 0. If realloc() fails the original block is left untouched - it is not freed or moved.

CONFORMS TO

ANSI - C

SEE ALSO

brk,






GNU April 4, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/ioctl.htm0000644000076400001440000000424607055335000014660 ioctl



IOCTL(2) Linux Programmer's Manual IOCTL(2)

NAME

ioctl - control device

SYNOPSIS

#include <sys/ioctl.h> int ioctl(int d, int request, ...) [The "third" argument is traditionally char *argp, and will be so named for this discussion.]

DESCRIPTION

The ioctl function manipulates the underlying device parameters of special files. In particular, many operat- ing characteristics of character special files (e.g. ter- minals) may be controlled with ioctl requests. The argu- ment d must be an open file descriptor. An ioctl request has encoded in it whether the argument is an in parameter or out parameter, and the size of the argument argp in bytes. Macros and defines used in speci- fying an ioctl request are located in the file sys/ioctl.h.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EBADF d is not a valid descriptor. ENOTTY d is not associated with a character special device. ENOTTY The specified request does not apply to the kind of object that the descriptor d references. EINVAL Request or argp is not valid.

HISTORY

An ioctl function call appeared in Version 7 AT&T UNIX.

SEE ALSO

execve, fcntl, mt, sd, tty,














BSD Man Page 23 July 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/ungetc.htm0000644000076400001440000000735507055334766015061 ungetc



GETS(3) Linux Programmer's Manual GETS(3)

NAME

fgetc, fgets, getc, getchar, gets, ungetc - input of char- acters and strings

SYNOPSIS

#include <stdio.h> int fgetc(FILE *stream); char *fgets(char *s, int size, FILE *stream); int getc(FILE *stream); int getchar(void); char *gets(char *s); int ungetc(int c, FILE *stream);

DESCRIPTION

fgetc() reads the next character from stream and returns it as an unsigned char cast to an int, or EOF on end of file or error. getc() is equivalent to fgetc() except that it may be implemented as a macro which evaluates stream more than once. getchar() is equivalent to getc(stdin). gets() reads a line from stdin into the buffer pointed to by s until either a terminating newline or EOF, which it replaces with '\0'. No check for buffer overrun is per- formed (see BUGS below). fgets() reads in at most one less than n characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after the last character in the buffer. ungetc() pushes c back to stream, cast to unsigned char, where it is available for subsequent read operations. Pushed - back characters will be returned in reverse order; only one pushback is guaranteed. Calls to the functions described here can be mixed with each other and with calls to other input functions from the stdio library for the same input stream.

RETURN VALUES

fgetc(), getc() and getchar() return the character read as an unsigned char cast to an int or EOF on end of file or error. gets() and fgets() return s on success, and NULL on end of file or error. ungetc() returns c on success, or EOF on error.

GNU April 4, 1993 1

GETS(3) Linux Programmer's Manual GETS(3)

CONFORMS TO

ANSI - C, POSIX.1

BUGS

Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store characters past the end of the buffer, it is extremely dangerous to use. It has been used to break computer security. Use fgets() instead. It is not advisable to mix calls to input functions from the stdio library with low - level calls to read() for the file descriptor associated with the input stream; the results will be undefined and very probably not what you want.

SEE ALSO

read, write, fopen, fread, scanf, puts, fseek, ferror,






































GNU April 4, 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/rmdir.htm0000644000076400001440000000602307055334753014674 rmdir



RMDIR(2) Linux Programmer's Manual RMDIR(2)

NAME

rmdir - delete a directory

SYNOPSIS

#include <unistd.h> int rmdir(const char *pathname);

DESCRIPTION

rmdir deletes a directory, which must be empty.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EPERM The filesystem containing pathname does not sup- port the removal of directories. EFAULT pathname points outside your accessible address space. EACCES Write access to the directory containing pathname was not allowed for the process's effective uid, or one of the directories in pathname did not allow search (execute) permission. EPERM The directory containing pathname has the sticky- bit (S_ISVTX) set and the process's effective uid is neither the uid of the file to be deleted nor that of the directory containing it. ENAMETOOLONG pathname was too long. ENOENT A directory component in pathname does not exist or is a dangling symbolic link. ENOTDIR pathname, or a component used as a directory in pathname, is not, in fact, a directory. ENOTEMPTY pathname contains entries other than . and .. . EBUSY pathname is the current working directory or root directory of some process. ENOMEM Insufficient kernel memory was available. EROFS pathname refers to a file on a read-only filesys- tem. ELOOP pathname contains a reference to a circular sym- bolic link, ie a symbolic link containing a

Linux 0.99.7 24 July 1993 1

RMDIR(2) Linux Programmer's Manual RMDIR(2)

reference to itself.

CONFORMING TO

SVID, AT&T, POSIX, BSD 4.3

BUGS

Infelicities in the protocol underlying NFS can cause the unexpected disappearance of directories which are still being used.

SEE ALSO

rename, mkdir, chdir, unlink,














































Linux 0.99.7 24 July 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/sinh.htm0000644000076400001440000000225707055335020014511 sinh



SINH(3) Linux Programmer's Manual SINH(3)

NAME

sinh - hyperbolic sine function

SYNOPSIS

#include <math.h> double sinh(double x);

DESCRIPTION

The sinh() function returns the hyperbolic sine of x, which is defined mathematically as exp(x) - exp(-x) / 2.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acosh, asinh, atanh, cosh, tanh,









































                          June 13, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/memcmp.htm0000644000076400001440000000322007055335001015014 memcmp



MEMCMP(3) Linux Programmer's Manual MEMCMP(3)

NAME

memcmp - compare memory areas

SYNOPSIS

#include <string.h> int memcmp(const void *s1, const void *s2, size_t n);

DESCRIPTION

The memcmp() function compares the first n bytes of the memory areas s1 and s2. It returns an integer less than, equal to, or greater than zero if s1 is found, respec- tively, to be less than, to match, or be greater than s2.

RETURN VALUE

The memcmp() function returns an integer less than, equal to, or greater than zero if the first n bytes of s1 is found, respectively, to be less than, to match, or be greater than the first n bytes of s2.

CONFORMING TO

SVID 3, BSD 4.3, ISO 9899

SEE ALSO

bcmp, strcasecmp, strcmp, strcoll, strncmp, strncasecmp,
































                          April 10, 1993                        1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/sin.htm0000644000076400001440000000233007055335017014337 sin



SIN(3) Linux Programmer's Manual SIN(3)

NAME

sin - sine function

SYNOPSIS

#include <math.h> double sin(double x);

DESCRIPTION

The sin() function returns the sine of x, where x is given in radians.

RETURN VALUE

The sin() function returns a value between -1 and 1.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acos, asin, atan, atan2, cos, tan,






































                           June 8, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/sleep.htm0000644000076400001440000000277507055334743014700 sleep



SLEEP(3) Linux Programmer's Manual SLEEP(3)

NAME

sleep - Sleep for the specified number of seconds

SYNOPSIS

#include <unistd.h> unsigned int sleep(unsigned int seconds);

DESCRIPTION

sleep() makes the current process sleep until seconds sec- onds have elapsed or a signal arrives which is not ignored.

RETURN VALUE

Zero if the requested time has elapsed, or the number of seconds left to sleep.

CONFORMS TO

POSIX.1

BUGS

sleep() may be implemented using SIGALRM; mixing calls to alarm() and sleep() is a bad idea. Using longjmp() from a signal handler or modifying the handling of SIGALRM while sleeping will cause undefined results.

SEE ALSO

signal, alarm,




























GNU April 7, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/fscanf.htm0000644000076400001440000002710107055335051015007 fscanf



SCANF(3) Linux Programmer's Manual SCANF(3)

NAME

scanf, fscanf, sscanf, vscanf, vsscanf, vfscanf - input format conversion

SYNOPSIS

#include <stdio.h> int scanf( const char *format, ...); int fscanf( FILE *stream, const char *format, ...); int sscanf( const char *str, const char *format, ...); #include <stdarg.h> int vscanf( const char *format, va_list ap); int vsscanf( const char *str, const char *format, va_list ap); int vfscanf( FILE *stream, const char *format, va_list ap);

DESCRIPTION

The scanf family of functions scans input according to a format as described below. This format may contain con- version specifiers; the results from such conversions, if any, are stored through the pointer arguments. The scanf function reads input from the standard input stream stdin, fscanf reads input from the stream pointer stream, and sscanf reads its input from the character string pointed to by str. The vfscanf function is analogous to vfprintf(3) and reads input from the stream pointer stream using a variable argument list of pointers (see stdarg(3). The vscanf function scans a variable argument list from the standard input and the vsscanf function scans it from a string; these are analogous to the vprintf and vsprintf functions respectively. Each successive pointer argument must correspond properly with each successive conversion specifier (but see `sup- pression' below). All conversions are introduced by the % (percent sign) character. The format string may also con- tain other characters. White space (such as blanks, tabs, or newlines) in the format string match any amount of white space, including none, in the input. Everything else matches only itself. Scanning stops when an input character does not match such a format character. Scan- ning also stops when an input conversion cannot be made (see below).

CONVERSIONS

Following the % character introducing a conversion there may be a number of flag characters, as follows: * Suppresses assignment. The conversion that follows occurs as usual, but no pointer is used; the result of the conversion is simply discarded. h Indicates that the conversion will be one of dioux

BSD MANPAGE 29 November 1993 1

SCANF(3) Linux Programmer's Manual SCANF(3)

or n and the next pointer is a pointer to a short int (rather than int). l Indicates either that the conversion will be one of dioux or n and the next pointer is a pointer to a long int (rather than int), or that the conversion will be one of efg and the next pointer is a pointer to double (rather than float). L Indicates that the conversion will be efg and the next pointer is a pointer to long double. (This type is not implemented; the L flag is currently ignored--this may not be true for Linux.) In addition to these flags, there may be an optional maxi- mum field width, expressed as a decimal integer, between the % and the conversion. If no width is given, a default of `infinity' is used (with one exception, below); other- wise at most this many characters are scanned in process- ing the conversion. Before conversion begins, most con- versions skip white space; this white space is not counted against the field width. The following conversions are available: % Matches a literal `%'. That is, `%%' in the format string matches a single input `%' character. No conversion is done, and assignment does not occur. d Matches an optionally signed decimal integer; the next pointer must be a pointer to int. D Equivalent to ld; this exists only for backwards compatibility. i Matches an optionally signed integer; the next pointer must be a pointer to int. The integer is read in base 16 if it begins with `0x' or `0X', in base 8 if it begins with `0', and in base 10 other- wise. Only characters that correspond to the base are used. o Matches an octal integer; the next pointer must be a pointer to unsigned int. O Equivalent to lo; this exists for backwards compat- ibility. u Matches an optionally signed decimal integer; the next pointer must be a pointer to unsigned int. x Matches an optionally a signed hexadecimal integer; the next pointer must be a pointer to unsigned int.

BSD MANPAGE 29 November 1993 2

SCANF(3) Linux Programmer's Manual SCANF(3)

X Equivalent to lx; this violates the ANSI C3.159-1989 (``ANSI C'') but is backwards compati- ble with previous UNIX systems--I don't know what Linux does with this. f Matches an optionally signed floating-point number; the next pointer must be a pointer to float. e Equivalent to f. g Equivalent to f. E Equivalent to lf; this violates the ANSI C3.159-1989 (``ANSI C'') but is backwards compati- ble with previous UNIX systems--I don't know what Linux does with this. F Equivalent to lf; this exists only for backwards compatibility. s Matches a sequence of non-white-space characters; the next pointer must be a pointer to char, and the array must be large enough to accept all the sequence and the terminating NUL character. The input string stops at white space or at the maximum field width, whichever occurs first. c Matches a sequence of width count characters (default 1); the next pointer must be a pointer to char, and there must be enough room for all the characters (no terminating NUL is added). The usual skip of leading white space is suppressed. To skip white space first, use an explicit space in the format. [ Matches a nonempty sequence of characters from the specified set of accepted characters; the next pointer must be a pointer to char, and there must be enough room for all the characters in the string, plus a terminating NUL character. The usual skip of leading white space is suppressed. The string is to be made up of characters in (or not in) a particular set; the set is defined by the characters between the open bracket [ character and a close bracket ] character. The set excludes those characters if the first character after the open bracket is a circumflex ^. To include a close bracket in the set, make it the first character after the open bracket or the circumflex; any other position will end the set. The hyphen character - is also special; when placed between two other characters, it adds all intervening characters to the set. To include a hyphen, make it the last character before the final close bracket. For

BSD MANPAGE 29 November 1993 3

SCANF(3) Linux Programmer's Manual SCANF(3)

instance, `[^]0-9-]' means the set `everything except close bracket, zero through nine, and hyphen'. The string ends with the appearance of a character not in the (or, with a circumflex, in) set or when the field width runs out. p Matches a pointer value (as printed by `%p' in printf(3); the next pointer must be a pointer to void. n Nothing is expected; instead, the number of charac- ters consumed thus far from the input is stored through the next pointer, which must be a pointer to int. This is not a conversion, although it can be suppressed with the * flag. For backwards compatibility, other conversion characters (except `\0') are taken as if they were `%d' or, if upper- case, `%ld', and a `conversion' of `%\0' causes an immedi- ate return of EOF. The F and X conversions will be changed in the future to conform to the ANSI C standard, after which they will act like and respectively. The behavior of Linux on the non-standard points is not known by this documenter.

RETURN VALUES

These functions return the number of input items assigned, which can be fewer than provided for, or even zero, in the event of a matching failure. Zero indicates that, while there was input available, no conversions were assigned; typically this is due to an invalid input character, such as an alphabetic character for a `%d' conversion. The value EOF is returned if an input failure occurs before any conversion such as an end-of-file occurs. If an error or end-of-file occurs after conversion has begun, the num- ber of conversions which were successfully completed is returned.

SEE ALSO

strtol, strtoul, strtod, getc, printf,


STANDARDS

The functions fscanf, scanf, and sscanf conform to ANSI C3.159-1989 (``ANSI C'').

BUGS

Differences for Linux are not known at this time. The following is for the BSD version: The current situation with %F and %X conversions is unfor- tunate. All of the backwards compatibility formats will be removed

BSD MANPAGE 29 November 1993 4

SCANF(3) Linux Programmer's Manual SCANF(3)

in the future. Numerical strings are truncated to 512 characters; for example, %f and %d are implicitly %512f and %512d.

BSD MANPAGE 29 November 1993 5


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/memcpy.htm0000644000076400001440000000254207055335002015037 memcpy



MEMCPY(3) Linux Programmer's Manual MEMCPY(3)

NAME

memcpy - copy memory area

SYNOPSIS

#include <string.h> void *memcpy(void *dest, const void *src, size_t n);

DESCRIPTION

The memcpy() function copies n bytes from memory area src to memory area dest. The memory areas may not overlap. Use memmove(3) if the memory areas do overlap.

RETURN VALUE

The memcpy() function returns a pointer to dest.

CONFORMING TO

SVID 3, BSD 4.3, ISO 9899

SEE ALSO

bcopy, memccpy, memmove, strcpy, strncpy,





































GNU April 10, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/modf.htm0000644000076400001440000000244707055335017014504 modf



MODF(3) Linux Programmer's Manual MODF(3)

NAME

modf - extract signed integral and fractional values from floating-point number

SYNOPSIS

#include <math.h> double modf(double x, double *iptr);

DESCRIPTION

The modf() function breaks the argument x into an integral part and a fractional part, each of which has the same sign as x. The integral part is stored in iptr.

RETURN VALUE

The modf() function returns the fractional part of x.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

frexp, ,




































                           June 6, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/telldir.htm0000644000076400001440000000265407055334763015225 telldir



TELLDIR(3) Linux Programmer's Manual TELLDIR(3)

NAME

telldir - return current location in directory stream.

SYNOPSIS

#include <dirent.h> off_t telldir(DIR *dir);

DESCRIPTION

The telldir() function returns the current location asso- ciated with the directory stream dir.

RETURN VALUE

The telldir() function returns the current location in the directory stream or -1 if an error occurs.

ERRORS

EBADF Invalid directory stream descriptor dir.

CONFORMING TO

BSD 4.3

SEE ALSO

opendir, readdir, closedir, rewinddir, seekdir, scandir,

































                          March 31, 1993                        1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/atan2.htm0000644000076400001440000000272307055335007014560 atan2



ATAN2(3) Linux Programmer's Manual ATAN2(3)

NAME

atan2 - arc tangent function of two variables

SYNOPSIS

#include <math.h> double atan2(double y, double x);

DESCRIPTION

The atan2() function calculates the arc tangent of the two variables x and y. It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result.

RETURN VALUE

The atan2() function returns the result in radians, which is between -PI and PI (inclusive).

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acos, asin, atan, cos, sin, tan,



































                           June 8, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/chroot.htm0000644000076400001440000000415007055335057015052 chroot



CHROOT(2) Linux Programmer's Manual CHROOT(2)

NAME

chroot - change root directory

SYNOPSIS

#include <unistd.h> int chroot(const char *path);

DESCRIPTION

chroot changes the root directory to that specified in path. This directory will be used for path name beginning with /. The root directory is inherited by all children of the current process. Only the super-user may change the root directory.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

Depending on the file system, other errors can be returned. The more general errors are listed below: EPERM The effective UID does not match the owner of the file, and is not zero; or the owner or group were specified incorrectly. EROFS The named file resides on a read-only file system. EFAULT path points outside your accessible address space. ENAMETOOLONG path is too long. ENOENT The file does not exist. ENOMEM Insufficient kernel memory was available. ENOTDIR A component of the path prefix is not a directory. EACCES Search permission is denied on a component of the path prefix. ELOOP path contains a circular reference (i.e., via a symbolic link)

SEE ALSO

chdir,








Linux 1.1.46 21 August 1994 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/tan.htm0000644000076400001440000000222107055335021014322 tan



TAN(3) Linux Programmer's Manual TAN(3)

NAME

tan - tangent function

SYNOPSIS

#include <math.h> double tan(double x);

DESCRIPTION

The tan() function returns the tangent of x, where x is given in radians.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acos, asin, atan, atan2, cos, sin,









































                           June 8, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/getenv.htm0000644000076400001440000000252507055334766015056 getenv



GETENV(3) Linux Programmer's Manual GETENV(3)

NAME

getenv - get an environment variable

SYNOPSIS

#include <stdlib.h> char *getenv(const char *name);

DESCRIPTION

The getenv() function searches the environment list for a string that matches the string pointed to by name. The strings are of the form name = value.

RETURN VALUE

The getenv() function returns a pointer to the value in the environment, or NULL if there is no match.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

putenv, setenv, unsetenv,




































GNU April 3, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/fgetpos.htm0000644000076400001440000000700407055335040015214 fgetpos



FSEEK(3) Linux Programmer's Manual FSEEK(3)

NAME

fgetpos, fseek, fsetpos, ftell, rewind - reposition a stream

SYNOPSIS

#include <stdio.h> int fseek( FILE *stream, long offset, int whence); long ftell( FILE *stream); void rewind( FILE *stream); int fgetpos( FILE *stream, fpos_t *pos); int fsetpos( FILE *stream, fpos_t *pos);

DESCRIPTION

The fseek function sets the file position indicator for the stream pointed to by stream. The new position, mea- sured in bytes, is obtained by adding offset bytes to the position specified by whence. If whence is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the start of the file, the current position indicator, or end-of-file, respectively. A successful call to the fseek function clears the end-of-file indicator for the stream and undoes any effects of the ungetc(3) function on the same stream. The ftell function obtains the current value of the file position indicator for the stream pointed to by stream. The rewind function sets the file position indicator for the stream pointed to by stream to the beginning of the file. It is equivalent to: (void)fseek(stream, 0L, SEEK_SET) except that the error indicator for the stream is also cleared (see clearerr(3). The fgetpos and fsetpos functions are alternate interfaces equivalent to ftell and fseek (with whence set to SEEK_SET), setting and storing the current value of the file offset into or from the object referenced by pos. On some non-UNIX systems an fpos_t object may be a complex object and these routines may be the only way to portably reposition a text stream.

RETURN VALUES

The rewind function returns no value. Upon successful completion, fgetpos, fseek, fsetpos return 0, and ftell returns the current offset. Otherwise, -1 is returned and the global variable errno is set to indicate the error.

ERRORS

EBADF The stream specified is not a seekable stream.

BSD MANPAGE 29 November 1993 1

FSEEK(3) Linux Programmer's Manual FSEEK(3)

EINVAL The whence argument to fseek was not SEEK_SET, SEEK_END, or SEEK_CUR. The function fgetpos, fseek, fsetpos, and ftell may also fail and set errno for any of the errors specified for the routines fflush(3), fstat(2), lseek(2), and malloc(3).

SEE ALSO

lseek,


STANDARDS

The fgetpos, fsetpos, fseek, ftell, and rewind functions conform to ANSI C3.159-1989 (``ANSI C'').

BSD MANPAGE 29 November 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/assert.htm0000644000076400001440000000303407055335001015042 assert



ASSERT(3) Linux Programmer's Manual ASSERT(3)

NAME

assert - Abort the program if assertion is false.

SYNOPSIS

#include <assert.h> void assert (int expression);

DESCRIPTION

assert() prints an error message to standard output and terminates the program by calling abort() if expression is false (i.e., compares equal to zero). This only happens when the macro NDEBUG is undefined.

RETURN VALUE

No value is returned.

CONFORMS TO

ANSI - C

BUGS

assert() is implemented as a macro; if the expression tested has side - effects, program behaviour will be dif- ferent depending on whether NDEBUG is defined. This may create Heisenbugs which go away when debugging is turned on.

SEE ALSO

exit, abort,





























GNU April 4, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/setsid.htm0000644000076400001440000000306407055335070015045 setsid



SETSID(2) System calls SETSID(2)

NAME

setsid - creates a session and sets the process group ID

SYNOPSIS

#include <unistd.h> pid_t setsid(void);

DESCRIPTION

setsid() creates a new session if the calling process is not a process group leader. The calling process is the leader of the new session, the process group leader if the new process group, and has no controlling tty. The pro- cess group ID of the calling process is set to the PID of the calling process. The calling process will be the only process in this new process group and in this new session.

RETURN VALUE

The process group ID of the calling process.

ERRORS

On error, -1 will be returned. The only error which can happen is EPERM.

CONFORMING TO

POSIX

SEE ALSO

setpgid,





























                           Aug 27, 1994                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/strcat.htm0000644000076400001440000000326407055334760015061 strcat



STRCAT(3) Linux Programmer's Manual STRCAT(3)

NAME

strcat, strncat - concatenate two strings

SYNOPSIS

#include <string.h> char *strcat(char *dest, const char *src); char *strncat(char *dest, const char *src, size_t n);

DESCRIPTION

The strcat() function appends the src string to the dest string overwriting the `\0' character at the end of dest, and then adds a terminating `\0' character. The strings may not overlap, and the dest string must have enough space for the result. The strncat() function is similar, except that only the first n characters of src are appended to dest.

RETURN VALUE

The strcat() and strncat() functions return a pointer to the resulting string dest.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

bcopy, memccpy, memcpy, strcpy, strncpy,





























GNU April 11, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/perror.htm0000644000076400001440000000301307055335041015053 perror



PERROR(3) Library functions PERROR(3)

NAME

perror - print a system error message

SYNOPSIS

#include <stdio.h> void perror(const char *s);

DESCRIPTION

perror produces a message on the standard error output, describing the last error encountered during a call to a system or library function. The argument string s is printed first, then a colon and a blank, then the message and a new-line. To be of most use, the argument string should include the name of the program that incurred the error. The error number is taken from the external vari- able errno, which is set when errors occur but not cleared when non-erroneous calls are made.

CONFORMING TO

ANSI C, POSIX

SEE ALSO

errno, strerror,


































                          March 16, 1995                        1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/ttyname.htm0000644000076400001440000000223007055335076015233 ttyname



TTYNAME(3) Linux Programmer's Manual TTYNAME(3)

NAME

ttyname - return name of a terminal

SYNOPSIS

#include <unistd.h> char *ttyname ( int desc );

DESCRIPTION

Returns a pointer to the pathname of the terminal device that is open on the file descriptor desc, or NULL on error (for example, if desc is not connected to a terminal).

CONFORMING TO

POSIX.1

SEE ALSO

isatty, fstat,








































Linux April 20, 1995 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/floor.htm0000644000076400001440000000222107055335016014665 floor



FLOOR(3) Linux Programmer's Manual FLOOR(3)

NAME

floor - largest integral value not greater than x

SYNOPSIS

#include <math.h> double floor(double x);

DESCRIPTION

The floor() function rounds x downwards to the nearest integer, returning that value as a double.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

abs, fabs, ceil, rint,









































                           June 6, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/chown.htm0000644000076400001440000000476307055335057014704 chown



CHOWN(1L) CHOWN(1L)

NAME

chown - change the user and group ownership of files

SYNOPSIS

chown [-Rcfv] [--recursive] [--changes] [--help] [--ver- sion] [--silent] [--quiet] [--verbose] [user][:.][group] file...

DESCRIPTION

This manual page documents the GNU version of chown. chown changes the user and/or group ownership of each given file, according to its first non-option argument, which is interpreted as follows. If only a user name (or numeric user ID) is given, that user is made the owner of each given file, and the files' group is not changed. If the user name is followed by a colon or dot and a group name (or numeric group ID), with no spaces between them, the group ownership of the files is changed as well. If a colon or dot but no group name follows the user name, that user is made the owner of the files and the group of the files is changed to that user's login group. If the colon or dot and group are given, but the user name is omitted, only the group of the files is changed; in this case, chown performs the same function as chgrp. OPTIONS -c, --changes Verbosely describe only files whose ownership actu- ally changes. -f, --silent, --quiet Do not print error messages about files whose own- ership cannot be changed. -v, --verbose Verbosely describe ownership changes. -R, --recursive Recursively change ownership of directories and their contents. --help Print a usage message on standard output and exit successfully. --version Print version information on standard output then exit successfully.

FSF GNU File Utilities 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/setenv.htm0000644000076400001440000000312607055334767015071 setenv



SETENV(3) Linux Programmer's Manual SETENV(3)

NAME

setenv - change or add an environment variable

SYNOPSIS

#include <stdlib.h> int setenv(const char *name, const char *value, int overwrite); void unsetenv(const char *name);

DESCRIPTION

The setenv() function adds the variable name to the envi- ronment with the value value, if name does not already exist. If name does exist in the environment, then its value is changed to value if overwrite is non-zero; if overwrite is zero, then the value of name is not changed. The unsetenv() function deletes the variable name from the environment.

RETURN VALUE

The setenv() function returns zero on success, or -1 if there was insufficient space in the environment.

CONFORMING TO

BSD 4.3

SEE ALSO

getenv, putenv,





























BSD April 4, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/remove.htm0000644000076400001440000000652207055335042015050 remove



REMOVE(3) GNU REMOVE(3)

NAME

remove - delete a name and possibly the file it refers to

SYNOPSIS

#include <stdio.h> int remove(const char *pathname);

DESCRIPTION

remove deletes a name from the filesystem. If that name was the last link to a file and no processes have the file open the file is deleted and the space it was using is made available for reuse. If the name was the last link to a file but any processes still have the file open the file will remain in existence until the last file descriptor referring to it is closed. If the name referred to a symbolic link the link is removed. If the name referred to a socket, fifo or device the name for it is removed but processes which have the object open may continue to use it.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EFAULT pathname points outside your accessible address space. EACCES Write access to the directory containing pathname is not allowed for the process's effective uid, or one of the directories in pathname did not allow search (execute) permission. EPERM The directory containing pathname has the sticky- bit (S_ISVTX) set and the process's effective uid is neither the uid of the file to be deleted nor that of the directory containing it. ENAMETOOLONG pathname was too long. ENOENT A directory component in pathname does not exist or is a dangling symbolic link. ENOTDIR A component used as a directory in pathname is not, in fact, a directory. EISDIR pathname refers to a directory.

Linux 13 July 1994 1

REMOVE(3) GNU REMOVE(3)

ENOMEM Insufficient kernel memory was available. EROFS pathname refers to a file on a read-only filesys- tem.

CONFORMING TO

SVID, AT&T, POSIX, X/OPEN, BSD 4.3

BUGS

In-felicities in the protocol underlying NFS can cause the unexpected disappearance of files which are still being used.

SEE ALSO

unlink, rename, open, rmdir, mknod, mkfifo, link, rm,










































Linux 13 July 1994 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/fread.htm0000644000076400001440000000373007055335037014636 fread



FREAD(3) Linux Programmer's Manual FREAD(3)

NAME

fread, fwrite - binary stream input/output

SYNOPSIS

#include <stdio.h> int fread( void *ptr, size_t size, size_t nmemb, FILE *stream); int fwrite( void *ptr, size_t size, size_t nmemb, FILE *stream);

DESCRIPTION

The function fread reads nmemb elements of data, each size bytes long, from the stream pointed to by stream, storing them at the location given by ptr. The function fwrite writes nmemb elements of data, each size bytes long, to the stream pointed to by stream, obtaining them from the location given by ptr.

RETURN VALUES

fread and fwrite return the number of items successfully read or written (i.e., not the number of characters). If an error occurs, or the end-of-file is reached, the return value is a short item count (or zero). fread does not distinguish between end-of-file and error, and callers must use feof(3) and ferror(3) to determine which occurred.

SEE ALSO

feof, ferror, read, write,


STANDARDS

The functions fread and fwrite conform to ANSI C3.159-1989 (``ANSI C'').

BSD MANPAGE 20 April 1995 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/stderr.htm0000644000076400001440000000260507055335005015053 strerror



STRERROR(3) Linux Programmer's Manual STRERROR(3)

NAME

strerror - return string describing error code

SYNOPSIS

#include <string.h> char *strerror(int errnum);

DESCRIPTION

The strerror() function returns a string describing the error code passed in the argument errno. The string can only be used until the next call to strerror().

RETURN VALUE

The strerror() function returns the appropriate descrip- tion string, or an unknown error message if the error code is unknown.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

errno, perror, strsignal,



































GNU April 13, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/exp.htm0000644000076400001440000000350707055335015014347 exp



EXP(3) Linux Programmer's Manual EXP(3)

NAME

exp, log, log10, pow - exponential, logarithmic and power functions

SYNOPSIS

#include <math.h> double exp(double x); double log(double x); double log10(double x); double pow(double x, double y);

DESCRIPTION

The exp() function returns the value of e (the base of natural logarithms) raised to the power of x. The log() function returns the natural logarithm of x. The log10() function returns the base-10 logarithm of x. The pow() function returns the value of x raised to the power of y.

ERRORS

The log() and log10() functions can return the following errors: EDOM The argument x is negative. ERANGE The argument x is zero. The log of zero is not defined. The pow() function can return the following error: EDOM The argument x is negative and y is not an integral value. This would result in a complex number.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

sqrt, cbrt,













GNU June 16, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/scanf.htm0000644000076400001440000002710007055335036014643 scanf



SCANF(3) Linux Programmer's Manual SCANF(3)

NAME

scanf, fscanf, sscanf, vscanf, vsscanf, vfscanf - input format conversion

SYNOPSIS

#include <stdio.h> int scanf( const char *format, ...); int fscanf( FILE *stream, const char *format, ...); int sscanf( const char *str, const char *format, ...); #include <stdarg.h> int vscanf( const char *format, va_list ap); int vsscanf( const char *str, const char *format, va_list ap); int vfscanf( FILE *stream, const char *format, va_list ap);

DESCRIPTION

The scanf family of functions scans input according to a format as described below. This format may contain con- version specifiers; the results from such conversions, if any, are stored through the pointer arguments. The scanf function reads input from the standard input stream stdin, fscanf reads input from the stream pointer stream, and sscanf reads its input from the character string pointed to by str. The vfscanf function is analogous to vfprintf(3) and reads input from the stream pointer stream using a variable argument list of pointers (see stdarg(3). The vscanf function scans a variable argument list from the standard input and the vsscanf function scans it from a string; these are analogous to the vprintf and vsprintf functions respectively. Each successive pointer argument must correspond properly with each successive conversion specifier (but see `sup- pression' below). All conversions are introduced by the % (percent sign) character. The format string may also con- tain other characters. White space (such as blanks, tabs, or newlines) in the format string match any amount of white space, including none, in the input. Everything else matches only itself. Scanning stops when an input character does not match such a format character. Scan- ning also stops when an input conversion cannot be made (see below).

CONVERSIONS

Following the % character introducing a conversion there may be a number of flag characters, as follows: * Suppresses assignment. The conversion that follows occurs as usual, but no pointer is used; the result of the conversion is simply discarded. h Indicates that the conversion will be one of dioux

BSD MANPAGE 29 November 1993 1

SCANF(3) Linux Programmer's Manual SCANF(3)

or n and the next pointer is a pointer to a short int (rather than int). l Indicates either that the conversion will be one of dioux or n and the next pointer is a pointer to a long int (rather than int), or that the conversion will be one of efg and the next pointer is a pointer to double (rather than float). L Indicates that the conversion will be efg and the next pointer is a pointer to long double. (This type is not implemented; the L flag is currently ignored--this may not be true for Linux.) In addition to these flags, there may be an optional maxi- mum field width, expressed as a decimal integer, between the % and the conversion. If no width is given, a default of `infinity' is used (with one exception, below); other- wise at most this many characters are scanned in process- ing the conversion. Before conversion begins, most con- versions skip white space; this white space is not counted against the field width. The following conversions are available: % Matches a literal `%'. That is, `%%' in the format string matches a single input `%' character. No conversion is done, and assignment does not occur. d Matches an optionally signed decimal integer; the next pointer must be a pointer to int. D Equivalent to ld; this exists only for backwards compatibility. i Matches an optionally signed integer; the next pointer must be a pointer to int. The integer is read in base 16 if it begins with `0x' or `0X', in base 8 if it begins with `0', and in base 10 other- wise. Only characters that correspond to the base are used. o Matches an octal integer; the next pointer must be a pointer to unsigned int. O Equivalent to lo; this exists for backwards compat- ibility. u Matches an optionally signed decimal integer; the next pointer must be a pointer to unsigned int. x Matches an optionally a signed hexadecimal integer; the next pointer must be a pointer to unsigned int.

BSD MANPAGE 29 November 1993 2

SCANF(3) Linux Programmer's Manual SCANF(3)

X Equivalent to lx; this violates the ANSI C3.159-1989 (``ANSI C'') but is backwards compati- ble with previous UNIX systems--I don't know what Linux does with this. f Matches an optionally signed floating-point number; the next pointer must be a pointer to float. e Equivalent to f. g Equivalent to f. E Equivalent to lf; this violates the ANSI C3.159-1989 (``ANSI C'') but is backwards compati- ble with previous UNIX systems--I don't know what Linux does with this. F Equivalent to lf; this exists only for backwards compatibility. s Matches a sequence of non-white-space characters; the next pointer must be a pointer to char, and the array must be large enough to accept all the sequence and the terminating NUL character. The input string stops at white space or at the maximum field width, whichever occurs first. c Matches a sequence of width count characters (default 1); the next pointer must be a pointer to char, and there must be enough room for all the characters (no terminating NUL is added). The usual skip of leading white space is suppressed. To skip white space first, use an explicit space in the format. [ Matches a nonempty sequence of characters from the specified set of accepted characters; the next pointer must be a pointer to char, and there must be enough room for all the characters in the string, plus a terminating NUL character. The usual skip of leading white space is suppressed. The string is to be made up of characters in (or not in) a particular set; the set is defined by the characters between the open bracket [ character and a close bracket ] character. The set excludes those characters if the first character after the open bracket is a circumflex ^. To include a close bracket in the set, make it the first character after the open bracket or the circumflex; any other position will end the set. The hyphen character - is also special; when placed between two other characters, it adds all intervening characters to the set. To include a hyphen, make it the last character before the final close bracket. For

BSD MANPAGE 29 November 1993 3

SCANF(3) Linux Programmer's Manual SCANF(3)

instance, `[^]0-9-]' means the set `everything except close bracket, zero through nine, and hyphen'. The string ends with the appearance of a character not in the (or, with a circumflex, in) set or when the field width runs out. p Matches a pointer value (as printed by `%p' in printf(3); the next pointer must be a pointer to void. n Nothing is expected; instead, the number of charac- ters consumed thus far from the input is stored through the next pointer, which must be a pointer to int. This is not a conversion, although it can be suppressed with the * flag. For backwards compatibility, other conversion characters (except `\0') are taken as if they were `%d' or, if upper- case, `%ld', and a `conversion' of `%\0' causes an immedi- ate return of EOF. The F and X conversions will be changed in the future to conform to the ANSI C standard, after which they will act like and respectively. The behavior of Linux on the non-standard points is not known by this documenter.

RETURN VALUES

These functions return the number of input items assigned, which can be fewer than provided for, or even zero, in the event of a matching failure. Zero indicates that, while there was input available, no conversions were assigned; typically this is due to an invalid input character, such as an alphabetic character for a `%d' conversion. The value EOF is returned if an input failure occurs before any conversion such as an end-of-file occurs. If an error or end-of-file occurs after conversion has begun, the num- ber of conversions which were successfully completed is returned.

SEE ALSO

strtol, strtoul, strtod, getc, printf,


STANDARDS

The functions fscanf, scanf, and sscanf conform to ANSI C3.159-1989 (``ANSI C'').

BUGS

Differences for Linux are not known at this time. The following is for the BSD version: The current situation with %F and %X conversions is unfor- tunate. All of the backwards compatibility formats will be removed

BSD MANPAGE 29 November 1993 4

SCANF(3) Linux Programmer's Manual SCANF(3)

in the future. Numerical strings are truncated to 512 characters; for example, %f and %d are implicitly %512f and %512d.

BSD MANPAGE 29 November 1993 5


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/setegid.htm0000644000076400001440000000467707055334760015216 setegid



SETREGID(2) Linux Programmer's Manual SETREGID(2)

NAME

setregid, setegid - set real and / or effective group ID

SYNOPSIS

#include <unistd.h> int setregid(gid_t rgid, gid_t egid); int setegid(gid_t egid);

DESCRIPTION

setregid sets real and effective group ID's of the current process. Un-privileged users may change the real group ID to the effective group ID and vice-versa. Prior to Linux 1.1.38, the saved ID paradigm, when used with setregid or setegid was broken. Starting at 1.1.38, it is also possible to set the effective group ID from the saved user ID. Only the super-user may make other changes. Supplying a value of -1 for either the real or effective group ID forces the system to leave that ID unchanged. Currently (libc-4.x.x), setegid(egid) is functionally equivalent to setregid(-1, egid). If the real group ID is changed or the effective group ID is set to a value not equal to the previous real group ID, the saved group ID will be set to the new effective group ID.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EPERM The current process is not the super-user and changes other than (i) swapping the effective group ID with the real group ID or (ii) setting one to the value of the other or (iii) setting the effective group ID to the value of the saved group ID was specified.

HISTORY

The setregid function call appeared in BSD 4.2.

CONFORMING TO

BSD 4.3

SEE ALSO

getgid, setgid,






Linux 1.1.38 2nd August 1994 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/memset.htm0000644000076400001440000000232107055335003015033 memset



MEMSET(3) Linux Programmer's Manual MEMSET(3)

NAME

memset - fill memory with a constant byte

SYNOPSIS

#include <string.h> void *memset(void *s, int c, size_t n);

DESCRIPTION

The memset() function fills the first n bytes of the mem- ory area pointed to be s with the constant byte c.

RETURN VALUE

The memset() function returns a pointer to the memory area s.

CONFORMING TO

SVID 3, BSD 4.3, ISO 9899

SEE ALSO

bzero, swab,





































GNU April 11, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/rand.htm0000644000076400001440000000652707055334773014516 rand



RAND(3) Linux Programmer's Manual RAND(3)

NAME

rand, srand - random number generator.

SYNOPSIS

#include <stdlib.h> int rand(void); void srand(unsigned int seed);

DESCRIPTION

The rand() function returns a pseudo-random integer between 0 and RAND_MAX. The srand() function sets its argument as the seed for a new sequence of pseudo-random integers to be returned by rand(). These sequences are repeatable by calling srand() with the same seed value. If no seed value is provided, the rand() function is auto- matically seeded with a value of 1.

RETURN VALUE

The rand() function returns a value between 0 and RAND_MAX. The srand() returns no value.

NOTES

The versions of rand() and srand() in the Linux C Library use the same random number generator as random() and sran- dom(), so the lower-order bits should be as random as the higher-order bits. However, on older rand() implementa- tions, the lower-order bits are much less random than the higher-order bits. In Numerical Recipes in C: The Art of Scientific Computing (William H. Press, Brian P. Flannery, Saul A. Teukolsky, William T. Vetterling; New York: Cambridge University Press, 1990 (1st ed, p. 207)), the following comments are made: "If you want to generate a random integer between 1 and 10, you should always do it by j=1+(int) (10.0*rand()/(RAND_MAX+1.0)); and never by anything resembling j=1+((int) (1000000.0*rand()) % 10); (which uses lower-order bits)." Random-number generation is a complex topic. The Numeri- cal Recipes in C book (see reference above) provides an excellent discussion of practical random-number generation issues in Chapter 7 (Random Numbers).

GNU 18 May 1995 1

RAND(3) Linux Programmer's Manual RAND(3)

For a more theoretical discussion which also covers many practical issues in depth, please see Chapter 3 (Random Numbers) in Donald E. Knuth's The Art of Computer Program- ming, volume 2 (Seminumerical Algorithms), 2nd ed.; Read- ing, Massachusetts: Addison-Wesley Publishing Company, 1981.

CONFORMING TO

SVID 3, BSD 4.3, ISO 9899

SEE ALSO

random, srandom, initstate, setstate,














































GNU 18 May 1995 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/sqrt.htm0000644000076400001440000000214407055335020014534 sqrt



SQRT(3) Linux Programmer's Manual SQRT(3)

NAME

sqrt - square root function

SYNOPSIS

#include <math.h> double sqrt(double x);

DESCRIPTION

The sqrt() function returns the non-negative square root of x. It fails and sets errno to EDOM, if x is negative.

ERRORS

EDOM x is negative.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

hypot,






































                          June 21, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/seteuid.htm0000644000076400001440000000465107055334756015231 setreuid



SETREUID(2) Linux Programmer's Manual SETREUID(2)

NAME

setreuid, seteuid - set real and / or effective user ID

SYNOPSIS

#include <unistd.h> int setreuid(uid_t ruid, uid_t euid); int seteuid(uid_t euid);

DESCRIPTION

setreuid sets real and effective user ID's of the current process. Un-privileged users may change the real user ID to the effective user ID and vice-versa. Prior to Linux 1.1.37, the saved ID paradigm, when used with setreuid or seteuid was broken. Starting at 1.1.37, it is also possible to set the effec- tive user ID from the saved user ID. Only the super-user may make other changes. Supplying a value of -1 for either the real or effective user ID forces the system to leave that ID unchanged. Currently (libc-4.x.x), seteuid(euid) is functionally equivalent to setreuid(-1, euid). If the real user ID is changed or the effective user ID is set to a value not equal to the previous real user ID, the saved user ID will be set to the new effective user ID.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EPERM The current process is not the super-user and changes other than (i) swapping the effective user ID with the real user ID or (ii) setting one to the value of the other or (iii) setting the effec- tive user ID to the value of the saved user ID was specified.

HISTORY

The setreuid function call appeared in BSD 4.2.

CONFORMING TO

BSD 4.3

SEE ALSO

getuid, setuid,






Linux 1.1.38 2nd August 1994 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/lseek.htm0000644000076400001440000000537707055335067014674 lseek



LSEEK(2) Linux Programmer's Manual LSEEK(2)

NAME

lseek - reposition read/write file offset

SYNOPSIS

#include <unistd.h> off_t lseek(int fildes, off_t offset, int whence);

DESCRIPTION

The lseek function repositions the offset of the file descriptor fildes to the argument offset according to the directive whence. The argument fildes must be an open file descriptor. Lseek repositions the file pointer fildes as follows: If whence is SEEK_SET, the offset is set to offset bytes. If whence is SEEK_CUR, the offset is set to its current location plus offset bytes. If whence is SEEK_END, the offset is set to the size of the file plus offset bytes. The lseek function allows the file offset to be set beyond the end of the existing end-of-file of the file. If data is later written at this point, subsequent reads of the data in the gap return bytes of zeros (until data is actu- ally written into the gap). Some devices are incapable of seeking. The value of the pointer associated with such a device is undefined.

RETURN VALUES

Upon successful completion, lseek returns the resulting offset location as measured in bytes from the beginning of the file. Otherwise, a value of -1 is returned and errno is set to indicate the error.

ERRORS

EBADF Fildes is not an open file descriptor. ESPIPE Fildes is associated with a pipe, socket, or FIFO. EINVAL Whence is not a proper value.

CONFORMS TO

POSIX, BSD 4.3

BUGS

This document's use of whence is incorrect English, but maintained for historical reasons.

Linux 1.2.9 10 June 1995 1

LSEEK(2) Linux Programmer's Manual LSEEK(2)


SEE ALSO

dup, open, fseek,
























































Linux 1.2.9 10 June 1995 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/gets.htm0000644000076400001440000000735507055335037014526 ungetc



GETS(3) Linux Programmer's Manual GETS(3)

NAME

fgetc, fgets, getc, getchar, gets, ungetc - input of char- acters and strings

SYNOPSIS

#include <stdio.h> int fgetc(FILE *stream); char *fgets(char *s, int size, FILE *stream); int getc(FILE *stream); int getchar(void); char *gets(char *s); int ungetc(int c, FILE *stream);

DESCRIPTION

fgetc() reads the next character from stream and returns it as an unsigned char cast to an int, or EOF on end of file or error. getc() is equivalent to fgetc() except that it may be implemented as a macro which evaluates stream more than once. getchar() is equivalent to getc(stdin). gets() reads a line from stdin into the buffer pointed to by s until either a terminating newline or EOF, which it replaces with '\0'. No check for buffer overrun is per- formed (see BUGS below). fgets() reads in at most one less than n characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after the last character in the buffer. ungetc() pushes c back to stream, cast to unsigned char, where it is available for subsequent read operations. Pushed - back characters will be returned in reverse order; only one pushback is guaranteed. Calls to the functions described here can be mixed with each other and with calls to other input functions from the stdio library for the same input stream.

RETURN VALUES

fgetc(), getc() and getchar() return the character read as an unsigned char cast to an int or EOF on end of file or error. gets() and fgets() return s on success, and NULL on end of file or error. ungetc() returns c on success, or EOF on error.

GNU April 4, 1993 1

GETS(3) Linux Programmer's Manual GETS(3)

CONFORMS TO

ANSI - C, POSIX.1

BUGS

Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store characters past the end of the buffer, it is extremely dangerous to use. It has been used to break computer security. Use fgets() instead. It is not advisable to mix calls to input functions from the stdio library with low - level calls to read() for the file descriptor associated with the input stream; the results will be undefined and very probably not what you want.

SEE ALSO

read, write, fopen, fread, scanf, puts, fseek, ferror,






































GNU April 4, 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/Makefile.am0000644000076400001440000000021707055335105015070 EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/MAN/Makefile.in0000644000076400001440000002651107474405126015114 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/MAN mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/MAN/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/MAN/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/MAN/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=fputs.htm rename.htm modf.htm assert.htm labs.htm asctime.htm setpgid.htm longjmp.htm scanf.htm sleep.htm closedir.htm getpwnam.htm ldexp.htm sysconf.htm wcstombs.htm perror.htm seekdir.htm setlocale.htm toupper.htm realloc.htm calloc.htm fmod.htm seteuid.htm fpathconf.htm frexp.htm telldir.htm readdir.htm ungetc.htm memchr.htm atan2.htm putenv.htm getpw.htm tmpnam.htm ttyname.htm stat.htm memcpy.htm rmdir.htm time.htm cos.htm abs.htm close.htm unsetenv.htm strspn.htm remove.htm strpbrk.htm setjmp.htm pause.htm mbstowcs.htm lseek.htm alarm.htm strtod.htm chroot.htm getopt.htm strcasecmp.htm sinh.htm tan.htm mkdir.htm mbtowc.htm uname.htm sqrt.htm fabs.htm chdir.htm dup2.htm setenv.htm rand.htm getenv.htm stderr.htm setuid.htm perlembed.htm getuid.htm difftime.htm ldiv.htm tanh.htm tmpfile.htm strcoll.htm gets.htm acos.htm floor.htm freopen.htm putpwent.htm exp.htm strlen.htm setegid.htm togetpgrp.htm ceil.htm ctermid.htm index.htm scandir.htm sin.htm atan.htm strstr.htm strcat.htm getpgrp.htm memmove.htm memcmp.htm ioctl.htm opendir.htm unlink.htm fread.htm ferror.htm fgetpwent.htm access.htm chown.htm strftime.htm mblen.htm test getgroupd.htm signal.htm getlogin.htm isatty.htm va_start.htm vfprintf.htm cosh.htm div.htm gethostname.htm setsid.htm memset.htm fflush.htm wctomb.htm getpid.htm cuserid.htm fscanf.htm getpwent.htm fgetpos.htm asin.htm strcspn.htm link.htm setgid.htm clock.htm raise.htm rewinddir.htm setbuf.htm getdid.htm DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/MAN/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/MAN/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/MAN/asctime.htm0000644000076400001440000001461107055335030015173 asctime



CTIME(3) Linux Programmer's Manual CTIME(3)

NAME

asctime, ctime, gmtime, localtime, mktime - transform binary date and time to ASCII

SYNOPSIS

#include <time.h> char *asctime(const struct tm *timeptr); char *ctime(const time_t *timep); struct tm *gmtime(const time_t *timep); struct tm *localtime(const time_t *timep); time_t mktime(struct tm *timeptr); extern char *tzname[2]; long int timezone; extern int daylight;

DESCRIPTION

The ctime(), gmtime() and localtime() functions all take an argument of data type time_t which represents calendar time. When interpreted as an absolute time value, it rep- resents the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC). The asctime() and mktime() functions both take an argument representing broken-down time which is a binary represen- tation separated into year, month, day, etc. Broken-down time is stored in the structure tm which is defined in <time.h> as follows: struct tm { int tm_sec; /* seconds */ int tm_min; /* minutes */ int tm_hour; /* hours */ int tm_mday; /* day of the month */ int tm_mon; /* month */ int tm_year; /* year */ int tm_wday; /* day of the week */ int tm_yday; /* day in the year */ int tm_isdst; /* daylight saving time */ }; The members of the tm structure are: tm_sec The number of seconds after the minute, normally in the range 0 to 59, but can be up to 61 to allow for leap seconds. tm_min The number of minutes after the hour, in the range

BSD June 30, 1993 1

CTIME(3) Linux Programmer's Manual CTIME(3)

0 to 59. tm_hour The number of hours past midnight, in the range 0 to 23. tm_mday The day of the month, in the range 1 to 31. tm_mon The number of months since January, in the range 0 to 11. tm_year The number of years since 1900. tm_wday The number of days since Sunday, in the range 0 to 6. tm_yday The number of days since January 1, in the range 0 to 365. tm_isdst A flag that indicates whether daylight saving time is in effect at the time described. The value is positive if daylight saving time is in effect, zero if it is not, and negative if the information is not available. The ctime() function converts the calendar time timep into a string of the form "Wed Jun 30 21:49:08 1993\n" The abbreviations for the days of the week are `Sun', `Mon', `Tue', `Wed', `Thu', `Fri', and `Sat'. The abbre- viations for the months are `Jan', `Feb', `Mar', `Apr', `May', `Jun', `Jul', `Aug', `Sep', `Oct', `Nov', and `Dec'. The return value points to a statically allocated string which might be overwritten by subsequent calls to any of the date and time functions. The function also sets the external variable tzname with information about the current time zone. The gmtime() function converts the calendar time timep to broken-down time representation, expressed in Coordinated Universal Time (UTC). The localtime() function converts the calendar time timep to broken-time representation, expressed relative to the user's specified time zone. The function sets the external variables tzname with information about the cur- rent time zone, timezone with the difference between

BSD June 30, 1993 2

CTIME(3) Linux Programmer's Manual CTIME(3)

Coordinated Universal Time (UTC) and local standard time in seconds, and daylight to a non-zero value if standard US daylight savings time rules apply. The asctime() function converts the broken-down time value timeptr into a string with the same format as ctime(). The return value points to a statically allocated string which might be overwritten by subsequent calls to any of the date and time functions. The mktime() function converts a broken-down time struc- ture to calendar time representation. The function ignores the specified contents of the structure members tm_wday and tm_yday and recomputes them from the other information in the broken-down time structure. Calling mktime() also sets the external variable tzname with information about the current time zone. If the specified broken-down time cannot be represented as calendar time, mktime() returns a value of (time_t)(-1) and does not alter the tm_wday and tm_yday members of the broken-down time structure.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

date, gettimeofday, time, tzset, difftime, strftime,






























BSD June 30, 1993 3


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/pause.htm0000644000076400001440000000233507055335067014675 pause



PAUSE(2) Linux Programmer's Manual PAUSE(2)

NAME

pause - wait for signal

SYNOPSIS

#include<unistd.h> int pause(void);

DESCRIPTION

pause causes the process to sleep until a signal is received.

RETURN VALUE

pause always returns -1, and errno is set to ERESTARTNO- HAND.

ERRORS

EINTR signal was received.

CONFORMING TO

SVID, AT&T, POSIX, X/OPEN, BSD 4.3

SEE ALSO

kill, select, signal,


































Linux March 28, 1992 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/clock.htm0000644000076400001440000000276307055335030014646 clock



CLOCK(3) Linux Programmer's Manual CLOCK(3)

NAME

clock - Determine processor time

SYNOPSIS

#include <time.h> clock_t clock(void);

DESCRIPTION

The clock() function returns an approximation of processor time used by the program.

RETURN VALUE

The value returned is the CPU time used so far as a clock_t; to get the number of seconds used, divide by CLOCKS_PER_SEC.

CONFORMS TO

ANSI C

BUGS

The C standard allows for arbitrary values at the start of the program; take the difference between the value returned from a call to clock() at the start of the pro- gram and the end to get maximum portability. The times() function call returns more information.

SEE ALSO

times,




























GNU April 21, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/access.htm0000644000076400001440000000674107055335056015024 access



ACCESS(2) Linux Programmer's Manual ACCESS(2)

NAME

access - check user's permissions for a file

SYNOPSIS

#include <unistd.h> int access(const char *pathname, int mode);

DESCRIPTION

access checks whether the process would be allowed to read, write or test for existence of the file (or other file system object) whose name is pathname. mode is a mask consisting of one or more of R_OK, W_OK, X_OK and F_OK. R_OK, W_OK and X_OK request testing for reading, writing and executing the file, respectively. F_OK requests checking whether merely testing for the existence of the file would be allowed (this depends on the permissions of the directories in the path to the file, as given in path- name.) The check is done with the process's real uid and gid, rather than with the effective ids as is done when actu- ally attempting an operation. This is to allow set-UID programs to easily determine the invoking user's author- ity. Only access bits are checked, not the file type or con- tents. Therefore, if a directory is found to be "writable," it probably means that files can be created in the directory, and not that the directory can be written as a file. Similarly, a DOS file may be found to be "exe- cutable," but the execve(2) call will still fail.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EACCES The requested access would be denied, either to the file itself or one of the directories in path- name. EFAULT pathname points outside your accessible address space. EINVAL mode was incorrectly specified. ENAMETOOLONG pathname is too long. ENOENT A directory component in pathname would have been

Linux 1.1.46 21 August 1994 1

ACCESS(2) Linux Programmer's Manual ACCESS(2)

accessible but does not exist or was a dangling symbolic link. ENOTDIR A component used as a directory in pathname is not, in fact, a directory. ENOMEM Insufficient kernel memory was available. ELOOP pathname contains a reference to a circular sym- bolic link, i.e., a symbolic link containing a reference to itself.

CONFORMING TO

SVID, AT&T, POSIX, X/OPEN, BSD 4.3

SEE ALSO

stat, open, chmod, chown, setuid,








































Linux 1.1.46 21 August 1994 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/cosh.htm0000644000076400001440000000226107055335014014502 cosh



COSH(3) Linux Programmer's Manual COSH(3)

NAME

cosh - hyperbolic cosine function

SYNOPSIS

#include <math.h> double cosh(double x);

DESCRIPTION

The cosh() function returns the hyperbolic cosine of x, which is defined mathematically as exp(x) + exp(-x) / 2.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acosh, asinh, atanh, sinh, tanh,









































                          June 13, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/getpw.htm0000644000076400001440000000415607055334747014715 getpw



GETPW(3) Linux Programmer's Manual GETPW(3)

NAME

getpw - Re-construct password line entry

SYNOPSIS

#include <pwd.h> #include <sys/types.h> int getpw(uid_t uid, char *buf);

DESCRIPTION

The getpw() function re-constructs the password line entry for the given user uid uid in the buffer buf. The returned buffer contains a line of format name:passwd:uid:gid:gecos:dir:shell The passwd structure is defined in <pwd.h> as follows: struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* user password */ uid_t pw_uid; /* user id */ gid_t pw_gid; /* group id */ char *pw_gecos; /* real name */ char *pw_dir; /* home directory */ char *pw_shell; /* shell program */ };

RETURN VALUE

The getpw() function returns 0 on success, or -1 if an error occurs.

ERRORS

ENOMEM Insufficient memory to allocate passwd structure.

FILES

/etc/passwdpassword database file

SEE ALSO

fgetpwent, getpwent, setpwent, endpwent, getpwuid, putpwent,

















GNU April 9, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/getpgrp.htm0000644000076400001440000000551007055335064015223 getpgrp



SETPGID(2) Linux Programmer's Manual SETPGID(2)

NAME

setpgid, getpgid, setpgrp, getpgrp - set/get process group

SYNOPSIS

#include <unistd.h> int setpgid(pid_t pid, pid_t pgid); pid_t getpgid(pid_t pid); int setpgrp(void); pid_t getpgrp(void);

DESCRIPTION

setpgid sets the process group ID of the process specified by pid to pgid. If pid is zero, the process ID of the current process is used. If pgid is zero, the process ID of the process specified by pid is used. getpgid returns the process group ID of the process speci- fied by pid. If pid is zero, the process ID of the cur- rent process is used. In the Linux DLL 4.4.1 library, setpgrp simply calls setpgid(0,0). getpgrp is equivalent to getpgid(0). Process groups are used for distribution of signals, and by terminals to arbitrate requests for their input: pro- cesses that have the same process group as the terminal are foreground and may read, while others will block with a signal if they attempt to read. These calls are thus used by programs such as csh(1) to create process groups in implementing job control. The TIOCGPGRP and TIOCSPGRP calls described in termios(4) are used to get/set the process group of the control terminal.

RETURN VALUE

On success, setpgid and setpgrp return zero. On error, -1 is returned, and errno is set appropriately. getpgid returns a process group on success. On error, -1 is returned, and errno is set appropriately. getpgrp always returns the current process group.

ERRORS

EINVAL pgid is less than 0. EPERM Various permission violations. ESRCH pid does not match any process.

Linux 1.2.4 15 April 1995 1

SETPGID(2) Linux Programmer's Manual SETPGID(2)


SEE ALSO

getuid, setsid, tcsetpgrp, termios,
























































Linux 1.2.4 15 April 1995 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/acos.htm0000644000076400001440000000271307055335002014472 acos



ACOS(3) Linux Programmer's Manual ACOS(3)

NAME

acos - arc cosine function

SYNOPSIS

#include <math.h> double acos(double x);

DESCRIPTION

The acos() function calculates the arc cosine of x; that is the value whose cosine is x. If x falls outside the range -1 to 1, acos() fails and errno is set.

RETURN VALUE

The acos() function returns the arc cosine in radians and the value is mathematically defined to be between 0 and PI (inclusive).

ERRORS

EDOM x is out of range.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

asin, atan, atan2, cos, sin, tan,
































                           June 8, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/alarm.htm0000644000076400001440000000351507055335056014653 alarm



ALARM(2) Linux Programmer's Manual ALARM(2)

NAME

alarm - set an alarm clock for delivery of a signal

SYNOPSIS

#include <unistd.h> long alarm(long seconds);

DESCRIPTION

alarm arranges for a SIGALRM signal to be delivered to the process in seconds seconds. If seconds is zero, no new alarm is scheduled. In any event any previously set alarm is cancelled.

RETURN VALUE

alarm returns the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm.

NOTES

alarm and setitimer share the same timer; calls to one will interfere with use of the other. Scheduling delays can, as ever, cause the execution of the process to be delayed by an arbitrary amount of time.

CONFORMING TO

SVID, AT&T, POSIX, X/OPEN, BSD 4.3

SEE ALSO

setitimer, signal, sigaction, gettimeofday, select, pause, sleep,
























Linux 21 July 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/index.htm0000644000076400001440000000324207055334775014672 index



INDEX(3) Linux Programmer's Manual INDEX(3)

NAME

index, rindex - locate character in string

SYNOPSIS

#include <string.h> char *index(const char *s, int c); char *rindex(const char *s, int c);

DESCRIPTION

The index() function returns a pointer to the first occur- rence of the character c in the string s. The rindex() function returns a pointer to the last occur- rence of the character c in the string s. The terminating NULL character is considered to be a part of the strings.

RETURN VALUE

The index() and rindex() functions return a pointer to the matched character or NULL if the character is not found.

CONFORMING TO

BSD 4.3

SEE ALSO

memchr, strchr, strpbrk, strrchr, strsep, strspn, strstr, strtok,




























GNU April 12, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/abs.htm0000644000076400001440000000252507055335021014314 abs



ABS(3) Linux Programmer's Manual ABS(3)

NAME

abs - computes the absolute value of an integer.

SYNOPSIS

#include <stdlib.h> int abs(int j);

DESCRIPTION

The abs() function computes the absolute value of the integer argument j.

RETURN VALUE

Returns the absolute value of the integer argument.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

NOTES

Trying to take the absolute value of the most negative integer is not defined.

SEE ALSO

ceil, floor, fabs, , rint,


































GNU June 6, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/fgetpwent.htm0000644000076400001440000000437507055334745015573 fgetpwent



FGETPWENT(3) Linux Programmer's Manual FGETPWENT(3)

NAME

fgetpwent - get password file entry

SYNOPSIS

#include <pwd.h> #include <stdio.h> #include <sys/types.h> struct passwd *fgetpwent(FILE *stream);

DESCRIPTION

The fgetpwent() function returns a pointer to a structure containing the broken out fields of a line in the file stream. The first time it is called it returns the first entry; thereafter, it returns successive entries. The file stream must have the same format as /etc/passwd. The passwd structure is defined in <pwd.h> as follows: struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* user password */ uid_t pw_uid; /* user id */ gid_t pw_gid; /* group id */ char *pw_gecos; /* real name */ char *pw_dir; /* home directory */ char *pw_shell; /* shell program */ };

RETURN VALUE

The fgetpwent() function returns the passwd structure, or NULL if there are no more entries or an error occurs.

ERRORS

ENOMEM Insufficient memory to allocate passwd structure.

CONFORMING TO

SVID 3

SEE ALSO

getpwnam, getpwuid, getpwent, setpwent, getpw, putpwent,
















GNU April 9, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/getuid.htm0000644000076400001440000000252507055334755015045 getuid



GETUID(2) Linux Programmer's Manual GETUID(2)

NAME

getuid, geteuid - get user identity

SYNOPSIS

#include <unistd.h> uid_t getuid(void); uid_t geteuid(void);

DESCRIPTION

getuid returns the real user ID of the current process. geteuid returns the effective user ID of the current pro- cess. The real ID corresponds to the ID of the calling process. The effective ID corresponds to the set ID bit on the file being executed.

ERRORS

These functions are always successful.

CONFORMS TO

POSIX, BSD 4.3

SEE ALSO

setreuid, setuid,































Linux 0.99.11 23 July 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/setgid.htm0000644000076400001440000000406407055334757015045 setgid



SETGID(2) Linux Programmer's Manual SETGID(2)

NAME

setgid - set group identity

SYNOPSIS

#include <unistd.h> int setgid(gid_t gid)

DESCRIPTION

setgid sets the effective group ID of the current process. If the caller is the superuser, the real and saved group ID's are also set. Under Linux, setgid is implemented like SYSV with SAVED_IDS. This allows a setgid (other than root) program to drop all of it's group privileges, do some un-privi- leged work, and then re-engage the original effective group ID in a secure manner. If the user is root or the program is setgid root, special care must be taken. The setgid function checks the effec- tive gid of the caller and if it is the superuser, all process related group ID's are set to gid. After this has occurred, it is impossible for the program to regain root privileges.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EPERM The user is not the super-user, and gid does not match the effective or saved group ID of the call- ing process.

CONFORMING TO

System V

SEE ALSO

getgid, setregid, setegid,


















Linux 1.1.36 29 July 1994 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/chdir.htm0000644000076400001440000000376307055334752014657 chdir



CHDIR(2) Linux Programmer's Manual CHDIR(2)

NAME

chdir, fchdir - change working directory

SYNOPSIS

#include <unistd.h> int chdir(const char *path); int fchdir(int fd);

DESCRIPTION

chdir changes the current directory to that specified in path. fchdir is identical to chdir, only that the directory is given as an open file descriptor.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

Depending on the file system, other errors can be returned. The more general errors are listed below: EPERM The process does not have execute permission on the directory. EFAULT path points outside your accessible address space. ENAMETOOLONG path is too long. EBADF The fd is not a valid file descriptor. ENOENT The file does not exist. ENOMEM Insufficient kernel memory was available. ENOTDIR A component of the path prefix is not a directory. EACCES Search permission is denied on a component of the path prefix. ELOOP path contains a circular reference (i.e., via a symbolic link)

SEE ALSO

getcwd, chroot,









Linux 1.2.4 15 April 1995 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/setuid.htm0000644000076400001440000000404707055334756015063 setuid



SETUID(2) Linux Programmer's Manual SETUID(2)

NAME

setuid - set user identity

SYNOPSIS

#include <unistd.h> int setuid(uid_t uid)

DESCRIPTION

setuid sets the effective user ID of the current process. If the caller is the superuser, the real and saved user ID's are also set. Under Linux, setuid is implemented like SYSV with SAVED_IDS. This allows a setuid (other than root) program to drop all of it's user privileges, do some un-privileged work, and then re-engage the original effective user ID in a secure manner. If the user is root or the program is setuid root, special care must be taken. The setuid function checks the effec- tive uid of the caller and if it is the superuser, all process related user ID's are set to uid. After this has occurred, it is impossible for the program to regain root privileges.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EPERM The user is not the super-user, and uid does not match the effective or saved user ID of the call- ing process.

CONFORMING TO

System V

SEE ALSO

getuid, setreuid, seteuid,


















Linux 1.1.36 29 July 1994 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/rewinddir.htm0000644000076400001440000000251607055334763015552 rewinddir



REWINDDIR(3) Linux Programmer's Manual REWINDDIR(3)

NAME

rewinddir - reset directory stream

SYNOPSIS

#include <sys/types.h> #include <dirent.h> void rewinddir(DIR *dir);

DESCRIPTION

The rewinddir() function resets the position of the direc- tory stream dir to the beginning of the directory.

RETURN VALUE

The readdir() function returns no value.

CONFORMING TO

SVID 3, POSIX, BSD 4.3

SEE ALSO

opendir, readdir, closedir, seekdir, telldir, scandir,



































                           11 June 1995                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/labs.htm0000644000076400001440000000255007055335023014470 labs



LABS(3) Linux Programmer's Manual LABS(3)

NAME

labs - computes the absolute value of a long integer.

SYNOPSIS

#include <stdlib.h> long int labs(long int j);

DESCRIPTION

The labs() function computes the absolute value of the long integer argument j.

RETURN VALUE

Returns the absolute value of the long integer argument.

CONFORMING TO

SVID 3, BSD 4.3, ISO 9899

NOTES

Trying to take the absolute value of the most negative integer is not defined.

SEE ALSO

abs, ceil, floor, fabs, rint,


































GNU June 6, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/tanh.htm0000644000076400001440000000225707055335021014503 tanh



TANH(3) Linux Programmer's Manual TANH(3)

NAME

tanh - hyperbolic tangent function

SYNOPSIS

#include <math.h> double tanh(double x);

DESCRIPTION

The tanh() function returns the hyperbolic tangent of x, which is defined mathematically as sinh(x) / cosh(x).

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acosh, asinh, atanh, cosh, sinh,









































                          June 13, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/mbtowc.htm0000644000076400001440000000267207055335024015050 mbtowc



MBTOWC(3) Linux Programmer's Manual MBTOWC(3)

NAME

mbtowc - convert a multibyte character to a wide charac- ter.

SYNOPSIS

#include <stdlib.h> int mbtowc(wchar_t *pwc, const char *s, size_t n);

DESCRIPTION

The mbtowc() function converts a multibyte character s, which is no longer than n bytes, into a wide character and, if pwc is not NULL, stores the wide character in pwc.

RETURN VALUE

mbtowc() returns the number of bytes in the multibyte character or -1 if the multibyte character is not valid.

CONFORMING TO

SVID 3, ISO 9899

SEE ALSO

mblen, mbstowcs, wcstombs, wctomb,



































GNU March 29, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/wctomb.htm0000644000076400001440000000262407055335025015046 wctomb



WCTOMB(3) Linux Programmer's Manual WCTOMB(3)

NAME

wctomb - convert a wide character to a multibyte charac- ter.

SYNOPSIS

#include <stdlib.h> int wctomb(char *s, wchar_t wchar);

DESCRIPTION

The wctomb() function converts a wide character wchar into a multibyte character and, if s is not NULL, stores the multibyte character representation in s.

RETURN VALUE

wctomb() returns the number of bytes in the multibyte character or -1 if the wide character is not valid.

CONFORMING TO

SVID 3, ISO 9899

SEE ALSO

mblen, mbstowcs, mbtowc, wcstombs,



































GNU March 29, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/ldexp.htm0000644000076400001440000000221607055335016014664 ldexp



LDEXP(3) Linux Programmer's Manual LDEXP(3)

NAME

ldexp - multiply floating-point number by integral power of 2

SYNOPSIS

#include <math.h> double ldexp(double x, int exp);

DESCRIPTION

The ldexp() function returns the result of multiplying the floating-point number x by 2 raised to the power exp.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

frexp, modf,








































BSD June 6, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/stat.htm0000644000076400001440000001374607055334775014550 stat



STAT(2) Linux Programmer's Manual STAT(2)

NAME

stat, fstat, lstat - get file status

SYNOPSIS

#include <sys/stat.h> #include <unistd.h> int stat(const char *file_name, struct stat *buf); int fstat(int filedes, struct stat *buf); int lstat(const char *file_name, struct stat *buf);

DESCRIPTION

These functions return information about the specified file. You do not need any access rights to the file to get this information but you need search rights to all directories named in the path leading to the file. stat stats the file pointed to by file_name and fills in buf. lstat is identical to stat, only the link itself is stated, not the file that is obtained by tracing the links. fstat is identical to stat, only the open file pointed to by filedes (as returned by fopen(3) ) is stated in place of file_name. They all return a stat structure, which is declared as follows: struct stat { dev_t st_dev; /* device */ ino_t st_ino; /* inode */ umode_t st_mode; /* protection */ nlink_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of owner */ gid_t st_gid; /* group ID of owner */ dev_t st_rdev; /* device type (if inode device) */ off_t st_size; /* total size, in bytes */ unsigned long st_blksize; /* blocksize for filesystem I/O */ unsigned long st_blocks; /* number of blocks allocated */ time_t st_atime; /* time of last access */ time_t st_mtime; /* time of last modification */ time_t st_ctime; /* time of last change */ }; Note that st_blocks may not always be in terms of blocks of size st_blksize, and that st_blksize may instead pro- vide a notion of the "preferred" blocksize for efficient file system I/O.

Linux 1.1.75 1 January 1995 1

STAT(2) Linux Programmer's Manual STAT(2)

Not all of the Linux filesystems implement all of the time fields. Traditionally, st_atime is changed by mknod(2), utime(2), read(2), write(2), and truncate(2). Traditionally, st_mtime is changed by mknod(2), utime(2), and write(2). The st_mtime is not changed for changes in owner, group, hard link count, or mode. Traditionally, st_ctime is changed by writing or by set- ting inode information (i.e., owner, group, link count, mode, etc.). The following macros are defined to check the file type: S_ISLNK(m) is it a symbolic link S_ISREG(m) regular file S_ISDIR(m) directory S_ISCHR(m) character device S_ISBLK(m) block device S_ISFIFO(m) fifo S_ISSOCK(m) socket The following flags are defined for the st_mode field: S_IFMT 00170000 bitmask for the file type bit- fields S_IFSOCK 0140000 socket S_IFLNK 0120000 symbolic link S_IFREG 0100000 regular file S_IFBLK 0060000 block device S_IFDIR 0040000 directory S_IFCHR 0020000 character device S_IFIFO 0010000 fifo S_ISUID 0004000 set UID bit S_ISGID 0002000 set GID bit S_ISVTX 0001000 sticky bit S_IRWXU 00700 user (file owner) has read, write

Linux 1.1.75 1 January 1995 2

STAT(2) Linux Programmer's Manual STAT(2)

and execute permission S_IRUSR (S_IREAD) 00400 user has read permission S_IWUSR (S_IWRITE) 00200 user has write permission S_IXUSR (S_IEXEC) 00100 user has execute permission S_IRWXG 00070 group has read, write and execute permission S_IRGRP 00040 group has read permission S_IWGRP 00020 group has write permission S_IXGRP 00010 group has execute permission S_IRWXO 00007 others have read, write and execute permission S_IROTH 00004 others have read permission S_IWOTH 00002 others have write permisson S_IXOTH 00001 others have execute permission

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EBADF filedes is bad. ENOENT File does not exist.

CONFORMING TO

SVID (not lstat()), AT&T (not lstat()), POSIX (not lstat()), X/OPEN (not lstat()), BSD 4.3

SEE ALSO

chmod, chown, readlink, utime,














Linux 1.1.75 1 January 1995 3


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/unlink.htm0000644000076400001440000000650107055334750015055 unlink



UNLINK(2) Linux Programmer's Manual UNLINK(2)

NAME

unlink - delete a name and possibly the file it refers to

SYNOPSIS

#include <unistd.h> int unlink(const char *pathname);

DESCRIPTION

unlink deletes a name from the filesystem. If that name was the last link to a file and no processes have the file open the file is deleted and the space it was using is made available for reuse. If the name was the last link to a file but any processes still have the file open the file will remain in existence until the last file descriptor referring to it is closed. If the name referred to a symbolic link the link is removed. If the name referred to a socket, fifo or device the name for it is removed but processes which have the object open may continue to use it.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EFAULT pathname points outside your accessible address space. EACCES Write access to the directory containing pathname is not allowed for the process's effective uid, or one of the directories in pathname did not allow search (execute) permission. EPERM The directory containing pathname has the sticky- bit (S_ISVTX) set and the process's effective uid is neither the uid of the file to be deleted nor that of the directory containing it. ENAMETOOLONG pathname was too long. ENOENT A directory component in pathname does not exist or is a dangling symbolic link. ENOTDIR A component used as a directory in pathname is not, in fact, a directory. EISDIR pathname refers to a directory.

Linux 24 July 1993 1

UNLINK(2) Linux Programmer's Manual UNLINK(2)

ENOMEM Insufficient kernel memory was available. EROFS pathname refers to a file on a read-only filesys- tem.

CONFORMING TO

SVID, AT&T, POSIX, X/OPEN, BSD 4.3

BUGS

Infelicities in the protocol underlying NFS can cause the unexpected disappearance of files which are still being used.

SEE ALSO

link, rename, open, rmdir, mknod, remove, rm,










































Linux 24 July 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/ctermid.htm0000644000076400001440000000303207055335060015173 ctermid



CTERMID(3) Linux Programmer's Manual CTERMID(3)

NAME

ctermid - get controlling terminal name

SYNOPSIS

#include <stdio.h> char *ctermid(char *s);

DESCRIPTION

ctermid() returns a string which is the pathname for the current controlling terminal for this process. If s is NULL, a static buffer is used, otherwise s points to a buffer used to hold the terminal pathname. The symbolic constant L_ctermid is the maximum number of characters in the returned pathname.

RETURN VALUE

The pointer to the pathname.

CONFORMS TO

POSIX.1

BUGS

The path returned may not uniquely identify the control- ling terminal; it may, for example, be /dev/tty. It is not assured that the program can open the terminal.

SEE ALSO

ttyname,




























GNU April 6, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/isatty.htm0000644000076400001440000000212507055335065015070 isatty



ISATTY(3) Linux Programmer's Manual ISATTY(3)

NAME

isatty - does this descriptor refer to a terminal

SYNOPSIS

#include <unistd.h> int isatty ( int desc );

DESCRIPTION

returns 1 if desc is an open descriptor connected to a terminal and 0 else.

CONFORMING TO

SVID, AT&T, X/OPEN, BSD 4.3

SEE ALSO

fstat, ttyname,









































Linux April 20, 1995 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/strlen.htm0000644000076400001440000000225107055334776015072 strlen



STRLEN(3) Linux Programmer's Manual STRLEN(3)

NAME

strlen - calculate the length of a string

SYNOPSIS

#include <string.h> size_t strlen(const char *s);

DESCRIPTION

The strlen() function calculates the length of the string s, not including the terminating `\0' character.

RETURN VALUE

The strlen() function returns the number of characters in s.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

string,





































                          April 12, 1993                        1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/close.htm0000644000076400001440000000430607055334744014666 close



CLOSE(2) Linux Programmer's Manual CLOSE(2)

NAME

close - close a file descriptor

SYNOPSIS

#include <unistd.h> int close(int fd);

DESCRIPTION

close closes a file descriptor, so that it no longer refers to any file and may be reused. If fd is the last copy of a particular file descriptor the resources associated with it are freed; for example any locks held are removed and if the descriptor was the last reference to a file which has been removed using unlink the file is deleted.

RETURN VALUE

close returns zero on success, or -1 if an error occurred.

ERRORS

EBADF fd isn't a valid open file descriptor.

CONFORMING TO

SVID, AT&T, POSIX, X/OPEN, BSD 4.3

NOTES

Not checking the return value of close is a common but nevertheless serious programming error. File system implementations which use techniques as ``write-behind'' to increase performance may lead to write(2) succeeding, although the data has not been written yet. The error status may be reported at a later write operation, but it is guaranteed to be reported on closing the file. Not checking the return value when closing the file may lead to silent loss of data. This can especially be observed with NFS and disk quotas.

SEE ALSO

open, fcntl, shutdown, unlink,

















                        February 18, 1995                       1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/frexp.htm0000644000076400001440000000300007055335016014664 frexp



FREXP(3) Linux Programmer's Manual FREXP(3)

NAME

frexp - convert floating-point number to fractional and integral components

SYNOPSIS

#include <math.h> double frexp(double x, int *exp);

DESCRIPTION

The frexp() function is used to split the number x into a normalized fraction and an exponent which is stored in exp.

RETURN VALUE

The frexp() function returns the normalized fraction. If the argument x is not zero, the normalized fraction is x times a power of two, and is always in the range 1/2 (inclusive) to 1 (exclusive). If x is zero, then the nor- malized fraction is zero and zero is stored in exp.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

, modf,
































GNU June 6, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/wcstombs.htm0000644000076400001440000000272607055335026015420 wcstombs



WCSTOMBS(3) Linux Programmer's Manual WCSTOMBS(3)

NAME

wcstombs - convert a wide character string to a multibyte character string.

SYNOPSIS

#include <stdlib.h> size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);

DESCRIPTION

The wcstombs() function converts a sequence of wide char- acters from the array pwcs into a sequence of multibyte characters and stores up to n bytes of multibyte charac- ters in the array s.

RETURN VALUE

wcstombs() returns the number of bytes stored in s or -1 if s contains an invalid wide character.

CONFORMING TO

SVID 3, ISO 9899

SEE ALSO

mblen, mbtowc, mbstowcs, wctomb,


































GNU March 29, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/vfprintf.htm0000644000076400001440000003336507055335055015422 vfprintf



PRINTF(3) Linux Programmer's Manual PRINTF(3)

NAME

printf, fprintf, sprintf, vprintf, vfprintf, vsprintf - formatted output conversion

SYNOPSIS

#include <stdio.h> int printf( const char *format, ...); int fprintf( FILE *stream, const char *format, ...); int sprintf( char *str, const char *format, ...); #include <stdarg.h> int vprintf( const char *format, va_list ap); int vfprintf( FILE *stream, const char *format, va_list ap); int vsprintf( char *str, char *format, va_list ap);

DESCRIPTION

The printf family of functions produces output according to a format as described below. Printf and vprintf write output to stdout, the standard output stream; fprintf and vfprintf write output to the given output stream; sprintf, and vsprintf write to the character string str. These functions write the output under the control of a format string that specifies how subsequent arguments (or argu- ments accessed via the variable-length argument facilities of stdarg(3) are converted for output. These functions return the number of characters printed (not including the trailing `\0' used to end output to strings). The format string is composed of zero or more directives: ordinary characters (not %), which are copied unchanged to the output stream; and conversion specifications, each of which results in fetching zero or more subsequent argu- ments. Each conversion specification is introduced by the character %. The arguments must correspond properly (after type promotion) with the conversion specifier. After the %, the following appear in sequence: o Zero or more of the following flags: # specifying that the value should be con- verted to an ``alternate form''. For c, d, i, n, p, s, and u conversions, this option has no effect. For o conversions, the pre- cision of the number is increased to force the first character of the output string to a zero (except if a zero value is printed with an explicit precision of zero). For x and X conversions, a non-zero result has the string `0x' (or `0X' for X conversions) prepended to it. For e, E, f, g, and G con- versions, the result will always contain a

BSD MANPAGE 29 November 1993 1

PRINTF(3) Linux Programmer's Manual PRINTF(3)

decimal point, even if no digits follow it (normally, a decimal point appears in the results of those conversions only if a digit follows). For g and G conversions, trailing zeros are not removed from the result as they would otherwise be. 0 specifying zero padding. For all conver- sions except n, the converted value is padded on the left with zeros rather than blanks. If a precision is given with a numeric conversion (d, i, o, u, i, x, and X), the 0 flag is ignored. - (a negative field width flag) indicates the converted value is to be left adjusted on the field boundary. Except for n conver- sions, the converted value is padded on the right with blanks, rather than on the left with blanks or zeros. A - overrides a 0 if both are given. (a space) specifying that a blank should be left before a positive number produced by a signed conversion (d, e, E, f, g, G, or i). + specifying that a sign always be placed before a number produced by a signed conver- sion. A + overrides a space if both are used. o An optional decimal digit string specifying a mini- mum field width. If the converted value has fewer characters than the field width, it will be padded with spaces on the left (or right, if the left- adjustment flag has been given) to fill out the field width. o An optional precision, in the form of a period (`.') followed by an optional digit string. If the digit string is omitted, the precision is taken as zero. This gives the minimum number of digits to appear for d, i, o, u, x, and X conversions, the number of digits to appear after the decimal-point for e, E, and f conversions, the maximum number of significant digits for g and G conversions, or the maximum number of characters to be printed from a string for s conversions. o The optional character h, specifying that a follow- ing d, i, o, u, x, or X conversion corresponds to a short int or unsigned short int argument, or that a following n conversion corresponds to a pointer to a short int argument.

BSD MANPAGE 29 November 1993 2

PRINTF(3) Linux Programmer's Manual PRINTF(3)

o The optional character l (ell) specifying that a following d, i, o, u, x, or X conversion applies to a pointer to a long int or unsigned long int argu- ment, or that a following n conversion corresponds to a pointer to a long int argument. o The character L specifying that a following e, E, f, g, or G conversion corresponds to a long double argument. o A character that specifies the type of conversion to be applied. A field width or precision, or both, may be indicated by an asterisk `*' instead of a digit string. In this case, an int argument supplies the field width or precision. A negative field width is treated as a left adjustment flag followed by a positive field width; a negative precision is treated as though it were missing. The conversion specifiers and their meanings are: diouxX The int (or appropriate variant) argument is con- verted to signed decimal (d and i), unsigned octal (o, unsigned decimal (u, or unsigned hexadecimal (x and X) notation. The letters abcdef are used for x conversions; the letters ABCDEF are used for X con- versions. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires fewer digits, it is padded on the left with zeros. DOU The long int argument is converted to signed deci- mal, unsigned octal, or unsigned decimal, as if the format had been ld, lo, or lu respectively. These conversion characters are deprecated, and will eventually disappear. eE The double argument is rounded and converted in the style [-]d.dddedd where there is one digit before the decimal-point character and the number of dig- its after it is equal to the precision; if the pre- cision is missing, it is taken as 6; if the preci- sion is zero, no decimal-point character appears. An E conversion uses the letter E (rather than e) to introduce the exponent. The exponent always contains at least two digits; if the value is zero, the exponent is 00. f The double argument is rounded and converted to decimal notation in the style [-]ddd.ddd, where the number of digits after the decimal-point character is equal to the precision specification. If the precision is missing, it is taken as 6; if the

BSD MANPAGE 29 November 1993 3

PRINTF(3) Linux Programmer's Manual PRINTF(3)

precision is explicitly zero, no decimal-point character appears. If a decimal point appears, at least one digit appears before it. g The double argument is converted in style f or e (or E for G conversions). The precision specifies the number of significant digits. If the precision is missing, 6 digits are given; if the precision is zero, it is treated as 1. Style e is used if the exponent from its conversion is less than -4 or greater than or equal to the precision. Trailing zeros are removed from the fractional part of the result; a decimal point appears only if it is fol- lowed by at least one digit. c The int argument is converted to an unsigned char, and the resulting character is written. s The ``char *'' argument is expected to be a pointer to an array of character type (pointer to a string). Characters from the array are written up to (but not including) a terminating NUL character; if a precision is specified, no more than the num- ber specified are written. If a precision is given, no null character need be present; if the precision is not specified, or is greater than the size of the array, the array must contain a termi- nating NUL character. p The ``void *'' pointer argument is printed in hex- adecimal (as if by %#x or %#lx). n The number of characters written so far is stored into the integer indicated by the ``int *'' (or variant) pointer argument. No argument is con- verted. % A `%' is written. No argument is converted. The complete conversion specification is `%%'. In no case does a non-existent or small field width cause truncation of a field; if the result of a conversion is wider than the field width, the field is expanded to con- tain the conversion result.

EXAMPLES

To print a date and time in the form `Sunday, July 3, 10:02', where weekday and month are pointers to strings: #include <stdio.h> fprintf(stdout, "%s, %s %d, %.2d:%.2d\n", weekday, month, day, hour, min); To print to five decimal places:

BSD MANPAGE 29 November 1993 4

PRINTF(3) Linux Programmer's Manual PRINTF(3)

#include <math.h> #include <stdio.h> fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0)); To allocate a 128 byte string and print into it: #include <stdio.h> #include <stdlib.h> #include <stdarg.h> char *newfmt(const char *fmt, ...) { char *p; va_list ap; if ((p = malloc(128)) == NULL) return (NULL); va_start(ap, fmt); (void) vsnprintf(p, 128, fmt, ap); va_end(ap); return (p); }

SEE ALSO

printf, scanf,


STANDARDS

The fprintf, printf, sprintf, vprintf, vfprintf, and vsprintf functions conform to ANSI C3.159-1989 (``ANSI C'').

BUGS

Some floating point conversions under Linux cause memory leaks. The conversion formats %D, %O, and %U are not standard and are provided only for backward compatibility. These may not be provided under Linux. The effect of padding the %p format with zeros (either by the 0 flag or by specifying a precision), and the benign effect (i.e., none) of the # flag on %n and %p conver- sions, as well as other nonsensical combinations such as %Ld, are not standard; such combinations should be avoided. Because sprintf and vsprintf assume an infinitely long string, callers must be careful not to overflow the actual space; this is often impossible to assure.

BSD MANPAGE 29 November 1993 5


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/getlogin.htm0000644000076400001440000000073507055335063015366 getlogin


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/strcspn.htm0000644000076400001440000000356007055335004015244 strcspn



STRSPN(3) Linux Programmer's Manual STRSPN(3)

NAME

strspn, strcspn - search a string for a set of characters

SYNOPSIS

#include <string.h> size_t strspn(const char *s, const char *accept); size_t strcspn(const char *s, const char *reject);

DESCRIPTION

The strspn() function calculates the length of the initial segment of s which consists entirely of characters in accept. The strcspn() function calculates the length of the ini- tial segment of s which consists entirely of characters not in reject.

RETURN VALUE

The strspn() function returns the number of characters in the initial segment of s which consist only of characters from accept. The strcspn() function returns the number of characters in the initial segment of s which are not in the string reject.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

index, memchr, rindex, strchr, strpbrk, strsep, strstr, strtok,
























                          April 12, 1993                        1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/opendir.htm0000644000076400001440000000360107055334760015214 opendir



OPENDIR(3) Linux Programmer's Manual OPENDIR(3)

NAME

opendir - open a directory

SYNOPSIS

#include <sys/types.h> #include <dirent.h> DIR *opendir(const char *name);

DESCRIPTION

The opendir() function opens a directory stream corre- sponding to the directory name, and returns a pointer to the directory stream. The stream is positioned at the first entry in the directory.

RETURN VALUE

The opendir() function returns a pointer to the directory stream or NULL if an error occurred.

ERRORS

EACESS Permission denied. EMFILE Too many file descriptors in use by process. ENFILE Too many files are currently open in the system. ENOENT Directory does not exist, or name is an empty string. ENOMEM Insufficient memory to complete the operation. ENOTDIR name is not a directory.

CONFORMING TO

SVID 3, POSIX, BSD 4.3

SEE ALSO

open, readdir, closedir, rewinddir, seekdir, telldir, scandir,

















                           11 June 1995                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/strcasecmp.htm0000644000076400001440000000347707055335014015724 strcasecmp



STRCASECMP(3) Linux Programmer's Manual STRCASECMP(3)

NAME

strcasecmp, strncasecmp - compare two strings ignoring case

SYNOPSIS

#include <string.h> int strcasecmp(const char *s1, const char *s2); int strncasecmp(const char *s1, const char *s2, size_t n);

DESCRIPTION

The strcasecmp() function compares the two strings s1 and s2, ignoring the case of the characters. It returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2. The strncasecmp() function is similar, except it only com- pares the first n characters of s1.

RETURN VALUE

The strcasecmp() and strncasecmp() functions return an integer less than, equal to, or greater than zero if s1 (or the first n bytes thereof) is found, respectively, to be less than, to match, or be greater than s2.

CONFORMING TO

BSD 4.3

SEE ALSO

bcmp, memcmp, strcmp, strcoll, strncmp,


























                          April 11, 1993                        1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/asin.htm0000644000076400001440000000271407055335006014504 asin



ASIN(3) Linux Programmer's Manual ASIN(3)

NAME

asin - arc sine function

SYNOPSIS

#include <math.h> double asin(double x);

DESCRIPTION

The asin() function calculates the arc sine of x; that is the value whose sine is x. If x falls outside the range -1 to 1, asin() fails and errno is set.

RETURN VALUE

The asin() function returns the arc sine in radians and the value is mathematically defined to be between -PI/2 and PI/2 (inclusive).

ERRORS

EDOM x is out of range.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acos, atan, atan2, cos, sin, tan,
































                           June 8, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/realloc.htm0000644000076400001440000000512307055335025015171 realloc



MALLOC(3) Linux Programmer's Manual MALLOC(3)

NAME

calloc, malloc, free, realloc - Allocate and free dynamic memory

SYNOPSIS

#include <stdlib.h> void *calloc(size_t nmemb, size_t size); void *malloc(size_t size); void free(void *ptr); void *realloc(void *ptr, size_t size);

DESCRIPTION

calloc() allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. malloc() allocates size bytes and returns a pointer to the allocated memory. The memory is not cleared. free() frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() or realloc(). If ptr is NULL, no operation is performed. realloc() changes the size of the memory block pointed to by ptr to size bytes. The contents will be unchanged to the minimum of the old an new sizes; newly allocated mem- ory will be uninitialized. If ptr is NULL, the call is equivalent to malloc(size); if size is equal to zero, the call is equivalent to free(ptr). Unless ptr is NULL, it must have been returned by an earlier call to malloc(), calloc() or realloc().

RETURN VALUES

For calloc() and malloc(), the value returned is a pointer to the allocated memory, which is suitably aligned for any kind of variable, or NULL if the request fails. free() returns no value. realloc() returns a pointer to the newly allocated memory, which is suitably aligned for any kind of variable and may be different from ptr, or NULL if the request fails or if size was equal to 0. If realloc() fails the original block is left untouched - it is not freed or moved.

CONFORMS TO

ANSI - C

SEE ALSO

brk,






GNU April 4, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/readdir.htm0000644000076400001440000000542107055334761015171 readdir



READDIR(2) Linux Programmer's Manual READDIR(2)

NAME

readdir - read directory entry

SYNOPSIS

#include <unistd.h> #include <linux/dirent.h> #include <linux/unistd.h> _syscall3(int, readdir, uint, fd, struct dirent *, dirp, uint, count); int readdir(unsigned int fd, struct dirent *dirp, unsigned int count);

DESCRIPTION

This is not the function you are interested in. Look at readdir(3) for the POSIX conforming C library interface. This page documents the bare kernel system call interface, which can change, and which is superseded by getdents(2). readdir reads one dirent structure from the directory pointed at by fd into the memory area pointed to by dirp. The parameter count is ignored; at most one dirent struc- ture is read. The dirent structure is declared as follows: struct dirent { long d_ino; /* inode number */ off_t d_off; /* offset to this dirent */ unsigned short d_reclen; /* length of this d_name */ char d_name [NAME_MAX+1]; /* file name (null-terminated) */ } d_ino is an inode number. d_off is the distance from the start of the directory to this dirent. d_reclen is the size of d_name, not counting the null terminator. d_name is a null-terminated file name.

RETURN VALUE

On success, 1 is returned. On end of directory, 0 is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EBADF Invalid file descriptor fd. ENOTDIR File descriptor does not refer to a directory.

CONFORMING TO

This system call is Linux specific.

Linux 1.3.6 22 July 1995 1

READDIR(2) Linux Programmer's Manual READDIR(2)


SEE ALSO

getdents, readdir,
























































Linux 1.3.6 22 July 1995 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/getgroupd.htm0000644000076400001440000000505207055335063015553 getgroups



GETGROUPS(2) Linux Programmer's Manual GETGROUPS(2)

NAME

getgroups, setgroups - get/set group access list

SYNOPSIS

#include <unistd.h> int getgroups(int size, gid_t list[]); #define __USE_BSD #include <grp.h> int setgroups(size_t size, const gid_t *list);

DESCRIPTION

getgroups Up to size supplemental groups are returned in list. If size is zero, list is not modified, but the total number of supplemental groups for the process is returned. setgroups Sets the supplemental groups for the process. Only the super-user may use this function.

RETURN VALUE

getgroups On success, the number of groups stored in list is returned (if size is zero, however, the number of supplemental group IDs associated with the process is returned). On error, -1 is returned, and errno is set appropriately. setgroups On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EFAULT list has an invalid address. EPERM For setgroups, the user is not the super-user. EINVAL For setgroups, gidsetsize is greater than NGROUPS (32 for Linux 0.99.11).

CONFORMING TO

getgroups conforms to POSIX.1 (and is present in BSD 4.3). Since setgroups requires privilege, it is not covered under POSIX.1.

BUGS

The __USE_BSD flag probably shouldn't be required for set- groups.

Linux 0.99.11 23 July 1993 1

GETGROUPS(2) Linux Programmer's Manual GETGROUPS(2)


SEE ALSO

initgroups,
























































Linux 0.99.11 23 July 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/ferror.htm0000644000076400001440000000364407055334770015063 ferror



FERROR(3) Linux Programmer's Manual FERROR(3)

NAME

clearerr, feof, ferror, fileno - check and reset stream status

SYNOPSIS

#include <stdio.h> void clearerr( FILE *stream); int feof( FILE *stream); int ferror( FILE *stream); int fileno( FILE *stream);

DESCRIPTION

The function clearerr clears the end-of-file and error indicators for the stream pointed to by stream. The function feof tests the end-of-file indicator for the stream pointed to by stream, returning non-zero if it is set. The end-of-file indicator can only be cleared by the function clearerr. The function ferror tests the error indicator for the stream pointed to by stream, returning non-zero if it is set. The error indicator can only be reset by the clear- err function. The function fileno examines the argument stream and returns its integer descriptor.

ERRORS

These functions should not fail and do not set the exter- nal variable errno.

SEE ALSO

open, stdio,


STANDARDS

The functions clearerr, feof, and ferror conform to C3.159-1989 (``ANSI C'').

BSD MANPAGE 29 November 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/getpwent.htm0000644000076400001440000000457407055334746015427 getpwent



GETPWENT(3) Linux Programmer's Manual GETPWENT(3)

NAME

getpwent, setpwent, endpwent - get password file entry

SYNOPSIS

#include <pwd.h> #include <sys/types.h> struct passwd *getpwent(void); void setpwent(void); void endpwent(void);

DESCRIPTION

The getpwent() function returns a pointer to a structure containing the broken out fields of a line from /etc/passwd. The first time it is called it returns the first entry; thereafter, it returns successive entries. The setpwent() function rewinds the file pointer to the beginning of the /etc/passwd file. The endpwent() function closes the /etc/passwd file. The passwd structure is defined in <pwd.h> as follows: struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* user password */ uid_t pw_uid; /* user id */ gid_t pw_gid; /* group id */ char *pw_gecos; /* real name */ char *pw_dir; /* home directory */ char *pw_shell; /* shell program */ };

RETURN VALUE

The getpwent() function returns the passwd structure, or NULL if there are no more entries or an error occurs.

ERRORS

ENOMEM Insufficient memory to allocate passwd structure.

FILES

/etc/passwdpassword database file

CONFORMING TO

SVID 3, BSD 4.3

SEE ALSO

fgetpwent, getpwnam, getpwuid, getpw,






GNU April 9, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/getopt.htm0000644000076400001440000001411407055334772015062 getopt



GETOPT(3) Linux Programmer's Manual GETOPT(3)

NAME

getopt - Read command line options

SYNOPSIS

#include <unistd.h> int getopt(int argc, char * const argv[], const char *optstring); extern char *optarg; extern int optind, opterr, optopt; #include <getopt.h> int getopt_long(int argc, char * const argv[], const char *shortopts, const struct option *longopts, int longind);

DESCRIPTION

The getopt() function parses the command line arguments. Its arguments argc and argv are the argument count and array as passed to the main() function on program invoca- tion. optstring is a list of available option characters. If such a character is followed by a colon, the option takes an argument, which is placed in optarg. The external variable optind is the index of the next array element of argv[] to be processed; it communicates from one call of getopt() to the next which element to process. The getopt_long() function works like getopt() except that it also accepts long options, started out by two dashes. If these take values, it is either in the form --arg=value or --arg value. It takes the additional arguments lon- gopts which is a pointer to the first element of an array of struct option declared in <getopt.h> as struct option { const char *name; int has_arg; int *flag; int val; }; The meaning of the different fields are: name is the name of the long option. has_arg is a boolean value which should be set to nonzero if the long option takes a value. flag determines the return value if getopt_long()

GNU April 25, 1993 1

GETOPT(3) Linux Programmer's Manual GETOPT(3)

returns a value for a long option; if it is non- zero, zero is returned as a function value, other- wise val. val determines the value to return if flag is zero. The last element of the array has to be filled with zeroes. The option_index points to the index of the long option relative to longopts.

RETURN VALUE

The getopt() function returns the option character if the option was found successfully, ':' if there was a missing parameter for one of the options, '?' for an unknown option character and -1 for the end of the option list.

EXAMPLE

The following example program, from the source code, illustrates the use of getopt_long() with most of its fea- tures. #include <stdio.h> int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 1, 0, 'c'}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:012", long_options, &option_index); if (c == -1) break; switch (c)

GNU April 25, 1993 2

GETOPT(3) Linux Programmer's Manual GETOPT(3)

{ case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("0); break; case '0': case '1': case '2': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.0); digit_optind = this_option_optind; printf ("option %c0, c); break; case 'a': printf ("option a0); break; case 'b': printf ("option b0); break; case 'c': printf ("option c with value `%s'0, optarg); break; case 'd': printf ("option d with value `%s'0, optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??0, c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("0); } exit (0); }

BUGS

This manpage is confusing.

GNU April 25, 1993 3

GETOPT(3) Linux Programmer's Manual GETOPT(3)

CONFORMS TO

getopt() : POSIX.1

GNU April 25, 1993 4


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/time.htm0000644000076400001440000000244407055335031014506 time



TIME(2) Linux Programmer's Manual TIME(2)

NAME

time - get time in seconds

SYNOPSIS

#include <time.h> time_t time(time_t *t);

DESCRIPTION

time returns the time since 00:00:00 GMT, January 1, 1970, measured in seconds. If t is non null, the return value is also stored in the memory pointed to by t.

CONFORMING TO

SVID, AT&T, POSIX, X/OPEN, BSD 4.3 Under BSD 4.3, this call is obsoleted by gettimeofday(2).

SEE ALSO

ctime, date, ftime, gettimeofday,





































Linux 24 July 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/mblen.htm0000644000076400001440000000300207055335023014635 mblen



MBLEN(3) Linux Programmer's Manual MBLEN(3)

NAME

mblen - determine the number of bytes in a character

SYNOPSIS

#include <stdlib.h> int mblen(const char *s, size_t n);

DESCRIPTION

The mblen() function scans the first n bytes of the string s and returns the number of bytes in a character. The mblen() function is equivalent to mbtowc((wchat_t *)0, s, n); except that the shift state of the mbtowc() function is not affected.

RETURN VALUE

The mblen() returns the number of bytes in a character or -1 if the character is invalid or 0 if s is a NULL string.

CONFORMING TO

SVID 3, ISO 9899

SEE ALSO

mbstowcs, mbtowc, wcstombs, wctomb,































GNU March 29, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/fputs.htm0000644000076400001440000000517707055334765014734 fputs



PUTS(3) Linux Programmer's Manual PUTS(3)

NAME

fputc, fputs, putc, putchar, puts - output of characters and strings

SYNOPSIS

#include <stdio.h> int fputc(int c, FILE *stream); int fputs(const char *s, FILE *stream); int putc(int c, FILE *stream); int putchar(int c); int puts(char *s); int ungetc(int c, FILE *stream);

DESCRIPTION

fputc() writes the character c, cast to an unsigned char, to stream. fputs() writes the string s to stream, without its trail- ing '\0'. putc() is equivalent to fputc() except that it may be implemented as a macro which evaluates stream more than once. putchar(c); is equivalent to putc(c,stdout). puts() writes the string s and a trailing newline to std- out. Calls to the functions described here can be mixed with each other and with calls to other output functions from the stdio library for the same output stream.

RETURN VALUES

fputc(), putc() and putchar() return the character written as an unsigned char cast to an int or EOF on error. puts() and fputs() return a non - negative number on suc- cess, or EOF on error.

CONFORMS TO

ANSI - C, POSIX.1

BUGS

It is not advisable to mix calls to output functions from the stdio library with low - level calls to write() for the file descriptor associated with the same output stream; the results will be undefined and very probably not what you want.

SEE ALSO

write, fopen, fwrite, scanf, gets,




GNU April 4, 1993 1

PUTS(3) Linux Programmer's Manual PUTS(3)

fseek(3), ferror(3)

GNU April 4, 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/tmpfile.htm0000644000076400001440000000351007055335042015205 tmpfile



TMPFILE(3) Linux Programmer's Manual TMPFILE(3)

NAME

tmpfile - create a temporary file

SYNOPSIS

#include <stdio.h> FILE *tmpfile (void);

DESCRIPTION

The tmpfile() function generates a unique temporary file- name using the path prefix P_tmpdir defined in <stdio.h>. The temporary file is then opened in binary read/write (w+b) mode. The file will be automatically deleted when it is closed or the program terminates.

RETURN VALUE

The tmpfile() function returns a stream descriptor, or NULL if a unique filename cannot be generated or the unique file cannot be opened.

ERRORS

EACCES Search permission denied for directory in file's path prefix. EEXIST Unable to generate a unique filename. EMFILE Too many file descriptors in use by process. ENFILE Too many files open in system. EROFS Read-only filesystem.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

mktemp, mkstemp, tmpnam, tempnam,





















GNU April 3, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/difftime.htm0000644000076400001440000000264407055335031015341 difftime



DIFFTIME(3) Linux Programmer's Manual DIFFTIME(3)

NAME

difftime - calculate time difference

SYNOPSIS

#include <time.h> double difftime(time_t time1, time_t time0);

DESCRIPTION

The difftime() function returns the number of seconds elapsed between time time1 and time time0. The two times are specified in calendar time, which represents the time elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).

CONFORMING TO

SVID 3, BSD 4.3, ISO 9899

SEE ALSO

date, gettimeofday, time, ctime, gmtime, ,





































GNU July 2, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/closedir.htm0000644000076400001440000000277007055334764015372 closedir



CLOSEDIR(3) Linux Programmer's Manual CLOSEDIR(3)

NAME

closedir - close a directory

SYNOPSIS

#include <sys/types.h> #include <dirent.h> int closedir(DIR *dir);

DESCRIPTION

The closedir() function closes the directory stream asso- ciated with dir. The directory stream descriptor dir is not available after this call.

RETURN VALUE

The closedir() function returns 0 on success or -1 on failure.

ERRORS

EBADF Invalid directory stream descriptor dir.

CONFORMING TO

SVID 3, POSIX, BSD 4.3

SEE ALSO

close, opendir, readdir, rewinddir, seekdir, telldir, scandir,






























                           11 June 1995                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/atan.htm0000644000076400001440000000253007055335007014472 atan



ATAN(3) Linux Programmer's Manual ATAN(3)

NAME

atan - arc tangent function

SYNOPSIS

#include <math.h> double atan(double x);

DESCRIPTION

The atan() function calculates the arc tangent of x; that is the value whose tangent is x.

RETURN VALUE

The atan() function returns the arc tangent in radians and the value is mathematically defined to be between -PI/2 and PI/2 (inclusive).

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acos, asin, atan2, cos, sin, tan,




































                           June 8, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/fpathconf.htm0000644000076400001440000001051707055335062015524 pathconf



FPATHCONF(3) Linux Programmer's Manual FPATHCONF(3)

NAME

fpathconf, pathconf - get configuration values for files

SYNOPSIS

#include <unistd.h> long fpathconf(int filedes, int name); long pathconf(char *path, int name);

DESCRIPTION

fpathconf() gets a value for the configuration option name for the open file descriptor filedes. pathconf() gets a value for configuration option name for the file name path. The corresponding macros defined in <unistd.h> minimum values; if an application wants to take advantage of val- ues which may change, a call to fpathconf() or pathconf() can be made, which may yield more liberal results. Setting name equal to one of the following constants returns the following configuration options: _PC_LINK_MAX returns the maximum number of links to the file. If filedes or path refer to a directory, then the value applies to the whole directory. The corre- sponding macro is _POSIX_LINK_MAX. _PC_MAX_CANON returns the maximum length of a formatted input line, where filedes or path must refer to a termi- nal. The corresponding macro is _POSIX_MAX_CANON. _PC_MAX_INPUT returns the maximum length of an input line, where filedes or path must refer to a terminal. The cor- responding macro is _POSIX_MAX_INPUT. _PC_NAME_MAX returns the maximum length of a filename in the directory path or filedes. the process is allowed to create. _POSIX_MAX_. _PC_PATH_MAX returns the maximum length of a relative pathname when path or filedes is the current working direc- tory. The corresponding macro is _POSIX_PATH_MAX. _PC_PIPE_BUF returns the size of the pipe buffer, where filedes must refer to a pipe or FIFO and path must refer to a FIFO. The corresponding macro is _POSIX_PIPE_BUF.

GNU April 4, 1993 1

FPATHCONF(3) Linux Programmer's Manual FPATHCONF(3)

_PC_CHOWN_RESTRICTED returns nonzero if the chown(2) call may not be used on this file. If filedes or path refer to a directory, then this applies to all files in that directory. The corresponding macro is _POSIX_CHOWN_RESTRICTED. _PC_NO_TRUNC returns nonzero if accessing filenames longer than _POSIX_NAME_MAX generates an error. The corre- sponding macro is _POSIX_NO_TRUNC. _PC_VDISABLE returns nonzero if special character processing can be disabled, where filedes or path must refer to a terminal.

RETURN VALUE

The limit is returned, if one exists. If the system does not have a limit for the requested resource, -1 is returned, and errno is unchanged. If there is an error, -1 is returned, and errno is set to reflect the nature of the error.

CONFORMS TO

POSIX.1 Files with name lengths longer than the value returned for name equal to _PC_NAME_MAX may exist in the given directory. Some returned values may be huge; they are not suitable for allocating memory.

SEE ALSO

getconf, statfs, open, sysconf,
























GNU April 4, 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/putenv.htm0000644000076400001440000000305707055334767015111 putenv



PUTENV(3) Linux Programmer's Manual PUTENV(3)

NAME

putenv - change or add an environment variable

SYNOPSIS

#include <stdlib.h> int putenv(const char *string);

DESCRIPTION

The putenv() function adds or changes the value of envi- ronment variables. The argument string is of the form name = value. If name does not already exist in the envi- ronment, then string is added to the environment. If name does exist, then the value of name in the environment is changed to value.

RETURN VALUE

The putenv() function returns zero on success, or -1 if an error occurs.

ERRORS

ENOMEM Insufficient space to allocate new environment.

CONFORMING TO

SVID 3, POSIX, BSD 4.3

SEE ALSO

getenv, setenv, unsetenv,






























GNU April 8, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/getpid.htm0000644000076400001440000000261507055335065015033 getpid



GETPID(2) Linux Programmer's Manual GETPID(2)

NAME

getpid, getppid - get process identification

SYNOPSIS

#include <unistd.h> pid_t getpid(void); pid_t getppid(void);

DESCRIPTION

getpid returns the process ID of the current process. (This is often used by routines that generate unique tem- porary file names.) getppid returns the process ID of the parent of the cur- rent process.

CONFORMING TO

POSIX, BSD 4.3, SVID

SEE ALSO

exec, fork, kill, mkstemp, tmpnam, tempnam, tmpfile,



































Linux 0.99.11 23 July 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/rename.htm0000644000076400001440000001224507055334752015030 rename



RENAME(2) Linux Programmer's Manual RENAME(2)

NAME

rename - change the name or location of a file

SYNOPSIS

#include <unistd.h> int rename(const char *oldpath, const char *newpath);

DESCRIPTION

rename renames a file, moving it between directories if required. Any other hard links to the file (as created using link) are unaffected. If newpath already exists it will be atomically overwrit- ten (subject to a few conditions - see ERRORS below), so that there is no point at which another process attempting to access newpath will find it missing. If newpath exists but the operation fails for some reason or the system crashes rename guarantees to leave an instance of newpath in place. However, when overwriting there will probably be a window in which both oldpath and newpath refer to the file being renamed. If oldpath refers to a symbolic link the link is renamed; if newpath refers to a symbolic link the link will be overwritten.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EISDIR newpath is an existing directory, but oldpath is not a directory. EXDEV oldpath and newpath are not on the same filesys- tem. ENOTEMPTY newpath is a non-empty directory. EBUSY newpath exists and is the current working direc- tory or root directory of some process. EINVAL An attempt was made to make a directory a subdi- rectory of itself. EMLINK oldpath already has the maximum number of links to it, or it was a directory and the directory

Linux 0.99.7 24 July 1993 1

RENAME(2) Linux Programmer's Manual RENAME(2)

containing newpath has the maximum number of links. ENOTDIR A component used as a directory in oldpath or new- path is not, in fact, a directory. EFAULT oldpath or newpath points outside your accessible address space. EACCES Write access to the directory containing oldpath or newpath is not allowed for the process's effec- tive uid, or one of the directories in oldpath or newpath did not allow search (execute) permission, or oldpath was a directory and did not allow write permission (needed to update the .. entry). EPERM The directory containing oldpath has the sticky bit set and the process's effective uid is neither the uid of the file to be deleted nor that of the directory containing it, or the filesystem con- taining pathname does not support renaming of the type requested. ENAMETOOLONG oldpath or newpath was too long. ENOENT A directory component in oldpath or newpath does not exist or is a dangling symbolic link. ENOMEM Insufficient kernel memory was available. EROFS The file is on a read-only filesystem. ELOOP oldpath or newpath contains a reference to a cir- cular symbolic link, ie a symbolic link whose expansion contains a reference to itself. ENOSPC The device containing the file has no room for the new directory entry.

CONFORMING TO

POSIX, BSD 4.3, ANSI C

BUGS

Currently (Linux 0.99pl7) most of the filesystems except Minix will not allow any overwriting renames involving directories. You get EEXIST if you try. On NFS filesystems, you can not assume that only because the operation failed, the file was not renamed. If the server does the rename operation and then crashes, the retransmitted RPC which will be processed when the server is up again causes a failure. The application is expected to deal with this. See link(2) for a similar problem.

Linux 0.99.7 24 July 1993 2

RENAME(2) Linux Programmer's Manual RENAME(2)


SEE ALSO

link, unlink, symlink,
























































Linux 0.99.7 24 July 1993 3


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/cuserid.htm0000644000076400001440000000073407055335060015210 cuserid


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/strspn.htm0000644000076400001440000000355707055335005015110 strspn



STRSPN(3) Linux Programmer's Manual STRSPN(3)

NAME

strspn, strcspn - search a string for a set of characters

SYNOPSIS

#include <string.h> size_t strspn(const char *s, const char *accept); size_t strcspn(const char *s, const char *reject);

DESCRIPTION

The strspn() function calculates the length of the initial segment of s which consists entirely of characters in accept. The strcspn() function calculates the length of the ini- tial segment of s which consists entirely of characters not in reject.

RETURN VALUE

The strspn() function returns the number of characters in the initial segment of s which consist only of characters from accept. The strcspn() function returns the number of characters in the initial segment of s which are not in the string reject.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

index, memchr, rindex, strchr, strpbrk, strsep, strstr, strtok,
























                          April 12, 1993                        1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/mbstowcs.htm0000644000076400001440000000270507055335024015413 mbstowcs



MBSTOWCS(3) Linux Programmer's Manual MBSTOWCS(3)

NAME

mbstowcs - convert a multibyte string to a wide character string.

SYNOPSIS

#include <stdlib.h> size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n);

DESCRIPTION

The mbstowcs() function converts a sequence of multibyte characters from the array s into a sequence of wide char- acters and stores up to n wide characters in the array pwcs.

RETURN VALUE

mbstowcs() returns the number of wide characters stored or -1 if s contains an invalid multibyte character.

CONFORMING TO

SVID 3, ISO 9899

SEE ALSO

mblen, mbtowc, wcstombs, wctomb,


































GNU March 29, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/dup2.htm0000644000076400001440000000433307055335061014424 dup2



DUP(2) Linux Programmer's Manual DUP(2)

NAME

dup, dup2 - duplicate a file descriptor

SYNOPSIS

#include <unistd.h> int dup(int oldfd); int dup2(int oldfd, int newfd);

DESCRIPTION

dup and dup2 create a copy of the file descriptor oldfd. The old and new descriptors may be used interchangeably. They share locks, file position pointers and flags; for example, if the file position is modified by using lseek on one of the descriptors, the position is also changed for the other. The two descriptors do not share the close-on-exec flag, however. dup uses the lowest-numbered unused descriptor for the new descriptor. dup2 makes newfd be the copy of oldfd, closing newfd first if necessary.

RETURN VALUE

dup and dup2 return the new descriptor, or -1 if an error occurred (in which case, errno is set appropriately).

ERRORS

EBADF oldfd isn't an open file descriptor, or newfd is out of the allowed range for file descriptors. EMFILE The process already has the maximum number of file descriptors open and tried to open a new one.

WARNING

The error returned by dup2 is different to that returned by fcntl(...,F_DUPFD,...) when newfd is out of range. On some systems dup2 also sometimes returns EINVAL like F_DUPFD.

CONFORMING TO

SVID, AT&T, POSIX, X/OPEN, BSD 4.3

SEE ALSO

fcntl, open,









Linux 1.1.46 21 August 1994 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/raise.htm0000644000076400001440000000221207055335011014642 raise



RAISE(3) Linux Programmer's Manual RAISE(3)

NAME

raise - send a signal.

SYNOPSIS

#include <signal.h> int raise (int sig);

DESCRIPTION

raise() sends a signal to the current process. It is equivalent to kill(getpid(),sig)

RETURN VALUE

Zero for success, nonzero for failure.

CONFORMS TO

ANSI - C

SEE ALSO

kill, signal, getpid,






































GNU April 4, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/getpwnam.htm0000644000076400001440000000467407055334745015414 getpwuid



GETPWNAM(3) Linux Programmer's Manual GETPWNAM(3)

NAME

getpwnam, getpwuid - get password file entry

SYNOPSIS

#include <pwd.h> #include <sys/types.h> struct passwd *getpwnam(const char * name); struct passwd *getpwuid(uid_t uid);

DESCRIPTION

The getpwnam() function returns a pointer to a structure containing the broken out fields of a line from /etc/passwd for the entry that matches the user name name. The getpwuid() function returns a pointer to a structure containing the broken out fields of a line from /etc/passwd for the entry that matches the user uid uid. The passwd structure is defined in <pwd.h> as follows: struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* user password */ uid_t pw_uid; /* user id */ gid_t pw_gid; /* group id */ char *pw_gecos; /* real name */ char *pw_dir; /* home directory */ char *pw_shell; /* shell program */ };

RETURN VALUE

The getpwnam() and getpwuid() functions return the passwd structure, or NULL if the matching entry is not found or an error occurs.

ERRORS

ENOMEM Insufficient memory to allocate passwd structure.

FILES

/etc/passwdpassword database file

CONFORMING TO

SVID 3, POSIX, BSD 4.3

SEE ALSO

fgetpwent, getpwent, setpwent, endpwent, getpw, putpwent,









GNU April 9, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/putpwent.htm0000644000076400001440000000401107055334747015443 putpwent



PUTPWENT(3) Linux Programmer's Manual PUTPWENT(3)

NAME

putpwent - write a password file entry

SYNOPSIS

#include <pwd.h> #include <stdio.h> #include <sys/types.h> int putpwent(const struct passwd *p, FILE *stream);

DESCRIPTION

The putpwent() function writes a password entry from the structure p in the file associated with stream. The passwd structure is defined in <pwd.h> as follows: struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* user password */ uid_t pw_uid; /* user id */ gid_t pw_gid; /* group id */ char *pw_gecos; /* real name */ char *pw_dir; /* home directory */ char *pw_shell; /* shell program */ };

RETURN VALUE

The putpwent() function returns 0 on success, or -1 if an error occurs.

ERRORS

EINVAL Invalid (NULL) argument given.

CONFORMING TO

SVID 3

SEE ALSO

fgetpwent, getpwent, setpwent, endpwent, getpwuid, getpw,



















GNU April 9, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/tmpnam.htm0000644000076400001440000000324707055334743015057 tmpnam



TMPNAM(3) Linux Programmer's Manual TMPNAM(3)

NAME

tmpnam - create a name for a temporary file

SYNOPSIS

#include <stdio.h> char *tmpnam(char *s);

DESCRIPTION

The tmpnam() function generates a unique temporary file- name using the path prefix P_tmpdir defined in <stdio.h>. If the argument s is NULL, tmpnam() returns the address of an internal static area which holds the filename, which is overwritten by subsequent calls to tmpnam(). If s is not NULL, the filename is returned in s.

RETURN VALUE

The tmpnam() function returns a pointer to the unique tem- porary filename, or NULL if a unique name cannot be gener- ated.

ERRORS

EEXIST Unable to generate a unique filename.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

mktemp, mkstemp, tempnam, tmpfile,





























GNU April 3, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/freopen.htm0000644000076400001440000001210407055335044015204 freopen



FOPEN(3) Linux Programmer's Manual FOPEN(3)

NAME

fopen, fdopen, freopen - stream open functions

SYNOPSIS

#include <stdio.h> FILE *fopen( char *path, char *mode); FILE *fdopen( int fildes, char *mode); FILE *freopen( char *path, char *mode, FILE *stream);

DESCRIPTION

The fopen function opens the file whose name is the string pointed to by path and associates a stream with it. The argument mode points to a string beginning with one of the following sequences (Additional characters may follow these sequences.): r Open text file for reading. The stream is posi- tioned at the beginning of the file. r+ Open for reading and writing. The stream is posi- tioned at the beginning of the file. w Truncate file to zero length or create text file for writing. The stream is positioned at the beginning of the file. w+ Open for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the beginning of the file. a Open for writing. The file is created if it does not exist. The stream is positioned at the end of the file. a+ Open for reading and writing. The file is created if it does not exist. The stream is positioned at the end of the file. The mode string can also include the letter ``b'' either as a third character or as a character between the charac- ters in any of the two-character strings described above. This is strictly for compatibility with ANSI C3.159-1989 (``ANSI C'') and has no effect; the ``b'' is ignored. Linux may not behave this way. Any created files will have mode S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH (0666), as modified by the process' umask value (see umask(2). Reads and writes may be intermixed on read/write streams in any order, and do not require an intermediate seek as

BSD MANPAGE 29 November 1993 1

FOPEN(3) Linux Programmer's Manual FOPEN(3)

in previous versions of stdio. This is not portable to other systems, however, and may not work under Linux (someone should find out and fix this manpage); ANSI C requires that a file positioning function intervene between output and input, unless an input operation encounters end-of-file. The fdopen function associates a stream with the existing file descriptor, fildes. The mode of the stream must be compatible with the mode of the file descriptor. The freopen function opens the file whose name is the string pointed to by path and associates the stream pointed to by stream with it. The original stream (if it exists) is closed. The mode argument is used just as in the fopen function. The primary use of the freopen func- tion is to change the file associated with a standard text stream (stderr, stdin, or stdout).

RETURN VALUES

Upon successful completion fopen, fdopen and freopen return a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error.

ERRORS

EINVAL The mode provided to fopen, fdopen, or freopen was invalid. The fopen, fdopen and freopen functions may also fail and set errno for any of the errors specified for the routine malloc(3). The fopen function may also fail and set errno for any of the errors specified for the routine open(2). The fdopen function may also fail and set errno for any of the errors specified for the routine fcntl(2). The freopen function may also fail and set errno for any of the errors specified for the routines open(2), fclose(3) and fflush(3).

SEE ALSO

open, fclose,


STANDARDS

The fopen and freopen functions conform to ANSI C3.159-1989 (``ANSI C''). The fdopen function conforms to IEEE Std1003.1-1988 (``POSIX'').

BSD MANPAGE 29 November 1993 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/signal.htm0000644000076400001440000000403007055335012015015 signal



SIGACTION(2) Linux Programmer's Manual SIGACTION(2)

NAME

signal - ANSI C signal handling.

SYNOPSIS

#include <signal.h> void (*signal(int signum, void (*handler)(int)))(int);

DESCRIPTION

The signal system call installs a new signal handler for signal signum. The signal handler is set to handler which may be a user specified function, or one of the following: SIG_IGN Ignore the signal. SIG_DFL Reset the signal to its default behavior.

RETURN VALUE

signal returns the previous value of the signal handler, or SIG_ERR on error.

NOTES

Signal handlers cannot be set for SIGKILL or SIGSTOP. Unlike BSD systems, signals under Linux are reset to their default behavior when raised. If you're confused by the prototype at the top of this manpage, it may help to see it separated out thus: typedef void (*sighandler_t)(int); sighandler_t signal(int signum, sighandler_t handler);

CONFORMING TO

ANSI C

SEE ALSO

kill, kill, killpg, pause, raise, tion, signal, sigsetops, sigvec,









Linux 1.0 24 September 1994 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/ceil.htm0000644000076400001440000000224607055335010014461 ceil



CEIL(3) Linux Programmer's Manual CEIL(3)

NAME

ceil - smallest integral value not less than x

SYNOPSIS

#include <math.h> double ceil (double x);

DESCRIPTION

The ceil() function rounds x upwards to the nearest inte- ger, returning that value as a double.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

abs, fabs, floor, , rint,









































                           June 6, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/strstr.htm0000644000076400001440000000271007055334777015125 strstr



STRSTR(3) Linux Programmer's Manual STRSTR(3)

NAME

strstr - locate a substring

SYNOPSIS

#include <string.h> char *strstr(const char *haystack, const char *needle);

DESCRIPTION

The strstr() function finds the first occurrence of the substring needle in the string haystack. The terminating `\0' characters are not compared.

RETURN VALUE

The strstr() function returns a pointer to the beginning of the substring, or NULL if the substring is not found.

SEE ALSO

index, memchr, rindex, strchr, strpbrk, strsep, strspn, strtok,






































GNU April 12, 1993 1


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/togetpgrp.htm0000644000076400001440000003321207055335076015571 tcgetpgrp



TERMIOS(2) Linux Programmer's Manual TERMIOS(2)

NAME

termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, tcgetpgrp, tcsetpgrp - get and set terminal attributes, line control, get and set baud rate, get and set terminal foreground process group ID

SYNOPSIS

#include <termios.h> #include <unistd.h> int tcgetattr ( int fd, struct termios *termios_p ); int tcsetattr ( int fd, int optional_actions, struct termios *termios_p ); int tcsendbreak ( int fd, int duration ); int tcdrain ( int fd ); int tcflush ( int fd, int queue_selector ); int tcflow ( int fd, int action ); speed_t cfgetospeed ( struct termios *termios_p ); int cfsetospeed ( struct termios *termios_p, speed_t speed ); speed_t cfgetispeed ( struct termios *termios_p ); int cfsetispeed ( struct termios *termios_p, speed_t speed ); pid_t tcgetpgrp ( int fd ); int tcsetpgrp ( int fd, pid_t pgrpid );

DESCRIPTION

The termios functions describe a general terminal inter- face that is provided to control asynchronous communica- tions ports. Many of the functions described here have a termios_p argument that is a pointer to a termios structure. This structure contains the following members: tcflag_t c_iflag; /* input modes */ tcflag_t c_oflag; /* output modes */ tcflag_t c_cflag; /* control modes */ tcflag_t c_lflag; /* local modes */ cc_t c_cc[NCCS]; /* control chars */

Linux February 25, 1995 1

TERMIOS(2) Linux Programmer's Manual TERMIOS(2)

c_iflag flag constants: IGNBRK ignore BREAK condition on input BRKINT If IGNBRK is not set, generate SIGINT on BREAK con- dition, else read BREAK as character \0. IGNPAR ignore framing errors and parity errors. PARMRK if IGNPAR is not set, prefix a character with a parity error or framing error with \377 \0. If neither IGNPAR nor PARMRK is set, read a character with a parity error or framing error as \0. INPCK enable input parity checking ISTRIP strip off eighth bit INLCR translate NL to CR on input IGNCR ignore carriage return on input ICRNL translate carriage return to newline on input (unless IGNCR is set) IUCLC map uppercase characters to lowercase on input IXON enable XON/XOFF flow control on output IXANY enable any character to restart output IXOFF enable XON/XOFF flow control on input IMAXBEL ring bell when input queue is full c_oflag flag constants: OPOST enable implementation-defined output processing OLCUC map lowercase characters to uppercase on output ONLCR map NL to CR-NL on output OCRNL map CR to NL on output ONOCR don't output CR at column 0 ONLRET don't output CR OFILL send fill characters for a delay, rather than using a timed delay OFDEL fill character is ASCII DEL. If unset, fill

Linux February 25, 1995 2

TERMIOS(2) Linux Programmer's Manual TERMIOS(2)

character is ASCII NUL NLDLY newline delay mask. Values are NL0 and NL1. CRDLY carriage return delay mask. Values are CR0, CR1, CR2, or CR3. TABDLY horizontal tab delay mask. Values are TAB0, TAB1, TAB2, TAB3, or XTABS. A value of XTABS expands tabs to spaces (with tab stops every eight columns). BSDLY backspace delay mask. Values are BS0 or BS1. VTDLY vertical tab delay mask. Values are VT0 or VT1. FFDLY form feed delay mask. Values are FF0 or FF1. c_cflag flag constants: CSIZE character size mask. Values are CS5, CS6, CS7, or CS8. CSTOPB set two stop bits, rather than one. CREAD enable receiver. PARENB enable parity generation on output and parity checking for input. PARODD parity for input and output is odd. HUPCL lower modem control lines after last process closes the device (hang up). CLOCAL ignore modem control lines CIBAUD mask for input speeds (not used). CRTSCTS flow control. c_lflag flag constants: ISIG when any of the characters INTR, QUIT, SUSP, or DSUSP are received, generate the corresponding sig- nal. ICANON enable canonical mode. This enables the special characters EOF, EOL, EOL2, ERASE, KILL, REPRINT, STATUS, and WERASE, and buffers by lines. XCASE if ICANON is also set, terminal is uppercase only. Input is converted to lowercase, except for

Linux February 25, 1995 3

TERMIOS(2) Linux Programmer's Manual TERMIOS(2)

characters preceded by \. On output, uppercase characters are preceded by \ and lowercase charac- ters are converted to uppercase. ECHO echo input characters. ECHOE if ICANON is also set, the ERASE character erases the preceding input character, and WERASE erases the preceding word. ECHOK if ICANON is also set, the KILL character erases the current line. ECHONL if ICANON is also set, echo the NL character even if ECHO is not set. ECHOCTL if ECHO is also set, ASCII control signals other than TAB, NL, START, and STOP are echoed as ^X, where X is the character with ASCII code 0x10 greater than the control signal. For example, character 0x28 (BS) is echoed as ^H. ECHOPRT if ICANON and IECHO are also set, characters are printed as they are being erased. ECHOKE if ICANON is also set, KILL is echoed by erasing each character on the line, as specified by ECHOE and ECHOPRT. FLUSHO output is being flushed. This flag is toggled by typing the DISCARD character. NOFLSH disable flushing the input and output queues when generating the SIGINT and SIGQUIT signals, and flushing the input queue when generating the SIG- SUSP signal. TOSTOP send the SIGTTOU signal to the process group of a background process which tries to write to its con- trolling terminal. PENDIN all characters in the input queue are reprinted when the next character is read. (bash handles typeahead this way.) IEXTEN enable implementation-defined input processing. tcgetattr() gets the parameters associated with the object referred by fd and stores them in the termios structure referenced by termios_p. This function may be invoked from a background process; however, the terminal attributes may be subsequently changed by a foreground

Linux February 25, 1995 4

TERMIOS(2) Linux Programmer's Manual TERMIOS(2)

process. tcsetattr() sets the parameters associated with the termi- nal (unless support is required from the underlying hard- ware that is not available) from the termios structure referred to by termios_p. optional_actions specifies when the changes take effect: TCSANOW the change occurs immediately. TCSADRAIN the change occurs after all output written to fd has been transmitted. This function should be used when changing parameters that affect output. TCSAFLUSH the change occurs after all output written to the object referred by fd has been transmitted, and all input that has been received but not read will be discarded before the change is made. tcsendbreak() transmits a continuous stream of zero-valued bits for a specific duration, if the terminal is using asynchronous serial data transmission. If duration is zero, it transmits zero-valued bits for at least 0.25 sec- onds, and not more that 0.5 seconds. If duration is not zero, it sends zero-valued bits for duration*N seconds, where N is at least 0.25, and not more than 0.5. If the terminal is not using asynchronous serial data transmission, tcsendbreak() returns without taking any action. tcdrain() waits until all output written to the object referred to by fd has been transmitted. tcflush() discards data written to the object referred to by fd but not transmitted, or data received but not read, depending on the value of queue_selector: TCIFLUSH flushes data received but not read. TCOFLUSH flushes data written but not transmitted. TCIOFLUSH flushes both data received but not read, and data written but not transmitted. tcflow() suspends transmission or reception of data on the object referred to by fd, depending on the value of action:

Linux February 25, 1995 5

TERMIOS(2) Linux Programmer's Manual TERMIOS(2)

TCOOFF suspends output. TCOON restarts suspended output. TCIOFF transmits a STOP character, which stops the termi- nal device from transmitting data to the system. TCION transmits a START character, which starts the ter- minal device transmitting data to the system. The default on open of a terminal file is that neither its input nor its output is suspended. The baud rate functions are provided for getting and set- ting the values of the input and output baud rates in the termios structure. The new values do not take effect until tcsetattr() is successfully called. Setting the speed to B0 instructs the modem to "hang up". The actual bit rate corresponding to B38400 may be altered with setserial(8). The input and output baud rates are stored in the termios structure. cfgetospeed() returns the output baud rate stored in the termios structure pointed to by termios_p. cfsetospeed() sets the output baud rate stored in the termios structure pointed to by termios_p to speed, which must be one of these constants: B0 B50 B75 B110 B134 B150 B200 B300 B600 B1200 B1800 B2400 B4800 B9600 B19200 B38400 B57600 B115200 B230400 The zero baud rate, B0, is used to terminate the connec- tion. If B0 is specified, the modem control lines shall no longer be asserted. Normally, this will disconnect the line. CBAUDEX is a mask for the speeds beyond those

Linux February 25, 1995 6

TERMIOS(2) Linux Programmer's Manual TERMIOS(2)

defined in POSIX.1 (57600 and above). Thus, B57600 & CBAUDEX is nonzero. cfgetispeed() returns the input baud rate stored in the termios structure. cfsetispeed() sets the input baud rate stored in the termios structure to speed. If the input baud rate is set to zero, the input baud rate will be equal to the output baud rate. tcgetpgrp() returns process group ID of foreground pro- cessing group, or -1 on error. tcsetpgrp() sets process group ID to pgrpid. pgrpid must be the ID of a process group in the same session.

RETURN VALUES

cfgetispeed() returns the input baud rate stored in the termios structure. cfgetospeed() returns the output baud rate stored in the termios structure. tcgetpgrp() returns process group ID of foreground pro- cessing group, or -1 on error. All other functions return: 0 on success. -1 on failure and set errno to indicate the error.

SEE ALSO























Linux February 25, 1995 7


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/link.htm0000644000076400001440000000711507055335066014515 link



LINK(2) Linux Programmer's Manual LINK(2)

NAME

link - make a new name for a file

SYNOPSIS

#include <unistd.h> int link(const char *oldpath, const char *newpath);

DESCRIPTION

link creates a new link (also known as a hard link) to an existing file. If newpath exists it will not be overwritten. This new name may be used exactly as the old one for any operation; both names refer to the same file (and so have the same permissions and ownership) and it is impossible to tell which name was the `original'.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EXDEV oldpath and newpath are not on the same filesys- tem. EPERM The filesystem containing oldpath and newpath does not support the creation of hard links. EFAULT oldpath or newpath points outside your accessible address space. EACCES Write access to the directory containing newpath is not allowed for the process's effective uid, or one of the directories in oldpath or newpath did not allow search (execute) permission. ENAMETOOLONG oldpath or newpath was too long. ENOENT A directory component in oldpath or newpath does not exist or is a dangling symbolic link. ENOTDIR A component used as a directory in oldpath or new- path is not, in fact, a directory. ENOMEM Insufficient kernel memory was available. EROFS The file is on a read-only filesystem. EEXIST newpath already exists. EMLINK The file referred to by oldpath already has the

Linux 17 August 1994 1

LINK(2) Linux Programmer's Manual LINK(2)

maximum number of links to it. ELOOP oldpath or newpath contains a reference to a cir- cular symbolic link, ie a symbolic link whose expansion contains a reference to itself. ENOSPC The device containing the file has no room for the new directory entry. EPERM oldpath is the . or .. entry of a directory.

NOTES

Hard links, as created by link, cannot span filesystems. Use symlink if this is required.

CONFORMING TO

SVID, AT&T, POSIX, BSD 4.3

BUGS

On NFS file systems, the return code may be wrong in case the NFS server performs the link creation and dies before it can say so. Use stat(2) to find out if the link got created.

SEE ALSO

symlink, unlink, rename, open, stat, ln,































Linux 17 August 1994 2


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/sysconf.htm0000644000076400001440000001560307055335072015242 sysconf



SYSCONF(3) Linux Programmer's Manual SYSCONF(3)

NAME

sysconf - Get configuration information at runtime

SYNOPSIS

#include <unistd.h> long sysconf(int name);

DESCRIPTION

sysconf() provides a way for the application to determine values for system limits or options at runtime. The equivalent macros defined in <unistd.h> can only give conservative values; if an application wants to take advantage of values which may change, a call to sysconf() can be made, which may yield more liberal results. For getting information about a particular file, see fpathconf() or pathconf(). The following values are supported for name. First, the POSIX.1 compatible values: _SC_ARG_MAX The maximum length of the arguments to the exec() family of functions; the corresponding macro is ARG_MAX. _SC_CHILD_MAX The number of simultaneous processes per user id, the corresponding macro is _POSIX_CHILD_MAX. _SC_CLK_TCK The number of clock ticks per second; the corre- sponding macro is CLK_TCK. _SC_STREAM_MAX The maximum number of streams that a process can have open at any time. The corresponding POSIX macro is STREAM_MAX, the corresponding standard C macro is FOPEN_MAX. _SC_TZNAME_MAX The maximum number of bytes in a timezone name, the corresponding macro is TZNAME_MAX. _SC_OPEN_MAX The maximum number of files that a process can have open at any time, the corresponding macro is _POSIX_OPEN_MAX. _SC_JOB_CONTROL This indicates whether POSIX - style job control is supported, the corresponding macro is

GNU April 18, 1993 1

SYSCONF(3) Linux Programmer's Manual SYSCONF(3)

_POSIX_JOB_CONTROL. _SC_SAVED_IDS This indicates whether a process has a saved set- user-ID and a saved set-group-ID; the corresponding macro is _POSIX_SAVED_IDS. _SC_VERSION indicates the year and month the POSIX.1 standard was approved in the format YYYYMML;the value 199009L indicates the most recent revision, 1990. Next, the POSIX.2 values: _SC_BC_BASE_MAX indicates the maximum obase value accepted by the bc(1) utility; the corresponding macro is BC_BASE_MAX. _SC_BC_DIM_MAX indicates the maximum value of elements permitted in an array by bc(1); the corresponding macro is BC_DIM_MAX. _SC_BC_SCALE_MAX indicates the maximum scale value allowed by bc(1); the corresponding macro is BC_SCALE_MAX. _SC_BC_STRING_MAX indicates the maximum length of a string accepted by bc(1); the corresponding macro is BC_STRING_MAX. _SC_COLL_WEIGHTS_MAX indicates the maximum numbers of weights that can be assigned to an entry of the LC_COLLATE order keyword in the locale definition file; the corre- sponding macro is COLL_WEIGHTS_MAX. _SC_EXPR_NEST_MAX is the maximum number of expressions which can be nested within parentheses by expr(1). The corre- sponding macro is EXPR_NEST_MAX. _SC_LINE_MAX The maximum length of a utility's input line length, either from standard input or from a file. This includes length for a trailing newline. The corresponding macro is LINE_MAX. _SC_RE_DUP_MAX The maximum number of repeated occurrences of a regular expression when the interval notation \{m,n\} is used. The value of the corresponding macro is RE_DUP_MAX.

GNU April 18, 1993 2

SYSCONF(3) Linux Programmer's Manual SYSCONF(3)

_SC_2_VERSION indicates the version of the POSIX.2 standard in the format of YYYYMML. The corresponding macro is POSIX2_VERSION. _SC_2_DEV indicates whether the POSIX.2 C language develop- ment facilities are supported. The corresponding macro is POSIX2_C_DEV. _SC_2_FORT_DEV indicates whether the POSIX.2 FORTRAN development utilities are supported. The corresponding macro is POSIX2_FORT_RUN. _SC_2_FORT_RUN indicates whether the POSIX.2 FORTRAN runtime util- ities are supported. The corresponding macro is POSIX2_FORT_RUN. POSIX2_LOCALEDEF indicates whether the POSIX.2 creation of locates via locale(1) is supported. The corresponding macro is POSIX2_LOCALEDEF. _SC_2_SW_DEV indicates whether the POSIX.2 software development utilities option is supported. The corresponding macro is POSIX2_SW_DEV.

RETURN VALUE

The value returned is the value of the system resource, 1 if a queried option is available, 0 if it is not, or -1 on error. The variable errno is not set.

CONFORMS TO

POSIX.1, proposed POSIX.2

BUGS

It is difficult use ARG_MAX because it is not specified how much of the argument space for exec() is consumed by the user's environment variables. Some returned values may be huge; they are not suitable for allocating memory. POSIX.2 is not yet an approved standard; the information in this manpage is subject to change.

SEE ALSO

bc, expr, locale, fpathconf, pathconf,







GNU April 18, 1993 3


Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/fmod.htm0000644000076400001440000000251307055335016014475 fmod



FMOD(3) Linux Programmer's Manual FMOD(3)

NAME

fmod - floating-point remainder function

SYNOPSIS

#include <math.h> double fmod(double x, double y);

DESCRIPTION

The modf() function computes the remainder of dividing x by y. The return value is x - n * y, where n is the quo- tient of x / y, rounded towards zero to an integer.

RETURN VALUE

The fmod() function returns the remainder, unless y is zero, when the function fails and errno is set.

ERRORS

EDOM The denominator y is zero.

CONFORMING TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

drem,

































                           June 6, 1993                         1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MAN/seekdir.htm0000644000076400001440000000271207055334762015206 seekdir



SEEKDIR(3) Linux Programmer's Manual SEEKDIR(3)

NAME

seekdir - set the position of the next readdir() call in the directory stream.

SYNOPSIS

#include <dirent.h> void seekdir(DIR *dir, off_t offset);

DESCRIPTION

The seekdir() function sets the location in the directory stream from which the next readdir() call will start. seekdir() should be used with an offset returned by telldir().

RETURN VALUE

The seekdir() function returns no value.

CONFORMING TO

BSD 4.3

SEE ALSO

lseek, opendir, readdir, closedir, dir, telldir, scandir,


































                          March 31, 1993                        1




Top Master Index Keywords Functions


This manual page was brought to you by mjl_man V-2.0 c_cpp_reference-2.0.2/reference/C/MISC/0000777000076400001440000000000007474405227013250 5c_cpp_reference-2.0.2/reference/C/MISC/linklists.html0000644000076400001440000000620707055334735016073 Link Lists

Link Lists


Question, how would you write a program to meet the following requirements?
  1. Read an unknown number of records from a file into memory. A typical record would look like:
    	Ref  Title	  Cost
    	---  -----	  ----
    	1234 Oracle_Guide 22.95
    
  2. Perform a numeric sort based on the first field.
  3. Delete duplicate records based on the first field.
One method is to define an
array of records as below:
	main()
 	{
	  char array[50][80]; /* 50 records, 80 bytes long	*/
	}
The data can then be read into the array and then actions performed on the data. This is OK but has some major problems.
  1. The arrary will hold all the data in character format. It would be nice to hold the integer and decimal numbers in a more appropriate form.
  2. If you have more than 50 records the program has to be altered and recompiled.
The first problem could be fixed by defining an array of structures BUT both problems can be solved with linked lists.

The concept of a linked list is fairly simple. It is a group of structures linked together by pointers, here is a picture:


The "Name Age Pointer" block could be defined as below:

	struct record {char name[20]; int age; struct record *next_rec;}; 
The important bit is "struct record *next_rec" this is the pointer to the next structure (record). It will either point to the next record which will require memory reserved with the malloc function or NULL if its the last record.

Examples

Here is the first example. This program is more complicated than I would like, but its the simplest I can come up with.

This is the same program but without the heavy commenting.

This is still the same program but it is slightly simplified with the use of typedef.


Top Master Index C Keywords Functions


Martin Leslie
c_cpp_reference-2.0.2/reference/C/MISC/Master.html0000644000076400001440000000123707055334737015312 Imbedding Perl

Imbedding Perl in C code.



Top Master Index C Keywords Functions


Martin Leslie
c_cpp_reference-2.0.2/reference/C/MISC/perl.html0000644000076400001440000000152207055334737015016 Embedding Perl

Embedding Perl in C code.


This program shows how to imbed Perl code into a C program. The program was inspired by reading this man page.


Top Master Index C Keywords Functions


Martin Leslie
c_cpp_reference-2.0.2/reference/C/MISC/numconv.html0000644000076400001440000000152107055334737015540 Number converter.

Number conversion


A Java compatible browser is required to view this page.


See Also:

strtol convert a string to a long, in a given number base.


Top Master Index C Keywords Functions

c_cpp_reference-2.0.2/reference/C/MISC/Makefile.am0000644000076400001440000000024107055334737015217 EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) SUBDIRS = CLASSES docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/MISC/Makefile.in0000644000076400001440000003410207474405126015227 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) SUBDIRS = CLASSES docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/MISC mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = Makefile.am Makefile.in DIST_SUBDIRS = $(SUBDIRS) #>- all: all-recursive #>+ 1 all: docs-am all-recursive .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/MISC/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/MISC/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/MISC/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) GTAGS: here=`CDPATH=: && cd $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=numconv.html download.html linklists.html stdfiles.html io.html Master.html perl.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done for subdir in $(SUBDIRS); do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-recursive #>+ 1 clean: kde-rpo-clean clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-generic clean-libtool clean-recursive distclean \ distclean-generic distclean-libtool distclean-recursive \ distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ info-recursive install install-am install-data install-data-am \ install-data-recursive install-docsDATA install-exec \ install-exec-am install-exec-recursive install-info \ install-info-am install-info-recursive install-man \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-libtool mostlyclean-recursive tags tags-recursive \ uninstall uninstall-am uninstall-docsDATA uninstall-info-am \ uninstall-info-recursive uninstall-recursive # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/MISC/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/MISC/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/MISC/download.html0000644000076400001440000000671107055334736015667 Download


Download and install the HTML source.


Install Instructions

  • Request the source by clicking on the links below. The DOS files have been split so you can get them onto floppy disks.

    • cunix.tgz - tar gzip file contains the complete source for use on Unix machines.
    • cdos1.zip - Contains most of the source for use on DOS and Windows 3.1 machines.
    • cdos2.zip - The remainder of the source for DOS and Windows 3.1 machines.

    Unix Version.
    cunix.tgz 1.00 Kbytes

    DOS/Windows 3.1.
    cdos1.zip 0.86 Kbytes
    cdos2.zip 0.62 Kbytes

  • Create a suitable directory, like 'cref' and copy the zip or tgz files into it.
  • Unpack with the following commands.
    Unix
    
         gunzip cunix.tgz
         tar xvf cunix.tar
    
    
    DOS
    
         pkunzip cdos1.zip
         pkunzip cdos2.zip
    
  • Recompile the Java code in
    	C/MISC/CLASSES
    
    The existing binaries are compiled for Linux. BTW the Java compiler is called javac.

If you have install problems or find mistakes please let me know.

Windows 3.1 users, you should now be able to install this source with pkunzip. I have provided the source with 8.3 format names but left the links in the original (unix) form. Testing this with Netscape 3.01 for Windows 3.1 and Internet Explorer, it would seem that the browsers will chop the link name down to 8.3 format and then attempt to load the resulting file.

distribution files made with the following commands.

tar cvf ../cunix.tar * --gzip
mv ../cunix.tar ../cunix.tgz

zip -k -r ../cdos1.zip * -x C/CONTRIB/\* zip -k -r ../cdos2.zip C/CONTRIB/*

Top Master Index C Keywords Functions


Martin Leslie
c_cpp_reference-2.0.2/reference/C/MISC/stdfiles.html0000644000076400001440000000345307055334736015675 STDIN, STDOUT, STDERR

STDIN, STDOUT, STDERR


These three file pointers are automatically defined when a program executes and provide access to the keyboard and screen.

stdin

By default stdin accesses the keyboard. Functions that read stdin include... The following functions can access stdin
  • fgets
  • fgetc
  • fscanf
stdin example program.

stdout

stdout sends data to the screen. Functions that write to stdout include....

stderr

stderr also writes to the screen. If you are using a Unix based system the data sent to stdout and stderr can be seperated and sent to different places. Functions that could write to stderr include...
  • fprintf
  • fputs

Top Master Index C Keywords Functions


If you wish to create file pointers to perform I/O to other devices you should use fopen
Martin Leslie

c_cpp_reference-2.0.2/reference/C/MISC/io.html0000644000076400001440000000505607055334734014466 Input and Output


Input and Output


The C language does not have any I/O capability! You can access files and devices via two groups of functions, these can be split as shown below.

Low Level I/O

Low level functions provide direct access to files and devices. If you only need file read and write you should use the
ANSI functions as your code will remain portable. If you want to access things like, serial ports, virtual memory and tape drives, low level I/O is for you.

Low level functions reference files by a file descriptor, this descriptor is created with the open function and can be referenced by functions like:

close
read
write
mmap - Memory map (Not supported on Linux).
ioctl I/O control.

Three 'file descripters' are opened automatically when your program runs. These are:

	File		Default
	Desc	Name	device
	----    ----	------
	0	stdin	Keyboard
	1	stdout	Screen
	2	stderr	Screen
If you want to use these 'file descriptors', you do not have to issue an 'open'.

ANSI standard functions

These functions are defined in the
stdio.h header. The important thing to remember with these functions is the data is presented in a consistant manor across all platforms. A record is considered to be 0 or more characters followed by a newline character. If the actual (physical) record is terminated in some other way, the functions will perform the conversion for you.

Top Master Index C Keywords Functions


Martin Leslie
c_cpp_reference-2.0.2/reference/C/MISC/CLASSES/0000777000076400001440000000000007474405227014345 5c_cpp_reference-2.0.2/reference/C/MISC/CLASSES/Numbers.class0000644000076400001440000001116007055334741016717 -T:9<;65870/42ONQPJIMLEDHGBACS     ,+.-('*)$#&% "!>=@?F f l e l h i d i j c k m c p m h e k i o f i q n g q o m q k % R % % R 3  K 1 whiteLineNumberTablejava/lang/Longjava/awt/TextComponentboundsAsciiStr(Ljava/awt/Font;)V4(Ljava/awt/Component;Ljava/awt/GridBagConstraints;)Vjava/lang/StringBufferjava/awt/GridBagLayout(J)Ljava/lang/String;java/awt/Container Exceptions(II)Ljava/lang/String;(JI)Ljava/lang/String;widthsetFontPaddjava/awt/Graphics ConstantValue setEditable Dec Hex Oct Binary ASCII addgrayjava/lang/StringdrawRectpaint SourceFile(Ljava/lang/String;II)Vjava/awt/Componentinit*(Ljava/awt/Component;)Ljava/awt/Component; substring appendTextLocalVariables(Ljava/lang/String;)Vappend setBackground(Ljava/awt/LayoutManager;)Vjava/awt/GridBagConstraintsLjava/awt/Color; setLayoutCourier 00000000000000java/awt/TextAreaheightNumbersjava/applet/ApplettoString setForeground'(Ljava/lang/String;I)Ljava/lang/String;Code(IIII)V(Ljava/awt/Graphics;)V Numbers.java,(Ljava/lang/String;)Ljava/lang/StringBuffer;()Ljava/lang/String;(Z)Vjava/awt/Rectangle()V~}| gridwidth{zyxwvu()Ljava/awt/Rectangle;ts()Irqponmlkjijava/awt/Colorhgfedcba`_^]\[ZYXWVUTSRQPblackONMLKJIHGFEDCBA@?>valueOf=length<;:9876543210/.-+* java/awt/Font)('&setConstraints%$#"! (Ljava/awt/Color;)V ed *w*y*pYoYLhYvM*+~fYa rN::::: 7  :*t: :*t: :*t: :* t:* :*t:-mY} a7  q-y-w-,d+-,*-{W   &.3AEIMQU ["b#k$t%}&'()*+- 01267 ;P,*M+,ud,sdz+,u d,s dzEIJ+AD$NmY-+|d+}:OQ!RkYSYSYSYSYSYSYSYSYSY SY SY SY SY SYSYSYSYSYSYSYSYSYSYSYSYSYSYSYSYSYSYSY SY!SY" SY#SY$SY%SY&SY'SY(SY)SY*SY+SY,SY-SY.SY/SY0`SY1bSY2^SY3_SY4SY5SY6SY7SY8SY9SY:SY;SY< SY= SY> SY? SY@PSYAQSYBNSYCOSYDTSYEUSYFRSYGSSYHXSYIYSYJVSYKWSYL\SYM]SYNZSYO[SYP@SYQASYR>SYS?SYTDSYUESYVBSYWCSYXHSYYISYZFSY[GSY\LSY]MSY^JSY_KSY`0SYa1SYb.SYc/SYd4SYe5SYf2SYg3SYh8SYi9SYj6SYk7SYlX@WDXFWJXLWPXRWVXXW\X^WbXdWhXjWnXpWtXvWzY|WYWYWYWYWYWYWYWYWYWZWZWZWZWZWZWZWZWZWZW[W[W[W[W [ W[W[W[W"[$W([*W.\0W4\6W:\<W@\BWF\HWL\NWR\TWX\ZW^\`Wd\fWj]lWp]rWv]xW|]~W]W]W]W]W]W]W^W^W^W^W^W^W^W^W^W^W_W_W_W_W_W_W_W _W_W_W` W$`&W*`,W0`2W6`8W<`>WB`DWH`JWN`PWT`VWZa\W`abWfahWlanWratWxazW~aWaWaWaWbWbWbWbWbWbWbWbWbWbWcWcWcWcWcWcWcWegi l*xc_cpp_reference-2.0.2/reference/C/MISC/CLASSES/Makefile.am0000644000076400001440000000017707055334742016320 EXTRA_DIST = $(wildcard *.class) $(wildcard *.java) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/MISC/CLASSES/Makefile.in0000644000076400001440000002374007474405126016332 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.class) $(wildcard *.java) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/MISC/CLASSES mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/MISC/CLASSES/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/MISC/CLASSES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/MISC/CLASSES/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=Numbers.java Numbers.class DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/MISC/CLASSES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/MISC/CLASSES/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/MISC/CLASSES/Numbers.java0000644000076400001440000000554107055334742016542 import java.applet.*; import java.awt.*; import java.lang.*; public class Numbers extends Applet { public void init() { // Default settings for the frame. setBackground(Color.gray); setForeground(Color.white); setFont(new Font("Courier", Font.PLAIN, 20)); // The way we are going to place items on the Frame. GridBagLayout gb = new GridBagLayout(); GridBagConstraints cgb = new GridBagConstraints(); setLayout(gb); // Create an Item. TextArea Text = new TextArea(" Dec Hex Oct Binary ASCII\n" ,10 ,30); String Padding = " "; String DecStr = " "; String HexStr = " "; String OctStr = " "; String BinStr = " "; String AsciiStr = " "; for (long Count=0; Count <= 255; Count++) { DecStr = DecStr.valueOf(Count); DecStr = Padd(DecStr, 4); HexStr = Long.toString(Count, 16); HexStr = Padd(HexStr, 4); OctStr = Long.toString(Count, 8); OctStr = Padd(OctStr, 4); BinStr = Long.toString(Count, 2); BinStr = Padd(BinStr, 9); AsciiStr = AsciiStr(Count); AsciiStr = Padd(AsciiStr, 2); Text.appendText( DecStr + HexStr + OctStr + BinStr + AsciiStr + "\n"); } Text.setForeground(Color.black); Text.setBackground(Color.white); Text.setEditable(false); // Set the constraints. cgb.gridwidth = 100; gb.setConstraints(Text, cgb); // And place it on the Frame. add(Text); } // Override paint method so it draws a rectange around the Frame public void paint(Graphics g) { // Get the panels dimentions. Rectangle r = bounds(); // top left, length across, length down. g.drawRect(0, 0, r.width-1, r.height-1); g.drawRect(5, 5, r.width-11, r.height-11); } public String Padd(String Str, int Size) { String Padding = " 00000000000000"; String PaddedStr = Padding.substring(0, Size-Str.length()) + Str; return PaddedStr; } public String AsciiStr(long Num) { String[] Ascii = {" "," "," "," "," "," "," "," "," "," ", " "," "," "," "," "," "," "," "," "," ", " "," "," "," "," "," "," "," "," "," ", " "," "," ","!","\"","#","$","%","&","'", "(",")","*","+","'","-",".","/","0","1", "2","3","4","5","6","7","8","9",":",";", "<","=",">","?","@","A","B","C","D","E", "F","G","H","I","J","K","L","M","N","O", "P","Q","R","S","T","U","V","W","X","Y", "Z","[","\\","]","^","_","`","a","b","c", "d","e","f","g","h","i","j","k","l","m", "n","o","p","q","r","s","t","u","v","w", "x","y","z","{","|","}","~" }; String Ret = " "; if (Num < 127) { Ret = Ascii[(int) Num]; } return Ret; } } c_cpp_reference-2.0.2/reference/C/master.gif0000644000076400001440000000225207055333535014411 GIF89aL*!,L*ڋ Vؕd z1G:BX_ DWjD6Tгa]K4 !qci|Q5  -\_g`'H&rX২7'7q&YSH`%*vjyש:xi Qvz8+{& zǪ'ul ](;=;ȂpSmqZ <`r!uLPޜ/,;Q^7{Q̗a8t`_au ; qw= #Yxacb饔`8S2XOF( 7)PW&tqHOM,J."*Q2+S:ReSίYAGhԫvu=if&Jz=sZYkUf̹0O-*5VظT]oWmGܥҭj7pgB[;un)׻=Rϧ}kisMlf[@Yv w^dα3!h9]}q{>tޅ5l/HЍ)GZx`w&θБؓj[)ya%Yl6"۔If!tH^uxb]ʕ!B!#I&ُѢ\vNyVAVК,A`N L :Rι_Jy\opb4[ClX:oPhin"}#:ѫKIBמb "Dj h. ꉪrS>k>#Q"~*\bgb,[n2Bj-j^<-+bT龜Ks.z7ƻ/m^-&lCH!fg&WLB}|{їm w<3F6].{VcXvRI +y g*~pj/v\^f'V N9 yfHcV}26#9[B[S3gcLGZ{gA]C+$Co9%rl:xu fj6P;c_cpp_reference-2.0.2/reference/C/blueball.gif0000644000076400001440000000050607055333535014700 GIF87a14(!޿eclcGBο{{Ɓ{ KJ41sskcZZJJ,k@pH,DKD"XH\ @N9%`tBBh%yBw&("B!#%)(E$$'(E"''"CD A;c_cpp_reference-2.0.2/reference/C/X_EXAMPLES/0000777000076400001440000000000007474405230014214 5c_cpp_reference-2.0.2/reference/C/X_EXAMPLES/hardware.c0000644000076400001440000000341707055335106016075 /************************************************************************ * * Purpose: Program extracts information from the X server and displays * it on the screen. * * Notes: Use the following command to compile. * * gcc hardware.c -lX11 * * Author: M.J. Leslie * * Date: 26-Mar-95 * ************************************************************************/ /****************** Includes ********************************************/ /* These are in /usr/X386 */ #include #include #include #include main() { Display * display; int screen; char * display_name=NULL; Window root; Visual* visual; /* Connect to X display server. */ display=XOpenDisplay(display_name); /* Get screen ID */ screen=DefaultScreen(display); printf("\n\tInformation extracted from the X server\n"); printf("\t---------------------------------------\n\n"); printf(" X server by \'%s\'\n", ServerVendor(display)); printf(" X Server protocol %d\n", ProtocolVersion(display)); printf(" X server Release %d\n", VendorRelease(display)); printf(" Screen is %dmm high.\n", DisplayHeightMM(display, screen)); printf(" Screen is %dmm wide.\n", DisplayWidthMM(display, screen)); printf(" Screen is %d pixels high.\n", DisplayHeight(display, screen)); printf(" Screen is %d pixels wide.\n", DisplayWidth(display, screen)); visual = DefaultVisual(display,screen); printf(" %3d Colour map entries", visual->map_entries); printf(" (Number of colours on the screen at one time).\n"); printf(" %3d Display planes (bits per screen pixel).\n", DisplayPlanes(display, screen)); printf(" There is %d screen(s).\n", ScreenCount (display)); }c_cpp_reference-2.0.2/reference/C/X_EXAMPLES/root_colour.c0000644000076400001440000001476107055335110016645 /************************************************************************ * * Purpose: Program to randomly change the root window colour on X Displays. * * Description. * The program randomly selects a target colour and then * performs a basic interpolation to move from the current * colour to the target colour. When the target has been * reached, a new target is selected and the process is * repeated. * * Notes: 1) No attempt is made to see if the client supports colour. * 2) Other applications may cause problems if they have allocated * all the available colour cells in the colour map. * 3) Use the following command to compile. * * gcc root_col.c -lX11 * 4) Tested on Linux running XFree386 and FVWM * and SunOS 4.1.3 running X11R5 and Motif. * * Author: M.J. Leslie * * Date: 26-Mar-95 * ************************************************************************/ /****************** Includes ********************************************/ #include #include #include #include #include /************************************************************************/ #define INC 512 /* Increments between colours. */ #define MAX_COL 65536 /* Max number of colours. */ #define SECONDS 2 /* # of seconds between updates */ /****************** Functions *******************************************/ void help(char * proganme); /* Give some help on syntax. */ /* Used to see if a colour gun has * reached its required intensity */ int reached_target( unsigned short colour, unsigned short target_colour); void root_colour(int seconds); /* Where the real work starts. */ /* Change the colour of the * root window */ void change_colour(Display * display, Window root, Colormap colormap, XColor colour); /************************************************************************/ main(int argc, char * argv[]) { int seconds=SECONDS; /* Have we got cmd line parms? */ if (argc > 1 ) { /* Yes. Is Help Required? */ if ( !strcmp(argv[1], "-h")) { help(argv[0]); /* Yes. */ exit(0); } /* Do we have an integer. */ if (!sscanf(argv[1], "%u", &seconds)) { help(argv[0]); /* No. */ exit(0); } } root_colour(seconds); /* Start colouring the * root window. * 'seconds' is the # of seconds * between updates. */ } /************************************************************************/ void root_colour(int seconds) { Display * display; int screen; char * display_name=NULL; Window root; Colormap colormap; XColor colour, target_colour; /**************************************** * * Initalise the X environment. * ****************************************/ /* Connect to X display server. */ display=XOpenDisplay(display_name); /* Get screen ID */ screen=DefaultScreen(display); root=RootWindow(display, screen); /* Load the default colour map */ colormap = DefaultColormap(display, screen); /* Starting colour - Grey */ colour.red=MAX_COL/2; colour.green=MAX_COL/2; colour.blue=MAX_COL/2; colour.flags = DoRed|DoGreen|DoBlue; /**************************************** * * Loop forever. * ****************************************/ while(1) { /* Increments used to go from the current * colour to the target colour. */ int red_inc, green_inc, blue_inc; /* Flags used to show when the target * colour has been reached. * * 0 = Arrived at the target colour. * 1 = Not arrived at the target colour. * */ int red=1, green=1, blue=1; /* Random selection of a new target * colour */ target_colour.red=rand()%MAX_COL; target_colour.green=rand()%MAX_COL; target_colour.blue=rand()%MAX_COL; /* Calculate the direction to go in * to reach the new target colour. */ red_inc = ( target_colour.red > colour.red ) ? INC : INC * -1; green_inc = ( target_colour.green > colour.green) ? INC : INC * -1; blue_inc = ( target_colour.blue > colour.blue ) ? INC : INC * -1; /* Loop until all three colours have * reached their required value. */ while(red || green || blue) { /* Change the colour of the root window */ change_colour(display, root, colormap, colour); /* Increment onto the next colour. */ if ( red=reached_target(colour.red, target_colour.red)) colour.red += red_inc; if (green=reached_target(colour.green, target_colour.green)) colour.green += green_inc; if ( blue=reached_target(colour.blue, target_colour.blue)) colour.blue += blue_inc; sleep(seconds); /* Pause...... */ } } XCloseDisplay(display); } /************************************************************************/ int reached_target( unsigned short colour, unsigned short target_colour) { return (( colour >= target_colour-INC && colour <= target_colour+INC) ?0:1); } /************************************************************************/ void change_colour(Display * display, Window root, Colormap colormap, XColor colour) { /* Reserve a cell in the colour map */ XAllocColorCells(display, colormap, False, NULL, 0, &colour.pixel, 1); /* Place the required colour in the map.*/ XStoreColor(display, colormap, &colour); /* Free the cell so it can be reused. */ XFreeColors(display, colormap, &colour.pixel, 1, 0); /* Set the root window colour. */ XSetWindowBackground(display, root, colour.pixel); /* Refresh the root window (with the new * colour). */ XClearWindow(display, root); } /************************************************************************/ void help(char * progname) { printf("\n%s information\n\n", progname); puts(" This program randomly changes the color of the screen background."); puts("\n Syntax:\n"); printf("\t%s \tRun the program with with a default update time\n", progname); printf("\t\t \tof %d seconds.\n", SECONDS); printf("\t%s 3\tRun the program specifing the delay between updates.\n", progname); printf("\t%s -h\tHelp. you are reading it.\n\n", progname); } c_cpp_reference-2.0.2/reference/C/X_EXAMPLES/Xref.html0000644000076400001440000000246007055335110015716 X Examples

X Examples


The following programs will only run under the 'X Windows' environment, they have been tested on Linux running X11R6 and SunOS running X11R5. If you are a DOS/Windows user these programs will not compile until you junk 'Windows' and install Linux.

A few statistics about your X environment
randomly change the colour of the root window.
A tool for issuing an rlogin to anothe machine. It basicaly saves a bit of typing.

Top Master Index C Keywords Functions


Martin Leslie
c_cpp_reference-2.0.2/reference/C/X_EXAMPLES/xxterm.c0000644000076400001440000004432007055335115015625 /*********************************************************************** * Purpose: To provide a tool that allows people to login to machines. * * Compile: Edit BUTTONS - Number of machines. * Edit XTERM - Location of the xterm command. * Edit 'machines' - Names of the machines. * * Compile command for Linux and Sun * * gcc xxterm.c -o xxterm -lX11 * User notes: * This is only of use to people running UNIX boxes on a LAN. * * History: * * Rev Date Author Comments. * --- ---- ------ --------- * 1.0 30-May-95 MJL Inital Release. */ /****************** Includes ********************************************/ /* These are in /usr/X386 */ #include #include #include #include #include /* setuid */ /****************** Defines *********************************************/ #define BUTTONS 7 /* <<<<<--- number of machines. */ /* VVVVV--- Location of the xterm comnd */ #define XTERM "/usr/X11R5/bin/xterm -sb -e rlogin" /* window background colour */ #define BACKGROUND_COLOUR "light grey" #define BUTTON_COLOUR "blue" #define DOWN "down" #define ACTIVE "active" /****************** Global Variables ************************************/ Display *display; int screen; Colormap colormap; /* <<<<<---- Machines you want to access */ char * machines[] = { "marin", "xarque", "dragon", "saturn", "sentinel", "silver", "sirius" }; /****************** Structures ******************************************/ /* Hold the co-ordinates of the buttons */ struct { XPoint topleft; XPoint topright; XPoint botleft; XPoint botright; } buttons[BUTTONS+1]; struct window_info { Window win; GC gc; }; /****************** Functions *******************************************/ void init_buttons(char *button_caps[]); void draw_image (Window, GC *, char *button_caps[]); int draw_button (Window, GC *gc, char *text, /* Text to put on screen button cap */ int x, int y, /* Position of button in window */ int width, int height, int, char button_caps[]); /* Change the colour in the graphics * context. */ void set_colour (GC *gc, char *, Colormap); int where_am_i (Window, GC *gc); /* Take an action based on the * button ID. */ int process_button (Window win, GC *gc, char *button_caps[], int button); /* Button ID. */ void press_button (Window, GC *gc, char *button_caps[], char *text ); struct window_info create_window (int x, /* Window size */ int y); /* Execute system commands */ void execute_command (int root, /* 1 == must be run by root * 0 == Can be run by anyone */ char *command, /* Command */ char *machine); /************************************************************************/ main() { unsigned int width, height; /* Size of the window. */ int x=0, y=0; /* x is across, y is down! */ unsigned int border_width=4; /* Window border. */ /* Array of pointers, one for each screen * button, they point to a string constant * describing their status, active, down, * inactive */ char *button_caps[BUTTONS+1]; struct window_info window; Window win; GC gc; XEvent report; XFontStruct *font_info; XColor colour; char * display_name=NULL; /********************************************************************* * * Setup the window environment * *********************************************************************/ /* Connect to X display server. */ display=XOpenDisplay(display_name); /* Get screen ID */ screen=DefaultScreen(display); /* Load the default colour map */ colormap = DefaultColormap(display, screen); /* Create the new window with the same attributes as the parent. */ /* Put the info window on the screen */ width = 90; height = (BUTTONS+1)* 30 +15+5; window=create_window(width, height); win = window.win; gc = window.gc; /************************************************************************ * * Window environment has been setup. * * We must now define the attributes required by the graphics that * will be placed inside the window. * ************************************************************************/ { int exit_prog=1; /* Initalize the screen buttons */ init_buttons(button_caps); /* Will stop looping when the 'exit' button * is pressed. */ while (exit_prog) { /* Wait for an event.... These are documented in Xlib Programming Manual Volume 1 P.223 */ XNextEvent(display, &report); switch (report.type) { /* drawing can only be done on an 'Expose' event */ case Expose: /* Event No. ? */ { /* Redraw the whole screen. */ draw_image(win, &gc, button_caps); break; } case ButtonPress: /* Event No. 4 */ { int button; /* Act on a mouse button press. If the 'exit' * screen button has been pressed, 'exit_prog' * will be set to 0. */ button=where_am_i(win, &gc); process_button(win, &gc, button_caps, button); /* Test for exit. */ if ( button == BUTTONS) exit_prog=0; break; } case KeyPress: /* Event No. 2 */ { break; /* Not realy interested.... */ } case 22: /* Event No. 22 */ { break; /* Window moved, i think... */ } default: { printf ("Unexpected Event occoured in xxterm window. Event No. is %i\n", report.type); break; } } } } } /************************************************************************ * * root == 1 Command can only be executed by root * root >= 0 Command can be executed by anyone. * ************************************************************************/ void execute_command(int root, char *command, char *machine) { char full_cmd[100]; /* Q. Does this command 'root' authority*/ if (root) { if (getuid()) { printf("You are not authorised to execute this command\n"); return; } } strcpy( full_cmd, command); strcat( full_cmd, " "); strcat( full_cmd, machine); strcat( full_cmd, " &"); system(full_cmd); } /************************************************************************ * * * * * ************************************************************************/ int process_button (Window win, GC *gc, char *button_caps[], int button) { /* locate the button the pointer is in */ if (button >= 0 && button < BUTTONS) { button_caps[button] = DOWN; press_button(win, gc, button_caps, " " ); execute_command(0, XTERM, machines[button]); sleep(1); button_caps[button] = ACTIVE; press_button(win, gc, button_caps, " " ); } /* Check for exit */ if ( button == BUTTONS) { button_caps[button] = DOWN; press_button(win, gc, button_caps, " " ); sleep(1); button_caps[button] = ACTIVE; press_button(win, gc, button_caps, " " ); } return (1); } /****************** Build an image onto the window **********************/ void draw_image (Window win, GC *gc, char *button_caps[]) { int i, x; /* Build the screen buttons */ /* Button states are: * active (up) * down * inactive */ for (i=0, x=15; i< BUTTONS; i++, x+=30) { /* Draw_box parms are: * Graphic Context * | Text on the button * | | x indent from left side * | | | y indent from top * | | | | width * | | | | | height * V V V V V V */ draw_button(win, gc, machines[i], 15, x, 60, 20, i, button_caps[i]) ; } draw_button(win, gc, "Exit" , 15, x, 60, 20, i, button_caps[i]) ; } /****************** Draw button with text in it ************************* * * Draw a button with texted on its cap. * * win Window ID * gc Graphics context. * text text to put in the box. * x,y top left hand corner of the box. x is across the screen * width * height * box identifing number. * button_state state of screen button, active, inactive or down * ************************************************************************/ draw_button(Window win, GC *gc, char *text, int x, int y, int width, int height, int box, char button_cap[]) { /* variables to hold the colour names. ****************************************/ char top_left_col[80]; /* button shading */ char bottom_right_col[80]; /* more button shading. */ char text_col[80]; /* Text on button. */ int yfudge=height-5; /* Text location */ int xfudge=x+6; struct { XPoint p; } points[6]; int thickness=2; /* Thickness of the button edge. */ /* Co-ordinates for the inner box. */ int xinner=x+thickness; int yinner=y+thickness; int hinner=height-(thickness*2); int winner=width-(thickness*2); /* Set colours for an "active" button */ if (!strcmp(button_cap, ACTIVE)) { strcpy(top_left_col, "white"); strcpy(bottom_right_col, "slategrey"); } /* Set colours for a "down" button * the button has been pressed. */ if (!strcmp(button_cap, DOWN)) { strcpy(top_left_col, "slategrey"); strcpy(bottom_right_col, "white"); } /* set the border colour. */ set_colour(gc, top_left_col, colormap); /* Top Left border */ points[0].p.x=x; points[0].p.y=y; points[1].p.x=x+width; points[1].p.y=y; points[2].p.x=xinner+winner; points[2].p.y=yinner; points[3].p.x=xinner; points[3].p.y=yinner; points[4].p.x=xinner; points[4].p.y=yinner+hinner; points[5].p.x=x; points[5].p.y=y+height; XFillPolygon( display, win, *gc, points, 6, Nonconvex, CoordModeOrigin); /* set the border colour. */ set_colour(gc, bottom_right_col, colormap); /* Bottom right */ points[0].p.x=x; points[0].p.y=y+height; points[1].p.x=xinner; points[1].p.y=yinner+hinner; points[2].p.x=xinner+winner; points[2].p.y=yinner+hinner; points[3].p.x=xinner+winner; points[3].p.y=yinner; points[4].p.x=x+width; points[4].p.y=y; points[5].p.x=x+width; points[5].p.y=y+height; XFillPolygon( display, win, *gc, points, 6, Nonconvex, CoordModeOrigin); /* set the text colour. */ set_colour(gc, BUTTON_COLOUR, colormap); /* draw the text that will be on the screen * button cap. */ XDrawString (display, win, *gc, xfudge, y+yfudge, /* Bottom left of text */ text, strlen(text)); /* Store the button location */ buttons[box].topleft.x=x; buttons[box].topleft.y=y; buttons[box].topright.x=x+width; buttons[box].topright.y=y; buttons[box].botright.x=x+width; buttons[box].botright.y=y+height; buttons[box].botleft.x=x; buttons[box].botleft.y=y+height; } /************************************************************************ * * Returns * -1 == Not on a screen button or the screen button is not active * ge 0 == Button number. * ************************************************************************/ int where_am_i(Window win, GC *gc) { Window root, child; int root_x, root_y; /* Cursor location on the screen. */ int win_x, win_y; /* Cursor location in the window. */ int mask; int inc; int button; /* Get pointer location on the screen * and within the window from the top left * corner. * x left to right. * y top to bottom. */ XQueryPointer( display, win, &root, &child, &root_x, &root_y, &win_x, &win_y, &mask); /* win_x and win_y give the usefull position * within the window. */ /* Scan through each of the button positions * and see if the pointer is in one of them */ button=-1; for (inc = 0 ; inc <= BUTTONS && button == -1; inc++) { if ( win_x > buttons[inc].topleft.x && win_x < buttons[inc].topright.x && win_y > buttons[inc].topleft.y && win_y < buttons[inc].botleft.y) { button = inc; /* Store the button ID. */ } } return(button); } /************************************************************************ * * press - status of button then we start the routine. * release - Status of button when we exit the routine (active/inactive) * ************************************************************************/ void press_button(Window win, GC *gc, char *button_caps[], char *text ) { draw_image(win, gc, button_caps); /* redraw all the buttons */ } /************************************************************************ * * Change the colour of any graphics that are drawn after this * function has been called. * * colour - Name of the colour to change to. * * For a list of valid colour names: * Use the Unix command 'showrgb' * or look in /usr/lib/X11/rgb * or on Suns you can try the unix command 'xco'. * ************************************************************************/ void set_colour (GC *gc, char * colour, Colormap colormap) { XColor xcolour; /* Convert the Colour name into RGB values. */ XParseColor(display, colormap, colour, &xcolour); /* Convert the RGB values into a pixel value. */ XAllocColor(display, colormap, &xcolour); /* Use the pixel value to set the foreground * colour. */ XSetForeground(display, *gc, xcolour.pixel); } /************************************************************************ * * Initalise the screen buttons. * ************************************************************************/ void init_buttons(char *button_caps[]) { int i; for (i=0; i <= BUTTONS; i++) button_caps[i] = ACTIVE; } /************************************************************************ * * Put a window on the screen. * * x & y are the size of the window. * ************************************************************************/ struct window_info create_window(int x, int y) { struct window_info window; XColor colour; /* Build background colour * XParseColor gets rgb values for the named * colour, then XAllocColor gets the pixel * value from the rgb values. */ XParseColor(display, colormap, BACKGROUND_COLOUR, &colour); XAllocColor(display, colormap, &colour); /* Create the new window with the same attributes as the parent. */ window.win = XCreateSimpleWindow(display, RootWindow(display, screen), 0, 0, /* Position */ x, y, /* Size */ 4, WhitePixel(display, screen), /* Window Border color */ colour.pixel); /* Window Background color */ /* Select the event types we want the * window to respond to. * XSelectInput(display, */ XSelectInput(display, window.win, ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask ); /* Make window visable - this does not actually make the window visable until we start looking for 'events' */ XMapWindow (display, window.win); /* Create a 'Graphics Context' used to hold common attributes requires by graphic images, for example colour and line thickness. */ window.gc = XCreateGC(display, RootWindow(display, screen), 0, NULL); return window; } c_cpp_reference-2.0.2/reference/C/X_EXAMPLES/Makefile.am0000644000076400001440000000017307055335115016164 EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/X_EXAMPLES/Makefile.in0000644000076400001440000002373307474405126016211 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/X_EXAMPLES mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/X_EXAMPLES/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/X_EXAMPLES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/X_EXAMPLES/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=root_colour.c xxterm.c hardware.c Xref.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/X_EXAMPLES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/X_EXAMPLES/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/future.html0000644000076400001440000003172207055333534014632 Future additions.

Future additions.


Here is a short list of items I hope to add or complete. If you have any ideas or want to help out, please let me know.

To be completed.

o
Libraries.

o
GDB.

o
Technique and Style.

o
Descriptions for files in O'Reilly 'Using C' Directory.

Future Sections.

o
Makefile introduction.

o
Obfusticated code examples.

o
a umask example

o
Green house problem

o
Trapping escapes sequences.


Release 1.09

(15th Nov 1998)

o
I have continued to add C++ information. The main effort has been in the non object related improvements within C++ that should make a C programmers life easier.

Release 1.08

(5th April 1998)

o
This is a minor release. It correctes a few duff links found in 1.07 and generally tidys things up.

Release 1.07

(1st Mar 1997)

o
An extra feature in struct is now documented.

o
static functions now documented.

o
All the code examples now use the same formatting standard.

o
The master index now uses 'frames' to improve the layout.

o
Number conversion page. This is a Java Applet that shows numbers in Hex, Oct, Dec, Binary and ASCII.

o
It appears that some people have problems getting CGI scripts installed. In attempt to make your lives easier, several JavaScript pages have been written to replace the CGI scripts.

Enjoy.

o
Some pages use JavaScript to change the color of the bullet. This was added just so I could see it work...

o
A bit more flesh has been added to the function reference.

o
I found the old mottled background hardwork on some terminals so I have changed it to something a little easier on the eyes.

o
A little more information added on C++ keywords.

o
The POSIX libraries are starting to appear! Check out unistd.h and pipe or fork in particular.

o
const improved.

o
Information on arrarys improved.

o
Information on pointer documentation improved.

Release 1.06

(30th March 1996)

o
This release corrects problems with 1.05! There are only minor changes.


Release 1.05

(11th March 1996)

o
Well! the most obvious change is the background. Do you like it or do you think its a distraction or maybe you have a better background I could use. Please let me know.
o
All the ANSI functions are now listed. I have supplied some of my own notes on the more common functions and all the others use man pages to provide you with information.

o
Bitwise operators have recieved some attension. There is also a Simulator that will show you whats happening. Coool....

o
Pointers reworked.

o
Strings added.

o
I know I am going to regret this move, but, I have started adding C++ notes to this documentation! If a page has brown text, it will contain C++ notes. As an example please checkout the pages on:

Please dont expect this side of the documentation to grow....

o
A large number of the pages now have buttons to jump directly to Top, Master Index, Keywords and Functions.

Check out the bottom of this page to see what I mean.

o
strtok has been reworked.

o
sizeof information expanded.

o
I have changed the numbering system by dropping the 1. bit as it does not serve much purpose.

Release 1.4

(23rd Nov 1995)

o
The following keywords have been documented by Vinay Kanitkar

else
if
switch
case

o
void keyword explanation.

o
stdin, stdout, stderr file pointers.

o
Download the HTML source to this guide.

o
malloc function.

o
GOT YA. Traps that people fall into.


Release 1.3

(15th June 1995)

o
Pointers to functions.

o
Another X program added.

o
Small fix put into stat example.

o
Corrections made to strchr documentation.

o
Keyword documentation now includes union , do , for and while.

o
Formatting using HTML 2.0 extensions now appearing on some pages.

o
Precedence table improved.

o
Link Lists.

o
ANSI functions the never ending task of documenting these continues (slowly).

o
strpbrk and bsearch are new additions.


Release 1.2

(18th April 1995)

o
Hex dump problem added.

o
Yet more links added to existing documents especially the glossary.

o
General corrections (spelling/HTML/grammar).

o
Keywords - goto documented.

o
mjl_man re-written, I kept finding bugs in V1.x. Latest version is V2.0

o
Structures - more information added.

o
Precedence table added.

o
Descriptions for my example programs.

o
Descriptions for files in O'Reilly ' Practical C' Directory.

o
ANSI functions now listed by header instead of alphabetically.

o
printf/sprintf etc formatting improved.

o
A couple of X program examples added.


Release 1.1

(5th February 1995)

This release fixes problems found with 1.0. There is no extra information added.

o
All icons now have transparent backgrounds so they will blend in with the browsers background.

o
Links placed in the glossary pointing to related info.

o
Master index tidied up.

o
Changes made to the program examples so they are displayed correctly in NCSA Mosaic and Netscape browsers.

o
Links in the 'Interesting items from the net' page actually work!!!

o
White ball icon now the correct size.


Release 1.0

(21st January 1995)

o
First public release.


Creation

(1st January 1994)

o
The saga starts here. The inital documentation started out as a bunch of files in a directory. Over time they became un-managable and got the HTML treatment and eventually grew into this seathing mass of hypertext links.....


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/0000777000076400001440000000000007474405230013535 5c_cpp_reference-2.0.2/reference/C/SYNTAX/got_ya.html0000644000076400001440000000271407055334535015631 Got Ya


Got Ya



An error which almost every C programmer has made is shown below:
	main()
	{
	   int left=10;
	   		
	   if ( left = 5 )
	   {
	      puts(" Values are equal...");
	   }
        }
The program assigns 5 to the variable left and returns 5. This is interpreted as
TRUE and causes the puts statement to be executed everytime.

Here is the corrected program.

	main()
	{
	   int left=10;
	   		
	   if ( left == 5 )		/* Double equals required. */
	   {
	      puts(" Values are equal...");
	   }
        }


See Also:

Coding idioms.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/switch.html0000644000076400001440000001130707055334526015646 switch/case keywords


The 'switch' and 'case' keywords


The switch-case statement is a multi-way decision statement. Unlike the multiple decision statement that can be created using if-else, the switch statement evaluates the conditional expression and tests it against numerous constant values. The branch corresponding to the value that the expression matches is taken during execution.

The value of the expressions in a switch-case statement must be an ordinal type i.e. integer, char, short, long, etc. Float and double are not allowed.

The syntax is :


     switch( expression )
     {
        case constant-expression1:	statements1;
        [case constant-expression2:	statements2;]    
        [case constant-expression3:	statements3;]
        [default : statements4;]
     }

The case statements and the default statement can occur in any order in the switch statement. The default clause is an optional clause that is matched if none of the constants in the case statements can be matched.

Consider the example shown below:


     switch( Grade )
     {
        case 'A' : printf( "Excellent" );
        case 'B' : printf( "Good" );
        case 'C' : printf( "OK" );
        case 'D' : printf( "Mmmmm...." );
        case 'F' : printf( "You must do better than this" );    
        default  : printf( "What is your grade anyway?" );
     }		

Here, if the Grade is 'A' then the output will be

     Excellent
     Good
     OK
     Mmmmm....
     You must do better than this    
     What is your grade anyway?

This is because, in the 'C' switch statement, execution continues on into the next case clause if it is not explicitly specified that the execution should exit the switch statement. The correct statement would be:


     switch( Grade )
     {
        case 'A' : printf( "Excellent" );
                   break;

        case 'B' : printf( "Good" );
	           break;

	case 'C' : printf( "OK" );
	           break;

        case 'D' : printf( "Mmmmm...." );
	           break;

	case 'F' : printf( "You must do better than this" );    
	           break;

	default  : printf( "What is your grade anyway?" );
                   break;
	}		

Although the break in the default clause (or in general, after the last clause) is not necessary, it is good programming practice to put it in anyway.

An example where it is better to allow the execution to continue into the next case statement:


     char Ch;
     .
     .
     switch( Ch )
     {
       			/* Handle lower-case characters */ 
        case 'a' :
        case 'b' :
       	      .
	      .
	      .
        case 'z' :
          printf( "%c is a lower-case character.\n", Ch );
	  printf( "Its upper-case is %c.\n" toupper(Ch) );      
	  break;

       			/* Handle upper-case characters */
	case 'A' :	
	case 'B' :
	      .
	      .
	      .
	case 'Z' :
           printf( "%c is a upper-case character.\n", Ch );
	   printf( "Its lower-case is %c.\n" tolower(Ch) );
	   break;

       			/* Handle digits and special characters */   

        default  :
           printf( "%c is not in the alphabet.\n", Ch );
	   break;

     }
     .
     .


Example:

Basic switch example.

See also:


Top Master Index Keywords Functions


Martin Leslie

Vinay Kanitkar c_cpp_reference-2.0.2/reference/C/SYNTAX/statements.html0000644000076400001440000000342007055334504016525 C statements and blocks

C Statements and blocks.


Statements

C has three types of statement.
  • assignment
    	=
    
  • selection (branching)
    	if (expression)
    	else
    	switch
    
  • iteration (looping)
    	while (expression)
    	for (expression;expression;expression)
    	do {block}
    

Blocks

These statements are grouped into blocks, a block is identified by curly brackets...There are two types of block.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/do.html0000644000076400001440000000327107055334531014744 The DO keyword.


The DO keyword.


The do keyword performs a simular function to while. Basicaly, it repeats a block of statements. Here is an example of the syntax:
        main()
        {
          int i=5;

          do
          {
            printf(" i is %d\n", i);
          }
          while(--i);
        }

The program result will look like this:
 		i is 5
 		i is 4
 		i is 3
 		i is 2
 		i is 1
The main difference between do and while is the time that expression is evaluated.
  • do performs the first test AFTER the first iteration.
  • while performs the first test BEFORE the first iteration.

Examples:

Basic do.

See also:


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/Master.html0000644000076400001440000000163607055334535015604 XXX


XXXX


XXXX



Examples:

example program.

See Also:

malloc function.


Top Master Index Keywords Functions


Martin Leslie

C keywords.


C keywords.


The following list shows all the ANSII defined C keywords. I have included sizeof because it looks like a keyword and it keeps the table below tidy....
auto break case char const continue default do
double else enum extern float for goto if
int long register return short signed sizeof static
struct switch typedef union unsigned void volatile while


C++ extends the language to include these keywords

Top Master Index Keywords Functions


Martin Leslie
c_cpp_reference-2.0.2/reference/C/SYNTAX/comments.html0000644000076400001440000000350007055334510016157 Comments.

Comments.


Lets start with a few examples.


  main()
  {

      int Counter=0;       /* Initalise Counter */

      /* a comment */

      /*
       * Another comment
       */

      /*****************
       *
       * Final comment.
       *
       *****************/ 
  }


A comment starts with a /* and ends with */. Comments started in this way can span multiple lines but cannot be nested. For example:


   main()
   {
       int Count = 0;           /* Initalise 
                                 * Counter to 0 */

       /* /* Invalid comment */ */
   }

This will give a syntax error, because the last line contains nested comments. C++ offers a solution to comment nesting.


C++ Extension

Inline comments


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/conditional.html0000644000076400001440000000447607055334513016655 Conditional Expressions


Conditional Expressions.


We have a short-hand construct for some if ... else ... constructs.

Consider the following two examples.

Example 1 Example 2

  if ( x == 1 ) 
    y = 10;
  else
    y = 20;
    

  y = (x == 1) ? 10 : 20;  

These examples both perform the same function. If x is 1 then y becomes 10 else y becomes 20. The example on the right evaluates the first expression '(x ==1 )' and if true evaluates the second '10'. If false the third is evaluated. Here is another example.

Example 1 Example 2

 if ( x == 1 ) 
   puts("take car"); 
 else
   puts("take bike");  

 (x == 1) ? puts("take car") : puts("take bike"); 
                                                  
    or

 puts( (x == 1) ? "take car" : "take bike");

It has been said that the compiler can create more efficent code from a conditional expression possibly at the expence of readable code. Unless you are writing time critical code (and lets face it, thats unlikely) the more efficent code is not much of a reason to use this construct. I feel that it has its uses, but should not be lost into some complex statement, but, since when did C programmers worry if anyone else could read their code ;-)


See also:


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/syntax.gif0000644000076400001440000000157007055334537015477 GIF89a6!,6jZuHUnpLmRxEpĢ[mP5`KJgE>]ԮwjfB2MUG VމvuxWdhWh#Gx&"S(2b٩WIS!Z:7ci'[73{AHd.O+jRuWzڪ6޽tJ+BR )k-> *ܧS"į3ߕ(O&D@KMq )di/Mgir&D]Z%OPЭs*u9'fjiI|~H!+7OB%7Y@eWh?fؼs T夙Q1\7`o1o.{'/NE9:ne M;+V}pˉ/x-N6={җdgM%fO<+SEwPKyǿL ދ^~v_kE}9w1^jiV}^(5]l҈ǟ]ǥa<48IS!y`~7˔R |#aUIh>8$(>ԝk c erc]rdo.Rqe^NX"O %_*8Qus"r%q<; 2`$уٗ$YX.Ti'bnYڥl RjaM>5ˠU]:t~b!VLLBN{^-+[fmx nK.2Yn9sRKp޻Q;c_cpp_reference-2.0.2/reference/C/SYNTAX/for.html0000644000076400001440000000765207055334527015144 The FOR keyword.


The FOR keyword.


The for keyword is used to repeat a block of code many times.


Basic principles

Say you wanted to print all the numbers between 1 and 10, you could write:
	main()
        {
	   int count=1;

	   printf("%d\n", count++);
	   printf("%d\n", count++);
	   printf("%d\n", count++);
	   printf("%d\n", count++);
	   printf("%d\n", count++);
	   printf("%d\n", count++);
	   printf("%d\n", count++);
	   printf("%d\n", count++);
	   printf("%d\n", count++);
	   printf("%d\n", count++);
        }
As you can see this program would NOT be very practical if we wanted 1000 numbers. The problem can be solved with the for statement as below.
	main()
        {
	   int count;

           for ( count=1 ; count <= 10 ; count++) printf("%d\n", count);
        }
The for statement can be broken down into 4 sections:

count=1
is the initalisation.

count <= 10
An expression. The for statement continues to loop while this statement remains true

count++
increament or decreament.

printf("%d\n", count)
the statement to execute.


Repeating several lines of code

The previous example showed how to repeat ONE statement. This example shows how many lines can be repeated.
	main()
        {
	   int count, sqr;

           for ( count=1 ; count <= 10 ; count++) 
           {
	      sqr=count * count;
              printf( " The square of");
	      printf( " %2d", count);
	      printf( " is %3d\n", sqr);
           }
        }
The { and } following the for statement define a
block of statements.

More detail

The for statement performs the following functions while looping.
	for (expression_1 ; expression_2 ; expression_3) statement ;
  1. Executes expression_1.

  2. Executes statement.
  3. Executes expression_3.
  4. Evaluates expression_2.

    • If TRUE, Jumps to item 2.
    • If FALSE, Stops looping.
Any of the three expressions can be missing, if the first or third is missing, it is ignored. If the second is missing, is is assumed to be TRUE.

The following example is an infinite loop:

	main()
	{
	   for( ; ; ) puts(" Linux rules!");
	}

Examples:

Basic for example.
Advanced for example.

See also:


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/while.html0000644000076400001440000000564007055334531015454 The WHILE keyword.


The WHILE keyword.


The while keyword is related to do and for. Its purpose is to repeatedly execute a block of statements. Here is an example :


        main()
        {
            int i=5;

            while(--i)
            {
                printf(" i is %d\n", i);
            }
        }

The expression i-- is evaluated and if its true the statements in the block are executed. The loop continues until the expression is false (zero). The result will look like this:

                
                i is 4
                i is 3
                i is 2
                i is 1

It is important to note that the statements on a while will not get executed if the first evaluation of the expression is FALSE. If you do not want this to happen you may prefer to use the do statement.


Now consider the next example.


        main()
        {
            int i=5;

            while(--i);
            {
                printf(" i is %d\n", i);
            }
        }
The result will look like this:


                i is 0

This is because of the ; on the end of the while statement which means the while will loop (executing NULL statements) until i is zero. Execution will then continue down the program (to the printf).


Examples:

o Basic while.

See also:


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/define_preprocessor.html0000644000076400001440000000315107055334507020402 define preprocessor


#define preprocessor


The #define preprocessor allows us to define symbolic names and constants. A quick example

	#define PI 3.14159
This statement will translate every occurance of PI in the program to 3.14159. Here is a more complete example:


	#define PI 3.14159
	main()
	{
   	   int r=10;
	   float cir;
	   cir = PI * (r*r);
	}
This feature is partically usefull for defining 'magic' numbers.


See Also:

  • A related C keyword is enum which can be used to build lists of aliases.

  • Another related C keyword is const.

  • An advanced use of #define is in the creation of macros.

Examples:

example program.

Conflict between enum and #define.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/void.html0000644000076400001440000000363707055334532015312 The VOID keyword.


The VOID keyword.


The void keyword allows us to create functions that either do not require any parameters or do not return a value.

The following example shows a function that does not return a value.


	void Print_Square(int Number);

	main()
	{
	   Print_Square(10);
	   exit(0);
	}
	
	void Print_Square(int Number)
	{
	   printf("%d squared is %d\n",Number, Number*Number);
	}

The next example shows a function that does not require any parameters:


	#include 
	#include 

        int Random(void);

        main()
        {
           printf("A random number is %d\n", Random());
           exit(0);
        }

        int Random(void)
        {
	   srand((unsigned int)time((time_t *)NULL));
	   return( rand());
        }


Example:

void example

See also:

Functions Void pointers


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/struct.html0000644000076400001440000002251107055334516015667 STRUCT keyword


STRUCT keyword



Structure basics

struct is used to declare a new
data-type. Basically this means grouping variables together. For example, a struct data type could be used to declare the format of the following file.

          
   Jo		Loss		Maths		A   
   Harry	Carpenter	English 	A
   Billy	King		Maths		C

The records above could be described in a struct as follows:

   

   struct
   {
       char cname[8];
       char sname[16];   
       char exam[16];
       char grade;
   } record;

The statement above declares a variable called record with 4 members called cname, sname, exam, grade. The structure as a whole can be referred to as record and a member can be referenced as record.exam

Structures can be declared in various forms...

	struct x {int a; int b; int c;};		/* declaration	*/
	struct 	 {int a; int b; int c;} z;
	struct x z;
All the examples above are structure declarations,
  • The first gives x as a 'structure tag' - this is optional.
  • The first and second declare the members of the structure.
  • Second and third give z this is the variable that assumes the structure type.


Structure membership

We can access individual members of a structure with the . operator.

For example to assign a value, we can enter:

	
   struct x {int a; int b; int c;};   

   main()
   {
      struct x z;
     
      z.a = 10;
      z.b = 20;
      z.c = 30;
   }
   

And to retrieve a value from a structure member:


   struct x
   {
      int a;
      int b;
      int c;
   };

   main()
   {
      struct x z;
	
      z.a = 10;
      z.a++;

      printf(" first member is %d \n", z.a);   
   }
   


Pointers to structures

Fast path to an explanation of the -> operator.

All that we have discussed so far has been OK but runs into problems when structures have to be moved between functions for the following reasons.

  • If the structure is large it is more effiecent to pass a pointer to the structure instead of the structure its self. This technic is also used to pass pointers to arrays between functions.

  • When passing a structure to a function, you actually pass a COPY of the structure. Therefore it is not possible to change the values of members within the structure as the copy is destroyed when the function ends.

So how does it all work? Here is an example. (make your browser W-I-D-E so you can see the two examples).

					|
					|
   struct x {int a; int b; int c;} ;	| struct x {int a; int b; int c;} ;
					|
   void function(struct x);		| void function(struct x *);
					|
   main()			       	| main()
   {					| {
     struct x z;                        |   struct x z, *pz;	     /* 3 */
					|   pz = &z;		     /* 4 */
     z.a = 10;		/* 1 */		|   z.a = 10;
     z.a++;				|   z.a++;
					|
     function(z);	/* 2 */	        | function(pz);		     /* 5 */
   }					| }
					|
   void function( struct x z)		| void function(struct x * pz)
   {					| {			     /* 6 */
     printf(" first member %d \n", z.a);|   printf(" first member %d \n", (*pz).a);   
   }					| }
					|

Here is the annotation.

  1. Give a structure member a value.
  2. Pass a COPY of the whole structure to the function.
  3. Define 'pz' a pointer to a structure of type 'x'.
  4. Put the address of 'z' into 'pz'. 'pz' now POINTS to 'z'. PLEASE NOTE. 'z' is defined to reserve memory equal to the size of the structure. 'pz' only holds an address so will be 4 bytes long.
  5. Pass the pointer into the function.
  6. Print the value of the member 'a'.
The (*pz).a syntax is used a great deal in C and it was decided to create a short hand for it. So:
	(*pz).a   ==  pz->a
Here is the final picture.

   /*************************************************************************/

   struct x {int a; int b; int c;} ;	/* Declare the structure.	    */

   void function(struct x * );		/* Declare the function.	    */

   /*************************************************************************/

   main() 
   {  
					/* Declare two variables.
					 * z == type struct x
					 * pz == a pointer to type struct x
					 */
     struct x z, *pz; 			

     pz = &z;        			/* put the address of 'z' into 'pz' */
     z.a = 10;				/* initialize z.a		    */
     z.a++;				/* Increment z.a		    */

					/* print the contents of 'z.a'
					 * using the pointer 'pz'	    */
   
     printf(" first member before the function call %d \n", pz->a);

					/* Call 'function' passing the 
					 * pointer 'pz'			    */
     function(pz);  			

					/* Print the NEW value of 'z.a'
					 * using three different notations  */
     printf(" first member after the function call %d \n", pz->a);
     printf(" first member after the function call %d \n", (*pz).a);
     printf(" first member after the function call %d \n", z.a);

   }

   /*************************************************************************/
   
   void function(struct x * pz)
   { 
					/* Print the value of 'z.a' by
					 * referencing the pointer 'pz'
					 * which holds the address of 'z'   */
     printf(" first member inside the function %d \n", pz->a);
      
					/* Increment the value of 'z.a'
					 * this is the source location
					 * in memory.			    */
     pz->a++;
     
   }

   /*************************************************************************/
  


The Bottom Draw

Finally, here is a little feature that allows you to save a little space.


  main()
  {
    struct Flags
    {
      unsigned int Online  :1;   
      unsigned int Mounted :1;
    }

    struct Flags TapeInfo;

    TapeInfo.Online  = 1;
    TapeInfo.Mounted = 0;
  }
  

The :1 tells the compiler that only 1 byte is required for Online and Mounted. There are a few points to note about this though.

  • You may expect the compiler to reserve 2 bytes for the structure, it actually reserves one word (usually 4 bytes) as this is the smallest unit that can be reserved, the remaining 2 bytes are unavailable. This is still better than the 2 words that wold normally get reserved.
  • You can put any number into the variable, if the number is too large to fit, the high order bits are lost without warning.
  • Only signed int, unsigned int, int support this syntax.

Examples

This is the most basic struct example I could think of.
Using structure elements, and passing them into a function.
Passing a whole structure to a function. This performs a copy of the structure so the same rules apply as for int etc. Pointers to structures can be passed but I have not got to them yet....
Define and use an array of structures.
Here is a struct problem for you.


See Also:

typedef keyword.
Linked lists.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/functions.html0000644000076400001440000001124607055334512016352 Functions and passing arguments.


Functions and passing arguments.


A function is a block of code that can be executed many times by other functions or its self.

Function Basics.

You should already understand the concept of functions! If you don't, you are a sad sad man....

Might expand on this one day.

P.S. main() is a function.

Declaration.

Just like variables, all functions have to be declared before use. Here is an example.
        int add( int, int);
This statement declares a function called add, it has two integer arguments and returns an integer.

Definition.

The
definition is the meat of the function. Heres an example.

Passing values.

Passing values is known as call by value. You actually pass a copy of the variable to the function. If the function modifies the copy, the original remains unaltered. The previous example demonstarted call by value

Passing pointers.

This is known as call by reference and is an area worth spending some time on. We do not pass the data to the function, instead we pass a pointer to the data. This means that if the function alters the data, the original is altered.

Example of passing a pointer to a scalar.

C++ has a nice feature called reference variables which is a tider approch to modifing the contents of a passed variable.

Passing Arrays.

Example of passing a pointer to an integer array.
Example of passing a pointer to a two dimensional integer array.
Example of passing a pointer to a character array.
Example of passing a two dimensional character array.

Variable number of parms (...)

Example of passing an unknown number of variables to a function
Man page for va_start, va_end etc

Function recurssion.

Returning values.

Normally you would return an 'int', 'char', 'float', or 'double' using this technic. The obvious time to return a value would be to return a completion code.

Here is an example

The contents of 'c' are copied into 'i'.

Returning pointers.

Returning values is OK for the data types above but not very practical for 'char *' or structures. For these data types passing pointers can be more appropriate. When using these pointers it is important to understand the 'static' storage class otherwise you are going to get some unpredictable results.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/syntax.html0000644000076400001440000000755607055334503015701 C Syntax


Syntax

The following items highlight the main areas of C syntax.


If nothing appears below this line, click on low tech links.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/volatile.html0000644000076400001440000000516407055334530016163 The VOLATILE keyword.


The VOLATILE keyword.


I have had several sugestions on how to describe volatile, If you have any input please mail me.
  • The volatile keyword acts as a data type qualifier. The qualifier alters the default why in which the compiler handles the variable and does not attempt to optimize the storage referenced by it. Martin Leslie

  • volatile means the storage is likely to change at anytime and be changed but something outside the control of the user program. This means that if you reference the variable, the program should always check the physical address (ie a mapped input fifo), and not use it in a cashed way.Stephen Hunt

  • Here is an example for the usage of the volatile keyword:
    	/* Base address of the data input latch */
    
    	volatile unsigned char *baseAddr;
    
    	/* read parts of output latch */
    
    	lsb    = *handle->baseAddr;
    	middle = *handle->baseAddr;
    	msb    = *handle->baseAddr;
    
    Between reads the bytes are changed in the latch.

    Without the volatile, the compiler optimises this to a single assignment:

    	lsb = middle = msb = *handle->baseAddr;
    
    Tim Potter

  • A volatile variable is for dynamic use. E.G. for data that is to be passed to an I/O port Here is an example.
    	#define TTYPORT 0x17755U
    
    	volatile char *port17 = (char)*TTYPORT;
    	*port17 = 'o';
    	*port17 = 'N';
    
    Without the volatile modifier, the compiler would think that the statement *port17 = 'o'; is redundant and would remove it from the object code. The volatile statement prevents the compiler optimisation.Alex Arzon.

Examples:

o No example:-(

See also:


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/typedef.html0000644000076400001440000000560607055334523016007 The TYPEDEF keyword.


The TYPEDEF keyword.


Every variable has a data type. typedef is used to define new data type names to make a program more readable to the programmer.

For example:


				|
	main()	                |   main()
        {	                |   {
  	    int money;          |       typedef int Pounds;
            money = 2;          |       Pounds money = 2
        }	                |   } 

These examples are EXACTLY the same to the compiler. But the right hand example tells the programmer the type of money he is dealing with.

A common use for typedef is to define a boolean data type as below.
Note: Recent C++ compilers have introduced a boolean datatype.


	typedef enum {FALSE=0, TRUE} Boolean

	main ()
        {
	    Boolean flag = TRUE;
	}
        

And as a final example, how about creating a string datatype?


     typedef char *String;
     
     main()
     {
         String Text = "Thunderbird";
       
         printf("%s\n", Text);
     }
     

The main use for typedef seems to be defining structures. For example:


	typedef struct {int age; char *name} person;
	person people;

Take care to note that person is now a type specifier and NOT a variable name.

As a final note, you can create several data types in one hit.


	typedef int Pounds, Shillings, Pennies, Dollars, Cents;  


Examples:

Here is a rather heavy example of typedef.

Notes:

I would expect to see 'typedef' in header files.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/const.html0000644000076400001440000001026707055334534015476 The const keyword.


The const keyword.


The const keyword is used to create a read only variable. Once initialised, the value of the variable cannot be changed but can be used just like any other variable.

const syntax


        main()
        {
            const float pi = 3.14; 
        }

The const keyword is used as a qualifier to the following data types - int float char double struct.


        const int   degrees = 360; 
        const float pi      = 3.14; 
        const char  quit    = 'q'; 

const and pointers.

Consider the following example.


        void Func(const char *Str);

        main()
        {
            char *Word;

            Word = (char *) malloc(20);

            strcpy(Word, "Sulphate");
          
            Func(Word);
        }
        
        void Func(const char *Str)
        {
        }

The const char *Str tells the compiler that the DATA the pointer points too is const. This means, Str can be changed within Func, but *Str cannot. As a copy of the pointer is passed to Func, any changes made to Str are not seen by main....


            --------
           | Str    |  Value can be changed
            -----|--
                 |
                 |
                 V
            --------
           | *Str   | Read Only - Cannot be changed.
            --------

Geeky Stuff

It is still possible to change the contents of a 'const' variable. Consider this program it creates a const variable and then changes its value by accessing the data by another name.

I am not sure if this applies to all compilers, but, you can place the 'const' after the datatype, for example:


        int   const degrees = 360; 
        float const pi      = 3.14; 
        char  const quit    = 'q'; 

are all valid in 'gcc'.

More Geeky Stuff

What would you expect these to do?


        main()
        {
            const char * const Variable1;
            char const * const Variable2;
        };

These both make the pointer and the data read only. Here are a few more examples.


  const int   Var;           /* Var is constant */
  int const   Var;           /* Ditto */
  int * const Var;           /* The pointer is constant, 
                              * the data its self can change. */
  const int * Var;           /* Var can not be changed. */  
                           


See Also.

o #define preprocessor

o C++ version of const


An Example.

o const example.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/namespace.html0000644000076400001440000000164007055334504016274 XXX


XXXX


XXXX



Examples:

example program.

See Also:

malloc function.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/goto.html0000644000076400001440000000236407055334523015315 The GOTO keyword.


The GOTO keyword.


Well, I have resisted adding goto for a whole year. But tonight I have had a couple of beers and I am ready to go for it. It must be said that most programmers will claim that goto is never required and I dont have reason to disagree, but you may like to differ.

goto syntax

	goto lab1;

	lab1:
goto allows the program to 'jump' to a named label, in this case lab1, the target label MUST be terminated with a : (colon).

An Example.

goto example.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/fork1.c0000644000076400001440000000076707055334536014656 #include main() { pid_t ForkPID; printf("Program start. \n"); ForkPID = fork(); /* Create a child and copy the parents * parent data space, heap and stack. */ /* ForkPID == -1 Fork failure. * == 0 This is the child process. * > 0 This is the parent process. The number given is the * PID of the child. */ printf("forkPID is %d \n", ForkPID); /* Child execution starts here. */ printf("Program end. \n"); } c_cpp_reference-2.0.2/reference/C/SYNTAX/Makefile.am0000644000076400001440000000021507055334537015511 EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/SYNTAX/Makefile.in0000644000076400001440000002466507474405126015537 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/SYNTAX mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/SYNTAX/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/SYNTAX/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/SYNTAX/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=if.html static.htm include_preprocessor.html sizeof.html comma.html syntax.gif idioms.html syntax.html conditional.html define_preprocessor.html glo_int_vars.html typedef.html while.html for.html volatile.html break.html return.html comments.html namespace.html syntax_p.html keywords.html functions.html switch.html void.html logical.html goto.html null.html fork1.c struct.html union.html Master.html statements.html enum.html macros.html const.html storage_class.html got_ya.html do.html preprocessors.html continue.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/SYNTAX/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/SYNTAX/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/SYNTAX/macros.html0000644000076400001440000000421607055334521015625 Macros


Macros


Macros are built on the #define preprocessor.

Normally a #define would look like:

	#define PI 3.142
But, a macro would look like this.
	#define SQUARE(x) x*x
The main difference is that the first example is a constant and the second is an expression. If the macro above was used in some code it may look like this:
        #define SQUARE(x)  x*x

        main()
        {
          int value=3;
          printf("%d \n", SQUARE(value));
        }
After preprocessing the code would become:
        main()
        {
          int value=3;
          printf("%d \n", value*value);
        }

Examples:

macro example.


Notes:

  • The value passed to SQUARE could have been an int float or double
  • Long macros can span multiple lines by using a \ followed by a newline (return).
  • If you are using gcc to compile your code, you can use the -E option to see the preprocessor output

See Also:

  • #define preprocessor.
  • inline A C++ keyword that provides a better aproch to macros.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/idioms.html0000644000076400001440000000471107055334533015630 Idioms


Idioms


Here are some C idioms that may be usefull.


Place \0 at the location pointed to by ptr then increment ptr


   *ptr++ = '\0';   


Increment ptr then place \0 at the location pointed to by ptr


   *++ptr = '\0';   


This program will print its self! I guess its not of any real use, but I think its clever.


  main(a) {a="main(a) {a=%c%s%c;printf(a,34,a,34);}";printf(a,34,a,34);}  


This is something I saw out on the web. It swaps the value of two variables without using a third variable as a temporary store.


   one ^= two;   
   two ^= one;
   one ^= two;


Have you ever had a SEGV from printf because you passed a NULL pointer to a %s flag???. This idiom will put a stop to all that nonsence.


   printf("%s\n", Str ? Str : "Null");   


o Program swapping the contents of two variables.


See Also:

o Common Coding Errors.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/include_preprocessor.html0000644000076400001440000000254107055334507020575 include preprocessor


include preprocessor.


The include preprocessor will add source code to your existing source. This is used to include header files that contain function declarations. For example:

	#include <stdio.h>
	main()
	printf("hi peeps");
	}
The printf function declaration is held in stdio.h

There are two ways of defining the include files location.

  • <>says to the preprocessor that the file is in the system libraries.
    	#include <stdio.h>
    
  • ""means that this is a user defined file. Absolute or relative paths may be defined.
    	#include "myheaders.h"
    	#include "/usr/home/leslim/myheaders.h"
    


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/logical.html0000644000076400001440000000361707055334517015764 Logical AND OR and NOT


Logical AND OR and NOT



Logical AND

In simple terms, && is true (1) if both sides of the expression returns NOT 0.

For Example:

	/* These all return TRUE (1) */

	if (4 && 5) return();

	i=3;
	j=2;
	return( i && j);
The expression is evaluated 'Left to Right' If any part of the expression returns ZERO - The evaluation ends.

THIS CAN CAUSE SERIOUS PROBLEMS.

For example:

	k=0;
	i=3;
	j=2;
	if ( i-i && j++) k=1
The left side (i-i) resolves to 0, so j is not incremented and k is not changed.

Logical OR

OR also evaluates 'Left to Right' and will stop when an expression returns true.

SO WATCH YOUR BACK....

	k=0;
	i=3;
	j=2;
	if ( i+i && j++) k=1
What are j and k going to be when this code is executed?????

Logical NOT

NOT reverses the logical state of its
operand. If the operand is 0, 1 is returned, else 0 is returned.
	!4	/* Returns 0	*/
	!-4	/* Returns 0	*/
	!1	/* Returns 0	*/
	!0	/* Returns 1	*/


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/comma.html0000644000076400001440000000256707055334535015451 The COMMA.


The COMMA.


The comma has two uses. The most comman, is as a parameter seperator for data types and function parameter lists. Here is an example:
	main()
    	{
	   char String1[20], String2[]="Outback Pub"; /* data types */
	   strncpy(String1, string2, 7);
	}
The other use is as a series operator which can be seen in use with the for keyword. An example of the syntax is shown in the link below.

Examples:

Example of the series operator.

See also:

Nothing else to see :-(


Top Master Index Keywords Functions


Martin Leslie

C Storage Classes


C Storage Classes.


C has a concept of 'Storage classes' which are used to define the scope (visability) and life time of variables and/or functions.

So what Storage Classes are available?

auto register static extern typedef


auto - storage class

auto is the default storage class for local variables.
	{
            int Count;
            auto int Month;
	}
The example above defines two variables with the same storage class. auto can only be used within functions, i.e. local variables.


register - Storage Class

register is used to define local variables that should be stored in a register instead of RAM. This means that the variable has a maximum size equal to the register size (usually one word) and cant have the unary '&' operator applied to it (as it does not have a memory location).
	{
            register int  Miles;
	}
Register should only be used for variables that require quick access - such as counters. It should also be noted that defining 'register' goes not mean that the variable will be stored in a register. It means that it MIGHT be stored in a register - depending on hardware and implimentation restrictions.


static - Storage Class

static is the default storage class for global variables. The two variables below (count and road) both have a static storage class.
	static int Count;
        int Road;

        {
            printf("%d\n", Road);
        }
static variables can be 'seen' within all functions in this source file. At link time, the static variables defined here will not be seen by the object modules that are brought in.

'static' can also be defined within a function! If this is done the variable is initalised at run time but is not reinitalized when the function is called. This is serious stuff - tread with care.

	{
	    static Count=1;
        }
Here is an
example

There is one very important use for 'static'. Consider this bit of code.

        char *func(void);

        main()
        {
            char *Text1;
            Text1 = func();
        }

        char *func(void)
        {
            char Text2[10]="martin";
            return(Text2);
        }
Now, 'func' returns a pointer to the memory location where 'text2' starts BUT text2 has a storage class of 'auto' and will disappear when we exit the function and could be overwritten but something else. The answer is to specify
	static char Text[10]="martin";
The storage assigned to 'text2' will remain reserved for the duration if the program.


C++ has overloaded static,
here are the details.

extern - storage Class

extern defines a global variable that is visable to ALL object modules. When you use 'extern' the variable cannot be initalized as all it does is point the variable name at a storage location that has been previously defined.
Source 1 Source 2

extern int count;			int count=5;

write()					main()
{					{
    printf("count is %d\n", count);         write();
}					}
test
Count in 'source 1' will have a value of 5. If source 1 changes the value of count - source 2 will see the new value. Here are some example source files.

Source 1
Source 2

The compile command will look something like.

	gcc source1.c source2.c -o program

See Also:

Data types.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/static.htm0000644000076400001440000000571507055334502015460 static functions


static functions


static functions are functions that are only visable to other functions in the same file. Consider the following code.

main.c

   #include 

   main()
   {
     Func1();   

     Func2();
   }
   
funcs.c

   /*************************************
    *
    * Function declarations (prototypes).
    *
    *************************************/

   /* Func1 is only visable to functions in this file. */   

   static void Func1(void);

   /* Func2 is visable to all functions. */

   void Func2(void); 

   /*************************************
    *
    * Function definitions
    *
    *************************************/
       
   void Func1(void)
   {
     puts("Func1 called");
   }
   
   /*************************************/
   
   void Func2(void)        
   {
     puts("Func2 called");
   }
   

If you attempted to compile this code with the following command,


   gcc main.c funcs.c   

it will fail with an error simular to.....


   undefined reference to `Func1'  

Because 'Func1' is declared as static and cannot be 'seen' by 'main.c'.


Notes:

For some reason, static has different meanings in in different contexts.
  1. When specified on a function declaration, it makes the function local to the file.

  2. When specified with a variable inside a function, it allows the vairable to retain its value between calls to the function. See static variables.
It seems a little strange that the same keyword has such different meanings....


See Also:

static variables

C++ extensions for static


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/if.html0000644000076400001440000000535107055334533014743 if-else keywords.


The 'if' and 'else' keywords


The if-else statement is a two-way decision statement. It is written as

	if ( expression )	statement1;
	[else			statement2;]
The else portion is optional. If the expression evaluates to true (anything other than 0) then statement1 is executed. If there is an else statement and the expression evaluates to false statement2 is executed. For example
(1)
	int NumberOfUsers;
	.
	.
	if( NumberOfUsers == 25 )
        {				/* No else part */
	  printf( "There are already enough users. Try later.\n" );
	  return ERROR;
        }
	.
	.


(2)	if( a >= b )	larger = a;	/* else part is present */
	else		larger = b;
Consider this code fragment:
	if( p == 1 )
	  if( q == 2 )	r = p * 2 + q;
        else r = q * 2 + p;
Because the else part is optional, there is an ambiguity when an else is omitted from a nested if sequence. In 'C', this is resolved by associating the else with the closest previous if that does not have an else. Therefore, in the above example, the else part belongs to the if(q==2) statement. The code can be made more readable by explicitly putting parentheses in the expression, like this
	if( p == 1 )
        {
	  if( q == 2 )	r = p * 2 + q;
        }
	else r = q * 2 + p;

		OR

	if( p == 1 )
        {
	  if( q == 2 )	r = p * 2 + q;
	  else r = q * 2 + p;
        }
Because the statement in the else part can also be an if statement, a construct such as shown below is possible in 'C' to create a multiple choice construct.
	if( expression1 )
	  statement1;
	else if( expression2 )
	  statement2;
	else if( expression3 )
	  statement3;
	.
	.
	else
	  statementN;

Example:

Basic if example.

See also:


Top Master Index Keywords Functions


Martin Leslie

Vinay Kanitkar c_cpp_reference-2.0.2/reference/C/SYNTAX/union.html0000644000076400001440000000362507055334524015477 The UNION keyword.

The UNION keyword.


The union keyword allows several variables of different type and size to occupy the same storage location.

The syntax to define a union is simular to the struct keyword as shown below:

	union union_def { int a; float b; char c;} ;
and a variable declared with either of these statements:
	union union_def union_var;
	union { int a; float b; char c;} union_var;
If you wish to initalise a variable you can say:
	union { int a; float b; char c;} union_var=97;
By default the first variable (a) is initalised.

To assign a value to a variable you can say:

	union_var.b=99.99;
	union_var.a=34;
	union_var.c='x';
It's important to note that the storage will only hold ONE value, looking at the three lines above, union_var.a overwrites union_var.b and then union_var.c overwrites union_var.a

I have yet to see more than one use for this keyword.


Examples:

Here is an example.

See also:


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/preprocessors.html0000644000076400001440000000421707055334505017255 C compiler preprocessors


C compiler preprocessors


Preprocessor commands are executed before the compiler compiles the source code. These commands will change the original code usually to suit the operating environment and/or to add code that will be required by calls to library functions. Preprocessors are recognised by the leading # in their names.

Preprocessors
#include Insert a source file.
#define Define a preprocessor constant.
#if Branch based on an expression.
#ifdef Branch if preprocessor constant has been defined?
#ifndef Branch is a preprocessor constant has NOT been defined.
#line Specify the number of the next source line.
#undef Remove a preprocessor constant.
#pragma Perform an implementation dependent action???
#else Executed if #if #ifdef or #ifndef fails.
#error Write an error message.
#elif Executed when an #if fails.
#endif Close #if #ifdef or #ifndef


Notes:

  • Preprocessors should start in column 1.
  • The -E option tells gcc to stop after the preprocessor stage and send the O/P to STDOUT (usually the screen).


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/enum.html0000644000076400001440000000472507055334514015314 The enum statement


The enum statement


ENUM is closely related to the #define preprocessor.

It allows you to define a list of aliases which represent integer numbers. For example if you find yourself coding something like:

        #define MON 1 
        #define TUE 2 
        #define WED 3 
You could use enum as below.
        enum week { Mon=1, Tue, Wed, Thu, Fri Sat, Sun} days;
  or
        enum escapes { BELL   = '\a', BACKSPACE = '\b', HTAB = '\t',
                       RETURN = '\r', NEWLINE   = '\n', VTAB = '\v' };
                       
  or     
        enum boolean { FALSE = 0, TRUE };
 
An advantage of enum over #define is that it has scope This means that the variable (just like any other) is only visable within the block it was declared within.


Notes:

  • If a variable is defined with enum it is considered by the compiler to be an integer, and can have ANY integer value assigned to it, it is not restericted to the values in the enum statement.

See Also:

C++ Enhancements to enum.

#define preprocessor.


Examples:

enum example 1.

enum example 2.

enum coding error.

Another enum coding error.

enum and #define coding error.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/glo_int_vars.html0000644000076400001440000001077707055334506017043 Global and Local variables declaration.


Global and Local variables.


Local variables

Local variables must always be defined at the top of a block.

C++ has changed the rules regarding where you can define a local variable. Click here for the low down.

When a local variable is defined - it is not initalised by the system, you must initalise it yourself.

A local variable is defined inside a block and is only visable from within the block.


   main()
   {
       int i=4;
       i++;
   }

When execution of the block starts the variable is available, and when the block ends the variable 'dies'.

A local variable is visible within nested blocks unless a variable with the same name is defined within the nested block.


   main()
   {
       int i=4;
       int j=10;
       
       i++;
      
       if (j > 0)
       {
          printf("i is %d\n",i);      /* i defined in 'main' can be seen      */
       }
     
       if (j > 0)
       {
          int i=100;                  /* 'i' is defined and so local to 
                                       * this block */
          printf("i is %d\n",i);      
       }                              /* 'i' (value 100) dies here            */
     
       printf("i is %d\n",i);         /* 'i' (value 5) is now visable.        */
   }


Global variables

C++ has enhanced the use of
global variables.

Global variables ARE initalised by the system when you define them!

Data Type Initialser
int 0
char '\0'
float 0
pointer NULL

In the next example i is a global variable, it can be seen and modified by main and any other functions that may reference it.


   int i=4;
   
   main()
   {
       i++;
   }

Now, this example has global and Internal variables.


   int i=4;          /* Global definition   */
   
   main()
   {
       i++;          /* global variable     */
       func
   }

   func()
   {
       int i=10;     /* Internal declaration */
       i++;          /* Internal variable    */
   }

i in main is global and will be incremented to 5. i in func is internal and will be incremented to 11. When control returns to main the internal variable will die and and any reference to i will be to the global.

static variables can be 'seen' within all functions in this source file. At link time, the static variables defined here will not be seen by the object modules that are brought in.


Example:

An Example program.

See Also:

See Storage classes to see the more powerfull features of variable declarations.


Top Master Index Keywords Functions


Martin Leslie

c_cpp_reference-2.0.2/reference/C/SYNTAX/break.html0000644000076400001440000000207207055334512015423 The break statement


The break statement.


This statement allows the program to escape from for, while, do ... while loops and switch structures.

It should NOT be used to escape from an if block.


Examples

Switch example.


Top Master Index Keywords Functions


Martin Leslie

Null


NULL


NULL is used in several ways.

  • As a pointer to address zero. NULL is defined in several ANSI headers as the symbolic constant (void *)0. Zero is often returned from functions that normaly return a pointer to signal an error. It is therefore conveniant to compare a function return code with NULL to catch errors.
    	if ((fp=fopen("/etc/hosts","r") == NULL)
            {
              exit(0);
            }
    

  • To mark the end of a character string. A null character is used to terminate the string. For example if you coded:
    	char * text="abc";
    
    You will actually reserve FOUR bytes containing in ASCII hex.
    	61 62 63 00
    	 a  b  c \0
    
    The null at the end can be coded by using the escape sequence '\0'.

\0 is actually an octal escape sequence, strictly speeking it should be written as \000


ANSI headers

The following headers define NULL.
  • locale.h
  • stddef.h
  • stdio.h
  • stdlib.h
  • string.h
  • string.h
  • time.h


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/SYNTAX/syntax_p.html0000644000076400001440000000467407406420626016220 C Syntax



    The following items highlight the main areas of C syntax.


    If your browser can support JavaScript click here.

    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/SYNTAX/sizeof.html0000644000076400001440000000463507055334524015650 The sizeof operator

    The sizeof operator


    sizeof will return the number of bytes reserved for a variable or data type.

    The following code shows sizeof returning the length of a data type.

    
            /* How big is an int? expect an answer of 4. */
    	
    	main()
     	{
    	   printf("%d \n", sizeof(int));
            }
    

    sizeof will also return the number of bytes reserved for a structure.

    
            /* Will print 8 on most machines. */
    	
            main()
    	{
    	  struct 
    	  {
    	    int a;
    	    int b;
    	  } TwoInts;
    	
    	printf("%d \n", sizeof(TwoInts));
    	}
    	
    

    Finally, sizeof will return the length of a variable.

    
    	main()
    	{
    	  char String[20];
    	  
    	  printf ("%d \n", sizeof String);
     	  printf ("%d \n", sizeof (String));
            }
    
    

    In the example above I have printed the size of 'String' twice. This is to show that when dealing with variables, the brackets are optional. I recommend that you always place the brackets around the sizeof argument.


    Examples:

    Example 1 Data types.

    Example 2 Data objects.


    See also:

    The strlen function.

    Other operators

    malloc function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/SYNTAX/continue.html0000644000076400001440000000201307055334514016160 The continue statement


    The continue statement


    continue allows a new iteration of a loop without the current iteration completing. For example you could filter records from a file with the 'continue' statement.

    continue example.

    continue is related to the break statement.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/SYNTAX/return.html0000644000076400001440000000411707055334522015661 The return statement


    The return statement


    return will return a value from a function to its caller. The value returned is the result of an expression.


    As an Example this will print 7

    
            int func(void);
    
    	main()
     	{
    	   printf("%d \n", func());
            }
    
            int func(void)
            {
               return 7;
    	}
    

    What ever follows the return statement will be evaluated as an expression. So, to be consistant you could place brackets around the return value.

    
            return(7);
    

    Or you could evaluate a formula on the statement:

    
    	return (Count-1);
    

    Finally, if the function returns a void the return statement is not required, but maybe needed to leave a function before the end of the function block. Here is an example.

    
    	void CheckDate(int)
    
    	main()
    	{
    	  CheckDate(40)
            }
    
    	void CheckDate(int Month)
    	{
    	  if (Month > 31)
    	  {
    	    return;
    	  }
    
    	  puts("Month is valid");
            }
    


    See also:

    The exit function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/TECHNIC/0000777000076400001440000000000007474405230013564 5c_cpp_reference-2.0.2/reference/C/TECHNIC/Makefile.am0000644000076400001440000000021707055334710015533 EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/TECHNIC/Makefile.in0000644000076400001440000002371507474405126015561 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/TECHNIC mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/TECHNIC/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/TECHNIC/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/TECHNIC/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=technic.html itter_rec.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/TECHNIC/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/TECHNIC/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/TECHNIC/technic.html0000644000076400001440000000167407055334710016012 C Technique and Style.


    C Technique and Style

    This section will probably generate some discussion! Its main aim is to make you aware of some areas that can cause problems. These areas can be avoided with good technique...

    Top Master Index C Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/TECHNIC/itter_rec.html0000644000076400001440000000235207055334710016347 Iteration vs Recursion.

    Iteration vs Recursion

    Most problems that can be solved with iteration ( for, while, do loops) can also be solved with recursion. Pros and cons are:
    • Iteration code will be faster and will use less resources.
    • Recursion normaly looks more like the original formula.
    Anyway up, as an example of both technics here is some code to give the factorial of a number. Iteration------ Recursion

    Top Master Index C Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/LIBRARIES/0000777000076400001440000000000007474405225014027 5c_cpp_reference-2.0.2/reference/C/LIBRARIES/syscalls.htm0000644000076400001440000000300207055334501016276 System calls and library calls

    System calls and library calls


    I have wondered for sometime what the difference is between system calls (found in section 2 of the man pages) and library calls (in section 3). Its simple...

    • system calls are provided by the system and are executed in the system kernel. They are entry points into the kernel and are therefore NOT linked into your program. These are not portable calls.
    • Library calls include the ANSI C standard library and are therefore portable. These functions are linked into your program.
    It is worth noting that, because system calls are part of the O/S. The program has to make a context switch to the kernel when they are called and because of this, they have a high startup overhead. The upside is that the time executing these routines is assigned to the OS and not the user program.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/LIBRARIES/Makefile.am0000644000076400001440000000021707055334501015770 EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/LIBRARIES/Makefile.in0000644000076400001440000002374507474405126016023 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/LIBRARIES mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/LIBRARIES/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/LIBRARIES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/LIBRARIES/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=dynamic.htm libraries.html syscalls.htm DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/LIBRARIES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/LIBRARIES/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/LIBRARIES/dynamic.htm0000644000076400001440000000225007055334501016071 User created dynamic libraries


    User created dynamic libraries


    Wot is a dynamic library? I hear you ask! Well its a collection of your functions, that, when placed into a library are available to all the programs you write.

    This is what Chris Sawtell has to say about libraries.

    These are two types of library, static and dynamic. dynamic libraries are the prefered alternative, unfortuanatly I have not got around to documenting them......


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/LIBRARIES/libraries.html0000644000076400001440000000535107055334501016602 User created libraries/archives


    User created libraries/archives


    Wot is a user library? I hear you ask! Well, its a collection of your functions, that, when placed into a library are available to all the programs you write.

    This is what Chris Sawtell has to say about libraries.

    There are two types of library, dynamic and static. Although dynamic libraries are the prefered alternative (because they are not linked into your program), here is the method required to create static libraries....

    There are several steps required in creating a library.

    • Create a function.
    • Create an object module of the function.
    • Add the object module to the library/archive.
    • Compile a program that uses the library/archive.

    Here are the four steps in UNIX terms. The function is called reverse and the library is called mart.

    
     vi reverse.c			     # write your function (no main). 
     gcc -c reverse.c		     # -c just compiles (no link).
     ar -q  libmart.a reverse.o	     # -r == if nessasary replace 
             			     #       an existing function.
     gcc program.c -lmart -L/home/leslim # -l == library to search
    				     # -L == Location of the library.
    

    A few notes:

    • reverse.c should NOT contain a main.
    • A header file containing the prototype for reverse.c is required.
    • I expected to be able to add /home/leslim to LD_LIBRARY_PATH but gcc does not seem to look at this variable for its list of libraries.
    • If you dont want to use the -L option you will have to place your library in a directory like /usr/lib.
    • DONT LOOSE THE SOURCE! You cant rebuild the source from the object module. If you want to make a change at a later date you will want the source.

    Other usefull commands:
    • ar -t libmart.a == List the Objects in a library.


    See Also:


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/PROBLEMS/0000777000076400001440000000000007474405230013732 5c_cpp_reference-2.0.2/reference/C/PROBLEMS/fractions.c0000644000076400001440000000771707055333567016026 /************************************************************************ * Author: M.J. Leslie * Purpose: Add two fractions together. * Date: 04-Oct-94 ************************************************************************/ /******************* Structures *****************************************/ /* Define a structure to hold the * fraction */ struct fract { int num; /* Numerator */ int den; /* Denominator */ }; /******************* Declare Functions **********************************/ void print_title(void); /* O/P the title information. */ /* Get the fraction from the * user. */ void read_fract(struct fract *); /* Add fractions by passing the * whole structure to the function. */ struct fract add_fraction1(struct fract, struct fract); /* Add fractions by passing * pointers to the structures. */ void add_fraction2(struct fract *, struct fract *, struct fract *); /* Print fractions */ void print_fraction(char *, struct fract fraction, char *); /****************** Main ************************************************/ main () { /* Declare the structures that * hold the fractions */ struct fract fract1, fract2, out_fract; print_title(); /* airy-fairy title */ /* Get the fraction values * from the user */ read_fract(&fract1); read_fract(&fract2); puts("\n Passing structure to function gives:"); print_fraction(" ",fract1, " + "); print_fraction("",fract2, " = "); /* add the fractions together */ out_fract = add_fraction1(fract1, fract2); print_fraction("",out_fract, "\n"); puts("\n Passing structure pointers to function gives:"); print_fraction(" ",fract1, " + "); print_fraction("",fract2, " = "); add_fraction2(&fract1, &fract2, &out_fract); print_fraction("",out_fract, "\n"); return(1); } /************************************************************************/ void print_title(void) { puts("\n This is a C education program that will add fractions."); puts(" It demonstrates the technic of copying structures to "); puts(" functions and copying pointers to structures to functions."); puts("\n As a by-product the program will ask for two fractions"); puts(" that are added together and the result put on the screen"); puts(" "); } /************************************************************************/ void read_fract(struct fract *fract) { char value[80]; puts(" "); printf(" Please enter the numerator ===> "); gets(value); fract->num = atoi(value); printf(" Please enter the denominator => "); gets(value); fract->den = atoi(value); } /************************************************************************/ struct fract add_fraction1(struct fract f1, struct fract f2) { struct fract answer; /* get the comman denominator */ answer.den = f1.den * f2.den; /* sort out the numerators */ f1.num = (answer.den / f1.den) * f1.num; f2.num = (answer.den / f2.den) * f2.num; /* Add up the numerators */ answer.num = f1.num + f2.num; return (answer); } /************************************************************************/ void add_fraction2(struct fract *f1, struct fract *f2, struct fract *answer) { /* Use temps so we do not corrupt * The original values of f1 and * f2 */ int temp1, temp2; /* get the comman denominator */ answer->den = f1->den * f2->den; /* sort out the numerators */ temp1 = (answer->den / f1->den) * f1->num; temp2 = (answer->den / f2->den) * f2->num; /* Add up the numerators */ answer->num = temp1 + temp2; } /************************************************************************/ void print_fraction(char * string1, struct fract fraction, char * string2) { /* Format the fraction with * information strings around it */ printf("%s%d/%d%s", string1, fraction.num, fraction.den, string2); } c_cpp_reference-2.0.2/reference/C/PROBLEMS/whiteball.gif0000644000076400001440000000032707055333572016316 GIF89a3瞞YYY߶aaaIIIqqqiii!,T di0tª@Fp8nGh<$ʑ`aX4 `9N$xHDܖEBy"!;c_cpp_reference-2.0.2/reference/C/PROBLEMS/numtest.c0000644000076400001440000000213707055333562015517 /************************************************************************** * * Purpose: find the smallest and largest numbers from a sequence of numbers. * to do: Change it so it will take any number of numbers from the keyboard. * Author: M. J. Leslie * Date: 04-Apr-94 * **************************************************************************/ #include #define MAX_NUM 4 float bignum (float, float); float littlenum(float, float); main() { float numbers[MAX_NUM]= {0}; float biggest=0, littlest=999; int count; puts("Please enter 4 numbers"); scanf("%f %f %f %f", &numbers[0], &numbers[1], &numbers[2], &numbers[3]); for (count = 0; count < MAX_NUM; count++) { biggest = bignum(numbers[count], biggest); littlest = littlenum(numbers[count], littlest); } printf("Biggest number is %f\n", biggest); printf("Littlest number is %f\n", littlest); } float bignum( float num1, float num2) { if ( num1 > num2) return num1; else return num2; } float littlenum( float num1, float num2) { if ( num1 < num2) return num1; else return num2; } c_cpp_reference-2.0.2/reference/C/PROBLEMS/calender.c0000644000076400001440000001123107055333565015573 /* * Purpose: To generate a calender. * Author: M J Leslie * Date: 19-Mar-94 */ #include #define TRUE 1 #define FALSE 0 #define DAYS_IN_A_WEEK 7 #define MAX_COLS 6 #define BASE_YEAR 1990 /* Year from which all calculations are done. */ /* Function declatations */ int calender_month(const int month, const int year); int start_day(const int month, const int year); int leap(int); /* Global variables. */ int days_in_month[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; main(int argc, char *argv[]) { int i; /* General purpose var */ int year; /* year to start display */ int num_of_months; /* Number of months */ int start_month; /* Start month */ int month; /* Current month */ char *prog=argv[0]; /* Program name */ /* Check we have the program name and 3 parms */ if ( argc != 4) { puts("\tProgram syntax:"); printf("\t\t%s start_month start_year num_of_months",prog ); exit(1); } /* Dont bother checking if the parms are integers!! */ /* Put command line parms into meaningfull variable names */ start_month = atoi(argv[1]); year = atoi(argv[2]); num_of_months = atoi(argv[3]); /* AND OFF WE GO... */ month = start_month; for (i=start_month; i < start_month + num_of_months ; i++) { calender_month(month, year); /* O/P one month. */ if ( month++ >= 12) /* Q. End of year? */ { /* Yes. */ month = 1; year++; } } } /************************************************************************/ /* Calender_month */ /* Display one calender month. */ /************************************************************************/ calender_month(const int month, const int year) { int i,j,count; /* General Purpose variables. */ /* dont forget - arrays start at zero */ char *days[]= { " ", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sun" }; char *months[]= { " ", "January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; int month_map[8][MAX_COLS+1]={0}; /* init array with zeros */ j=start_day(month, year); /* Get the day the month starts */ /* Build the calender values */ i=1;count=0; while ( days_in_month[month] > count) { month_map[j++][i]=++count; /* Build the table. */ /* Start a new week. */ if ( j > DAYS_IN_A_WEEK) { j=1; i++; } } /* O/P Title bar. */ printf("\n\t\t%s %d\n\n",months[month], year); /* O/P the calender */ for (j=1; j<=DAYS_IN_A_WEEK; j++) { printf("\t%s ",days[j]); /* Day names */ for (i=1; i<=MAX_COLS; i++) { if ( month_map[j][i] == 0 ) /* dates */ {printf (" ");} else {printf ("%2d ", month_map[j][i]);} } puts (""); /* puts supplies a Newline */ } } /************************************************************************/ /* Start_day */ /* Work out which day the month starts on. */ /************************************************************************/ int start_day(const int month, const int year) { int day=1; /* 1/1/1990 was a Monday. */ int i,j; /* GP work variable. */ /* Count days in the year. */ i = BASE_YEAR; while ( i < year ) { leap(i); /* Check for leap years */ for (j=1; j<=12; j++) day = day + days_in_month[j]; i++; } /* Count upto the month required */ i=1; leap(year); /* Check for leap years */ while ( i < month ) { day = day + days_in_month[i++]; } /* Get modulo and return it as the start day for this month */ if ( (day = day%7) == 0 ) day = 7; /* correct 0 to 7 */ return ( day ); } /************************************************************************/ /* leap */ /* Find leap years. */ /* Returns 0 - Not a leap year. */ /* 1 - leap year. */ /************************************************************************/ int leap(int year) { /* A leap year follows the following rules: if divisable by 4 and not 100 its a leap year. if divisable by 400 it is a leap year. */ if ( (year%4 == FALSE && year%100 != FALSE) || year%400 == FALSE ) { days_in_month[2] = 29; return(1); /* leap year */ } else { days_in_month[2] = 28; return(0); /* NOT a leap year */ } } c_cpp_reference-2.0.2/reference/C/PROBLEMS/yesterday.c0000644000076400001440000000513207055333572016030 /************************************************************************ * * Purpose: By default, display yesterdays date. * If a number is given on the command line, it is subtracted * from todays date and the result printed. * * Author: M.J. Leslie. * * Date: 10-Jan-95 * ************************************************************************/ #include #include #include #include #define DAYS 1 /* Validate the command line * parmeters */ int check_parm(int argc, char *argv[]); /************************************************************************/ main(int argc, char *argv[]) { time_t seconds; const int one_day = 86400; /* Number of seconds in a day */ int days=DAYS; /* Number of days to subtract. */ /* Checkout the cmd line parms */ if (check_parm( argc, argv)) { /* Data is OK. * Override the default. */ days = atoi(argv[1]); } /* Get current calendar time. * This is the number of seconds * since 1-jan-1970 */ time(&seconds); /* Subtract the required number * of days. */ seconds -= one_day*days; /* Return the required date. */ printf("%s", ctime(&seconds)); /* All done - time to go home. */ exit(1); } /************************************************************************ * * Validate the data enter on the command line. * ************************************************************************/ int check_parm(int argc, char *argv[]) { if (argc > 1 ) /* Q. Have we got parms? */ { if ( !strcmp("-h", argv[1])) /* Q. Help requested? */ { /* Y. */ printf("%s will return the date of a passed day.", argv[0]); puts("\nFor example:"); printf("\t%s \tReturns yesterdays date.\n", argv[0]); printf("\t%s 1 \tReturns yesterdays date.\n", argv[0]); printf("\t%s 365\tReturns the date one year ago.\n\n", argv[0]); exit(0); } /* Do a simple check to validate * the I/P data - not 100% reliable */ if (!isdigit(*argv[1])) { /* Data naff. * End the program. */ printf("%s: Numeric value required.\n", argv[0]); printf("\n\tTry: %s -h for some info.\n\n", argv[0]); exit(0); } return(1); } return(0); } c_cpp_reference-2.0.2/reference/C/PROBLEMS/ljust.c0000644000076400001440000000003607055333572015156 main() { int*a=0; *a=1; } c_cpp_reference-2.0.2/reference/C/PROBLEMS/unix2dos.c0000644000076400001440000000147307055333560015573 /************************************************************************* * * problem: Convert Unix files to DOS format. * Method: Program scans for hex '0A' (LF) and replaces it with hex '0D0A' (CRLF) * todo: Prompt the user for a filename, and check it exists. * Author: M J Leslie * Date: 12-Mar-94 * *************************************************************************/ #include /* printf, putchar, fopen, fclose */ #define LF 10 #define CR 13 #define FILENAME "unix2dos.c" main() { FILE *fptr; /* Pointer to file */ char ch; /* File buffer */ fptr = fopen(FILENAME, "r"); while ( (ch = fgetc(fptr)) != EOF ) /* read characters until EOF */ { if ( ch == LF ) printf("%c", CR); /* add CR if we see an LF */ putchar(ch); /* write byte */ } fclose(fptr); } c_cpp_reference-2.0.2/reference/C/PROBLEMS/problems.html0000644000076400001440000001634407055333564016374 C programming problems


    C programming problems


    Here are few problems to try out your C skills on. 


    Produce a multiplication table. Top left hand corner will show 1x1 and bottom right shows 12x12, as below.
        1   2   3   4   5   6   7   8   9  10  11  12 
        2   4   6   8  10  12  14  16  18  20  22  24 
        3   6   9  12  15  18  21  24  27  30  33  36 
        4   8  12  16  20  24  28  32  36  40  44  48 
        5  10  15  20  25  30  35  40  45  50  55  60 
        6  12  18  24  30  36  42  48  54  60  66  72 
        7  14  21  28  35  42  49  56  63  70  77  84 
        8  16  24  32  40  48  56  64  72  80  88  96 
        9  18  27  36  45  54  63  72  81  90  99 108 
       10  20  30  40  50  60  70  80  90 100 110 120 
       11  22  33  44  55  66  77  88  99 110 121 132 
       12  24  36  48  60  72  84  96 108 120 132 144
    Answer 1
    Answer 2 
    Produce an Ascii convertion table.
    Answer 1
    Answer 2 
    Convert unix files to DOS format.
    Unix records are terminated with x'0a'
    DOS records are terminated with x'0d0a'
    Answer 
    'for' problem. Count from 1 to 32 and list the range of unsigned integer numbers that can be stored in each collection of bits. I.E 8 bits can hold the range 0 to 255.
    Answer 
    Random numbers. Produce a sequence of six random numbers between 1 and 49. These can then be used to play the National lottery (in England). The odds on getting the right numbers are 13,983,816 to 1 - GOOD LUCK SUCKER.
    Answer should look like:
            Possible winning ticket numbers are 7 8 9 33 34 43

    Take the previous 'lotto' program and add code so duplicate numbers are filtered out and the results are sorted (use qsort).
    Answer 
    Here is a problem you can solve with an integer array. Generate the Fibonacci sequence. Starting with 0, 1 add them up then take the result and add it to the last number and repeat.
    Answer should look like:
    0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181
    Answer taken from 'Practical C' from O'Reilly and Associates. 
    Functions - write a program that calls bignum() and littlenum() which determine, respectively, the highest and the smallest of a sequecnce of numbers read in from the terminal.
    Answer 


    Structures - Use structures to add two fractions together.
    Answer 
    Write a calendar program
    Answer



    Print the name of the program thats executing.
    Answer 
    Produce a program that will display a file in hex format as below. Most versions of Unix have 'od' but this dump format is more usefull.
       20 2A 20 68 65 78 5F 63 68 61 72 28 63 68 61 72     * hex_char(char
       20 2A 70 6F 73 69 74 69 6F 6E 2C 20 63 68 61 72     *position, char
       20 63 29 0A 20 20 20 7B 0A 20 20 20 73 70 72 69     c).   {.   spri
       6E 74 66 28 70 6F 73 69 74 69 6F 6E 2C 20 22 25    ntf(position, "%
       30 32 58 20 22 2C 20 63 29 3B 20 0A 0A 09 09 09    02X ", c); .....
    Answer 
    Print yesterdays date. You can use the ANSI standard functions 'time' and 'ctime'. An example of the O/P from my program is.
            Fri Mar 17 18:46:47 1995
    Answer 
    Display a byte in binary format. For example:
            55 == 00110111
    Things like << <<= & can be used to solve this problem.
    Answer

    Top Master Index C Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/PROBLEMS/bits.c0000644000076400001440000000232307055333560014754 #include #include main () { long int i=1,j=i; /* title */ puts("Bits\tRange"); puts("----\t-----"); /* O/P data and calc the next * set of values */ for (i=1; i<=32; i++) { printf("%2ld\t0-%12lu\n", i, j*=2); } } /************************************************************************ * Bits Range * ---- ----- * 1 0- 1 * 2 0- 3 * 3 0- 7 * 4 0- 15 * 5 0- 31 * 6 0- 63 * 7 0- 127 * 8 0- 255 * 9 0- 511 * 10 0- 1023 * 11 0- 2047 * 12 0- 4095 * 13 0- 8191 * 14 0- 16383 * 15 0- 32767 * 16 0- 65535 * 17 0- 131071 * 18 0- 262143 * 19 0- 524287 * 20 0- 1048575 * 21 0- 2097151 * 22 0- 4194303 * 23 0- 8388607 * 24 0- 16777215 * 25 0- 33554431 * 26 0- 67108863 * 27 0- 134217727 * 28 0- 268435455 * 29 0- 536870911 * 30 0- 1073741823 * 31 0- 2147483647 * 32 0- 4294967295 */ c_cpp_reference-2.0.2/reference/C/PROBLEMS/Makefile.am0000644000076400001440000000021507055333573015705 EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) $(wildcard *.c) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/PROBLEMS/Makefile.in0000644000076400001440000002421007474405126015716 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) $(wildcard *.c) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/PROBLEMS mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/PROBLEMS/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/PROBLEMS/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/PROBLEMS/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=fractions.c lotto2.c problems.html unix2dos.c ascii1.c times1.c numtest.c ascii2.c array_prob.c bits.c times2.c yesterday.c computer.gif times3.c whiteball.gif binary_op.c ljust.c calender.c lotto1.c hexdump1.c DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/PROBLEMS/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/PROBLEMS/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/PROBLEMS/ascii1.c0000644000076400001440000000070707055333572015173 /************************************************************************ * * problem: Display an Ascii table. Basic version * Author: M J Leslie * Date: 12-Mar-94 * ************************************************************************/ #include /* printf, putchar, fopen, fclose */ main() { int count; for (count=0; count<=127; count++) { printf("%2x %c \n", count, count); /* O/P hex and character formats */ } } c_cpp_reference-2.0.2/reference/C/PROBLEMS/ascii2.c0000644000076400001440000000376407055333561015200 /************************************************************************ * * problem: Display an Ascii table. Fab version * Author: M J Leslie * Date: 12-Mar-94 * ************************************************************************/ #include /* printf, putchar, fopen, fclose */ /* Function declarations */ int ascii(int); main() { ascii('h'); /* ascii table in Hex */ ascii('d'); /* ascii table in decimal */ ascii('r'); /* test invalid option */ } /************************************************************************* O/P an ascii table Parms: int - O/P type 'h' hex 'd' decimal any other value not allowed. Return codes: 0 = OK 1 = Invalid parms passed. *************************************************************************/ #define LINEBREAK 8 #define FALSE 0 #define TRUE 1 int ascii(int type) { int ascii, inc=0; char ch; /* 'ascii' in char format. */ char format[10]; /* Format statement for printf */ /* Are we to O/P in hex or decimal? h - hex d - decimal */ switch(type) { case 'h' : strcpy(format,"%02X %c "); /* hex */ break; case 'd' : strcpy(format,"%03d %c "); /* decimal */ break; default : printf("\n Function syntax:\n"); /* error */ printf(" ascii('h') for hex O/P\n"); printf(" ascii('d') for decimal O/P\n"); return(1); } /* O/P a table heading */ printf("\n\tAscii table"); printf("\n\t-----------\n\n"); /* O/P the table */ for (ascii=0; ascii<=127; ascii++) /* loop through the Ascii codes */ { /* Check that the character is printable... */ ch = ascii; if ( isprint(ch) == FALSE ) ch = ' '; /* Replace with ' ' if not printable */ printf(format, ascii, ch); /* O/P numeric and character format */ /* count # of codes O/P and insert L/F when required */ if ( ++inc%LINEBREAK == 0 ) printf("\n"); } return(0); } c_cpp_reference-2.0.2/reference/C/PROBLEMS/computer.gif0000644000076400001440000000063707055333572016205 GIF89a(,/OOp22R-ͅ?!,(,I8ͻ d Vg{:tsM&ݮq&]Kw=WX%]Q@l0,&j=ptȶ ogM@uwq{=~nz18me]c2RdycxrwdÇfӭ+w؇#D˥g=wD#|n$F1"A ;'pI ,0CMq /C+@h0ŏ#2PAbZT͋:SrC?D93EL˜T lX]e^v;c_cpp_reference-2.0.2/reference/C/PROBLEMS/array_prob.c0000644000076400001440000000145607055333561016162 /************************************************************************* * * Purpose: Numerical exercise with integer arrays. Starting with 0, 1 add * them up then take the result and add it to the last number and * repeat. * * For example: * * 0 + 1 = 1 * 1 + 1 = 2 * 1 + 2 = 3 * * Author: M. J. Leslie * Date: 04-Apr-94 * ************************************************************************/ #include #define ITTERATIONS 20 /* NO COMMENTS! can you figure it out? */ main() { int num[3]={0,1}; int count1, count2; printf("%d %d ", num[0], num[1]); for (count1=0; count1 < ITTERATIONS-2; count1++) { num[2] = num[0] + num[1]; printf("%d ",num[2]); for (count2 =0; count2 < 2; count2++) num[count2] = num[count2+1]; } puts(""); } c_cpp_reference-2.0.2/reference/C/PROBLEMS/times1.c0000644000076400001440000000235207055333561015220 /* * Purpose: To display the times table. * Author: M J leslie * Date: 26-Feb-94 */ main() { /* Define the variables */ int count1,count2; /* General purpose counters */ int value; /* result of a multiply calc */ for (count1 = 1 ; count1 <= 12 ; count1++) { for (count2 = 1 ; count2 <= 12 ; count2++) { value = count1 * count2; printf ("%3d ",value); } printf("\n"); } } /**************************************************************** * * Here is the O/P from the program. * * 1 2 3 4 5 6 7 8 9 10 11 12 * 2 4 6 8 10 12 14 16 18 20 22 24 * 3 6 9 12 15 18 21 24 27 30 33 36 * 4 8 12 16 20 24 28 32 36 40 44 48 * 5 10 15 20 25 30 35 40 45 50 55 60 * 6 12 18 24 30 36 42 48 54 60 66 72 * 7 14 21 28 35 42 49 56 63 70 77 84 * 8 16 24 32 40 48 56 64 72 80 88 96 * 9 18 27 36 45 54 63 72 81 90 99 108 * 10 20 30 40 50 60 70 80 90 100 110 120 * 11 22 33 44 55 66 77 88 99 110 121 132 * 12 24 36 48 60 72 84 96 108 120 132 144 * ****************************************************************/ c_cpp_reference-2.0.2/reference/C/PROBLEMS/times2.c0000644000076400001440000000123007055333560015212 /* Purpose: To display the times table. Fabber version with annotation. Author: M J leslie Date: 26-Feb-94 */ main() { /* Define the variables */ int count1,count2; /* General purpose counters */ int value; /* result of a multiply calc */ /* O/P a top bar */ printf(" "); for (count1 = 1 ; count1 <= 12 ; count1++) { printf ("%3d ",count1); } printf("\n\n"); /* O/P the table with a side bar. */ for (count1 = 1 ; count1 <= 12 ; count1++) { printf("%2d ",count1); for (count2 = 1 ; count2 <= 12 ; count2++) { value = count1 * count2; printf ("%3d ",value); } printf("\n"); } } c_cpp_reference-2.0.2/reference/C/PROBLEMS/times3.c0000644000076400001440000000020507055333561015215 #include main() { unsigned Inc; for (Inc=1; Inc <= 144; Inc++) { printf("%3d%c", Inc, (Inc%12)?' ':'\n'); } c_cpp_reference-2.0.2/reference/C/PROBLEMS/hexdump1.c0000644000076400001440000001275007055333571015555 /************************************************************************ * * Purpose: To display a file in (mainframe) dump format as shown below. * * 20 2A 20 68 65 78 5F 63 68 61 72 28 63 68 61 72 * hex_char(char * 20 2A 70 6F 73 69 74 69 6F 6E 2C 20 63 68 61 72 *position, char * 20 63 29 0A 20 20 20 7B 0A 20 20 20 73 70 72 69 c). {. spri * 6E 74 66 28 70 6F 73 69 74 69 6F 6E 2C 20 22 25 ntf(position, "% * 30 32 58 20 22 2C 20 63 29 3B 20 0A 0A 09 09 09 02X ", c); ..... * * Syntax: hexdump filename * * Method: The program fills a variable (line) with the data, when * the variable is full - it is sent to STDOUT. * Unprintable charcters are converted to '.' in the ASCII * display on the right. * * Bugs: If the last line of the dump is full, the program will * follow it with a blank line. Not exactly a serious bug * but you are welcome to fix it. * * To do: o Highlight '0A' (end of line) - seems like a good idea. * o Get it to read directories. * o Remove the directory info from argv[0] (if present). * o Add a column showing the byte offset. * * Author: M J Leslie * * Rev Date Comments * --- --------- -------- * 1.0 08-Feb-94 Inital Release. * * 1.1 12-May-95 Original only worked for the hex range 00-7F * This version supports 00-FF. * Thanks to Emmanuel Guyot for the fix. * ************************************************************************/ #include #define HEX_OFFSET 1 #define ASCII_OFFSET 51 #define NUM_CHARS 16 /************************************************************************/ void hexdump (char* prog_name, char * filename); /* Clear the display line. */ void clear_line (char *line, int size); /* Put a character (in hex format * into the display line. */ char * hex_char (char *position, int c); /* Put a character (in ASCII format * into the display line. */ char * ascii_char (char *position, int c); /************************************************************************/ main(int argc, char * argv[]) { char *prog_name="hexdump"; if (argc != 2) { printf("\n\t%s syntax:\n\n", argv[0]); printf("\t\t%s filename\n\n", argv[0]); exit(0); } hexdump( argv[0], argv[1]); } /************************************************************************ * * The program proper. * ************************************************************************/ void hexdump(char* prog_name, char * filename) { int c=' '; /* Character read from the file */ char * hex_offset; /* Position of the next character * in Hex */ char * ascii_offset; /* Position of the next character * in ASCII. */ FILE *ptr; /* Pointer to the file. */ char line[81]; /* O/P line. */ /* Open the file */ ptr = fopen(filename,"r"); if ( ferror(ptr) ) { printf("\n\t%s: Unable to open %s\n\n", prog_name, filename); exit(0); } /* little heading. */ printf("\n\tHex dump of %s\n\n", filename); /* Read one character at a time, * checking for the End of File. * EOF is defined in */ while (c != EOF ) { /* Prepare the variables. */ clear_line(line, sizeof line); hex_offset = line+HEX_OFFSET; ascii_offset = line+ASCII_OFFSET; while ( ascii_offset < line+ASCII_OFFSET+NUM_CHARS &&(c = fgetc(ptr)) != EOF ) { /* Build the hex part of * the line. */ hex_offset = hex_char(hex_offset, c); /* Build the Ascii part of * the line. */ ascii_offset = ascii_char(ascii_offset, c); } /* Display the current line */ printf("%s\n", line); } fclose(ptr); /* Close the file. */ } /************************************************************************ * * Clear the display line. * ************************************************************************/ void clear_line(char *line, int size) { int count; for (count=0; count < size; line[count]=' ', count++); } /************************************************************************ * * Put a character into the display line and return the location * of the next character. * ************************************************************************/ char * ascii_char(char *position, int c) { /* If the character is NOT printable * replace it with a '.' */ if (!isprint(c)) c='.'; sprintf(position, "%c", c); /* Put the character to the line * so it can be displayed later */ /* Return the position of the next * ASCII character. */ return(++position); } /************************************************************************ * * Put the hex value of a character into the display line and * return the location of the next hex character. * ************************************************************************/ char * hex_char(char *position, int c) { int offset=3; /* Format and place the character into * the display line. * (unsigned char) required for correct * O/P. */ sprintf(position, "%02X ", (unsigned char) c); *(position+offset)=' '; /* Remove the '/0' created by 'sprint' */ return (position+offset); } c_cpp_reference-2.0.2/reference/C/PROBLEMS/lotto1.c0000644000076400001440000000176007055333562015243 /************************************************************************ * * Purpose: First attempt at a lottery number selector. * Author: M.J. Leslie. * Date: 17-Nov-94 * Description: Any 6 random numbers from 1 to 49 are displayed. * Futures: Filter duplicates. * Sort the result. *************************************************************************/ #include #include #include #define NUMBERS 6 /************************************************************************/ main() { int num; printf("\n\nLOTTERY CRACKER V1.0\n"); printf("--------------------\n\n"); printf("\tPossible winning ticket number is "); /* New starting point * for the random numbers */ srand((unsigned int)time((time_t *)NULL)); /* Display any 6 numbers. * Duplicates are not filtered. */ for (num=0; num < NUMBERS; num++) { printf(" %02d", (rand()%49)+1); } puts(""); puts(""); } c_cpp_reference-2.0.2/reference/C/PROBLEMS/lotto2.c0000644000076400001440000000534407055333570015245 /************************************************************************ * * Purpose: Second crack at a lottery number selector. * Author: M.J. Leslie. * Date: 03-Dec-94 * Description: Any 6 random numbers from 1 to 49 are displayed. * Duplicates are removed and the results sorted. * ************************************************************************/ /********** Preprocessor ***********************************************/ #include #include #include #define NUMBERS 6 /********** Functions ***************************************************/ void display_nums(int *, int); int comp_nums(const int *, const int *); /************************************************************************/ main() { int num[NUMBERS]; /* array holding the selected * numbers */ int count; /* General counter */ printf("\n\nLOTTERY CRACKER V1.1\n"); printf("--------------------\n\n"); printf("\tPossible winning ticket number is "); /* New starting point * for the random number generator. */ srand((unsigned int)time((time_t *)NULL)); /* Collect Six numbers. * Filter out duplicats as we go. */ { int dup, count2; for (count=0; count < NUMBERS; count++) { num[count]=(rand()%49)+1; /* Get a number. */ dup=0; /* Set the duplicate flag to * NO DUPLICATES */ /* Test latest number with the ones * already held. */ for (count2=0 ; count2 < count; count2++) { /* If match found - set flag. */ if (num[count] == num[count2]) dup++ ; } /* If flag set - reset the array * index so we overwrite the current * number. */ if (dup > 0 ) count--; } } /* Sort the numbers */ qsort( num, /* Pointer to elements */ NUMBERS, /* Number of elements */ sizeof(int), /* size of one element. */ (void *)comp_nums /* Pointer to comparison function */ ); display_nums(num, NUMBERS); /* Display the results */ } /************************************************************************ * * comp_nums: Compare two numbers. * ************************************************************************/ int comp_nums(const int *num1, const int *num2) { return (*num1 - *num2); } /************************************************************************ * * display_nums: Display the numbers * ************************************************************************/ void display_nums(int *array, int count) { /* Print all the elements of * the array. */ while ( count-- ) { printf("%d ",*array); array++; } puts(""); puts(""); } c_cpp_reference-2.0.2/reference/C/PROBLEMS/binary_op.c0000644000076400001440000000230607055333572016001 /************************************************************************ * * Purpose: Display a byte in binary format. * * Author: M.J. Leslie. * * Date: 19-Mar-95 * * Improvements: * 1) Return the result to the calling function. * 2) Make it work on integers (4 bytes long). * ************************************************************************/ void binary_op(char byte); /* Print a byte in binary. */ /************************************************************************/ main() { char byte=55; binary_op(byte); /* Print a byte in binary. */ } /************************************************************************/ void binary_op(char byte) { int count=8; /* Number of bits in a byte. */ while(count--) { /* AND the high order bit (the * left one) If the bit is set, * print a ONE. */ printf("%d", ( byte & 128 ) ? 1 : 0 ); /* Move all the bits LEFT. */ byte <<= 1; } printf("\n"); } /************************************************************************ * * Program results. * ---------------- * * 00110111 * ************************************************************************/ c_cpp_reference-2.0.2/reference/C/c.html0000644000076400001440000000310307055333525013532 C Programming Reference Introduction.

    C Programming Reference Introduction.


    This document is an attempt at producing a reference guide for the C programming language. To date, I have found several C tutorials and lessons on the net but no reference documents. This is not an attempt to replace the many high quality books available, but does try to provide an on-line reference that can give answers to questions quickly and without hasle.

    As usual, here is a disclaimer.

    Every effort has been made to ensure all information and examples are correct BUT no guarantee is implied or intended.

    o C Reference starts here.



    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/EXAMPLES/0000777000076400001440000000000007474405223013727 5c_cpp_reference-2.0.2/reference/C/EXAMPLES/single_array.c0000644000076400001440000000122107055334576016471 int function1(char* array); main() { /* The array MUST be initalised otherwise the pointer will not be defined. */ /* We have one less so the \0 will fit */ char array1[10]="987654321"; function1(array1); /* Pass the pointer to the array */ printf("%s\n", array1); /* O/P the altered array. */ } /************************************************************************/ function1(char * array) { /* Pass a pointer to the string.*/ printf("%s\n", array); array +=4; /* Modify the pointer. */ *array = 'x'; /* Modify the data pointed to by 'array' */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/do.c0000644000076400001440000000103507055334571014412 /************************************************************************ * * Purpose: Program to demonstrate the 'do' statement. * Author: M J Leslie * Date: 26-Jan-94 * ************************************************************************/ #include main() { int i=1; /* Define an integer variable. */ /* * The block is executed. Then the i <= 10 * expression is evaluated. If TRUE the block * is executed again. */ do { printf ("i is %i\n", i); i++; } while (i <= 10); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/if.c0000644000076400001440000000110607055334571014405 /**************************************************************** * * Purpose: Program to demonstrate the 'if' statement. * Author: M J Leslie * Date: 26-Feb-94 * ****************************************************************/ #include main() { int i=1; /* Define an integer variable. */ /* * i == 1 expression is evaluated. If TRUE the * first block is executed. * if i == 1 is FALSE the optional else block * is executed */ if (i == 1) { puts ("i is equal to 1\n"); } else { puts("i is NOT equal to 1"); } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/or.c0000644000076400001440000000173507055334613014434 /**************************************************************************** * * Purpose: To show the effect of a bitwise OR (|) by converting * an ASCII character to its graphic extension equivalent. * Author: M.J. Leslie. * Date: 04-Mar-95 * ****************************************************************************/ main() { /* Hex 66 (f) looks like this in binary * * 0110 0110 */ unsigned char value='\x66'; /* Hex 80 looks like this in binary * * 1000 0000 */ printf("%2X %2X \n", value, (value | (unsigned char)'\x80')); /* A bitwise OR has the effect of * adding wanted bits. * * 0110 0110 (66) OR * 1000 0000 (80) * --------- * 1110 0110 (E6) */ } /**************************************************************************** * * Program results are: * * 66 E6 * ****************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/read_file.c0000644000076400001440000000153107055334572015724 /************************************************************************ * * Purpose: To display a file on the screen (Unix 'cat' command). * Version 1 * * to do: Read file name from command line. * * Author: M J Leslie * Date: 06-Feb-94 * ************************************************************************/ #include main() { int c; /* Character read from the file. */ FILE *ptr; /* Pointer to the file. FILE is a structure defined in */ /* Open the file - no error checking done */ ptr = fopen("/etc/hosts","r"); /* Read one character at a time, checking for the End of File. EOF is defined in as -1 */ while ((c = fgetc(ptr)) != EOF) { printf("%c",c); /* O/P the character to the screen */ } fclose(ptr); /* Close the file. */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/linklst1.c0000644000076400001440000001513607055334622015555 /************************************************************************ * * Purpose: To demonstrate 'linked lists' This program will build a * linked list and place data into it. When the data is exausted * the contents of the list are O/P. * * This is a "First in First out" (FIFO) list. * * Author: M. J. Leslie * * Date: 11-May-95 * ************************************************************************/ #include /* malloc */ /************************************************************************/ struct x { /* Declare a structure */ char name[20]; int age; struct x *next_rec; }; /************************************************************************/ main() { struct x *start_pointer; /* Define pointers to the structure */ struct x *next_pointer; /* Create some data to be placed in the * Linked list. */ char *names[]= { "Martin", "John ", "Alex ", "" }; int ages[]={32, 43, 29, 0}; int count=0; /* General purpose counter. */ /*===================================================================* = = = Build a LINKED LIST and place data into it. = = = *===================================================================*/ /* Initalise 'start_pointer' by reserving * memory and pointing to it */ start_pointer=(struct x *) malloc (sizeof (struct x)); /* Initalise 'next_pointer' to point * to the same location. */ next_pointer=start_pointer; /********************************************************************* * * start_pointer --- * | * | * V * ----------------- * | | | | * ----------------- * A * | * | * next_pointer --- * *********************************************************************/ /* Put some data into the reserved * memory. */ strcpy(next_pointer->name, names[count]); next_pointer->age = ages[count]; /********************************************************************* * * start_pointer --- * | * | * V * ----------------- * |Martin | 32 | | * ----------------- * A * | * | * next_pointer --- * *********************************************************************/ /* Loop until all data has been read */ while ( ages[++count] != 0 ) { /* Reserve more memory and point to it */ next_pointer->next_rec=(struct x *) malloc (sizeof (struct x)); /****************************************************************** * * start_pointer --- * | * | * V * ----------------- * |Martin | 32 | | | * ---------------|- * A | * | V * | --------------- * next_pointer --- | | * --------------- * ******************************************************************/ next_pointer=next_pointer->next_rec; /****************************************************************** * * start_pointer --- * | * | * V * ----------------- * |Martin | 32 | | | * ---------------|- * | * V * --------------- * next_pointer --------------->| | * --------------- * ******************************************************************/ strcpy(next_pointer->name, names[count]); next_pointer->age = ages[count]; /****************************************************************** * * start_pointer --- * | * | * V * ----------------- * |Martin | 32 | | | * ---------------|- * | * V * ---------------- * next_pointer --------------->|John | 43 | | * ---------------- * ******************************************************************/ } next_pointer->next_rec=NULL; /*===================================================================* = = = Traverse the linked list and O/P all the data within it. = = = *===================================================================*/ next_pointer=start_pointer; /****************************************************************** * * start_pointer --- * | * | * V * ----------------- * |Martin | 32 | | | * ---------------|- * A | * | V * | ---------------- * next_pointer --- |John | 43 | | * ---------------- * ******************************************************************/ while (next_pointer != NULL) { printf("%s ", next_pointer->name); printf("%d \n", next_pointer->age); next_pointer=next_pointer->next_rec; /****************************************************************** * * start_pointer --- * | * | * V * ----------------- * |Martin | 32 | | | * ---------------|- * | * V * ---------------- * next_pointer --------------->|John | 43 | | * ---------------- * ******************************************************************/ } } /************************************************************************ * * Program results. * * Martin 32 * John 43 * Alex 29 * ************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/linklst2.c0000644000076400001440000000525007055334615015554 /************************************************************************ * * Purpose: To demonstrate 'linked lists' This program will build a * linked list and place data into it. When the data is exausted * the contents of the list are O/P. * * This is a "First in First out" (FIFO) list. * * Author: M. J. Leslie * * Date: 11-May-95 * ************************************************************************/ #include /* malloc */ /************************************************************************/ struct x { /* Declare a structure */ char name[20]; int age; struct x *next_rec; }; /************************************************************************/ main() { struct x *start_pointer; /* Define pointers to the structure */ struct x *next_pointer; /* Create some data to be placed in the * Linked list. */ char *names[]= { "Martin", "John ", "Alex ", "" }; int ages[]={32, 43, 29, 0}; int count=0; /* General purpose counter. */ /*===================================================================* = = = Build a LINKED LIST and place data into it. = = = *===================================================================*/ /* Initalise 'start_pointer' by reserving * memory and pointing to it */ start_pointer=(struct x *) malloc (sizeof (struct x)); /* Initalise 'next_pointer' to point * to the same location. */ next_pointer=start_pointer; /* Put some data into the reserved * memory. */ strcpy(next_pointer->name, names[count]); next_pointer->age = ages[count]; /* Loop until all data has been read */ while ( ages[++count] != 0 ) { /* Reserve more memory and point to it */ next_pointer->next_rec=(struct x *) malloc (sizeof (struct x)); next_pointer=next_pointer->next_rec; strcpy(next_pointer->name, names[count]); next_pointer->age = ages[count]; } next_pointer->next_rec=NULL; /*===================================================================* = = = Traverse the linked list and O/P all the data within it. = = = *===================================================================*/ next_pointer=start_pointer; while (next_pointer != NULL) { printf("%s ", next_pointer->name); printf("%d \n", next_pointer->age); next_pointer=next_pointer->next_rec; } } /************************************************************************ * * Program results. * * Martin 32 * John 43 * Alex 29 * ************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/linklst3.c0000644000076400001440000000546007055334616015561 /************************************************************************ * * Purpose: To demonstrate 'linked lists' This program will build a * linked list and place data into it. When the data is exausted * the contents of the list are O/P. * This example shows the use of 'typedef' on linked lists. * * This is a "First in First out" (FIFO) list. * * Author: M. J. Leslie * * Date: 11-May-95 * ************************************************************************/ #include /* malloc */ /************************************************************************/ /* Declare a structure and give it a * data type name with 'typdef' */ typedef struct x { char name[20]; int age; struct x *next_rec; } linklist; /************************************************************************/ main() { linklist *start_pointer; /* Define pointers to the structure */ linklist *next_pointer; /* Create some data to be placed in the * Linked list. */ char *names[]= { "Martin", "John ", "Alex ", "" }; int ages[]={32, 43, 29, 0}; int count=0; /* General purpose counter. */ /*===================================================================* = = = Build a LINKED LIST and place data into it. = = = *===================================================================*/ /* Initalise 'start_pointer' by reserving * memory and pointing to it */ start_pointer=(linklist *) malloc (sizeof (linklist)); /* Initalise 'next_pointer' to point * to the same location. */ next_pointer=start_pointer; /* Put some data into the reserved * memory. */ strcpy(next_pointer->name, names[count]); next_pointer->age = ages[count]; /* Loop until all data has been read */ while ( ages[++count] != 0 ) { /* Reserve more memory and point to it */ next_pointer->next_rec=(linklist *) malloc (sizeof (linklist)); next_pointer=next_pointer->next_rec; strcpy(next_pointer->name, names[count]); next_pointer->age = ages[count]; } next_pointer->next_rec=NULL; /*===================================================================* = = = Traverse the linked list and O/P all the data within it. = = = *===================================================================*/ next_pointer=start_pointer; while (next_pointer != NULL) { printf("%s ", next_pointer->name); printf("%d \n", next_pointer->age); next_pointer=next_pointer->next_rec; } } /************************************************************************ * * Program results. * * Martin 32 * John 43 * Alex 29 * ************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/pointer_func.c0000644000076400001440000000156307055334576016516 /************************************************************************ * * Purpose: Program to demonstrate passing a pointer to a scalar to * a function. * Author: M J Leslie. * Date: 11-Apr-94 * ************************************************************************/ void add(int*); /* Function declaration */ main() { int i=4; /* variable declaration */ int* ptr; /* int pointer */ ptr = &i; /* 'ptr' now contains the address of 'i' */ printf("i starts out life as %d.\n", i); printf(" *ptr is %d.\n", *ptr); add(ptr); /* Function call */ printf(" i is now %d.\n", i); } /************************************************************************/ void add(int *ptr) /* Function definition */ { ++*ptr; /* Add 1 to the value * pointed too by 'ptr' */ return; } c_cpp_reference-2.0.2/reference/C/EXAMPLES/reverse.c0000644000076400001440000000100307055334600015447 /********************************************************************* * * Purpose: Reverse characters in a string. * Author: K&R * Date: * *********************************************************************/ void reverse(char s[]); main() { char text[80]="martin"; printf("string is %s\n", text); reverse(text); printf("string is %s\n", text); } void reverse(char s[]) { int c, i, j; for (i=0, j=strlen(s)-1; i < j;i++, j--) { c = s[i]; s[i] = s [j]; s[j] = c; } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/const.c0000644000076400001440000000057107055334633015141 /****************************************************************** * * Purpose: Program to demonstrate const * Date: 03-Dec-96 * Author: M J Leslie. * Descrip: To be written. * ******************************************************************/ #include main() { const int Men=10; Men = 20; /* This will be failed by the compiler. */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/pointer2_func.c0000644000076400001440000000165607055334577016604 /* * Purpose: Program to demonstrate passing an int array to a function. * Author: M J Leslie. * Date: 14-Apr-94 */ void add(int swap[3][2]); /* Function declaration */ void display(int array[3][2]); /* Function declaration */ main() { int i[3][2]= { {1,2}, /* array declaration */ {3,4}, {5,6} }; display(i); /* i is a pointer */ add(i); display(i); } /***************************************************************/ void add(int swap[3][2]) /* Function definition */ { int temp,i; for (i=0; i<3; i++) { temp = swap[i][0]; swap[i][0] = swap[i][1]; swap[i][1] = temp; } return; } /***************************************************************/ void display(int array[3][2]) /* Function definition */ { int count=0,count1=0; for (count=0;count<3;count++) for (count1=0;count1<2;count1++) printf("%d ", array[count][count1]); puts(""); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/clrscr.c0000644000076400001440000000107107055334603015274 /************************************************************************* * * Purpose: Clear the screen with VT100 escape codes. This can be done * with conio.h on PCs - non standard code. Or curses.h, bit of * a fag... * Author: M.J. Leslie * Date: 22-Jun-94 * ************************************************************************/ void clrscr(void); main() { clrscr(); } void clrscr(void) { printf("\033[2J"); /* Clear the entire screen. */ printf("\033[0;0f"); /* Move cursor to the top left hand corner */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/bit_shift.c0000644000076400001440000000133607055334613015764 /*********************************************************************** * * Purpose: Show the 'shift right' operator. * * Author: M.J. Leslie. * * Date: 19-Mar-95 * ***********************************************************************/ main() { unsigned int bytes=256; /* 00000000 00000000 00000000 10000000 */ do { printf("%3d \n", bytes); bytes >>= 1; /* 00000000 00000000 00000000 01000000 */ } while (bytes); } /*********************************************************************** * * Program results. * ---------------- * * 256 * 128 * 64 * 32 * 16 * 8 * 4 * 2 * 1 * ***********************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/and.c0000644000076400001440000000207507055334612014553 /**************************************************************************** * * Purpose: To show the effect of a bitwise AND (&) by converting * an ASCII graphic extension into its character equivalent. * Author: M.J. Leslie. * Date: 04-Mar-95 * ****************************************************************************/ main() { /* * Hex E6 looks like this in binary * * 1110 0110 * * UNSIGNED is used to stop C using * first 1 as an indicator of the sign */ unsigned char value='\xE6'; /* Hex 7F looks like this in binary * * 0111 1111 */ printf("%2X %2X \n", value, (value & '\x7F')); /* A bitwise AND has the effect of * filtering unwanted bits. * * 1110 0110 (E6) AND * 0111 1111 (7F) * --------- * 0110 0110 (66) */ } /**************************************************************************** * * Program results are: * * E6 66 * ****************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/dir.c0000644000076400001440000000160107055334613014562 /************************************************************************ * * Purpose: List all files in the current directory. * Author: M J Leslie * Date: 15-Apr-95 * * Note: 1) This program uses NON ANSI STANDARD functions. You may * not find them on your platform. * 2) The file names are NOT stored in any particular order. * ************************************************************************/ #include /* Directory information. */ main() { DIR *dir_p; struct dirent *dir_entry_p; /* Open the current directory */ dir_p = opendir("."); /* read each entry until NULL. */ while( NULL != (dir_entry_p = readdir(dir_p))) { /* print the name of the file held in * this directory entry. */ printf(" %s \n", dir_entry_p->d_name); } /* Tidy up. */ closedir(dir_p); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/sprintf1.c0000644000076400001440000000144507055334636015565 /*********************************************************************** * * Purpose: Program to demonstrate the * flag limiting a string filed width * in a 'sprintf' statement. * * This example shows an alternative way of performing a strncpy. * * Author: M J Leslie * Date: 18-Mar-98 * ************************************************************************/ #include main() { char Dest[10] = ""; char Src[] = "Ski on Whistler Mountain"; /* Populate Dest */ memset (Dest, 0, sizeof(Dest)); sprintf (Dest, "%.*s", sizeof(Dest)-1, Src); /* Show the results. */ printf("Src string : %s\n", Src); printf("Dest string: %s\n", Dest); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/whiteball.gif0000644000076400001440000000032707055334636016313 GIF89a3瞞YYY߶aaaIIIqqqiii!,T di0tª@Fp8nGh<$ʑ`aX4 `9N$xHDܖEBy"!;c_cpp_reference-2.0.2/reference/C/EXAMPLES/strncpy.c0000644000076400001440000000231607055334624015514 /**************************************************************** * * Purpose: Program to demonstrate the 'strncpy' function. * Author: M J Leslie * Date: 03-Feb-96 * ****************************************************************/ #include /* strcpy */ void SafeCopy(char *Dest, int DestSize, char *Source); main() { char Text1[20]="Tracy Sorrell"; /* string buffer */ char Text2[10]="Martin"; /* string buffer */ printf (" Original string contents are: %s\n", Text2); SafeCopy(Text2, sizeof(Text2), Text1); printf (" New string contents are: %s\n", Text2); strcpy(Text2, "Alex"); printf (" Final string contents are: %s\n", Text2); } /****************************************************************/ void SafeCopy( char *Dest, /* Destination buffer. */ int DestSize, char *Source) /* Source data. */ { /* ... Copy 'Source' into 'Dest'. * ... 'Dest' is padded with NULLs if 'Source' is smaller.. */ strncpy(Dest, Source, DestSize); /* ... Safety net! Add the NULL just in case 'Source' is larger * ... than 'Dest'. */ Dest[DestSize-1] = '\0'; } c_cpp_reference-2.0.2/reference/C/EXAMPLES/Master.c0000644000076400001440000000036707055334614015250 /************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Jan-94 * ************************************************************************/ #include main() { } c_cpp_reference-2.0.2/reference/C/EXAMPLES/exec_one.c0000644000076400001440000000050107055334627015574 /**************************************************************** * * Purpose: Program to demonstrate the 'execl' function. * Author: M J Leslie * Date: 21-Apr-96 * ****************************************************************/ main(int argc, char *argv[]) { execl("exec_two", "exec_two", (char *) 0); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/exec_two.c0000644000076400001440000000053607055334627015634 /**************************************************************** * * Purpose: This program is executed by exec_one to demonstrate * the execl function. * Author: M J Leslie * Date: 21-Apr-96 * ****************************************************************/ main(int argc, char *argv[]) { printf("This is %s\n", argv[0]); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/strpbrk.c0000644000076400001440000000163307055334623015501 /* * field.c * * Dave Doolin 12 May, 1995 * * Turns miscellaneous field separators into just a space separating tokens for * easy parsing by SSCANF. Eventually, the character separators and * replacement character will be passed in as strings. * */ #include #include #include #define LINE_BUF 100 void find_comment(char *); main() { char line[LINE_BUF]; char *sep; int var1, var2; while (fgets(line, LINE_BUF, stdin)) { /* * Check this out: Since SEP is a pointer to type char, when line is * assigned to sep, really the first address is assigned to sep. LINE * is the address of the start of the string. In contrast, LINE[0] * is the first character of the string. */ sep = line; while (sep != 0) { sep = strpbrk(line, ";.&:,"); if (sep != 0) *sep = ' '; } fputs(line, stdout); } return 0; } c_cpp_reference-2.0.2/reference/C/EXAMPLES/address.c0000644000076400001440000000126407055334577015447 /************************************************************************ * * Purpose: Demonstrate the Unary '&' and '*' operators. * Unary & - Address of a variable. * Unary * - Data at the address. * * These are not to be confused with their binary equivalents * that perform bitwise AND and OR. * * Author: M J Leslie. * Date: 16-Apr-94 * ************************************************************************/ main() { int i=4; /* variable declaration */ int* ptr; /* int pointer */ ptr = &i; /* 'ptr' now contains the address of 'i' */ printf(" i is %d.\n", i); printf("*ptr is %d.\n", *ptr); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/basename.c0000644000076400001440000000206007055334625015562 /************************************************************************ * * Purpose: Extract the directory information from a file name. * * /etc/local/bin/fdmount --> fdmount * * This mimics the unix command 'basename'. * * Author: M J Leslie * Date: 29-Feb-96 * ************************************************************************/ #include char *basename(const char *FullName); main() { char *FullName = "/usr/local/bin/fdmount"; printf("Full name is %s \n", FullName); printf("File name is %s \n", basename(FullName)); } /************************************************************************/ char *basename(const char *FullName) { static char *File; /* ... I guess DOS users will have to change the direction of ... the slash. */ File = strrchr(FullName, '/'); /* ... If no slashes have been found, Return the full file name */ if (File == NULL) { File = FullName; } else { File++; } return(File); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/command_line.c0000644000076400001440000000175707055334573016452 /******************************************************************** * * Purpose: Demonstrate getting parameters from the command line. * Author: M J Leslie * Date: 27-Mar-94 * ********************************************************************/ #include main(int argc, char *argv[]) { int count; /* Main takes two variables 'argc' is the number of parms on the * command line and 'argv' is a pointer to each of the parameters. * * int argc -- integer number called 'argc' * char *argv[] -- Character pointer array! */ printf("%i parameters entered on the command line.\n", argc); /* * progname argc = 1 * progname parm1 parm2 argc = 3 */ /* * We take 1 from argc because * the argv array starts at zero * an ends at argc -1 */ for ( count = 0; count <= argc -1 ; count++) { /* printf expects a pointer * to the text */ printf("parm %d is %s\n", count, argv[count]); } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/ljust1.c0000644000076400001440000000133207055334634015232 #include #include void ljust(char *String); main() { char Str[]=" Martin "; puts("Function to left justify text."); printf("*%s*\n", Str); ljust(Str); printf("*%s*\n", Str); } /*****************************************************************/ void ljust( char *String) { int Pos; /* ... Keep looping until a non space ... character appears in the first byte. */ while(isspace(String[0])) { /* ... Move all the characters left one place. */ for(Pos=0; Pos < strlen(String)-1; Pos++) { String[Pos] = String[Pos+1]; } String[strlen(String)-1] = ' '; } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/switch.c0000644000076400001440000000204307055334575015315 /************************************************************************** * * Purpose: Program to demonstrate the 'switch/case' structure. * Method: Prog looks at the number of parameters passed to it and * tells the user how many its got. * Author: M J Leslie * Date: 09-Apr-94 * **************************************************************************/ main(int argc, char *argv[]) { switch (argc) /* Switch evaluates an expression (argc) */ { /* If expression resolves to 1, jump here */ case 1: puts("Only the command was entered."); break; /* break - cases the execution to jump out of the 'switch' block. */ /* If expression resolves to 2, jump here */ case 2: puts("Command plus one parm entered"); break; /* If expression resolves to 3, jump here */ case 3: puts("Command plus two parm entered"); break; /* Any other value jumps here. */ default: printf("Command plus %d parms entered\n", argc-1); break; } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/fprintf.c0000644000076400001440000000123207055334605015455 /************************************************************************ * * Purpose: To show fprintf in action. * Author: M J Leslie * Date: 15-May-96 * Use: The program takes data from STDIN and sends it to a file. * An example use would be. * * cat /etc/hosts | fprintf * ************************************************************************/ #include main() { FILE *Ptr; char Line[256]; /* ... Open a file for output. */ Ptr = fopen("/tmp/OutputFile", "w"); while(gets(Line)) /* Get data from stdin */ { fprintf(Ptr, "%s\n", Line); /* Send data to file. */ } fclose(Ptr); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/examples.html0000644000076400001440000000613307406420625016350 C Programming Examples

    C Programming Examples


    All these examples have been tested on a PC running Linux and using the 'gcc' compiler. You can extract the programs with the 'save' option under 'file' and compile with your own compiler.

    o
    Your first C program.
    o
    if.
    o
    while.
    o
    do.
    o
    for example 1.

    for A more advanced example.
    o
    switch.
    o
    function.
    o
    Global and local variables.
    o
    Increment & decrement.
    o
    Pass command line arguments.
    o
    Print from 10 to 1 - three examples.
    o
    Read a file - version 1.
    o
    manipulate strings.
    o
    Using 'curses' to read a password.
    o
    Programs requiring X. Unix users only. 
    o
    Index of all example programs.
    o
    O'Reillys' Using C examples.
    o
    O'Reillys' Practical C examples.
    o
    Bob Stouts 'Snippets'.

    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/EXAMPLES/struct1.c0000644000076400001440000000146207055334603015415 /************************************************************************ * * Purpose: Demonstrate structures. * Author: M.J. Leslie. * Date: 13-June-94 * * ************************************************************************/ #include main () { /* Declare the structure. */ struct { char name[20]; int age;} record ; /* Put some values into the * structure. */ strcpy(record.name, "Joe Brown"); record.age = 21; /* Display the contents of the * structure. */ printf("name is %s \nage is %d \n", record.name, record.age); } /************************************************************************ * * Here is the result. * * name is Joe Brown * age is 21 * ************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/struct2.c0000644000076400001440000000100607055334603015410 /* * Date 13-Jun-94 * * Pass 'struct' elements to a function. */ #include void display(char *name, int age); /************************************************************************/ main () { struct { char name[20]; int age;} record; strcpy(record.name, "Joe Brown"); record.age = 21; display (record.name, record.age); } /************************************************************************/ void display(char *name, int age) { printf("name is %s \nage is %d \n", name, age); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/struct3.c0000644000076400001440000000220007055334603015406 /************************************************************************ * * Purpose: Passing a copy of a structure to a function. * Author: M.J. Leslie * Date: 13-Jun-94 * ************************************************************************/ #include /* Declare a structure. It MUST * be declared before its use in * function declarations. */ struct record_format { char name[20]; int age;}; void display(struct record_format); /* function declaration */ /************************************************************************/ main () { struct record_format record; strcpy(record.name, "Joe Brown"); record.age = 21; display (record); /* * Print the contents of the structure. * The original value of record.age has been * retained. */ printf("name is %s \nage is %d \n", record.name, record.age); } /************************************************************************/ void display(struct record_format rec) { printf("name is %s \nage is %d \n", rec.name, rec.age); rec.age=31; /* change the value of a structure * member. */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/struct4.c0000644000076400001440000000226207055334614015421 /************************************************************************ * * Purpose: Create an array of structures. * Author: M.J. Leslie * Date: 09-May-95 * ************************************************************************/ #include /* Declare a structure. It MUST * be declared before use. */ struct record_format { char name[20]; int age; }; /************************************************************************/ main () { int count=0; struct record_format record[]= { {"Joe Brown", 21}, {"James Dean", 34}, {"David Williams", 54}, {"Neil Harrison", 62}, {"EOF", -1} }; /* * Print the contents of the structure. */ while( record[count].age != -1) { printf("name is %s \tage is %d \n", record[count].name, record[count].age); count++; } } /************************************************************************ * * Program will produce: * * name is Joe Brown age is 21 * name is James Dean age is 34 * name is David Williams age is 54 * name is Neil Harrison age is 62 * *************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/is_examp.c0000644000076400001440000000246507055334573015627 /************************************************************************ * * Purpose: Program to demonstrate the following functions: * isalpha, isdigit, isspace. * The same principles apply to isalnum, iscntrl, isgraph, * islower, isprint, ispunct, isupper, isxdigit * * Author: M. J. Leslie * Date: 09-Mar-94 * ************************************************************************/ #include /* printf */ #include /* isalpha isdigit isspace etc */ #define FALSE 0 #define TRUE 1 /* function declarations */ int char_type(char); main() { char ch; /* get a character from the keyboard */ printf(" Please enter a charcater => "); ch = getc(stdin); char_type(ch); /* Figure out the character type */ } /**************************************************************** decide the character type. *****************************************************************/ int char_type(char ch) { /* returns non zero if A-Z or a-z */ if ( isalpha(ch) != FALSE) printf("%c is an Alpha character.\n",ch); /* returns non zero if 0-9 */ if ( isdigit(ch) != FALSE) printf("%c is a numeric character.\n",ch); /* returns non zero if a space, CR, Tab, NL FF */ if ( isspace(ch) != FALSE) printf("%c is white space\n", ch); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/fact1.c0000644000076400001440000000116507055334575015016 /************************************************************************** * * Purpose: generate the factorial of a number by iteration. * Author: M. J. Leslie * Date: 09-Apr-94 * **************************************************************************/ #include int factorial(int num); main() { int num; puts ("This program will return the factorial of a number."); printf("Please enter the number ==> " ); scanf("%d", &num); printf(" %d! is %d\n",num, factorial(num) ); } int factorial(int num) { int count, ans=1; for (count=1 ; count <= num; count++ ) ans *= count; return ans; } c_cpp_reference-2.0.2/reference/C/EXAMPLES/fact2.c0000644000076400001440000000116307055334575015015 /*************************************************************************** * * Purpose: generate the factorial of a number by recursion * Author: M. J. Leslie * Date: 09-Apr-94 * ***************************************************************************/ #include int factorial(int num); main() { int num; puts ("This program will return the factorial of a number."); printf("Please enter the number ==> " ); scanf("%d", &num); printf(" %d! is %d\n",num, factorial(num) ); } int factorial(int num) { int ans=1; if (num == 1 ) return; ans = num * factorial(num-1); return ans; } c_cpp_reference-2.0.2/reference/C/EXAMPLES/macro.c0000644000076400001440000000072007055334605015107 /**************************************************************** * * Purpose: To demonstrate macros * Author: M.J. Leslie * Date: 17-Oct-94 * ****************************************************************/ #define SQUARE(x) x*x main() { int value=3; printf("%d \n", SQUARE(value)); } /**************************************************************** * * answer will be 9 * ****************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/pointer4_func.c0000644000076400001440000000053007055334600016557 int set(char *items[]); main() { char *items[]={"apple", "pear", "banana", "grape"}; set (items); } int set(char *items[]) { printf ("/t%s\n", items[2]); } /********************************************************************** * * Result is * banana * **********************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/enum1.c0000644000076400001440000000132307055334601015027 /**************************************************************************** * * Enumeration example. Program will return the month in a year. * I.E. It returns 9 for September. * ****************************************************************************/ main() { /* * Define a list of aliases */ enum months {Jan=1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec}; /* A A | | | | | ------- list of aliases. -------------- Enumeration tag. */ enum months month; /* define 'month' variable of type 'months' */ printf("%d\n", month=Sep); /* Assign integer value via an alias * This will return a 9 */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/enum2.c0000644000076400001440000000143707055334601015036 /**************************************************************************** * * Enumeration example. Program will return the number of days in a month * I.E. returns 28 for Feburary. * ****************************************************************************/ main() { /* * Define a list of aliases */ enum days {Jan=31, Feb=28, Mar=31, Apr=30, May=31, Jun=30, Jul=31, Aug=31, Sep=30, Oct=31, Nov=30, Dec=31}; /* A A | | | | | ------- list of aliases. -------------- Enumeration tag. */ enum days month; /* define 'month' variable of type 'months' */ printf("%d\n", month=Feb); /* Assign integer value via an alias * This will return 28 */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/enum3.c0000644000076400001440000000130707055334623015037 /**************************************************************************** * * Enumeration example: This program will fail to compile because * 'Alex' is in both enum lists. * ****************************************************************************/ main() { enum People1 {Alex=0, Tracy, Kristian} Girls; enum People2 {William=0, Martin, Alex} Boys; /* A A | | | | | ------- list of aliases. -------------- Enumeration tag. */ switch (Boys) { case William: puts("William"); break; case Martin: puts("Martin"); break; case Alex: puts("Alex"); break; default: break; } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/enum4.c0000644000076400001440000000072507055334623015043 /**************************************************************************** * * Enumeration example: This program will fail to compile because the * preprocessor will change the FALSE to 1 on the enum statement.... * ****************************************************************************/ #define FALSE 1 main() { enum Boolian_t {FALSE=0, TRUE} Boolian; printf("False has a value of %d", FALSE); printf(" True has a value of %d", TRUE); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/enum5.c0000644000076400001440000000131307055334623015036 /**************************************************************************** * * Enumeration example: This program will compile but the #define statement * will cause FALSE and TRUE to have a value of 1 * ****************************************************************************/ enum Boolian_t {FALSE=0, TRUE} Boolian; #define FALSE 1 main() { enum Boolian_t Boolian; printf("False has a value of %d\n", FALSE); printf(" True has a value of %d\n", TRUE); } /**************************************************************************** * * Results: * * False has a value of 1 * True has a value of 1 * ****************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/modulo.c0000644000076400001440000000112707055334567015316 /************************************************************************ * * Purpose: Program to demonstrate the '%' operator. * Author: M J Leslie * Date: 19-Mar-94 * ************************************************************************/ #include main() { int i,j; /* The modulo is the remainder of after an integer division */ printf("14 modulo 7 (14%%7) is %i\n", 14%7); /* answer is 0 */ printf("15 modulo 7 (15%%7) is %i\n", 15%7); /* answer is 1 */ i=10; j=6; printf("%i modulo %i (%i%%%i) is %i\n",i,j,i,j,i%j); /* answer is 4 */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/inc_dec.c0000644000076400001440000000251407055334573015401 /************************************************************************* * * Purpose: Demonstrate the increment and decrement operators. * * Author: M.J. Leslie. * * Date: 07-Apr-94 * *************************************************************************/ main() { /* * ++i - i incremented before i is used. * --i - i decremented before i is used. * j++ - j is incremented AFTER j has been used. * j-- - j is decremented AFTER j has been used. */ int i=1,j=1; puts("\tDemo 1"); printf("\t%d %d\n",++i, j++); /* O/P 2 1 */ printf("\t%d %d\n",i, j); /* O/P 2 2 */ i=1;j=1; puts("\n\tDemo 2"); printf("\t%d \n",i=j++); /* O/P 1 */ printf("\t%d \n",i=++j); /* O/P 3 */ /************************************************************************ This is a GOT YA *************************************************************************/ /* Consider this code */ i = 0; j = 0; puts("\n\tDemo 3"); if ( (i++ == 1) && (j++ == 1)) puts("Some text"); /* Will i and j get incremented? The answer is NO! Because * the expression in the left of '&&' resolves to false the * compiler does NOT execute the expression on the right and * so 'j' does not get executed!!!!! */ printf("\t%d %d\n",i, j); /* O/P 1 0 */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/getchar.c0000644000076400001440000000125507055334600015422 /************************************************************************ * * Purpose: Program to demonstrate the 'getchar' function. * The prog will read data entered via the keyboard. And return * the number of characters entered. * Author: M. J. Leslie * Date: 08-May-94 * ************************************************************************/ #include #define RETURN '\n' /* \n == return in UNIX \r == return in DOS */ main() { int count=0; puts("Please enter some text."); /* Count the letters in the 'stdin' buffer. */ while ( getchar() != RETURN) count++; printf("You entered %d characters\n", count); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/fgets.c0000644000076400001440000000122607055334575015126 /******************************************************************** * * Purpose: Program to demonstrate the 'fgets' function. * The prog will count the number of lines in a file. * The is a function of the UNIX command 'wc' * Author: M J Leslie * Date: 10-Apr-94 * ********************************************************************/ #include #define LINE_LENGTH 80 main() { FILE* fp; char line[LINE_LENGTH]; int count=0; fp=fopen("/home/DOC/C/c.html","r"); /* Count up the lines here. */ while ( fgets(line, LINE_LENGTH, fp) != NULL) count++; printf("File contains %d lines.\n", count); fclose(fp); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/function.c0000644000076400001440000000120307055334572015633 /************************************************************************ * * Purpose: Program to demonstrate functions. * Author: M J Leslie. * Date: 28-Feb-94 * ************************************************************************/ int add( int, int); /* Function declaration */ main() { int i=1; printf("i starts out life as %d.", i); i = add(1, 1); /* Function call */ printf(" And becomes %d after function is executed.\n", i); } /************************************************************************/ int add( int a, int b) /* Function definition */ { int c; c = a + b; return c; } c_cpp_reference-2.0.2/reference/C/EXAMPLES/malloc.c0000644000076400001440000000036707055334617015267 /************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Jan-94 * ************************************************************************/ #include main() { } c_cpp_reference-2.0.2/reference/C/EXAMPLES/first.c0000644000076400001440000000046107055334567015146 /****************************************************************** * * Purpose: Show the basic structure of a C program * Author: M J Leslie * Date: 03-Feb-94 * ******************************************************************/ #include main() { puts ("your first C program"); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/lenstr.c0000644000076400001440000000172007055334625015320 /************************************************************************ * * Purpose: Find the length of a string. * This duplicates the strlen function found in string.h * Author: M J Leslie * Date: 20-Mar-94 * ************************************************************************/ #include int lenstr(const char *text); main() { char kb_buf[80]; /* Keyboard buffer */ puts(" Please enter some text "); printf("Text is %d characters long.\n", lenstr(gets(kb_buf))); } /************************************************************************ * * Find the length of a string - does not check if we fall off * the end of the text buffer. oops. * ************************************************************************/ int lenstr(const char *text) { int count=-1; /* Character counter */ while(text[++count] != '\0') ; /* Serach for a null */ return(count); /* Return the position * of the NULL-1 */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/sizeof.c0000644000076400001440000000403707055334574015317 /**************************************************************************** * * Purpose: Find out the size of the different data types * Author: M J Leslie * Date: 27-feb-94 * ****************************************************************************/ #include main() { /* * int/char are 'type specifiers' * short/long are 'type qualifiers' */ int i; printf(" short int is %2d bytes \n", sizeof(short int)); printf(" int is %2d bytes \n", sizeof(int)); printf(" int * is %2d bytes \n", sizeof(int *)); printf(" long int is %2d bytes \n", sizeof(long int)); printf(" long int * is %2d bytes \n", sizeof(long int *)); printf(" signed int is %2d bytes \n", sizeof(signed int)); printf(" unsigned int is %2d bytes \n", sizeof(unsigned int)); printf("\n"); printf(" float is %2d bytes \n", sizeof(float)); printf(" float * is %2d bytes \n", sizeof(float *)); printf(" double is %2d bytes \n", sizeof(double)); printf(" double * is %2d bytes \n", sizeof(double *)); printf(" long double is %2d bytes \n", sizeof(long double)); printf("\n"); printf(" signed char is %2d bytes \n", sizeof(signed char)); printf(" char is %2d bytes \n", sizeof(char)); printf(" char * is %2d bytes \n", sizeof(char *)); printf("unsigned char is %2d bytes \n", sizeof(unsigned char)); } /************************************************************* * * The O/P from this program is * * short int is 2 bytes * int is 4 bytes * int * is 4 bytes * long int is 4 bytes * long int * is 4 bytes * signed int is 4 bytes * unsigned int is 4 bytes * * float is 4 bytes * float * is 4 bytes * double is 8 bytes * double * is 4 bytes * long double is 12 bytes * * signed char is 1 bytes * char is 1 bytes * char * is 4 bytes * unsigned char is 1 bytes * * **************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/varlist.c0000644000076400001440000000215007055334604015470 /************************************************************************ * * Purpose: To show ... in action. This operator (?) allows us to pass * a variable number of parameters to a function, 'printf' * uses ... * Author: M.J. Leslie * Date: 09-Jul-94 * ************************************************************************/ #include #include /* va_list, va_arg, va_end */ int set(char *item, int, num, ...); /************************************************************************/ main() { char *item="pear"; (set (item,4, "apple", "pear", "banana", "grape") ) ? printf ("%s found\n", item) : printf("%s not found\n", item); } /************************************************************************/ int set(char *item, int num, ...) { va_list ap; /* define 'ap' It acts as a pointer * to the undefined variables. */ int ok=0; int inc=0; va_start(ap, num); /* seed 'ap' */ do { if ( item == va_arg(ap, char *)) ok=1; } while ( ok==0 && ++inc < num); va_end(ap); /* tidy up. */ return (ok); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/convesc.c0000644000076400001440000000511307055334625015451 /********************************************************************** * * Description: If a text string is created outside of C, the * escape codes are not correctly stored. This * routine will prepare them for C's use. * * Author : M.J. Leslie * Date: 25-Feb-96 * *********************************************************************/ void mos_ConvertEscapeCode(char *String, char *Code); int main(int argc, char *argv[]) { if (argc == 1) { puts("\n\tPlease provide a text string on the command line."); } else { printf("I/P string is: %s\n", argv[1]); mos_ConvertEscapeCode(argv[1], "\\n"); mos_ConvertEscapeCode(argv[1], "\\t"); mos_ConvertEscapeCode(argv[1], "\\v"); mos_ConvertEscapeCode(argv[1], "\\b"); mos_ConvertEscapeCode(argv[1], "\\r"); mos_ConvertEscapeCode(argv[1], "\\f"); printf("O/P string is: %s\n", argv[1]); } } /********************************************************************** * * Purpose: To convert escape codes in text form into * actual codes. * * I/P ------------------------------- * | A | B | C | \ | n | D | E | F | * ------------------------------- * * O/P ---------------------------- * | A | B | C | \n | D | E | F | * ---------------------------- * **********************************************************************/ void mos_ConvertEscapeCode(char *String, char *Code) { char *Ptr1; char *Ptr2; char EscCode = ' '; /* ... Make sure the Code is long enough */ if (strlen(Code) == 2) { /* ... Find the right escape code. */ switch(Code[1]) { case 'n': /* New line */ EscCode = '\n'; break; case 't': /* Horizontal tab */ EscCode = '\t'; break; case 'v': /* Vertical tab */ EscCode = '\v'; break; case 'b': /* Backspace */ EscCode = '\b'; break; case 'r': /* Return */ EscCode = '\r'; break; case 'f': /* Form feed */ EscCode = '\f'; break; default: break; } /* ... If the escape code has been found */ if (EscCode != ' ') { /* ... Copy each character until the text code is found, ... insert the escape code and copy the remaining chars. */ for (Ptr1=Ptr2=String; Ptr2 < (String+strlen(String)+1); Ptr1++, Ptr2++) { if ((*Ptr2 == '\\') && (*(Ptr2+1) == Code[1])) { *Ptr1 = EscCode; Ptr2++; } else { *Ptr1 = *Ptr2; } } } } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/stdin.c0000644000076400001440000000101307055334617015126 /************************************************************************ * * Purpose: To read data fron 'stdin' (by default the keyboard) * * Author: M. J. Leslie * * Date: 01-Sep-95 * ************************************************************************/ #include void read_stdin(void); main() { read_stdin(); } /************************************************************************/ void read_stdin(void) { char line[256]; while (gets(line)) { printf("%s\n", line); } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/global.c0000644000076400001440000000132107055334572015247 /************************************************************************ * * Purpose: Demonstrate global and internal variables * Author: M J Leslie * date: 02-Feb-94 * ************************************************************************/ int counter = 0; /* global because we are outside all blocks. */ int func(void); main() { counter++; /* global because it has not been declared within this block */ printf("counter is %2d before the call to func\n", counter); func(); /* call a function. */ printf("counter is %2d after the call to func\n", counter); } int func(void) { int counter = 10; /* local. */ printf("counter is %2d within func\n", counter); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/atof.c0000644000076400001440000000233607055334600014737 /**************************************************************** * * Purpose: Program to demonstrate the 'atof' and 'gets' functions. * Author: M J Leslie * Date: 08/05/94 * ****************************************************************/ #include /* puts gets */ #include /* atof */ main() { char str1[80], str2[80]; /* define a couple o' strings. */ double result; /* Result of multiplication. */ puts ("This program will multiply two floating point numbers."); puts ("Warning: The program will accept invalid data, and give"); puts ("you crap results in return.\n"); puts ("Please enter the first number."); gets(str1); puts ("And the second."); gets(str2); result = atof(str1) * atof(str2); printf("Answer is %8.2f\n", result); } /******************************************************************** * * Here is an example run. * * This program will multiply two floating point numbers. * Warning: The program will accept invalid data, and give * you crap results as a result. * * Please enter the first number. * 20 * And the second. * .5 * Answer is 10.00 * ********************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/continue.c0000644000076400001440000000165007055334602015632 /************************************************************************** * * Purpose: To filter some records. * Demonstrates the 'continue', 'feof' & 'fgets' statemnts. * Author: M J Leslie * Date: 07-Jun-94 * *************************************************************************/ #include main() { char data[80]; /* Record read from the file. */ FILE *ptr; /* Pointer to the file. FILE is a structure defined in */ /* Open the file - no error checking done */ ptr = fopen("/etc/hosts","r"); /* Read one record at a time, checking for the End of File. EOF is defined in as -1 */ while (feof(ptr) == 0) { fgets(data, 80, ptr); /* Read next record */ if (data[0] == '#') continue; /* filter out the comments */ printf("%s",data); /* O/P the record to the screen */ } fclose(ptr); /* Close the file. */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/fork1.c0000644000076400001440000000132307055334625015032 /**************************************************************** * * Purpose: Basic example of fork. * Author: M J Leslie * Date: 01 Apr 96 * ****************************************************************/ #include main() { pid_t ForkPID; printf("Program start. \n"); ForkPID = fork(); /* Create a child and copy the parents * parent data space, heap and stack. */ /* ForkPID == -1 Fork failure. * == 0 This is the child process. * > 0 This is the parent process. The number given is the * PID of the child. */ printf("forkPID is %d \n", ForkPID); /* Child execution starts here. */ printf("Program end. \n"); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/fork2.c0000644000076400001440000000146107055334626015037 /**************************************************************** * * Purpose: Basic example of fork. * Author: M J Leslie * Date: 01 Apr 96 * ****************************************************************/ #include int Value = 5; main() { pid_t ForkPID; printf("Program start. \n"); ForkPID = fork(); /* Create a child and copy the parents * parent data space, heap and stack. */ /* ForkPID == -1 Fork failure. * == 0 This is the child process. * > 0 This is the parent process. The number given is the * PID of the child. */ if (ForkPID == 0) { Value += 4; } else { sleep (5); } printf("Value is %d\n", Value); printf("forkPID is %d \n", ForkPID); printf("Program end. \n"); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/const2.c0000644000076400001440000000150607055334634015223 /******************************************************************* * * Purpose: 'const' example. This code shows that making a * variable 'const' only tells the compiler to not * allow reassignment of the variable. The data is not * in a special location, it can still be altered. * * This code may cause compiler warning messages * but will compile and run. * * Author: M J Leslie. * Date: 03-Mar-97 * *******************************************************************/ main() { const int Men = 10; int *Women = &Men; *Women = 20; printf("There are %d men\n", Men); } /******************************************************************* * * Result. * * There are 20 men * *******************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/for1.c0000644000076400001440000000110107055334600014642 /************************************************************************** * * Purpose: Program to demonstrate the 'for' statement. * Author: M J Leslie * Date: 26/01/94 * **************************************************************************/ #include main() { int i; /* Define an integer */ /* * i=1 is executed the first time into the loop. * i<=10 is then tested, if true, the block is executed. * ++1 is the increment, before i<=10 is retested. */ for (i=1; i<=10; ++i) { printf ("loop counter = %i\n", i); } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/for2.c0000644000076400001440000000162307055334571014663 /************************************************************************ * * Purpose: Program to demonstrate the 'for' statement. * Author: M J Leslie * Date: 08/04/94 * ************************************************************************/ #include main() { int i,j; /* Define integers */ /* 'i' and 'j' get initalised on the 'for'. * Then they both are incremented and decremented * before 'i' is tested. */ for (i=1, j=10; i<=10; ++i, --j) { printf (" i = %02d j = %02d\n", i, j); } } /************************************************************************ O/P will look like this: i = 01 j = 10 i = 02 j = 09 i = 03 j = 08 i = 04 j = 07 i = 05 j = 06 i = 06 j = 05 i = 07 j = 04 i = 08 j = 03 i = 09 j = 02 i = 10 j = 01 **************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/gets.c0000644000076400001440000000175707055334614014763 /************************************************************************** * * Purpose: Compare the action of gets and fgets reading data from STDIN. * Author: M J Leslie * Date: 22-Apr-95 * *************************************************************************/ #include main() { char buff[80]; /* Input buffer. */ /* Get data from the keyboard. */ printf("\nplease enter text => "); gets(buff); printf("\nlength is %d #%s#\n", strlen(buff), buff); /* Get data from the keyboard. */ printf("\nplease enter text => "); fgets(buff, sizeof(buff), stdin); printf("\nlength is %d #%s#\n\n",strlen(buff), buff); } /************************************************************************* * * Example program run. * -------------------- * * please enter text => abcd * * length is 4 #abcd# * * please enter text => abcd * * length is 5 #abcd * # * *************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/if_else_endif.c0000644000076400001440000000047507055334604016567 /* Purpose: Demonstrate #if, #else & #endif preprocessors. * Author: M J Leslie * Date: 28-Jun-94 */ #define SWITCH 0 /* The #if can only perform * INTEGER tests!!!! */ #if ( SWITCH == 1 ) #define TEXT "Carabanger\n" #else #define TEXT "Hip Dude\n" #endif main () { printf(TEXT); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/pointer1_func.c0000644000076400001440000000165407055334577016601 /************************************************************************ * * Purpose: Program to demonstrate passing a pointer to an array * to a function. * Author: M J Leslie. * Date: 14-Apr-94 * ************************************************************************/ #define I_SIZE 2 void add(int*); /* Function declaration */ main() { int i[I_SIZE]={4,6}; /* array declaration */ int count=0; for (count=0;count main() { char data[100]; double num1, num2; printf(" Please enter a number ==> " ); gets(data); num1 = atof(data); printf(" Please enter a number ==> " ); gets(data); num2 = atof(data); /* Stop a divide by zero with * the goto statement. */ if ( num2 == 0.0 ) goto end_prog; printf(" %4.2f divided by %4.2f is %4.2f\n", num1, num2, num1/num2); end_prog: printf(" Program ended\n"); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/Makefile.am0000644000076400001440000000023507055334636015703 EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) $(wildcard *.h) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/EXAMPLES/Makefile.in0000644000076400001440000002606407474405126015722 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) $(wildcard *.h) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/EXAMPLES mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/EXAMPLES/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/EXAMPLES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/EXAMPLES/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=do.c address.c basename.c first.c struct2.c extern2.c single_array.c copy_file.c var_func.c sprintf1.c README.html perl2.c atexit.c readch.c fgets.c strchr.c malloc.c sizeof1.c enum1.c qsort2.c fprintf.c linklst3.c statfs.c if.c funcpt2.c getchar.c setuid.c HEADER.html atof.c strtok.c popen.c const.c static.c pointer2_func.c sscanf.c ifndef.c user_name.c struct3.c continue.c union.c and.c time.c enum2.c system.c exec_one.c while.c fact1.c prog_name.c inc_dec.c goto.c funcpt3.c Master.c strtol.c password.c reverse.c printenv.c 10to1.c struct4.c pointer1_func.c switch.c clrscr.c exponent.c ljust1.c enum3.c strcpy.c rand.c function.c read_file.c fact2.c pointer_func.c strncpy.c strcmp.c sprintf.c stat.c for1.c if_else_endif.c enum4.c uname.c examples.html pipe1.c fork1.c sizeof.c kill.c command_line.c pointer4_func.c swap.c linklst1.c const2.c bit_shift.c lenstr.c or.c gets.c whiteball.gif strstr.c stdin.c struct1.c extern1.c macro.c for2.c keyboard.c enum5.c temp.c exec_two.c define.c pipe2.c fork2.c strpbrk.c qsort1.c convesc.c varlist.c modulo.c bsearch.c global.c linklst2.c is_examp.c pointer3_func.c dir.c funcpt1.c DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/EXAMPLES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/EXAMPLES/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/EXAMPLES/define.c0000644000076400001440000000061707055334604015244 /********************************************************************* * * Purpose: Demonstrate the #define pre-processor. * Author: M J Leslie * Date: 26-Jun-94 * *********************************************************************/ #define EQ == main () { /* the EQ is translated to == by * the C pre-processor. COOL! */ if ( 5 EQ 5 ) printf("define works...\n"); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/qsort1.c0000644000076400001440000000430507055334607015244 /************************************************************************ * * Purpose: To sort numbers held in an array. * Author: M.J.Leslie * Date: 30-Nov-94 * ************************************************************************/ /********** Preprocessor ***********************************************/ #include #include #include /********** Functions ***************************************************/ void display_nums(int *, int); int comp_nums(const int *, const int *); /********** main ********************************************************/ main() { int numbers[]= /* Numbers to be sorted. */ {43,76,23,1,100,56,23,99,33,654}; int how_many=10; /* Number of numbers entered */ puts("\nThese are the unsorted numbers\n"); display_nums(numbers, how_many); /* SORT the numbers held in * 'numbers'. */ qsort( numbers, /* Pointer to elements */ how_many, /* Number of elements */ sizeof(int), /* size of one element. */ (void *)comp_nums /* Pointer to comparison function */ ); puts("\nThese are the sorted numbers\n"); display_nums(numbers, how_many); } /************************************************************************ * * comp_nums: Compare two numbers. * ************************************************************************/ int comp_nums(const int *num1, const int *num2) { if (*num1 < *num2) return -1; if (*num1 == *num2) return 0; if (*num1 > *num2) return 1; } /************************************************************************ * * display_nums: Display the numbers * ************************************************************************/ void display_nums(int *array, int count) { /* Print all the elements in * the array. */ while ( count-- ) { printf("%d ",*array); array++; } puts(""); } /******* The Results **************************************************** * * These are the unsorted numbers * * 43 76 23 1 100 56 23 99 33 654 * * These are the sorted numbers * * 1 23 23 33 43 56 76 99 100 654 * ************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/qsort2.c0000644000076400001440000000520307055334606015242 /************************************************************************ * * Purpose: To read numbers entered by the user and sort them. * Author: M.J.Leslie * Date: 30-Nov-94 * ************************************************************************/ /********** Preprocessor ***********************************************/ #include #include #include /********** Functions ***************************************************/ int read_nums(int *); void display_nums(int *); int comp_nums(const int *, const int *); /********** main ********************************************************/ main() { int numbers[30]; /* Numbers to be sorted. */ int how_many=0; /* Number of numbers entered */ /* Get the numbers */ how_many = read_nums(numbers); puts("\nThese are the unsorted numbers\n"); display_nums(numbers); /* SORT the numbers held in * 'numbers'. */ qsort( numbers, /* Pointer to elements */ how_many, /* Number of elements */ sizeof(int), /* size of one element. */ (void *)comp_nums /* Pointer to comparison function */ ); puts("\nThese are the sorted numbers\n"); display_nums(numbers); } /************************************************************************ * * comp_nums: Compare two numbers. * ************************************************************************/ int comp_nums(const int *num1, const int *num2) { if (*num1 < *num2) return -1; if (*num1 == *num2) return 0; if (*num1 > *num2) return 1; } /************************************************************************ * * readnums: read numbers from the keyboard and put them into an array. * ************************************************************************/ int read_nums(int *array) { char data[80]; /* Data entered by the user */ int inc=0; puts("\n\tPlease enter some integer numbers"); puts("\tno checking is made on the data you enter...."); printf("\t==> "); gets(data); /* Assume we have valid data. * Put it into an array. */ *(array+inc) = atoi(strtok(data," ")); inc++; while ( *(array+inc) = atoi(strtok(NULL," "))) inc++; /* Return the number of items * stored in 'array'. */ return inc++; } /************************************************************************ * * display_nums: Display the numbers * ************************************************************************/ void display_nums(int *array) { /* NULL is a pointer to 0, * so it must be cast to an * integer */ while ( *array != (int)NULL) { printf("%d ",*array); array++; } puts(""); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/HEADER.html0000644000076400001440000000037007055334611015456 Index of all Example Programs.

    Index of all Example Programs.


    Here is the HTTP generated list of all Example programs. c_cpp_reference-2.0.2/reference/C/EXAMPLES/kill.c0000644000076400001440000000027007055334626014744 main() { int pid; /* ... Get the process ID of this program. */ getpid(pid); /* ... Check to see if this program is active. */ printf("R = %d\n", kill (pid, 0)); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/sscanf.c0000644000076400001440000000156607055334624015275 #include main() { char Host[64]; char User[64]; char *Buff = "Jobname=job1 Hostname=arnamul User=leslim Time=11:15"; /* <----------> <-----> <---------> <--------> * | | | | * | ------------ | | * | | ------------------ V * | | | NULL * V V V */ sscanf (Buff, "%*s Hostname=%s %s", Host, User); printf("Host is %s\n", Host); printf("User is %s\n", User); exit(0); } /************************************************************************ * * Job Output is: * * Host is arnamul * User is User=leslim * ************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/sizeof1.c0000644000076400001440000000114107055334602015361 /*************************************************************** * * Purpose: Find out the size of the different data objects * Author: M J Leslie * Date: 03-Sep-94 * ***************************************************************/ #include main() { char array[10]; struct s { int a; float b; } structure; printf(" array is %i\n", sizeof array); printf(" struct is %i\n", sizeof structure); } /***************************************************************** * array is 10 * struct is 8 *****************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/funcpt1.c0000644000076400001440000000160007055334634015366 /************************************************************************ * * Purpose: 1. Define a pointer to a function. * 2. Point at a function. * 3. Execute the function. * * Author: M.J. Leslie * * Date: 04-Jun-95 * ************************************************************************/ int (*fpointer)(void); /* Define a pointer to a function */ int func1(void); /* Define a few functions. */ int func2(void); main() { fpointer = func1; /* Put the address of 'func1' in 'fpointer' */ fpointer(); /* Execute 'func1' */ fpointer = func2; /* Repeat for 'func2' */ fpointer(); } /************************************************************************/ int func1(void) { puts("martin was ere"); } /************************************************************************/ int func2(void) { puts("alex was ere"); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/funcpt2.c0000644000076400001440000000173407055334620015372 /************************************************************************ * * Purpose: 1. Define a pointer to a function with parameters. * 2. Point at the function. * 3. Execute the function passing parameters to it. * * Author: M.J. Leslie * * Date: 04-Jun-95 * ************************************************************************/ int (*fpointer)(int, int); /* Define a pointer to a function */ int add(int, int); /* Define a few functions. */ int sub(int, int); main() { fpointer = add; /* Put the address of 'add' in 'fpointer' */ printf("%d \n", fpointer(4, 5)); /* Execute 'add' and print results */ fpointer = sub; /* Repeat for 'sub' */ printf("%d \n", fpointer(6, 2)); } /************************************************************************/ int add(int a, int b) { return(a + b); } /************************************************************************/ int sub(int a, int b) { return(a - b); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/funcpt3.c0000644000076400001440000000233707055334620015373 /************************************************************************ * * Purpose: 1. Define a pointer to a function with parameters. * 2. Point at the function. * 3. Execute the function passing char and string parameters to it. * * Author: M.J. Leslie * * Date: 04-Jun-95 * ************************************************************************/ char * (*fpointer)(char *, char); /* Define a pointer to a function */ char * prefix(char *, char); /* Define a few functions. */ char * suffix(char *, char); main() { fpointer = prefix; /* Put the address of 'add' in 'fpointer' */ printf("%s ", fpointer("artin", 'M')); fpointer = suffix; /* Repeat for 'suffix' */ printf("%s \n", fpointer("lesli", 'e')); } /************************************************************************/ char * prefix(char *str, char c) { char result[100]; result[0] = c; strcpy(result+1, str); return(result); } /************************************************************************/ char * suffix(char *str, char c) { char result[100]; int eol; strcpy(result, str); eol=strlen(result); result[eol] = c; result[eol+1] = '\0'; return(result); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/user_name.c0000644000076400001440000000207607055334611015767 /************************************************************************ * * Purpose: Get the users real name with the 'getpwuid' function. * Notes: This is a UNIX only program. It will not work on DOS machines * as 'getpwuid' gets its information from /etc/passwd. * Author: M J Leslie * Date: 13-Jan-95 * ************************************************************************/ #include /* getpwuid */ #include /************************************************************************/ void user_name(void); /************************************************************************/ main() { user_name(); } /************************************************************************/ void user_name(void) { /* See the getpwuid man page * for a description of the * structure. */ struct passwd *passwd; /* Get the uid of the running * process and use it to get * a record from /etc/passwd */ passwd=getpwuid(getuid()); printf("Users Real name is %s\n", passwd->pw_gecos); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/uname.c0000644000076400001440000000202307055334610015105 /************************************************************************ * * Description: Try out the 'uname' function. * Author: M.J. Leslie * Date: 28-12-94 * ************************************************************************/ #include /* Header for 'uname' */ main() { struct utsname uname_pointer; uname(&uname_pointer); printf("System name - %s \n", uname_pointer.sysname); printf("Nodename - %s \n", uname_pointer.nodename); printf("Release - %s \n", uname_pointer.release); printf("Version - %s \n", uname_pointer.version); printf("Machine - %s \n", uname_pointer.machine); printf("Domain name - %s \n", uname_pointer.domainname); } /*********************************************************************** * * system name - Linux * Nodename - norma2 * Release - 1.1.54 * Version - #5 Sat Dec 3 15:08:21 GMT 1994 * Machine - i486 * Domain name - (none) * ***********************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/rand.c0000644000076400001440000000127707055334607014744 /********************************************************************* * * Purpose: Demonstrate the 'srand' and 'rand' functions * Author: M.J. Leslie. * Date: 11=Nov-94 * *********************************************************************/ #include #include main() { int rolls=4; /* This looks DISCUSTING! * time returns a different value * on every execution. And so * changes the value passed to * srand. See CAST * for an explanation of * (unsigned int) and (time_t) */ srand((unsigned int)time((time_t *)NULL)); /* Roll the dice. */ while(rolls--) { printf("Dice value is %d\n", (rand()%6)+1); } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/union.c0000644000076400001440000000004507055334625015140 /* * Example to be done ..... */ c_cpp_reference-2.0.2/reference/C/EXAMPLES/temp.c0000644000076400001440000000165407055334602014757 /* Purpose: Find out the size of the different data types Author: M J Leslie Date: 27-feb-94 */ #include main() { /* int/char are 'type specifiers' short/long are 'type qualifiers' */ int i; printf(" short int is %2d bytes \n", sizeof(short int)); printf(" int is %2d bytes \n", sizeof(int)); printf(" long int is %2d bytes \n", sizeof(long int)); printf(" signed int is %2d bytes \n", sizeof(signed int)); printf(" unsigned int is %2d bytes \n", sizeof(unsigned int)); printf("\n"); printf(" float is %2d bytes \n", sizeof(float)); printf(" double is %2d bytes \n", sizeof(double)); printf(" long double is %2d bytes \n", sizeof(long double)); printf("\n"); printf(" signed char is %2d bytes \n", sizeof(signed char)); printf(" char is %2d bytes \n", sizeof(char)); printf("unsigned char is %2d bytes \n", sizeof(unsigned char)); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/system.c0000644000076400001440000000063107055334607015335 /************************************************************************ * * Purpose: To test the system function. * * Author: M J Leslie * Date: 23-Oct-95 * ************************************************************************/ #include main() { /* Execute an system command and wait * for it to end. * DO NOT ATTEMPT TO RUN INERACTIVE CMDS*/ system("ls -l"); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/stat.c0000644000076400001440000000461507055334614014770 /************************************************************************ * * Purpose: Program to demonstrate the 'stat' function. * The program will show the modification and access times * plus the size of a file. * * Author: M J Leslie * * Date: 01-Jun-95 MJL Minor bug fixed. * 13-Apr-95 MJL Inital Release * * Notes: This function is only available to Unix systems. If you * are on a DOS machine, this will not compile. * * Compile: Change the #define (below) to a suitable file name on your * system. The file name is not passed on the command line * as I did not want to complicate the example. * ************************************************************************/ #include /* declare the 'stat' structure */ #include #include #include /* printf */ #include #define FILENAME "martin" /* PUT YOUR FILE NAME HERE */ /************************************************************************/ char * format_time(time_t cal_time); void file_stat(char * filename); /************************************************************************/ main() { file_stat(FILENAME); } /************************************************************************/ void file_stat(char * filename) { struct stat stat_p; /* 'stat_p' is a pointer to a structure * of type 'stat'. */ /* Get stats for file and place them in * the structure. */ if ( -1 == stat (filename, &stat_p)) { printf(" Error occoured attempting to stat %s\n", filename); exit(0); } /* Print a few structure members. */ printf("Stats for %s \n", filename); printf("Modify time is %s", format_time(stat_p.st_mtime)); /* Access time does not get updated if the filesystem is NFS mounted! */ printf("Access time is %s", format_time(stat_p.st_atime)); printf("File size is %d bytes\n", stat_p.st_size); } /************************************************************************/ char * format_time(time_t cal_time) { struct tm *time_struct; static char string[30]; /* Put the calendar time into a structure * if type 'tm'. */ time_struct=localtime(&cal_time); /* Build a formatted date from the * structure. */ strftime(string, sizeof string, "%h %e %H:%M\n", time_struct); /* Return the date/time */ return(string); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/time.c0000644000076400001440000000324507055334602014746 /************************************************************************ * * Purpose: To play with the time.h functions. * * Author: M.J. Leslie * * Date: 18-Mar-95 * ************************************************************************/ #include /* NULL */ #include /* ctime, asctime */ main() { time_t now; /* define 'now'. time_t is probably * a typedef */ /* Calender time is the number of * seconds since 1/1/1970 */ now = time((time_t *)NULL); /* Get the system time and put it * into 'now' as 'calender time' */ printf("%s", ctime(&now)); /* Format data in 'now' * NOTE that 'ctime' inserts a * '\n' */ /*********************************************************************/ /* Here is another way to extract the time/date information */ time(&now); printf("%s", ctime(&now)); /* Format data in 'now' */ /*********************************************************************/ { struct tm *l_time; l_time = localtime(&now); /* Convert 'calender time' to * 'local time' - return a pointer * to the 'tm' structure. localtime * reserves the storage for us. */ printf("%s", asctime(l_time)); } /*********************************************************************/ time(&now); printf("%s", asctime(localtime( &now ))); /*********************************************************************/ { struct tm *l_time; char string[20]; time(&now); l_time = localtime(&now); strftime(string, sizeof string, "%d-%b-%y\n", l_time); printf("%s", string); } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/swap.c0000644000076400001440000000105007055334627014761 /****************************************************************** * * Purpose: Program to demonstrate the use of ^ (XOR). * Date: 03-Dec-96 * Author: M J Leslie. * Descrip: The contents of two variables are swapped without * the use of a temorary variable * ******************************************************************/ #include main() { int One = 20; int Two = 12; printf("One = %d Two = %d\n", One, Two); One ^= Two; Two ^= One; One ^= Two; printf("One = %d Two = %d\n", One, Two); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/pointer3_func.c0000644000076400001440000000126207055334577016576 /* * Purpose: Program to demonstrate passing apointer to a character * string to a function. * Author: M J Leslie. * Date: 21-Apr-94 */ int function1(char * array); main() { char array1[10]="987654321"; /* one less so the \0 will fit */ function1(array1); /* call function */ printf("%s\n", array1); /* O/P the altered array. '5' will * have been changed to 'x' */ } /************************************************************************/ function1(char * array) { printf("%s\n", array); /* printf expects a pointer. */ array +=4; /* Modify the pointer. */ *array = 'x'; /* Modify the data pointed to * by 'array' */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/statfs.c0000644000076400001440000001070007055334636015315 /************************************************************************ * * Purpose: Program to demonstrate the 'statfs' function. * The program will show the number of free blocks * on the /tmp filesystem. * * Author: M J Leslie * * Date: 09-Nov-97 MJL Inital Release * * Notes: This function is only available on older unix systems. * SVR4 systems replaced statfs with statvfs. * ************************************************************************/ #include #include #define UNDEF -1 #define OK 0 #define FAIL 1 void GetFileSystemStat( const char *Path, /* I Path to a file on the file system to be queried */ long *BSize, /* O Size of blocks on this file system */ long *Blocks, /* O Total no. of blocks on this file system */ long *BFree, /* O No. of blocks still available to an ordinary user */ long *Files, /* O Maximum no. of files possible on this file system */ long *FFree, /* O No. of free file nodes (ie max - currently allocated) */ int *Status); /* O Returned status of this function call: OK File system parameters found FAIL Unable to determine file system parameters */ main() { long BSize; long Blocks; long BFree; long Files; long FFree; int Status; GetFileSystemStat("/tmp", /* I Path to a file on the file system to be queried */ &BSize, /* O Size of blocks on this file system */ &Blocks, /* O Total no. of blocks on this file system */ &BFree, /* O No. of blocks still available to an ordinary user */ &Files, /* O Maximum no. of files possible on this file system */ &FFree, /* O No. of free file nodes (ie max - currently allocated) */ &Status); /* O REturned status of this function call: OK File system parameters found FAIL */ printf("Free Blocks = %d\n", BFree); } /* PUBLIC FUNCTION ******************************************************************************** ** ** mos_GetFileSystemStat ** ** DESCRIPTION ** ** Gets information on the file-system on which a particular file resides ** ** IMPLEMENTATION NOTES ** ** On some file systems (eg NFS mounted partitions) it may not be possible ** to determine all the required parameters. In these cases the returned ** value will be set to MOS_UNDEF. ** ******************************************************************************** */ void GetFileSystemStat( const char *Path, /* I Path to a file on the file system to be queried */ long *BSize, /* O Size of blocks on this file system */ long *Blocks, /* O Total no. of blocks on this file system */ long *BFree, /* O No. of blocks still available to an ordinary user */ long *Files, /* O Maximum no. of files possible on this file system */ long *FFree, /* O No. of free file nodes (ie max - currently allocated) */ int *Status) /* O returned status of this function call: OK File system parameters found FAIL Unable to determine file system parameters */ { struct statfs FSBuf; /* structure to contain file system information */ int locStatus; /* local status value */ locStatus = statfs(Path, &FSBuf); if (locStatus != 0) { *BSize = UNDEF; *Blocks = UNDEF; *BFree = UNDEF; *Files = UNDEF; *FFree = UNDEF; *Status = FAIL; } else { *BSize = FSBuf.f_bsize; *Blocks = FSBuf.f_blocks; *BFree = FSBuf.f_bavail; *Files = FSBuf.f_files; *FFree = FSBuf.f_ffree; *Status = OK; } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/extern1.c0000644000076400001440000000063707055334623015403 /************************************************************************ * * Purpose: Part one of a two part example showing the * extern keyword in action. * * Author: M. J. Leslie * * Date: 24-Oct-95 * ************************************************************************/ void write_extern(void); extern int count; void write_extern(void) { printf("count is %i\n", count); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/extern2.c0000644000076400001440000000053707055334623015403 /************************************************************************ * * Purpose: Part two of a two part example showing the * extern keyword in action. * * Author: M. J. Leslie * * Date: 24-Oct-95 * ************************************************************************/ int count=5; main() { write_extern(); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/static.c0000644000076400001440000000200707055334605015275 /* * Author: M.J Leslie. * Purpose: To demonstrate the 'static' storage class */ void func1(void); static count=10; /* Global variable - static is the default */ main() { while (count--) func1(); } /***************************************************************************/ void func1(void) { /* 'thingy' is local to 'func1' - it is * only initalised at run time. Its value * is NOT reset on every invocation of * 'func1' */ static thingy=5; thingy++; printf(" thingy is %d and count is %d\n", thingy, count); } /************************************************************************** Program )/P looks like this: thingy is 6 and count is 9 thingy is 7 and count is 8 thingy is 8 and count is 7 thingy is 9 and count is 6 thingy is 10 and count is 5 thingy is 11 and count is 4 thingy is 12 and count is 3 thingy is 13 and count is 2 thingy is 14 and count is 1 thingy is 15 and count is 0 **************************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/prog_name.c0000644000076400001440000000100507055334610015746 /************************************************************************ * * Purpose: Display the name of the program. * To do: Stip any directory information away so we are left with * with the file name only. * Author: M.J.Leslie * Date: 09-Jan-95 * ************************************************************************/ main(int argc, char *argv[]) { char *prog=argv[0]; /* prog_name points to the same location * as argv[0] */ printf("Program is called %s\n", prog); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/var_func.c0000644000076400001440000000242707055334601015613 /************************************************************************ * * Purpose: Program to demonstrate functions that have a variable * number of parameters. * Author: M J Leslie. * Date: 28-Mar-94 * ************************************************************************/ #include #include /* va_list, va_arg, va_end */ int set(char *item, int num, ...); /* Declare the function. */ /************************************************************************/ main() { char *item="pear"; int Ret; Ret = set (item,4, "apple", "pear", "banana", "grape"); if (Ret) { printf ("%s found\n", item); } else { printf("%s not found\n", item); } } /************************************************************************/ int set(char *item, int num, ...) { va_list ap; /* define 'ap' It acts as a * pointer to the undefined * variables. */ int Ret=0; int Inc=0; /* Assume the worst. */ va_start(ap, num); /* seed 'ap' */ do { if ( item == va_arg(ap, char *)) { Ret = 1; } } while ( Ret==0 && ++Inc < num); va_end(ap); /* tidy up. */ return (Ret); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/sprintf.c0000644000076400001440000000155407055334604015500 /*********************************************************************** * * Purpose: Program to demonstrate the 'sprintf' statement. This example * is a bit lame as the same effect can be seen with a 'printf'. * But, it does show a string being built and passed into a * function. * Author: M J Leslie * Date: 10-Jul-94 * ************************************************************************/ #include main() { int i=1; /* Define an integer variable. */ char message[80]; /* Text string */ /* format text and put into 'message' this a great * improvement over using 'strcpy' and 'strcat' to * build a text string. */ sprintf (message, "i is %i", i); /* I may be stating the obvious but a '\0' is * put on the end of the string. */ puts(message); /* Display message */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/ifndef.c0000644000076400001440000000024707055334605015245 #include /* Create NULL if NULL was not * created by stdio.h */ #ifndef NULL #define NULL '\0' #endif main() { printf("%c \n", NULL); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/setuid.c0000644000076400001440000000207407055334610015303 #include #include main() { /* Identify the person logged in (real ID). */ printf("getuid = %d\n", getuid()); /* Get the ID in use by this process (effective ID). * Normally this is the same as above but if the program is: * * o Owned by root (chown root progname). * o Had 'Set owner' set in the permissions (chmod u+s progname). * o The disk is not mounted 'nosetuid'. * * We can use 'setuid' and 'seteuid'. */ printf("geteuid = %d\n", geteuid()); (!geteuid()) ? puts("setuid//setruid/seteuid will work.") : puts("setuid/setruid/seteuid will fail."); /* 0 = OK * -1 = Fail */ /* printf("seteuid return code = %d\n", seteuid(3570)); printf("getuid = %d\n", getuid()); printf("geteuid = %d\n", geteuid()); printf("seteuid return code = %d\n", seteuid(0)); printf("getuid = %d\n", getuid()); printf("geteuid = %d\n", geteuid()); */ printf("setuid return code = %d\n", setuid(4261)); printf("getuid = %d\n", getuid()); printf("geteuid = %d\n", geteuid()); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/README.html0000644000076400001440000000110307055334612015457


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/EXAMPLES/bsearch.c0000644000076400001440000000207507055334622015421 /************************************************************************ * * Purpose: To demonstrate the 'bsearch' function. * * Author: M.J. Leslie * * Date: 04-Jun-95 * ************************************************************************/ #include #define NUM 11 static int func (void *, void *); /************************************************************************/ main() { /* List of numbers. */ int numbers[NUM]={3,4,7,9,11,13,15,17,19,21,23}; int key=22; /* number to find. */ int * result; /* Result of 'bsearch' */ /* Search for 'key' in 'numbers'*/ result = bsearch (&key, numbers, NUM, sizeof(numbers[0]), (void *)func); printf("%d ", key); (result) ? puts("found") : puts("not found"); } /************************************************************************/ static int func (void *a, void *b) { printf("%d %d \n", *(int *)a, *(int *)b); /* Diagnistics. */ /* Compare the two numbers */ if (*(int *)a == *(int *)b) return(0); if (*(int *)a < *(int *)b) return(-1); return (1); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/exponent.c0000644000076400001440000000235007055334575015655 /************************************************************************** * * Purpose: Give the exponent of a number. * Author: M. J. Leslie * Date: 05-Apr-94 * **************************************************************************/ #include int exponent(int); main(int argc,char *argv[]) { int user_val; char *progname; progname=argv[0]; /* have we got one command line parameter? */ if (argc != 2) { printf("%s syntax is:\n", progname); printf("\t%s num - where num is the number you ", progname); printf("require the exponent of.\n"); exit(); } /* y. Put it in a suitable variable */ user_val = atoi(argv[1]); /* get and O/P its exponent. */ printf(" The exponent of %d is %d \n", user_val, exponent(user_val)); } /************************************************************************ Get the exponent of an integer number. *************************************************************************/ int exponent(int input) { int count, result=1; /* 'result *= count' means 'result = result * count' to fortran programmers... */ for(count=1; count<=input; count++) result *= count; return result; } c_cpp_reference-2.0.2/reference/C/EXAMPLES/perl2.c0000644000076400001440000000463107055334617015042 /******************************************************************** * * Date: 11-May-97 * * Purpose: Imbed PERL code in C. * * Notes: This code is based on the examples found in the * Perl man pages. * * Compile: To compile this code you will need a starement simular too: * * g++ perl2.c -L/usr/lib/perl5/i586-linux/5.003/CORE * -I/usr/lib/perl5/i586-linux/5.003/CORE * -lperl * -lm * * This program uses the C++ compiler as there seem to be problems * With the header files on Linux when using GCC. * ********************************************************************/ #include #include #include /********************************************************************/ PerlInterpreter *my_perl; void PerlInit(char **env); int PerlEval(char *string); void PerlEnd (void); /********************************************************************/ main ( int argc, char **argv, char **env) { unsigned int Length; // ... Initalise. PerlInit(env); // ... Some basic Perl statements PerlEval("$a = 3;"); PerlEval("$a = $a+2;"); // ... Extract an integer perl value into the C code. printf("a = %d\n", SvIV(perl_get_sv("a", FALSE))); PerlEval("$a = $a+2.5;"); // ... Extract a float perl value into the C code. printf("a = %f5.2\n", SvNV(perl_get_sv("a", FALSE))); // ... Play with strings. PerlEval("$a = 'rekcaH lreP rehtonA tsuJ';"); PerlEval("$a = reverse($a); "); // ... Extract a string perl value into the C code. printf("a = %s\n", SvPV(perl_get_sv("a", FALSE), Length)); printf("%d\n", Length); // ... Tidy up. PerlEnd(); } /********************************************************************/ void PerlInit( char **env) { char *Embedding[] = { "", "-e", "sub _eval_ { eval $_[0] }" }; my_perl = perl_alloc(); perl_construct( my_perl ); perl_parse(my_perl, NULL, 3, Embedding, env); } /********************************************************************/ int PerlEval(char *string) { char *argv[2]; argv[0] = string; argv[1] = NULL; perl_call_argv("_eval_", 0, argv); } /********************************************************************/ void PerlEnd(void) { perl_destruct(my_perl); perl_free(my_perl); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/copy_file.c0000644000076400001440000000156207055334627015770 /************************************************************************ * * Purpose: To copy a file (Unix 'cp' command). * Author: M J Leslie * Date: 16-May-96 * ************************************************************************/ #include main() { int c; /* Character read/written between files */ FILE *IPFile; /* Pointer to the I/P file. FILE is a structure defined in */ FILE *OPFile; /* Open the file - no error checking done */ IPFile = fopen("/etc/hosts","r"); OPFile = fopen("/tmp/hosts","w"); /* Read one character at a time, checking for the End of File. EOF is defined in as -1 */ while ((c = fgetc(IPFile)) != EOF) { fputc(c, OPFile); /* O/P the character */ } fclose(IPFile); /* Close the files. */ fclose(OPFile); /* Close the files. */ } c_cpp_reference-2.0.2/reference/C/EXAMPLES/while.c0000644000076400001440000000077607055334571015133 /****************************************************************** * * Purpose: Program to demonstrate the 'while' statement. * Date: 20-Feb-94 * Author: M J Leslie. * ******************************************************************/ #include main() { int i=1; /* Define an integer variable. */ /* * i <= 10 expression is evaluated. If TRUE the * block is executed. */ while (i <= 10) { printf ("i is %i\n", i); i++; } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/printenv.c0000644000076400001440000000105207055334630015650 /****************************************************************** * * Purpose: Program to demonstrate the 'environ' variable * by emulating the Unix printenv command. * Date: 21-May-96 * Author: M J Leslie. * Descrip: 'environ' is declared in stdlib.h and points to * a list of environmental variables. * ******************************************************************/ #include main() { int Count; char *Line; while(Line = *(environ+Count)) { printf("%s \n", Line); Count++; } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/pipe1.c0000644000076400001440000000324607055334626015035 /**************************************************************** * * Purpose: Basic example of pipe. * Read and write fixed length records across a pipe. * This is about a simple as they come... * * Author: M J Leslie * * Date: 17 Apr 96 * ****************************************************************/ #include #include /* pipe. */ #include void Child (pid_t Handle); void Parent (pid_t Handle); main() { pid_t Pid; int fd[2]; pipe(fd); /* Create two file descriptors */ Pid = fork(); if ( Pid == 0) /* Child */ { close(fd[0]); Child(fd[1]); puts("Child end"); } else /* Parent. */ { close(fd[1]); Parent(fd[0]); puts("Parent end"); } } /**************************************************************** * * The Child sends data to the parent. * ****************************************************************/ void Child(pid_t Handle) { char Buff[]="Martin 1 abcdefghijklmnop "; write(Handle, Buff, strlen(Buff)+1); Buff[7] = '2'; write(Handle, Buff, strlen(Buff)+1); Buff[7] = '3'; write(Handle, Buff, strlen(Buff)+1); Buff[7] = '4'; write(Handle, Buff, strlen(Buff)+1); close(Handle); } /**************************************************************** * * Read the data sent by the child. * ****************************************************************/ void Parent(pid_t Handle) { char Buff[50]; /* ... Read EXACTLY the number of bytes sent. ... 0 is returned when the pipe is closed by the child. */ while (read(Handle,Buff, 27) > 0) { printf("%s\n", Buff); } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/pipe2.c0000644000076400001440000000365707055334627015045 /**************************************************************** * * Purpose: Basic example of pipe. * Read and write variable length records across a pipe. * * Author: M J Leslie * * Date: 17 Apr 96 * ****************************************************************/ #include #include /* pipe. */ #include void Child (pid_t Handle); void Parent (pid_t Handle); main() { pid_t Pid; int fd[2]; pipe(fd); /* Create two file descriptors */ Pid = fork(); if ( Pid == 0) /* Child */ { close(fd[0]); Child(fd[1]); puts("Child end"); } else /* Parent */ { close(fd[1]); Parent(fd[0]); puts("Parent end"); } } /**************************************************************** * * The Child sends data to the parent. * ****************************************************************/ void Child(pid_t Handle) { int Len; char Buff[50]="Bass Beer"; Len = strlen(Buff)+1; write(Handle, &Len, sizeof(Len)); write(Handle, Buff, Len); strcpy(Buff, "Wild times."); Len = strlen(Buff)+1; write(Handle, &Len, sizeof(Len)); write(Handle, Buff, Len); strcpy(Buff, "Alex was ere."); Len = strlen(Buff)+1; write(Handle, &Len, sizeof(Len)); write(Handle, Buff, Len); strcpy(Buff, "Bon Jovi rules the world."); Len = strlen(Buff)+1; write(Handle, &Len, sizeof(Len)); write(Handle, Buff, Len); close(Handle); } /**************************************************************** * * Read the data sent by the child. * ****************************************************************/ void Parent(pid_t Handle) { int Len; char Buff[50]; /* ... Perform two reads. THe first gets the length of the data ... the second gets the actual data. */ while (read(Handle, &Len, sizeof(Len)) > 0) { read(Handle,Buff, Len); printf("%s\n", Buff); } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/keyboard.c0000644000076400001440000000225007055334634015610 /**************************************************************************** * * Purpose: Reset the keyboard from line mode to character mode and * suppress the echo when a key is entered. This allow the * program to get a character without the user pressing ENTER. * * This is for UNIX systems. DOS users have getch and getche. * Unix programers can also use curses. * * Author: M.J. Leslie. * Date: 30-Mar-97 * ****************************************************************************/ void SetKeyboard (void); void ResetKeyboard(void); main() { char Characters[1024]; int Inc=0; memset(Characters, 0, 1024); printf("Press a load of characters (q=exit)\n"); SetKeyboard(); for(Inc = 0; (Characters[Inc] = getchar()) != 'q'; Inc++); ResetKeyboard(); printf("You Pressed %s\n", Characters); } /* Set the keyboard. */ void SetKeyboard(void) { system("stty raw -echo"); } /* Return the keyboard to its original state. If this is not called * before the program ends, the keyboard will remain in its reconfigured * state. */ void ResetKeyboard(void) { system("stty -raw echo"); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/readch.c0000644000076400001440000000057307055334600015235 /* * Purpose: Program to demonstrate the 'getchar' function. * The prog will read data entered via the keyboard. And return * the number of characters entered. * Author: M J Leslie * Date: 08-May-94 */ #include #include int readch(void); main() { printf("%c",readch()+1); } int readch(void) { char ch; read(0, &ch, 1); return (ch); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/strchr.c0000644000076400001440000000221607055334617015320 /************************************************************************* * * Purpose: To find a # in a string. If found, it is removed along all text * to the right of it. * Author: Dave Doolin * Date: 03-Jun-95 * * * Notes: This is NOT a complete program. It is provided as a function * for inclusion into your code. * *************************************************************************/ #include #include /* For the `strchr' synonym for `index'. */ /* * FIND_COMMENT will replace the octothorpe ("#") with a null character to * get rid of comments in a line. Later need to add `stopchar' for more * flexibility, instead of just using "#". Need also to find a way to * collapse initial spaces and tabs, in case I want to clean up the line as * well. */ void find_comment(char *tline) { char *comment; comment = strchr(tline, '#'); if (comment != 0) /* If STRCHR returns an address for # then */ *comment = '\0'; /* stick a null character at that address. */ comment = strchr(tline, '\n');/* Replace \n with \0 for consistency. */ if (comment != 0) *comment = '\0'; } c_cpp_reference-2.0.2/reference/C/EXAMPLES/strcmp.c0000644000076400001440000000224407055334633015322 /****************************************************************** * * Purpose: Program to demonstrate the use of strcmp. * Date: 05-Dec-96 * Author: M J Leslie. * Descrip: The standard strcmp returns 0 when the strings match * and indicates which string is lexigraphically greater. * Every time I have used strcmp, I have never been interested * in which string is greater and always frustrated that the * return code is inverted. This function tidys things up. * ******************************************************************/ #include #include #define TRUE 1 #define FALSE 0 int StringCompare(char *s1, char *s2); main() { char One[] = "Bartman"; char Two[] = "Batman"; int Ret; Ret = StringCompare(One, Two); if (Ret == TRUE) { puts("The Strings match"); } else { puts("The Strings do not match"); } } /**************************************************************/ int StringCompare(char *s1, char *s2) { int Ret; if (strcmp(s1, s2)) { Ret = 0; } else { Ret = 1; } return (Ret); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/strcpy.c0000644000076400001440000000112407055334572015334 /* * Purpose: Program to demonstrate the 'strcpy' function. * Author: M J Leslie * Date: 12-Mar-94 */ #include /* strcpy */ main() { char text1[20]="martin"; /* string buffer */ char text2[20]="leslie"; /* string buffer */ printf (" original string contents are: %s\n", text1); /* Copy text2 into text1. If text1 is smaller that text2 it will probably overwrite something! */ strcpy(text1, text2); printf (" new string contents are: %s\n", text1); strcpy(text1, "linux"); printf (" final string contents are: %s\n", text1); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/atexit.c0000644000076400001440000000077307055334630015312 /****************************************************************** * * Purpose: Program to demonstrate the use of atexit. * Date: 17-Feb-97 * Author: M J Leslie. * Descrip: Regester a function to be executed when a program normally * terminates. * ******************************************************************/ #include void End(void); main() { atexit(End); printf("Program is about to end\n"); } void End(void) { printf("Program ended\n"); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/10to1.c0000644000076400001440000000165307055334571014662 /******************************************************************* * * Purpose: Count down from 10 to 1 in steps of 1 * Author: M J Leslie. * Date: 02-Feb-94 * *******************************************************************/ /* version 1 */ #include main() { int a=10; while (a >= 1) { printf("a is %2d\n",a); a=a-1; } } /*******************************************************************/ /* version 2 */ main() { a =11; while (0 < (a = a - 1) ) { printf("a is %2d\n",a); } } /*******************************************************************/ /* version 3 */ main() { /* * This works because the 'while' loop * will keep spinning while 'i' is TRUE. * That is while 'i' is NOT equal to 0 */ a=11; while (i) { printf ("%i",i=i-1); } } c_cpp_reference-2.0.2/reference/C/EXAMPLES/strstr.c0000644000076400001440000000102207055334602015340 /***************************************************************** * * Purpose: Program to demonstrate the 'strstr' function. * Author: M J Leslie * Date: 18-Jun-94 * *****************************************************************/ #include #include main() { char string[]="string to search"; char test[]="sear"; /* strstr returns a pointer into 'string' * if 'test' is found' if not found, NULL * is returned. */ if (strstr(string, test)) puts("String found"); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/strtok.c0000644000076400001440000000215107055334576015343 /***************************************************************** * * Purpose: Program to demonstrate the 'strtok' function. * Author: M J Leslie * Date: 23-Apr-94 * ****************************************************************/ #include #include main() { /* Copy the constant into the memory * pinted to by 'test_string' */ char test_string[50]="string to split up"; /* if 'test_string' is declared as below and the program will give a * 'Segmentation fault' This is because test_string' is pointing * to a constant i.e. somethin that cant be changed. char *test_string="string to split up"; */ char *sub_string; /* Extract first string */ printf("%s\n", strtok(test_string, " ")); /* Extract remaining * strings */ while ( (sub_string=strtok(NULL, " ")) != NULL) { printf("%s\n", sub_string); } } /***************************************************************** * * Program O/P will look like this... * * string * to * split * up * *****************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/strtol.c0000644000076400001440000000412607055334606015342 /**************************************************************** * * Purpose: To show examples of the strtol function. * Author: M.J. Leslie * Date: 06-Nov-94 * ****************************************************************/ #include main() { char num[10]; /* Test a valid number */ strcpy(num,"13"); printf("%s(Oct) is %i(Dec)\n", num, strtol(num, NULL, 8)); printf("%s(Dec) is %i(Dec)\n", num, strtol(num, NULL, 10)); printf("%s(hex) is %i(Dec)\n", num, strtol(num, NULL, 16)); puts("----------------------------------"); /* Test a slightly valid number * Returns the same results as * above. */ strcpy(num, "13hzcd"); printf("%s(Oct) is %i(Dec)\n", num, strtol(num, NULL, 8)); printf("%s(Dec) is %i(Dec)\n", num, strtol(num, NULL, 10)); printf("%s(hex) is %i(Dec)\n", num, strtol(num, NULL, 16)); puts("----------------------------------"); /* Test an invalid number * Returns ZERO */ strcpy(num, "hzcd"); printf("%s(Oct) is %i(Dec)\n", num, strtol(num, NULL, 8)); printf("%s(Dec) is %i(Dec)\n", num, strtol(num, NULL, 10)); printf("%s(hex) is %i(Dec)\n", num, strtol(num, NULL, 16)); puts("----------------------------------"); /* Test 0 base. * This will look at the number * and decide the base for its self! */ strcpy(num, "13"); printf("%s is %i(Dec)\n", num, strtol(num, NULL, 0)); strcpy(num, "013"); printf("%s is %i(Dec)\n", num, strtol(num, NULL, 0)); strcpy(num, "0x13"); printf("%s is %i(Dec)\n", num, strtol(num, NULL, 0)); } /**************************************************************** * * Results of the program: * * 13(Oct) is 11(Dec) * 13(Dec) is 13(Dec) * 13(hex) is 19(Dec) * ---------------------------------- * 13hzcd(Oct) is 11(Dec) * 13hzcd(Dec) is 13(Dec) * 13hzcd(hex) is 19(Dec) * ---------------------------------- * hzcd(Oct) is 0(Dec) * hzcd(Dec) is 0(Dec) * hzcd(hex) is 0(Dec) * ---------------------------------- * 13 is 13(Dec) * 013 is 11(Dec) * 0x13 is 19(Dec) * ****************************************************************/ c_cpp_reference-2.0.2/reference/C/EXAMPLES/popen.c0000644000076400001440000000066307055334607015137 /* * Purpose: Program to demonstrate the popen function. * * to do: Check that the 'popen' was successfull. * * Author: M J Leslie. * Date: 08-Jan-94 */ #include main() { FILE *fp; char line[130]; /* line of data from unix command*/ fp = popen("ls -l", "r"); /* Issue the command. */ /* Read a line */ while ( fgets( line, sizeof line, fp)) { printf("%s", line); } pclose(fp); } c_cpp_reference-2.0.2/reference/C/EXAMPLES/password.c0000644000076400001440000000174107055334573015660 /************************************************************************ * * Purpose: To read and verify a password. * Compile: gcc password.c -lcurses * Notes: To read text from the keyboard on a UNIX system without * it being echoed to the screen you can use noecho() and * getch() from curses.h In DOS you can use getch() in conio.h * Author: M. J. Leslie * Date: 12-Mar-94 * ************************************************************************/ #include main() { int i; char buffer[80]; /* work buffer */ initscr(); /* initialize the screen */ printw("Please enter a password => "); /* update screen image */ refresh(); /* Update screen with screen image */ noecho(); /* Suppress echo to the screen */ /* Read characters until C/R */ while((buffer[i] = getch()) != '\n') i++; printw("\nPassword is %s - press return to continue.",buffer); refresh(); getch(); endwin(); /* Shut down curses */ } c_cpp_reference-2.0.2/reference/C/backup/0000777000076400001440000000000007474405231013755 5c_cpp_reference-2.0.2/reference/C/backup/Makefile.am0000644000076400001440000000017507055334733015733 EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/backup/Makefile.in0000644000076400001440000002366307474405126015753 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/backup mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/backup/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/backup/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/backup/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=mindxhed.htm mindxbdy.htm DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/backup/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/backup/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/backup/mindxhed.htm0000644000076400001440000000441307055334733016210 Master Index.

    ?

    #

    A

    B

    C

    D

    E

    F

    G

    H

    I

    J

    K

    L

    M

    N

    O

    P

    Q

    R

    S

    T

    U

    V

    W

    X

    Y

    Z

    Top C Keywords Functions
    c_cpp_reference-2.0.2/reference/C/backup/mindxbdy.htm0000644000076400001440000020264707055334732016236 Master Index.  



     
     

    ?

    # 

    A

    B 

    C

    D 

    E

    F 

    G

    H 

    I

    J 

    K

    L 

    M

    N 

    O

    P 

    Q

    R 

    S

    T 

    U

    V 

    W

    X 

    Y

    Z 

     
     

    ?
    % format identifer. 
    % Operator (modulo). 
    + Operator (addition). 
    - Operator (Subtraction). 
    / Operator (division). 
    /* Open a comment. 
    // Inline comment (C++).
    * Operator (Multiplication). 
    * width/percision formating character. 
    * Pointer operator (Unary). 
    */ Close a comment. 
    -- Operator (decrement). 
    ++ Operator (increment). 
    = Operator (Assignment, Equals). 
    *= Operator. 
    /= Operator. 
    %= Operator.
    += Operator. 
    -= Operator. 
    <<= Operator.
    >>= Operator.
    &= Operator. 
    ^= Operator. 
     
    ? continued
    |= Operator.
    == Operator. 
    != Operator. 
    > Operator. 
    < Operator.
    >= Operator.
    <= Operator. 
    && Operator. 
    || Operator. 
    ! Operator. 
    & Reference Variables (C++).
    & Bitwise AND Operator (binary). 
    | Bitwise OR Operator (binary). 
    ^ Operator. 
    << Shift Left Operator. 
    >> Shift Right Operator. 
    ~ Operator. 
    & Address of Operator (Unary). 
    ? Operator. 
    : Operator. 
    . Operator (structure member). 
    -> Operator (structure pointer). 
    ... in function declarations. 
    , Comma Operator. 
     
    #
    #include preprocessor 
    #define preprocessor 
    #if preprocessor 
    #ifdef preprocessor 
    #ifndef preprocessor 
    #line preprocessor 
     
    # continued
    #undef preprocessor 
    #pragma preprocessor 
    #else preprocessor 
    #error preprocessor 
    #elif preprocessor 
    #endif preprocessor 
     
    A
    abort a program. 
    abs function. Aboslute value of an integer. 
    acos function. 
    AND Operator. 
    ANSI Standard headers
    Archive libraries.
    ARGC and ARGV[]
    Arithmetic Operators
    Arrays
    Arrarys of Structures
    Array sorting
    Assignment Operators
     
    A continued
    Ascii table. 
    asctime function 
    asin function. 
    assert function. 
    Assignment Constructors C++ class
    atan function. 
    atan function. 
    atexit Execute the named function when the program terminates. 
    atof
    atoi Accepts +-0123456789 leading blanks and converts to integer. 
    atol
    Audible Alert \a
    auto keyword. 
     
    B
    Backspace \b
    Base conversion.
    basename strip directory information from a file name. 
    Bell \a
    Binary formating problem.
    Bits
    Bitwise Operators
     
    B continued
    Book list
    boolean
    bool datatype (C++).
    break keyword. 
    bsearch function. 
    Bytes
     
    C
    Carriage Return \r
    case keyword. 
    cast
    ceil function. 
    Change working directory.
    close function. 
    closedir function. 
    %c Character formatting (printf, scanf etc) 
    char keyword. 
    Character arrays
    Character Constants.
    Character I/P & O/P in files.
    chdir function. 
    class C++ keyword 
    class Inheritance(C++)
    class keyword (C++)
    clock function. 
    clrscr Clear screen 
    clrscr Program to clear the screen using VT escape sequence.
    Coding idioms.
    Comma operator. 
     
    C continued
    Command line arguments
    C Comments.
    Commentsin C++. 
    Comman coding errors.
    Compare strings
    Compare strings ignoring case.
    Compilers
    Compiler Error messages (GCC)
    Completion codes
    Concatenate strings.
    const keyword.
    const keyword. In classes
    Constants.
    constructors C++ class
    continue keyword. 
    Conversion table between ASCII Binary, Decimal, Hex 
    Convert Unix file to DOS format
    Convert Unix path names to DOS path names.
    Copy Constructors C++ class
    Copy strings.
    Copy a file.
    Create Environmental variables.
    ctime function 
     
    D
    Data types
    Data type conversion
    Date functions. 
    %d Decimal formatting (printf, scanf etc) 
    Declaration
    Debugging
    Decimal Ascii table. 
    Decrementing.
    Default Constructors C++ class
    Default Parameter values. (C++)
    default keyword. 
    #define Preprocessor
    Definition
     
    D continued
    deleteC++.
    Destructors C++ class
    difftime function. 
    Directory access functions. 
    Directory information stipped from a file name. 
    do keyword. 
    Domain name.
    double keyword. 
    Download the source. 
    dup duplicate a file descriptor. 
    dup2 duplicate a file descriptor. 
    dynamically allocate memory.
    dynamic libraries
     
    E
    %e formatting (printf, scanf etc) 
    #elif preprocessor
    #else preprocessor
    else keyword. 
    #edif preprocessor
    endpwent function. 
    enum keyword. 
    enum. C++ changes.
    environ example. 
    errno.h ANSI header. 
    #error preprocessor
    escape codes. 
    Environmental variables.
    Evaluation of operators
     
    E continued
    Example programs.
    execl function.
    execlp function.
    execle function.
    exect function.
    execv function.
    execvp function.
    exit function. 
    Expressions
    extern keyword. 
     
    F
    File descriptor
    %f formatting (printf, scanf etc) 
    fabs function. 
    FALSE
    fclose Close a file. 
    feof Check for EOF while reading a file. 
    fgetc Read a character from a file. 
    fgetpwent function. 
    fgets
    field width. (printf, scanf etc) 
    File status, permissions, ownership etc. 
    Float arrays
    float keyword. 
    float.h ANSI header. 
    Floating point Constants.
    floor function. 
     
    F continued
    fopen Open a file 
    format flags. (printf, scanf etc) 
    fork a child process. 
    Formfeed \f Read a record from a file (safer than fgetc). 
    for keyword 
    formatting (printf, scanf etc) 
    fprintf O/P a line of data to a file. 
    fputc Write a character to a file.
    friend C++ keyword.
    free function to release memory allocated with malloc. 
    fputs Write a string to a file. 
    fstat File status, permissions, ownership etc. 
    functions writing. 
    functions ANSI library. 
    Function Overloading. (C++)
    Functions (pointers to)
    Functions (static)
    static functions in C++.
     
    G
    %g formatting (printf, scanf etc) 
    GDB debugger
    getenv Get an environmental variable. 
    getchar Get a character from the keyboard (STDIN). 
    getc Get a character from an input stream. 
    getch function. 
    getche function. 
    geteuid function. Get a Users effective ID. 
    gethostname function. Get the name of this host! 
    getopt function. Parse the command line. 
     
    G continued
    getpid function. Get the process id. 
    getppid function. Get the parent process id. 
    getpw function. 
    getpwent function. 
    getpwnam Get a record from /etc/passwd by keying on the user name. 
    getpwuid Get a record from /etc/passwd by keying on the UID. 
    gets function. Get string (from keyboard). 
    getuid function. Get a Users real ID. 
    Global variables. 
    Glossary (C)
    Glossary (C++) 
    gmtime function 
    goto keyword. 
    Got Ya! Comman coding errors. 
     GREP command for DOS users.
    Group ID.
     
    H
    Headers (standard). 
    Hex base conversion.
    Hex dump program. 
    Hex table. 
     
    H continued
    Hex Character constant \x
    Hex formatting (printf, scanf etc) 
    Horizontal tab \t
    Host name via the 
    uname function. 
    Host name via the 
    gethostname function. 
     
    I
    %i Decimal formatting (printf, scanf etc) 
    Idioms.
    Incrementing
    #include Preprocessor
    #if preprocessor
    #ifdef preprocessor
    #ifndef preprocessor
    if keyword. 
    index Search for a character in a string. 
    inline C++ keyword.
    Inheritance (C++)
    input from the keyboard
    int keyword. 
    Integer arrays
    Integer Constants.
    integer formatting. 
    I/O
     
    I continued
    input from the keyboard
    int keyword. 
    Integer arrays
    Integer Constants.
    integer formatting. 
    I/O
    isalnum Checks whether a character is alphanumeric (A-Z, a-z, 0-9) 
    iscntrl Checks whether a character is a control character or delete ( decimal 0-31 and 127) 
    isdigit Checks whether a character is a digit (0-9) 
    isgraph Checks whether a character is a printable character, excluding the space (decimal 32) 
    islower Checks whether a character is a lower case letter (a-z). 
    isprint Checks whether a character is printable (decimal 32-126). 
    ispunct Checks whether a character is punctuation (decimal 32-47, 58-63, 91-96, 123-126) 
    isspace Checks whether a character is white space - space, CR HT VT NL, FF. 
    isupper Checks whether a character is an upper case letter (A-Z). 
    isxdigit Checks whether a character is hex digit (0-9, A-F, a-f). 
     
    J
     
    J continued
     
    K
    keyboard input. 
    Keywords.
    Keywordsadded to C++ 
    kill a process.
     
    K continued
     
    L
    labs function. 
    libraries (user)
    limits.h ANSI header. 
    #line preprocessor
    Linked lists
    locale.h ANSI header. 
    Local variables. 
    localtime function. 
     
    L continued
    Logical AND Operator. 
    Logical OR Operator. 
    long keyword. 
    setjmp.h ANSI header. 
    Love Tim Love's C programming documentation. 
    Low level I/O
    Lowercase to uppercase character conversion.
    lstat function. Get file status, permissions, ownership etc. 
     
    M
    Macros
    Machine type.
    malloc function to dynamically allocate memory. 
    math.h
    member of a structure
    memchr function. 
    memcmp function. 
     
    M continued
    memcpy function. 
    memove function. 
    memset function. 
    mkdir function. 
    mktime function. 
    Mirror sites.
    modulo
    Modifiers
     
    N
    %n formatting (printf, scanf etc) 
    namespace C++ keyword.
    new C++.
    Newline \n
    NOT Operator. 
    Null.
    Number base conversion.
    Number base converter.
    Nutshell book examples.
     
    N continued
     
    O
    %o Octal formatting (printf, scanf etc) 
    \o Octal Character constant
    open function. 
    opendir function. 
    operator C++ keyword.
    Operators Operator 
    Precedence
    Operand definition. 
    OR Operator. 
    O'Reilly books.
     
    O continued
    Overloading Functions. (C++)
    P
    %p formatting (printf, scanf etc) 
    password functions. 
    pclose Close a pipe. 
    perl in C code
    pipe function. 
    Pointers
    Pointers to arrays.
    Pointers to functions
    Pointers to pointers
    Pointers to Strings
    Pointers to structures
    pointer (void)
    popen Open a pipe. 
    pow raise a number by a given power. 
    Practical C (O'Reilly) examples.
     
    P continued
    #pragma preprocessor
    Precedence of operators. 
    Preprocessor instructions
    printenv program. 
    printf O/P data to the screen or a file. 
    Problems for you to solve.
    Process ID.
    Process - is a PID active? 
    Program examples.
    Program name.
    putc 
    putchar. O/P a character to STDOUT. 
    putenv Create an environmental variable. 
    puts O/P data to the screen or a file. 
     
    Q
    qsort
    qsort O'Reilly 'Using C' example. 
     
    Q continued
     
    R
    \r Carriage Return
    rand function. 
    random numbers. 
    RAND_MAX numbers. 
    read function. 
    readdir function. 
    Read data from a file.
    Reference Variables (C++).
     
    R continued
    register keyword.
    Relational Operators
    Remote Procedure Calls
    rename function. Rename a file.
    Return code.
    return keyword.
    reverse Program to reverse characters in a string.
    rewinddir function.
    rint function.
    rmdir function.
    RPC Remote Procedure CAlls 
     
    S
    S_ISLNK Is this a link.
    S_ISREG Is this a regular file.
    S_ISDIR Is this a directory
    S_ISCHR
    S_ISBLK
    S_ISFIFO
    S_ISSOCK
    %s String formatting (printf, scanf etc) 
    scandir function. 
    scanf 
    scope
    seekdir function. 
    setenv Create an environmental variable. 
    setjmp.h ANSI header. 
    setpwent function. 
    setuid function. 
    short keyword. 
    signal.h ANSI header. 
    signed keyword. 
    sizeof. Return the storage allocation for a 
    data type.
    sleep function. Pause for the specified number of seconds. 
    sort an array. 
    sprintf O/P data in tha same way as 'printf' but put it into a string. 
    sqrt Square root of a number. 
    srand function. 
    sscanf function. 
    Standard C++ Library
    Standard headers
    Standard headers
    stat function. Get file status, permissions, ownership etc. 
    statfs function. Get filesystem status, free blocks, block size etc. 
    static keyword. 
    static in C++.
    static libraries
    stdarg.h ANSI header. 
    stddef.h ANSI header. 
    STDERR
    STDIN
    stdlib.h
    STDOUT
    Storage clase
    strcat function. Concatenate strings. 
    strcasecmp Compare strings ignoring case. 
    strchr Search for a character in a string. 
    strcmp Compare strings. 
    strcoll function. Compare two strings. 
     
    S continued
    strcpy Move strings. 
    strcspn function. Search a string for a set of characters. 
    strftime function. 
    String Constants.
    String pointers
    String formating
    strlen
    strncat function. Concatenate strings. 
    strncmp Compare strings. 
    strncpy Copy N bytes from one string to another. 
    strpbrk function 
    strrchr Search for a character in a string. 
    strrchr function. 
    strspn function. 
    strstr function. Search a string for a substring. 
    strtok function. The books say this function splits a string into tokens. I think its function is best described as parsing a string. 
    strtol Convert String to a long integer. 
    struct keyword. 
    Structure arrays
    Structure basics
    Structure membership
    Structure pointers
    strxfrm function.
    swap two values. 
    switch keyword. 
    Syntax.
    system Issue a system command. 
    system calls
    system information
     
    T
    \t Horizontal tab
    telldir function. 
    threads
    time functions. 
    time.h header. 
     
    T continued
    tolower function. Convert an uppercase character to lowercase. 
    toupper function. Converts a lowercase character to uppercase. 
    TRUE
    Tutorials on the net
    Data type conversion
    typedef keyword. 
     
    U
    %u formatting. 
    uname function. 
    #undef preprocessor
    union keyword. 
    unistd header. 
    Unix to DOS file conversion
     
    U continued
    unlink function, delete a file. 
    unsetenv function. Remove an environmental variable. 
    unsigned keyword. 
    unsigned integer formatting. 
    Uppercase to lowercase character conversion.
    Users /etc/passwd entry.
    Using C (O'Reilly) examples.
     
    V
    va_arg
    va_end
    va_list
    va_start
    Variables.
    Variable definition.
    Variable function parameter lists
    Variables - Reference(C++).
     
    V continued
    Vertical tab \v
    vfprintf. Print a va_list to a file. 
    vprintf. Print a va_list 
    vsprintf. O/P a va_list into a string. 
    void keyword. 
    void *(void pointer). 
    volatile keyword. 
     
    W
    Width of a field. (printf, scanf etc) 
    while keyword. 
    Why use pointers?
    write function. 
    Write data to a file.
     
    W continued
     
    X
    \x Hex Character constant
    %x Hex formatting (printf, scanf etc) 
    X program examples. 
     
    X continued
     
    Y
     
    Y continued
     
    Z
     
    Z continued
     

    Top Master Index Keywords Functions

    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/Makefile.am0000644000076400001440000000035607055333557014472 EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) SUBDIRS = CONCEPT CONTRIB EXAMPLES FUNCTIONS GDB LIBRARIES MAN MISC PROBLEMS SYNTAX TECHNIC \ X_EXAMPLES backup docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/Makefile.in0000644000076400001440000003417107474405126014502 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) SUBDIRS = CONCEPT CONTRIB EXAMPLES FUNCTIONS GDB LIBRARIES MAN MISC PROBLEMS SYNTAX TECHNIC \ X_EXAMPLES backup docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = Makefile.am Makefile.in DIST_SUBDIRS = $(SUBDIRS) #>- all: all-recursive #>+ 1 all: docs-am all-recursive .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) GTAGS: here=`CDPATH=: && cd $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=blueball.gif master_index.html glossary.html cref.html master.gif compiler.html future.html c.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done for subdir in $(SUBDIRS); do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-recursive #>+ 1 clean: kde-rpo-clean clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-generic clean-libtool clean-recursive distclean \ distclean-generic distclean-libtool distclean-recursive \ distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ info-recursive install install-am install-data install-data-am \ install-data-recursive install-docsDATA install-exec \ install-exec-am install-exec-recursive install-info \ install-info-am install-info-recursive install-man \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-libtool mostlyclean-recursive tags tags-recursive \ uninstall uninstall-am uninstall-docsDATA uninstall-info-am \ uninstall-info-recursive uninstall-recursive # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/master_index.html0000644000076400001440000020214007055333557016001 Master Index.  



     
     

    ?

    # 

    A

    B 

    C

    D 

    E

    F 

    G

    H 

    I

    J 

    K

    L 

    M

    N 

    O

    P 

    Q

    R 

    S

    T 

    U

    V 

    W

    X 

    Y

    Z 

     
     
    ?
    % format identifer. 
    % Operator (modulo). 
    + Operator (addition). 
    - Operator (Subtraction). 
    / Operator (division). 
    /* Open a comment. 
    // Inline comment (C++).
    * Operator (Multiplication). 
    * width/percision formating character. 
    * Pointer operator (Unary). 
    */ Close a comment. 
    -- Operator (decrement). 
    ++ Operator (increment). 
    = Operator (Assignment, Equals). 
    *= Operator. 
    /= Operator. 
    %= Operator.
    += Operator. 
    -= Operator. 
    <<= Operator.
    >>= Operator.
    &= Operator. 
    ^= Operator. 
     
    ? continued
    |= Operator.
    == Operator. 
    != Operator. 
    > Operator. 
    < Operator.
    >= Operator.
    <= Operator. 
    && Operator. 
    || Operator. 
    ! Operator. 
    & Reference Variables (C++).
    & Bitwise AND Operator (binary). 
    | Bitwise OR Operator (binary). 
    ^ Operator. 
    << Shift Left Operator. 
    >> Shift Right Operator. 
    ~ Operator. 
    & Address of Operator (Unary). 
    ? Operator. 
    : Operator. 
    . Operator (structure member). 
    -> Operator (structure pointer). 
    ... in function declarations. 
    , Comma Operator. 
     
    #
    #include preprocessor 
    #define preprocessor 
    #if preprocessor 
    #ifdef preprocessor 
    #ifndef preprocessor 
    #line preprocessor 
     
    # continued
    #undef preprocessor 
    #pragma preprocessor 
    #else preprocessor 
    #error preprocessor 
    #elif preprocessor 
    #endif preprocessor 
     
     
    A
    abort a program. 
    abs function. Aboslute value of an integer. 
    acos function. 
    AND Operator. 
    ANSI Standard headers
    Archive libraries.
    ARGC and ARGV[]
    Arithmetic Operators
    Arrays
    Arrarys of Structures
    Array sorting
    Assignment Operators
     
    A continued
    Ascii table. 
    asctime function 
    asin function. 
    assert function. 
    Assignment Constructors C++ class
    atan function. 
    atan function. 
    atexit Execute the named function when the program terminates. 
    atof
    atoi Accepts +-0123456789 leading blanks and converts to integer. 
    atol
    Audible Alert \a
    auto keyword. 
     
     
    B
    Backspace \b
    Base conversion.
    basename strip directory information from a file name. 
    Bell \a
    Binary formating problem.
    Bits
    Bitwise Operators
     
    B continued
    Book list
    boolean
    bool datatype (C++).
    break keyword. 
    bsearch function. 
    Bytes
     
     
    C
    Carriage Return \r
    case keyword. 
    cast
    ceil function. 
    Change working directory.
    close function. 
    closedir function. 
    %c Character formatting (printf, scanf etc) 
    char keyword. 
    Character arrays
    Character Constants.
    Character I/P & O/P in files.
    chdir function. 
    class C++ keyword 
    class Inheritance(C++)
    class keyword (C++)
    clock function. 
    clrscr Clear screen 
    clrscr Program to clear the screen using VT escape sequence.
    Coding idioms.
    Comma operator. 
     
    C continued
    Command line arguments
    C Comments.
    Commentsin C++. 
    Comman coding errors.
    Compare strings
    Compare strings ignoring case.
    Compilers
    Compiler Error messages (GCC)
    Completion codes
    Concatenate strings.
    const keyword.
    const keyword. In classes
    Constants.
    constructors C++ class
    continue keyword. 
    Conversion table between ASCII Binary, Decimal, Hex 
    Convert Unix file to DOS format
    Convert Unix path names to DOS path names.
    Copy Constructors C++ class
    Copy strings.
    Copy a file.
    Create Environmental variables.
    ctime function 
     
     
    D
    Data types
    Data type conversion
    Date functions. 
    %d Decimal formatting (printf, scanf etc) 
    Declaration
    Debugging
    Decimal Ascii table. 
    Decrementing.
    Default Constructors C++ class
    Default Parameter values. (C++)
    default keyword. 
    #define Preprocessor
    Definition
     
    D continued
    deleteC++.
    Destructors C++ class
    difftime function. 
    Directory access functions. 
    Directory information stipped from a file name. 
    do keyword. 
    Domain name.
    double keyword. 
    Download the source. 
    dup duplicate a file descriptor. 
    dup2 duplicate a file descriptor. 
    dynamically allocate memory.
    dynamic libraries
     
     
    E
    %e formatting (printf, scanf etc) 
    #elif preprocessor
    #else preprocessor
    else keyword. 
    #edif preprocessor
    endpwent function. 
    enum keyword. 
    enum. C++ changes.
    environ example. 
    errno.h ANSI header. 
    #error preprocessor
    escape codes. 
    Environmental variables.
    Evaluation of operators
     
    E continued
    Example programs.
    execl function.
    execlp function.
    execle function.
    exect function.
    execv function.
    execvp function.
    exit function. 
    Expressions
    extern keyword. 
     
     
    F
    File descriptor
    %f formatting (printf, scanf etc) 
    fabs function. 
    FALSE
    fclose Close a file. 
    feof Check for EOF while reading a file. 
    fgetc Read a character from a file. 
    fgetpwent function. 
    fgets
    field width. (printf, scanf etc) 
    File status, permissions, ownership etc. 
    Float arrays
    float keyword. 
    float.h ANSI header. 
    Floating point Constants.
    floor function. 
     
    F continued
    fopen Open a file 
    format flags. (printf, scanf etc) 
    fork a child process. 
    Formfeed \f Read a record from a file (safer than fgetc). 
    for keyword 
    formatting (printf, scanf etc) 
    fprintf O/P a line of data to a file. 
    fputc Write a character to a file.
    friend C++ keyword.
    free function to release memory allocated with malloc. 
    fputs Write a string to a file. 
    fstat File status, permissions, ownership etc. 
    functions writing. 
    functions ANSI library. 
    Function Overloading. (C++)
    Functions (pointers to)
    Functions (static)
    static functions in C++.
     
    G
    %g formatting (printf, scanf etc) 
    GDB debugger
    getenv Get an environmental variable. 
    getchar Get a character from the keyboard (STDIN). 
    getc Get a character from an input stream. 
    getch function. 
    getche function. 
    geteuid function. Get a Users effective ID. 
    gethostname function. Get the name of this host! 
    getopt function. Parse the command line. 
     
    G continued
    getpid function. Get the process id. 
    getppid function. Get the parent process id. 
    getpw function. 
    getpwent function. 
    getpwnam Get a record from /etc/passwd by keying on the user name. 
    getpwuid Get a record from /etc/passwd by keying on the UID. 
    gets function. Get string (from keyboard). 
    getuid function. Get a Users real ID. 
    Global variables. 
    Glossary (C)
    Glossary (C++) 
    gmtime function 
    goto keyword. 
    Got Ya! Comman coding errors. 
     GREP command for DOS users.
    Group ID.
     
    H
    Headers (standard). 
    Hex base conversion.
    Hex dump program. 
    Hex table. 
     
    H continued
    Hex Character constant \x
    Hex formatting (printf, scanf etc) 
    Horizontal tab \t
    Host name via the 
    uname function. 
    Host name via the 
    gethostname function. 
     
    I
    %i Decimal formatting (printf, scanf etc) 
    Idioms.
    Incrementing
    #include Preprocessor
    #if preprocessor
    #ifdef preprocessor
    #ifndef preprocessor
    if keyword. 
    index Search for a character in a string. 
    inline C++ keyword.
    Inheritance (C++)
    input from the keyboard
    int keyword. 
    Integer arrays
    Integer Constants.
    integer formatting. 
    I/O
     
    I continued
    input from the keyboard
    int keyword. 
    Integer arrays
    Integer Constants.
    integer formatting. 
    I/O
    isalnum Checks whether a character is alphanumeric (A-Z, a-z, 0-9) 
    iscntrl Checks whether a character is a control character or delete ( decimal 0-31 and 127) 
    isdigit Checks whether a character is a digit (0-9) 
    isgraph Checks whether a character is a printable character, excluding the space (decimal 32) 
    islower Checks whether a character is a lower case letter (a-z). 
    isprint Checks whether a character is printable (decimal 32-126). 
    ispunct Checks whether a character is punctuation (decimal 32-47, 58-63, 91-96, 123-126) 
    isspace Checks whether a character is white space - space, CR HT VT NL, FF. 
    isupper Checks whether a character is an upper case letter (A-Z). 
    isxdigit Checks whether a character is hex digit (0-9, A-F, a-f). 
     
    J
     
    J continued
     
    K
    keyboard input. 
    Keywords.
    Keywordsadded to C++ 
    kill a process.
     
    K continued
     
    L
    labs function. 
    libraries (user)
    limits.h ANSI header. 
    #line preprocessor
    Linked lists
    locale.h ANSI header. 
    Local variables. 
    localtime function. 
     
    L continued
    Logical AND Operator. 
    Logical OR Operator. 
    long keyword. 
    setjmp.h ANSI header. 
    Love Tim Love's C programming documentation. 
    Low level I/O
    Lowercase to uppercase character conversion.
    lstat function. Get file status, permissions, ownership etc. 
     
    M
    Macros
    Machine type.
    malloc function to dynamically allocate memory. 
    math.h
    member of a structure
    memchr function. 
    memcmp function. 
     
    M continued
    memcpy function. 
    memove function. 
    memset function. 
    mkdir function. 
    mktime function. 
    Mirror sites.
    modulo
    Modifiers
     
    N
    %n formatting (printf, scanf etc) 
    namespace C++ keyword.
    new C++.
    Newline \n
    NOT Operator. 
    Null.
    Number base conversion.
    Number base converter.
    Nutshell book examples.
     
    N continued
     
    O
    %o Octal formatting (printf, scanf etc) 
    \o Octal Character constant
    open function. 
    opendir function. 
    operator C++ keyword.
    Operators Operator 
    Precedence
    Operand definition. 
    OR Operator. 
    O'Reilly books.
     
    O continued
    Overloading Functions. (C++)
    P
    %p formatting (printf, scanf etc) 
    password functions. 
    pclose Close a pipe. 
    perl in C code
    pipe function. 
    Pointers
    Pointers to arrays.
    Pointers to functions
    Pointers to pointers
    Pointers to Strings
    Pointers to structures
    pointer (void)
    popen Open a pipe. 
    pow raise a number by a given power. 
    Practical C (O'Reilly) examples.
     
    P continued
    #pragma preprocessor
    Precedence of operators. 
    Preprocessor instructions
    printenv program. 
    printf O/P data to the screen or a file. 
    Problems for you to solve.
    Process ID.
    Process - is a PID active? 
    Program examples.
    Program name.
    putc 
    putchar. O/P a character to STDOUT. 
    putenv Create an environmental variable. 
    puts O/P data to the screen or a file. 
     
    Q
    qsort
    qsort O'Reilly 'Using C' example. 
     
    Q continued
     
    R
    \r Carriage Return
    rand function. 
    random numbers. 
    RAND_MAX numbers. 
    read function. 
    readdir function. 
    Read data from a file.
    Reference Variables (C++).
     
    R continued
    register keyword.
    Relational Operators
    Remote Procedure Calls
    rename function. Rename a file.
    Return code.
    return keyword.
    reverse Program to reverse characters in a string.
    rewinddir function.
    rint function.
    rmdir function.
    RPC Remote Procedure CAlls 
     
    S
    S_ISLNK Is this a link.
    S_ISREG Is this a regular file.
    S_ISDIR Is this a directory
    S_ISCHR
    S_ISBLK
    S_ISFIFO
    S_ISSOCK
    %s String formatting (printf, scanf etc) 
    scandir function. 
    scanf 
    scope
    seekdir function. 
    setenv Create an environmental variable. 
    setjmp.h ANSI header. 
    setpwent function. 
    setuid function. 
    short keyword. 
    signal.h ANSI header. 
    signed keyword. 
    sizeof. Return the storage allocation for a 
    data type.
    sleep function. Pause for the specified number of seconds. 
    sort an array. 
    sprintf O/P data in tha same way as 'printf' but put it into a string. 
    sqrt Square root of a number. 
    srand function. 
    sscanf function. 
    Standard C++ Library
    Standard headers
    Standard headers
    stat function. Get file status, permissions, ownership etc. 
    statfs function. Get filesystem status, free blocks, block size etc. 
    static keyword. 
    static in C++.
    static libraries
    stdarg.h ANSI header. 
    stddef.h ANSI header. 
    STDERR
    STDIN
    stdlib.h
    STDOUT
    Storage clase
    strcat function. Concatenate strings. 
    strcasecmp Compare strings ignoring case. 
    strchr Search for a character in a string. 
    strcmp Compare strings. 
    strcoll function. Compare two strings. 
     
    S continued
    strcpy Move strings. 
    strcspn function. Search a string for a set of characters. 
    strftime function. 
    String Constants.
    String pointers
    String formating
    strlen
    strncat function. Concatenate strings. 
    strncmp Compare strings. 
    strncpy Copy N bytes from one string to another. 
    strpbrk function 
    strrchr Search for a character in a string. 
    strrchr function. 
    strspn function. 
    strstr function. Search a string for a substring. 
    strtok function. The books say this function splits a string into tokens. I think its function is best described as parsing a string. 
    strtol Convert String to a long integer. 
    struct keyword. 
    Structure arrays
    Structure basics
    Structure membership
    Structure pointers
    strxfrm function.
    swap two values. 
    switch keyword. 
    Syntax.
    system Issue a system command. 
    system calls
    system information
     
    T
    \t Horizontal tab
    telldir function. 
    threads
    time functions. 
    time.h header. 
     
    T continued
    tolower function. Convert an uppercase character to lowercase. 
    toupper function. Converts a lowercase character to uppercase. 
    TRUE
    Tutorials on the net
    Data type conversion
    typedef keyword. 
     
    U
    %u formatting. 
    uname function. 
    #undef preprocessor
    union keyword. 
    unistd header. 
    Unix to DOS file conversion
     
    U continued
    unlink function, delete a file. 
    unsetenv function. Remove an environmental variable. 
    unsigned keyword. 
    unsigned integer formatting. 
    Uppercase to lowercase character conversion.
    Users /etc/passwd entry.
    Using C (O'Reilly) examples.
     
    V
    va_arg
    va_end
    va_list
    va_start
    Variables.
    Variable definition.
    Variable function parameter lists
    Variables - Reference(C++).
     
    V continued
    Vertical tab \v
    vfprintf. Print a va_list to a file. 
    vprintf. Print a va_list 
    vsprintf. O/P a va_list into a string. 
    void keyword. 
    void *(void pointer). 
    volatile keyword. 
     
    W
    Width of a field. (printf, scanf etc) 
    while keyword. 
    Why use pointers?
    write function. 
    Write data to a file.
     
    W continued
     
    X
    \x Hex Character constant
    %x Hex formatting (printf, scanf etc) 
    X program examples. 
     
    X continued
     
    Y
     
    Y continued
     
    Z
     
    Z continued
     

    Top Master Index Keywords Functions

    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/cref.html0000644000076400001440000000321207055333530014224 C Programming Reference

    C Programming Reference.

    Release 1.08



               C++ notes
     
    Top Master Index Keywords Functions


    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/0000777000076400001440000000000007474405224014062 5c_cpp_reference-2.0.2/reference/C/FUNCTIONS/fputc.html0000644000076400001440000000276307055334672016020 fputc function

    fputc function


    fputc writes one character to a file.


    Library:   stdio.h
    
    Prototype: int fputc(int c,  FILE *stream);
    
    Syntax:    FILE *fp;
               int  ch = 'a';
    
               fp = fopen("/tmp/file", "w");
    	   fputc(ch, fp);
               fclose(fp);
    
    

    Example program. Copy a file.


    Man pages

    fputc Write a character.


    See Also:


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/strlen.html0000644000076400001440000000276407055334644016206 strlen function


    strlen function


    strlen will give you the length of a string, NOT including the '\0' terminator. It should not be confused with the sizeof operator which returns the size of a variable (that could hold a string).

    Library:   string.h
    
    Prototype: size_t strlen(const char *s);
    
    Syntax:	   size_t size;
    	   char string[20]="red dwarf";
               size = strlen(string);
    

    Examples

    Example program.

    See Also

    strlen man page.

    sizeof operator.

    lenstr - User written version of strlen.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/directory.html0000644000076400001440000000562107055334667016703 Directory functions.


    Directory functions


    OK. First things first. These functions are NOT part of the ANSI standard library. They may not be supported on your platform.

    Here is a quick summary of each function, they are listed in the order in which you may want to execute them.

  • opendir Open a directory stream.
  • readdir read the current entry in the stream.
  • scandir Find an entry in a direcory.
  • seekdir Jump to a directory offset.
  • telldir Return the current location within the directory stream.
  • rewinddir Return to the start of the directory stream.
  • closedir Close a directory.
    
      Library:   dirent.h
    
      Prototype: DIR *opendir(const char *name);
    
                 struct dirent *readdir(DIR *dir);
    
                 int scandir(const char *dir, struct dirent ***namelist,  
                     int (*select)(const struct dirent *),
                     int (*compar)(const void *, const void *));
    		
    	     void seekdir(DIR *dir, off_t offset);
    
    	     off_t telldir(DIR *dir);
    
    	     void rewinddir(DIR *dir);
    
    	     int closedir(DIR *dir);
    
    The dirent structure does not seem to be documented in the man pages, so here it is.

    
    	struct dirent 
    	{
              long            d_ino;
           	  off_t           d_off;
           	  unsigned short  d_reclen;
           	  char            d_name[NAME_MAX+1];
    	};
    
    example program using opendir, readdir and closedir.


    See Also:

    stat function.


    man Pages:

    opendir readdir scandir seekdir telldir rewinddir closedir


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/close.html0000644000076400001440000000262307055334707015776 close function


    close function


    close


    	Library:   unistd.h
    
    	Prototype: int close(int fd);
    
    	Syntax:    int fd;
    
    		   close(fd);
    
    


    Examples:

    pipe example program.

    Man Pages:

    close man page.

    See Also:

    pipe function.

    open function.

    write function.

    fclose function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/Master.html0000644000076400001440000000206307055334667016127 XXXX function


    XXXX function


    XXXX


    	Library:   stdlib.h
    
    	Prototype: char *gets(char *s);
    
    	Syntax:    char read_line[80];
    
                       gets( read_line);
    
    

    Examples:

    example program.

    See Also:

    malloc function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/getopt.html0000644000076400001440000000201707055334671016170 getopt function


    getopt function



    Examples:

    Example using argc and argv

    See Also:

    command line arguments (argc/argv).

    getopt man page.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/atexit.htm0000644000076400001440000000303307055334665016012 ATEXIT function


    ATEXIT function


    atexit regesters a function to be executed when the program terminates normally.


    
    	Library:   stdlib.h
    
    	Prototype: int atexit(void (*function)(void));
    
    	Syntax:    void End(void);
            
                       main()
                       {
                         atexit(End);
                       }
    
                       void End(void)
                       {
                         printf("The End\n");
                       }
    
    

    Please see function pointers for information on how this works.


    Examples:

    example program.

    See Also:

    exit function.

    abort function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/strchr.html0000644000076400001440000000325107055334645016175 strchr strrchr functions


    strchr strrchr functions


    • strchr will find the first matching character in a string.

    • strrchr will find the last matching character in a string.

    The functions will return a pointer to the character or NULL if the character is not found.
    Library:   string.h
    
    Prototype: char * strchr(const char *string, int character);
    
    Syntax:	   int character='w';
    	   char *string="red dwarf";
               if(strchr(string, character)) puts("Character found");
    

    See Also:

    strstr which looks for a sub-string in a string.

    strpbrk

    index and rindex do the same as strchr and strrchr but are non standard.


    Example program (from Dave Doolin).


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/fgetc.html0000644000076400001440000000245607055334643015764 fgetc/getc function


    fgetc/getc function


    fgetc and getc both read a character from a file (input stream) and have the same syntax. They are for all intents and purposes the same!
    Library:   stdio.h
    
    Prototype: int fgetc(FILE *stream);
    
    Syntax:    FILE *file_pointer;
    	   char ch;
    
    	   ch = fgetc(file_pointer);
               ch = getc(file_pointer);
    
    

    Examples:

    Example program.


    See also:

    getch, getche (non standard)


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/arglists.html0000644000076400001440000000176207055334645016525 Function argument lists.


    Function argument lists.


    Normally, a function has a fixed number of arguments passed to it. But if you have used something like 'printf' or 'scanf' you will know that a variable number of arguments can be passed. This ability is defined by the use of ... (three periods). Here is an example.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/time.html0000644000076400001440000000352607055334665015635 time and date related functions


    time and date related functions.


    The following information gives a taste of the date and time related functions. It stikes me that this is overly complicated, but what do I know... To review all the functions available in the standard library, click here.

    
      Library:   time.h
    
      Prototype: char *asctime( const struct tm *time);
                 char *ctime(const time_t *timer);
                 struct tm *localtime(const time_t *timer);
                 size_t strftime(char *s, 
              		     size_t maxsize, 
    		   	     const *format,
    	   		     const struct tm *time);
    
      Syntax:    
    
    

    The prototype list does NOT list all the functions that are described in time.h - only the ones I have used and shown in the example that follows.

    Example program.

    Here is a time related problem.


    See also:


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/strpbrk.html0000644000076400001440000000253007055334666016361 strpbrk function


    strpbrk function


    strpbrk locates characters in a string.


    Library:   string.h
    
    Prototype: char * strpbrk(const char *string1, const char *string2);
    
    Syntax:	   char *ptr;
    	   char string1[]="martin was ere";
    	   char string2[]="ea";
    
    	   ptr=strpbrk(string1, string2);
    
    In this example ptr will be pointing to the first a within martin was ere

    See Also:


    Example:

    Change field seperators to 'blank'.

    MAN PAGE


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/write.html0000644000076400001440000000314507055334675016027 write function


    write function


    write


    	Library:   unistd.h
    		   sys/types.h
    
    	Prototype: int write(int fd, char *Buff, int NumBytes);
    
    	Syntax:    int fd;
                       char Buff[]="V8 cars are coool";
    
    		   write(fd, Buff, strlen(Buff)+1);
    
    

    Examples:

    pipe example program.

    See Also:

    pipe function.

    open function.

    close function.

    read function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/exit.html0000644000076400001440000000231707055334656015645 exit function


    exit function


    exit causes the program to end and supplies a status code to the calling environment.
    Library:   stdlib.h
    
    Prototype: void exit(int status);
    
    Syntax:	  
    	   main()
               {
                 exit(0);		/* Clean exit */
    	   }
    

    No example program.


    See also:

    return keyword.

    atexit function.

    abort function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/atof.html0000644000076400001440000000235607055334652015624 atof function


    atof function


    atof to be done.

    Library:   stdlib.h
    
    Prototype: double atof(const char *ptr);
    
    Syntax:	  
    
    example program.


    See also:

    atoi String to integer conversion.
    atol String to long integer conversion.
    strtod String to double conversion.
    strtol String to long integer conversion.
    strtoul String to unsigned long integer conversion.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/setuid.html0000644000076400001440000000366007055334662016170 User ID.

    User ID.

    Various functions to change and see a User or Group ID. These are NOT ANSII standard functions. Do not expect them all to work on your machine....


    Man pages.

    getuid Get a users real ID.

    geteuid Get a users effective ID.


    setuid Set real and effective process ID.

    seteuid Set effective process ID.

    setruid Set real process ID.

    setgid Set real and effective Group ID.

    setegid Set effective Group ID.


    setreuid Seems to have different uses on Sun and RS/6000.

    setuidx RS/6000 (AIX only).

    getuidx RS/6000 (AIX only).


    Some notes


    Example program.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/atoi.html0000644000076400001440000000270507055334651015624 atoi function


    atoi function


    atoi to be done.

    Library:   stdlib.h
    
    Prototype: 
    
    Syntax:	  
    

    Example:

    example program.


    See also:

    atof String to floating point conversion.
    atol String to long integer conversion.
    strtod String to double conversion.
    strtol String to long integer conversion.
    strtoul String to unsigned long integer conversion.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/execl.html0000644000076400001440000000265307055334672015775 execl family of functions


    execl family of functions


    execl execlp execle exect execv execvp all performa a simular function by starting another program. This new program overlays the existing program, so you can never return to the to original code unless the call to execl fails.


    	Library:   unistd.h
    
    	Prototype: int execl(char *Path, char *arg, (char *)0);
    
    	Syntax:    execl("newprog", "newprog", NULL);
    
    

    Examples:

    example program issuing the execl.

    The program started by the example above


    See Also:

    fork function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/memcpy.htm0000644000076400001440000000433307055334673016011 memcpy function


    memcpy function


    memcpy copies data between two memory locations. This function will copy the supplied number of bytes stored at the location pointed to by 's2' to the location pointed to by 's1'.

    
         	s1		s2
    	|		|
    	V		V
            - - - -		---------------	
           | | | | |       | a | b | c | d |
            - - - -		---------------	
    	^ ^		|    |
    	| |		|    |
    	 -|-------------     |
    	   ------------------
    


    Prototype

        Library:   string.h
    
        Prototype: char memcpy(void *s1, void *s2, int num);
    
        Syntax:
                   float data1;
                   char  data2[64];
                   
                   memcpy(data1, data2, sizeof(data2));
    


    Notes

    This is a handy function for moving data between data types

    See also:


    strncpy
    strcpy
    sprintf
    strcat
    strings
    memcpy Copy data from one memory location to another.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/strtok.html0000644000076400001440000000431507055334655016221 strncpy function


    strtok function


    All the books that I have read, say that strtok will break a string into tokens. This is true, but a more obvious explanation is, that it will break a string into words.


    
    Library:   string.h
    
    Prototype: char * strtok(char *s, const char *delim);
    
    Syntax:	   char string []="abc def ghi";
    	   char * word;
    
    	   word=strtok(string, " ");
    	   word=strtok(NULL, " ");
    
    
    strtok requires a string and the word delimiters, for example:
    
    	   word = strtok(string, " ");
    	                   A      A
    	                   |      |
    	                   |	  -------  Delimiters.
    	                   |
    	                   --------------  String to break up.
    
    
    After the first call to strtok, word will point to abc on the second call, word will point to def


    Notes:

    • strtok will alter the I/P string by placing NULLS at the delimiter positions. A good habit is to copy the string to a tempary string and use the copy in the strtok call.

    • More than one delimiter can be specified. So you could code:
      
      	word = strtok(string, " \t;:,");
      	                         
      
    • You do not have to include \0 or NULL

    Examples:

    Example program.

    See also:

    strcpy
    strncpy


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/fopen.html0000644000076400001440000000452107055334657016003 fopen function


    fopen function


    fopen is used to open a file for read, write or update. stdin, stdout & stderr are opened by the system at execution time.

    
    Library:   stdio.h
    
    Prototype: FILE *fopen(const char *filename, const char *mode);
    
    Syntax:    FILE *fp;
    	   fp = fopen( "/etc/printcap", "r");
    
    

    Notes:

    	filename - is the name of the file.
    	mode     - r - read file.
                     - w - Write to file.
                     - a - Append to file.
    
    

    Example Programs:

    Example program.


    See Also:

    fgetc Get a character from a file.
    fgets Get a record from a file.
    fputc Put a character into a file. MAN PAGE.
    fprintf Put a formatted line into a file.
    fclose Close a file.
    pclose Close a pipe.
    system Open a pipe.
    ferror. Check error code on a file stream.
    feof. Check for EOF on a file stream.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/atol.html0000644000076400001440000000232107055334653015623 atol function


    atol function


    atol to be done.

    Library:   stdlib.h
    
    Prototype: 
    
    Syntax:	  
    
    example program.


    See also:

    atof String to floating point conversion.
    atoi String to integer conversion.
    strtod String to double conversion.
    strtol String to long integer conversion.
    strtoul String to unsigned long integer conversion.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/strtol.html0000644000076400001440000000444607055334651016223 strtol function


    strtol function


    strtol will convert a string to a long integer. An important feature of this function is the ability to accept data in various number bases and convert to decimal. If you are just working with decimal numbers, atoi is probably an easer function to use.


    
    Library:   stdlib.h
    
    Prototype: long int strtol(const char *sptr, char **endptr, int base);
    
    Syntax:	   char     String[]="ff";		/* string to convert	*/
    	   int      Base=16;			/* Base 16		*/
               long int Ans;			/* Result		*/
    
               Ans = strtol(String, NULL, Base);
    

    Notes

    The second argument (char **endptr) seems to be a waste of space! If it is set to NULL, STRTOL seems to work its way down the string until it finds an invalid character and then stops. All valid chars read are then converted if the string starts with an invalid character the function returns ZERO (0).

    The Third argument (base) can have a value of 0 or 2-32.

    • 0 - strtol will attempt to pick the base. Only Dec, Oct Hex supported.
    • 2-31 - The base to use.

    Examples:

    Example program.


    See also:

    atoi String to integer conversion.
    atof String to floating point conversion.
    atol String to long integer conversion.
    strtod String to double conversion.
    strtoul String to unsigned long integer conversion.
    Conversion table.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/pipe.html0000644000076400001440000000420207055334673015623 pipe function


    pipe function


    pipe creates two file descriptors which can be used by parent and child processes to communicate data. A child process can be created with the fork function.


    
    	Library:   unistd.h
    
    	Prototype: int pipe(int fd[2]);
    
    	Syntax:    int fd[2];
    		   pipe(fd);
    


    On error, pipe returns -1.

    Once the pipe has been executed, the data can be transfered using read and write.


    Notes:

    Make sure that when you read exactly the same number of bytes that are written! I spend HOURS trying to figure out why I was loosing data because of this feature!!

    Examples:

    read and write fixed length records.

    read and write variable length records.


    See Also:

    fork

    popen function.

    pclose function.

    read function.

    write function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/clrscr.html0000644000076400001440000000157007055334645016162 clrscr function

    clrscr function

    clrscr clears the screen. This is non standard.
    Library:   conio.h
    
    Prototype: 
    
    Syntax:	   
    
    See also: Clear the screen using VT escape codes.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/passwd.html0000644000076400001440000000341607055334663016174 Password file functions.


    Password file functions.


    Various functions to extract information from the /etc/passwd file. This will not work on DOS machines.


    man pages.

    Some of these links may not work as your system may not support all the functions.

    getpwuid Get a record by keying on the UID (numeric).

    getpwnam Get a record by keying on the user name.

    fgetpwent

    getpwent

    setpwent

    endpwent

    getpw

    putpwent


    Some notes


    Example program.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/format.html0000644000076400001440000001520107055334647016160 printf format identifiers.


    printf format identifiers.


    printf formatting is controlled by 'format identifiers' which, are shown below in their simplest form.

    
        %d %i     Decimal signed integer.
        %o	      Octal integer.
        %x %X     Hex integer.
        %u	      Unsigned integer.
        %c	      Character.
        %s	      String. See below.
        %f	      double
        %e %E     double.
        %g %G     double.
        %p        pointer.
        %n	      Number of characters written by this printf.
                  No argument expected.
        %%	      %. No argument expected.
    
    

    These identifiers actually have upto 6 parts as shown in the table below. They MUST be used in the order shown.

    % Flags Minimum field width Period Precision. Maximum field width Argument type
    Required Optional Optional Optional Optional Required


    %

    The % marks the start and therfore is manatory.


    Flags

    The format identifers can be altered from their default function by applying the following flags:

    
       -      Left justify.
       0  	  Field is padded with 0's instead of blanks.
       +	  Sign of number always O/P.
       blank  Positive values begin with a blank.
       # 	  Various uses:
    	  %#o (Octal) 0 prefix inserted.
    	  %#x (Hex)   0x prefix added to non-zero values.
    	  %#X (Hex)   0X prefix added to non-zero values.
    	  %#e         Always show the decimal point.
    	  %#E         Always show the decimal point.
    	  %#f         Always show the decimal point.
    	  %#g         Always show the decimal point trailing 
    	  	      zeros not removed.
    	  %#G         Always show the decimal point trailing
    		      zeros not removed.
              
    
    Here are a few more examples.

    
        printf(" %-10d \n", number);
        printf(" %010d \n", number);
        printf(" %-#10x \n", number);  
        printf(" %#x \n", number);
    


    Minimum field width.

    By default the width of a field will be the minimum required to hold the data. If you want to increase the field width you can use the following syntax.

    
      main()
      {
          int number    =  5;
          char *pointer = "little";
    
          printf("Here is a number-%4d-and a-%10s-word.\n", number, pointer);
      }
      
      /*********************************
       *
       *	Program result is:
       *
       * 	Here is a number-   5-and a-    little-word.
       *
       *********************************/
    

    As you can see, the data is right justified within the field. It can be left justified by using the - flag. A maximum string width can also be specified.

    The width can also be given as a variable as shown below.

    
        main()
        {
            int number=5;
    
            printf("---%*d----\n", 6, number);
        }
      
        /*********************************
         *
         *    Program result is:
         *
         *    ----     5---
         *
         *********************************/
    

    The * is replaced with the supplied int to provide the ability to dynamically specify the field width.


    Period

    If you wish to specify the
    precision of an argument, it MUST be prefixed with the period.


    Precision

    The Precision takes different meanings for the different format types.

    Float Precision

    	%8.2f
    
    This says you require a total field of 8 characters, within the 8 characters the last 2 will hold the decimal part.
    	%.2f
    
    The example above requests the minimum field width and the last two characters are to hold the decimal part.

    Character String Maximum field width

    The precision within a string format specifies the maximum field width.
    	%4.8s
    
    Specifies a minimum width of 4 and a maximum width of 8 characters. If the string is greater than 8 characters, it will be cropped down to size.

    Here is a little program that shows an alternative to strncpy.

    * Precision

    As with the 'width' above, the precision does not have to be hard coded, the * symbol can be used and an integer supplied to give its value.


    Format Identifiers

    The format identifier describes the expected data. The identifier is the character that ends Here is a list of the format identifers as used in 'printf' ,'sprintf' ,'fprintf' and 'scanf'.
    1. Except for '%' and 'n', all the identifiers expect to extract an argument from the printf parameter list.
    2. All of the parmameters should be the value to be inserted. EXCEPT %s, this expects a pointer to be passed.

    An example.

    
    	main()
            {
                int number=5;
    	    char *pointer="little";
    
    	    printf("Here is a number %d and a %s word.\n", number, pointer);
    	}
    	/*********************************
    	 *
    	 *	Program result is:
    	 *
    	 * 	Here is a number 5 and a little word.
    	 *
    	 *********************************/
    


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/fgets.html0000644000076400001440000000425607055334640016001 fgets function


    fgets function


    fgets is used to read a line of data from an external source.


    Library:   stdio.h
    
    Prototype: char *fgets(char *s, int n, FILE *stream);
    
    Syntax:    char  Data[80];
    	   char *ReturnCode;
    	   FILE *FilePointer;
    
    	   ReturnCode=fgets(Data, 80, FilePointer);
    
    	   ReturnCode == NULL when an error occours. The EOF is 
    	   considered to be an ERROR!
    

    Notes

    • fgets should be used in preference to gets as it checks that the incoming data does not exceed the buffer size.

    • If fgets is reading STDIN, the NEWLINE character is placed into the buffer. gets removes the NEWLINE.

    example program number one.

    example program number two.

    program comparing the action of gets and fgets when reading STDIN.


    See Also:

    • gets Read STDIN (keyboard by default).
    • fgetc Get a character from a file.
    • fputc Put a character into a file.
    • fprintf Put a formatted line into a file.
    • fopen Open a file.
    • fclose Close a file.
    • popen Open a pipe.
    • pclose Close a pipe.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/puts.html0000644000076400001440000000162407055334637015666 puts function


    puts function


    puts is used to print data on the screen (or to a file). Another related function is printf which is much more powerfull.

    Anyway here is an example of the puts function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/printf.html0000644000076400001440000000426307055334637016177 printf function


    printf function


    printf is used to O/P data to STDOUT (usually the screen). It has many formatting options which we shall look at in a moment.


    printf syntax

    This is an example of printf in its simplest form.

    
      #include <stdio.h>
    
      main()
      {
        printf("This text will appear on the screen\n");  
      }
    

    printf is passed one formatting argument. The unusual thing about the example (in my mind) is \n, this is actually an escape sequence that signals a new line. Without it, any printf's that follow would O/P to the same line. printf also takes extra arguments which are inserted into the format string at locations marked with a %.

    
      #include <stdio.h>
    
      main()
      {
        int number=42;
        printf("The answer is %i\n", number);  
      }
    

    What happens here is the %i is seen as a formatting identifer for the next argument (number). In this case an integer is expected.


    See also

    1. puts Much easier to use - but not as powerfull.
    2. sprintf Same as 'printf' but O/P to a string array.
    3. Strings.
    4. A dead handy printf idiom..


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/funcquery.htm0000644000076400001440000000101107055334707016524

    Please enter a search string.
    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/rand.html0000644000076400001440000000273107055334653015615 rand function

    rand function

    rand will generate a random number between 0 and 'RAND_MAX' (at least 32767).
    Library:   stdlib.h
    
    Prototype: int rand(void);
    
    Syntax:	   int r;                 		/* Random number	*/
    
               r = rand();
    

    Notes

    • Rand will always produce the same sequence of numbers unless srand is called to seed the start point.
    • RAND_MAX is only defined in ANSII header files.
    • A non standard function random is available on the Sun.

    example program.


    See also:

    srand Seed the randon number generator.
    rand man page.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/stdlib.html0000644000076400001440000000135007055334664016150


    stdlib.h


    This page is obsolete and has been replaced with this new page.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/strcpy.html0000644000076400001440000000475207055334655016224 strcpy function


    strcpy function


    strcpy copies a string. This function will copy the bytes stored at the location pointed to by 's2' to the location pointed to by 's1'.

    
         	s1		s2
    	|		|
    	V		V
            - - - -		- - - --	
           | | | | |       |a|b|c|\0|
            - - - -		- - - --	
    	^ ^		| |
    	| |		| |
    	 -|-------------  |
    	   ---------------
    

    Library:   string.h
    
    Prototype: char strcpy(char *s1, const char *s2);
    
    Syntax:	  
    	   char string2[20]="red dwarf";
    	   char string1[20]="";
               strcpy(string1, string2);
    

    Notes

    Dont forget that strings are terminated with a '\0' so allow space for it...

    There is another way to code the example above. Consider this piece of code.

    	main()
    	{
    	  char *string2="red dwarf";
    	  char *string1;
    
    	  string1=string2;
    	}
    
    'string2' is now a character pointer (only one byte) that points to a storage location containing "red dwarf" (a string constant). So string1=string2; copies the address of "red dwarf" into 'string1'. This version of the code will execute quicker than strcpy because less data is being moved around the system.
    example program.

    See also:

    strtok
    strncpy
    sprintf
    strcat
    strings
    memcpy Copy data between tow memory locations.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/free.html0000644000076400001440000000331207055334670015605 free function


    free function


    free is used to return allocated memory to the system.


    	Library:   sdlib.h
    
    	Prototype: void free(void *s);
    
    	Syntax:    char *StrPtr;
    		   StrPtr = (char *) malloc(100);
                       free(StrPtr);
    
    

    Notes:

    • If you use malloc inside a loop and dont free the memory, you run the risk of the program crashing.

    • If a program ends without issuing a free, any allocated memory is returned to the system.


    Examples:

    example program.

    See Also:

    malloc function.

    new C++ replacement for malloc.

    delete C++ replacement for free.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/strncpy.html0000644000076400001440000000307107055334654016372 strncpy function


    strncpy function


    strncpy copies 'n' bytes from one string to another.

    Library:   string.h
    
    Prototype: char strncpy(char s1, const char *s2, size_t n);
    
    Syntax:	   size_t n;
    	   char string1[20]="red dwarf";
    	   char string2[20]=";
               strncpy(string2, string1, 4);
    

    Notes

    • It may be nessacary to add your own NULL terminator.

    example program.

    An alternative method using 'sprintf'...


    See also:


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/open.html0000644000076400001440000000320407055334706015625 open function


    open function


    open


    	Library:   unistd.h
    		   sys/types.h
    		   sys/stat.h
    		   fcntl.h
    
    	Prototype: int open(char *Path, int Flags);
    
    	Syntax:    int fd;
    		   char *Path="/tmp/file";
    		   int Flags= O_WRONLY;
    
    		   fd = open(Path, Flags);
    
    

    Flags specify the file attributes. They must contain one of O_RDONLY, O_WRONLY or O_RDWR and may also have any of the following. O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, O_NONBLOCK, O_NDELAY, O_SYNC. See the man page for full details.


    Examples:

    pipe example program.

    See Also:

    pipe function.

    close function.

    write function.

    fopen function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/hex_tab.html0000644000076400001440000000373107055334641016301 Hex Ascii table


    Hex Ascii table.


    Here is the Ascii table in base 16.

      00    01    02    03    04    05    06    07    
      08    09    0A    0B    0C    0D    0E    0F    
      10    11    12    13    14    15    16    17    
      18    19    1A    1B    1C    1D    1E    1F    
      20    21 !  22 "  23 #  24 $  25 %  26 &  27 '  
      28 (  29 )  2A *  2B +  2C ,  2D -  2E .  2F /  
      30 0  31 1  32 2  33 3  34 4  35 5  36 6  37 7  
      38 8  39 9  3A :  3B ;  3C <  3D =  3E >  3F ?  
      40 @  41 A  42 B  43 C  44 D  45 E  46 F  47 G  
      48 H  49 I  4A J  4B K  4C L  4D M  4E N  4F O  
      50 P  51 Q  52 R  53 S  54 T  55 U  56 V  57 W  
      58 X  59 Y  5A Z  5B [  5C \  5D ]  5E ^  5F _  
      60 `  61 a  62 b  63 c  64 d  65 e  66 f  67 g  
      68 h  69 i  6A j  6B k  6C l  6D m  6E n  6F o  
      70 p  71 q  72 r  73 s  74 t  75 u  76 v  77 w  
      78 x  79 y  7A z  7B {  7C |  7D }  7E ~  7F    
    

    The decimal table is here.

    A program to generate this table.

    Conversion between Dec,Hec,Binary


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/fclose.html0000644000076400001440000000244507055334660016144 fclose function


    fclose function


    fclose is used to close a file.

    Library:   stdio.h
    
    Prototype: int fclose( FILE *stream);
    
    Syntax:    FILE *fp;
    	   fclose(fp);
    
    
    example program.


    See Also:

    • fgetc Get a character from a file.
    • fputc Put a character into a file.
    • fprintf Put a formatted line into a file.
    • fopen Open a file.
    • popen Open a pipe.
    • pclose Close a pipe.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/files.html0000644000076400001440000000317007055334662015771 Files - Character I/P & O/P functions.


    Files - character I/P & O/P functions.


    The following functions allow you to read & write characters in files.


    man pages.

    fputs Write a string.

    fgetc Read a character.

    getc Read a character.

    fputc Write a character to a file.

    ungetc Return a character.

    puts Write a string.

    putchar Write a string.

    putc Write a string.

    gets Read a string.

    getchar Read a character.


    Some of my notes

    fopen Open a file for read or write.

    fputc Write a character to a file.

    fclose Close a file.


    Example program.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/FUNCTIONS/gets.html0000644000076400001440000000363007055334664015634 fgets function


    gets function


    gets is used to read a line of data from STDIN. By default STDIN is the keyboard. gets continues to read characters until NEWLINE or EOF is seen.

    Library:   stdio.h
    
    Prototype: char *gets(char *s);
    
    Syntax:    char read_line[80];
    
    	   gets( read_line);
    

    Notes

    1. gets does NOT check the size of the buffer and overflow on the stack can occour. Because of this, you should use fgets in preferance.

    2. The NEWLINE character is NOT placed in the buffer. fgets will retain the NEWLINE. example showing fgets and gets in action.


      See Also:


  • Ungrouped functions


    XXXX function


    XXXX


    	Library:   stdlib.h
    
    	Prototype: char *gets(char *s);
    
    	Syntax:    char read_line[80];
    
                       gets( read_line);
    
    

    Examples:

    example program.

    See Also:

    malloc function.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/compiler.html0000644000076400001440000000677707055333534015146 GCC compiler error messages.


    GCC compiler error messages.


    This is a list of compiler error messages I have hit and the method used to clear them.


    warning: comparison between pointer and integer
    Maybe OK. This was generated from 'if (strstr(line,"word") != NULL )' strstr returns NULL or pointers, I was only interested in the fact that a string had been found, not where it was.


    `floppyto.c:782: parse error at end of input
    floppyto.c is the program name, 782 is the line number but it is one greater then the file length. This is because of unbalanced {} or unbalanced comments /* */


    parse error before `printf'
    Missing ; before this statement.


    Segmentation error.
    You have attempted to access protected storage or overwritten something important!


    subscripted value is neither array nor pointer
    Attempted to subscript a scalar variable.


    `j' undeclared (first use this function)
    Declare the variable.


    /usr/lib/crt0.o: Undefined symbol _main referenced from text segment
    Generated when main() is missing. I have seen this twice.
    1. When there was a syntax error in an included header file.
    2. And when the C source file was missing in the gcc command!


    Undefined symbol _initscr referenced from text segment
    Called a function but have not supplied it or the library that contains it with an #include statement.


    unterminated `#if' conditional
    #endif preprocessor required.


    warning: passing arg 1 of `cpystr' makes integer from pointer
    without a cast
    
    This is the code causing the problem:
    void cpystr( char item);
    main()
    {
       char src[]="martin leslie";
       cpystr(src);
    }
       cpystr(char item)
    {
    }
    
    It should be....
    void cpystr( char item[]);
    main()
    {
       char src[]="martin leslie";
       cpystr(src);
    }
       cpystr(char item[])
    {
    }
    


    conflicting types for `Alex'
    previous declaration of `Alex'
    
    Alex has been declared in two enum statements. Here is the code


    parse error before `1'
    At top level:
    warning: data definition has no type or storage class
    parse error before string constant
    warning: data definition has no type or storage class
    
    There is a conflict between enum and #define statements. Here is the code


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/CONCEPT/0000777000076400001440000000000007474405212013602 5c_cpp_reference-2.0.2/reference/C/CONCEPT/bitsnbytes.html0000644000076400001440000000351107055334565016601 Bits 'n Bytes


    Bits 'n Bytes.


    This is basic Computer Science but its worth restating the basics sometimes.


    bits

    A bit is the smallest component in computer memory, it has two states, either ON or OFF. These states are represented as 1 or 0 and thus everything is based on binary arithmatic.
    Off == 0
    On  == 1
    


    Bytes

    For convinence, bits are grouped into blocks of 8, these blocks are called Bytes. An integer byte can store any value from 0 -> 255. ------------------------- 128 64 32 16 8 4 2 1 ------------------------- 8 4 2 1 8 4 2 1 ------------------------- F F -------------------------

    KiloBytes

    This is a thousand bytes. The exact value is 2 to the power of 10 or 1,024

    MegaBytes

    This is a Million bytes. The exact value is 2 to the power of 20 or 1,048,576

    GigaBytes

    The exact value is 2 to the power of 30 or 1,073,741,824

    TeraBytes

    The exact value is 2 to the power of 40 or 1,099,511,627,776 (big....)


    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/expressions.html0000644000076400001440000001047607055334562017002 C operators

    C Operators/Expressions


    Operators are used with operands to build expressions. For example the following is an expression containing two operands and one oprator.

            4 + 5
    
    The following list of operators is probably not complete but does highlight the common operators and a few of the outrageous ones....

    C contains the following operator groups.

    The order (precedence) that operators are evaluated can be seen here.

    Arithmetic

            +
            -
            /
            *
            %       modulo
            --      Decrement (post and pre)
            ++      Increment (post and pre)
    

    Assignment

    These all perform an arithmetic operation on the lvalue and assign the result to the lvalue. So what does this mean in English? Here is an example:
       counter = counter + 1; 
    can be reduced to
       counter += 1;           
    Here is the full set.
            =
            *=      Multiply
            /=      Divide.
            %=      Modulus.
            +=      add.
            -=      Subtract.
            <<=     left shift.
            >>=     Right shift.
            &=      Bitwise AND.
            ^=      bitwise exclusive OR (XOR).
            |=      bitwise inclusive OR.
    

    Logical/Relational

            ==      Equal to
            !=      Not equal to
            >
            <
            >=
            <=
            &&      Logical AND
            ||      Logical OR
            !       Logical NOT
    

    Bitwise

            &       AND (Binary operator)
            |       inclusive OR
            ^       exclusive OR
            <<      shift left. C ++ use of <<
    
            >>      shift right. C ++ use of >>
            ~       one's complement
    

    Odds and ends!

            sizeof() size of objects and data types.
                     strlen may also be of interest.
            &       Address of (Unary operator)
            *       pointer (Unary operator)
            ?       Conditional expressions
            :       Conditional expressions
            ,       Series operator.
    

    C++ Extensions

    Read about :: >> and << in the world of C++ here!

    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/constants.html0000644000076400001440000000640707055334555016435 Constants

    Constants


    Be sure you understand the difference between a 'constant' and a declaration. A constant has a value that cannot be changed. For example:
    
    	1234
    	'x'
    	9.89
    	"String"
    
    
    Constants are used to assign a value to a variable. E.G
    	int i;		/* declare a variable called 'i'	*/
    	i=1234;		/* assign the constant value 1234 to 
    			 * the variable 'i'			*/
            i++;		/* Change the value of the variable.	*/
    

    Integer constants.

    Interger constants can be expressed in the following ways.
    	1234	(decimal)
    	0xff	(Hexidecimal)
    	0100	(Octal)
    	'\xf'	(Hex character)
    
    Examples of their use are:
    	int i=255;	/* i assigned the decimal value of 255	*/
    
    	i-=0xff		/* subtract 255 from i			*/
    
    	i+=010		/* Add Octal 10 (decimal 8)		*/
    
    			/* Print 15 - there are easier ways...	*/
    	printf ("%i \n", '\xf'); 
    
    
    Integer constants are assumed to have a datatype of
    int, if it will not fit into an 'int' the compiler will assume the constant is a long. You may also force the compiler to use 'long' by putting an 'L' on the end of the integer constant.
            1234L           /* Long int constant (4 bytes)          */
    
    The other modifier is 'U' for Unsigned.
            1234U           /* Unsigned int                         */
    
    and to complete the picture you can specify 'UL'
            1234UL          /* Unsigned long int                    */
    

    Floating point constants.

    Floating point constants contain a decimal point or exponent. By default they are double.
    	123.4
    	1e-2
    
    	
    

    Chararacter constants.

    Are actually integers.
    	'x'
    	'\000'
    	'\xhh'
    
    	escape sequences
    
    

    String constants.

    Strings do not have a datatype of their own. They are actually a sequence of char items terminated with a \0. A string can be accessed with a char pointer.

    An example of a string would be:

    
    	char *Str = "String Constant";
    
    
    See the discussion on strings for more information.


    Also see:


    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/data_types.html0000644000076400001440000001226407055334543016551 C Data types

    C Data types.


    Variable definition

    C has a concept of 'data types' which are used to define a variable before its use.

    The definition of a variable will assign storage for the variable and define the type of data that will be held in the location.

    So what data types are available?

    int float double char void enum

    Please note that there is not a boolean data type. C does not have the traditional view about logical comparison, but thats another story.

    Recent C++ compilers do have a boolean datatype.


    int - data type

    int is used to define integer numbers.

    
        {
            int Count;
            Count = 5;
        }
    


    float - data type

    float is used to define floating point numbers.

    
        {
            float Miles;
            Miles = 5.6;
        }
    


    double - data type

    double is used to define BIG floating point numbers. It reserves twice the storage for the number. On PCs this is likely to be 8 bytes.

    
        {
            double Atoms;
            Atoms = 2500000;
        }
    


    char - data type

    char defines characters.

    
        {
            char Letter;
            Letter = 'x';
        }
    


    Modifiers

    The three data types above have the following modifiers.

    • short
    • long
    • signed
    • unsigned
    The modifiers define the amount of storage allocated to the variable. The amount of storage allocated is not cast in stone. ANSI has the following rules:

    
            short int <=    int <= long int
                float <= double <= long double
    

    What this means is that a 'short int' should assign less than or the same amount of storage as an 'int' and the 'int' should be less or the same bytes than a 'long int'. What this means in the real world is:

    
                     Type  Bytes  Bits                Range
    
    
                short int    2      16          -16,384 -> +16,383          (16kb)
       unsigned short int    2      16                0 -> +32,767          (32Kb)
             unsigned int    4      16                0 -> +4,294,967,295   ( 4Gb)
                      int    4      32   -2,147,483,648 -> +2,147,483,647   ( 2Gb)
                 long int    4      32   -2,147,483,648 -> +2,147,483,647   ( 2Gb)
              signed char    1       8             -128 -> +127
            unsigned char    1       8                0 -> +255
                    float    4      32
                   double    8      64
              long double   12      96
    

    These figures only apply to todays generation of PCs. Mainframes and midrange machines could use different figures, but would still comply with the rule above.

    You can find out how much storage is allocated to a data type by using the sizeof operator.


    Qualifiers

    The const qualifier is used to tell C that the variable value can not change after initialisation.

    const float pi=3.14159;

    pi cannot be changed at a later time within the program.

    Another way to define constants is with the #define preprocessor which has the advantage that it does not use any storage (but who counts bytes these days?).


    See also:

    Data type conversion

    Storage classes.

    cast

    typedef keyword.


    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/bit_shift.html0000644000076400001440000001274707055334550016373 Bitwise operations

    Bitwise operations


    Bitwise operators include:

    & AND
    &= AND
    | OR
    |= OR
    ^ XOR
    ~ one's compliment
    << Shift Left
    >> Shift Right
    <<= Shift Left
    >>=Shift Right


    AND OR and XOR

    These require two operands and will perform bit comparisions.

    AND & will copy a bit to the result if it exists in both operands.

      
      main()
      {
        unsigned int a = 60;	/* 60 = 0011 1100 */  
        unsigned int b = 13;	/* 13 = 0000 1101 */
        unsigned int c = 0;           
    
        c = a & b;                  /* 12 = 0000 1100 */ 
      }
    
    

    OR | will copy a bit if it exists in eather operand.

      
      main()
      {
        unsigned int a = 60;	/* 60 = 0011 1100 */  
        unsigned int b = 13;	/* 13 = 0000 1101 */
        unsigned int c = 0;           
    
        c = a | b;                  /* 61 = 0011 1101 */ 
      }
    
    

    XOR ^ copies the bit if it is set in one operand (but not both).

      
      main()
      {
        unsigned int a = 60;	/* 60 = 0011 1100 */  
        unsigned int b = 13;	/* 13 = 0000 1101 */
        unsigned int c = 0;           
    
        c = a ^ b;                  /* 49 = 0011 0001 */ 
      }
    
    

    Try it out with the simulator

    Ones Complement

    This operator is unary (requires one operand) and has the efect of 'flipping' bits.

    
      main()
      {
        unsigned int Value=4;          /*   4 = 0000 0100 */  
    
        Value = ~ Value;               /* 251 = 1111 1011 */  
    
      }
    
    

    Try it out with the simulator


    Bit shift.

    The following
    operators can be used for shifting bits left or right.

    << >> <<= >>=

    The left operands value is moved left or right by the number of bits specified by the right operand. For example:

    
      main()
      {
        unsigned int Value=4;          /*  4 = 0000 0100 */  
        unsigned int Shift=2;
    
        Value = Value << Shift;        /* 16 = 0001 0000 */  
    
        Value <<= Shift;               /* 64 = 0100 0000 */  
    
        printf("%d\n", Value);         /* Prints 64      */  
      }
    
    

    Usually, the resulting 'empty' bit is assigned ZERO. Please use unsigned variables with these operators to avoid unpredictable results.

    Try them out with the simulator

    The simultaor will only work if the CGI scripts have been installed.


    Examples:

    AND
    OR
    Bit shifting.

    Problem:

    Bit shifting problem.

    See Also:

    All the other Expressions and operators.
    Operator precedence.
    Assignment Operators.

    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/JavaSim.html0000644000076400001440000001344407055334564015752 Bit Manipulation Simulator

    Bit Manipulation Simulator


    This page requires JavaScript support to test the various bitwise operators. If you do not have JavaScript available, you can try the CGI supported simulator. Please note. The CGI simulator will only work if the site administrator has installed it. Please note, this does not work when using Internet Explorer 3.0

    CGI Version
    Bit Manipulation Simulator



    JavaScript Version
    Enter the Hex values and select an operator, then press the 'Execute' button to see the results.

    Hex Binary Decimal

    Sections of this page controlled by 'JavaScript' cannot be printed.


    See Also:

    Bitwise Operators.


    Top Master Index Keywords Functions


    Martin Leslie
    Assignment operators.

    Assignment operators.


    C has the following assignement operators:
    	=   +=   -=   *=   /=   %=   <<=   >>=   &=   ^=   |=
    
    = is the obvious one. It takes the result of the expression on the right and assigns it to the variable on the left (lvalue).
    	main ()
            {
    	  int a, b=4, c=10;
    	  a = b + c;
    	}
    
    I know this is stating the obvious, but:
    1. b is assigned the value 4
    2. c is assigned the value 10
    3. a is assigned the result of b plus C (14).

    All the other operators act in a simular way. If you find yourself coding the example on the left, it could be changed to the example on the right.
    	main ()				main()
    	{				{
    	  int a=4;			  int a=4;
    	  a = a * 4;			  a *= 4;
    	}				}
    
    The rule is as follows:

    The lvalue is multiplied by the rvalue and the result assigned to the lvalue.

    Here is another example.

    	main()				main()
    	{				{
    	    int a=10, b=2;	            int a=10, b=2;
    	    a /= b * 5;		            a = a / (b*5);
    	}				}
    
    Again both preduce the same answer (1).


    Increment (++) and Decrement (--)
    Bit shifting ( >>= <<= )
    Operator precedence table.

    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/string.html0000644000076400001440000000750107055334541015716 Strings

    Strings.


    Pointers to strings.

    C does not have a "string" datatype. To create a string you have to use a char array or a char pointer. If you are not familur with char arrays I recomend that you read about them now.

    To recap, a char pointer is defined like this:

     
         main()
         {
           char *Text;
         }
         
    

    All this program does is reserve storage that will hold an address. At this point the address could be anything. To initalize Text you can code:

        
         main()
         {
           char *Text = "Thunder";
         }
         
    
    Text now has the address of the first character in Thunder. Graphically, things look like this.

    
          (Address) (Data)
          
               ---- ----    
              | F1 | 00 <------- Text   
    	  |----|----|               (Data) (Adress)
              | F2 | 00 |                 -------------
    	  |----|----|         -------> 54 (T) | D1 |
    	  | F3 | 00 |        |       |--------|----|
    	  |----|----|  *Text |       | 68 (h) | D2 |
    	  | F4 | D1 | -------        |--------|----|
    	   ---------                 | 75 (u) | D3 |
    	                             |--------|----|
    				     | 6E (n) | D4 |
    				     |--------|----|
                                         | 64 (d) | D5 |
                                         |--------|----|
                                         | 65 (e) | D6 |
                                         |--------|----|
                                         | 72 (r) | D7 |
                                         |--------|----|     
                                         | 00     | D8 |
                                          -------------
    
    

    Please note the 00 at the end of Thunder. This is the NULL character and is used to mark the end of a string.

    If we wanted to O/P the data pointed to by a char pointer we can code.

    Source
    
         main()
         {
           char *Text1 = "Thunder";          /* Define and initalize */
           char *Text2;                      /* Define only          */
           
           Text2 = "Bird";                   /* Point to some text   */
           
           printf("%s%s\n", Text1, Text2);
         }
         
    
    Result
    
          ThunderBird
    
    

    This is all very well, but there is a MAJOR problem! Thunder and Bird are constants, they cannot be changed in anyway. We need a method of pointing to some storage that can be altered and true to form, C provides a function called malloc to do just that.


    See Also:

    VOID keyword.

    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/rpc.html0000644000076400001440000001500307055334567015200 RPC

    Remote Procedure Calls (RPC).


    In the normal scope of things, a program can only call a function that is linked into the executable or provided by a shared library. RPC allows programs to execute functions in another executing program, cool!

    RPC has a concept of clients and servers.

    1. The client issues requests to the server.
    2. Servers perform the requests and return the results.
    3. The data that flows between client and server includes int, float, strings and structures.
    4. The client and server can be on the same host or different hosts connected via a network.
    5. The hosts do not have to be the same artitechture.
    The RPC API has three levels of support. By using the highest level RPC is responcable for most of the code but is not too flexable. The lowest level requres more coding but gives the programmer more control over how RPC functions.

    The easiest way to start with RPC is to use a program called rpcgen this reads a file that describes the required interface between client and server and generates C code that you can include in your client and server.

    
    	prog.x --> rpcgen ---> prog.h        Header file
                              ---> prog_clnt.c   Client stubs file
                              ---> prog_svc.c    Server stubs file
                              ---> prog_xdr.c    XDR routines (more later).
    
    
    You write prog.x and rpcgen generates prog.h prog_clnt.c prog_svc.c prog_xdr.c You then write the client and server and link them with the rpcgen code to complete the RPC system.
    
    	client.c    -----> client executable
            prog.h      ---|
            prog_clnt.c ---|
            prog_xdr.c  ---|
    
            server.c    -----> Server executable
            prog.h      ---|
            prog_svc.c  ---|
            prog_xdr.c  ---|
    
    
    
    Ok, time for some examples.

    Calling an RPC server function without passing any arguments.

    This is the simplest form of RPC.

    void.x
    
      /* RPCGEN code decribing the client/server API. */
     
      program MJLPROG
      {
        version MJLVERS
        {
          void VOID(void) = 1;
        
        } = 1;
      } = 0x20000001;
    

    void.x describes the RPC interface between the client and server. There are some important items to note here.

    program MJLPROG
    {
    } = 0x20000001;
    
    This is the RPC program number. It is used by the client to identify the server it intends to use. It is important that you provide a unique number here. You can see which values are in use with the Unix command rpcinfo -p or by looking at /etc/rpc. Please note that the number is supplied in void.x as a hex value but shown as a decimal value by rpcinfo One other point, you should only use values in the range 0x20000000 0x3FFFFFFF as these have been reserved for use local use.
    version MJLVERS
    {
    } = 1;
    
    The RPC Version number.
    void VOID(void) = 1;
    This defines the only RPC function that the server will provide.

    void_client.c
    
      #include <rpc/rpc.h>
      #include "void.h"
    
      main()
      {
          CLIENT *pclnt;
          void   *pVoid;
        
          char    Host[256];
    
          /* Get the name of the host running the server. */
        
          gethostname(Host, 256);
    
          /* Connect to the server. */
        
          pclnt = clnt_create(Host, MJLPROG, MJLVERS, "udp");
    
          /* Issue a request to the server. */
        
          void_1(pVoid, pclnt);
    
          /* Disconnect from the server. */
        
          clnt_destroy(pclnt);
    
      }
    

    #include <rpc/rpc.h>
    
    
    Include the standard RPC headers.
    #include "void.h"
    
    Include the header file generated by rpcgen
    pclnt = clnt_create();
    
    Connect to the server MJLPROG on Host and return a pointer to the CLIENT control structure.
    void_1(pVoid, pclnt);
    
    Call the remote function.
    clnt_destroy();
    
    Disconnect from the server.

    void_server.c
    
      #include 
      #include "void.h"
    
      void *void_1_svc(void *pVoid,  struct svc_req *X)
      {
          printf("Function called without passing arguments\n");
      }
    
    

    void *void_1_svc()
    
    The server function that will be run for the client.

    Please note that the server does not have a main(), rpcgen generates it for you.

    The code can be compiled with the following commands

      gcc void_server.c void_svc.c -o void_server
      gcc void_client.c void_clnt.c -o void_client
    

    In theory you should be able to start the server and it will respond everytime the client is executed. I have not included any error recovery into this example as it makes the code harder to read. As an exercise try adding the error recovery code yourself :-)

    Transfer integers between the client and server

    integer.x
    
      /* RPCGEN code decribing the client/server API. */
     
      program MJLPROG
      {
        version MJLVERS
        {
          int INTEGER(int) = 1;
        
        } = 1;
      } = 0x20000001;
    

    int INTEGER(int) = 1;
    
    Server function now accepts an integer and returns an integer.


    See Also:

    VOID keyword.

    Top Master Index Keywords Functions


    29-Dec-97
    Martin Leslie c_cpp_reference-2.0.2/reference/C/CONCEPT/cmdline.html0000644000076400001440000000177007055334562016030 Command line arguments

    Command line arguments



    Examples:

    Example using argc and argv
    Bob Stout's example.

    See Also:

    getopt function.

    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/Makefile.am0000644000076400001440000000017507055334567015566 EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/CONCEPT/Makefile.in0000644000076400001440000002425507474405126015577 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/CONCEPT mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/CONCEPT/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONCEPT/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONCEPT/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=bitsnbytes.html cast.html assignment.html data_types.html expressions.html true_false.html bitwise.html storage_class.html pointers.html rpc.html arrays.html precedence.html type_conv.html JavaSim.html bit_shift.html string.html constants.html cmdline.html inc_dec.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONCEPT/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONCEPT/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/CONCEPT/bitwise.html0000644000076400001440000001336707055334556016073 Bitwise operations

    Bitwise operations


    Bitwise operators include:

    & AND
    &= AND
    | OR
    |= OR
    ^ XOR
    ^= XOR
    ~ one's compliment
    << Shift Left
    << Shift Left
    >>= Shift Right
    >>=Shift Right


    AND OR and XOR

    These require two operands and will perform bit comparisions.

    AND & will copy a bit to the result if it exists in both operands.

      
      main()
      {
        unsigned int a = 60;	/* 60 = 0011 1100 */  
        unsigned int b = 13;	/* 13 = 0000 1101 */
        unsigned int c = 0;           
    
        c = a & b;                  /* 12 = 0000 1100 */ 
      }
    
    

    OR | will copy a bit if it exists in eather operand.

      
      main()
      {
        unsigned int a = 60;	/* 60 = 0011 1100 */  
        unsigned int b = 13;	/* 13 = 0000 1101 */
        unsigned int c = 0;           
    
        c = a | b;                  /* 61 = 0011 1101 */ 
      }
    
    

    XOR ^ copies the bit if it is set in one operand (but not both).

      
      main()
      {
        unsigned int a = 60;	/* 60 = 0011 1100 */  
        unsigned int b = 13;	/* 13 = 0000 1101 */
        unsigned int c = 0;           
    
        c = a ^ b;                  /* 49 = 0011 0001 */ 
      }
    
    

    o XOR example program which swaps the contents of two variables.

    Try it out with one of these simulators.

    CGI simulator JavaScript Simulator


    Ones Complement

    This operator is unary (requires one operand) and has the efect of 'flipping' bits.

    
      main()
      {
        unsigned int Value=4;          /*   4 = 0000 0100 */  
    
        Value = ~ Value;               /* 251 = 1111 1011 */  
    
      }
    
    

    Try it out

    CGI simulator


    Bit shift.

    The following
    operators can be used for shifting bits left or right.

    << >> <<= >>=

    The left operands value is moved left or right by the number of bits specified by the right operand. For example:

    
      main()
      {
        unsigned int Value=4;          /*  4 = 0000 0100 */  
        unsigned int Shift=2;
    
        Value = Value << Shift;        /* 16 = 0001 0000 */  
    
        Value <<= Shift;               /* 64 = 0100 0000 */  
    
        printf("%d\n", Value);         /* Prints 64      */  
      }
    
    

    Usually, the resulting 'empty' bit is assigned ZERO. Please use unsigned variables with these operators to avoid unpredictable results.

    Try it out with one of these silulators

    CGI simulator JavaScript Simulator


    Examples:

    AND
    OR
    Bit shifting.

    Problem:

    Bit shifting problem.

    See Also:

    All the other Expressions and operators.
    Operator precedence.
    Assignment Operators.

    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/pointers.html0000644000076400001440000003033407055334554016257 Pointers

    Pointers.


    Pointers are at the heart of C. When you crack this subject, you have got the worst of C behind you. Before you tackle pointers though, you should get a grip on arrays.


    First Principles.

    To understand pointers, it may be worth understanding how normal variables are stored. If you disagree,
    Click here to move on.

    What does the following program realy mean?

    
            main()
    	{
      	    int Length;     
    	}      
    

    In my mind, it means, reserve enough storage to hold an integer and assign the variable name 'Length' to it. The data held in this storage is undefined. Graphically it looks like:

    
          (Address) (Data)
               ---- ----
              | F1 |   <------- Length
              |----|----|
              | F2 |    |       
              |----|----|
              | F3 |    |
              |----|----|
              | F4 |    |
               ---------    
    
    
    To put a known value into 'Length' we code,

    
    	main()
    	{
    	    int Length;
      	    Length = 20;
            }
    

    the deciamal value 20 (Hex 14) is placed into the storage location.

    
          (Address) (Data)
    	   ---- ----
              | F1 | 00 <------- Length
              |----|----|
              | F2 | 00 |
              |----|----|
              | F3 | 00 |
              |----|----|
              | F4 | 14 |
               ---------
         
    
    Finally, if the program is expanded to become

    
          main()
          {
              int Length;
    
              Length = 20;
    
              printf("Length is %d\n", Length);
              printf("Address of Length is %p\n", &Length);
          }
          
    

    The output would look something like this .....

        
          Length is 20
          Address of Length is 0xF1
          
    
    Please note the '&Length' on the second printf statement. The & means address of Length. If you are happy with this, you should push onto the pointers below.


    Pointer definition.

    A pointer contains an
    address that points to data.

    An example of code defining a pointer could be...

    
          main()
          {
              int *Width;
          }
    
    

    A graphical representation could be...

    
          (Address) (Data)
               ---- ----
              | F1 |    <------- Width
              |----|----|
              | F2 |    |
              |----|----|
              | F3 |    |
              |----|----|
              | F4 |    |
               ---------
    		   
    
    So far, this variable looks the same as above, the value stored at 'Width' is unknown. To place a value in 'Width' you could code.

    
          main()
          {
              int *Width;                                 /* 1 */
    
              Width = (int *)malloc(sizeof(int));         /* 2 */
    
              *Width = 34;                                /* 3 */
          }
    
    

    
          (Address) (Data)
               ---- ----    
              | F1 | 00 <------- Width   
    	  |----|----|               (Data) (Adress)
              | F2 | 00 |                 ---------
    	  |----|----|         -------> 00 | D1 |
    	  | F3 | 00 |        |       |----|----|
    	  |----|----|  *Width|       | 00 | D2 |
    	  | F4 | D1 | -------        |----|----|
    	   ---------                 | 00 | D3 |
    	                             |----|----|
    				     | 22 | D4 |
    				      ---------
    		 
    
    Statements 2 and 3 are important here:

    2) The malloc function reserves some storage and puts the address of the storage into Width.

    3) *Width puts a value into the storage pointed to by Width.

    Unlike the Length = 20 example above, the storage pointed to by 'Width' does NOT contain 34 (22 in Hex), it contains the address where the value 34 can be found. The final program is...

    
          main()
          {
              int *Width;                               
    
              Width  = (int *)malloc(sizeof(int));      
    	  *Width = 34;
    
    	  printf("  Data stored at *Width is %d\n", *Width); 
    	  printf("       Address of Width is %p\n", &Width);
    	  printf("Address stored at Width is %p\n",  Width);
          }
    				  
    

    The program would O/P something like.

    
              Data stored at *Width is 34
    	       Address of Width is 0xF1
    	Address stored at Width is 0xD1
    
    

    A pointer can point to any data type, ie int, float, char. When defining a pointer you place an * (asterisk) character between the data type and the variable name, here are a few examples.

    
    	main()
    	{
    	    int    count;		/* an integer variable              */
    	    int   *pcount;		/* a pointer to an integer variable */
    	    float  miles;		/* a floating point variable.	    */
    	    float *m;			/* a pointer			    */
    	    char   ans;			/* character variable		    */ 	
    	    char  *charpointer;		/* pointer to a character variable  */
    	}
    
    


    Pointers to arrays

    When looking at
    arrays we had a program that accessed data within a two dimensional character array. This is what the code looked like.
            main()
            {
              char colours[3][6]={"red","green","blue"};
            }
    
    The code above has defined an array of 3 elements, each pointing to 6 character strings. You can also code it like this. Which is actually more descriptive because it indicates what is actually going on in storage.
            main()
            {
              char *colours[]={"red","green","blue"};
            }
    
    Graphically it looks like this:

    
    
    
                            
         colours  *colours *(colours+2) **colours
              |         |       |           |
              |         |       |           |
              V         V       V           |     
             ---       -----------          |     
            |   |---->|   |   |   |         |     
             ---       -----------          |     
                        |   |   |           V     
                        |   |   |         -----------------------
                         --------------->| r | e | d |   |   |   |
                            |   |         -----------------------
                            |   |      
                            |   |          -----------------------
                             ---|-------->| g | r | e | e | n |   |
                                |          -----------------------
                                |
                                |          -----------------------
                                 -------->| b | l | u | e |   |   |
                                           -----------------------
    		            	        A           A
                                            |           |
                                            |           |
                                    **(colours+2)   *(*(colours+2)+3)
                                     
    

    	printf("%s \n", colours[1]);
    	printf("%s \n", *(colours+1))
    
    will both return green.


    Char Arrays verses Char pointers

    What is the difference between these two lumps of code?

    	
      main()			
      {			
          char colour[]="red";		
          printf("%s \n",colour);	
      }				
    
    
    
      main()
      {				
          char *colour="red";
          printf("%s \n",colour);	
      }				
    
    

    The answer is, NOTHING! They both print the word red because in both cases 'printf' is being passed a pointer to a string.

    An array of 4 bytes is reserved and the text 'red' placed into the storage array. The contents of the array can be chaged later BUT on the left, the size of the array is fixed.

    Here is a picture of the example on the right. The 'r' of 'red' is stored at address 10, the 'e' is at address 11 etc.

    At this point it maybe worth looking at the malloc function.


    Void Pointers

    There are times when you write a function but do not know the datatype of the returned value. When this is the case, you can use a void pointer.

    
      	int func(void *Ptr);
    
      	main()
      	{
                char *Str = "abc";
    
                func(Str);
      	}
    
      	int func(void *Ptr)
      	{
      	    printf("%s\n", Ptr);
      	}
    

    Please note, you cant do pointer arithmatic on void pointers.


    Pointers to pointers

    So far we have looked at pointers to data, but there is no reason why we should not define a pointer to a pointer. The syntax looks like this.

    
    	main()
    	{
    	    char **DoublePtr;
    	}
    

    A common use for these is when you want to return a pointer in a function parameter.

       	#include 		/* malloc */
    
    	void Func(char **DoublePtr);
    
    	main()
    	{
                char *Ptr;
    
    	    Func(&Ptr);
    	}
    
    	void Func(char **DoublePtr)
    	{
    	    *DoublePtr = malloc(50);
    	}
    


    Pointers to functions

    Pointers to functions can be used to create 'callback' functions. An example of these pointers can be seen in the
    qsort function.

    Examples.

    Simple example passing a function pointer.

    Example passing 'int' variables.

    Example passing 'char' and 'char *' variables.


    See Also:

    VOID keyword.

    function arguments.

    linked lists.

    Strings.

    Arrays.


    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/true_false.html0000644000076400001440000000364507055334564016553 True or False

    True or False.


    The concept of an expression evaluating to true or false is one of the corner stones of C. BUT the language derives true and false in an unusual way.

    Basicly there is no boolean value. The number 0 is considered to be false and all other numbers are considered to be true....

    Please consider the following expressions.

    	(1 == 1) 	true
    	(1 != 1)	false
    	(i  = 1)   	true
    	(i  = 0)   	false
    	(i  = 1 + 1) 	true
    
    The first two examples should be clear but the last ones need explanation .

    The last three examples assign a value to a variable and a side effect of assignment is to return the value assigned, it is this value that is tested to be true or false.

    Looking at the last example:

    	(i = 1 + 1)
      	(i = 2)
    	(2)
    
    • The third expression assigns a value of 1 to i. 1 is considered to be true because it is non-zero.

    • The fourth expression assigns a value of 0 to i. 0 is considered to be false.

    • The fith expression assigns a value of 2 to i. 2 is considered to be true, because it is non-zero.


    See Also:

    enum keyword

    Top Master Index Keywords Functions


    Martin Leslie
    Corrections made by Christopher Wolf c_cpp_reference-2.0.2/reference/C/CONCEPT/storage_class.html0000644000076400001440000001162307055334545017245 C Storage Classes

    C Storage Classes.


    C has a concept of 'Storage classes' which are used to define the scope (visability) and life time of variables and/or functions.

    So what Storage Classes are available?

    auto register static extern typedef


    auto - storage class

    auto is the default storage class for local variables.
    	{
    	    int Count;
    	    auto int Month;
    	}
    
    The example above defines two variables with the same storage class. auto can only be used within functions, i.e. local variables.


    register - Storage Class

    register is used to define local variables that should be stored in a register instead of RAM. This means that the variable has a maximum size equal to the register size (usually one word) and cant have the unary '&' operator applied to it (as it does not have a memory location).
    	{
    	  register int  Miles;
    	}
    
    Register should only be used for variables that require quick access - such as counters. It should also be noted that defining 'register' goes not mean that the variable will be stored in a register. It means that it MIGHT be stored in a register - depending on hardware and implimentation restrictions.


    static - Storage Class

    Click here for static functions

    static is the default storage class for global variables. The two variables below (count and road) both have a static storage class.

    
         static int Count;
         int Road;
    
         main()
         {
           printf("%d\n", Count);
           printf("%d\n", Road);
         }
    

    'static' can also be defined within a function. If this is done, the variable is initalised at compilation time and retains its value between calls. Because it is initialsed at compilation time, the initalistation value must be a constant. This is serious stuff - tread with care.

    
         void Func(void)
         {
           static Count=1;
         }
    

    Here is an example

    There is one very important use for 'static'. Consider this bit of code.

    
         char *Func(void);
    
         main()
         {
           char *Text1;
           Text1 = Func();
         }
    
         char *Func(void)
         {
           char Text2[10]="martin";
           return(Text2);
         }
    

    'Func' returns a pointer to the memory location where 'Text2' starts BUT Text2 has a storage class of auto and will disappear when we exit the function and could be overwritten by something else. The answer is to specify:

    
         static char Text[10]="martin";
    

    The storage assigned to 'Text2' will remain reserved for the duration if the program.


    extern - storage Class

    extern defines a global variable that is visable to ALL object modules. When you use 'extern' the variable cannot be initalized as all it does is point the variable name at a storage location that has been previously defined.
    
    
     	Source 1				Source 2
            --------				--------
    
    
    	extern int count;			int count=5;
    
            write()					main()
            {					{
              printf("count is %d\n", count);	  write();
            }					}
    
    Count in 'source 1' will have a value of 5. If source 1 changes the value of count - source 2 will see the new value. Here are some example source files.

    Source 1
    Source 2

    The compile command will look something like.

    	gcc source1.c source2.c -o program
    

    See Also:

    Data types.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/CONCEPT/cast.html0000644000076400001440000000311007055334544015335 cast


    To cast, casting


    If you want to change the datatype of a variable you have to use a technic called cast. For example if want to change an int to a float you could use the following syntax:

            
        main()
        {
            int var1;
            float var2;
    
            var2 = (float)var1;
        }
    

    As it happens this example would never be used in practice because C would perform the conversion automatically. What this example does show is the cast operator () . This states, the result of the expression (in this case var1) is to be a data type of float.


    See Also:

    C++ changes to cast.


    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/arrays.html0000644000076400001440000001165307055334542015715 Arrays

    Arrays.


    Arrays can be created from any of the C data types int, float, char. I start with int and float as these are the easiest to understand. Then move onto int and float multi dimentional arrays and finally char arrays

    int and float arrays

    To
    define an integer or floating point variable you would say.
    	main()
    	{
    	  int   Count;		/* integer variable 		*/
    	  float Miles;		/* floating point variable	*/
    	}
    
    The syntax for an array is:
    	main()
    	{
    	  int   Count[5];	/* 5 element integer array	*/
    	  float Miles[10];	/* 10 element floating point array */
    	}
    
    Now, the important fact is that the elements start at 0 (ZERO), so, 'Count' above has elements 0, 1, 2, 3, 4.

    To change the value of the 5th element we would code:

    	main()
    	{
    	  int Count[5];
    	  Count[4] = 20;	/* code 4 to update the 5th element */
    	}
    
    If we want to initalise 'Count' at definition we can say:
    	main()
    	{
    	  int i;
    	  int Count[5]={10, 20, 30};
    	  for (i=0; i< 5; i++)
          	  {
       	    printf("%d ", Count[i]);
       	  }
    	  puts("");
    	}
    
    The result will be:
    	10 20 30 0 0 
    
    We can see from the example above that the elements that have NOT been initalised have been set to zero.

    One last thing to show you. If all the elements are being initialized when the variable is being defined, the compiler can work out the number of elements for you. So this example will create an array with 3 elements.

    	main()
    	{
    	  int i;
    	  int Count[]={10, 20, 30};
    	}
    
    Don't forget, all the stuff so far also applies to float.


    Two dimensional int and float arrays.

    C does not actually support multi-dimensional arrays, but you can emulate them.
    	main()
    	{
    	  int Count[5];
    	  int Matrix[10][4];
    	}
    
    Count has been seen before, it defines an array of 5 elements.

    Matrix is defined as 10 arrays, all with 4 elements.

    To initalise Matrix at definition, you would code the following.

    	main()
    	{
    	  int Matrix[4][2]={{1, 2},
    	  		    {3, 4},
    			    {5, 6},
    			    {7, 8}};
    	}
    
    Dont forget the last element will be Matrix[3][1]


    char arrays.

    char arrays work in the same way as int and float
    	main()
    	{
    	  char Letter;
    	  char Letters[10];
    	}
    
    'Letter' can only hold one character but 'the 'Letters' array could hold 10. It is important to think of 'char' as an array and NOT a string.

    To initalise 'char' variables you can use the following syntax.

    	main()
    	{
    	  char Letter='x';
    	  char Letters[10]='f','a','x',' ','m','o','d','e','m','\0';
    	  char Text[10]="fax modem";
    	}
    
    Note that the double quotes mean 'text string' and so they will add the
    NULL automatically. This is the only time that text can be loaded into an array in this way. If you want to change the contents of the array you should use the function strcpy.


    Two dimensional char arrays.

    Two dimensional arrays are a different kettle of fish! We can follow the rules above to define the array like this.
    	main()
    	{
    	  char Colours[3][6]={"red","green","blue"};
    
    	  printf ("%c \n", Colours[0][0]); 	/* O/P 'r' */
    	  printf ("%s \n", Colours[1]);    	/* O/P 'green' */
    	}
    
    The example above has reserved 18 consecutive bytes and created three pointers into them.
    
                      ---------------------
                     |red  \0green\0blue \0|
                      ---------------------
                      A      A      A
                      |      |      |
       Colours[0] ----       |      |
       Colours[1] -----------       |
       Colours[2] ------------------
    
    

    click here for chat on pointers.


    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/precedence.html0000644000076400001440000001767707055334561016526 Operator Precedence

    Operator Precedence


    The following tables show the order in which operators are evaluated. Please note the following.
    • The order in which the operands are evaluated is not specified in the ANSII standard.
    • For readability you should not rely on these rules! Put everything in brackets so you intension is clear to the compiler and other programmers.
    o Summary table.
    o Table in detail.
    o Operators listed by type.

    Summary precedence table.

    All operators on the same line have the same precedence. The first line has the highest precedence.

    () [] -> .
    ! ~ ++ -- + - * & sizeof
    * / %
    + -
    << >>
    < <= >= >
    == !=
    &
    ^
    |
    &&
    ||
    ?:
    = += -= *= /= %= &= ^= |= <<= >>=
    ,

    Lary Huang has told me that the postfix unary -- and postfix unary ++ have a higher precedence than the prefix unary -- and prefix unary ++.


    Detailed precedence table.

    All operators in the same 'block' have the same precedence. The first block has the highest precedence.

    GroupOperatorDescriptionExample
    Membership.
    ()Function call.count = function(4,3);
    []Array.value = array[5] + increment;
    ->Structure pointer.
    .Structure member.
    Unary.
    !Logical NOT
    ~
    ++Increment.
    --Decrement.
    +
    -
    *Pointer to data
    &Address of a variable.
    sizeof
    (type)type cast.
    Binary.
    * Multiply.
    / Divide.
    % Modulo.
    Binary.
    + Addition
    - Subtraction.
    Bitwise
    << Shift left.
    >> Shift Right.
    Relational.
    < Less than.
    > Greater than.
    <= Less than or equal too.
    >= Greater than or equal too.
    == Equal too.
    != Not equal too.
    More Bitwise
    & bitwise AND
    ^ bitwise Excusive OR
    | bitwise OR
    Logical.
    && Logical AND
    Logical.
    || Logical OR
    Conditional
    ? : Conditional construct.
    Assignment
    = Equals
    += assignment
    -= assignment
    *= assignment
    /= assignment
    %= assignment
    &= assignment
    ^= assignment
    |= assignment
    <<= assignment
    >>= assignment
    Series
    , Comma


    See also:

    o
    Expressions and operators.
    o Assignment Operators.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/CONCEPT/inc_dec.html0000644000076400001440000000372307055334546016003 Increment and decrement.


    Increment and decrement.


    The traditional method of incrementing numbers is by coding something like:
    	a = a + 1;
    
    Within C, this syntax is valid but you can also use the ++ operator to perform the same function.
    	a++;
    
    will also add 1 to the value of a. By using a simular syntax you can also decrement a variable as shown below.
    	a--;
    
    These operators can be placed as a prefix or post fix as below:
    	a++;		++a;
    
    When used on their own (as above) the prefix and postfix have the same effect BUT within an expression there is a subtle difference....

    1. Prefix notation will increment the variable BEFORE the expression is evaluated.
    2. Postfix notation will increment AFTER the expression evaluation.
    Here is an example:
    	main()				main()
    	{				{
    	  int a=1;			  int a=1;
    	  printf(" a is %d", ++a);	  printf(" a is %d", a++);
            }				}
    
    
    In both examples, the final value of a will be 2. BUT the first example will print 2 and the second will print 1.
    Example program.
    Other operators.
    Operator precedence table.

    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONCEPT/type_conv.html0000644000076400001440000000320307055334546016416 Data type conversion

    Data type conversion


    An operator must have operands of the same type before it can carry out the operation. Because of this, C will perform some automatic conversion of data types.

    These are the general rules for binary operators (* + / % etc):

    • If either operand is long double the other is converted to long double.

    • Otherwise, if either operand is double the other is converted to double

    • Otherwise, if either operand is float the other is converted to float

    • Otherwise, convert char and short to int

    • Then, if an operand is long convert the other to long.

    See Also

    cast to force a type conversion.
    typedef keyword.

    Top Master Index Keywords Functions


    Martin Leslie
    c_cpp_reference-2.0.2/reference/C/CONTRIB/0000777000076400001440000000000007474405222013610 5c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/0000777000076400001440000000000007474405220014357 5c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/clock.c0000755000076400001440000001274107055333704015544 /* CLOCK.H: prototypes/defines for the CLOCK.C file */ /* This file written in 1990 Jonathan R. Guthrie and placed in the public domain */ int far startclock(int x, int y, int attr); void far stopclock(void); #define CLOCK_OK 0 /* Clock was installed properly */ #define CLOCK_ERR_INST -1 /* Clock is already installed */ #define CLOCK_ERR_OOS -2 /* Clock would be off the screen */ /* CLOCK.C: An on-screen clock generator */ /* This file written in 1990 Jonathan R. Guthrie and placed in the public domain */ #include #include #include #include #include "clock.h" #define CLOCK 0x1c #define TRUE 1 #define FALSE 0 /* Now, the stuff needed for the for the on-screen clock */ static void interrupt (*oldvector)(void); static void interrupt do_clock(void); static void setstr(char *, int, size_t); static char timestuff[22], hours, oddfives, ticks, ticklimit; static int clockx, clocky, clockattr, installed = FALSE; int far startclock(int x, int y, int attr) { time_t temptime; struct tm *struct_time; int bigx; struct text_info r; /* The clock starting routine */ /* First, see if it's already installed */ if(installed) return CLOCK_ERR_INST; else installed = TRUE; /* Now, set assorted important module constants */ clockx = x; clocky = y; clockattr = attr; gettextinfo(&r); if((clockx < 0) || (clockx > r.screenwidth - 10) || (clocky < 0) || (clocky > r.screenheight)) { installed = FALSE; return CLOCK_ERR_OOS; } /* Now, set the program's clock */ setstr(timestuff, clockattr, 22); time(&temptime); struct_time = localtime(&temptime); oddfives = 0; ticklimit = 17; hours = (struct_time->tm_hour + 11) % 12 + 1; timestuff[0] = (hours > 9) ? '1' : ' '; timestuff[2] = '0' + hours % 10; timestuff[4] = ':'; timestuff[6] = '0' + struct_time->tm_min / 10; timestuff[8] = '0' + struct_time->tm_min % 10; timestuff[10] = ':'; timestuff[12] = '0' + struct_time->tm_sec / 10; timestuff[14] = '0' + struct_time->tm_sec % 10; timestuff[16] = ' '; timestuff[18] = (struct_time->tm_hour > 11) ? 'P' : 'A'; timestuff[20] = 'M'; /* Now, initialize the clock as displayed on the screen */ puttext(clockx, clocky, clockx+10, clocky, timestuff); /* Finally, set the vector to point to the clock routine */ disable(); oldvector = getvect(CLOCK); setvect(CLOCK, do_clock); enable(); return CLOCK_OK; } static void interrupt do_clock(void) { ++ticks; if(ticks > ticklimit) /* Then, it's time to update the seconds */ { ticks = 0; /* First, handle the fractional Hz part */ ++oddfives; if (5 == oddfives) { oddfives = 0; ticklimit = 18; } else { ticklimit = 17; } /* Now, handle the seconds count */ ++timestuff[14]; if (timestuff[14] > '9') { timestuff[14] = '0'; /* Now, handle the tens of seconds count */ ++timestuff[12]; if (timestuff[12] > '5') { timestuff[12] = '0'; /* Now, handle the minutes count */ ++timestuff[8]; if (timestuff[8] > '9') { timestuff[8] = '0'; /* Now, handle the ten minutes count */ ++timestuff[6]; if (timestuff[6] > '5') { timestuff[6] = '0'; /* Now, handle the hours count */ ++hours; if(12 == hours) if ('P' == timestuff[18]) timestuff[18] = 'A'; else timestuff[18] = 'P'; if(hours > 12) hours = 1; timestuff[0] = (hours > 9) ? '1' : ' '; timestuff[2] = '0' + hours % 10; } } } } /* Now, update the display */ puttext(clockx, clocky, clockx+10, clocky, timestuff); } } void far stopclock(void) { if(installed) { disable(); setvect(CLOCK, oldvector); enable(); installed = FALSE; } } static void setstr(char *s, int ch, size_t n) { size_t i; for(i=0 ; i or ". This program doesn't inhibit comment, string, or character ** constant detection within the header name, as an ANSI parser must. ** ** Written by and contributed to the public domain by ** Thad Smith III, Boulder, CO, October 1990. */ #include #ifndef INHIBIT_TRIGRAPHS /* default: recognize trigraphs */ #define getnc() getnsc(1) /* get char with trigraph xlate */ #ifdef TRANSLATE_TRIGRAPHS #define getcmtc() getnsc(1) /* get comment char w/ t.g. xlate */ #else #define getcmtc() getnsc(0) /* default: no comment t.g. xlate */ #endif /* ** get next source character or EOF */ int getnsc(int cvtg) /* boolean: convert trigraphs */ { static int c, nc, nnc; /* next 3 characters */ /* shift in next source character */ c = nc; nc = nnc; nnc = getchar(); /* perform trigraph substitution */ if (cvtg && c == '?' && nc == '?') { switch (nnc) { case '=' : c = '#' ; break; case '(' : c = '[' ; break; case '/' : c = '\\'; break; case ')' : c = ']' ; break; case '\'': c = '^' ; break; case '<' : c = '{' ; break; case '!' : c = '|' ; break; case '>' : c = '}' ; break; case '-' : c = '~' ; break; default : return c; /* no substitution */ } nc = getchar(); nnc = getchar(); } return c; } #else /* don't process trigraphs */ #define getnc() getchar() #define getcmtc() getchar() #endif int main(void) { int pc; /* previous character */ int c; /* current input character */ #ifndef INHIBIT_TRIGRAPHS getnc(); /* prime the pump */ getnc(); #endif c = getnc(); /* get first char */ for (;;) /* in non-comment area */ { switch (c) { case '/': /* possible start of comment */ if ((c= getnc()) == '*') /* process comment */ { putchar('/'); putchar('*'); /* copy comment to stdout */ for (pc = 0; (c = getcmtc()) != EOF && (putchar(c) != '/' || pc != '*'); pc=c) ; putchar('\n'); #ifdef CPP_MODE } else if (c == '/') /* '//' comment */ { putchar('/'); putchar('/'); while ((c = getcmtc()) != EOF && putchar(c) != '\n') ; #endif } else continue; /* test current char */ break; case '\"': /* start of string */ case '\'': /* start of (possibly multi-byte) char constant */ pc = c; /* save delimiter */ do /* scan through character constant, ** discarding escape chars */ { while ((c = getnc()) == '\\') getnc(); } while (c != pc && c != EOF); break; } if (c == EOF) return 0; else c = getnc(); } } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ansiscrn.h0000755000076400001440000000451007055333637016276 #ifndef ANSISCRN #define ANSISCRN /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ANSISCRN.H * * #include implementation of ANSI screen control codes * Contributed to the public domain 12-26-91 by * Matthew J. Glass. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include #define ESC 27 #define ANSI_cup(a,b) printf("%c[%d;%dH",ESC,a,b) #define ANSI_up(a) printf("%c[%dA",ESC,a) #define ANSI_down(a) printf("%c[%dB",ESC,a) #define ANSI_right(a) printf("%c[%dC",ESC,a) #define ANSI_left(a) printf("%c[%dD",ESC,a) #define ANSI_locate(a,b) printf("%c[%d;%df",ESC,a,b) #define ANSI_savecurs() printf("%c[S",ESC) #define ANSI_restcurs() printf("%c[U",ESC) #define ANSI_cls() printf("%c[2J",ESC) #define ANSI_cleol() printf("%c[K",ESC) #define ANSI_margins(a,b) printf("%c[%d;%dr",ESC,a,b) #define NORMAL 0 /* attributes for ANSI_attrib() */ #define BOLD 1 #define USCORE 2 #define BLINK 3 #define REVERSE 4 #define INVIS 5 #define BLACK 0 /* colors for ANSI_bg_color() and */ #define RED 1 /* ANSI_fg_color. */ #define GREEN 2 #define YELLOW 3 #define BLUE 4 #define MAGENTA 5 #define CYAN 6 #define WHITE 7 #define B_BLACK 8 /* bright colors for ANSI_fg_color() */ #define B_RED 9 #define B_GREEN 10 #define B_YELLOW 11 #define B_BLUE 12 #define B_MAGENTA 13 #define B_CYAN 14 #define B_WHITE 15 static char *_atrb_plt[] = { "0","1","4","5","7","8" }; static char *_fg_plt[] = { "0;30","0;31","0;32","0;33", "0;34","0;35","0;36","0;37", "1;30","1;31","1;32","1;33", "1;34","1;35","1;36","1;37" }; static char *_bg_plt[] = { "40","41","42","43", "44","45","46","47" }; #define ANSI_attrib(a) printf("%c[%sm",ESC,_atrb_plt[a]) #define ANSI_fg_color(a) printf("%c[%sm",ESC, _fg_plt[a] ) #define ANSI_bg_color(a) printf("%c[%sm",ESC, _bg_plt[a] ) #endif /* ANSISCRN */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ansiself.c0000755000076400001440000000063507055333637016261 /* ** Challenge: Write the smallest self-duplicating program, not ** reading the source file, which successfully exits and is strictly ** conforming Standard C. ** ** Public domain response by Thad Smith */ #include main(){char*c="\\\"#include%cmain(){char*c=%c%c%c%.102s%cn%c;printf(c+2,c[102],c[1],*c,*c,c,*c,c[1]);exit(0);}\n";printf(c+2,c[102],c[1],*c,*c,c,*c,c[1]);exit(0);} c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/inchcvrt.c0000755000076400001440000000360307055334015016262 /* ** Convert English measurement units ** ** Takes command line arguments in inches and converts to: ** ** 1. feet and inches (expressed as floating point) ** 2. feet and inches (expressed as fraction) ** ** public domain demo by Bob Stout ** uses ROUND.H from SNIPPETS */ #include #include #include #include "round.h" #define BASE 64.0 void cnvrt_inches(double input, double *feet, double *inches, double *dec_inches, double *num_inches, double *den_inches) { double quot, rem, temp; /* ** Split feet and inches */ *feet = floor(input / 12.0); *inches = fmod(input, 12.0); /* ** Get integer inches and fractions */ *num_inches = modf(*inches, dec_inches) * BASE; *num_inches = fround(*num_inches, 0); if (0.0 == *num_inches) return; /* ** Reduce fractions to lowest common denominator */ for (*den_inches = BASE; 0.0 == fmod(*num_inches, 2.0); *den_inches /= 2.0, *num_inches /= 2.0) { ; } } main(int argc, char *argv[]) { double arg, feet, inches, dec, num, den, dummy; while (--argc) { arg = atof(*(++argv)); cnvrt_inches(arg, &feet, &inches, &dec, &num, &den); printf("%f Inches = %d' %.5f\" or %d' %d", arg, (int)feet, inches, (int)feet, (int)dec); if (0.0 == num) puts("\""); else { printf("-%d/%d\"", (int)num, (int)den); if (modf(num, &dummy)) puts(" (approx.)"); else puts(""); } } return EXIT_SUCCESS; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/do.c0000755000076400001440000000052507055333722015050 /* ** DO.C - a simple facility for specifying multiple commands */ #include #include void main(int argc, char *argv[]) { if (2 > argc) { puts("Usage: DO \"DOS command 1\" \"DOS command 2\" ..."); return; } while (--argc) system(*++argv); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mv.c0000755000076400001440000000624007055334114015064 /* ** mv.c -- move or rename files or directories ** updated for multiple files, 5 jul 92, rlm ** placed in the public domain via C_ECHO by the author, Ray McVay ** ** modified by Bob Stout, 28 Mar 93 ** modified by Bob Stout, 4 Jun 93 ** ** uses file_copy from SNIPPETS file WB_FCOPY.C */ #include #include #include #include /* For portability, make everything look like MSC 6 */ #if defined(__TURBOC__) #include #define _dos_findfirst(f,a,b) findfirst(f,b,a) #define find_t ffblk #define _A_SUBDIR FA_DIREC #define attrib ff_attrib #else /* assume MSC/QC */ #include #endif /* ** Tell 'em they messed up */ void help(char *s) { puts("usage: mv "); printf("error: %s\n", s); } /* ** Simple directory test */ isdir(char *path) { struct find_t f; /* "Raw" drive specs are always directories */ if (':' == path[1] && '\0' == path[2]) return 1; return (_dos_findfirst(path, _A_SUBDIR, &f) == 0 && (f.attrib & _A_SUBDIR)); } /* ** Use rename or copy and delete */ int mv(char *src, char *dest) { int errcount = 0; char buf[FILENAME_MAX]; const char *generr = "ERROR: mv - couldn't %s %s %s\n"; if (':' == dest[1] && *dest != *getcwd(buf, FILENAME_MAX)) { if (file_copy(src, dest)) { printf(generr, "move", src, dest); ++errcount; } else if (unlink(src)) { printf(generr, "delete", src, ""); ++errcount; } } else { if (rename(src, dest)) { printf(generr, "rename", src, dest); ++errcount; } } return errcount; } /* ** Enter here */ int main(int argc, char **argv) { int src, errcount = 0; char target[FILENAME_MAX]; puts("mv 1.3 (4 jun 93) - Ray L. McVay/Bob Stout"); if (argc < 3) help("Not enough parameters"); /* ** Handle cases where target is a directory */ else if (isdir(argv[argc -1])) { for (src = 1; src < argc - 1; src++) { char termch; strcpy(target, argv[argc - 1]); termch = target[strlen(target) - 1]; if ('\\' != termch && ':' != termch) strcat(target, "\\"); if (strrchr(argv[src], '\\')) strcat(target, strrchr(argv[src], '\\') + 1); else if (argv[src][1] == ':') strcat(target, argv[src] + 2); else strcat(target, argv[src]); errcount += mv(argv[src], target); } } /* ** Nothing left except 2 explicit file names */ else if (argc == 3) errcount += mv(argv[1], argv[2]); return errcount; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/pi.c0000755000076400001440000000712607055334137015063 /* ** PI.C - Computes Pi to an arbitrary number of digits ** ** Uses far arrays so may be compiled in any memory model */ #include #include #if defined(__ZTC__) #include #define FAR _far #define Fcalloc farcalloc #define Ffree farfree #define Size_T unsigned long #elif defined(__TURBOC__) #include #define FAR far #define Fcalloc farcalloc #define Ffree farfree #define Size_T unsigned long #else /* assume MSC/QC */ #include #define FAR _far #define Fcalloc _fcalloc #define Ffree _ffree #define Size_T size_t #endif long kf, ks; long FAR *mf, FAR *ms; long cnt, n, temp, nd; long i; long col, col1; long loc, stor[21]; void shift(long FAR *l1, long FAR *l2, long lp, long lmod) { long k; k = ((*l2) > 0 ? (*l2) / lmod: -(-(*l2) / lmod) - 1); *l2 -= k * lmod; *l1 += k * lp; } void yprint(long m) { if (cnt 9) { wk = m / 10; m %= 10; for (wk1 = loc; wk1 >= 1; wk1--) { wk += stor[(int)wk1]; stor[(int)wk1] = wk % 10; wk /= 10; } } } stor[(int)(++loc)] = m; } void memerr(int errno) { printf("\a\nOut of memory error #%d\n", errno); if (2 == errno) Ffree(mf); _exit(2); } int main(int argc, char *argv[]) { int i=0; char *endp; stor[i++] = 0; if (argc < 2) { puts("\aUsage: PI "); return(1); } n = strtol(argv[1], &endp, 10); if (NULL == (mf = Fcalloc((Size_T)(n + 3L), (Size_T)sizeof(long)))) memerr(1); if (NULL == (ms = Fcalloc((Size_T)(n + 3L), (Size_T)sizeof(long)))) memerr(2); printf("\nApproximation of PI to %ld digits\n", (long)n); cnt = 0; kf = 25; ks = 57121L; mf[1] = 1L; for (i = 2; i <= (int)n; i += 2) { mf[i] = -16L; mf[i+1] = 16L; } for (i = 1; i <= (int)n; i += 2) { ms[i] = -4L; ms[i+1] = 4L; } printf("\n 3."); while (cnt < n) { for (i = 0; ++i <= (int)n - (int)cnt; ) { mf[i] *= 10L; ms[i] *= 10L; } for (i =(int)(n - cnt + 1); --i >= 2; ) { temp = 2 * i - 1; shift(&mf[i - 1], &mf[i], temp - 2, temp * kf); shift(&ms[i - 1], &ms[i], temp - 2, temp * ks); } nd = 0; shift((long FAR *)&nd, &mf[1], 1L, 5L); shift((long FAR *)&nd, &ms[1], 1L, 239L); xprint(nd); } printf("\n\nCalculations Completed!\n"); Ffree(ms); Ffree(mf); return(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/pi.h0000755000076400001440000000017107055334137015061 #ifndef PI #define PI (4*atan(1)) #endif #define deg2rad(d) ((d)*PI/180) #define rad2deg(r) ((r)*180/PI) c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/pr.c0000755000076400001440000002206407055334151015066 /* This program is similar to a program of the same name found on UNIX. It prints the files named in the command tail with headings except as modified below. usage: pr [-i -ln -on -pname -tn -wn] file1[ file2 ... filen] where: -i = accept files from stdin -ln = set lines per page to n -on = set page offset to n -pname = output to file -tn = set tabs to n cols -wn = set page width to n note: the expr 'PAGE(mesg)' found in col 1 will cause a formfeed and the 'mesg' to be included in the title line on this and each subsequent page until EOF or another PAGE. */ #include #define TAB_DEFAULT 4 #define PAGE_LENGTH 60 #define PAGE_OFFSET 0 #define PAGE_WIDTH 80 #define MAX_ARGS 70 #define MAX_FILES 64 #define PATH_LENGTH 63 #define PAGE(head) #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif int page_length = PAGE_LENGTH; int page_offset = PAGE_OFFSET; int page_width = PAGE_WIDTH; int tab_width = TAB_DEFAULT; char *xargv[ MAX_ARGS ]; unsigned xargc; char filenames [MAX_FILES] [PATH_LENGTH + 1]; char *print_name = "PRN:"; extern long atoi(); char title [80]; char date [20]; char time [20]; int ln, pn; PAGE (MAIN) main(argc, argv) /* copy file to printer */ int argc; char *argv []; { FILE *file, *lp; int fi = 0; int read_stdin = FALSE; int pn; char *cp; if (argc < 2) /* No args so tell 'em how it works */ { fprintf(stderr, "usage:\n\npr %s %s\n\n", "[-i] [-lnn] [-onn] [-p] [-tn] [-wnn]", "[file1[ file2 ... filen]]"); fprintf(stderr, "where: i = read 'stdin' for filenames to print\n"); fprintf(stderr, " l = lines-per-page and nn <= 120\n"); fprintf(stderr, " o = page offset and nn <= 120\n"); fprintf(stderr, " p = print redirection and\n"); fprintf(stderr, " = pathname or devicename\n"); fprintf(stderr, " t = spaces-per-tab and n <= 8\n"); fprintf(stderr, " w = page width and nn <= 160\n\n"); fprintf(stderr, "Notes: PAGE() in col 1 of text file\n"); fprintf(stderr, " and <title text...> the title you want.\n\n"); fprintf(stderr, " C pgms should include the following macro:\n\n"); fprintf(stderr, " #define PAGE(title)\n\n"); fprintf(stderr, " < and > not required and should not be used\n\n"); exit(0); } xargc = xargs("pr", argc, argv, xargv, MAX_ARGS); for (pn = 0; pn < xargc; pn++) { if (*xargv[pn] == '-') { cp = xargv[pn] + 1; switch (tolower(*cp)) { case 'i':/* wants help */ read_stdin = TRUE; break; case 'l':/* page length change */ page_length = (int) atoi(cp + 1); if ((page_length <= 0) || (page_length > 120)) page_length = PAGE_LENGTH; break; case 'p':/* direct output to file */ print_name = cp + 1; break; case 't':/* tab width change */ tab_width = (int) atoi(cp + 1); if ((tab_width <= 0) || (tab_width > 8)) tab_width = TAB_DEFAULT; break; case 'o':/* page offset change */ page_offset = (int) atoi(cp + 1); if ((page_offset < 0) || (page_offset > 120)) page_offset = PAGE_OFFSET; break; case 'w':/* page width change */ page_width = (int) atoi(cp + 1); if ((page_width <= 0) || (page_width > 160)) page_width = PAGE_WIDTH; break; default: fprintf(stderr, "pr: Invalid option = %s\n", xargv[pn]); } } else /* must be a path name */ { if (fi < MAX_FILES) strcpy(filenames[fi++], xargv[pn]); else { fprintf(stderr, "pr: " "Exceeded maximum file capacity\n"); break; } } } if ((lp = fopen(print_name, "w")) == 0) { fprintf(stderr, "pr: Unable to open %s as output\n", print_name); exit(1); } if (read_stdin) { for(;;) { if (fi == MAX_FILES) { fputs("pr: Exceeded maximum file capacity\n", stderr); break; } cp = gets(filenames [fi], PATH_LENGTH); if (!cp) break; else fi++; } } /* now print each file */ for (pn = 0; pn < fi; pn++) prt(filenames [pn], lp); /* print the file */ } PAGE (NEW PAGE) new_page (fnp, lp) char *fnp; FILE *lp; { if (ln < 3) return; ++pn; if (pn > 1) fputc('\f', lp); fprintf(lp, "%s %s %s PAGE %d: %s\n\n", fnp, date, time, pn, title); ln = 2; } PAGE (PRINT FILE) prt (fnp, lp) char fnp[]; FILE *lp; { FILE *inp_file; int i, j, col; char line [256], *st, *et, *sp; inp_file = fopen(fnp, "r"); if (!inp_file) { fprintf(stderr, "pr: unable to open %s\n", fnp); return; } else fprintf(stderr, "pr: printing %s\n", fnp); pn = 0; ln = 999; gdates(date); /* get date */ gtimes(time); /* and time */ *title = '\0'; while (fgets(line, 256, inp_file)) { if (strncmp(line, "PAGE", 4) == 0) { if (st = index(line, '(')) { et = index(line, ')'); strncpy(title, st + 1, (et) ? et - st - 1 : 160); } ln = 999; } if (ln > page_length) new_page(fnp, lp); if (page_offset) indent(lp); for (col = (page_offset) ? page_offset : 1, sp = &line[0]; *sp; sp++) { switch (*sp) { case '\t': /* tab character */ do { fputc(' ', lp); col++; if (col > page_width) { fputc('\n', lp); col = (page_offset) ? page_offset : 1; ln++; if (ln > page_length) new_page(fnp, lp); if (page_offset) indent(lp); break; } } while ((col - 1) % tab_width); break; case '\f': /* form feed character */ new_page(fnp, lp); break; default: fputc(*sp, lp); ++col; if (col > page_width) { fputc('\n', lp); col = (page_offset) ? page_offset - 1 : 0; ln++; if (ln > page_length) new_page(fnp, lp); if (page_offset) indent(lp); } } } /* of line print (for) */ ++ln; } /* of while not eof */ fclose(inp_file); fputc(014, lp); } /* of print */ indent(lp) FILE *lp; { int i; for(i = 1; i < page_offset; i++) fputc(' ', lp); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/wc.c�������������������������������������������������0000755�0000764�0000144�00000002644�07055334332�015061� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* File wc.c - a sample word count program Written and submitted to public domain by Jay Elkes April, 1992 */ #include <stdio.h> #include <string.h> #include <ctype.h> int main (int argc, char *argv[]) { FILE *infileptr; char infile[80]; long int nl = 0; long int nc = 0; long int nw = 0; int state = 0; const int NEWLINE = '\n'; int c; /* The program name itself is the first command line arguement so we ignore it (argv[0]) when showing user entered parameters. */ switch (argc - 1) { case (0): printf("no parameters\n"); return 12; case (1): break; default: printf("too many parameters\n"); return 12; } strcpy(infile,argv[1]); infileptr = fopen(infile,"rb"); if (infileptr == NULL) { printf("Cannot open %s\n",infile); return 12; } while ((c = getc(infileptr)) != EOF) { ++nc; if (c == NEWLINE) ++nl; if (isspace(c)) state = 0; else if (state == 0) { state = 1; ++nw; } } /* Final Housekeeping */ printf("%ld Lines, %ld Words, %ld Characters", nl, nw, nc); return 0; } ��������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/strucfil.c�������������������������������������������0000755�0000764�0000144�00000012430�07055334270�016276� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/******************************************************************* * Generic structure <> disk file manipulations. These functions * form a basic template for reading and writing structures to a * sequential file. This template is probably most useful for files * with 500 or less records and eliminates the need for a more * elaborate file handler such as C-Tree, DB-Vista, Mix etc. * Routines to put data in the struct is out of scope here. * Written by Lynn Nash 8/28/91 and donated to the public domain. */ #include <io.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #ifndef ERROR #define ERROR -1 #define OK 0 #endif #ifndef TRUE #define TRUE 1 #define FALSE !TRUE #endif /* make sure the record structure is byte aligned */ #if defined(__TURBOC__) #pragma option -a- #elif defined(__ZTC__) #pragma ZTC align 1 #else /* MSC/QC/WATCOM/METAWARE */ #pragma pack(1) #endif static struct blackbook { int delete_flag; /* 0 = active -1 = deleted */ int recordnum; /* a sequential number in the file */ /* The data fields in asciiz. */ char firstname[11]; char lastname[16]; char addr[26]; char city[16]; char state[3]; char zip[10]; char phone[11]; } rec, oldrec; /* 97 byte record * 2 */ #pragma pack() /*-------------------- general globals ---------------------*/ static long cur_rec = 0; /* the current record number */ static FILE *fsptr = NULL; /* fixed record data file pointer */ /* if file exists open in read/write mode else create file */ FILE * open_file(char *filename) { if (access(filename, 0) == 0) fsptr = fopen(filename, "rb+"); else fsptr = fopen(filename, "wb+"); return fsptr; /* return the file pointer */ } /* add new records to the data file */ int datadd(void) { if (fsptr) { if (fseek(fsptr, 0L, SEEK_END) != 0) return ERROR; /* seek failure */ rec.delete_flag = 0; /* active record tag */ rec.recordnum = (int) (ftell(fsptr) / (long) sizeof(struct blackbook)); if (fwrite(&rec, sizeof(struct blackbook), 1, fsptr) != 1) { return ERROR; /* write error */ } else { /* put your clean up code here */ return OK; } } return ERROR; } /* tag the last record read in the file as deleted */ int data_delete(void) { if (fsptr) { if (fseek(fsptr, (long) sizeof(struct blackbook) * -1L, SEEK_CUR) != 0) { return ERROR; } rec.delete_flag = -1; /* tag the record as deleted */ if (fwrite(&rec, sizeof(struct blackbook), 1, fsptr) != 1) return ERROR; else return OK; } return ERROR; } /* read a random structure. If successful the global cur_rec will * contain the number of the last record read & it can be compared * to the number in the struct as a double check (belt & suspenders) */ int data_read(long recnum) { if (fseek(fsptr, (long) sizeof(struct blackbook) * recnum, SEEK_SET) != 0) { return ERROR; } cur_rec = recnum; /* keep tabs on record pointer in global */ /* now read the record into save struct*/ if (fread(&oldrec, sizeof(struct blackbook), 1, fsptr) != 1) { return ERROR; } else /* copy save struct to edit struct */ { memcpy(&rec, &oldrec, sizeof(struct blackbook)); return OK; } } /* rewrite the last read record back to disk */ int data_update(void) { if (memcmp(&rec, &oldrec, sizeof(struct blackbook)) == 0) return TRUE; /* no update needed */ /* back up one record before writing */ if (fseek(fsptr, (long) sizeof(struct blackbook) * -1L, SEEK_CUR) != 0) { return ERROR; /* seek error */ } /* now write the record */ if (fwrite(&rec, sizeof(struct blackbook), 1, fsptr) != 1) return ERROR; /* write error */ return OK; } /* get the next valid record in the file */ int read_forward(void) { do { cur_rec++; /* upcount the record number */ if (data_read(cur_rec) != 0) { cur_rec--; /* decrement the record number */ return ERROR; } } while (oldrec.delete_flag != 0); /* record read was deleted */ return OK; } /* get the previous valid record in the file */ int read_backward(void) { do { cur_rec--; /* decrement the record number */ if (cur_rec >= 0) { if ( data_read(cur_rec) != 0 ) { cur_rec++; /* increment the record number */ return ERROR; } } } while (oldrec.delete_flag != 0); /* record read was deleted */ return OK; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rg_rand.c��������������������������������������������0000755�0000764�0000144�00000003765�07055334207�016072� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** longrand() -- generate 2**31-2 random numbers ** ** public domain by Ray Gardner ** ** based on "Random Number Generators: Good Ones Are Hard to Find", ** S.K. Park and K.W. Miller, Communications of the ACM 31:10 (Oct 1988), ** and "Two Fast Implementations of the 'Minimal Standard' Random ** Number Generator", David G. Carta, Comm. ACM 33, 1 (Jan 1990), p. 87-88 ** ** linear congruential generator f(z) = 16807 z mod (2 ** 31 - 1) ** ** uses L. Schrage's method to avoid overflow problems */ #define a 16807 /* multiplier */ #define m 2147483647L /* 2**31 - 1 */ #define q 127773L /* m div a */ #define r 2836 /* m mod a */ long nextlongrand(long seed) { unsigned long lo, hi; lo = a * (long)(seed & 0xFFFF); hi = a * (long)((unsigned long)seed >> 16); lo += (hi & 0x7FFF) << 16; if (lo > m) { lo &= m; ++lo; } lo += hi >> 15; if (lo > m) { lo &= m; ++lo; } return (long)lo; } static long randomnum = 1; long longrand(void) /* return next random long */ { randomnum = nextlongrand(randomnum); return randomnum; } void slongrand(unsigned long seed) /* to seed it */ { randomnum = seed ? (seed & m) : 1; /* nonzero seed */ } #ifdef TEST #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { long reps, k, num; unsigned long seed; reps = 10000; seed = 1; /* ** correctness test: after 10000 reps starting with seed 1, ** result should be 1043618065 */ if (argc > 1) reps = atol(argv[1]); if (argc > 2) seed = atol(argv[2]); printf("seed %ld for %ld reps...\n", seed, reps); slongrand(seed); for (k = 0; k < reps; ++k) num = longrand(); printf("%ld\n", num); return 0; } #endif �����������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rm_all.c���������������������������������������������0000755�0000764�0000144�00000014121�07055334211�015703� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Remove all files and (optionally) subdirectories ** ** public domain demo by Bob Stout */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <io.h> #include <dos.h> #include <ctype.h> #define LAST_CHAR(str) (str[strlen(str) - 1]) #define MAX_PATH 80 #ifdef __TURBOC__ #include <dir.h> #include <io.h> #define FAR far #define find_1st(n,a,b) (findfirst((n),(b),(a))) #define find_nxt(b) (findnext(b)) #define find_t ffblk #define name ff_name #define attrib ff_attrib #define _A_SUBDIR FA_DIREC #else #include <direct.h> #include <stdarg.h> #define FAR _far #define find_1st(n,a,b) (_dos_findfirst((n),(a),(b))) #define find_nxt(b) (_dos_findnext(b)) #ifndef FA_RDONLY #define FA_RDONLY _A_RDONLY #endif #ifndef FA_HIDDEN #define FA_HIDDEN _A_HIDDEN #endif #ifndef FA_SYSTEM #define FA_SYSTEM _A_SYSTEM #endif #if (defined(_MSC_VER) && (_MSC_VER >= 700)) || (defined(__SC__)) // Make FP_xxx macros lvalues as in older versions #undef FP_SEG #undef FP_OFF #define FP_SEG(fp) ((unsigned)((unsigned long)(fp) >> 16)) #define FP_OFF(fp) ((unsigned)(fp && 0xffff)) #endif #endif /* Select one of the following - remove() is ANSI */ #define rmfunc remove /* #define rmfunc unlink */ #define show(s) fputs((s), stderr) typedef enum {ERROR = -1, SUCCESS, FALSE = 0, TRUE} LOGICAL; LOGICAL recurse = FALSE, gobble = FALSE, ignore = FALSE; char *mask = "*.*"; /* ** Clean all files from a directory */ void clean_dir(char *path) { char rmpath[MAX_PATH], *rmfile; struct find_t fbuf; unsigned attrib = (ignore) ? 0xff : 0; strcpy(rmpath, path); if ('\\' != LAST_CHAR(rmpath)) strcat(rmpath, "\\"); rmfile = &rmpath[strlen(rmpath)]; strcpy(rmfile, mask); if (0 == find_1st(rmpath, attrib, &fbuf)) do { strcpy(rmfile, fbuf.name); if (ignore) { union REGS regs; struct SREGS sregs; regs.x.ax = 0x4300; regs.x.dx = FP_OFF((char FAR *)rmpath); segread(&sregs); sregs.ds = FP_SEG((char FAR *)rmpath); intdosx(®s, ®s, &sregs); if (!regs.x.cflag) { regs.x.ax = 0x4301; regs.x.cx &= ~(FA_RDONLY | FA_HIDDEN | FA_SYSTEM); intdosx(®s, ®s, &sregs); if (regs.x.cflag) printf("unable to delete %s\n", rmpath); } } rmfunc(rmpath); printf("deleting %s\n", rmpath); } while (0 == find_nxt(&fbuf)); } /* ** Process directories */ void do_dir(char *path) { char search[MAX_PATH], new[MAX_PATH]; struct find_t ff; strcpy(search, path); if ('\\' != LAST_CHAR(search)) strcat(search, "\\"); strcat(search, "*.*"); if (SUCCESS == find_1st(search, 0xff, &ff)) do { if (ff.attrib & _A_SUBDIR && '.' != *ff.name) { strcpy(new, path); if ('\\' != LAST_CHAR(new)) strcat(new, "\\"); strcat(new, ff.name); do_dir(new); } } while (SUCCESS == find_nxt(&ff)); clean_dir(path); if (gobble) rmdir(path); } /* ** Tell 'em they messed up */ void usage(LOGICAL errstat) { if (errstat) fputc('\a', stderr); show("Usage: RM_ALL directory [...directory] [-eFNAME.EXT] [-rgi?]\n"); show("switches: -eFNAME.EXT Remove only files matching mask " "(default is \"-e*.*\")\n"); show(" -r Recurse subdirectories\n"); show(" -g Gobble (delete) empty subdirectories\n"); show(" -i Ignore special file attributes " "(CAUTION!)\n"); show(" -? Display help (this message)\n"); exit(errstat); } /* ** RM_ALL - Deletes all files and (optionally) subdirectories */ int main(int argc, char *argv[]) { int i, j; LOGICAL found_dir = FALSE; void (*clean_func)(char *) = clean_dir; for (i = 1; i < argc; ++i) /* Check for switches */ { if (NULL == strchr("-/", *argv[i])) continue; /* Assume it's a filename */ for (j = 1; argv[i][j] ; ++j) /* Traverse nested switches */ { switch (toupper(argv[i][j])) { case 'R': clean_func = do_dir; break; case 'G': gobble = TRUE; break; case 'I': ignore = TRUE; break; case '?': puts("***help***"); usage(FALSE); break; case 'E': if (0 == strlen(&argv[i][++j])) { puts("***no file***"); usage(ERROR); /* Oops */ } mask = strupr(&argv[i][j]); j += strlen(&argv[i][j]) - 1; /* End of switch */ break; default: puts("***default***"); usage(ERROR); } } } for (i = 1; i < argc; ++i) /* Scan filenames */ { if (strchr("/-", *argv[i])) continue; found_dir = TRUE; clean_func(argv[i]); } if (!found_dir) { puts("***not found***"); usage(TRUE); } else return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bmhisrch.c�������������������������������������������0000755�0000764�0000144�00000006111�07055333655�016247� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Case-Insensitive Boyer-Moore-Horspool pattern match ** ** Public Domain version by Thad Smith 7/21/1992, ** based on a 7/92 public domain BMH version by Raymond Gardner. ** ** This program is written in ANSI C and inherits the compilers ** ability (or lack thereof) to support non-"C" locales by use of ** toupper() and tolower() to perform case conversions. ** Limitation: pattern length + string length must be less than 32767. ** ** 10/21/93 rdg Fixed bugs found by Jeff Dunlop */ #include <limits.h> #include <stdlib.h> #include <string.h> #include <ctype.h> typedef unsigned char uchar; #define LARGE 32767 /* flag for last character match */ static int patlen; /* # chars in pattern */ static int skip[UCHAR_MAX+1]; /* skip-ahead count for test chars */ static int skip2; /* skip-ahead after non-match with ** matching final character */ static uchar *pat = NULL; /* uppercase copy of pattern */ /* ** bmhi_init() is called prior to bmhi_search() to calculate the ** skip array for the given pattern. ** Error: exit(1) is called if no memory is available. */ void bmhi_init(const char *pattern) { int i, lastpatchar; patlen = strlen(pattern); /* Make uppercase copy of pattern */ pat = realloc ((void*)pat, patlen); if (!pat) exit(1); for (i=0; i < patlen; i++) pat[i] = toupper(pattern[i]); /* initialize skip array */ for ( i = 0; i <= UCHAR_MAX; ++i ) /* rdg 10/93 */ skip[i] = patlen; for ( i = 0; i < patlen - 1; ++i ) { skip[ pat[i] ] = patlen - i - 1; skip[tolower(pat[i])] = patlen - i - 1; } lastpatchar = pat[patlen - 1]; skip[ lastpatchar ] = LARGE; skip[tolower(lastpatchar)] = LARGE; skip2 = patlen; /* Horspool's fixed second shift */ for (i = 0; i < patlen - 1; ++i) { if ( pat[i] == lastpatchar ) skip2 = patlen - i - 1; } } char *bmhi_search(const char *string, const int stringlen) { int i, j; char *s; i = patlen - 1 - stringlen; if (i >= 0) return NULL; string += stringlen; for ( ;; ) { while ( (i += skip[((uchar *)string)[i]]) < 0 ) ; /* mighty fast inner loop */ if (i < (LARGE - stringlen)) return NULL; i -= LARGE; j = patlen - 1; s = (char *)string + (i - j); while ( --j >= 0 && toupper(s[j]) == pat[j] ) ; if ( j < 0 ) /* rdg 10/93 */ return s; /* rdg 10/93 */ if ( (i += skip2) >= 0 ) /* rdg 10/93 */ return NULL; /* rdg 10/93 */ } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/fln_fix.c��������������������������������������������0000755�0000764�0000144�00000007761�07055333761�016107� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** FLN_FIX.C ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include <stdio.h> #include <string.h> #include <dos.h> #include <io.h> #define LAST_CHAR(string) (((char *)string)[strlen(string)-1]) typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL; char *unix2dos(char *path); /****************************************************************/ /* */ /* Function to `crunch' dot directories and check for */ /* DOS-valid path strings. Drive specifiers in the path */ /* ignored. */ /* */ /****************************************************************/ char *fln_fix(char *path) { LOGICAL dir_flag = FALSE, root_flag = FALSE; char *r, *p, *q, *s; if (path) strupr(path); /* Ignore leading drive specs */ if (NULL == (r = strrchr(path, ':'))) r = path; else ++r; unix2dos(r); /* Convert Unix to DOS style */ while ('\\' == *r) /* Ignore leading backslashes */ { if ('\\' == r[1]) strcpy(r, &r[1]); else { root_flag = TRUE; ++r; } } p = r; /* Change "\\" to "\" */ while (NULL != (p = strchr(p, '\\'))) { if ('\\' == p[1]) strcpy(p, &p[1]); else ++p; } while ('.' == *r) /* Scrunch leading ".\" */ { if ('.' == r[1]) { /* Ignore leading ".." */ for (p = (r += 2); *p && (*p != '\\'); ++p) ; } else { for (p = r + 1 ;*p && (*p != '\\'); ++p) ; } strcpy(r, p + ((*p) ? 1 : 0)); } while ('\\' == LAST_CHAR(path)) /* Strip trailing backslash */ { dir_flag = TRUE; LAST_CHAR(path) = '\0'; } s = r; /* Look for "\." in path */ while (NULL != (p = strstr(s, "\\."))) { if ('.' == p[2]) { /* Execute this section if ".." found */ q = p - 1; while (q > r) /* Backup one level */ { if (*q == '\\') break; --q; } if (q > r) { strcpy(q, p + 3); s = q; } else if ('.' != *q) { strcpy(q + ((*q == '\\') ? 1 : 0), p + 3 + ((*(p + 3)) ? 1 : 0)); s = q; } else s = ++p; } else { /* Execute this section if "." found */ q = p + 2; for ( ;*q && (*q != '\\'); ++q) ; strcpy (p, q); } } if (root_flag) /* Embedded ".." could have bubbled up to root */ { for (p = r; *p && ('.' == *p || '\\' == *p); ++p) ; if (r != p) strcpy(r, p); } if (dir_flag) strcat(path, "\\"); return path; } ���������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/scanfrac.c�������������������������������������������0000755�0000764�0000144�00000007700�07055334216�016227� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* function scanfrac - scan an input string for a numeric value. ** ** Written in ANSI C and contributed to the public domain by ** Thad Smith III, Boulder, CO. August 5, 1991 */ /******************************************************************* ** scanfrac() scans an input string for a numeric value, which can ** be specified as: ** 1. an integer, 5 ** 2. a floating point value, 5.1 ** 3. a fraction, or 3/4 ** 4. a mixed fraction. 5 3/4 or 5-3/4 ** ** Conditions: ** 1. Preceeding whitespace is allowed. ** 2. The input number may be signed. ** 3. The fractional part of a mixed fraction (but not pure fraction) ** must be less than 1. ** 4. The numerator and denominator of a fraction or mixed fraction ** must be less than 2^31. ** ** Parameters: ** 1. Input buffer containing value. ** 2. Pointer to double to receive return value. ** ** Return status: ** 0 = OK, value returned in f, ** 1 = bad input format, ** 2 = can't allocate memory */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int scanfrac (const char buf[], double *f) { char *tbuf = malloc (strlen(buf) +2); /* input + terminator */ static char term[] = "\a"; /* terminator flag */ char t1,t2,t3; /* separator chars */ char sign; /* possible sign */ int nc; /* # conversions */ long int b,c; /* 2nd & 3rd inputs */ if (!tbuf) /* couldn't allocate memory */ return 2; /* Copy the input to a temporary buffer and append a terminator ** character. This terminator is used to determine whether the ** scanning of the input field by sscanf() was terminated by end ** of input or by an invalid character. If terminated properly, ** the terminator character picked up in t1, t2, or t3. */ strcat (strcpy(tbuf, buf), term); /* input + term flag */ nc = sscanf (tbuf, " %lf%c %ld %c %ld %c", f,&t1,&b,&t2,&c,&t3); free (tbuf); switch (nc) /* number of sscanf() conversions */ { case 2: /* single floating value: a */ if (t1 == *term) return 0; break; case 4: /* pure fraction: a/b */ if (t1 == '/' && t2 == *term && fmod (*f,1.0) == 0.0 && b > 0) { *f /= b; return 0; } break; case 6: /* mixed fraction: a b/c or a-b/c */ if ((t1 == ' ' || t1 == '-') && t2 == '/' && t3 == *term && fmod (*f,1.0) == 0.0 && b >= 0 && c > b) { /* get first non-blank character so that ** -0 b/c will be neg */ #ifdef __ZTC__ /* fix for missing const in sscanf() declaration */ sscanf ((char*)buf, " %c", &sign); #else sscanf (buf, " %c", &sign); #endif if (sign == '-') *f -= (double)b/c; else *f += (double)b/c; return 0; } } return 1; } /* This is a simple test driver. It should be omitted before ** placing scanfrac() into a library. */ main () { char buf[80]; double f; int stat; printf ("Enter 999. or generate EOF to stop\n"); do { printf ("Enter value: "); if (! gets (buf)) { printf ("EOF detected. Aborting.\n"); return 1; } stat = scanfrac (buf, &f); printf ("\nStat = %d, value = %f\n", stat, f); } while ( f != 999.); return 0; } ����������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bincomp.c��������������������������������������������0000755�0000764�0000144�00000010231�07055333651�016071� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** BINCOMP -- binary compare ** by Raymond Gardner -- Englewood CO -- 8/92 -- public domain */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #ifndef min #define min(a,b) ((a) < (b) ? (a) : (b)) #endif #define bufsize 8 #define empty_legend " .." unsigned char f1buf[bufsize+1], f2buf[bufsize+1]; long prevn; void putempty(unsigned n) { while (n--) printf(empty_legend); } void putbl(unsigned n) { while (n--) printf(" "); } void showbufs(long n, unsigned m, unsigned char *b1, unsigned char *b2) { unsigned i; if (n != prevn + bufsize) printf("\n"); prevn = n; printf("%08lX ", n); if (b1 && b2) { for (i = 0; i < m; i++) printf(" %02X", b1[i]); for (i = m; i < 8; i++) printf(" "); putchar(' '); for (i = 0; i < m; i++) { if (isprint(b1[i])) putchar(b1[i]); else putchar(' '); } for (i = m; i < 8; i++) putchar(' '); printf(" |"); for (i = 0; i < m; i++) { if (b1[i] != b2[i]) printf(" %02X", b2[i]); else printf(empty_legend); } for (i = m; i < 8; i++) printf(" "); putchar(' '); for (i = 0; i < m; i++) { if (b1[i] != b2[i] && isprint(b2[i])) putchar(b2[i]); else putchar(' '); } } else if (b1) { for (i = 0; i < m; i++) printf(" %02X", b1[i]); for (i = m; i < 8; i++) printf(" "); putchar(' '); for (i = 0; i < m; i++) { if (isprint(b1[i])) putchar(b1[i]); else putchar(' '); } for (i = m; i < 8; i++) putchar(' '); printf(" |"); } else { putbl(33); printf(" |"); for (i = 0; i < m; i++) printf(" %02X", b2[i]); for (i = m; i < 8; i++) printf(" "); putchar(' '); for (i = 0; i < m; i++) { if (isprint(b2[i])) putchar(b2[i]); else putchar(' '); } } printf("\n"); } long fsize(FILE *fp) { long pos, size; pos = ftell(fp); fseek(fp, 0L, SEEK_END); size = ftell(fp); fseek(fp, pos, SEEK_SET); return size; } void bincomp(FILE *f1, FILE *f2) { unsigned m; long f1len, f2len, k, n; prevn = -1; f1len = fsize(f1); f2len = fsize(f2); printf("%ld %ld\n", f1len, f2len); k = min(f1len, f2len); n = 0; while (n < k) { m = (unsigned)min(k - n, (long)bufsize); fread(f1buf, 1, m, f1); fread(f2buf, 1, m, f2); if (memcmp(f1buf, f2buf, m) != 0) showbufs(n, m, f1buf, f2buf); n += m; } while (n < f1len) { m = (unsigned)min(f1len - n, (long)bufsize); fread(f1buf, 1, m, f1); showbufs(n, m, f1buf, NULL); n += m; } while (n < f2len) { m = (unsigned)min(f2len - n, (long)bufsize); fread(f2buf, 1, m, f2); showbufs(n, m, NULL, f2buf); n += m; } } int main(int argc, char **argv) { FILE *f1, *f2; if (argc < 3) { puts("Usage: bincomp f1 f2"); exit(0); } printf("%s vs. %s\n", argv[1], argv[2]); f1 = fopen(argv[1], "rb"); f2 = fopen(argv[2], "rb"); if (f1 && f2) bincomp(f1, f2); else puts("can't open file(s)"); return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/lbitops.c��������������������������������������������0000755�0000764�0000144�00000002316�07055334036�016121� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** large bit array operations by Scott Dudley ** with modifications by Auke Reitsma and Bob Stout ** ** Public domain */ #include <limits.h> /* ** The following macros assume CHAR_BIT is one of either 8, 16, or 32 */ #define MASK CHAR_BIT-1 #define SHIFT ((CHAR_BIT==8)?3:(CHAR_BIT==16)?4:8) #define BitOff(a,x) ((void)((a)[(x)>>SHIFT] &= ~(1 << ((x)&MASK)))) #define BitOn(a,x) ((void)((a)[(x)>>SHIFT] |= (1 << ((x)&MASK)))) #define BitFlip(a,x) ((void)((a)[(x)>>SHIFT] ^= (1 << ((x)&MASK)))) #define IsBit(a,x) ((a)[(x)>>SHIFT] & (1 << ((x)&MASK))) #include <stdio.h> #include <string.h> int main(void) { char array[64]; memset(array, '\0', sizeof(array)); BitOn(array, 5); BitOn(array, 12); BitOn(array, 500); if (IsBit(array, 5) && IsBit(array, 12) && IsBit(array, 500)) puts("These functions seem to work!"); else puts("Something's broken here!"); BitFlip(array, 12); BitOff(array, 5); if (!IsBit(array, 5) && !IsBit(array, 12) && IsBit(array, 500)) puts("These functions still seem to work!"); else puts("Something's broken here!"); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/center.c���������������������������������������������0000755�0000764�0000144�00000002466�07055333673�015741� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* public domain by Jerry Coffin. Tested with MSC 7.0 */ /* written primarily for clarity, not speed... */ /* requires w_wrap.c and w_wrap.h from snippets. */ #include <stdio.h> #include <conio.h> #include <string.h> #include "w_wrap.h" void center(FILE *file, char *string, size_t width) { char *line,*end_line; size_t spaces; int last = 0; size_t len; word_wrap(string,width); line = string; while (!last) { end_line = strchr(line,'\n'); if (NULL==end_line) { last = 1; end_line = strchr(line,'\0'); } len = end_line - line; spaces = (width - len) / 2 ; fprintf(file,"\n%*c%*.*s",spaces,' ',len,len,line); line = end_line + 1; } } #ifdef TEST int main(void) { char *string = "This is a long string to see if it will be" " printed out correctly but I'm not sure whether it will work" " correctly or not. I guess we'll see when we try it out."; printf("\nHere's the string centered in 50 columns.\n"); center(stdout,string,50); printf("\n\nAnd here it's centered in 72 columns.\n"); center(stdout,string,72); } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rand1.c����������������������������������������������0000755�0000764�0000144�00000017105�07055334174�015457� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/************************************************************************ This random number generator originally appeared in "Toward a Universal Random Number Generator" by George Marsaglia and Arif Zaman. Florida State University Report: FSU-SCRI-87-50 (1987) It was later modified by F. James and published in "A Review of Pseudo- random Number Generators" Converted from FORTRAN to C by Phil Linttell, James F. Hickling Management Consultants Ltd, Aug. 14, 1989. THIS IS THE BEST KNOWN RANDOM NUMBER GENERATOR AVAILABLE. (However, a newly discovered technique can yield a period of 10^600. But that is still in the development stage.) It passes ALL of the tests for random number generators and has a period of 2^144, is completely portable (gives bit identical results on all machines with at least 24-bit mantissas in the floating point representation). The algorithm is a combination of a Fibonacci sequence (with lags of 97 and 33, and operation "subtraction plus one, modulo one") and an "arithmetic sequence" (using subtraction). On a Vax 11/780, this random number generator can produce a number in 13 microseconds. ************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #define TRUE 1 #define FALSE 0 float u[97], c, cd, cm; int i97, j97, test; int rmarin(int ij, int kl); int ranmar(float rvec[], int len); int main() { float temp[100]; int i; int ij, kl, len; /*These are the seeds needed to produce the test case results*/ ij = 1802; kl = 9373; /*Do the initialization*/ if (1 == rmarin(ij,kl)) return 1; /*Generate 20000 random numbers*/ len = 100; for ( i=0; i<=199 ; i++) if (1 == ranmar(temp, len)) return 1; /*If the random number generator is working properly, the next six random numbers should be: 6533892.0 14220222.0 7275067.0 6172232.0 8354498.0 10633180.0 */ len = 6; if (1 == ranmar(temp, len)) return 1; for ( i=0; i<=5; i++) printf("%12.1f\n",4096.0*4096.0*temp[i]); return 0; } /************************************************************************ This is the initialization routine for the random number generator RANMAR() NOTE: The seed variables can have values between: 0 <= IJ <= 31328 0 <= KL <= 30081 The random number sequences created by these two seeds are of sufficient length to complete an entire calculation with. For example, if several different groups are working on different parts of the same calculation, each group could be assigned its own IJ seed. This would leave each group with 30000 choices for the second seed. That is to say, this random number generator can create 900 million different subsequences -- with each subsequence having a length of approximately 10^30. Use IJ = 1802 & KL = 9373 to test the random number generator. The subroutine RANMAR should be used to generate 20000 random numbers. Then display the next six random numbers generated multiplied by 4096*4096 If the random number generator is working properly, the random numbers should be: 6533892.0 14220222.0 7275067.0 6172232.0 8354498.0 10633180.0 ************************************************************************/ int rmarin(int ij, int kl) { float s, t; int i, j, k, l, m; int ii, jj; /* Change FALSE to TRUE in the next statement to test the random routine.*/ test = TRUE; if ( ( ij < 0 || ij > 31328 ) || ( kl < 0 || kl > 30081 ) ) { printf ("RMARIN: The first random number seed must have a " "value between 0 and 31328\n"); printf (" The second random number seed must have a " "value between 0 and 30081"); return 1; } i = (int)fmod(ij/177.0, 177.0) + 2; j = (int)fmod(ij , 177.0) + 2; k = (int)fmod(kl/169.0, 178.0) + 1; l = (int)fmod(kl , 169.0); for ( ii=0; ii<=96; ii++ ) { s = (float)0.0; t = (float)0.5; for ( jj=0; jj<=23; jj++ ) { m = (int)fmod( fmod(i*j,179.0)*k , 179.0 ); i = j; j = k; k = m; l = (int)fmod( 53.0*l+1.0 , 169.0 ); if ( fmod(l*m,64.0) >= 32) s = s + t; t = (float)(0.5 * t); } u[ii] = s; } c = (float)( 362436.0 / 16777216.0); cd = (float)( 7654321.0 / 16777216.0); cm = (float)(16777213.0 / 16777216.0); i97 = 96; j97 = 32; test = TRUE; return 0; } int ranmar(float rvec[], int len) { float uni; int ivec; if ( !test ) { printf ("RANMAR: Call the initialization routine (RMARIN) " "before calling RANMAR.\n"); return 1; } for ( ivec=0; ivec < len; ivec++) { uni = u[i97] - u[j97]; if ( uni < 0.0F ) uni = uni + 1.0; u[i97] = uni; i97--; if ( i97 < 0 ) i97 = 96; j97--; if ( j97 < 0 ) j97 = 96; c = c - cd; if ( c < 0.0F ) c = c + cm; uni = uni - c; if ( uni < 0.0F ) uni = uni + 1.0; rvec[ivec] = uni; } return 0; } /* I use the following procedure in TC to generate seeds: The sow() procedure calculates two seeds for use with the random number generator from the system clock. I decided how to do this myself, and I am sure that there must be better ways to select seeds; hopefully, however, this is good enough. The first seed is calculated from the values for second, minute, hour, and year-day; weighted with the second most significant and year-day least significant. The second seed weights the values in reverse. */ void sow( seed1, seed2 ) int *seed1, *seed2; { struct tm *tm_now; float s_sig, s_insig, maxs_sig, maxs_insig; long secs_now; int s, m, h, d, s1, s2; time(&secs_now); tm_now = localtime(&secs_now); s = tm_now->tm_sec + 1; m = tm_now->tm_min + 1; h = tm_now->tm_hour + 1; d = tm_now->tm_yday + 1; maxs_sig = (float)(60.0 + 60.0/60.0 + 24.0/60.0/60.0 + 366.0/24.0/60.0/60.0); maxs_insig = (float)(60.0 + 60.0*60.0 + 24.0*60.0*60.0 + 366.0*24.0*60.0*60.0); s_sig = (float)(s + m/60.0 + h/60.0/60.0 + d/24.0/60.0/60.0); s_insig = (float)(s + m*60.0 + h*60.0*60.0 + d*24.0*60.0*60.0); s1 = (int)(s_sig / maxs_sig * 31328.0); s2 = (int)(s_insig / maxs_insig * 30081.0); *seed1 = s1; *seed2 = s2; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rand2.c����������������������������������������������0000755�0000764�0000144�00000002431�07055334175�015455� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/******************************************************************** The McGill Super-Duper Random Number Generator G. Marsaglia, K. Ananthanarayana, N. Paul Incorporating the Ziggurat method of sampling from decreasing or symmetric unimodal density functions. G. Marsaglia, W.W. Tsang Rewritten into C by E. Schneider *********************************************************************/ static unsigned long mcgn, srgn; #define MULT 69069L void rstart (long i1, long i2) { mcgn = (unsigned long)((i1 == 0L) ? 0L : i1 | 1L); srgn = (unsigned long)((i2 == 0L) ? 0L : (i2 & 0x7FFL) | 1L); } long uni(void) { unsigned long r0, r1; r0 = (srgn >> 15); r1 = srgn ^ r0; r0 = (r1 << 17); srgn = r0 ^ r1; mcgn = MULT * mcgn; r1 = mcgn ^ srgn; return (r1 >> 1); } long vni(void) { unsigned long r0, r1; r0 = (srgn >> 15); r1 = srgn ^ r0; r0 = (r1 << 17); srgn = r0 ^ r1; mcgn = MULT * mcgn; r1 = mcgn ^ srgn; return r1; } /* "Anyone who consider arithmetic means of producing random number is, of course, in a state of sin" - John Von Neumann */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/biport.c���������������������������������������������0000755�0000764�0000144�00000000513�07055333651�015743� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** BIPORT.C - Port TC/TC++/BC++ code using register pseudovariables ** ** public domain by Bob Stout */ #include "biport.h" union REGS BIP_regs_; struct SREGS BIP_sregs_; unsigned _pascal geninterrupt(int int_no) { int86x(int_no, &BIP_regs_, &BIP_regs_, &BIP_sregs_); return BIP_regs_.x.ax; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/biport.h���������������������������������������������0000755�0000764�0000144�00000001515�07055333651�015753� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** BIPORT.H - Port TC/TC++/BC++ code using register pseudovariables ** ** public domain by Bob Stout */ #include <dos.h> extern union REGS BIP_regs_; extern struct SREGS BIP_sregs_; #define _AX BIP_regs_.x.ax #define _BX BIP_regs_.x.bx #define _CX BIP_regs_.x.cx #define _DX BIP_regs_.x.dx #define _AH BIP_regs_.h.ah #define _AL BIP_regs_.h.al #define _BH BIP_regs_.h.ah #define _BL BIP_regs_.h.al #define _CH BIP_regs_.h.ah #define _CL BIP_regs_.h.al #define _DH BIP_regs_.h.ah #define _DL BIP_regs_.h.al #define _SI BIP_regs_.x.si #define _DI BIP_regs_.x.di #define _CF BIP_regs_.x.cflag #define _FF BIP_regs_.x.flags #define _ES BIP_sregs_.es #define _CS BIP_sregs_.cs #define _SS BIP_sregs_.ss #define _DS BIP_sregs_.ds #define regload_() segread(&BIP_sregs_) unsigned _pascal geninterrupt(int); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/fcompare.c�������������������������������������������0000755�0000764�0000144�00000002535�07055333755�016253� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** FCOMPARE.C - Compare 2 files ** ** public domain demo by Bob Stout */ #include <stdio.h> #include <stdlib.h> #include <string.h> enum {ERROR = -1, SUCCESS, FAIL}; #define BUFSIZE 16384 static char buf[2][BUFSIZE]; int fcompare(const char *fname1, const char *fname2) { FILE *f1, *f2; int retval = SUCCESS; if (NULL == (f1 = fopen(fname1, "rb"))) return ERROR; if (NULL != (f2 = fopen(fname2, "rb"))) { size_t size1, size2; do { size1 = fread(buf[0], 1, BUFSIZE, f1); size2 = fread(buf[1], 1, BUFSIZE, f2); if (0 == (size1 | size2)) break; if ((size1 != size2) || memcmp(buf[0], buf[1], size1)) { retval = FAIL; break; } } while (size1 && size2); fclose(f2); } else retval = ERROR; fclose(f1); return retval; } #ifdef TEST int main(int argc, char *argv[]) { if (3 > argc) { puts("Usage: FCOMPARE file1 file2"); return 1; } printf("fcompare(%s, %s) returned %d\n", argv[1], argv[2], fcompare(argv[1], argv[2])); } #endif /* TEST */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/pfopen.c���������������������������������������������0000755�0000764�0000144�00000003300�07055334136�015727� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Written and released to the public domain by David Engel. * * This function attempts to open a file which may be in any of * several directories. It is particularly useful for opening * configuration files. For example, PROG.EXE can easily open * PROG.CFG (which is kept in the same directory) by executing: * * cfg_file = pfopen("PROG.CFG", "r", getenv("PATH")); * * NULL is returned if the file can't be opened. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef unix #define SEP_CHARS ":" #else #define SEP_CHARS ";" #endif FILE *pfopen(const char *name, const char *mode, const char *dirs) { char *ptr; char *tdirs; FILE *file = NULL; if (dirs == NULL || dirs[0] == '\0') return NULL; if ((tdirs = malloc(strlen(dirs)+1)) == NULL) return NULL; strcpy(tdirs, dirs); for (ptr = strtok(tdirs, SEP_CHARS); file == NULL && ptr != NULL; ptr = strtok(NULL, SEP_CHARS)) { size_t len; char work[FILENAME_MAX]; strcpy(work, ptr); len = strlen(work); if (len && work[len-1] != '/' && work[len-1] != '\\') strcat(work, "/"); strcat(work, name); file = fopen(work, mode); } free(tdirs); return file; } #ifdef TEST int main(int argc, char **argv) { FILE *file; if (argc != 4) { fprintf(stderr, "usage: pfopen name mode dirs\n"); exit(1); } file = pfopen(argv[1], argv[2], argv[3]); printf("%s \"%s\" with mode \"%s\"\n", (file == NULL) ? "Could not open" : "Opened", argv[1], argv[2]); return 0; } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/noreset.c��������������������������������������������0000755�0000764�0000144�00000005544�07055334126�016132� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* code to disable <Ctrl><Alt><Del>. */ /* Compiled and tested under TC++ and MSC 6 */ #include <dos.h> #include <conio.h> #if defined(__TURBOC__) #define _interrupt interrupt #define _far far #else /* i.e. if MSC */ #define inportb(port) inp(port) #define outportb(port,val) outp(port,val) #define enable() _enable() #define disable() _disable() #define getvect(int) _dos_getvect(int) #define setvect(int,ptr) _dos_setvect(int,ptr) unsigned char peekb(unsigned seg, unsigned ofs) { unsigned char far *ptr; FP_SEG(ptr) = seg; FP_OFF(ptr) = ofs; return *ptr; } #endif #define CTRLALT (0x08|0x04) /* bit flags set in kbstat() */ #define DELSCAN 0x53 /* keyboard scan code for <Del> */ #define KEYPORT 0x60 /* keyboard scan code port */ #define CONTROLLERPORT 0x20 /* interrupt controller port */ #define kbstat() peekb(0,0x417) /* BIOS data area - kb flags */ #define keyport() inportb(KEYPORT) /* macro that returns the scancode of the key that caused */ /* the interrupt */ #define install() (oldkbisr=getvect(0x09),setvect(0x09,newkbisr)) /* installation macro, installs newkbisr() in the keyboard */ /* interrupt chain */ #define uninstall() setvect(0x09,oldkbisr) /* removal macro, call to remove newkbisr() from interrupt */ /* chain. oldkbisr() must be removed before program ends */ void (_interrupt _far * oldkbisr)(void); /* address of old keyboard ISR */ void _interrupt _far newkbisr(void) { if((keyport()==DELSCAN)&&((kbstat()&CTRLALT)==CTRLALT)) { char kbin = (char)inportb(KEYPORT+1); /* reset keyboard */ outportb(KEYPORT+1, kbin|0x80); outportb(KEYPORT+1, kbin); disable(); outportb(CONTROLLERPORT,0x20); /* tell controller to shut up */ enable(); } else oldkbisr(); /* chain to old keyboard isr */ } #ifdef TEST #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <signal.h> #include <errno.h> void main(void) { int ch = 0; void cleanup(void), cbrk(int); install(); atexit(cleanup); signal(SIGINT, cbrk); puts("This is a test of Ctrl-Alt-Del disabling."); puts("Press any key, but only Esc should stop this program."); while (0x1b != ch) { if (kbhit) ch = getch(); } } void cbrk(int sig) { signal(SIGINT, SIG_IGN); signal(SIGINT, cbrk); } void cleanup(void) { uninstall(); } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/strftime.c�������������������������������������������0000755�0000764�0000144�00000023407�07055334265�016312� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * * strftime.c * * implements the ansi c function strftime() * * written 6 september 1989 by jim nutt * released into the public domain by jim nutt * * modified 21-Oct-89 by Rob Duff * **/ #include <stddef.h> /* for size_t */ #include <stdarg.h> /* for va_arg */ #include <time.h> /* for struct tm */ /* ** The following line should be appended to TIME.H. ** Also copy size_t define from STRING.H. */ size_t strftime(char *s, size_t maxs, const char *f, const struct tm *t); static char *aday[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static char *day[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; static char *amonth[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; static char *month[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; extern char *tzname[2]; static char buf[26]; static void strfmt(char *str, const char *fmt, ...); /** * * size_t strftime(char *str, * size_t maxs, * const char *fmt, * const struct tm *t) * * this functions acts much like a sprintf for time/date output. * given a pointer to an output buffer, a format string and a * time, it copies the time to the output buffer formatted in * accordance with the format string. the parameters are used * as follows: * * str is a pointer to the output buffer, there should * be at least maxs characters available at the address * pointed to by str. * * maxs is the maximum number of characters to be copied * into the output buffer, included the '\0' terminator * * fmt is the format string. a percent sign (%) is used * to indicate that the following character is a special * format character. the following are valid format * characters: * * %A full weekday name (Monday) * %a abbreviated weekday name (Mon) * %B full month name (January) * %b abbreviated month name (Jan) * %c standard date and time representation * %d day-of-month (01-31) * %H hour (24 hour clock) (00-23) * %I hour (12 hour clock) (01-12) * %j day-of-year (001-366) * %M minute (00-59) * %m month (01-12) * %p local equivalent of AM or PM * %S second (00-59) * %U week-of-year, first day sunday (00-53) * %W week-of-year, first day monday (00-53) * %w weekday (0-6, sunday is 0) * %X standard time representation * %x standard date representation * %Y year with century * %y year without century (00-99) * %Z timezone name * %% percent sign * * the standard date string is equivalent to: * * %a %b %d %Y * * the standard time string is equivalent to: * * %H:%M:%S * * the standard date and time string is equivalent to: * * %a %b %d %H:%M:%S %Y * * strftime returns the number of characters placed in the * buffer, not including the terminating \0, or zero if more * than maxs characters were produced. * **/ size_t strftime(char *s, size_t maxs, const char *f, const struct tm *t) { int w; char *p, *q, *r; p = s; q = s + maxs - 1; while ((*f != '\0')) { if (*f++ == '%') { r = buf; switch (*f++) { case '%' : r = "%"; break; case 'a' : r = aday[t->tm_wday]; break; case 'A' : r = day[t->tm_wday]; break; case 'b' : r = amonth[t->tm_mon]; break; case 'B' : r = month[t->tm_mon]; break; case 'c' : strfmt(r, "%0 %0 %2 %2:%2:%2 %4", aday[t->tm_wday], amonth[t->tm_mon], t->tm_mday,t->tm_hour, t->tm_min, t->tm_sec, t->tm_year+1900); break; case 'd' : strfmt(r,"%2",t->tm_mday); break; case 'H' : strfmt(r,"%2",t->tm_hour); break; case 'I' : strfmt(r,"%2",(t->tm_hour%12)?t->tm_hour%12:12); break; case 'j' : strfmt(r,"%3",t->tm_yday+1); break; case 'm' : strfmt(r,"%2",t->tm_mon+1); break; case 'M' : strfmt(r,"%2",t->tm_min); break; case 'p' : r = (t->tm_hour>11)?"PM":"AM"; break; case 'S' : strfmt(r,"%2",t->tm_sec); break; case 'U' : w = t->tm_yday/7; if (t->tm_yday%7 > t->tm_wday) w++; strfmt(r, "%2", w); break; case 'W' : w = t->tm_yday/7; if (t->tm_yday%7 > (t->tm_wday+6)%7) w++; strfmt(r, "%2", w); break; case 'w' : strfmt(r,"%1",t->tm_wday); break; case 'x' : strfmt(r, "%3s %3s %2 %4", aday[t->tm_wday], amonth[t->tm_mon], t->tm_mday, t->tm_year+1900); break; case 'X' : strfmt(r, "%2:%2:%2", t->tm_hour, t->tm_min, t->tm_sec); break; case 'y' : strfmt(r,"%2",t->tm_year%100); break; case 'Y' : strfmt(r,"%4",t->tm_year+1900); break; case 'Z' : r = (t->tm_isdst && tzname[1][0])?tzname[1]:tzname[0]; break; default: buf[0] = '%'; /* reconstruct the format */ buf[1] = f[-1]; buf[2] = '\0'; if (buf[1] == 0) f--; /* back up if at end of string */ } while (*r) { if (p == q) { *q = '\0'; return 0; } *p++ = *r++; } } else { if (p == q) { *q = '\0'; return 0; } *p++ = f[-1]; } } *p = '\0'; return p - s; } /* * stdarg.h * typedef void *va_list; #define va_start(vp,v) (vp=((char*)&v)+sizeof(v)) #define va_arg(vp,t) (*((t*)(vp))++) #define va_end(vp) * */ static int pow[5] = { 1, 10, 100, 1000, 10000 }; /** * static void strfmt(char *str, char *fmt); * * simple sprintf for strftime * * each format descriptor is of the form %n * where n goes from zero to four * * 0 -- string %s * 1..4 -- int %?.?d * **/ static void strfmt(char *str, const char *fmt, ...) { int ival, ilen; char *sval; va_list vp; va_start(vp, fmt); while (*fmt) { if (*fmt++ == '%') { ilen = *fmt++ - '0'; if (ilen == 0) /* zero means string arg */ { sval = va_arg(vp, char*); while (*sval) *str++ = *sval++; } else /* always leading zeros */ { ival = va_arg(vp, int); while (ilen) { ival %= pow[ilen--]; *str++ = (char)('0' + ival / pow[ilen]); } } } else *str++ = fmt[-1]; } *str = '\0'; va_end(vp); } #ifdef TEST #include <stdio.h> /* for printf */ #include <time.h> /* for strftime */ char test[80]; int main(int argc, char *argv[]) { int len; char *fmt; time_t now; time(&now); fmt = (argc == 1) ? "%I:%M %p\n%c\n" : argv[1]; len = strftime(test,sizeof test, fmt, localtime(&now)); printf("%d: %s\n", len, test); return !len; } #endif /* TEST */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/addhndls.c�������������������������������������������0000755�0000764�0000144�00000006154�07055333634�016235� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** ADDHNDLS.C ** ** A compilation of public domain sources originally written by ** Doug Burger and Bob Jarvis ** ** Collected and modified for Zortech, Microsoft, and Borland by Bob Stout ** ** Demonstrates relocating the file handle table under DOS 3.x ** for having more than the usual 20 files open in a single ** program */ #include <stdio.h> #include <dos.h> #include <io.h> #include <fcntl.h> #define TABLE_SIZE 255 /* NOTE: *Must* be <= FILES in CONFIG.SYS */ #ifdef TEST #if !defined(__ZTC__) && !defined(__TURBOC__) /* i.e. #if MSC/QC */ #include <stdlib.h> #define MK_FP(seg,offset) \ ((void far *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) /* MSC's open() is funny - this code only works with _dos_open() */ int open(const char *name, int mode, ...) { int hdl; if (0 == _dos_open(name, mode, &hdl)) return hdl; else return -1; } #endif /* MSC */ #endif /* TEST */ unsigned char handle_table[TABLE_SIZE]; /* table of file DOS handles */ unsigned char far * far * handle_ptr; /* ptr to DOS's ptr to hand. */ unsigned int far *handle_count; /* ptr to handle count */ int relocate(void) { switch (_osmajor) { case 2: return -1; case 3: if (3 > _osminor) { /* by Doug Burger */ unsigned int i; handle_count = MK_FP(_psp, 0x32); /* handle count at PSP:32h */ handle_ptr = MK_FP(_psp, 0x34); /* table ptr at PSP:34h */ for (i = 0; i < *handle_count; i++) /* relocate exiting table */ handle_table[i] = (*handle_ptr)[i]; for (i = *handle_count; i < TABLE_SIZE; i++) /* init. rest */ handle_table[i] = 255; *handle_ptr = handle_table; /* set pointer to new table */ *handle_count = TABLE_SIZE; /* set new table size */ return 0; } else default: /* DOS 4+ */ { /* by Bob Jarvis */ union REGS regs; regs.h.ah = 0x67; regs.x.bx = TABLE_SIZE | 1; /* has to be an odd number */ intdos(®s, ®s); if(regs.x.cflag) /* error */ return -1; else return 0; } } } /* relocate() */ /* ** Test code */ #ifdef TEST void main(void) { int c, h; relocate(); c = 0; while ((h = open("CON", O_RDONLY)) >= 0) /* DOS closes files */ { c++; /* on exit, so I */ printf("handle = %d\n", h); /* don't bother */ } /* saving handles */ printf("total opened files = %d\n", c); } /* ADDHNDLS.C */ #endif /* TEST */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/hires.asm��������������������������������������������0000755�0000764�0000144�00000002343�07055334011�016106� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������1. 80 x 50 on VGA ================= mov ax,1202h ; select 400 scan line mode mov bl,30h int 10h mov ax,3 ; select 80 x 25 16 colour mode int 10h mov ax,1112h ; load 8x8 character set into RAM mov bl,0 int 10h 2. 80 x 43 on EGA ================= mov ax,3 ; establish 350 scan line mode int 10h ; and 80 x 25 16 colour mode mov ax,1112h ; 8x8 character set mov bl,0 int 10h mov ax,40h ; update cursor size/ pointers mov es,ax mov dx,es:[63h] mov ax,060ah out dx,ax mov ax,000bh out dx,ax mov ax,12h ; set up new prtscr routine mov bl,20h int 10h Warnings: ========= DOS's ANSI.SYS prior to DOS 5 has no comprehension of screens having more than 25 lines! Reference: "Programmer's Guide to PC and PS/2 Video Systems": author Richard Wilton. Microsoft Press 1988. ISBN 1-55615-103-9 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/whicharc.c�������������������������������������������0000755�0000764�0000144�00000020677�07055334342�016247� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <stdio.h> #include <string.h> /* -------------------------------------------------------------------- Module: WHICHARC.C Subject: tries to determine the archiver used to compress files Author: Heinz Ozwirk & David Gersic modified for SNIPPETS by Bob Stout Status: public domain Started: 28.09.1991 13:35:57 Modified: 13.10.1991 14:15:57 Modified: 5 January, 1992 11:50am by David Gersic Added return codes for self extracting archive files. Modified: 16 January, 1992, 4:15pm by David Gersic Added Pak and ARC ver. 6 with information from Richard Vanhouten @1:272/38. I'm not sure that this code works perfectly for those formats, as his message seems to indicate that the entire archive has to be scanned for headers to check before the type can be perfectly determined. It seems to work for test archives produced here, but may not work for all archives. -------------------------------------------------------------------- Prototype: int WhichArc(char *pName) pName address of full path name of file to examine Result -1: file not found UNKNOWN: unknown packer ARC: ARC or PKARC ARJ: ARJ LHA: LHARC or LHA ZIP: PKZIP ZOO: Zoo PAK: Pak ARC7: ARC later than ver. 6.02 SFXARC: Self Extracting PKARC SFXARJ: Self Extracting ARJ SFXLHARC:Self Extracting LHARC SFXLHA: Self Extracting LHA SFXZIP: Self Extracting ZIP SFXPAK: Self Extracting Pak SFXARC6: Self Extracting ARC later than ver. 6.02 EXE: MS DOS executable of unknown type LHARC/LHA No archive header. WhichArc examines the checksum of the first file header. If the checksum is valid and if the string -lh?- is found, LHA or LHARC is assumed. ARJ If a file starts with 0x60, 0xEA, ARJ is assumed. ZIP If the file begins with "PK", PKZIP is assumed. ZOO Zoo'ed archives always start with "ZOO x.xx Archive". WhichArc only looks for "ZOO". ARC No header. Files starting with 0x1A are assumed to be ARCed. PAK Similar to ARC files, but if the second byte of the header is 0x0a or 0x0b, it was created by Pak. ARC7 Similar to ARC, but if the second byte of the header is 0x14 or higher, it was created by an Arc version later than 6.02. SFX* All of the SFX files start with a small decompressor. Seek past the decompressor and repeat the above checks. -------------------------------------------------------------------- */ typedef unsigned char BYTE; enum ArcType { ArcERR=-1, UNKNOWN, ARC, ZOO, ARJ, LHARC, LHA, ZIP, PAK, ARC7, SFXARC, SFXARJ, SFXLHARC, SFXLHA, SFXZIP, SFXARC7, SFXPAK, EXE }; enum ArcType WhichArc(char *pName) { FILE *fp; BYTE header[128]; int c, i, n; enum ArcType retval = ArcERR; memset(header, 0, sizeof(header)); fp = fopen(pName, "rb"); if (fp == NULL) goto EXIT; /* error opening file */ n = fread(header, sizeof(BYTE), sizeof(header) - sizeof(BYTE), fp); if (n <= 0) /* error reading from file */ goto EXIT; if (n >= 7 && n >= header[0] + 2) { for (c = 0, i = header[0]; i--; c += (header+2)[i]) ; if (((BYTE)(c & 0x00FF)) == header[1] && header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-') { retval = (header[5] > '1') ? LHA : LHARC; goto EXIT; } } if (n >= 2) { if (header[0] == 0x60 && header[1] == 0xEA) { retval = ARJ; goto EXIT; } if (header[0] == 'P' && header[1] == 'K') { retval = ZIP; goto EXIT; } } if (n >= 3 && header[0] == 'Z' && header[1] == 'O' && header[2] == 'O') { retval = ZOO; goto EXIT; } if (n >= 25 && header[0] == 0x1A) { if (header[1]>0x14) retval = ARC7; else if (header[1]==0x0a || header[1]==0x0b) retval = PAK; else retval = ARC; goto EXIT; } if (0 == strncmp(header, "MZ", 2)) /* some sort of .EXE file */ { /* test for SFX ARJ file */ memset(header, 0, sizeof(header)); fseek(fp, 0x39ba, SEEK_SET); n = fread(header, sizeof(BYTE), sizeof(header) - sizeof(BYTE), fp); if (n > 1 && header[0] == 0x60 && header[1] == 0xea) { retval = SFXARJ; goto EXIT; } /* test for SFX LHARC file */ memset(header, 0, sizeof(header)); fseek(fp, 0x653, SEEK_SET); n = fread(header, sizeof(BYTE), sizeof(header) - sizeof(BYTE), fp); for (c = 0, i = header[0]; i--; c += (header+2)[i]) ; if (n >= 7 && n >= header[0] + 2) { if (((BYTE)(c & 0x00FF)) == header[1] && header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-') { retval = SFXLHARC; goto EXIT; } } /* test for SFX LHA file */ memset(header, 0, sizeof(header)); fseek(fp, 0x799, SEEK_SET); n = fread(header, sizeof(BYTE), sizeof(header) - sizeof(BYTE), fp); for (c = 0, i = header[0]; i--; c += (header+2)[i]) ; if (n >= 7 && n >= header[0] + 2) { if (((BYTE)(c & 0x00FF)) == header[1] && header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-') { retval = SFXLHA; goto EXIT; } } /* test for SFX ZIP file */ memset(header, 0, sizeof(header)); fseek(fp, 0x31f0, SEEK_SET); n = fread(header, sizeof(BYTE), sizeof(header) - sizeof(BYTE), fp); if (n > 1 && header[0] == 'P' && header[1] == 'K') { retval = SFXZIP; goto EXIT; } /* test for SFX PKARC file */ memset(header, 0, sizeof(header)); fseek(fp,0x261e,SEEK_SET); n = fread(header, sizeof(BYTE), sizeof(header) - sizeof(BYTE), fp); if (n > 1 && header[0] == 0x1a) { if (header[1]>0x14) retval = SFXARC7; else if (header[1]==0x0a || header[1]==0x0b) retval = SFXPAK; else retval = SFXARC; } else retval = EXE; } retval = UNKNOWN; EXIT: fclose(fp); return retval; } #ifdef TEST int main(int argc,char *argv[]) { char *arc_types[]={"UNKNOWN", "ARC", "ZOO", "ARJ", "LHARC", "LHA", "ZIP", "PAK", "PAK", "ARC7", "SFXARC", "SFXARJ", "SFXLHARC", "SFXLHA", "SFXZIP", "SFXARC7", "SFXPAK", "EXE"}; while (--argc) { enum ArcType which; if (ArcERR == (which = WhichArc(*++argv))) printf("File error accessing %s\n", *argv); else printf("%s archive type is %s\n", *argv, arc_types[which]); } return(0); } #endif �����������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ll_msort.c�������������������������������������������0000755�0000764�0000144�00000003623�07055334037�016303� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Here's an example of how to sort a singly-linked list. I think it ** can be modified to sort a doubly-linked list, but it would get a bit ** more complicated. Note that this is a recursive method, but the ** recursion depth is limited to be proportional to the base 2 log of ** the length of the list, so it won't "run away" and blow the stack. ** ** 10/21/93 rdg Fixed bug -- function was okay, but called incorrectly. */ /* linked list sort -- public domain by Ray Gardner 5/90 */ #include <stdio.h> /* for NULL definition */ #include <string.h> typedef struct list_struct { struct list_struct *next; char *key; /* other stuff */ } list; /* returns < 0 if *p sorts lower than *q */ int keycmp (list *p, list *q) { return strcmp(p->key, q->key); } /* merge 2 lists under dummy head item */ list *lmerge (list *p, list *q) { list *r, head; for ( r = &head; p && q; ) { if ( keycmp(p, q) < 0 ) { r = r->next = p; p = p->next; } else { r = r->next = q; q = q->next; } } r->next = (p ? p : q); return head.next; } /* split list into 2 parts, sort each recursively, merge */ list *lsort (list *p) { list *q, *r; if ( p ) { q = p; for ( r = q->next; r && (r = r->next) != NULL; r = r->next ) q = q->next; r = q->next; q->next = NULL; if ( r ) p = lmerge(lsort(r), lsort(p)); } return p; } main (void) { list *listp; /* pointer to start of list */ /* first build unsorted list, then */ listp = lsort(listp); /* rdg 10/93 */ return 0; } �������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/noctrlc.c��������������������������������������������0000755�0000764�0000144�00000003221�07055334123�016102� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/****************************************************************/ /* Name: noctrl() */ /* Desc: captures interrput 9 so as to ignore ctrl-c,ctrl-break,*/ /* ctrl-alt-del */ /****************************************************************/ #include <dos.h> #if defined(__ZTC__) #define INTERRUPT #define FAR _far #define ENABLE int_on #define INPORTB inp #define OUTPORTB outp #else #include <conio.h> #if defined(__TURBOC__) #define INTERRUPT interrupt #define FAR far #define ENABLE enable #define INPORTB inportb #define OUTPORTB outportb #else #define INTERRUPT _interrupt #define FAR _far #define ENABLE _enable #define INPORTB inp #define OUTPORTB outp #endif #endif extern void (INTERRUPT FAR *oldint9)(void); /* Caller must set this */ void INTERRUPT FAR noctrl(void) { unsigned char byte; static int flag; ENABLE(); if ((byte = (unsigned char)INPORTB(0x60)) == 29) flag = 1; if (byte == 157) flag = 0; if (!flag) (*oldint9)(); else switch (byte) { case 46 : /* yeah, these should be #defined! */ case 70 : case 56 : case 83 : byte = (unsigned char)INPORTB(0x61); OUTPORTB(0x61,byte | 0x80); OUTPORTB(0x61,byte); OUTPORTB(0x20,0x20); break; default : (*oldint9)(); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/translat.c�������������������������������������������0000755�0000764�0000144�00000003240�07055334307�016273� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Public Domain by Jerry Coffin. ** ** Interpets a string in a manner similar to that the compiler ** does string literals in a program. All escape sequences are ** longer than their translated equivalant, so the string is ** translated in place and either remains the same length or ** becomes shorter. */ #include <string.h> #include <stdio.h> char *translate(char *string) { char *here=string; size_t len=strlen(string); int num; int numlen; while (NULL!=(here=strchr(here,'\\'))) { numlen=1; switch (here[1]) { case '\\': break; case 'r': *here = '\r'; break; case 'n': *here = '\n'; break; case 't': *here = '\t'; break; case 'v': *here = '\v'; break; case 'a': *here = '\a'; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': numlen = sscanf(here,"%o",&num); *here = (char)num; break; case 'x': numlen = sscanf(here,"%x",&num); *here = (char) num; break; } num = here - string + numlen; here++; memmove(here,here+numlen,len-num ); } return string; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/memavail.c�������������������������������������������0000755�0000764�0000144�00000000777�07055334102�016243� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** MEMAVAIL.C - Report available DOS memory ** ** public domain by Thor Johnson */ #include <dos.h> long memavail(void) { union REGS regs; /* Request impossibly large number of 16-byte paragraphs from DOS */ regs.h.ah = 0x48; regs.x.bx = 0xFFFF; int86(0x21,®s,®s); return((long)regs.x.bx * 16L); } #ifdef TEST #include <stdio.h> main() { printf("Available DOS memory = %ld bytes\n", memavail()); } #endif /* TEST */ �c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/remtab.c���������������������������������������������0000755�0000764�0000144�00000003346�07055334176�015730� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* remtab.c 12-4-91 Robert Mashlan, Public Domain modified 28 mar 93 by Bob Stout Filter for removing tabs. All tabs in the input will be replaced with spaces. This filter takes one optional command line parameter, which specifies the number spaces to replace for a tab. If no size is specifies, it defaults to 8. example usage: remtab 6 < tabbed.c > untabbed.c */ #include <stdio.h> #include <stdlib.h> #define BUFSIZE 4096 int main(int argc, char **argv ) { int tabsize = 8; if (argc > 1) /* look for command line parameter */ { if (0 == (tabsize = atoi(argv[1]))) tabsize = 8; } while (1) { char buf[BUFSIZE]; int nr, i, j, pos = 0; nr = fread(buf, 1, sizeof(buf), stdin); for (i = 0; i < nr; i++) { switch (buf[i]) { case '\t': /* replace tabs with spaces */ for(j = pos % tabsize; j < tabsize; ++j) { putchar(' '); ++pos; } break; case '\n': /* start a new line */ pos = -1; /* this will become 0 when... */ /* ...we fall through to... */ default: putchar(buf[i]);/* send character through unchanged */ ++pos; } } if (nr < sizeof(buf)) break; } return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/read.me����������������������������������������������0000755�0000764�0000144�00000000107�07055334175�015537� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Before you start, read SNIPPETS.TXT for instructions and information. ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/isfopen.c��������������������������������������������0000755�0000764�0000144�00000001457�07055334023�016111� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Find out if a FILE * is valid ** ** public domain demo by Bob Stout */ #include <stdio.h> #ifdef __TURBOC__ #define STREAM_BUF _streams #define FCNT FOPEN_MAX #define FLAG flags #else /* MSC, ZTC++ */ #define STREAM_BUF _iob #define FCNT _NFILE #define FLAG _flag #endif typedef enum {FALSE, TRUE} LOGICAL; int isfopen(FILE *fp) { int i; for (i = 0; i < FCNT; ++i) { if (0 != STREAM_BUF[i].FLAG && fp == &STREAM_BUF[i]) return TRUE; } return FALSE; } #ifdef TEST void main(void) { printf("stdout is%s valid\n", isfopen(stdout) ? "":" not"); printf("buffer #10 is%s valid\n", isfopen(&STREAM_BUF[9]) ? "":" not"); } #endif /*TEST */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/amalloc.c��������������������������������������������0000755�0000764�0000144�00000007011�07055333635�016056� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* AMALLOC - multi-dimensional malloc() Allocates a multidimensional array dynamically, at runtime, so that 1: its elements can be accessed using multiple indirection 2: it can be deallocated using a call to the standard free() function Note: On PC's the max array size is 64K Paul Schlyter, 1992-02-09. Released to the public domain. */ #include <stdlib.h> #include <stdarg.h> #include <string.h> #define MAXDIMS 5 /* Defines the maximum number of dimensions */ #define MAXSIZE ((size_t) -1L) /* Maximum size of array */ void *amalloc( int esiz, void *initval, int dims, ... ) /* * Input: esiz size of each array elements, as given by sizeof * initval pointer to initial value. NULL ==> zero fill * dims number of dimensions: 1..MAXDIMS (5) * ... number of elements in each dimension (int's) * * Returns: NULL error: out of memory, or illegal parameters * otherwise base pointer to array */ { unsigned int dim[MAXDIMS], accdim[MAXDIMS]; va_list ap; int i, j; long int totsiz; void **q; char *p, *r, *s; if (dims < 1 || dims > MAXDIMS) return NULL; memset(dim, 0, sizeof(dim)); /* Read dimension numbers */ memset(accdim, 0, sizeof(accdim)); va_start(ap, dims); dim[0] = accdim[0] = va_arg(ap,int); for (i = 1; i < dims; i++) { dim[i] = va_arg(ap,int); accdim[i] = accdim[i-1] * dim[i]; } va_end(ap); /* Compute total array size */ totsiz = esiz * accdim[dims-1]; /* Data size */ for (i = 0; i < dims - 1; i++ ) /* Add space for pointers */ totsiz += sizeof(void *) * accdim[i]; if (totsiz > MAXSIZE) /* Exit if totsiz too large */ return NULL; p = malloc((size_t) totsiz); /* Allocate memory */ if (p == NULL) /* Out-of-memory */ return NULL; memset(p, 0, (unsigned int) totsiz); /* Zero out allocated memory */ q = (void **) p; if (dims == 1) r = (char *) q + esiz * accdim[0]; for (i = 1; i < dims; i++) /* Fill in pointers */ { int siz; int accd = accdim[i-1], d = dim[i]; siz = i == dims-1 ? esiz : sizeof(void *); r = (char *) q + sizeof(void *) * accd; for (j = 0; j < accd; j++) { *q++ = r; r += siz * d; } } if (initval != NULL) { for (s = (char *) q; s < r; s += esiz) memcpy(s, initval, esiz); } return p; } /* amalloc */ #ifdef TEST /* Test program */ #include <stdio.h> main() { static char init_d[8] = { 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF }; int init_i = 0x1111; double *a = amalloc( sizeof(double), init_d, 1, 4 ); double **b = amalloc( sizeof(double), init_d, 2, 4, 5 ); double ***c = amalloc( sizeof(double), init_d, 3, 4, 5, 6 ); int ***d = amalloc( sizeof(int), &init_i, 3, 4, 5, 6 ); int i, j, k; for (i = 0; i < 4; i++) for (j = 0; j < 5; j++ ) for (k = 0; k < 6; k++ ) d[i][j][k] = (i * 256) + (j * 16) + k; a = a, b = b, c = c; return 0; } #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/redir.c����������������������������������������������0000755�0000764�0000144�00000003303�07055334176�015554� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Program: REDIR.C Author: F. PIETTE (2:293/2201.135) Object: Demonstration of the output redirection Creation: Augustus 2, 1991 Updates: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include <stdio.h> #include <stdlib.h> #include <io.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> void main(void) { int old_fh; int new_fh; fprintf(stdout, "This goes to the original standard output\n"); /* Duplicate the stdout file handle to restore it later */ old_fh = dup(fileno(stdout)); if (old_fh == -1) { fprintf(stderr, "dup error\n"); exit(1); } /* Open the new file for output */ if ((new_fh = open("redir.txt", O_CREAT | O_TRUNC | O_WRONLY, S_IREAD | S_IWRITE)) == -1) { fprintf(stderr, "Unable to open redir.txt\n"); exit(1); } /* Duplicate the new handle to stdout */ dup2(new_fh, fileno(stdout)); /* We don't need new_fh any more, so close it */ close(new_fh); /* stdout is now redirected, let's try it */ fprintf(stdout, "This goes to redir.txt file !\n"); /* If you run a program using spawn(), the child program will have */ /* its output redirected to REDIR.TXT file ! */ /* Now let's restore stdout to its original state */ fflush(stdout); /* First flush the outut buffer */ /* Then duplicate the original file handle to stdout */ dup2(old_fh, fileno(stdout)); /* Let's try if we canceled the redirection */ fprintf(stdout, "Back to original stdout\n"); exit(0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/nonmsdos.txt�����������������������������������������0000755�0000764�0000144�00000005377�07055334125�016713� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������The following SNIPPETS files are either non-MS/PC-DOS specific or may be easily ported to other environments: Cast.H Hilobyte.H Pi.H Round.H C_Lines.Awk A2E.C Amalloc.C Ansiflen.C Ansiself.C Approx.C Bascnvrt.C Bastrngs.C Bitarray.C Bitcnt_1.C Bitcnt_2.C Bitfiles.C Bitops.C Bitstrng.C Bstr_I.C Bresnham.C Calsupp.C Cant.C Checksum.C Combin.C Commafmt.C Crc-16.C Crc-16F.C Crc_32.C Crypt.C Ctrlprnt.C Cubic.C Dbl2Long.C Dblround.C Editgets.C Eng.C Eval.C Factoryl.C Fcompare.C Fcopy.C Ferrorf.C Fmtmoney.C Fpswitch.C Fscanbin.C Fsm.C Getstrng.C Hexorint.C Howdy.C Hstr_I.C Initvars.C Isisbn.C Ispow2.C Isqrt.C Jdn.C Lbitops.C Ldfloor.C Ll_Msort.C Ll_Qsort.C Ltoa.C Ltostr.C Lv1Ws.C Mainmain.C Mdalloc.C Memrev.C Mkdirs.C Moon_Age.C Ord_Text.C Perm_Idx.C Pluraltx.C Rand1.C Rand2.C Redir.C Rg_Isort.C Rg_Qsort.C1 Rg_Qsort.C2 Rg_Rand.C Rg_Ssort.C Rmallws.C Rmlead.C Rmtrail.C Rndmize.C Scanfrac.C Soundex.C Srchfile.C Sstrcpy.C Stats.C Stptok.C Str27Seg.C Strftime.C Strrepl.C Strrev.C Strsort.C Strucfil.C Style.C Tabtrick.C Toascii.C Translat.C Trim.C Wb_Fcopy.C Weird.C Windchil.C Wordwrap.C Xstrcat.C Xstrcmp.C C_Prec.Txt Storage.Typ Rtlftrul.Txt Ptr_Help.Txt C_Port.Txt Enums.Txt Resource.Lst Match.H Match.C Match.Doc Dirmask.C Patmat.C Fln_Fix.C Getcmt.C Testcmt.C Scaldate.H Scaldate.C Daynum.C Cal.C W_Wrap.H W_Wrap.C Center.C Xfile.H Xfile.C Xtest.C Getopt3.C Getopts.H Getopts.C Pbmsrch.C Bmhsrch.C Bmhisrch.C Bmhasrch.C Strdup.C Strupr.C Iostutor.Txt Myio.H Myio.Cpp Mystream.H Mystream.Cpp Myline.H Myline.Cpp Myiodemo.Cpp Myio.Mak Str.Doc Str.H Str.C Mem.Txt Toolkit.H Mem.H Mem.C 2Dlife.C Bigfac.C Bincomp.C C_Cmnt.C Chbytes.C Cmdline.C Commconv.C Factor.C Fraction.C Head.C Hexdump.C Ifactor.C Inchcvrt.C Killff.C Log.C Lzhuf.C Maze_1.C Maze_2.C Maze_3.C Mv.C Palndrom.C Permute1.C Permute2.C Pi.C Pr.C Rdxcnvrt.C Remtab.C Roman.C Split.C Stub.C Sunriset.C Tail.C Uuencode.C Uudecode.C Wc.C Where.C Jgrep.C Grep.C �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bitcnt_1.c�������������������������������������������0000755�0000764�0000144�00000001327�07055333651�016153� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Bit counter by Ratko Tomic */ int bit_count(long x) { int n = 0; /* ** The loop will execute once for each bit of x set, this is in average ** twice as fast as the shift/test method. */ if (x) do n++; while (0 != (x = x&(x-1))) ; return(n); } #ifdef TEST #include <stdio.h> #include <stdlib.h> #define plural_text(n) &"s"[(1 == (n))] void main(int argc, char *argv[]) { long n; while(--argc) { int i; n = atol(*++argv); i = bit_count(n); printf("%ld contains %d bit%s set\n", n, i, plural_text(i)); } } #endif /* TEST */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bitcnt_2.c�������������������������������������������0000755�0000764�0000144�00000001330�07055333651�016146� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������int bitcount(long i) { i = ((i & 0xAAAAAAAA) >> 1) + (i & 0x55555555); i = ((i & 0xCCCCCCCC) >> 2) + (i & 0x33333333); i = ((i & 0xF0F0F0F0) >> 4) + (i & 0x0F0F0F0F); i = ((i & 0xFF00FF00) >> 8) + (i & 0x00FF00FF); i = ((i & 0xFFFF0000) >> 16) + (i & 0x0000FFFF); return (int)i; } #ifdef TEST #include <stdio.h> #include <stdlib.h> #define plural_text(n) &"s"[(1 == (n))] void main(int argc, char *argv[]) { long n; while(--argc) { int i; n = atol(*++argv); i = bitcount(n); printf("%ld contains %d bit%s set\n", n, i, plural_text(i)); } } #endif /* TEST */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bitops.c���������������������������������������������0000755�0000764�0000144�00000000515�07055333652�015747� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Bit set, clear, and test operations ** ** public domain snippet by Bob Stout */ typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL; #define BOOL(x) (!(!(x))) #define BitSet(arg,posn) ((arg) | (1L << (posn))) #define BitClr(arg,posn) ((arg) & ~(1L << (posn))) #define BitTst(arg,posn) BOOL((arg) & (1L << (posn))) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/crypt.c����������������������������������������������0000755�0000764�0000144�00000007273�07055333715�015620� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/****************************************************************/ /* */ /* S-CODER - Encrypt/decrypt data */ /* */ /* Copyright 1987-1989 by Robert B. Stout dba MicroFirm */ /* */ /* Originally written by Bob Stout with modifications */ /* suggested by Mike Smedley. */ /* */ /* This code may be used freely in any program for any */ /* application, personal or commercial. */ /* */ /* Current commercial availability: */ /* */ /* 1. MicroFirm Toolkit ver 3.00: LYNX and CRYPT utilities */ /* 2. CXL libraries (MSC, TC, ZTC/C++, PC): fcrypt() */ /* dedicated file encryption function */ /* 3. SMTC & MFLZT libraries: crypt() function */ /* */ /****************************************************************/ char *cryptext; /* The actual encryption/decryption key */ int crypt_ptr = 0; /* Circular pointer to elements of key */ int crypt_length; /* Set externally to strlen(cryptext) */ /* NOTES: cryptext should be set and qualified (to something over 5-6 chars, minimum) by the calling program, which should also set crypt_ptr in the range of 0 to strlen(cryptext) before each use. If crypt() is used to encrypt several buffers, cryptext should be reloaded and crypt_ptr reset before each buffer is encrypted. The encryption is both reversible - to decrypt data, pass it back through crypt() using the original key and original initial value of crypt_ptr - and multiple passes are commutative. */ /**** Encrypt/decrypt buffer datum ******************************/ void crypt(unsigned char *buf) { *buf ^= cryptext[crypt_ptr] ^ (cryptext[0] * crypt_ptr); cryptext[crypt_ptr] += ((crypt_ptr < (crypt_length - 1)) ? cryptext[crypt_ptr + 1] : cryptext[0]); if (!cryptext[crypt_ptr]) cryptext[crypt_ptr] += 1; if (++crypt_ptr >= crypt_length) crypt_ptr = 0; } /**** Encrypt/decrypt buffer ************************************/ void bufcrypt(unsigned char *buf, long length) { while (length--) crypt(*buf++) } #ifdef TEST #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { static char buf[16384]; size_t len, i; FILE *in, *out; if (4 > argc) { puts("Usage: CRYPT password infile outfile"); return -1; } cryptext = argv[1]; crypt_length = strlen(cryptext); if (NULL == (in = fopen(argv[2], "rb"))) { printf("Can't open %s for input\n", argv[2]); return -1; } if (NULL == (out = fopen(argv[3], "wb"))) { printf("Can't open %s for output\n", argv[3]); return -1; } do { if (0 != (len = fread(buf, 1, 16384, in))) { for (i = 0; i < len; ++i) crypt(&buf[i]); fwrite(buf, 1, len, out); } } while (len); fclose(in); fclose(out); return 0; } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/isramdsk.c�������������������������������������������0000755�0000764�0000144�00000002563�07055334025�016264� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** isRamDsk() - Determine if a drive is a RAM disk ** ** Call with drive letter ('a' - 'z', 'A' - 'Z') ** ** Returns TRUE, FALSE, or ERROR ** ** Uses ABSDISKC.C, ABSDISK.ASM, and DOS5BOOT.H from SNIPPETS ** (Note: The relevent parts of the structure in DOS5BOOT.H are ** also applicable to lower version numbers of DOS) ** ** Public domain by Bob Stout */ #include <stdlib.h> #include <ctype.h> #include <dos.h> #include "dos5boot.h" int AbsDiskRead(unsigned short, size_t, size_t, void *); typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL; LOGICAL isRamDsk(unsigned char drive) { union REGS regs; B_REC buffer; regs.x.ax = 0x4408; /* Not if removable */ regs.h.bl = (unsigned)toupper(drive) - (unsigned char)'@'; intdos(®s, ®s); if (0 == regs.x.ax) return FALSE; if (AbsDiskRead(toupper(drive) - 'A', 1, 0, &buffer)) return ERROR; return (1 == buffer.bsFATs); } #ifdef TEST #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (2 > argc) { puts("Syntax: ISRAMDSK drive_letter"); return EXIT_FAILURE; } printf("Drive %c: is%s a RAM drive\n", toupper(*argv[1]), isRamDsk(*argv[1]) ? "" : " not"); return EXIT_SUCCESS; } #endif /* TEST */ ���������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/factor.c���������������������������������������������0000755�0000764�0000144�00000003350�07055333754�015730� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** factor.c -- print prime factorization of a number ** Ray Gardner -- 1985 -- public domain ** Modified Feb. 1989 by Thad Smith > public domain ** ** This version takes numbers up to the limits of double precision. */ #include <stdio.h> #include <stdlib.h> #include <math.h> int prevfact = 0; void factor (double); void show (double, int); void main (int argc, char *argv[]) { while ( --argc ) factor(atof(*++argv)); } void factor (double n) { double d; int k; prevfact = 0; d = n+1; /* test for roundoff error */ if (n+3 != d+2) { printf("%0.0f is too large to process.\n", n); return; } if (fmod(n,1.) != 0.0) { printf("%f is not an integer.\n",n); return; } printf("%0.0f ",n); if ( n < 2. ) { printf("is less than 2.\n"); return; } else if ( n > 2. ) { d = 2; for ( k = 0; fmod(n,d) == 0.0; k++ ) n /= d; if ( k ) show(d,k); for ( d = 3; d * d <= n; d += 2 ) { for ( k = 0; fmod(n,d) == 0.0; k++ ) n /= d; if ( k ) show(d,k); } } if ( n > 1 ) { if ( ! prevfact ) printf(" is prime"); else show(n,1); } printf("\n"); } void show (double d, int k) { if ( prevfact ) printf(" * "); else printf(" = "); prevfact++; printf("%0.0f",d); if ( k > 1 ) printf("^%d",k); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cubic.c����������������������������������������������0000755�0000764�0000144�00000002752�07055333716�015542� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** CUBIC.C - Solve a cubic polynomial ** public domain by Ross Cottrell */ #include <math.h> #include <stdlib.h> void SolveCubic(double a, double b, double c, double d, int *solutions, double *x) { long double a1 = b/a, a2 = c/a, a3 = d/a; long double Q = (a1*a1 - 3.0*a2)/9.0; long double R = (2.0*a1*a1*a1 - 9.0*a1*a2 + 27.0*a3)/54.0; double R2_Q3 = R*R - Q*Q*Q; double theta; if (R2_Q3 <= 0) { *solutions = 3; theta = acos(R/sqrt(Q*Q*Q)); x[0] = -2.0*sqrt(Q)*cos(theta/3.0) - a1/3.0; x[1] = -2.0*sqrt(Q)*cos((theta+2.0*M_PI)/3.0) - a1/3.0; x[2] = -2.0*sqrt(Q)*cos((theta+4.0*M_PI)/3.0) - a1/3.0; } else { *solutions = 1; x[0] = pow(sqrt(R2_Q3)+fabs(R), 1/3.0); x[0] += Q/x[0]; x[0] *= (R < 0.0) ? 1 : -1; x[0] -= a1/3.0; } } #ifdef TEST int main(void) { double a1 = 1.0, b1 = -10.5, c1 = 32.0, d1 = -30.0; double a2 = 1.0, b2 = -4.5, c2 = 17.0, d2 = -30.0; double x[3]; int solutions; SolveCubic(a1, b1, c1, d1, &solutions, x); /* should get 3 solutions: 2, 6 & 2.5 */ SolveCubic(a2, b2, c2, d2, &solutions, x); /* should get 1 solution: 2.5 */ return 0; } #endif /* TEST */ ����������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/x00api.c���������������������������������������������0000755�0000764�0000144�00000025754�07055334346�015565� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * X00API.C: X00 FOSSIL driver * * Created by R.F. Pels. * modified by Bob Stout * Placed in the public domain by R.F. Pels. */ #include "x00api.h" #include <dos.h> static union REGS x00regs; static struct SREGS x00sregs; int x00error = 0; #if __cplusplus extern "C" { #endif #ifdef __TURBOC__ #define PEEK(s,o) peek(s,o) #else /* MSC or ZTC */ #define PEEK(s,o) *((unsigned _far *)(MK_FP((s),(o)))) #endif #ifndef MK_FP #define MK_FP(seg,offset) \ ((void _far *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #endif unsigned int x00_detect(void) { unsigned int segofx00; unsigned int ofsofx00; /* Peek in interrupt vector table for start of FOSSIL */ ofsofx00 = PEEK(0, X00_VECTOR * 4); segofx00 = PEEK(0, (X00_VECTOR * 4) + 2); /* Peek in start of FOSSIL + X00_IDOFFSET */ return (PEEK(segofx00, ofsofx00 + X00_IDOFFSET)); } FOSSILSTATUS x00_set(unsigned char set, PORT port) { FOSSILSTATUS retval; x00regs.x.ax = SET_BAUDRATE | set; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); retval.statusword = x00regs.x.ax; return retval; } FOSSILSTATUS x00_tx_char(unsigned char c, PORT port) { FOSSILSTATUS retval; x00regs.x.ax = TX_CHAR | c; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); retval.statusword = x00regs.x.ax; return retval; } unsigned char x00_rx_char(PORT port) { x00regs.x.ax = RX_CHAR; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); return (unsigned char)(x00regs.x.ax & 0xff); } FOSSILSTATUS x00_status(PORT port) { FOSSILSTATUS retval; x00regs.x.ax = STATUS; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); retval.statusword = x00regs.x.ax; return retval; } FOSSILINIT x00_init(PORT port, unsigned char far *ctlc_flagbyte) { FOSSILINIT retval; x00regs.x.ax = INITIALIZE; if (ctlc_flagbyte != (unsigned char far *)0) { x00regs.x.dx = 0x00ff; x00regs.x.bx = 0x4F50; segread(&x00sregs); x00sregs.es = FP_SEG(ctlc_flagbyte); x00regs.x.cx = FP_OFF(ctlc_flagbyte); } else { x00regs.x.bx = 0x0000; /* in any case _NOT_ 0x4f50 */ x00regs.x.dx = port; } int86x(X00_VECTOR, &x00regs, &x00regs, &x00sregs); retval.result = x00regs.x.ax; retval.max_function = (unsigned char)(x00regs.x.bx & 0xff); retval.revision = (unsigned char)(x00regs.x.bx >> 8); return retval; } void x00_deinit(PORT port) { x00regs.x.ax = DEINITIALIZE; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); } unsigned int x00_raise_dtr(PORT port) { unsigned int retval; x00regs.x.ax = RAISE_DTR; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); if ((x00regs.x.ax & 0x0001) == 1) { retval = X00_DTR_HIGH; } else retval = X00_DTR_LOW; return retval; } unsigned int x00_lower_dtr(PORT port) { unsigned int retval; x00regs.x.ax = LOWER_DTR; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); if ((x00regs.x.ax & 0x0001) == 1) { retval = X00_DTR_HIGH; } else retval = X00_DTR_LOW; return retval; } FOSSILSYSINFO x00_sysinfo(void) { FOSSILSYSINFO retval; x00regs.x.ax = GET_SYS_INFO; int86(X00_VECTOR, &x00regs, &x00regs); retval.tick_number = (unsigned char)(x00regs.x.ax & 0xff); retval.ticks_per_second = (unsigned char)(x00regs.x.ax >> 8); retval.approx_ms_per_tick = x00regs.x.dx; return retval; } void x00_flush_output(PORT port) { x00regs.x.ax = FLUSH_OUTPUT; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); } void x00_purge_output(PORT port) { x00regs.x.ax = PURGE_OUTPUT; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); } void x00_purge_input(PORT port) { x00regs.x.ax = PURGE_INPUT; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); } unsigned int x00_tx_char_nowait(unsigned char c, PORT port) { unsigned int retval; x00regs.x.ax = TX_CHAR_NOWAIT | c; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); if ((x00regs.x.ax & 0x0001) == 1) { retval = X00_OK; } else retval = X00_CHAR_NOT_SENT; return retval; } unsigned int x00_peek_ahead_input(PORT port) { x00regs.x.ax = PEEK_AHEAD_INPUT; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); return x00regs.x.ax; } unsigned int x00_peek_ahead_kbd(void) { x00regs.x.ax = PEEK_AHEAD_KBD; int86(X00_VECTOR, &x00regs, &x00regs); return x00regs.x.ax; } unsigned int x00_read_kbd(void) { x00regs.x.ax = READ_KBD; int86(X00_VECTOR, &x00regs, &x00regs); return x00regs.x.ax; } void x00_flow_control(FOSSILFLOWCTRL f, PORT port) { x00regs.x.ax = FLOW_CONTROL | 0xf0 | f.flowword; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); } unsigned int x00_ctlc_ctlk_check(FOSSILCTLCCTLK c, PORT port) { x00regs.x.ax = CTLC_CTLK_CHECK | c.checkword; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); return x00regs.x.ax; } void x00_set_cup(unsigned char row, unsigned char col) { x00regs.x.ax = SET_CUP; x00regs.x.dx = (row << 8) | col; int86(X00_VECTOR, &x00regs, &x00regs); } void x00_get_cup(unsigned char *row, unsigned char *col) { x00regs.x.ax = GET_CUP; int86(X00_VECTOR, &x00regs, &x00regs); *col = (unsigned char)(x00regs.x.dx & 0xff); *row = (unsigned char)(x00regs.x.dx >> 8); } void x00_write_ANSI_char(unsigned char c) { x00regs.x.ax = WRITE_ANSI_CHAR | c; int86(X00_VECTOR, &x00regs, &x00regs); } void x00_enable_watchdog(PORT port) { x00regs.x.ax = ENABLE_WATCHDOG; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); } void x00_disable_watchdog(PORT port) { x00regs.x.ax = DISABLE_WATCHDOG; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); } void x00_write_BIOS_char(unsigned char c) { x00regs.x.ax = WRITE_BIOS_CHAR | c; int86(X00_VECTOR, &x00regs, &x00regs); } unsigned int x00_insert_tick_func(void (far *tickfunc)()) { unsigned int retval; x00regs.x.ax = INSERT_TICK_FUNC; x00regs.x.dx = FP_OFF(tickfunc); segread(&x00sregs); x00sregs.es = FP_SEG(tickfunc); int86x(X00_VECTOR, &x00regs, &x00regs, &x00sregs); if (x00regs.x.ax == 0x0000) { retval = X00_OK; } else retval = X00_INS_TICK; return retval; } unsigned int x00_delete_tick_func(void (far *tickfunc)()) { unsigned int retval; x00regs.x.ax = DELETE_TICK_FUNC; x00regs.x.dx = FP_OFF(tickfunc); segread(&x00sregs); x00sregs.es = FP_SEG(tickfunc); int86x(X00_VECTOR, &x00regs, &x00regs, &x00sregs); if (x00regs.x.ax == 0x0000) { retval = X00_OK; } else retval = X00_DEL_TICK; return retval; } void x00_boot_machine(unsigned int boottype) { x00regs.x.ax = BOOT_MACHINE | (boottype & 0x0001); int86(X00_VECTOR, &x00regs, &x00regs); } unsigned int x00_read_block(unsigned int count, void far *buf, PORT port) { x00regs.x.ax = READ_BLOCK; x00regs.x.cx = count; x00regs.x.dx = port; segread(&x00sregs); x00sregs.es = FP_SEG(buf); x00regs.x.di = FP_OFF(buf); int86x(X00_VECTOR, &x00regs, &x00regs, &x00sregs); return x00regs.x.ax; } unsigned int x00_write_block(unsigned int count, void far *buf, PORT port) { x00regs.x.ax = WRITE_BLOCK; x00regs.x.cx = count; x00regs.x.dx = port; segread(&x00sregs); x00sregs.es = FP_SEG(buf); x00regs.x.di = FP_OFF(buf); int86x(X00_VECTOR, &x00regs, &x00regs, &x00sregs); return x00regs.x.ax; } void x00_start_break_signal(PORT port) { x00regs.x.ax = START_BREAK_SIGNAL; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); } void x00_stop_break_signal(PORT port) { x00regs.x.ax = STOP_BREAK_SIGNAL; x00regs.x.dx = port; int86(X00_VECTOR, &x00regs, &x00regs); } unsigned int x00_get_driverinfo(void far *buf, PORT port) { x00regs.x.ax = GET_DRIVER_INFO; x00regs.x.cx = sizeof(FOSSILINFO); segread(&x00sregs); x00sregs.es = FP_SEG(buf); x00regs.x.di = FP_OFF(buf); x00regs.x.dx = port; int86x(X00_VECTOR, &x00regs, &x00regs, &x00sregs); return x00regs.x.ax; } unsigned int x00_install_appendage(unsigned char appcode, void (far *appfunc)()) { unsigned int retval; x00regs.x.ax = INSTALL_APPENDAGE | appcode; segread(&x00sregs); x00sregs.es = FP_SEG(appfunc); x00regs.x.dx = FP_OFF(appfunc); int86x(X00_VECTOR, &x00regs, &x00regs, &x00sregs); if (x00regs.x.ax == X00_PRESENT) { if ((x00regs.x.bx & 0xff00) == 1) { retval = X00_OK; } else retval = X00_INS_APP; } else retval = X00_NOT_HERE; return retval; } unsigned int x00_remove_appendage(unsigned char appcode, void (far *appfunc)()) { unsigned int retval; x00regs.x.ax = REMOVE_APPENDAGE | appcode; segread(&x00sregs); x00sregs.es = FP_SEG(appfunc); x00regs.x.dx = FP_OFF(appfunc); int86x(X00_VECTOR, &x00regs, &x00regs, &x00sregs); if (x00regs.x.ax == X00_PRESENT) { if ((x00regs.x.bx & 0xff00) == 1) { retval = X00_OK; } else retval = X00_REM_APP; } else retval = X00_NOT_HERE; return retval; } #if __cplusplus } #endif ��������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/x00api.h���������������������������������������������0000755�0000764�0000144�00000017000�07055334350�015546� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * X00API.H - X00 FOSSIL driver HLLAPI * * Created by R.F. Pels. * modified by Bob Stout * Placed in the public domain by R.F. Pels. */ #ifndef __X00API_H /* Prevent double inclusion */ #define __X00API_H /* FOSSIL specifics */ #define X00_VECTOR 0x14 #define X00_IDOFFSET 6 /* FOSSIL function request codes */ #define SET_BAUDRATE 0x0000 #define TX_CHAR 0x0100 #define RX_CHAR 0x0200 #define STATUS 0x0300 #define INITIALIZE 0x0400 #define DEINITIALIZE 0x0500 #define RAISE_DTR 0x0601 #define LOWER_DTR 0x0600 #define GET_SYS_INFO 0x0700 #define FLUSH_OUTPUT 0x0800 #define PURGE_OUTPUT 0x0900 #define PURGE_INPUT 0x0A00 #define TX_CHAR_NOWAIT 0x0B00 #define PEEK_AHEAD_INPUT 0x0C00 #define PEEK_AHEAD_KBD 0x0D00 #define READ_KBD 0x0E00 #define FLOW_CONTROL 0x0F00 #define CTLC_CTLK_CHECK 0x1000 #define SET_CUP 0x1100 #define GET_CUP 0x1200 #define WRITE_ANSI_CHAR 0x1300 #define ENABLE_WATCHDOG 0x1401 #define DISABLE_WATCHDOG 0x1400 #define WRITE_BIOS_CHAR 0x1500 #define INSERT_TICK_FUNC 0x1601 #define DELETE_TICK_FUNC 0x1600 #define BOOT_MACHINE 0x1700 #define READ_BLOCK 0x1800 #define WRITE_BLOCK 0x1900 #define START_BREAK_SIGNAL 0x1A01 #define STOP_BREAK_SIGNAL 0x1A00 #define GET_DRIVER_INFO 0x1B00 #define INSTALL_APPENDAGE 0x7e00 #define REMOVE_APPENDAGE 0x7f00 /* port numbers and variable type of portnumber in calls */ #define PORTCOM1 0 #define PORTCOM2 1 #define PORTCOM3 2 #define PORTCOM4 3 #define PORTCOM5 4 #define PORTCOM6 5 #define PORTCOM7 6 #define PORTCOM8 7 #define PORTSPECIAL 0x00ff typedef unsigned int PORT; /* defines components of baud settings call */ #define BAUD300 0x40 #define BAUD600 0x60 #define BAUD1200 0x80 #define BAUD2400 0xa0 #define BAUD4800 0xc0 #define BAUD9600 0xe0 #define BAUD19200 0x00 #define BAUD38400 0x20 #define PARITYNONE 0x00 #define PARITYODD 0x08 #define PARITYNONEALT 0x10 #define PARITYEVEN 0x18 #define STOP1BIT 0x00 #define STOP2BIT 0x04 #define WORD5BIT 0x00 #define WORD6BIT 0x01 #define WORD7BIT 0x02 #define WORD8BIT 0x03 #define FIDOSETTING PARITYNONE | STOP1BIT | WORD8BIT #define OPUSSETTING PARITYNONE | STOP1BIT | WORD8BIT #define SEADOGSETTING PARITYNONE | STOP1BIT | WORD8BIT /* Error numbers */ #define X00_OK 0 #define X00_NOT_HERE 100 #define X00_CHAR_NOT_SENT 101 #define X00_NO_INPUT 0xffff #define X00_NO_KEY 0xffff #define X00_INS_TICK 104 #define X00_DEL_TICK 105 #define X00_INS_APP 106 #define X00_REM_APP 107 #define X00_DTR_HIGH 108 #define X00_DTR_LOW 109 /* FOSSIL initcall result type */ #define X00_PRESENT 0x1954 typedef struct { unsigned int result; unsigned char max_function; unsigned char revision; } FOSSILINIT; /* FOSSIL status return type: all fields are 1 if condition exists */ typedef union { struct STATUSBITS { unsigned int : 3; unsigned int alwayshigh : 1; unsigned int : 3; unsigned int carrier_detect : 1; unsigned int chars_in_input : 1; unsigned int input_overrun : 1; unsigned int : 3; unsigned int output_not_full : 1; unsigned int output_empty : 1; unsigned int : 1; } statusbits; unsigned int statusword; } FOSSILSTATUS; /* FOSSIL info type */ typedef struct { unsigned int size; unsigned char version; unsigned char revision; unsigned int ofs_fossil_id; unsigned int seg_fossil_id; unsigned int input_size; unsigned int input_avail; unsigned int output_size; unsigned int output_avail; unsigned char screen_width; unsigned char screen_height; unsigned char baud_rate_mask; } FOSSILINFO; /* FOSSIL system info type */ typedef struct { unsigned char tick_number; unsigned char ticks_per_second; unsigned int approx_ms_per_tick; } FOSSILSYSINFO; /* FOSSIL flow control type */ typedef union { struct FLOWBITS { unsigned char xonxoff : 1; unsigned char ctsrts : 1; unsigned char remote_xonxoff : 1; unsigned char : 5; } flowbits; unsigned char flowword; } FOSSILFLOWCTRL; /* FOSSIL checks control type */ #define X00_CTLCK 0x0001 #define X00_NO_CTLCK 0x0000 typedef union { struct CHECKBITS { unsigned char ctlc_ctlk : 1; unsigned char stop_transmitter : 1; unsigned char : 6; } checkbits; unsigned char checkword; } FOSSILCTLCCTLK; #define COLDBOOT 0 #define WARMBOOT 1 #if __cplusplus extern "C" { #endif unsigned int x00_detect(void); FOSSILSTATUS x00_set(unsigned char set, PORT port); FOSSILSTATUS x00_tx_char(unsigned char c, PORT port); unsigned char x00_rx_char(PORT port); FOSSILSTATUS x00_status(PORT port); FOSSILINIT x00_init(PORT port, unsigned char far *ctlc_flagbyte); void x00_deinit(PORT port); unsigned int x00_raise_dtr(PORT port); unsigned int x00_lower_dtr(PORT port); FOSSILSYSINFO x00_sysinfo(void); void x00_flush_output(PORT port); void x00_purge_output(PORT port); void x00_purge_input(PORT port); unsigned int x00_tx_char_nowait(unsigned char c, PORT port); unsigned int x00_peek_ahead_input(PORT port); unsigned int x00_peek_ahead_kbd(void); unsigned int x00_read_kbd(void); void x00_flow_control(FOSSILFLOWCTRL f, PORT port); unsigned int x00_ctlc_ctlk_check(FOSSILCTLCCTLK c, PORT port); void x00_set_cup(unsigned char row, unsigned char col); void x00_get_cup(unsigned char *row, unsigned char *col); void x00_write_ANSI_char(unsigned char c); void x00_enable_watchdog(PORT port); void x00_disable_watchdog(PORT port); void x00_write_BIOS_char(unsigned char c); unsigned int x00_insert_tick_func(void (_far *tickfunc)()); unsigned int x00_delete_tick_func(void (_far *tickfunc)()); void x00_boot_machine(unsigned int boottype); unsigned int x00_read_block(unsigned int count, void far *buf, PORT port); unsigned int x00_write_block(unsigned int count, void far *buf, PORT port); void x00_start_break_signal(PORT port); void x00_stop_break_signal(PORT port); unsigned int x00_get_driverinfo(void far *buf, PORT port); unsigned int x00_install_appendage(unsigned char appcode, void (_far *appfunc)()); unsigned int x00_remove_appendage(unsigned char appcode, void (_far *appfunc)()); #if __cplusplus } #endif #endif /* __X00API_H */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/isnetdr.c��������������������������������������������0000755�0000764�0000144�00000002315�07055334024�016111� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*----------------------------------------------------------------------*/ /* determine_drive_type -- Public Domain code from Bob Dolan */ /* */ /* INPUT: the drive number ( 0=current, 1=A:, 2=B:, etc. ) */ /* OUTPUT: drive type ( 0=physical drive, 1=Network drive, 2=RamDisk ) */ /*----------------------------------------------------------------------*/ #include <dos.h> drive_type(int dr) { union REGS regs; regs.x.ax = 0x4409; /* IOCTL func 9 */ regs.h.bl = (unsigned char)dr; int86(0x21, ®s, ®s); if (!regs.x.cflag) { if (regs.x.dx & 0x1000) return 1; /* Network drive */ else if (regs.x.dx == 0x0800) return 2; /* RAMdisk */ } return 0; /* physical drive */ } #ifdef TEST #include <stdio.h> #include <stdlib.h> #include <ctype.h> int main(int argc, char *argv[]) { int dr = 0; if (1 < argc) dr = toupper(*argv[1]) - '@'; printf ("drive_type(%d) = %d\n", dr, drive_type(dr)); return 0; } #endif /* TEST */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/a2e.c������������������������������������������������0000755�0000764�0000144�00000005131�07055333632�015113� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** ASCII <=> EBCDIC conversion functions */ static unsigned char a2e[256] = { 0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 37, 11, 12, 13, 14, 15, 16, 17, 18, 19, 60, 61, 50, 38, 24, 25, 63, 39, 28, 29, 30, 31, 64, 79,127,123, 91,108, 80,125, 77, 93, 92, 78,107, 96, 75, 97, 240,241,242,243,244,245,246,247,248,249,122, 94, 76,126,110,111, 124,193,194,195,196,197,198,199,200,201,209,210,211,212,213,214, 215,216,217,226,227,228,229,230,231,232,233, 74,224, 90, 95,109, 121,129,130,131,132,133,134,135,136,137,145,146,147,148,149,150, 151,152,153,162,163,164,165,166,167,168,169,192,106,208,161, 7, 32, 33, 34, 35, 36, 21, 6, 23, 40, 41, 42, 43, 44, 9, 10, 27, 48, 49, 26, 51, 52, 53, 54, 8, 56, 57, 58, 59, 4, 20, 62,225, 65, 66, 67, 68, 69, 70, 71, 72, 73, 81, 82, 83, 84, 85, 86, 87, 88, 89, 98, 99,100,101,102,103,104,105,112,113,114,115,116,117, 118,119,120,128,138,139,140,141,142,143,144,154,155,156,157,158, 159,160,170,171,172,173,174,175,176,177,178,179,180,181,182,183, 184,185,186,187,188,189,190,191,202,203,204,205,206,207,218,219, 220,221,222,223,234,235,236,237,238,239,250,251,252,253,254,255 }; static unsigned char e2a[256] = { 0, 1, 2, 3,156, 9,134,127,151,141,142, 11, 12, 13, 14, 15, 16, 17, 18, 19,157,133, 8,135, 24, 25,146,143, 28, 29, 30, 31, 128,129,130,131,132, 10, 23, 27,136,137,138,139,140, 5, 6, 7, 144,145, 22,147,148,149,150, 4,152,153,154,155, 20, 21,158, 26, 32,160,161,162,163,164,165,166,167,168, 91, 46, 60, 40, 43, 33, 38,169,170,171,172,173,174,175,176,177, 93, 36, 42, 41, 59, 94, 45, 47,178,179,180,181,182,183,184,185,124, 44, 37, 95, 62, 63, 186,187,188,189,190,191,192,193,194, 96, 58, 35, 64, 39, 61, 34, 195, 97, 98, 99,100,101,102,103,104,105,196,197,198,199,200,201, 202,106,107,108,109,110,111,112,113,114,203,204,205,206,207,208, 209,126,115,116,117,118,119,120,121,122,210,211,212,213,214,215, 216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231, 123, 65, 66, 67, 68, 69, 70, 71, 72, 73,232,233,234,235,236,237, 125, 74, 75, 76, 77, 78, 79, 80, 81, 82,238,239,240,241,242,243, 92,159, 83, 84, 85, 86, 87, 88, 89, 90,244,245,246,247,248,249, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,250,251,252,253,254,255 }; char ASCIItoEBCDIC(const unsigned char c) { return a2e[c]; } char EBCDICtoASCII(const unsigned char c) { return e2a[c]; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cal.c������������������������������������������������0000755�0000764�0000144�00000007070�07055333667�015217� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** CAL - a calendar for DOS ** ** a public domain demo using Ray Gardner's SCALDATE.C scalar date functions ** by Bob Stout */ #include <stdio.h> #include <stdlib.h> /* ** function prototypes for SCALDATE.C */ int isleap (unsigned); long ymd_to_scalar (unsigned, unsigned, unsigned); /* ** calendar generation information */ int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; char *month[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; char *daynames[8] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; /* ** box drawing stuff */ #ifdef MSDOS const char *topborder = "\xd5\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xb8"; const char *midborder = "\xc6\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xb5"; const char *botborder = "\xd4\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xbe"; const char *line = "\xb3"; #else const char *line = ""; #endif /* ** tell 'em they messed up */ void usage(void) { puts("Usage: CAL m y"); puts("where: m = month (1 - 12)"); puts(" y = year (1 - 99, 1800 - 3000)"); exit(-1); } /* ** Define ISO to be 1 for ISO (Mon-Sun) calendars */ #ifndef ISO #define ISO 0 #endif #if (ISO != 0 && ISO != 1) #error ISO must be set to either 0 or 1 #endif /* ** here's where the real work's done */ int main(int argc, char *argv[]) { int day, day_1, numdays, i, j; unsigned yr, mo; if (3 > argc) usage(); yr = atoi(argv[2]); mo = atoi(argv[1]); if (!mo || 12 < mo) usage(); if (100 > yr) yr += 1900; if (3000 < yr || 1800 > yr) usage(); for (i = 0, mo -= 1; i < 3; ++i, ++mo) { if (!mo) { mo = 12; --yr; } if (12 < mo) { mo = 1; ++yr; } numdays = days[mo - 1]; if (2 == mo && isleap(yr)) ++numdays; day_1 = (int)((ymd_to_scalar(yr, mo, 1) - (long)ISO) % 7L); #ifdef MSDOS if (!i) puts(topborder); #endif fputs(line, stdout); for (j = 0; j < 7; ) { fputs(daynames[ISO + j], stdout); if (7 != ++j) fputc(' ', stdout); } printf("%s < %s, %d\n%s", line, month[mo - 1], yr, line); for (day = 0; day < day_1; ++day) fputs(" ", stdout); for (day = 1; day <= numdays; ++day, ++day_1, day_1 %= 7) { if (!day_1 && 1 != day) printf("\b%s\n%s", line, line); printf("%3d ", day); } for ( ; day_1; ++day_1, day_1 %= 7) fputs(" ", stdout); #ifdef MSDOS printf("\b%s\n", line); if (2 > i) puts(midborder); else puts(botborder); #else fputc('\n', stdout); #endif } return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ccomcall.c�������������������������������������������0000755�0000764�0000144�00000001240�07055333671�016221� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Call undocumented Int 2Eh to invoke COMMAND.COM ** ** demo by Bob Stout ** ** NOTES: Dangerous code - will abort batch files in progress and ** occasionally have other undesirable effects. ** ** Requires INT2E.ASM */ #include <string.h> #include <stdlib.h> extern void _Int_2E(char *); void C_Com_Call(char *string) { char *buf; buf = (char *)malloc(strlen(string) + 3); strcat(strcpy(&buf[1], string), "\r"); buf[0] = (char)strlen(&buf[1]); _Int_2E(buf); free(buf); } #ifdef TEST void main(int argc, char *argv[]) { C_Com_Call(argv[1]); } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/resource.lst�����������������������������������������0000755�0000764�0000144�00000040702�07055334203�016651� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������The following are a list of resources that I've put together from recommendations in the FidoNet C_Echo. These include books, magazines and compiler vendors. The format for book entries is as follows: Author _Title_, ISBN, Publisher, Year, List Price (Comments -- Recommmended-By) Prices are in $US unless otherwise specified. Where a book has been recommended by multiple persons, I've left off the names that don't have comments. Books are in alpha order by author's last name, or title if the author is unknown or unattributed. When there is more than one ISBN or price, the following suffixes will be used: .p -- paperback .h -- hardback .d -- with disk Magazine information includes the name of the magazine and the address and subscription rates. I cannot list information I do not have. It is possible that some information may be missing for a particular book. Comments are condensed from the messages I got the recommendation from and may or may not accurately describe the book. Lest they take over C_ECHO, any and all additions/corrections/suggestions should be sent to me netmail at 1:106/2000.25. [DISCLAIMER: I make no promises real or implied as to the usefulness of any of the books here listed. The reason for the 'recommended by' is to give you some idea of who thought the book was good so you can find books that are recommended by folks whose messages make particular sense to you. (Or folks who forgot to mention author/ISBN/publisher/price so you can harass them.) These people are not in any position to promise you anything, either.] In response to a request by the FidoNet C_Echo moderator, I'm soliciting longer blurbs about any and all resources listed here. Please answer the following questions, either individually, or cover the answers to most of them in a paragraph or so about the book. a) Title or other information sufficient for me to determine what the heck you're writing about b) When you last read/looked at the book (if it's been a long time, I'll need to take that into account when selecting whose comments to use) c) A brief description. d) A list of subjects where the book should be listed e) It's target audience (pick one or more of the following: beginner, intermediate, skilled, advanced, expert) f) Your opinion of the useability/readability/understandibilty of the book g) What types of folks you'd recommend it to h) What types of folks you'd recommend to pass it by ...and anything you think I forgot. Your cooperation will be appreciated and your name will be listed as a contributor. - J-Mag Guthrie 1:106/2000.25 1:106/1393 ----[ Beginning of book list - last updated 8 Oct 1993 ]---------------------- Abramowitz, Milton and Stegun, Irene _Handbook of Mathematical Functions_, 0-486-61272-4, Dover Publications, 1972, $21.95 (Bob Jarvis) Abrash, Michael _Power Graphics Programming_, 0-88022-500-9, QUE, 1989 (out of print) _Advanced C Programming_, Brady Publishing Group Aho, Sethi, and Ullman _Compilers: Principles, Techniques, and Tools_ Atkinson and Atkinson _Using Borland C++_, QUE (Steven Owen) Banahan, Mike _The C Book_ (Tom Donahue) Bentley, Jon, _More Programming Pearls - Confessions of a Coder_, 0-201-11889-0, Addison-Wesley, 1990, $18.25 Bentley, Jon _Programming Pearls_, 0-201-10331-1, Addison-Wesley, 1986, $18.25 Bentley, Jon _Writing Efficient Programs_ Booch, Grady _Object Oriented Design with Applications_, 0-8053-0091-0, Benjamin/Cummings Publishing, 1991 Brooks, Fred _The Mythical Man-Month: Essays on Software Engineering_, 0-201-00650-2, Addison-Wesley, 1975 Brown, Ralf and Kyle, Jim, _PC Interrupts_, 0-201-57797-6, Addison- Wesley, 1991, $32.95 Campbell, Joe _C Programmer's Guide to Serial Communications_, 0-672-22584-0, Howard W. Sams & Co, 1987, $26.95 (Does not talk about RTS/CTS handshaking [which is] vital for creating a modern terminal program. -- Jon Guthrie) Davis, Stephen R. _Hands-On Turbo C++_, 0-201-57052-1, Addison-Wesley (Daniel Lo) _DOD Programmer's Reference, 3rd Edition_ Que (Robert Johnstone) Duncan, Ray; Petzold, Charles; Shulman, Andrew; Baker, M. Steven; Nelson, Ross P.; Davis, Stephen R.; Moote, Robert _Extending DOS_, 0-201-56798-9, Addison-Wesley, 1992, $26.95 Ellis, Margaret and Stroustrup, Bjarne _The Annotated C++ Reference Manual_, 0-201-51459-1, Addison-Wesley, 1990, (Bob Jarvis) Gorlen, Keith E.; Orlow, Sanford M.; and Plexico, Perry S. _Data Abstraction and Object-Oriented Programming in C++_, 0-471-92346-X, John Wiley & Sons, 1990 (Bob Stout) Ferraro, Richard _The Programmer's Guide to the EGA and VGA Cards, 2nd Edition_ 0-201-57025-4, Addison Wesley, $34.95, CAN$44.95 Foerster, Scott _The Printer Bible_, 0-88022-512-2, QUE Books, 1990, $24.95, CAN$31.95, UK#22.95 Goodwin, Mark _Serial Communications in C and C++_, MIS Press, $29.95, $49.95d Hekmatpour, Sharam _C++ - A Guide for C Programmers_, 0-13-109471-8, Prentice Hall, 1990 Harbison, Samuel P. and Steele, Guy L. Jr. _C, a Reference Manual (third edition)_, 0-13-110933-2, Prentice Hall, 1991 Hogan, Thom _The Programmer's PC Sourcebook (Second Edition)_, 1-55615-321-X, Microsoft Press, 1991, $39.95 Holub, Allen _Compiler Design in C_, 0-13-155045-4, Prentice Hall, 1990 Horton, Mark R. _Portable C Software_, 0-13-868050-7, Prentice Hall, 1990 (Bob Stout) James, Geoffrey _The Tao of Programming_, 0-981137-07-01-795 Jourdain, Robert and The Peter Norton Computing Group _The Programmer's Problem Solver_ Kay, David C., and Levine, John R. _Graphics File Formats_ 0-8306-3059-7.p, 0-8306-3060-0.h, Tab/Windcrest/McGraw-Hill, 1992 (primarily a file format reference and does not give programming examples -- David Harmon) Kernighan, Brian W. and Ritchie, Dennis M. _The C Programming Language_ 0-13-11-163-3, 0-13-110362-8, Prentice Hall (two editions, informally K&R and K&R2) Knuth, Donald _Sorting and Searching_, Addison Wesley (Knuth is a Vulcan -- Terry Carmen) Kosko, Bert _Neural Networks and Fuzzy Systems: A Dynamical Systems Approach to Machine Intelligence_, 1992, $56.95 (2 Disks -- Eric Ford) Koenig, Andrew _C Traps and Pitfalls_, 0-201-17928-8 LaFore, Robert _Turbo C, Programming for the PC_ Waite Group (Ray Parker) Lapin, J.E. (pseudonym) _Portable C and Unix System Programming_, 0-13-686494-5, Prentice-Hall, 1987 (Bob Stout) Leblanc, Gerard _Matrise de Turbo C_, Eyrolles Editions (in French -- Francis Peree) Lewine, Donald _POSIX Programmer's Guide_, 0-937175-73-0, O'Reilly & Associates, Inc., 1991, $34.95 Lindley, Craig A. _Practical Image Processing in C_, 0-471-54377-2 (Joe Angert) Mayer, Bertrand _Object-oriented Software Construction_, 0-13-629049-3, Prentice Hall (Mike Taylor) McCord, James W. _C Programmer's Guide to Graphics_, 0-672-22784-3, SAMS, $29.95, $37.95 CAN (Branko Dragicevic) McGregor, John and Sykes, David _Object-Oriented Software Development: Engineering Software for Reuse_, 0-442-00157-6, Van Nostrand Reinhold, 1992 (Bob Jarvis) _Microsoft MS-DOS Programmer's Reference_, 1-55615-329-5, Microsoft Press, 1991, $24.95 (Bob Jarvis) Nance, Barry _Network Programming in C_, Que Books (Steve Cox) Nelson, Mark _The Data Compression Handbook_, 1-55851-214-4, 1-55851-216-0 M&T Books, $29.95, $36.95.d (Oliver Reubens) Norton, Peter and Wilton, Richard _The NEW Peter Norton Programmer's Guide to the IBM PC & PS/2_, 1-55615-131-4, Microsoft Press Oualline, Steve _Practical C Programming_, 0-937175-65-X, O'Reilly & Associates (David Gersic) Perry, Greg and Johnson, Marcus _Turbo C++ By Example_ 0-88022-812-1, Que Petzold, Charles _Programming Windows 3.1_, 1-55615-395-3, MicroSoft Press Plauger, P. J. _The Standard C Library_, 0-13-131509-9, Prentice Hall, 1992 Plauger, P. J. _Standard C: Programmer's Quick Reference_, 1-55615-158-6, Microsoft Press, 1989, $7.95 Press, William H.; Flannery, Brian P.; Teukolsky, Saul A.; and Vetterling, William T., _Numerical Recipes: The Art of Scientific Computing_, 0-521-30811-9, Cambridge University Press, 1986 Press, William et. al. _Numerical Recipes in C_ (the C version of the above -- J-Mag) Qualline, Steve _C Elements of Style_ 1-55851-291-8, M&% Books Radcliffe, Robert _Encyclopedia C_ 0-89588-655-3 (Microsoft C specific) Remer, Daniel and Dunaway, Robert _Legal Care for Your Software (4th Edition)_, 87337-037-6, RDS Publishing Company, $39.95 Rimmer, Steve _Bit-Mapped Graphics_, 0-8306-3558-0, Windcrest/McGraw- Hill Rimmer, Steve _Supercharged Bit-Mapped Graphics_, 0-8306-3788-5, Windcrest/McGraw-Hill Rose, Charles G. _Programmer's Guide to NetWare_, 0-07-607029-8, Mcgraw-Hill Salone, M. J. _How to Copyright Software_, NOLO Press. (George Milliken) Schildt, Herbert _Advanced C_, 0-07-881348-4, Osborne McGraw-Hill, $21.95 Schildt, Herbert _ANSI C Made Easy_, 0-07-881500-2, Osborne McGraw-Hill, $19.95 Schildt, Herbert _ANSI C Made Easy (Spanish)_, 84-76156030, Osborne McGraw-Hill Schildt, Herbert _Artificial Intelligence Using C_, 0-07-881255-0, Osborne McGraw-Hill, $24.94 Schildt, Herbert _The Art of C_, 0-07-881-691-2.d, Osborne-McGraw-Hill, 1991, $39.95.d Schildt, Herbert _Born to Code in C_, 0-07-881468-5, Osborne McGraw-Hill, $28.95 Schildt, Herbert _C: The Pocket Reference_, 0-07-881321-2, Osborne McGraw-Hill, $5.95 Schildt, Herbert _C: The Pocket Reference (Spanish)_, 84-76152175, Osborne McGraw-Hill Schildt, Herbert _C: Power User's Guide_, 0-07-881307-7, Osborne McGraw-Hill, $22.95 Schildt, Herbert _C: Power User's Guide (Spanish)_, 84-76153813, Osborne McGraw-Hill Schildt, Herbert _C: The Complete Reference_, 0-07-881538-X, Osborne McGraw-Hill, $28.95 Schildt, Herbert _C++: The Complete Reference_, 0-07-881654-8, Osborne McGraw-Hill, $29.95 Schildt, Herbert _Teach Yourself C_, 0-07-881596-7, Osborn McGraw-Hill, $19.95 Schildt, Herbert _Turbo C++: The Complete Reference_, 0-07-881535-5, Osborne McGraw-Hill, $29.95 Schildt, Herbert _Using Turbo C++_, 0-07-881610-6, Osborne McGraw-Hill, $24.95 Schulman, Andrew, et al. _Undocumented DOS_, 0-201-570649-5, Addison Wesley, 1990, $39.95 (one portion of..."et al."...Ralf Brown -- Brian Dunworth) Schwaderer, David _C Programmer's Guide to NETBIOS_ (Dimitri Van de Ville) Sedgewick, Robert _Algorithms in C_, 0-201-51425-7, Addison-Wesley, 1990 Selby, Samual M. _Standard Mathematical Tables_, The Chemical Rubber Company, 1970 Shlaer, Sally and Mellor, Stephen _Object Lifecycles : Modeling the World in States_, 0-13-629940-7, Yourdon Press, 1992 (Bob Jarvis) Shlaer, Sally and Mellor, Stephen _Object-Oriented Systems Analysis : Modeling the World in Data_, 0-13-629023-X, Yourdon Press, 1988 (Bob Jarvis) Stevens, Al _C Database Development, 2nd Ed._, 1-5528-135-5, MIS Press, $24.95, $49.95.d Stevens, Al _Extending Turbo C Professional_ Stevens, Al _Turbo C Memory Resident Utilities, Screen I/O and Programming Techniques_, 0-943518-35-0, MIS Press Stoltz, Axel _The Soundblaster Book_ 1-55755-164-2, Abacus, 34.95, CAN$44.95 Straker, David _C Style: Standards & Guidelines_ 0-13-116898-3, Prentice-Hall Stroustrup, Bjarne _The C++ Programming Language - 2nd Edition_ (more current than the ARM, but less official -- Bob Stout) _Supercharged Bitmapped Graphics_ TAB books (Jim Mooney) Swan, Tom _Learning C++_, 0-672-22785-1, SAMS, 1991 (Comes with working demo version of Zortech C++ -- Bram Smits) Swan, Tom _Mastering Borland C++_, 0-672-30274-8, SAMS, 1992, $39.95d (ANSI C, C++, extensive examples and answers for the exercises -- Scott Remick) Tisher, Michael _PC Intern_, 1-55755-145-6 ( Patrick Tousignant) Tondo, Clovis L., Nathanson, Andrew, Yount, Eden _Mastering Make_, 0-13-554619-2, Prentice Hall, 1992, $25.75 Traister, Robert J _Mastering C Pointers_, 0-12-697408-X, Academic Press, 1990 (Tom Donahue) Van Wyk, Christopher J. _Data Structures and C Programs_,0-201-16116-8, Addison-Wesley (David Gersic) Voss, Greg and Chui, Paul (unknown title), 0-07-881526-6, Borland/Osborne/McGraw Hill (a C++ tutorial -- Phil Sharp) _The Waite Group's Essential Guide to ANSI C_, 0-672-22673-1, Howard W. Sams, 1989, $7.95, (out of print but worth searching for - the best pocket-sized C handbook available -- Bob Stout) _The Waite Group's New C Primer Plus_, 0-672-22687-1 (Dale Furneaux) Waite and Prata, _C: Step by Step_, 0-672-22651-0 Wiener, Richard and Pinson, Lewis _An Introduction to Object-Oriented Programming and C++_, 0-201-15413-7, Addison-Wesley, 1988 $31.68 (Bob Jarvis) Wilton, Richard _Programmer's Guide to PC & PS/2 Video Systems_, 1-55615-103-9, Microsoft Press, 1987, $24.95 (Bob Jarvis) Young, Michael J. _System Programming in Microsoft C_, Sybex (Nhan Tran) ----[ End of book list ]------------------------------------------------------ ----[ Begin magazine list ]--------------------------------------------------- DDJ (Dr. Dobbs Journal) P.O. Box 56188 Boulder, CO 80322-6188 U.S.A. Canada & Mexico: $45/yr (surface) Other countries: $70/yr (air) Domestic (US): #29.97/yr The C Users Journal 1601 W. 23rd St., Suite 200 Lawrence, KS 66046-9950 US discount rate: $29.95/yr Canada/Mexico: $54/yr Other countries: $65/yr (air) C++ Report Subscriber Services, Dept CPR P.O. Box 3000 Denvill NJ 07834-9979 Domestic US: $69/yr Foreign & Canada: $94/yr (air) AI Expert P.O. Box 51241 Boulder, CO 80321-1241 US discount rate: $32/yr (basic rate: $42) Canada/Mexico: $32+$6/yr Other countries: $32 +15/yr (surface) or +40/yr (air) ----[ End magazine list ]----------------------------------------------------- ----[ Begin support phone list ]---------------------------------------------- Borland (Turbo C/C++, Borland C/C++) Customer Service: Customer Service (all products) 408-461-9000 (7am-4pm PT Monday-Friday) Order Desk (Credit Card orders only) 800-331-0877 (7am-4pm PT Monday-Friday) Technical Support: Technical support for the following products is available from 6am-5pm PT, Monday-Friday: C++ 408-461-9133 Paradox Engine for C/C++ 408-461-9133 Resource Workshop for C/C++ 408-461-9133 Turbo Vision for C/C++ 408-461-9133 900-Advisor Line When you need a fast response or a more advanced level of technical support, you can call the 900-Advisor Line. Technical support for the following products is available from 6am-5pm PT, Monday-Friday. You gain access within one minute. Each call is $2.00 per minute (the first minute is free). Borland C++ (Windows) 900-555-1002 Borland C++ (DOS) 900-555-1004 Other Services: The following services are available 7 days a week, 24 hours a day. Online Automated Support (modem) (8 data bits, no parity, 1 stop bit) 408-431-5250 TechFax (Automated FAX retrieval) 800-822-4269 Download Bulletin Board System (modem) (8 data bits, no parity, 1 stop bit) 408-439-9096 For more information about the services listed below, you may order the appropriate document from our TechFax system by dialing 800-822-4269. TechFax Service Document Online Automated Support 9606 TechFax 9652 Download Bulletin Board System 9604 Dunfield Develpment Systems (Micro C) Dunfield Development Systems P.O. Box 31044 Nepean, Ontario (Canada) K2B 8S8 VOICE: (613) 256-5820 [Between 0800-1900 EST please!] FAX: (613) 256-5821 [0800-1900 EST Mon-Fri] BBS: (613) 256-5820 [1900-0800 EST Mon-Fri, All day Sat-Sun] (300/1200/2400 Dial '2' when autoattendant answers). Mix Software Mix Software 1132 Commerce Dr. Richardson, Tx 75081 Order: 1-800-333-0330 Tech: 1-214-783-6001 Fax: 1-214-783-1404 ----[ End support phone list ]------------------------------------------------ ��������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/eng.c������������������������������������������������0000755�0000764�0000144�00000002124�07055333743�015217� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ENG.C - Format floating point in engineering notation */ /* Released to public domain by author, David Harmon, Jan. 1994 */ #include <stdio.h> char *eng(double value, int places) { const char * const prefixes[] = { "a", "f", "p", "n", "", "m", "", "k", "M", "G", "T" }; int p = 6; static char result[30]; char *res = result; if (value < 0.) { *res++ = '-'; value = -value; } while (value != 0 && value < 1. && p > 0) { value *= 1000.; p--; } while (value != 0 && value > 1000. && p < 10 ) { value /= 1000.; p++; } if (value > 100.) places--; if (value > 10.) places--; sprintf(res, "%.*f %s", places-1, value, prefixes[p]); return result; } #ifdef TEST #include <stdio.h> main() { double w; for (w = 1e-19; w < 1e16; w *= 42) printf(" %g W = %sW\n", w, eng(w, 3)); return 0; } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/fsm.c������������������������������������������������0000755�0000764�0000144�00000001467�07055333770�015244� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** code snippet demonstrating a finite state machine (FSM) */ typedef enum {s0,s1,s2,s3,s4,...,sn,sexit} state; state nextstate; int done = 0; nextstate = s0; /* set up to start with the first state */ while(!done) switch(nextstate) { case s0: nextstate = do_state_0(); break; case s1: nextstate = do_state_1(); break; case s2: nextstate = do_state_2(); break; case s3: . . . . case sn: nextstate = do_state_n(); break; case sexit: done = TRUE; break; default: /* some sort of unknown state */ break; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/jdn.c������������������������������������������������0000755�0000764�0000144�00000011727�07055334030�015220� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* jdn.c -- Julian Day Number computation ** ** public domain Julian Day Number functions ** ** Based on formulae originally posted by ** Tom Van Flandern / Washington, DC / metares@well.sf.ca.us ** in the UseNet newsgroup sci.astro. ** Reposted 14 May 1991 in FidoNet C Echo conference by ** Paul Schlyter (Stockholm) ** Minor corrections, added JDN to julian, and recast into C by ** Raymond Gardner Englewood, Colorado ** ** Synopsis: ** long ymd_to_jdn(int year, int month, int day, int julian_flag) ** void jdn_to_ymd(long jdn, int *year, int *month, int *day, ** int julian_flag) ** year is negative if BC ** if julian_flag is > 0, use Julian calendar ** if julian_flag is == 0, use Gregorian calendar ** if julian_flag is < 0, routines decide based on date ** ** These routines convert Gregorian and Julian calendar dates to and ** from Julian Day Numbers. Julian Day Numbers (JDN) are used by ** astronomers as a date/time measure independent of calendars and ** convenient for computing the elapsed time between dates. The JDN ** for any date/time is the number of days (including fractional ** days) elapsed since noon, 1 Jan 4713 BC. Julian Day Numbers were ** originated by Joseph Scaliger in 1582 and named after his father ** Julius, not after Julius Caesar. They are not related to the ** Julian calendar. ** ** For dates from 1 Jan 4713 BC thru 12 Dec Feb 32766 AD, ymd_to_jdn() ** will give the JDN for noon on that date. jdn_to_ymd() will compute ** the year, month, and day from the JDN. Years BC are given (and ** returned) as negative numbers. Note that there is no year 0 BC; ** the day before 1 Jan 1 AD is 31 Dec 1 BC. Note also that 1 BC, ** 5 BC, etc. are leap years. ** ** Pope Gregory XIII decreed that the Julian calendar would end on ** 4 Oct 1582 AD and that the next day would be 15 Oct 1582 in the ** Gregorian Calendar. The only other change is that centesimal ** years (years ending in 00) would no longer be leap years ** unless divisible by 400. Britain and its possessions and ** colonies continued to use the Julian calendar up until 2 Sep ** 1752, when the next day became 14 Sep 1752 in the Gregorian ** Calendar. These routines can be compiled to use either ** convention. By default, the British convention will be used. ** Simply #define PAPAL to use Pope Gregory's convention. ** ** Each routine takes, as its last argument, a flag to indicate ** whether to use the Julian or Gregorian calendar convention. If ** this flag is negative, the routines decide based on the date ** itself, using the changeover date described in the preceding ** paragraph. If the flag is zero, Gregorian conventions will be used, ** and if the flag is positive, Julian conventions will be used. */ #ifdef PAPAL /* Pope Gregory XIII's decree */ #define LASTJULDATE 15821004L /* last day to use Julian calendar */ #define LASTJULJDN 2299160L /* jdn of same */ #else /* British-American usage */ #define LASTJULDATE 17520902L /* last day to use Julian calendar */ #define LASTJULJDN 2361221L /* jdn of same */ #endif long ymd_to_jdn(int y, int m, int d, int julian) { long jdn; if (julian < 0) /* set Julian flag if auto set */ julian = (((y * 100L) + m) * 100 + d <= LASTJULDATE); if (y < 0) /* adjust BC year */ y++; if (julian) jdn = 367L * y - 7 * (y + 5001L + (m - 9) / 7) / 4 + 275 * m / 9 + d + 1729777L; else jdn = (long)(d - 32076) + 1461L * (y + 4800L + (m - 14) / 12) / 4 + 367 * (m - 2 - (m - 14) / 12 * 12) / 12 - 3 * ((y + 4900L + (m - 14) / 12) / 100) / 4 + 1; /* correction by rdg */ return jdn; } void jdn_to_ymd(long jdn, int *yy, int *mm, int *dd, int julian) { long x, z, m, d, y; long daysPer400Years = 146097L; long fudgedDaysPer4000Years = 1460970L + 31; if (julian < 0) /* set Julian flag if auto set */ julian = (jdn <= LASTJULJDN); x = jdn + 68569L; if ( julian ) { x += 38; daysPer400Years = 146100L; fudgedDaysPer4000Years = 1461000L + 1; } z = 4 * x / daysPer400Years; x = x - (daysPer400Years * z + 3) / 4; y = 4000 * (x + 1) / fudgedDaysPer4000Years; x = x - 1461 * y / 4 + 31; m = 80 * x / 2447; d = x - 2447 * m / 80; x = m / 11; m = m + 2 - 12 * x; y = 100 * (z - 49) + y + x; *yy = (int)y; *mm = (int)m; *dd = (int)d; if (*yy <= 0) /* adjust BC years */ (*yy)--; } �����������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/pushdir.c��������������������������������������������0000755�0000764�0000144�00000012101�07055334172�016115� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** PushDir() and PopDir() ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is an expanded version of the one ** originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include <dos.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #ifdef __TURBOC__ #include <dir.h> #else #include <direct.h> #endif #define DIR_STACK_SIZE 8 #define MAX_FLEN 67 typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL; #define BOOL(x) (!(!(x))) /* ** NOTE: Uses the author's chdrv(), also in SNIPPETS! */ int chdrv(int); static int PushDir_stack_ptr; static char PushDir_stack[DIR_STACK_SIZE][MAX_FLEN]; /* ** PushDir() ** ** Like chdir(), except a drive may be specified and the old directory ** is saved. ** ** Arguments: 1 - newdir, the buffer containing the new directory name ** ** Returns: -1 - stack overflow ** 0 - error ** 1 - success, still on same drive ** 2 - success, changed drive ** ** Side effects: Converts name in newdir to upper case and prepends ** a drive letter. ** ** CAUTION: Since a drive will be prepended to newdir, it's buffer ** should be at at least MAX_FLEN long. */ int PushDir(char *newdir) { char pname[MAX_FLEN]; char drive[3]; char *target = &pname[2]; int new_drv = 0, ercode = 0; static int init = 0; if (!init) PushDir_stack_ptr = init = -1; if (DIR_STACK_SIZE <= ++PushDir_stack_ptr) { ercode = -1; goto ErrEx; } getcwd(PushDir_stack[PushDir_stack_ptr], MAX_FLEN); strupr(PushDir_stack[PushDir_stack_ptr]); strncpy(drive, PushDir_stack[PushDir_stack_ptr], 2); drive[2] = '\0'; if (':' == newdir[1]) { /* If a drive is specified */ strupr(newdir); strcpy(pname, newdir); if (strchr(target, ':')) /* if filename is illegal */ goto ErrEx; if (*drive != *newdir) { if (ERROR == chdrv(newdir[0] - 'A')) { /* If the drive is invalid */ goto ErrEx; } else new_drv = 1; } } else { /* If a drive isn't specified */ if (!strchr(strupr(newdir), ':')) { /* If legal filename */ strcpy(pname, drive); strcat(pname, newdir); strcpy(newdir, pname); } else { /* If filename is illegal */ goto ErrEx; } } if (*target) { if (chdir(target)) { if (1 == new_drv) /* We already changed drives */ chdrv(*drive - 'A'); /* Go home before exit */ goto ErrEx; } } return (new_drv + 1); ErrEx: --PushDir_stack_ptr; return (ercode); } /* ** PopDir() ** ** Like chdir(), except goes to the drive/directory specified on the ** top of the PushDir stack. ** ** Arguments: none ** ** Returns: -1 - stack empty ** 0 - error - stack pointer unchanged ** 1 - success, still on same drive ** 2 - success, changed drive ** ** Side effects: none ** ** CAUTION: chdir() or chdrv() should not be called between PushDir- ** PopDir calls. */ int PopDir(void) { char I_am_here[MAX_FLEN], target_drv, *target; int new_drv = 0; if (0 > PushDir_stack_ptr) return -1; getcwd(I_am_here, MAX_FLEN); target = &PushDir_stack[PushDir_stack_ptr][2]; target_drv = PushDir_stack[PushDir_stack_ptr][0]; if (I_am_here[0] != target_drv) { if (ERROR == chdrv(target_drv - 'A')) return 0; new_drv = 1; } if (!chdir(target)) { --PushDir_stack_ptr; return (1 + new_drv); } else return 0; } /* ** isdir() ** ** Checks to see if a drive and/or path are a valid directory. ** ** Arguments: 1 - dir, the buffer containing the new directory name ** ** Returns: ERROR - push/popdir stack overflow ** FALSE - not a valid directory ** TRUE - valid directory ** ** Side effects: Converts name in dir to upper case and prepends a ** drive letter. ** ** CAUTION: Since a drive will be prepended to newdir, it's buffer ** should be at at least MAX_FLEN long. */ int isdir(char *dir) { int ercode; if (-1 == (ercode = PushDir(dir))) return ercode; if (ercode) PopDir(); return BOOL(ercode); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/hstr_i.c���������������������������������������������0000755�0000764�0000144�00000001635�07055334012�015732� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Originally published as part of the MicroFirm Function Library ** ** Copyright 1986, S.E. Margison ** Copyright 1989, Robert B.Stout ** ** Subset version released to the public domain, 1992 ** ** Make an ascii hexadecimal string into an integer. */ #include <stdio.h> #include <ctype.h> unsigned int hstr_i(char *cptr) { unsigned int i, j = 0; while (cptr && *cptr && isxdigit(*cptr)) { i = *cptr++ - '0'; if (9 < i) i -= 7; j <<= 4; j |= (i & 0x0f); } return(j); } #ifdef TEST #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { char *arg; unsigned int x; while (--argc) { x = hstr_i(arg = *++argv); printf("Hex %s = %d\n", arg, x, x); } return EXIT_SUCCESS; } #endif /* TEST */ ���������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/log.c������������������������������������������������0000755�0000764�0000144�00000017241�07055334042�015226� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/************************************************************************ * LOG.C - Creates a ASCII file with time and date stamps for logging * * hours. * * * * usage: LOG [IN][OUT][CALC] * * IN - Creates an opening entry from which a "time spent" * * is calculated. * * OUT - Creates a closing entry and calculates * * "time spent" for that entry. * * CALC - Calculates total overall "time spent" for the * * entire log. * * * * NOTES: I used seconds to do all the calculations. The other * * time/date entries are for human readability. Some * * enhancments can be done to this program. * * i.e. Wage/Pay calculation, closing the log after a CALC * * to insure log is not reused, tracking hours for individual * * people, tracking hours for individual projects, etc. * * * * Public domain by Robert Sprawls. * ************************************************************************/ #include <stdlib.h> #include <stdio.h> #include <stddef.h> #include <string.h> #include <time.h> /* Define time file constants */ #define HOUR 3600 /* Number of seconds in an hour. */ #define MINS 60 /* Number of seconds in a minute */ #define IN_ENTRY 40 /* Size of an IN entry */ #define SEC_OFF 4 /* Offset of seconds in an IN entry */ #define HOUR_OFF 64 /* Offset of seconds in an "time spent" */ /* calculated entry. */ /* Define values returned to DOS */ #define OK 0 /* Executed normally, nothing will be eched */ #define OPENLOG 1 /* Attempted to log in while open entry in log */ #define CLOSEDLOG 2 /* Attempted to log out while closed entry in log */ #define FILE_ERROR 3 /* File access error. Just in case. */ #define SEEK_ERROR 4 /* File positioning error */ #define NOPARMS 5 /* No parameters supplied to program */ #define INVALID 6 /* Invalid parameters */ void usage( void ); long get_in_entry( FILE * ); void fastforw( FILE * ); /* Oppisite of rewind(); */ void quit( int ); char strbuf[ IN_ENTRY + 1 ]; FILE *wrklog; int main( int argc, char *argv[] ) { char outline[ IN_ENTRY * 2 + 1 ]; long in_entry_time = 0, total_seconds = 0; double hours, pay; time_t current_time; div_t hdiv, mdiv; if( argc < 2 ) { usage(); quit( NOPARMS ); } /* Open log. Can be any directory. */ if(( wrklog = fopen( "WORK.LOG", "a+" )) == NULL ) quit( FILE_ERROR ); strupr( argv[ 1 ] ); time( ¤t_time ); /* Create an opening IN entry. */ if( strcmp( "IN", argv[ 1 ] ) == 0 ) { /* Make sure there isn't a open entry already. */ if( get_in_entry( wrklog ) ) quit( OPENLOG ); /* Stamp it. */ fprintf( wrklog, "%3s %ld %s", argv[ 1 ], current_time, ctime( ¤t_time )); } /* Create a closinf OUT entry. */ else if( strcmp( "OUT", argv[ 1 ] ) == 0 ) { /* Make sure there is a previous IN entry. */ if( ( in_entry_time = get_in_entry( wrklog )) == 0 ) quit( CLOSEDLOG ); total_seconds = current_time - in_entry_time; sprintf( outline, "%3s %ld %s", argv[ 1 ], current_time, ctime( ¤t_time )); /* Cut off the newline character that's normally put on. */ outline[ strlen( outline ) - 1 ] = '\0'; hdiv = div( total_seconds, HOUR ); mdiv = div( hdiv.rem, MINS ); sprintf( strbuf, " Time Spent: %02d:%02d:%02d/%ld\n\n", hdiv.quot, mdiv.quot, mdiv.rem, total_seconds ); strcat( outline, strbuf ); fprintf( wrklog, outline ); } /* Calculate the overall "time spent" */ else if( strcmp( "CALC", argv[ 1 ] ) == 0 ) { rewind( wrklog ); while( !feof( wrklog ) ) { /* This is to eliminate garbage or residual entries. */ outline[ 0 ] = '\0'; fgets( outline, 80, wrklog ); if( strstr( outline, "OUT" ) != NULL ) { total_seconds += atol( &outline[ HOUR_OFF ] ); } } /* goto to end of file and stamp total hours */ fastforw( wrklog ); if( total_seconds ) { hdiv = div( total_seconds, HOUR ); mdiv = div( hdiv.rem, MINS ); fprintf( wrklog, "\t\t\t\t\t\t\t\t\t\t " "Total Hours: %02d:%02d:%02d/%ld\n", hdiv.quot, mdiv.quot, mdiv.rem, total_seconds ); } } else { usage(); quit( INVALID ); } quit( OK ); } void usage( void ) { printf( "\nusage: LOG [IN][OUT][CALC]\n"); } /**************************************************************** * get_in_entry - gets a previous IN entry. * * * * Params: FILES *fp - file pointer. * * Returns: The entry's seconds if successful, else 0 * * * * NOTES: If fseek fails for any reason, function does not * * return. Instead, quit is call with the error code. * ****************************************************************/ long get_in_entry( FILE *fp ) { if( fseek( fp, -IN_ENTRY, SEEK_END ) != 0 ) quit( SEEK_ERROR ); fread( strbuf, 1, IN_ENTRY, fp ); fastforw( fp ); if( strstr( strbuf, "IN" ) == NULL ) return( 0 ); else { return( atol( &strbuf[ SEC_OFF ])); } } /**************************************************************** * quit() - Program exit function. Reports of any outstanding * * errors. * * * * Params: errcode - Error code as defined in beginning. * * Returns: nothing. * ****************************************************************/ void quit( int errcode ) { char *errmsg[] = { "", "Log has an open entry.", "No corresponding IN entry.", "File open error.", "Seek error", "No parameters specified.", "Invalid Parameters." }; printf( "\n%s\n", errmsg[ errcode ] ); fclose( wrklog ); exit( errcode ); } /**************************************************************** * fastforw() - Puts file pointer to end of file. * * * * Params: fp - File pointer. * * Returns: nothing. * ****************************************************************/ void fastforw( FILE *fp ) { fseek( fp, 0, SEEK_END ); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mem.c������������������������������������������������0000755�0000764�0000144�00000033026�07055334076�015231� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** This is a copyrighted work which is functionally identical to work ** originally published in Micro Cornucopia magazine (issue #52, March-April, ** 1990) and is freely licensed by the author, Walter Bright, for any use. */ /*_ mem.c Fri Jan 26 1990 Modified by: Walter Bright */ /* $Header: /home/cvs/c_cpp_reference/reference/C/CONTRIB/SNIP/mem.c,v 1.1.1.1 2000/02/24 23:01:18 tasin Exp $ */ /* Memory management package */ #if defined(VAX11C) #define __FILE__ "mem.c" #endif #include <stdio.h> #include <stdlib.h> #include <io.h> #ifndef MEM_H #include "mem.h" #endif #ifndef assert #include <assert.h> #endif #if defined(_MSC_VER) #include <dos.h> #endif #if !defined(VAX11C) #ifdef BSDUNIX #include <strings.h> #else #include <string.h> #endif #else extern char *strcpy(),*memcpy(); extern int strlen(); #endif /* VAX11C */ int mem_inited = 0; /* != 0 if initialized */ static int mem_behavior = MEM_ABORTMSG; static int (*fp)() = NULL; /* out-of-memory handler */ static int mem_count; /* # of allocs that haven't been free'd */ static int mem_scount; /* # of sallocs that haven't been free'd */ static int near mem_exception(); /* called when out of memory */ /* Determine where to send error messages */ #ifdef MSDOS #define ferr stdout /* stderr can't be redirected with MS-DOS */ #else #define ferr stderr #endif /*******************************/ void mem_setexception(flag,handler_fp) #if __cplusplus enum MEM_E flag; #else int flag; #endif int (*handler_fp)(); { mem_behavior = flag; fp = (mem_behavior == MEM_CALLFP) ? handler_fp : 0; #if MEM_DEBUG assert(0 <= flag && flag <= MEM_RETRY); #endif } /************************* * This is called when we're out of memory. * Returns: * 1: try again to allocate the memory * 0: give up and return NULL */ static int near mem_exception() { int behavior; behavior = mem_behavior; while (1) { switch (behavior) { case MEM_ABORTMSG: #if defined(MSDOS) || defined(__OS2__) /* Avoid linking in buffered I/O */ { static char msg[] = "Fatal error: out of memory\r\n"; write(1,msg,sizeof(msg) - 1); } #else fputs("Fatal error: out of memory\n",ferr); #endif /* FALL-THROUGH */ case MEM_ABORT: exit(EXIT_FAILURE); /* NOTREACHED */ case MEM_CALLFP: assert(fp); behavior = (*fp)(); break; case MEM_RETNULL: return 0; case MEM_RETRY: return 1; default: assert(0); } } } /****************************/ #if MEM_DEBUG #undef mem_strdup char *mem_strdup(s) const char *s; { return mem_strdup_debug(s,__FILE__,__LINE__); } char *mem_strdup_debug(s,file,line) char *file; const char *s; int line; { char *p; p = s ? (char *) mem_malloc_debug((unsigned) strlen(s) + 1,file,line) : NULL; return p ? strcpy(p,s) : p; } #else char *mem_strdup(s) const char *s; { char *p; p = s ? (char *) mem_malloc((unsigned) strlen(s) + 1) : NULL; return p ? strcpy(p,s) : p; } #endif /* MEM_DEBUG */ #ifdef MEM_DEBUG static long mem_maxalloc; /* max # of bytes allocated */ static long mem_numalloc; /* current # of bytes allocated */ #define BEFOREVAL 0x12345678 /* value to detect underrun */ #define AFTERVAL 0x87654321 /* value to detect overrun */ #if SUN || SUN386 static long afterval = AFTERVAL; /* so we can do &afterval */ #endif /* The following should be selected to give maximum probability that */ /* pointers loaded with these values will cause an obvious crash. On */ /* Unix machines, a large value will cause a segment fault. */ /* MALLOCVAL is the value to set malloc'd data to. */ #if MSDOS || __OS2__ #define BADVAL 0xFF #define MALLOCVAL 0xEE #else #define BADVAL 0x7A #define MALLOCVAL 0xEE #endif /* Disable mapping macros */ #undef mem_malloc #undef mem_calloc #undef mem_realloc #undef mem_free /* Create a list of all alloc'ed pointers, retaining info about where */ /* each alloc came from. This is a real memory and speed hog, but who */ /* cares when you've got obscure pointer bugs. */ static struct mem_debug { struct mh { struct mem_debug *Mnext; /* next in list */ struct mem_debug *Mprev; /* previous value in list */ char *Mfile; /* filename of where allocated */ int Mline; /* line number of where allocated */ unsigned Mnbytes; /* size of the allocation */ long Mbeforeval; /* detect underrun of data */ } m; char data[1]; /* the data actually allocated */ } mem_alloclist = { { (struct mem_debug *) NULL, (struct mem_debug *) NULL, "noname", 11111, 0, BEFOREVAL }, AFTERVAL }; /* Convert from a void *to a mem_debug struct. */ #define mem_ptrtodl(p) ((struct mem_debug *) ((char *)p - sizeof(struct mh))) /* Convert from a mem_debug struct to a mem_ptr. */ #define mem_dltoptr(dl) ((void *) &((dl)->data[0])) #define next m.Mnext #define prev m.Mprev #define file m.Mfile #define line m.Mline #define nbytes m.Mnbytes #define beforeval m.Mbeforeval /***************************** * Set new value of file,line */ void mem_setnewfileline(ptr,fil,lin) void *ptr; char *fil; int lin; { struct mem_debug *dl; dl = mem_ptrtodl(ptr); dl->file = fil; dl->line = lin; } /**************************** * Print out struct mem_debug. */ static void near mem_printdl(dl) struct mem_debug *dl; { #if LPTR fprintf(ferr,"alloc'd from file '%s' line %d nbytes %d ptr x%lx\n", dl->file,dl->line,dl->nbytes,mem_dltoptr(dl)); #else fprintf(ferr,"alloc'd from file '%s' line %d nbytes %d ptr x%x\n", dl->file,dl->line,dl->nbytes,mem_dltoptr(dl)); #endif } /**************************** * Print out file and line number. */ static void near mem_fillin(fil,lin) char *fil; int lin; { fprintf(ferr,"File '%s' line %d\n",fil,lin); fflush(ferr); } /**************************** * If MEM_DEBUG is not on for some modules, these routines will get * called. */ void *mem_calloc(u) unsigned u; { return mem_calloc_debug(u,__FILE__,__LINE__); } void *mem_malloc(u) unsigned u; { return mem_malloc_debug(u,__FILE__,__LINE__); } void *mem_realloc(p,u) void *p; unsigned u; { return mem_realloc_debug(p,u,__FILE__,__LINE__); } void mem_free(p) void *p; { mem_free_debug(p,__FILE__,__LINE__); } /**************************/ void mem_freefp(p) void *p; { mem_free(p); } /*********************** * Debug versions of mem_calloc(), mem_free() and mem_realloc(). */ void *mem_malloc_debug(n,fil,lin) unsigned n; char *fil; int lin; { void *p; p = mem_calloc_debug(n,fil,lin); if (p) memset(p,MALLOCVAL,n); return p; } void *mem_calloc_debug(n,fil,lin) unsigned n; char *fil; int lin; { struct mem_debug *dl; do dl = (struct mem_debug *) calloc(sizeof(*dl) + n + sizeof(AFTERVAL) - 1,1); while (dl == NULL && mem_exception()); if (dl == NULL) { #if 0 printf("Insufficient memory for alloc of %d at ",n); mem_fillin(fil,lin); printf("Max allocated was: %ld\n",mem_maxalloc); #endif return NULL; } dl->file = fil; dl->line = lin; dl->nbytes = n; dl->beforeval = BEFOREVAL; #if SUN || SUN386 /* bus error if we store a long at an odd address */ memcpy(&(dl->data[n]),&afterval,sizeof(AFTERVAL)); #else *(long *) &(dl->data[n]) = AFTERVAL; #endif /* Add dl to start of allocation list */ dl->next = mem_alloclist.next; dl->prev = &mem_alloclist; mem_alloclist.next = dl; if (dl->next != NULL) dl->next->prev = dl; mem_count++; mem_numalloc += n; if (mem_numalloc > mem_maxalloc) mem_maxalloc = mem_numalloc; return mem_dltoptr(dl); } void mem_free_debug(ptr,fil,lin) void *ptr; char *fil; int lin; { struct mem_debug *dl; if (ptr == NULL) return; #if 0 { fprintf(ferr,"Freeing NULL pointer at "); goto err; } #endif if (mem_count <= 0) { fprintf(ferr,"More frees than allocs at "); goto err; } dl = mem_ptrtodl(ptr); if (dl->beforeval != BEFOREVAL) { #if LPTR fprintf(ferr,"Pointer x%lx underrun\n",ptr); #else fprintf(ferr,"Pointer x%x underrun\n",ptr); #endif goto err2; } #if SUN || SUN386 /* Bus error if we read a long from an odd address */ if (memcmp(&dl->data[dl->nbytes],&afterval,sizeof(AFTERVAL)) != 0) #else if (*(long *) &dl->data[dl->nbytes] != AFTERVAL) #endif { #if LPTR fprintf(ferr,"Pointer x%lx overrun\n",ptr); #else fprintf(ferr,"Pointer x%x overrun\n",ptr); #endif goto err2; } mem_numalloc -= dl->nbytes; if (mem_numalloc < 0) { fprintf(ferr,"error: mem_numalloc = %ld, dl->nbytes = %d\n", mem_numalloc,dl->nbytes); goto err2; } /* Remove dl from linked list */ if (dl->prev) dl->prev->next = dl->next; if (dl->next) dl->next->prev = dl->prev; /* Stomp on the freed storage to help detect references */ /* after the storage was freed. */ memset((void *) dl,BADVAL,sizeof(*dl) + dl->nbytes); mem_count--; /* Some compilers can detect errors in the heap. */ #if defined(DLC) { int i; i = free(dl); assert(i == 0); } #else free((void *) dl); #endif return; err2: mem_printdl(dl); err: fprintf(ferr,"free'd from "); mem_fillin(fil,lin); assert(0); /* NOTREACHED */ } /******************* * Debug version of mem_realloc(). */ void *mem_realloc_debug(oldp,n,fil,lin) void *oldp; unsigned n; char *fil; int lin; { void *p; struct mem_debug *dl; if (n == 0) { mem_free_debug(oldp,fil,lin); p = NULL; } else if (oldp == NULL) p = mem_malloc_debug(n,fil,lin); else { p = mem_malloc_debug(n,fil,lin); if (p != NULL) { dl = mem_ptrtodl(oldp); if (dl->nbytes < n) n = dl->nbytes; memcpy(p,oldp,n); mem_free_debug(oldp,fil,lin); } } return p; } /***************************/ void mem_check() { register struct mem_debug *dl; for (dl = mem_alloclist.next; dl != NULL; dl = dl->next) mem_checkptr(mem_dltoptr(dl)); } /***************************/ void mem_checkptr(p) register void *p; { register struct mem_debug *dl; for (dl = mem_alloclist.next; dl != NULL; dl = dl->next) { if (p >= (void *) &(dl->data[0]) && p < (void *)((char *)dl + sizeof(struct mem_debug)-1 + dl->nbytes)) goto L1; } assert(0); L1: dl = mem_ptrtodl(p); if (dl->beforeval != BEFOREVAL) { #if LPTR fprintf(ferr,"Pointer x%lx underrun\n",p); #else fprintf(ferr,"Pointer x%x underrun\n",p); #endif goto err2; } #if SUN || SUN386 /* Bus error if we read a long from an odd address */ if (memcmp(&dl->data[dl->nbytes],&afterval,sizeof(AFTERVAL)) != 0) #else if (*(long *) &dl->data[dl->nbytes] != AFTERVAL) #endif { #if LPTR fprintf(ferr,"Pointer x%lx overrun\n",p); #else fprintf(ferr,"Pointer x%x overrun\n",p); #endif goto err2; } return; err2: mem_printdl(dl); assert(0); } #else /***************************/ void *mem_malloc(numbytes) unsigned numbytes; { void *p; if (numbytes == 0) return NULL; while (1) { p = malloc(numbytes); if (p == NULL) { if (mem_exception()) continue; } else mem_count++; break; } /*printf("malloc(%d) = x%lx\n",numbytes,p);*/ return p; } /***************************/ void *mem_calloc(numbytes) unsigned numbytes; { void *p; if (numbytes == 0) return NULL; while (1) { p = calloc(numbytes,1); if (p == NULL) { if (mem_exception()) continue; } else mem_count++; break; } /*printf("calloc(%d) = x%lx\n",numbytes,p);*/ return p; } /***************************/ void *mem_realloc(oldmem_ptr,newnumbytes) void *oldmem_ptr; unsigned newnumbytes; { void *p; if (oldmem_ptr == NULL) p = mem_malloc(newnumbytes); else if (newnumbytes == 0) { mem_free(oldmem_ptr); p = NULL; } else { do p = realloc(oldmem_ptr,newnumbytes); while (p == NULL && mem_exception()); } /*printf("realloc(x%lx,%d) = x%lx\n",oldmem_ptr,newnumbytes,p);*/ return p; } /***************************/ void mem_free(ptr) void *ptr; { /*printf("free(x%lx)\n",ptr);*/ if (ptr != NULL) { assert(mem_count > 0); mem_count--; #if DLC { int i; i = free(ptr); assert(i == 0); } #else free(ptr); #endif } } #endif /* MEM_DEBUG */ /***************************/ void mem_init() { if (mem_inited == 0) { mem_count = 0; #if MEM_DEBUG mem_numalloc = 0; mem_maxalloc = 0; mem_alloclist.next = NULL; #endif #if defined(__ZTC__) || defined(__SC__) /* Necessary if mem_sfree() calls free() before any */ /* calls to malloc(). */ free(malloc(1)); /* initialize storage allocator */ #endif mem_inited++; } } /***************************/ void mem_term() { if (mem_inited) { #if MEM_DEBUG register struct mem_debug *dl; for (dl = mem_alloclist.next; dl; dl = dl->next) { fprintf(ferr,"Unfreed pointer: "); mem_printdl(dl); } #if 0 fprintf(ferr,"Max amount ever allocated == %ld bytes\n", mem_maxalloc); #endif #else if (mem_count) fprintf(ferr,"%d unfreed items\n",mem_count); if (mem_scount) fprintf(ferr,"%d unfreed s items\n",mem_scount); #endif /* MEM_DEBUG */ assert(mem_count == 0 && mem_scount == 0); mem_inited = 0; } } #undef next #undef prev #undef file #undef line #undef nbytes #undef beforeval ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mem.h������������������������������������������������0000755�0000764�0000144�00000014317�07055334077�015241� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** This is a copyrighted work which is functionally identical to work ** originally published in Micro Cornucopia magazine (issue #52, March-April, ** 1990) and is freely licensed by the author, Walter Bright, for any use. */ /*_ mem.h Fri May 26 1989 Modified by: Walter Bright */ /* $Header: /home/cvs/c_cpp_reference/reference/C/CONTRIB/SNIP/mem.h,v 1.1.1.1 2000/02/24 23:01:19 tasin Exp $ */ /* Copyright 1986-1988 by Northwest Software */ /* All Rights Reserved */ /* Written by Walter Bright */ #ifndef MEM_H #define MEM_H 1 #ifndef TOOLKIT_H #include "toolkit.h" #endif /* * Memory management routines. * * Compiling: * * #define MEM_DEBUG 1 when compiling to enable extended debugging * features. * * Features always enabled: * * o mem_init() is called at startup, and mem_term() at * close, which checks to see that the number of alloc's is * the same as the number of free's. * o Behavior on out-of-memory conditions can be controlled * via mem_setexception(). * * Extended debugging features: * * o Enabled by #define MEM_DEBUG 1 when compiling. * o Check values are inserted before and after the alloc'ed data * to detect pointer underruns and overruns. * o Free'd pointers are checked against alloc'ed pointers. * o Free'd storage is cleared to smoke out references to free'd data. * o Realloc'd pointers are always changed, and the previous storage * is cleared, to detect erroneous dependencies on the previous * pointer. * o The routine mem_checkptr() is provided to check an alloc'ed * pointer. */ /********************* GLOBAL VARIABLES *************************/ extern int mem_inited; /* != 0 if mem package is initialized. */ /* Test this if you have other packages */ /* that depend on mem being initialized */ /********************* PUBLIC FUNCTIONS *************************/ /*********************************** * Set behavior when mem runs out of memory. * Input: * flag = MEM_ABORTMSG: Abort the program with the message * 'Fatal error: out of memory' sent * to stdout. This is the default behavior. * MEM_ABORT: Abort the program with no message. * MEM_RETNULL: Return NULL back to caller. * MEM_CALLFP: Call application-specified function. * fp must be supplied. * fp Optional function pointer. Supplied if * (flag == MEM_CALLFP). This function returns * MEM_XXXXX, indicating what mem should do next. * The function could do things like swap * data out to disk to free up more memory. * fp could also return: * MEM_RETRY: Try again to allocate the space. Be * careful not to go into an infinite loop. */ #if __cplusplus enum MEM_E { MEM_ABORTMSG, MEM_ABORT, MEM_RETNULL, MEM_CALLFP, MEM_RETRY }; void mem_setexception P((enum MEM_E, int (*)())); #else #define MEM_ABORTMSG 0 #define MEM_ABORT 1 #define MEM_RETNULL 2 #define MEM_CALLFP 3 #define MEM_RETRY 4 void mem_setexception P((int, int(*)())); #endif /**************************** * Allocate space for string, copy string into it, and * return pointer to the new string. * This routine doesn't really belong here, but it is used so often * that I gave up and put it here. * Use: * char *mem_strdup(const char *s); * Returns: * pointer to copied string if succussful. * else returns NULL (if MEM_RETNULL) */ char *mem_strdup P((const char *)); /************************** * Function so we can have a pointer to function mem_free(). * This is needed since mem_free is sometimes defined as a macro, * and then the preprocessor screws up. * The pointer to mem_free() is used frequently with the list package. * Use: * void mem_freefp(void *p); */ /*************************** * Check for errors. This routine does a consistency check on the * storage allocator, looking for corrupted data. It should be called * when the application has CPU cycles to burn. * Use: * void mem_check(void); */ void mem_check P((void )); /*************************** * Check ptr to see if it is in the range of allocated data. * Cause assertion failure if it isn't. */ void mem_checkptr P((void *ptr)); /*************************** * Allocate and return a pointer to numbytes of storage. * Use: * void *mem_malloc(unsigned numbytes); * void *mem_calloc(unsigned numbytes); allocated memory is cleared * Input: * numbytes Number of bytes to allocate * Returns: * if (numbytes > 0) * pointer to allocated data, NULL if out of memory * else * return NULL */ void *mem_malloc P((unsigned)); void *mem_calloc P((unsigned)); /***************************** * Reallocate memory. * Use: * void *mem_realloc(void *ptr,unsigned numbytes); */ void *mem_realloc P((void *,unsigned)); /***************************** * Free memory allocated by mem_malloc(), mem_calloc() or mem_realloc(). * Use: * void mem_free(void *ptr); */ void mem_free P((void *)); /*************************** * Initialize memory handler. * Use: * void mem_init(void); * Output: * mem_inited = 1 */ void mem_init P((void )); /*************************** * Terminate memory handler. Useful for checking for errors. * Use: * void mem_term(void); * Output: * mem_inited = 0 */ void mem_term P((void )); /* The following stuff forms the implementation rather than the * definition, so ignore it. */ #if MEM_DEBUG /* if creating debug version */ #define mem_strdup(p) mem_strdup_debug((p),__FILE__,__LINE__) #define mem_malloc(u) mem_malloc_debug((u),__FILE__,__LINE__) #define mem_calloc(u) mem_calloc_debug((u),__FILE__,__LINE__) #define mem_realloc(p,u) mem_realloc_debug((p),(u),__FILE__,__LINE__) #define mem_free(p) mem_free_debug((p),__FILE__,__LINE__) char *mem_strdup_debug P((const char *,char *,int)); void *mem_calloc_debug P((unsigned,char *,int)); void *mem_malloc_debug P((unsigned,char *,int)); void *mem_realloc_debug P((void *,unsigned,char *,int)); void mem_free_debug P((void *,char *,int)); void mem_freefp P((void *)); void mem_setnewfileline P((void *,char *,int)); #else #define mem_freefp mem_free #define mem_check() #define mem_checkptr(p) #endif /* MEM_DEBUG */ #endif /* MEM_H */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/lsd.c������������������������������������������������0000755�0000764�0000144�00000016075�07055334045�015236� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** LSD - A simple directory lister ** A public domain C demo program by Bob Stout */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <dos.h> /* For portability, make everything look like MSC 6+ */ #if defined(__TURBOC__) #include <dir.h> #define _dos_findfirst(f,a,b) findfirst(f,b,a) #define _dos_findnext(b) findnext(b) #define find_t ffblk #define _A_SUBDIR FA_DIREC #define attrib ff_attrib #define name ff_name #define size ff_fsize #define wr_time ff_ftime #define wr_date ff_fdate #define _dos_getdiskfree getdfree #define diskfree_t dfree #define avail_clusters df_avail #define sectors_per_cluster df_sclus #define bytes_per_sector df_bsec #else /* assume MSC/QC */ #include <errno.h> #endif #ifdef TRUE #undef TRUE #endif #ifdef FALSE #undef FALSE #endif #ifdef ERROR #undef ERROR #endif enum LOGICAL {ERROR = -1, SUCCESS, FALSE = 0, TRUE}; #ifndef CAST #define CAST(new_type,old_object) (*((new_type *)&(old_object))) #endif #define LAST_CHAR(s) (((char *)s)[strlen(s) - 1]) struct DOS_TIME { unsigned int ss : 5; unsigned int mm : 6; unsigned int hh : 5; } ; #define dos_time(t) CAST(struct DOS_TIME, (t)) struct DOS_DATE { unsigned int da : 5; unsigned int mo : 4; unsigned int yr : 7; } ; #define dos_date(t) CAST(struct DOS_DATE, (t)) /* ** DOS DIR improved work-alike w/ improved formatting & attribute display ** ** supports /W switch */ main(int argc, char *argv[]) { int i, files = 0, dirs = 0, argptr = 0, errflag = FALSE, cols, drive; long siz_tot = 0L; char *p, *fname, *ext, name[13], buf[67], numbuf[12]; struct find_t ff; #ifndef __ZTC__ struct diskfree_t df; #endif int one_column(), five_column(); int (*display)(char *, char *, long, unsigned, unsigned, unsigned) = one_column; char *sprintfc(char *, long); char *capitalize(const char *); strcpy(buf, fname = "*.*"); if(argc != 1) for (i = 1; i < argc; ++i) { if ('/' == argv[i][0]) { if ('W' == toupper(argv[i][1])) display = five_column; else { puts("\aUsage: LSD [/W] [file]"); errflag = TRUE; } } else if (!argptr) argptr = i; } if (argptr) { fname = argv[argptr]; strcpy(buf, fname); if ('\\' == LAST_CHAR(buf) || ':' == LAST_CHAR(buf)) strcat(buf, "*.*"); else { if (SUCCESS == _dos_findfirst(buf, _A_SUBDIR, &ff)) { if (ff.attrib & _A_SUBDIR && '.' != *ff.name) { if ('\\' != LAST_CHAR(buf)) strcat(buf, "\\"); strcat(buf, "*.*"); } } else errflag = TRUE; } } if (':' == buf[1]) drive = toupper(*buf) - '@'; else drive = 0; if (!errflag && !(_dos_findfirst(buf, 0xff, &ff))) do { siz_tot += ff.size; if (ff.attrib & _A_SUBDIR) ++dirs; else ++files; strcpy(name, ff.name); if (NULL != (p = strchr(name, '.')) && p != name) { *p = '\0'; ext = ++p; } else ext = ""; cols = (*display)(name, ext, ff.size, ff.attrib, ff.wr_date, ff.wr_time); } while (SUCCESS == _dos_findnext(&ff)); else { fprintf(stderr, "Cannot do directory on '%s'\n", fname); exit(-1); } if (cols) fputc('\n', stdout); sprintfc(numbuf,siz_tot); printf("\n%3d Files totalling %s bytes\n", files, numbuf); printf("%3d Director%s\n", dirs, (1 == dirs) ? "y" : "ies"); #ifndef __ZTC__ _dos_getdiskfree(drive, &df); sprintfc(numbuf, (long)df.avail_clusters * df.sectors_per_cluster * df.bytes_per_sector); #else /* if ZTC */ sprintfc(numbuf, dos_getdiskfreespace(drive)); #endif printf("%s bytes free\n", numbuf); return 0; } /* ** The single column directory entry display function */ int one_column(char *name, char *ext, long size, unsigned attribs, unsigned date, unsigned time) { register int i, mask; static char *atr = "RHSVDA", szbuf[12]; sprintfc(szbuf, size); printf("%-8s %-3s %12s ", capitalize(name), capitalize(ext), szbuf); for (i = 0, mask = 1; i < 6; ++i, mask <<= 1) { if (attribs & mask) fputc(atr[i], stdout); else fputc('.' , stdout); } printf("%4d-%02d-%02d%4d:%02d:%02d\n", dos_date(date).mo, dos_date(date).da, (dos_date(date).yr + 80) % 100, dos_time(time).hh, dos_time(time).mm, dos_time(time).ss); return 0; } /* ** The five column directory entry display function */ int five_column(char *name, char *ext, long size, unsigned attribs, unsigned date, unsigned time) { static int cols = 0; printf("%-8s %-3s%s", capitalize(name), capitalize(ext), (5 > ++cols) ? " " : ""); if (0 == (cols %= 5)) putchar('\n'); return (cols); } /* ** Display a long int using commas as thousands separators */ char *sprintfc(char *string, long num) { if (num > 999999L) { sprintf(string, "%d,%03d,%03d", (int)(num / 1000000L), (int)((num % 1000000L) / 1000L), (int)(num % 1000L)); } else { if (num > 999L) { sprintf(string, "%d,%03d", (int)(num / 1000L), (int)(num % 1000L)); } else sprintf(string, "%d", (int)num); } return string; } /* ** Capitalize a name or extension in place */ char *capitalize(const char *string) { int flag = 0; char *ptr = (char *)string; do { if (isalpha(*ptr)) { if (flag) *ptr = (char)tolower(*ptr); else { flag = 1; *ptr = (char)toupper(*ptr); } } else flag = 0; } while (*++ptr); return (char *)string; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/str.h������������������������������������������������0000755�0000764�0000144�00000015533�07055334256�015273� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// // Simple string class // Public domain // // Written by david nugent // davidn@csource.pronet.com // 3:632/348@fidonet // # if !defined( _str_h ) # define _str_h 1 # if defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0300 ) # define PLACEMENT_NEW_BUG # define SIGNED_CHAR_BUG # endif struct refstr { short _size; short _length; short _refs; refstr (short length, short size) : _length(length), _size(size), _refs(1) {} ~refstr (void) {} # if !defined( PLACEMENT_NEW_BUG ) void * operator new(unsigned sz, short allocsz); # endif char * ptr (void) { return ((char *)this) + sizeof(refstr); } }; class str { public: // constructors/destructors str (void) { _strinit(); } str (char const * s, short len =-1) { _strinit(s, len, -1); } str (unsigned char const * s, short len =-1) { _strinit((char const *)s, len, -1); } # if !defined( SIGNED_CHAR_BUG ) str (signed char const * s, short len =-1) { _strinit((char const *)s, len, -1); } # endif str (char c) { _strinit (&c, 1, -1); } str (unsigned char c) { _strinit ((char const *)&c, 1, -1); } # if !defined( SIGNED_CHAR_BUG ) str (signed char c) { _strinit ((char const *)&c, 1, -1); } # endif str (str const & s) : strdata(s.strdata) { ++strdata->_refs; } ~str (void) { if (!--strdata->_refs) delete strdata; } // assignment str & operator= (str const & s); str & operator= (char const * s); str & operator= (char c); str & operator= (unsigned char const * s) { return operator= ((char const *)s); } # if !defined( SIGNED_CHAR_BUG ) str & operator= (signed char const * s) { return operator= ((char const *)s); } # endif // primitive members short length (void) const { return strdata->_length; } short size (void) const { return strdata->_size; } // operators str & operator<< (char const * s) // concatenate { _concat (s); return *this; } str & operator<< (unsigned char const * s) { _concat ((char const *)s); return *this; } # if !defined( SIGNED_CHAR_BUG ) str & operator<< (signed char const * s) { _concat ((char const *)s); return *this; } # endif str & operator<< (str const & s) { _concat (s); return *this; } str & operator<< (char c) { _concat (c); return *this; } str & operator<< (unsigned char c) { _concat (c); return *this; } # if !defined( SIGNED_CHAR_BUG ) str & operator<< (signed char c) { _concat (c); return *this; } # endif char & operator[] (short pos) { if (pos < 0 || pos >= strdata->_length) { char * buf = c_ptr() + length(); *buf = 0; return *buf; } return c_ptr()[pos]; } char * c_ptr (void) const // not necessarily NUL terminated! { // Use with caution... return strdata->ptr(); } char const * c_str (void) const // return char* { char * buf = c_ptr(); buf[strdata->_length] = 0; return buf; } unsigned char const * u_str (void) const { return (unsigned char const *)c_str(); } // manipulators short insert (short pos, char const * s, short len =-1); short insert (short pos, str const & s) { return insert (pos, s.c_ptr(), s.length()); } short insert (short pos, unsigned char const * s, short len =-1) { return insert (pos, (char const *)s, len); } # if !defined( SIGNED_CHAR_BUG ) short insert (short pos, signed char const * s, short len =-1) { return insert (pos, (char const *)s, len); } # endif short insert (short pos, char c) { return insert (pos, &c, 1); } short insert (short pos, unsigned char c) { return insert (pos, (char const *)&c, 1); } # if !defined( SIGNED_CHAR_BUG ) short insert (short pos, signed char c) { return insert (pos, (char const *)&c, 1); } # endif short remove (short pos =0, short len =-1); short replace (short pos, char const * s, short clen =-1, short len =-1); short replace (short pos, str & s, short clen =-1) { return replace (pos, s.c_ptr(), clen, s.length()); } short replace (short pos, unsigned char const * s, short clen =-1, short len =-1) { return replace (pos, (char const *)s, clen, len); } # if !defined( SIGNED_CHAR_BUG ) short replace (short pos, signed char const * s, short clen =-1, short len =-1) { return replace (pos, (char const *)s, clen, len); } # endif short replace (short pos, char c, short clen =-1) { return replace (pos, &c, clen, 1); } short replace (short pos, unsigned char c, short clen =-1) { return replace (pos, (char const *)&c, clen, 1); } # if !defined( SIGNED_CHAR_BUG ) short replace (short pos, signed char c, short clen =-1) { return replace (pos, (char const *)&c, clen, 1); } # endif str & left (short len, char padch =' '); str & right (short len, char padch =' '); str & mid (short pos, short len, char padch =' '); short removech (char const * clist ="\r\n"); short countch (char const * clist); protected: refstr * strdata; // Check to see if big enough for size int _chksize (short sz =0); int _concat (char const * s, short len =-1); int _concat (str const & s) { return _concat (s.c_ptr(), s.length()); } int _concat (char ch) { return _concat (&ch, 1); } int _concat (unsigned char const * s, short len =-1) { return _concat ((char const *)s, len); } # if !defined( SIGNED_CHAR_BUG ) int _concat (signed char const * s, short len =-1) { return _concat ((char const *)s, len); } # endif private: // Common constructor void _strinit (char const * s =0, short slen =0, short siz =-1); }; str left (str const & s, short len, char padch =' '); str right (str const & s, short len, char padch =' '); str mid (str const & s, short pos, short len, char padch =' '); # endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/portable.h�������������������������������������������0000755�0000764�0000144�00000012351�07055334142�016260� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*============================================================================ portable.h v1.00 Written by Scott Robert Ladd. _MSC_VER Microsoft C 6.0 and later _QC Microsoft Quick C 2.51 and later __TURBOC__ Borland Turbo C, Turbo C++, and Borland C++ __BORLANDC__ Borland C++ __ZTC__ Zortech C++ and Symantec C++ __SC__ Symantec C++ __WATCOM__ WATCOM C __POWERC Mix Power C Revised: 09/14/93 Fred Cole Moved MK_FP() macro to end of file to avoid redefinition error when dos.h gets included at the in/outport definitions for __TURBOC__ 09/15/93 Thad Smith Add conditional code for TC 2.01 Fix findfirst/findnext support for ZTC 3.0 10/15/93 Bob Stout Revise find first/next support 04/03/94 Bob Stout Add Power C support, FAR ============================================================================*/ /* prevent multiple inclusions of this header file */ #if !defined(PORTABLE_H) #define PORTABLE_H /* ** Correct far pointer syntax */ #if defined(__POWERC) || (defined(__TURBOC__) && !defined(__BORLANDC__)) #define FAR far #else #define FAR _far #endif /*---------------------------------------------------------------------------- Directory search macros and data structures DOSFileData MS-DOS file data structure FIND_FIRST MS-DOS function 0x4E -- find first file matchine spec FIND_NEXT MS-DOS function 0x4F -- find subsequent files ----------------------------------------------------------------------------*/ /* make sure the structure is packed on byte boundary */ #if defined(_MSC_VER) || defined(_QC) || defined(__WATCOM__) #pragma pack(1) #elif defined(__ZTC__) #pragma ZTC align 1 #elif defined(__TURBOC__) && (__TURBOC__ > 0x202) #pragma option -a- #endif /* use this structure in place of compiler-defined file structure */ typedef struct { char reserved[21]; char attrib; unsigned time; unsigned date; long size; char name[13]; } DOSFileData; /* set structure alignment to default */ #if defined (_MSC_VER) || defined(_QC) || defined(__WATCOMC__) #pragma pack() #elif defined (__ZTC__) #pragma ZTC align #elif defined(__TURBOC__) && (__TURBOC__ > 0x202) #pragma option -a. #endif /* include proper header files and create macros */ #if defined (_MSC_VER) || defined(_QC) || defined(__WATCOMC) #include "direct.h" #define FIND_FIRST(spec,attr,buf) _dos_findfirst(spec,attr,\ (struct find_t *)buf) #define FIND_NEXT(buf) _dos_findnext((struct find_t *)buf) #elif defined (__TURBOC__) #include "dir.h" #define FIND_FIRST(spec,attr,buf) findfirst(spec,(struct ffblk *)buf,attr) #define FIND_NEXT(buf) findnext((struct ffblk *)buf) #elif defined (__ZTC__) #include "dos.h" #define FIND_FIRST(spec,attr,buf) _dos_findfirst(spec,attr,\ (struct find_t *)buf) #define FIND_NEXT(buf) _dos_findnext((struct find_t *)buf) #endif /*---------------------------------------------------------------------------- I/O Port Macros IN_PORT read byte from I/O port IN_PORTW read word from I/O port OUT_PORT write byte to I/O port OUT_PORTW write word to I/O port ----------------------------------------------------------------------------*/ #if defined(__TURBOC__) #include "dos.h" #define IN_PORT(port) inportb(port) #define IN_PORTW(port) inport(port) #define OUT_PORT(port, val) outportb(port, val) #define OUT_PORTW(port, val) outport(port, val) #else #include "conio.h" #define IN_PORT(port) inp(port) #define IN_PORTW(port) inpw(port) #define OUT_PORT(port, val) outp(port, val) #define OUT_PORTW(port, val) outpw(port, val) /*---------------------------------------------------------------------------- Borland pseudo register macros These macros replace references to Borland's pseudo register variables and geninterrup() funciton with traditional struct REGS/int86 references. ----------------------------------------------------------------------------*/ #if !defined(__TURBOC__) #include "dos.h" extern union REGS CPURegs; #define _AX CPURegs.x.ax #define _BX CPURegs.x.bx #define _CX CPURegs.x.cx #define _DX CPURegs.x.dx #define _AH CPURegs.h.ah #define _AL CPURegs.h.al #define _BH CPURegs.h.bh #define _BL CPURegs.h.bl #define _CH CPURegs.h.ch #define _CL CPURegs.h.cl #define _DH CPURegs.h.dh #define _DL CPURegs.h.dl #define geninterrupt(n) int86(n,&CPURegs,&CPURegs); #define O_DENYALL 0x10 #define O_DENYWRITE 0x20 #define O_DENYREAD 0x30 #define O_DENYNONE 0x40 #endif #endif /*---------------------------------------------------------------------------- Pointer-related macros MK_FP creates a far pointer from segment and offset values ----------------------------------------------------------------------------*/ #if !defined(MK_FP) #define MK_FP(seg,off) ((void FAR *)(((long)(seg) << 16)|(unsigned)(off))) #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/vio.h������������������������������������������������0000755�0000764�0000144�00000003525�07055334325�015253� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** By: Jim Nutt */ #ifndef VIO_H #define VIO_H #if __cplusplus extern "C" { #endif #if defined(__TURBOC__) #define _far far #define _pascal pascal #endif /* initialization and termination functions */ int _far VIOopen(void); void _far VIOclose(void); /* scrolling functions */ void _far VIOscrollright(int x1, int y1, int x2, int y2, int count); void _far VIOscrollleft(int x1, int y1, int x2, int y2, int count); void _far VIOscrollup(int x1, int y1, int x2, int y2, int count); void _far VIOscrolldown(int x1, int y1, int x2, int y2, int count); /* screen clear */ void _far VIOclear(int x1, int y1, int x2, int y2); /* write to screen */ void _far VIOputc(const char c); void _far VIOputs(const char far * s); void _far VIOputr(int x, int y, int w, int h, int _far * b); /* read from screen */ int _far VIOgetca(const int x, const int y); int _far * _far VIOgetra(int x1, int y1, int x2, int y2, int _far * b); /* set colors */ void _far VIOsetfore(const int c); void _far VIOsetback(const int c); /* get current color settings */ int _far VIOgetfore(void); int _far VIOgetback(void); /* set the write cursor */ void _far VIOgotoxy(int x, int y); /* update the screen and visible cursor */ void _far VIOupdate(); /* get the current write cursor position */ int _far VIOwherex(void); int _far VIOwherey(void); /* get screen information */ unsigned int _far VIOsegment(void); int _far VIOcolumns(void); int _far VIOrows(void); int _far VIOmode(void); int _far VIOheight(void); /* set segment information */ void _far VIOsetSegment(unsigned int s); void _far VIOsetRows(int r); void _far VIOsetCols(int c); /* get BIOS cursor location */ void _far VIOcursor(int _far * x, int _far * y, int _far * shape); #if __cplusplus } ; #endif #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/tp6tod.c���������������������������������������������0000755�0000764�0000144�00000003576�07055334307�015677� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Convert Turbo Pascal 6-byte reals to C double format ** Written by Thad Smith III, Boulder, CO. 12/91 ** Tested on TC 2.01, BC++ 2.0/3.0, QC 2.50, Power C 2.0.1, ZTC 3.0 ** Contributed to the Public Domain. */ #include <math.h> #include <string.h> #ifdef TEST #include <stdio.h> #endif /* ** Specify packed structures. ** Note: This may not work on some compilers. */ #if __TURBOC__ > 0x0201 #pragma option -a- #elif defined __ZTC__ #pragma ZTC align 1 #else /* MSC, WATCOM */ #pragma pack(1) #endif double tp6_to_double(const unsigned char *tp6) { struct { unsigned char be ; /* biased exponent */ unsigned int v1 ; /* lower 16 bits of mantissa */ unsigned int v2 ; /* next 16 bits of mantissa */ unsigned int v3:7; /* upper 7 bits of mantissa */ unsigned int s :1; /* sign bit */ } real; memcpy (&real, tp6, 6); if (real.be == 0) return 0.0; return (((((128 +real.v3) * 65536.0) + real.v2) * 65536.0 + real.v1) * ldexp ((real.s? -1.0: 1.0), real.be - (129+39))); } #ifdef TEST /* ** This test program reads 6-byte values, one per line, in ** 12-digit hexadecimal format from stdin, converts to a double, ** then prints it. */ void main(void) { unsigned char c[6]; int buf[6]; int i, n; for (;;) { n = scanf (" %2x%2x%2x%2x%2x%2x", &buf[0], &buf[1], &buf[2], &buf[3], &buf[4], &buf[5]); if (n <= 0) break; for (i=0; i < 6; i++) { c [i] = buf[i]; printf ("%2.2x", buf[i]); } printf (" = %lg\n", tp6_to_double (c)); } return 0; } #endif ����������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/query.c����������������������������������������������0000755�0000764�0000144�00000002400�07055334172�015605� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** QUERY.C - Timed query with default for batch files ** ** public domain by Bob Stout */ #include <stdio.h> #include <time.h> #include <ctype.h> #include <stdlib.h> #include <conio.h> main(int argc, char *argv[]) { int ch = '\0', def_ch = '\0'; char *prompt = "(y/n) "; clock_t start, limit = (clock_t)0; if (1 < argc) { def_ch = toupper(*argv[1]); if ('Y' == def_ch) prompt[1] = (char)def_ch; else if ('N' == def_ch) prompt[3] = (char)def_ch; else def_ch = '\0'; } fputs(prompt, stderr); if (2 < argc) { start = clock(); limit = (clock_t)(CLK_TCK * atoi(argv[2])); } while ('Y' != ch && 'N' != ch) { while (!kbhit()) { if (limit && (limit <= (clock() - start))) { ch = def_ch; goto BYE; } } ch = toupper(getch()); if ('Y' != ch && 'N' != ch && (1 < argc)) ch = def_ch; }; BYE: fputc(ch, stderr); fputc('\n', stderr); return ('Y' == ch); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/xtest.c����������������������������������������������0000755�0000764�0000144�00000001465�07055334353�015622� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <stdio.h> #include "xfile.h" int main(int argc, char **argv) { while (*++argv != 0) { XFILE *f = xopen(*argv); if (f == 0) fprintf(stderr, "ERROR: can't open file %s\n", *argv); else { #if 0 char *s; fprintf(stdout, "--- %s ---\n", *argv); while ((s = xgetline(f)) != 0) fputs(s, stdout); xclose(f); #else unsigned int nLines = 0; char *s; while ((s = xgetline(f)) != 0) ++nLines; printf("%5u lines in %s\n", nLines, *argv); xclose(f); #endif } } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/myiodemo.cpp�����������������������������������������0000755�0000764�0000144�00000010033�07055334120�016614� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Myiodemo.cpp // This is a trivial program which uses the myio loopback class // to demonstrate the basics on writing an io interface using // the AT&T C++ iostream classes. // The program simply provides the ability to selectively add // to or read from a Myio instance and display information to // assist in understanding how it all works. // # include "Mystream.h" // This includes Myio.h and iostream.h # include "myLine.h" # include <conio.h> // For getch() # include <ctype.h> // For toupper() # include <string.h> # define NL char('\n') // Let's do the "application is a class" trick class myApplication { // Defines a pointer to member function type // used for dispatching the menu typedef void (myApplication::*pvf) (void); public: myApplication (void) : mio() {} int execute (void); private: iostream & stream (void) { return mio.stream(); } int domenu (void); void send (void); void read (void); void disp (void); void peek (void); void flsh (void); void stat (void); pvf choice; // Function called to execute Myio mio; // IO object }; void myApplication::disp (void) { cout << "Mystream status:" << NL << "Chrs in output buffer = " << stream().rdbuf()->out_waiting() << NL << "Chrs in input buffer = " << stream().rdbuf()->in_avail() << NL << "Myio object status = " << mio.count() << char('/') << mio.size() << " LastWrite=" << (mio.writeok() ? "OK" : "Incomplete") << " LastRead=" << (mio.readok() ? "OK" : "EOF") << endl; } // Request a line and send it to the IO device void myApplication::send (void) { cout << NL << "Enter text to write - press <ENTER> when done\n:"; myLine L; cin >> L; int l = strlen(L); if (!l) cerr << "Nothing entered." << endl; else { cout << "Writing '" << L << char('\'') << endl; stream() << L << NL; // Send the entered data, NL terminated cout << "Chrs written to Myio object = " << (l + 1) << NL; disp (); } } void myApplication::read (void) { cout << NL << "Reading a line from object:" << NL; myLine L; mio.stream().clear(); mio.stream() >> L; int l = strlen(L); if (!l) { cout << "Nothing read." << endl; mio.stream().clear(); // Clear EOF status } else { cout << "Read '" << L << char('\'') << endl; cout << "Chrs read from Myio object = " << (l + 1) << NL; disp (); } } void myApplication::flsh (void) { cout << NL << "Flushing stream" << endl; stream() << flush; disp (); } void myApplication::stat (void) { cout << NL << "Myio object buffer dump:" << NL; mio.dump(); disp (); stream().rdbuf()->dbp(); // Dump stream info } int myApplication::domenu (void) { cout << NL << "W)rite R)ead D)ump F)lush Q)uit\n" << "Select: " << flush; // Need to flush here for portability int key; for (;;) { key = getch (); switch (toupper(key)) { case 'W': choice = &myApplication::send; break; case 'R': choice = &myApplication::read; break; case 'D': choice = &myApplication::stat; break; case 'F': choice = &myApplication::flsh; break; case 'Q': key = 0; break; default: continue; } cout << char(key) << endl; break; } return key; } int // This is really the application myApplication::execute (void) { while (domenu ()) (this->*choice) (); return 0; } int main (void) { myApplication Demo; // Declare the application return Demo.execute (); // go for it! } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/trapdemo.c�������������������������������������������0000755�0000764�0000144�00000002776�07055334307�016273� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Demonstrate TRAPFLAG.ASM ** ** public domain by Bob Stout */ #include <stdio.h> #include <dos.h> #include <int.h> extern void ins09(void); extern void undo09(void); extern volatile int far ccrcvd; static void biosprt(char *p) { union REGS regs; while (*p) { regs.h.ah = 0x0e; /* Low-level services only! */ regs.h.al = *p++; regs.x.bx = 0; int86(0x10, ®s, ®s); } } static void far my_cc(void) { char *p1 = "Ctrl-"; char *p2 = "C"; char *p3 = "Break"; char *p4 = " received\r\n"; biosprt(p1); if (1 == ccrcvd) biosprt(p2); else biosprt(p3); biosprt(p4); } main() { unsigned seg, ofs; int ch = 0; setbuf(stdout, NULL); my_cc(); ins09(); atexit(undo09); puts("New Ints 09h & 1Bh installed..."); puts("Hit Esc to quit..."); do { if (kbhit()) { if (0x1b != (ch = getch())) { if (0x20 > ch) { fputc('^', stdout); ch += '@'; } fputc(ch, stdout); } } if (ccrcvd) { my_cc(); ccrcvd = 0; } } while (0x1b != ch); } ��c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/errfix.c���������������������������������������������0000755�0000764�0000144�00000003006�07055333745�015747� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** ERRFIX.C - redirect stderr to some other file under MS-DOS ** ** by Bob Jarvis */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <process.h> char *usage = "ERRFIX [filename] [prog] { {parm1} {parm2} ... {parmN} }\n" " Redirects stderr to another file, then invokes a program\n" " which will inherit the new definition of stderr.\n\n" "Parameters:\n" " filename (required) - the name of the file stderr should\n" " be redirected to. Output written to stderr will\n" " be routed to this file instead of the console.\n" " prog (required) - name of the program to be run.\n" " parm1...parmN (optional) - command-line parameters needed\n" " to run the program specified by the 'prog' argument."; int main(int argc, char *argv[]) { char **args = argv; if (3 > argc) { printf(usage); return 1; } if (NULL != argv[argc]) /* may be a problem under some compilers */ { args = malloc((argc+1) * sizeof(char *)); if (NULL == args) { printf("Unable to allocate storage"); return 2; } memcpy(args, argv, argc * sizeof(char *)); args[argc] = NULL; } freopen(args[1], "w", stderr); spawnvp(0, args[2], &args[2]); return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rfind1st.c�������������������������������������������0000755�0000764�0000144�00000012575�07055334204�016204� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** RFIND1ST.C - Our own non-compiler specific find first/next calls ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include <stdio.h> #include <stdlib.h> #include <dos.h> #include "dirent.h" #ifndef OS2 /************************************************************************/ /* */ /* rfind_1st() - Find first matching file */ /* */ /* Parameters: 1 - Drive, path and filename of file to be found. May */ /* include wildcards */ /* 2 - Attribute of file to search for. Attributes are */ /* described in the MS-DOS manual. The search strategy */ /* is described under DOS call 0x4Eh. */ /* 3 - Disk transfer area buffer. If NULL, one will be */ /* malloc'ed. */ /* Returns: Pointer to a struct DSTRUCT. If error, NULL is returned and */ /* _doserrno is set to the error #. */ /* */ /************************************************************************/ struct DSTRUCT *rfind_1st(char *name, unsigned attribute, struct DSTRUCT *dta) { struct DSTRUCT *my_dta; union REGS regs; if (NULL == dta) my_dta = (struct DSTRUCT *)malloc(sizeof(struct DSTRUCT)); else my_dta = dta; bdos(0x1A, (unsigned)my_dta, 0); /* set DTA to my_dta */ regs.x.ax = 0x4E00; /* find first */ regs.x.dx = (unsigned)name; regs.x.cx = attribute; intdos(®s, ®s); if (regs.x.cflag) /* if error */ { _doserrno = regs.x.ax; if (NULL == dta && my_dta != NULL) free(my_dta); return (struct DSTRUCT *) NULL; } return my_dta; } /************************************************************************/ /* */ /* rfind_nxt() - Find next matching file */ /* */ /* Parameters: 1 - Pointer to DSTRUCT structure to use */ /* */ /* Returns: Pointer to struct DSTRUCT, */ /* NULL if no more matching files found */ /* */ /************************************************************************/ struct DSTRUCT *rfind_nxt(struct DSTRUCT *dta) { union REGS regs; bdos(0x1A, (unsigned)dta, 0); /* set DTA to dta */ regs.x.ax = 0x4F00; intdos(®s,®s); if (regs.x.cflag) /* if error */ { _doserrno = regs.x.ax; return (struct DSTRUCT *) NULL; } return dta; } #else /************************************************************************/ /* */ /* OS/2 Versions follow - poorly tested! */ /* */ /************************************************************************/ #if OS2 < 2 typedef USHORT UWORD #else typedef ULONG UWORD #endif static HDIR hdir_ptr = DSIR_CREATE; #if OS2 < 2 static FILEFINDBUF flist; #else static FILEFINDBUF3 flist; #endif static PSZ fname; static UWORD count = 1; struct DSTRUCT *rfind_1st(char *name, unsigned attribute, struct DSTRUCT *dta) { struct DSTRUCT *my_dta; short retval; if (NULL == dta) my_dta = (struct DSTRUCT *)malloc(sizeof(struct DSTRUCT)); else my_dta = dta; fname = (PSZ)name; #if OS2 < 2 if (DosFindFirst(fname, &hdir_ptr, attribute, &flist, sizeof(flist), &count, 0L)) #else if (DosFindFirst(fname, &hdir_ptr, attribute, &flist, sizeof(flist), &count, FIL_STANDARD)) #endif { return NULL; } else { my_dta->ATTRIBUTE = (BYTE)(flist.attrFile & 0xff); my_dta->TIME = flist.ftimeCreation; my_dta->DATE = flist.fdateCreation; my_dta->FSIZE = flist.cbFile; strcpy(my_dta->NAME, flist.achName); return my_dta; } } struct DSTRUCT *rfind_nxt(struct DSTRUCT *dta) { struct DSTRUCT *my_dta; if (DosFindNext(hdir_ptr, &flist, sizeof(flist), & count)) return NULL; else { my_dta->ATTRIBUTE = (BYTE)(flist.attrFile & 0xff); my_dta->TIME = flist.ftimeCreation; my_dta->DATE = flist.fdateCreation; my_dta->FSIZE = flist.cbFile; strcpy(my_dta->NAME, flist.achName); return my_dta; } } #endif �����������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mainmain.c�������������������������������������������0000755�0000764�0000144�00000000120�07055334054�016225� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������main(){char *c="main(){char *c=%c%s%c;printf(c,34,c,34);}";printf(c,34,c,34);} ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ndpcheck.asm�����������������������������������������0000755�0000764�0000144�00000002254�07055334123�016560� �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� page 55, 132 ; ; FUNCTION: ndp_check ; ; Require MASM 5.1 or later, or equivalent ; ; Assemble with: MASM /Mx /z ... ; TASM /jMASM /mx /z ... ; % .MODEL memodel,C ;Add model support via ;command line macros, e.g. ;MASM /Mx /Dmemodel=LARGE .CODE control dw 0 ;--------------------------------------------------------------- ; ; Check for an NDP. ; ; Returns 0 if no coprocessor ; Returns 1 if coprocessor present PUBLIC ndp_check ndp_check PROC USES BX xor BX,BX ; set up zero return fninit ; try to initialize the NDP mov byte ptr control+1,0 ; clear memory byte fnstcw control ; put control word in memory mov AH,byte ptr control+1 ; if AH is 03h, you got cmp AH,03h ; an NDP on board !! jne SHORT NDPbye inc BX NDPbye: mov AX,BX ret ndp_check ENDP end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/addpath.c��������������������������������������������0000755�0000764�0000144�00000005133�07055333635�016056� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Append a new directory to the AUTOEXEC.BAT path ** ** public domain by Bob Stout ** also uses TRIM.C from SNIPPETS */ #include <stdio.h> #include <string.h> char *trim(char *); #define TAG_1 "set path=" #define TAG_2 "path=" typedef enum {ERROR = -1, SUCCESS} LOGICAL; #define NUL '\0' #define LAST_CHAR(s) (((char *)s)[strlen(s) - 1]) #ifdef TESTDIR #define ROOT "" /* While testing, do things in the current dir */ #else #define ROOT "\\" /* Otherwise, look for AUTOEXEC.BAT in the root */ #endif LOGICAL addpath(char *newdir) { FILE *autoexec, *tmp; char fname[FILENAME_MAX], bakname[FILENAME_MAX]; char tfname[L_tmpnam], tbakname[L_tmpnam]; char *ptr; strcat(strcpy(fname, ROOT), "autoexec.bat"); tmpnam(tfname); tmpnam(tbakname); strcpy(bakname, fname); if (NULL != (ptr = strrchr(bakname, '.'))) { if (NULL == strchr(ptr, '\\') && NULL == strchr(ptr, '/')) *ptr = NUL; } strcat(bakname, ".bak"); rename(bakname, tbakname); rename(fname, bakname); if (NULL == (autoexec = fopen(bakname, "r"))) { if (NULL == (autoexec = fopen(fname, "w"))) return ERROR; fprintf(autoexec, "SET PATH=%s\n", newdir); fclose(autoexec); remove(tbakname); return SUCCESS; } if (NULL == (tmp = fopen(tfname, "w"))) { fclose(autoexec); rename(bakname, fname); rename(tbakname, bakname); return ERROR; } else remove(tbakname); while (!feof(autoexec)) { char rline[256 + FILENAME_MAX]; char tline[256 + FILENAME_MAX]; if (fgets(rline, 256, autoexec)) { trim(strcpy(tline, rline)); if ((SUCCESS == strnicmp(tline, TAG_1, strlen(TAG_1))) || (SUCCESS == strnicmp(tline, TAG_2, strlen(TAG_2)))) { if ('\n' == LAST_CHAR(rline)) LAST_CHAR(rline) = NUL; strcat(rline, (';' == LAST_CHAR(rline) ? "" : ";")); strcat(strcat(rline, newdir), "\n"); } fputs(rline, tmp); } } fclose(autoexec); fclose(tmp); rename(tfname, fname); return SUCCESS; } #ifdef TEST main() { printf("addpath(mydir) returned %d\n", addpath("mydir")); } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/file_id.diz������������������������������������������0000755�0000764�0000144�00000000326�07055333756�016413� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������The SNIPPETS collection is an archive of over 300 separate files, over 30,000 lines of mostly C/C++ source code - all public domain and freeware - which contains the best answers to "How do I..." questions. ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/daynum.c���������������������������������������������0000755�0000764�0000144�00000004645�07055333717�015756� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** DAYNUM.C - Functions to return statistics about a given date. ** ** public domain by Bob Stout - uses Ray Gardner's SCALDATE.C */ #include "scaldate.h" static long jan1date; /* ** Determine if a given date is valid */ int valiDate(unsigned yr, unsigned mo, unsigned day) { unsigned int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; if (1 > mo || 12 < mo) return 0; if (1 > day || day > (days[mo - 1] + (2 == mo && isleap(yr)))) return 0; else return 1; } /* ** Return the day of the week */ int dow(unsigned yr, unsigned mo, unsigned day) { #if (!ISO) /* Sunday(0) -> Saturday(6) (i.e. U.S.) calendars */ return (ymd_to_scalar(yr, mo, day) % 7L); #else /* International Monday(0) -> Sunday(6) calendars */ return ((ymd_to_scalar(yr, mo, day) - 1L) % 7L); #endif } /* ** Return the day of the year (1 - 365/6) */ int daynum(int year, int month, int day) { jan1date = ymd_to_scalar(year, 1, 1); return (int)(ymd_to_scalar(year, month, day) - jan1date + 1L); } /* ** Return the week of the year (1 - 52, 0 - 52 if ISO) */ int weeknum(int year, int month, int day) { int wn, j1n, dn = daynum(year, month, day); dn += (j1n = (int)((jan1date - (long)ISO) % 7L)) - 1; wn = dn / 7; if (ISO) wn += (j1n < 4); else ++wn; return wn; } #ifdef TEST #include <stdio.h> #include <stdlib.h> void do_err(void); void main(int argc, char *argv[]) { int day, month, year; char *days[] = #if (!ISO) {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; #else {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; #endif if (4 > argc) { puts("Usage: DAYNUM month day year"); return; } month = atoi(argv[1]); day = atoi(argv[2]); year = atoi(argv[3]); if (100 > year) year += 1900; if (!valiDate(year, month, day)) printf("%d/%d/%d is invalid!\n", month, day, year); else printf("%d/%d/%d is a %s, day #%d in week %d\n", month, day, year, days[dow(year, month, day)], daynum(year, month, day), weeknum(year, month, day)); } #endif /* TEST */ �������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/toolkit.h��������������������������������������������0000755�0000764�0000144�00000003206�07055334305�016135� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** This is a copyrighted work which is functionally identical to work ** originally published in Micro Cornucopia magazine (issue #52, March-April, ** 1990) and is freely licensed by the author, Walter Bright, for any use. */ /*_ toolkit.h Tue Apr 18 1989 Modified by: Walter Bright */ #ifndef TOOLKIT_H #define TOOLKIT_H /* Define stuff that's different between machines. * PROTOTYPING 1 if compiler supports prototyping * HOSTBYTESWAPPED 1 if on the host machine the bytes are * swapped (1 for 6809, 68000, 0 for 8088 * and VAX). */ #ifdef MSDOS #define PROTOTYPING 1 #define HOSTBYTESWAPPED 0 #define BITSPERBYTE 8 #define SIZEOFINT sizeof(int) #define SIZEOFLONG sizeof(long) #else #ifdef M_UNIX /* SCO UNIX using Microsoft C. */ #define PROTOTYPING 1 #define HOSTBYTESWAPPED 0 #define EXIT_SUCCESS 0 #define EXIT_FAILURE 1 #define BITSPERBYTE 8 #define SIZEOFINT sizeof(int) #define SIZEOFLONG sizeof(long) #else /* NOTE: host.h is *NOT* included in SNIPPETS */ #include "host.h" /* Compiler/environment-specific stuff goes here */ #endif #endif /* Static definitions do not appear in the linker .MAP file. Override */ /* the definition here to make them global if necessary. */ #ifndef STATIC #define STATIC static #endif #define arraysize(array) (sizeof(array) / sizeof(array[0])) /* Macros so that we can do prototyping, but still work with non- */ /* prototyping compilers: */ #if PROTOTYPING #define P(s) s #else #define P(s) () #endif #ifdef DEBUG #define debug(a) (a) #else #define debug(a) #endif #endif /* TOOLKIT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/doansi_1.c�������������������������������������������0000755�0000764�0000144�00000032317�07055333726�016153� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** DOANSI_1.C - Portable ANSI screen code interpreter ** ** From DRSK_105.LZH (ansi.c), hereby declared free for use for whatever ** purposes by author: Mark Kimes */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include "doansi.h" /* * to initialize: * call set_screensize(<# lines to reserve>); * to print through ansi interpreter: * call ansi_out(<string>); */ char curattr = 7; int curx = 0,cury = 0; int maxx = 80, maxy = 25; /* size of ansi output window */ int realmaxy,realmaxx; /* real screen size */ char useansi = 1; /* while true, interp ansi seqs */ int tabspaces = 8; static int savx,savy,issaved = 0; static char ansi_terminators[] = "HFABCDnsuJKmp"; #define MAXARGLEN 128 #define NOTHING 0 #define WASESCAPE 1 #define WASBRKT 2 /* "generic" support functions closely related to ansi_out */ void set_pos (char *argbuf,int arglen,char cmd) { int y,x; char *p; if (!*argbuf || !arglen) { curx = cury = 0; } y = atoi(argbuf) - 1; p = strchr(argbuf,';'); if (y >= 0 && p) { x = atoi(p + 1) - 1; if(x >= 0) { curx = x; cury = y; } } } void go_up (char *argbuf,int arglen,char cmd) { int x; x = atoi(argbuf); if (!x) x = 1; for ( ; x ; x--) { if (!cury) break; cury--; } } void go_down (char *argbuf,int arglen,char cmd) { int x; x = atoi(argbuf); if (!x) x = 1; for ( ; x ; x--) { if (cury == maxy - 1) break; cury++; } } void go_left (char *argbuf,int arglen,char cmd) { int x; x = atoi(argbuf); if (!x) x = 1; for ( ; x ; x--) { if(!curx) break; curx--; } } void go_right (char *argbuf,int arglen,char cmd) { int x; x = atoi(argbuf); if (!x) x = 1; for ( ; x ; x--) { if (curx == maxx - 1) break; curx++; } } void report (char *argbuf,int arglen,char cmd) { /* you figure out how to implement it ... */ } void save_pos (char *argbuf,int arglen,char cmd) { savx = curx; savy = cury; issaved = 1; } void restore_pos (char *argbuf,int arglen,char cmd) { if(issaved) { curx = savx; cury = savy; issaved = 0; } } void clear_screen (char *argbuf,int arglen,char cmd) { /* needs error checking */ clearwindow(0,0,maxx - 1,maxy - 1,curattr); curx = cury = 0; } void kill_line (char *argbuf,int arglen,char cmd) { cleartoeol(curx,cury,maxx - 1,curattr); } void set_colors (char *argbuf,int arglen,char cmd) { char *p,*pp; if (*argbuf && arglen) { pp = argbuf; do { p = strchr(pp,';'); if (p && *p) { *p = 0; p++; } switch (atoi(pp)) { case 0: /* all attributes off */ curattr = 7; break; case 1: /* bright on */ curattr |= 8; break; case 2: /* faint on */ curattr &= (~8); break; case 3: /* italic on */ break; case 5: /* blink on */ curattr |= 128; break; case 6: /* rapid blink on */ break; case 7: /* reverse video on */ curattr = 112; break; case 8: /* concealed on */ curattr = 0; break; case 30: /* black fg */ curattr &= (~7); break; case 31: /* red fg */ curattr &= (~7); curattr |= 4; break; case 32: /* green fg */ curattr &= (~7); curattr |= 2; break; case 33: /* yellow fg */ curattr &= (~7); curattr |= 6; break; case 34: /* blue fg */ curattr &= (~7); curattr |= 1; break; case 35: /* magenta fg */ curattr &= (~7); curattr |= 5; break; case 36: /* cyan fg */ curattr &= (~7); curattr |= 3; break; case 37: /* white fg */ curattr |= 7; break; case 40: /* black bg */ curattr &= (~112); break; case 41: /* red bg */ curattr &= (~112); curattr |= (4 << 4); break; case 42: /* green bg */ curattr &= (~112); curattr |= (2 << 4); break; case 43: /* yellow bg */ curattr &= (~112); curattr |= (6 << 4); break; case 44: /* blue bg */ curattr &= (~112); curattr |= (1 << 4); break; case 45: /* magenta bg */ curattr &= (~112); curattr |= (5 << 4); break; case 46: /* cyan bg */ curattr &= (~112); curattr |= (3 << 4); break; case 47: /* white bg */ curattr |= 112; break; case 48: /* subscript bg */ break; case 49: /* superscript bg */ break; default: /* unsupported */ break; } pp = p; } while (p); } } int ansi_out (char *buf) { int arglen = 0, ansistate = NOTHING, x; char *b = buf, argbuf[MAXARGLEN] = ""; /* cursor is off while string is being displayed so we don't have to keep updating it. works to our detriment only if using BIOS writes under MS-DOS */ hardcursor_off(); if (!useansi) /* is ANSI interp on? */ { ansistate = NOTHING; arglen = 0; *argbuf = 0; } while (*b) { switch (ansistate) { case NOTHING: switch (*b) { case '\x1b': if (useansi) { ansistate = WASESCAPE; break; } case '\r': curx = 0; break; case '\n': cury++; if (cury > maxy - 1) { scroll_up(0,0,maxx - 1,maxy - 1,curattr); cury--; } break; case '\t': /* so _you_ figure out what to do... */ for (x = 0; x < tabspaces; x++) { put_char(' ',curattr,curx,cury); curx++; if (curx > maxx - 1) { curx = 0; cury++; if (cury > maxy - 1) { scroll_up(0, 0, maxx - 1, maxy - 1, curattr); cury--; } } } break; case '\b': if (curx) { curx--; } break; case '\07': /* usually a console bell */ putchar('\07'); break; default: put_char(*b,curattr,curx,cury); curx++; if (curx > maxx - 1) { curx = 0; cury++; if (cury > maxy - 1) { scroll_up(0,0,maxx - 1,maxy - 1,curattr); cury--; } } break; } break; case WASESCAPE: if (*b == '[') { ansistate = WASBRKT; arglen = 0; *argbuf = 0; break; } ansistate = NOTHING; break; case WASBRKT: if (strchr(ansi_terminators, (int)*b)) { switch ((int)*b) { case 'H': /* set cursor position */ case 'F': set_pos(argbuf,arglen,*b); break; case 'A': /* up */ go_up(argbuf,arglen,*b); break; case 'B': /* down */ go_down(argbuf,arglen,*b); break; case 'C': /* right */ go_right(argbuf,arglen,*b); break; case 'D': /* left */ go_left(argbuf,arglen,*b); break; case 'n': /* report pos */ report(argbuf,arglen,*b); break; case 's': /* save pos */ save_pos(argbuf,arglen,*b); break; case 'u': /* restore pos */ restore_pos(argbuf,arglen,*b); break; case 'J': /* clear screen */ clear_screen(argbuf,arglen,*b); break; case 'K': /* delete to eol */ kill_line(argbuf,arglen,*b); break; case 'm': /* set video attribs */ set_colors(argbuf,arglen,*b); break; case 'p': /* keyboard redef -- disallowed */ break; default: /* unsupported */ break; } ansistate = NOTHING; arglen = 0; *argbuf = 0; } else { if (arglen < MAXARGLEN) { argbuf[arglen] = *b; argbuf[arglen + 1] = 0; arglen++; } } break; default: pos_hardcursor(curx,cury); fputs("\n **Error in ANSI state machine.\n",stderr); break; } b++; } pos_hardcursor(curx,cury); hardcursor_on(curx,cury); return ((int)b - (int)buf); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/doansi_2.c�������������������������������������������0000755�0000764�0000144�00000011070�07055333730�016140� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** DOANSI_2.C - OS-Specific ANSI screen code interpreter functions ** ** From DRSK_105.LZH (ansi.c), hereby declared free for use for whatever ** purposes by author: Mark Kimes */ #ifdef OS2 #define INCL_DOS #define INCL_VIO #include <os2.h> int vidhandle = 0; /* can be changed for AVIO */ void set_screensize (int reservedlines) { VIOMODEINFO vm; vm.cb = sizeof(VIOMODEINFO); VioGetMode(&vm, vidhandle); maxx = vm.col; maxy = vm.row - reservedlines; realmaxx = maxx; realmaxy = vm.row; } void pos_hardcursor (int x,int y) { VioSetCurPos(y,x,vidhandle); } void hardcursor_off (void) { VIOCURSORINFO vc; VioGetCurType(&vc,vidhandle); vc.attr = -1; VioSetCurType(&vc,vidhandle); } void hardcursor_on (int x,int y) { VIOCURSORINFO vc; VioGetCurType(&vc,vidhandle); vc.attr = 0; VioSetCurType(&vc,vidhandle); VioSetCurPos(y,x,vidhandle); } void put_char (char c, char attr, int x, int y) { VioWrtCharStrAtt(&c,1,y,x,&attr,vidhandle); } void scroll_up (int tx,int ty,int bx,int by,char attr) { int attrib = ' ' | (attr << 8); VioScrollUp(ty,tx,by,bx,1,(char *)&attrib,vidhandle); } void clearwindow (int tx,int ty,int bx,int by,char attr) { int attrib = ' ' | (attr << 8); VioScrollUp(ty,tx,by,bx,-1,(char *)&attrib,vidhandle); } void cleartoeol (int x,int y,int ex,char attr) { int attrib = ' ' | (attr << 8); VioScrollUp(y,x,y,ex,-1,(char *)&attrib,vidhandle); } #else /* MS-DOS -- (urp) */ #include <dos.h> #if !defined(MK_FP) #define MK_FP(seg,off) ((void far *)(((long)(seg) << 16)|(unsigned)(off))) #endif static int far *vseg; int realmaxy,realmaxx; char usebios = 0; /* if true, output through BIOS */ int vmode (void) { union REGS r; r.h.ah = 15; r.x.bx = 0; int86(0x10,&r,&r); return r.h.al; } void set_screensize (int reservedlines) { union REGS r; unsigned int vbase; r.h.ah = 0x0f; r.x.bx = 0; int86 (0x10, &r, &r); maxx = (int) r.h.ah; if (maxx < 80) /* gimme a break! */ { r.x.ax = 0x0003; int86(0x10,&r,&r); maxx = 80; } realmaxx = maxx; r.x.ax = 0x1130; r.x.dx = maxy; int86 (0x10, &r, &r); realmaxy = maxy = (r.x.dx == 0) ? 25 : (r.x.dx + 1); maxy -= reservedlines; vbase = (vmode () == 7 ? 0xb000 : 0xb800); vseg = MK_FP(vbase,0); /* address of video ram as pointer */ } void pos_hardcursor (int x,int y) { union REGS r; r.x.ax = 0x0200; r.x.bx = 0; r.x.dx = ((y << 8) & 0xff00) + x; int86(0x10,&r,&r); } void hardcursor_off (void) { union REGS r; r.x.ax = 0x0200; r.x.bx = 0; r.x.dx = ((realmaxy << 8) & 0xff00); int86(0x10,&r,&r); } void hardcursor_on (int x,int y) { union REGS r; r.x.ax = 0x0200; r.x.bx = 0; r.x.dx = ((y << 8) & 0xff00) + x; int86(0x10,&r,&r); } void put_char (char c, char attr, int x, int y) { if(!usebios) { register int far *v; /* point v to right spot in vid RAM */ v = vseg + ((y * realmaxx) + x); *v = (c | (attr << 8)); /* display */ } else { union REGS r; r.x.ax = 0x0200; r.x.bx = 0; r.x.dx = ((y << 8) & 0xff00) + x; int86(0x10,&r,&r); r.h.ah = 0x09; r.h.bh = 0; r.h.bl = attr; r.x.cx = 1; r.h.al = c; int86(0x10,&r,&r); } } void scroll_up (int tx,int ty,int bx,int by,char attr) { union REGS r; r.h.ah = 6; r.h.al = 1; r.h.bh = attr; r.h.cl = tx; r.h.ch = ty; r.h.dl = bx; r.h.dh = by; int86(0x10,&r,&r); } void clearwindow (int tx,int ty,int bx,int by,char attr) { union REGS r; r.h.ah = 6; r.h.al = 0; r.h.bh = attr; r.h.cl = tx; r.h.ch = ty; r.h.dl = bx; r.h.dh = by; int86(0x10,&r,&r); } void cleartoeol (int x,int y,int ex,char attr) { union REGS r; r.h.ah = 6; r.h.al = 0; r.h.bh = attr; r.h.cl = x; r.h.ch = y; r.h.dl = ex; r.h.dh = y; int86(0x10,&r,&r); } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/uuencode.c�������������������������������������������0000755�0000764�0000144�00000006227�07055334315�016261� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* uuencode.c */ /* uudecode and uuencode are easily implemented under MSDOS as well. Here are the sources for Microsoft C v3.0, but if you have another kind of C compiler, there should be perhaps only 1 change -- the output file of uudecode and the input file of uuencode must be in binary format. (ie. binary files, like .EXE files may have byte patterns that are the same as ^Z, which signals end-of-file in non-binary (text) mode). Don Kneller UUCP: ...ucbvax!ucsfcgl!kneller ARPA: kneller@ucsf-cgl.ARPA BITNET: kneller@ucsfcgl.BITNET patched up for BC++ 3.1 by Alan Eldridge 10/12/92 (UUCP: alane@wozzle.linet.org, FIDO: 1:272/38.473) */ #ifndef lint #ifndef MSDOS static char sccsid[] = "@(#)uuencode.c 5.1 (Berkeley) 7/2/83"; #endif #endif /* * uuencode [input] output * * Encode a file so it can be mailed to a remote system. */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> /* ENC is the basic 1 character encoding function to make a char printing */ #define ENC(c) (((c) & 077) + ' ') void encode(FILE *in, FILE *out); void outdec(char *p, FILE *f); int fr(FILE *fd, char *buf, int cnt); main(int argc, char *argv[]) { FILE *in; struct stat sbuf; int mode; /* optional 1st argument */ if (argc > 2) { #ifdef MSDOS /* Use binary mode */ if ((in = fopen(argv[1], "rb")) == NULL) { #else if ((in = fopen(argv[1], "r")) == NULL) { #endif perror(argv[1]); exit(1); } argv++; argc--; } else in = stdin; if (argc != 2) { printf("Usage: uuencode [infile] remotefile\n"); exit(2); } /* figure out the input file mode */ fstat(fileno(in), &sbuf); mode = sbuf.st_mode & 0777; printf("begin %o %s\n", mode, argv[1]); encode(in, stdout); printf("end\n"); return 0; } /* * copy from in to out, encoding as you go along. */ void encode(FILE *in, FILE *out) { char buf[80]; int i, n; for (;;) { /* 1 (up to) 45 character line */ n = fr(in, buf, 45); putc(ENC(n), out); for (i = 0; i < n; i += 3) outdec(&buf[i], out); putc('\n', out); if (n <= 0) break; } } /* * output one group of 3 bytes, pointed at by p, on file f. */ void outdec(char *p, FILE *f) { int c1, c2, c3, c4; c1 = *p >> 2; c2 = ((p[0] << 4) & 060) | ((p[1] >> 4) & 017); c3 = ((p[1] << 2) & 074) | ((p[2] >> 6) & 03); c4 = p[2] & 077; putc(ENC(c1), f); putc(ENC(c2), f); putc(ENC(c3), f); putc(ENC(c4), f); } /* fr: like read but stdio */ int fr(FILE *fd, char *buf, int cnt) { int c, i; for (i = 0; i < cnt; i++) { c = getc(fd); if (c == EOF) return(i); buf[i] = (char)c; } return (cnt); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/fndislot.c�������������������������������������������0000755�0000764�0000144�00000002057�07055333764�016300� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Originally published as part of the MicroFirm Function Library ** ** Copyright 1990, Robert B.Stout ** ** Subset version released to the public domain, 1992 ** ** Function to locate an unused user interrupt vector. */ #ifdef __ZTC__ #include <int.h> #else #include <dos.h> #ifdef __TURBOC__ #define GETVECT getvect #define FAR far #define INTERRUPT interrupt #else /* assume MSC */ #define GETVECT _dos_getvect #define FAR _far #define INTERRUPT _interrupt #endif #define FNULL (void (FAR *)())(0L) #endif unsigned findIslot(void) { #ifdef __ZTC__ unsigned int_no, seg, ofs; for (int_no = 0x60; int_no < 0x6f; ++int_no) { int_getvector(int_no, &seg, &ofs); if (0U == (seg | ofs)) return int_no; } #else /* MSC/BC/TC */ unsigned int_no; for (int_no = 0x60; int_no < 0x6f; ++int_no) { if (FNULL != (void (FAR *)())GETVECT(int_no)) return int_no; } #endif return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rg_qsort.c1������������������������������������������0000755�0000764�0000144�00000015240�07055334206�016365� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/******************************************************************/ /* qsort.c -- Non-Recursive ANSI Quicksort function */ /* */ /* Public domain by Raymond Gardner, Englewood CO February 1991 */ /* */ /* Usage: */ /* qsort(base, nbr_elements, width_bytes, compare_function); */ /* void *base; */ /* size_t nbr_elements, width_bytes; */ /* int (*compare_function)(const void *, const void *); */ /* */ /* Sorts an array starting at base, of length nbr_elements, each */ /* element of size width_bytes, ordered via compare_function, */ /* which is called as (*compare_function)(ptr_to_element1, */ /* ptr_to_element2) and returns < 0 if element1 < element2, */ /* 0 if element1 = element2, > 0 if element1 > element2. */ /* Most refinements are due to R. Sedgewick. See "Implementing */ /* Quicksort Programs", Comm. ACM, Oct. 1978, and Corrigendum, */ /* Comm. ACM, June 1979. */ /******************************************************************/ #include <stddef.h> /* for size_t definition */ /* prototypes */ void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); void swap_chars(char *, char *, size_t); /* ** Compile with -DSWAP_INTS if your machine can access an int at an ** arbitrary location with reasonable efficiency. (Some machines ** cannot access an int at an odd address at all, so be careful.) */ #ifdef SWAP_INTS void swap_ints(char *, char *, size_t); #define SWAP(a, b) (swap_func((char *)(a), (char *)(b), width)) #else #define SWAP(a, b) (swap_chars((char *)(a), (char *)(b), size)) #endif #define COMP(a, b) ((*comp)((void *)(a), (void *)(b))) #define T 7 /* subfiles of T or fewer elements will */ /* be sorted by a simple insertion sort */ /* Note! T must be at least 3 */ void qsort(void *basep, size_t nelems, size_t size, int (*comp)(const void *, const void *)) { char *stack[40], **sp; /* stack and stack pointer */ char *i, *j, *limit; /* scan and limit pointers */ size_t thresh; /* size of T elements in bytes */ char *base; /* base pointer as char * */ #ifdef SWAP_INTS size_t width; /* width of array element */ void (*swap_func)(char *, char *, size_t); /* swap func pointer*/ width = size; /* save size for swap routine */ swap_func = swap_chars; /* choose swap function */ if ( size % sizeof(int) == 0 ) { /* size is multiple of ints */ width /= sizeof(int); /* set width in ints */ swap_func = swap_ints; /* use int swap function */ } #endif base = (char *)basep; /* set up char * base pointer */ thresh = T * size; /* init threshold */ sp = stack; /* init stack pointer */ limit = base + nelems * size;/* pointer past end of array */ for ( ;; ) { /* repeat until break... */ if ( limit - base > thresh ) { /* if more than T elements */ /* swap base with middle */ SWAP((((limit-base)/size)/2)*size+base, base); i = base + size; /* i scans left to right */ j = limit - size; /* j scans right to left */ if ( COMP(i, j) > 0 ) /* Sedgewick's */ SWAP(i, j); /* three-element sort */ if ( COMP(base, j) > 0 ) /* sets things up */ SWAP(base, j); /* so that */ if ( COMP(i, base) > 0 ) /* *i <= *base <= *j */ SWAP(i, base); /* *base is pivot element */ for ( ;; ) { /* loop until break */ do /* move i right */ i += size; /* until *i >= pivot */ while ( COMP(i, base) < 0 ); do /* move j left */ j -= size; /* until *j <= pivot */ while ( COMP(j, base) > 0 ); if ( i > j ) /* if pointers crossed */ break; /* break loop */ SWAP(i, j); /* else swap elements, keep scanning*/ } SWAP(base, j); /* move pivot into correct place */ if ( j - base > limit - i ) { /* if left subfile larger */ sp[0] = base; /* stack left subfile base */ sp[1] = j; /* and limit */ base = i; /* sort the right subfile */ } else { /* else right subfile larger*/ sp[0] = i; /* stack right subfile base */ sp[1] = limit; /* and limit */ limit = j; /* sort the left subfile */ } sp += 2; /* increment stack pointer */ } else { /* else subfile is small, use insertion sort */ for ( j = base, i = j+size; i < limit; j = i, i += size ) for ( ; COMP(j, j+size) > 0; j -= size ) { SWAP(j, j+size); if ( j == base ) break; } if ( sp != stack ) { /* if any entries on stack */ sp -= 2; /* pop the base and limit */ base = sp[0]; limit = sp[1]; } else /* else stack empty, done */ break; } } } /* ** swap nbytes between a and b */ static void swap_chars(char *a, char *b, size_t nbytes) { char tmp; do { tmp = *a; *a++ = *b; *b++ = tmp; } while ( --nbytes ); } #ifdef SWAP_INTS /* ** swap nints between a and b */ static void swap_ints(char *ap, char *bp, size_t nints) { int *a = (int *)ap, *b = (int *)bp; int tmp; do { tmp = *a; *a++ = *b; *b++ = tmp; } while ( --nints ); } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rg_qsort.c2������������������������������������������0000755�0000764�0000144�00000002057�07055334207�016371� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** quicksort.c -- quicksort integer array ** ** public domain by Raymond Gardner 12/91 */ static void swap(int *a, int *b) { register int t; t = *a; *a = *b; *b = t; } void quicksort(int v[], unsigned n) { unsigned i, j, ln, rn; while (n > 1) { swap(&v[0], &v[n/2]); for (i = 0, j = n; ; ) { do --j; while (v[j] > v[0]); do ++i; while (i < j && v[i] < v[0]); if (i >= j) break; swap(&v[i], &v[j]); } swap(&v[j], &v[0]); ln = j; rn = n - ++j; if (ln < rn) { quicksort(v, ln); v += j; n = rn; } else { quicksort(v + j, rn); n = ln; } } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/int2e.asm��������������������������������������������0000755�0000764�0000144�00000002757�07055334017�016034� �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� PAGE 55,132 .LIST ; ; Interrupt 2Eh Call ; ; From information originally published in ; PC magazine, April 28, 1987. Requires ; MASM 5.1 or later. ; ; Adapted by Bob Stout. ; ; NOTES: INT 2Eh passes a formatted command line ; directly to the resident portion of ; COMMAND.COM for execution. It functions ; similarly to the 'EXEC' function in DOS ; but is generally quicker. This is an ; undocumented DOS function and is subject ; to change in future releases of DOS. It ; also aborts any .BAT file which invokes ; a program which uses it. Use with care! ; ; Assemble with: MASM /Mx /z ... ; TASM /jMASM /mx /z ... ; % .MODEL memodel,C ;Add model support via ;command line macros, e.g. ;MASM /Mx /Dmemodel=LARGE .CODE PUBLIC _Int_2E _Int_2E PROC USES SI DI DS ES, command:PTR Mov CS:SaveSP,SP Mov CS:SaveSS,SS IF @DataSize Lds SI,command ELSE Mov SI,command Endif Int 2Eh Mov AX,CS:SaveSS Mov SS,AX Mov SP,CS:SaveSP Ret SaveSS Dw ? SaveSP Dw ? _Int_2E ENDP End �����������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rmlead.c���������������������������������������������0000755�0000764�0000144�00000001024�07055334212�015700� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Originally published as part of the MicroFirm Function Library ** ** Copyright 1986, S.E. Margison ** Copyright 1989, Robert B.Stout ** ** Subset version released to the public domain, 1991 ** ** remove leading whitespace from a string */ #include <ctype.h> #include <string.h> #define NUL '\0' char *rmlead(char *str) { char *obuf; for (obuf = str; obuf && *obuf && isspace(*obuf); ++obuf) ; if (str != obuf) strcpy(str, obuf); return str; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rg_isort.c�������������������������������������������0000755�0000764�0000144�00000000644�07055334204�016274� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** insort() -- insertion sort an array of string pointers via strcmp() ** public domain by Ray Gardner Denver, CO 12/91 */ void strsort(char **v, int n) { int i, j; char *vtmp; for (i = 1; i < n; ++i) { vtmp = v[i]; for ( j = i - 1; j >= 0 && strcmp(v[j], vtmp) > 0; --j ) v[j+1] = v[j]; v[j+1] = vtmp; } } ��������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/c_prec.txt�������������������������������������������0000755�0000764�0000144�00000010022�07055333666�016276� �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Operator Precedence and Associativity Rules in C / C++ ============================================================================ :: scope resolution (C++, e.g. name::member) left-to-right :: global (C++, e.g. ::name) ---------------------------------------------------------------------------- ( ) function call left-to-right [ ] array element . class, structure or union member -> pointer reference to member :: scope access / resolution (C++) sizeof size of object in bytes sizeof size of type in bytes ---------------------------------------------------------------------------- ++ post increment (lvalue++) right-to-left ++ pre increment (++lvalue) -- post decrement (lvalue--) -- pre decrement (--lvalue) ~ bitwise complement ! logical not - unary minus + unary plus & address of * contents of new create object (C++) delete destroy object (C++) delete[] destroy array (C++) (type) cast to type ---------------------------------------------------------------------------- .* member pointer (C++) left-to-right ->* pointer reference to member pointer (C++) ---------------------------------------------------------------------------- * multiply left-to-right / divide % remainder ---------------------------------------------------------------------------- + add left-to-right - subtract ---------------------------------------------------------------------------- << bitwise left shift left-to-right >> bitwise right shift ---------------------------------------------------------------------------- < scalar less than left-to-right <= scalar less than or equal to > scalar greater than >= scalar greater than or equal to ---------------------------------------------------------------------------- == scalar equal left-to-right != scalar not equal ---------------------------------------------------------------------------- & bitwise and left-to-right ---------------------------------------------------------------------------- ^ bitwise exclusive or left-to-right ---------------------------------------------------------------------------- | bitwise or left-to-right ---------------------------------------------------------------------------- && logical and left-to-right ---------------------------------------------------------------------------- || logical inclusive or left-to-right ---------------------------------------------------------------------------- ? : conditional expression right-to-left ---------------------------------------------------------------------------- = assignment operator right-to-left also += -= *= /= %= &= ^= |= >>= <<= ---------------------------------------------------------------------------- , sequential expression left-to-right ---------------------------------------------------------------------------- All of the operators in this table can be overloaded (C++) except: . C++ direct component selector .* C++ dereference :: C++ scope access/resolution ?: Conditional ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/vidport.c��������������������������������������������0000755�0000764�0000144�00000004636�07055334321�016140� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Portable PC screen functions ** Public domain by Bob Stout ** Uses SCROLL.C, also from SNIPPETS */ #include <stdio.h> #include <dos.h> #include "scrnmacs.h" /* Also in SNIPPETS */ void GotoXY(int col, int row) { union REGS regs; setbuf(stdout, NULL); regs.h.dh = (unsigned)row; regs.h.dl = (unsigned)col; regs.h.bh = VIDPAGE; regs.h.ah = 2; int86(0x10, ®s, ®s); } void ClrScrn(int vattrib) { scroll(SCROLL_UP, 0, vattrib, 0, 0, SCREENROWS, SCREENCOLS); GotoXY(0, 0); /* Home cursor */ } void GetCurPos(int *col, int *row) { union REGS regs; regs.h.ah = 0x03; regs.h.bh = VIDPAGE; int86(0x10, ®s, ®s); *row = regs.h.dh; *col = regs.h.dl; } int GetCurAtr(void) { int row, col; unsigned short chat; GetCurPos(&col, &row); chat = *((unsigned FAR *)MK_FP(SCREENSEG, (row * SCREENCOLS + col) << 1)); return (chat >> 8); } void ClrEol(void) { int row, col; GetCurPos(&col, &row); scroll(0, 0, GetCurAtr(), row, col, row, SCREENCOLS); } void ClrEop(void) { int row, col; GetCurPos(&col, &row); ClrEol(); if (++row < SCREENROWS) scroll(0, 0, GetCurAtr(), row, 0, SCREENROWS, SCREENCOLS); } void Repaint(int vattrib) { unsigned short FAR *screen = SCRBUFF; int row, col; for (row = 0; row < SCREENROWS; ++row) { for (col = 0; col < SCREENCOLS; ++col, ++screen) *screen = (*screen & 0xff) + (vattrib << 8); } } #ifdef TEST #include <conio.h> /* ** Run this test with a screenful of misc. stuff */ main() { int vatr = GetCurAtr(); GotoXY(1, 1); fputs("Testing ClrEol()", stderr); ClrEol(); fputs("\nHit any key to continue...\n", stderr); getch(); fputs("Testing ClrEop()", stderr); ClrEop(); fputs("\nHit any key to continue...\n", stderr); getch(); ClrScrn(vatr); GotoXY(0, 0); fputs("ClrScrn() tested", stderr); fputs("\nHit any key to continue...\n", stderr); getch(); Repaint(BG_(CYAN) | BLACK); fputs("Repaint() tested", stderr); fputs("\nHit any key to continue...\n", stderr); getch(); Repaint(vatr); } #endif ��������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/filcount.c�������������������������������������������0000755�0000764�0000144�00000004573�07055333756�016307� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** FILCOUNT.C - counts directories and /or files in a directory ** ** public domain demo by Bob Stout */ #include <stdio.h> #include <string.h> #undef TRUE #undef FALSE typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL; #ifdef __ZTC__ #include <dos.h> #elif defined(__TURBOC__) #include <dir.h> #include <dos.h> #define _dos_findfirst(f,a,b) findfirst(f,b,a) #define _dos_findnext(b) findnext(b) #define find_t ffblk #define _A_SUBDIR FA_DIREC #define attrib ff_attrib #define name ff_name #else /* assume MSC/QC */ #include <dos.h> #include <errno.h> #endif #undef SUCCESS #define SUCCESS 0 #define LAST_CHAR(str) (str)[strlen(str) - 1] unsigned DirCount = 0, FileCount = 0; /* ** Arguments: 1 - directory to search ** 2 - search subdirectories: TRUE or FALSE */ void do_dir(char *path, int recurse_flag) { char search[67], new[67]; struct find_t ff; strcpy(search, path); if ('\\' != LAST_CHAR(search)) strcat(search, "\\"); strcat(search, "*.*"); if (SUCCESS == _dos_findfirst(search, 0xff, &ff)) do { if ('.' == *ff.name) continue; if (ff.attrib & _A_SUBDIR) { DirCount++; if (recurse_flag) { strcpy(new, path); if ('\\' != LAST_CHAR(new)) strcat(new, "\\"); strcat(new, ff.name); do_dir(new, recurse_flag); } } else FileCount++; } while (SUCCESS == _dos_findnext(&ff)); } /* ** Simple resursive file/directory counter ** ** Usage: FILCOUNT [path_name] [{Y | N}] ** ** Notes: 1. If a path name isn't specified, the current directory is assumed ** 2. Default recursion flag is FALSE ** 3. Path must be specified in order to specify the recursion flag */ void main(int argc, char *argv[]) { char *Dir ="."; LOGICAL recurse = FALSE; if (1 < argc) Dir = argv[1]; if (2 < argc) recurse = (NULL != strchr("Yy", *argv[2])); do_dir(Dir, recurse); printf("Counted: %d Directories and %d Files\n", DirCount, FileCount); } �������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/roman.c����������������������������������������������0000755�0000764�0000144�00000003471�07055334212�015560� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * * ROMAN.C - Converts integers to Roman numerals * * Written by: Jim Walsh * * Compiler : Microsoft QuickC v2.5 * * This Program Is Released To The Public Domain * */ #include <stdio.h> #include <stdlib.h> #include <string.h> int main( int argc, char *argv[] ) { int value, dvalue; char roman[80]; roman[0] = '\0'; if( argc == 2 ) value = atoi( argv[1] ); else { printf( "\nEnter an integer value: " ); scanf( "%d", &value ); } dvalue = value; while( value >= 1000 ) { strcat( roman, "M" ); value -= 1000; } if( value >= 900 ) { strcat( roman, "CM" ); value -= 900; } while( value >= 500 ) { strcat( roman, "D" ); value -= 500; } if( value >= 400 ) { strcat( roman, "CD" ); value -= 400; } while( value >= 100 ) { strcat( roman, "C" ); value -= 100; } if( value >= 90 ) { strcat( roman, "XC" ); value -= 90; } while( value >= 50 ) { strcat( roman, "L" ); value -= 50; } if( value >= 40 ) { strcat( roman, "XL" ); value -= 40; } while( value >= 10 ) { strcat( roman, "X" ); value -= 10; } if( value >= 9 ) { strcat( roman, "IX" ); value -= 9; } while( value >= 5 ) { strcat( roman, "V" ); value -= 5; } if( value >= 4 ) { strcat( roman, "IV" ); value -= 4; } while( value > 0 ) { strcat( roman, "I" ); value--; } printf( "\n%d = %s\n", dvalue, roman ); return(0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/strrepl.c��������������������������������������������0000755�0000764�0000144�00000003744�07055334266�016153� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* -------------------------------------------------------------------- Module: REPLACE.C Author: Gilles Kohl Started: 09.06.1992 12:16:47 Modified: 09.06.1992 12:41:41 Subject: Replace one string by another in a given buffer. This code is public domain. Use freely. -------------------------------------------------------------------- */ #include <stdio.h> #include <stdlib.h> #include <string.h> /* * StrReplace: Replace OldStr by NewStr in string Str. * * Str should have enough allocated space for the replacement, no check * is made for this. Str and OldStr/NewStr should not overlap. * The empty string ("") is found at the beginning of every string. * * Returns: pointer to first location behind where NewStr was inserted * or NULL if OldStr was not found. * This is useful for multiple replacements, see example in main() below * (be careful not to replace the empty string this way !) */ char *StrReplace(char *Str, char *OldStr, char *NewStr) { int OldLen, NewLen; char *p, *q; if(NULL == (p = strstr(Str, OldStr))) return p; OldLen = strlen(OldStr); NewLen = strlen(NewStr); memmove(q = p+NewLen, p+OldLen, strlen(p+OldLen)+1); memcpy(p, NewStr, NewLen); return q; } #ifdef TEST /* * Test main(). * Given two arguments, replaces the first arg. in the lines read from * stdin by the second one. * Example invocation: * replace printf puts <replace.c * will replace all printf's by puts in replace's source. * */ int main(int argc, char *argv[]) { char buf[200]; char *Start; if(argc != 3) exit(1); /* Repeat until all occurences replaced */ while(NULL != (Start = gets(buf))) { while(NULL != (Start = StrReplace(Start, argv[1], argv[2]))) ; printf("%s\n", buf); } return 0; } #endif TEST ����������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/round.h����������������������������������������������0000755�0000764�0000144�00000000342�07055334212�015572� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** rounding macros by Dave Knapp & Thad Smith */ /* round to integer */ #define iround(x) floor((x)+0.5) /* round number n to d decimal points */ #define fround(n,d) (floor((n)*pow(10.,(d))+.5)/pow(10.,(d))) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/todaybak.c�������������������������������������������0000755�0000764�0000144�00000004336�07055334305�016246� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** TODAYBAK.C - Back up today's work to a specified floppy ** ** public domain demo by Bob Stout */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dos.h> #if defined(__ZTC__) && (__ZTC__ < 0x600) #define _dos_getdate dos_getdate #define _dos_setdate dos_setdate #define _dosdate_t dos_date_t #endif #ifdef __TURBOC__ #define _dosdate_t dosdate_t #endif #ifndef SUCCESS #define SUCCESS 0 #endif #ifndef CAST #define CAST(new_type,old_object) (*((new_type *)&(old_object))) #endif #define LAST_CHAR(s) (((char *)s)[strlen(s) - 1]) struct DOS_DATE { unsigned int da : 5; unsigned int mo : 4; unsigned int yr : 7; } ; struct _dosdate_t today; struct DOS_DATE ftoday; char drive; void do_dir(char *); void usage(void); int main(int argc, char *argv[]) { int i; _dos_getdate(&today); ftoday.da = today.day; ftoday.mo = today.month; ftoday.yr = today.year - 1980; if (2 > argc) usage(); drive = *argv[1]; if (!strchr("AaBb", drive)) usage(); if (3 > argc) do_dir("."); else for (i = 2; i < argc; ++i) do_dir(argv[i]); return EXIT_SUCCESS; } void usage(void) { puts("usage: TODAYBAK floppy [dir1] [...dirN]"); puts(" Copies today's files to the specified floppy."); puts(" floppy = 'A' | 'B'"); puts(" with no directories specified, " "uses current directory"); exit(EXIT_FAILURE); } void do_dir(char *path) { char search[67]; struct find_t ff; strcat(strcpy(search, path), "\\*.*"); if (SUCCESS == _dos_findfirst(search, 0xff, &ff)) do { if (!(ff.attrib & _A_SUBDIR) && '.' != *ff.name) { if (ff.wr_date == CAST(unsigned short, ftoday)) { char cmd[128]; sprintf(cmd, "COPY %s\\%s %c: > NUL", path, ff.name, drive); system(cmd); } } } while (SUCCESS == _dos_findnext(&ff)); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/toascii.c��������������������������������������������0000755�0000764�0000144�00000004576�07055334304�016110� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������int ascii2ebcdic[256] = { 0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 37, 11, 12, 13, 14, 15, 16, 17, 18, 19, 60, 61, 50, 38, 24, 25, 63, 39, 28, 29, 30, 31, 64, 79,127,123, 91,108, 80,125, 77, 93, 92, 78,107, 96, 75, 97, 240,241,242,243,244,245,246,247,248,249,122, 94, 76,126,110,111, 124,193,194,195,196,197,198,199,200,201,209,210,211,212,213,214, 215,216,217,226,227,228,229,230,231,232,233, 74,224, 90, 95,109, 121,129,130,131,132,133,134,135,136,137,145,146,147,148,149,150, 151,152,153,162,163,164,165,166,167,168,169,192,106,208,161, 7, 32, 33, 34, 35, 36, 21, 6, 23, 40, 41, 42, 43, 44, 9, 10, 27, 48, 49, 26, 51, 52, 53, 54, 8, 56, 57, 58, 59, 4, 20, 62,225, 65, 66, 67, 68, 69, 70, 71, 72, 73, 81, 82, 83, 84, 85, 86, 87, 88, 89, 98, 99,100,101,102,103,104,105,112,113,114,115,116,117, 118,119,120,128,138,139,140,141,142,143,144,154,155,156,157,158, 159,160,170,171,172,173,174,175,176,177,178,179,180,181,182,183, 184,185,186,187,188,189,190,191,202,203,204,205,206,207,218,219, 220,221,222,223,234,235,236,237,238,239,250,251,252,253,254,255 }; int ebcdic2ascii[256] = { 0, 1, 2, 3,156, 9,134,127,151,141,142, 11, 12, 13, 14, 15, 16, 17, 18, 19,157,133, 8,135, 24, 25,146,143, 28, 29, 30, 31, 128,129,130,131,132, 10, 23, 27,136,137,138,139,140, 5, 6, 7, 144,145, 22,147,148,149,150, 4,152,153,154,155, 20, 21,158, 26, 32,160,161,162,163,164,165,166,167,168, 91, 46, 60, 40, 43, 33, 38,169,170,171,172,173,174,175,176,177, 93, 36, 42, 41, 59, 94, 45, 47,178,179,180,181,182,183,184,185,124, 44, 37, 95, 62, 63, 186,187,188,189,190,191,192,193,194, 96, 58, 35, 64, 39, 61, 34, 195, 97, 98, 99,100,101,102,103,104,105,196,197,198,199,200,201, 202,106,107,108,109,110,111,112,113,114,203,204,205,206,207,208, 209,126,115,116,117,118,119,120,121,122,210,211,212,213,214,215, 216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231, 123, 65, 66, 67, 68, 69, 70, 71, 72, 73,232,233,234,235,236,237, 125, 74, 75, 76, 77, 78, 79, 80, 81, 82,238,239,240,241,242,243, 92,159, 83, 84, 85, 86, 87, 88, 89, 90,244,245,246,247,248,249, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,250,251,252,253,254,255 }; ����������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/dirent.h���������������������������������������������0000755�0000764�0000144�00000005032�07055333721�015735� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** DIRENT.H - Posix compliant header ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #ifndef DIRENT_H #define DIRENT_H #include <stdio.h> /* For FILENAME_MAX */ #include <dos.h> #ifndef OS2 #if defined(__ZTC__) #define DSTRUCT FIND /* ZTC++/SC++ */ #define ATTRIBUTE attribute #define NAME name #define TIME time #define DATE date #define FSIZE size #pragma pack(1) #include <direct.h> #elif defined(__TURBOC__) #define DSTRUCT ffblk /* TC/C++ */ #define ATTRIBUTE ff_attrib #define NAME ff_name #define TIME ff_ftime #define DATE ff_fdate #define FSIZE ff_fsize #include <dir.h> #else #define DSTRUCT find_t /* Assume MSC/QC */ #define ATTRIBUTE attrib #define NAME name #define TIME time #define DATE date #define FSIZE size #pragma pack(1) #include <direct.h> #endif #else /* OS/2 */ #define INCL_DOSFILEMAN #include <os2.h> struct DSTRUCT { BYTE reserved[21]; BYTE ATTRIBUTE; FTIME TIME; FDATE DATE; ULONG FSIZE; CHAR NAME[13]; }; #endif #define FA_ANY 0xff #undef FA_DIREC #define FA_DIREC 0x10 /* ** Portable find first/next functions from RFIND1ST.C */ struct DSTRUCT *rfind_1st(char *, unsigned, struct DSTRUCT *); struct DSTRUCT *rfind_nxt(struct DSTRUCT *); typedef struct { int dd_fd; unsigned dd_loc, dd_size; struct DSTRUCT dd_buf; char dd_dirname[FILENAME_MAX]; } DOS_DIR; DOS_DIR *opendir(char *); int closedir(DOS_DIR *), rewinddir(DOS_DIR *); struct DSTRUCT *readdir(DOS_DIR *), *seekdir(DOS_DIR *, int, int); #define telldir(dd) dd->loc /* ** Other useful functions from DIRMASK.C and PATMAT.C */ int dirmask(struct DSTRUCT *,char *,char *,unsigned,unsigned); int patmat(const char *, const char *); extern int DFerr; extern DOS_DIR _DIRS[]; #endif /* DIRENT_H */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/strsort.c��������������������������������������������0000755�0000764�0000144�00000001616�07055334266�016174� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** strsort() -- Shell sort an array of string pointers via strcmp() ** public domain by Ray Gardner Denver, CO 12/88 */ #include <string.h> #include <stddef.h> void strsort (char **array, size_t array_size) { size_t gap, i, j; char **a, **b, *tmp; for (gap = 0; ++gap < array_size; ) gap *= 2; while (gap /= 2) { for (i = gap; i < array_size; i++) { for (j = i - gap; ;j -= gap) { a = array + j; b = a + gap; if (strcmp(*a, *b) <= 0) break; tmp = *a; *a = *b; *b = tmp; if (j < gap) break; } } } } ������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/kbflip.c���������������������������������������������0000755�0000764�0000144�00000004523�07055334033�015713� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** KBFLIP.C ** ** a public domain demo by: Bob Stout */ #include <stdio.h> #include <string.h> #include <ctype.h> #include <process.h> #ifdef __TURBOC__ #define FAR far #else #define FAR _far #endif #define SHOW(str) fputs(str"\n", stderr) #define BitSet(arg,posn) ((arg) | (1L << (posn))) #define BitClr(arg,posn) ((arg) & ~(1L << (posn))) #define LOCKS_POSN 4 #define BYTE unsigned char BYTE FAR *kb_status = (BYTE FAR *) 0x00400017; /* ** Tell the folks how this works */ void usage(void) { SHOW("Usage: KBFLIP {+|-}[switches] [...{+|-}[switches]]"); SHOW("Where \"switches\" are one or more of:"); SHOW(" +/-C - Turn Caps Lock on/off"); SHOW(" +/-N - Turn Num Lock on/off"); SHOW(" +/-S - Turn Scroll Lock on/off"); SHOW("Note switches may be upper or lower case\n"); SHOW("Example: \"KBFLIP +Cn -S\" turns Caps Lock and Num Lock on " "and Scroll lock off"); exit(-1); } /* ** The real works starts here ** ** This works by checking the user input against a string containing the ** allowable switch characters in the same relative positions they ** occupy in the BIOS data area, offset by 4 (LOCKS_POSN). ** ** Note that all changes are made to a copy of the BIOS data so any ** input errors will not cause incomplete changes to be applied. */ int main(int argc, char *argv[]) { int i, j; char *args = "SNC"; BYTE template = *kb_status; /* Make changes to copy */ if (2 > argc) /* Help 'em */ usage(); for (i = 1; i < argc; ++i) { if (NULL == strchr("+-", *argv[i])) usage(); for (j = 1; argv[i][j]; ++j) { char *found; if (NULL != (found = strchr(args, toupper(argv[i][j])))) { int posn = LOCKS_POSN + (found - args); if ('+' == *argv[i]) template = (BYTE)BitSet(template, posn); else template = (BYTE)BitClr(template, posn); } else usage(); } } *kb_status = template; /* Apply all changes */ return(0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/shel2dos.c�������������������������������������������0000755�0000764�0000144�00000002116�07055334224�016165� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** SHEL2DOS.C - Shell to DOS from a running program ** ** Original Copyright 1989-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is hereby donated to the public domain. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <process.h> int shell_to_DOS(void) { char *comspec, prompt[256], *oldprompt; int retval; comspec = getenv("COMSPEC"); if(comspec == NULL) comspec = "COMMAND.COM"; /* Better than nothing... */ sprintf(prompt, "PROMPT=[Type EXIT to return to program]\r\n%s", oldprompt = getenv("PROMPT")); putenv(prompt); retval = spawnlp(0, comspec, comspec, NULL); sprintf(prompt, "PROMPT=%s", oldprompt); putenv(prompt); return retval; } #ifdef TEST #include <stdio.h> void main(void) { int retval = shell_to_DOS(); printf("shell_to_DOS() returned %d\n", retval); retval = shell_to_DOS(); printf("shell_to_DOS() returned %d\n", retval); } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ansisys.c��������������������������������������������0000755�0000764�0000144�00000003532�07055333637�016145� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************** * * program that detects the presence (or absence) of an ANSI device driver. * * Returns: * * errorlevel 0: Ansi devicedriver not detected. * errorlevel 1: Ansi devicedriver detected. * ***************************************************************************** */ #include <stdio.h> #include <string.h> #include <conio.h> /********************************** print () ********************************* * * A dum print string routine * ***************************************************************************** */ void print(char *p) { while(*p) putchar(*p++); fflush(stdout); /* necessary for ZTC */ } /* print () */ /********************************** main () ********************************** * * Detect whether ANSI.SYS is present and return 1 if so, else returns 0 * ***************************************************************************** */ int main(void) { char buffer [31]; /* temporary buffer */ int nr=0; /* counter */ print("\x1b[6n\r \r"); /* ask for ansi device report */ while ((0 !=kbhit()) && (nr<30))/* read whatever input is present */ buffer[nr++] = (char)getch(); buffer[nr]='\0'; /* zero terminate string */ if (strstr(buffer, "\x1b[")) /* check precense of device report */ return 1; /* signal ANSI.SYS present */ else return 0; /* signal ANSI.SYS not present */ } /* main () */ /********************************** end *************************************/ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/playlib.c��������������������������������������������0000755�0000764�0000144�00000005371�07055334140�016101� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** PLAYLIB.C ** ** Public domain for TC only by Lynn R. Lively ** Modified by Bob Stout */ #include <dos.h> #include <stdlib.h> #include "sound.h" #ifdef __ZTC__ #include <int.h> #define interrupt #else static void (interrupt far *n_oldtmint) (void); #endif #define TIMER_TICK_INTR 0x1c static NOTE * n_buff; static unsigned n_buff_sz; static NOTE * n_head; static NOTE * n_tail; static unsigned play_duration; static unsigned play_freq; /* ** Add note to note buff. Return = 1 (note added), 0 (Out of note buff) */ int playb_note (unsigned freq, unsigned duration) { if (++n_tail == (n_buff + n_buff_sz)) n_tail = n_buff; if (n_tail == n_head) { --n_tail; return (0); } n_tail->freq = freq; n_tail->duration = duration; return (1); } /* ** ISR for background music. */ #ifndef __ZTC__ static void interrupt far play_intr (void) #else static int play_intr (struct INT_DATA *idp) #endif { int_off (); #ifndef __ZTC__ (*n_oldtmint) (); /* Call Old timer interrupt. */ #else int_prev(idp); #endif if (play_duration == 0) { soundoff (); if (++n_head == (n_buff + n_buff_sz)) n_head = n_buff; if (n_head == n_tail) { --n_head; int_on (); return; } play_duration = n_head->duration; if (0 != (play_freq = n_head->freq)) soundon(); dosound (play_freq); } else --play_duration; int_on (); #ifdef __ZTC__ return 1; /* Don't chain */ #endif } /* ** Call this function to init background music. buff_sz is number of ** notes in the note buffer. Returns pointer to buff or NULL if ** out of heap space. */ NOTE * playb_open (unsigned buff_sz) { n_buff = n_head = n_tail = (NOTE *) calloc (buff_sz, sizeof (NOTE)); if (n_buff != (NOTE *) NULL) { n_buff_sz = buff_sz; play_duration = play_freq = 0; #ifdef __ZTC__ int_intercept(TIMER_TICK_INTR, play_intr, 256); #else n_oldtmint = getvect (TIMER_TICK_INTR); setvect (TIMER_TICK_INTR, play_intr); #endif } return (n_buff); } /* ** Return things to normal and free allocated space. */ void playb_close (void) { soundoff (); #ifndef __ZTC__ setvect (TIMER_TICK_INTR, n_oldtmint); #else int_restore(TIMER_TICK_INTR); #endif free (n_buff); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/glbl_env.c�������������������������������������������0000755�0000764�0000144�00000024257�07055334003�016237� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************** This code is based upon the program SETPATH.PAS (located in BPROGA) by David Dubois [71401,747] This Turbo C version is written by Peter Thomas [75716,2377] This series of routines are designed to Locate, Retrieve, Update, and Remove "Variables" from the MASTER copy of the DOS Environment table. The routines have been written in a manner that avoids linking any EXTERNAL routines for string manipulation, and thus should be independent of memory model being used. Be careful that changes made to the Environment with these routines ONLY OCCUR IN THE MASTER COPY, and that if COMMAND.COM is spawned from a routine that has changed the environment, NO CHANGES WILL BE SEEN IN THE ENVIRONMENT. This is most apparent when this program is run in the INTEGRATED environment: changes made by this technique will not appear if the "OS Shell" is invoked, and will only appear on exit from TC. For full documentation on the techniques used here can be found in the file COMENV.ARC located in LIB 2 of BPROGA on Compuserve. As David Dubois says: I hereby dedicate this knowledge to the public domain. Feel free to use it, but if you do, please mention my name. There are no guarantees, and in fact, I wouldn't bet a dollar that it will work every time. That this works at all is based on experimental, rather than properly documented, evidence. There are no guarantees. But then, its free. *****************************************************************************/ #include <stdio.h> #include <dos.h> #ifdef __ZTC__ #error ZTC/C++ not supported - huge pointers required! #endif #ifdef __TURBOC__ #include <alloc.h> #define Fmalloc farmalloc #define Ffree farfree #else #include <malloc.h> #include <stdlib.h> #define far _far #define Fmalloc _fmalloc #define Ffree _ffree #define MK_FP(seg,offset) \ ((void far *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #endif /* * Mstr_FindEnvironment: * Scans for the "Master" Environment area, and returns * a pointer to it, and the size of the environment. */ void Mstr_FindEnvironment ( char far **Env , unsigned *EnvSize ) { unsigned int far *CommandSeg, far *TempSeg ; char far *BlockSeg ; /* * Scan through PSP's looking for a block that is its own father. * This block is the PSP of COMMAND.COM */ TempSeg = MK_FP ( _psp , 0 ) ; do { CommandSeg = TempSeg ; TempSeg = MK_FP ( *(TempSeg+8) , 0 ) ; } while ( TempSeg != CommandSeg ) ; /* * Scan forward through memory looking for the correct MSB. * This will have COMMAND.COM's PSP as owner, and begin with * the character M */ BlockSeg = (char far *)CommandSeg ; do { BlockSeg = MK_FP ( FP_SEG(BlockSeg)+1 , 0 ) ; } while ( ( *(unsigned int far *)(BlockSeg+1) != FP_SEG ( CommandSeg ) ) || ( *BlockSeg != 'M' ) ) ; /* * The environment is the NEXT segment of memory * and bytes 4 and 5 are the size in paragraphs */ *Env = MK_FP ( FP_SEG(BlockSeg)+1 , 0 ) ; *EnvSize = 16 * *(unsigned int far *)(BlockSeg+3) ; } /* * Mstr_getenv: * Scans the "Master" Environment for a given "sub string" * and returns a pointer to it. * Similar to Turbo routine "getenv" but uses the Master copy of the * environment table. */ char far *Mstr_getenv (char far *Env , char far *name) { char far *Sub_Env, far *str1, far *str2 ; /* * Start at the beginning of the environment */ Sub_Env = Env ; /* * While the "sub string" we're looking at is non-zero */ for ( ; *Sub_Env ; ) { /* * Simulate a "strcmp" on the "sub string" of the environment * and the string we're looking for */ for ( str1 = Sub_Env , str2 = name ; (*str1) && (*str2) && ( *str1 == *str2) ; str1++ , str2++ ) ; /* * If we reached the end of the string we're looing for * we've found the correct portion of the environment. * Return the ptr to the start of this "sub string" */ if ( !*str2 ) return ( Sub_Env ) ; /* * Otherwise, advance to the next "sub string" in the environment * by performing a "strchr" function */ for ( ; *(Sub_Env++) ; ) ; } /* * Obviously, the string is not present in the environment. * Return this fact. */ return ( NULL ) ; } /* * Mstr_delenv: * Scans the "Master" Environment for a given "sub string" * and removes it. */ int Mstr_delenv (char far *Env , unsigned EnvSize , char far *name) { char far *Sub_Env , far *New_Env ; char huge *Dest , far *Src , huge *End_Env ; int Done ; unsigned Ctr ; /* * Allocate a chunk of storage to act as a "working" copy of * the Environment table */ New_Env = Fmalloc ( EnvSize ) ; /* * Copy the data from the Master to Working copy of the * Environment table. * Simulates a "memcpy" function. */ for ( Src = Env , Dest = (char far *)New_Env , Ctr = 0 ; Ctr < EnvSize ; *(Dest++) = *(Src++) , Ctr++ ) ; /* * Scan the working copy of the environment for the desired * sub string */ Sub_Env = Mstr_getenv ( New_Env , name ) ; if ( Sub_Env == NULL ) { /* * If not found, do nothing */ Done = -1 ; } else { /* * Locate the end of the string to delete * Simulate a "strchr" call */ for ( Src = Sub_Env ; *(Src++) ; ) ; /* * Move the rest of the environment back over the "sub string" * being deleted. * Simulated "memcpy" function. * Huge pointers used for pointer comparison purposes. */ for ( Dest = (char huge *)Sub_Env , End_Env = (char huge *) (New_Env + EnvSize ) ; ( Dest < End_Env ) ; *(Dest++) = *(Src++) ) ; /* * Copy the data from the Working to Master copy of the * Environment table. * Simulates a "memcpy" function. */ for ( Src = New_Env , Dest = (char huge *)Env , Ctr = 0 ; Ctr < EnvSize ; *(Dest++) = *(Src++) , Ctr++ ) ; /* * Signal all done */ Done = 0 ; } /* * Free all working storage */ Ffree ( New_Env ) ; return ( Done ) ; } /* * Mstr_putenv: * Adds/Replaces a given "sub string" in the Master Environment. * Similar to Turbo routine "putenv" but uses the Master copy of the * environment table. */ int Mstr_putenv (char far *Env , unsigned EnvSize , char far *name ) { char far *Sub_Env , far *Temp_Name ; char huge *Dest , far *Src , huge *End_Env ; int Done ; /* * Allocate a chunk of storage to create the Variable name to add * to the Environment table */ Temp_Name = Fmalloc ( 256 ) ; /* * Extract only the Name portion of the data to add to the Environment */ for ( Src = name , Dest = Temp_Name ; *Src && ( *Src != '=' ) ; *(Dest++) = *(Src++) ) ; /* * Ensure that the resulting name is well formed. */ *(Dest++) = '=' ; *Dest = 0 ; /* * Delete this sub string if found in the environment */ Mstr_delenv ( Env , EnvSize , Temp_Name ) ; /* * Locate the END of the Master table by locating a zero length * String in it */ Sub_Env = Env ; for ( ; *Sub_Env ; ) { for ( ; *(Sub_Env++) ; ) ; } /* * Add the new string to the END of the existing environment, with * trincation IF needed */ for ( Dest = (char huge *)(Sub_Env) , Src = name , End_Env = (char huge *) (Env + EnvSize ) ; ( Dest < End_Env ) && (*Src) ; *(Dest++) = *(Src++) ) ; Done = -1 ; if ( !*Src ) { /* * If the string to add was FULLY added, ensure that the * newly updated environment is properly finished */ Done = 0 ; *(Dest++) = 0 ; *Dest = 0 ; } /* * As a real safety measure, ensure that the FINAL two bytes of the * Environment are both 0. This will finish the last string AND * ensure that a zero length string is also present */ *(End_Env-1) = 0 ; *(End_Env-2) = 0 ; /* * Free all working storage */ Ffree ( Temp_Name ) ; return ( Done ) ; } void main(void) { char far *Env ; unsigned EnvSize ; /* * Locate the Master Table */ Mstr_FindEnvironment ( &Env, &EnvSize ) ; /* * Describe what we've just found */ printf ( "Env = %Fp Size = %u\n\n" , Env , EnvSize ) ; /* * Search for, and display LOCATIONS of PATH, FRED and BERT */ printf ( "Search for PATH= returns %Fp\n", Mstr_getenv ( Env , "PATH=" ) ) ; printf ( "Search for FRED= returns %Fp\n", Mstr_getenv ( Env , "FRED=" ) ) ; printf ( "Search for BERT= returns %Fp\n", Mstr_getenv ( Env , "BERT=" ) ) ; /* * Add FRED and BERT to the environment */ Mstr_putenv ( Env , EnvSize , "FRED=fred" ) ; Mstr_putenv ( Env , EnvSize , "BERT=bert" ) ; printf ( "\nAdded FRED and BERT to environment\n" ) ; /* * Search for, and display LOCATIONS of PATH ,FRED and BERT */ printf ( "Search for PATH= returns %Fp\n", Mstr_getenv ( Env , "PATH=" ) ) ; printf ( "Search for FRED= returns %Fp\n", Mstr_getenv ( Env , "FRED=" ) ) ; printf ( "Search for BERT= returns %Fp\n", Mstr_getenv ( Env , "BERT=" ) ) ; /* * Delete FRED from the environment */ Mstr_delenv ( Env , EnvSize , "FRED=" ) ; printf ( "\nDeleted FRED= from the environment\n" ) ; /* * Search for, and display LOCATIONS of PATH, FRED, and BERT */ printf ( "Search for PATH= returns %Fp\n", Mstr_getenv ( Env , "PATH=" ) ) ; printf ( "Search for FRED= returns %Fp\n", Mstr_getenv ( Env , "FRED=" ) ) ; printf ( "Search for BERT= returns %Fp\n", Mstr_getenv ( Env , "BERT=" ) ) ; printf ( "\nIssue the DOS command SET and see that BERT is now set\n" ) ; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/compiler.c�������������������������������������������0000755�0000764�0000144�00000002610�07055333707�016260� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Tests for popular PC compilers and versions */ #include <stdio.h> void main(void) /* Actually, void main() is non-ANSI/ISO */ { int version; #if defined(__ZTC__) #ifdef __SC__ printf("Symantec C++ ver. %x.%x\n", __SC__ >> 8, __SC__ & 0xff); #else printf("Zortech C++ ver. %x.%xr%x\n", __ZTC__ >> 8, (__ZTC__ >> 4) & 0xf, __ZTC__ & 0xf); #endif #elif defined(__WATCOMC__) printf("Watcom C/C++ ver. %d.%d\n", __WATCOMC__ / 100, __WATCOMC__ % 100); #elif defined(__TURBOC__) version = __TURBOC__; if (0x295 > version) { printf("Borland Turbo C ver. %x.%02x\n", version >> 8, version & 0xff); } else if (0x400 <= version) { printf("Borland C++ ver. %x.%x\n", (version >> 8) - 1, (version & 0xff) >> 4); } else if (0x297 > version) printf("Borland Turbo C++ ver. 1.%02x\n", version - 0x295); else printf("Borland C++ ver. 2.%02x\n", version - 0x297); #elif defined(_QC) printf("Microsoft Quick C ver. %d.%d\n", _QC / 100, _QC % 100); #elif defined(_MSC_VER) printf("Microsoft C(/C++) ver. %d.%d\n", _MSC_VER / 100, _MSC_VER % 100); #elif defined(__POWERC) printf ("MIX Power C ver. %d\n", __POWERC); #else puts("Unknown compiler!"); #endif } ������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/storage.typ������������������������������������������0000755�0000764�0000144�00000003711�07055334252�016503� �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� STORAGE TYPES A C language crib sheet from Jeff Galbraith int x; - x is an int. int *x; - x is a pointer to an int. int **x; - x is a pointer to a pointer to an int. const int x; - x is a const int (constant integer). const int *x; - x is a pointer to a const int. The value of x may change, but the integer that it points to not be changed. In other words, x cannot be used to alter the value to which it points. int *const x; - x is a constant pointer to an int. The value may not change, but the integer that it points to may change. In other words, x will always point at the same location, but the contents may vary. const int *const x; - x is a constant pointer to a constant integer. The value of x may not change, and the integer that it points to may not change. In other words, x will always point at the same location, which cannot be modified via x. int x[]; - x is an array of int. int x[99]; - x is an array of 99 int's. int *x[]; - x is an array of pointers to int. int (*x)[]; - x is a pointer to an array of int. int *(*x)[]; - x is a pointer to an array of pointers to int. int F(); - F is a function returning int. int *F(); - F is a function returning a pointer to int. int (*x)(); - x is a pointer to a function returning int. int (*x[99])(); - x is an array of 99 pointers to functions returning int. int (*F())(); - F is a function returning a pointer to a function returning int. int *(*F())(); - F is a function returning a pointer to a function returning a pointer to an int. int (*F())[]; - F is a function returning a pointer to an array of int. int (*(*F())[])(); - F is a function returning a pointer to an array of pointers to functions returning int. int *(*(*F())[])(); - F is a function returning a pointer to an array of pointers to functions returning a pointer to int. �������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/2dlife.c���������������������������������������������0000755�0000764�0000144�00000005273�07055333631�015617� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** A quick "life" (2-d cellular automaton) implementation done in Turbo C 2.0 ** on the spur-of-the-moment by Jonathan Guthrie 9/20/1992 and donated to the ** public domain. ** ** In keeping with the guidelines of the C_ECHO, this program has been tested, ** and does seem to operate properly. */ #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <time.h> #ifndef random #define random(num) (int)(((long)rand()*(num))/RAND_MAX) #endif /* ** From VIDPORT.C, also in SNIPPETS */ void GotoXY(int col, int row); void ClrScrn(int vattrib); #ifndef randomize #define randomize() srand(((unsigned int)time(NULL))|1) #endif #define ROWS 24 #define COLS 80 #define GENERATIONS 10 int civ1[ROWS][COLS], civ2[ROWS][COLS]; void update_generation(int old[ROWS][COLS], int new[ROWS][COLS]) { int i, j, count; for (i = 0; i < ROWS; ++i) { for (j = 0; j < COLS; ++j) { count = old[(i + ROWS - 1) % ROWS][(j + COLS - 1) % COLS] + old[(i + ROWS - 1) % ROWS][j] + old[(i + ROWS - 1) % ROWS][(j + 1) % COLS] + old[i][(j + COLS - 1) % COLS] + old[i][(j + 1) % COLS] + old[(i + 1) % ROWS][(j + COLS - 1) % COLS] + old[(i + 1) % ROWS][j] + old[(i + 1) % ROWS][(j + 1) % COLS]; switch(count) { case 0: case 1: case 4: case 5: case 6: case 7: case 8: new[i][j] = 0; break; case 2: new[i][j] = old[i][j]; break; case 3: new[i][j] = 1; break; } GotoXY(j+1, i+1); putch(new[i][j] ? '*' : ' '); } } } void initialize(void) { int i, j; randomize(); ClrScrn(7); for (i = 0; i < ROWS; ++i) { for (j = 0; j < COLS; ++j) { civ1[i][j] = random(2); GotoXY(j+1, i+1); putch(civ1[i][j] ? '*' : ' '); } } } int main(void) { int i; initialize(); for (i = 0; i < GENERATIONS; ++i) { update_generation(civ1, civ2); update_generation(civ2, civ1); } return EXIT_SUCCESS; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/evsavres.txt�����������������������������������������0000755�0000764�0000144�00000000361�07055333747�016706� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������To blank EGA/VGA screen - read flipflop at 0x3DA, then write 0x00 to control port at 0x3C0 To restore screen - read flipflop at 0x3DA, then write 0x020 to control port at 0x3C0 �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/uudecode.c�������������������������������������������0000755�0000764�0000144�00000002134�07055334314�016237� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** by: John Lots ** patched up for BC++ 3.1 by Alan Eldridge 10/12/92 ** (UUCP: alane@wozzle.linet.org, FIDO: 1:272/38.473) */ #include <stdio.h> #include <stdlib.h> #define DEC(c) (char)(((c)-' ')&077) int main() { int n; char buf[128],a,b,c,d; scanf("begin %o ", &n); gets(buf); /* filename */ if (!freopen(buf, "wb", stdout)) /* oops.. */ { perror(buf); exit(1); } while ((n=getchar())!=EOF&&((n=DEC(n))!=0)) { while (n>0) { a=DEC(getchar()); b=DEC(getchar()); c=DEC(getchar()); d=DEC(getchar()); if (n-->0) putchar((a<<2)|(b>>4)); if (n-->0) putchar((b<<4)|(c>>2)); if (n-->0) putchar((c<<6)|d); } n=getchar(); /* skip \n */ } return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/hilobyte.h�������������������������������������������0000755�0000764�0000144�00000000124�07055334011�016255� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define LOBYTE(x) ((unsigned char)(x)) #define HIBYTE(x) ((unsigned int)(x) >> 8) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bordcolr.c�������������������������������������������0000755�0000764�0000144�00000005454�07055333656�016270� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** BORDCOLR.C - set the border color ** by: Bob Jarvis */ #include <stdio.h> #include <stdlib.h> #include <dos.h> char *usage = "BORDCOLR - sets the border color\n" "Parameter: color to set - one of\n" "\tBLK - black\n" "\tBLU - blue\n" "\tGRN - green\n" "\tCYN - cyan\n" "\tRED - red\n" "\tMAG - magenta\n" "\tBRN - brown\n" "\tLTG - light gray\n" "\tDKG - dark gray\n" "\tLTB - light blue\n" "\tLGN - light green\n" "\tLTC - light cyan\n" "\tLTR - light red\n" "\tLTM - light magenta\n" "\tYEL - yellow\n" "\tWHT - white"; #define BLACK 0 #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define MAGENTA 5 #define BROWN 6 #define LTGRAY 7 #define DKGRAY 8 #define LTBLUE 9 #define LTGREEN 10 #define LTCYAN 11 #define LTRED 12 #define LTMAGENTA 13 #define YELLOW 14 #define WHITE 15 void set_border_color(int color) { union REGS regs; printf("color = %d\n", color); regs.h.ah = 0x0B; regs.h.bh = 0; regs.h.bl = color; int86(0x10, ®s, ®s); } main(int argc, char *argv[]) { int color; if(argc < 2) { printf(usage); return EXIT_SUCCESS; } if(strcmpl(argv[1], "BLK") == 0) color = BLACK; else if(strcmpl(argv[1], "BLU") == 0) color = BLUE; else if(strcmpl(argv[1], "GRN") == 0) color = GREEN; else if(strcmpl(argv[1], "CYN") == 0) color = CYAN; else if(strcmpl(argv[1], "RED") == 0) color = RED; else if(strcmpl(argv[1], "MAG") == 0) color = MAGENTA; else if(strcmpl(argv[1], "BRN") == 0) color = BROWN; else if(strcmpl(argv[1], "LTG") == 0) color = LTGRAY; else if(strcmpl(argv[1], "DKG") == 0) color = DKGRAY; else if(strcmpl(argv[1], "LTB") == 0) color = LTBLUE; else if(strcmpl(argv[1], "LGN") == 0) color = LTGREEN; else if(strcmpl(argv[1], "LTC") == 0) color = LTCYAN; else if(strcmpl(argv[1], "LTR") == 0) color = LTRED; else if(strcmpl(argv[1], "LTM") == 0) color = LTMAGENTA; else if(strcmpl(argv[1], "YEL") == 0) color = YELLOW; else if(strcmpl(argv[1], "WHT") == 0) color = WHITE; else { printf(usage); return EXIT_SUCCESS; } set_border_color(color); return EXIT_SUCCESS; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/snippets.wc������������������������������������������0000755�0000764�0000144�00000062025�07055334243�016504� �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� WC 3.00  File Lines Words Chars --------------------------------- ------- ------- ------- READ.ME 1 10 70 FILE_ID.DIZ 6 38 208 SNIPPETS.TXT 23 179 1155 SNIPPETS.(C) 42 269 1743 SNIPPETS.NDX 468 3355 26369 SNIPPETS.WC 0 0 0 MISSING.TXT 21 172 1036 NONMSDOS.TXT 42 426 2773 DOSFUNCS.TXT 34 338 2251 PDN.LST 184 1429 10435 MAKE.INI 190 465 3851 ANSISCRN.H 72 317 2304 CAST.H 23 50 1240 DD_STRUC.H 31 187 1019 HILOBYTE.H 2 13 82 PI.H 6 20 115 PORTABLE.H 166 636 5187 ROUND.H 11 37 215 SCRNMACS.H 92 334 2405 C_LINES.AWK 43 184 1269 8087_SAV.ASM 73 389 2797 COLDBOOT.ASM 42 141 1042 CPUCHECK.ASM 78 280 2689 HIRES.ASM 37 154 1214 NDPCHECK.ASM 44 128 1152 STRECPY.ASM 92 418 3375 A2E.C 51 544 2598 ADDHNDLS.C 104 349 3076 ADDPATH.C 101 278 2550 AMALLOC.C 124 445 3469 ANSIFLEN.C 34 75 594 ANSILOAD.C 66 194 1278 ANSISELF.C 10 75 403 ANSISYS.C 60 136 1822 APPROX.C 168 540 4931 ASSIGNPR.C 56 216 1583 ATR2ANSI.C 80 252 1894 BASCNVRT.C 49 141 1027 BASTRNGS.C 144 350 2907 BITARRAY.C 15 49 417 BITCNT_1.C 41 96 686 BITCNT_2.C 33 85 695 BITFILES.C 138 335 2943 BITOPS.C 13 45 320 BITSTRNG.C 59 243 1683 BREAK.C 29 65 465 BRESNHAM.C 155 521 3573 BSTR_I.C 40 84 654 CALSUPP.C 65 207 1375 CANT.C 22 59 447 CHANGPRN.C 52 130 1103 CHECKEXE.C 126 344 3219 CHECKSUM.C 39 111 789 CHGEXT.C 71 217 1687 CLOCK.C 200 540 5401 COMBIN.C 66 263 1603 COMMAFMT.C 82 216 2018 COMPILER.C 46 182 1370 CRC-16.C 37 125 988 CRC-16F.C 130 535 4603 CRC_32.C 172 952 8578 CRYPT.C 98 355 3673 CTRLPRNT.C 40 95 767 CUBIC.C 61 246 1453 CURSOR.C 52 190 2348 DBL2LONG.C 64 326 1984 DBLROUND.C 35 82 618 DOSCOPY.C 58 183 1856 DROPTIME.C 21 70 535 DRVALID.C 166 440 3556 DRVS.C 43 199 1391 DSPDTST.C 149 525 4122 EDITGETS.C 371 919 12377 ENG.C 50 124 1058 ERRFIX.C 52 180 1490 EVAL.C 314 665 6992 FACTORYL.C 103 329 2532 FASKBHIT.C 28 69 519 FAVAIL.C 54 116 967 FCOMPARE.C 59 146 1314 FCOPY.C 55 129 1192 FERRORF.C 25 94 662 FILES.C 93 346 2336 FMTMONEY.C 119 277 2461 FNDISLOT.C 48 131 1023 FORMAT.C 56 156 1210 FPSWITCH.C 81 140 1358 FSCANBIN.C 115 378 3497 FSIZE.C 78 223 1872 FSM.C 37 79 786 GETDCWD.C 74 213 1622 GETKEY.C 27 55 459 GETSEG.C 49 149 1127 GETSTRNG.C 66 176 1612 GLBL_ENV.C 364 1328 10051 GRAFLINE.C 29 201 1346 HEXORINT.C 54 132 967 HOWDY.C 21 129 516 HSTR_I.C 48 113 877 HUGEREAD.C 242 653 5628 HUGESORT.C 105 331 2745 INITVARS.C 139 568 5089 ISCONS.C 39 108 801 ISFOPEN.C 41 102 774 ISISBN.C 25 59 480 ISNETDR.C 45 131 1184 ISPOW2.C 12 35 221 ISQRT.C 91 349 2390 ISRAMDSK.C 56 187 1339 ISSHARE.C 86 300 2179 ISSHIFT.C 24 75 878 ISWPROT.C 82 244 1773 ISXKBRD.C 47 126 1101 JDN.C 124 711 4955 JOYSTICK.C 74 192 1523 KB_DATA.C 50 262 2159 KEYLOCKS.C 21 29 282 KEYWATCH.C 155 608 5174 LBITOPS.C 46 170 1184 LDFLOOR.C 41 172 1597 LL_MSORT.C 77 253 1862 LL_QSORT.C 146 450 3839 LSARY.C 112 322 2536 LTOA.C 58 174 1444 LTOSTR.C 57 181 1463 LV1WS.C 36 82 827 MAINMAIN.C 1 19 79 MCB_ENV.C 166 520 4380 MDALLOC.C 160 676 5322 MEMAVAIL.C 32 64 479 MEMREV.C 52 199 1419 MKDIRS.C 52 125 1071 MOON_AGE.C 66 263 2055 MSB2IEEE.C 59 214 1713 NOCTRLC.C 63 147 1618 NORESET.C 103 314 2813 ORD_TEXT.C 33 85 632 OS_ID.H 41 114 732 OS_ID.C 134 404 2804 PCNVRT.C 22 79 623 PERM_IDX.C 37 141 995 PFOPEN.C 78 228 1650 PLURALTX.C 19 62 385 PRTOGGLE.C 91 289 2389 PRTSCRN.C 53 113 932 PRTSTAT.C 68 156 1189 PUSHDIR.C 192 598 4993 RAND1.C 239 1017 7510 RAND2.C 51 143 1254 REBOOT.C 32 64 476 REDIR.C 59 221 1672 RG_ISORT.C 18 62 402 RG_QSORT.C1 150 696 6666 RG_QSORT.C2 50 107 1021 RG_RAND.C 88 254 1949 RG_SSORT.C 43 105 1148 RMALLWS.C 28 67 538 RMLEAD.C 26 65 506 RMTRAIL.C 31 67 577 RNDMIZE.C 1 6 40 SCANFRAC.C 119 471 3913 SCROLL.C 47 180 1752 SETENVAR.C 155 448 3950 SHEL2DOS.C 50 136 1052 SOUNDEX.C 43 85 1066 SPEED.C 155 533 3773 SPIN.C 29 93 838 SRCHFILE.C 225 679 5792 SSTRCPY.C 13 30 207 STATS.C 53 162 1731 STPTOK.C 38 142 1074 STR27SEG.C 148 378 3814 STRFTIME.C 339 1021 9652 STRREPL.C 74 251 1946 STRREV.C 37 74 607 STRSORT.C 34 91 876 STRUCFIL.C 190 614 5210 STYLE.C 32 106 1701 TABTRICK.C 54 154 1607 TIMEGETC.C 44 108 778 TOASCII.C 37 518 2393 TP6TOD.C 74 255 1844 TRANSLAT.C 71 164 1625 TRIM.C 78 138 1610 TRUENAME.C 103 268 2022 UNIX2DOS.C 15 33 252 VFNAME.C 226 732 6346 VIDEO.C 181 541 5858 WB_FCOPY.C 86 300 2510 WEIRD.C 13 43 264 WHICHARC.C 251 912 8388 WINDCHIL.C 19 68 504 WORDWRAP.C 92 217 2242 XSTRCAT.C 32 79 664 XSTRCMP.C 67 132 1525 C_PREC.TXT 74 215 4040 STORAGE.TYP 78 379 1915 RTLFTRUL.TXT 140 696 4896 PTR_HELP.TXT 1117 7108 41674 C_PORT.TXT 340 1771 12290 ENUMS.TXT 55 281 2077 WHICH_C.TXT 283 2317 14183 RESOURCE.LST 459 2221 16375 ENVIRON.TXT 63 624 3854 SHARING.TXT 70 335 1968 EVSAVRES.TXT 5 34 236 ANSISYS.TXT 226 1151 10351 VT100.TXT 199 1037 9300 VIO.H 90 283 1787 VIO.ASM 896 1875 9514 SCRNSAVE.C 79 198 1627 INT2E.ASM 55 169 1464 CCOMCALL.C 36 87 636 DIRENT.H 97 292 2489 RFIND1ST.C 156 493 5501 POSIXDIR.C 276 824 10098 POSIX_LS.C 83 405 2934 MATCH.H 107 523 3963 MATCH.C 585 1675 18755 MATCH.DOC 126 827 5288 DIRMASK.C 73 252 2956 PATMAT.C 75 428 4693 FLN_FIX.C 142 354 3939 FLNORM.C 158 504 4735 UCLOCK.H 53 153 1134 UCLOCK.C 106 451 3683 SOUND.H 181 528 3836 SOUND.C 30 71 568 MKTONE.C 52 136 1118 PLAYLIB.C 137 334 2672 PLAYDEMO.C 37 105 747 GETCMT.C 267 968 9461 TESTCMT.C 16 53 316 SCALDATE.H 27 135 773 SCALDATE.C 49 190 1327 DAYNUM.C 104 339 2365 CAL.C 144 461 3496 X00API.H 236 886 7444 X00API.C 411 1308 10833 PRNSPOOL.H 48 167 1281 PRNSPOOL.C 151 389 3117 PRINTQ.C 46 156 1411 STRAT.H 22 68 432 STRAT.C 170 497 3889 W_WRAP.H 5 27 143 W_WRAP.C 139 735 5059 CENTER.C 49 181 1285 DOS5BOOT.H 40 162 2185 ABSDISKC.C 34 115 1023 ABSDISK.ASM 72 269 2126 MOUSE.H 38 175 1119 MOUSE.C 352 1183 9063 SCRNPICK.C 58 222 1608 XFILE.H 41 96 707 XFILE.C 200 706 5019 XTEST.C 35 79 786 GETOPT3.C 102 404 3077 GETOPTS.H 31 67 605 GETOPTS.C 193 551 6021 PBMSRCH.C 95 299 2511 BMHSRCH.C 68 231 2084 BMHISRCH.C 94 365 3051 BMHASRCH.C 104 609 3632 EXT_KEYS.H 98 388 3089 EXT_KEYS.C 56 153 1326 DOANSI.H 33 176 972 DOANSI_1.C 478 1009 13041 DOANSI_2.C 229 675 4435 TASKER.TXT 78 470 3028 TASKER.H 44 104 714 TASKER.C 127 360 2576 BIPORT.H 34 154 811 BIPORT.C 16 47 315 FMEMOPS.C 52 163 1200 FTIME.H 20 60 499 FTIME.C 58 129 1157 MSC_PEEK.C 48 118 881 PMERGE.C 69 178 1504 PSPLIT.C 110 286 2602 STRDUP.C 15 32 258 STRUPR.C 29 42 436 VIDPORT.C 114 288 2348 BIG_MALL.H 15 54 400 EXCEPT.DOC 184 1333 8755 CCTRAP.ASM 64 190 1586 CBTRAP.ASM 63 166 1384 TRAPFLAG.ASM 133 428 3753 TRAPDEMO.C 74 146 1460 CERRINST.ASM 100 345 2990 CERRTRAP.ASM 134 551 4628 IOSTUTOR.TXT 260 2112 12414 MYIO.H 98 317 2624 MYIO.CPP 127 402 3544 MYSTREAM.H 92 190 1712 MYSTREAM.CPP 142 430 3650 MYLINE.H 43 158 1336 MYLINE.CPP 76 218 1762 MYIODEMO.CPP 168 464 3955 MYIO.MAK 107 315 2073 STR.DOC 47 286 1940 STR.H 322 821 6681 STR.CPP 303 760 6188 MEM.TXT 215 1401 8956 TOOLKIT.H 66 226 1604 MEM.H 212 868 6115 MEM.C 681 1910 13156 2DLIFE.C 111 315 2636 BIGFAC.C 122 350 2875 BINCOMP.C 172 479 4077 BORDCOLR.C 109 355 2751 C_CMNT.C 154 502 4984 CDIR.C 127 372 3326 CHBYTES.C 203 680 6476 CHMOD.C 224 686 5828 CMDLINE.C 28 85 638 COMMCONV.C 97 300 2459 CURSIZE.C 66 193 1486 DO.C 17 39 324 DOSSORT.C 118 330 3073 DRIVSRCH.C 84 302 2238 DSPCLOCK.C 83 284 2473 FACTOR.C 80 209 1688 FILCOUNT.C 93 286 2334 FLOPCOPY.C 120 391 3150 FRACTION.C 91 321 2743 GETVOL.C 68 210 1486 HEAD.C 40 132 1006 HEXDUMP.C 88 243 2052 IFACTOR.C 66 147 1253 INCHCVRT.C 79 207 1844 KBFLIP.C 86 295 2301 KILLFF.C 123 475 4032 LOG.C 216 750 7625 LSD.C 265 786 6964 LZHUF.C 646 2501 18271 MAZE_1.C 183 483 4201 MAZE_2.C 1 74 238 MAZE_3.C 7 67 441 MORSE.C 238 1002 7306 MTERM.C 133 419 3871 MV.C 136 377 3096 PALNDROM.C 2 74 277 PERMUTE1.C 114 374 3436 PERMUTE2.C 79 187 1721 PI.C 155 447 3515 PR.C 301 913 8967 QUERY.C 51 144 1229 RDXCNVRT.C 49 141 1029 REMTAB.C 63 177 1703 RM_ALL.C 222 655 6003 ROMAN.C 97 192 1752 SETIMETO.C 64 160 1303 SETVOL.C 222 626 5124 SPLIT.C 71 207 1829 STRIPEOF.C 61 125 1412 STUB.C 115 396 3331 SUNRISET.C 507 2443 21206 TAIL.C 181 467 4541 TODAYBAK.C 98 270 2172 TOUCH.C 63 202 1916 TREEDIR.C 53 159 1252 UUENCODE.C 146 448 3077 UUDECODE.C 41 119 1075 WC.C 66 161 1378 WHERE.C 132 405 3434 JGREP.C 178 481 4519 GREP.C 567 1755 15359 --------------------------------- ------- ------- ------- Total (367 files) 39137 139917 1122625 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/fscanbin.c�������������������������������������������0000755�0000764�0000144�00000007034�07055333767�016244� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* fscanbin.c -- scan binary fields via format string ** ** public domain by Ray Gardner Englewood, Colorado 11/29/89 ** ** Usage: fscanbin(FILE *fp, char *format, ...) ** ** where format string contains specifiers: ** -ddd means skip ddd bytes ** i means read a 16-bit int ** l means read a 32-bit int ** sddd means read a character string of up to ddd bytes ** reads up to a nul byte if ddd is zero or missing ** cnnn means read a character field of nnn bytes (not nul-terminated) ** reads one byte if nnn is zero or missing */ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <ctype.h> typedef unsigned short int16; typedef unsigned long int32; #define int16swap(n) (*n = (*n << 8) | (*n >> 8)) #define int32swap(n) (\ int16swap(&((int16 *)n)[0]),\ int16swap(&((int16 *)n)[1]),\ *n = (*n << 16) | (*n >> 16)\ ) #define maxk 32767 int fscanbin (FILE *fp, char *format, ...) { va_list argp; unsigned char *p; unsigned k; int c; char *charp; int16 *int16p; int32 *int32p; int bytes_read; bytes_read = 0; va_start(argp, format); for ( p = (unsigned char *)format; *p; ) { switch( *p & 0xFF ) { case '-': for ( k = 0, c = *++p; isdigit(c); c = *++p ) k = 10 * k + c - '0'; if ( k == 0 ) k = 1; if ( fseek(fp, (long)k, SEEK_CUR) ) return -2; /* i/o error */ bytes_read += k; break; case 'i': int16p = va_arg(argp, int16 *); if ( fread((void *)int16p, sizeof(int16), 1, fp) != 1 ) return -2; /* i/o error */ #if SWAP16 int16swap(int16p); #endif p++; bytes_read += sizeof(int16); break; case 'l': int32p = va_arg(argp, int32 *); if ( fread((void *)int32p, sizeof(int32), 1, fp) != 1 ) return -2; /* i/o error */ #if SWAP32 int32swap(int32p); #endif p++; bytes_read += sizeof(int32); break; case 's': charp = va_arg(argp, char *); for ( k = 0, c = *++p; isdigit(c); c = *++p ) k = 10 * k + c - '0'; do { c = getc(fp); if ( c == EOF ) return -2; *charp++ = (char)c; bytes_read++; } while ( c && (k == 0 || --k) ); break; case 'c': charp = va_arg(argp, char *); for ( k = 0, c = *++p; isdigit(c); c = *++p ) k = 10 * k + c - '0'; if ( k == 0 ) k = 1; if ( fread((void *)charp, sizeof(char), k, fp) != k ) return -2; /* i/o error */ bytes_read += k; break; default: return -1; /* bad format */ } } va_end(argp); return bytes_read; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/match.c����������������������������������������������0000755�0000764�0000144�00000045614�07055334062�015550� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* EPSHeader File: match.c Author: J. Kercheval Created: Sat, 01/05/1991 22:21:49 */ /* EPSRevision History J. Kercheval Wed, 02/20/1991 22:29:01 Released to Public Domain J. Kercheval Fri, 02/22/1991 15:29:01 fix '\' bugs (two :( of them) J. Kercheval Sun, 03/10/1991 19:31:29 add error return to matche() J. Kercheval Sun, 03/10/1991 20:11:11 add is_valid_pattern code J. Kercheval Sun, 03/10/1991 20:37:11 beef up main() J. Kercheval Tue, 03/12/1991 22:25:10 Released as V1.1 to Public Domain */ /* Wildcard Pattern Matching */ #include "match.h" int matche_after_star (register char *pattern, register char *text); int fast_match_after_star (register char *pattern, register char *text); /*---------------------------------------------------------------------------- * * Return TRUE if PATTERN has any special wildcard characters * ----------------------------------------------------------------------------*/ BOOLEAN is_pattern (char *p) { while (*p) { switch (*p++) { case '?': case '*': case '[': case '\\': return TRUE; } } return FALSE; } /*---------------------------------------------------------------------------- * * Return TRUE if PATTERN has is a well formed regular expression according * to the above syntax * * error_type is a return code based on the type of pattern error. Zero is * returned in error_type if the pattern is a valid one. error_type return * values are as follows: * * PATTERN_VALID - pattern is well formed * PATTERN_ESC - pattern has invalid escape ('\' at end of pattern) * PATTERN_RANGE - [..] construct has a no end range in a '-' pair (ie [a-]) * PATTERN_CLOSE - [..] construct has no end bracket (ie [abc-g ) * PATTERN_EMPTY - [..] construct is empty (ie []) * ----------------------------------------------------------------------------*/ BOOLEAN is_valid_pattern (char *p, int *error_type) { /* init error_type */ *error_type = PATTERN_VALID; /* loop through pattern to EOS */ while (*p) { /* determine pattern type */ switch (*p) { /* check literal escape, it cannot be at end of pattern */ case '\\': if (!*++p) { *error_type = PATTERN_ESC; return FALSE; } p++; break; /* the [..] construct must be well formed */ case '[': p++; /* if the next character is ']' then bad pattern */ if (*p == ']') { *error_type = PATTERN_EMPTY; return FALSE; } /* if end of pattern here then bad pattern */ if (!*p) { *error_type = PATTERN_CLOSE; return FALSE; } /* loop to end of [..] construct */ while (*p != ']') { /* check for literal escape */ if (*p == '\\') { p++; /* if end of pattern here then bad pattern */ if (!*p++) { *error_type = PATTERN_ESC; return FALSE; } } else p++; /* if end of pattern here then bad pattern */ if (!*p) { *error_type = PATTERN_CLOSE; return FALSE; } /* if this a range */ if (*p == '-') { /* we must have an end of range */ if (!*++p || *p == ']') { *error_type = PATTERN_RANGE; return FALSE; } else { /* check for literal escape */ if (*p == '\\') p++; /* if end of pattern here then bad pattern */ if (!*p++) { *error_type = PATTERN_ESC; return FALSE; } } } } break; /* all other characters are valid pattern elements */ case '*': case '?': default: p++; /* "normal" character */ break; } } return TRUE; } /*---------------------------------------------------------------------------- * * Match the pattern PATTERN against the string TEXT; * * returns MATCH_VALID if pattern matches, or an errorcode as follows * otherwise: * * MATCH_PATTERN - bad pattern * MATCH_LITERAL - match failure on literal mismatch * MATCH_RANGE - match failure on [..] construct * MATCH_ABORT - premature end of text string * MATCH_END - premature end of pattern string * MATCH_VALID - valid match * * * A match means the entire string TEXT is used up in matching. * * In the pattern string: * `*' matches any sequence of characters (zero or more) * `?' matches any character * [SET] matches any character in the specified set, * [!SET] or [^SET] matches any character not in the specified set. * * A set is composed of characters or ranges; a range looks like * character hyphen character (as in 0-9 or A-Z). [0-9a-zA-Z_] is the * minimal set of characters allowed in the [..] pattern construct. * Other characters are allowed (ie. 8 bit characters) if your system * will support them. * * To suppress the special syntactic significance of any of `[]*?!^-\', * and match the character exactly, precede it with a `\'. * ----------------------------------------------------------------------------*/ int matche (register char *p, register char *t) { register char range_start, range_end; /* start and end in range */ BOOLEAN invert; /* is this [..] or [!..] */ BOOLEAN member_match; /* have I matched the [..] construct? */ BOOLEAN loop; /* should I terminate? */ for ( ; *p; p++, t++) { /* if this is the end of the text then this is the end of the match */ if (!*t) { return ( *p == '*' && *++p == '\0' ) ? MATCH_VALID : MATCH_ABORT; } /* determine and react to pattern type */ switch (*p) { case '?': /* single any character match */ break; case '*': /* multiple any character match */ return matche_after_star (p, t); /* [..] construct, single member/exclusion character match */ case '[': { /* move to beginning of range */ p++; /* check if this is a member match or exclusion match */ invert = FALSE; if (*p == '!' || *p == '^') { invert = TRUE; p++; } /* if closing bracket here or at range start then we have a malformed pattern */ if (*p == ']') { return MATCH_PATTERN; } member_match = FALSE; loop = TRUE; while (loop) { /* if end of construct then loop is done */ if (*p == ']') { loop = FALSE; continue; } /* matching a '!', '^', '-', '\' or a ']' */ if (*p == '\\') { range_start = range_end = *++p; } else range_start = range_end = *p; /* if end of pattern then bad pattern (Missing ']') */ if (!*p) return MATCH_PATTERN; /* check for range bar */ if (*++p == '-') { /* get the range end */ range_end = *++p; /* if end of pattern or construct then bad pattern */ if (range_end == '\0' || range_end == ']') return MATCH_PATTERN; /* special character range end */ if (range_end == '\\') { range_end = *++p; /* if end of text then we have a bad pattern */ if (!range_end) return MATCH_PATTERN; } /* move just beyond this range */ p++; } /* if the text character is in range then match found. make sure the range letters have the proper relationship to one another before comparison */ if (range_start < range_end) { if (*t >= range_start && *t <= range_end) { member_match = TRUE; loop = FALSE; } } else { if (*t >= range_end && *t <= range_start) { member_match = TRUE; loop = FALSE; } } } /* if there was a match in an exclusion set then no match */ /* if there was no match in a member set then no match */ if ((invert && member_match) || !(invert || member_match)) return MATCH_RANGE; /* if this is not an exclusion then skip the rest of the [...] construct that already matched. */ if (member_match) { while (*p != ']') { /* bad pattern (Missing ']') */ if (!*p) return MATCH_PATTERN; /* skip exact match */ if (*p == '\\') { p++; /* if end of text then we have a bad pattern */ if (!*p) return MATCH_PATTERN; } /* move to next pattern char */ p++; } } break; } case '\\': /* next character is quoted and must match exactly */ /* move pattern pointer to quoted char and fall through */ p++; /* if end of text then we have a bad pattern */ if (!*p) return MATCH_PATTERN; /* must match this character exactly */ default: if (*p != *t) return MATCH_LITERAL; } } /* if end of text not reached then the pattern fails */ if (*t) return MATCH_END; else return MATCH_VALID; } /*---------------------------------------------------------------------------- * * recursively call matche() with final segment of PATTERN and of TEXT. * ----------------------------------------------------------------------------*/ int matche_after_star (register char *p, register char *t) { register int match = 0; register nextp; /* pass over existing ? and * in pattern */ while ( *p == '?' || *p == '*' ) { /* take one char for each ? and + */ if (*p == '?') { /* if end of text then no match */ if (!*t++) return MATCH_ABORT; } /* move to next char in pattern */ p++; } /* if end of pattern we have matched regardless of text left */ if (!*p) return MATCH_VALID; /* get the next character to match which must be a literal or '[' */ nextp = *p; if (nextp == '\\') { nextp = p[1]; /* if end of text then we have a bad pattern */ if (!nextp) return MATCH_PATTERN; } /* Continue until we run out of text or definite result seen */ do { /* a precondition for matching is that the next character in the pattern match the next character in the text or that the next pattern char is the beginning of a range. Increment text pointer as we go here */ if (nextp == *t || nextp == '[') match = matche(p, t); /* if the end of text is reached then no match */ if (!*t++) match = MATCH_ABORT; } while ( match != MATCH_VALID && match != MATCH_ABORT && match != MATCH_PATTERN); /* return result */ return match; } /*---------------------------------------------------------------------------- * * match() is a shell to matche() to return only BOOLEAN values. * ----------------------------------------------------------------------------*/ BOOLEAN match( char *p, char *t ) { int error_type; error_type = matche(p,t); return (error_type == MATCH_VALID ) ? TRUE : FALSE; } #ifdef TEST /* ** This test main expects as first arg the pattern and as second arg ** the match string. Output is yaeh or nay on match. If nay on ** match then the error code is parsed and written. */ #include <stdio.h> int main(int argc, char *argv[]) { int error; int is_valid_error; if (argc != 3) printf("Usage: MATCH Pattern Text\n"); else { printf("Pattern: %s\n", argv[1]); printf("Text : %s\n", argv[2]); if (!is_pattern(argv[1])) printf(" First Argument Is Not A Pattern\n"); else { error = matche(argv[1],argv[2]); is_valid_pattern(argv[1],&is_valid_error); switch (error) { case MATCH_VALID: printf(" Match Successful"); if (is_valid_error != PATTERN_VALID) printf(" -- is_valid_pattern() " "is complaining\n"); else printf("\n"); break; case MATCH_LITERAL: printf(" Match Failed on Literal\n"); break; case MATCH_RANGE: printf(" Match Failed on [..]\n"); break; case MATCH_ABORT: printf(" Match Failed on Early " "Text Termination\n"); break; case MATCH_END: printf(" Match Failed on Early " "Pattern Termination\n"); break; case MATCH_PATTERN: switch (is_valid_error) { case PATTERN_VALID: printf(" Internal Disagreement " "On Pattern\n"); break; case PATTERN_ESC: printf(" Literal Escape at " "End of Pattern\n"); break; case PATTERN_RANGE: printf(" No End of Range in " "[..] Construct\n"); break; case PATTERN_CLOSE: printf(" [..] Construct is Open\n"); break; case PATTERN_EMPTY: printf(" [..] Construct is Empty\n"); break; default: printf(" Internal Error in " "is_valid_pattern()\n"); } break; default: printf(" Internal Error in matche()\n"); break; } } } return(0); } #endif ��������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/match.h����������������������������������������������0000755�0000764�0000144�00000007746�07055334065�015564� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* EPSHeader File: match.h Author: J. Kercheval Created: Sat, 01/05/1991 22:27:18 */ /* EPSRevision History J. Kercheval Wed, 02/20/1991 22:28:37 Released to Public Domain J. Kercheval Sun, 03/10/1991 18:02:56 add is_valid_pattern J. Kercheval Sun, 03/10/1991 18:25:48 add error_type in is_valid_pattern J. Kercheval Sun, 03/10/1991 18:47:47 error return from matche() J. Kercheval Tue, 03/12/1991 22:24:49 Released as V1.1 to Public Domain */ /* Wildcard Pattern Matching */ #ifndef BOOLEAN # define BOOLEAN int # define TRUE 1 # define FALSE 0 #endif /* match defines */ #define MATCH_PATTERN 6 /* bad pattern */ #define MATCH_LITERAL 5 /* match failure on literal match */ #define MATCH_RANGE 4 /* match failure on [..] construct */ #define MATCH_ABORT 3 /* premature end of text string */ #define MATCH_END 2 /* premature end of pattern string */ #define MATCH_VALID 1 /* valid match */ /* pattern defines */ #define PATTERN_VALID 0 /* valid pattern */ #define PATTERN_ESC -1 /* literal escape at end of pattern */ #define PATTERN_RANGE -2 /* malformed range in [..] construct */ #define PATTERN_CLOSE -3 /* no end bracket in [..] construct */ #define PATTERN_EMPTY -4 /* [..] contstruct is empty */ /*---------------------------------------------------------------------------- * * Match the pattern PATTERN against the string TEXT; * * match() returns TRUE if pattern matches, FALSE otherwise. * matche() returns MATCH_VALID if pattern matches, or an errorcode * as follows otherwise: * * MATCH_PATTERN - bad pattern * MATCH_LITERAL - match failure on literal mismatch * MATCH_RANGE - match failure on [..] construct * MATCH_ABORT - premature end of text string * MATCH_END - premature end of pattern string * MATCH_VALID - valid match * * * A match means the entire string TEXT is used up in matching. * * In the pattern string: * `*' matches any sequence of characters (zero or more) * `?' matches any character * [SET] matches any character in the specified set, * [!SET] or [^SET] matches any character not in the specified set. * * A set is composed of characters or ranges; a range looks like * character hyphen character (as in 0-9 or A-Z). [0-9a-zA-Z_] is the * minimal set of characters allowed in the [..] pattern construct. * Other characters are allowed (ie. 8 bit characters) if your system * will support them. * * To suppress the special syntactic significance of any of `[]*?!^-\', * and match the character exactly, precede it with a `\'. * ----------------------------------------------------------------------------*/ BOOLEAN match (char *pattern, char *text); int matche(register char *pattern, register char *text); /*---------------------------------------------------------------------------- * * Return TRUE if PATTERN has any special wildcard characters * ----------------------------------------------------------------------------*/ BOOLEAN is_pattern (char *pattern); /*---------------------------------------------------------------------------- * * Return TRUE if PATTERN has is a well formed regular expression according * to the above syntax * * error_type is a return code based on the type of pattern error. Zero is * returned in error_type if the pattern is a valid one. error_type return * values are as follows: * * PATTERN_VALID - pattern is well formed * PATTERN_ESC - pattern has invalid escape ('\' at end of pattern) * PATTERN_RANGE - [..] construct has a no end range in a '-' pair (ie [a-]) * PATTERN_CLOSE - [..] construct has no end bracket (ie [abc-g ) * PATTERN_EMPTY - [..] construct is empty (ie []) * ----------------------------------------------------------------------------*/ BOOLEAN is_valid_pattern (char *pattern, int *error_type); ��������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/w_wrap.c���������������������������������������������0000755�0000764�0000144�00000012116�07055334331�015741� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* w_wrap.c */ /* ** This is an attempt at a useful word-wrap function. It is given an array ** of characters ( a string ) and it modifies the string, replacing any ** new-lines found with spaces and placing new-lines where needed to make ** lines of the width specified, placing them only where there was previously ** white-space. ( ie. Words are not split across lines. ) At the present ** time it is rather stupid. 1) It doesn't know enough to split a line at an ** existing hyphen. 2) It has no clue about how to hyphenate words. 3) It ** makes no attempt at dealing intelligently with a singly word longer than ** the specified line length 4) It does not deal intelligently with multiple ** spaces new-lines, etc. ( eg. has no clue of paragraph seperation, etc. ) ** OTOH, it does deal well with unformatted, left justified text. ** ** Tabs will be considered the size specified. Note that word_wrap() does ** not actually expand tabs. This is only to inform it of the number of ** spaces the output device will expand them to, so it will know how much ** they expand a line. The only time word_wrap does anything with tabs, is ** if the tab size is set to zero, in which case each tab is replaced with a ** single space character. This often provides the most useful output, since ** tabs will often be in the wrong places after re-formatting, and is ** therfore the default. ** ** ** Publicly available contents: ** ** char *word_wrap(char *string,long line_len); ** Does the actual word-wrapping, as described above; ** Parameters: ** string: actual string to work with ** line_len: length of lines for output ** Returns: pointer to justified string. ** ** void set_tab_size(int size); ** Set the number of spaces that tabs will be expanded to on output ** default tab size is zero. (each tab replaced with a space char ) ** word_wrap does not actually expand tabs. This only lets it keep ** track of how many spaces they take up. If this is set to ** zero, each tab will be replaced with a single space. ** ** Other procedures: ** int get_word(char *string); ** returns the number of characters in the next word in string, ** including leading white-space characters. ** ** This compiles without warnings and runs with the following compilers: ** MS Quick C 2.51: ** Borland C++ 2.0: either as C or C++ ** GNU C++ 1.39, DOS port: either as C or C++ ** As far as I know, it uses only portable, standard C constructs. It should ** compile and run with little or no modification under nearly any C compiler ** and environment. ** ** ** This code was written Nov 16, 1991 by Jerry Coffin. ** It is hereby placed in the public domain, for free use by any and ** all who wish to do so, for any use, public, private, or commercial. */ #include <stddef.h> #include <ctype.h> enum {FALSE,TRUE}; static int tab_size = 0; /* size to consider tabs as */ static size_t get_word(char *string); /* returns size of next word*/ void set_tab_size(size_t size) { tab_size = size; } char *word_wrap(char *string, size_t line_len) { size_t len, /* length of current word */ current_len = 0; /* current length of line */ size_t start_line = 0; /* index of beginning if line */ while (0 != (len = get_word(&string[current_len + start_line]))) { if (current_len + len < line_len) current_len += len; else { string[start_line+current_len] = '\n'; start_line += current_len + 1; current_len = 0; } } return string; } static size_t get_word(char *string) { register int i = 0, word_len = 0; if (!string[0]) return 0; while (isspace(string[i])) { if ('\t' == string[i]) { if (0 == tab_size) string[i] = ' '; else word_len += tab_size-1; } else if ('\n' == string[i]) string[i]=' '; word_len++; i++; } while (string[i] && !isspace(string[i++])) word_len++; return word_len; } #ifdef TEST #include <stdio.h> #include "w_wrap.h" void main(void) { char *string = "This is a long line\nto be wrapped by the w_wrap function. " "Hopefully, things will work correctly and it will be wrapped " "between words. On the other hand, maybe I should hope that it " "doesn't work well so I will have an opportunity\nto learn more " "about what I'm doing"; printf("Here's a string wrapped to 40 columns:\n\n%s\n\n", word_wrap(string, 40)); printf("And here it's wrapped to 72:\n\n%s\n\n", word_wrap(string,72)); } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/w_wrap.h���������������������������������������������0000755�0000764�0000144�00000000224�07055334331�015743� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* w_wrap.h */ /* prototypes for the functions in w_wrap.c */ char *word_wrap(char *string, size_t line_len); void set_tab_size(size_t size); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/unix2dos.c�������������������������������������������0000755�0000764�0000144�00000000413�07055334314�016213� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** UNIX2DOS.C - Convert Unix-style pathnames to DOS-style ** ** public domain by Bob Stout */ char *unix2dos(char *path) { char *p; for (p = path; *p; ++p) if ('/' == *p) *p = '\\'; return path; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/fcopy.c����������������������������������������������0000755�0000764�0000144�00000002337�07055333756�015600� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * FCOPY.C - copy one file to another. Returns the (positive) * number of bytes copied, or -1 if an error occurred. * by: Bob Jarvis */ #include <stdio.h> #include <stdlib.h> #define BUFFER_SIZE 1024 long fcopy(char *dest, char *source) { FILE *d, *s; char *buffer; size_t incount; long totcount = 0L; s = fopen(source, "rb"); if(s == NULL) return -1L; d = fopen(dest, "wb"); if(d == NULL) { fclose(s); return -1L; } buffer = malloc(BUFFER_SIZE); if(buffer == NULL) { fclose(s); fclose(d); return -1L; } incount = fread(buffer, sizeof(char), BUFFER_SIZE, s); while(!feof(s)) { totcount += (long)incount; fwrite(buffer, sizeof(char), incount, d); incount = fread(buffer, sizeof(char), BUFFER_SIZE, s); } totcount += (long)incount; fwrite(buffer, sizeof(char), incount, d); free(buffer); fclose(s); fclose(d); return totcount; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/format.c���������������������������������������������0000755�0000764�0000144�00000002362�07055333765�015746� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** FORMAT.C - Use DOS FORMAT to format a diskette ** ** Original Copyright 1992 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is hereby donated to the public domain. */ #include <stdio.h> #include <stdlib.h> enum {ERROR = -1, SUCCESS}; /* ** format ** ** Formats a specified floppy disk with optional switches. ** ** Parameters: 1 - Drive letter ('A', 'B', ...) to format ** 2 - Formatting switches in FORMAT.COM format, e.g. "/4" ** 3 - Volume label ** ** Returns: SUCCESS or ERROR */ int format(char drive, char *switches, char *vlabel) { char command[128], fname[13]; FILE *tmpfile; tmpnam(fname); if (NULL == (tmpfile = fopen(fname, "w"))) return ERROR; /* Can't open temp file */ fprintf(tmpfile, "\n%s\nN\n", vlabel); fclose(tmpfile); sprintf(command, "format %c: /V %s < %s > NUL", drive, switches, fname); system(command); remove(fname); return SUCCESS; } #ifdef TEST void main(void) { int retval = format((char)'a', "/4", "dummy_test"); printf("format() returned %d\n", retval); } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/favail.c���������������������������������������������0000755�0000764�0000144�00000001775�07055333755�015726� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Find out how many more files can be fopen'ed ** ** public domain demo by Bob Stout */ #include <stdio.h> #ifdef __TURBOC__ #define STREAM_BUF _streams #define FCNT FOPEN_MAX #define FLAG flags #else /* MSC, ZTC++ */ #define STREAM_BUF _iob #define FCNT _NFILE #define FLAG _flag #endif int favail(void) { int i, count; for (i = count = 0; i < FCNT; ++i) { if (0 == STREAM_BUF[i].FLAG) ++count; } return count; } #ifdef TEST void main(void) { char *fname = "A$$$$$$$.$$$"; FILE *fp; do { int i = favail(); printf("You can fopen %d new file%s\n", i, &"s"[i == 1]); fp = fopen(fname, "w"); *fname += 1; } while (fp); do { printf("removing %s\n", fname); remove(fname); } while ('A' <= --(*fname)) ; } #endif /*TEST */ ���c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ifactor.c��������������������������������������������0000755�0000764�0000144�00000002447�07055334015�016076� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** ifactor.c -- print prime factorization of a number ** ** Ray Gardner -- 1985 -- public domain */ #include <stdio.h> #include <stdlib.h> int prevfact = 0; void factor (long); void show (long, int); void main (int argc, char *argv[]) { while ( --argc ) factor(atol(*++argv)); } void factor (long n) { long d; int k; long n0 = n; prevfact = 0; printf("%ld ",n); if ( n < 2 ) { printf("is less than 2.\n"); return; } else if ( n > 2 ) { d = 2; for ( k = 0; n % d == 0; k++ ) n /= d; if ( k ) show(d,k); for ( d = 3; d * d <= n; d += 2 ) { for ( k = 0; n % d == 0; k++ ) n /= d; if ( k ) show(d,k); } } if ( n > 1 ) { if ( n == n0 ) printf(" is prime"); else show(n,1); } printf("\n"); } void show (long d, int k) { if ( prevfact ) printf(" * "); else printf(" = "); prevfact++; printf("%ld",d); if ( k > 1 ) printf("^%d",k); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/snippets._c_�����������������������������������������0000755�0000764�0000144�00000003371�07406406027�016612� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Welcome to SNIPPETS! All the code I put into SNIPPETS for distribution is Public Domain or free to the best that I can determine. What this means is that: 1. I know or can contact the original author(s) to verify the presumed copyright ownership, and 2. The work bears an explicit Public Domain notice, or 3. The work is copyrighted but includes a free use license, or 4. The work was published without a copyright notice prior to the effective date of the new copyright law. This has been occasionally annoying when I've had to pass up some useful piece of code because it's questionable whether anyone can use it without incurring liability (distributing someone else's property makes me an accessory, doncha know). Since SNIPPETS includes both public domain and free code, be sure to carefully read each header for any free license restrictions which may apply. Distribution: Starting with the December 1992 version, SNIPPETS is distributed in two files: SNIPmmyy.LZH is the full SNIPPETS collection. SNPDmmyy.LZH contains only the files changes since the last release. SNIPPETS is distributed through the FidoNet Programmer's Distribution Network (PDN - see the file PDN.LST for a list of PDN sites and further information. The SNIPPETS files are also available from my "home" BBS, Comm Port One, (713) 980-9671, FidoNet address 1:106/2000 using the "magic" F'req names of "SNIPPETS" and "SNIPDIFF". Various Internet mirror sites also carry SNIPPETS, but I'm not sure which ones have it an any given time. One place to try is oak.oakland.edu in /pub/msdos/c. ...Bob Stout ------------------------------- Enjoy! ----------------------------------- �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/snippets.ndx�����������������������������������������0000755�0000764�0000144�00000064325�07055334234�016671� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������|NOTES: "+" preceding file name means new since last SNIPPETS | "*" preceding file name means modified since last SNIPPETS | "-" preceding file name means deleted since last SNIPPETS | | File Author Description | ------------ -------------- --------------------------------------------- * Read.Me Last minute information and instructions + File_Id.Diz File info for BBS's * Snippets.Txt General information about SNIPPETS * Snippets.(C) SNIPPETS freeware notice * Snippets.Ndx SNIPPETS index - this file * Snippets.Wc Count of SNIPPETS files + Missing.Txt Rationale of files deleted since last SNIPPETS + Nonmsdos.Txt List of universal SNIPPETS functions + Dosfuncs.Txt List of MS/PC-DOS-specific SNIPPETS functions * Pdn.Lst Janis Kracht List of PDN sites Make.Ini Jim Nutt Master file for NDMAKE Ansiscrn.H Macros for ANSI.SYS screen control Cast.H Bob Stout Cast any object to any type - Dow.H + Dd_Struc.H Wayne Hamilton TC/TC++/BC++ DOS file time/date macros Hilobyte.H Extract high, low bytes from an int + Pi.H Useful definitions using PI * Portable.H Scott Ladd Write portable code for various PC compilers * Round.H Dave Knapp Rounding macros * Scrnmacs.H Jerry Houston Macros for direct video work C_Lines.Awk Dan Kozak AWK program to count lines of C code 8087_Sav.Asm Jeffrey Nonken Saves/restores 80x87 environment Coldboot.Asm David Nugent Reliable cold/warm boot Cpucheck.Asm Determine type of CPU in use Hires.Asm Switch to 43/50 line mode on EGA/VGA Ndpcheck.Asm Determine presence of coprocessor + Strecpy.Asm L. Satenstein Like strcpy, but returns pointer to NUL A2E.C Bob Stout ASCII <=> EBCDIC conversions Addhndls.C Doug Burger Allow more than 20 open files under DOS 3+ Bob Jarvis + Addpath.C Bob Stout Add directories to path in AUTOEXEC.BAT Amalloc.C Paul Schlyter Multi-dimensional array allocate ( <64K on PC) * Ansiflen.C Bob Jarvis ANSI-compliant file size function Ansiload.C Bob Jarvis Detect ANSI.SYS Ansiself.C Thad Smith Self-replicating program in ANSI C Ansisys.C Detect ANSI.SYS Approx.C John Rex Fuzzy string search Assignpr.C Bob Stout Multiple printer support Atr2Ansi.C Bob Stout Build ANSI.SYS command string, given attribute Bascnvrt.C Bob Stout Convert radix of a numeric string Bastrngs.C Bob Stout BASIC-like string functions Bitarray.C Bit array functions Bitcnt_1.C Ratko Tomic Count bits in a number (fast, clever) Bitcnt_2.C Count bits in a number (fascinating) Bitfiles.C Aare Tali Bit I/O for buffered (fopen'ed) files Bitops.C Bob Stout Small bit array macros Bitstrng.C J. Blauth Format numeric value as string of bits + Bstr_I.C Bob Stout Convert binary string to int + Break.C Bob Stout Control DOS "SET BREAK=" status + Bresnham.C Brian Dessent Draw lines and circles Calsupp.C Ray McVay Calendar support funtions Cant.C Bob Stout An fopen() replacement with error trapping Changprn.C Bob Stout Change the standard printer device Checkexe.C Bob Jarvis Checksum protection for executable files + Checksum.C Bob Stout Calculate checksum Chgext.C Bob Stout Change/add a file name extension Clock.C Jon Guthrie On-screen clock generator Combin.C Thad Smith III Compute combinations without overflow Commafmt.C Bob Stout Add thousands separators to numeric strings + Compiler.C Test for popular PC compilers & versions * Crc-16.C Calculated 16-bit CRC Crc-16F.C Fast 16-bit CRC Crc_32.C Gary S. Brown Table lookup 32-bit CRC * Crypt.C Bob Stout S-Coder data encryption from DDJ Ctrlprnt.C Bob Stout Print a line, displaying Ctrl characters Cubic.C Ross Cottrell Solve cubic equations Cursor.C Bill Wilkie Cursor management/manipulation Dbl2Long.C Ross Cottrell Rounds doubles to longs Dblround.C Ross Cottrell Rounds a double to nearest whole number - Dd_Struc.C Doscopy.C Peter Yard Copy a file + Droptime.C Thor Johnson Give up time slices to Win, OS/2, etc. * Drvalid.C Bob Stout Benignly validate disk drives + Drvs.C David Gersic Checks for valid disk drives, local or remote * Dspdtst.C I/O benchmark - MSC/TC/ZTC/Watcom * Editgets.C Jon Burchmore Get an input string with editing functions Bob Stout + Eng.C David Harmon Floating point value -> engineering notation Errfix.C Bob Jarvis Redirect stderr to a file Eval.C Bob Stout Simple arithmetic expression evaluator Factoryl.C Bob Stout Factorial, combinations, permutations * Faskbhit.C D. Goodenough Fast kbhit() and kbflush() Favail.C Bob Stout How many more files may be fopen'ed? Fcompare.C Bob Stout Compare 2 files for equality Fcopy.C Bob Jarvis Copy a file Ferrorf.C Mark Devlin Formatted error messages - Figets.C Files.C Matthew Hunt Determine number of FILE set in CONFIG.SYS Fmtmoney.C Bob Stout Format US dollar amounts into text strings Fndislot.C Bob Stout Locate an unused user interrupt vector Format.C Bob Stout Use DOS format to format a diskette + Fpswitch.C Demo how to use function pointer arrays Fscanbin.C Ray Gardner Scan binary fields via format string + Fsize.C Bob Stout Return true apparent size of buffered file Fsm.C Demonstrates a finite state machine Getdcwd.C Bob Jarvis Get current working directory for given drive Getkey.C Bob Stout Get extended key codes Getseg.C Bob Stout Get segment and offset of any object Getstrng.C Ron Sires Safe gets() for input string of unknown length Glbl_Env.C Peter Thomas Update & remove global environment variables Grafline.C David Harmon Demo of PC line drawing characters + Hexorint.C Bob Stout Auto-convert hex or decimal strings Howdy.C Obfuscated C code * Hstr_I.C Bob Stout Convert hex string to int * Hugeread.C Bob Stout Read & write huge data using far pointers Hugesort.C Ray Gardner Quicksort using huge pointers Initvars.C Ray Gardner Read data into variables Iscons.C Bob Stout Does a FILE * refer to the console? Isfopen.C Bob Stout Is a FILE * in use? + Isisbn.C Maynard Hogg Validate ISBN (book) numbers Isnetdr.C Bob Dolan Determine is a drive is local or remote Ispow2.C Is a number an integral power of 2? Isqrt.C Integer square root Isramdsk.C Bob Stout Determine if a drive is a RAM disk + Isshare.C Mike Ratledge Determine if file sharing is enabled Isshift.C Jeff Dunlop Determine if a shift key is pressed * Iswprot.C Bob Stout Determine is a floppy is write protected Wayne King + Isxkbrd.C Ed Kowalski Detects extended (101+ key) keyboard Jdn.C Paul Schlyter Julian Day Number computation Ray Gardner Joystick.C Bob Stout Joystick support functions * Kb_Data.C Dan Kozak Keyboard status determination * Keylocks.C Caps/Num lock set/clear functions Keywatch.C Robert Mashlan Demonstrates capturing keyboard interrupt Lbitops.C Scott Dudley Large bit array macros Ldfloor.C Ray Gardner Long double floor * Ll_Msort.C Ray Gardner Linked list mergesort Ll_Qsort.C Jon Guthrie Linked list quicksort * Lsary.C Bob Stout Read a directory into a linked list Ltoa.C Bob Stout Convert long to a string Ltostr.C Thad Smith III Convert long to a string Lv1Ws.C Bob Stout Convert whitespace strings to single spaces Mainmain.C Obfuscated C code Mcb_Env.C Modify master environment using MCB's Mdalloc.C Blair Haukedal Multi-dimentional array alloction Memavail.C Thor Johnson Report available DOS memory Memrev.C Ray Gardner Assymetrical memory swap Mkdirs.C Bob Stout Build directory tree (deep mkdir()) * Moon_Age.C M. Jones Determine the phase of the moons for any date + Msb2Ieee.C Jeffrey Foy Convert MSBIN format to/from IEEE float Noctrlc.C Traps Ctrl-C, Ctrl-Break, Ctrl-Alt-Del Noreset.C Traps Ctrl-Alt-Del * Ord_Text.C Bob Stout Format ordinal numbers in English + Os_Id.H David Gibbs Header for determining PC OS's + Os_Id.C David Gibbs Determine PC OS * Pcnvrt.C Bob Stout Convert Pascal strings to C Perm_Idx.C Thad Smith III Determine permutation index Pfopen.C David Engel Open a file anywhere Pluraltx.C Bob Stout How to print proper plurals Prtoggle.C Bob Stout Tee stdio to stdprn Prtscrn.C Bob Stout Invoke BIOS print screen function Prtstat.C Bob Stout Determine printer status * Pushdir.C Bob Stout Stack-oriented CHDIR functions Rand1.C Phil Linttell Random number generator Rand2.C E. Schneider Random number generator Reboot.C Bob Stout Simple PC reboot function in C Redir.C F. Piette Demonstrates output redirection * Rg_Isort.C Ray Gardner Insertion sort function Rg_Qsort.C1 Ray Gardner Non-Recursive ANSI quicksort function * Rg_Qsort.C2 Ray Gardner Recursive ANSI quicksort function * Rg_Rand.C Ray Gardner Minimal random number generator Rg_Ssort.C Ray Gardner ANSI quicksort-compatible shellsort function Rmallws.C Bob Stout Remove all whitespace from a string Rmlead.C Bob Stout Remove leading whitespace from a string Rmtrail.C Bob Stout Remove trailing whitespace from a string Rndmize.C How to seed ANSI random number generator Scanfrac.C Thad Smith III Scans/converts text fractions * Scroll.C Bob Stout Scroll screen function Setenvar.C Bob Stout Set DOS master environment *legally* * Shel2Dos.C Bob Stout Shell to DOS from a running program Soundex.C Bob Jarvis Standard English soundex Speed.C Benchmark to calculate I/O performance + Spin.C Demo of how to make various text "spinners" * Srchfile.C Bob Stout Search files for text, forwards & backwards Sstrcpy.C Ray Gardner Overlapping strcpy() & strcat() work-alikes Stats.C Bob Stout Analyze file statistics Stptok.C Ray Gardner Improved tokenizing function + Str27Seg.C Bob Stout Convert numeric string to 7-segment displays Strftime.C Jim Nutt Non-locale version of ANSI strftime() Rob Duff Strrepl.C Gilles Kohl Replace substrings Strrev.C Bob Stout Reverse a string in place using XOR swapping Strsort.C Ray Gardner (Shell) Sort a string array Strucfil.C Lynn Nash Read/write structures to/from a file Style.C Suggested coding style guidelines + Tabtrick.C Demo using printf() for columnar formatting Timegetc.C Bob Jarvis Wait specified time for a keypress Toascii.C EBCDIC-ASCII conversion arrays Tp6Tod.C Thad Smith III Convert TP 6-byte reals to C doubles + Translat.C Jerry Coffin Translate string w/ C-style escape sequences Trim.C Bob Stout Trim leading, trailing, & embedded spaces Truename.C gk Normalize filename using undocumented DOS Unix2Dos.C Bob Stout Convert Unix-style pathnames to DOS-style + Vfname.C Sid Rogers Validate DOS-legal file names Video.C Jeff Dunlop C video information functions * Wb_Fcopy.C Walter Bright Fast file copy/append Weird.C Obfuscated C code * Whicharc.C Heinz Ozwirk Determine which archiver used on a packed file David Gersic * Windchil.C Compute wind chill factor Wordwrap.C Robert Morgan Simple CRT word wrap demonstration Xstrcat.C String concatenation funct Xstrcmp.C S. Offermann Compare strings using DOS wildcards | |-------------- FAQ file (answers to Frequently Asked Questions -------------- | * C_Prec.Txt Operator precedence/associativity in C / C++ Storage.Typ Jeff Galbraith C storage types crib sheet Rtlftrul.Txt Right-left rule for reading C * Ptr_Help.Txt Ted Jensen Helpful hints on pointers C_Port.Txt Joseph Carnage How to write portable C code Enums.Txt Helpful hints for enums * Which_C.Txt Bob Stout Guidelines for choosing a PC C compiler * Resource.Lst J-Mag Guthrie C/C++ resources (books, magazines, vendors) Environ.Txt Bob Stout Notes on changing the master environment Sharing.Txt Mike Ratledge How to check if file sharing is active Evsavres.Txt How to blank/restore EGA/VGA screen Ansisys.Txt Chart of ANSI screen control codes + Vt100.Txt Jon Guthrie Chart of VT-100 escape codes | |-------------- Jim Nutt's direct video functions ---------------------------- | Vio.H Direct screen package Vio.Asm " " " Scrnsave.C Bob Stout Save and restore text screens | |-------------- Bob Stout's Int 2Eh functions -------------------------------- | Int2E.Asm Access command processor "back door" Ccomcall.C C "glue" to use Int 2Eh | |-------------- Bob Stout's POSIX compliant directory functions -------------- | * Dirent.H POSIX compliant header * Rfind1St.C Compiler-independent find first/next functions Posixdir.C opendir(), readdir(), seekdir(), closedir() Posix_Ls.C Directory lister demo | |-------------- J. Kercheval's PD regular expression comparator -------------- | Match.H Header file Match.C Portable source including optional test code Match.Doc Documentation for Match.C | |-------------- Bob Stout/Sreenath Chary file name processing functions ------ | Dirmask.C Bob Stout Complex pattern matching (calls patmat()) Patmat.C Sreenath Chary String pattern matching Fln_Fix.C Bob Stout Crunch dot directories, verify DOS-valid paths Flnorm.C Bob Stout Full file name normalization | |-------------- Bob Stout/Lynn Lively/David Fox sound & timing package ------- | Uclock.H David L. Fox Microsecond timing function header * Uclock.C " " " Microsecond resolution timing functions Sound.H Bob Stout Sound functions header Sound.C " " Speaker control functions Mktone.C " " Tone generation functions Playlib.C Lynn R. Lively Background music package Playdemo.C Bob Stout Demo of backgroud music package | |-------------- Greg Messer's C/C++ comment extractor ------------------------ | Getcmt.C Greg Messer Extract comments from C/C++ source files Testcmt.C " " Test file for above | |-------------- Ray Gardner's scalar date function with calendar demo -------- | + Scaldate.H Ray Gardner Scalar ("Julian") date header * Scaldate.C Ray Gardner Scalar ("Julian") date functions * Daynum.C Bob Stout Return statistics about a given date Cal.C Bob Stout Calendar using Scaldate.C | |-------------- Ruurd Pels's FOSSIL access functions ------------------------- | * X00Api.H C header w/ prototype declarations * X00Api.C C access functions | |-------------- Robert Mashlan's PRINT.COM interface functions --------------- | * Prnspool.H C header w/ prototype declarations Prnspool.C PRINT.COM spool queue functions Printq.C Demo program for above | |-------------- Robert Mashlan's memory allocation strategy functions -------- | Strat.H C header w/ prototypes and enum'ed constants Strat.C C functions | |-------------- Jerry Coffin's word wrapping functions ----------------------- | W_Wrap.H C header w/ prototypes and enum'ed constants W_Wrap.C C functions Center.C Center a wrapped line | |-------------- Bob Stout's absolute sector read/write functions ------------- | Dos5Boot.H Header for boot sector access * Absdiskc.C C read and write functions Absdisk.Asm Low-level code for disk I/O, DOS 2-5 | |-------------- Mouse functions ---------------------------------------------- | Mouse.H Bob Jarvis Header w/ prototypes * Mouse.C Bob Jarvis Essential mouse stuff Scrnpick.C Ray McVay Demo, retrieves text from screen using mouse | |-------------- Martin Maney's fast line buffered file input ----------------- | Xfile.H Header w/ prototypes Xfile.C Contains xopen(), xclose(), xgetline() Xtest.C Demo for above | |-------------- Functions to get command line options ------------------------ | Getopt3.C AT&T compatible getopt(3) + Getopts.H Bob Stout Header for Getopts.C * Getopts.C Bob Stout Scan command line for switches | |-------------- String searching functions ----------------------------------- | * Pbmsrch.C Jerry Coffin Pratt-Boyer-Moore string search * Bmhsrch.C Ray Gardner Case-sensitive Boyer-Moore-Horspool search * Bmhisrch.C Thad Smith Case-insensitive Boyer-Moore-Horspool search * Bmhasrch.C Ray Gardner Case-insensitive BMH search w/ accented chars | |-------------- Bob Stout's extended keyboard stuff -------------------------- | Ext_Keys.H Header to define extended key codes Ext_Keys.C A getch() work-alike for extended keyboards | |-------------- Mark Kimes ANSI screen code interpreter ---------------------- | Doansi.H Header file Doansi_1.C Portable intepreter Doansi_2.C OS-specific support functions | |-------------- David Gibbs' multitasker functions for Win, OS/2, & DV ------- | + Tasker.Txt Description of Tasker functions + Tasker.H Header, structs, and prototypes + Tasker.C Detect multitasker and give up time slices | |-------------- PC compiler compatibility functions -------------------------- | Biport.H Bob Stout Header to port Borland _geninterrupt() Biport.C Bob Stout Port Borland code using pseudovariables * Fmemops.C Bob Stout Emulate MSC's _fmemxxx() in BC++ & ZTC++ Ftime.H Jeff Dunlop BC++-style file date/time struct & prototypes Ftime.C Jeff Dunlop BC++-style file date/time functions * Msc_Peek.C Bob Stout Add peek/poke to MSC Pmerge.C Bob Stout Portable fnmerge(), _makepath() equivalents * Psplit.C Bob Stout Portable fnsplit(), _splitpath() equivalents + Strdup.C Bob Stout Portable strdup() + Strupr.C Bob Stout Portable strupr() strlwr() * Vidport.C Bob Stout Portable gotoxy(), clrscr() equivalents, etc. + Big_Mall.H Bob Stout Portably allocate memory > 64Kb | |-------------- Bob Stout's Portable PC exception handling ------------------- | Except.Doc Information on programs below Cctrap.Asm Int 23h (Ctrl-C) trap Cbtrap.Asm Int 1Bh (Ctrl-Break) trap Trapflag.Asm Trap & flag Ints 23h & 1Bh Trapdemo.C Demo of TRAPFLAG.ASM Cerrinst.Asm Install DOS critical error handler Cerrtrap.Asm DOS critical error handler | |-------------- David Nugent's iostreams (C++) tutorial ---------------------- | + Iostutor.Txt Tutorial for following demo code + Myio.H Header for Myio.Cpp + Myio.Cpp Simple I/O class + Mystream.H iostream Interface for class Myio + Mystream.Cpp ios Interface implementation + Myline.H Simple line input classes + Myline.Cpp Implementation of myLine classes + Myiodemo.Cpp myio Loopback demo + Myio.Mak Makefile for Iostutor.Txt demo files | |-------------- David Nugent's simple string class --------------------------- | + Str.Doc Information on the string class + Str.H C++ header + Str.Cpp Simple, portable C++ string class | |-------------- Walter Bright's memory allocation debugging package ---------- | + Mem.Txt Information on the Mem package + Toolkit.H Compiler-independent portability header + Mem.H Mem package header + Mem.C Mem package code | |-------------- DOS utilities as demos --------------------------------------- | 2Dlife.C Jon Guthrie 2-D Life program Bigfac.C Carl Declerck Do large factorials using ASCII multiply Bincomp.C Ray Gardner Binary file comparison utility Bordcolr.C Bob Jarvis Set border color C_Cmnt.C Thad Smith Extract comments from a C source file Cdir.C Lynn R. Lively Like DOS CHDIR except changes drives as well Chbytes.C Bob Stout Edit binary files in place * Chmod.C Bob Stout Change DOS file attributes - wildcards, etc. + Cmdline.C Demonstation how to access command line args Commconv.C Jari Laaksonen Convert C++ style comments to C style Cursize.C Bob Jarvis Set the cursor size Do.C Specify multiple command line commands Dossort.C Robert Mashlan DOS SORT work-alike * Drivsrch.C Marty Connely Search for physical/logical drives Dspclock.C Mike Jones On-screen TSR clock Factor.C Ray Gardner Print prime factorization of a number (double) Filcount.C Bob Stout Count files/directories + Flopcopy.C Bob Stout Copy a floppy to a HD subdirectory * Fraction.C Thad Smith Convert a real number to an integer ratio Getvol.C Bob Stout Retrieve a disk volume label Head.C Unix head work-alike Hexdump.C Paul Edwards Hex/ASCII file dump utility Ifactor.C Ray Gardner Print prime factorization of a number (long) + Inchcvrt.C Bob Stout Convert inches to feet/inches and fractions Kbflip.C Bob Stout Set/clear Caps/Num/Scroll locks Killff.C Jerry Gore Strip FF characters from text files Erik VanRiper Log.C Robert Sprawls Utility to log working time * Lsd.C Bob Stout DOS DIR enhanced work-alike Lzhuf.C Yoshi Compression used in LHARC & LHA Maze_1.C Jon Guthrie Maze generator Maze_2.C Obfuscated maze generator + Maze_3.C Cute maze generator. Run, then enter size. Morse.C Mike Dodd Convert strings to morse code Mterm.C David Harmon Micro terminal (comm) program - use with X00 * Mv.C Ray McVay Move files Palndrom.C Dan Hoey Self-replicating palindrome - try it! Permute1.C Dave Chapman Permute strings Permute2.C Jon Guthrie Permute strings Pi.C Calculate PI to 60,000 digits or more + Pr.C Print a file with headers & breaks Query.C Bob Stout Timed query w/default for batch files Rdxcnvrt.C Bob Stout Convert between number bases * Remtab.C Robert Mashlan Convert tabs to spaces * Rm_All.C Bob Stout Remove all files - now supports recursion Roman.C Jim Walsh Convert Arabic number to Roman numeral Setimeto.C Bob Stout Set a file's time/datestamp to match another's * Setvol.C Bob Stout Set, change, or kill a disk volume label + Split.C Bob Stout Split large text files into smaller ones Stripeof.C Bob Stout Strip ^Z characters from DOS text files * Stub.C Bob Stout Truncate .OBJ (and other) files Sunriset.C Paul Schlyter Computes length of day at any place on Earth * Tail.C Joe Huffman Print last n (default = 5) lines of a file Ruurd Pels + Todaybak.C Bob Stout Back up today's files to a floppy Touch.C Ray L. McVay TC/TC++/BC++ set file time/date stamp Treedir.C Bob Stout Recursive directory lister Uuencode.C Don Kneller Unix uuencode Uudecode.C John Lots Unix uudecode Wc.C Jay Elkes Like Unix wc, counts lines, words, chars Where.C Search for a file | |-------------- Various flavors of grep utilities ---------------------------- | + Jgrep.C Jerry Coffin Simple and portable + Grep.C DECUS "Real" grep - free with some strings �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/snippets.txt�����������������������������������������0000755�0000764�0000144�00000002232�07055334234�016704� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������INFORMATION ABOUT SNIPPETS APR 94 EDITION ========================================= Beginning with the Dec '92 edition, SNIPPETS is being distributed in two forms. The first, and most familiar, is the full SNIPPETS collection. As before it is named "SNIPdddd.xxx", where "dddd" is the release date and "xxx" is the archive utility extension. For example, I distribute the Apr '94 edition as SNIP9404.LZH, using the LHA.EXE archive utility. New to the Dec '92 release was SNIPDIFF, an archive containing both files and a utility to create a complete and fully-validated SNIPPETS archive using files from the last edition of SNIPPETS which haven't changed. This represents a considerable saving in the size of the archive and, consequently, the time required to download it from bulletin boards and public information services. Beginning the Apr '93 release, SNIPDIFF became even smaller with the inclusion of DSAPP.EXE which allows that only the differences for changed files need be included. DSAPP.EXE is a public domain utility for applying changes, written by David Burton, and which is distributed with his excellent TLIB revision control system. ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/keylocks.c�������������������������������������������0000755�0000764�0000144�00000000457�07055334033�016272� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������static volatile unsigned char far *keyflags = (char far *)0x00400017; void setcaps(void) { *keyflags |= 0x40; } void clrcaps(void) { *keyflags &= ~0x40; } void setnumlock(void) { *keyflags |= 0x20; } void clrnumlock(void) { *keyflags &= ~0x20; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/absdiskc.c�������������������������������������������0000755�0000764�0000144�00000002041�07055333633�016225� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** ABSDISKC.C - Functions to read and write absolute disk sectors ** (these will work with all versions of DOS 2-5). ** ** Public domain code by Bob Stout ** ** NOTE: These functions work by calling absdisk() from SNIPPETS file, ** ABSDISK.ASM. */ #include <stddef.h> #include <dos.h> int _cdecl absdisk(unsigned char function, unsigned short drive, size_t number_of_sectors, size_t starting_sector, void * sector_buffer); int AbsDiskRead(unsigned short drive, size_t num_of_sectors, size_t sector, void *ptr) { return absdisk(0x25, drive, num_of_sectors, (unsigned)sector, ptr); } int AbsDiskWrite(unsigned short drive, size_t num_of_sectors, size_t sector, void *ptr) { return absdisk(0x26, drive, num_of_sectors, (unsigned)sector, ptr); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mem.txt����������������������������������������������0000755�0000764�0000144�00000021723�07055334102�015615� �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Walter Bright's MEM Package --------------------------- PREFACE: -------- The files, MEM.H and MEM.C which constitute the MEM package were originally published in the March-April 1990 edition of Micro Cornucopia magazine, now sadly out of print. The files as they appear in SNIPPETS have been edited somewhat to remove compiler dependencies and correct minor discrepancies. For those who don't already know, Walter Bright is the author of Datalight Optimum-C, the original optimizing C compiler for PC's. Through a succession of sales and acquisitions plus continual improvement by Walter,, his compiler became Zortech C++ and is now sold as Symantec C++. As such, it is the only major PC compiler which can claim single authorship. It also compiles faster than most other compilers and is still a market leader in its optimization technology. Like many other library and ancillary functions unique to Walter's compilers, the MEM package was originally something he wrote for his own use. As noted above, he published it only once but it has been included as an unheralded "freebie" in Walter's compilers for the past several years. Walter was kind enough to grant permission for its inclusion in SNIPPETS beginning with the April, '94 release. WHAT IS MEM?: ------------- MEM is a set of functions used for debugging C pointers and memory allocation problems. Quoting Walter, "Symptoms of pointer bugs include: hung machines, scrambled disks, failures that occur once-in-10,000 iterations, irreprodu- cible results, and male pattern baldness." After writing MEM for use in developing his own compiler and tools, he reported that its use reduced pointer bugs by as much as 75%. MEM is simple to add to existing programs and adds little or no overhead. USING MEM: ---------- Included in the MEM package is TOOLKIT.H, which isolates compiler and environmental dependencies. It should work as-is for most PC compilers and the Microsoft compiler for SCO Unix. Other environments may be customized by writing your own HOST.H file, using the existing definitions in TOOLKIT.H as examples and modifying the values to match your system. Using these techniques, the MEM package has been used successfully on Amigas, Macs, VAXes, and many other non-DOS systems. The MEM functions exactly parallel the standard library (plus 1 non-standard) memory allocation functions. To implement MEM in your program, simply do a global search-and-replace of the following functions: malloc() -> mem_malloc() calloc() -> mem_calloc() realloc() -> mem_realloc() free() -> mem_free() strdup() -> mem_strdup() At the beginning of main(), add the following lines: mem_init(); atexit(mem_term); In the header section of each of your C files, add... #include "mem.h" ...to every .C file which calls any of the above functions. The final step is to compile and link MEM.C into all programs using the MEM package. It really is a pretty simple procedure! MEM has 2 modes of operation, debugging and non-debugging. Use debugging mode during program development and then turn debugging off for final production code. Control of debugging is by defining the MEM_DEBUG macro. If the macro is defined, debugging is on; if undefined, debugging is off. The default is non-debugging, in which case the MEM functions become trivial wrappers for the standard functions, incurring virtually no overhead. WHAT MEM DOES: -------------- 1. ISO/ANSI verification: When Walter wrote MEM, compiler compliance with ANSI standards was still quite low. MEM verifies ISO/ANSI compliance for situations such as passing NULL or size 0 to allocation/reallocation functions. 2. Logging of all allocations and frees: All MEM's functions pass the __FILE__ and __LINE__ arguments. During alloca- tion, MEM makes an entry into a linked list and stores the file and line information in the list for whichever allocation or free function is called. This linked list is the backbone of MEM. When MEM detects a bug, it tells you where to look in which file to begin tracking the problem. 3. Verification of frees: Since MEM knows about all allocations, when a pointer is freed, MEM can verify that the pointer was allocated originally. Additionally, MEM will only allow a pointer to be freed once. Freed data is overwritten with a non-zero known value, flushing such problems as continuing to reference data after it's been freed. The value written over the data is selected to maximize the probability of a segment fault or assertion failure if your application references it after it's been freed. MEM obviously can't directly detect "if" instances such as... mem_free(p); if (p) ... ...but by guaranteeing that `p' points to garbage after being freed, code like this will hopefully never work and will thus be easier to find. 4. Detection of pointer over- and under-run: Pointer overrun occurs when a program stores data past the end of a buffer, e.g. p = malloc(strlen(s)); /* No space for terminating NUL */ strcpy(p,s); /* Terminating NUL clobber memory */ Pointer underrun occurs when a program stores data before the beginning of a buffer. This error occurs less often than overruns, but MEM detects it anyway. MEM does this by allocating a little extra at each end of every buffer, which is filled with a known value, called a sentinel. MEM detects overruns and underruns by verifying the sentinel value when the buffer is freed. 5. Dependence on values in buffer obtained from malloc(): When obtaining a buffer from malloc(), a program may develop erroneous and creeping dependencies on whatever random (and sometimes repeatable) values the buffer may contain. The mem_malloc() function prevents this by always setting the data in a buffer to a known non-zero value before returning its pointer. This also prevents another common error when running under MS-DOS which doesn't clear unused memory when loading a program. These bugs are particularly nasty to find since correct program operation may depend on what was last run! 6. Realloc problems: Common problems when using realloc() are: 1) depending on realloc() *not* shifting the location of the buffer in memory, and 2) depending on finding certain values in the uninitialized region of the realloc'ed buffer. MEM flushes these out by *always* moving the buffer and stomping on values past the initialized area. 7. Memory leak detection: Memory "leaks" are areas that are allocated but never freed. This can become a major problem in programs that must run for long periods without interrup- tion (e.g. BBS's). If there are leaks, eventually the program will run out of memory and fail. Another form of memory leak occurs when a piece of allocated memory should have been added to some central data structure, but wasn't. MEM find memory leaks by keeping track of all allocations and frees. When mem_term() is called, a list of all unfreed allocations is printed along with the files and line numbers where the allocations occurred. 8. Pointer checking: Sometimes it's useful to be able to verify that a pointer is actually pointing into free store. MEM provides a function... mem_checkptr(void *p); ...to do this. 9. Consistency checking: Occasionally, even MEM's internal data structures get clobbered by a wild pointer. When this happens, you can track it down by sprinkling your code temporarily with calls to mem_check(), which performs a consistency check on the free store. 10. Out of memory handling: MEM can be set using mem_setexception() (see MEM.H) to handle out-of-memory conditions in any one of several predefined ways: 1. Present an "Out of memory" message and terminate the program. 2. Abort the program with no message. 3. Mimic ISO/ANSI and return NULL. 4. Call a user-specified function, perhaps involving virtual memory or some other "emergency reserve". 5. Retry (be careful to avoid infinite loops!) 11. Companion techniques: Since MEM presets allocated and stomps on freed memory, this facilitates adding your own code to add tags to your data structures when debugging. If the structures are invalid, you'll know it because MEM will have clobbered your verification tags. SUMMARY: -------- Since it is, in the final analysis, a software solution, MEM is fallible. As the saying goes, "Nothing is foolproof because fools are so ingenious." Walter himself readily acknowledges that there are circumstances where your code can do sufficient damage to MEM's internal data structures to render it useless. The good news is such circumstances are few and far between. For most memory debugging, MEM is a highly reliable and valuable addition to your C programming toolchest. ���������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ord_text.c�������������������������������������������0000755�0000764�0000144�00000001231�07055334126�016270� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Originally published as part of the MicroFirm Function Library ** ** Copyright 1991, Robert B.Stout ** ** Subset version with modifications suggested by Maynard Hogg ** released to the public domain, 1992 ** ** Function to return ordinal text. */ static char *text[] = {"th", "st", "nd", "rd"}; char *ordinal_text(int number) { if (((number %= 100) > 9 && number < 20) || (number %= 10) > 3) number = 0; return text[number]; } #ifdef TEST #include <stdio.h> void main(void) { int i; for (i = 0; i < 26; ++i) printf("%d%s\n", i, ordinal_text(i)); } #endif /* TEST */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ansisys.txt������������������������������������������0000755�0000764�0000144�00000024521�07055333642�016537� �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ANSI.SYS's Escape Sequences Files. WARNING: You must press the ESC key, the [, the number wanted, then the tiny M key. Graphics functions: 0 : All Attributes Off 1 : Bold On 4 : Underscore (Monochrome Display Only) 5 : Blink On 7 : Reverse Video On 8 : Concealed On That's all for the Graphics Functions existing in ANSI.SYS. Foreground colors: 30 : Black 34 : Blue 31 : Red 35 : Magenta 32 : Green 36 : Cyan 33 : Yellow 37 : White Background colors: 40 : Black 44 : Blue 41 : Red 45 : Magenta 42 : Green 46 : Cyan 43 : Yellow 47 : White ( Background is finally the Foreground + 10 ) -------------------- Code Description ------------------------------------------------------------------------ Pn : Numeric Parameter - a Decimal Number that you Specify with ASCII digits. Ps : Selective Paramater - a Decimal Number that you use to select a Subfunction. You may specify More than One Sub- function by separating the parameters with semicolons. Pl : Line Parameter - a Decimal Number that you Specify with ASCII digits. Pc : Column Paramater - a Decimal Number that you Specify with ASCII digits. ------------------ Don't Forget! All theses sequences are precede by the ESC key. ------------------ Sequence Function ------------------------------------------------------------------------ [Pl;Pc H : Cursor Position (CUP) [Pl;Pc F : Horizontal & Vertical Position (HVP). CUP and HVP move the cursor to the position specified by the parameters. When no parameters are provided, the cursor move to the home position (the upper-left corner of the screen). [Pn A : Cursor Up (CUU) This sequence moves the cursor up Pn lines without chan- ging columns. If the cursor is Already on the Top line, then it's ignores the CUU sequence. [Pn B : Cursor Down (CUD) This sequence moves the cursor down Pn lines without chan- ging columns. If the cursor is already on the bottom line, then it's igrnores the CUD sequence. [Pn C : Cursor Forward (CUF) The CUF sequence moves the cursor forward Pn columns with- out changing lines. If the cursor is already in the far right column, then it's ignores the CUF sequence. [Pn D : Cursor Backward (CUB) This escape sequence moves the cursor back Pn columns with- out changing lines. If the cursor is already in the far left columns, then it's ignore the CUB sequence. [6n : Device Status Report (DSR) The console driver outputs an RCP sequence when it receives the DSR escape sequence. [s : Save Cursor Position (SCP) The console driver saves the current cursor position. This position can be restored with the RCP sequence. [u : Restore Cursor Position (RCP) This sequence restores the cursor position to the value it had when the console driver received the SCP sequence. [2j : Erase Display (ED) The ED sequence erases the screen. The cursor then goes to the home position. [K : Erase Line (EL) This sequences erases from the cursor to the end of the line (including cursor position). [Ps; ... ; Ps m: Set Graphics Rendition (SGR) The SGR escape sequence calls the graphic functions specified by the following numeric parameters. These functions remain until the next occurence of an SGR escape sequence. [=Ps h Set mode (SM) [=h The SM escape sequence changes the screen width or type [=0h to one of the following numeric parameters: Screen Width Parameters ---------------------------------- 0 : 40 x 25 B&W 1 : 40 x 25 color 2 : 80 x 25 B&W 3 : 80 x 25 color 4 : 320 x 200 color 5 : 320 x 200 B&W 6 : 640 x 200 B&W 7 : Wraps at the end of Each line 14 : 640 x 200 color 15 : 640 x 350 mono 16 : 640 x 350 color 17 : 640 x 480 color 18 : 640 x 480 color (both 17-18 are good) 19 : 320 x 200 color ------------------------------------ [= Ps 1 : Reset mode (RM) Parameters for RM are the same as for SM (Set Mode) except parameter 7 resets the mode that causes wrapping at the end of each line. [code;string;...p: Allows redefinition of keyboard keys to a specified string where: 'string' is either the ASCII code for a single character or a string contained in quotation marks. For example, both 65 and "A" can be used to represent an uppercase. 'code' is one or more of the following values that re- present keyboard keys. Semicolons shown in this table must be entered in addition to the required semicolons in the command line. Key Code ------------------------------------------------------------------------- Alone Shift- Ctrl- Alt- ------------------------------------------------------------------------- F1 0;59 0;84 0;94 0;104 F2 0;60 0;85 0;95 0;105 F3 0;61 0;86 0;96 0;106 F4 0;62 0;87 0;97 0;107 F5 0;63 0;88 0;98 0;108 F6 0;64 0;89 0;90 0;109 F7 0;65 0;90 0;100 0;110 F8 0;66 0;91 0;101 0;111 F9 0;67 0;92 0;102 0;112 F10 0;68 0;93 0;103 0;113 F11 0;133 0;135 0;137 0;139 F12 0;134 0;136 0;138 0;140 Home 0;71 55 0;119 ----- Up Arrow 0;72 56 ----- ----- Page Up 0;73 57 0;132 ----- Left Arrow 0;75 52 0;115 ----- Down Arrow 0;77 54 0;116 ----- End 0;79 49 0;117 ----- Page Down 0;81 51 0;118 ----- Insert 0;82 48 ----- ----- Delete 0;83 46 ----- ----- Printscreen ----- ----- 0;114 ----- ------------------------------------------ and for the keyboard's alphabeticals keys: ------------------------------------------ Key Code ------------------------------------------------------------------------ Alone Shift- Ctrl- Alt- ------------------------------------------------------------------------ A 97 65 1 0;30 B 98 66 2 0;48 C 99 67 3 0;46 D 100 68 4 0;32 E 101 69 5 0;18 F 102 70 6 0;33 G 103 71 7 0;34 H 104 72 8 0;35 I 105 73 9 0;23 J 106 74 10 0;36 K 107 75 11 0;37 L 108 76 12 0;38 M 109 77 13 0;50 N 110 78 14 0;49 O 111 79 15 0;24 P 112 80 16 0;25 Q 113 81 17 0;16 R 114 82 18 0;19 S 115 83 19 0;31 T 116 84 20 0;20 U 117 85 21 0;22 V 118 86 22 0;47 W 119 87 23 0;17 X 120 88 24 0;45 Y 121 89 25 0;21 Z 122 90 26 0;44 1 49 33 ----- 0;120 2 50 64 ----- 0;121 3 51 35 ----- 0;122 4 52 36 ----- 0;123 5 53 37 ----- 0;124 6 54 94 ----- 0;126 7 55 38 ----- 0;127 8 56 42 ----- 0;128 9 57 40 ----- 0;129 0 48 41 ----- 0;130 . 45 95 ----- 0;131 = 61 43 ----- ----- TAB 9 0;15 ----- ----- NULL 0;3 ----- ----- ----- �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/scrnmacs.h�������������������������������������������0000755�0000764�0000144�00000004701�07055334217�016264� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Macros for managing direct video writes by Jerry Houston ** ** prototypes for SCROLL.C and VIDPORT.C functions added by Bob Stout */ #if defined(__TURBOC__) #define FAR far #else #define FAR _far #endif #ifndef MK_FP #define MK_FP(seg,off) ((void far *)(((long)(seg) << 16)|(unsigned)(off))) #endif /* ** Text screen scrolling function from SCROLL.C in SNIPPETS */ #define SCROLL_UP 0 #define SCROLL_DN 1 void scroll(int direction, int num_lines, int vattrib, int ulrow, int ulcomumn, int lrrow, int lrcolumn); /* ** Functions in VIDPORT.C in SNIPPETS */ void GotoXY(int col, int row); void ClrScrn(int vattrib); void GetCurPos(int *col, int *row); int GetCurAtr(void); void ClrEol(void); void ClrEop(void); void Repaint(int vattrib); #if !defined(COLORMODE) #define COLORMODE ((*(char FAR *)0x0449) != 7) #define EXT_KBD (*(char FAR *)0x0496 & 16) #define VIDPAGE (*((unsigned char far *)0x0462)) #define ROWSIZE (*(int FAR *)0x044A) #define SCANLINES ((int)*(char FAR*)0x0461) #define SCRBUFF ((unsigned FAR *)((COLORMODE)?0xB8000000:0xB0000000)) #define SCREENSEG ((unsigned)((COLORMODE)?0xB800:0xB000)) #define SCREENSIZE ((*(int FAR *)0x044C) >> 1) #define SCREENCOLS (*(int FAR *)0x044A) #define SCREENROWS ((*(char FAR *)0x0484)?1+(*(char FAR *)0x0484):25) #endif /* COLORMODE = true/false, are we using color? EXT_KBD = true/false, extended keyboard in use? VIDPAGE = current video page in use SCANLINES = number of scan lines in a character. SCRBUFF = returns B800:0000 if using color, B000:0000 if mono. SCREENSEG = when you just need the segment portion. SCREENSIZE = number of (2-byte) cells required to save screen. SCREENCOLS = number of columns, often 80. SCREENROWS = number of rows, usually defaults to 25. */ /* ** colors -- Use as is for foreground colors ** For background, shift left by 4 and OR with ** foreground and possible video attributes */ #define BLACK 0 #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define MAGENTA 5 #define BROWN 6 #define WHITE 7 #define GRAY 8 #define LTBLUE 9 #define LTGREEN 10 #define LTCYAN 11 #define LTRED 12 #define LTMAGENTA 13 #define YELLOW 14 #define HIWHITE 15 /* hi-intensity white */ #define BG_(a) (((a) & 0x7f) << 4) ���������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/killff.c���������������������������������������������0000755�0000764�0000144�00000010073�07055334036�015713� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** KILLFF.C - A program was written to strip out all the Form Feeds ** in text files. ** ** Public domain by Erik VanRiper, 12/22/91 ** Modified by Bob Stout, 17 Feb 93 ** ** Reads a text file and makes a duplicate with NO Form Feed ** characters! The default action is to create a duplicate without ** Form Feeds, then remove the original and rename the dupliicate, ** although an explicit output file name may be specified. ** ** Form Feed characters are replaced with newline characters ('\n'). ** Since ANSI mandates that fwrite() will translate newlines when ** a stream is opened in text (non-binary) mode, these will appear ** in the ouput file in a format appropriate to the implementation, ** e.g. CRLF pairs on PC's. ** ** Usage: KILLFF filename [newname] */ #include <stdio.h> #include <string.h> #include <stdlib.h> #define BSIZ 32768U /* max size of read/write buffer */ main(int argc, char *argv[]) { FILE *in, *out; /* input and output files */ char name[80], /* name of file to be fixed */ temp[80], /* output file name */ *buf; /* buffer we will use to write */ /* *s; /* searching pointer */ size_t bad, /* check to see if write ok */ num; /* number of bytes read */ int retval = EXIT_SUCCESS, /* return value */ tmpflag = 0; /* non-zero if tmpnam() used */ printf("\nKILL FORM FEEDS by Erik VanRiper & Bob Stout\n\n"); if(argc < 2) /* usage info */ { puts("Usage: KILLFF input_file [output_file]"); puts("\nIf no output file is given, the input file will " "be replaced."); return retval; /* return to OS */ } strcpy(name,argv[1]); /* input filename */ if(argc == 3) strcpy(temp,argv[2]); /* outfile name */ else { tmpnam(temp); tmpflag = -1; } if((in = fopen(name,"r")) == NULL) /* Open in file */ { printf("\nCan't Open Input File %s",name); return (retval = EXIT_FAILURE); /* return to OS */ } if((out = fopen(temp,"wt")) == NULL) /* open out file */ { printf("\nCan't Open Output File %s",temp); fclose(in); /* close in file */ return (retval = EXIT_FAILURE); /* return to OS */ } if((buf = malloc(BSIZ)) == NULL) /* malloc a large buffer */ { printf("\nOut of memory\n"); return (retval = EXIT_FAILURE); /* return to OS */ } printf("Input file: %s Output file: %s\n", name,tmpflag ? name : temp); /* read in file while chars to read */ while (0 < (num = fread(buf,sizeof(char),BSIZ,in))) { size_t i; for (i = 0; i < num; ++i) /* look for FF */ if ('\f' == buf[i]) buf[i] = '\n'; /* change to newline */ bad=fwrite(buf,sizeof(char),num,out); /* write out buf */ if(bad != num) /* error */ { printf("\nCan't Write to %s ", temp); retval = EXIT_FAILURE; /* return to OS */ break; } } fclose(in); /* close in file */ fclose(out); /* close out file */ free(buf); /* free memory */ if (tmpflag) { if (remove(name)) { printf("Can't rename %s\n", name); printf("Converted file is named %s\n", temp); } else rename(temp, name); } printf("\nDone!"); /* Finished */ return retval; /* return to OS */ } /* List this source file to test this program! New page New page All done */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/make.ini���������������������������������������������0000755�0000764�0000144�00000007711�07055334055�015724� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # Master MAKE.INI file for NDMAKE # # jim nutt # 'the computer handyman' # .SUFFIXES : .doc .exe .prf .obj .cpp .c .a86 .asm .com .a86 # # generate response files for these as well as lib and link # .RESPONSE_LINK: tlink blink ztcmap .RESPONSE_LIB: tlib zorlib VPATH = .;c:\include; MAKE_TMP= $(TMP) # # some defaults # project = obj = cc = ztc mcflags = $p $s $w cflags = # # zortech c settings # ztclib = c:\lib\$(cc) # where are the libraries ztcinclude = c:\include\$(cc) ztclibrary = $(lib)\zl$(model) ztccompile = $(cc) -c -m$(options) ztcoptions = $(model) $(mcflags) -I$(include) -ic:\include ztcstartup = ztcwild = ztcscheck = -s ztcpcheck = ztcalign = -a ztcunsigned= -J ztccodeview= -g ztcmaxwarnings= -p -r ztcinline = -f ztcoptimize= -o+all -o+loop ztcmodel = -m ztcdefine = -d ztcstdc = -A # # quick c settings # qcllib = c:\lib\msc qclinclude = c:\include\msc qcllibrary = $(lib)\$(model)libcr $(lib)\libh qclcompile = qcl /c /X /Zl /A$(options) /D__MSC__=1 qcloptions = $(model) $(mcflags) /I$(include) qclstartup = qclwild = qclscheck = qclpcheck = /Zr qclalign = /Zp qclunsigned= qclcodeview= /Zi qclmaxwarnings = /W3 qclinline = /FPi87 qcloptimize= /Ox qclmodel = /A qcldefine = /D qclstdc = /Za # # msc 5.1 settings # msclib = c:\lib\msc mscinclude = c:\include\$(cc) msclibrary = $(lib)\$(model)libcr $(lib)\libh msccompile = cl /c /X /Zl /A$(options) /D__MSC__=1 mscoptions = $(model) $(mcflags) /I$(include) /Ic:\include mscstartup = mscwild = mscscheck = mscpcheck = mscalign = /Zp mscunsigned= msccodeview= /Zi mscmaxwarnings = /W3 mscinline = /FPi87 mscoptimize= /Owilt mscmodel = /A mscdefine = /D mscstdc = /Za # # turbo c settings # tcclib = c:\lib\$(cc) # where are the libraries tccinclude = c:\include\$(cc) tcclibrary = $(lib)\c$(model) tcccompile = $(cc) -c -m$(options) tccoptions = $(model) $(mcflags) -I$(include) tccstartup = $(lib)\c0$(model) tccwild = tccscheck = -N tccpcheck = tccalign = -a- tccunsigned= -K tcccodeview= -y tccmaxwarnings = -w -w-stv tccinline = -f87 tccmodel = -m tccdefine = -D tccoptimize= -O -G -r tccstdc = -A lib = $($(cc)lib) include = $($(cc)include) library = $($(cc)library) cxl = $(lib)\cxl$(model) options = $($(cc)options) compile = $($(cc)compile) $(cflags) startup = $($(cc)startup) wild = $($(cc)wild) libs = $(library) # compiler options a = $($(cc)align) # byte align structures c = $($(cc)codeview) # codeview debugging (if avail, else symdeb) d = $($(cc)define) # command line #define i = $($(cc)inline) # inline 8087 code generation m = $($(cc)model) # memory model selection p = $($(cc)pcheck) # pointer checking (if available) s = $($(cc)scheck) # turn on stack checking u = $($(cc)unsigned) # chars are unsigned o = $($(cc)optimize) # do max optimizations w = $($(cc)maxwarnings) # give maximum warnings stdc = $($(cc)stdc) # use ANSI standard keywords only model = S # the linker linkopt = /noi linker = link # an easy linking macros linklst = $($(project)obj),$(project),$(project),$(libs) $(linkopt); link = $(linker) $(wild) $(startup) $(linklst) # default rules markfile : calltree -z markfile *.c .c.exe : .c.obj $(linker) $(wild) $(startup) $*, $* ,$* ,$(libs) $(linkopt); .obj.exe : $(link) .c.obj : $(compile) $*.c .cpp.obj : $(cc) $* .asm.obj : masm $*; .a86.obj : a86 +o +s $*.a86 $*.obj .a86.com : a86 $*.a86 .a86.exe : a86 +o +s $*.a86 link $*; .prf.doc : proff $*.prf $*.doc �������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/chgext.c���������������������������������������������0000755�0000764�0000144�00000003336�07055333701�015730� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** chgext.c - Change a file's extension ** ** public domain by Bob Stout ** ** Arguments: 1 - Pathname ** 2 - Old extension (NULL if don't care) ** 3 - New extension ** ** Returns: Pathname or NULL if failed ** ** Note: Pathname buffer must be long enough to append new extension ** ** Side effect: Converts Unix style pathnames to DOS style */ #include <stdio.h> #include <string.h> char *chgext(char *path, char *oldext, char *newext) { char *p; /* Convert to DOS-style path name */ for (p = path; *p; ++p) if ('/' == *p) *p = '\\'; /* Find extension or point to end for appending */ if (NULL == (p = strrchr(path, '.')) || NULL != strchr(p, '\\')) p = strcpy(&path[strlen(path)], "."); ++p; /* Check for old extension */ if (oldext && strcmp(p, oldext)) return NULL; /* Add new extension */ while ('.' == *newext) ++newext; strncpy(p, newext, 3); return path; } #ifdef TEST void main(int argc, char *argv[]) { char *retval, *old_ext = NULL, path[128]; if (2 > argc) { puts("Usage: CHGEXT path [old_ext]"); puts("\nChanges extension to \".TST\""); puts("Old extension optional"); return; } strcpy(path, strupr(argv[1])); if (2 < argc) old_ext = strupr(argv[2]); if (NULL == (retval = chgext(path, old_ext, ".TSTstuff"))) puts("chgext() failed"); else printf("chgext(%s, %s, TST)\n...returned...\n%s\n", argv[1], old_ext ? old_ext : "NULL", path); } #endif /* TEST */ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/getdcwd.c��������������������������������������������0000755�0000764�0000144�00000003240�07055333773�016072� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** GETDCWD.C - returns the current working directory for a specific drive ** ** public domain by Bob Jarvis, modified by Bob Stout */ #if defined(__ZTC__) #define GetDrive(d) dos_getdrive(&d) #define FAR _far #elif defined(__TURBOC__) #define GetDrive(d) ((d) = getdisk() + 1) #define FAR far #else /* assume MSC */ #define GetDrive(d) _dos_getdrive(&d) #define FAR _far #endif #include <dos.h> #include <stdlib.h> #include <stdio.h> #include <ctype.h> char *getdcwd(unsigned int drive) /* 0 = current, 1 = A, 2 = B, etc */ { union REGS regs; struct SREGS sregs; char *retptr; retptr = calloc(FILENAME_MAX + 4, sizeof(char)); if(retptr == NULL) return NULL; if(drive == 0) /* figure out which drive is current */ { GetDrive(drive); drive += 1; } *retptr = (char)((drive-1) + 'A'); *(retptr+1) = ':'; *(retptr+2) = '\\'; segread(&sregs); regs.h.ah = 0x47; regs.h.dl = (unsigned char)drive; sregs.ds = FP_SEG((void FAR *)retptr); regs.x.si = FP_OFF((void FAR *)retptr) + 3; intdosx(®s, ®s, &sregs); if (15 == regs.x.ax) /* drive number invalid */ { free(retptr); return NULL; } else return retptr; } #ifdef TEST void main(int argc, char *argv[]) { char *curpath; unsigned int n; if(argc > 1) n = (tolower(*argv[1]) - 'a') + 1; else GetDrive(n); printf("curpath = '%s'\n", curpath = getdcwd(n)); if (curpath) free(curpath); } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cbtrap.asm�������������������������������������������0000755�0000764�0000144�00000002647�07055333671�016271� �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� PAGE ,132 ; Install a custom Interrupt 1b (Ctrl-Break exception) handler ; ; Public domain by Bob Stout ; ; Requires MASM 5.1 or later or equivalent ; ; Assemble with: MASM /Mx /z ... ; TASM /jMASM /mx /z ... % .MODEL memodel,C ;Add model support via command ;line macros, e.g. ;MASM /Dmemodel=LARGE .DATA? _origvec dd ? .DATA public cbrcvd cbrcvd dw 0 .CODE ; ; This is our actual ISR ; myint1b: mov ax,-1 mov cbrcvd,ax iret ; ; Call this to install our ISR ; ins1b PROC USES AX BX DS ES mov ax,351bh ;get old vector... int 21h mov word PTR _origvec,bx mov word PTR _origvec+2,es ;...and save it push cs ;get myint1b segment in DS pop ds mov dx, OFFSET myint1b ;install myint1b in int 1bh mov ax,251bh int 21h ret ins1b ENDP ; ; Call this to uninstall our ISR ; redo1b PROC USES AX BX DS mov dx, word PTR _origvec ;restore original vector mov ds, word PTR _origvec+2 mov ax,251bh int 21h ret redo1b ENDP end �����������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/lv1ws.c����������������������������������������������0000755�0000764�0000144�00000001537�07055334046�015526� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Originally published as part of the MicroFirm Function Library ** ** Copyright 1987-88, Robert B.Stout ** ** Subset version released to the public domain, 1992 ** ** Makes all whitespace single spaces. Passed a string, lv1ws() ** converts all multiple whitespace characters to single spaces. */ #include <ctype.h> void lv1ws(char *str) { char *ibuf = str, *obuf = str; int i = 0, cnt = 0; while(*ibuf) { if(isspace(*ibuf) && cnt) ibuf++; else { if (!isspace(*ibuf)) cnt = 0; else { *ibuf = ' '; cnt = 1; } obuf[i++] = *ibuf++; } } obuf[i] = '\0'; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/match.doc��������������������������������������������0000755�0000764�0000144�00000012446�07055334064�016072� �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� REGEX Globber (Wild Card Matching) A *IX SH style pattern matcher written in C V1.10 Dedicated to the Public Domain March 12, 1991 J. Kercheval [72450,3702] -- johnk@wrq.com *IX SH style Regular Expressions ================================ The *IX command SH is a working shell similar in feel to the MSDOS shell COMMAND.COM. In point of fact much of what we see in our familiar DOS PROMPT was gleaned from the early UNIX shells available for many of machines the people involved in the computing arena had at the time of the development of DOS and it's much maligned precursor CP/M (although the UNIX shells were and are much more flexible and powerful then those on the current flock of micro machines). The designers of DOS and CP/M did some fairly strange things with their command processor and OS. One of those things was to only selectively adopt the regular expressions allowed within the *IX shells. Only '?' and '*' were allowed in filenames and even with these the '*' was allowed only at the end of a pattern and in fact when used to specify the filename the '*' did not apply to extension. This gave rise to the all too common expression "*.*". REGEX Globber is a SH pattern matcher. This allows such specifications as *75.zip or * (equivelant to *.* in DOS lingo). Expressions such as [a-e]*t would fit the name "apple.crt" or "catspaw.bat" or "elegant". This allows considerably wider flexibility in file specification, general parsing or any other circumstance in which this type of pattern matching is wanted. A match would mean that the entire string TEXT is used up in matching the PATTERN and conversely the matched TEXT uses up the entire PATTERN. In the specified pattern string: `*' matches any sequence of characters (zero or more) `?' matches any character `\' suppresses syntactic significance of a special character [SET] matches any character in the specified set, [!SET] or [^SET] matches any character not in the specified set. A set is composed of characters or ranges; a range looks like 'character hyphen character' (as in 0-9 or A-Z). [0-9a-zA-Z_] is the minimal set of characters allowed in the [..] pattern construct. Other characters are allowed (ie. 8 bit characters) if your system will support them (it almost certainly will). To suppress the special syntactic significance of any of `[]*?!^-\', and match the character exactly, precede it with a `\'. To view several examples of good and bad patterns and text see the output of MATCHTST.BAT MATCH() and MATCHE() ==================== The match module as written has two parsing routines, one is matche() and the other is match(). Since match() is a call to matche() which simply has its output mapped to a BOOLEAN value (ie TRUE if pattern matches or FALSE otherwise), I will concentrate my explanations here on matche(). The purpose of matche() is to match a pattern against a string of text (usually a file name or specification). The match routine has extensive pattern validity checking built into it as part of the parser and allows for a robust pattern match. The parser gives an error code on return of type int. The error code will be one of the the following defined values (defined in match.h): MATCH_PATTERN - bad pattern or misformed pattern MATCH_LITERAL - match failed on character match (standard character) MATCH_RANGE - match failure on character range ([..] construct) MATCH_ABORT - premature end of text string (pattern longer than text string) MATCH_END - premature end of pattern string (text longer than pattern called for) MATCH_VALID - valid match using pattern The functions are declared as follows: BOOLEAN match (char *pattern, char *text); int matche(register char *pattern, register char *text); IS_VALID_PATTERN() and IS_PATTERN() =================================== There are two routines for determining properties of a pattern string. The first, is_pattern(), is designed simply to determine if some character exists within the text which is consistent with a SH regular expression (this function returns TRUE if so and FALSE if not). The second, is_valid_pattern() is designed to check the validity of a given pattern string (TRUE return if valid, FALSE if not). By 'validity', I mean well formed or syntactically correct. In addition, is_valid_pattern() has as one of it's parameters a return code for determining the type of error found in the pattern if one exists. The error codes are as follows and defined in match.h: PATTERN_VALID - pattern is well formed PATTERN_ESC - pattern has invalid literal escape ('\' at end of pattern) PATTERN_RANGE - [..] construct has a no end range in a '-' pair (ie [a-]) PATTERN_CLOSE - [..] construct has no end bracket (ie [abc-g ) PATTERN_EMPTY - [..] construct is empty (ie []) The functions are declared as follows: BOOLEAN is_valid_pattern (char *pattern, int *error_type); BOOLEAN is_pattern (char *pattern); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/speed.c����������������������������������������������0000755�0000764�0000144�00000007530�07055334246�015553� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/******** CALCULATE I/O PERFORMANCE TO NUL FILE ********/ #include <assert.h> #include <dos.h> #include <stdio.h> #include <stdlib.h> #define CHK 100 /* speed factor */ long ticks(long tick) /* GET BIOS TIME TICK */ { union REGS reg; reg.h.ah=0; int86(0x1A, ®, ®); return ((long)reg.x.cx<<16)+reg.x.dx-tick; } long time_it(void(*func)(void)) { long t = ticks(0L); (*func)(); return ticks(t); } void show_it(long t) { long lquot, lrem; t = (t*1000/182+5)/10; lquot = t/10; lrem = t%10; printf("%3ld.%02d sec", lquot, (int)lrem); } void t_printf(void) { register FILE *fp; register unsigned u; fp = fopen("NUL", "wt"); assert(fp != NULL); for (u=0; u<50*CHK; ++u) fprintf(fp, "Now is %d time for %d little indians\n", 123, -456); fclose(fp); } void b_printf(void) { register FILE *fp; register unsigned u; fp = fopen("NUL", "wb"); assert(fp != NULL); for (u=0; u<50*CHK; ++u) fprintf(fp, "Now is %d time for %d little indians\n", 123, -456); fclose(fp); } void tu_printf(void) { register FILE *fp; register unsigned u; fp = fopen("NUL", "wt"); assert(fp != NULL); setbuf(fp, NULL); for (u=0; u<5*CHK; ++u) fprintf(fp, "Now is %d time for %d little indians\n", 123, -456); fclose(fp); } void bu_printf(void) { register FILE *fp; register unsigned u; fp = fopen("NUL", "wb"); assert(fp != NULL); setbuf(fp, NULL); for (u=0; u<5*CHK; ++u) fprintf(fp, "Now is %d time for %d little indians\n", 123, -456); fclose(fp); } void t_write(void) { register FILE *fp; register unsigned u; fp = fopen("NUL", "wt"); assert(fp != NULL); for (u=0; u<250*CHK; ++u) fwrite("Now is the time for all good men to come\n", 41, 1, fp); fclose(fp); } void b_write(void) { register FILE *fp; register unsigned u; fp = fopen("NUL", "wb"); assert(fp != NULL); for (u=0; u<500*CHK; ++u) fwrite("Now is the time for all good men to come\n", 41, 1, fp); fclose(fp); } void tu_write(void) { register FILE *fp; register unsigned u; fp = fopen("NUL", "wt"); assert(fp != NULL); setbuf(fp, NULL); for (u=0; u<100*CHK; ++u) fwrite("Now is the time for all good men to come\n", 41, 1, fp); fclose(fp); } void bu_write(void) { register FILE *fp; register unsigned u; fp = fopen("NUL", "wb"); assert(fp != NULL); setbuf(fp, NULL); for (u=0; u<200*CHK; ++u) fwrite("Now is the time for all good men to come\n", 41, 1, fp); fclose(fp); } main(void) { show_it(time_it(t_printf)); printf(": time for text printf buffered\n"); show_it(time_it(b_printf)); printf(": time for binary printf buffered\n"); show_it(time_it(tu_printf)); printf(": time for text printf unbuffered\n"); show_it(time_it(bu_printf)); printf(": time for binary printf unbuffered\n"); show_it(time_it(t_write)); printf(": time for text write buffered\n"); show_it(time_it(b_write)); printf(": time for binary write buffered\n"); show_it(time_it(tu_write)); printf(": time for text write unbuffered\n"); show_it(time_it(bu_write)); printf(": time for binary write unbuffered\n"); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/sound.c����������������������������������������������0000755�0000764�0000144�00000001126�07055334243�015573� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** SOUND.C ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include "sound.h" void soundon(void) { short value; value = inp(SCNTRL); value |= SOUNDON; outp(SCNTRL, value); } void soundoff(void) { short value; value = inp(SCNTRL); value &= SOUNDOFF; outp(SCNTRL, value); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/sound.h����������������������������������������������0000755�0000764�0000144�00000007661�07055334244�015613� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** SOUND.H ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #if defined(__ZTC__) #include <int.h> #undef int_on #undef int_off #elif defined(__TURBOC__) #define int_on enable #define int_off disable #ifndef inp #define inp inportb #endif #ifndef outp #define outp outportb #endif #else /* assume MSC/QC */ #include <conio.h> #define int_on _enable #define int_off _disable #define getvect _dos_getvect #define setvect _dos_setvect #endif /* defines for mktone() update parameter: */ #define ON 0 /* turn the speaker on */ #define UPDATE 1 /* sound is on, just change freq */ #define TOGGLE 2 /* for delay use, turn on, then off */ /* port equates */ #define SCNTRL 0x61 /* sound control port */ #define SOUNDON 0x03 /* bit mask to enable speaker */ #define SOUNDOFF 0xfc /* bit mask to disable speaker */ #define C8253 0x43 /* port address to control 8253 */ #define SETIMER 0xb6 /* tell 8253 to expect freq data next */ #define F8253 0x42 /* frequency address on 8253 */ /* frequency equates (muscical scale) */ /* digit in label is octave number, S indicates Sharp (#) */ #define C0 36489 #define CS0 34445 #define D0 32512 #define DS0 30673 #define E0 28961 #define F0 27329 #define FS0 25804 #define G0 24351 #define GS0 22981 #define A0 21694 #define AS0 20473 #define B0 19326 #define C1 18244 #define CS1 17218 #define D1 16251 #define DS1 15340 #define E1 14480 #define F1 13668 #define FS1 12899 #define G1 12175 #define GS1 11493 #define A1 10847 #define AS1 10238 #define B1 9663 #define C2 9121 #define CS2 8609 #define D2 8126 #define DS2 7670 #define E2 7239 #define F2 6833 #define FS2 6450 #define G2 6088 #define GS2 5746 #define A2 5424 #define AS2 5119 #define B2 4832 #define C3 4561 #define CS3 4305 #define D3 4063 #define DS3 3835 #define E3 3620 #define F3 3417 #define FS3 3225 #define G3 3044 #define GS3 2873 #define A3 2712 #define AS3 2560 #define B3 2416 #define C4 2280 #define CS4 2152 #define D4 2032 #define DS4 1917 #define E4 1810 #define F4 1708 #define FS4 1612 #define G4 1522 #define GS4 1437 #define A4 1356 #define AS4 1280 #define B4 1210 #define C5 1140 #define CS5 1076 #define D5 1016 #define DS5 959 #define E5 905 #define F5 854 #define FS5 806 #define G5 761 #define GS5 718 #define A5 678 #define AS5 640 #define B5 604 #define C6 570 #define CS6 538 #define D6 508 #define DS6 479 #define E6 449 #define F6 427 #define FS6 403 #define G6 380 #define GS6 359 #define A6 339 #define AS6 320 #define B6 302 #define C7 285 #define CS7 269 #define D7 254 #define DS7 240 #define E7 226 #define F7 214 #define FS7 202 #define G7 190 #define GS7 180 #define A7 169 #define AS7 160 #define B7 151 #define C8 143 #define REST 0 typedef struct { unsigned int freq; unsigned int duration; } NOTE; #if __cplusplus extern "C" { #endif void mktone(int, int, unsigned), dosound(int), soundon(void), soundoff(void), playb_close(void); int playb_note(unsigned, unsigned); NOTE *playb_open(unsigned); #if __cplusplus } #endif �������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/split.c����������������������������������������������0000755�0000764�0000144�00000003554�07055334247�015611� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** SPLIT.C - A utility to split large text files into smaller files ** ** public domain by Bob Stout ** ** uses PSPLIT.C from SNIPPETS */ #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef __TURBOC__ #define FAR far #else #define FAR _far #endif void psplit(char *, char *, char *, char *, char *); int main(int argc, char *argv[]) { long newsize = 32L * 1024L; size_t seq = 0; char fname[FILENAME_MAX]; FILE *from; if (2 > argc) { puts("SPLIT big_file [size_in_K]\n"); puts("creates files of the same name, " "but with numeric extensions"); puts("a maximum file size may be specified for new files"); return EXIT_SUCCESS; } if (2 < argc) { newsize = atol(argv[2]); newsize <<= 10; } if (NULL == (from = fopen(argv[1], "r"))) { printf("\aSPLIT: error - can't open %s\n", argv[1]); return EXIT_FAILURE; } psplit(argv[1], NULL, NULL, fname, NULL); while (!feof(from)) { char newname[FILENAME_MAX], buf[1024]; FILE *to; long bytes; sprintf(newname, "%s.%03d", fname, seq++); if (NULL == (to = fopen(newname, "w"))) { printf("\aSPLIT: error - can't write %s\n", newname); return EXIT_FAILURE; } for (bytes = 0L; !feof(from) && (bytes < newsize); ) { if (fgets(buf, 1023, from)) { fputs(buf, to); bytes += (long)strlen(buf); } } fclose(to); printf("%s written\n", newname); } return EXIT_SUCCESS; } ����������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/lsary.c����������������������������������������������0000755�0000764�0000144�00000005130�07055334043�015572� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** LSARY - A simple directory lister using a filename array ** A public domain C demo program by Bob Stout */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <dos.h> /* For portability, make everything look like MSC 6 */ #if defined(__TURBOC__) #include <dir.h> #define _dos_findfirst(f,a,b) findfirst(f,b,a) #define _dos_findnext(b) findnext(b) #define find_t ffblk #ifndef _A_SUBDIR #define _A_SUBDIR FA_DIREC #endif #define attrib ff_attrib #define name ff_name #define size ff_fsize #define wr_time ff_ftime #define wr_date ff_fdate #define _dos_getdiskfree getdfree #define diskfree_t dfree #define avail_clusters df_avail #define sectors_per_cluster df_sclus #define bytes_per_sector df_bsec #else /* assume MSC/QC */ #include <errno.h> #endif #ifdef TRUE #undef TRUE #endif #ifdef FALSE #undef FALSE #endif #ifdef ERROR #undef ERROR #endif enum LOGICAL {ERROR = -1, SUCCESS, FALSE = 0, TRUE}; #ifndef CAST #define CAST(new_type,old_object) (*((new_type *)&(old_object))) #endif #define LAST_CHAR(s) (((char *)s)[strlen(s) - 1]) struct DirEntry { char fname[FILENAME_MAX]; struct DirEntry *next; } DirRoot = {"", NULL}; /* ** Read a directory into an array */ int ReaDirArray(char *path) { struct find_t ff; char pattern[67]; struct DirEntry *base = &DirRoot; strcpy(pattern, path); if ('/' != LAST_CHAR(pattern) && '\\' != LAST_CHAR(pattern)) strcat(pattern, "\\"); strcat(pattern, "*.*"); if (SUCCESS == _dos_findfirst(pattern, 0xff, &ff)) do { struct DirEntry *node; if (NULL == (node = malloc(sizeof(struct DirEntry)))) return ERROR; base->next = node; strcpy(base->fname, ff.name); node->next = NULL; *node->fname = '\0'; base = node; } while (SUCCESS == _dos_findnext(&ff)); return SUCCESS; } /* ** Simple directory lister */ void main(int argc, char *argv[]) { char *path; if (2 > argc) path = "."; else path = argv[1]; if (ERROR == ReaDirArray(path)) printf("*** Could not read %s\n", path); else { struct DirEntry *node = &DirRoot; printf("Directory of %s\n\n", path); while (node) { puts(node->fname); node = node->next; } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/patmat.c���������������������������������������������0000755�0000764�0000144�00000011240�07055334130�015722� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <stddef.h> #include <string.h> /*********************************************************************** ** ** ** Function : patmat ** ** ** ** Purpose : Pattern Matching ** ** ** ** Usage : Pass two string pointers as parameters.The first ** ** being a raw string & the second a pattern the raw ** ** string is to be matched against.If the raw string ** ** matches the pattern,then the function returns a ** ** 1,else it returns a 0. ** ** ** ** e.g patmat("abcdefghi","*ghi") returns a 1. ** ** patmat("abcdefghi","??c??f*") returns a 1. ** ** patmat("abcdefghi","*dh*") returns a 0. ** ** patmat("abcdefghi","*def") returns a 0. ** ** ** ** The asterisk is a wild card to allow any charac- ** ** ters from its first appearance to the next spec- ** ** ific character.The character ? is a wild card ** ** for only one character in the position it appears.** ** Combinations such as "*?" or "?*" or "**" are ** ** illegal for obvious reasons & the functions may ** ** goof,though I think it will still work. ** ** ** ** Author : Sreenath Chary Nov 29 1988 ** ** ** ** Logic : The only simple way I could devise is to use ** ** recursion.Each character in the pattern is ** ** taken & compared with the character in the raw ** ** string.If it matches then the remaining amount ** ** of the string & the remaining amount of the ** ** pattern are passed as parameters to patmat again ** ** until the end of the pattern.If at any stage ** ** the pattern does not match,then we go back one ** ** level & at this level if the previous character ** ** was a asterisk in the pattern,we hunt again from ** ** where we left off,otherwise we return back one ** ** more level with a not found & the process goes ** ** on till the first level call. ** ** ** ** Only one character at a time is considered,except ** ** when the character is an asterisk.You'll get the ** ** logic as the program unfolds. ** ** ** ***********************************************************************/ patmat(char *raw,char *pat) { int i, slraw; if ((*pat == '\0') && (*raw == '\0')) /* if it is end of both */ return( 1 ) ; /* strings,then match */ if (*pat == '\0') /* if it is end of only */ return( 0 ) ; /* pat tehn mismatch */ if (*pat == '*') /* if pattern is a '*' */ { if (*(pat+1) == '\0') /* if it is end of pat */ return( 1 ) ; /* then match */ for(i=0,slraw=strlen(raw);i<=slraw;i++)/* else hunt for match*/ if ((*(raw+i) == *(pat+1)) || /* or wild card */ (*(pat+1) == '?')) if (patmat(raw+i+1,pat+2) == 1) /* if found,match */ return( 1 ) ; /* rest of pat */ } else { if (*raw == '\0') /* if end of raw then */ return( 0 ) ; /* mismatch */ if ((*pat == '?') || (*pat == *raw)) /* if chars match then */ if (patmat(raw+1,pat+1) == 1) /* try & match rest of it*/ return( 1 ) ; } return( 0 ) ; /* no match found */ } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/files.c����������������������������������������������0000755�0000764�0000144�00000004575�07055333757�015571� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** FILES.C: A program to determine the number of file handles ** ** Released in to the Public Domian by Matthew Hunt @ 1:129/135, in the ** hopes that no "programmer" will be so lazy that he|she simple reads ** the CONFIG.SYS file ever again. ** ** Any improvements and modifications are welcome, but I ask that all ** modified versions also be placed into the Public Domain. ** ** Information on the List of Lists and SFT format was provided by ** PC Magazine November 26, 1991, and PC Interrupts by Ralf Brown ** and Jim Kyle. FILES.C was originally written for Power C. ** ** Modifcations for other compiler support by Bob Stout @ 1:106/2000.6 */ #include <dos.h> #ifdef __TURBOC__ #define FAR far #else #define FAR _far #endif #ifndef MK_FP #define MK_FP(seg,offset) \ ((void FAR *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #endif /* ** This is the format for a System File Table header. SFT's are a linked ** list in which the header points to the next SFT, is followed by the ** number of FILES in this SFT, and ends with the FILES themselves, which ** are not important here. */ struct SFT_HEADER { struct SFT_HEADER (FAR *next); unsigned number; }; /* ** Walk the SFT linked list, counting file handles as we go */ int files(void) { struct SFT_HEADER (FAR *sft); unsigned int segment, offset; int count=0; union REGS regs; struct SREGS sregs; /* Get ptr to List of Lists in ES:DX */ regs.x.ax = 0x5200; segread(&sregs); intdosx(®s, ®s, &sregs); /* Get ssss:oooo to first SFT */ segment = *((unsigned FAR *)(MK_FP(sregs.es, regs.x.bx + 6))); offset = *((unsigned FAR *)(MK_FP(sregs.es, regs.x.bx + 4))); /* Point our structure to it. */ sft = MK_FP(segment, offset); do { count += sft->number; /* Add the number of FILES */ sft = sft->next; /* Point to next one */ } while(FP_OFF(sft->next) != 0x0FFFF); /* Last one in the chain */ /* Add the FILES for the last entry */ count += sft->number; return count; } #ifdef TEST #include <stdio.h> #include <stdlib.h> int main(void) { printf("Number of FILES entries: %d", files()); return EXIT_SUCCESS; } #endif /* TEST */ �����������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/scrnpick.c�������������������������������������������0000755�0000764�0000144�00000003202�07055334217�016255� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* program: mousword.c * programmer: Ray L. McVay * date: 20 Oct 1988 * modified: 15 Feb 93 by Bob Stout to use Bob Jarvis' MOUSE.H and MOUSE.C * * Demonstration of picking "words" off a text mode PC screen using a mouse. * Submitted to the C_ECHO and placed in the public domain, 7 Jun 1992. */ #include <stdio.h> #include <stdlib.h> #include "mouse.h" char word[80]; int FAR *scrn = (int FAR *)0xb8000000L; /* See VIO.H for a better way */ void getword(char *, int, int); main(void) { int done, b, x, y; ms_reset(&b); /* reset */ ms_show_cursor(); for (done = 0; !done; ) { b = ms_get_mouse_pos(&x, &y); if (b == 1) { ms_hide_cursor(); getword(word, x/8, y/8); do { b = ms_get_mouse_pos(&x, &y); } while (b); if (*word) printf("{%s}\n", word); ms_show_cursor(); } else if (b > 1) done = 1; } ms_reset(&b); return 0; } void getword(char *w, int x, int y) { int txs, txe, ci; for (txs = x; (txs >= 0) && ((scrn[80 * y + txs] & 255) != 32); txs--) scrn[80 * y + txs] = (scrn[80 * y + txs] & 255) | 0x7000; for (txe = x; (txe < 80) && ((scrn[80 * y + txe] & 255) != 32); txe++) scrn[80 * y + txe] = (scrn[80 * y + txe] & 255) | 0x7000; for (ci = txs + 1; ci < txe; ci++) *w++ = (char)scrn[80 * y + ci]; *w = 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/fpswitch.c�������������������������������������������0000755�0000764�0000144�00000002637�07055333765�016312� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** FPSELECT.C - Demonstrates using function pointers in lieu of switches */ #include <stdlib.h> /* for NULL */ /* Declare your functions here */ char *cpfunc1(int); char *cpfunc2(int); char *cpfunc3(int); void vfunc1(void); void vfunc2(void); void vfunc3(void); void vfunc4(void); /* ** Old ways using switch statements */ char *oldcpswitch(int select, int arg) { switch (select) { case 1: return cpfunc1(arg); case 2: return cpfunc2(arg); case 3: return cpfunc3(arg); default: return NULL; } } void oldvswitch(int select) { switch (select) { case 1: vfunc1(); break; case 2: vfunc2(); break; case 3: vfunc3(); break; case 4: vfunc4(); break; } } /* ** Using function pointers */ char *newcpswitch(int select, int arg) { char *(*cpfunc[3])(int) = { cpfunc1, cpfunc2, cpfunc3 }; if (select < 1 || select > 3) return NULL; return (*cpfunc[select-1])(arg); } void newvswitch(int select) { void (*vfunc[4])(void) = { vfunc1, vfunc2, vfunc3, vfunc4 }; if (select > 0 && select < 5) (*vfunc[select-1])(); } �������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/missing.txt������������������������������������������0000755�0000764�0000144�00000002041�07055334103�016501� �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� M.I.A. Files ------------ Several folks have asked about the files that inevitably disappear from one SNIPPETS release to the next. Some have gone so far as to suggest I include a brief rationale within SNIPPETS.NDX why each deleted entry (marked with a '-' in the first column) was dropped. This would be impractical since SNIPPETS.NDX is more than a simple index - it also acts as the control file for SNIPDIFF. A such it is maintained by a separate program and its entries read in order when producing SNIPDIFF. More importantly, its file verification tag is computed during the automatic maintenance cycle. In other words, it's more work than I want to tackle right now, OK? This file is therefore a separate list of all the files deleted from SNIPPETS since the last release along with the reason they were removed: Dow.H : Bug in early 21st century - replaced by function in SCALDATE.C Dd_Struc.C : Renamed DD_STRUCT.H Figets.C : Buggy, not yet fixed �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/setenvar.c�������������������������������������������0000755�0000764�0000144�00000010011�07055334221�016257� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** SETENVAR.C - Program which sets the DOS master environment upon exit ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <conio.h> #include <dos.h> #if !defined(__ZTC__) && !defined(__TURBOC__) #define MK_FP(seg,offset) \ ((void far *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #define peek(s,o) (*((unsigned far *)(MK_FP(s,o)))) #define poke(s,o,w) (*((unsigned far *)(MK_FP(s,o)))=(w)) #endif #define SUCCESS 0 #define ERROR -1 static unsigned head, tail, start, end; static int idx = 0; static unsigned keystack[16][2]; /* ** ungetkey() ** ** Stuffs characters into the keyboard buffer. ** ** Parameters: 1 - Extended character to stuff ** ** Returns: SUCCESS or EOF ** ** Note: This function assumes that the keyboard buffer is in ** the normal (for IBM) location of 40:1E. ** */ int ungetkey(unsigned key) { int count; #ifdef __ZTC__ peek(0x40, 0x1a, &head, sizeof(unsigned)); peek(0x40, 0x1c, &tail, sizeof(unsigned)); peek(0x40, 0x80, &start, sizeof(unsigned)); peek(0x40, 0x82, &end, sizeof(unsigned)); #else head = peek(0x40, 0x1a); tail = peek(0x40, 0x1c); start = peek(0x40, 0x80); end = peek(0x40, 0x82); #endif count = tail - head; if (0 > count) count += (16 * sizeof(unsigned)); count >>= 1; if (15 > count) { #ifdef __ZTC__ peek(0x40, tail, &keystack[idx][0], sizeof(unsigned)); #else keystack[idx][0] = peek(0x40, tail); #endif keystack[idx][1] = tail; #ifdef __ZTC__ poke(0x40, tail, &key, sizeof(unsigned)); #else poke(0x40, tail, key); #endif tail += sizeof(unsigned); if (end <= tail) tail = start; #ifdef __ZTC__ poke(0x40, 0x1c, &tail, sizeof(unsigned)); #else poke(0x40, 0x1c, tail); #endif return key; } return EOF; } /* ** KB_stuff() ** ** Stuffs strings into the keyboard buffer. ** ** Parameters: 1 - String to stuff ** ** Returns: SUCCESS if successful ** ERROR in case of error, plus beyboard buffer is ** restored ** ** Note: This function assumes that the keyboard buffer is in ** the normal (for IBM) location of 40:1E. */ int KB_stuff(char *str) { int ercode = SUCCESS; idx = 0; while (*str) { if (EOF == ungetkey((unsigned)(*str++))) { while (0 <= --idx) { tail = keystack[idx][1]; #ifdef __ZTC__ poke(0x40, tail, &keystack[idx][0], sizeof(unsigned)); #else poke(0x40, tail, keystack[idx][0]); #endif } #ifdef __ZTC__ poke(0x40, 0x1c, &tail, sizeof(unsigned)); #else poke(0x40, 0x1c, tail); #endif ercode = ERROR; break; } else ++idx; } idx = 0; return ercode; } void main(int argc, char *argv[]) { FILE *bfile; if (3 > argc) { puts("\aUsage: SETENVAR envar datum"); abort(); } bfile = fopen("$TMP$.BAT", "w"); fprintf(bfile, "SET %s=%s\ndel $tmp$.bat\x1a", argv[1], argv[2]); fclose(bfile); while (kbhit()) getch(); KB_stuff("$tmp$\r"); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/dd_struc.h�������������������������������������������0000755�0000764�0000144�00000002032�07055333721�016254� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** DosDate macros - access bitfield values from DOS file date & time ** for Borland C and C++ compilers by: Wayne Hamilton */ #define dd_yr(d) (((struct { unsigned day:5, mo:4, yr:7; } *) &d)->yr) #define dd_mo(d) (((struct { unsigned day:5, mo:4, yr:7; } *) &d)->mo) #define dd_day(d) (((struct { unsigned day:5, mo:4, yr:7; } *) &d)->day) #define dd_hr(t) (((struct { unsigned sec:5, mn:6, hr:5; } *) &t)->hr) #define dd_mn(t) (((struct { unsigned sec:5, mn:6, hr:5; } *) &t)->mn) #define dd_sec(t) (((struct { unsigned sec:5, mn:6, hr:5; } *) &t)->sec) /* then: year = dd_yr(ffblk.ff_date); */ #ifdef TEST #include <stdio.h> #include <dir.h> main(int argc, char *argv[]) { struct ffblk ff; findfirst(argv[0], &ff, 0xff); printf("%s was saved on %d-%d-%d at %d:%02d:%02d\n", argv[0], dd_mo(ff.ff_fdate), dd_day(ff.ff_fdate), dd_yr(ff.ff_fdate), dd_hr(ff.ff_ftime), dd_mn(ff.ff_ftime), 2 * dd_sec(ff.ff_ftime)); return 0; } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cursor.c���������������������������������������������0000755�0000764�0000144�00000004540�07055333717�015770� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*****************************************************************/ /** CURSOR() **/ /** ARGUMENTS: A char variable identifiny what to do with **/ /** the cursor. **/ /** RETURN: none **/ /** **/ /** DESCRIPTION: This function receives a character which **/ /** tells it to do one of several things. **/ /** Turn the cursor on or off, or save the **/ /** cursor positon, or restore the position. **/ /** **/ /** BY Bill Wilkie, 1988 **/ /*****************************************************************/ #include <dos.h> static int position; /* global to hold cursor postion */ void cursor(char tmp) { union REGS inregs,outregs; /* cpu registers */ switch(tmp) { case 'h' : /* CURSOR OFF */ inregs.h.ah = 1; /* set cursor size */ inregs.h.ch = 0x20; /* set bit turns cursor off */ int86(0x10,&inregs,&outregs); break; case 's' : /* SAVE CURSOR POSITION */ inregs.h.ah = 3; /* read cursor positon and size */ inregs.h.bh = 0; /* from page zero */ int86(0x10,&inregs,&outregs); position = outregs.x.dx; /* store positon */ break; case 'r' : /* RESTORE CURSOR POSITON */ inregs.h.ah = 2; /* set cursor positon */ inregs.h.bh = 0; /* on page zero */ inregs.x.dx = position; /* at this old position */ int86(0x10,&inregs,&outregs); break; case 'o' : /* CURSOR ON */ inregs.h.ah = 1; /* set cursor size */ inregs.h.ch = 6; /* cursor start line */ inregs.h.cl = 7; /* cursor end line */ int86(0x10,&inregs,&outregs); break; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/stats.c����������������������������������������������0000755�0000764�0000144�00000003370�07055334251�015603� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/****************************************************************/ /* */ /* Collect file statistics */ /* */ /* Public domain demo program for analyzing encrypted */ /* files. By: Bob Stout */ /* */ /****************************************************************/ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <assert.h> main(int argc, char *argv[]) { int i, ch, hist = 0; long n = 0L; double mean = 0., stdev = 0., ftmp; static unsigned bins[256]; FILE *infile; assert(infile = fopen(argv[1], "rb")); while (!feof(infile)) { if (EOF == (ch = fgetc(infile))) break; bins[ch] += 1; ++n; } fclose(infile); for (i = 0; i < 256; ++i) { mean += (double)(bins[i]); if (bins[i]) ++hist; } mean /= 256.; for (i = 0; i < 256; ++i) { ftmp = (double)(bins[i]) - mean; stdev += (ftmp * ftmp); } ftmp = stdev / 255.; stdev = sqrt(ftmp); printf("%ld Characters were read from %s\n" "There are an average of %f occurances of each character\n" "%d Characters out of 256 possible were used\n" "The standard deviation is %f\n" "The coefficient of variation is %f%%\n", n, argv[1], mean, hist, stdev, (100. * stdev) / mean); return EXIT_SUCCESS; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/perm_idx.c�������������������������������������������0000755�0000764�0000144�00000002010�07055334134�016242� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Determine the permutation index for a given permutation list. ** Written by Thad Smith III, Boulder, CO 8/31/91 ** Hereby contributed to the Public Domain. ** ** The following function computes the ordinal of the given permutation, ** which is index of the permutation in sorting order: ** 1, 2, ..., n-1, n is index 0 ** 1, 2, ..., n, n-1 is index 1 ** ... ** n, n-1, ..., 2, 1 is index n! -1 ** ** The actual values of the elements are immaterial, only the relative ** ordering of the values is used. ** ** pit[] is the array of elements of length size. ** The return value is the permutation index. */ int perm_index (char pit[], int size) { int i; register int j, ball; int index = 0; for (i = 1; i < size; i++) { ball = pit[i-1]; for (j = i; j < size; j++) { if (ball > pit[j]) index ++; } index *= size - i; } return index; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/stripeof.c�������������������������������������������0000755�0000764�0000144�00000002701�07055334265�016302� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** STRIPEOF.C ** ** public domain demo by Bob Stout */ #include <stdio.h> #include <stdlib.h> #include <io.h> #include <fcntl.h> #define BUFSIZE 16384 int main(int argc, char *argv[]) { char *buf; if (2 > argc) { puts("Usage: STRIPEOF filename1 [...filenameN]"); return EXIT_FAILURE; } if (NULL == (buf = malloc(BUFSIZE))) { puts("STRIPEOF internal failure"); return EXIT_FAILURE; } while (--argc) { int fd; size_t bytes; int found = 0; long zpos = 0L; if (-1 == (fd = open(*(++argv), O_RDWR | O_BINARY))) { printf("Couldn't open %s\n", *argv); return EXIT_FAILURE; } while (0 < (bytes = read(fd, buf, BUFSIZE))) { int i; for (i = 0; i < (int)bytes; ++i) { if (('Z' - 64) == buf[i]) { found = 1; zpos += i; break; } } if (found) break; zpos += bytes; } if (found) chsize(fd, zpos); } return EXIT_SUCCESS; } ���������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/str.cpp����������������������������������������������0000755�0000764�0000144�00000014533�07055334254�015623� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// // Implements simple string class 'str' // # include "str.h" # include <string.h> # include <memory.h> # if defined( _MSC_VER ) # pragma warning(disable:4505) # endif # define STDLEN 32 extern "C" void * malloc (unsigned sz); extern "C" void free (void * ptr); # if defined( PLACEMENT_NEW_BUG ) inline void * operator new (unsigned sz, short allocsz) { return malloc (sz + allocsz); } # else void * refstr::operator new (unsigned sz, short allocsz) { return malloc (sz + allocsz); } # endif void str::_strinit (char const * s, short len, short siz) { if (len < 0) len = (short) ((s) ? strlen (s) : 0); if (siz < 0) siz = STDLEN; if (siz < len + 1) siz = short(len + 1); strdata = new(siz) refstr(len, siz); if (s && len) memcpy (c_ptr(), s, len); } // Called whenever string is to be modified or grown int str::_chksize (short sz) { refstr * old = 0; if (strdata->_refs > 1) // Need to dup memory --strdata->_refs; // Dec existing string reference else if (sz >= size()) old = strdata; else return 0; _strinit (c_ptr(), length(), sz); delete old; return 1; } str & str::operator= (str const & s) { if (&s != this) { if (!--strdata->_refs) delete strdata; strdata = s.strdata; ++strdata->_refs; } return *this; } str & str::operator= (char const * s) { if (s != c_ptr()) { short len = (short) strlen (s); _chksize (len); memcpy (c_ptr(), s, len + 1); strdata->_length = len; } return *this; } str & str::operator= (char c) { _chksize (1); *c_ptr() = c; strdata->_length = 1; return *this; } short str::insert (short pos, char const * s, short len) { if (len < 0) len = (short) strlen (s); if (len) { short leng = strdata->_length; if (pos < 0 || pos > leng) pos = leng; _chksize (short(leng + len)); char * buf = c_ptr(); if (pos < leng) memmove (buf + pos + len, buf + pos, leng - pos); memcpy (buf + pos, s, len); strdata->_length += len; } return length(); } short str::remove (short pos, short len) { if (pos >= 0 && pos < length()) { short leng = strdata->_length; if (len < 0 || (pos + len) > leng) len = short(leng - pos); if (len) { _chksize (0); char * buf = c_ptr(); memcpy (buf + pos, buf + pos + len, leng - (pos + len)); strdata->_length -= len; } } return length(); } short str::replace (short pos, char const * s, short clen, short len) { if (pos >= 0) { short leng = strdata->_length; if (clen < 0 || (pos + clen) > leng) clen = short(leng - pos); if (len < 0) len = (short) strlen (s); if (pos > leng) pos = leng; _chksize (short(leng - clen + len)); char * buf = c_ptr(); if (clen != len && clen) memmove (buf + pos + len, buf + pos + clen, leng - (pos + clen - len)); if (len) memcpy (buf + pos, s, len); strdata->_length += short(len - clen); } return length(); } str & str::left (short len, char padch) { if (len < 0) return right (short(-len), padch); short leng = strdata->_length; if (len != leng) { _chksize (len); if (len > leng) memset (strdata->ptr() + leng, padch, leng - len); strdata->_length = len; } return *this; } str & str::right (short len, char padch) { if (len < 0) return left(-1, padch); short leng = strdata->_length; if (len != leng) { _chksize (len); if (len > leng) { char * buf = strdata->ptr(); memmove (buf + len - leng, buf, leng); memset (buf, padch, len - leng); } strdata->_length = len; } return *this; } str & str::mid (short pos, short len, char padch) { if (pos <= 0) return left(len, padch); short leng = strdata->_length; if (pos > leng) pos = leng; if (leng < len) // Are we padding? { _chksize (len); char * buf = strdata->ptr(); short nlen = short((len - (leng - pos)) / 2); if (nlen > 0) { memmove (buf, buf + pos, leng - pos); memset (buf + leng - pos, padch, nlen); strdata->_length -= short(pos - nlen); } } return right (len, padch); } int str::_concat (char const * s, short len) { if (len < 0) len = (short) strlen (s); if (len) { _chksize (short(len + length())); memcpy (c_ptr() + length(), s, len); strdata->_length += len; } return length(); } short str::removech (char const * clist) { short result = 0; if (*clist) { char * buf, * sub; buf = sub = strdata->ptr(); short nlen = strdata->_length; for (short i = 0; i < nlen; ++i) { if (strchr (clist, *buf) == 0) { if (result) *sub = *buf; ++sub; } else { if (!result) _chksize (0); ++result; } ++buf; } strdata->_length = short(nlen - result); } return result; } short str::countch (char const * clist) { short result = 0; if (*clist) { char * buf = strdata->ptr(); short nlen = strdata->_length; for (short i = 0; i < nlen; ++i, ++buf) if (strchr (clist, *buf) != 0) ++result; } return result; } str left (str const & s, short len, char padch) { str n(s); return n.left(len, padch); } str right (str const & s, short len, char padch) { str n(s); return n.right(len, padch); } str mid (str const & s, short pos, short len, char padch) { str n(s); return n.mid(pos, len, padch); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/str.doc����������������������������������������������0000755�0000764�0000144�00000003703�07055334254�015603� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Bear in mind that this is an intentionally simple and plain string class, devoid of many features which might be found in a more complete implementation. The reason I say 'intentionally' is purely because it was written for a specific set of uses than to be the be-all and everything-including-your- kitchen-sink-string-class. In particular, the aims I had in mind were: 1. Portable, 2. Small but efficient - where sizeof(str) == sizeof(char *) in almost all C++ implementations, 3. Doesn't rely upon, but allows for, NUL terminators, so avoids lots of redundant length calculations as is common in C. The library attempts to use memory operations rather than C string operations where possible, 4. As much as possible is implemented in-line for speed. All common operations are centralised into a 'core' set of private functions. 5. Copy constructors and assignment are cheap operations by use of reference counting. This makes passing objects by value very cheap (requires no as few as possible memory allocations / copying of string data), and is conservative with memory. 6. Should be easily exchanged with char*. 7. Memory management of strings made possible by use of a single memory allocation function for string data (easily replaced or enhanced) 8. Uses absolutely no third party classes, so is stand-alone, making it highly reusable, 9. Requires no additional include files from the standard library. 10. Avoids use of cast operators for char const * and therefore prevents problems caused by creation of temporaries (these can also occur with member c_str(), but at least you have to explicitly invoke it rather than causing a temporary to be used in a dangerous manner without notification). cheers, David Nugent Moderator ('93-'94) of the FidoNet C++ international EchoMail conference �������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cant.c�����������������������������������������������0000755�0000764�0000144�00000000725�07055333670�015377� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** CANT.C - An fopen() replacement with error trapping ** ** public domain by Bob Stout ** ** Call just as you would fopen(), but make sure your exit functions are ** registered with atexit(). */ #include <stdio.h> FILE *cant(char *fname, char *fmode) { FILE *fp; if (NULL == (fp = fopen(fname, mode))) { fprintf(stderr, "Can't open %s\n", fname); exit(EXIT_FAILURE); } return fp; } �������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cast.h�����������������������������������������������0000755�0000764�0000144�00000002357�07055333670�015414� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** public domain demo by Bob Stout */ #define CAST(new_type,old_object) (*((new_type *)&old_object)) #if 0 ************************************************************************* * * * /* Example of CAST macro at work */ * * * * union { * * char ch[4]; * * int i[2]; * * } my_union; * * * * long longvar; * * * * longvar = (long)my_union; /* Illegal cast */ * * longvar = CAST(long, my_union); /* Legal cast */ * * * ************************************************************************* #endif /* 0 */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/scrnsave.c�������������������������������������������0000755�0000764�0000144�00000003252�07055334217�016272� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** SCRNSAVE.C - Save and restore text screen portably ** ** public domain demo by Bob Stout */ #include <stdlib.h> /* ** Stuff from SNIPPETS courtesy of Jim Nutt ** ** Notes: VIOopen() is called redundantly to assure that the video ** information is always initialized. These multiple calls are benign. ** ** Because of using VIO.OBJ, this *must* be compiled in large model! */ #include "vio.h" /* ** Save the current text screen ** ** Arguments: None ** ** Returns: Pointer to saved screen buffer, NULL if insufficient heap */ unsigned short *savescreen(void) { unsigned short *vbuf; VIOopen(); if (NULL == (vbuf = malloc(VIOcolumns() * VIOrows() * 2))) return NULL; VIOgetra(0, 0, VIOcolumns() - 1, VIOrows() - 1, (int _far *)vbuf); return vbuf; } /* ** Restore a screen previously saved by savescreen() ** ** Arguments: Buffer containing the screen to restore ** ** Returns: Nothing ** ** WARNING: No error checking done to verify same screen size and mode! */ void restorescreen(unsigned short *vbuf) { VIOopen(); VIOputr(0, 0, VIOcolumns(), VIOrows(), (int _far *)vbuf); free(vbuf); } #ifdef TEST #include <stdio.h> #include <conio.h> int main(void) { unsigned short *vbuf; VIOopen(); if (NULL == (vbuf = savescreen())) { puts("Unable to save screen"); return EXIT_FAILURE; } VIOclear(0, 0, VIOcolumns(), VIOrows()); puts("Hit any key to exit"); getch(); restorescreen(vbuf); VIOclose(); return EXIT_SUCCESS; } #endif /* TEST */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cdir.c�����������������������������������������������0000755�0000764�0000144�00000006575�07055333672�015406� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** CDIR.C ** ** Written By: Lynn R. Lively ** Date Written: 9/18/91 ** ** Purpose: To provide a change directory facility that will cross ** drive/partition boundries. Never did understand why ** MSDOS cd wouldn't do this already. ** **----------------------------------------------------------------- ** I hereby place this work into the Public Domain. It may be used ** for any legal purpose public or private. Use this material at ** your own risk. I accept no responsibility for the accuracy or ** usability of the information contained herein. Neither do I ** accept liability for any possible damage caused by use of this ** material. However, should you have a problem, question, or ** suggestion I would be glad to help in any way that I can. You ** can reach me at (H) 713-893-7875 or (W) 713-591-6611 x 149. **----------------------------------------------------------------- */ /* ** Change History ** ** Rev # Date By Description of change ** 1.00 | 09/18/91 | LRL | Original Version ** 1.01 | 09/18/91 | RBS | Added MSC, ZTC support for SNIPPETS **----------------------------------------------------------------- ** Directory of initials: ** Initials Name ** LRL Lynn R. Lively ** RBS Bob Stout */ #include <stdio.h> #include <string.h> #ifdef __TURBOC__ #include <dir.h> #else #include <dos.h> #include <direct.h> #ifdef __ZTC__ #define _dos_getdrive(d) dos_getdrive(d) #define _dos_setdrive(d,m) dos_setdrive(d,m) #define drive_t unsigned #else #define drive_t int #endif drive_t getdisk(void) { drive_t drive; _dos_getdrive(&drive); return drive - 1; } drive_t setdisk(drive_t drive) { drive_t max_drives; _dos_setdrive(drive + 1, &max_drives); return max_drives - 1; } #endif main (int argc, char * argv[]) { int d; int max_d; char wk_str[128]; if (argc > 1) { strupr (argv[1]); if (argv[1][1] == ':') { /* ** Find out what the maximum drive number can be. */ max_d = getdisk (); max_d = setdisk (max_d); d = argv[1][0] - 'A'; if (d < max_d) { /* ** If the drive specification was valid position to it ** and then do a change directory. */ setdisk (d); chdir (argv[1]); } else { puts ("Invalid drive specification"); return -1; } } else { /* ** If the argument has no drive spec just do a regular ** change directory. */ chdir (argv[1]); } } else { /* ** If no arguments are passed, return the current working ** directory path just like MSDOS cd does. */ puts (getcwd (wk_str, sizeof (wk_str))); } return 0; } �����������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/iostutor.txt�����������������������������������������0000755�0000764�0000144�00000030602�07055334022�016724� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PROLOGUE -------- This tutorial started out as a "small" example of how to interface an I/O object into the AT&T iostream classes currently provided with almost every C++ compiler. When I say "small", I mean just that - but the scope of the information I wanted to present really didn't fit well into that little hole, so it turned out a little larger than I had initially hoped. However, I think the effort was worth it - I know it was for me, since although I've done code which deals with ostream, I hadn't fooled at all with istream derived facilities, and learned some new things in the process. I can't really cite any single reference on iostreams that might prove useful for those wanting to go further other than the AT&T iostreams reference manual (my copy is out on loan at the moment so I can't quote the ISBN number). I have never come across one which is more complete than this reference, and most other references (including documentation from MSC/C++C, Borland, IBM etc.) tend to quote from it fairly liberally, but lack any of the important information needed to put it all together. While Microsoft's C++ tutorial reference has some great hints for getting started in iostream manipulators, it lacks in providing any information on interfacing to the iostream classes themselves. Hopefully the information I've provided below will make some sense. It is as complete as I could make it without really going overboard. Most of the ostream related code is gleaned from my own library, but the rest is brand new. The text of this tutorial and the accompanying source code are donated to the public domain. Tutorial in iostreams --------------------- This little project started out with the following aims: A) To define a simple input/output object, one that consumes bytes sent to it and generates data for input into a sample program. It should there- fore feature a "read" and "write" function. The object created is simply a loopback buffer - input is queued immediately for output in FIFO (first in first out) fashion. B) To create a streams interface for this object, so that existing facili- ties for I/O in the AT&T streams classes can be used directly in a polymorphic fashion (ie. make use of C++ inheritance & virtual dispatch). Specifically, I wanted to demonstrate the following aspects of iostreams: - Use of buffered vs. unbuffered I/O - Using the streams buffer for both input and output operations. (an interface to iostream, rather than just istream or ostream) - How the put, get and putback buffers work C) To write a trivial application which uses both components and provide a means of interactively demonstrating how it all works. A - The I/O Object ---------------- class Myio; This class is simply a front-end for a circular buffer. Input bytes are added at the head, and read from the tail. It is fixed in size, set by the constructor. Two read/write functions are provided to access any contained data: int Myio::read (char * buf, int max); int Myio::write (char const * buf, int len); These are both non-blocking calls which return the number of bytes read or written. They know nothing about line delineation - only about raw bytes, as would be the case for almost any I/O device. In addition, an internal flag is maintained to indicate when a write results in a buffer 'overflow' (an attempt to write more bytes than will fit in the buffer) and 'underflow' (an attempt to read an empty buffer). These flags reflect the last write and read calls respectively, and are reset or set on each write or read call. The members Myio::readok() and Myio::writeok() rturn the settings as a boolean value. A Myio object can also optionally create a stream. It is created and comes into life when the member function Myio::stream() is called. If it was previously created, this function simply returns a reference to the existing stream. The stream, if it exists, is deleted by the destructor. Myio's stream is an iostream, which inherits all of the abilities of both ostream (for output) and istream (for input), including all operators. This, of course, is the primary benefit of using streams! B - The Streams Interface ----------------------- class Mystreambuf; class Mystreambase; class Mystream; Three classes as above are used. Mystreambuf derives from streambuf, and is responsible for the input output operations and buffering on behalf of a Myio object. Mystreambase is used as a base class for Mystream to assist in the initialisation of the (My)streambuf passed to the iostream constructor. The iostream side is in fact very simple. Nothing really needs to be overridden, and all of the work is done in Mystreambuf, where all the action really takes place. The relationship between the ios/stream classes and the streambuf family is one of delegation rather than inheritance. The user/application accesses streambuf I/O via the stream object, not directly. A class diagram showing the basic iostream classes and our classes would look like: _ istream _ / \ ios -- ostream -- iostream \ \ \ Mystream \_____ Mystreambase _/ | | (owns) | streambuf -- Mystreambuf All relationships, except the one marked "(owns)", indicate inheritance. The 'owns' relationship is where the delegation occurs. ios is inherited virtually, so that there is only one combined 'ios' object at the root of the streams inheritence tree. Within Mystreambuf, we need to override the functions responsible for actual input and output. But first, let's discuss how this streambuf works. Mystreambuf uses a single buffer, using the default buffer size allocated for any streambuf (under most operating systems, this will be 1024 bytes). Since we are dealing with both input and output operations, and these operations are independent so far as the streambuf is concerned (as is the case with, for example, serial I/O, but *not* the case with files), the buffer is split into two; the first half is used for writing, the second for reading. The buffer used for writing is called the "put" buffer. Nothing mysterious there - when full, streambuf::overflow() function is called, and via virtual dispatch calls our Mystreambuf::overflow() which takes the contents of the buffer and writes it to the output device. The read - or "get" - buffer is slightly more complex. There are occasions in dealing with an input stream where it is convenient to know what's next without actually removing it from the stream. That way, you can use the next character as an indication of what to do next. For example, if you're parsing a number, you want to know whether or not the next character is a valid digit, and stop parsing if it isn't. The read side therefore incorporates the idea of a "putback" buffer - after being read, the character can be placed back into the input stream. The putback buffer is entirely the responsibility of any streambuf derived class. It most you need to support a one character putback buffer - it is not valid to remove, and then restore, more than one character from the stream. It is also not valid put 'putback' any character but the one that was the result of the last 'get'. It really must be "put back", not any old character "pushed" (you could actually support 'pushing' data into the stream if you wanted to, but you shouldn't use putback to do it). The get buffer is set up as: Offset 0 1 2 3 .... n | | | | to end of buffer | +---+---+---+---------------------+ ^ ^ | +- Start of get buffer (where data is read in) | +- Where data is putback Each time streambuf runs out of characters to give to its client, the underflow() function is called. This fills the get buffer (get buffer size - 1, starting at offset 1) and reserves the first byte in case the previously read character needs to be put back. streambuf provides internal pointers into the put, get and putback areas. All of the I/O functions it provides handle these automatically. In our underflow() and overflow() functions, we need to set these pointers according to where and how much data is read in. I mentioned above that in our case, the input & output streams are independant. That's not entirely the case - it may happen that when reading from the Myio buffer we run out of data and need additional data in the output stream buffer not yet written to Myio. We therefore flush the output stream before retrieving any data by calling overflow() directly from within underflow(). The sync() function is also overridden. This simply empties all buffers by flushing the output buffer and discarding any buffered input. C - The Application ----------------- The application itself is a simple menu, offering choice to send a line of output to the IO object (via its stream), read one in, and dump/display information both about the stream and Myio object. This added two other classes to the project: - myApplication: the actual application, implemented as a class. The only way to go in C++. :-) - myList: a simple line input class, whose sole purpose in life is to extract a linefeed delimited line from any istream object and return it as a char const *. (I posted this code last week, but have since fixed one minor bug I found in the process of developing Myio). A couple of subtle points - class myApplication uses a pointer to member function it its menu selection. This is not the only way of doing this of course, but I thought it was a good way of demonstrating a very C++ specific concept, operator ->*, which does not exist at all in C. Additional notes are included in the source comments. Making the application ---------------------- Hopefully this is a fairly simple thing to do - just compile the modules: Myiodemo.cpp Myio.cpp Mystream.cpp myLine.cpp and link them together. A simple makefile is provided - take a look at the definitions at the top, adjust as desired, and type "make" (or nmake). If you use any of Borland's compilers, just add the above files to a new project called "Myiodemo.PRJ", set it to produce a .EXE (*not* Windows or PM based) and press F9. Assuming a C++ compiler compatibile with cfront 2.1 and the presence of an iostreans 1.2 library, the only non-portable part of this app is the use of getch() from conio.h. This isn't easily provided under a UNIX system. You can either fudge it by writing a getch() which switches into/out of 'raw' mode, or use getchar() and clear everything up to and including a CR or NL after the first character (the user still has to hit CR for input to get to the program). EPILOGUE -------- Just some notes as to use of this code. If you need an output or input only class, then you use ostream or istream wherever iostream is mentioned in this example. Also, if you use buffered mode (you can support it or not - you can even ignore the streambuf setting at your discretion), then you can use the entire buffer rather than just half each for input output. If you interface to an input only object, you only need to override streambuf::underflow(). Conversely, you override streambuf::overflow() for an output only object. I have noticed that *some* implementations of iostreams define the overflow() and underflow() methods as pure virtual functions, whereas the AT&T default defines each as simply returning EOF. If portability is any concern, you may need to override the function you aren't using in this fashion. The default sync() simply returns 0 (success), but again, this is sometimes defined as a pure virtual, so you may need to define it in your implementation. In some cases, you may wish to "switch" between unbuffered and buffered modes. This is easily done by defining a function in Mystream which does it, and this object is of course accessible in your I/O object (in this case Myio). The only thing you need to remember is to flush all the buffers by calling sync() when switching from buffered to unbuffered mode. Note also that some streambuf constructors take an existing buffer. This means that you can use buffers already provided in your I/O object directly rather than being forced to "double buffer" anything. Your buffer can also be any size you like, subject to memory and other architecture constraints. Enjoy! David Nugent - 3:632/348@fidonet.org Moderor ('93-'94) of the FidoNet international C++ EchoMail conference ������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/strat.c����������������������������������������������0000755�0000764�0000144�00000007733�07055334261�015612� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** strat.c 10-5-91 Robert Mashlan, public domain ** ** Interface functions to DOS 3.0+ set allocation strategy ** and get allocation strategy functions via int 21h, ** function 58h. ** ** By setting the dos allocation strategy to LAST_FIT_LOW ** before using DOS the set handle count function int 21h, ** function 67h, DOS will allocate memory for the extended ** file handle table at the end of free memory instead of ** after the last heap allocation, with the benefit of ** allowing the heap manager make further contiguous ** allocations from the operating system. ** */ #include <stdlib.h> #include <dos.h> #include "strat.h" /* ** Gets dos memory allocation strategy via function 0x58. ** Returns allocation strategy, else returns -1 and sets ** _doserrno on error. */ int get_alloc_strat(void) { union REGS r; r.x.ax = 0x5800; /* DOS "get allocation strategy" */ int86(0x21,&r,&r); if (r.x.cflag) /* error? */ { _doserrno = r.x.ax; /* save error code */ return -1; } else return r.x.ax; } /* ** Sets DOS memory allocation strategy ** returns allocation strategy on success, ** else returns -1 and sets _doserrno on error */ int set_alloc_strat( int strat ) { union REGS r; r.x.ax = 0x5801; /* DOS "set allocation strategy" */ r.x.bx = strat; int86(0x21,&r,&r); if (r.x.cflag) /* error? */ { _doserrno = r.x.ax; /* save error code */ return -1; } _doserrno = 0; return strat; } /* ** Uses dos function 67h to increase open file handle count. ** Returns -1 and sets _doserrno on error, 0 otherwise. */ int set_handle_count( unsigned nhandles ) { union REGS r; r.x.ax = 0x6700; r.x.bx = nhandles; int86(0x21,&r,&r); if(r.x.cflag) { _doserrno = r.x.ax; return -1; } _doserrno = 0; return 0; } #ifdef DEMO #include <stdio.h> #include <stdlib.h> #include <io.h> #include <fcntl.h> /* ** returns maximum number of files that can be open */ int handle_count(void) { int handles[500]; int i, result; /* try allocating as many file handles as possible */ for (i = 0; i < 500; i++) { if( (handles[i]=open("NUL",O_WRONLY)) == -1 ) break; } result = i; /* close all files opened */ for (i--; i >= 0; i--) close(handles[i]); return result; } /* ** Memory test, returns number of kilobytes that ** can be allocated before failure. */ int memtest(void) { static void *mem[1024]; int i,result; /* try allocating as many 1K blocks as possible */ for(i=0;i<1024;i++) { if( (mem[i]=malloc(1024)) == NULL ) break; } result = i; /* save result */ /* free memory allocated */ for(i--; i >= 0; i--) free(mem[i]); return result; } #define checkdoserror(f) \ ((f==-1)?printf("%s failed, doserror = %#02x\n",#f,_doserrno):(void)0) int main(void) { int strat; /* do pre-test diagnostics */ printf("allocated %d Kbytes before failure\n",memtest()); printf("opened %d files\n",handle_count()); strat = get_alloc_strat(); /* save current allocation strategy */ checkdoserror(set_alloc_strat(LAST_FIT_LOW)); puts("setting handle count to 50, with changed allocation strategy"); checkdoserror(set_handle_count(50)); checkdoserror(set_alloc_strat(strat)); /* restore strategy */ /* do post-test diagnostics */ printf("allocated %d Kbytes before failure\n",memtest()); printf("opened %d files\n",handle_count()); return 0; } #endif �������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/strat.h����������������������������������������������0000755�0000764�0000144�00000000706�07055334261�015610� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** strat.h 10-5-91 Robert Mashlan, public domain ** ** header file for strat.c ** */ const enum { FIRST_FIT_LOW, BEST_FIT_LOW, LAST_FIT_LOW, FIRST_FIT_HIGH = 0x80, /* these strategies available only in DOS 5.0 */ BEST_FIT_HIGH, LAST_FIT_HIGH, FIRST_FIT_HIGHONLY = 0x40, BEST_FIT_HIGHONLY, LAST_FIT_HIGHONLY }; int get_alloc_strat(void); int set_alloc_strat( int strat ); int set_handle_count( unsigned nhandles ); ����������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/posix_ls.c�������������������������������������������0000755�0000764�0000144�00000005711�07055334143�016306� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** POSIX_LS.C - Directory lister using POSIX style processing ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include <stdio.h> #include "dirent.h" #define SUCCESS 0 void dumpdir(char *dirname, char *mask) { DOS_DIR *dirp; struct DSTRUCT *dstruct; dirp = opendir(dirname); if (!dirp) { printf("Opening %s returned NULL\n\n", dirname); return; } printf("Dir %s has %d entries\n", dirname, dirp->dd_size); do { if (NULL != (dstruct = readdir(dirp))) { if (SUCCESS == dirmask(dstruct, mask, NULL, FA_ANY, 0)) printf("%3d - %s\n", dirp->dd_loc, dstruct->NAME); } else puts("EOF\n"); } while (dstruct); printf("seekdir( -1) returned %p\n", seekdir(dirp, -1, SEEK_SET)); printf("seekdir(999) returned %p\n", seekdir(dirp, 999, SEEK_SET)); printf("seekdir(0, SEEK_SET) returned %p\n", dstruct = seekdir(dirp, 0, SEEK_SET)); printf("%3d - %s\n", dirp->dd_loc, dstruct->NAME); printf("seekdir(1, SEEK_SET) returned %p\n", dstruct = seekdir(dirp, 1, SEEK_SET)); printf("%3d - %s\n", dirp->dd_loc, dstruct->NAME); printf("seekdir(4, SEEK_SET) returned %p\n", dstruct = seekdir(dirp, 4, SEEK_SET)); printf("%3d - %s\n", dirp->dd_loc, dstruct->NAME); printf("seekdir(4, SEEK_CUR) returned %p\n", dstruct = seekdir(dirp, 4, SEEK_CUR)); printf("%3d - %s\n", dirp->dd_loc, dstruct->NAME); printf("seekdir(-1, SEEK_CUR) returned %p\n", dstruct = seekdir(dirp, -1, SEEK_CUR)); printf("%3d - %s\n", dirp->dd_loc, dstruct->NAME); printf("seekdir(1, SEEK_CUR) returned %p\n", dstruct = seekdir(dirp, 1, SEEK_CUR)); printf("%3d - %s\n", dirp->dd_loc, dstruct->NAME); printf("seekdir(0, SEEK_END) returned %p\n", dstruct = seekdir(dirp, 0, SEEK_END)); printf("%3d - %s\n", dirp->dd_loc, dstruct->NAME); printf("seekdir(-1, SEEK_END) returned %p\n", dstruct = seekdir(dirp, -1, SEEK_END)); printf("%3d - %s\n", dirp->dd_loc, dstruct->NAME); printf("seekdir(-4, SEEK_END) returned %p\n", dstruct = seekdir(dirp, -4, SEEK_END)); printf("%3d - %s\n", dirp->dd_loc, dstruct->NAME); closedir(dirp); } void main(int argc, char *argv[]) { int i; char *mask = NULL, *dirname; if (1 < argc) dirname = argv[1]; else dirname = "."; if (2 < argc) mask = argv[2]; printf("Calling dumpdir(%s, %s)\n\n", dirname, mask); dumpdir(dirname, mask); } �������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/scroll.c���������������������������������������������0000755�0000764�0000144�00000003407�07055334220�015740� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*--------------------------[ scroll ]--------------------------*/ /* Scroll the active page up or down a number of lines */ /* Public domain code by Jeff Dunlop: */ /*--------------------------------------------------------------*/ /* input: */ /* dx = direction */ /* num_lines = number of lines to scroll, 0 = clear coords */ /* attr = attribute of blank line(s) */ /* y1, x1, y2, x2 = corner coordinates of scroll window */ /* local: */ /* regs = register union for ISR */ /*--------------------------------------------------------------*/ #include <dos.h> #include "scrnmacs.h" void scroll(int direction, int num_lines, int vattrib, int ulrow, int ulcomumn, int lrrow, int lrcolumn) { union REGS regs; /* BH = attribute to be used on blank line CH = row of upper left corner of scroll window CL = column of upper left corner of scroll window DH = row of lower right corner of scroll window DL = column of lower right corner of scroll window */ regs.h.al = (unsigned char)num_lines; regs.h.bh = (unsigned char)vattrib; regs.h.ch = (unsigned char)ulrow; regs.h.cl = (unsigned char)ulcomumn; regs.h.dh = (unsigned char)lrrow; regs.h.dl = (unsigned char)lrcolumn; if (direction == SCROLL_UP) regs.h.ah = 0x06; else regs.h.ah = 0x07; int86(0x10, ®s, ®s); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/posixdir.c�������������������������������������������0000755�0000764�0000144�00000024206�07055334146�016312� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** POSIXDIR.C - POSIX-style directory processing ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include <string.h> #include <stdlib.h> #include <dos.h> #include <io.h> #include <errno.h> #include "dirent.h" #define _NDIRS 20 #define SUCCESS 0 #define ERROR -1 #define LAST_CHAR(s) ((char *)(s))[strlen(s) - 1] int DFerr; DOS_DIR _DIRS[_NDIRS]; /* Initilize DOS_DIR array to zeros */ /* ** Convert Unix-style pathnames to DOS-style */ static char *unix2dos(char *path) { char *p; while (NULL != (p = strchr(path, '/'))) *p = '\\'; return path; } /****************************************************************/ /* */ /* opendir() */ /* */ /* Function: Open a directory for reading. */ /* */ /* Parameters: 1 - Directory name. May include path spec. */ /* */ /* Returns: Pointer to a DOS_DIR typedef'ed structure, similar */ /* to fopen() returning a FILE pointer. */ /* */ /* NULL if error, DFerr set as follows: */ /* SUCCESS - No error */ /* ENOENT - Could not locate directory or contents */ /* ENOTDIR - Not a directory */ /* ENOMEM - Too many directories already open */ /* */ /* Side effects: The dd_size element of the DOS_DIR structure */ /* will contain a number representing the total */ /* number of entries in the directory. The */ /* dd_loc element will be set to zero since */ /* no elements have, as yet, been read. */ /* */ /****************************************************************/ DOS_DIR *opendir(char *fname) { int i; unsigned n = 0; char nametmp[13], *p; struct DSTRUCT dstruct; for (i = 0; i < _NDIRS; ++i) { if (!_DIRS[i].dd_fd) break; } if (_NDIRS <= i) { DFerr = ENOMEM; return NULL; } unix2dos(fname); if (':' == fname[1] && 1 < strlen(fname)) p = &fname[2]; else p = fname; while ('\\' == LAST_CHAR(p) && 1 < strlen(p)) LAST_CHAR(p) = '\0'; if (strcmp(p, "\\") && strlen(p)) { if (NULL == (rfind_1st(fname, FA_ANY, &_DIRS[i].dd_buf))) { DFerr = ENOENT; return NULL; } if (!(FA_DIREC & _DIRS[i].dd_buf.ATTRIBUTE)) { DFerr = ENOTDIR; return NULL; } } strcpy(_DIRS[i].dd_dirname, fname); if (!strlen(p)) strcat(_DIRS[i].dd_dirname, "."); if ('\\' != LAST_CHAR(_DIRS[i].dd_dirname)) strcat(_DIRS[i].dd_dirname, "\\"); strcat(strupr(_DIRS[i].dd_dirname), "*.*"); if (NULL == rfind_1st(_DIRS[i].dd_dirname, FA_ANY, &_DIRS[i].dd_buf)) { DFerr = ENOENT; return NULL; } memcpy(&dstruct, &_DIRS[i].dd_buf, sizeof(struct DSTRUCT)); do { ++n; } while (rfind_nxt(&_DIRS[i].dd_buf)); memcpy(&_DIRS[i].dd_buf, &dstruct, sizeof(struct DSTRUCT)); _DIRS[i].dd_size = n; _DIRS[i].dd_loc = 0; _DIRS[i].dd_fd = i + 1; DFerr = SUCCESS; return &_DIRS[i]; } /****************************************************************/ /* */ /* closedir() */ /* */ /* Function: Close a preeviously opened directory. */ /* */ /* Parameters: 1 - DOS_DIR pointer of directory to close. */ /* */ /* Returns: SUCCESS or ERROR. */ /* */ /****************************************************************/ int closedir(DOS_DIR *dirp) { if (0 == dirp->dd_fd || _NDIRS < dirp->dd_fd) { DFerr = EBADF; return ERROR; } memset(dirp, 0, sizeof(DOS_DIR)); return SUCCESS; } /****************************************************************/ /* */ /* rewinddir() */ /* */ /* Function: Reset an open DOS_DIR to its first entry. */ /* */ /* Parameters: 1 - DOS_DIR pointer of directory to rewind. */ /* */ /* Returns: SUCCESS or ERROR. */ /* */ /****************************************************************/ int rewinddir(DOS_DIR *dirp) { if (0 == dirp->dd_fd || _NDIRS < dirp->dd_fd) { DFerr = EBADF; return ERROR; } rfind_1st(dirp->dd_dirname, FA_ANY, &(dirp->dd_buf)); dirp->dd_loc = 0; return SUCCESS; } /****************************************************************/ /* */ /* seekdir() */ /* */ /* Function: Point to a selected entry in a DOS_DIR. */ /* */ /* Parameters: 1 - DOS_DIR pointer of directory to rewind. */ /* 2 - Offset of entry to seek */ /* 3 - Origin of offset */ /* */ /* Returns: A DSTRUCT pointer, same as returned by rfind_1st() */ /* and rfind_nxt(). */ /* */ /* NULL if error, DFerr set as follows: */ /* SUCCESS - No error */ /* EBADF - Bad file (DOS_DIR) pointer */ /* EACCES - Illegal origin specification */ /* EOF - Attempt to seek past end of directory */ /* */ /****************************************************************/ struct DSTRUCT *seekdir(DOS_DIR *dirp, int offset, int origin) { int i, loc; if (0 == dirp->dd_fd || _NDIRS < dirp->dd_fd) { DFerr = EBADF; return NULL; } switch (origin) { case SEEK_SET: loc = offset + 1; break; case SEEK_CUR: loc = dirp->dd_loc + offset; break; case SEEK_END: loc = dirp->dd_size + offset; break; default: DFerr = EACCES; return NULL; } if (loc > (int)dirp->dd_size || 0 >= loc) { DFerr = EOF; return NULL; } rewinddir(dirp); for (i = 0; i < loc; ++i) readdir(dirp); DFerr = SUCCESS; return (&(dirp->dd_buf)); } /****************************************************************/ /* */ /* readdir() */ /* */ /* Function: Reads entries from an open directory. */ /* */ /* Parameters: 1 - DOS_DIR pointer of directory to read. */ /* */ /* Returns: A DSTRUCT pointer, same as returned by rfind_1st() */ /* and rfind_nxt(). */ /* */ /* NULL if error, DFerr set as follows: */ /* SUCCESS - No error */ /* EBADF - Bad file (DOS_DIR) pointer */ /* EOF - Attempt to read past end of directory */ /* */ /* Side effects: The dd_loc element of the DOS_DIR structure */ /* will contain a number representing which */ /* element of the directory was returned. It may */ /* range from 1 to dd_size. */ /* */ /****************************************************************/ struct DSTRUCT *readdir(DOS_DIR *dirp) { if (0 == dirp->dd_fd || _NDIRS < dirp->dd_fd) { DFerr = EBADF; return NULL; } if (0 == dirp->dd_loc || NULL != rfind_nxt(&(dirp->dd_buf))) { dirp->dd_loc += 1; DFerr = SUCCESS; return (&(dirp->dd_buf)); } else { DFerr = EOF; return NULL; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bitfiles.c�������������������������������������������0000755�0000764�0000144�00000006011�07055333652�016245� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** BITFILES.C - reading/writing bit files ** ** Public domain by Aare Tali */ #include <stdio.h> #include <stdlib.h> typedef struct { FILE * file; /* for stream I/O */ char rbuf; /* read bit buffer */ char rcnt; /* read bit count */ char wbuf; /* write bit buffer */ char wcnt; /* write bit count */ } bfile; bfile *bfopen(char *name, char *mode) { bfile * bf; bf = malloc(sizeof(bfile)); if (NULL == bf) return NULL; bf->file = fopen(name, mode); if (NULL == bf->file) { free(bf); return NULL; } bf->rcnt = 0; bf->wcnt = 0; return bf; } int bfread(bfile *bf) { if (0 == bf->rcnt) /* read new byte */ { bf->rbuf = (char)fgetc(bf->file); bf->rcnt = 8; } bf->rcnt--; return (bf->rbuf & (1 << bf->rcnt)) != 0; } void bfwrite(int bit, bfile *bf) { if (8 == bf->wcnt) /* write full byte */ { fputc(bf->wbuf, bf->file); bf->wcnt = 0; } bf->wcnt++; bf->wbuf <<= 1; bf->wbuf |= bit & 1; } void bfclose(bfile *bf) { fclose(bf->file); free(bf); } void test1(void) { bfile *out; bfile *in; FILE *in1; FILE *in2; in = bfopen("bitfiles.c", "rb"); out = bfopen("bitfiles.cc", "wb"); if ((NULL == in) || (NULL == out)) { printf("Can't open/create test files\n"); exit(1); } while (!feof(in->file)) bfwrite(bfread(in), out); bfclose(in); bfclose(out); in1 = fopen("bitfiles.c", "rb"); in2 = fopen("bitfiles.cc", "rb"); if ((NULL == in1) || (NULL == in2)) { printf("Can't open test files for verifying\n"); exit(1); } while (!feof(in1) && !feof(in2)) { if (fgetc(in1) != fgetc(in2)) { printf("Files not identical, copy failed!\n"); exit(1); } } if (!feof(in1) || !feof(in2)) { printf("Not same size, copy failed!\n"); exit(1); } fclose(in1); fclose(in2); } void test2(void) { FILE *in1; bfile *in2; int ch; in1 = fopen("bitfiles.c", "rb"); in2 = bfopen("bitfiles.cc", "rb"); if ((NULL == in1) || (NULL == in2)) { printf("Can't open test files\n"); exit(1); } while (!feof(in1) && !feof(in2->file)) { ch = fgetc(in1); if (ch < ' ') ch = '.'; printf(" '%c' ", ch); for (ch = 0; ch < 8; ch++) printf("%c", "01"[bfread(in2)]); printf(" "); } fclose(in1); bfclose(in2); } void main(void) { test1(); test2(); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/flopcopy.c�������������������������������������������0000755�0000764�0000144�00000006306�07055333763�016311� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** FLOPCOPY.C ** ** Copy a floppy to a hard disk directory with directory recursion ** Public domain, uses functions from SNIPPETS. */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <io.h> #include <fcntl.h> #ifdef __TURBOC__ #include <dir.h> #include <dos.h> #define _dos_findfirst(f,a,b) findfirst(f,b,a) #define _dos_findnext(b) findnext(b) #define find_t ffblk #define _A_SUBDIR FA_DIREC #define attrib ff_attrib #define name ff_name #else #include <direct.h> #ifdef __ZTC__ #include <dos.h> #ifndef _A_SUBDIR #define _A_SUBDIR FA_DIREC #endif #else /* assume MSC/QC */ #include <dos.h> #include <errno.h> #include <sys\types.h> #endif #endif #include <sys\stat.h> #undef SUCCESS #define SUCCESS 0 #undef NUL #define NUL '\0' #define LAST_CHAR(s) (((char *)s)[strlen(s) - 1]) int file_copy(char *,char *); /* In Wb_Fcopy.C */ void do_dir(char *, char *); /* ** Copy a floppy to an HD subdirectory */ int main(int argc, char *argv[]) { char fdrv[4] = "A:\\", target[FILENAME_MAX]; if (3 > argc) { puts("Usage: FLOPCOPY drive_letter subdir"); puts("where: drive_letter is \"A\" or \"B\" (colon optional)"); puts(" subdir is drive:dir target, e.g. \"C:\\FLOPSTUF\""); return EXIT_FAILURE; } *fdrv = *argv[1]; strcpy(target, argv[2]); if ('\\' != LAST_CHAR(target)) strcat(target, "\\"); do_dir(fdrv, target); } /* ** Process a directory (SNIPPETS: Treedir.C, modified) */ void do_dir(char *from, char *to) { char search[FILENAME_MAX], new[FILENAME_MAX], newto[FILENAME_MAX]; struct find_t ff; strcat(strcpy(search, from), "*.*"); if (SUCCESS == _dos_findfirst(to, 0xff, &ff)) { if (0 == (ff.attrib & _A_SUBDIR)) { printf("*** %s Exists and is not a directory!\n", to); return; } } else { strcpy(newto, to); if ('\\' == LAST_CHAR(newto)) LAST_CHAR(newto) = NUL; mkdir(newto); } if (SUCCESS == _dos_findfirst(search, 0xff, &ff)) do { if (ff.attrib & _A_SUBDIR && '.' != *ff.name) { strcat(strcat(strcpy(new, from), ff.name), "\\"); strcat(strcat(strcpy(newto, to), ff.name), "\\"); do_dir(new, newto); } else { char file1[FILENAME_MAX], file2[FILENAME_MAX]; if ((ff.attrib & (_A_SUBDIR | _A_VOLID)) || '.' == *ff.name) continue; strcat(strcpy(file1, from), ff.name); strcat(strcpy(file2, to), ff.name); if (SUCCESS != file_copy(file1, file2)) printf("*** Unable to copy %s to %s\n", file1, file2); else printf("Copied %s to %s\n", file1, file2); } } while (SUCCESS == _dos_findnext(&ff)); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/style.c����������������������������������������������0000755�0000764�0000144�00000003305�07055334271�015605� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/***************************************************************************/ /* Global (public) headers look like this */ /* */ /* foo() */ /* Parameters: description of each passed datum */ /* Returns: description of return value & significance */ /* Side effects: complete details */ /* Notes: extra info */ /***************************************************************************/ /* ** Static (local) headers look like this ** ** Brief description */ int foo(void) /* use ANSI prototypes on every compiler that supports 'em */ { int local1, local2; /* local variable declarations are always followed by a blank line */ do_stuff(); if (bar(local1)) { /* long comments here *//* this lines up with -----------+ */ char *local3; /* autos declared close to use | */ /* | */ do_more_stuff(); /* (everything else indented) | */ local2 = strlen(local3);/* | */ } /* this <------------------------+ */ else local2 = fubar(); /* using tab >= 6, else's line up */ return local2; } /* no question where functions end! */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/combin.c���������������������������������������������0000755�0000764�0000144�00000003205�07055333705�015714� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Compute C(n,m) = the number of combinations of n items, ** taken m at a time. ** ** Written by Thad Smith III, Boulder County, CO. ** Released to the Public Domain 10/14/91. ** ** The def of this function is ** C(n,m) = n! / (m! * (n-m)!). ** Computing this formula can cause overflow for large values of n, ** even when C(n,m) would be defined. ** ** The first version will not overflow if C(n,m) * (n-m+1) < ULONG_MAX. ** The second version will not overflow if C(n,m) < ULONG_MAX, but ** is slightly more complex. ** Function domain: n >= 0, 0 <= m <= n. ** ** Both versions work by reducing the product as it is computed. It ** relies on the property that the product on n consecutive integers ** must be evenly divisible by n. ** ** The first version can be changed to make cnm and the return value ** double to extend the range of the function. */ unsigned long ncomb1 (int n, int m) { unsigned long cnm = 1UL; int i; if (m*2 >n) m = n-m; for (i=1 ; i <= m; n--, i++) cnm = cnm * n / i; return cnm; } unsigned long ncomb2 (int n, int m) { unsigned long cnm = 1UL; int i, f; if (m*2 >n) m = n-m; for (i=1 ; i <= m; n--, i++) { if ((f=n) % i == 0) f /= i; else cnm /= i; cnm *= f; } return cnm; } #ifdef TEST #include <stdio.h> #include <stdlib.h> main (int argc, char *argv[]) { int n,m; n = atoi (argv[1]); m = atoi (argv[2]); printf ("ncomb1 = %lu, ncomb2 = %lu\n", ncomb1(n,m), ncomb2(n,m)); return 0; } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bastrngs.c�������������������������������������������0000755�0000764�0000144�00000005753�07055333646�016306� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** BASIC-like string operations ** ** public domain by Bob Stout */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdarg.h> #include <assert.h> static int stralloc_ptr; static char *strings[8]; static int str_tag[8]; /* ** stralloc() is the key function in this package, maintaining a pool of ** reusable strings. */ char *stralloc(size_t length) { register int i; i = stralloc_ptr++; if ((!strings[i]) || (length > strlen(strings[i]))) { assert(strings[i] = (char *)realloc(strings[i], length)); str_tag[i] = -1; } else str_tag[i] = 0; stralloc_ptr &= 7; return (strings[i]); /* Maintains 8 strings in a circular buffer */ } /* ** free the string pool. */ void str_free(char *string) { register int i; for (i = 0; i < 8; ++i) { if (strings[i] == string) { if (str_tag[i]) free(strings[i]); return; } } } /* ** return the leftmost N characters from a string */ char *left(char *string, size_t N) { char *buf; size_t strlength = strlen(string); if (N > strlength) N = strlength; buf = stralloc(N + 1); memcpy(buf, string, N); buf[N] = '\0'; return buf; } /* ** return the rightmost N characters from a string */ char *right(char *string, size_t N) { char *buf; size_t strlength = strlen(string); if (N > strlength) N = strlength; buf = stralloc(N + 1); strcpy(buf, &string[strlength-N]); return buf; } /* ** return a substring, N characters long beginning at position M */ char *mid(char *string, size_t M, size_t N) { char *buf; size_t strlength = strlen(string); if (M > strlength) return NULL; if (N > (strlength - M)) N = strlength - M; buf = stralloc(N + 1); memcpy(buf, &string[M-1], N); buf[N] = '\0'; return buf; } /* ** string concatenation function, equivalent to A$=B$+C$+... */ char *string_add(char *string, ...) { va_list arg_ptr; char *temp1, *temp2, *buf; va_start(arg_ptr, string); temp1 = string; do { if(NULL == (temp2 = va_arg(arg_ptr, char *))) break; buf = stralloc(strlen(temp1) + strlen(temp2) + 1); temp1 = strcat(strcpy(buf, temp1), temp2); } while (NULL != temp2); return temp1; } #ifdef TEST /* ** Demo main() */ void main(void) { char *x = "European", *y = "Hardware", *z = "Skaters"; z = string_add(left(x, 2), right(y, 2), mid(z, 2, 2), "!", NULL); puts(z); } #endif /* TEST */ ���������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/getstrng.c�������������������������������������������0000755�0000764�0000144�00000003216�07055333777�016315� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** GETSTRNG.C -- Demonstation of dynamic memory allocation to ** receive string of unknown length. ** ** Ron Sires 1/31/89, released to the public domain. ** Bob Stout 2/18/93, modified to use a static buffer */ #include <stdlib.h> #include <stdio.h> #define BLOCKSIZ 16 char *getstring(void) { int newchar; size_t i; static size_t bufsize = 0; static char *buffer = NULL; /* Get chars from keyboard and put them in buffer. */ for (i = 0; ((newchar = getchar()) != EOF) && (newchar != '\n') && (newchar != '\r'); ++i ) { if (i + 1 > bufsize) { /* If buffer is full, resize it. */ if (NULL == (buffer = realloc(buffer, bufsize + BLOCKSIZ))) { puts("\agetstrng() - Insufficient memory"); /* Add terminator to partial string */ if (buffer) buffer[i] = '\0'; return buffer; } bufsize += BLOCKSIZ; } buffer[i] = (char) newchar; } buffer[i] = '\0'; /* Tack on a null-terminator. */ return buffer; } #ifdef TEST #include <string.h> int main(void) { char *string; puts("Enter strings of any length or <Enter> to quit\n"); do { string = getstring(); printf("You entered:\n\"%s\"\n\n", string); } while (strlen(string)); free(string); return EXIT_SUCCESS; } #endif /* TEST */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/drvs.c�����������������������������������������������0000755�0000764�0000144�00000002632�07055333735�015431� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** DRVS.C - public domain by David Gersic, DeKalb, Il 1993 ** ** Routine checks how many valid disk drives are available on machine, ** both physical and logical drives. ** ** Includes drive letters assigned with DOS SUBST command and network ** drives for Novell Netware (and probably other networks). ** ** Compiled Under MSC 6 LARGE memory Model ** Should be compatible with other DOS compilers ** */ #include <stdio.h> #include <dos.h> #include <stdlib.h> main() { union REGS in, out; int i; /* Novell's shell TSRs allow up to 32 drive 'letters' to be created */ char drives[]={' ','a','b','c','d','e','f','g','h','i','j', 'k','l','m','n','o','p','q','r','s','t','u', 'v','w','x','y','z','[','\\',']','^','_','`'}; in.x.ax=0x4409; /* IOCTL function - Check if block device remote */ for(i = 1; i < 32; i++) { in.h.bl=(unsigned char)i; /* 1==a:, 2==b:, etc. */ intdos(&in,&out); if(!out.x.cflag) /* carry flag set on error */ { /* bit 15 == subst, bit 12 == 'remote'*/ printf("drive %c: is %s\n", drives[i],out.x.dx & 1<<15 ? "subst" : out.x.dx & 1<<12 ? "network" : "local"); } } return(0); } ������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/approx.c���������������������������������������������0000755�0000764�0000144�00000011753�07055333644�015767� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************************************** * * Fuzzy string searching subroutines * * Author: John Rex * Date: August, 1988 * References: (1) Computer Algorithms, by Sara Baase * Addison-Wesley, 1988, pp 242-4. * (2) Hall PAV, Dowling GR: "Approximate string matching", * ACM Computing Surveys, 12:381-402, 1980. * * Verified on: * Datalite, DeSmet, Ecosoft, Lattice, MetaWare, MSC, Turbo, Watcom * * Compile time preprocessor switches: * DEBUG - if defined, include test driver * * Usage: * * char *pattern, *text; - search for pattern in text * int degree; - degree of allowed mismatch * char *start, *end; * int howclose; * * void App_init(pattern, text, degree); - setup routine * void App_next(&start, &end, &howclose); - find next match * * - searching is done when App_next() returns start==NULL * **************************************************************/ #define DEBUG 1 #include <stdio.h> #include <stdlib.h> #include <string.h> /* local, static data */ static char *Text, *Pattern; /* pointers to search strings */ static int Textloc; /* current search position in Text */ static int Plen; /* length of Pattern */ static int Degree; /* max degree of allowed mismatch */ static int *Ldiff, *Rdiff; /* dynamic difference arrays */ static int *Loff, *Roff; /* used to calculate start of match */ void App_init(char *pattern, char *text, int degree) { int i; /* save parameters */ Text = text; Pattern = pattern; Degree = degree; /* initialize */ Plen = strlen(pattern); Ldiff = (int *) malloc(sizeof(int) * (Plen + 1) * 4); Rdiff = Ldiff + Plen + 1; Loff = Rdiff + Plen + 1; Roff = Loff + Plen + 1; for (i = 0; i <= Plen; i++) { Rdiff[i] = i; /* initial values for right-hand column */ Roff[i] = 1; } Textloc = -1; /* current offset into Text */ } void App_next(char **start, char **end, int *howclose) { int *temp, a, b, c, i; *start = NULL; while (*start == NULL) /* start computing columns */ { if (Text[++Textloc] == '\0') /* out of text to search! */ break; temp = Rdiff; /* move right-hand column to left ... */ Rdiff = Ldiff; /* ... so that we can compute new ... */ Ldiff = temp; /* ... right-hand column */ Rdiff[0] = 0; /* top (boundary) row */ temp = Roff; /* and swap offset arrays, too */ Roff = Loff; Loff = temp; Roff[1] = 0; for (i = 0; i < Plen; i++) /* run through pattern */ { /* compute a, b, & c as the three adjacent cells ... */ if (Pattern[i] == Text[Textloc]) a = Ldiff[i]; else a = Ldiff[i] + 1; b = Ldiff[i+1] + 1; c = Rdiff[i] + 1; /* ... now pick minimum ... */ if (b < a) a = b; if (c < a) a = c; /* ... and store */ Rdiff[i+1] = a; } /* now update offset array */ /* the values in the offset arrays are added to the current location to determine the beginning of the mismatched substring. (see text for details) */ if (Plen > 1) for (i=2; i<=Plen; i++) { if (Ldiff[i-1] < Rdiff[i]) Roff[i] = Loff[i-1] - 1; else if (Rdiff[i-1] < Rdiff[i]) Roff[i] = Roff[i-1]; else if (Ldiff[i] < Rdiff[i]) Roff[i] = Loff[i] - 1; else /* Ldiff[i-1] == Rdiff[i] */ Roff[i] = Loff[i-1] - 1; } /* now, do we have an approximate match? */ if (Rdiff[Plen] <= Degree) /* indeed so! */ { *end = Text + Textloc; *start = *end + Roff[Plen]; *howclose = Rdiff[Plen]; } } if (start == NULL) /* all done - free dynamic arrays */ free(Ldiff); } #ifdef DEBUG void main(int argc, char **argv) { char *begin, *end; int howclose; if (argc != 4) { puts("Usage is: approx pattern text degree\n"); exit(0); } App_init(argv[1], argv[2], atoi(argv[3])); App_next(&begin, &end, &howclose); while (begin != NULL) { printf("Degree %d: %.*s\n", howclose, end-begin+1, begin); App_next(&begin, &end, &howclose); } } #endif ���������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/hexorint.c�������������������������������������������0000755�0000764�0000144�00000001775�07055334011�016306� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** HEXORINT.C - Detect if a string denotes a hex or decimal ** number by detecting a leading "0X" or trailing "H" string. ** ** public domain demo by Bob Stout */ #include <stdlib.h> #include <string.h> #undef NUL #define NUL '\0' #define LAST_CHAR(s) (((char *)s)[strlen(s) - 1]) /* ** Let strtol() do most of the work */ long hexorint(const char *string) { int radix = 0; char *dummy, valstr[128]; strcpy(valstr, string); if (strchr("Hh", LAST_CHAR(valstr))) { LAST_CHAR(valstr) = NUL; radix = 16; } return strtol(valstr, &dummy, radix); } /* ** Test code follows - compile with TEST macro defined to test */ #ifdef TEST #include <stdio.h> main(int argc, char *argv[]) { long val; while (--argc) { val = hexorint(*(++argv)); printf("Value of %s = %ld = %#lx\n", *argv, val, val); } return EXIT_SUCCESS; } #endif /* TEST */ ���c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/getcmt.c���������������������������������������������0000755�0000764�0000144�00000023000�07055333773�015730� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* getcmt.c - get comments from a C or C++ source file */ /* Byte_Magic Software 9850 Meadowglen Ln. #35 Houston, Tx. 77042 (713) 975-9033 Author: Greg Messer Program: getcmt.c Purpose: Isolate comments from a C or C++ source file. Filter. Syntax: getcmt [/L?] [filename] (may use redirection for file and/or device I/O) Release: Released to the Public Domain by Byte_Magic Software. Date: 07-11-88 GM... First release. Revised: 01-13-90 GM... Streamlined logic. 01-15-90 Bob Stout (RBS)... Fixed unsigned char error as return from getc(). 01-22-90 GM... Fixed bug handling "xx/" (xx = **) at end of comment. Added C++ comment extraction. Added return of count to OS (ERRORLEVEL in MS-DOS). 01-24-90 RBS Added filename spec option Added /? switch System: Compiled with Zortech C V2.06 under MS-DOS 3.20 for IBM PCs and compatibles. Rules: ANSI C comments begin with /x and end with x/. (x = *). Comments do not nest and do not appear in string or character constants. C++ comments begin with double slashes and end at EOL. A Microsoft extension to C allows C++ style comments to serve as single-line comments in C source. Comments: Useful for creating documentation and improving commenting style. Input may be from a specified filename or stdin. Output is to stdout, so use DOS redirection for output. Messages go to stderr so they are not redirectable from the screen. Returns ERRORLEVEL = number of comments in source file(s). Examples: Example... Output to screen: getcmt < cfile.c (displays comments from cfile.c on screen) type cfile.c | getcmt (same as above but slightly slower) getcmt < cfile.c | more (same as above, but pauses after each full screen) getcmt cfile.c /l | more (same as above, but display line numbers) Example... Output to printer: getcmt < cfile.c > prn (same as above but prints output on printer) type cfile.c | getcmt > prn (same as above but slightly slower) Example... Output to file: getcmt < cfile.c > cfile.cmt (writes cfile.c comments to cfile.cmt, overwriting existing file) getcmt < cfile.c >> cfile.doc (writes cfile.c comments to end of cfile.doc (appends)) getcmt /? (displays help screen, returns ERRORLEVEL = 0) getcmt /x (invalid option - displays help screen, returns ERRORLEVEL = -1) For complete instructions on using redirection symbols, consult the PC-DOS or MS-DOS manual or a general DOS reference book. */ #include <stdlib.h> #include <stdio.h> #include <ctype.h> #include <string.h> #define LOOKS_GREAT 1 #define LESS_FILLING 0 int extract_c_cmts(void); void inside_c_cmt(int); FILE *infile = stdin; /* read input from here */ int show_nos = 0; /* 0 = don't display line numbers */ int line_no = 1; /* line_no = line number */ /* * * * * * * * * * * * * * * * * * * */ main(int argc, char *argv[]) /* main logic: */ { register int i; const char *hype = "\nGETCMT v1.1 - GET CoMmenTs\nby Byte_Magic Software\n"; const char *help = "\nUsage: GETCMT [/l?] [filename | <sourcefile.ext] " "[>destination file or device]\n" "Options: l - Print line numbers\n" " ? - Help\n" "\nFilename optional - Reads source code from stdin " "(Ctrl-C to quit before EOF)\n"; const char *oops = "\a*** GETCMT - Can't open input file "; /* display messages to operator */ #if LOOKS_GREAT fputs(hype, stderr); #elif LESS_FILLING i = 0; while(hype[i] != '\0') putc(hype[i++], stderr); #endif if (1 < argc) { for (i = 1; i < argc; ++i) { if ('/' == *argv[i]) { if ('l' == tolower(argv[i][1])) show_nos = 1; else { int ercode; ercode = ('?' == argv[i][1]) ? 0 : -1; #if LOOKS_GREAT fputs(help, stderr); #elif LESS_FILLING i = 0; while(help[i] != '\0') putc(help[i++], stderr); #endif if (ercode) /* output BEL if invalid seitch */ putc('\a', stderr); return(ercode); } } else { infile = fopen(argv[i], "r"); if (!infile) { #if LOOKS_GREAT fputs(oops, stderr); fputs(argv[i], stderr); #elif LESS_FILLING char *p = argv[i]; i = 0; while (oops[i]) putc(oops[i], stderr); i = 0; while (*p) putc(*p++, stderr); #endif } } } } i = extract_c_cmts(); /* extract comments in infile */ putc('\n', stdout); return(i); /* return number of comments to */ /* OS (ERRORLEVEL in DOS) */ } /* * * * * * * * * * * * * * * * * * * */ int extract_c_cmts() /* comment extraction logic: */ { register int chi, cht; /* chi = char in, cht = char test */ int count; /* count = comment count */ count = 0; chi = getc(infile); while(chi != EOF) /* as long as there is input... */ { if(chi == '/') /* process comments */ { cht = getc(infile); if(cht == EOF) return(count); if(cht == '*' || cht == '/') /* if start of a comment... */ { count++; /* count it and */ inside_c_cmt(cht); /* output all of the comment */ } else ungetc(cht, infile); } if ('\n' == chi) line_no += 1; chi = getc(infile); /* continue scanning input */ } return(count); } /* * * * * * * * * * * * * * * * * * * */ char *lntoaz(void) /* line number to zero-padded ASCII */ { int i, num = line_no; static char numbuf[] = "0000: "; if (9999 < num) strncpy(numbuf, "0000", 4); else for (i = 3; i >= 0; --i) { numbuf[i] = (char)('0' + num % 10); num /= 10; } return numbuf; } /* * * * * * * * * * * * * * * * * * * */ void inside_c_cmt(int ch) /* comment output logic: */ { /* input ch = either '*' for C */ /* or '/' for C++ */ register int chi, cht; /* chi = char in, cht = char test */ #if LESS_FILLING char *p; #endif if(ch == '/') /* make ch = '\n' if C++ */ ch = '\n'; /* note: ch is already 1st char */ /* of end comment if this is C */ putc('\n', stdout); if (show_nos) { #if LOOKS_GREAT fputs(lntoaz(), stdout); #elif LESS_FILLING p = lntoaz(); while (*p) putc(*p++, stdout); #endif } chi = getc(infile); while(chi != EOF) /* as long as there is input... */ { /* process comments */ if(chi == ch) { if(ch == '\n') /* if C++ comment is ended... */ return; /* stop outputting */ cht = getc(infile); if(cht == '/') /* if C comment is ended... */ return; /* stop outputting */ else { ungetc(cht, infile); putc(chi, stdout); } } else putc(chi, stdout); /* else comment text, output it */ if ('\n' == chi) line_no += 1; chi = getc(infile); /* continue scanning input */ } return; } /* * * * * * * * * * * * * * * * * * * */ /* end of getcmt.c */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/lzhuf.c����������������������������������������������0000755�0000764�0000144�00000044745�07055334054�015611� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/************************************************************** lzhuf.c written by Haruyasu Yoshizaki 1988/11/20 some minor changes 1989/04/06 comments translated by Haruhiko Okumura 1989/04/07 getbit and getbyte modified 1990/03/23 by Paul Edwards so that they would work on machines where integers are not necessarily 16 bits (although ANSI guarantees a minimum of 16). This program has compiled and run with no errors under Turbo C 2.0, Power C, and SAS/C 4.5 (running on an IBM mainframe under MVS/XA 2.2). Could people please use YYYY/MM/DD date format so that everyone in the world can know what format the date is in? external storage of filesize changed 1990/04/18 by Paul Edwards to Intel's "little endian" rather than a machine-dependant style so that files produced on one machine with lzhuf can be decoded on any other. "little endian" style was chosen since lzhuf originated on PC's, and therefore they should dictate the standard. initialization of something predicting spaces changed 1990/04/22 by Paul Edwards so that when the compressed file is taken somewhere else, it will decode properly, without changing ascii spaces to ebcdic spaces. This was done by changing the ' ' (space literal) to 0x20 (which is the far most likely character to occur, if you don't know what environment it will be running on. **************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> FILE *infile, *outfile; static unsigned long int textsize = 0, codesize = 0, printcount = 0; char wterr[] = "Can't write."; static void Error(char *message) { printf("\n%s\n", message); exit(EXIT_FAILURE); } /********** LZSS compression **********/ #define N 4096 /* buffer size */ #define F 60 /* lookahead buffer size */ #define THRESHOLD 2 #define NIL N /* leaf of tree */ unsigned char text_buf[N + F - 1]; static int match_position, match_length, lson[N + 1], rson[N + 257], dad[N + 1]; static void InitTree(void) /* initialize trees */ { int i; for (i = N + 1; i <= N + 256; i++) rson[i] = NIL; /* root */ for (i = 0; i < N; i++) dad[i] = NIL; /* node */ } static void InsertNode(int r) /* insert to tree */ { int i, p, cmp; unsigned char *key; unsigned c; cmp = 1; key = &text_buf[r]; p = N + 1 + key[0]; rson[r] = lson[r] = NIL; match_length = 0; for ( ; ; ) { if (cmp >= 0) { if (rson[p] != NIL) p = rson[p]; else { rson[p] = r; dad[r] = p; return; } } else { if (lson[p] != NIL) p = lson[p]; else { lson[p] = r; dad[r] = p; return; } } for (i = 1; i < F; i++) if ((cmp = key[i] - text_buf[p + i]) != 0) break; if (i > THRESHOLD) { if (i > match_length) { match_position = ((r - p) & (N - 1)) - 1; if ((match_length = i) >= F) break; } if (i == match_length) { if ((c = ((r - p) & (N-1)) - 1) < (unsigned)match_position) { match_position = c; } } } } dad[r] = dad[p]; lson[r] = lson[p]; rson[r] = rson[p]; dad[lson[p]] = r; dad[rson[p]] = r; if (rson[dad[p]] == p) rson[dad[p]] = r; else lson[dad[p]] = r; dad[p] = NIL; /* remove p */ } static void DeleteNode(int p) /* remove from tree */ { int q; if (dad[p] == NIL) return; /* not registered */ if (rson[p] == NIL) q = lson[p]; else if (lson[p] == NIL) q = rson[p]; else { q = lson[p]; if (rson[q] != NIL) { do { q = rson[q]; } while (rson[q] != NIL); rson[dad[q]] = lson[q]; dad[lson[q]] = dad[q]; lson[q] = lson[p]; dad[lson[p]] = q; } rson[q] = rson[p]; dad[rson[p]] = q; } dad[q] = dad[p]; if (rson[dad[p]] == p) rson[dad[p]] = q; else lson[dad[p]] = q; dad[p] = NIL; } /* Huffman coding */ #define N_CHAR (256 - THRESHOLD + F) /* kinds of characters (character code = 0..N_CHAR-1) */ #define T (N_CHAR * 2 - 1) /* size of table */ #define R (T - 1) /* position of root */ #define MAX_FREQ 0x8000 /* updates tree when the */ typedef unsigned char uchar; /* table for encoding and decoding the upper 6 bits of position */ /* for encoding */ uchar p_len[64] = { 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }; uchar p_code[64] = { 0x00, 0x20, 0x30, 0x40, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78, 0x80, 0x88, 0x90, 0x94, 0x98, 0x9C, 0xA0, 0xA4, 0xA8, 0xAC, 0xB0, 0xB4, 0xB8, 0xBC, 0xC0, 0xC2, 0xC4, 0xC6, 0xC8, 0xCA, 0xCC, 0xCE, 0xD0, 0xD2, 0xD4, 0xD6, 0xD8, 0xDA, 0xDC, 0xDE, 0xE0, 0xE2, 0xE4, 0xE6, 0xE8, 0xEA, 0xEC, 0xEE, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF }; /* for decoding */ uchar d_code[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F, 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 0x18, 0x18, 0x19, 0x19, 0x1A, 0x1A, 0x1B, 0x1B, 0x1C, 0x1C, 0x1D, 0x1D, 0x1E, 0x1E, 0x1F, 0x1F, 0x20, 0x20, 0x21, 0x21, 0x22, 0x22, 0x23, 0x23, 0x24, 0x24, 0x25, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x29, 0x2A, 0x2A, 0x2B, 0x2B, 0x2C, 0x2C, 0x2D, 0x2D, 0x2E, 0x2E, 0x2F, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, }; uchar d_len[256] = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, }; unsigned freq[T + 1]; /* frequency table */ int prnt[T + N_CHAR]; /* pointers to parent nodes, except for the */ /* elements [T..T + N_CHAR - 1] which are used to get */ /* the positions of leaves corresponding to the codes. */ int son[T]; /* pointers to child nodes (son[], son[] + 1) */ unsigned getbuf = 0; uchar getlen = 0; static int GetBit(void) /* get one bit */ { unsigned i; while (getlen <= 8) { if ((int)(i = getc(infile)) < 0) i = 0; getbuf |= i << (8 - getlen); getlen += 8; } i = getbuf; getbuf <<= 1; getlen--; return (int)((i & 0x8000) >> 15); } static int GetByte(void) /* get one byte */ { unsigned i; while (getlen <= 8) { if ((int)(i = getc(infile)) < 0) i = 0; getbuf |= i << (8 - getlen); getlen += 8; } i = getbuf; getbuf <<= 8; getlen -= 8; return (int)((i & 0xff00) >> 8); } unsigned putbuf = 0; uchar putlen = 0; static void Putcode(int l, unsigned c) /* output c bits of code */ { putbuf |= c >> putlen; if ((putlen += l) >= 8) { if (putc(putbuf >> 8, outfile) == EOF) { Error(wterr); } if ((putlen -= 8) >= 8) { if (putc(putbuf, outfile) == EOF) { Error(wterr); } codesize += 2; putlen -= 8; putbuf = c << (l - putlen); } else { putbuf <<= 8; codesize++; } } } /* initialization of tree */ static void StartHuff(void) { int i, j; for (i = 0; i < N_CHAR; i++) { freq[i] = 1; son[i] = i + T; prnt[i + T] = i; } i = 0; j = N_CHAR; while (j <= R) { freq[j] = freq[i] + freq[i + 1]; son[j] = i; prnt[i] = prnt[i + 1] = j; i += 2; j++; } freq[T] = 0xffff; prnt[R] = 0; } /* reconstruction of tree */ static void reconst(void) { int i, j, k; unsigned f, l; /* collect leaf nodes in the first half of the table */ /* and replace the freq by (freq + 1) / 2. */ j = 0; for (i = 0; i < T; i++) { if (son[i] >= T) { freq[j] = (freq[i] + 1) / 2; son[j] = son[i]; j++; } } /* begin constructing tree by connecting sons */ for (i = 0, j = N_CHAR; j < T; i += 2, j++) { k = i + 1; f = freq[j] = freq[i] + freq[k]; for (k = j - 1; f < freq[k]; k--); k++; l = (j - k) * 2; memmove(&freq[k + 1], &freq[k], l); freq[k] = f; memmove(&son[k + 1], &son[k], l); son[k] = i; } /* connect prnt */ for (i = 0; i < T; i++) { if ((k = son[i]) >= T) { prnt[k] = i; } else { prnt[k] = prnt[k + 1] = i; } } } /* increment frequency of given code by one, and update tree */ static void update(int c) { int i, j, k, l; if (freq[R] == MAX_FREQ) { reconst(); } c = prnt[c + T]; do { k = ++freq[c]; /* if the order is disturbed, exchange nodes */ if ((unsigned)k > freq[l = c + 1]) { while ((unsigned)k > freq[++l]); l--; freq[c] = freq[l]; freq[l] = k; i = son[c]; prnt[i] = l; if (i < T) prnt[i + 1] = l; j = son[l]; son[l] = i; prnt[j] = c; if (j < T) prnt[j + 1] = c; son[c] = j; c = l; } } while ((c = prnt[c]) != 0); /* repeat up to root */ } unsigned code, len; static void EncodeChar(unsigned c) { unsigned i; int j, k; i = 0; j = 0; k = prnt[c + T]; /* travel from leaf to root */ do { i >>= 1; /* if node's address is odd-numbered, choose bigger brother node */ if (k & 1) i += 0x8000; j++; } while ((k = prnt[k]) != R); Putcode(j, i); code = i; len = j; update(c); } static void EncodePosition(unsigned c) { unsigned i; /* output upper 6 bits by table lookup */ i = c >> 6; Putcode(p_len[i], (unsigned)p_code[i] << 8); /* output lower 6 bits verbatim */ Putcode(6, (c & 0x3f) << 10); } static void EncodeEnd(void) { if (putlen) { if (putc(putbuf >> 8, outfile) == EOF) { Error(wterr); } codesize++; } } static int DecodeChar(void) { unsigned c; c = son[R]; /* travel from root to leaf, */ /* choosing the smaller child node (son[]) if the read bit is 0, */ /* the bigger (son[]+1} if 1 */ while (c < T) { c += GetBit(); c = son[c]; } c -= T; update(c); return (int)c; } static int DecodePosition(void) { unsigned i, j, c; /* recover upper 6 bits from table */ i = GetByte(); c = (unsigned)d_code[i] << 6; j = d_len[i]; /* read lower 6 bits verbatim */ j -= 2; while (j--) { i = (i << 1) + GetBit(); } return (int)(c | (i & 0x3f)); } /* compression */ static void Encode(void) /* compression */ { int i, c, len, r, s, last_match_length; fseek(infile, 0L, 2); textsize = ftell(infile); fputc((int)((textsize & 0xff)),outfile); fputc((int)((textsize & 0xff00) >> 8),outfile); fputc((int)((textsize & 0xff0000L) >> 16),outfile); fputc((int)((textsize & 0xff000000L) >> 24),outfile); if (ferror(outfile)) Error(wterr); /* output size of text */ if (textsize == 0) return; rewind(infile); textsize = 0; /* rewind and re-read */ StartHuff(); InitTree(); s = 0; r = N - F; for (i = s; i < r; i++) text_buf[i] = 0x20; for (len = 0; len < F && (c = getc(infile)) != EOF; len++) text_buf[r + len] = (unsigned char)c; textsize = len; for (i = 1; i <= F; i++) InsertNode(r - i); InsertNode(r); do { if (match_length > len) match_length = len; if (match_length <= THRESHOLD) { match_length = 1; EncodeChar(text_buf[r]); } else { EncodeChar(255 - THRESHOLD + match_length); EncodePosition(match_position); } last_match_length = match_length; for (i = 0; i < last_match_length && (c = getc(infile)) != EOF; i++) { DeleteNode(s); text_buf[s] = (unsigned char)c; if (s < F - 1) text_buf[s + N] = (unsigned char)c; s = (s + 1) & (N - 1); r = (r + 1) & (N - 1); InsertNode(r); } if ((textsize += i) > printcount) { printf("%12ld\r", textsize); printcount += 1024; } while (i++ < last_match_length) { DeleteNode(s); s = (s + 1) & (N - 1); r = (r + 1) & (N - 1); if (--len) InsertNode(r); } } while (len > 0); EncodeEnd(); printf("In : %ld bytes\n", textsize); printf("Out: %ld bytes\n", codesize); printf("Out/In: %.3f\n", 1.0 * codesize / textsize); } static void Decode(void) /* recover */ { int i, j, k, r, c; unsigned long int count; textsize = (fgetc(infile)); textsize |= (fgetc(infile) << 8); textsize |= (fgetc(infile) << 16); textsize |= (fgetc(infile) << 24); if (ferror(infile)) Error("Can't read"); /* read size of text */ if (textsize == 0) return; StartHuff(); for (i = 0; i < N - F; i++) text_buf[i] = 0x20; r = N - F; for (count = 0; count < textsize; ) { c = DecodeChar(); if (c < 256) { if (putc(c, outfile) == EOF) { Error(wterr); } text_buf[r++] = (unsigned char)c; r &= (N - 1); count++; } else { i = (r - DecodePosition() - 1) & (N - 1); j = c - 255 + THRESHOLD; for (k = 0; k < j; k++) { c = text_buf[(i + k) & (N - 1)]; if (putc(c, outfile) == EOF) { Error(wterr); } text_buf[r++] = (unsigned char)c; r &= (N - 1); count++; } } if (count > printcount) { printf("%12ld\r", count); printcount += 1024; } } printf("%12ld\n", count); } int main(int argc, char *argv[]) { char *s; if (argc != 4) { printf("'lzhuf e file1 file2' encodes file1 into file2.\n" "'lzhuf d file2 file1' decodes file2 into file1.\n"); return EXIT_FAILURE; } if ((s = argv[1], s[1] || strpbrk(s, "DEde") == NULL) || (s = argv[2], (infile = fopen(s, "rb")) == NULL) || (s = argv[3], (outfile = fopen(s, "wb")) == NULL)) { printf("??? %s\n", s); return EXIT_FAILURE; } if (toupper(*argv[1]) == 'E') Encode(); else Decode(); fclose(infile); fclose(outfile); return EXIT_SUCCESS; } ���������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/eval.c�����������������������������������������������0000755�0000764�0000144�00000016212�07055333747�015404� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** EVAL.C - A simple mathematical expression evaluator in C ** ** operators supported: ( ** ) ** + ** - ** * ** / ** ^ ** ** limitations: 1 - No precedence rules are implemented. ** 2 - Numbers can be negated (e.g. "-13"), but not ** expressions (e.g. "-(13)"). ** ** Original Copyright 1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset* version is hereby donated to the public domain. ** ** *(The MFL version adds 150 lines of code, 5 level precedence, ** logarithmic and transcendental operators, pi as a constant, ** named variables, and fully understands negation.) */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <math.h> #define NUL '\0' typedef enum {R_ERROR = -2 /* range */, ERROR /* syntax */, SUCCESS} STATUS; static char delims[] = "+-*/^)("; /* Tokens */ static char op_stack[256]; /* Operator stack */ static double arg_stack[256]; /* Argument stack */ static char token[256]; /* Token buffer */ static int op_sptr, /* op_stack pointer */ arg_sptr, /* arg_stack pointer */ parens, /* Nesting level */ state = 0; /* 0 = Awaiting expression 1 = Awaiting operator */ int evaluate(char *, double *); static int do_op(void); static int do_paren(void); static void push_op(char); static void push_arg(double); static STATUS pop_arg(double *); static STATUS pop_op(int *); static char *getexp(char *); static char *getop(char *); static void pack(char *); #ifdef TEST void main(int argc, char *argv[]) { double val; printf("evaluate(%s) ", argv[1]); printf("returned %d\n", evaluate(argv[1], &val)); printf("val = %f\n", val); } #endif /* ** Evaluate a mathematical expression */ int evaluate(char *line, double *val) { double arg; char *ptr = line, *str, *endptr; int ercode; pack(line); while (*ptr) { switch (state) { case 0: if (NULL != (str = getexp(ptr))) { if ('(' == *str) { push_op(*str); ptr += strlen(str); break; } if (0.0 == (arg = strtod(str, &endptr)) && NULL == strchr(str, '0')) { return ERROR; } push_arg(arg); ptr += strlen(str); } else return ERROR; state = 1; break; case 1: if (NULL == (str = getop(ptr))) return ERROR; if (strchr(delims, *str)) { if (')' == *str) { if (SUCCESS > (ercode = do_paren())) return ercode; } else { push_op(*str); state = 0; } ptr += strlen(str); } else return ERROR; break; } } while (1 < arg_sptr) { if (SUCCESS > (ercode = do_op())) return ercode; } if (!op_sptr) return pop_arg(val); else return ERROR; } /* ** Evaluate stacked arguments and operands */ static int do_op(void) { double arg1, arg2; int op; if (ERROR == pop_op(&op)) return ERROR; pop_arg(&arg1); pop_arg(&arg2); switch (op) { case '+': push_arg(arg2 + arg1); break; case '-': push_arg(arg2 - arg1); break; case '*': push_arg(arg2 * arg1); break; case '/': if (0.0 == arg1) return R_ERROR; push_arg(arg2 / arg1); break; case '^': if (0.0 > arg2) return R_ERROR; push_arg(pow(arg2, arg1)); break; case '(': arg_sptr += 2; break; default: return ERROR; } if (1 > arg_sptr) return ERROR; else return op; } /* ** Evaluate one level */ static int do_paren(void) { int op; if (1 > parens--) return ERROR; do { if (SUCCESS > (op = do_op())) break; } while ('('!= op); return op; } /* ** Stack operations */ static void push_op(char op) { if ('(' == op) ++parens; op_stack[op_sptr++] = op; } static void push_arg(double arg) { arg_stack[arg_sptr++] = arg; } static STATUS pop_arg(double *arg) { *arg = arg_stack[--arg_sptr]; if (0 > arg_sptr) return ERROR; else return SUCCESS; } static STATUS pop_op(int *op) { if (!op_sptr) return ERROR; *op = op_stack[--op_sptr]; return SUCCESS; } /* ** Get an expression */ static char *getexp(char *str) { char *ptr = str, *tptr = token; while (*ptr) { if (strchr(delims, *ptr)) { if ('-' == *ptr) { if (str != ptr && 'E' != ptr[-1]) break; } else if (str == ptr) return getop(str); else if ('E' == *ptr) { if (!isdigit(ptr[1]) && '-' != ptr[1]) return NULL; } else break; } *tptr++ = *ptr++; } *tptr = NUL; return token; } /* ** Get an operator */ static char *getop(char *str) { *token = *str; token[1] = NUL; return token; } /* ** Remove whitespace & capitalize */ static void pack(char *str) { char *ptr = str, *p; strupr(str); for ( ; *ptr; ++ptr) { p = ptr; while (*p && isspace(*p)) ++p; if (ptr != p) strcpy(ptr, p); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/doscopy.c��������������������������������������������0000755�0000764�0000144�00000003572�07055333731�016133� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*************************************************** * function : copy * * purpose : copy one file * * * * arguments: path to source 'fromDir', * * path to target 'toDir', * * filename to copy 'fname' * * * * returns : nothing * * * * By : Peter Yard (29 May 1991) * ***************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <io.h> void pmerge(char *path, char *drive, char *dir, char *fname, char *ext); #define STDOUT fileno(stdout) void copy(char *fromDir, char *fname, char *toDir) { FILE *nul; /* nul will redirect stdout to DOS 'nul' */ char from[FILENAME_MAX], to[FILENAME_MAX], comd[128]; int bytesRead, oldStdout; /* Create the strings to describe the paths */ pmerge(from, NULL, fromDir, fname, NULL); pmerge(to, NULL, toDir, fname, NULL); /* Construct 'comd' string which is a dos command for a copy */ strcpy(comd, "copy "); strcat(comd, from); strcat(comd, " "); strcat(comd, to); /* Redirect stdout to a nul file, kills output to the screen */ nul = fopen("NUL", "w"); oldStdout = dup(STDOUT); dup2(fileno(nul), STDOUT); fclose(nul); system(comd); /* COPY file */ /* Restore stdout and close nul file */ dup2(oldStdout, STDOUT); close(oldStdout); /* Display file source and target, */ /* otherwise comment out the next line. */ printf("\n%s copied to %s",from,to); } ��������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/getkey.c���������������������������������������������0000755�0000764�0000144�00000000746�07055333774�015752� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Originally published as part of the MicroFirm Function Library ** ** Copyright 1986, S.E. Margison ** Copyright 1989-92, Robert B.Stout ** ** Subset version released to the public domain, 1990 */ #include <conio.h> int getkey(void) { int i; switch (i = (int)getch()) { case 0xe0: #ifdef MSDOS return i; #endif case 0: return 256 + (int)getch(); default: return i; } } ��������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/grafline.c�������������������������������������������0000755�0000764�0000144�00000002537�07055334003�016233� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Demonstration of PC line drawing characters by David Harmon */ #include <stdio.h> void main(void) { /* compile and run this on a PC, and meditate on the results. */ puts("ASCII Decimal Hex ASCII Dec Hex\n" "----- ----------- -------- ----- --- ---\n" "\332 \302 \277 218 194 191 da c2 bf \304 196 c4\n" "\303 \305 \264 195 197 180 c3 c5 b4 \263 179 b3\n" "\300 \301 \331 192 193 217 c0 c1 d9 \315 205 cd\n" " \272 186 ba\n" "\311 \313 \273 201 203 187 c9 cb bb\n" "\314 \316 \271 204 206 185 cc ce b9 \260 176 b0\n" "\310 \312 \274 200 202 188 c8 ca bc \261 177 b1\n" " \262 178 b2\n" "\326 \322 \267 214 210 183 d6 d2 b7 \333 219 db\n" "\307 \327 \266 199 215 182 c7 d7 b6\n" "\323 \320 \275 211 208 189 d3 d0 bd \334 220 dc\n" " \335 221 dd\n" "\325 \321 \270 213 209 184 d5 d1 b8 \336 222 de\n" "\306 \330 \265 198 216 181 c6 d8 b5 \337 223 df\n" "\324 \317 \276 212 207 190 d4 cf be\n" ); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/morse.c����������������������������������������������0000755�0000764�0000144�00000016570�07055334106�015577� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** <<< Morse Code Functions >>> ** ** Written by Michael M. Dodd, N4CF, and placed in the public domain. ** ** The morse() function transmits a string in Morse code on the IBM PC's ** speaker. The speed is set by a program constant (UNIT_TIME). ** ** There are several other functions in this file, all used by morse(), ** and defined ahead of morse() for convenience. ** ** The main() function at the end of the file is a test program to send ** the command-line argument string in morse code. Enclose multiple ** words in quotes. Example: morse "hello, world" ** ** These functions have been compiled and tested in the Small and Large ** memory models using Microsoft C 6.00a. ** ** Modified for ZTC++, TC++, & BC++ by Bob Stout */ #include <stdio.h> #include <dos.h> #include <conio.h> #include <ctype.h> /* ** These functions turn on and off the CW tone on the PC's speaker. The ** frequency is specified by the freq argument. ** IMPORTANT! These functions are highly IBM PC-specific! */ #define CLK_FREQ (1193180L) #define PIO (0x61) #define CTC_CMD (0x43) #define CTC_DATA (0x42) #define SETUP (0xB6) #define TONE_ON (0x03) #define TONE_OFF (0xFC) void note_on (int freq) /* Turn on the tone. */ { int divisor ; int pio_word ; divisor = (int)(CLK_FREQ / (long)(freq)) ; outp (CTC_CMD, SETUP) ; outp (CTC_DATA, divisor & 0xFF) ; outp (CTC_DATA, divisor >> 8) ; pio_word = inp (PIO) ; outp (PIO, pio_word | TONE_ON) ; } void note_off (void) /* Turn off the tone. */ { int pio_word ; pio_word = inp (PIO) ; outp (PIO, pio_word & TONE_OFF) ; } /* ** These functions implement a timing-loop delay. Because the PC's ** internal clock is too coarse for accurate CW timing, the pause() ** function uses a simple software loop to produce a delay. ** ** To minimize the effects of CPU clock speed, the calib() function ** returns a number which represents a rough index of the clock speed ** with relation to the standard IBM PC (this is very approximate). ** ** Calibration is performed only once, when the static fudge_factor is ** zero. Thereafter, the contents of fudge_factor are used to form a ** delay value. ** ** IMPORTANT! These functions are highly IBM PC-specific! */ unsigned int calib (void) { unsigned int far *timerLow = (unsigned int far *)(0x046c) ; unsigned int lastTime ; unsigned int iter ; for (lastTime = *timerLow; lastTime == *timerLow;) ; for (iter = 0, lastTime = *timerLow; lastTime == *timerLow; iter++) ; #if defined(__ZTC__) return ((unsigned int)((125L * ((long)(iter)) + 50L) / 2300L)) ; #elif defined(__TURBOC__) return ((unsigned int)((77L * ((long)(iter)) + 50L) / 2300L)) ; #else /* assume MSC */ return ((unsigned int)((100L * ((long)(iter)) + 50L) / 2300L)) ; #endif } void pause (unsigned int amount) { static unsigned int fudge_factor = 0 ; unsigned long ul ; if (fudge_factor == 0) /* Calibrate the speed. */ fudge_factor = calib () ; ul = (unsigned long)(amount) * (long)(fudge_factor) ; while (ul--) /* Delay. */ ; } /* ** These functions transmit a dot, a dash, a letter space, and a ** word space. ** ** Note that a single unit space is automatically transmitted after ** each dot or dash, so the ltr_space() function produces only a ** two-unit pause. ** ** Also, the word_space() function produces only a four-unit pause ** because the three-unit letter space has already occurred following ** the previous letter. */ #define SPACE_MASK (1 << 15) #define BIT_MASK (0xfe) #define UNIT_TIME (18) #define FREQUENCY (1500) void send_dot (void) /* Send a dot and a space. */ { note_on (FREQUENCY) ; pause (UNIT_TIME) ; note_off () ; pause (UNIT_TIME) ; } void send_dash (void) /* Send a dash and a space. */ { note_on (FREQUENCY) ; pause (UNIT_TIME * 3) ; note_off () ; pause (UNIT_TIME) ; } void ltr_space (void) /* Produce a letter space. */ { pause (UNIT_TIME * 2) ; } void word_space (void) /* Produce a word space. */ { pause (UNIT_TIME * 4) ; } /* ** MORSE () - Transmit a string in Morse code ** ** This function transmits the string pointed to by the cp argument in ** Morse code on the PC's speaker. The speed is set by the UNIT_TIME ** constant. ** ** A static table translates from ASCII to Morse code. Each entry is ** an unsigned integer, where a zero represents a dot and a one ** represents a dash. No more than 14 bits may be used. Setting bit ** 15 produces a word space, regardless of any other pattern. ** ** The Morse code pattern is taken from bit 0, and is shifted right ** each time an element is sent. A special "marker bit" follows the ** complete Morse pattern. This marker bit is tested before ** transmitting each bit; if there are no 1's in bits 1..15, the ** complete character has been sent. ** ** For example, an "L" would be 0000000000010010, with bit zero ** containing the first dot, bit one the dash, etc. The marker ** bit is in bit 4. */ void morse (char *cp) { /*--- MORSE CODE FUNCTION ---*/ unsigned int c ; static unsigned int codes [64] = { SPACE_MASK, /* Entry 0 = space (0x20) */ 0, 0, 0, 0, 0, 0, 0, 0, /* ! " # $ % & " ( */ 0, 0, 0, 115, 49, 106, 41, /* ) * + , - . / */ 63, 62, 60, 56, 48, 32, 33, 35, /* 0 1 2 3 4 5 6 7 */ 39, 47, 0, 0, 0, 0, 0, 76, /* 8 9 : ; < = > ? */ 0, 6, 17, 21, 9, 2, 20, 11, /* @ A B C D E F G */ 16, 4, 30, 13, 18, 7, 5, 15, /* H I J K L M N O */ 22, 27, 10, 8, 3, 12, 24, 14, /* P Q R S T U V W */ 25, 29, 19 /* X Y Z */ } ; pause (0) ; /* Calibrate pause() function. */ while ((c = *cp++) != '\0') { /*--- TRANSMIT COMPLETE STRING ---*/ c = toupper (c) ; /* No lower-case Morse characters. */ c -= ' ' ; /* Adjust for zero-based table. */ if (c < 0 || c > 58) /* If out of range, ignore it. */ continue ; c = codes[c] ; /* Look up Morse pattern from table. */ if (c & SPACE_MASK) /* If the space bit is set.. */ { /* ..send a word space and go on. */ word_space () ; continue ; } while (c & BIT_MASK) /* Transmit one character. */ { /*--- TRANSMIT EACH BIT ---*/ if (c & 1) send_dash () ; else send_dot () ; c >>= 1 ; } /*--- TRANSMIT EACH BIT ---*/ ltr_space () ; /* Send a space following character. */ } /*--- TRANSMIT COMPLETE STRING ---*/ } /*--- MORSE CODE FUNCTION ---*/ /* ** This is the test program, which transmits argv[1] in Morse code. */ void main (int argc, char *argv[]) { if (argc > 1) morse (argv[1]) ; } ����������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/prtoggle.c�������������������������������������������0000755�0000764�0000144�00000004660�07055334153�016274� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** prtoggle() ** ** Tee's all standard output to the printer. ** ** Parameters: None ** ** Returns: 0 if operation was successful. ** -1 if stdout or stdin is redirected. ** ** Side effects: Flushes the keyboard buffer ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <io.h> #if !defined(__ZTC__) && !defined(__TURBOC__) #define MK_FP(seg,offset) \ ((void far *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #define peek(s,o) (*((unsigned far *)(MK_FP(s,o)))) #define poke(s,o,w) (*((unsigned far *)(MK_FP(s,o)))=(w)) #endif #define SUCCESS 0 #define ERROR -1 static unsigned head, tail, start, end; static int idx = 0; static unsigned keystack[16][2]; int ungetkey(unsigned key) { int count; #ifdef __ZTC__ peek(0x40, 0x1a, &head, sizeof(unsigned)); peek(0x40, 0x1c, &tail, sizeof(unsigned)); #else head = peek(0x40, 0x1a); tail = peek(0x40, 0x1c); #endif count = tail - head; if (0 > count) count += (16 * sizeof(unsigned)); count >>= 1; if (15 > count) { #ifdef __ZTC__ peek(0x40, tail, &keystack[idx][0], sizeof(unsigned)); #else keystack[idx][0] = peek(0x40, tail); #endif keystack[idx][1] = tail; #ifdef __ZTC__ poke(0x40, tail, &key, sizeof(unsigned)); #else poke(0x40, tail, key); #endif tail += sizeof(unsigned); if (0x3e <= tail) tail = 0x1e; #ifdef __ZTC__ poke(0x40, 0x1c, &tail, sizeof(unsigned)); #else poke(0x40, 0x1c, tail); #endif return key; } return EOF; } int prtoggle(void) { if (!isatty(fileno(stdin)) || !isatty(fileno(stdout))) return -1; while (kbhit()) /* Flush the keyboard buffer */ getch(); ungetkey('P' - 64); /* Stuff a Ctrl-P into the buffer */ system(""); /* Let COMMAND.COM do the work */ return 0; } ��������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bitstrng.c�������������������������������������������0000755�0000764�0000144�00000003316�07055333653�016306� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** bitstring(): print bit pattern of bytes formatted to string. ** ** By J. Blauth, Sept. 1992. Hereby placed into the public domain. ** ** byze: value to transform to bitstring. ** biz: count of bits to be shown (counted from lowest bit, can be any ** even or odd number). ** strwid: total width the string shall have. Since between every 4 bits a ** blank (0x20) is inserted (not added after lowest bit), width of ** bitformat only is (biz+(biz/4-1)). Bits are printed right aligned, ** positions from highest bit to start of string filled with blanks. ** If value of strwid smaller than space needed to print all bits, ** strwid is ignored (e.g.: ** bitstr(s,b,16,5) results in 19 chars +'\0'). ** ** EXAMPLE: ** for (j = 1; j <= 16; j++) { bitstring(s, j, j, 16); puts(s); } ** 1: 1 ** 2: 10 ** 3: 011 ** d: 0 0000 0000 1101 ** e: 00 0000 0000 1110 ** f: 000 0000 0000 1111 */ void bitstring(char *str, long byze, int biz, int strwid) { int i, j; j = strwid - (biz + (biz >> 2)- (biz % 4 ? 0 : 1)); for (i = 0; i < j; i++) *str++ = ' '; while (--biz >= 0) { *str++ = ((byze >> biz) & 1) + '0'; if (!(biz % 4) && biz) *str++ = ' '; } *str = '\0'; } #ifdef TEST #include <stdio.h> #include <stdlib.h> int main(void) { char s[80]; long j; for (j = 1L; j <= 16L; j++) { bitstring(s, (long)j, (int)j, 16); printf("%2ld: %s\n", j, s); } return EXIT_SUCCESS; } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mouse.c����������������������������������������������0000755�0000764�0000144�00000022307�07055334111�015571� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** A series of routines to provide access to MicroSoft (and compatible) ** mice. Consult your mouse documentation for detailed information regarding ** each mouse driver function. ** ** by Bob Jarvis w/ modifications by Bob Stout */ #include <dos.h> #include "mouse.h" int mouse_present = 0; /* globally visible */ /* ** Uses driver function 0 to initialize the mouse software to its default ** settings. If no mouse is present it returns 0. If a mouse is present, it ** returns -1, and places the value of the mouse type (2 = MicroSoft, ** 3 = Mouse Systems, other values are possible) in *mousetype. Also ** initializes the global variable mouse_present (0 = no mouse, !0 = mouse ** is available). */ int ms_reset(int *mousetype) { union REGS workregs; struct SREGS sregs; /* check the vector */ segread (&sregs); workregs.h.ah = 0x35; /* DOS get vector */ workregs.h.al = 0x33; /* mouse vector */ intdosx(0x21, &workregs, &workregs, &sregs); /* ES:BX now contains the pointer to the interrupt handler */ if (sregs.es == 0 && inregs.x.bx == 0) return mouse_present = 0; workregs.x.ax = 0; int86(MSMOUSE,&workregs,&workregs); *mousetype = workregs.x.bx; mouse_present = workregs.x.ax; return(mouse_present); } /* ** Makes the mouse cursor visible. */ void ms_show_cursor(void) { union REGS workregs; workregs.x.ax = 1; int86(MSMOUSE,&workregs,&workregs); } /* ** Hides the mouse cursor. Should be called before changing any portion of ** the screen under the mouse cursor. */ void ms_hide_cursor(void) { union REGS workregs; workregs.x.ax = 2; int86(MSMOUSE,&workregs,&workregs); } /* ** Obtains information about the mouse position and button status. ** Places the current horizontal and vertical positions in *horizpos and ** *vertpos, respectively. Returns the mouse button status, which is ** mapped at the bit level as follows: ** Bit 0 - left button \ ** Bit 1 - right button >-- 0 = button up, 1 = button down ** Bit 2 - middle button / */ int ms_get_mouse_pos(int *horizpos, int *vertpos) /* Returns button status */ { union REGS workregs; workregs.x.ax = 3; int86(MSMOUSE,&workregs,&workregs); *horizpos = workregs.x.cx; *vertpos = workregs.x.dx; return(workregs.x.bx); } /* ** Moves the mouse cursor to a new position. */ void ms_set_mouse_pos(int horizpos, int vertpos) { union REGS workregs; workregs.x.ax = 4; workregs.x.cx = horizpos; workregs.x.dx = vertpos; int86(MSMOUSE,&workregs,&workregs); } /* ** Obtains information about the last time the specified button ** (0 = left, 1 = right, 2 = middle) was pressed. Returns the current ** button status (same format as return from ms_get_mouse_pos() above). */ int ms_button_press_status(int button, int *press_count, int *column, int *row) { union REGS workregs; workregs.x.ax = 5; workregs.x.bx = button; int86(MSMOUSE,&workregs,&workregs); *press_count = workregs.x.bx; *column = workregs.x.cx; *row = workregs.x.dx; return(workregs.x.ax); } /* ** Similar to above but obtains information about the last release of the ** specified button. */ int ms_button_release_status(int button, int *release_count, int *column, int *row) { union REGS workregs; workregs.x.ax = 6; workregs.x.bx = button; int86(MSMOUSE,&workregs,&workregs); *release_count = workregs.x.bx; *column = workregs.x.cx; *row = workregs.x.dx; return(workregs.x.ax); } /* ** Forces the mouse cursor to remain within the range specified. */ void ms_restrict_horiz(int min, int max) { union REGS workregs; workregs.x.ax = 7; workregs.x.cx = min; workregs.x.dx = max; int86(MSMOUSE,&workregs,&workregs); } /* ** Forces the mouse cursor to remain within the range specified. */ void ms_restrict_vert(int min, int max) { union REGS workregs; workregs.x.ax = 8; workregs.x.cx = min; workregs.x.dx = max; int86(MSMOUSE,&workregs,&workregs); } void ms_define_window(int left, int top, int right, int bottom) { ms_restrict_horiz(left,right); ms_restrict_vert(top,bottom); } /* ** Allows the user to set the graphics cursor to a new shape. Check your ** mouse reference manual for full information about the use of this function. */ void ms_set_graphics_cursor(int horiz_hotspot, int vert_hotspot, unsigned seg_shape_tables, unsigned offset_shape_tables) { union REGS workregs; struct SREGS segregs; workregs.x.ax = 9; workregs.x.bx = horiz_hotspot; workregs.x.cx = vert_hotspot; workregs.x.dx = offset_shape_tables; segregs.es = seg_shape_tables; int86x(MSMOUSE,&workregs,&workregs,&segregs); } /* ** Selects either the software or hardware cursor and sets the start and stop ** scan lines (for the hardware cursor) or the screen and cursor masks (for ** the software cursor). Consult your mouse reference for more information. */ void ms_set_text_cursor(int type, int screen_mask, int cursor_mask) { union REGS workregs; workregs.x.ax = 10; workregs.x.bx = type; workregs.x.cx = screen_mask; workregs.x.dx = cursor_mask; int86(MSMOUSE,&workregs,&workregs); } /* ** Obtains the horizontal and vertical raw motion counts since the last ** request. */ void ms_read_motion_counters(int *horiz, int *vert) { union REGS workregs; workregs.x.ax = 11; int86(MSMOUSE,&workregs,&workregs); *horiz = workregs.x.cx; *vert = workregs.x.dx; } /* ** Sets up a subroutine to be called when a given event occurs. ** NOTE: Use with extreme care. The function whose address is provided MUST ** terminate with a far return (i.e. must be compiled using large model). ** Also, no DOS or BIOS services may be used, as the user-defined function ** is (in effect) an extension to an interrupt service routine. */ void ms_set_event_subroutine(int mask, unsigned seg_routine, unsigned offset_routine) { union REGS workregs; struct SREGS segregs; workregs.x.ax = 12; workregs.x.cx = mask; workregs.x.dx = offset_routine; segregs.es = seg_routine; int86x(MSMOUSE,&workregs,&workregs,&segregs); } /* ** Turns light pen emulation mode on. */ void ms_light_pen_on(void) { union REGS workregs; workregs.x.ax = 13; int86(MSMOUSE,&workregs,&workregs); } /* ** turns light pen emulation mode off. */ void ms_light_pen_off(void) { union REGS workregs; workregs.x.ax = 14; int86(MSMOUSE,&workregs,&workregs); } /* ** Sets the sensitivity of the mouse. Defaults are 8 and 16 for horizontal ** and vertical sensitivity (respectively). */ void ms_set_sensitivity(int horiz, int vert) { union REGS workregs; workregs.x.ax = 15; workregs.x.cx = horiz; workregs.x.dx = vert; int86(MSMOUSE,&workregs,&workregs); } /* ** Sets up a region of the screen inside of which the mouse cursor will ** automatically be 'hidden'. */ void ms_protect_area(int left, int top, int right, int bottom) { union REGS workregs; workregs.x.ax = 16; workregs.x.cx = left; workregs.x.dx = top; workregs.x.si = right; workregs.x.di = bottom; int86(MSMOUSE,&workregs,&workregs); } /* * Similar to ms_set_graphics_cursor() but allows a larger cursor. Consult ** your mouse documentation for information on how to use this function. */ int ms_set_large_graphics_cursor(int width, int height, int horiz_hotspot, int vert_hotspot, unsigned seg_shape_tables, unsigned offset_shape_tables) { union REGS workregs; struct SREGS segregs; workregs.x.ax = 18; workregs.x.bx = (width << 8) + horiz_hotspot; workregs.x.cx = (height << 8) + vert_hotspot; workregs.x.dx = offset_shape_tables; segregs.es = seg_shape_tables; int86x(MSMOUSE,&workregs,&workregs,&segregs); if(workregs.x.ax == -1) return(workregs.x.ax); /* Return -1 if function 18 supported */ else return(0); /* else return 0 */ } /* ** Sets the threshold value for doubling cursor motion. Default value is 64. */ void ms_set_doublespeed_threshold(int speed) { union REGS workregs; workregs.x.ax = 19; workregs.x.dx = speed; int86(MSMOUSE,&workregs,&workregs); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mouse.h����������������������������������������������0000755�0000764�0000144�00000002205�07055334111�015571� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* module: mouse.h * programmer: Ray L. McVay * started: 26oct86 * updated: 26oct86 * * Some handy mouse interface functions. */ #ifdef __TURBOC__ #define FAR far #else #define FAR _far #endif #define MSMOUSE 0x33 extern int mouse_present; int ms_reset(int *); void ms_show_cursor(void); void ms_hide_cursor(void); int ms_get_mouse_pos(int *, int *); void ms_set_mouse_pos(int, int); int ms_button_press_status(int, int *, int *, int *); int ms_button_release_status(int, int *, int *, int *); void ms_restrict_horiz(int, int); void ms_restrict_horiz(int, int); void ms_define_window(int, int, int, int); void ms_set_graphics_cursor(int, int, unsigned, unsigned); void ms_set_text_cursor(int, int, int); void ms_read_motion_counters(int *, int *); void ms_set_event_subroutine(int, unsigned, unsigned); void ms_light_pen_on(void); void ms_light_pen_off(void); void ms_set_sensitivity(int, int); void ms_protect_area(int, int, int, int); int ms_set_large_graphics_cursor(int, int, int, int, unsigned, unsigned); void ms_set_doublespeed_threshold(int); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/getseg.c���������������������������������������������0000755�0000764�0000144�00000002230�07055333777�015731� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** GETSEG.C - How to get the memory segment of an object ** ** public domain demo by Bob Stout */ #include <stdio.h> #include <dos.h> #ifdef __TURBOC__ #define FAR far #else #define FAR _far #endif #define GetSeg(obj) (unsigned)((unsigned long)(((void FAR *)(obj))) >> 16) #define GetOfs(obj) (unsigned)((unsigned long)(((void FAR *)(obj))) & 0xffff) int dummyv = 0; int dummyf(void) { return dummyv; } void main(void) { struct SREGS sregs; segread (&sregs); printf("DS = %04X, CS = %04X\n", sregs.ds, sregs.cs); #if defined(__ZTC__) printf("&dummyv = %lp, dummyf = %lp\n\n", #else printf("&dummyv = %Fp, dummyf = %Fp\n\n", #endif #if defined(__ZTC__) || defined(__TURBOC__) (int FAR *)&dummyv, (int (FAR *)())dummyf); #else /* MSC doesn't allow casting near function pointers to far */ (int FAR *)&dummyv, dummyf); #endif printf("GetSeg(dummyv) = %04X, GetSeg(dummyf) = %04X\n", GetSeg(&dummyv), GetSeg(dummyf)); printf("GetOfs(dummyv) = %04X, GetOfs(dummyf) = %04X\n", GetOfs(&dummyv), GetOfs(dummyf)); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/head.c�����������������������������������������������0000755�0000764�0000144�00000002026�07055334010�015334� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <stdio.h> #include <stdlib.h> #include <string.h> #define NUL '\000' #define BEL '\007' #define LINE_LEN 132 void give_up(char *msg) { putchar(BEL); puts(msg); exit(-1); } int main(int argc, char *argv[]) { FILE *infile; char line[LINE_LEN + 2]; /* Allow for '\n' & NUL */ int i, N = 0; if (2 > argc) give_up("Usage: HEAD file [number_of_lines]"); if (NULL == (infile = fopen(argv[1], "r"))) give_up("Unable to open input file"); if (2 < argc) N = atoi(argv[2]); if (!N) N = 4; for (i = 0; i < N; ++i) { if (NULL == fgets(line, LINE_LEN + 1, infile)) break; line[LINE_LEN + 1] = NUL; /* Allow too-long lines */ fputs(line, stdout); if (!strrchr(line, '\n')) i -= 1; /* More to read */ } fclose(infile); return EXIT_SUCCESS; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/getvol.c���������������������������������������������0000755�0000764�0000144�00000003022�07055334000�015727� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** GETVOL.C - Retrieve a disk volume label ** (proof you don't need FCBs to do it!) ** ** public domain demo by Bob Stout */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dos.h> #include <io.h> #if defined(__TURBOC__) #pragma option -a- #include <dir.h> #define _dos_findfirst(f,a,b) findfirst(f,b,a) #define _dos_findnext(b) findnext(b) #define find_t ffblk #define _A_VOLID FA_LABEL #define attrib ff_attrib #define name ff_name #else #include <direct.h> #if defined(__ZTC__) #pragma ZTC align 1 #else /* MSC/QC/WATCOM/METAWARE */ #pragma pack(1) #endif #endif #define SUCCESS 0 char *getvol(char drive) { char search[] = "A:\\*.*"; static struct find_t ff; *search = drive; if (SUCCESS == _dos_findfirst(search, _A_VOLID, &ff)) { if (8 < strlen(ff.name)) /* Eliminate period */ strcpy(&ff.name[8], &ff.name[9]); return ff.name; } else return NULL; } #ifdef TEST int main(int argc, char *argv[]) { char *label; if (2 > argc) { puts("\aUsage: GETVOL d[:]"); puts("where: d = drive letter (e.g. A, B, C, etc."); return -1; } if (NULL == (label = getvol(*argv[1]))) printf("Unable to read a label on drive %c:\n", *argv[1]); else printf("The volume label of drive %c: is \"%s\"\n", *argv[1], label); return 0; } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/Makefile.am������������������������������������������0000644�0000764�0000144�00000000747�07406406026�016337� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) $(wildcard *.h) $(wildcard *.asm) $(wildcard *.txt) \ 8087_sav.asm HEADER.html c_lines.awk except.doc file_id.diz make.ini match.doc myio.cpp \ myio.mak myiodemo.cpp myline.cpp mystream.cpp pdn.lst read.me resource.lst rg_qsort.c1 \ rg_qsort.c2 snippets._c_ snippets.ndx snippets.txt snippets.wc storage.typ str.cpp str.doc docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) �������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/Makefile.in������������������������������������������0000644�0000764�0000144�00000033024�07474405126�016347� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) $(wildcard *.h) $(wildcard *.asm) $(wildcard *.txt) \ 8087_sav.asm HEADER.html c_lines.awk except.doc file_id.diz make.ini match.doc myio.cpp \ myio.mak myiodemo.cpp myline.cpp mystream.cpp pdn.lst read.me resource.lst rg_qsort.c1 \ rg_qsort.c2 snippets._c_ snippets.ndx snippets.txt snippets.wc storage.typ str.cpp str.doc docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/CONTRIB/SNIP mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/CONTRIB/SNIP/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/SNIP/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/SNIP/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=memrev.c crc-16.c cursor.c spin.c absdisk.asm doansi_1.c do.c isramdsk.c mouse.c trim.c fmemops.c myline.h wordwrap.c cbtrap.asm mouse.h shel2dos.c tail.c prtoggle.c daynum.c ll_msort.c psplit.c video.c ansiflen.c amalloc.c fndislot.c redir.c big_mall.h eval.c scrnsave.c msb2ieee.c ansiself.c scanfrac.c truename.c tabtrick.c mkdirs.c where.c rm_all.c xtest.c isfopen.c jdn.c posixdir.c morse.c fsm.c rand1.c stats.c bitcnt_2.c getopts.c cal.c x00api.c getopts.h ferrorf.c maze_1.c clock.c x00api.h bitfiles.c vfname.c playlib.c strrepl.c treedir.c isnetdr.c enums.txt lbitops.c errfix.c factor.c hexdump.c cubic.c permute1.c ansiload.c ispow2.c getkey.c pr.c lsd.c scrnpick.c rfind1st.c stripeof.c doansi_2.c flnorm.c getcmt.c mem.c ansisys.c mem.h myio.h speed.c rmlead.c strrev.c rtlftrul.txt log.c calsupp.c dossort.c wb_fcopy.c fcompare.c bitops.c doscopy.c chgext.c fcopy.c setenvar.c bordcolr.c checkexe.c moon_age.c ifactor.c strucfil.c trapflag.asm sstrcpy.c posix_ls.c which_c.txt lsary.c unix2dos.c testcmt.c cast.h split.c flopcopy.c compiler.c doansi.h cctrap.asm prtscrn.c nonmsdos.txt killff.c ord_text.c stptok.c strdup.c chmod.c fpswitch.c jgrep.c rand2.c windchil.c msc_peek.c maze_2.c isxkbrd.c hexorint.c trapdemo.c playdemo.c ll_qsort.c tp6tod.c query.c bigfac.c commafmt.c cant.c mdalloc.c glbl_env.c permute2.c dirmask.c pbmsrch.c bastrngs.c rg_isort.c pluraltx.c break.c str27seg.c scaldate.c kbflip.c scaldate.h eng.c uuencode.c isshare.c lv1ws.c bmhisrch.c biport.c filcount.c drivsrch.c changprn.c biport.h roman.c bmhsrch.c combin.c mcb_env.c ctrlprnt.c pi.c pi.h sunriset.c toascii.c approx.c fscanbin.c rdxcnvrt.c ccomcall.c portable.h fln_fix.c os_id.c ext_keys.c getvol.c isqrt.c bitarray.c os_id.h ext_keys.h evsavres.txt w_wrap.c dosfuncs.txt w_wrap.h a2e.c environ.txt setimeto.c bascnvrt.c maze_3.c keywatch.c scroll.c tasker.c hires.asm ldfloor.c tasker.h patmat.c droptime.c match.c format.c checksum.c srchfile.c round.h missing.txt match.h crc-16f.c hstr_i.c ftime.c strupr.c head.c ftime.h style.c assignpr.c strftime.c cursize.c weird.c toolkit.h fsize.c kb_data.c hilobyte.h bincomp.c todaybak.c ptr_help.txt keylocks.c ltostr.c hugesort.c dspdtst.c isisbn.c ndpcheck.asm rg_ssort.c ansiscrn.h perm_idx.c cmdline.c absdiskc.c setvol.c getdcwd.c ltoa.c dblround.c files.c vt100.txt favail.c cpucheck.asm factoryl.c remtab.c joystick.c pfopen.c uudecode.c iostutor.txt mainmain.c pcnvrt.c addhndls.c vidport.c uclock.c dbl2long.c xstrcmp.c c_prec.txt crc_32.c str.h grep.c uclock.h hugeread.c faskbhit.c commconv.c timegetc.c prtstat.c getopt3.c translat.c fraction.c cerrinst.asm rmallws.c strsort.c bitstrng.c touch.c inchcvrt.c chbytes.c xfile.c memavail.c c_cmnt.c mterm.c coldboot.asm xfile.h getseg.c howdy.c center.c pmerge.c initvars.c pushdir.c isshift.c mystream.h bmhasrch.c mv.c stub.c scrnmacs.h strecpy.asm bresnham.c strat.c addpath.c strat.h vio.h lzhuf.c grafline.c editgets.c getstrng.c mktone.c iswprot.c cerrtrap.asm atr2ansi.c noreset.c vio.asm palndrom.c ansisys.txt sound.c prnspool.c rg_rand.c sound.h c_port.txt dspclock.c prnspool.h mem.txt sharing.txt whicharc.c crypt.c xstrcat.c reboot.c dd_struc.h 2dlife.c bitcnt_1.c tasker.txt fmtmoney.c rmtrail.c dos5boot.h wc.c cdir.c noctrlc.c iscons.c dirent.h drvs.c printq.c soundex.c bstr_i.c drvalid.c int2e.asm rndmize.c DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/SNIP/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/SNIP/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/iscons.c���������������������������������������������0000755�0000764�0000144�00000001510�07055334023�015732� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** iscons() ** ** A function to determine if a specified stream refers to the console. ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is hereby donated to the public domain. */ #include <stdio.h> #include <dos.h> #define BOOL(x) (!(!(x))) int iscons(FILE *fp) { union REGS regs; regs.x.ax = 0x4400; regs.x.bx = (unsigned)fileno(fp); intdos(®s, ®s); if (0 == (regs.x.ax & 0x80)) return 0; return BOOL(regs.x.ax & 0x13); } #ifdef TEST int main(void) { fprintf(stderr, "stdin is%s redirected\n", iscons(stdin) ? " not" : ""); fprintf(stderr, "stdout is%s redirected\n", iscons(stdout) ? " not" : ""); } #endif /* TEST */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/grep.c�����������������������������������������������0000755�0000764�0000144�00000037066�07055334010�015404� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * The information in this document is subject to change * without notice and should not be construed as a commitment * by Digital Equipment Corporation or by DECUS. * * Neither Digital Equipment Corporation, DECUS, nor the authors * assume any responsibility for the use or reliability of this * document or the described software. * * Copyright (C) 1980, DECUS * * General permission to copy or modify, but not for profit, is * hereby granted, provided that the above copyright notice is * included and reference made to the fact that reproduction * privileges were granted by DECUS. */ #include <stdio.h> /* * grep * * Runs on the Decus compiler or on vms, On vms, define as: * grep :== "$disk:[account]grep" (native) * grep :== "$disk:[account]grep grep" (Decus) * See below for more information. */ char *documentation[] = { "grep searches a file for a given pattern. Execute by", " grep [flags] regular_expression file_list\n", "Flags are single characters preceeded by '-':", " -c Only a count of matching lines is printed", " -f Print file name for matching lines switch, see below", " -n Each line is preceeded by its line number", " -v Only print non-matching lines\n", "The file_list is a list of files (wildcards are acceptable on RSX modes).", "\nThe file name is normally printed if there is a file given.", "The -f flag reverses this action (print name no file, not if more).\n", 0 }; char *patdoc[] = { "The regular_expression defines the pattern to search for. Upper- and", "lower-case are always ignored. Blank lines never match. The expression", "should be quoted to prevent file-name translation.", "x An ordinary character (not mentioned below) matches that character.", "'\\' The backslash quotes any character. \"\\$\" matches a dollar-sign.", "'^' A circumflex at the beginning of an expression matches the", " beginning of a line.", "'$' A dollar-sign at the end of an expression matches the end of a line.", "'.' A period matches any character except \"new-line\".", "':a' A colon matches a class of characters described by the following", "':d' character. \":a\" matches any alphabetic, \":d\" matches digits,", "':n' \":n\" matches alphanumerics, \": \" matches spaces, tabs, and", "': ' other control characters, such as new-line.", "'*' An expression followed by an asterisk matches zero or more", " occurrances of that expression: \"fo*\" matches \"f\", \"fo\"", " \"foo\", etc.", "'+' An expression followed by a plus sign matches one or more", " occurrances of that expression: \"fo+\" matches \"fo\", etc.", "'-' An expression followed by a minus sign optionally matches", " the expression.", "'[]' A string enclosed in square brackets matches any character in", " that string, but no others. If the first character in the", " string is a circumflex, the expression matches any character", " except \"new-line\" and the characters in the string. For", " example, \"[xyz]\" matches \"xx\" and \"zyx\", while \"[^xyz]\"", " matches \"abc\" but not \"axb\". A range of characters may be", " specified by two characters separated by \"-\". Note that,", " [a-z] matches alphabetics, while [z-a] never matches.", "The concatenation of regular expressions is a regular expression.", 0}; #define LMAX 512 #define PMAX 256 #define CHAR 1 #define BOL 2 #define EOL 3 #define ANY 4 #define CLASS 5 #define NCLASS 6 #define STAR 7 #define PLUS 8 #define MINUS 9 #define ALPHA 10 #define DIGIT 11 #define NALPHA 12 #define PUNCT 13 #define RANGE 14 #define ENDPAT 15 int cflag=0, fflag=0, nflag=0, vflag=0, nfile=0, debug=0; char *pp, lbuf[LMAX], pbuf[PMAX]; extern char *cclass(), *pmatch(); /*** Main program - parse arguments & grep *************/ main(argc, argv) int argc; char *argv[]; { register char *p; register int c, i; int gotpattern; FILE *f; if (argc <= 1) usage("No arguments"); if (argc == 2 && argv[1][0] == '?' && argv[1][1] == 0) { help(documentation); help(patdoc); return; } nfile = argc-1; gotpattern = 0; for (i=1; i < argc; ++i) { p = argv[i]; if (*p == '-') { ++p; while (c = *p++) { switch(tolower(c)) { case '?': help(documentation); break; case 'C': case 'c': ++cflag; break; case 'D': case 'd': ++debug; break; case 'F': case 'f': ++fflag; break; case 'n': case 'N': ++nflag; break; case 'v': case 'V': ++vflag; break; default: usage("Unknown flag"); } } argv[i] = 0; --nfile; } else if (!gotpattern) { compile(p); argv[i] = 0; ++gotpattern; --nfile; } } if (!gotpattern) usage("No pattern"); if (nfile == 0) grep(stdin, 0); else { fflag = fflag ^ (nfile > 0); for (i=1; i < argc; ++i) { if (p = argv[i]) { if ((f=fopen(p, "r")) == NULL) cant(p); else { grep(f, p); fclose(f); } } } } } /*** Display a file name *******************************/ file(s) char *s; { printf("File %s:\n", s); } /*** Report unopenable file ****************************/ cant(s) char *s; { fprintf(stderr, "%s: cannot open\n", s); } /*** Give good help ************************************/ help(hp) char **hp; { register char **dp; for (dp = hp; *dp; ++dp) printf("%s\n", *dp); } /*** Display usage summary *****************************/ usage(s) char *s; { fprintf(stderr, "?GREP-E-%s\n", s); fprintf(stderr, "Usage: grep [-cfnv] pattern [file ...]. grep ? for help\n"); exit(1); } /*** Compile the pattern into global pbuf[] ************/ compile(source) char *source; /* Pattern to compile */ { register char *s; /* Source string pointer */ register char *lp; /* Last pattern pointer */ register int c; /* Current character */ int o; /* Temp */ char *spp; /* Save beginning of pattern */ s = source; if (debug) printf("Pattern = \"%s\"\n", s); pp = pbuf; while (c = *s++) { /* * STAR, PLUS and MINUS are special. */ if (c == '*' || c == '+' || c == '-') { if (pp == pbuf || (o=pp[-1]) == BOL || o == EOL || o == STAR || o == PLUS || o == MINUS) badpat("Illegal occurrance op.", source, s); store(ENDPAT); store(ENDPAT); spp = pp; /* Save pattern end */ while (--pp > lp) /* Move pattern down */ *pp = pp[-1]; /* one byte */ *pp = (c == '*') ? STAR : (c == '-') ? MINUS : PLUS; pp = spp; /* Restore pattern end */ continue; } /* * All the rest. */ lp = pp; /* Remember start */ switch(c) { case '^': store(BOL); break; case '$': store(EOL); break; case '.': store(ANY); break; case '[': s = cclass(source, s); break; case ':': if (*s) { switch(tolower(c = *s++)) { case 'a': case 'A': store(ALPHA); break; case 'd': case 'D': store(DIGIT); break; case 'n': case 'N': store(NALPHA); break; case ' ': store(PUNCT); break; default: badpat("Unknown : type", source, s); } break; } else badpat("No : type", source, s); case '\\': if (*s) c = *s++; default: store(CHAR); store(tolower(c)); } } store(ENDPAT); store(0); /* Terminate string */ if (debug) { for (lp = pbuf; lp < pp;) { if ((c = (*lp++ & 0377)) < ' ') printf("\\%o ", c); else printf("%c ", c); } printf("\n"); } } /*** Compile a class (within []) ***********************/ char *cclass(source, src) char *source; /* Pattern start -- for error msg. */ char *src; /* Class start */ { register char *s; /* Source pointer */ register char *cp; /* Pattern start */ register int c; /* Current character */ int o; /* Temp */ s = src; o = CLASS; if (*s == '^') { ++s; o = NCLASS; } store(o); cp = pp; store(0); /* Byte count */ while ((c = *s++) && c!=']') { if (c == '\\') { /* Store quoted char */ if ((c = *s++) == '\0') /* Gotta get something */ badpat("Class terminates badly", source, s); else store(tolower(c)); } else if (c == '-' && (pp - cp) > 1 && *s != ']' && *s != '\0') { c = pp[-1]; /* Range start */ pp[-1] = RANGE; /* Range signal */ store(c); /* Re-store start */ c = *s++; /* Get end char and*/ store(tolower(c)); /* Store it */ } else { store(tolower(c)); /* Store normal char */ } } if (c != ']') badpat("Unterminated class", source, s); if ((c = (pp - cp)) >= 256) badpat("Class too large", source, s); if (c == 0) badpat("Empty class", source, s); *cp = c; return(s); } /*** Store an entry in the pattern buffer **************/ store(op) int op; { if (pp >= &pbuf[PMAX]) error("Pattern too complex\n"); *pp++ = op; } /*** Report a bad pattern specification ****************/ badpat(message, source, stop) char *message; /* Error message */ char *source; /* Pattern start */ char *stop; /* Pattern end */ { fprintf(stderr, "-GREP-E-%s, pattern is\"%s\"\n", message, source); fprintf(stderr, "-GREP-E-Stopped at byte %d, '%c'\n", stop-source, stop[-1]); error("?GREP-E-Bad pattern\n"); } /*** Scan the file for the pattern in pbuf[] ***********/ grep(fp, fn) FILE *fp; /* File to process */ char *fn; /* File name (for -f option) */ { register int lno, count, m; lno = 0; count = 0; while (fgets(lbuf, LMAX, fp)) { ++lno; m = match(); if ((m && !vflag) || (!m && vflag)) { ++count; if (!cflag) { if (fflag && fn) { file(fn); fn = 0; } if (nflag) printf("%d\t", lno); printf("%s\n", lbuf); } } } if (cflag) { if (fflag && fn) file(fn); printf("%d\n", count); } } /*** Match line (lbuf) with pattern (pbuf) return 1 if match ***/ match() { register char *l; /* Line pointer */ for (l = lbuf; *l; ++l) { if (pmatch(l, pbuf)) return(1); } return(0); } /*** Match partial line with pattern *******************/ char *pmatch(line, pattern) char *line; /* (partial) line to match */ char *pattern; /* (partial) pattern to match */ { register char *l; /* Current line pointer */ register char *p; /* Current pattern pointer */ register char c; /* Current character */ char *e; /* End for STAR and PLUS match */ int op; /* Pattern operation */ int n; /* Class counter */ char *are; /* Start of STAR match */ l = line; if (debug > 1) printf("pmatch(\"%s\")\n", line); p = pattern; while ((op = *p++) != ENDPAT) { if (debug > 1) printf("byte[%d] = 0%o, '%c', op = 0%o\n", l-line, *l, *l, op); switch(op) { case CHAR: if (tolower(*l++) != *p++) return(0); break; case BOL: if (l != lbuf) return(0); break; case EOL: if (*l != '\0') return(0); break; case ANY: if (*l++ == '\0') return(0); break; case DIGIT: if ((c = *l++) < '0' || (c > '9')) return(0); break; case ALPHA: c = tolower(*l++); if (c < 'a' || c > 'z') return(0); break; case NALPHA: c = tolower(*l++); if (c >= 'a' && c <= 'z') break; else if (c < '0' || c > '9') return(0); break; case PUNCT: c = *l++; if (c == 0 || c > ' ') return(0); break; case CLASS: case NCLASS: c = tolower(*l++); n = *p++ & 0377; do { if (*p == RANGE) { p += 3; n -= 2; if (c >= p[-2] && c <= p[-1]) break; } else if (c == *p++) break; } while (--n > 1); if ((op == CLASS) == (n <= 1)) return(0); if (op == CLASS) p += n - 2; break; case MINUS: e = pmatch(l, p); /* Look for a match */ while (*p++ != ENDPAT); /* Skip over pattern */ if (e) /* Got a match? */ l = e; /* Yes, update string */ break; /* Always succeeds */ case PLUS: /* One or more ... */ if ((l = pmatch(l, p)) == 0) return(0); /* Gotta have a match */ case STAR: /* Zero or more ... */ are = l; /* Remember line start */ while (*l && (e = pmatch(l, p))) l = e; /* Get longest match */ while (*p++ != ENDPAT); /* Skip over pattern */ while (l >= are) { /* Try to match rest */ if (e = pmatch(l, p)) return(e); --l; /* Nope, try earlier */ } return(0); /* Nothing else worked */ default: printf("Bad op code %d\n", op); error("Cannot happen -- match\n"); } } return(l); } /*** Report an error ***********************************/ error(s) char *s; { fprintf(stderr, "%s", s); exit(1); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/except.doc�������������������������������������������0000755�0000764�0000144�00000021353�07055333752�016266� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������USER-GENERATED EXCEPTIONS IN GENERAL ------------------------------------ MS-DOS users can generate exceptions by means of two separate mechanisms, Ctrl-C and Ctrl-Break. Although these are often treated the same, they are actually handled in subtly different manners. The difference in the way these are processed allows a great deal of flexibility in allowing users to interrupt an executing program. When a program is executed, the Ctrl-C Interrupt 23h is set up to point to a default error handler. This handler is called whenever a Ctrl-C character is detected in the keyboard input buffer. When a program terminates in any way, MS-DOS resets the Interrupt 23h vector to its default state. Note that the Ctrl-C character in the input buffer is only recognized - and an Interrupt 23h generated - when retrieving characters from the buffer and if BREAK ON is set. The Ctrl-Break Interrupt 1Bh works somewhat differently, though usually in concert with Interrupt 23h. Whenever the ROM BIOS detects the Ctrl-Break key combination, the keyboard buffer is flushed and a Ctrl-C key combination is stuffed in place of the previous contents. This Ctrl-C will later be detected and processed by Interrupt 23h. Ctrl-Break processing therefore offers more immediate response than Ctrl-C processing if the default action is overridden. Several caveats are in order here, however. First is the fact that, unlike Interrupt 23h, MS-DOS does not restore the default state of Interrupt 1Bh upon program termination. Second is that while Ctrl-C processing is standardized among the various machines utilizing both MS-DOS and PC-DOS, Ctrl-Break processing is much less standardized. Finally, since processing either ultimately relies on trapping Ctrl-C, either may be ignored for a long period because of the way that Ctrl-C is detected. HANDLING USER-GENERATED EXCEPTIONS ---------------------------------- DOS's default Ctrl-C handler is triggered whenever the Ctrl-C character is detected in the input buffer. DOS's response is to simply close all files which were opened using handle functions and to terminate the program. The limitations of this approach and the desirability of providing your own exception processing is obvious. An equally obvious solution to the default Ctrl-C handler's problems is to explicitly do your own Ctrl-C exception processing. CCTRAP.ASM installs and de-installs you own customized exception handler. Note that the code is written to accept the address of a function specified with an explicit segment and offset. Also note that an explicit de-installation function is provided despite the fact that DOS restores the default Int 23h vector upon program termination. The reason this is provided is that you should always de-install a Ctrl-C interrupt trap before you spawn a child process. Within your program, if you need to spawn such a process through any mechanism other than spawning a subordinate shell (more on this in a second), you should explicitly de-install your interrupt handlers and re-install them when the subordinate process returns. As noted, this is unnecessary when the subordinate process is a DOS shell such as COMMAND.COM, since the shell will reset the interrupts to their defaults during execution. Ctrl-Break processing is much more problematical, though potentially more powerful. The first problem to deal with is how to assure that the default Int 1Bh Ctrl-Break handler will be restored upon program termination. The de-installation function therefore becomes mandatory in this context rather than optional as in the case of the Int 23h handler. CBTRAP.ASM shows a sample Ctrl-Break handler. Since Ctrl-Break processing is much less standardized than Ctrl-C processing, the safest way to deal with it is to simply set a flag, "cbrcvd", which informs your program that a Ctrl-Break has been received. Your program may then poll this flag and take appropriate actions at "safe" times within your program. WHERE THE CARET-C COMES FROM ---------------------------- There's still nothing new here and nothing to prevent the ugly "^C" being printed to the screen. This is because it is actually printed by the BIOS during Int 9 processing, long before DOS ever sees it. What this means is that even though the code in CCTRAP.ASM and CBTRAP.ASM is fine, it still only provides a framework for solving our problem. TRAPFLAG.ASM is the final trick to banish the "^C". The actual ISR has to muck around quite a bit with the keyboard hardware, as is to be expected of an Int 09h replacement. Whenever a Ctrl-C or Ctrl- Break is detected, it is trapped, and our exception handler called in place of the original Int 09h handler, after discarding the trapped key codes. Referring to TRAPFLAG.ASM, note that since I need to trap both Ctrl-C and Ctrl-Break, I adopt the flag approach introduced in CBTRAP.ASM for dealing with both Ctrl-C and Ctrl-Break processing. Now, rather than supplying an explicit exception vector, I merely set a global flag to inform me if either exception has occurred and accept the responsibility of processing the exceptions within the body of my program. I've added an extra bit of versatility here by posting different non-zero values to the flag, "ccrcvd" depending on whether the exception was a Ctrl-C or Ctrl-Break. TRAPDEMO.C is a short C program demonstrating the use of the combined Ctrl-C/Ctrl-Break handler. Using this approach, your carefully crafted screens need never more be cluttered with the "^C" uglies. SYSTEM-GENERATED EXCEPTIONS --------------------------- It's usually desirable, in any professional-looking program, to explicitly trap the Int 24h critical error interrupt to process system-generated exceptions. CERRINST.ASM is a portable critical error handler installation program functionally equivalent to the [_]hardxxx() package in Borland C++ and Microsoft C++ compilers, and the ceror_xxx() package in Zortech C++. It's obvious that writing code to intercept DOS critical error exceptions is just as simple as intercepting Ctrl-C or Ctrl-Break exceptions. The real challenge in writing critical error handlers is in interpretation of the nature of the exception. The critical error handler requires more information in order to decide what action to take than does a Ctrl-C handler. All of this information is passed in the CPU's registers. Just like a typical compiler vendor's critical error handler, CERRINST.ASM will simply pass these registers and leave their interpretation to you. In CERRINST.ASM, the information required for intelligent critical error processing is posted in 4 global variables, cedevdvr, cetype, ceerror, and cereturn. Next you need to determine what your program requires of a critical error handler. CERRTRAP.ASM is a skeletal, yet robust critical error function which may be called from the handler in CERRINST.ASM. CERRTRAP.ASM assumes you have set up the following specific error handlers in the global variables provided: FAT error (*FAT_err)(); Disk read error (*read_err)() Disk write error (*write_err)() Terminal error (*term_err)(), Printer out of paper (*no_paper)(), All other errors (*fixup_ret)(), In the case of an unrecognized error, fixup_ret() is called. A simple skeleton for this function would be: #include <dos.h> /* for _osmajor */ extern int exerr; /* DOS extended error posted by CERRTRAP.ASM */ extern int rmvbl; /* removable media flag posted by CERRTRAP.ASM */ extern int locus; /* extened error locus posted by CERRTRAP.ASM */ extern int class; /* extened error class posted by CERRTRAP.ASM */ extern int suggest; /* suggested action posted by CERRTRAP.ASM */ int fixup_ret(void) { if (2 < _osmajor) { /* analyze DOS extended error information */ return appropriate_error_code; } /* cleanup */ return 2; /* abort */ } In customing your specific critical error handler functions, there are several important restrictions to keep in mind. The first is that no DOS system services may be requested other than Interrupt 21h functions 01h-0Ch (character I/O), 30h (get DOS version number), and 59h (get extended error information). All registers except AL must be preserved since DOS sets them up for processing Retry returns prior to invoking the critical error interrupt. Finally, the handler must return with an IRET instruction, passing a return code in AL to tell DOS what to do next. The available codes and their actions under various DOS versions are: 0 - Ignore 1 - Retry 2 - Abort 3 - Fail (DOS 3.3 and later) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/vt100.txt��������������������������������������������0000755�0000764�0000144�00000022433�07055334330�015713� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # VT100 Escape Codes # symbology: # ^[ = escape character (ascii 27 decimal) # <v> = single or double digit number. Vertical coordinate # <h> = single or double digit number. Horizontal coordinate # <n> = single or double digit number. Number of chars/lines # others = single characters just as they appear. # # NOTE: Many sequences have "^[[" which is two chars: "escape" and "[". # Name Description Esc Code -------------------- ------------------------------------- ----------- setnl LMN Set new line mode ^[[20h setappl DECCKM Set cursor key to application ^[[?1h setansi DECANM Set ANSI (versus VT52) none setcol DECCOLM Set number of columns to 132 ^[[?3h setsmooth DECSCLM Set smooth scrolling ^[[?4h setrevscrn DECSCNM Set reverse video on screen ^[[?5h setorgrel DECOM Set origin to relative ^[[?6h setwrap DECAWM Set auto-wrap mode ^[[?7h setrep DECARM Set auto-repeat mode ^[[?8h setinter DECINLM Set interlacing mode ^[[?9h setlf LMN Set line feed mode ^[[20l setcursor DECCKM Set cursor key to cursor ^[[?1l setvt52 DECANM Set VT52 (versus ANSI) ^[[?2l resetcol DECCOLM Set number of columns to 80 ^[[?3l setjump DECSCLM Set jump scrolling ^[[?4l setnormscrn DECSCNM Set normal video on screen ^[[?5l setorgabs DECOM Set origin to absolute ^[[?6l resetwrap DECAWM Reset auto-wrap mode ^[[?7l resetrep DECARM Reset auto-repeat mode ^[[?8l resetinter DECINLM Reset interlacing mode ^[[?9l altkeypad DECKPAM Set alternate keypad mode ^[= numkeypad DECKPNM Set numeric keypad mode ^[> setukg0 Set United Kingdom G0 character set ^[(A setukg1 Set United Kingdom G1 character set ^[)A setusg0 Set United States G0 character set ^[(B setusg1 Set United States G1 character set ^[)B setspecg0 Set G0 special chars. & line set ^[(0 setspecg1 Set G1 special chars. & line set ^[)0 setaltg0 Set G0 alternate character ROM ^[(1 setaltg1 Set G1 alternate character ROM ^[)1 setaltspecg0 Set G0 alt char ROM and spec. graphics ^[(2 setaltspecg1 Set G1 alt char ROM and spec. graphics ^[)2 setss2 SS2 Set single shift 2 ^[N setss3 SS3 Set single shift 3 ^[O modesoff SGR0 Turn off character attributes ^[[m modesoff SGR0 Turn off character attributes ^[[0m bold SGR1 Turn bold mode on ^[[1m lowint SGR2 Turn low intensity mode on ^[[2m underline SGR4 Turn underline mode on ^[[4m blink SGR5 Turn blinking mode on ^[[5m reverse SGR7 Turn reverse video on ^[[7m invisible SGR8 Turn invisible text mode on ^[[8m setwin DECSTBM Set top and bottom line#s of a window ^[[<v>;<v>r cursorup(n) CUU Move cursor up n lines ^[[<n>A cursordn(n) CUD Move cursor down n lines ^[[<n>B cursorrt(n) CUF Move cursor right n lines ^[[<n>C cursorlf(n) CUB Move cursor left n lines ^[[<n>D cursorhome Move cursor to upper left corner ^[[H cursorhome Move cursor to upper left corner ^[[;H cursorpos(v,h) CUP Move cursor to screen location v,h ^[[<v>;<h>H hvhome Move cursor to upper left corner ^[[f hvhome Move cursor to upper left corner ^[[;f hvpos(v,h) CUP Move cursor to screen location v,h ^[[<v>;<h>f index IND Move/scroll window up one line ^[D revindex RI Move/scroll window down one line ^[M nextline NEL Move to next line ^[E savecursor DECSC Save cursor position and attributes ^[7 restorecursor DECSC Restore cursor position and attributes ^[8 tabset HTS Set a tab at the current column ^[H tabclr TBC Clear a tab at the current column ^[[g tabclr TBC Clear a tab at the current column ^[[0g tabclrall TBC Clear all tabs ^[[3g dhtop DECDHL Double-height letters, top half ^[#3 dhbot DECDHL Double-height letters, bottom half ^[#4 swsh DECSWL Single width, single height letters ^[#5 dwsh DECDWL Double width, single height letters ^[#6 cleareol EL0 Clear line from cursor right ^[[K cleareol EL0 Clear line from cursor right ^[[0K clearbol EL1 Clear line from cursor left ^[[1K clearline EL2 Clear entire line ^[[2K cleareos ED0 Clear screen from cursor down ^[[J cleareos ED0 Clear screen from cursor down ^[[0J clearbos ED1 Clear screen from cursor up ^[[1J clearscreen ED2 Clear entire screen ^[[2J devstat DSR Device status report ^[5n termok DSR Response: terminal is OK ^[0n termnok DSR Response: terminal is not OK ^[3n getcursor DSR Get cursor position ^[6n cursorpos CPR Response: cursor is at v,h ^[<v>;<h>R ident DA Identify what terminal type ^[[c ident DA Identify what terminal type (another) ^[[0c gettype DA Response: terminal type code n ^[[?1;<n>0c reset RIS Reset terminal to initial state ^[c align DECALN Screen alignment display ^[#8 testpu DECTST Confidence power up test ^[[2;1y testlb DECTST Confidence loopback test ^[[2;2y testpurep DECTST Repeat power up test ^[[2;9y testlbrep DECTST Repeat loopback test ^[[2;10y ledsoff DECLL0 Turn off all four leds ^[[0q led1 DECLL1 Turn on LED #1 ^[[1q led2 DECLL2 Turn on LED #2 ^[[2q led3 DECLL3 Turn on LED #3 ^[[3q led4 DECLL4 Turn on LED #4 ^[[4q # # All codes below are for use in VT52 compatibility mode. # setansi Enter/exit ANSI mode (VT52) ^[< altkeypad Enter alternate keypad mode ^[= numkeypad Exit alternate keypad mode ^[> setgr Use special graphics character set ^[F resetgr Use normal US/UK character set ^[G cursorup Move cursor up one line ^[A cursordn Move cursor down one line ^[B cursorrt Move cursor right one char ^[C cursorlf Move cursor left one char ^[D cursorhome Move cursor to upper left corner ^[H cursorpos(v,h) Move cursor to v,h location ^[<v><h> revindex Generate a reverse line-feed ^[I cleareol Erase to end of current line ^[K cleareos Erase to end of screen ^[J ident Identify what the terminal is ^[Z identresp Correct response to ident ^[/Z #======================================================================= # # VT100 Special Key Codes # # These are sent from the terminal back to the computer when the # particular key is pressed. Note that the numeric keypad keys # send different codes in numeric mode than in alternate mode. # See escape codes above to change keypad mode. # # Function Keys: PF1 ^[OP PF2 ^[OQ PF3 ^[OR PF4 ^[OS # Arrow Keys: Reset Set ----- --- up ^[A ^[OA down ^[B ^[OB right ^[C ^[OC left ^[D ^[OD # Numeric Keypad Keys: Keypad Mode ----------------- Keypad Key Numeric Alternate ---------- ------- --------- 0 0 ^[Op 1 1 ^[Oq 2 2 ^[Or 3 3 ^[Os 4 4 ^[Ot 5 5 ^[Ou 6 6 ^[Ov 7 7 ^[Ow 8 8 ^[Ox 9 9 ^[Oy - (minus) - ^[Om , (comma) , ^[Ol . (period) . ^[On ENTER ^M ^[OM �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/fmemops.c��������������������������������������������0000755�0000764�0000144�00000002344�07055333763�016122� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** FMEMOPS.C - Emulate MSC's far memory functions in BC++ & ZTC++ ** ** Original Copyright 1988-1992 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is hereby donated to the public domain. */ #include <stdlib.h> #include <string.h> #include <dos.h> #if defined(__TURBOC__) || defined(__ZTC__) #ifdef __TURBOC__ #define FAR far #else #define FAR _far #endif typedef unsigned char FAR *FarBytePtr; void FAR * _fmemcpy(void FAR *dest, void FAR *src, size_t count) { movedata(FP_SEG(src), FP_OFF(src), FP_SEG(dest), FP_OFF(dest), count); return dest; } void FAR * _fmemmove(void FAR *dest, void FAR *src, size_t count) { void FAR *target = dest; FarBytePtr to = (FarBytePtr)dest, from = (FarBytePtr)src; if (src >= dest) _fmemcpy(dest, src, count); else for (to += count, from += count; count; --count) *--to = *--from; return target; } void FAR * _fmemset(void FAR *dest, int ch, size_t count) { void FAR *target = dest; FarBytePtr to = (FarBytePtr)dest; for ( ; count; --count) *to++ = (unsigned char) ch; return target; } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/fsize.c����������������������������������������������0000755�0000764�0000144�00000003636�07055333770�015577� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** FSIZE.C - Determine apparent file size of buffered file. Returns size ** corrected for text mode character translation. ** ** public domain demo by Bob Stout */ #include <stdio.h> #include <stdlib.h> long fsize(FILE *fp) { size_t bufsize, bytes_read; char *bufptr; long size = 0L, pos; for (bufsize = 0x8000; NULL == (bufptr = malloc(bufsize)); bufsize /= 2) ; if (!bufptr) return -1L; pos = ftell(fp); do { bytes_read = fread(bufptr, sizeof(char), bufsize, fp); size += bytes_read; } while (bytes_read); free(bufptr); fseek(fp, pos, SEEK_SET); return size; } #ifdef TEST #include <string.h> #ifdef MSDOS #define fl(x) filelength(x) #define getsize(fp) fl(fileno(fp)) #else #define fl(x) puts("Install compiler-specific file length function here") #define getsize(fp) fl(fp) #endif int main(int argc, char *argv[]) { FILE *fp; long size, csize, lsize; char buf[256]; while (--argc) { if (NULL == (fp = fopen(*++argv, "r"))) printf("Can't open %s\n", *argv); size = getsize(fp); printf("\n\"Real\" size of %s is %ld\n", *argv, size); for (csize = 0L; EOF != fgetc(fp); ++csize) ; rewind(fp); for (lsize = 0L; !feof(fp); ) { if (NULL != fgets(buf, 256, fp)) lsize += strlen(buf); } rewind(fp); printf("fsize() returned a size = %s is %ld\n", *argv, fsize(fp)); printf("Reading chars returned an apparent size of %ld\n", csize); printf("Reading lines returned an apparent size of %ld\n", lsize); } } #endif ��������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/touch.c����������������������������������������������0000755�0000764�0000144�00000003673�07055334306�015576� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*----------------------------------------------------------------------* * Program: touch * * Programmer: Ray L. McVay * * Started: 8 Aug 91 * * Updated: 13 Feb 93 Thad Smith * * Updated: 15 Feb 93 Bob Stout * *-----------------------------------------------------------------------* * Simple touch program to test BC time stamping function. * * Public Domain * *----------------------------------------------------------------------*/ #include <stdio.h> #include <stdlib.h> #include <time.h> #ifdef __TURBOC__ #include <dos.h> #include <io.h> #else #include "ftime.h" /* Borland work-alike in SNIPPETS */ #endif void usage(void); main(int argc, char **argv) { time_t tnow; struct tm tmnow; struct ftime ft; FILE *f; if (argc < 2) usage(); tnow = time(NULL); tmnow = *localtime(&tnow); ft.ft_year = tmnow.tm_year - 80; ft.ft_month = tmnow.tm_mon + 1; ft.ft_day = tmnow.tm_mday; ft.ft_hour = tmnow.tm_hour; ft.ft_min = tmnow.tm_min; ft.ft_tsec = tmnow.tm_sec/2; if ((f = fopen(argv[1], "r+b")) != NULL) setftime(fileno(f), &ft); else if ((f = fopen(argv[1], "w")) != NULL) setftime(fileno(f), &ft); else perror("Can't open file"); if (f) fclose(f); return EXIT_SUCCESS; } void usage(void) { puts("Usage: TOUCH filename\n"); puts(" The timestamp of filename will be set to the current time."); puts(" A zero-length file will be created if the file doesn't exist."); exit(EXIT_FAILURE); } ���������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mdalloc.c��������������������������������������������0000755�0000764�0000144�00000012552�07055334071�016062� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Written by Blair Haukedal 91/09 and placed in the public domain */ /* mdalloc - a multi dimensional array allocator * mdfree - a companion function to mdalloc for freeing storage * synopsis: * void *mdalloc(int ndim, int width, ...); * where: ndim: number of array dimensions * width: size of elements in array * variable args are dimensions of array * returns: n-way indirect pointer to allocated storage * or NULL if insufficient storage * * void mdfree(void *p, ndim); * where: p: pointer to storage obtained by mdalloc * ndim: number of dimensions used in mdalloc * * example: * int ***tip; * tip = mdalloc(3, sizeof(int), 2, 3, 4); * tip will be a triple indirect pointer to a 3 dimensional array * tip[0][0][0] refers to the first int in a contiguous area of * storage that is 2*3*4*sizeof(int) bytes long * tip[0][0] is the address of the first int * memset can be used to initialize array elements as follows: * memset(tip[0][0], 0, 2*3*4*sizeof(int)); * mdfree is used to free storage obtained with mdalloc: * mdfree(tip, 3) * * notes: * - must be compiled with appropriate memory model * - memory is allocated for each dimension for indirect pointers * eg. 3x4x5 array of longs * (assuming 4 byte longs, small mem model) * p = mdalloc(3, sizeof(long), 3, 4, 5) - bytes * 3 pointers allocated for 1st dimension - 6 * 3x4 pointers allocated for 2nd dimension - 24 * 3x4x5 longs allocated for array elements - 240 * total of 270 bytes allocated * - if insufficient memory, nothing will be allocated. * ie. intermediate pointer arrays that were successfully * allocated will be freed. * - the intent of mdalloc is to facilitate dynamic array creation, * it will use more memory than statically declared arrays, and * the required dereferencing will be slower than the use of * statically declared arrays. * - this function assumes that sizeof(char) == 1. */ #include <stdarg.h> #include <stdlib.h> static void **md2(int n_units, int ndim, int *dims); static void md3(char ***tip, int n_units, int ndim, int *dims); static int w_units; /* mdalloc: entry point for mdalloc function described above * - reduces variable arg list to fixed list with last arg * represented as pointer to int (array dimensions). * Calls md2 to allocate storage. * Calls md3 to initialize intermediate pointers. * Returns pointer. */ void *mdalloc(int ndim, int width, ...) { va_list argp; int *dims, i; char ***tip; va_start(argp, width); /* allocate storage for variable args (dimensions) */ dims = malloc(ndim*sizeof(int)); if(dims == NULL) return NULL; /* initialize dimensions array for subsequent calls */ for(i=0; i<ndim; i++) dims[i] = va_arg(argp,int); w_units = width; /* global used by md2 and md3 */ /* allocate required pointer and array element storage */ tip = (char ***)md2(dims[0], ndim, &dims[1]); if(ndim>1 && tip) md3(tip, dims[0], ndim-1, &dims[1]); /* init pointers */ free(dims); return tip; } /* mdfree: companion function to mdalloc * frees storage obtained by mdalloc */ void mdfree(void *tip, int ndim) { if(ndim == 1) free(tip); else { mdfree(((void **)tip)[0], ndim-1); free(tip); } } /* md2: allocates storage for n-way indirect pointer arrays * allocates storage for requested array elements */ static void **md2(int n_units, int ndim, int *dims) { char **tip; if(ndim == 1) /* recursed to final dimension - allocate element storage */ tip = malloc(n_units*w_units); else { /* allocate pointer array for dimension n */ tip = malloc(n_units*sizeof(char *)); if(tip) { /* recurse until final dimension */ tip[0] = (char *)md2(n_units*dims[0], ndim-1, &dims[1]); if(tip[0] == NULL) { /* allocate error - fall back up freeing everything */ free(tip); tip = NULL; } } } return (void **)tip; } /* md3: initializes indirect pointer arrays */ static void md3(char ***tip, int n_units, int ndim, int *dims) { int i; for(i=1; i<n_units; i++) { if(ndim == 1) /* final dimension - must scale by element width */ tip[i] = (char **)((char *)tip[0] + i*dims[0]*w_units); else /* intermediate dimension - scale by pointer size */ tip[i] = tip[0] + i*dims[0]; } if(ndim > 1) /* not at final dimension - continue to recurse */ md3((char ***)tip[0], n_units*dims[0], ndim-1, &dims[1]); } ������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/moon_age.c�������������������������������������������0000755�0000764�0000144�00000004111�07055334104�016220� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* PD by Michelangelo Jones, 1:1/124. */ /* ** Returns 0 for new moon, 15 for full moon, ** 29 for the day before new, and so forth. */ /* ** This routine sometimes gets "off" by a few days, ** but is self-correcting. */ int moon_age(int month, int day, int year) { static short int ages[] = {18, 0, 11, 22, 3, 14, 25, 6, 17, 28, 9, 20, 1, 12, 23, 4, 15, 26, 7}; static short int offsets[] = {-1, 1, 0, 1, 2, 3, 4, 5, 7, 7, 9, 9}; if (day == 31) day = 1; return ((ages[(year + 1) % 19] + ((day + offsets[month-1]) % 30) + (year < 1900)) % 30); } #ifdef TEST #include <stdio.h> #include <stdlib.h> static char *description[] = { "new", /* totally dark */ "waxing crescent", /* increasing to full & quarter light */ "in its first quarter", /* increasing to full & half light */ "waxing gibbous", /* increasing to full & > than half */ "full", /* fully lighted */ "waning gibbous", /* decreasing from full & > than half */ "in its last quarter", /* decreasing from full & half light */ "waning crescent" /* decreasing from full & quarter light */ }; static char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; int main(int argc, char *argv[]) { int month, day, year, phase; if (4 > argc) { puts("Usage: MOON_AGE month day year"); return EXIT_FAILURE; } month = atoi(argv[1]); day = atoi(argv[2]); year = atoi(argv[3]); if (100 > year) year += 1900; printf("moon_age(%d, %d, %d) returned %d\n", month, day, year, phase = moon_age(month, day, year)); printf("Moon phase on %d %s %d is %s\n", day, months[month - 1], year, description[(int)((phase + 2) * 16L / 59L)]); } #endif /* TEST */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/getopt3.c��������������������������������������������0000755�0000764�0000144�00000006153�07055333774�016045� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * * @(#)getopt.c 2.3 (smail) 5/30/87 */ /* * Here's something you've all been waiting for: the AT&T public domain * source for getopt(3). It is the code which was given out at the 1985 * UNIFORUM conference in Dallas. I obtained it by electronic mail directly * from AT&T. The people there assure me that it is indeed in the public * domain. * * There is no manual page. That is because the one they gave out at UNIFORUM * was slightly different from the current System V Release 2 manual page. * The difference apparently involved a note about the famous rules 5 and 6, * recommending using white space between an option and its first argument, * and not grouping options that have arguments. Getopt itself is currently * lenient about both of these things White space is allowed, but not * mandatory, and the last option in a group can have an argument. That * particular version of the man page evidently has no official existence, * and my source at AT&T did not send a copy. The current SVR2 man page * reflects the actual behavor of this getopt. However, I am not about to * post a copy of anything licensed by AT&T. */ #ifdef BSD #include <strings.h> #else #define index strchr #include <string.h> #endif /* LINTLIBRARY */ #define NULL 0 #define EOF (-1) #define ERR(s, c) if(opterr){\ extern int write(int, void *, unsigned);\ char errbuf[2];\ errbuf[0] = (char)c; errbuf[1] = '\n';\ (void) write(2, strlwr(argv[0]), (unsigned)strlen(argv[0]));\ (void) write(2, s, (unsigned)strlen(s));\ (void) write(2, errbuf, 2);} extern char *index(); int opterr = 1; int optind = 1; int optopt; char *optarg; int getopt(int argc, char *argv[], char *opts) { static int sp = 1; register int c; register char *cp; if (sp == 1) { if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') return (EOF); else if (strcmp(argv[optind], "--") == NULL) { optind++; return (EOF); } } optopt = c = argv[optind][sp]; if (c == ':' || (cp = index(opts, c)) == NULL) { ERR(": illegal option -- ", c); if (argv[optind][++sp] == '\0') { optind++; sp = 1; } return ('?'); } if (*++cp == ':') { if (argv[optind][sp + 1] != '\0') optarg = &argv[optind++][sp + 1]; else if (++optind >= argc) { ERR(": option requires an argument -- ", c); sp = 1; return ('?'); } else optarg = argv[optind++]; sp = 1; } else { if (argv[optind][++sp] == '\0') { sp = 1; optind++; } optarg = NULL; } return (c); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/getopts.c��������������������������������������������0000755�0000764�0000144�00000014106�07055333776�016144� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** GETOPTS.C - Universal command line options parser ** ** Original Copyright 1993 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is hereby donated to the public domain. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "portable.h" #include "getopts.h" #define NUL '\0' #define MAX_XARGS 512 int xargc; char *xargv[MAX_XARGS]; /* ** getopts() ** ** Parameters: 1 - argc from main() ** 2 - argv from main() ** 3 - your program's options[] array ** ** Returns: Number of options specified or -1 if error ** ** Note: Your program should declare the global options[] array which ** specifies all options recognized by getopts(). */ int getopts(int argc, char *argv[]) { int i, count, argidx = 0; char *argp; FILE *argfile; char argline[256]; struct Option_Tag *ptr; xargc = argc; xargv[argidx++] = argv[0]; for (i = 1, count = 0; i < argc; ++i) { if (strchr("-/", argv[i][0]) && !strchr("-/", argv[i][1])) { /* ** Found a switch - If the 2nd character is also a switch ** character. If so, then it's a literal and is skipped */ if (strchr("-/", argv[i][1])) continue; for (ptr = options; ptr->buf; ++ptr) { if ((int)argv[i][1] == ptr->letter) switch (ptr->type) { case Boolean_Tag: if ('-' == argv[i][2]) *((Boolean_T *)(ptr->buf)) = FALSE; else *((Boolean_T *)(ptr->buf)) = TRUE; ++count; --xargc; break; case Word_Tag: sscanf(&argv[i][2], "%hd", (short *)(ptr->buf)); ++count; --xargc; break; case DWord_Tag: sscanf(&argv[i][2], "%ld", (long *)(ptr->buf)); ++count; --xargc; break; case Double_Tag: sscanf(&argv[i][2], "%lg", (double *)(ptr->buf); ++count; --xargc; break; case String_Tag: strcpy(ptr->buf, &argv[i][2]); ++count; --xargc; break; default: return ERROR; } } } else /* It must be a file name */ { DOSFileData ffblk; /* Set argp to point to the filename */ if (strchr("-/", argv[i][0])) argp = &argv[i][1]; else argp = argv[i]; /* If no wildcards, just copy it */ if (!strchr(argp, '*') && !strchr(argp, '?')) { xargv[argidx++] = argp; continue; } /* Expand wildcards, if possible */ if (0 == FIND_FIRST(argp, 0xff, &ffblk)) { char path[FILENAME_MAX], *p; /* Save the path for re-attachment */ if (NULL == (p = strrchr(argp, '\\'))) p = strrchr(argp, '/'); if (p) { char ch = *p; *p = NUL; strcat(strcpy(path, argp), "\\"); *p = ch; } else *path = NUL; --xargc; do { xargv[argidx] = malloc(strlen(ffblk.name) + strlen(path) + 2); strcat(strcpy(xargv[argidx], path), ffblk.name); ++argidx; ++xargc; } while (0 == FIND_NEXT(&ffblk)); } } } return count; } #ifdef TEST #include <stdlib.h> Boolean_T test1 = TRUE, test2 = FALSE; int test3 = -37; long test4 = 100000L; char test5[80] = "Default string"; struct Option_Tag options[] = { {'A', Boolean_Tag, &test1 }, /* Valid options */ {'B', Boolean_Tag, &test2 }, {'C', Word_Tag, &test3 }, {'D', DWord_Tag, &test4 }, {'E', String_Tag, test5 }, {'\0', ERROR, NULL } /* Terminating record */ }; #define TFprint(v) ((v) ? "TRUE" : "FALSE") int main(int argc, char *argv[]) { int i; printf("Defaults:\ntest1 = %s\ntest2 = %s\ntest3 = %d\ntest4 = %ld\n" "test5 = \"%s\"\n\n", TFprint(test1), TFprint(test2), test3, test4, test5); printf("getopts() returned %d\n", getopts(argc, argv)); printf("Options are now:\ntest1 = %s\ntest2 = %s\ntest3 = %d\n" "test4 = %ld\ntest5 = \"%s\"\n\n", TFprint(test1), TFprint(test2), test3, test4, test5); puts("Hit any key to continue"); getch(); for (i = 0; i < xargc; ++i) printf("xargv[%d] = \"%s\"\n", i, xargv[i]); printf("\nxargc = %d\n", xargc); return 0; } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/getopts.h��������������������������������������������0000755�0000764�0000144�00000001174�07055333777�016153� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** GETOPTS.H ** ** public domain by Bob Stout */ #undef ERROR #undef FALSE #undef TRUE typedef enum {ERROR = -1,FALSE, TRUE} Boolean_T; typedef enum { Boolean_Tag, Word_Tag, DWord_Tag, Double_Tag, String_Tag } TAG_TYPE; struct Option_Tag { int letter; /* Option switch */ TAG_TYPE type; /* Type of option */ void *buf; /* Storage location */ }; extern struct Option_Tag options[]; extern int xargc; extern char *xargv[]; int getopts(int, char *[]); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/sharing.txt������������������������������������������0000755�0000764�0000144�00000003766�07055334224�016506� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������From: Mike Ratledge To: All Msg #245, 03-Aug-88 12:45.00 Subject: File sharing enabled test Someone asked the other day about an easy way to determine if file-sharing is enabled at program run-time. I use the following code in all of my Turbo C program to do just that: #define TRUE 1 #define FALSE 0 int sharing; main (int argc, char *argv[]) { sharing = is_sharing(argv[0]); . . . if (sharing) { /* open file in shared mode */ ... } else { /* use "normal" open */ ... } } int is_sharing(char *arg) { FILE *exe; if (_osmajor < 3) return(FALSE); exe = fopen(arg, "rb"); ii = lock(fileno(exe), 0l, 500l); if (ii != -1) { ii = unlock(fileno(exe), 0l, 500l); fclose(exe); return(TRUE); } fclose(exe); return(FALSE); } What does this code do? First - it checks to make sure it's running under DOS 3.0+ - if not - no sharing. Next - it opens the program itself (the .EXE file) by using "argv[0]", which points to the actual program name complete with the path under DOS 3.0 or later. It then attempts to lock the first 500 bytes of the program on disk, and if successful (i.e. return != -1) it unlocks the same bytes and closes the file (actually - the unlock is superfluous, since closing the file releases all locks) and returns the "TRUE" result. If it fails - it closes the .EXE file and returns FALSE. Note that this does not depend on opening a file in shared mode to test it. Note that this code must be modified slightly to be useful for MicroSoft C, since they use the "locking" procedure for both lock & unlock. You also have to "rewind" before the unlock, since M/S C works from the current file-pointer forward. I could post both - but I'm sure all you C-jockeys out there know what I'm talking about if it concerns you (i.e. you're using M/S C instead of Turbo). I also have this coded in Turbo Pascal if anyone needs it... ����������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/soundex.c��������������������������������������������0000755�0000764�0000144�00000002125�07055334245�016132� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** from Bob Jarvis */ #include <stdio.h> #include <ctype.h> char *soundex(char *instr, char *outstr) { /* ABCDEFGHIJKLMNOPQRSTUVWXYZ */ char *table = "01230120022455012623010202"; int count = 0; while(!isalpha(instr[0]) && instr[0]) ++instr; if(!instr[0]) /* Hey! Where'd the string go? */ return(NULL); if(toupper(instr[0]) == 'P' && toupper(instr[1]) == 'H') { instr[0] = 'F'; instr[1] = 'A'; } *outstr++ = (char)toupper(*instr++); while(*instr && count < 5) { if(isalpha(*instr) && *instr != *(instr-1)) { *outstr = table[toupper(instr[0]) - 'A']; if(*outstr != '0') { ++outstr; ++count; } } ++instr; } *outstr = '\0'; return(outstr); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/dos5boot.h�������������������������������������������0000755�0000764�0000144�00000004261�07055333731�016212� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** DOS5BOOT.H - DOS 5 boot record */ #if defined(__TURBOC__) #pragma option -a- #define FAR far #elif defined(__ZTC__) #pragma ZTC align 1 #define FAR _far #else /* MSC/QC/WATCOM/METAWARE */ #pragma pack(1) #define FAR _far #endif typedef struct { /* offset in buffer record */ char bsJump[3]; /* 1 - 3 */ char bsOemName[8]; /* 4 - 11 */ short bsBytesPerSec; /* 12 - 13 */ char bsSecPerClust; /* 14 */ short bsResSectors; /* 15 - 16 */ char bsFATs; /* 17 */ short bsRootDirEnts; /* 18 - 19 */ short bsSectors; /* 20 - 21 */ char bsMedia; /* 22 */ short bsFATsecs; /* 23 - 24 */ short bsSecPerTrack; /* 25 - 26 */ short bsHeads; /* 27 - 28 */ long bsHiddenSecs; /* 29 - 32 */ long bsHugeSectors; /* 33 - 36 */ char bsDriveNumber; /* 37 */ char bsReserved1; /* 38 */ char bsBootSignature; /* 39 */ long bsVolumeID; /* 40 - 43 */ char bsVolumeLabel[11]; /* 44 - 54 */ char bsFileSysType[8]; /* 54 - 61 */ char bsReserved2[8]; /* 62 - 69 */ char bsJunk[442]; /* 70 - end of record (byte 512 is last) */ } B_REC; /* Boot_record; total of 512 bytes */ �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/msb2ieee.c�������������������������������������������0000755�0000764�0000144�00000003354�07055334112�016136� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/*** MSBIN conversion routines ***/ /*** public domain by Jeffery Foy ***/ union Converter { unsigned char uc[10]; unsigned int ui[5]; unsigned long ul[2]; float f[2]; double d[1]; }; /* MSBINToIEEE - Converts an MSBIN floating point number */ /* to IEEE floating point format */ /* */ /* Input: f - floating point number in MSBIN format */ /* Output: Same number in IEEE format */ float MSBINToIEEE(float f) { union Converter t; int sign, exp; /* sign and exponent */ t.f[0] = f; /* extract the sign & move exponent bias from 0x81 to 0x7f */ sign = t.uc[2] / 0x80; exp = (t.uc[3] - 0x81 + 0x7f) & 0xff; /* reassemble them in IEEE 4 byte real number format */ t.ui[1] = (t.ui[1] & 0x7f) | (exp << 7) | (sign << 15); return t.f[0]; } /* End of MSBINToIEEE */ /* IEEEToMSBIN - Converts an IEEE floating point number */ /* to MSBIN floating point format */ /* */ /* Input: f - floating point number in IEEE format */ /* Output: Same number in MSBIN format */ float IEEEToMSBIN(float f) { union Converter t; int sign, exp; /* sign and exponent */ t.f[0] = f; /* extract sign & change exponent bias from 0x7f to 0x81 */ sign = t.uc[3] / 0x80; exp = ((t.ui[1] >> 7) - 0x7f + 0x81) & 0xff; /* reassemble them in MSBIN format */ t.ui[1] = (t.ui[1] & 0x7f) | (sign << 7) | (exp << 8); return t.f[0]; } /* End of IEEEToMSBIN */ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/prnspool.c�������������������������������������������0000755�0000764�0000144�00000006304�07055334152�016321� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* prnspool.c 12-22-91 Robert Mashlan, public domain */ /* DOS print spooler interface functions */ #include <stdio.h> #include <dos.h> #include "prnspool.h" int printspool_errno = 0; char *printspool_errlist[] = { "No error", "Function Invalid", "File not found", "Path not found", "Too many open files", "Access denied", "", "", "Queue full", "Spooler busy", "", "", "Name too long", "", "Drive invalid" }; /* returns -1 if printspooler installed */ /* 0 otherwise */ int printspool_installed(void) { union REGS r; r.x.ax = 0x0100; int86(0x2f, &r, &r); if(r.h.al==0xff) { printspool_errno=0; return -1; } else { printspool_errno=1; return 0; } } /* submits a file name to be printed */ /* returns error code */ int printspool_submit( const char *pathname ) { struct PACKET packet; union REGS r; struct SREGS s; packet.level = 0; packet.pathname = (char far *)pathname; s.ds = FP_SEG(&packet); r.x.dx = FP_OFF(&packet); r.x.ax = 0x0101; int86x(0x2f, &r, &r, &s); if(!r.x.cflag) return printspool_errno = 0; else return printspool_errno = r.x.ax; } /* removes a file from the print queue */ int printspool_remove( const char far *fname ) { union REGS r; struct SREGS s; s.ds = FP_SEG(fname); r.x.dx = FP_OFF(fname); r.x.ax = 0x0102; int86x(0x2f, &r, &r, &s); if(!r.x.cflag) return printspool_errno = 0; else return printspool_errno=r.x.ax; } /* cancels all files in the print queue */ int printspool_cancel(void) { union REGS r; r.x.ax = 0x0103; int86(0x2f, &r, &r); if(!r.x.cflag) return printspool_errno = 0; else return printspool_errno = r.x.ax; } /* ends hold state after a call to printspool_qetqueue */ /* or printspool_errorcount */ void printspool_endhold(void) { union REGS r; r.x.ax = 0x0105; int86(0x2f, &r, &r); } /* returns a far pointer to the printspooler queue, */ /* an array of 64 char asciiz strings */ char far *printspool_getqueue(void) { char far *result; union REGS r; struct SREGS s; r.x.ax = 0x0104; int86x(0x2f, &r, &r, &s); result = MK_FP(s.ds,r.x.si); if (!r.x.cflag) { printspool_errno = 0; return result; } else { printspool_errno = r.x.ax; return NULL; } } /* returns the error count from the printspooler */ int printspool_errorcount(void) { union REGS r; r.x.ax = 0x0104; int86(0x2f, &r, &r); if (!r.x.cflag) { printspool_errno = 0; return r.x.dx; /* return the number of errors */ } else { printspool_errno = r.x.ax; return r.x.dx; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/prnspool.h�������������������������������������������0000755�0000764�0000144�00000002461�07055334152�016326� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* prnspool.h 12-22-91 Robert Mashlan, public domain */ /* print spooler interface functions header file */ /* modified by Bob Stout, Nov '93 */ #ifdef __TURBOC__ #define FAR far #else #define FAR _far #if (defined(_MSC_VER) && (_MSC_VER >= 700)) || (defined(__SC__)) /* Make FP_xxx macros lvalues as in older versions */ #undef FP_SEG #undef FP_OFF #define FP_SEG(fp) ((unsigned)((unsigned long)(fp) >> 16)) #define FP_OFF(fp) ((unsigned)(fp && 0xffff)) #endif #endif #ifndef MK_FP #define MK_FP(seg,offset) \ ((void _far *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #endif struct PACKET { unsigned char level; char far *pathname; }; extern int printspool_errno; extern char *printspool_errlist[]; int printspool_installed(void); int printspool_submit( const char *pathname ); int printspool_remove( const char far *fname ); int printspool_cancel(void); char far *printspool_getqueue(void); void printspool_endhold(void); int printspool_errorcount(void); #define PSENOERR 0x00 #define PSEINVFNC 0x01 #define PSENOFILE 0x02 #define PSENOPATH 0x03 #define PSEMFILE 0x04 #define PSEACCES 0x05 #define PSEQUEFUL 0x08 #define PSESPLBUSY 0x09 #define PSENME2LNG 0x0c #define PSEINVDRV 0x0f ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/hexdump.c��������������������������������������������0000755�0000764�0000144�00000004134�07055334010�016107� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** HEXDUMP.C - Dump a file. ** ** This Program Written By Paul Edwards w/ modifications by Bob Stout ** Released to the public domain */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> static void dodump(FILE *fp, long start, long count); static void skipb(FILE *fp, long start); main(int argc, char **argv) { FILE *fp; long start, count; if (argc < 2) { puts("Usage: HEXDUMP file_name [start] [length]"); return (EXIT_FAILURE); } if (argc > 2) start = atol(*(argv + 2)); else start = 0L; if (argc > 3) count = atol(*(argv + 3)); else count = -1L; fp = fopen(*(argv + 1), "rb"); if (fp == NULL) { printf("unable to open file %s for input\n", *(argv+1)); return (EXIT_FAILURE); } skipb(fp, start); dodump(fp, start, count); return (EXIT_SUCCESS); } static void dodump(FILE *fp, long start, long count) { int c, pos1, pos2; long x = 0L; char prtln[100]; while (((c = fgetc(fp)) != EOF) && (x != count)) { if (x%16 == 0) { memset(prtln,' ',sizeof prtln); sprintf(prtln,"%0.6X ", start + x); pos1 = 8; pos2 = 45; } sprintf(prtln + pos1, "%0.2X", c); if (isprint(c)) sprintf(prtln + pos2, "%c", c); else sprintf(prtln + pos2, "."); pos1 += 2; *(prtln+pos1) = ' '; pos2++; if (x % 4 == 3) *(prtln + pos1++) = ' '; if (x % 16 == 15) printf("%s\n", prtln); x++; } if (x % 16 != 15) printf("%s\n", prtln); return; } static void skipb(FILE *fp, long start) { long x = 0; if (start == 0) return; while (x < start) { fgetc(fp); x++; } return; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ftime.c����������������������������������������������0000755�0000764�0000144�00000002277�07055333770�015563� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Public domain by Jeff Dunlop & Bob Stout */ #ifndef __TURBOC__ #include <dos.h> #include "ftime.h" #ifdef __ZTC__ #pragma ZTC align 1 #define DOS_GETFTIME dos_getftime #define DOS_SETFTIME dos_setftime #else #pragma pack(1) #define DOS_GETFTIME _dos_getftime #define DOS_SETFTIME _dos_setftime #endif int _cdecl getftime (int handle, struct ftime *ftimep) { int retval = 0; union { struct { unsigned time; unsigned date; } msc_time; struct ftime bc_time; } FTIME; if (0 == (retval = DOS_GETFTIME(handle, &FTIME.msc_time.date, &FTIME.msc_time.time))) { *ftimep = FTIME.bc_time; } return retval; } int _cdecl setftime (int handle, struct ftime *ftimep) { union { struct { unsigned time; unsigned date; } msc_time; struct ftime bc_time; } FTIME; FTIME.bc_time = *ftimep; return DOS_SETFTIME(handle, FTIME.msc_time.date, FTIME.msc_time.time); } #endif /* __TURBOC__ */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ftime.h����������������������������������������������0000755�0000764�0000144�00000001007�07055333770�015556� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** Public domain by Jeff Dunlop */ #ifndef __TURBOC__ struct ftime /* As defined by Borland C */ { unsigned ft_tsec : 5; /* Two second interval */ unsigned ft_min : 6; /* Minutes */ unsigned ft_hour : 5; /* Hours */ unsigned ft_day : 5; /* Days */ unsigned ft_month : 4; /* Months */ unsigned ft_year : 7; /* Year */ }; int _cdecl getftime (int, struct ftime *); int _cdecl setftime (int, struct ftime *); #endif /* __TURBOC__ */ �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/treedir.c��������������������������������������������0000755�0000764�0000144�00000002431�07055334311�016075� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** TREEDIR.C - simple recursive directory lister ** ** public domain demo by Bob Stout */ #include <stdio.h> #include <string.h> #ifdef __ZTC__ #include <dos.h> #ifndef _A_SUBDIR #define _A_SUBDIR FA_DIREC #endif #elif defined(__TURBOC__) #include <dir.h> #include <dos.h> #define _dos_findfirst(f,a,b) findfirst(f,b,a) #define _dos_findnext(b) findnext(b) #define find_t ffblk #define _A_SUBDIR FA_DIREC #define attrib ff_attrib #define name ff_name #else /* assume MSC/QC */ #include <dos.h> #include <errno.h> #endif #ifndef SUCCESS #define SUCCESS 0 #endif void do_dir(char *path) { char search[67], new[67]; struct find_t ff; strcat(strcpy(search, path), "\\*.*"); if (SUCCESS == _dos_findfirst(search, 0xff, &ff)) do { printf("%s\\%s\n", path, ff.name); if (ff.attrib & _A_SUBDIR && '.' != *ff.name) { strcat(strcat(strcpy(new, path), "\\"), ff.name); do_dir(new); } } while (SUCCESS == _dos_findnext(&ff)); } void main(void) /* simple resursive current directory lister */ { do_dir("."); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/tasker.txt�������������������������������������������0000755�0000764�0000144�00000006042�07055334303�016330� �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Multi-Tasker Detection Routines by David Gibbs FidoNet: 1:115/439.0 Internet: David.Gibbs@f439.n115.z1.fidonet.org The following is a set of C routines that will enable a programmer to detect a mutli-tasking environment and release the time slice when desired. Currently DESQview, Windows, & OS/2 are the environments supported. Routines consist of two functions, two global int variables, one global structure, and a table of character pointers. void t_get_os(); This routines detects the operating environment, sets on the appropriate bits in the t_os_type field, and sets the t_os field to the dominant environment. void t_slice(); This routine will release the remainder of the current tasks time slice in the manner appropriate to the dominant envionment. The following fields & structures are available... int t_os_type; is a bit mapped integer that indicates the presence of various operating envionments. If Bit 0 is on, DOS is present, Bit 1 = OS2, bit 2 = DESQview, bit 3 = Windows standard, bit 4 = Windows 386 Enh. These bits can be tested by using logical operations with the symbolic constants is_DOS, is_OS2, is_DV, is_WINS, and is_WIN3. int t_os; represents the dominant environment. The dominant envionment is defined as the multi-tasking system that takes precidence. For instance, you can run Windows *UNDER* DESQview, but DESQview would be dominant, the same goes true for OS/2 & Windows. This value can be tested by comparing to the symbolic constants: DOS, OS2, DV, WINS, and WIN3. struct t_os_ver ts_os_ver[]; indicates the versions of the various environments present. Major & minor versions are found in the structure members 'maj' and 'min'. The structure is subscripted, so you can access the version of envionments using the symbolic constants use in 't_os'. const char *t_os_name[]; contains the names of the environments detectable. These too are subscripted and can be accessed using the symbolic constants above. A sample program that uses these routines follows: #include <stdio.h> #include "tasker.h" void main() { get_os(); printf("%s %d.%d detected",t_os_name[t_os], t_os_ver[t_os].maj, t_os_ver[t_os].min); while(!kbhit()) { printf("Hit a key!\r\n"); t_slice(); } } Special thanks go to Geoffery Booher (1:2270/233) for assistance with Windows & OS/2 detection & Time slicing. This routine is released to the public as CommentWare - If you use it, please send me a comment as to what you thought of it... oh yeah, you might think of giving me credit for the routines. Also, if you can think of a enhancement or correction, please let me know. I can be reached at the above mentioned email addresses. Copyrights: DESQview by Quarterdeck Office Systems Windows by Microsoft OS/2 by IBM TurboC++ by Borland ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mterm.c����������������������������������������������0000755�0000764�0000144�00000007644�07055334113�015576� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* MTERM.C - Minimal example PC terminal program. Released to public domain by author, David Harmon, June 1992. Intended for use with a FOSSIL driver, but will run with BIOS alone. I expect you'll want to add something for practical purposes. ;-) */ #include <stdio.h> #include <stdlib.h> #include <conio.h> /* kbhit(), getch(), putch(), etc. */ #include <dos.h> /* int86(), etc. */ #ifdef __ZTC__ #define cputs(s) fputs((s),stderr) #endif int port = 0; /* 0 = COM1:, 1 = COM2: etc. */ int local_echo = 0; int cr_add_lf = 0; int exiting = 0; int init_comm(int flags) { union REGS regs; regs.h.ah = 0x04; /* initialize driver (port) */ regs.x.bx = 0x4f50; regs.x.dx = port; int86( 0x14, ®s, ®s); regs.h.ah = 0x00; /* set baud rate * port attrs */ regs.h.al = (unsigned char)flags; regs.x.dx = port; int86( 0x14, ®s, ®s); return regs.h.ah; } void send_char(char ch) { union REGS regs; regs.h.ah = 0x01; /* Send char (wait until ready)*/ regs.h.al = ch; regs.x.dx = port; int86( 0x14, ®s, ®s); } int input_ready(void) { union REGS regs; regs.h.ah = 0x03; /* Get port status */ regs.x.dx = port; int86( 0x14, ®s, ®s); return ((regs.h.ah & 0x01) != 0); /* input ready */ } int get_char(void) { union REGS regs; regs.h.ah = 0x02; /* receive char (wait if necessary)*/ regs.x.dx = port; int86( 0x14, ®s, ®s); return regs.h.al; } void deinit_comm(void) { union REGS regs; regs.h.ah = 0x05; /* deinitialize port (pseudo close) */ regs.h.al = 0x00; /* (lower DTR) */ regs.x.dx = port; int86( 0x14, ®s, ®s); } void main(void) { int ch; init_comm(0xE3); /* hard coded 0xB3 = 2400,N,8,1 */ cputs("MTERM ready! Press F1 to exit.\r\n"); while (!exiting) { if (kbhit()) /* key was hit */ { ch = getch(); /* Regular ASCII keys are returned as the ASCII code; function keys, arrows, etc. as zero followed by a special code (on next getch.) */ if (ch != 0) { send_char((char)ch); /* to com port */ if (local_echo) { putch(ch); /* to screen */ /* add LF to CR? */ if (cr_add_lf && ch == '\r') putch('\n'); } } else { ch = getch(); /* get the special key code */ switch (ch) { case 0x3B: /* F1 */ exiting = 1; /* quit now */ break; case 0x3C: /* F2 */ local_echo = !local_echo; /* toggle echo */ break; case 0x3D: /* F3 */ cr_add_lf = !cr_add_lf; /* toggle LF */ break; } } } /* end if kbhit */ if (input_ready()) /* com port */ { ch = get_char(); putch(ch); if (cr_add_lf && ch == '\r') /* add LF to CR? */ putch('\n'); } } /* end while not exiting */ deinit_comm(); } ��������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/timegetc.c�������������������������������������������0000755�0000764�0000144�00000001466�07055334304�016251� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* ** TIMEGETC.C - waits for a given number of seconds for the user to press ** a key. Returns the key pressed, or EOF if time expires ** ** by Bob Jarvis */ #include <stdio.h> #include <time.h> #include <conio.h> int timed_getch(int n_seconds) { time_t start, now; start = time(NULL); now = start; while(difftime(now, start) < (double)n_seconds && !kbhit()) { now = time(NULL); } if(kbhit()) return getch(); else return EOF; } #ifdef TEST void main(void) { int c; printf("Starting a 5 second delay...\n"); c = timed_getch(5); if(c == EOF) printf("Timer expired\n"); else printf("Key was pressed, c = '%c'\n", c); } #endif /* TEST */ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/HEADER.html������������������������������������������0000644�0000764�0000144�00000000570�07055334353�016116� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<title>Snippets

    Snippets

    This is Bob Stouts compilation of public domain C programs. A large number of these programs are not portable as they require DOS. That aside, this is a good source of examples and utilities.

    This copy was taken in Jan '95. If you want the latest, click here.


    c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bstr_i.c0000755000076400001440000000126607055333660015734 /* ** Make an ascii binary string into an integer. ** ** Public domain by Bob Stout */ #include unsigned int bstr_i(char *cptr) { unsigned int i, j = 0; while (cptr && *cptr && strchr("01", *cptr)) { i = *cptr++ - '0'; j <<= 1; j |= (i & 0x01); } return(j); } #ifdef TEST #include #include int main(int argc, char *argv[]) { char *arg; unsigned int x; while (--argc) { x = bstr_i(arg = *++argv); printf("Binary %s = %d = %04Xh\n", arg, x, x); } return EXIT_SUCCESS; } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/chbytes.c0000755000076400001440000001502707055333677016123 /* ** CHBYTES.C - Change bytes in a file ** ** This program searches a file for a sequence of bytes. If they are ** found, they are replaced with zeros. It was originally developed for ** a friend who needed a program to call from Paradox to remove printer ** control sequences from formatted print files. The requirements were ** 1) since it is called by another program, all status has to be returned ** in the errorlevel with no screen messages allowed, and 2) The file must ** remain the same length, so the deleted sequences must only be replaced ** with ASCII NULs. ** ** Syntax: CHBYTES filename pattern_1 [pattern_2 [...pattern_N]] ** where: Each pattern is a comma-separated list of bytes, each of which ** may be of the following forms: ** C - Any single character will be treated as literal. ** XXh - "XX" will be interpreted as a hexidecimal number (both ** 1- and 2-digit hex numbers are allowed). ** NNNd - "NNN" will be interpreted as a decimal number (both ** 1-, 2-, and 3-digit decimal numbers are allowed). ** ** e.g. CHBYTES printer.fil 12d 1bh,[,3,x ** would zero out form feeds and the escape sequence "[3x" ** ** Returns: 0 - Success ** 1 - No filename ** 2 - No arguments ** 3 - Error opening file ** 4 - Not enough memory ** 5 - Bad argument ** 6 - Error reading file ** 7 - Error writing file ** ** Public domain by Bob Stout */ #include #include #include #include #ifdef __ZTC__ int _okbigbuf = 0; #endif #define LAST_CHAR(s) (((char *)(s))[strlen((char *)(s)) - 1]) #ifndef max #define max(x,y) (((x) >= (y)) ? (x) : (y)) #endif typedef enum {ERROR = -1, SUCCESS, FALSE = 0, TRUE} LOGICAL; int bufsize; struct { char pattern[40]; /* pattern to find */ int numbytes; /* length of pattern */ } search[40]; int main (int argc, char *argv[]) { FILE *fp = NULL; char *buf = NULL, *getbuf(void); fpos_t rpos; int i, patterns, max_bytes = 0; LOGICAL hex2char(const char *, char *); if (2 > argc) /* no filename */ return 1; if (3 > argc) /* no argument */ return 2; if (NULL == (fp = fopen(argv[1], "r+b"))) return 3; /* file open error */ if (NULL == (buf = getbuf())) return 4; /* no memory for buffer */ patterns = argc - 2; /* process arguments */ for (i = 2; i < argc; ++i) { char *p, *ptr; if (NULL != (ptr = strtok(argv[i], ","))) { p = search[i - 2].pattern; do { search[i - 2].numbytes++; if (1 == strlen(ptr)) { *p++ = *ptr; continue; } switch (toupper(LAST_CHAR(ptr))) { case 'D': LAST_CHAR(ptr) = '\0'; *p++ = (char)atoi(ptr); break; case 'H': LAST_CHAR(ptr) = '\0'; if (ERROR == hex2char(ptr, p++)) return 5; break; default: return 5; } } while (NULL != (ptr = strtok(NULL, ","))); *p = '\0'; max_bytes = max(max_bytes, search[i - 2].numbytes); } else return 5; } fgetpos(fp, &rpos); /* save where we are */ while (1) { int bytes, n; LOGICAL modified; if (max_bytes > (bytes = (int)fread(buf, 1, bufsize, fp))) { if (0 == bytes && !feof(fp)) return 6; /* something's wrong! */ else break; /* all done! */ } for (n = 0, modified = FALSE; n < patterns; ++n) { /* check each pattern in turn */ for (i = 0; i < (bytes - max_bytes + 1); ++i) { int j; if (buf[i] != *(search[n].pattern)) continue; if (SUCCESS != strncmp(&buf[i], search[n].pattern, search[n].numbytes)) { continue; } /* found one! replace it in the buffer */ for (j = 0; j < search[n].numbytes; ++j, ++i) buf[i] = '\0'; modified = TRUE; } } if (modified) /* write changes, if any*/ { fpos_t wpos = rpos; fsetpos(fp, &wpos); if (bytes != (int)fwrite(buf, 1, bytes, fp)) return 7; fsetpos(fp, &rpos); } rpos += bytes - max_bytes + 1; /* get another buffer */ fsetpos(fp, &rpos); } fclose(fp); return SUCCESS; } /* ** Allocate the largest buffer we can */ char *getbuf(void) { register char *buffer; for (bufsize = 0x4000; bufsize >= 128; bufsize >>= 1) { if (NULL != (buffer = (char *) malloc(bufsize))) return buffer; } return NULL; } /* ** Convert ASCII hex char to char */ #define xdigit(c) (toupper(c) - (((c) > '9') ? 'A' - 10 : '0')) LOGICAL hex2char(const char *hex, char *buf) { int ch = 0; char *p = (char *)hex; while(*p) { if (!isxdigit(*p)) return ERROR; ch <<= 4; ch += xdigit(*p); ++p; } *buf = (char)ch; return SUCCESS; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/uclock.c0000755000076400001440000000731507055334313015727 /* ** UCLOCK.C ** ** Contains routines to perform microsecond accuracy timing ** operations. ** ** Adapted from public domain source originally by David L. Fox ** Modified by Bob Stout */ #include "uclock.h" /* Constants */ #define CONTVAL 0x34 /* == 00110100 Control byte for 8253 timer. */ /* Sets timer 0 to 2-byte read/write, */ /* mode 2, binary. */ #define T0DATA 0x40 /* Timer 0 data port address. */ #define TMODE 0x43 /* Timer mode port address. */ #define BIOS_DS 0x40 /* BIOS data segment. */ #define B_TIKP 0x6c /* Address of BIOS (18.2/s) tick count. */ #define SCALE 10000 /* Scale factor for timer ticks. */ /* The following values assume 18.2 BIOS ticks per second resulting from the 8253 being clocked at 1.19 MHz. */ #define us_BTIK 54925 /* Micro sec per BIOS clock tick. */ #define f_BTIK 4595 /* Fractional part of usec per BIOS tick. */ #define us_TTIK 8381 /* Usec per timer tick * SCALE. (4/4.77 MHz) */ static int init = 0; /* ** usec_clock() ** ** An analog of the clock() function, usec_clock() returns a number of ** type uclock_t (defined in UCLOCK.H) which represents the number of ** microseconds past midnight. Analogous to CLK_TCK is UCLK_TCK, the ** number which a usec_clock() reading must be divided by to yield ** a number of seconds. */ uclock_t usec_clock(void) { unsigned char msb, lsb; unsigned int tim_ticks; static uclock_t last, init_count; static uclock_t far *c_ptr; uclock_t count, us_tmp; if (!init) { c_ptr = (uclock_t far *)MK_FP(BIOS_DS, B_TIKP); init = 1; /* First call, we have to set up timer. */ int_off(); outp(TMODE, CONTVAL); /* Write new control byte. */ outp(T0DATA, 0); /* Initial count = 65636. */ outp(T0DATA, 0); init_count = *c_ptr; int_on(); return 0; /* First call returns zero. */ } /* Read PIT channel 0 count - see text */ int_off(); /* Don't want an interrupt while getting time. */ outp(TMODE, 0); /* Latch count. */ lsb = (unsigned char)inp(T0DATA); /* Read count. */ msb = (unsigned char)inp(T0DATA); /* Get BIOS tick count (read BIOS ram directly for speed and to avoid turning on interrupts). */ count = *c_ptr; int_on(); /* Interrupts back on. */ if ((-1) == init) /* Restart count */ { init_count = count; init = 1; } /* Merge PIT channel 0 count with BIOS tick count */ if (count < init_count) count += last; else last = count; count -= init_count; tim_ticks = (unsigned)(-1) - ((msb << 8) | lsb); us_tmp = count * us_BTIK; return (us_tmp + ((long)tim_ticks * us_TTIK + us_tmp % SCALE) / SCALE); } /* ** restart_uclock() ** ** Since usec_clock() bases its return value on a differential value, ** a potential exists for problems in programs which run continuously ** for more than 24 hours. In such an application, it's necessary, at ** least once a day, to reset usec_clock's starting count. */ void restart_uclock(void) { if (init) init = -1; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/uclock.h0000755000076400001440000000224307055334314015730 /* ** UCLOCK.H ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include #include #if defined(__ZTC__) #include #undef int_on #undef int_off #elif defined(__TURBOC__) #define int_on enable #define int_off disable #ifndef inp #define inp inportb #endif #ifndef outp #define outp outportb #endif #else /* assume MSC/QC */ #include #define int_on _enable #define int_off _disable #ifndef MK_FP #define MK_FP(seg,offset) \ ((void far *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #endif #endif /* ANSI-equivalent declarations and prototypes */ typedef unsigned long uclock_t; #define UCLK_TCK 1000000L /* Usec per second - replaces CLK_TCK */ #if __cplusplus extern "C" { #endif uclock_t usec_clock(void); void restart_uclock(void); #if __cplusplus } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/dspdtst.c0000755000076400001440000001025707055333737016144 /* ** Compiler I/O benchmarks ** public domain by Dave Knapp & Bob Stout */ #include #include #include typedef unsigned long dword; #ifdef M_I86 /* Identifier for MSC, QC, Watcom, or ZTC */ #ifndef __ZTC__ #include #ifndef __WATCOMC__ #ifdef _MSC_VER #define LOGFILE "dspdtst.msc" #else #define LOGFILE "dspdtst.qc" #endif // #define MK_FP(seg,off) ((void far *)(((dword)(seg)<<16)|(off))) #else #define LOGFILE "dspdtst.wc" #endif /* not Watcom */ #define cputs(s) _outtext((char _far *)(s)) #define gotoxy(col,row) _settextposition(row,col) #else /* if ZTC */ #include #define cputs(s) disp_puts(s "\n") #define cprintf(s) disp_printf(s "\n") #ifdef __SC__ #define LOGFILE "dspdtst.sc" #define gotoxy(col,row) __emit__(0xb2,col-1,0xb6,row-1,0xb7,0,0xb4,2,0xcd,0x10) #else #define LOGFILE "dspdtst.ztc" #define gotoxy(col,row) asm(0xb2,col-1,0xb6,row-1,0xb7,0,0xb4,2,0xcd,0x10) #endif #endif /* if ZTC */ #else #ifdef __BORLANDC__ #define LOGFILE "dspdtst.bc" #else #define LOGFILE "dspdtst.tc" #endif #endif /* if TC */ dword far *bios_time = (dword far *)(0x0040006c); dword time1,time2,time3,time4,time5,time6; void main(void) { int i; FILE *log = stdout, *nulfile; #ifdef __ZTC__ disp_open(); #endif nulfile = fopen("NUL", "w"); time1 = *bios_time; for(i = 1; i < 1000; i++) { gotoxy(10,5); puts("puts test."); puts("this is the second line.\n"); } time1 = *bios_time - time1; time2 = *bios_time; for(i = 1; i < 1000; i++) { gotoxy(10,5); printf("printf test.\n"); printf("this is the second line.\n"); } time2 = *bios_time - time2; time3 = *bios_time; for(i = 1; i < 1000; i++) { #ifdef __ZTC__ disp_move(4,9); cputs("d_puts test."); #else gotoxy(10,5); #if defined(M_I86) && !defined(__WATCOMC__) cputs("_outtext test.\r\n"); #else cputs("cputs test.\r\n"); #endif #endif cputs("this is the second line."); } time3 = *bios_time - time3; time4 = *bios_time; for(i = 1; i < 1000; i++) { #ifdef __ZTC__ disp_move(4,9); cprintf("d_printf test."); #else gotoxy(10,5); cprintf("cprintf test.\r\n"); #endif cprintf("this is the second line."); } time4 = *bios_time - time4; time5 = *bios_time; for(i = 1; i < 1000; i++) { fputs("fputs test.\n", nulfile); fputs("this is the second line.\n", nulfile); } time5 = *bios_time - time5; time6 = *bios_time; for(i = 1; i < 1000; i++) { fprintf(nulfile, "fprintf test.\n"); fprintf(nulfile, "this is the second line.\n"); } time6 = *bios_time - time6; #ifdef __ZTC__ disp_close(); #endif log = fopen(LOGFILE, "w"); fputs("Times for 1000 iterations:\n\n", log); fprintf(log, "puts %10.3f seconds\n", (double)time1 * .054945); fprintf(log, "printf %10.3f seconds\n", (double)time2 * .054945); #ifndef __ZTC__ #if defined(M_I86) && !defined(__WATCOMC__) fprintf(log, "_outtext %10.3f seconds\n", (double)time3 * .054945); #else fprintf(log, "cputs %10.3f seconds\n", (double)time3 * .054945); #endif fprintf(log, "cprintf %10.3f seconds\n", (double)time4 * .054945); #else fprintf(log, "d_puts %10.3f seconds\n", (double)time3 * .054945); fprintf(log, "d_printf %10.3f seconds\n", (double)time4 * .054945); #endif fprintf(log, "fputs %10.3f seconds\n", (double)time5 * .054945); fprintf(log, "fprintf %10.3f seconds\n", (double)time6 * .054945); fclose(log); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/dbl2long.c0000755000076400001440000000400007055333720016137 /* ** DBL2LONG.C - Functions to round doubles to longs ** Public domain by Ross G. Cottrell, June 1992 */ #include #include #include /* Assume IEEE doubles, little-endian CPU, 32-bit 2's complement longs. */ /* (Actually, the assumptions made here aren't quite that gross.) */ unsigned long dbl2ulong(double t) { assert(1 == FLT_ROUNDS); t += 1.0 / DBL_EPSILON; return *(unsigned long *)&t; } long dbl2long(double t) { assert(1 == FLT_ROUNDS); t += 1.0 / DBL_EPSILON + 2.0 * (LONG_MAX + 1.0); return *(long *)&t; } #ifdef TEST #include #include int main(int argc, char **argv) { while (*++argv) { printf("'%s', as a long: %ld, as an unsigned long: %lu\n", *argv, dbl2long(atof(*argv)), dbl2ulong(atof(*argv))); } return 0; } #endif /* TEST */ /* EXPLANATION: The offset of 1.0/DBL_EPSILON forces the least significant bit of the mantissa to represent the integer 1. This may not work on all formats of doubles, but I think it's a safe bet for IEEE compliant doubles, and any other floating point format with a radix of 2. When this offset is added, the number should be rounded to the nearest representable value. The assertion that FLT_ROUNDS has the value of 1 is an attempt to guarantee this. You might check your float.h; if this isn't #defined as a constant 1 you should investigate how to ensure that it will always round to the nearest. If it is #defined as 1 you can safely rip out the assertions. The addition of 2.0*(LONG_MAX+1.0) for the signed long is to prevent the the MSB of the mantissa being borrowed for negative inputs - if this happened, the exponent would change and the LSB of the mantissa would no longer be worth 1. This offset would be perfectly okay to use with the unsigned longs too but it's unnecessary for them, unless you want to get the answer correct modulo 2^^32 for negatives. */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bresnham.c0000755000076400001440000000722007055333660016245 /* ** Public Domain mode 13h Bresenham line/circle algorithms ** By Brian Dessent ** ** Written for Borland, modified for others by Bob Stout */ #include #include #include #include #include /* for randomize */ #ifndef __TURBOC__ #define random(num) (int)(((rand())*(long)(num))/(((long)RAND_MAX)+1)) #define randomize() srand((unsigned)time(NULL)|1) #else #endif #ifndef MK_FP #define MK_FP(seg,offset) \ ((void far *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #endif #define SCREEN_WIDTH 320 #define SCREEN_HEIGTH 200 #define MAX_X (SCREEN_WIDTH-1) #define MAX_Y (SCREEN_HEIGTH-1) /* prototypes */ void setmode(int mode); void plotdot(int x, int y, char c); void bresenham_line(int x, int y, int x2, int y2, char c); void bresenham_circle(int xc, int yc, int r, char c); void main(void); /* code begins */ /* uses BIOS to set video mode */ void setmode(int mode) { union REGS r; r.x.ax = mode; int86(0x10, &r, &r); } /* plots a dot at (x, y) with color c */ void plotdot(int x, int y, char c) { register char far *addr; if(x < 0 || x > MAX_X || y < 0 || y > MAX_Y) return; addr = MK_FP(0xa000, (SCREEN_WIDTH * y) + x); *addr = c; } /* draws a line from (x, y) to (x2, y2) in color c */ void bresenham_line(int x, int y, int x2, int y2, char c) { int i, steep = 0, sx, sy, dx, dy, e; dx = abs(x2 - x); sx = ((x2 - x) > 0) ? 1 : -1; dy = abs(y2 - y); sy = ((y2 - y) > 0) ? 1 : -1; if(dy > dx) { steep = 1; x ^= y; /* swap x and y */ y ^= x; x ^= y; dx ^= dy; /* swap dx and dy */ dy ^= dx; dx ^= dy; sx ^= sy; /* swap sx and sy */ sy ^= sx; sx ^= sy; } e = 2 * dy - dx; for(i = 0;i < dx;i++) { if(steep) plotdot(y, x, c); else plotdot(x, y, c); while(e >= 0) { y += sy; e -= 2 * dx; } x += sx; e += 2 * dy; } plotdot(x2, y2, c); } /* draws a circle at (xc, yc) with radius r in color c ** ** note: the scaling factor of (SCREEN_WIDTH / SCREEN_HEIGTH) is used when ** updating d. This makes round circles. If you want ellipses, you can ** modify that ratio. */ void bresenham_circle(int xc, int yc, int r, char c) { int x = 0, y = r, d = 2 * (1 - r); while(y > 0) { plotdot(xc + x, yc + y, c); plotdot(xc + x, yc - y, c); plotdot(xc - x, yc + y, c); plotdot(xc - x, yc - y, c); if(d + y > 0) { y -= 1; d -= (2 * y * SCREEN_WIDTH / SCREEN_HEIGTH) - 1; } if(x > d) { x += 1; d += (2 * x) + 1; } } } /* draws random lines and circles until a key is pressed in mode 13h */ /* (draws in colors 0 - 63 only) */ void main(void) { int i=0; randomize(); setmode(0x13); while(!kbhit()) { bresenham_line(random(SCREEN_WIDTH), random(SCREEN_HEIGTH), random(SCREEN_WIDTH), random(SCREEN_HEIGTH), i = ++i % 64); bresenham_circle(random(SCREEN_WIDTH), random(SCREEN_HEIGTH), random(50), i = ++i % 64); } getch(); setmode(0x03); /* set to color text mode, clearing screen */ } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/maze_1.c0000755000076400001440000001044007055334067015622 /* This program makes 10x10 mazes and prints them on the screen. No promise of portability is made, but it does seem to work on NS GNX C. Public Domain by Jonathan Guthrie. */ #include #include #include #define UP 1 #define DN 2 #define LT 4 #define RT 8 int addelem(int, int [12][12], int *, int, int); void openwall(int [12][12], int, int); void writemaze(int [12][12]); void main(void) { int i, j, base; int search[150], array[12][12]; for(i=1 ; i<11 ; ++i) { array[i][0] = -1; array[i][11] = -1; array[0][i] = -1; array[11][i] = -1; for(j=1 ; j<11 ; ++j) array[i][j] = 0; } srand((int)time(NULL)); i = rand() % 10 + 1; j = rand() % 10 + 1; base = addelem(0, array, search, i, j); array[i][j] = RT + RT; /* Not a valid value */ while(0 < base) { i = rand() % base; j = search[i]; search[i] = search[--base]; i = j % 100; j /= 100; openwall(array, i, j); base = addelem(base, array, search, i, j); } writemaze(array); } int addelem(int base, int maze[12][12], int *search, int row, int col) { if(0 == maze[row-1][col]) { search[base++] = row + col * 100 - 1; maze[row-1][col] = -DN; } else if(0 > maze[row-1][col]) maze[row-1][col] -= DN; if(0 == maze[row+1][col]) { search[base++] = row + col * 100 + 1; maze[row+1][col] = -UP; } else if(0 > maze[row+1][col]) maze[row+1][col] -= UP; if(0 == maze[row][col-1]) { search[base++] = row + col * 100 - 100; maze[row][col-1] = -RT; } else if(0 > maze[row][col-1]) maze[row][col-1] -= RT; if(0 == maze[row][col+1]) { search[base++] = row + col * 100 + 100; maze[row][col+1] = -LT; } else if(0 > maze[row][col+1]) maze[row][col+1] -= LT; return base; } void openwall(int maze[12][12], int row, int col) { int directions, max, direction, temprow, tempcol, temp, back; directions = -maze[row][col]; max = 0; if(directions & UP) { temp = rand(); if(temp > max) { max = temp; direction = UP; back = DN; temprow = row - 1; tempcol = col; } } if(directions & DN) { temp = rand(); if(temp > max) { max = temp; direction = DN; back = UP; temprow = row + 1; tempcol = col; } } if(directions & LT) { temp = rand(); if(temp > max) { max = temp; direction = LT; back = RT; temprow = row; tempcol = col - 1; } } if(directions & RT) { temp = rand(); if(temp > max) { max = temp; direction = RT; back = LT; temprow = row; tempcol = col + 1; } } maze[row][col] = direction; maze[temprow][tempcol] += back; } void writemaze(int maze[12][12]) { int i, j; puts("*********************"); for(i=1 ; i<11 ; ++i) { putchar('*'); for(j=1 ; j<11 ; ++j) { putchar(' '); if(maze[i][j] & RT) putchar(' '); else putchar('*'); } putchar('\n'); for(j=1 ; j<11 ; ++j) { putchar('*'); if(maze[i][j] & DN) putchar(' '); else putchar('*'); } puts("*"); } } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/maze_2.c0000755000076400001440000000035707055334067015631 int a[1817];main(z,p,q,r){for(p=80;q+p-80;p-=2*a[p])for(z=9;z--;)q=3&(r=time(0)+r*57)/7,q=q?q-1?q-2?1-p%79?-1:0:p%79-77?1:0:p<1659?79:0:p>158?-79:0,q?!a[p+q*2]?a[p+=a[p+=q]=q]=q:0:0;for(;q++-1817;)printf(q%79?"%c":"%c\n"," #"[!a[q-1]]);} c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/maze_3.c0000755000076400001440000000070007055334067015622 char*M,A,Z,E=40,J[40],T[40];main(C){for(*J=A=scanf(M="%d",&C); -- E; J[ E] =T [E ]= E) printf("._"); for(;(A-=Z=!Z) || (printf("\n|" ) , A = 39 ,C -- ) ; Z || printf (M ))M[Z]=Z[A-(E =A[J-Z])&&!C & A == T[ A] |6<<11 #include #include #include #include #include /**** init_globals(fp, names, types, ...) ** ** public domain by Raymond Gardner Sept. 1991 ** ** fp is a FILE * to the (already fopen'ed) file containing ** initialization data ** names is a space-separated list of names of globals (as they ** are to appear in the data file) ** types is a list of datatype characters, corresponding to names ** i for a pointer to integer ** s for a pointer to string (already allocated char array) ** p for a pointer to pointer to char (space will be malloc'd) ** (NOTE: no whitespace allowed in types !!) ** followed by var arg list of pointers to variables to init */ #define LNSZ 256 int init_globals(FILE *fp, char *names, char *types, ...) { char ln[LNSZ]; char *p; va_list arglist; char *namep, *typep, name[40], *e; void *argp; int k; while ( fgets(ln, LNSZ, fp) ) { /* read init file */ while ( isspace(ln[0]) ) /* drop leading whitespace */ memmove(ln, ln+1, strlen(ln)); if ( ln[0] == 0 ) /* skip if blank line */ continue; p = strchr(ln, '='); /* find equal sign */ if ( p == NULL ) /* error if none */ return -1; /* or continue; */ while ( p > ln && isspace(p[-1]) ) { /* remove whitespace */ memmove(p-1, p, strlen(p-1)); /* before = sign */ --p; } *p++ = 0; /* plug EOS over = sign */ while ( isspace(p[0]) ) /* remove leading space on */ memmove(p, p+1, strlen(p)); /* init string */ k = strlen(p) - 1; /* init string length */ if ( k < 1 ) return -1; if ( p[k] != '\n' ) /* if '\n' is missing, input */ return -1; /* exceeded buffer; error return */ p[k] = 0; /* plug EOS over newline */ va_start(arglist, types); /* setup for arglist search */ namep = names; /* init ptr to var names */ typep = types; /* init ptr to var types */ while ( *namep == ' ' ) /* skip blanks before namelist */ ++namep; while ( *typep ) { /* while any typelist items left...*/ argp = (void *)va_arg(arglist, void *); /* get var arg */ k = strcspn(namep, " "); /* length of namelist entry */ memmove(name, namep, k); /* put into name hold area */ name[k] = 0; /* terminate it */ if ( strcmp(name, ln) != 0 ) { /* if it doesn't match... */ namep += k; /* get next name */ while ( *namep == ' ' ) ++namep; ++typep; /* get next type */ } else { /* else name is found... */ if ( *typep == 'i' ) { /* if it's an int, init it */ *(int *)argp = atoi(p); } else if ( *typep == 's' || *typep == 'p' ) { if ( *p == '"' ) { /* is string in quotes? */ ++p; /* skip leading quote, and */ e = strchr(p, '"'); /* look for trailing quote */ if ( e ) /* terminate string if found */ *e = 0; } if ( *typep == 'p' ) { /* if it's a char *ptr */ e = malloc(strlen(p) + 1); /* get space */ if ( e == 0 ) { /* error if no space */ return -1; /* call va_end(arglist); first? */ } *(char **)argp = e; strcpy(*(char **)argp, p); /* copy in string */ } else /* must be char array */ strcpy(argp, p); /* copy in string */ } else { return -1; /* bad type */ } break; /* break search; get next line */ } } va_end(arglist); } return 0; } #ifdef TEST int foo; char bar[80]; int baz; char *quux; int main(int argc, char **argv) { FILE *fp; int k; if ( argc < 2 ) { fprintf(stderr, "missing arg\n"); exit(1); } fp = fopen(argv[1], "r"); assert(fp); k = init_globals(fp, "foo bar baz quux", "isip", &foo, bar, &baz, &quux); printf("k: %d\n", k); printf("foo: %d\nbar: <%s>\nbaz: %d\nquux: <%s>\n", foo, bar, baz, quux); fclose(fp); return 0; } #endif /* test data file: foo=123 bar = "a test" baz = 456 quux= what is this */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/iswprot.c0000755000076400001440000000347707055334026016164 /* ** ISWPROT.C - Detect if floppy drive is write protected ** ** public domain by Bob Stout w/ corrections & additions by Wayne King */ #include #ifdef __TURBOC__ #define FAR far #else #define FAR _far #endif /* ** isWprot() ** ** Parameters: 1 - Drive number (A: = 0, B: = 1) ** ** Returns: -1 - Error ** 0 - Not write protected ** 1 write protected ** ** Note: If drive door is open, an error is returned but the critical ** error handler is NOT tripped */ int isWprot(int drive) { union REGS regs; struct SREGS sregs; char buf[512], FAR *bufptr = (char FAR *)buf; /* Needed by MSC */ /* First read sector 0 */ segread(&sregs); regs.x.ax = 0x201; regs.x.cx = 1; regs.x.dx = drive & 0x7f; sregs.es = FP_SEG(bufptr); regs.x.bx = FP_OFF(bufptr); int86x(0x13, ®s, ®s, &sregs); if (regs.x.cflag && regs.h.ah != 6) { regs.h.ah = 0x00; /* reset diskette subsystem */ regs.h.dl = drive & 0x7f; int86x(0x13, ®s, ®s, &sregs); return -1; } /* Try to write it back */ segread(&sregs); regs.x.ax = 0x301; regs.x.cx = 1; regs.x.dx = drive & 0x7f; sregs.es = FP_SEG(bufptr); regs.x.bx = FP_OFF(bufptr); int86x(0x13, ®s, ®s, &sregs); return (3 == regs.h.ah); } #ifdef TEST #include #include int main(int argc, char *argv[]) { int drive; if (2 > argc) { puts("Usage: ISWPROT drive_letter"); return -1; } drive = toupper(argv[1][0]) - 'A'; printf("isWprot(%c:) returned %d\n", drive + 'A', isWprot(drive)); return 0; } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/coldboot.asm0000755000076400001440000000207407055333705016613 ; by: David Nugent via ECPROG echo ; ; works VERY reliably under all the protected mode environments I've ; tried (namely DV and PC-MOS). Haven't tried VM386 or NX386 yet, but ; I'm hopeful.... ;-) BIOS_POST equ 0472H ; POST (warm boot) flag xor BX,BX ; AL=1 for warm boot, 0 for cold mov ES,BX cmp AL,1 jnz @NcB mov AX,1234H ; Avoid POST @NcB: mov ES:[BIOS_POST],AX ; Install flag cli ; Reboot xor AX,AX mov DS,AX mov ES,AX mov SS,AX mov SP,AX @cP: in AL,64H ; Wait on AT keyboard controller test AL,2 jne @cP xor AL,AL ; Try reset lines out 64H,AL iodelay mov AL,0FEh out 64H,AL iodelay mov AX,0002H ; Jump to reset vector push AX ; via IRET mov AX,0F000H push AX mov AX,0FFF0H push AX iret c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ltoa.c0000755000076400001440000000273607055334046015413 /* ** LTOA.C ** ** Converts a long integer to a string. ** ** Copyright 1988-90 by Robert B. Stout dba MicroFirm ** ** Released to public domain, 1991 ** ** Parameters: 1 - number to be converted ** 2 - buffer in which to build the converted string ** 3 - number base to use for conversion ** ** Returns: A character pointer to the converted string if ** successful, a NULL pointer if the number base specified ** is out of range. */ #include #include #define BUFSIZE (sizeof(long) * 8 + 1) char *ltoa(long N, char *str, int base) { register int i = 2; long uarg; char *tail, *head = str, buf[BUFSIZE]; if (36 < base || 2 > base) base = 10; /* can only use 0-9, A-Z */ tail = &buf[BUFSIZE - 1]; /* last character position */ *tail-- = '\0'; if (10 == base && N < 0L) { *head++ = '-'; uarg = -N; } else uarg = N; if (uarg) { for (i = 1; uarg; ++i) { register ldiv_t r; r = ldiv(uarg, base); *tail-- = (char)(r.rem + ((9L < r.rem) ? ('A' - 10L) : '0')); uarg = r.quot; } } else *tail-- = '0'; memcpy(head, ++tail, i); return str; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/isisbn.c0000755000076400001440000000077107055334023015733 /* ** ISISBN.C - Validate International Standard Book Numbers (ISBNs) ** ** public domain by Maynard Hogg */ #include int isbn2(char *str) { int i = 0; int test = 0; int c; while ('\0' != (c = *str++)) { if (isdigit(c)) c -= '0'; else if (i == 9 && 'X' == c) c = 10; else continue; test += c * ++i; } return (i == 10 && test % 11 == 0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/myio.h0000755000076400001440000000524207055334116015427 // Myio.h // Specialised I/O class to demonstrate use of C++ iostream // facilities in a customised environment // Written by David L Nugent, June 1993. // # if !defined(_Myio_h) # define _Myio_h 1 // Foward declare classes class Myio; class Mystreambuf; class Mystreambase; class Mystream; // Forward declare iostream classes class iostream; // // class Myio // This is a simplistic class which simply fields // input and output to a simulated stream device. // // In fact, it doesn't really do much at all other // than read input from and send output to a // circular queue, as though talking via a loopback // pipe to itself. // class Myio { friend class Mystreambuf; public: Myio (int sz =2048); // sz = buffer size to allocate virtual ~Myio (void); iostream & stream (void); // Return (or create) stream int readok (void) const; // Underflow check int writeok (void) const; // Overflow check int gcount (void) const; // Get # of chrs last read int pcount (void) const; // Get # of chrs last written int count (void) const; // Get # of chrs in buffer int size (void) const; // Get size of buffer int dump (void) const; // Debugging - dumps buffer int write (char const * buf, int len); // Put data into 'pipe' int read (char * buf, int max); // Read data from our 'pipe' private: enum { overflow = 0x0001, // Last write only partial underflow = 0x0002 // Last read only partial }; unsigned stat; // Last read/write status int _pcount; // Last write count int _gcount; // Last read count int bufsize; // Size of our buffer int bufchars; // Chrs in buffer now int bufidx; // Index into buffer (next put) char * bufaddr; // Pointer to buffer Mystream * mystream; // Stream assocated with this object }; inline int Myio::readok (void) const { return ((stat & Myio::underflow) == 0); } inline int Myio::writeok (void) const { return ((stat & Myio::overflow) == 0); } inline int Myio::gcount (void) const { return _gcount; } inline int Myio::pcount (void) const { return _pcount; } inline int Myio::count (void) const { return bufchars; } inline int Myio::size (void) const { return bufsize; } # endif // _Myio_h c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/big_mall.h0000755000076400001440000000063707055333646016232 /* ** void _far *BigMalloc(unsigned long num_elem, size_t size_elem) */ #ifdef MSDOS #if defined(__TURBOC__) || defined(__ZTC__) #ifdef __TURBOC__ #define _far far #endif #define BigMalloc(i,n) (void _far *)farmalloc(i*n) #else /* MSC, Watcom */ #define BigMalloc(i,n) (void _far *)halloc(i,n) #else #define BigMalloc(i,n) malloc(i*n) #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/vfname.c0000755000076400001440000001465407055334317015733 /* ** VFNAME.C */ #include #include #include #ifdef TRUE #undef TRUE #endif #ifdef FALSE #undef FALSE #endif #ifdef ERROR #undef ERROR #endif enum LOGICAL {ERROR = -1, SUCCESS, FALSE = 0, TRUE}; #if defined(__TURBOC__) #include #endif #if !defined( MAXFILE ) #define MAXFILE 9 #endif #define NUL '\0' /* ** Prototypes */ int valid_fname (char *fname, int wild_check); /* ** valid_fname.c ** ** Verifies whether a filename is valid or invalid without ** altering the passed filename itself. ** ** Note that only filenames are validated. Path and drive specs ** need to be separately validated. See FLN_FIX.C in SNIPPETS. ** ** Arguments: 2 - fname = a char array MAXFILE long ** wild_check: 0 means wildcard use okay ** any other value means test for ** wildcards which are not acceptable ** ** Returns: ERROR - fname is invalid ** SUCCESS - fname is valid ** ** Side effects: none ** ** Speed: 1) Turbo Profiler rates valid_fname at 0.0004 sec/call ** on an Intel 80286. ** 2) Token testing from both ends to center yields a slight ** improvement. ** ** Notes: Space, ASCII character 32, is a special case. Dos will ** write a filename or volume label that includes a space. ** Getting access to that file, afterwards, is not always ** easy :) For my purposes, space is an invalid filename ** token. You? You're on your own :) ** ** Uses strnicmp() and stricmp(), non-ISO/ANSI, but available on ** all DOS C compilers (MSC, BC++, SC++ WC, etc.) ** ** Revisions: 1) Dropped str2upper after comment by David Johnson ** on 07-17-93 ** 2) Added [] to token list after comment by Ed ** Kowalski on 07-17-93 ** 3) Added lpt1-lpt3, com1-com4 and clock$ to ** invalid name list after comment by Ed ** Kowalski on 07-17-93 ** 4) Eliminated double exit points after my own ** comment to Bob Stout :) on 07/22/1993 ** 5) Revisions to detect DOS extension errors on 03/13/94 ** ** Public domain by Sid Rogers and Bob Stout ** */ int valid_fname(char *fname, int wild_check) { /* invalid filename tokens */ static char invalid_tokens[] = "\0 ,;:|\\/<>\"+=[]*?"; static int itoklen = sizeof(invalid_tokens) - 1; /* invalid file names -- even with extension .xxx */ static char *invalid_3lnam[]={"AUX","CON","PRN","NUL","COM",NULL}; /* other invalid file & directory names */ static char *invalid_4lnam[]={"LPT1","LPT2","LPT3","COM1", "COM2","COM3","COM4",NULL}; static char *invalid_6lnam = "CLOCK$"; int num_toks, fl, i, j, k, proceed = 0; char *p; /* Handle the critical stuff first */ for (i = 0; invalid_3lnam[i]; ++i) { if (SUCCESS == strnicmp(fname, invalid_3lnam[i], 3)) proceed = ERROR; } /* Handle extensions next */ if (ERROR != proceed && NULL != (p = strchr(fname, '.'))) { if (3 < strlen(p+1) || NULL != strchr(p+1, '.')) proceed = ERROR; if (8 < (p - fname)) proceed = ERROR; } if (ERROR != proceed) { if (p) *p = NUL; for (i = 0; invalid_4lnam[i]; ++i) { if (SUCCESS == stricmp(fname, invalid_4lnam[i])) proceed = ERROR; } if (SUCCESS == stricmp(fname, invalid_6lnam)) proceed = ERROR; if (p) *p = '.'; else if (8 < strlen(fname)) proceed = ERROR; } fl = strlen(fname); /* process filename for invalid tokens */ if (ERROR != proceed) { if (wild_check) num_toks = itoklen; /* wildcards invalid */ else num_toks = itoklen - 2; /* wildcards ok */ for (i = -1, j = 0; i < 0 && j < num_toks; j++) { for (k = 0; k < fl; k++) if(invalid_tokens[j] == fname[k]) i=j; } if (i >= 0) proceed = ERROR; } return proceed; /* single exit point */ } #ifdef TEST /* ** Revised function test - Performs standard tests and then validates ** filenames passed on the command line. */ main(int argc, char *argv[]) { static char *name_test[]= {"aaa","aux","con","prn","nul","lpt1", "lpt2", "lpt3","com1","com2","com3", "com4","bbbb", "clock$","com.c", "cccccc",NULL}; static char *token_test[]={"00fname.","01 fname","02fname,", "03fname[", "04fname;","05fname:", "06fname|","07fname/", "08fname<", "09fname>","10fname+","11fname=", "12fname\\","13fname\"","14fname]", "15fname*", "16fname?","filename", NULL}; char fname[MAXFILE]; int i; for (i = 0; name_test[i]; ++i) { strcpy(fname,name_test[i]); printf("%6s is %s\n",fname, valid_fname(fname,0) ? "INvalid" : "Valid"); } puts("\nHit a key"); getch(); puts("\n[Wildcards not allowed]\n"); for (i = 0; token_test[i]; ++i) { strcpy(fname,token_test[i]); printf("%s is %s\n",fname, valid_fname(fname,1) ? "INvalid" : "Valid"); } puts("\nHit a key"); getch(); puts("\n[Wildcards allowed]\n"); for (i = 0; token_test[i]; ++i) { strcpy(fname,token_test[i]); printf("%s is %s\n",fname, valid_fname(fname,0) ? "INvalid" : "Valid"); } puts("\nHit a key"); getch(); while (--argc) { strcpy(fname, *(++argv)); printf("%s is %s\n",fname, valid_fname(fname,1) ? "INvalid" : "Valid"); } return 0; } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ltostr.c0000755000076400001440000000276007055334046016000 /* ** LTOSTR.C -- routine and example program to convert a long int to ** the specified numeric base, from 2 to 36. ** ** Written by Thad Smith III, Boulder, CO. USA 9/06/91 ** and contributed to the Public Domain. */ #include char * /* addr of terminating null */ ltostr ( char *str, /* output string */ long val, /* value to be converted */ unsigned base) /* conversion base */ { ldiv_t r; /* result of val / base */ if (base > 36) /* no conversion if wrong base */ { str = '\0'; return str; } if (val < 0) *str++ = '-'; r = ldiv (labs(val), base); /* output digits of val/base first */ if (r.quot > 0) str = ltostr (str, r.quot, base); /* output last digit */ *str++ = "0123456789abcdefghijklmnopqrstuvwxyz"[(int)r.rem]; *str = '\0'; return str; } #include main() { char buf[100], line[100], *tail; long v; int inbase, outbase; for (;;) { printf ("inbase, value, outbase? "); fgets (line, sizeof line, stdin); sscanf (line, " %d%*[, ]%[^, ]%*[, ]%d", &inbase, buf, &outbase); if (inbase == 0) break; /* exit if first number 0 */ v = strtol (buf, &tail, inbase); ltostr (buf, v, outbase); printf ("=%ld (10) = %s (%d).\n", v, buf, outbase); }; return 0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/pcnvrt.c0000755000076400001440000000120507055334131015751 /* ** demo code for converting Pascal strings to/from C strings ** ** public domain by Bob Stout */ #include typedef unsigned char UCHAR; #define P2Cconvert(s) {UCHAR n = *(s); memmove((s), &(s)[1], n); s[n] = '\0';} #define C2Pconvert(s) {int n = strlen(s); memmove(&(s)[1], (s), n); *(s) = n;} #if (0) /* Demo code fragment follows */ char string[81]; fgets(string, 81, inFile); /* get 80-char pascal string */ P2Cconvert(string); /* convert it in place */ C2Pconvert(string); /* convert back */ #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/which_c.txt0000755000076400001440000003420207055334340016443 Q: Which PC C/C++ compiler is best and what should I buy? A: This is perhaps the commonest of Frequently Asked Questions (FAQ's), especially by beginning C'er. The honest answer is that there is no "best" compiler and what may be best for you depends to a large degree on what you'll be using it for. The PC C/C++ compiler market is quite brutal and the companies that have survived have done so because some number of people think each of them makes the "best" compiler. With the preceding caveat in mind, following are some summaries of the current crop of C/C++ compilers with some of their strengths and weaknesses. Additional recommended reading are the C/C++ compiler reviews appearing in PC Magazine. PC Mag's reviews for many years were highly slanted and suspect, but in the past 2 years, have become commendably objective and even-handed. MIX POWER C ----------- Power C is the least expensive PC C compiler on the market. The compiler itself is $20, and an additional $30 will buy their source-level debugger along with the complete library source code with an assembler. So, what's the catch? None, actually. Power C is a quite decent and ANSI-conforming compiler which compiles relatively tight, fast code relatively quickly. It's biggest drawback is its use of a non-standard object file format which obviates object-level compatibility with any other compiler using Microsoft/Intel standard object file formats. Another problem is lack of support from 3rd party library vendors. Although Mix sells a wide range of libraries themselves, it's difficult to convince a vendor to produce a $100 add-on library for a $20 compiler. On the plus side, Power C comes with the best user's manual for students in the business. The beginner's tutorial section has enabled many beginning C programmers to get up to speed without spending another dime on any other textbooks. Should you want more instruction, Mix sells a package including Power C with the library source and debugger along with the book "Master C" for only $60. Power C's primary technical claim to fame is its floating point which challenges the industry leader, Watcom, in many cases. It's also the only remaining C compiler which can run effectively on small or older machines without extended memory (SC++ can also, but is limited to *very* small programs). MICROSOFT VISUAL C++ (VC++) --------------------------- Microsoft's professional compiler now comes in two versions with the same name. The profession version replaces Microsoft C/C++, version 7.0. The regular version replaces Microsoft Quick C for Windows. The primary difference is the price and the extras since each requires at least a 386 processor, 4 Mb of *available* extended memory, and a DPMI server such as Windows 3.1. If you don't have the machine resources, you can't use VC++. On the plus side, VC++ is an excellent C++ compiler and generates executables which may not always be smaller than Borland, but usually execute faster. Microsoft's C compilers are still the standard for PC C compilers and it shows in the ready availability of 3rd party libraries supporting it. Support for Windows programming is excellent with tools only rivaled by SC++ (which is shipped with licensed copies of VC++'s MFC 2.0 class library). Compile times with full optimization are still quite sluggish, but using the quick compile option can be provide acceptable results. BORLAND C++ (BC++) ------------------ BC++ carries on Borland's tradition of providing excellent bang for the buck. The latest release (3.1) of their professional compiler is an attractive alternative to shops also considering VC++. BC++ isn't as demanding as VC++ and only requires a 286 and 2 Mb of *available* extended memory to run. A full 32-bit version is currently available for OS/2 2.1. Windows programming support is also quite good, but has been leapfrogged somewhat by VC++ and SC++ for the time being. Borland's tools are uniformly excellent, but the compiler still suffers a bit in comparison to the industry's technological leaders, Microsoft, Watcom, and Symantec - although the gap is closing. As with VC++, it's an excellent C++ compiler and enjoys widespread support among 3rd party library vendors. Like all Borland compilers, ease of use was a design priority, all oriented to the excellent IDE. Borland recently alienated many of their loyal customers with the release of BC++ 4.0. In addition to the normal version x.0 bugs that we all expect, the new version came with no DOS IDE, vastly slower compilation times (with no apparent increase in optimization to justify the slowdown), and an odious new license agreement that their lawyers quickly rescinded in the face of the massive desertion of corporate clients. They're working hard to get folks to like them again, but for the first time in their corporate life, they have seriously dissatisfied customers and aren't quite sure how to handle it. TURBO C++ (TC++) ---------------- TC++ is to Borland's C++ compiler targeted at the hobbyist market. The latest version (TC++ 3.1) raised quite a stir when Borland released it requiring at least a 286 processor and 1 Mb of *available* extended memory above the normal 640K DOS limit. Many hobbyists running on older XT's, or machines without the excess memory capacity have therefore failed to upgrade to the new release. If you have the machine to support it, TC++ has the usual Borland attributes of extreme ease-of-use, attractive Integrated Development Environment (IDE), and good supporting tools. Based on the facts of BC++ 4.0 cited above, it has become the compiler of choice for many Borland loyalists. SYMANTEC C++ (SC++) ------------------- Symantec C++ (nee Zortech C++) was the industry's first C++ compiler, but fell behind in tracking the C++ language spec. Bought out by Symantec in 1991, the C compiler was always excellent and now its C++ compiler rates among the best. SC++ supports DOS, Mac, Unix, Win32s, and NT (OS/2 was supported in previous Zortech releases and may be again) using an extremely powerful new object- oriented Windows-hosted IDE. It includes excellent libraries and add-ons including a TSR library, swapping spawn functions, a royalty-free 32-bit DOS extender, and an excellent set of ancillary C and C++ tools libraries including MFC 2.0 as previously noted. VC++ can generate true 32-bit code and has a switch for generating Pentium code. At the same time that Symantec bought Zortech, they also bought Multiscope, whose debuggers are included in the package. As with VC++, SC++ includes excellent tools for quickly developing Windows applications. SC++ has always been in the forefront of optimizer technology along with Microsoft and Watcom. A major feature is full IEEE-754 and NCEG (Numerical C Extensions Group (an ANSI working committee trying to make C a suitable replacement for FORTRAN) compatibilty. The only negative for the current release is a poor reputation which arose largely during the period following the Symantec acquisition of Zortech. With 6.1, these now appear mostly fixed. With the 6.1 release, support of DOS graphics has been dropped, but an updated version of the excellent Flash Graphics package shipped with the Zortech versions is available from FlashTek, which also supplies improved verions of the 32-bit DOS extender and the pre-Symantec debugger. One caveat - if you got the 6.0 release, be sure to get the free 6.1 update! WATCOM C/C++ (WC++) ------------------- Watcom is the technological industry leader, performing feats of optimization and floating point speed other vendors only dream of. The cost is compile speed, which has been described (somewhat unfairly) as glacial. For all its technical excellence, WC++ is still a niche market compiler like SC++. As such, it's 3rd party support is poor, but many have found that Microsoft C libraries will work just fine with WC++. Like SC++, and unlike BC++ and VC++, WC++ provides documented support for embedded systems work, although not to nearly the same degree as Metaware (see below). Also, like SC++, WC++ supports 32-bit code generation. WC++ is the compiler of choice for many OEMs, such as Novell, who want only the best supporting code for their products. MSC/VC++ compatibility is excellent, but watch out for Watcom's sensitivity to proper _cdecl declarations, implemented in Watcom via a pragma rather than as a built-in language feature. Watcom sells both 16- and 32-bit versions of its C/C++ compiler. The best deal is to buy the 32-bit compiler and then purchase the 16-bit upgrade pack. Where Watcom really shines is its support for a multitude of environments with the same compiler(s). Supported are DOS, Win3.1, Win32s, NT, OS/2 (1.x & 2.x), Netware 386, AutoCAD ADS, QNX, Phar Lap and Rational DOS extenders. With such a bewildering array of targets, compilation is relatively straightforward but the linker has a steep learning curve. Watcom remains the only one of the "big name" compilers to not ofer an IDE, if that's important to you or you don't own a "real" programmer's editor. METAWARE HIGH-C/C++ (HC++) -------------------------- HC++ is the darling of some segments of the embedded systems market. As such, it's a lot like WC++, only not quite as good and a lot weirder since it offers detailed control over every aspect of the executable. Most WC++ comments apply, except for the ones relating to quality of generated code. HC++'s code is quite good, but seems to be showing its niche market orientation (any one remember Manx Aztec C?) TOPSPEED C/C++ (TSC++) ---------------------- TSC++ has had a rocky life, getting off to a late start in the market and never having really quite caught on. Originally, TSC++ was a Turbo C clone which shared tools and environments with its sister Modula-2 compiler. More recent versions have extended this by using a modular approach with an environment supporting "plug-in" compilers for various languages which can all be used together. The company was recently acquired by Clarion. TSC++'s undisputed biggest strength is its smart linker and various features added to facilitate mixed-language programming (Modula-2, for example, supports multi-threaded code). Using this technology, you can count on TSC++ to almost always produce the smallest executables for a given piece of source code. The library, written almost exclusively in assembly, is also excellent and contributes to the frugal use of run-time memory. Unfortunately, compiler-generated code is typically not of the same quality. Drawbacks include almost non-existant 3rd party support and the pervasive IDE which feels more at home to Modula-2 programmers than C programmers. GNU C/C++ (GCC, G++) -------------------- Available from the Free Software Foundation, GCC and G++ are the only compilers listed here available for free without a guilty conscience. Originally written for Unix systems, there are several DOS ports available, all of which require some sort of DOS extender technology built-in in order to work in DOS's limited memory. OS/2 ports obviously don't share this limitation. Along with SC++, WC++, and HC++, the gnu compilers round out the list of full ISO/ANSI/ARM compilers with explicit support for embedded systems. Performance is decent, but not earth-shattering, and executable tends to exhibit lots of bloat. If you plan to use one of these to write commercial code, be sure and read the license agreement *very* closely. DUNFIELD MICRO-C ---------------- There have been many "small" or "tiny" C's over the years, some useful for teaching the rudiments of compiler construction, others not much use for anything. Small C's typically lack structs, unions, bit fields, and even long integers. Why bother listing this one then? First of all, Micro-C is an evolving product which, as of version 3, now includes many features such as structs and unions not normally associated with small C's. Also, the source code (available when you register the shareware version) is quite decent and really can teach you something about compiler internals. But Micro-C is genuinely useful for a lot more reasons. The author also produces cross-assemblers for a variety of microprocessors and provides plug-in code generators for his C compiler to use with those chips as well. The 80x86 version comes ready to compile either PC or embedded code. Included in the PC library are support for writing TSR's, interrupt- driven serial I/O, and screen windowing. Amazingly, it also sports an optimizer, but requires MASM or equivalent for compiling PC applications. Supporting small and tiny model only, Micro-C executables are phenomenally small. "Hello world" programs that run 5-6K on other compilers run under 600 bytes when compiled with Micro-C. One other point needs to be mentioned with respect to Micro-C... Although it is *a* small C, it has no code commonality with *the* Small C from the book of the same name. This is important since there are a number of variants of Small C available, all not much better than the original. Micro-C, OTOH, was written by Dave Dunfield completely from scratch and is a *much* better designed piece of code and certainly much more instructive to fledgling compiler writers. His better design is evinced in code quality and execution speed. PCC --- The Personal C Compiler is available as shareware. It used to be marketed as the deSmet C compiler and had a generally good reputation for quick compile times and tight code. Unfortunately, the product hasn't been seriously upgraded in quite a while and can't stand too much comparison. It's horribly non-ANSI compliant, has a weaker set of library functions than Micro-C, features non-standard file formats, and is generally incompatible with most published C code If price is your concern, Mix Power C costs less to buy than PCC and offers better performance along with the ANSI compliance that PCC lacks. If you plan on using an unregistered copy, Gnu C/C++ are vastly superior and are legally free. If you're attracted to its tight, fast code and can live with quirks and without ANSI compliance, go with Dunfield Micro-C. c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/isxkbrd.c0000755000076400001440000000217407055334026016114 /* ** ISXKBRD.C - public domain by Ed Kowalski. ** ** isxkeybrd() - detects enhanced kbd */ #include /* ** Check for enhanced keyboard support. */ int isxkeybrd(void) { union REGS rg; unsigned kbdflags; rg.h.ah = 0x02; /* check BIOS supports enhanced kbd */ int86(0x16, &rg, &rg); /* get kbd flags */ kbdflags = rg.h.al; /* mess 'em up, get enhanced flags */ rg.x.ax = 0x1200 + kbdflags ^ 0xff; int86(0x16, &rg, &rg); if (rg.h.al == kbdflags) /* BIOS supports enhanced keyboard */ { /* if bit 4 at 40:96h is set machine has an enhanced kbd */ if ((*(( char far *) 0x400096L) & 0x10)) return 1; /* enhanced keyboard present */ } return 0; /* don't use enhanced keyboard calls */ } #ifdef TEST #include main() { if (isxkeybrd()) puts( "Enhanced Keyboard supported" ); else puts( "Enhanced Keyboard NOT supported "); return 0; } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/prtscrn.c0000755000076400001440000000173107055334153016140 /* ** PRTSC.C - Access the BIOS print screen function ** ** public domain demo by Bob Stout */ #include #ifdef __TURBOC__ #define FAR far #else #define FAR _far #endif /* ** Get screen printing status ** ** 0 - Ready ** 1 - Screen printing in process ** 2 - Error occurred last time */ int PrtScrnStat(void) { return ((int)*((char FAR *)(0x00500000))); } /* ** Print the current screen */ int PrtScrn(void) { union REGS regs; /* Dummy for use by int86() */ if (1 == PrtScrnStat()) /* Can we print now? */ return -1; /* Nope, return with error */ int86(5, ®s, ®s); /* Issue Int 5 */ return 0; } #ifdef TEST #include void main(void) { printf("PrtScrn() returned %d\n", PrtScrn()); printf("PrtScrnStat() returned %d\n", PrtScrnStat()); } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ll_qsort.c0000755000076400001440000000762107055334040016303 /*========== SNIP SNIP SNIP ==========*/ /* SORT.H */ void *sortl(void *list, void *(*getnext)(void *), void (*setnext)(void *, void *), int (*compare)(void *, void *)); /*========== SNIP SNIP SNIP ==========*/ /* SORT.C */ #include #include "sort.h" /* This is a quicksort routine to be used to sort linked-lists by Jon Guthrie. */ void *sortl(list, getnext, setnext, compare) void *list, *(*getnext)(void *), (*setnext)(void *, void *); int (*compare)(void *, void *); { void *low_list, *high_list, *current, *pivot, *temp; int result; /* Test for empty list. */ if(NULL == list) return(NULL); /* Find the first element that doesn't have the same value as the first element. */ current = list; do { current = getnext(current); if(NULL == current) return(list); } while(0 == (result = compare(list, current))); /* My pivot value is the lower of the two. This insures that the sort will always terminate by guaranteeing that there will be at least one member of both of the sublists. */ if(result > 0) pivot = current; else pivot = list; /* Initialize the sublist pointers */ low_list = high_list = NULL; /* Now, separate the items into the two sublists */ current = list; while(NULL != current) { temp = getnext(current); if(compare(pivot, current) < 0) { /* add one to the high list */ setnext(current, high_list); high_list = current; } else { /* add one to the low list */ setnext(current, low_list); low_list = current; } current = temp; } /* And, recursively call the sort for each of the two sublists. */ low_list = sortl(low_list, getnext, setnext, compare); high_list = sortl(high_list, getnext, setnext, compare); /* Now, I have to put the "high" list after the end of the "low" list. To do that, I first have to find the end of the "low" list... */ current = temp = low_list; while(1) { current = getnext(current); if(NULL == current) break; temp = current; } /* Then, I put the "high" list at the end of the low list */ setnext(temp, high_list); return(low_list); } /* mergesort linked lists by Ray Gardner */ /* split list into 2 parts, sort each recursively, merge */ void *sortl(p, getnext, setnext, compare) void *p, *(*getnext)(void *), (*setnext)(void *, void *); int (*compare)(void *, void *); { void *q, *r, *head; if ( p ) { /* first split it */ r = p; for ( q = getnext(r); q && (q = getnext(q)) != NULL; q = getnext(q) ) r = getnext(r); q = getnext(r); setnext(r, NULL); if ( q ) { /* now sort each sublist */ p = sortl(p, getnext, setnext, compare); q = sortl(q, getnext, setnext, compare); if ( compare(q, p) < 0 ) { /* smallest item becomes list head */ head = q; q = getnext(q); } else { head = p; p = getnext(p); } for ( r = head; p && q; ) { /* now merge the lists under head */ if ( keycmp(q, p) < 0 ) { setnext(r, q); r = q; q = getnext(q); } else { setnext(r, p); r = p; p = getnext(p); } } setnext(r, (p ? p : q)); /* append the leftovers */ p = head; } } return p; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cmdline.c0000755000076400001440000000123207055333704016055 /* ** CMDLINE.C - Demonstrates accessing command line arguments */ #include #define plural_text(n) &"s"[(1 == (n))] #define plural_text2(n) &"es"[(1 == (n)) << 1] main(int argc, char *argv[]) { int i, n = argc - 1; printf("You passed %d argument%s on the command line.", n, plural_text(n)); if (argc > 1) { puts(" They are:"); for (i = 1; i < argc; ++i) { printf("\nArgument #%d:\n Text: \"%s\"\n Value: %d\n", i, argv[i], atoi(argv[i])); } } else putchar('\n'); return 0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/prtstat.c0000755000076400001440000000235107055334153016145 /* ** PRTSTAT.H - Header file for PRTSTAT.C */ #ifndef PRTSTAT_H #define PRTSTAT_H struct PrStatus { unsigned int timeout : 1; unsigned int unused : 2; unsigned int IOerror : 1; unsigned int selected : 1; unsigned int paperout : 1; unsigned int ack : 1; unsigned int notbusy : 1; }; int prtstat(unsigned int); #endif /*** End of PRTSTAT.H *******************************************************/ /* ** PRTSTAT.C - Determine printer status ** ** public domain by Bob Stout */ #include #ifndef PRTSTAT_H #include "prtstat.h" #endif /* ** prtstat() - Call with printer number (0 = LPT1, 1 = LPT2, 2 = LPT3) ** ** Returns status which can be mapped to a PrStatus struct */ int prtstat(unsigned int printer_no) { union REGS regs; regs.h.ah = 2; regs.x.dx = printer_no; int86(0x17, ®s, ®s); return regs.h.ah; } #ifdef TEST #include #define show(x) printf(#x" is %strue (LPT1)\n", mystat.x ? "" : "not "); void main(void) { struct PrStatus mystat; *((int *)&mystat) = prtstat(0); show(notbusy); show(selected); show(paperout); } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/checkexe.c0000755000076400001440000000642107055333700016222 /* ** CHECKEXE.C - checksum protection for executable files ** ** by: Bob Jarvis */ #include #include #include #include static struct { unsigned char marker[16]; unsigned long checksum; } marker_struct = {"CHECKEXE MARKER",0L}; void checkexe(char *fname) { FILE *fptr; unsigned int c; int first_time = 0, i; char buffer[14]; unsigned long chksum = 0L; unsigned long l; unsigned long marker_offset; unsigned char *charptr; time_t tm; fptr = fopen(fname,"r+b"); if(fptr == NULL) { fprintf(stderr,"checkexe : unable to open input file '%s'\n", fname); exit(99); } setvbuf(fptr, NULL, _IOFBF, 32767); /* try to get a 32K buffer */ /* * If this is the first time the check has been run, scan the entire file * to find the marker. Otherwise proceed. */ if(marker_struct.checksum == 0L) { first_time = 1; c = fgetc(fptr); while(!feof(fptr)) { if(c == (unsigned int)marker_struct.marker[0]) { fread(buffer,sizeof(buffer),1,fptr); if(memcmp(buffer,&marker_struct.marker[1], sizeof(buffer)) == 0) { marker_offset = ftell(fptr) + 1L; break; } fseek(fptr,-13L,SEEK_CUR); } c = fgetc(fptr); } if(feof(fptr)) { fprintf(stderr,"checkexe : unable to locate marker\n"); exit(99); } /* Change the marker field to random values */ tm = time(NULL); srand((unsigned int)tm); for(i = 0 ; i < sizeof(marker_struct.marker) ; ++i) marker_struct.marker[i] = (unsigned char) rand(); fseek(fptr,marker_offset - sizeof(marker_struct.marker),SEEK_SET); fwrite(marker_struct.marker,sizeof(marker_struct.marker),1,fptr); } /* Calculate the checksum for the entire file */ rewind(fptr); c = fgetc(fptr); for(l = 0 ; !feof(fptr) ; ++l) { chksum += (unsigned long)c; c = fgetc(fptr); } if(first_time) { marker_struct.checksum = chksum; fseek(fptr,marker_offset,SEEK_SET); fwrite(&marker_struct.checksum,sizeof(unsigned long),1,fptr); } else { charptr = (unsigned char*) &marker_struct.checksum; for(i = 0 ; i < sizeof(marker_struct.checksum) ; ++i) chksum -= (unsigned long)(charptr[i]); if(chksum != marker_struct.checksum) { fprintf(stderr, "\acheckexe : %s has been altered, " "possibly by a virus\n", fname); exit(99); } } fclose(fptr); return; } main(int argc, char *argv[]) { checkexe(argv[0]); return EXIT_SUCCESS; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/tail.c0000755000076400001440000001116207055334301015370 /* ** TAIL.C ** ---------------------------------------------------------------------- ** Display the last n lines of a file (20 lines by default). ** ** Revision history ** ================ ** Modified 19930604 by Ruurd Pels: ** - Increased default line numbers from 5 to 20 ** - Made ANSI C conformant (I hope) ** - Added '-' support for commandline ** - Outputs header to stderr instead of stdout to leave it out when ** redirecting files ** - Fixed \r\r\n bug for MSDOS machines ** ** Modified 19861005 by Joe Huffman: ** - Utilize prototyping, fixed a bug, added (a few) comments and help. ** ** Written 19860204 by Joe Huffman. ** ** Not copyrighted. */ #include #include char head1[] = {"\n------- \""}; char head2[] = {" -------\n"}; FILE * fp; int filenum; int cc; unsigned int linenum = 20; unsigned int indx; long int * tail; /* ** Get the number of lines to display at the "tail" of each file from ** the command line. */ void getlinenum(int n, char * str[]) { for (--n; n; --n) { ++str; if ((**str == '/') || (**str == '-')) { linenum = atoi(*(str) + 1); if (linenum <= 0) linenum = 20; } } /* Because we save a pointer to the end of the PREVIOUS line */ linenum++; } /* ** Set the file pointer "fp" to "linenum - 1" lines before the end of ** the file. */ void gettail(void) { unsigned char outstr[15]; unsigned long int currline = 0L; tail = (long int *)malloc(sizeof(*tail) * linenum); if (!tail) { fputs("Insufficient memory.", stderr); exit(1); } tail[0] = ftell(fp); indx = 0; for (cc = getc(fp); cc != EOF; cc = getc(fp)) { if (cc == '\r') { ++currline; cc = getc(fp); if (cc != '\n') ungetc(cc, fp); ++indx; indx %= linenum; tail[indx] = ftell(fp); } else { if (cc == '\n') { ++currline; cc = getc(fp); if (cc != '\r') ungetc(cc, fp); ++indx; indx %= linenum; tail[indx] = ftell(fp); } } } fputs("\" ", stderr); ltoa(currline, outstr, 10); fputs(outstr, stderr); fputs(" lines", stderr); if (currline >= linenum - 1) { indx++; indx %= linenum; } else indx = 0; if (fseek(fp, tail[indx], 0) == -1) { fputs("\nFile seek error.", stderr); exit(1); } free(tail); } /* ** Tell the user what the program is and how to use it. */ void help(void) { char *ptr; static char help_str[] = "Usage:\n\nTAIL [filename] " "[/n]\n\n - The name of a valid file, wildcards " "accepted.\nn - Number of lines to print out, 20 " "by default."; for (ptr = &help_str[0]; *ptr; ptr++) fputc(*ptr, stdout); } int main(int argc, char **argv) { if (argc <= 1) { help(); exit(1); } getlinenum(argc, argv); for (filenum = 1; filenum < argc; ++filenum) { if (*argv[filenum] == '/') continue; fp = fopen(argv[filenum], "rb"); if (!fp) { fputs(head1, stderr); fputs(argv[filenum], stderr); fputs("\" not found.", stderr); fputs(head2, stderr); } else { fputs(head1, stderr); fputs(argv[filenum], stderr); gettail(); fputs(head2, stderr); for (cc = getc(fp); cc != EOF; cc = getc(fp)) { #ifdef __MSDOS__ if (cc != '\r') { fputc(cc, stdout); } #else fputc(cc, stdout); #endif } fclose(fp); } } return EXIT_SUCCESS; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/strecpy.asm0000755000076400001440000000661307055334262016501 page ,132 title STRECPY COMMENT $ Author: Leslie Satenstein A form of strcpy() where the result returned is the nul terminating character of the first argument. In many cases this function is move efficient than the equivalent strcpy, followed by strcat. The assembler code does a strlen followed by a memcpy, and makes use of the special string move instructions intrinsic to the intel 8088, 80186, 80286, '386 and '486s. Use as: strecpy(strecpy(target,"first part"),"Second part"); in place of strcat(strcpy(target,"first part"),"Second part"); One of the ways the C code appears is: char *strecpy(char *target,const char *src) { return target+strlen(strcpy(target,src)); } Another way is to do your own looping: char *strecpy(char *target,const char *src) { char *cpt,*cps; /* many compilers optimise better * when local pointers are declared * (locals can be assigned registers) */ cpt=target-1; cps=src-1; do { *++cpt = *++src; /* copy first, ask questions later */ } while(*cpt!='\0'); return cpt; } $ ; Requires MASM 5.1 or later or equivalent ; ; Assemble with: MASM /Mx /z ... ; TASM /jMASM /mx /z ... % .MODEL memodel,C ;Add model support via command ;line macros, e.g. ;MASM /Dmemodel=LARGE, ;MASM /Dmemodel=SMALL, etc. PUBLIC STRECPY .DATA .CODE if @DataSize strecpy proc uses si di ds,target:FAR ptr byte,src:FAR ptr byte les di,src ; load es:di with src mov si,di ; put copy to bx:si mov bx,es else strecpy proc uses si di,target:NEAR ptr byte,src:NEAR ptr byte mov di,ds ; make es same as ds mov es,di mov di,src mov si,di ; put copy to es:si endif xor ax,ax ; scan for the nul at end of string mov cx,-1 repne scasb not cx ; cx = strlen(src)+1 ; if @Datasize les di,target ; this is where copy is to begin mov dx,es ; dx has segment, di has offset to target mov ds,bx ; ds:si have pointer to src else mov di,target ; this is where copy is to begin endif test di,1 ; if we are on odd address, do one byte move jz on_even movsb ; now, prepare to move words at a dec cx ;time to target on_even: shr cx,1 ; carry flag has remainder after divide by 2 rep movsw ; move this many words jnc fini ; if no carry, we are finished movsb fini: xchg di,ax ; set up return value, dx has seg value dec ax ; backup to the nul character ret strecpy endp end c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cursize.c0000755000076400001440000000302007055333716016126 /* ** Program to set the size of the cursor ** ** Public domain demonstration by Bob Jarvis */ #include /* puts() */ #include /* int86(), union REGS */ #include /* exit(), atoi() */ char *help = "CURSIZE - sets the cursor size.\n" "Usage:\n" " CURSIZE \n" "where\n" " top-line = top line of cursor within character cell\n" " bottom-line = bottom line\n" "Example:\n" " CURSIZE 7 8 \n" " CURSIZE 32 32 "; void cursor_size(int top_line, int bottom_line) { union REGS regs; regs.h.ah = 1; regs.h.ch = (unsigned char)top_line; regs.h.cl = (unsigned char)bottom_line; int86(0x10,®s,®s); } void get_cursor_size(int *top_line, int *bottom_line) { union REGS regs; regs.h.ah = 3; regs.h.bh = 0; int86(0x10, ®s, ®s); *top_line = regs.h.ch; *bottom_line = regs.h.cl; return; } void main(int argc, char *argv[]) { int top, bottom; if(argc < 3) { puts(help); exit(1); } top = atoi(argv[1]); bottom = atoi(argv[2]); cursor_size(top,bottom); top = bottom = -1; get_cursor_size(&top, &bottom); printf("top = %d bottom = %d\n", top, bottom); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/spin.c0000755000076400001440000000154307055334246015422 /* ** Miscellaneous text spinners demonstration ** ** public domain by Jon Guthrie, Bob Stout, and others */ #include #define DURATION 500 /* Length of demo */ #define SSLOWDOWN 5 /* Make spinner look ok */ #define TSLOWDOWN 10 /* Make target look ok */ main() { unsigned i; char spinner[] = "|/-\\", target[] = ".oO"; for (i = 0; i < DURATION; ++i) { unsigned scount = i / SSLOWDOWN, tcount = i / TSLOWDOWN; unsigned scountdown = DURATION / SSLOWDOWN; unsigned tcountdown = DURATION / TSLOWDOWN; printf("CW %c ... CCW %c ... Explode %c ... Implode%c\r", spinner[scount & 3], spinner[(scountdown - scount) & 3], target[tcount % 3], target[(tcountdown - tcount) % 3]); } return 0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rg_ssort.c0000755000076400001440000000224707055334210016304 /* ** ssort() -- Fast, small, qsort()-compatible Shell sort ** ** by Ray Gardner, public domain 5/90 */ #include void ssort (void *base, size_t nel, size_t width, int (*comp)(const void *, const void *)) { size_t wnel, gap, wgap, i, j, k; char *a, *b, tmp; wnel = width * nel; for (gap = 0; ++gap < nel;) gap *= 3; while ( gap /= 3 ) { wgap = width * gap; for (i = wgap; i < wnel; i += width) { for (j = i - wgap; ;j -= wgap) { a = j + (char *)base; b = a + wgap; if ( (*comp)(a, b) <= 0 ) break; k = width; do { tmp = *a; *a++ = *b; *b++ = tmp; } while ( --k ); if (j < wgap) break; } } } } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rmtrail.c0000755000076400001440000000114007055334212016105 /* ** Originally published as part of the MicroFirm Function Library ** ** Copyright 1986, S.E. Margison ** Copyright 1989, Robert B.Stout ** ** Subset version released to the public domain, 1991 ** ** remove trailing whitespace from a string */ #include #include #define NUL '\0' char *rmtrail(char *str) { int i; if (0 != (i = strlen(str))) { while (--i >= 0) { if (!isspace(str[i])) break; } str[++i] = NUL; } return str; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/stub.c0000755000076400001440000000656607055334271015436 /* ** STUB.C - Utility to truncate files ** ** STUB is used with MAKE utilities which lack the ability to timestamp ** library object modules to reduce disk space requirements. After ** compiling and building your library or executable, run "STUB *.OBJ" ** to truncate all object files to zero length. The files' time and ** date stamps will remain unchanged. By doing this, your make utility ** will still know which modules are out of date even though the files ** themselves have all been truncated to zero length. STUB also supports ** the standard response file format so you can use your linker response ** files to direct the files to be truncated. ** ** public domain by Bob Stout ** ** Notes: To expand command line arguments with wildcards, ** TC/TC++/BC++ - Link in WILDARGS.OBJ. ** MSC/QC - Link in SETARGV.OBJ. ** ZTC/C++ - Link in _MAINx.OBJ, where 'x' is the memory model. ** Watcom C/C++ - Compile & link with WILDARGV.C ** ** Allows file list(s) using standard "@file_list_name" convention. */ #include #include #include #include #include #define LAST_CHAR(s) (s)[strlen(s)-1] int fd; void truncate(char *); int main(int argc, char **argv) { int i; if (2 > argc) { puts("Usage: STUB filespec [...filespec]"); puts("where: filespec = fully-specified file name, or"); puts(" filespec = wildcard-specified file name, or"); puts(" filespec = response file name, e.g. \"@FILE.LST\""); return 1; } for (i = 1; i < argc; ++i) /* Scan for simple file specs */ { if ('@' == *argv[i]) continue; else truncate(argv[i]); } for (i = 1; i < argc; ++i) /* Scan for response file specs */ { if ('@' == *argv[i]) { FILE *fp; char buf[256], *ptr = &argv[i][1]; if (NULL == (fp = fopen(ptr, "r"))) { printf("\aSTUB: Error opening %s\n", ptr); return -1; } while (NULL != fgets(buf, 255, fp)) { LAST_CHAR(buf) = '\0'; /* Strip '\n' */ truncate(buf); } fclose(fp); } } return 0; } /* ** The actual truncation function */ #ifdef __ZTC__ #define GETFTIME dos_getftime #define SETFTIME dos_setftime #else #define GETFTIME _dos_getftime #define SETFTIME _dos_setftime #endif void truncate(char *fname) { #ifdef __TURBOC__ struct ftime Ftime; #else unsigned short date, time; #endif fd = open(fname, O_WRONLY); #ifdef __TURBOC__ /* Save the time/date */ getftime(fd, &Ftime); #else GETFTIME(fd, &date, &time); #endif chsize(fd, 0L); /* Truncate the file */ #ifdef __TURBOC__ /* Restore the time/date */ setftime(fd, &Ftime); #else SETFTIME(fd, date, time); #endif close(fd); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/atr2ansi.c0000755000076400001440000000366607055333645016206 /* ** Form a command string for ANSI.SYS to set a given video attribute ** ** Public domain demo by Bob Stout */ /* video attributes */ #define BLINKING 0x87 #define REVERSE 0x70 #define REVBLINK 0xf0 #define NORMAL 0x07 #define HIGHLITE 0x0f #define HIGHBLINK 0x8f #define BLINKBIT 0x80 /* OR in to cause blink */ #define HILTBIT 0x08 /* OR in to cause highlight */ /* ** colors -- Use as is for foreground colors ** For background, shift left by 4 and OR with ** foreground and possible video attributes */ #define BLACK 0 #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define MAGENTA 5 #define BROWN 6 #define WHITE 7 #define GRAY 8 #define LTBLUE 9 #define LTGREEN 10 #define LTCYAN 11 #define LTRED 12 #define LTMAGENTA 13 #define YELLOW 14 #define HIWHITE 15 /* hi-intensity white */ #define BG_(a) (((a) & 0x7f) << 4) /* ** Example: ** Video attribute of yellow text on blue background = BG_(BLUE)+YELLOW */ char *make_ansi(int vatr) { void add_str(char *, char *); static char string[40]; static char *fore[8] = {"30","34","32","36","31","35","33","37"}; static char *back[8] = {"40","44","42","46","41","45","43","47"}; strcpy(string, "\033["); if (vatr == 0x07) strcat(string, "0"); else { if (vatr & 0x80) add_str(string, "5"); if (vatr & 0x08) add_str(string, "1"); add_str(string, fore[vatr & 0x07]); add_str(string, back[(vatr & 0x70) >> 4]); } strcat(string, "m"); return string; } void add_str(char *string1, char *string2) { char last_char; last_char = string1[strlen(string1) - 1]; if (last_char != '[') strcat(string1, ";"); strcat(string1, string2); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/checksum.c0000755000076400001440000000147407055333700016250 /* ** CHECKSUM.C - Compute the checksum of a file ** ** public somain demo by Bob Stout */ #include unsigned checksum(void *buffer, size_t len, unsigned int seed) { unsigned char *buf = (unsigned char *)buffer; size_t i; for (i = 0; i < len; ++i) seed += (unsigned int)(*buf++); return seed; } #ifdef TEST #include main() { FILE *fp; size_t len; char buf[4096], *file = "CHECKSUM.C"; if (NULL == (fp = fopen(file, "rb"))) { printf("Unable to open %s for reading\n", file); return -1; } len = fread(buf, sizeof(char), sizeof(buf), fp); printf("%d bytes read\n", len); printf("The checksum of %s is %#x\n", file, checksum(buf, len, 0)); } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/droptime.c0000755000076400001440000000105407055333733016271 /** int drop_time(void) ** ** Drops current timeslice in OS/2, Win, DPMI 1.0 and (I think) DV ** ** Returns: 0 if not successful, 1 if dropped ** ** Based on Ralf Brown's Interrupt list. ** Donated to Public Domain by Thor Johnson. ** ***********************************************************************/ #include int drop_time(void) /* Drops Time-slice, giving to another program */ { union REGS regs; regs.x.ax = 0x1680; int86(0x2f, ®s, ®s); return (regs.h.al == 0x80)? 0 : 1; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/str27seg.c0000755000076400001440000000757207055334260016135 /* ** STR27SEG.C - Convert numeric strings to 7-segment strings. ** ** Public domain by Bob Stout ** ** Input: A string (NUL-delimited char array) containing only digits ** ('0' - '9' chars). ** ** Output: The same string with each digit converted to a 7-segment ** representation. Returns NULL on error. */ #include #include #define CAST(new_type,old_object) (*((new_type *)&old_object)) #define DISP(str) fputs((str), stdout) /* ** Define the bit significance ** ** a ** --- ** | | ** f| |b ** | g | ** --- ** | | ** e| |c ** | | ** --- ** d */ struct Seg7disp { unsigned seg_a : 1; unsigned seg_b : 1; unsigned seg_c : 1; unsigned seg_d : 1; unsigned seg_e : 1; unsigned seg_f : 1; unsigned seg_g : 1; } Seg7digits[10] = { { 1, 1, 1, 1, 1, 1, 0 }, /* 0 */ { 0, 1, 1, 0, 0, 0, 0 }, /* 1 */ { 1, 1, 0, 1, 1, 0, 1 }, /* 2 */ { 1, 1, 1, 1, 0, 0, 1 }, /* 3 */ { 0, 1, 1, 0, 0, 1, 1 }, /* 4 */ { 1, 0, 1, 1, 0, 1, 1 }, /* 5 */ { 1, 0, 1, 1, 1, 1, 1 }, /* 6 */ { 1, 1, 1, 0, 0, 0, 0 }, /* 7 */ { 1, 1, 1, 1, 1, 1, 1 }, /* 8 */ { 1, 1, 1, 1, 0, 1, 1 } /* 9 */ }; char *str27seg(char *string) { char *str; int ch; for (str = string ; *str; ++str) { if (!isdigit(*str)) return NULL; ch = CAST(int, Seg7digits[*str - '0']); *str = (char)(ch & 0xff); } return string; } #ifdef TEST main() { char tstrng[] = "0123456789", *segs; printf("str27seg() returned %p", segs = str27seg(tstrng)); if (segs) { char *ptr; struct Seg7disp ch; int i; puts(" & produced:\n"); for (ptr = segs ; *ptr; ++ptr) { ch = CAST(struct Seg7disp, *ptr); if (ch.seg_a) DISP(" --- "); else DISP(" "); DISP(" "); } puts(""); for (i = 0; i < 3; ++i) { for (ptr = segs ; *ptr; ++ptr) { ch = CAST(struct Seg7disp, *ptr); if (ch.seg_f) DISP("| "); else DISP(" "); if (ch.seg_b) DISP("|"); else DISP(" "); DISP(" "); } puts(""); } for (ptr = segs ; *ptr; ++ptr) { ch = CAST(struct Seg7disp, *ptr); if (ch.seg_g) DISP(" --- "); else DISP(" "); DISP(" "); } puts(""); for (i = 0; i < 3; ++i) { for (ptr = segs ; *ptr; ++ptr) { ch = CAST(struct Seg7disp, *ptr); if (ch.seg_e) DISP("| "); else DISP(" "); if (ch.seg_c) DISP("|"); else DISP(" "); DISP(" "); } puts(""); } for (ptr = segs ; *ptr; ++ptr) { ch = CAST(struct Seg7disp, *ptr); if (ch.seg_d) DISP(" --- "); else DISP(" "); DISP(" "); } puts(""); } else puts("\n"); return 0; } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/crc-16f.c0000755000076400001440000001117507055333711015610 /* * Calculate, intelligently, the CRC of a dataset incrementally given a * buffer full at a time. * Initialize crc to 0 for XMODEM, -1 for CCITT. * * Usage: * newcrc = updcrc( oldcrc, bufadr, buflen ) * unsigned int oldcrc, buflen; * char *bufadr; * * Compile with -DTEST to generate program that prints CRC of stdin to stdout. * Compile with -DMAKETAB to print values for crctab to stdout */ /* the CRC polynomial. This is used by XMODEM (almost CCITT). * If you change P, you must change crctab[]'s initial value to what is * printed by initcrctab() */ #define P 0x1021 /* number of bits in CRC: don't change it. */ #define W 16 /* this the number of bits per char: don't change it. */ #define B 8 static unsigned short crctab[1<>(W-B)) ^ *cp++]; return( crc ); } #ifdef MAKETAB main() { initcrctab(); } initcrctab() { register b, v, i; for( b = 0; b <= (1<= 0; ) v = v&0x8000 ? (v<<1)^P : v<<1; crctab[b] = v; printf( "0x%04x,", v & 0xFFFF ); if( (b&7) == 7 ) printf("\n" ); else printf(" "); } } #endif #ifdef TEST #include #include #define MAXBUF 4096 void main(int argc, char **argv) { int fd = 0; int nr; char buf[MAXBUF]; unsigned short crc; if( argc > 1 ) { if( (fd = open( argv[1], O_RDONLY )) < 0 ) { perror( argv[1] ); exit( -1 ); } } crc = 0; while( (nr = read( fd, buf, MAXBUF )) > 0 ) crc = updcrc( crc, buf, nr ); printf( "%04x\n", crc ); if( nr != 0 ) perror( "reading" ); } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ispow2.c0000755000076400001440000000035107055334024015662 #include int another_function(int x) { return! ((~(~0U>>1)|x)&x -1) ;} int main(void) { int i; for (i = 0; i < 256; ++i) printf("%3d: %d\n", i, another_function(i)); return 0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/trim.c0000755000076400001440000000323007055334311015410 /* ** TRIM.C - Remove leading, trailing, & excess embedded spaces ** ** public domain by Bob Stout */ #include #include #define NUL '\0' char *trim(char *str) { char *ibuf = str, *obuf = str; int i = 0, cnt = 0; /* ** Trap NULL */ if (str) { /* ** Remove leading spaces (from RMLEAD.C) */ for (ibuf = str; *ibuf && isspace(*ibuf); ++ibuf) ; if (str != ibuf) memmove(str, ibuf, ibuf - str); /* ** Collapse embedded spaces (from LV1WS.C) */ while (*ibuf) { if (isspace(*ibuf) && cnt) ibuf++; else { if (!isspace(*ibuf)) cnt = 0; else { *ibuf = ' '; cnt = 1; } obuf[i++] = *ibuf++; } } obuf[i] = NUL; /* ** Remove trailing spaces (from RMTRAIL.C) */ while (--i >= 0) { if (!isspace(obuf[i])) break; } obuf[++i] = NUL; } return str; } #ifdef TEST #include main(int argc, char *argv[]) { printf("trim(\"%s\") ", argv[1]); printf("returned \"%s\"\n", trim(argv[1])); } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ldfloor.c0000755000076400001440000000314607055334037016111 /* ldfloor() -- long double floor ** public domain by Raymond Gardner Englewood, CO ** tested with TC++ ** assumptions: 80-bit IEEE format numbers, stored LSB first ** (Intel style), longs & ints are accessed from arbitrary boundaries */ long double ldfloor(long double a) { long double a0; int e, n; a0 = a; e = ((int *)&a)[4] & 0x7FFF; /* extract exponent */ if ( e == 0 ) /* 0 is special case */ return (long double) 0.0; e -= 16383; /* unbias exponent */ if (e < 0) /* if < 0, num is < 1,... */ { a = 0.0; /* so floor is zero */ } else if ((n = 63 - e) > 0) /* clear n least sig. bits */ { if (n < 32) /* clear n lowest bits */ { ((unsigned long *)&a)[0] &= ~((1L << n) - 1); } else /* n >= 32 */ { ((unsigned long *)&a)[0] = 0; /* clear lower 32 bits */ n -= 32; /* how many left to clear ? */ if (n) /* if any, clear n next lowest bits */ { ((unsigned long *)&a)[1] &= ~((1L << n) - 1); } } } if (a0 < 0 && a0 != a) /* if neg. and it had fractional bits */ a -= 1.0; /* adjust the floor */ return a; /* return it */ } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/palndrom.c0000755000076400001440000000042707055334126016262 /**/char q='"',*a="*//**/char q='%c',*a=%c%s%c*/};)b(stup;]d[b=]d-472[b)--d(elihw;)q,a,q,q,2+a,b(ftnirps;)b(stup{)(niam;731=d tni;]572[b," ,b[275];int d=137;main(){puts(b);sprintf(b,a+2,q,q,a,q);while(d--)b[274-d]=b[d];puts(b);}/*c%s%c%=a*,'c%'=q rahc/**//*"=a*,'"'=q rahc/**/ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/crc-16.c0000755000076400001440000000200107055333710015425 #define POLY 0x8408 /* // 16 12 5 // this is the CCITT CRC 16 polynomial X + X + X + 1. // This works out to be 0x1021, but the way the algorithm works // lets us use 0x8408 (the reverse of the bit pattern). The high // bit is always assumed to be set, thus we only use 16 bits to // represent the 17 bit value. */ unsigned short crc16(char *data_p, unsigned short length) { unsigned char i; unsigned int data; unsigned int crc = 0xffff; if (length == 0) return (~crc); do { for (i=0, data=(unsigned int)0xff & *data_p++; i < 8; i++, data >>= 1) { if ((crc & 0x0001) ^ (data & 0x0001)) crc = (crc >> 1) ^ POLY; else crc >>= 1; } } while (--length); crc = ~crc; data = crc; crc = (crc << 8) | (data >> 8 & 0xff); return (crc); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/editgets.c0000755000076400001440000003071407055333743016264 /* editgets.c - line input w/editing */ /* this code is released to the public domain */ /* written by Jon Burchmore */ /* modifications & enhancements by Bob Stout */ /* This is as close to ANSI compliant C that I could come, but it was made */ /* on an IBM compatable computer, so I designed it for that platform. */ /* If you're porting it to another computer type, please note how the IBM */ /* passes enhanced keys. First, it sends an ASCIIZ (character 0), then a */ /* standard character. Anyway, what the switch() statement does is check */ /* to see if there WAS a zero sent, and if there wasn't, it just "falls" */ /* through to the default, which handles normal characters. */ /* The conio header file provides the getch() function, which returns a */ /* single character from the KEYBOARD, not stdin, and waits if it must. */ /* It is be possible to re-write this function for a computer besides an */ /* IBM PC. */ /* It would be possible to check the variable insert, and if it's on, make */ /* the cursor large, and if it's off, make the cursor small, but my primary */ /* goal is portability, not fancy add-ons */ /* Pardon the lack of comments. I'm a coder, not an author. Besides, if */ /* you can't understand this, DON'T USE IT! (Words to live by) */ #include #include #include #include #undef min #define min(x,y) (((x) <= (y)) ? (x) : (y)) #define NUL 0x00 #define ESC 0x1B #define LEFT 0x4B #define RIGHT 0x4D #define HOME 0x47 #define END 0x4F #define INSERT 0x52 #define DELETE 0x53 #define BACKSPC 0x08 #define ENTER 0x0D #define CTLEND 0x75 #define CTLHOME 0x77 #define CTLRT 0x74 #define CTLLFT 0x73 /* ** Password mode - '*' is echoed for all characters, only ESC, ENTER, ** BACKSPC, and CTLHOME are active. */ int password_mode = 0; /* ** Aruments: 1) Buffer to receive string ** 2) Size of buffer ** 3) Default string */ int jgets(char *s, int maxlen, char *string) { char temp[500]; int insert = 1, done = 0, pos, len, i, j, c, zeroflag; if (NULL == string) string = ""; if (0 != (pos = len = strlen(string))) strncpy(temp, string, min(len, maxlen)); for (i = 0; i < maxlen; ++i) { if (NUL == *string) putchar('_'); else putchar(*string++); } for (i = 0; i < (maxlen - len); ++i) putchar(BACKSPC); while (!done) { zeroflag = 0; if ((c = getch()) == 0) { zeroflag = 1; c = getch(); } switch (c) { case ESC : if (len == 0) break; if (pos != len) { for (i = pos; i < len; i++) putch('_'); for (i = len; i >= 0; i--) { putch(BACKSPC); putch('_'); putch(BACKSPC); } pos = len = 0; break; } case LEFT : if (zeroflag) { if (password_mode) break; if (pos == 0) break; pos--; putch(BACKSPC); break; } case RIGHT : if (zeroflag) { if (password_mode) break; if (pos == len) break; if (pos != maxlen) { putch(temp[pos]); pos++; } break; } case HOME : if (zeroflag) { if (password_mode) break; while (pos-- > 0) putch(BACKSPC); pos = 0; break; } case END : if (zeroflag) { if (password_mode) break; while (pos < len) putch(temp[pos++]); break; } case INSERT : if (zeroflag) { if (password_mode) break; insert = (!(insert)); break; } case DELETE : if (zeroflag) { if (password_mode) break; if (pos == len) break; for (i = pos; i < len; i++) temp[i] = temp[i + 1]; len--; for (i = pos; i < len; i++) putch(temp[i]); putch('_'); for (i = len + 1; i > pos; i--) putch(BACKSPC); break; } case BACKSPC : if (c == BACKSPC) { if (pos == 0) break; if (pos != len) { for (i = pos - 1; i < len; i++) temp[i] = temp[i + 1]; pos--; len--; putch(BACKSPC); for (i = pos; i < len; i++) putch(temp[i]); putch('_'); for (i = len; i >= pos; i--) putch(BACKSPC); } else { putch(BACKSPC); putch('_'); putch(BACKSPC); pos = --len; } break; } case ENTER : if (c == ENTER) { done = 1; break; } case CTLEND : if (zeroflag) { if (password_mode) break; for (i = pos; i < len; ++i) putch('_'); for (i = pos; i < len; ++i) putch(BACKSPC); len = pos; break; } case CTLHOME : if (zeroflag) { if (pos == 0) break; if (pos != len) { while (0 != pos) { for (i = pos - 1; i < len; i++) temp[i] = temp[i + 1]; pos--; len--; putch(BACKSPC); for (i = pos; i < len; i++) putch(temp[i]); putch('_'); for (i = len; i >= pos; i--) putch(BACKSPC); } } else { while (0 != pos) { putch(BACKSPC); putch('_'); putch(BACKSPC); pos = --len; } } break; } case CTLRT : if (zeroflag) { if (password_mode) break; do { if (pos == len) break; if (pos != maxlen) { putch(temp[pos]); pos++; } } while (isspace(temp[pos])); do { if (pos == len) break; if (pos != maxlen) { putch(temp[pos]); pos++; } } while (!isspace(temp[pos])); break; } case CTLLFT : if (zeroflag) { if (password_mode) break; do { if (pos == 0) break; pos--; putch(BACKSPC); } while (isspace(temp[pos])); do { if (pos == 0) break; pos--; putch(BACKSPC); } while (!isspace(temp[pos])); break; } default : if (zeroflag) break; if (c == 0 || pos == maxlen) break; if ((!(insert)) || pos == len) { temp[pos++] = (char)c; if (pos > len) len++; if (password_mode) putch('*'); else putch(c); } else { if (len == maxlen) break; for (i = len++; i >= pos; i--) temp[i + 1] = temp[i]; temp[pos++] = (char)c; if (password_mode) putch('*'); else putch(c); for (i = pos; i < len; i++) putch(temp[i]); for (i = len; i > pos; i--) putch(BACKSPC); } } } temp[len] = '\0'; strcpy(s, temp); return len; } #ifdef TEST void main(void) { char mystring[60]; memset(mystring, 0, 60); fputs("Enter any string: ", stdout); jgets(mystring, 60, "This is a test"); puts(""); printf("editgets() returned:\n%s\n", mystring); password_mode = 1; memset(mystring, 0, 60); fputs("Enter any password: ", stdout); jgets(mystring, 50, NULL); puts(""); printf("editgets() returned:\n%s\n", mystring); } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/windchil.c0000755000076400001440000000101307055334342016237 /* ** Wind Chill for exposed human skin, expressed as a function of wind ** speed in Miles per Hour and temperature in degrees Fahrenheit. ** ** Public domain from numerous published references. */ #include double wind_chill(int wind_speed, int temp) { if (4 > wind_speed) return (double)temp; else { return (((10.45 + (6.686112 * sqrt((double) wind_speed)) - (.447041 * wind_speed)) / 22.034 * (temp - 91.4)) + 91.4); } } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/scaldate.c0000755000076400001440000000254007055334214016222 /* ** scalar date routines -- public domain by Ray Gardner ** These will work over the range 1/01/01 thru 14699/12/31 */ #include "scaldate.h" int isleap (unsigned yr) { return yr % 400 == 0 || (yr % 4 == 0 && yr % 100 != 0); } static unsigned months_to_days (unsigned month) { return (month * 3057 - 3007) / 100; } static long years_to_days (unsigned yr) { return yr * 365L + yr / 4 - yr / 100 + yr / 400; } long ymd_to_scalar (unsigned yr, unsigned mo, unsigned day) { long scalar; scalar = day + months_to_days(mo); if ( mo > 2 ) /* adjust if past February */ scalar -= isleap(yr) ? 1 : 2; yr--; scalar += years_to_days(yr); return scalar; } void scalar_to_ymd (long scalar, unsigned *yr, unsigned *mo, unsigned *day) { unsigned n; /* compute inverse of years_to_days() */ for ( n = (unsigned)((scalar * 400L) / 146097); years_to_days(n) < scalar;) n++; /* 146097 == years_to_days(400) */ *yr = n; n = (unsigned)(scalar - years_to_days(n-1)); if ( n > 59 ) { /* adjust if past February */ n += 2; if ( isleap(*yr) ) n -= n > 62 ? 1 : 2; } *mo = (n * 100 + 3007) / 3057; /* inverse of months_to_days() */ *day = n - months_to_days(*mo); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/scaldate.h0000755000076400001440000000144007055334214016225 /* ** scalar date routines -- public domain by Ray Gardner ** These will work over the range 1/01/01 thru 14699/12/31 */ /* ** Define ISO to be 1 for ISO (Mon-Sun) calendars ** ** ISO defines the first week with 4 or more days in it to be week #1. */ #ifndef ISO #define ISO 0 #endif #if (ISO != 0 && ISO != 1) #error ISO must be set to either 0 or 1 #endif int isleap (unsigned yr); long ymd_to_scalar (unsigned yr, unsigned mo, unsigned day); void scalar_to_ymd (long scalar, unsigned *yr, unsigned *mo, unsigned *day); int dow(unsigned yr, unsigned mo, unsigned day); int valiDate(unsigned yr, unsigned mo, unsigned day); int dow(unsigned yr, unsigned mo, unsigned day); int daynum(int year, int month, int day); int weeknum(int year, int month, int day); c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/dossort.c0000755000076400001440000000616707055333733016155 /* cl /AL sortit.c =========================================================== sort.c 7-31-91 Robert Mashlan This filter is almost compatible with the MS-DOS filter of the same name. This filter sorts each line of standard input, disregarding case, and sends it to standard output. optional parameters: /R Output in reverse order /+n Compare at column n, 1 based example usage: sort < unsorted.txt > sorted.txt note: compile in a far data model for maximum capacity ( compact or large ) */ #include #include #include #define MAXLINES 10000 /* maximum number of lines to sort */ #define MAXLINE 80 /* maximum line length */ unsigned col = 0; /* column to start sort at ( zero based here ) */ int reverse = 0; /* reverse order flag */ /* ** compare function for qsort */ int cmp( const void *a, const void *b) { int result; const char *_a = *(const char **)a; const char *_b = *(const char **)b; /* compare at col if other than zero */ if (col > 0) { if (strlen(_a) > col) _a += col; else _a = ""; if (strlen(_b) > col) _b += col; else _b = ""; } result = stricmp(_a,_b); return reverse ? -result : result; } int main(int argc, char *argv[]) { static char *lines[MAXLINES]; int i, nlines=0, no_match; char buf[MAXLINE]; /* scan for command line options */ for(i=1;i #ifdef TEST #include #endif /* ** Calling parameters: 1 - Number string to be converted ** 2 - Buffer for the converted output ** 3 - Radix (base) of the input ** 4 - Radix of the output ** ** Returns: Pointer to converted output */ char *radix_convert(const char *in, char *out, int rin, int rout) { long n; char *dummy; n = strtol(in, &dummy, rin); return ltoa(n, out, rout); } #ifdef TEST int main(int argc, char *argv[]) { int rin, rout; char buf[40]; if (4 > argc) { puts("Usage: RDXCNVRT "); return(-1); } rin = atoi(argv[2]); rout = atoi(argv[3]); printf("%s (base %d) = %s (base %d)\n", argv[1], rin, radix_convert((const char *)argv[1], buf, rin, rout), rout); return 0; } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ferrorf.c0000755000076400001440000000125707055333756016125 /* FERRORF.C ** Prints error message with printf() formatting syntax, then a colon, ** then a message corressponding to the value of errno, then a newline. ** Output is to filehandle. ** ** Public Domain by Mark R. Devlin, free usage is permitted. */ #include #include #include #include int ferrorf(FILE *filehandle, const char *format, ...) { int vfp, fp; va_list vargs; vfp = fp = 0; va_start(vargs, format); vfp = vfprintf(filehandle, format, vargs); va_end(vargs); fp = fprintf(filehandle, ": %s\n", sys_errlist[errno]); return ((vfp==EOF || fp==EOF) ? EOF : (vfp+fp)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/video.c0000755000076400001440000001362707055334320015556 /*------------------------------[ vhdw.c ]-----------------------------*/ /* Hardware Interface Routines */ /*--------------------------------------------------------------------- /*---------------------------------------------------------------------*/ /* This code is a subset of a library copyrighted by Jeff Dunlop. */ /* License is hereby granted for unrestricted use. */ /*---------------------------------------------------------------------*/ /*---------------------------------------------------------------------*/ /* dv_info: get video and version info about DesqView */ /* get_rows: determine number of rows on screen */ /* get_cols: determine number of columns on screen */ /* get_vidpage: determine the current text mode video page */ /* get_vidbase: determine the base of video ram */ /* is_dv: determine if DesqView is loaded */ /* is_egavga: determine if monitor is ega/vga */ /*---------------------------------------------------------------------*/ /*--------------------------------------------------------------*/ /*-----------------------[ include files ]----------------------*/ /*--------------------------------------------------------------*/ #include #ifndef MK_FP #define MK_FP(seg,offset) \ ((void _far *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #endif typedef struct { int ver_major; int ver_minor; unsigned regen_buf; int win_rows; int win_cols; } DV_INFO; /*------------------------[ get_vidpage ]-----------------------*/ /* Determine the current text mode video page */ /*--------------------------------------------------------------*/ /* local: */ /* regs = register storage buffer */ /* return: */ /* video page number as determined by bios call */ /*--------------------------------------------------------------*/ unsigned char get_vidpage(void) { union REGS regs; regs.h.ah = 0x0f; int86(0x10, ®s, ®s); return regs.h.bh; } /*---------------------------[ is_dv ]--------------------------*/ /* Determine whether DesqView is active */ /*--------------------------------------------------------------*/ int is_dv(void) { union REGS regs; regs.h.ah = 0x2b; regs.x.cx = 0x4445; /* 'DE' */ regs.x.dx = 0x5351; /* 'SQ' */ regs.h.al = 1; /* get version */ int86(0x21, ®s, ®s); return regs.h.al != 0xff; } /*--------------------------[ dv_info ]-------------------------*/ /* Return screen and version info about DesqView */ /*--------------------------------------------------------------*/ /* return: */ /* -1 on error */ /*--------------------------------------------------------------*/ int get_dvinfo(DV_INFO *dv_info) { union REGS regs; regs.h.ah = 0x2b; regs.x.cx = 0x4445; /* 'DE' */ regs.x.dx = 0x5351; /* 'SQ' */ regs.h.al = 1; /* get version */ int86(0x21, ®s, ®s); if (regs.h.al == 0xff) return -1; dv_info->ver_major = regs.h.bh; dv_info->ver_minor = regs.h.bl; regs.h.al = 4; /* get screen info */ int86(0x21, ®s, ®s); if (regs.h.al == 0xff) return -1; dv_info->regen_buf = regs.x.dx; dv_info->win_rows = regs.h.bh; dv_info->win_cols = regs.h.bl; return 0; } /*------------------------[ get_vidbase ]-----------------------*/ /* Determine the base of video ram */ /*--------------------------------------------------------------*/ /* local: */ /* regs = register union for ISR */ /* return: */ /* the current text base segment */ /*--------------------------------------------------------------*/ unsigned get_vidbase(void) { union REGS regs; DV_INFO dv_info; if (is_dv() && get_dvinfo(&dv_info) != -1) return dv_info.regen_buf; else { regs.h.ah = 0xf; int86(0x10, ®s, ®s); if (regs.h.al == 7) return 0xb000; else return 0xb800; } } /*-------------------------[ get_rows ]-------------------------*/ /* Determine the number of rows in current text mode screen */ /*--------------------------------------------------------------*/ int is_egavga(void); int get_rows(void) { DV_INFO dv_info; char far *p = MK_FP(0x40, 0x84); if (is_dv() && get_dvinfo(&dv_info) != -1) return dv_info.win_rows; else return *p + is_egavga(); } /*-------------------------[ get_cols ]-------------------------*/ /* Determine the number of columns in current text screen */ /*--------------------------------------------------------------*/ int get_cols(void) { DV_INFO dv_info; int far *p = MK_FP(0x40, 0x4a); if (is_dv() && get_dvinfo(&dv_info) != -1) return dv_info.win_cols; else return *p; } /*-------------------------[ is_egavga ]------------------------*/ /* Determine whether the current text mode is ega/vga */ /*--------------------------------------------------------------*/ int is_egavga(void) { union REGS regs; regs.h.ah = 0x1a; regs.h.al = 0; int86(0x10, ®s, ®s); return regs.h.al == 0x1a; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/printq.c0000755000076400001440000000266107055334151015763 /* printq.c 12-22-91 Robert Mashlan, Public Domain A small program that utilizes the prnspool module, which is an interface to the DOS program PRINT.COM */ #include "prnspool.h" #include #include int main(int argc, char **argv ) { char far *files; int i; int addfiles = 1; if (!printspool_installed()) { printf("print.com not installed\n"); return 0; } for (i = 1; i < argc; i++) { if (stricmp(argv[i],"/T") == 0) printspool_cancel(); /* cancel all files in queue */ else if (stricmp(argv[i],"/C") == 0) addfiles = 0; /* cancel all listed files */ else if (stricmp(argv[i],"/P") == 0) addfiles = 1; /* add all listed files */ else /* here the specified file should really have the full pathname */ { if (addfiles) printspool_submit(argv[i]); else printspool_remove(argv[i]); if (printspool_errno) puts(printspool_errlist[printspool_errno]); } } printf("files currently in queue:\n"); for (files = printspool_getqueue(); *files; files += 64) printf("\t%Fs\n", files); printspool_endhold(); return 0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/vio.asm0000755000076400001440000002425207055334325015604 ; ; screen handling primitives ; ; by: jim nutt ; .model large .data vseg dw 0b000h vmode db ? x dw 0 y dw 0 color db 07h ofs dw 0 xhite db 8 ; video information block VIOinfo struc level db ? db ? dw ? flags dw ? mode db ? db ? colors dw ? pixcol dw ? pixrow dw ? txtcol dw ? txtrow dw ? VIOinfo ends info VIOinfo <0,0,14,1,0,0,2,0,0,80,25> .code public _VIOopen, _VIOclose, _VIOcolumns, _VIOrows, _VIOmode public _VIOscrollright, _VIOscrollleft, _VIOscrollup, _VIOscrolldown public _VIOclear, _VIOputc, _VIOputs, _VIOgetca, _VIOgetra, _VIOheight, public _VIOsetfore, _VIOsetback, _VIOgetfore, _VIOgetback public _VIOgotoxy, _VIOupdate, _VIOwherex, _VIOwherey, _VIOputr public _VIOcursor, _VIOsegment, _VIOsetSegment, _VIOsetRows, _VIOsetCols ;int _far _pascal VIOheight(void) _VIOheight proc mov al, xhite; xor ah,ah; ret _VIOheight endp ;int _far _pascal VIOopen(void); _VIOopen proc push ds mov ax,3000h ; get dos version, v4 can do this from dos int 21h cmp al,4 je odos4 mov ax,0f00h ; get screen mode and width int 10h mov vmode, al cmp al,7 je mono xor al,al xchg al,ah mov info.txtcol,ax mov vseg,0b800h push di mov ax,0fe00h mov es,vseg mov di,0 int 10h pop di mov vseg,es push bp ; how many rows mov ax,1130h mov bh,1h xor dx,dx int 10h pop bp cmp dl,0 je cga mov xhite,cl inc dl xor dh,dh mov info.txtrow,dx mono: mov ax,0 pop ds ret odos4: mov ax,440ch mov bx,0 mov cx,037fh mov dx,offset info int 21h jnc l1 pop ds ret cga: mov info.txtrow,25 l1: mov ax,0 pop ds ret _VIOopen endp ;void _far _pascal VIOclose(void); _VIOclose proc mov ax,3000h int 21h cmp al,4 jne l2 mov ax,440ch mov bx,0 mov cx,035fh mov dx,offset info int 21h l2: ret _VIOclose endp ;int _far VIOcolumns(void); _VIOcolumns proc mov ax,info.txtcol ret _VIOcolumns endp ;int _far VIOrows(void); _VIOrows proc mov ax,info.txtrow ret _VIOrows endp ;int _far VIOmode(void); _VIOmode proc mov al,vmode xor ah,ah ret _VIOmode endp ;int _far VIOwherex(void); _VIOwherex proc mov ax,x ret _VIOwherex endp ;int _far VIOwherey(void); _VIOwherey proc mov ax,y ret _VIOwherey endp ;void _far VIOscrollright(int x1, int y1, int x2, int y2, int count); _VIOscrollright proc push bp mov bp,sp pushf std push di push si mov ax,[bp+8] mov bx,[bp+12] sub bx,ax mov cx,info.txtcol mul cl mov dx,[bp+10] add dx,ax shl dx,1 mov cx,[bp+10] sub cx,[bp+6] add bx,2 mov [bp+6],cx mov [bp+8],bx mov es,vseg sr1: dec word ptr [bp+8] jz sr3 mov bx,[bp+14] push ds mov ah,color mov al,20h push es pop ds sr2: mov di,dx mov si,di dec si dec si mov cx,[bp+6] rep movsw stosw dec bx jnz sr2 pop ds mov ax,info.txtcol shl ax,1 add dx,ax jmp sr1 sr3: pop si pop di popf pop bp ret _VIOscrollright endp ;void _far VIOscrollleft(int x1, int y1, int x2, int y2, int count); _VIOscrollleft proc push bp mov bp,sp pushf push di push si mov ax,[bp+8] mov bx,[bp+12] sub bx,ax mov cx,info.txtcol mul cl mov dx,[bp+6] add dx,ax shl dx,1 mov cx,[bp+10] sub cx,[bp+6] add bx,2 mov [bp+6],cx mov [bp+8],bx mov es,vseg sl1: dec word ptr [bp+8] jz sl3 mov bx,[bp+14] push ds mov ah,color mov al,20h push es pop ds sl2: mov di,dx mov si,di inc si inc si mov cx,[bp+6] rep movsw stosw dec bx jnz sl2 pop ds mov ax,info.txtcol shl ax,1 add dx,ax jmp sl1 sl3: pop si pop di popf pop bp ret _VIOscrollleft endp ;void _far VIOscrollup(int x1, int y1, int x2, int y2, int count); _VIOscrollup proc push bp mov bp,sp push di push si mov es,vseg mov bx,[bp+6] mov ax,[bp+8] mov dx,info.txtcol mul dl add ax,bx shl ax,1 shl dx,1 push ax push ds push ax mov cx,[bp+10] sub cx,bx mov bx,cx mov ax,[bp+12] sub ax,[bp+8] mov [bp+12],ax push es pop ds inc word ptr [bp+14] l9: dec word ptr [bp+14] jz l11 mov ax,[bp+12] l10: pop di mov si,di add si,dx push si mov cx,bx rep movsw dec ax jne l10 pop di pop ds mov al,20h mov ah,color mov cx,bx rep stosw pop di push di push ds push di push es pop ds jmp l9 l11: pop ax pop ds pop ax pop si pop di pop bp ret _VIOscrollup endp ;void _far VIOscrolldown(int x1, int y1, int x2, int y2, int count); _VIOscrolldown proc push bp mov bp,sp push di push si mov es,vseg mov bx,[bp+6] mov ax,[bp+12] mov dx,info.txtcol mul dl add ax,bx shl ax,1 shl dx,1 push ax push ds push ax mov cx,[bp+10] sub cx,bx mov bx,cx mov ax,[bp+12] sub ax,[bp+8] mov [bp+12],ax push es pop ds inc word ptr [bp+14] l6: dec word ptr [bp+14] jz l7 mov ax,[bp+12] l8: pop di mov si,di sub si,dx push si mov cx,bx rep movsw dec ax jne l8 pop di pop ds mov al,20h mov ah,color mov cx,bx rep stosw pop di push di push ds push di push es pop ds jmp l6 l7: pop ax pop ds pop ax pop si pop di pop bp ret _VIOscrolldown endp ;void _far VIOclear(int x1, int y1, int x2, int y2); _VIOclear proc push bp mov bp,sp push di push si mov es,vseg mov ax,[bp+8] mov bx,[bp+6] mov cx,info.txtcol mul cl add ax,bx shl ax,1 mov si,ax mov bx,[bp+10] sub bx,[bp+6] inc bx mov dx,[bp+12] sub dx,[bp+8] inc dx mov al,20h mov ah,color l5: mov di,si mov cx,bx rep stosw mov cx,info.txtcol shl cx,1 add si,cx dec dx jne l5 pop si pop di pop bp ret _VIOclear endp ;void _far VIOputc(const char c); _VIOputc proc push bp mov bp,sp push di mov es,vseg mov di,ofs mov ax,[bp+6] mov ah,color stosw mov ofs,di pop di mov ax,x inc ax cmp ax,info.txtcol jge cwrap mov x,ax pop bp ret cwrap: inc y sub ax,info.txtcol mov x,ax pop bp ret _VIOputc endp ;void _far VIOputs(const char far * s); _VIOputs proc push bp mov bp,sp push di push si push ds mov es,vseg mov di,ofs mov ah,color lds si,[bp+6] mov bx,x l3: lodsb cmp al,0 je l4 stosw inc bx jmp l3 l4: mov ofs,di pop ds pop si pop di cmp bx,info.txtcol jge swrap mov x,bx pop bp ret swrap: inc y sub bx,info.txtcol mov x,bx pop bp ret _VIOputs endp ;int _far VIOgetca(const int x, const int y); _VIOgetca proc push bp mov bp,sp mov es,vseg mov ax,[bp+8] mov bx,[bp+6] mov cx,info.txtcol mul cl add ax,bx shl ax,1 xchg ax,bx mov ax,es:[bx] pop bp ret _VIOgetca endp ;int *_far VIOgetra(int x1, int y1, int x2, int y2, int * b); _VIOgetra proc push bp mov bp,sp push di push si push ds mov ax,[bp+8] ; y1 mov bx,info.txtcol mul bl ; y1 * width of screen add ax,[bp+6] shl ax,1 ; x1 * 2 shl bx,1 ; width * 2 mov cx,[bp+10] sub cx,[bp+6] ; x2 - x1 mov dx,[bp+12] sub dx,[bp+8] ; y2 - y1 inc dx inc cx les di,[bp+14] mov ds,vseg push cx gr1: pop cx push cx mov si,ax rep movsw add ax,bx dec dx jnz gr1 pop cx pop ds pop si pop di pop bp ret _VIOgetra endp ;void _far VIOputr(int x, int y, int w, int h, int far * b); _VIOputr proc push bp mov bp,sp push ds push si push di mov ax,[bp+8] mov bx,info.txtcol mul bl ; y * width add ax,[bp+6] shl ax,1 shl bx,1 mov es,vseg lds si,[bp+14] mov dx,[bp+10] pr1: mov cx,dx mov di,ax rep movsw add ax,bx dec word ptr [bp+12] jnz pr1 pop di pop si pop ds pop bp ret _VIOputr endp ;void _far VIOsetfore(const int c); _VIOsetfore proc push bp mov bp,sp mov bl,color and bx,00f0h mov ax,[bp+6] and ax,000fh or ax,bx mov color,al pop bp ret _VIOsetfore endp ;void _far VIOsetback(const int c); _VIOsetback proc push bp mov bp,sp mov bl,color and bx,000fh mov ax,[bp+6] and ax,000fh shl ax,1 shl ax,1 shl ax,1 shl ax,1 or ax,bx mov color,al pop bp ret _VIOsetback endp ;int _far VIOgetfore(void); _VIOgetfore proc mov al,color and ax,000fh ret _VIOgetfore endp ;int _far VIOgetback(void); _VIOgetback proc mov al,color and ax,00f0h shr al,1 shr al,1 shr al,1 shr al,1 ret _VIOgetback endp ;void _far VIOgotoxy(int x, int y); _VIOgotoxy proc push bp mov bp,sp mov bx,[bp + 6] mov ax,[bp + 8] mov x,bx mov y,ax mov cx,info.txtcol mul cl add ax,bx shl ax,1 mov ofs,ax pop bp ret _VIOgotoxy endp ;void _far VIOupdate(int x1, int y1, int x2, int y2); _VIOupdate proc mov ah,2 mov bh,0 mov cx,y mov dx,x mov dh,cl int 10h ret _VIOupdate endp ;void _far VIOcursor(int _far * x, int _far * y, int _far * shape); _VIOcursor proc push bp mov bp,sp push ds mov ah,3 mov bh,0 int 10h mov al,dl cbw lds bx,[bp + 6] mov [bx],ax mov al,dh cbw lds bx,[bp + 10] mov [bx],ax lds bx,[bp + 14] mov [bx],cx pop ds pop bp ret _VIOcursor endp ;unsigned int _far VIOsegment(void); _VIOsegment proc mov ax, vseg ret _VIOsegment endp ;void _far VIOsetSegment(unsigned int s); _VIOsetSegment proc push bp mov bp,sp mov ax, [bp + 6] mov vseg,ax pop bp ret _VIOsetSegment endp ;void _far VIOsetRows(int r); _VIOsetRows proc push bp mov bp,sp mov ax,[bp + 6] mov info.txtrow,ax pop bp ret _VIOsetRows endp ;void _far VIOsetCols(int c); _VIOsetCols proc push bp mov bp,sp mov ax,[bp + 6] mov info.txtcol, ax pop bp ret _VIOsetCols endp end c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/truename.c0000755000076400001440000000411507055334312016261 /* ** Apologies for the grotty code; I only just whipped this up. ** ** tname.c -- wrapper for the undocumented DOS function TRUENAME ** ** TRUENAME: interrupt 0x21 function 0x60 ** ** Call with: ah = 60h ** es:di -> destination buffer ** ds:si -> source buffer ** ** Returns: carry bit set if there were problems ** ** This code hereby contributed to the public domain. */ #include #include #include #include #include #ifdef __TURBOC__ #define _far far #endif /* ** Strip leading and trailing blanks from a string. */ char _far *strip(char _far *s) { char _far *end; for ( ; isspace(*s); s++) ; for (end = s; *end; end++) ; for (end--; isspace(*end); *end-- = '\0') ; return s; } /* ** Truename itself. Note that I'm using intdosx() rather than ** playing with some inline assembler -- I've discovered some ** people that actually don't have an assembler, poor bastards :-) */ char _far *truename(char _far *dst, char _far *src) { union REGS rg; struct SREGS rs; if (!src || !*src || !dst) return NULL; src=strip(src); rg.h.ah=0x60; rg.x.si=FP_OFF(src); rg.x.di=FP_OFF(dst); rs.ds=FP_SEG(src); rs.es=FP_SEG(dst); intdosx(&rg,&rg,&rs); return (rg.x.cflag) ? NULL : dst; } #ifdef TEST /* ** ... and a little test function. */ int main(int argc, char *argv[]) { char buf[128]=" ", _far *s; int i; if (3 > _osmajor) { puts("Only works with DOS 3+"); return -1; } if(argc > 1) { for(i = 1; i < argc; i++) { s = truename((char _far *)buf,(char _far *)argv[i]); printf("%s=%s\n",argv[i], s ? buf : "(null)"); } } else printf("Usage: TRUENAME [filename [filename...]]\n"); return 0; } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/environ.txt0000755000076400001440000000751507055333745016536 Q. Why was only the DOS batch file and "Stuff-key-buffer method" (SETENVAR.C) included in the original SNIPPETS? A. The reason that I only included the "batch&stuff" method in my SNIPPETS collection is simply that it's the *only* method you can rely on if your program is going to be distributed. Quite simply, there is *NO* safe, documented way under DOS to set an environment variable in the master environment block - period! By back-tracking PSPs or MCBs, you can try to locate the master environment and change it. You can also try to use Int 2Eh, the command processor's "back door". But all of these methods suffer from several shortcomings: 1) Someone using the program might be using 4DOS, COMMAND PLUS, or some other COMMAND.COM replacement. These don't always do things the same way as COMMAND.COM and the diferences can cause you to crash, roll, & burn! For example, several COMMAND.COM replacements allow the master environment block to be located in extended, expanded, or high memory. In such a case, backtracking PSPs or MCBs is less than useless, they're guranteed to yield undefined errors. 2) Int 2Eh seems to be the most universally supported, but cannot be used in a program invoked from a batch file. The book, "Undocumented DOS" details some procedures for making an Int 2Eh call safer but, again, these techniques rely on implementation features of COMMAND.COM which might not be available in alternate command processors. 3) Even if everything else is safe, you still need a way of error trapping in case your new environment variable might overwrite the end of the available master envirnment block. This error trapping in inherent in COMMAND.COM and alternate command processors (one reason why using the Int 2Eh back door is potentially the safest way to try), but if you try to modify things manually, you're on your own. If you do overwrite the end of the master environment block, you'll have automatically corrupted your MCB chain and possibly set yourself up for some *really* nasty surprises! 4) Finally, there's the very fundamental question of which environment block really is the master? Say you're in your comm program and hit the "shell to DOS" key. A secondary copy of the command processor, be it COMMAND.COM or whatever, is spawned and you're off and running. If you now run your program from this secondary DOS shell, is its environment block the master or is it the one from which you ran your comm program? Worse yet, depending on how you set up CONFIG.SYS, the secondary shell may have a considerably smaller environment block than the original. Despite having set the "/E:" switch, your secondary shell will likely only have an environment block whose size is equal to the current block size rounded up to the next paragraph boundry. If you trace PSPs, you'll find the secondary shell which you stand a good chance of over-running due to the difference in the block size. If you trace MCBs, you'll find the real master block, but then your changes will have disappered when you return to your comm program, defeating the purpose of your program in the first place. The inability to alter a parent program's environment block isn't a DOS exclusive, BTW - it's an inheritance from Unix where the same limitation applies. Finally, SNIPPETS now includes several of these alternate unsafe ways of setting the master environment. INT2E.ASM & CCOMCALL.C together provide access to the DOS command processor back door, GLBL_ENV.C provides means for TC/TC++/BC++ and MSC/QC programmers to modify the master environment by backtracking PSP pointers, and MCB_ENV.C serves the same purpose only using the MCB tracking method. c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/permute1.c0000755000076400001440000000673607055334135016221 #include #include /* chouse_n ( char *strng, int length) returns a pointer to a string of */ /* length characters chosen from "strng" , duplicate chars in "strng" are */ /* significant. Strings are generated in lexical order. */ /* First call, call with *strng. each subsiquent call, call with NULL, */ /* returns one combination. Calls after all combinations have been */ /* returned return NULL. Will return NULL for errors. */ /* not very defensive (i.e. WILL BREAK) */ /* dave chapman aug '91 released to public domain */ char *chouse_n( char *strng, int length); char *chouse_n( char *strng, int length) { static char *str; static char *curr; static char *pos; /* for each char in curr(ent string), its pos in str */ static int counts[256]; int i,j; if (0 >= length) return NULL; if (NULL != strng) { str = malloc(strlen(strng)); /* first call, prep string for use */ curr = malloc(2 * length + 1); pos = curr + length +1; for (i = 0; i < 256; counts[i++] = 0) ; for (i = 0; strng[i]; i++) counts[strng[i]]++; for (i = 1, j = 0; i < 256; i++) { if (counts[i]) { str[j] = i; counts[j++] = counts[i]; } } str[j] = '\0'; /* str is string of distinct chars in order */ /* counts[] holds count of each char */ /* take first length chars */ for (i = 0,j = 0; i < length; i++) { curr[i] = str[j]; pos[i] = j; if (!(--counts[j])) j++; } curr[i] = '\0'; return curr; } /* if called with "mississippi",5; str -> "imps" curr -> "iiiim" counts -> 0,0,2,4; pos -> 0,0,0,0,1; */ /* go back to front */ for (j = length; j > 0;) { counts[ pos[--j]]++; /* "replace" char */ /* look for a new char for curr posit. */ for ( i = ++pos[j]; str[i] && ! counts[i]; i++) ; if (0 != (curr[j] = str[i])) /* found a char */ { --counts[i]; pos[j] = i; /* placed char, fill out rest of string */ for (++j, i = 0; j < length; j++) { for ( ; !counts[i]; i++) ; curr[j] = str[i]; /* first available char */ --counts[i]; pos[j] = i; } return curr; } /* no more chars for this pos ; go back one */ } /* done */ return NULL; } void main(void) { char *str = "aabbccdd"; int i,j; j = 0; i = 5; puts(chouse_n( str, i)); while (NULL != (str = chouse_n(NULL, i))) { ++j; printf(" %s %d\n",str,j); } } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/permute2.c0000755000076400001440000000341007055334135016204 /* ** PERMUTE.C - prints all permutations of an input string ** ** public domain demo by Jon Guthrie */ #include #include #include int charcmp(char *, char *); void permute(char *, int, int); int main(int argc, char *argv[]) { int length; if (2 > argc) { puts("Usage: PERMUTE string"); abort(); } length = strlen(argv[1]); /* It only works if they're printed in order */ qsort(argv[1], length, 1, (int(*)(const void *, const void *))charcmp); permute(argv[1], 0, length); return 0; } /* ** This function prints all of the permutations of string "array" ** (which has length "len") starting at "start." */ void permute(char *array, int start, int len) { int j; char *s; if(start < len) { if(NULL == (s = malloc(len))) { printf("\n\nMemory error!!!\a\a\n"); abort(); } strcpy(s, array); for(j=start ; j #ifdef TEST #include #endif #define NUL '\0' size_t commafmt(char *buf, /* Buffer for formatted string */ int bufsize, /* Size of buffer */ long N) /* Number to convert */ { int len = 1, posn = 1, sign = 1; char *ptr = buf + bufsize - 1; if (2 > bufsize) { ABORT: *buf = NUL; return 0; } *ptr-- = NUL; --bufsize; if (0L > N) { sign = -1; N = -N; } for ( ; len <= bufsize; ++len, ++posn) { *ptr-- = (char)((N % 10L) + '0'); if (0L == (N /= 10L)) break; if (0 == (posn % 3)) { *ptr-- = ','; ++len; } if (len >= bufsize) goto ABORT; } if (0 > sign) { if (0 == bufsize) goto ABORT; *ptr-- = '-'; ++len; } strcpy(buf, ++ptr); return (size_t)len; } #ifdef TEST void main(int argc, char *argv[]) { size_t len; char buf[20]; long N; N = strtol(argv[1], NULL, 10); len = commafmt(buf, 20, N); printf("%s converts to %s and returned %d\n", argv[1], buf, len); } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mkdirs.c0000755000076400001440000000214307055334103015727 /* ** MKDIRS.C - Function to build multi-level directories in a single call ** ** Original Copyright 1993 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is hereby donated to the public domain. */ #include #include #include #ifdef __TURBOC__ #include #else #include #endif int mkdirs(char *path) { int retval; while (0 != (retval = mkdir(path))) { char subpath[FILENAME_MAX] = "", *delim; if (NULL == (delim = strrchr(path, '\\'))) return retval; strncat(subpath, path, delim - path); /* Appends NUL */ mkdirs(subpath); } return retval; } #ifdef TEST main(int argc, char *argv[]) { if (2 > argc) { puts("Usage: MKDIRS pathname [...pathname]"); return -1; } while (--argc) { ++argv; printf("mkdirs(%s) returned %d\n", *argv, mkdirs(*argv)); } return 0; } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/sunriset.c0000755000076400001440000005232107055334277016331 /* SUNRISET.C - computes Sun rise/set times, start/end of twilight, and the length of the day at any date and latitude Written as DAYLEN.C, 1989-08-16 Modified to SUNRISET.C, 1992-12-01 (c) Paul Schlyter, 1989, 1992 Released to the public domain by Paul Schlyter, December 1992 */ #include #include /* A macro to compute the number of days elapsed since 2000 Jan 0.0 */ /* (which is equal to 1999 Dec 31, 0h UT) */ #define days_since_2000_Jan_0(y,m,d) \ (367L*(y)-((7*((y)+(((m)+9)/12)))/4)+((275*(m))/9)+(d)-730530L) /* Some conversion factors between radians and degrees */ #ifndef PI #define PI 3.1415926535897932384 #endif #define RADEG ( 180.0 / PI ) #define DEGRAD ( PI / 180.0 ) /* The trigonometric functions in degrees */ #define sind(x) sin((x)*DEGRAD) #define cosd(x) cos((x)*DEGRAD) #define tand(x) tan((x)*DEGRAD) #define atand(x) (RADEG*atan(x)) #define asind(x) (RADEG*asin(x)) #define acosd(x) (RADEG*acos(x)) #define atan2d(y,x) (RADEG*atan2(y,x)) /* Following are some macros around the "workhorse" function __daylen__ */ /* They mainly fill in the desired values for the reference altitude */ /* below the horizon, and also selects whether this altitude should */ /* refer to the Sun's center or its upper limb. */ /* This macro computes the length of the day, from sunrise to sunset. */ /* Sunrise/set is considered to occur when the Sun's upper limb is */ /* 35 arc minutes below the horizon (this accounts for the refraction */ /* of the Earth's atmosphere). */ #define day_length(year,month,day,lon,lat) \ __daylen__( year, month, day, lon, lat, -35.0/60.0, 1 ) /* This macro computes the length of the day, including civil twilight. */ /* Civil twilight starts/ends when the Sun's center is 6 degrees below */ /* the horizon. */ #define day_civil_twilight_length(year,month,day,lon,lat) \ __daylen__( year, month, day, lon, lat, -6.0, 0 ) /* This macro computes the length of the day, incl. nautical twilight. */ /* Nautical twilight starts/ends when the Sun's center is 12 degrees */ /* below the horizon. */ #define day_nautical_twilight_length(year,month,day,lon,lat) \ __daylen__( year, month, day, lon, lat, -12.0, 0 ) /* This macro computes the length of the day, incl. astronomical twilight. */ /* Astronomical twilight starts/ends when the Sun's center is 18 degrees */ /* below the horizon. */ #define day_astronomical_twilight_length(year,month,day,lon,lat) \ __daylen__( year, month, day, lon, lat, -18.0, 0 ) /* This macro computes times for sunrise/sunset. */ /* Sunrise/set is considered to occur when the Sun's upper limb is */ /* 35 arc minutes below the horizon (this accounts for the refraction */ /* of the Earth's atmosphere). */ #define sun_rise_set(year,month,day,lon,lat,rise,set) \ __sunriset__( year, month, day, lon, lat, -35.0/60.0, 1, rise, set ) /* This macro computes the start and end times of civil twilight. */ /* Civil twilight starts/ends when the Sun's center is 6 degrees below */ /* the horizon. */ #define civil_twilight(year,month,day,lon,lat,start,end) \ __sunriset__( year, month, day, lon, lat, -6.0, 0, start, end ) /* This macro computes the start and end times of nautical twilight. */ /* Nautical twilight starts/ends when the Sun's center is 12 degrees */ /* below the horizon. */ #define nautical_twilight(year,month,day,lon,lat,start,end) \ __sunriset__( year, month, day, lon, lat, -12.0, 0, start, end ) /* This macro computes the start and end times of astronomical twilight. */ /* Astronomical twilight starts/ends when the Sun's center is 18 degrees */ /* below the horizon. */ #define astronomical_twilight(year,month,day,lon,lat,start,end) \ __sunriset__( year, month, day, lon, lat, -18.0, 0, start, end ) /* Function prototypes */ double __daylen__( int year, int month, int day, double lon, double lat, double altit, int upper_limb ); int __sunriset__( int year, int month, int day, double lon, double lat, double altit, int upper_limb, double *rise, double *set ); void sunpos( double d, double *lon, double *r ); void sun_RA_dec( double d, double *RA, double *dec, double *r ); double revolution( double x ); double rev180( double x ); double GMST0( double d ); /* A small test program */ void main(void) { int year,month,day; double lon, lat; double daylen, civlen, nautlen, astrlen; double rise, set, civ_start, civ_end, naut_start, naut_end, astr_start, astr_end; int rs, civ, naut, astr; printf( "Longitude (+ is east) and latitude (+ is north) : " ); scanf( "%lf %lf", &lon, &lat ); for(;;) { printf( "Input date ( yyyy mm dd ) (ctrl-C exits): " ); scanf( "%d %d %d", &year, &month, &day ); daylen = day_length(year,month,day,lon,lat); civlen = day_civil_twilight_length(year,month,day,lon,lat); nautlen = day_nautical_twilight_length(year,month,day,lon,lat); astrlen = day_astronomical_twilight_length(year,month,day, lon,lat); printf( "Day length: %5.2f hours\n", daylen ); printf( "With civil twilight %5.2f hours\n", civlen ); printf( "With nautical twilight %5.2f hours\n", nautlen ); printf( "With astronomical twilight %5.2f hours\n", astrlen ); printf( "Length of twilight: civil %5.2f hours\n", (civlen-daylen)/2.0); printf( " nautical %5.2f hours\n", (nautlen-daylen)/2.0); printf( " astronomical %5.2f hours\n", (astrlen-daylen)/2.0); rs = sun_rise_set ( year, month, day, lon, lat, &rise, &set ); civ = civil_twilight ( year, month, day, lon, lat, &civ_start, &civ_end ); naut = nautical_twilight ( year, month, day, lon, lat, &naut_start, &naut_end ); astr = astronomical_twilight( year, month, day, lon, lat, &astr_start, &astr_end ); printf( "Sun at south %5.2fh UT\n", (rise+set)/2.0 ); switch( rs ) { case 0: printf( "Sun rises %5.2fh UT, sets %5.2fh UT\n", rise, set ); break; case +1: printf( "Sun above horizon\n" ); break; case -1: printf( "Sun below horizon\n" ); break; } switch( civ ) { case 0: printf( "Civil twilight starts %5.2fh, " "ends %5.2fh UT\n", civ_start, civ_end ); break; case +1: printf( "Never darker than civil twilight\n" ); break; case -1: printf( "Never as bright as civil twilight\n" ); break; } switch( naut ) { case 0: printf( "Nautical twilight starts %5.2fh, " "ends %5.2fh UT\n", naut_start, naut_end ); break; case +1: printf( "Never darker than nautical twilight\n" ); break; case -1: printf( "Never as bright as nautical twilight\n" ); break; } switch( astr ) { case 0: printf( "Astronomical twilight starts %5.2fh, " "ends %5.2fh UT\n", astr_start, astr_end ); break; case +1: printf( "Never darker than astronomical twilight\n" ); break; case -1: printf( "Never as bright as astronomical twilight\n" ); break; } } } /* The "workhorse" function for sun rise/set times */ int __sunriset__( int year, int month, int day, double lon, double lat, double altit, int upper_limb, double *trise, double *tset ) /***************************************************************************/ /* Note: year,month,date = calendar date, 1801-2099 only. */ /* Eastern longitude positive, Western longitude negative */ /* Northern latitude positive, Southern latitude negative */ /* The longitude value IS critical in this function! */ /* altit = the altitude which the Sun should cross */ /* Set to -35/60 degrees for rise/set, -6 degrees */ /* for civil, -12 degrees for nautical and -18 */ /* degrees for astronomical twilight. */ /* upper_limb: non-zero -> upper limb, zero -> center */ /* Set to non-zero (e.g. 1) when computing rise/set */ /* times, and to zero when computing start/end of */ /* twilight. */ /* *rise = where to store the rise time */ /* *set = where to store the set time */ /* Both times are relative to the specified altitude, */ /* and thus this function can be used to comupte */ /* various twilight times, as well as rise/set times */ /* Return value: 0 = sun rises/sets this day, times stored at */ /* *trise and *tset. */ /* +1 = sun above the specified "horizon" 24 hours. */ /* *trise set to time when the sun is at south, */ /* minus 12 hours while *tset is set to the south */ /* time plus 12 hours. "Day" length = 24 hours */ /* -1 = sun is below the specified "horizon" 24 hours */ /* "Day" length = 0 hours, *trise and *tset are */ /* both set to the time when the sun is at south. */ /* */ /**********************************************************************/ { double d, /* Days since 2000 Jan 0.0 (negative before) */ sr, /* Solar distance, astronomical units */ sRA, /* Sun's Right Ascension */ sdec, /* Sun's declination */ sradius, /* Sun's apparent radius */ t, /* Diurnal arc */ tsouth, /* Time when Sun is at south */ sidtime; /* Local sidereal time */ int rc = 0; /* Return cde from function - usually 0 */ /* Compute d of 12h local mean solar time */ d = days_since_2000_Jan_0(year,month,day) + 0.5 - lon/360.0; /* Compute local sideral time of this moment */ sidtime = revolution( GMST0(d) + 180.0 + lon ); /* Compute Sun's RA + Decl at this moment */ sun_RA_dec( d, &sRA, &sdec, &sr ); /* Compute time when Sun is at south - in hours UT */ tsouth = 12.0 - rev180(sidtime - sRA)/15.0; /* Compute the Sun's apparent radius, degrees */ sradius = 0.2666 / sr; /* Do correction to upper limb, if necessary */ if ( upper_limb ) altit -= sradius; /* Compute the diurnal arc that the Sun traverses to reach */ /* the specified altitide altit: */ { double cost; cost = ( sind(altit) - sind(lat) * sind(sdec) ) / ( cosd(lat) * cosd(sdec) ); if ( cost >= 1.0 ) rc = -1, t = 0.0; /* Sun always below altit */ else if ( cost <= -1.0 ) rc = +1, t = 12.0; /* Sun always above altit */ else t = acosd(cost)/15.0; /* The diurnal arc, hours */ } /* Store rise and set times - in hours UT */ *trise = tsouth - t; *tset = tsouth + t; return rc; } /* __sunriset__ */ /* The "workhorse" function */ double __daylen__( int year, int month, int day, double lon, double lat, double altit, int upper_limb ) /**********************************************************************/ /* Note: year,month,date = calendar date, 1801-2099 only. */ /* Eastern longitude positive, Western longitude negative */ /* Northern latitude positive, Southern latitude negative */ /* The longitude value is not critical. Set it to the correct */ /* longitude if you're picky, otherwise set to to, say, 0.0 */ /* The latitude however IS critical - be sure to get it correct */ /* altit = the altitude which the Sun should cross */ /* Set to -35/60 degrees for rise/set, -6 degrees */ /* for civil, -12 degrees for nautical and -18 */ /* degrees for astronomical twilight. */ /* upper_limb: non-zero -> upper limb, zero -> center */ /* Set to non-zero (e.g. 1) when computing day length */ /* and to zero when computing day+twilight length. */ /**********************************************************************/ { double d, /* Days since 2000 Jan 0.0 (negative before) */ obl_ecl, /* Obliquity (inclination) of Earth's axis */ sr, /* Solar distance, astronomical units */ slon, /* True solar longitude */ sin_sdecl, /* Sine of Sun's declination */ cos_sdecl, /* Cosine of Sun's declination */ sradius, /* Sun's apparent radius */ t; /* Diurnal arc */ /* Compute d of 12h local mean solar time */ d = days_since_2000_Jan_0(year,month,day) + 0.5 - lon/360.0; /* Compute obliquity of ecliptic (inclination of Earth's axis) */ obl_ecl = 23.4393 - 3.563E-7 * d; /* Compute Sun's position */ sunpos( d, &slon, &sr ); /* Compute sine and cosine of Sun's declination */ sin_sdecl = sind(obl_ecl) * sind(slon); cos_sdecl = sqrt( 1.0 - sin_sdecl * sin_sdecl ); /* Compute the Sun's apparent radius, degrees */ sradius = 0.2666 / sr; /* Do correction to upper limb, if necessary */ if ( upper_limb ) altit -= sradius; /* Compute the diurnal arc that the Sun traverses to reach */ /* the specified altitide altit: */ { double cost; cost = ( sind(altit) - sind(lat) * sin_sdecl ) / ( cosd(lat) * cos_sdecl ); if ( cost >= 1.0 ) t = 0.0; /* Sun always below altit */ else if ( cost <= -1.0 ) t = 24.0; /* Sun always above altit */ else t = (2.0/15.0) * acosd(cost); /* The diurnal arc, hours */ } return t; } /* __daylen__ */ /* This function computes the Sun's position at any instant */ void sunpos( double d, double *lon, double *r ) /******************************************************/ /* Computes the Sun's ecliptic longitude and distance */ /* at an instant given in d, number of days since */ /* 2000 Jan 0.0. The Sun's ecliptic latitude is not */ /* computed, since it's always very near 0. */ /******************************************************/ { double M, /* Mean anomaly of the Sun */ w, /* Mean longitude of perihelion */ /* Note: Sun's mean longitude = M + w */ e, /* Eccentricity of Earth's orbit */ E, /* Eccentric anomaly */ x, y, /* x, y coordinates in orbit */ v; /* True anomaly */ /* Compute mean elements */ M = revolution( 356.0470 + 0.9856002585 * d ); w = 282.9404 + 4.70935E-5 * d; e = 0.016709 - 1.151E-9 * d; /* Compute true longitude and radius vector */ E = M + e * RADEG * sind(M) * ( 1.0 + e * cosd(M) ); x = cosd(E) - e; y = sqrt( 1.0 - e*e ) * sind(E); *r = sqrt( x*x + y*y ); /* Solar distance */ v = atan2d( y, x ); /* True anomaly */ *lon = v + w; /* True solar longitude */ if ( *lon >= 360.0 ) *lon -= 360.0; /* Make it 0..360 degrees */ } void sun_RA_dec( double d, double *RA, double *dec, double *r ) { double lon, obl_ecl, x, y, z; /* Compute Sun's ecliptical coordinates */ sunpos( d, &lon, r ); /* Compute ecliptic rectangular coordinates (z=0) */ x = *r * cosd(lon); y = *r * sind(lon); /* Compute obliquity of ecliptic (inclination of Earth's axis) */ obl_ecl = 23.4393 - 3.563E-7 * d; /* Convert to equatorial rectangular coordinates - x is uchanged */ z = y * sind(obl_ecl); y = y * cosd(obl_ecl); /* Convert to spherical coordinates */ *RA = atan2d( y, x ); *dec = atan2d( z, sqrt(x*x + y*y) ); } /* sun_RA_dec */ /******************************************************************/ /* This function reduces any angle to within the first revolution */ /* by subtracting or adding even multiples of 360.0 until the */ /* result is >= 0.0 and < 360.0 */ /******************************************************************/ #define INV360 ( 1.0 / 360.0 ) double revolution( double x ) /*****************************************/ /* Reduce angle to within 0..360 degrees */ /*****************************************/ { return( x - 360.0 * floor( x * INV360 ) ); } /* revolution */ double rev180( double x ) /*********************************************/ /* Reduce angle to within +180..+180 degrees */ /*********************************************/ { return( x - 360.0 * floor( x * INV360 + 0.5 ) ); } /* revolution */ /*******************************************************************/ /* This function computes GMST0, the Greenwhich Mean Sidereal Time */ /* at 0h UT (i.e. the sidereal time at the Greenwhich meridian at */ /* 0h UT). GMST is then the sidereal time at Greenwich at any */ /* time of the day. I've generelized GMST0 as well, and define it */ /* as: GMST0 = GMST - UT -- this allows GMST0 to be computed at */ /* other times than 0h UT as well. While this sounds somewhat */ /* contradictory, it is very practical: instead of computing */ /* GMST like: */ /* */ /* GMST = (GMST0) + UT * (366.2422/365.2422) */ /* */ /* where (GMST0) is the GMST last time UT was 0 hours, one simply */ /* computes: */ /* */ /* GMST = GMST0 + UT */ /* */ /* where GMST0 is the GMST "at 0h UT" but at the current moment! */ /* Defined in this way, GMST0 will increase with about 4 min a */ /* day. It also happens that GMST0 (in degrees, 1 hr = 15 degr) */ /* is equal to the Sun's mean longitude plus/minus 180 degrees! */ /* (if we neglect aberration, which amounts to 20 seconds of arc */ /* or 1.33 seconds of time) */ /* */ /*******************************************************************/ double GMST0( double d ) { double sidtim0; /* Sidtime at 0h UT = L (Sun's mean longitude) + 180.0 degr */ /* L = M + w, as defined in sunpos(). Since I'm too lazy to */ /* add these numbers, I'll let the C compiler do it for me. */ /* Any decent C compiler will add the constants at compile */ /* time, imposing no runtime or code overhead. */ sidtim0 = revolution( ( 180.0 + 356.0470 + 282.9404 ) + ( 0.9856002585 + 4.70935E-5 ) * d ); return sidtim0; } /* GMST0 */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/calsupp.c0000755000076400001440000000264007055333670016117 /* calsupp.c -- public domain by Ray McVay */ /* This module provides three handy date related functions: ** dow() - Returns the day of the week for a given date ** IsLeap() - Returns 1 if a year is a leap year ** GetToday() - Returns today's date from the operating system */ #include /* ** Returns an integer that represents the day of the week for ** the date passed as parameters. ** ** day: day of month ** mon: month (1-12) ** yr: year ** ** returns 0-6 where 0 == sunday */ int dow(int day, int mon, int yr) { int dow; if (mon <= 2) { mon += 12; yr -= 1; } dow = (day + mon * 2 + ((mon + 1) * 6) / 10 + yr + yr / 4 - yr / 100 + yr / 400 + 2); dow = dow % 7; return ((dow ? dow : 7) - 1); } /* ** Returns 1 if yr is a leap year, 0 if it is not */ int IsLeap(int yr) { if (yr % 400 == 0) return 1; if (yr % 100 == 0) return 0; if (yr % 4 == 0) return 1; else return 0; } /* ** Returns the current day, month and year in the referenced variables */ void GetToday(int *day, int *mon, int *yr) { struct tm today; time_t ctime; time(&ctime); today = *localtime(&ctime); *day = today.tm_mday; *mon = today.tm_mon + 1; *yr = today.tm_year + 1900; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/crc_32.c0000755000076400001440000002105607055333714015524 /* Crc - 32 BIT ANSI X3.66 CRC checksum files */ #include #define OK 0 #define ERROR (-1) /**********************************************************************\ |* Demonstration program to compute the 32-bit CRC used as the frame *| |* check sequence in ADCCP (ANSI X3.66, also known as FIPS PUB 71 *| |* and FED-STD-1003, the U.S. versions of CCITT's X.25 link-level *| |* protocol). The 32-bit FCS was added via the Federal Register, *| |* 1 June 1982, p.23798. I presume but don't know for certain that *| |* this polynomial is or will be included in CCITT V.41, which *| |* defines the 16-bit CRC (often called CRC-CCITT) polynomial. FIPS *| |* PUB 78 says that the 32-bit FCS reduces otherwise undetected *| |* errors by a factor of 10^-5 over 16-bit FCS. *| \**********************************************************************/ /* Need an unsigned type capable of holding 32 bits; */ typedef unsigned long int UNS_32_BITS; /* Copyright (C) 1986 Gary S. Brown. You may use this program, or code or tables extracted from it, as desired without restriction.*/ /* First, the polynomial itself and its table of feedback terms. The */ /* polynomial is */ /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ /* Note that we take it "backwards" and put the highest-order term in */ /* the lowest-order bit. The X^32 term is "implied"; the LSB is the */ /* X^31 term, etc. The X^0 term (usually shown as "+1") results in */ /* the MSB being 1. */ /* Note that the usual hardware shift register implementation, which */ /* is what we're using (we're merely optimizing it by doing eight-bit */ /* chunks at a time) shifts bits into the lowest-order term. In our */ /* implementation, that means shifting towards the right. Why do we */ /* do it this way? Because the calculated CRC must be transmitted in */ /* order from highest-order term to lowest-order term. UARTs transmit */ /* characters in order from LSB to MSB. By storing the CRC this way, */ /* we hand it to the UART in the order low-byte to high-byte; the UART */ /* sends each low-bit to hight-bit; and the result is transmission bit */ /* by bit from highest- to lowest-order term without requiring any bit */ /* shuffling on our part. Reception works similarly. */ /* The feedback terms table consists of 256, 32-bit entries. Notes: */ /* */ /* 1. The table can be generated at runtime if desired; code to do so */ /* is shown later. It might not be obvious, but the feedback */ /* terms simply represent the results of eight shift/xor opera- */ /* tions for all combinations of data and CRC register values. */ /* */ /* 2. The CRC accumulation logic is the same for all CRC polynomials, */ /* be they sixteen or thirty-two bits wide. You simply choose the */ /* appropriate table. Alternatively, because the table can be */ /* generated at runtime, you can start by generating the table for */ /* the polynomial in question and use exactly the same "updcrc", */ /* if your application needn't simultaneously handle two CRC */ /* polynomials. (Note, however, that XMODEM is strange.) */ /* */ /* 3. For 16-bit CRCs, the table entries need be only 16 bits wide; */ /* of course, 32-bit entries work OK if the high 16 bits are zero. */ /* */ /* 4. The values must be right-shifted by eight bits by the "updcrc" */ /* logic; the shift must be unsigned (bring in zeroes). On some */ /* hardware you could probably optimize the shift in assembler by */ /* using byte-swap instructions. */ static UNS_32_BITS crc_32_tab[] = { /* CRC polynomial 0xedb88320 */ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; #define UPDC32(octet, crc) (crc_32_tab[((crc)\ ^ (octet)) & 0xff] ^ ((crc) >> 8)) main(int argc, char *argp[]) { register errors = 0; while(--argc > 0) errors |= crc32file( *++argp); return(errors != 0); } crc32file(char *name) { register FILE *fin; register unsigned long oldcrc32; register unsigned long crc32; register unsigned long oldcrc; register c; register long charcnt; oldcrc32 = 0xFFFFFFFF; charcnt = 0; #ifdef MSDOS if ((fin=fopen(name, "rb"))==NULL) #else if ((fin=fopen(name, "r"))==NULL) #endif { perror(name); return ERROR; } while ((c=getc(fin))!=EOF) { ++charcnt; oldcrc32 = UPDC32(c, oldcrc32); } if (ferror(fin)) { perror(name); charcnt = -1; } fclose(fin); crc32 = oldcrc32; oldcrc = oldcrc32 = ~oldcrc32; /**/ crc32 = UPDC32((oldcrc32 & 0377), crc32); oldcrc32 >>=8; crc32 = UPDC32((oldcrc32 & 0377), crc32); oldcrc32 >>=8; crc32 = UPDC32((oldcrc32 & 0377), crc32); oldcrc32 >>=8; crc32 = UPDC32((oldcrc32 & 0377), crc32); oldcrc32 >>=8; printf("%08lX ", crc32); /**/ printf("%08lX %7ld %s\n", oldcrc, charcnt, name); return OK; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/tasker.c0000755000076400001440000000521707055334302015735 /* ** Tasker.C ** ** public domain by David Gibbs */ struct ts_os_ver t_os_ver[TOT_OS]; int t_os_type; int t_os; const char *t_os_name[TOT_OS] = { "DOS", "OS/2 DOS", "DESQview", "Windows Std", "Windows 386" }; int get_os (void) { union REGS t_regs; t_os_type = 0; t_os = 0; /* test for DOS or OS/2 */ if (_osmajor < 10) { t_os_ver[DOS].maj = _osmajor; t_os_ver[DOS].min = _osminor; t_os_type = t_os_type | is_DOS; } else { t_os_type = t_os_type | is_OS2; t_os_ver[OS2].maj = _osmajor/10; t_os_ver[OS2].min = _osminor; } /* test for Windows */ t_regs.x.ax = 0x4680; int86(0x2F, &t_regs, &t_regs); if (t_regs.x.ax == 0x0000) { t_os_ver[WINS].maj = 3; t_os_ver[WINS].min = 0; t_os_type = t_os_type | is_WINS; } else { t_regs.x.ax = 0x1600 ; int86(0x2F, &t_regs, &t_regs); switch (t_regs.h.al) { case 0x00 : case 0x80 : case 0x01 : case 0xFF : break; default : t_os_type = t_os_type | is_WIN3; t_os_ver[WIN3].maj = t_regs.h.al; t_os_ver[WIN3].min = t_regs.h.ah; break ; } /* endswitch */ } /* endif */ /* Test for DESQview */ t_regs.x.cx = 0x4445; /* load incorrect date */ t_regs.x.dx = 0x5351; t_regs.x.ax = 0x2B01; /* DV set up call */ intdos(&t_regs, &t_regs); if (t_regs.h.al != 0xFF) { t_os_type = t_os_type | is_DV; t_os_ver[DV].maj = t_regs.h.bh; t_os_ver[DV].min = t_regs.h.bl; } if(t_os_type & is_DOS) t_os = DOS; if(t_os_type & is_WINS) t_os = WINS; if(t_os_type & is_WIN3) t_os = WIN3; if(t_os_type & is_DV) t_os = DV; if(t_os_type & is_OS2) t_os = OS2; return(t_os-1); } void t_slice(void) { union REGS t_regs; switch (t_os) { case DOS : break; case OS2 : case WIN3 : case WINS : t_regs.x.ax = 0x1680; int86(0x2f,&t_regs,&t_regs); break; case DV : t_regs.x.ax = 0x1000; int86(0x15,&t_regs,&t_regs); break; } /* switch(t_os) */ } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/tasker.h0000755000076400001440000000136607055334302015743 /* ** Tasker.H ** ** public domain by David Gibbs */ #ifndef DG_TASKER #define DG_TASKER struct ts_os_ver { int maj; int min; }; #define TOT_OS 5 #define DOS 0 #define OS2 1 #define DV 2 #define WINS 3 #define WIN3 4 /* 76543210 */ #define is_DOS 0x01 /* b'00000001' */ #define is_OS2 0x02 /* b'00000010' */ #define is_DV 0x04 /* b'00000100' */ #define is_WINS 0x08 /* b'00001000' */ #define is_WIN3 0x10 /* b'00010000' */ extern int t_os_type; extern int t_os; extern const char *t_os_name[TOT_OS]; extern struct ts_os_ver t_os_ver[TOT_OS]; /* Function prototypes */ int get_os(); void t_slice(); #endif /* DG_TASKER */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ptr_help.txt0000755000076400001440000012344707055334170016667 UNDERSTANDING POINTERS (for beginners) by Ted Jensen Version 0.0 This material is hereby placed in the public domain. September 5, 1993 TABLE OF CONTENTS INTRODUCTION; CHAPTER 1: What is a pointer? CHAPTER 2: Pointer types and Arrays CHAPTER 3: Pointers and Strings CHAPTER 4: More on Strings CHAPTER 5: Pointers and Structures CHAPTER 6: Some more on Strings, and Arrays of Strings EPILOG: ================================================================== INTRODUCTION: Over a period of several years of monitoring various telecommunication conferences on C I have noticed that one of the most difficult problems for beginners was the understanding of pointers. After writing dozens of short messages in attempts to clear up various fuzzy aspects of dealing with pointers, I set up a series of messages arranged in "chapters" which I could draw from or email to various individuals who appeared to need help in this area. Recently, I posted all of this material in the FidoNet CECHO conference. It received such a good acceptance, I decided to clean it up a little and submit it for inclusion in Bob Stout's SNIPPETS file. It is my hope that I can find the time to expand on this text in the future. To that end, I am hoping that those who read this and find where it is lacking, or in error, or unclear, would notify me of same so the next version, should there be one, I can correct these deficiencys. It is impossible to acknowledge all those whose messages on pointers in various nets contributed to my knowledge in this area. So, I will just say Thanks to All. I frequent the CECHO on FidoNet via RBBSNet and can be contacted via the echo itself or by email at: RBBSNet address 8:916/1. I can also be reached via Internet email at ted.jensen@spacebbs.com Or Ted Jensen P.O. Box 324 Redwood City, CA 94064 ================================================================== CHAPTER 1: What is a pointer? One of the things beginners in C find most difficult to understand is the concept of pointers. The purpose of this document is to provide an introduction to pointers and their use to these beginners. I have found that often the main reason beginners have a problem with pointers is that they have a weak or minimal feeling for variables, (as they are used in C). Thus we start with a discussion of C variables in general. A variable in a program is something with a name, the value of which can vary. The way the compiler and linker handles this is that it assigns a specific block of memory within the computer to hold the value of that variable. The size of that block depends on the range over which the variable is allowed to vary. For example, on PC's the size of an integer variable is 2 bytes, and that of a long integer is 4 bytes. In C the size of a variable type such as an integer need not be the same on all types of machines. When we declare a variable we inform the compiler of two things, the name of the variable and the type of the variable. For example, we declare a variable of type integer with the name k by writing: int k; On seeing the "int" part of this statement the compiler sets aside 2 bytes (on a PC) of memory to hold the value of the integer. It also sets up a symbol table. And in that table it adds the symbol k and the address in memory where those 2 bytes were set aside. Thus, later if we write: k = 2; at run time we expect that the value 2 will be placed in that memory location reserved for the storage of the value of k. In a sense there are two "values" associated with k, one being the value of the integer stored there (2 in the above example) and the other being the "value" of the memory location where it is stored, i.e. the address of k. Some texts refer to these two values with the nomenclature rvalue (right value, pronounced "are value") and lvalue (left value, pronunced "el value") respectively. The lvalue is the value permitted on the left side of the assignment operator '=' (i.e. the address where the result of evaluation of the right side ends up). The rvalue is that which is on the right side of the assignment statment, the '2' above. Note that rvalues cannot be used on the left side of the assignment statement. Thus: 2 = k; is illegal. Okay, now consider: int j, k; k = 2; j = 7; <-- line 1 k = j; <-- line 2 In the above, the compiler interprets the j in line 1 as the address of the variable j (its lvalue) and creates code to copy the value 7 to that address. In line 2, however, the j is interpreted as its rvalue (since it is on the right hand side of the assignment operator '='). That is, here the j refers to the value _stored_ at the memory location set aside for j, in this case 7. So, the 7 is copied to the address designated by the lvalue of k. In all of these examples, we are using 2 byte integers so all copying of rvalues from one storage location to the other is done by copying 2 bytes. Had we been using long integers, we would be copying 4 bytes. Now, let's say that we have a reason for wanting a variable designed to hold an lvalue (an address). The size required to hold such a value depends on the system. On older desk top computers with 64K of memory total, the address of any point in memory can be contained in 2 bytes. Computers with more memory would require more bytes to hold an address. Some computers, such as the IBM PC might require special handling to hold a segment and offset under certain circumstances. The actual size required is not too important so long as we have a way of informing the compiler that what we want to store is an address. Such a variable is called a "pointer variable" (for reasons which will hopefully become clearer a little later). In C when we define a pointer variable we do so by preceding its name with an asterisk. In C we also give our pointer a type which, in this case, refers to the type of data stored at the address we will be storing in our pointer. For example, consider the variable definition: int *ptr; ptr is the _name_ of our variable (just as 'k' was the name of our integer variable). The '*' informs the compiler that we want a pointer variable, i.e. to set aside however many bytes is required to store an address in memory. The "int" says that we intend to use our pointer variable to store the address of an integer. Such a pointer is said to "point to" an integer. Note, however, that when we wrote "int k;" we did not give k a value. If this definiton was made outside of any function many compilers will initialize it to zero. Simlarly, ptr has no value, that is we haven't stored an address in it in the above definition. In this case, again if the definition is outside of any function, it is intialized to a value #defined by your compiler as NULL. It is called a NULL pointer. While in most cases NULL is #defined as zero, it need not be. That is, different compilers handle this differently. Also note that while zero is an integer, NULL need not be. But, back to using our new variable ptr. Suppose now that we want to store in ptr the address of our integer variable k. To do this we use the unary '&' operator and write: ptr = &k; What the '&' operator does is retrieve the lvalue (address) of k, even though k is on the right hand side of the assignment operator '=', and copies that to the contents of our pointer ptr. Now, ptr is said to "point to" k. Bear with us now, there is only one more operator we need to discuss. The "dereferencing operator" is the asterisk and it is used as follows: *ptr = 7; will copy 7 to the address pointed to by ptr. Thus if ptr "points to" (contains the address of) k, the above statement will set the value of k to 7. That is, when we use the '*' this way we are refering to the value of that which ptr is pointing at, not the value of the pointer itself. Similarly, we could write: printf("%d\n",*ptr); to print to the screen the integer value stored at the address pointed to by "ptr". One way to see how all this stuff fits together would be to run the following program and then review the code and the output carefully. ------------------------------------------------- #include int j, k; int *ptr; int main(void) { j = 1; k = 2; ptr = &k; printf("\n"); printf("j has the value %d and is stored at %p\n",j,&j); printf("k has the value %d and is stored at %p\n",k,&k); printf("ptr has the value %p and is stored at %p\n",ptr,&ptr); printf("The value of the integer pointed to by ptr is %d\n", *ptr); return 0; } --------------------------------------- To review: A variable is defined by giving it a type and a name (e.g. int k;) A pointer variable is defined by giving it a type and a name (e.g. int *ptr) where the asterisk tells the compiler that the variable named ptr is a pointer variable and the type tells the compiler what type the pointer is to point to (integer in this case). Once a variable is defined, we can get its address by preceding its name with the unary '&' operator, as in &k. We can "dereference" a pointer, i.e. refer to the value of that which it points to, by using the unary '*' operator as in *ptr. An "lvalue" of a variable is the value of its address, i.e. where it is stored in memory. The "rvalue" of a variable is the value stored in that variable (at that address). ================================================================== CHAPTER 2: Pointer types and Arrays Okay, let's move on. Let us consider why we need to identify the "type" of variable that a pointer points to, as in: int *ptr; One reason for doing this is so that later, once ptr "points to" something, if we write: *ptr = 2; the compiler will know how many bytes to copy into that memory location pointed to by ptr. If ptr was defined as pointing to an integer, 2 bytes would be copied, if a long, 4 bytes would be copied. Similarly for floats and doubles the appropriate number will be copied. But, defining the type that the pointer points to permits a number of other interesting ways a compiler can interpret code. For example, consider a block in memory consisting if ten integers in a row. That is, 20 bytes of memory are set aside to hold 10 integer. Now, let's say we point our integer pointer ptr at the first of these integers. Furthermore lets say that integer is located at memory location 100 (decimal). What happens when we write: ptr + 1; Because the compiler "knows" this is a pointer (i.e. its value is an address) and that it points to an integer (its current address, 100, is the address of an integer), it adds 2 to ptr instead of 1, so the pointer "points to" the _next_ _integer_, at memory location 102. Similarly, were the ptr defined as a pointer to a long, it would add 4 to it instead of 1. The same goes for other data types such as floats, doubles, or even user defined data types such as structures. Similarly, since ++ptr and ptr++ are both equivalent to ptr + 1 (though the point in the program when ptr is incremented may be different), incrementing a pointer using the unary ++ operator, either pre- or post-, increments the address it stores by the amount sizeof(type) (i.e. 2 for an integer, 4 for a long, etc.). Since a block of 10 integers located contiguously in memory is, by definition, an array of integers, this brings up an interesting relationship between arrays and pointers. Consider the following: int my_array[] = {1,23,17,4,-5,100}; Here we have an array containing 6 integers. We refer to each of these integers by means of a subscript to my_array, i.e. using my_array[0] through my_array[5]. But, we could alternatively access them via a pointer as follows: int *ptr; ptr = &my_array[0]; /* point our pointer at the first integer in our array */ And then we could print out our array either using the array notation or by dereferencing our pointer. The following code illustrates this: ------------------------------------------------------ #include int my_array[] = {1,23,17,4,-5,100}; int *ptr; int main(void) { int i; ptr = &my_array[0]; /* point our pointer to the array */ printf("\n\n"); for(i = 0; i < 6; i++) { printf("my_array[%d] = %d ",i,my_array[i]); /*<-- A */ printf("ptr + %d = %d\n",i, *(ptr + i)); /*<-- B */ } return 0; } ---------------------------------------------------- Compile and run the above program and carefully note lines A and B and that the program prints out the same values in either case. Also note how we dereferenced our pointer in line B, i.e. we first added i to it and then dereferenced the the new pointer. Change line B to read: printf("ptr + %d = %d\n",i, *ptr++); and run it again... then change it to: printf("ptr + %d = %d\n",i, *(++ptr)); and try once more. Each time try and predict the outcome and carefully look at the actual outcome. In C, the standard states that wherever we might use &var_name[0] we can replace that with var_name, thus in our code where we wrote: ptr = &my_array[0]; we can write: ptr = my_array; to achieve the same result. This leads many texts to state that the name of an array is a pointer. While this is true, I prefer to mentally think "the name of the array is a _constant_ pointer". Many beginners (including myself when I was learning) forget that _constant_ qualifier. In my opinon this leads to some confusion. For example, while we can write ptr = my_array; we cannot write my_array = ptr; The reason is that the while ptr is a variable, my_array is a constant. That is, the location at which the first element of my_array will be stored cannot be changed once my_array[] has been declared. Modify the example program above by changing ptr = &my_array[0]; to ptr = my_array; and run it again to verify the results are identical. Now, let's delve a little further into the difference between the names "ptr" and "my_array" as used above. We said that my_array is a constant pointer. What do we mean by that? Well, to understand the term "constant" in this sense, let's go back to our definition of the term "variable". When we define a variable we set aside a spot in memory to hold the value of the appropriate type. Once that is done the name of the variable can be interpreted in one of two ways. When used on the left side of the assignment operator, the compiler interprets it as the memory location to which to move that which lies on the right side of the assignment operator. But, when used on the right side of the assignment operator, the name of a variable is interpreted to mean the contents stored at that memory address set aside to hold the value of that variable. With that in mind, let's now consider the simplest of constants, as in: int i, k; i = 2; Here, while "i" is a variable and then occupies space in the data portion of memory, "2" is a constant and, as such, instead of setting aside memory in the data segment, it is imbedded directly in the code segment of memory. That is, while writing something like k = i; tells the compiler to create code which at run time will look at memory location &i to determine the value to be moved to k, code created by i = 2; simply puts the '2' in the code and there is no referencing of the data segment. Similarly, in the above, since "my_array" is a constant, once the compiler establishes where the array itself is to be stored, it "knows" the address of my_array[0] and on seeing: ptr = my_array; it simply uses this address as a constant in the code segment and there is no referencing of the data segment beyond that. Well, that's a lot of technical stuff to digest and I don't expect a beginner to understand all of it on first reading. With time and experimentation you will want to come back and re-read the first 2 chapters. But for now, let's move on to the relationship between pointers, character arrays, and strings. ================================================================== CHAPTER 3: Pointers and Strings The study of strings is useful to further tie in the relationship between pointers and arrays. It also makes it easy to illustrate how some of the standard C string functions can be implemented. Finally it illustrates how and when pointers can and should be passed to functions. In C, strings are arrays of characters. This is not necessarily true in other languages. In Pascal or (most versions of) Basic, strings are treated differently from arrays. To start off our discussion we will write some code which, while preferred for illustrative purposes, you would probably never write in an actual program. Consider, for example: char my_string[40]; my_string[0] = 'T'; my_string[1] = 'e'; my_string[2] = 'd': my_string[3] = '\0'; While one would never build a string like this, the end result is a string in that it is an array of characters _terminated_with_a_nul_character_. By definition, in C, a string is an array of characters terminated with the nul character. Note that "nul" is _not_ the same as "NULL". The nul refers to a zero as is defined by the escape sequence '\0'. That is it occupies one byte of memory. The NULL, on the other hand, is the value of an uninitialized pointer and pointers require more than one byte of storage. NULL is #defined in a header file in your C compiler, nul may not be #defined at all. Since writing the above code would be very time consuming, C permits two alternate ways of achieving the same thing. First, one might write: char my_string[40] = {'T', 'e', 'd', '\0',}; But this also takes more typing than is convenient. So, C permits: char my_string[40] = "Ted"; When the double quotes are used, instead of the single quotes as was done in the previous examples, the nul character ( '\0' ) is automatically appended to the end of the string. In all of the above cases, the same thing happens. The compiler sets aside an contiguous block of memory 40 bytes long to hold characters and initialized it such that the first 4 characters are Ted\0. Now, consider the following program: ------------------program 3.1------------------------------------- #include char strA[80] = "A string to be used for demonstration purposes"; char strB[80]; int main(void) { char *pA; /* a pointer to type character */ char *pB; /* another pointer to type character */ puts(strA); /* show string A */ pA = strA; /* point pA at string A */ puts(pA); /* show what pA is pointing to */ pB = strB; /* point pB at string B */ putchar('\n'); /* move down one line on the screen */ while(*pA != '\0') /* line A (see text) */ { *pB++ = *pA++; /* line B (see text) */ } *pB = '\0'; /* line C (see text) */ puts(strB); /* show strB on screen */ return 0; } --------- end program 3.1 ------------------------------------- In the above we start out by defining two character arrays of 80 characters each. Since these are globally defined, they are initialized to all '\0's first. Then, strA has the first 42 characters initialized to the string in quotes. Now, moving into the code, we define two character pointers and show the string on the screen. We then "point" the ponter pA at strA. That is, by means of the assignment statement we copy the address of strA[0] into our variable pA. We now use puts() to show that which is pointed to by pA on the screen. Consider here that the function prototype for puts() is: int puts(const char *s); For the moment, ignore the "const". The parameter passed to puts is a pointer, that is the _value_ of a pointer (since all parameters in C are passed by value), and the value of a pointer is the address to which it points, or, simply, an address. Thus when we write: puts(strA); as we have seen, we are passing the address of strA[0]. Similarly, when we write: puts(pA); we are passing the same address, since we have set pA = strA; Given that, follow the code down to the while() statement on line A. Line A states: While the character pointed to by pA (i.e. *pA) is not a nul character (i.e. the terminating '\0'), do the following: line B states: copy the character pointed to by pA to the space pointed to by pB, then increment pA so it points to the next character and pB so it points to the next space. Note that when we have copied the last character, pA now points to the terminating nul character and the loop ends. However, we have not copied the nul character. And, by definition a string in C _must_ be nul terminated. So, we add the nul character with line C. It is very educational to run this program with your debugger while watching strA, strB, pA and pB and single stepping through the program. It is even more educational if instead of simply defining strB[] as has been done above, initialize it also with something like: strB[80] = "12345678901234567890123456789012345678901234567890" where the number of digits used is greater than the length of strA and then repeat the single stepping procedure while watching the above variables. Give these things a try! Of course, what the above program illustrates is a simple way of copying a string. After playing with the above until you have a good understanding of what is happening, we can proceed to creating our own replacement for the standard strcpy() that comes with C. It might look like: char *my_strcpy(char *destination, char *source) { char *p = destination while (*source != '\0') { *p++ = *source++; } *p = '\0'; return destination. } In this case, I have followed the practice used in the standard routine of returning a pointer to the destination. Again, the function is designed to accept the values of two character pointers, i.e. addresses, and thus in the previous program we could write: int main(void) { my_strcpy(strB, strA); puts(strB); } I have deviated slightly from the form used in standard C which would have the prototype: char *my_strcpy(char *destination, const char *source); Here the "const" modifier is used to assure the user that the function will not modify the contents pointed to by the source pointer. You can prove this by modifying the function above, and its prototype, to include the "const" modifier as shown. Then, within the function you can add a statement which attempts to change the contents of that which is pointed to by source, such as: *source = 'X'; which would normally change the first character of the string to an X. The const modifier should cause your compiler to catch this as an error. Try it and see. Now, let's consider some of the things the above examples have shown us. First off, consider the fact that *ptr++ is to be interpreted as returning the value pointed to by ptr and then incrementing the pointer value. On the other hand, note that this has to do with the precedence of the operators. Were we to write (*ptr)++ we would increment, not the pointer, but that which the pointer points to! i.e. if used on the first character of the above example string the 'T' would be incremented to a 'U'. You can write some simple example code to illustrate this. Recall again that a string is nothing more than an array of characters. What we have done above is deal with copying an array. It happens to be an array of characters but the technique could be applied to an array of integers, doubles, etc. In those cases, however, we would not be dealing with strings and hence the end of the array would not be _automatically_ marked with a special value like the nul character. We could implement a version that relied on a special value to identify the end. For example, we could copy an array of postive integers by marking the end with a negative integer. On the other hand, it is more usual that when we write a function to copy an array of items other than strings we pass the function the number of items to be copied as well as the address of the array, e.g. something like the following prototype might indicate: void int_copy(int *ptrA, int *ptrB, int nbr); where nbr is the number of integers to be copied. You might want to play with this idea and create an array of integers and see if you can write the function int_copy() and make it work. Note that this permits using functions to manipulate very large arrays. For example, if we have an array of 5000 integers that we want to manipulate with a function, we need only pass to that function the address of the array (and any auxiliary information such as nbr above, depending on what we are doing). The array itself does _not_ get passed, i.e. the whole array is not copied and put on the stack before calling the function, only its address is sent. Note that this is different from passing, say an integer, to a function. When we pass an integer we make a copy of the integer, i.e. get its value and put it on the stack. Within the function any manipulation of the value passed can in no way effect the original integer. But, with arrays and pointers we can pass the address of the variable and hence manipulate the values of of the original variables. ================================================================== CHAPTER 4: More on Strings Well, we have progressed quite aways in a short time! Let's back up a little and look at what was done in Chapter 3 on copying of strings but in a different light. Consider the following function: char *my_strcpy(char dest[], char source[]) { int i = 0; while (source[i] != '\0') { dest[i] = source[i]; i++; } dest[i] = '\0'; return dest; } Recall that strings are arrays of characters. Here we have chosen to use array notation instead of pointer notation to do the actual copying. The results are the same, i.e. the string gets copied using this notation just as accurately as it did before. This raises some interesting points which we will discuss. Since parameters are passed by value, in both the passing of a character pointer or the name of the array as above, what actually gets passed is the address of the first element of each array. Thus, the numerical value of the parameter passed is the same whether we use a character pointer or an array name as a parameter. This would tend to imply that somehow: source[i] is the same as *(p+i); In fact, this is true, i.e wherever one writes a[i] it can be replaced with *(a + i) without any problems. In fact, the compiler will create the same code in either case. Now, looking at this last expression, part of it.. (a + i) is a simple addition using the + operator and the rules of c state that such an expression is commutative. That is (a + i) is identical to (i + a). Thus we could write *(i + a) just as easily as *(a + i). But *(i + a) could have come from i[a] ! From all of this comes the curious truth that if: char a[20]; int i; writing a[3] = 'x'; is the same as writing 3[a] = 'x'; Try it! Set up an array of characters, integers or longs, etc. and assigned the 3rd or 4th element a value using the conventional approach and then print out that value to be sure you have that working. Then reverse the array notation as I have done above. A good compiler will not balk and the results will be identical. A curiosity... nothing more! Now, looking at our function above, when we write: dest[i] = source[i]; this gets interpreted by C to read: *(dest + i) = *(source + i); But, this takes 2 additions for each value taken on by i. Additions, generally speaking, take more time than incrementations (such as those done using the ++ operator as in i++). This may not be true in modern optimizing compilers, but one can never be sure. Thus, the pointer version may be a bit faster than the array version. Another way to speed up the pointer version would be to change: while (*source != '\0') to simply while (*source) since the value within the parenthesis will go to zero (FALSE) at the same time in either case. At this point you might want to experiment a bit with writing some of your own programs using pointers. Manipulating strings is a good place to experiment. You might want to write your own versions of such standard functions as: strlen(); strcat(); strchr(); and any others you might have on your system. We will come back to strings and their manipulation through pointers in a future chapter. For now, let's move on and discuss structures for a bit. ================================================================== CHAPTER 5: Pointers and Structures As you may know, we can declare the form of a block of data containing different data types by means of a structure declaration. For example, a personnel file might contain structures which look something like: struct tag{ char lname[20]; /* last name */ char fname[20]; /* first name */ int age; /* age */ float rate; /* e.g. 12.75 per hour */ }; Let's say we have an bunch of these structures in a disk file and we want to read each one out and print out the first and last name of each one so that we can have a list of the people in our files. The remaining information will not be printed out. We will want to do this printing with a function call and pass to that function a pointer to the structure at hand. For demonstration purposes I will use only one structure for now. But realize the goal is the writing of the function, not the reading of the file which, presumably, we know how to do. For review, recall that we can access structure members with the dot operator as in: --------------- program 5.1 ------------------ #include #include struct tag{ char lname[20]; /* last name */ char fname[20]; /* first name */ int age; /* age */ float rate; /* e.g. 12.75 per hour */ }; struct tag my_struct; /* declare the structure m_struct */ int main(void) { strcpy(my_struct.lname,"Jensen"); strcpy(my_struct.fname,"Ted"); printf("\n%s ",my_struct.fname); printf("%s\n",my_struct.lname); return 0; } -------------- end of program 5.1 -------------- Now, this particular structure is rather small compared to many used in C programs. To the above we might want to add: date_of_hire; date_of_last_raise; last_percent_increase; emergency_phone; medical_plan; Social_S_Nbr; etc..... Now, if we have a large number of employees, what we want to do manipulate the data in these structures by means of functions. For example we might want a function print out the name of any structure passed to it. However, in the original C (Kernighan & Ritchie) it was not possible to pass a structure, only a pointer to a structure could be passed. In ANSI C, it is now permissible to pass the complete structure. But, since our goal here is to learn more about pointers, we won't pursue that. Anyway, if we pass the whole structure it means there must be enough room on the stack to hold it. With large structures this could prove to be a problem. However, passing a pointer uses a minimum amount of stack space. In any case, since this is a discussion of pointers, we will discuss how we go about passing a pointer to a structure and then using it within the function. Consider the case described, i.e. we want a function that will accept as a parameter a pointer to a structure and from within that function we want to access members of the structure. For example we want to print out the name of the employee in our example structure. Okay, so we know that our pointer is going to point to a structure declared using struct tag. We define such a pointer with the definition: struct tag *st_ptr; and we point it to our example structure with: st_ptr = &my_struct; Now, we can access a given member by de-referencing the pointer. But, how do we de-reference the pointer to a structure? Well, consider the fact that we might want to use the pointer to set the age of the employee. We would write: (*st_ptr).age = 63; Look at this carefully. It says, replace that within the parenthesis with that which st_ptr points to, which is the structure my_struct. Thus, this breaks down to the same as my_struct.age. However, this is a fairly often used expression and the designers of C have created an alternate syntax with the same meaning which is: st_ptr->age = 63; With that in mind, look at the following program: ------------ program 5.2 -------------- #include #include struct tag{ /* the structure type */ char lname[20]; /* last name */ char fname[20]; /* first name */ int age; /* age */ float rate; /* e.g. 12.75 per hour */ }; struct tag my_struct; /* define the structure */ void show_name(struct tag *p); /* function prototype */ int main(void) { struct tag *st_ptr; /* a pointer to a structure */ st_ptr = &my_struct; /* point the pointer to my_struct */ strcpy(my_struct.lname,"Jensen"); strcpy(my_struct.fname,"Ted"); printf("\n%s ",my_struct.fname); printf("%s\n",my_struct.lname); my_struct.age = 63; show_name(st_ptr); /* pass the pointer */ return 0; } void show_name(struct tag *p) { printf("\n%s ", p->fname); /* p points to a structure */ printf("%s ", p->lname); printf("%d\n", p->age); } -------------------- end of program 5.2 ---------------- Again, this is a lot of information to absorb at one time. The reader should compile and run the various code snippets and using a debugger monitor things like my_struct and p while single stepping through the main and following the code down into the function to see what is happening. ================================================================== CHAPTER 6: Some more on Strings, and Arrays of Strings Well, let's go back to strings for a bit. In the following all assignments are to be understood as being global, i.e. made outside of any function, including main. We pointed out in an earlier chapter that we could write: char my_string[40] = "Ted"; which would allocate space for a 40 byte array and put the string in the first 4 bytes (three for the characters in the quotes and a 4th to handle the terminating '\0'. Actually, if all we wanted to do was store the name "Ted" we could write: char my_name[] = "Ted"; and the compiler would count the characters, leave room for the nul character and store the total of the four characters in memory the location of which would be returned by the array name, in this case my_string. In some code, instead of the above, you might see: char *my_name = "Ted"; which is an alternate approach. Is there a difference between these? The answer is.. yes. Using the array notation 4 bytes of storage in the static memory block are taken up, one for each character and one for the nul character. But, in the pointer notation the same 4 bytes required, _plus_ N bytes to store the pointer variable my_name (where N depends on the system but is usually a minimum of 2 bytes and can be 4 or more). In the array notation, my_name is a constant (not a variable). In the pointer notation my_name is a variable. As to which is the _better_ method, that depends on what you are going to do within the rest of the program. Let's now go one step further and consider what happens if each of these definitions are done within a function as opposed to globally outside the bounds of any function. void my_function_A(char *ptr) { char a[] = "ABCDE"; . . } void my_function_B(char *ptr) { char *cp = "ABCDE"; . . } Here we are dealing with automatic variables in both cases. In my_function_A the automatic variable is the character array a[]. In my_function_B it is the pointer cp. While C is designed in such a way that a stack is not required on those processors which don't use them, my particular processor (80286) has a stack. I wrote a simple program incorporating functions similar to those above and found that in my_function_A the 5 characters in the string were all stored on the stack. On the other hand, in my_function_B, the 5 characters were stored in the data space and the pointer was stored on the stack. By making a[] static I could force the compiler to place the 5 characters in the data space as opposed to the stack. I did this exercise to point out just one more difference between dealing with arrays and dealing with pointers. By the way, array initialization of automatic variables as I have done in my_function_A was illegal in the older K&R C and only "came of age" in the newer ANSI C. A fact that may be important when one is considering portabilty and backwards compatability. As long as we are discussing the relationship/differences between pointers and arrays, let's move on to multi-dimensional arrays. Consider, for example the array: char multi[5][10]; Just what does this mean? Well, let's consider it in the following light. char multi[5][10]; ^^^^^^^^^^^^^ If we take the first, underlined, part above and consider it to be a variable in its own right, we have an array of 10 characters with the "name" multi[5]. But this name, in itself, implies an array of 5 somethings. In fact, it means an array of five 10 character arrays. Hence we have an array of arrays. In memory we might think of this as looking like: multi[0] = "0123456789" multi[1] = "abcdefghij" multi[2] = "ABCDEFGHIJ" multi[3] = "9876543210" multi[4] = "JIHGFEDCBA" with individual elements being, for example: multi[0][3] = '3' multi[1][7] = 'h' multi[4][0] = 'J' Since arrays are to be contiguous, our actual memory block for the above should look like: "0123456789abcdefghijABCDEFGHIJ9876543210JIHGFEDCBA" Now, the compiler knows how many columns are present in the array so it can interpret multi + 1 as the address of the 'a' in the 2nd row above. That is, it adds 10, the number of columns, to get this location. If we were dealing with integers and an array with the same dimension the compiler would add 10*sizeof(int) which, on my machine, would be 20. Thus, the address of the "9" in the 4th row above would be &multi[3][0] or *(multi + 3) in pointer notation. To get to the content of the 2nd element in row 3 we add 1 to this address and dereference the result as in *(*(multi + 3) + 1) With a little thought we can see that: *(*(multi + row) + col) and multi[row][col] yield the same results. The following program illustrates this using integer arrays instead of character arrays. ------------------- program 6.1 ---------------------- #include #define ROWS 5 #define COLS 10 int multi[ROWS][COLS]; int main(void) { int row, col; for (row = 0; row < ROWS; row++) for(col = 0; col < COLS; col++) multi[row][col] = row*col; for (row = 0; row < ROWS; row++) for(col = 0; col < COLS; col++) { printf("\n%d ",multi[row][col]); printf("%d ",*(*(multi + row) + col)); } return 0; } ----------------- end of program 6.1 --------------------- Because of the double de-referencing required in the pointer version, the name of a 2 dimensional array is said to be a pointer to a pointer. With a three dimensional array we would be dealing with an array of arrays of arrays and a pointer to a pointer to a pointer. Note, however, that here we have initially set aside the block of memory for the array by defining it using array notation. Hence, we are dealing with an constant, not a variable. That is we are talking about a fixed pointer not a variable pointer. The dereferencing function used above permits us to access any element in the array of arrays without the need of changing the value of that pointer (the address of multi[0][0] as given by the symbol "multi"). EPILOG: I have written the preceding material to provide an introduction to pointers for newcomers to C. In C, the more one understands about pointers the greater flexibility one has in the writing of code. The above has just scratched the surface of the subject. In time I hope to expand on this material. Therefore, if you have questions, comments, criticisms, etc. concerning that which has been presented, I would greatly appreciate your contacting me using one of the mail addresses cited in the Introduction. Ted Jensen c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/xstrcat.c0000755000076400001440000000127007055334352016134 /* ** XSTRCAT.C - String concatenation function ** ** Notes: 1st argument must be a buffer large enough to contain the ** concatenated strings. ** ** 2nd thru nth arguments are the string to concatenate. ** ** (n+1)th argument must be NULL to terminate the list. */ #include char *xstrcat(char *des, char *src, ...) { char *destination = des; va_list v; va_start(v, src); while (src != 0) { while (*src != 0) *des++ = *src++; src = va_arg(v, char *); } *des = 0; va_end(v); return destination; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/xstrcmp.c0000755000076400001440000000307007055334352016144 /* ** xstrcmp() - compares strings using DOS wildcards ** 'mask' may contain '*' and '?' ** returns 1 if 's' matches 'mask', otherwise 0 ** public domain by Steffen Offermann 1991 */ int xstrcmp (char *mask, char *s) { while (*mask) { switch (*mask) { case '?': if (!*s) return (0); s++; mask++; break; case '*': while (*mask == '*') mask++; if (!*mask) return ( 1 ); if (*mask == '?') break; while (*s != *mask) { if (!*s) return (0); s++; } s++; mask++; break; default: if (*s != *mask) return (0); s++; mask++; } } if (!*s && *mask) return (0); return ( 1 ); } #ifdef TEST #include void main(int argc, char *argv[]) { if (3 != argc) { puts("Usage: XSTRCMP string_1 string_2"); return; } printf("xstrcmp(\"%s\", \"%s\") returned %d\n", argv[1], argv[2], xstrcmp(argv[1], argv[2])); } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bmhsrch.c0000755000076400001440000000415007055333655016077 /* ** Case-sensitive Boyer-Moore-Horspool pattern match ** ** public domain by Raymond Gardner 7/92 ** ** limitation: pattern length + string length must be less than 32767 ** ** 10/21/93 rdg Fixed bug found by Jeff Dunlop */ #include /* rdg 10/93 */ #include #include typedef unsigned char uchar; #define LARGE 32767 static int patlen; static int skip[UCHAR_MAX+1]; /* rdg 10/93 */ static int skip2; static uchar *pat; void bmh_init(const char *pattern) { int i, lastpatchar; pat = (uchar *)pattern; patlen = strlen(pattern); for (i = 0; i <= UCHAR_MAX; ++i) /* rdg 10/93 */ skip[i] = patlen; for (i = 0; i < patlen; ++i) skip[pat[i]] = patlen - i - 1; lastpatchar = pat[patlen - 1]; skip[lastpatchar] = LARGE; skip2 = patlen; /* Horspool's fixed second shift */ for (i = 0; i < patlen - 1; ++i) { if (pat[i] == lastpatchar) skip2 = patlen - i - 1; } } char *bmh_search(const char *string, const int stringlen) { int i, j; char *s; i = patlen - 1 - stringlen; if (i >= 0) return NULL; string += stringlen; for ( ;; ) { while ( (i += skip[((uchar *)string)[i]]) < 0 ) ; /* mighty fast inner loop */ if (i < (LARGE - stringlen)) return NULL; i -= LARGE; j = patlen - 1; s = (char *)string + (i - j); while (--j >= 0 && s[j] == pat[j]) ; if ( j < 0 ) /* rdg 10/93 */ return s; /* rdg 10/93 */ if ( (i += skip2) >= 0 ) /* rdg 10/93 */ return NULL; /* rdg 10/93 */ } } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rtlftrul.txt0000755000076400001440000001165407055334214016723 Organization: KFW Corporation, Newbury Park, CA Message-ID: <1990Jul16.195111.5976@kfw.COM> Newsgroups: comp.lang.c I've received several mail messages since offering to explain the right-left rule via e-mail, so I've decided to post. For those of you who already know this or don't care, quit now (this is a little long). The "right-left" rule is a completely regular rule for deciphering C declarations. It can also be useful in creating them. First, symbols. Read * as "pointer to" [] as "array of" () as "function returning" as you encounter them in the declaration. STEP 1 ------ Find the identifier. This is your starting point. Then say to yourself, "identifier is". You've started your declaration. STEP 2 ------ Look at the symbols on the right of the identifier. If, say, you find "()" there, then you know that this is the declaration for a function. So you would then have "identifier is function returning". Or if you found a "[]" there, you would say "identifier is array of". Continue right until you run out of symbols *OR* hit a *right* parenthesis ")". (If you hit a left parenthesis, that's the beginning of a () symbol, even if there is stuff in between the parentheses. More on that below.) STEP 3 ------ Look at the symbols to the left of the identifier. If it is not one of our symbols above (say, something like "int"), just say it. Otherwise, translate it into English using that table above. Keep going left until you run out of symbols *OR* hit a *left* parenthesis "(". Now repeat steps 2 and 3 until you've formed your declaration. Here are some examples: int *p[]; 1) Find identifier. int *p[]; ^ "p is" 2) Move right until out of symbols or left parenthesis hit. int *p[]; ^^ "p is array of" 3) Can't move right anymore (out of symbols), so move left and find: int *p[]; ^ "p is array of pointer to" 4) Keep going left and find: int *p[]; ^^^ "p is array of pointer to int". Another example: int *(*func())(); 1) Find the identifier. int *(*func())(); ^^^^ "func is" 2) Move right. int *(*func())(); ^^ "func is function returning" 3) Can't move right anymore because of the right parenthesis, so move left. int *(*func())(); ^ "func is function returning pointer to" 4) Can't move left anymore because of the left parenthesis, so keep going right. int *(*func())(); ^^ "func is function returning pointer to function returning" 5) Can't move right anymore because we're out of symbols, so go left. int *(*func())(); ^ "func is function returning pointer to function returning pointer to" 6) And finally, keep going left, because there's nothing left on the right. int *(*func())(); ^^^ "func is function returning pointer to function returning pointer to int". As you can see, this rule can be quite useful. You can also use it to sanity check yourself while you are creating declarations, and to give you a hint about where the put the next symbol and whether parentheses are required. Some declarations look much more complicated than they are due to array sizes and argument lists in prototype form. If you see "[3]", that's read as "array (size 3) of...". If you see "(char *,int)" that's read as "function expecting (char *,int) and returning...". Here's a fun one: int (*(*fun_one)(char *,double))[9][20]; I won't go through each of the steps to decipher this one. It's: "fun_one is pointer to function expecting (char *,double) and returning pointer to array (size 9) of array (size 20) of int." As you can see, it's not as complicated if you get rid of the array sizes and argument lists: int (*(*fun_one)())[][]; You can decipher it that way, and then put in the array sizes and argument lists later. Some final words: It is quite possible to make illegal declarations using this rule, so some knowledge of what's legal in C is necessary. For instance, if the above had been: int *((*fun_one)())[][]; it would have been "fun_one is pointer to function returning array of array of ^^^^^^^^^^^^^^^^^^^^^^^^ pointer to int". Since a function cannot return an array, but only a pointer to an array, that declaration is illegal. Will will@kfw.com uunet!charyb!will c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/commconv.c0000755000076400001440000000477407055333707016304 /* * COMMCONV.C * Change C++ -comments to C-comments * * Public domain by Jari Laaksonen (2:221/105.11), 22 Dec 1992 */ #include int main (int argc, char **argv) { int Char, cpp_comment = 0, c_comment = 0, in_string = 0; char CannotOpen[] = "\nCannot open %s\n\n"; FILE *InFile, *OutFile = stdout; if (argc < 2) { fprintf (stderr, "USAGE: COMMCONV InFile [OutFile]\n"); return (1); } if ((InFile = fopen (argv[1], "r")) == NULL) { fprintf (stderr, CannotOpen, argv[1]); return (3); } if (argc == 3) { if ((OutFile = fopen (argv[2], "w")) == NULL) { fprintf (stderr, CannotOpen, argv[2]); OutFile = stdout; /* if can't open, output goes to stdout instead */ } } while ((Char = fgetc (InFile)) != EOF) { fputc (Char, OutFile); if (Char == '\"') in_string = ! in_string; /* toggle flag */ if (in_string) /* we are in a string now */ continue; if (Char == '/') /* slash */ { Char = fgetc (InFile); /* check next char */ if (Char == '/') /* is it start of C++ comment */ { Char = '*'; /* change it to C comment */ cpp_comment = 1; } else if (Char == '*') /* is it start of C comment */ c_comment = 1; fputc (Char, OutFile); if (c_comment || cpp_comment) /* inside C or C++ comment */ { while ((Char = fgetc (InFile)) != '\n') /* rest of the line */ { if (Char == '*' && c_comment) { int Ch = fgetc (InFile); /* check next char */ if (Ch == '/') /* is it end of C comment */ c_comment = 0; ungetc (Ch, InFile); /* put it back to stream */ } fputc (Char, OutFile); } if (cpp_comment) { fputs (" *", OutFile); /* put ending C comment mark */ if (c_comment) fputc (' ', OutFile); fputc ('/', OutFile); cpp_comment = 0; } fputc ('\n', OutFile); } } else if (Char == '*' && c_comment) { Char = fgetc (InFile); if (Char == '/') /* is it end of C comment */ c_comment = 0; fputc (Char, OutFile); } } /* while end */ if (argc == 3) fclose (OutFile); fclose (InFile); return 0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/setvol.c0000755000076400001440000001234207055334223015757 /* ** SETVOL.C - set, change, or kill a disk volume label ** ** public domain demo by Bob Stout ** DOS 5 enhancements suggested by Keith Beedle */ #include #include #include #include #include #include #include "portable.h" /* Also in SNIPPETS */ #define NUL '\0' #if defined(__TURBOC__) #pragma option -a- #include #include #define _A_VOLID FA_LABEL #define _far far #else #include #if defined(__ZTC__) #pragma ZTC align 1 #else /* MSC/QC/WATCOM/METAWARE */ #pragma pack(1) #endif struct fcb { char fcb_drive; char fcb_name[8]; char fcb_ext[3]; short fcb_curblk; short fcb_recsize; long fcb_filsize; short fcb_date; char fcb_resv[10]; char fcb_currec; long fcb_random; }; struct xfcb { char xfcb_flag; char xfcb_resv[5]; char xfcb_attr; struct fcb xfcb_fcb; }; #endif #include "dos5boot.h" /* SNIPPETS file with DOS 5 boot record structure */ /* ** NOTE: The following use functions in four other SNIPPETS files, ** ABSDISK.ASM, ABSDISKC.C, DRVALID.C, and PUSHDIR.C */ int AbsDiskRead(unsigned short, size_t, size_t, void *); int AbsDiskWrite(unsigned short, size_t, size_t, void *); int getdrv(void); int PushDir(char *); int PopDir(void); /* ** Erase an existing volume label */ void vol_kill(char *fname) { union REGS regs; struct SREGS sregs; struct xfcb buf; /* Parse the filename into an FCB */ segread(&sregs); regs.h.ah = 0x29; regs.h.al = 0; regs.x.si = (unsigned)fname; regs.x.di = (unsigned)&buf.xfcb_fcb; sregs.es = sregs.ds; intdosx(®s, ®s, &sregs); /* Volume labels require extended FCB's */ buf.xfcb_flag = 0xff; buf.xfcb_attr = _A_VOLID; /* Delete the old label */ regs.h.ah = 0x13; regs.x.dx = (unsigned)&buf; intdos(®s, ®s); } /* ** Create a new volume label */ void setvol(char *label) { char new_label[13]; /* name + ext + '.' + NUL */ struct xfcb buf; union REGS regs; struct SREGS sregs; const char pattern[] = "????????"; char _far *dta; /* ** Change to root directory. */ PushDir("\\"); /* If drive is already labeled, remove it */ segread(&sregs); regs.h.ah = 0x2f; intdosx(®s, ®s, &sregs); dta = MK_FP(sregs.es, regs.x.bx); buf.xfcb_flag = 0xff; buf.xfcb_attr = _A_VOLID; buf.xfcb_fcb.fcb_drive = 0; memcpy(buf.xfcb_fcb.fcb_name, pattern, 8); memcpy(buf.xfcb_fcb.fcb_ext, pattern, 3); regs.h.ah = 0x11; regs.x.dx = (unsigned)&buf; intdos(®s, ®s); if (0 == regs.h.al) { int i; char oldlabel[13], _far *p, *q; for (i = 0, p = dta + 8, q =oldlabel; i < 8; ++i, ++p, ++q) { *q = *p; } *q++ = '.'; for (i = 0, p = dta + 16; i < 3; ++i, ++p, ++q) { *q = *p; } vol_kill(oldlabel); } strcpy(new_label, label); if (8 < strlen(label)) { new_label[8] = '.'; strcpy(&new_label[9], &label[8]); } /* Parse the filename into an FCB */ segread(&sregs); regs.h.ah = 0x29; regs.h.al = 0; regs.x.si = (unsigned)new_label; regs.x.di = (unsigned)&buf.xfcb_fcb; sregs.es = sregs.ds; intdosx(®s, ®s, &sregs); /* Volume labels require extended FCB's */ buf.xfcb_flag = 0xff; buf.xfcb_attr = _A_VOLID; /* Create the new label */ regs.h.ah = 0x16; regs.x.dx = (unsigned)&buf; intdos(®s, ®s); /* Close the new label */ regs.h.ah = 0x10; regs.x.dx = (unsigned)&buf; intdos(®s, ®s); /* ** For DOS 5.0 replace the boot record too. */ if(_osmajor > 3) { int index, drive = getdrv(); B_REC boot_record; AbsDiskRead(drive, 1, 0, &boot_record); if(0 == strcmp(boot_record.bsOemName, "MSDOS5.0")) { index = 0; while (NUL != label[index]) { boot_record.bsVolumeLabel[index] = label[index]; index++; } for(index; index < 11; index++) boot_record.bsVolumeLabel[index] = 0x20; AbsDiskWrite(drive, 1, 0, &boot_record); } } PopDir(); } #ifdef TEST void main(int argc, char *argv[]) { if (2 > argc) { puts("\aUsage: SETVOL new_name"); abort(); } setvol(argv[1]); } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/tabtrick.c0000755000076400001440000000317507055334300016246 /* ** TABTRICKs.C - Demonstrates how to use printf() for columnar formatting */ #include #include #define putnum(i) putchar(i+'0') void main() /* void main() is not standard C, but avoids warnings */ { char *firstname[] = { "Aloysius", "Bob", "Dennis", NULL }, *lastname[] = { "Fuddrucker", "Stout", "Ritchie", NULL }; int score[] = { -10, 70, 200, 0 }, i, tabwidth; printf("%15sStudent Name%30s\n\n", "", "Test Score"); for (i = 0; NULL != lastname[i]; ++i) { tabwidth = 36 /* spaces to tab */ -2 /* allow for ", " */ -strlen(lastname[i]); /* lastname space */ printf("%15s%s, %-*s%3d\n", "", lastname[i], tabwidth, firstname[i], score[i]); } /* print a ruler to make things clearer */ puts(""); for (i = 0; i < 71; ++i) { if (i == 10 * (i / 10)) putnum(i / 10); else putchar(' '); } puts(""); for (i = 0; i < 71; ++i) putnum(i % 10); } /* RESULTS: Student Name Test Score Fuddrucker, Aloysius -10 Stout, Bob 70 Ritchie, Dennis 200 0 1 2 3 4 5 6 7 01234567890123456789012345678901234567890123456789012345678901234567890 */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/msc_peek.c0000755000076400001440000000164107055334112016226 /* ** For MSC which lacks these very basic (sic) functions ** ** public domain by Bob Stout */ #include #ifndef MK_FP #define MK_FP(seg,offset) \ ((void _far *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #endif unsigned char peekb(unsigned seg, unsigned ofs) { unsigned char _far *ptr; FP_SEG(ptr) = seg; FP_OFF(ptr) = ofs; return *ptr; } unsigned peek(unsigned seg, unsigned ofs) { unsigned _far *ptr; FP_SEG(ptr) = seg; FP_OFF(ptr) = ofs; return *ptr; } void pokeb(unsigned seg, unsigned ofs, unsigned char ch) { unsigned char _far *ptr; FP_SEG(ptr) = seg; FP_OFF(ptr) = ofs; *ptr = ch; } void poke(unsigned seg, unsigned ofs, unsigned num) { unsigned _far *ptr; FP_SEG(ptr) = seg; FP_OFF(ptr) = ofs; *ptr = num; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/howdy.c0000755000076400001440000000103107055334011015561 #define _ putchar #define __ ^ #define ___ / #include void main() {_((2*2*2*2*2*2*3*41)___ 64__(3*17));_((2*2*2*13*89)___ 104__(2*2*3*5));_((2*2*2*23*61)___ 92__(2*11));_((2*2*2*2*2*3*3)___ 4__(2*2*3*3));_((2*2*2*2*7*13)___ 26__(3*29));_((2*2*3*7*19)___ 28__(3*7));_((2*2*2*2*13*29)___ 104__(2*13));_((2*2*2*2*2*2*3*19)___ 114__(3*29));_((2*2*5*107)___ 20__(2*2));_((3*11*97)___ 97__(83));_((2*2*2*2*2*3*11)___ 11__(2*2*3));_((2*5*11*13)___ 55__(2*3*3*7));_((2*3*7*83)___ 83__(2*2));_((79)___ 79__(11)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/kb_data.c0000755000076400001440000000424107055334032016025 /* by: Dan Kozak */ #include #ifdef __TURBOC__ #define _far far #endif typedef struct /* Keyboard status structure */ { unsigned int right_shift_down : 1, /* Right Shift key depressed */ left_shift_down : 1, /* Left Shift key depressed */ ctrl_shift_down : 1, /* Ctrl key depressed */ alt_shift_down : 1, /* Alt key depressed */ scroll_on : 1, /* Scroll Lock is on */ num_on : 1, /* Num Lock is on */ caps_on : 1, /* Caps Lock is on */ ins_on : 1, /* Insert state is active */ filler : 3, /* Filler for word alignment */ ctrl_numloc : 1, /* Suspend key is on */ scroll_down : 1, /* Scroll Lock key depressed */ num_down : 1, /* Num Lock key depressed */ caps_down : 1, /* Caps Lock key depressed */ ins_down : 1; /* Insert key depressed */ } biosshiftstate; biosshiftstate _far *kbd_status = (biosshiftstate _far *) 0x00000417L; main() { while(1) { printf("right_shift_down = %d\n",kbd_status->right_shift_down); printf("left_shift_down = %d\n",kbd_status->left_shift_down); printf("ctrl_shift_down = %d\n",kbd_status->ctrl_shift_down); printf("alt_shift_down = %d\n",kbd_status->alt_shift_down); printf("scroll_on = %d\n",kbd_status->scroll_on); printf("num_on = %d\n",kbd_status->num_on); printf("caps_on = %d\n",kbd_status->caps_on); printf("ins_on = %d\n",kbd_status->ins_on); printf("filler = %d\n",kbd_status->filler); printf("ctrl_numloc = %d\n",kbd_status->ctrl_numloc); printf("scroll_down = %d\n",kbd_status->scroll_down); printf("num_down = %d\n",kbd_status->num_down); printf("caps_down = %d\n",kbd_status->caps_down); printf("ins_down = %d\n",kbd_status->ins_down); } return 0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/factoryl.c0000755000076400001440000000511307055333754016274 /* ** FACTORYL.C ** ** Original Copyright 1992 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is hereby donated to the public domain. */ #include #include #include #define dfrac(x) ((x)-dround(x)) /* Use #defines for Permutations and Combinations */ #define log10P(n,r) (log10factorial(n)-log10factorial((n)-(r))) #define log10C(n,r) (log10P((n),(r))-log10factorial(r)) #ifndef PI #define PI 3.14159265358979323846 #endif #define SQRT2PI sqrt(2 * PI) #define ONESIXTH (1.0/6.0) /* ** DROUND.C - Rounds a double to the nearest whole number ** public domain by Ross Cottrell */ double dround(double x) { assert(1 == FLT_ROUNDS); x += 1.0 / DBL_EPSILON; return x - 1.0 / DBL_EPSILON; } /* ** log10factorial() ** ** Returns the logarithm (base 10) of the factorial of a given number. ** The logarithm is returned since this allows working wil extremely ** large values which would otherwise overflow the F.P. range. ** ** Parameters: 1 - Number whose factorial to return. ** ** Returns: log10() of the passed value, -1.0 if error ** */ double log10factorial(double N) { if (N < 40) /* Small, explicitly compute */ { int i; double f; for (i = 1, f = 1.0; i <= (int)N; ++i) f *= i; return log10(f); } else /* Large, use approximation */ { return log10(SQRT2PI)+((N + 0.5) * (log10(sqrt(N * N + N + ONESIXTH) / exp(1)))); } } #ifdef TEST #include #include void main(int argc, char *argv[]) { double f, lf; char *dummy; while (--argc) { f = strtod((const char *)(*(++argv)), &dummy); lf = log10factorial(f); if (171.0 > f) printf("%.14g! = %.14g\n", f, pow(10.0, lf)); else { printf("%.14g! = %.14ge+%ld\n", f, pow(10.0, dfrac(lf)), (long)dround(lf)); } } lf = log10C(1000000,750000); printf("\nJust to dazzle with you with big numbers:\n" "C(1000000,750000) = %.14ge+%ld\n", pow(10.0, dfrac(lf)), (long)dround(lf)); lf = log10P(1000000,750000); printf("\n...once more:\n" "P(1000000,750000) = %.14ge+%ld\n", pow(10.0, dfrac(lf)), (long)dround(lf)); } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/keywatch.c0000755000076400001440000001232107055334035016260 /* keywatch.c 12-29-91 Robert Mashlan, Public Domain *\ DOS compiler portability modifications added by Bob Stout, 1:106/2000.6 This program monitors the keyboard interrupt, and stores the status of each key as to whether it is pressed or released. This is done by capturing interrupt 9, and watching the make/break codes. The status is updated in the keys array, where 1 means that the key is pressed, while 0 means the key is released. The key array is uses the scan code for an index instead of the ascii character. It is simple enough to find the scan code for a key, just run this program and watch the display. The ekeys array will reflect the status of keys found on an AT keyboard. For instance, the left and right alt keys are differentiated, as well as the edit control keys on the numeric keypad and the one not on the numeric keypad. Since this program installs an interrupt handler, it should be terminated normally, such the keyboard handler can be removed. The ^C/^Break exit is captured via signal(), but all possible exits should be trapped. \* */ #include #include #include #include #define BYTE unsigned char #if defined(__TURBOC__) #define _interrupt interrupt #define _far far #define IN_PORT(port) inportb(port) #define IN_PORTW(port) inport(port) #define OUT_PORT(port, val) outportb(port, val) #define OUT_PORTW(port, val) outport(port, val) #else #if defined(__ZTC__) #include #else /* MSC, QC, Watcom */ #define getvect(n) _dos_getvect(n) #define setvect(n,v) _dos_setvect(n,v) #endif #define IN_PORT(port) inp(port) #define IN_PORTW(port) inpw(port) #define OUT_PORT(port, val) outp(port, val) #define OUT_PORTW(port, val) outpw(port, val) #endif volatile char keys[128]; /* array of key states */ volatile char ekeys[128]; /* array of AT key states */ #define KEYPORT 0x60 /* keyboard scan code port */ #define keyport() IN_PORT(KEYPORT) /* macro that returns the scancode of the key that caused */ /* the interrupt */ /* Define: *\ installisr() installation macro, installs newkbisr() in the keyboard interrupt chain removeisr() removal macro, call to remove newkbisr() from interrupt chain. oldkbisr() must be removed before program ends \* */ #ifdef __ZTC__ #define installisr() int_intercept(0x09, newkbisr, 0) #define removeisr() int_restore(0x09); #else #define installisr() (oldkbisr=getvect(0x09),setvect(0x09,newkbisr)) #define removeisr() setvect(0x09,oldkbisr) #ifdef __TURBOC__ void _interrupt (_far *oldkbisr)(void); /* address of old ISR */ #else void (_interrupt _far *oldkbisr)(void); /* address of old ISR */ #endif #endif #ifdef __ZTC__ int newkbisr(struct INT_DATA *pd) #elif defined(__TURBOC__) void _interrupt newkbisr(void) #else void _interrupt _far newkbisr(void) #endif { static extkey; BYTE scancode = (BYTE)keyport(); /* read keyboard scan code */ if (scancode == 0xe0) extkey = 1; /* use ekey array on next scan code */ else { if (scancode & 0x80) /* key released */ (extkey ? ekeys : keys)[scancode & 0x7f] = 0; else (extkey ? ekeys : keys)[scancode] = 1; extkey = 0; } #ifdef __ZTC__ return 0; /* chain to previous keyboard ISR */ #else oldkbisr(); /* chain to previous keyboard ISR */ #endif } int keyspressed(void) /* returns number of keys being held down */ { int i, result = 0; for (i = 0; i < 128; i++) { result += keys[i]; result += ekeys[i]; } return result; } int main(void) { int lastkeycount = 0; signal(SIGINT,SIG_IGN); /* ingnore ^C and ^Break */ installisr(); /* install interrupt handler */ while(1) { int i; if (keyspressed() != lastkeycount) /* change in keystatus */ { lastkeycount = keyspressed(); puts("---"); for(i = 0; i < 128; i++) { if (keys[i]) printf("key with scan code %02x " "has been pressed\n", i); if (ekeys[i]) printf("key with scan codes e0 %02x " "had been pressed\n", i); } } if (kbhit() && getch()==0x1b) /* terminate when Esc pressed */ break; } removeisr(); /* remove interrupt handler */ return 0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/drvalid.c0000755000076400001440000000721207055333735016077 /* ** DRVALID.C - validate disk drives ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. ** ** Uses ABSDISKC.C and ABSDISK.ASM in SNIPPETS. */ #include #include typedef enum {ERROR = -1, SUCCESS, FALSE = 0, TRUE} LOGICAL; /* ** Function to read an absolute disk sector */ int AbsDiskRead(unsigned short, size_t, size_t, void *); /* ** getdrv() ** ** Just as getcwd() returns the default directory, getdrv() returns ** the current drive. ** ** Arguments: None. ** ** Returns: Current drive (0 = A:, 1 = B:, etc.) ** ** Side effects: none */ int getdrv(void) { union REGS regs; regs.h.ah = 0x19; intdos(®s, ®s); return (regs.h.al); } /* ** chdrv() ** ** Like chdir(), except changes drives rather than directories. ** ** Arguments: 1 - target drive (0 = A:, 1 = B:, etc.) ** ** Returns: SUCCESS or ERROR ** ** Side effects: none */ LOGICAL chdrv(int drive) { union REGS regs; regs.h.ah = 0x0e; regs.h.dl = (char)drive; intdos(®s, ®s); if (drive != getdrv()) return ERROR; else return SUCCESS; } /* ** drvalid() ** ** Verifies whether a logical disk drive is available without ** triggering the DOS critical error handler. ** ** Arguments: 1 - target drive (0 = A;, 1 = B:, etc.) ** ** Returns: TRUE - drive is valid ** FALSE - drive is invalid ** ** Side effects: none */ LOGICAL drvalid(int drive) { int original, result; original = getdrv(); result = (SUCCESS == chdrv(drive)); chdrv(original); return result; } /* ** drvrdy() ** ** Checks whether a drive with removable media is ready. ** ** Arguments: 1 - target drive (0 = A;, 1 = B:, etc.) ** ** Returns: TRUE - drive is ready ** FALSE - drive is not ready ** ERROR - other read error ** ** Side effects: none */ LOGICAL drvrdy(int drive) { int status; char buf[2048]; /* nice & roomy */ status = AbsDiskRead(drive, 1, 0, buf); if (0 == status) return TRUE; status &= 0xff; if (2 == status) return FALSE; else return ERROR; } #ifdef TEST #include #include int main(int argc, char *argv[]) { int drive; if (2 > argc) { puts("Usage: DRVALID drive[:]"); return EXIT_FAILURE; } drive = toupper(*argv[1]); if (!isalpha(drive)) { puts("Error: Invalid drive name"); return EXIT_FAILURE; } printf("Drive %c: is %svalid\n", drive, drvalid(drive - 'A') ? "" : "not "); if (2 < _osmajor) { union REGS regs; regs.x.ax = 0x4408; regs.h.bl = (unsigned char)(drive - '@'); intdos(®s, ®s); printf("ioctl returned Cflag=%s\n", regs.x.cflag ? "TRUE" : "FALSE"); printf("ioctl returned AX=0x%X\n", regs.x.ax); printf("Drive %c is%s removable\n", drive, regs.x.ax ? " not" : ""); if (0 == regs.x.ax) { printf("Drive %c is %sready\n", drive, drvrdy(drive - 'A') ? "" : "not "); } } return EXIT_SUCCESS; } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/pdn.lst0000755000076400001440000002457307055334133015615 1/11/94 =-=-=-=-PDN BBS List-=-=-=-= This list represents members of the Programmer's Distribution Network who have indicated to me that they will accept file requests for PDN files, or Downloads on the first call, or downloads after a validation program. This list is by no means all-inclusive, but represents only those who have let me know via netmail that they would like to be on the list. See *Note below for FTP access. KEY: HST : USRobotics Courier HST 14.4k H16 : USRobotics Courier HST 16.8k V32 : ITU-TS V.32 compliant V32B: ITU-TS V.32bis compliant V32T: AT&T V.32terbo compliant VFC : Rockwell 28.8k V.FC (V.Fast Class) CSP : Compucom CSP ZYX : ZyXEL 16.8k V.32bis Z19 : ZyXEL 19.2k V.32bis A21 : USR 21.6 ASL extension of v32terb FQ: U=Unlisted OK, L=only in nodelist N=No freqs 4=4d pts allowed DL: Y=on first call, V=after validation, L=Long Distance Validation N=n/a PDN: PDNAI = I PDNLANG = L PDNCEE = C PDNOTHER = T PDNWIN = W PDNASM = A PDNNEWS = E PDNGNDOS= D PDNPASCL = P PDNVBWIN=N PDNBASIC= B PDNOS2 = O PDNGNU = G PDNUNIX = U PDNVBDOS=V X = All areas !n = Not this area, but all others where n=above code N = awaiting feedback, not all areas carried. Hrs: A=anytime but ZMH, or listed times Node: FidoNet Node Number or UL=not in nodelist = *USA* ================================================================ St: Phone: Type: Fq: DL: PDN Hrs: Node: ========================================================================== AL 1-205-666-0932 HST L L X 17:00-24:00 1:3625/454 AZ 1-602-944-0524 V32B U V !G!U A 1:114/161 CA 1-619-466-9505 HST L Y X A 1:202/302 CA 1-714 939-6401 HST V32B U Y X A 1:103/208 CA 1-310-375-1521 V32B U Y X 03:00-01:00 1:102/344 CO 1-719-380-8813 H16 V32B U Y X A 1:128/60 CO 1-303-674-0147 V32B U Y X A 1:104/825 CT 1-203-879-7122 V32B U Y X A 1:141/1135 8:909/5(RBBS) DE 1-302-995-6910 V32B U Y P A 1:150/170 FL 1-904-494-6782 V32B L V X A 1:3612/370 FL 1-407-773-0831 HST V32B U Y X A 1:374/38 GA 1-912-953-1053 V32B L L ABCPOEL A 1:3611/15 IL 1-708-680-9420 HST V32b Y Y X A 1:115/858 KS 1-913-599-4626 ZYX L Y X A 1:280/314 LA 1-504-386-8827 V32B U Y X A 1:394/7 MA 1-508-250-0187 H16 V32B U V X A 1:324/287 MA 1-508-250-4672 H16 V32B U V X A 1:324/288 MA 1-508-256-1222 H16 V32B U V X A 1:324/291 MA 1-508-250-0135 H16 V32B U V X A 1:324/292 MD 1-410-256-0170 V32B U Y !W!G!U A 1:261/1082 MN 1-612-788-6685 V32B U Y X A 1:282/2007 MS 1-601-467-0801 V32 U Y X A 1:3604/15 NJ 1-908-271-5168 H16 V32B U Y X A 1:107/302 NY 1-518-761-0869 HST U V X A 1:267/54 NY 1-212-927-4980 H16 V32B U Y X A 1:278/707 NY 1-315-564-5700 V32B U Y X 03:00-04:00 EST 1:2608/15 NY 1-315-773-2099 HST V32B L Y X A 1:2608/89 NY 1-716-381-8538 HST V32 U V X A 1:2613/210 NY 1-716-898-4366 HST V32 U Y X A 1:260/1 NY 1-914-374-3903 HST L Y ABENV A 1:272/34 NY 1-914-344-0350 H16 A21 U Y X A 1:272/38 NY 1-914-343-7540 HST V32B U Y X A 1:272/100 NC 1-919-286-7738 HST V32B U V X A 1:3641/1 NC 1-919-286-4542 ZYX V32B U V X A 1:3641/224 NV 1-702-873-0614 H16 V32B U Y X !0800-1800 M-F 1:209/710 OH 1-419-478-7333 VFC U Y X A 1:234/56 OH 1-216-628-4860 Z19 V32B U V CP A 1:157/534 OK 1-918-438-8260 H16 V32b U Y X A 1:170/403 TX 1-210-496-6550 HST U Y B A 1:387/403 TX 1-210-675-4787 V32 U Y X 05:00-02:30 1:387/666 TX 1-512-573-0245 HST V32B U Y X A 1:3802/213 TX 1-817-855-1526 V32B U Y P A 1:3805/13 VT 1-802-223-7951 V32 U Y B A 1:325/609 WY 1-307-682-6944 HST V32B L Y ABCPTL 00:30-24:00A 1:15/24 = *Australia* ============================================================== St: Phone: Type: Fq: DL: PDN Hrs: Node: ========================================================================== VIC 61-3-338-3794 V32 Y Y X A 3:635/544 Innaloo 61-9-244-2111 V32 Y V X A 3:690/660 Innaloo 61-9-244-2111 V32 Y V X A 3:690/500 Innaloo 61-9-244-2111 V32 Y V X A 3:690/0 Essendn 61-3-301-1877 V32 Y N/A X A 3:50/99 = *Austria* ============================================================== Vienna 43-1-290-3658 Z19 V32B U Y X A 2:310/24 = *Belgium* ============================================================== Antwerp 32-3-2343790 V32B V42B U Y X A 2:292/855 = *Canada* =============================================================== Ontario 1-613-837-0413 V32B U V X A 1:163/319 Ontario 1-416-482-7097 ZYX V42B U N N 01:00-06:00EDT 1:250/820 Ontario 1-613-548-7744 H16 V32b U Y P A 1:249/1 Sask. 1-306-463-3117 H16 V32B U Y X A 1:140/53 Sask. 1-306-463-4581 V32B N Y X A UL Sask. 1-306-585-0298 HST Y Y X A 1:140/40 Quebec 1-418-648-9590 V32B L V X 6am-3am 1:240/507 Quebec 1-418-648-0691 V32B L V X 6am-3am EDT 1:240/508 TroisRi 1-819-372-0467 V32B L Y OCEW A 1:167/710 Vancvr 1-604-945-9384 H16 V32B U Y P A 1:153/740 = *Denmark* ============================================================== St: Phone: Type: Fq: DL: PDN Hrs: Node: ========================================================================== Aarhus +45-86-176232 H14 V32B L V X 8am-2am CET 2:230/22 Aarhus +45-86-143158 H14 V32B L V X 9am-1am CET 2:230/8 Aarhus +45-86-143599 2400b L V X 9am-1am CET 2:230/172 Aarhus +45-86-143231 2400b L V X 9am-1am CET 2:230/173 Aarhus +45-86-936822 Z19 L V X 7am-1am CET 2:230/73 Aarhus +45-86-119615 Z19 L V X 8am-2am CET 2:234/48 Aalborg +45-98-109446 HST V32B L N X 22pm-06am CET 2:230/914 Cph. +45-47-380514 H16 V32B L V X 8am-2am CET 2:230/100 Cph +45-31-241013 ZYX L V X 9am-2am CET 2:230/329 Vordingb. +45-55-342345 Z19 U Y X 8am-5am CET 2:230/64 Vordingb. +45-55-341345 H16 V32B U Y X 8am-5am CET 2:230/88 =France ================================================================== Wervicq-Sud 33-20392225 H16 V32B L V X A 2:322/2 Wervicq-Sud 33-20399342 H16 V32B L V X A 2:322/3 Wervicq-Sud 33-20392236 H16 V32B L V X A 2:322/4 = Germany ================================================================ Kronberg+49-6173-1499 H14/V32B U V X 08-18/19-24 2:244/1540 Kronberg+49-6173-940246 Z19/V32B U V X 06-24 2:244/1541 = Italy ================================================================= Malgesso 39-332-706469 H16 V32B U Y X A 2:331/106 Malgesso 39-332-706739 HST V32B U Y X A 2:331/117 Malgesso 39-332-706009 ZYX V32B U Y X A 2:331/121 Biandrnno 39-332-767277 HST V32B U Y X A 2:331/110 Biandrnno 39-332-819044 ZYX V32B U Y X A 2:331/118 Biandrnno 39-332-767329 ZYX V32B U Y X A 2:332/122 = *Luxembourg* =========================================================== Strassen +352-316702 ZYX V32B U Y!I!W!B A 2:270/17 = *Netherlands* ========================================================= Delden 31-5407-64701 HST V32B U Y X 8am-12pm CET 2:283/309 2:283/309 Den Bosh 31-73-222164 HST V32B N Y X 6am-3am CET 2:512/152 Eck & Wiel 31-3449-1909 V21 V22 U Y N 8am-2pm 2:500/137 V32B V42B Groningen 31-50-735035 HST V32B U Y X 8am-12pm CET 2:512/159 Tilburg 31-13-674745 ZYX U Y P A 2:285/228 Venlo 31-77-547521 ZYX V32B U Y !W!O 6am-1am CET 2:512/222.17 Drieber. 31-3438-14125 H16 V32B U Y X A 2:512/169 Zwijndrecht 31-78-196010 ZYX U N X 4:01-23:00 UTC 2:285/304 = *Sweden* =============================================================== Lerum 46-302-16565 V32B U V X 07:00-23:00 2:203/311 ========================================================================== *Note: PDN Files are available via Anonymous-FTP from ftpbone@ftp.fidonet.org (and mirrored to ftpbone.halcyon.com) in the pub/fidonet/pdn directories. IP Address 140.98.2.1 File Arrival Announcement messages are available on Internet via mailing list. To be added to the mailing-list send e-mail to: listproc@ftpbone.fidonet.org with a single line of 'help'. If you carry the Programmer's Distribution Network and would like to be added to this list, please send netmail to Janis Kracht 1:272/38, < #define NUM_OF_PRNTRS 6 FILE *printer[NUM_OF_PRNTRS] = {stdprn}; /* ** assign_printer() ** ** Call with printer number and device name ** ** printer number should be in the range of 0 to NUM_OF_PRNTRS-1 ** device should be "LPT1", "LPT2", "LPT3", "COM1", COM2", or a log file ** ** Returns 0 if successful, -1 if error ** ** Then do all printer output with fprintf(), fputs(), fputc(), etc. ** using printer[printer_number] as the output stream */ int cdecl assign_printer(int number, char *device) { FILE *fp; if (NUM_OF_PRNTRS <= number || NULL == (fp = fopen(device, "w"))) return -1; printer[number] = fp; return 0; } #ifdef TEST /* Test code follows */ main() { /* Leave printer[0] = stdprn */ assign_printer(1, "CON"); /* Set printer[1] to the screen */ assign_printer(2, "p.log"); /* Set printer[2] to log file */ fputs("This is a printer test\n", printer[0]); fputs("This is a screen test\n", printer[1]); fputs("This is a log test\n", printer[2]); } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/8087_sav.asm0000755000076400001440000000546607055333631016273 ; By: Jeffrey Nonken page 60,132 .286 _text segment byte public 'code' _text ends _data segment word public 'data' _data ends const segment word public 'const' const ends _bss segment word public 'bss' _bss ends dgroup group const, _bss, _data assume cs: _text, ds: nothing _data segment word public 'data' even env_8087 dw 47 dup (?) norm_8087 dw 177fh _data ends _text segment byte public 'code' ; ; This code saves the 80x87 enviroment and sets up our own. First, this ; assumes you are running an 80287; the 8087 may require more FWAIT ; operations. Second, I decided that I didn't want to handle exceptions, so ; I simply disabled them. That means that if the 80x87 gets an invalid result ; (such as divide-by-zero) the 80x87 will continue to run and will produce ; invalid results until the end of your current calculation. Anything that ; depends on the results will, of course, also be invalid. If you want ; exceptions to be handled, get documentation for the 80x87 and you will ; see how to set norm_8087 (above) to suit your needs. If you are running ; an 8087 and don't know where to put FWAIT instructions, you can always ; add one after each floating-point instruction. NOTE: FWAIT is synonymous ; to WAIT. They are the same instruction. ; ; This was written for TURBO C and will also work with MSC. It should work ; with any programming language with no more than minor changes in the ; label names or the interface. Consult your compiler manual for more detail. ; I wrote this so it would work with either the tiny or small models. ; Actually, it will probably work with any of the models. You should be ; able to assemble this with MASM and link it right in. ; ; extern save_8087(); ; extern restore_8087(); ; public _save_8087 _save_8087 proc near cli ; no interruptions! lea bx,dgroup:env_8087 ; point to save area fwait ; make sure processor is ready fnsave [bx] ; save the 8087 environment lea bx,dgroup:norm_8087 ; point to our new 8087 setup mov ax,[bx] ; get it fldcw [bx] ; set it fwait sti ; restore interrupts ret _save_8087 endp public _restore_8087 _restore_8087 proc near cli ; no interruptions! lea bx,dgroup:env_8087 ; point to saved 8087 stuff frstor [bx] ; restore the 8087 environment sti ; restore interrupts ret _restore_8087 endp _text ends end c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ext_keys.c0000755000076400001440000000254607055333752016311 /* ** ext_getch() ** ** A getch() work-alike for use with extended keyboards. ** ** Parameters: none ** ** Returns: Extended key code as follows: ** 0->255 Normal key ** 256->511 Numeric pad key or Function key ** 512->767 Cursor pad key or Numeric pad ** "duplicate" key (Enter, /, *, -, +) ** ** Original Copyright 1992 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is hereby donated to the public domain. */ #include #include #define LoByte(x) ((unsigned char)((x) & 0xff)) #define HiByte(x) ((unsigned char)((unsigned short)(x) >> 8)) int ext_getch(void) { int key; union REGS regs; regs.h.ah = 0x10; int86(0x16, ®s, ®s); key = regs.x.ax; switch (LoByte(key)) { case 0: key = HiByte(key) + 256; break; case 0xe0: key = HiByte(key) + 512; break; default: if (0xe0 == HiByte(key)) key = LoByte(key) + 512; else { if (ispunct(LoByte(key)) && HiByte(key) > 0x36) key = LoByte(key) + 512; else key = LoByte(key); } } return key; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ext_keys.h0000755000076400001440000000616307055333753016316 /* ** ext_getch() header file. ** ** ext_getch() returns: ** ** 0->255 Normal key ** 256->511 Numeric pad key or Function key ** 512->767 Cursor pad key or Numeric pad ** "duplicate" key (Enter, /, *, -, +) */ int ext_getch(void); #define Key_F1 0x13b /* Function keys */ #define Key_F2 0x13c #define Key_F3 0x13d #define Key_F4 0x13e #define Key_F5 0x13f #define Key_F6 0x140 #define Key_F7 0x141 #define Key_F8 0x142 #define Key_F9 0x143 #define Key_F10 0x144 #define Key_F11 0x185 #define Key_F12 0x186 #define Key_CF1 0x15e /* Ctrl-Function keys */ #define Key_CF2 0x15f #define Key_CF3 0x160 #define Key_CF4 0x161 #define Key_CF5 0x162 #define Key_CF6 0x163 #define Key_CF7 0x164 #define Key_CF8 0x165 #define Key_CF9 0x166 #define Key_CF10 0x167 #define Key_CF11 0x189 #define Key_CF12 0x18a #define Key_SF1 0x154 /* Shift-Function keys */ #define Key_SF2 0x155 #define Key_SF3 0x156 #define Key_SF4 0x157 #define Key_SF5 0x158 #define Key_SF6 0x159 #define Key_SF7 0x15a #define Key_SF8 0x15b #define Key_SF9 0x15c #define Key_SF10 0x15d #define Key_SF11 0x187 #define Key_SF12 0x188 #define Key_AF1 0x168 /* Alt-Function keys */ #define Key_AF2 0x169 #define Key_AF3 0x16a #define Key_AF4 0x16b #define Key_AF5 0x16c #define Key_AF6 0x16d #define Key_AF7 0x16e #define Key_AF8 0x16f #define Key_AF9 0x170 #define Key_AF10 0x171 #define Key_AF11 0x18b #define Key_AF12 0x18c #define Key_INS 0x152 /* Numeric pad keys */ #define Key_DEL 0x153 #define Key_HOME 0x147 #define Key_END 0x14f #define Key_PGUP 0x149 #define Key_PGDN 0x151 #define Key_UPARROW 0x148 #define Key_DNARROW 0x150 #define Key_LTARROW 0x14b #define Key_RARROW 0x14d #define Key_PADMIDDLE 0x14c #define Key_PADEQ 0x3d #define Key_PADPLUS 0x22b #define Key_PADMINUS 0x22d #define Key_PADASTERISK 0x22a #define Key_PADSLASH 0x22f #define Key_C1 0x175 /* Ctrl-Numeric pad keys */ #define Key_C2 0x191 #define Key_C3 0x176 #define Key_C4 0x173 #define Key_C5 0x18f #define Key_C6 0x174 #define Key_C7 0x177 #define Key_C8 0x18d #define Key_C9 0x184 #define Key_PINS 0x252 /* Cursor pad keys */ #define Key_PDEL 0x253 #define Key_PHOME 0x247 #define Key_PEND 0x24f #define Key_PPGUP 0x249 #define Key_PPGDN 0x251 #define Key_PUPARROW 0x248 #define Key_PDNARROW 0x250 #define Key_PLTARROW 0x24b #define Key_PRTARROW 0x24d #define Key_ESC 0x1b c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/fmtmoney.c0000755000076400001440000000502407055333764016311 /* ** FMTMONEY.C - Format a U.S. dollar value into a numeric string ** ** public domain demo by Bob Stout */ #include #include #include #include #define Form(s,a) bufptr += sprintf(bufptr, s, a) static char buf[256], *bufptr; static char *units[] = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"}, *tens[] = {"Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"}; static void form_group(int, char *); /* ** Call with double amount ** Rounds cents ** Returns string in a static buffer */ char *fmt_money(double amt) { int temp; double dummy, cents = modf(amt, &dummy); *buf = '\0'; bufptr = buf; temp = (int)(amt/1E12); if (temp) { form_group(temp, "Trillion"); amt = fmod(amt, 1E12); } temp = (int)(amt/1E9); if (temp) { form_group(temp, "Billion"); amt = fmod(amt, 1E9); } temp = (int)(amt/1E6); if (temp) { form_group(temp, "Million"); amt = fmod(amt, 1E6); } temp = (int)(amt/1E3); if (temp) { form_group(temp, "Thousand"); amt = fmod(amt, 1E3); } form_group((int)amt, ""); if (buf == bufptr) Form("%s ", units[0]); temp = (int)(cents * 100. + .5); sprintf(bufptr, "& %02d/100", temp); return buf; } /* ** Process each thousands group */ static void form_group(int amt, char *scale) { if (buf != bufptr) *bufptr++ = ' '; if (100 <= amt) { Form("%s Hundred ", units[amt/100]); amt %= 100; } if (20 <= amt) { Form("%s", tens[(amt - 20)/10]); if (0 != (amt %= 10)) { Form("-%s ", units[amt]); } else Form("%s", " "); } else if (amt) { Form("%s ", units[amt]); } Form("%s", scale); } #ifdef TEST void main(int argc, char *argv[]) { double amt = atof(argv[1]); printf("fmt_money(%g) = %s\n", amt, fmt_money(amt)); } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/weird.c0000755000076400001440000000042507055334332015555 #include char *c[] = { "ENTER", "NEW", "POINT", "FIRST" }; char **cp[] = { c+3, c+2, c+1, c }; char ***cpp = cp; void main() { printf("%s", **++cpp); printf("%s ", *--*++cpp+3); printf("%s", *cpp[-2]+3); printf("%s\n", cpp[-1][-1]+1); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/os_id.c0000755000076400001440000000557207055334124015547 /* ** OS_ID.C ** ** based upon a public domain work by David Gibbs */ #define TEST #define OS_ID_MAIN #include "os_id.h" #include struct i_os_ver id_os_ver[TOT_OS]; int id_os_type; int id_os; const char *id_os_name[TOT_OS] = { "DOS", "OS/2 DOS", "DESQview", "Windows Std", "Windows 386" }; int get_os (void) { union REGS t_regs; int osmajor, osminor; id_os_type = 0; id_os = 0; /* test for DOS or OS/2 */ t_regs.h.ah = 0x30; int86(0x21, &t_regs, &t_regs); osmajor = t_regs.h.al; osminor = t_regs.h.ah; if (osmajor < 10) { id_os_ver[DOS].maj = osmajor; id_os_ver[DOS].min = osminor; id_os_type = id_os_type | is_DOS; } else { /* OS/2 v1.x DOS Box returns 0x0A */ id_os_type = id_os_type | is_OS2; /* OS/2 v2.x DOS Box returns 0x14 */ id_os_ver[OS2].maj = osmajor/10; id_os_ver[OS2].min = osminor; } /* test for Windows */ t_regs.x.ax = 0x4680; int86(0x2F, &t_regs, &t_regs); if (t_regs.x.ax == 0x0000) { id_os_ver[WINS].maj = 3; id_os_ver[WINS].min = 0; id_os_type = id_os_type | is_WINS; } else { t_regs.x.ax = 0x1600 ; int86(0x2F, &t_regs, &t_regs); switch (t_regs.h.al) { case 0x00 : case 0x80 : case 0x01 : case 0xFF : break; default : id_os_type = id_os_type | is_WIN3; id_os_ver[WIN3].maj = t_regs.h.al; id_os_ver[WIN3].min = t_regs.h.ah; break ; } /* endswitch */ } /* endif */ /* Test for DESQview */ t_regs.x.cx = 0x4445; /* load incorrect date */ t_regs.x.dx = 0x5351; t_regs.x.ax = 0x2B01; /* DV set up call */ intdos(&t_regs, &t_regs); if (t_regs.h.al != 0xFF) { id_os_type = id_os_type | is_DV; id_os_ver[DV].maj = t_regs.h.bh; id_os_ver[DV].min = t_regs.h.bl; } if (id_os_type & is_DOS) id_os = DOS; if (id_os_type & is_WINS) id_os = WINS; if (id_os_type & is_WIN3) id_os = WIN3; if (id_os_type & is_DV) id_os = DV; if (id_os_type & is_OS2) id_os = OS2; return(id_os); } #ifdef TEST #include int main(void) { int ostype = get_os(); printf("%s version %d.%d\n", id_os_name[ostype], id_os_ver[ostype].maj, id_os_ver[ostype].min); return(0); } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/os_id.h0000755000076400001440000000140507055334126015545 /* ** OS_ID.H ** ** Based upon a public domain work by David Gibbs */ #ifndef OS_ID_H #define OS_ID_H struct i_os_ver { int maj; int min; }; #define DOS 0 #define OS2 1 #define DV 2 #define WINS 3 #define WIN3 4 #define TOT_OS 5 /* 76543210 */ #define is_DOS 0x01 /* b'00000001' */ #define is_OS2 0x02 /* b'00000010' */ #define is_DV 0x04 /* b'00000100' */ #define is_WINS 0x08 /* b'00001000' */ #define is_WIN3 0x10 /* b'00010000' */ #ifndef OS_ID_MAIN extern int id_os_type; extern int id_os; extern const char *id_os_name[TOT_OS]; extern struct id_os_ver i_os_ver[TOT_OS]; #endif /* Function prototypes */ int get_os(); #endif /* OS_ID_H */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ctrlprnt.c0000755000076400001440000000144707055333715016324 /* ** Print a line of text, displaying Ctrl characters using leading carets ** public domain by Bob Stout */ void ctrl_print(char *line) { while (*line) { if (' ' > *line) { putchar('^'); putchar('@' + (*line++)); } else putchar(*line++); } if (!strcmp((line - 2), "\x0d\x0a") || !strcmp((line - 2), "\x0a\x0d")) putchar('\n'); } #ifdef TEST #include #include #include #include void main(void) { char *p, *test = "This is a test"; for (p = strupr(test); *p; ++p) { if (isalpha(*p)) *p = *p - 64; } ctrl_print(test); } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/changprn.c0000755000076400001440000000220307055333675016250 /* ** change_prn() ** ** A function to change the standard printer device for the duration ** of a program. Valid new device codes are: ** ** 0 - LPT1 ** 1 - LPT2 ** 2 - LPT3 ** 3 - COM1 ** 4 - COM2 ** 5 - CON ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include int change_prn(int device) { char *newdev; switch (device) { case 0: newdev = "LPT1"; break; case 1: newdev = "LPT2"; break; case 2: newdev = "LPT3"; break; case 3: newdev = "COM1"; break; case 4: newdev = "COM2"; break; case 5: newdev = "CON"; break; default: return -1; } return (NULL == freopen(newdev, "w", stdprn)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/absdisk.asm0000755000076400001440000000422607055333633016427 page 55, 132 ; ; ABSDISK.ASM ; ; Originally published as part of The MicroFirm Function Library ; This version released to the public domain by the author, Bob Stout ; ; Requires MASM 5.1 or later or equivalent ; ; Assemble with: MASM /Mx /z ... ; TASM /jMASM /mx /z ... ; % .MODEL memodel,C ;Add model support via ;command line macro, ;e.g. MASM /Dmemodel=LARGE ... extrn _osmajor:BYTE public absdisk .DATA start dw ? fill dw 0 number dw ? buf dw ?,? .CODE absdisk PROC USES SI DI BP, func:BYTE, drive:WORD, num_sec:WORD, start_sec:WORD, buffer:PTR mov AX,drive ;Get drive number in AL mov AH,_osmajor ;Load OS version in AH mov CX,num_sec ;Set up regs for DOS 3 call mov DX,start_sec IF @DataSize push DS ;Save DS in L & C models lds BX,buffer ELSE mov BX,buffer ENDIF cmp AH,4 ;DOS 4+? jb doint ;No, skip it mov start,DX ;Yes, fill in DCB structure mov number,CX mov buf,BX mov buf+2,DS mov cx,-1 IF @DataSize ;Point to DCB mov BX,@Data mov DS,BX ENDIF mov bx,OFFSET start doint: mov AH,func ;Read or Write? cmp AH,25h jne skip_1 int 25h ;Read sector jmp skip_3 skip_1: cmp AH,26h jne skip_2 int 26h ;Write sector jmp skip_3 skip_2: stc ;Invalid command mov AX,-1 skip_3: jc bye ;Error? mov AX,0 ;No, return SUCCESS bye: add SP,2 ;Int 25h leave the flags on the stack IF @DataSize pop DS ;Restore DS in L & C models ENDIF ret absdisk ENDP end c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/flnorm.c0000755000076400001440000001143507055333762015751 /* ** FLNORM.C - Normalize DOS file names ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include #include #ifdef __TURBOC__ #include #else #include #endif #include #include #define MAX_FLEN 67 #define LAST_CHAR(string) (((char *)string)[strlen(string)-1]) typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL; /* ** NOTE: Uses the following functions, also in SNIPPETS! */ int chdrv(int); /* In DRVALID.C */ char *unix2dos(char *); /* In UNIX2DOS.C */ char *fln_fix(char *); /* In FLN_FIX.C */ int flnorm(char *in_name, char *out_name) { LOGICAL dir_flag = FALSE, new_drv = FALSE, root_flag; int status = 0, level = 0; char *p, *out; static char drive[2][3]; static char file[14]; static char I_am_here[MAX_FLEN]; static char I_am_there[MAX_FLEN]; static char remember[MAX_FLEN]; getcwd(I_am_here, MAX_FLEN); if (!in_name || !in_name[0]) { strcpy(out_name, I_am_here); goto ERRexit; } strncpy(drive[0], I_am_here, 2); drive[0][2] = '\0'; if (':' == in_name[1]) { /* If a drive is specified */ if (chdrv(in_name[0])) { /* If the drive is invalid */ status = ERROR; goto ERRexit; } new_drv = TRUE; getcwd(remember, MAX_FLEN); strncpy(drive[1], remember, 2); drive[1][2] = '\0'; } else { /* If a drive isn't specified */ if (NULL != (p = strchr(in_name, ':'))) { /* If filename is illegal */ status = ERROR; goto ERRexit; } } unix2dos(in_name); if (new_drv) { if ('\\' == in_name[2]) strcpy(out_name, drive[1]); else { strcpy(out_name, remember); if ('\\' != LAST_CHAR(remember)) strcat(out_name, "\\"); } } else { strcpy(out_name, drive[0]); if ('\\' != *in_name) { strcat(out_name, I_am_here); if ('\\' != LAST_CHAR(I_am_here)) strcat(out_name, "\\"); } } strcat(out_name, &in_name[(new_drv) ? 2 : 0]); fln_fix(out_name); out = &out_name[2]; if (!(*out)) goto ERRexit; while ('\\' == LAST_CHAR(out)) { /* Strip trailing `\'s */ LAST_CHAR(out_name) = '\0'; dir_flag = TRUE; } if (!(*out)) { if (dir_flag) { strcat(out, "\\"); goto ERRexit; } else goto BADPATH; } if (NULL != (p = strrchr(out_name, '\\'))) strcpy(file, p); /* Save filename */ if (chdir(out)) { /* If can't move to path */ if ((!dir_flag) && p) { /* If there was a separate path */ *p = '\0'; if (!(*out)) { /* Back at the root, handle it */ strcpy(p, "\\"); strcpy(file, &file[1]); } if (chdir(out)) { /* If we can't move to path */ *p = '\\'; goto BADPATH; } ++level; /* Flag we stripped name */ } else { /* No path as specified */ if (p) { BADPATH: status = ERROR; goto ERRexit; } } } getcwd(I_am_there, MAX_FLEN); /* Get normalized path */ strupr(I_am_there); strcpy(out_name, I_am_there); if (level) strcat(out_name, file); ERRexit: if (new_drv) { chdir(remember); chdrv(I_am_here[0]); } chdir(I_am_here); if (status) out_name[0] = '\0'; return status; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rmallws.c0000755000076400001440000000106607055334212016123 /* ** Originally published as part of the MicroFirm Function Library ** ** Copyright 1986, S.E. Margison ** Copyright 1989, Robert B.Stout ** ** Subset version released to the public domain, 1991 ** ** remove all whitespace from a string */ #include #include #define NUL '\0' char *rmallws(char *str) { char *obuf, *nbuf; for (obuf = str, nbuf = str; *obuf && obuf; ++obuf) { if (!isspace(*obuf)) *nbuf++ = *obuf; } *nbuf = NUL; return str; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ansiflen.c0000755000076400001440000000116407055333636016251 /* ** FLENGTH.C - a simple function using all ANSI-standard functions ** to determine the size of a file. ** ** Public domain by Bob Jarvis. */ #include long flength(char *fname) { FILE *fptr; long length = -1L; fptr = fopen(fname, "rb"); if(fptr != NULL) { fseek(fptr, 0L, SEEK_END); length = ftell(fptr); fclose(fptr); } return length; } #ifdef TEST main(int argc, char *argv[]) { printf("Length of %s = %ld\n", argv[0], flength(argv[0])); return 0; } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/myio.cpp0000755000076400001440000000712707055334115015765 // Myio.cpp // Simple I/O class to demonstrate use of C++ iostream // facilities in a customised environment // Written by David L Nugent, June 1993 # include # include # include "Myio.h" # include "Mystream.h" Myio::Myio (int sz) : bufsize(sz), bufchars(0), bufidx(0), bufaddr(new char[bufsize]), mystream(0) {} Myio::~Myio (void) { delete bufaddr; delete mystream; } iostream & Myio::stream (void) { if (!mystream) // Create a stream if required mystream = new Mystream(this); return *mystream; } int // Simple write function into a circular buffer Myio::write (char const * buf, int len) { int avail = (bufsize - bufchars); // See how many fit if (len > avail) { len = avail; stat |= Myio::overflow; // Only partial write } else stat &= ~Myio::overflow; avail = bufsize - bufidx; // Caculate room at end if (avail > len) avail = len; if (avail) { memcpy (bufaddr + bufidx, buf, avail); bufidx += avail; // Update the put index buf += avail; // And the input pointer } if (bufidx >= bufsize) // Wrap buffer to start bufidx = 0; avail = len - avail; // See if there is any more to go if (avail) { memcpy (bufaddr + bufidx, buf, avail); bufidx += avail; // Update the put index } bufchars += len; return (_pcount = len); } int // Simple read function from a circular buffer Myio::read (char * buf, int len) { if (len > bufchars) // Adjust for available bytes { len = bufchars; stat |= Myio::underflow; // Got an underflow (partial read) } else stat &= ~Myio::underflow; // Clear underflow flag int startidx = bufidx - bufchars; // Determine start get position if (startidx < 0) startidx += bufsize; // Adjust for wrap int avail = bufsize - startidx; // Check room at end of buffer if (avail > len) // Adjust down if necessary avail = len; if (avail) // Copy first section { memcpy (buf, bufaddr + startidx, avail); startidx += avail; // Adjust start index buf += avail; // Adjust output pointer } if (startidx >= bufsize) // Wrap buffer to start startidx = 0; avail = len - avail; // See if there is any more to go if (avail) // If so, copy the rest memcpy (buf, bufaddr + startidx, avail); bufchars -= len; // Adjust character count return (_gcount = len); } Myio & operator<< (Myio & m, char const * ptr) { m.write (ptr, strlen (ptr)); return m; } int Myio::dump (void) const { if (bufchars) { char * tmp = new char[bufchars + 2]; int idx = bufidx - bufchars; if (idx < 0) idx += bufsize; for (int i = 0; i < bufchars; ) { if (idx >= bufsize) idx = 0; tmp[i++] = bufaddr[idx++]; } if (i) { if (tmp[i-1] != '\n') // Terminate with NL tmp[i++] = '\n'; tmp[i] = 0; cout << "---\n" << tmp << "---\n"; } delete tmp; } return bufchars; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/myio.mak0000755000076400001440000000420407055334117015746 ## # Makefile for Myio project # Created on 06/13/93 at 09:47 after a long night ## ##### MSDOS & OS/2 extensions ##### X = .cpp O = .obj E = .EXE ##### UNIX #### #X = .cc #O = .o #E = ###### Borland C for OS/2 ###### #M = 2 #CC = bcc #LD = tlink #LIBPATH = F:\Bcc\lib #INCLUDEPATH = F:\Bcc\include #CFLAGS = -Oiabec -I$(INCLUDEPATH) -vi- -d -k- -w -a #LDFLAGS = /x /Toe /ap /L$(LIBPATH) #STARTUP = $(LIBPATH)\c0$(M)$(O) #LDLIBS = C$(M).LIB OS2.LIB ###### Borland C for MSDOS ###### #M = S #CC = bcc #LD = tlink #LIBPATH = F:\Bcc\lib.dos #INCLUDEPATH = F:\Bcc\include.dos #CFLAGS = -I$(INCLUDEPATH) -ms -Oiabec -k- -vi- -d -k- -w #LDFLAGS = /L$(LIBPATH) #STARTUP = $(LIBPATH)\c0$(M)$(O) #LDLIBS = C$(M).LIB ###### MicroSoft C/C++ for MSDOS ###### #M = S #CC = cl #LD = link #LIBPATH = F:\msc\lib #INCLUDEPATH = F:\msc\include #CFLAGS = -I$(INCLUDEPATH) -A$(M) -Oceglnota -W4 #LDFLAGS = #STARTUP = #LDLIBS = ; ###### Zortech C/C++ for MSDOS/OS/2 ###### #M = s #CC = ztc #LD = blink #LIBPATH = F:\zortech\lib #INCLUDEPATH = F:\zortech\include #CFLAGS = -I$(INCLUDEPATH) -m$(M) -o #LDFLAGS = #STARTUP = #LDLIBS = ; ###### Symantec C/C++ for MSDOS/Mac/OS/2 ###### #M = s #CC = sc #LD = link #LIBPATH = F:\symantec\lib #INCLUDEPATH = F:\symantec\include #CFLAGS = -I$(INCLUDEPATH) -m$(M) -o #LDFLAGS = #STARTUP = #LDLIBS = ; ###### IBM C++Set/2 for OS/2 ###### M = CC = icc LD = link386 LIBPATH = F:\IbmCpp\lib INCLUDEPATH = F:\IbmCpp\include CFLAGS = /Q /I$(INCLUDEPATH) /W2 /Wall /O /Oip LDFLAGS = /NOLOGO/BAT/NOI/NOE/PM:VIO LDLIBS = ; ##### Implicit Rules #### .SUFFIXES: .SUFFIXES: $(X) $(O) $(X)$(O): $(CC) $(CFLAGS) -c $< TARGET = Myiodemo$(E) OBJECTS = Myiodemo$(O) Myio$(O) Mystream$(O) myLine$(O) AOBJECTS = $(STARTUP) $(OBJECTS) $(TARGET): $(OBJECTS) $(LD) $(LDFLAGS) $(AOBJECTS),$@,,$(LDLIBS) # $(LD) $(LDFLAGS) $(AOBJECTS) -o $@ $(LDLIBS) ###### Dependancies ####### myLine$(O): myLine$(X) myLine.h Mystream$(O): Mystream$(X) Mystream.h Myio.h Myio$(O): Myio$(X) Mystream.h Myio.h Myiodemo$(O): Myiodemo$(X) myLine.h Myio.h Mystream.h c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bitarray.c0000755000076400001440000000066007055333651016264 char set[(BITCOUNT + 7) / 8]; int getbit(char *set, int number) { set += number / 8; return (*set & (1 << (number % 8))) != 0; /* 0 or 1 */ } int setbit(char *set, int number, int value) { set += number / 8; if (value) *set |= 1 << (number % 8); /* set bit */ else *set &= ~(1 << (number % 8)); /* clear bit */ } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/where.c0000755000076400001440000000675607055334334015574 /* ** WHERE.C: will search all DIRs on the given drive for specified file. */ #include #include #include #include #include #if defined(__ZTC__) #include #define GetDrive(d) dos_getdrive(&d) #define SetDrive(d) {unsigned x;dos_setdrive(d,&x);} #define FAR _far #elif defined(__TURBOC__) #include #define GetDrive(d) ((d) = getdisk() + 1) #define SetDrive(d) (setdisk(d - 1)) #define FAR far #define _dos_findfirst(f,a,b) findfirst(f,b,a) #define _dos_findnext(b) findnext(b) #define find_t ffblk #define _A_SUBDIR FA_DIREC #define attrib ff_attrib #define name ff_name #else /* assume MSC */ #include #define GetDrive(d) _dos_getdrive(&d) #define SetDrive(d) {unsigned x;_dos_setdrive(d,&x);} #define FAR _far #endif int count=0; main(int argc, char *argv[]) { char *curdir, sought[80], *temp; int curdrive, newdrive, p; void searchdir(char *dir, char *ptrn); /* Find out where we are */ curdir=getcwd(NULL,80); GetDrive(curdrive); /* Find out what we're looking for */ if(argc>1) strcpy(sought,argv[1]); else { printf("\n\nPattern to search for: "); gets(sought); } /* Get designator for another drive if specified */ if(sought[1]==':') { newdrive=(toupper(sought[0]))-64; /* convert */ SetDrive(newdrive); p = (sought[2]=='\\') ? 3:2; strcpy(sought, &(sought[p])); } /* Add wildcard prefix/suffix if necessary */ if(sought[0]=='.') { temp=strcat("*",sought); /* set prefix */ strcpy(sought,temp); } if(!strchr(sought,'.')) strcpy(sought,"*.*"); /* set suffix */ /* Perform search for pattern starting in root */ searchdir("\\",sought); printf("\nNumber of matches: %d",count); /* Restore Original Drive and Directory */ SetDrive(curdrive); chdir(curdir); return EXIT_SUCCESS; } /*------------------------------------------------------------------------- */ void searchdir(char *path, char *ptrn) #define ANYFILE 0xFF /* recursive routine */ { struct find_t *f; char *wholepath; unsigned rtn; chdir(path); /* change to new path */ wholepath=getcwd(NULL,80); /* get full path name */ f=malloc(sizeof(*f)); /* Search for filename matches in this directory */ rtn= _dos_findfirst(ptrn,ANYFILE,f); while(rtn==0) { if( f->attrib != _A_SUBDIR ) printf("%s\\%s\n",wholepath,f->name); else printf("%s\\%s \n",wholepath, f->name); ++count; rtn = _dos_findnext(f); /* find next match */ } /* end while loop */ /* Now search any subdirectories under this directory */ rtn= _dos_findfirst("*.*", _A_SUBDIR,f); while(rtn==0) { if( (f->attrib == _A_SUBDIR) && (f->name[0] != '.')) { searchdir(f->name,ptrn); /* recursive call */ chdir(wholepath); } rtn = _dos_findnext(f); /* search next dir */ } free(wholepath); free(f); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/isshare.c0000755000076400001440000000433107055334025016100 /* ** is_share() - This is a routine that allows a program to determine ** if file-sharing is enabled at run-time. ** ** What does this code do? First - it checks to make sure ** it is running under DOS 3.0+ - otherwise - no sharing. ** Next, it opens the program itself (the .EXE file) by using ** "argv[0]". This argument points to the actual program name ** complete with the path under DOS 3.0 or later. It then ** attempts to lock the first 500 bytes of the program on ** disk. If successful (i.e. return != -1), it unlocks the ** locked bytes and closes the file (actually the unlock is ** superfluous since closing the file releases all locks) and ** returns the a "TRUE" (1) result. If it fails, it closes ** the .EXE file and returns a "FALSE" (0) result. Note that ** this does not depend on opening a file in shared mode to ** test it. ** ** Example of usage: ** ** main(int argc, char *argv[]) ** { ** int sharing; ** ** sharing = is_share(argv[0]); ** . ** . ** if (sharing) ** { ** // open file in shared mode ** ... ** } ** else ** { ** // use "normal" open ** ... ** } ** } ** ** Revision History: ** ** 08/03/93 Original: "is_sharing()" by Mike Ratledge of fidonet ** 10/20/93 Revision: revised for library ** 04/03/94 Revision: "Portabalized" for SNIPPETS by Bob Stout */ #include #include #include #if defined(_MSC_VER) #include #include int lock(int fp, long ofs, long lng) { lseek(fp,0L,SEEK_SET); return locking(fp,LK_LOCK,lng); } int unlock(fp,ofs,lng) { lseek(fp,0L,SEEK_SET); return locking(fp,LK_UNLCK,lng); } #endif int is_share(char *arg) { FILE *exe; if (_osmajor < 3) return(0); exe = fopen(arg, "rb"); if (0 == lock(fileno(exe), 0l, 500l)) { unlock(fileno(exe), 0l, 500l); fclose(exe); return(1); } fclose(exe); return(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/wordwrap.c0000755000076400001440000000443607055334343016320 /* ** WORDWRAP.C - Simple CRT word wrap demonstration routine ** ** public domain by Robert Morgan */ #include #include #include int get_ln(int rmargin); void clr_eol(const int curpos, const int pos); void main() { printf("Enter text. Press CTRL-A to quit.\n"); while((get_ln(75)) != 0) /* Change 75 to whatever number you */ ; /* wish to be the right margin */ } void clr_eol(const int curpos, const int pos) { int distance; int count; distance = curpos - pos; for (count = 1; count <= distance; count++) putch('\b'); for (count = 1; count <= distance; count++) putch(' '); } int get_ln(int rmargin) { char word[80]; static int wordpos = 0; static int curpos = 1; static int ch = 0; static int pos = 0; word[wordpos] = '\0'; while (ch != 1) { ch = getch(); switch(ch) { case 1: return(0); case ' ': pos = curpos; putch(' '); curpos++; wordpos = 0; word[0] = '\0'; break; case '\b': putch('\b'); curpos--; if (wordpos > 0) wordpos--; break; case '\r': puts("\r"); wordpos = 0; word[wordpos] = '\0'; curpos = 1; pos = 0; break; default: putch(ch); word[wordpos] = (char)ch; curpos++; wordpos++; break; } if(curpos == rmargin) { word[wordpos] = '\0'; clr_eol(curpos,pos); wordpos = 0; curpos = strlen(word); pos = 0; puts("\r"); printf("%s",word); } } return -1; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bmhasrch.c0000755000076400001440000000723007055333654016241 /* ** Boyer-Moore-Horspool pattern match ** Case-insensitive with accented character translation ** ** public domain by Raymond Gardner 7/92 ** ** limitation: pattern length + subject length must be less than 32767 ** ** 10/21/93 rdg Fixed bug found by Jeff Dunlop */ #include /* rdg 10/93 */ #include #include typedef unsigned char uchar; #define LOWER_ACCENTED_CHARS unsigned char lowervec[UCHAR_MAX+1] = { /* rdg 10/93 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,'!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/', '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?', '@','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', 'p','q','r','s','t','u','v','w','x','y','z','[','\\',']','^','_', '`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', 'p','q','r','s','t','u','v','w','x','y','z','{','|','}','~',127, #ifdef LOWER_ACCENTED_CHARS 'c','u','e','a','a','a','a','c','e','e','e','i','i','i','a','a', 'e',145,146,'o','o','o','u','u','y','o','u',155,156,157,158,159, 'a','i','o','u','n','n',166,167,168,169,170,171,172,173,174,175, #else 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, #endif 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, }; #define lowerc(c) lowervec[(uchar)(c)] #define LARGE 32767 static int patlen; static int skip[UCHAR_MAX+1]; /* rdg 10/93 */ static int skip2; static uchar *pat; void bmh_init(const char *pattern) { int i, j; pat = (uchar *)pattern; patlen = strlen(pattern); for (i = 0; i <= UCHAR_MAX; ++i) /* rdg 10/93 */ { skip[i] = patlen; for (j = patlen - 1; j >= 0; --j) { if (lowerc(i) == lowerc(pat[j])) break; } if (j >= 0) skip[i] = patlen - j - 1; if (j == patlen - 1) skip[i] = LARGE; } skip2 = patlen; for (i = 0; i < patlen - 1; ++i) { if ( lowerc(pat[i]) == lowerc(pat[patlen - 1]) ) skip2 = patlen - i - 1; } } char *bmh_search(const char *string, const int stringlen) { int i, j; char *s; i = patlen - 1 - stringlen; if (i >= 0) return NULL; string += stringlen; for ( ;; ) { while ((i += skip[((uchar *)string)[i]]) < 0) ; /* mighty fast inner loop */ if (i < (LARGE - stringlen)) return NULL; i -= LARGE; j = patlen - 1; s = (char *)string + (i - j); while (--j >= 0 && lowerc(s[j]) == lowerc(pat[j])) ; if ( j < 0 ) /* rdg 10/93 */ return s; /* rdg 10/93 */ if ( (i += skip2) >= 0 ) /* rdg 10/93 */ return NULL; /* rdg 10/93 */ } } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/joystick.c0000755000076400001440000000307507055334032016303 /* ** JOYSTICK.H ** ** Joystick support functions ** ** Public domain demo by Bob Stout */ typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL; #define BOOL(x) (!(!(x))) #define SUCCESS 0 struct joystick { LOGICAL switch_0; LOGICAL switch_1; LOGICAL switch_2; LOGICAL switch_3; int pos_Ax; int pos_Ay; int pos_Bx; int pos_By; }; LOGICAL read_joystick(void); /* ** JOYSTICK.C ** ** Joystick support functions ** ** Public domain demo by Bob Stout */ #include #include "joystick.h" struct joystick JoyStick; /* ** read_joystick() ** ** returns SUCCESS or ERROR ** ** fills in global JoyStick structure */ LOGICAL read_joystick(void) { union REGS regs; regs.h.ah = 0x84; /* Read the switches */ regs.x.dx = 0; int86(0x15, ®s, ®s); if (regs.x.cflag) return ERROR; JoyStick.switch_0 = BOOL(regs.h.al & 0x10); JoyStick.switch_1 = BOOL(regs.h.al & 0x20); JoyStick.switch_2 = BOOL(regs.h.al & 0x40); JoyStick.switch_3 = BOOL(regs.h.al & 0x80); regs.h.ah = 0x84; /* Read positions */ regs.x.dx = 1; int86(0x15, ®s, ®s); if (regs.x.cflag) return ERROR; JoyStick.pos_Ax = regs.x.ax; JoyStick.pos_Ay = regs.x.bx; JoyStick.pos_Bx = regs.x.cx; JoyStick.pos_By = regs.x.dx; return SUCCESS; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/isshift.c0000755000076400001440000000160607055334026016116 /*-------------------------[ IsShift ]--------------------------*/ /* Determine whether a shift key is depressed */ /* public domain snippet by Jeff Dunlop */ /*--------------------------------------------------------------*/ /* local: */ /* key_flags = pointer to bios shift key area */ /* return: */ /* 1 if either shift key is depressed */ /*--------------------------------------------------------------*/ #if !defined(MK_FP) #define MK_FP(seg,off) ((void far *)(((long)(seg) << 16)|(unsigned)(off))) #endif int IsShift(void) { unsigned char far *keyflags = MK_FP(0x40, 0x17); return (*keyflags & 0x03); } /* -or?- */ #define IsShift ((*MK_FP(0x40, 0x17)) & 0x03) c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/dirmask.c0000755000076400001440000000572507055333722016107 /* ** DIRMASK.C - Complex pattern matching ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include #include #include "dirent.h" int patmat(const char *, const char *); typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL; #define SUCCESS 0 /****************************************************************/ /* */ /* dirmask() */ /* */ /* Tests a directory entry for matching patterns. Tests both */ /* file name and attributes. Tests for both inclusion specs */ /* and exclusion specs. */ /* */ /* Parameters: 1 - Pointer to the directory entry's FIND */ /* structure */ /* 2 - Filename for inclusion matching, i.e. if */ /* this spec matches the filename, we matched. */ /* Use NULL to match anything. */ /* 3 - Filename for exclusion matching, i.e. if */ /* this spec matches the filename, we failed. */ /* Use NULL to exclude nothing. */ /* 4 - Attribute for inclusion mask. Use FA_ANY */ /* to match anything). */ /* 5 - Attribute for exclusion mask. Use zero to */ /* exclude nothing). */ /* */ /* Returns: SUCCESS if name and attribute matched, else ERROR. */ /* */ /* Side effects: Converts patterns to upper case */ /* */ /****************************************************************/ int dirmask(struct DSTRUCT *dstruct, char *fname_inc, char *fname_exc, unsigned attr_inc, unsigned attr_exc) { if (!dstruct) return ERROR; strupr(fname_inc); strupr(fname_exc); if (fname_inc) { if (TRUE != patmat(dstruct->NAME, fname_inc)) return ERROR; } if (fname_exc) { if (TRUE == patmat(dstruct->NAME, fname_exc)) return ERROR; } if (!((dstruct->ATTRIBUTE | 0x80) & attr_inc)) return ERROR; if (dstruct->ATTRIBUTE & attr_exc) return ERROR; return SUCCESS; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/enums.txt0000755000076400001440000000412407055333743016174 Some of my favorites... ----------------------- typedef enum {ERROR = -1, SUCCESS, FALSE = 0, TRUE} logical; #define BOOL(x) (!(!(x))) /* always TRUE or FALSE */ /* (trivial) Example code follows */ #define MAX_VAL 10000 /* data upper bound */ #define MIN_VAL -37 /* data lower bound */ logical testfunc(int intvalue) { if (MAX_VAL < intvalue || MIN_VAL > intvalue) return ERROR; /* if out of bounds */ else return BOOL(intvalue); /* zero returns FALSE, anything else is TRUE*/ } /* Examples using SUCCESS/ERROR */ if (SUCCESS == strcmp(my_string, "something")) do_something(); if (ERROR == open("my_file", O_READ)) abort(); And, speaking of enumerated data types (which we can feel free to do since they're now "official" with the adoption of ANSI C), these are very handy when defining lists of data which may need to be appended in the future. If you define your enums this way: enum CARS {CARS_MIN = -1, FORD, CHEVY, PLYMOUTH, CARS_MAX}; ...then you can write "expandable" code as follows: logical real_car(enum CARS my_car) { if (CARS_MIN >= my_car || CARS_MAX <= my_car) return FALSE; else return TRUE; } By including `CARS_MIN' and `CARS_MAX' as dummy enumerations, you can change the declaration to: enum CARS {CARS_MIN = -1, FORD, CHEVY, PLYMOUTH, FERRARI, CARS_MAX}; ...and all your existing code will still work properly, allowing you to spend your time writing new code to support the new enumerations rather than going back to fix any bounds checking you may have already written. In addition if, within the enum declaration, you declare `CARS_MIN = -1', then you can also include this handy little bit of expandable code: printf("Right now, I know about %d type%s of CARS\n", CARS_MAX, &"s"[1 == CARS_MAX]); c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/myline.h0000755000076400001440000000254307055334121015744 // myLine.h // // Donated to the public domain; no restrictions on reuse or abuse apply. // by David Nugent, 7th June, 1993. // Simple line input class for istream to demonstrate input of a complete // line rather than whitespace separated tokens (the default for operator<< // for char* and other built-in types). // Works by overloading operator>> for a customised class - this functionality // is easily incorporated into your favourite String class // # if !defined(_myLine_h) # define _myLine_h 1 # define AUTO_GROW 1 // Allow autogrowth of buffer to fit # define ALLOC_LEN 80 // Standard length & growth increment // Class declaration class myLine { public: myLine (short buflen =ALLOC_LEN); myLine (char * usebuf, short buflen =ALLOC_LEN); ~myLine (void); // Get buffer address char const * buf (void) const { return mybuf; } // Conversion operators char const * operator() (void) const { return mybuf; } // Explicit cast operator char const * (void) const { return mybuf; } // Implicit cast // istream operator>> friend istream & operator>> (istream &, myLine &); private: short len, xalloc; char * mybuf; }; # endif // _myLine_h c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/rndmize.c0000755000076400001440000000005107055334212016103 srand( ((unsigned int)time(NULL)) | 1); c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cpucheck.asm0000755000076400001440000000531707055333710016572 page 55, 132 ; FUNCTION: cpu_check ; ; Attempt to discover the type of CPU. Use MASM 5.1 or greater. ; Returns 86 for 8088/8086, 286 for 80286, 386 for 80386/80486. ; ; Requires MASM 5.1 or later or equivalent ; ; Assemble with: MASM /Mx /z ... ; TASM /jMASM /mx /z ... ; % .MODEL memodel,C ;Add model support via ;command line macros, e.g. ;MASM /Dmemodel=LARGE .CODE ; ; int cpu_check(void) - returns 86, 186, 286, 386 ; PUBLIC cpu_check cpu_check PROC USES BX pushf xor ax,ax ; zero ax push ax popf ; try to put 0 into flags pushf pop ax ; see what went in flags and ax,0f000h ; mask off high flag bits cmp ax,0f000h ; was high nibble ones je _86 ; is 8086 or 8088 push sp ; see if sp is updated pop bx ; before or after it is cmp bx,sp ; pushed jne _186 mov ax,0f000h ; try to set high bits push ax popf ; in the flags pushf pop ax ; look at actual flags and ax,0f000h ; any high bits set? je _286 ; is 80286 _386: .386 ; enable 386 instructions pushfd ; save extended flags mov eax,040000h push eax ; push 40000h onto stack popfd ; pop extended flags pushfd ; push extended flags pop eax ; put in eax and eax,040000h ; is bit 18 set? jne _486 ; yes, it's a 486 mov ax,386 ; no, it's a 386 jmp _386x _486: mov ax,486 _386x: popfd ; clean the stack jmp ccexit _286: mov ax,286 ; is an 80286 jmp ccexit _186: mov ax,186 ; is an 80188/80186 jmp ccexit _86: mov ax,86 ; is an 8088/8086 ccexit: popf ; restore original flags ret ; return cpu_check ENDP end c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mcb_env.c0000755000076400001440000001070207055334070016052 #include #include #include #include #ifdef __TURBOC__ #include #define FAR far #else #include #define FAR _far #endif #if !defined(MK_FP) #define MK_FP(seg,off) ((void FAR *)(((long)(seg) << 16)|(unsigned)(off))) #endif struct EnvRec { unsigned EnvSeg; /*Segment of the environment*/ unsigned EnvLen; /*Usable length of the environment*/ } EnvRec; struct EnvRec *MasterEnv(void) { unsigned owner; unsigned mcb; unsigned eseg; static struct EnvRec env; env.EnvSeg = env.EnvLen = 0; owner = * ((unsigned FAR *) MK_FP(0, (2+4*0x2e))); /* int 0x2e points to command.com */ mcb = owner -1; /*Mcb points to memory control block for COMMAND */ if ( (*((char FAR *) MK_FP(mcb, 0)) != 'M') && (*((unsigned FAR *) MK_FP(mcb, 1)) != owner) ) return (struct EnvRec *) 0; eseg = *((unsigned FAR *) MK_FP(owner, 0x2c)); /* Read segment of environment from PSP of COMMAND} */ /* Earlier versions of DOS don't store environment segment there */ if ( !eseg ) { /* Master environment is next block past COMMAND */ mcb = owner + *((unsigned FAR *) MK_FP(mcb, 3)); if ( (*((char FAR *) MK_FP(mcb, 0)) != 'M') && (*((unsigned FAR *) MK_FP(mcb, 1)) != owner) ) return (struct EnvRec *) 0; eseg = mcb + 1; } else mcb = eseg-1; /* Return segment and length of environment */ env.EnvSeg = eseg; env.EnvLen = *((unsigned FAR *) MK_FP(mcb, 3)) << 4 ; return &env; } /* ** Then a function to find the string to be replaced. This one'll ** return a pointer to the string, or a pointer to the first (of 2) ** NUL byte at the end of the environment. */ char FAR *SearchEnv( char FAR *eptr, char *search ) { char FAR *e; char *s; while ( *eptr ) { for ( s=search, e=eptr; *e && *s && (*e == *s); e++, s++ ) ; /* NULL STATEMENT */ if ( !*s ) break; while ( *eptr ) eptr++; /* position to the NUL byte */ eptr++; /* next string */ } return eptr; } /* ** Now, the function to replace, add or delete. If a value is not ** given, the string is deleted. */ int SetEnvStr( struct EnvRec *env, char *search, char *value ) { /* -Set environment string, returning true if successful */ char FAR *envptr; register char FAR *p; char *s; int newlen; int oldlen; int i; if ( !env->EnvSeg || !search ) return 0; /* get some memory for complete environment string */ newlen = strlen(search) + sizeof((char) '\0') + strlen(value) + 2; if ( (s = (char *) malloc( newlen)) == NULL ) return 0; for ( i = 0; *search; search++, i++ ) s[i] = *search; s[i++] = '='; s[i] = '\0'; envptr = SearchEnv((char FAR *) MK_FP(env->EnvSeg, 0), s ); if ( *envptr ) { for ( p = envptr, oldlen = 0; *p; oldlen++, p++ ) ; /* can't use strlen() because of far pointer */ } /* will set p to point to terminating NUL */ if ( *value && (newlen > (int)env->EnvLen) ) /* not a deletion */ { free( s ); return 0; /* won't fit */ } if ( *envptr ) /* shift it down */ { for ( ++p; (*p || *(p+1)); envptr++, p++ ) *envptr = *p; *envptr++ = '\0'; *envptr = '\0'; } if ( *value ) /* append it */ { strcat(s, value); while ( *s ) *(envptr++) = *s++; *envptr++ = '\0'; *envptr = '\0'; } free(s); return 1; } /* ** Ok, just to show you that I tested it : */ void main(void) { char vn[80]; char va[80]; struct EnvRec *p = MasterEnv(); puts("enter variable name:"); gets(vn); puts("enter value:"); gets(va); printf("SetEnvStr returned %d\n", SetEnvStr( p, strupr(vn), va) ); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/stptok.c0000755000076400001440000000213007055334252015763 /* ** stptok() -- public domain by Ray Gardner, modified by Bob Stout ** ** You pass this function a string to parse, a buffer to receive the ** "token" that gets scanned, the length of the buffer, and a string of ** "break" characters that stop the scan. It will copy the string into ** the buffer up to any of the break characters, or until the buffer is ** full, and will always leave the buffer null-terminated. It will ** return a pointer to the first non-breaking character after the one ** that stopped the scan. */ #include #include char *stptok(const char *s, char *tok, size_t toklen, char *brk) { char *lim, *b; if (!*s) return NULL; lim = tok + toklen - 1; while ( *s && tok < lim ) { for ( b = brk; *b; b++ ) { if ( *s == *b ) { *tok = 0; return (char *)s; } } *tok++ = *s++; } *tok = 0; return (char *)s; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/doansi.h0000755000076400001440000000175507055333723015737 /* ** DOANSI.H - Portable ANSI screen code interpreter ** ** From DRSK_105.LZH (ansi.c), hereby declared free for use for whatever ** purposes by author: Mark Kimes */ /* set maxx,maxy as desired */ void set_screensize (int reservedlines); /* put character c at x,y using attr as attribute */ void put_char (char c,char attr,int x,int y); /* position hardware cursor at x,y */ void pos_hardcursor (int x,int y); /* turn hardware cursor off */ void hardcursor_off (void); /* turn hardware cursor on at x,y */ void hardcursor_on (int x,int y); /* scroll window tx,ty - bx,by up one line; fill with blank+attr */ void scroll_up (int tx,int ty,int bx,int by,char attr); /* clear the window from tx,ty - bx,by; fill with blank+attr */ void clearwindow (int tx,int ty,int bx,int by,char attr); /* clear line y from col x to eol (ex); fill with blank+attr */ void cleartoeol (int x,int y,int ex,char attr); /* the ansi string interpreter */ int ansi_out (char *buf); c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bigfac.c0000755000076400001440000000566507055333647015701 /* ** bigfac.c -- put into the public domain by Carl Declerck */ #include #include #include #define BUFFLEN 8192 #define BUFFER ((char *) malloc(BUFFLEN)) void main (void); void multiply (char *, char *, char *); void zero_buffer (char *); void minus_one (char *); int isnull (char *); void factorial (char *); void main (void) { char *g = BUFFER; printf ("Enter a number: "); scanf ("%s", g); printf ("Factorial of %s is: ", g); factorial (g); printf ("%s\n", g); free (g); } void multiply (char *g1, char *g2, char *g3) { int gp1, gp2, cumpos, respos, mod, div; int cmod, cdiv, resoff, wdig1, wdig2, base; zero_buffer (g3); for (gp2 = strlen(g2) - 1; gp2 >= 0; gp2--) { wdig2 = *(g2 + gp2) - 48; resoff = strlen(g2) - gp2 - 1; respos = BUFFLEN - resoff - 2; for (gp1 = strlen(g1) - 1; gp1 >= 0; gp1--) { wdig1 = *(g1 + gp1) - 48; mod = (wdig1 * wdig2) % 10; div = (wdig1 * wdig2) / 10; base = *(g3 + respos) - 48; cmod = (base + mod) % 10; cdiv = (base + mod) / 10 + div; *(g3 + respos) = (char)(cmod + 48); cumpos = --respos; while (cdiv > 0) { base = *(g3 + cumpos) - 48; *(g3 + cumpos--) = (char)((base + cdiv) % 10 + 48); cdiv = (base + cdiv) / 10; } } } for (respos = 0; *(g3 + respos) == '0'; respos++) ; strcpy (g3, (char *) (g3 + respos)); if (*g3 == 0) strcpy (g3, "0"); } void zero_buffer (char *buff) { int cnt; for (cnt= 0; cnt < BUFFLEN; cnt++) *(buff + cnt) = '0'; *(buff + BUFFLEN - 1) = 0; } void minus_one (char *g) { int p; char digit; p = strlen(g) - 1; digit = *(g + p); while (digit == '0') { *(g + p--) = '9'; digit = *(g + p); } *(g + p) -= 1; } int isnull (char *g) { int p, ok = 1; for (p = 0; p < (int)(strlen(g)); p++) if (*(g + p) != '0') ok = 0; return (ok); } void factorial (char *g) { char *h1 = BUFFER, *h2 = BUFFER; strcpy (h1, "1"); while (!isnull(g)) { multiply (h1, g, h2); strcpy (h1, h2); minus_one (g); } strcpy (g, h1); free (h1); free (h2); } /* ** The principal function is multiply(), it 'multiplies' two ** character-strings of arbritrary length and puts the result ** into a third. 8192 bytes is enough for 1000!, beyond that ** the buffer-size may need to be incremented. */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cerrinst.asm0000755000076400001440000000602207055333673016640 PAGE ,132 ; Install an Interrupt 24 (DOS critical error exception) handler ; ; Public domain by Bob Stout ; ; Requires MASM 5.1 or later or equivalent ; ; Assemble with: MASM /Mx /z ... ; TASM /jMASM /mx /z ... % .MODEL memodel,C ;Add model support via command ;line macros, e.g. ;MASM /Dmemodel=LARGE .DATA? PUBLIC cedevdvr, cetype, ceerror, cereturn _origvec dd ? _newvec dd ? cedevdvr dd ? cetype dw ? ceerror dw ? cereturn db ? .CODE ; ; This is our actual ISR ; myint24: push ds ;save registers which may be push es ;required in case "Retry" is push bx ;selected push cx push dx push si push di push bp mov word PTR cedevdvr,si ;save device driver header address mov word PTR cedevdvr+2,bp mov cetype,ax ;save error type information mov ceerror,di ;save error code information call far PTR _newvec ;call our handler mov al,cereturn ;set up return code (abort, retry...) pop bp ;restore necessary registers pop di pop si pop dx pop cx pop bx pop es pop ds iret ; ; Call this to install our ISR ; ; void (_far *)() ins24(unsigned short segm, unsigned short offs); ; void (_far *)() ins24((void _far *handler)()); ; ; Paramters (option 1) - 1 : Segment of handler ; 2 : Offset of handler ; ; Paramters (option 2) - 1 : Address of handler ; ; Returns pointer to old handler ; ins24 PROC USES AX BX DS ES, segm:WORD, offs:WORD mov ax,3524h ;get old vector... int 21h mov word PTR _origvec,bx mov word PTR _origvec+2,es ;...and save it mov ax,offs ;load handler offset... mov word PTR _newvec,ax mov ax,segm ; & segment into _newvec mov word PTR _newvec+2,ax push cs ;get myint24 segment in DS pop ds mov dx, OFFSET myint24 ;install myint24 in int 24h mov ax,2524h ; into Interrupt 24h int 21h mov ax,word PTR _origvec mov dx,word PTR _origvec+2 ins24 ENDP ; ; Call this to uninstall our ISR ; ; void redo24(void); ; redo24 PROC USES AX BX DS mov dx, word PTR _origvec ;restore original vector mov ds, word PTR _origvec+2 mov ax,2524h int 21h ret redo24 ENDP end c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/strdup.c0000755000076400001440000000042107055334261015761 /* ** Portable, public domain strdup() by Bob Stout */ #include #include char *strdup(const char *string) { char *new; if (NULL != (new = malloc(strlen(string) + 1))) strcpy(new, string); return new; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/testcmt.c0000755000076400001440000000051407055334303016123 /* testcmt.c - test getcmt.exe - C comment 1 */ int i; main() { int j; /* C comment 2 */ int k; /* C comment 3 */ char ch2; /* C comment 4 */ char ch3; // C++ comment 1 // C++ comment 2 char ch4; // C++ comment 3 i = 0; return(i); } /* end of testcmt.c - C comment 5 */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/fraction.c0000755000076400001440000000542207055333766016264 /* ** FRACTION.C - Compute continued fraction series ** ** cfrac() donated to the public domain by the author, Thad Smith ** original Fraction.C, public domain by Bob Stout, modified to use cfrac() */ #include #include #define MAX_LENGTH 100 long double cfrac(long double x, long double *p, long double *q, int bits) { double v; /* integer in series */ long double del; /* x - v */ long double z; /* approximated value from truncated series */ long double t; /* temp */ long double p0 = 0.0, q0 = 0.0; /* last p, q */ long double imax; /* max for p, q */ static long double cf[MAX_LENGTH]; /* continued fraction integers */ int i, j, ntimes = MAX_LENGTH;; if (x < 0) x = -x; imax = floor(pow(2.0, bits)) - 1.0; for (i = 0; i < ntimes; i++) { v = floor((double)x); cf[i] = v; z = cf[i]; *p = z; *q = 1; for (j = i; j--; ) { z = cf[j] + 1.0/z; t = *p; *p = cf[j] * (*p) + (*q); *q = t; } del = x-v; if (del < DBL_EPSILON) break; if ((*p > imax) || (*q > imax)) { *p = p0; *q = q0; break; } else { p0 = *p; q0 = *q; } x = 1.0 / del; } return (*p)/(*q); } /* ** Remove everything below this to use cfrac() as a stand-alone function */ #include #include main (int argc, char *argv[]) { long double x; /* value to be approximated */ long double r,p,q; /* approx ratio r = p/q */ int bits; /* bits of precision */ if (argc < 2 || argc > 3) { puts ("Use: FRACTION value [precision]"); puts ("where value = floating point value to generate " "continued fraction"); puts (" precision (optional) = bits in " "numerator/denominator"); return 1; } sscanf (argv[1], "%Lf", &x); if (argc == 3) bits = atoi(argv[2]); else bits = 32; cfrac(x, &p, &q, bits); printf("\n[%.20Lf]\n%.0Lf/%.0Lf = %lXh/%lXh = %.20Lf\n", x, p, q, (long)p, (long)q, r = p/q); printf("Error = %.10Lg, (%.10Lf%%)\n", r - x, 100. * (r - x) / x); return EXIT_SUCCESS; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/ansiload.c0000755000076400001440000000250007055333636016237 /* ** ANSILOAD.C - tries to detect if an ANSI-style driver is loaded ** ** public domain by Bob Jarvis */ #include #include typedef enum {FALSE, TRUE} LOGICAL; void goto_rc(int row, int col) { union REGS regs; regs.h.ah = 2; regs.h.bh = 0; /* assumes we're using video page 0 */ regs.h.dh = (unsigned char)row; regs.h.dl = (unsigned char)col; int86(0x10, ®s, ®s); } void get_rc(int *row, int *col) { union REGS regs; regs.h.ah = 3; regs.h.bh = 0; /* again, assume video page 0 */ int86(0x10, ®s, ®s); *row = regs.h.dh; *col = regs.h.dl; } int is_ansi_loaded(void) { int save_r, save_c; int new_r, new_c; int isloaded; get_rc(&save_r, &save_c); goto_rc(15,15); fputs("\x1B[0;0H", stderr); get_rc(&new_r, &new_c); if(new_r == 0 && new_c == 0) isloaded = TRUE; else { isloaded = FALSE; fputs("\b\b\b\b\b\b \b\b\b\b\b\b", stderr); } goto_rc(save_r, save_c); return isloaded; } void main(void) { if(is_ansi_loaded()) puts("ANSI.SYS is loaded"); else puts("ANSI.SYS is NOT loaded"); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/break.c0000755000076400001440000000075607055333656015546 /* ** Set or determine the status of the DOS "SET BREAK=" command */ #include #define BOOL(x) (!(!(x))) /* ** Returns status of DOS "SET BREAK" command */ int isBreakOn(void) { union REGS regs; regs.x.ax = 0x3300; intdos(®s, ®s); return (int)regs.h.dl; } void setBreak(int OnOff) /* Off = 0, On = 1 */ { union REGS regs; regs.x.ax = 0x3301; regs.h.dl = OnOff; intdos(®s, ®s); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cerrtrap.asm0000755000076400001440000001123207055333675016632 PAGE ,132 ; A sample Interrupt 24 (DOS critical error exception) handler ; ; Public domain by Bob Stout ; ; Requires MASM 5.1 or later or equivalent ; ; Assemble with: MASM /Mx /z ... ; TASM /jMASM /mx /z ... % .MODEL memodel,C ;Add model support via command ;line macros, e.g. ;MASM /Dmemodel=LARGE EXTRN cedevdvr:dword, cetype:word, ceerror:word, cereturn:byte EXTRN read_err:far, write_err:far, term_err:far EXTRN no_paper:far, fixup_ret:far, FAT_err:far ;NOTE: All the above routines MUST set cereturn to: ; 0 - Ignore ; 1 - Retry ; 2 - Abort ; 3 - Fail (DOS 3.3 and later) .DATA? PUBLIC osver, rmvbl, exerr, locus, class, suggest osver db ? rmvbl db ? exerr dw ? locus db ? class db ? suggest db ? .CODE ; ; This is called by myint24 ; ; extern int (*read_err)(), ; (*write_err)(), ; (*term_err)(), ; (*no_paper)(), ; (*fixup_ret)(), ; (*FAT_err)(); ; ; Each returns: 0 - Ignore ; 1 - Retry ; 2 - Abort ; 3 - Fail (DOS 3.3 and later) ; mynew24 PROC USES BX mov ah,030h ;get DOS version number int 21 or al,al ;zero means DOS 1.x jnz NotDOS1 mov al,1 NotDOS1: mov osver,al ;save DOS version mov ax,cetype ;get type of exception... mov bx,ax ; & save it for later and ax,80h ;disk error? jnz NotDiskErr ;no, continue cmp al,1 ;yes, DOS 1.x? jz wrong_DOS ;yes, can't check for removable media mov ah,-1 ;no, assume removable media test word PTR cedevdvr,0800h ;is the media removable? jz removable xor ah,ah ;no, flag fixed media removable: mov rmvbl,ah ;save media type cmp al,3 ;DOS 3.0 or greater? jb wrong_DOS ;no, skip it push bx ;yes, save cetype info... push ds ; & other regs push es push dx push si push di push bp mov ah,59h ;get extended error info int 21 pop bp ;restore regs pop di pop si pop dx pop es pop ds mov exerr,ax ;save extended error code... mov locus,ch ; locus... mov class,bh ; class... mov suggest,bl ; & suggested action pop bx ;restore cetype info wrong_DOS: mov ax,bx ;get exception type and ax,06h ;FAT problems? cmp ax,02h jnz ok_fat ;no, continue jmp far PTR FAT_err ;yes, handle it ok_fat: mov ax,bx ;get exception type and ax,01h ;handle read and write separately jz rd_err jmp far PTR write_err rd_err: jmp far PTR read_err NotDiskErr: test ceerror,0009h ;printer out of paper? jnz not_eop ;no, continue jmp far PTR no_paper ;yes, handle it not_eop: test word PTR cedevdvr,8000h ;character device? jnz unknown ;no, continue jmp far PTR term_err ;yes, assume bad terminal I/O ; ; If we get here, we haven't identified the error. We now call fixup_ret() ; to resolve which action to take. This will usually involve the information ; in exerr qualified by the version of DOS in use and is best left to coding ; in a higher level language like C. ; ; NOTE: It is IMPERATIVE that the return value of fixup_ret() default to 2 ; to insure that if all else fails, the critcal error handler aborts! ; unknown: call far PTR fixup_ret ;unknown error - handle loose ends... xor ah,ah ; & return mov cereturn,al ret mynew24 ENDP end c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/sstrcpy.c0000755000076400001440000000033407055334250016150 #include char *sstrcpy(char *to, char *from) { memmove(to, from, 1+strlen(from)); return to; } char *sstrcat(char *to, char *from) { sstrcpy(to + strlen(to), from); return to; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/strrev.c0000755000076400001440000000120407055334266015772 /* ** STRREV.C - reverse a string in place ** ** public domain by Bob Stout */ #include char *strrev(char *str) { char *p1, *p2; if (! str || ! *str) return str; for (p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2) { *p1 ^= *p2; *p2 ^= *p1; *p1 ^= *p2; } return str; } #ifdef TEST #include int main(int argc, char *argv[]) { while (--argc) { printf("\"%s\" backwards is ", *++argv); printf("\"%s\"\n", strrev(*argv)); } } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/reboot.c0000755000076400001440000000077407055334175015751 /* ** Public domain demo to reboot a PC */ #ifdef __TURBOC__ #define FAR far #else #define FAR _far #endif short FAR *bios_post = (short FAR *)0x00400072; void (FAR * boot)(void) = (void (FAR *)())0xffff0000; void reboot(warm) { if (warm) *bios_post = 0x1234; else *bios_post = 0; boot(); } #ifdef TEST #include void main(void) { puts("The computer should do a cold start"); reboot(0); } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mystream.h0000755000076400001440000000341407055334122016307 // Mystream.h // iostream interface for class Myio // Defines the following classes: // Mystreambuf derived from streambuf - buffer management & I/O interface // Mystreambase base class used for initialisation & object reference // Myiostream customised iostream, derived from iostream/Mystreambase // // Written by David L Nugent, June 1993 // # if !defined(_Mystream_h) # define _Mystream_h 1 # include # include "Myio.h" // // Mystreambuf // This is the class which does all the actual I/O // handling and (optional) buffer management // class Mystreambuf : public streambuf { public: Mystreambuf (Myio * mPtr); protected: virtual int overflow (int = EOF); virtual int underflow (); virtual int sync (); private: Myio * mptr; // Points to the Myio instance to // which this stream is attached char _back[2]; // Holder for putback }; class Mystreambase : public virtual ios { public: Mystreambase (Myio * mPtr); Mystreambuf * rdbuf (void); protected: Mystreambuf mystreambuf; }; inline Mystreambase::Mystreambase (Myio * mPtr) : mystreambuf (mPtr) {} inline Mystreambuf * Mystreambase::rdbuf (void) { return &mystreambuf; } class Mystream : public Mystreambase, public iostream { public: Mystream (Myio * mPtr); ~Mystream (void); }; // // class Mystream constructor // This uses Mystreambase to set up the Mystreambuf // which can then be used to initialise iostream. // inline Mystream::Mystream (Myio * m) : Mystreambase (m), iostream (rdbuf()) {} inline Mystream::~Mystream (void) {} # endif // _Mystream_h c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/strupr.c0000755000076400001440000000072107055334270016002 /* ** Portable, public domain strupr() & strlwr() */ #include char *strupr(char *str) { char *string = str; if (str) { for ( ; *str; ++str) *str = toupper(*str); } return string; } char *strlwr(char *str) { char *string = str; if (str) { for ( ; *str; ++str) *str = tolower(*str); } return string; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/faskbhit.c0000755000076400001440000000104307055333754016242 /* ** by David Goodenough & Bob Stout */ #ifdef __TURBOC__ #define FAR far #else #define FAR _far #endif #ifndef MK_FP #define MK_FP(seg,offset) \ ((void FAR *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #endif #define biosseg 0x40 int fast_kbhit(void) { return *((unsigned FAR *)MK_FP(biosseg, 0x1a)) - *((unsigned FAR *)MK_FP(biosseg, 0x1c)); } void fast_kbflush(void) { *((unsigned FAR *)MK_FP(biosseg, 0x1a)) = *((unsigned FAR *)MK_FP(biosseg, 0x1c)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/cctrap.asm0000755000076400001440000000316207055333671016263 PAGE ,132 ; Install a custom Interrupt 23 (Ctrl-C exception) handler ; ; Public domain by Bob Stout ; ; Requires MASM 5.1 or later or equivalent ; ; Assemble with: MASM /Mx /z ... ; TASM /jMASM /mx /z ... % .MODEL memodel,C ;Add model support via command ;line macros, e.g. ;MASM /Dmemodel=LARGE .DATA? _origvec dd ? _newvec dd ? .CODE ; ; This is our actual ISR ; myint23: call dword PTR _newvec ;call our handler iret ; ; Call this to install our ISR ; ins23 PROC USES AX BX DS ES, offs:WORD, segm:WORD mov ax,3523h ;get old vector... int 21h mov word PTR _origvec,bx mov word PTR _origvec+2,es ;...and save it mov ax,offs ;load handler offset... mov word PTR _newvec,ax mov ax,segm ; & segment into _newvec mov word PTR _newvec+2,ax push cs ;get myint23 segment in DS pop ds mov dx, OFFSET myint23 ;install myint23 in int 23h mov ax,2523h int 21h ret ins23 ENDP ; ; Call this to uninstall our ISR ; redo23 PROC USES AX BX DS mov dx, word PTR _origvec ;restore original vector mov ds, word PTR _origvec+2 mov ax,2523h int 21h ret redo23 ENDP end c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/dblround.c0000755000076400001440000000121507055333720016252 /* ** DBLROUND.C - Rounds a double to the nearest whole number ** public domain by Ross Cottrell */ #include #include #include double round(double x) { assert(1 == FLT_ROUNDS); x += 1.0 / DBL_EPSILON; return x - 1.0 / DBL_EPSILON; } #ifdef TEST #include #include void main(int argc, char *argv[]) { double val; char *dummy; while (--argc) { val = strtod((const char *)(*(++argv)), &dummy); printf("round(%g) = ", val); printf("%.12g\n", round(val)); } } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/pmerge.c0000755000076400001440000000304507055334140015720 /* ** pmerge() - Portable replacement for fnmerge(), _makepath(), etc. ** ** Forms a full DOS pathname from drive, path, file, and extension ** specifications. ** ** Arguments: 1 - Buffer to receive full pathname ** 2 - Drive ** 3 - Path ** 4 - Name ** 5 - Extension ** ** Returns: Nothing ** ** public domain by Bob Stout */ #include #define LAST_CHAR(s) ((s)[strlen(s) - 1]) void pmerge(char *path, char *drive, char *dir, char *fname, char *ext) { *path = '\0'; if (drive && *drive) { strcat(path, drive); if (':' != LAST_CHAR(path)) strcat(path, ":"); } if (dir && *dir) { char *p; strcat(path, dir); for (p = path; *p; ++p) if ('/' == *p) *p = '\\'; if ('\\' != LAST_CHAR(path)) strcat(path, "\\"); } if (fname && *fname) { strcat(path, fname); if (ext && *ext) { if ('.' != *ext) strcat(path, "."); strcat(path, ext); } } } #ifdef TEST #include int main(int argc, char *argv[]) { char pathname[FILENAME_MAX]; pmerge(pathname, argv[1], argv[2], argv[3], argv[4]); printf("pmerge (%s, %s, %s, %s) returned:\n %s\n", argv[1], argv[2], argv[3], argv[4], pathname); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/dspclock.c0000755000076400001440000000477407055333736016267 // public domain TSR clock code. By Michelangelo Jones, 1:141/575 or // 1:1/124. Very little support available; this is a quick hack, not // an example of the best way to write a clock TSR! Use at own risk. // Runs under TC++/BC++. Your mileage may vary. #ifndef __HUGE__ #error "Must be compiled using HUGE model-- for now" #endif #include extern unsigned _heaplen = 0; extern unsigned _stklen = 512; static char * screenbase = (char *) MK_FP (0xb800, 0); // change for mono static const long int * volatile ticks = // to 0xb000, 0 (long int * volatile) MK_FP (0, 0x046c); int calls, lastsec, lastmin, lasthr; const double tps = 18.20648; // found by experimentation! void interrupt (*oldhandler)(void); void displayclock (void) { char *moveinto = screenbase + 300; char *initwith = " : : "; // NOTE: This initializer only works because the attribute I want for the // clock HAPPENS to be the same as the ASCII value for the SPACE char! // Modify every alternate character if you want some other attribute. while (*initwith) *moveinto++ = *initwith++; lastsec = -1; lastmin = -1; lasthr = -1; calls = 20; } void interrupt clockproc(void) { static long seconds; if (calls < 17) calls++; else { seconds = (long) ((double) *ticks / tps); if (screenbase[301] != ' ') // if the attribute has changed, displayclock(); // the screen scrolled, so update. if (seconds % 60 != lastsec) { lastsec = seconds % 60; calls = 0; screenbase[314] = (char) (lastsec/10) + 48; screenbase[316] = (char) (lastsec%10) + 48; if ((! lastsec) || (lastmin < 0)) { lastmin = (seconds % 3600) / 60; screenbase[308] = (char) (lastmin/10) + 48; screenbase[310] = (char) (lastmin%10) + 48; if ((! lastmin) || (lasthr < 0)) { lasthr = ((seconds % 86400L) / 3600L); screenbase[302] = (char) (lasthr/10) + 48; screenbase[304] = (char) (lasthr%10) + 48; } } } } oldhandler (); } void main(void) { oldhandler = getvect (0x1c); displayclock(); setvect (0x1c, clockproc); keep (0, (_SS + (_SP/16) - _psp)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/c_lines.awk0000755000076400001440000000244007055333662016423 # count lines in a C program, not counting comments, blank lines or # form feeds # does separate count of preprocessor directives # if a preprocessor directive is commented out, it does not count # # By: Dan Kozak { if (file == "") { file = FILENAME } if (file != FILENAME) { printf("Number of lines in %s is: %d\n",file,nl+ppd) printf("Number of preprocessor directives is: %d\n",ppd) printf("Number of lines excluding preprocessor directives is: %d\n\n",nl) file = FILENAME tnl += nl tppd += ppd nl = 0 ppd = 0 } if ($0 == "") { ; } else if ($1 ~ /^\/\*/ && $NF ~ /\*\/$/) { ; } else if ($0 ~ /\/\*/ && $0 !~ /\*\//) { in_comment = 1 } else if ($0 !~ /\/\*/ && $0 ~ /\*\//) { in_comment = 0 } else if (in_comment) { ; } else if ($1 ~ /^#/) { ppd++ } else { nl++ } } END { printf("Number of lines in %s is: %d\n",file,nl+ppd) printf("Number of preprocessor directives is: %d\n",ppd) printf("Number of lines excluding preprocessor directives is: %d\n\n",nl) file = FILENAME tnl += nl tppd += ppd printf("Total number of lines is: %d\n",tnl+tppd) printf("Number of preprocessor directives is: %d\n",tppd) printf("Number of lines excluding preprocessor directives is: %d\n",tnl) } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/chmod.c0000755000076400001440000001364407055333702015544 /* ** CHMOD.C - Retrieve or change a DOS file's attributes ** ** public domain demo by Bob Stout ** ** Notes: To expand command line arguments with wildcards, ** TC/TC++/BC++ - Link in WILDARGS.OBJ. ** MSC/QC - Link in SETARGV.OBJ. ** ZTC/C++ - Link in _MAINx.OBJ, where 'x' is the memory model. ** ** Allows file list(s) using standard "@file_list_name" convention. */ #include #include #include #include #include #define LAST_CHAR(s) (s)[strlen(s)-1] #if defined(__TURBOC__) #include #define FAR far #else #include #define BOOL(x) (!(!(x))) #define FAR _far #if (defined(_MSC_VER) && (_MSC_VER >= 700)) || (defined(__SC__)) // Make FP_xxx macros lvalues as in older versions #undef FP_SEG #undef FP_OFF #define FP_SEG(fp) ((unsigned)((unsigned long)(fp) >> 16)) #define FP_OFF(fp) ((unsigned)(fp && 0xffff)) #endif int _chmod(const char *path, int func, ...) { union REGS regs; struct SREGS sregs; int atr = 0; va_list args; if (0 != (func = BOOL(func))) { va_start(args, func); atr = va_arg(args, int); } regs.x.ax = 0x4300 + func; regs.x.dx = FP_OFF((char FAR *)path); regs.x.cx = atr; segread(&sregs); sregs.ds = FP_SEG((char FAR *)path); intdosx(®s, ®s, &sregs); if (regs.x.cflag) return -1; if (func) return atr; else return regs.x.cx; } #ifndef FA_RDONLY #define FA_RDONLY _A_RDONLY #endif #ifndef FA_HIDDEN #define FA_HIDDEN _A_HIDDEN #endif #ifndef FA_SYSTEM #define FA_SYSTEM _A_SYSTEM #endif #ifndef FA_ARCH #define FA_ARCH _A_ARCH #endif #ifndef FA_LABEL #define FA_LABEL _A_VOLID #endif #ifndef FA_DIREC #define FA_DIREC _A_SUBDIR #endif #endif int attrib, /* Set up new attributes here */ atr_setmask = 0, atr_clrmask = -1, flag = 0; /* Passed as func to _chmod() */ void usage(void) /* Tell 'em they messed up */ { puts("Usage: CHMOD file [file [...file] [+switches] [-switches]"); puts("Where switches are one or more of:"); puts(" A: Archive"); puts(" R: Read only"); puts(" H: Hidden"); puts(" S: System"); puts("File lists may be specified with \"@file_list_name\""); puts("With no switches, diplays current attributes."); puts("Displayed attributes are as above plus:"); puts(" D: Subdirectory"); puts(" V: Volume label"); exit(1); } void setattr(char atr) /* Set bits in attribute */ { switch (toupper(atr)) { case 'A': atr_setmask |= FA_ARCH; break; case 'R': atr_setmask |= FA_RDONLY; break; case 'S': atr_setmask |= FA_SYSTEM; break; case 'H': atr_setmask |= FA_HIDDEN; break; default: usage(); } } void clrattr(char atr) /* Clear bits in attribute */ { switch (toupper(atr)) { case 'A': atr_clrmask &= ~FA_ARCH; break; case 'R': atr_clrmask &= ~FA_RDONLY; break; case 'S': atr_clrmask &= ~FA_SYSTEM; break; case 'H': atr_clrmask &= ~FA_HIDDEN; break; default: usage(); } } void show_atr(char *path) { char astr[7], *ptr; if (-1 == (attrib = _chmod(strupr(path), 0))) { ATR_ERR: printf("\aCHMOD: Error! (file: %s)", path); exit(-1); } attrib |= atr_setmask; attrib &= atr_clrmask; if (-1 == (attrib = _chmod(path, flag, attrib))) goto ATR_ERR; ptr = astr; *ptr++ = (char)((attrib & FA_ARCH) ? 'A' : '.'); *ptr++ = (char)((attrib & FA_RDONLY) ? 'R' : '.'); *ptr++ = (char)((attrib & FA_SYSTEM) ? 'S' : '.'); *ptr++ = (char)((attrib & FA_HIDDEN) ? 'H' : '.'); *ptr++ = (char)((attrib & FA_DIREC) ? 'D' : '.'); *ptr++ = (char)((attrib & FA_LABEL) ? 'V' : '.'); *ptr = '\0'; printf("%-15s %s\n", path, astr); } int main (int argc, char *argv[]) { int i, j; if (2 > argc) usage(); for (i = 1; i < argc; ++i) /* Build attribute masks */ { switch (*argv[i]) { case '+': for (j = 1; argv[i][j]; ++j) setattr(argv[i][j]); flag = 1; break; case '-': for (j = 1; argv[i][j]; ++j) clrattr(argv[i][j]); flag = 1; break; default: break; /* Assume it's a file name */ } } for (i = 1; i < argc; ++i) /* Scan filenames */ { if (strchr("+-", *argv[i])) continue; if ('@' == *argv[i]) { FILE *fp; char buf[256], *ptr = &argv[i][1]; if (NULL == (fp = fopen(ptr, "r"))) { printf("\aCHMOD: Error opening %s\n", ptr); return -1; } while (NULL != fgets(buf, 255, fp)) { LAST_CHAR(buf) = '\0'; /* Strip '\n' */ show_atr(buf); } fclose(fp); } else show_atr(argv[i]); } return 0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/bascnvrt.c0000755000076400001440000000206407055333645016274 /* ** BASCNVRT.C - Convert between number bases ** ** public domain demo by Bob Stout */ #include #ifdef TEST #include #endif /* ** Calling parameters: 1 - Number string to be converted ** 2 - Buffer for the converted output ** 3 - Radix (base) of the input ** 4 - Radix of the output ** ** Returns: Pointer to converted output */ char *base_convert(const char *in, char *out, int rin, int rout) { long n; char *dummy; n = strtol(in, &dummy, rin); return ltoa(n, out, rout); } #ifdef TEST int main(int argc, char *argv[]) { int rin, rout; char buf[40]; if (4 > argc) { puts("Usage: BASCNVRT "); return(-1); } rin = atoi(argv[2]); rout = atoi(argv[3]); printf("%s (base %d) = %s (base %d)\n", argv[1], rin, base_convert((const char *)argv[1], buf, rin, rout), rout); return 0; } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/trapflag.asm0000755000076400001440000000745607055334311016611 PAGE ,132 ; Install a custom Interrupt 23 (Ctrl-C exception) handler ; ; Public domain by Bob Stout ; ; Requires MASM 5.1 or later or equivalent ; ; Assemble with: MASM /Mx /z ... ; TASM /jMASM /mx /z ... % .MODEL memodel,C ;Add model support via command ;line macros, e.g. ;MASM /Dmemodel=LARGE kbstatseg equ 40h kbstatofs equ 17h ctl_on equ 0100b alt_on equ 1000b sk_c equ 2eh EOI equ 20h PIC equ 20h kb_inp equ 60h kb_outp equ 61h .CODE _oldvec09 dd ? _oldvec1b dd ? public ccrcvd ccrcvd dw 0 ; ; This is our actual ISR ; myint09: push ax ;save AX... pushf ; ...& flags in al,kb_inp ;get scan code cmp al,sk_c ;'C'? jne do_old ;no, forget it push ax ;yes, save it... push es ;...& ES reg mov ax,kbstatseg ;read keyboard status from 40:17 mov es,ax mov al,es:kbstatofs test al,ctl_on ;Ctrl pressed? pop es ;(restore AX, ES) pop ax jz do_old ;no, forget it in al,kb_outp ;yes, toggle keyboard acknowledge line mov ah,al or al,80h out kb_outp,al xchg al,ah out kb_outp,al cli mov ax,EOI ;send end-of-interrupt code out PIC,al mov ax,1 mov CS:ccrcvd,ax pop ax ;discard original flags... pop ax ; ...& AX iret ;all done do_old: popf ;restore flags... pop ax ; ...& AX jmp dword PTR CS:_oldvec09 ;call our handler ; ; To avoid keyboard confusion, trap Ctrl-Break separately ; myint1b: push ax pushf mov ax,-1 mov CS:ccrcvd,ax popf pop ax iret ; ; Call this to uninstall our ISR ; undo09 PROC USES DX DS AX mov dx, word PTR CS:_oldvec09 ;restore original keyboard vector mov ds, word PTR CS:_oldvec09+2 mov ax,2509h int 21h mov dx, word PTR CS:_oldvec1b ;restore original keyboard vector mov ds, word PTR CS:_oldvec1b+2 mov ax,251bh int 21h ret undo09 ENDP ; ; Call this to install our ISR ; ins09 PROC USES AX BX DS ES mov ax,3509h ;get old keyboard ISR vector... int 21h mov word PTR CS:_oldvec09,bx mov word PTR CS:_oldvec09+2,es ;...and save it mov ax,351bh ;get old exit vector... int 21h mov word PTR CS:_oldvec1b,bx mov word PTR CS:_oldvec1b+2,es ;...and save it push cs ;get myint09 segment in DS pop ds mov dx, OFFSET myint09 ;install myint09 in int 09h mov ax,2509h int 21h push cs ;get myint1b segment in DS pop ds mov dx, OFFSET myint1b ;install myint1b in int 1bh mov ax,251bh int 21h ret ins09 ENDP end c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mktone.c0000755000076400001440000000222207055334103015731 /* ** MKTONE.C ** ** Original Copyright 1988-1991 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is functionally identical to the ** version originally published by the author in Tech Specialist ** magazine and is hereby donated to the public domain. */ #include "uclock.h" #include "sound.h" static int usec_timeout(uclock_t start, uclock_t finish, uclock_t usecs) { if (usecs >= (finish - start)) return 0; else return 1; } void dosound(int freq) { unsigned i; outp(C8253, SETIMER); i = (unsigned)freq%256; outp(F8253, i); i = (unsigned)freq/256; outp(F8253, i); } void mktone(int freq, int update, unsigned delay) { uclock_t start; if (0 == freq) { soundoff(); return; } dosound(freq); if (update != UPDATE) soundon(); if (delay == 0) return; start = usec_clock(); while (!usec_timeout(start, usec_clock(), 1000L * (long)delay)) ; if (update == TOGGLE) soundoff(); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/jgrep.c0000755000076400001440000001113107055334031015542 /* ** JGREP.C - A utility to search files for text. ** ** public domain by Jerry Coffin ** ** Link with wildargs.obj (Borland), setargv.obj (Microsoft), _mainX.obj ** (Symantech/Zortech), or wildargX.obj (Watcom) which allows you to pass ** wildcards on the command line. */ #include #include #include #include #include #define LINELEN 1024 #define BUFSIZE 32767 #if defined(_QC) || defined(_MSC_VER) void _cdecl _setenvp(void) {} void _cdecl _nullcheck(void) {} #endif enum { FALSE, TRUE }; typedef unsigned char uchar; static size_t table[UCHAR_MAX+1]; static size_t len; static char *string=NULL; void init_find(char *new_string) { size_t i; if (NULL != string) free(string); string = strdup(new_string); len = strlen(string); for (i=0;i<=UCHAR_MAX;i++) table[i]=len; for (i=0;i0) pos+=shift; if (0==shift) { if (!memcmp(string,here=string2+pos-len+1,len)) return(here); else pos++; } } return NULL; } char *find_no_case(char *string2) { size_t limit = strlen(string2); size_t shift; size_t pos=len-1; char *here; while (pos < limit) { while( pos < limit && (shift=table[(uchar)toupper(string2[pos])])>0) { pos+=shift; } if (0==shift) { if (!memicmp(string,here=string2+pos-len+1,len)) return(here); else pos++; } } return NULL; } char *( *find) (char *)=find_case; int _cdecl main(int argc, char **argv) { int k, first; unsigned line; int line_numbers=FALSE, reverse=FALSE, print_file_name=FALSE; int no_case = TRUE; char line_buffer[LINELEN],*string,c; FILE *infile=NULL; static char buffer[BUFSIZE]; while ((c=argv[1][0])=='/' || c=='-') { switch(tolower(argv[1][1])) { case 'c': case 'y': no_case=FALSE; break; case 'f': print_file_name=TRUE; case 'n': line_numbers=TRUE; break; case 'v': reverse = TRUE; break; default: fprintf(stderr,"unknown switch -%c",argv[1][1]); } argv++; argc--; } if (argc < 3) { fprintf(stderr ,"\nsyntax: find [-c|y][-n][-v][-f] " "string filename ..." "\n\t-c | -y : make case significant ('c' != 'C')" "\n\t-n : number lines" "\n\t-f : place file name before lines ( forces -n)" "\n\t-v : print lines that don't match" "\n - by itself to read from standard input"); return(1); } string=argv[1]; if (no_case) { strupr(string); find=find_no_case; } init_find(string); for (k=2;k #include #define NUL '\0' void psplit(char *path, char *drv, char *dir, char *fname, char *ext) { char ch, *ptr, *p; /* convert slashes to backslashes for searching */ for (ptr = path; *ptr; ++ptr) { if ('/' == *ptr) *ptr = '\\'; } /* look for drive spec */ if (NULL != (ptr = strchr(path, ':'))) { ++ptr; if (drv) { strncpy(drv, path, ptr - path); drv[ptr - path] = NUL; } path = ptr; } else if (drv) *drv = NUL; /* find rightmost backslash or leftmost colon */ if (NULL == (ptr = strrchr(path, '\\'))) ptr = (strchr(path, ':')); if (!ptr) { ptr = path; /* obviously, no path */ if (dir) *dir = NUL; } else { ++ptr; /* skip the delimiter */ if (dir) { ch = *ptr; *ptr = NUL; strcpy(dir, path); *ptr = ch; } } if (NULL == (p = strrchr(ptr, '.'))) { if (fname) strcpy(fname, ptr); if (ext) *ext = NUL; } else { *p = NUL; if (fname) strcpy(fname, ptr); *p = '.'; if (ext) strcpy(ext, p); } } #ifdef TEST #include int main(int argc, char *argv[]) { char drive[10], pathname[FILENAME_MAX], fname[9], ext[5]; while (--argc) { psplit(*++argv, drive, pathname, fname, ext); printf("psplit(%s) returns:\n drive = %s\n path = %s\n" " name = %s\n ext = %s\n", *argv, drive, pathname, fname, ext); } return EXIT_SUCCESS; } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/pluraltx.c0000755000076400001440000000062407055334140016314 /* ** PLURALTX.C - How to print proper plurals ** ** public domain - original algorithm by Bob Stout */ #include #define plural_text(n) &"s"[(1 == (n))] #define plural_text2(n) &"es"[(1 == (n)) << 1] void main(void) { int i; for (i = 0; i < 10; ++i) printf("%d thing%s in %d box%s\n", i, plural_text(i), i, plural_text2(i)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/hugeread.c0000755000076400001440000001335607055334013016232 /* ** HUGEREAD.C - "Universal" PC read and write functions using huge data ** and far pointers. ** ** NOTES: ** ** 1. If these functions are called with a prototype in scope, passed ** parameters will be coerced to the proper data types. ** ** 2. Since these call read() and write(), all normal mode flags which ** are supported by individual compilers will be honored. ** ** 3. In small data memory models (S, T, and M), an intermediate buffer ** is allocated and used. In large data models (L and C), the data ** are read/written directly from/to target memory. ** ** 4. Like many mixed-model functions, this may generate lots of warnings ** with many compilers. Despite this, it really does generate correct ** code for all major PC compilers. ** ** Original Copyright 1992 by Bob Stout as part of ** the MicroFirm Function Library (MFL) ** ** This subset version is hereby donated to the public domain. */ #include #include #include #include #include #ifdef __TURBOC__ #define FAR far #else #define FAR _far #endif #ifndef min #define min(x,y) (((x) <= (y)) ? (x) : (y)) #endif #ifndef MK_FP #define MK_FP(seg,offset) \ ((void FAR *)(((unsigned long)(seg)<<16) | (unsigned)(offset))) #endif /* ** Get the largest buffer possible. */ static size_t gettmp(char **buf) { size_t bufsiz; for (bufsiz = 0x4000; bufsiz >= 128; bufsiz >>= 1) { if (NULL != (*buf = (char *) malloc(bufsiz))) return bufsiz; } return 0; } /* ** Normalize a far pointer */ void FAR *farnormal(void FAR *ptr) { unsigned long base, para; base = (unsigned long)(ptr & 0xffff000fL); para = (unsigned long)(ptr & 0x0000fff0L); para <<= 12; return (void FAR *)(base + para); } /* ** Read any size block to anywhere in memory */ long hugeread(int fh, char FAR *buf, long size) { long count; size_t bufsiz; char *tmp; long ercode = size; if (4 > sizeof(void *)) { if (0 == (bufsiz = gettmp(&tmp))) return -1L; } else { tmp = (char *)buf; bufsiz = 0x4000; } while (0 < (count = min(size, (long)bufsiz))) { int i, numread = read(fh, tmp, (size_t)count); if (1 > numread || numread != (int)count) return -1L; if (4 > sizeof(void *)) { for (i = 0; i < count; ++i) buf[i] = tmp[i]; } buf = farnormal(buf + count); size -= count; if (2 < sizeof(void *)) tmp = (char *)buf; } return ercode; } /* ** Write any size block from anywhere in memory */ long hugewrite(int fh, char FAR *buf, long size) { long count; size_t bufsiz; char *tmp; long ercode = size; if (4 > sizeof(void *)) { if (0 == (bufsiz = gettmp(&tmp))) return -1L; } else { tmp = (char *)buf; bufsiz = 0x4000; } while (0 < (count = min(size, (long)bufsiz))) { int i, numwrite; if (4 > sizeof(void *)) { for (i = 0; i < count; ++i) tmp[i] = buf[i]; } numwrite = write(fh, tmp, (size_t)count); if (1 > numwrite || numwrite != (int)count) return -1L; buf = farnormal(buf + count); size -= count; if (2 < sizeof(void *)) tmp = (char *)buf; } return ercode; } /* ** Read any size block to anywhere in memory */ long hugefread(FILE *fp, char FAR *buf, long size) { long count; size_t bufsiz; char *tmp; long ercode = size; if (4 > sizeof(void *)) { if (0 == (bufsiz = gettmp(&tmp))) return -1L; } else { tmp = (char *)buf; bufsiz = 0x4000; } while (0 < (count = min(size, (long)bufsiz))) { int i, numread = fread(tmp, 1, (size_t)count, fp); if (1 > numread || numread != (int)count) return -1L; if (4 > sizeof(void *)) { for (i = 0; i < count; ++i) buf[i] = tmp[i]; } buf = farnormal(buf + count); size -= count; if (2 < sizeof(void *)) tmp = (char *)buf; } return ercode; } /* ** Write any size block from anywhere in memory */ long hugefwrite(FILE *fp, char FAR *buf, long size) { long count; size_t bufsiz; char *tmp; long ercode = size; if (4 > sizeof(void *)) { if (0 == (bufsiz = gettmp(&tmp))) return -1L; } else { tmp = (char *)buf; bufsiz = 0x4000; } while (0 < (count = min(size, (long)bufsiz))) { int i, numwrite; if (4 > sizeof(void *)) { for (i = 0; i < count; ++i) tmp[i] = buf[i]; } numwrite = fwrite(tmp, 1, (size_t)count, fp); if (1 > numwrite || numwrite != (int)count) return -1L; buf = farnormal(buf + count); size -= count; if (2 < sizeof(void *)) tmp = (char *)buf; } return ercode; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/c_port.txt0000755000076400001440000003052607055333665016343 =====[ Ed Hopper's BBS #1 ]=====[ 8-04-91 ]=====[ 9:55.22 ]===== Date: 08-02-91 (09:40) C-Lang Number: 26406 (Echo) To: ALL From: JOSEPH CARNAGE Read: 08-03-91 (10:56) City: DUNEDIN FL Last On: 02-28-91 (22:53) Subj: Portable, clean code #1 How to write portable clean source code --------------------------------------- A common concern with programmers new to Axiom is writing portable code. There a number of tricks and guide lines which may help with this. In no particular order: -- Use full ANSI prototypes with all arguments declared. For function pointers, declare their expected arguments. For prototypes for functions which accept function pointers, do not declare the expected arguments for the function pointer argument. It is good practice to put dummy variable names in prototypes as this adds readability. -- Explicitly type all variables and functions. Never rely on them defaulting to int. -- Pay a little care to the ternary operator ? :, and parenthesize heavily. A very few compilers have problems with the default order of evaluation for the ternary operator. -- Never ever name a variable identically to a function. This is most especially true of statics or globals. This sort of error can cause weird hidden linker problems which cause bizarre results at runtime and are difficult to trace. -- Never ever name a screen, form, data field etc identically to a variable or function as this can cause weird and non-reported linker errors in the final executable which can be very difficult to locate. -- Do not nest comments. If you want to block off a section of code temporarily, use #ifdef/#endif. eg. ...code... #ifdef JUNK /* Unwanted code */ ...more code... #endif /* JUNK */ ...yet more code... -- Run PC-Lint on all code, and handle ALL errors and warnings. -- Read the "Frequently Asked Questions" document and understand fully. -- Read K&R thoroughly and everywhere it mentions "implementation dependant", or "new" features not "supported by all compilers", avoid those areas. Examples are bit fields, passing structures to functions, returning structures from functions, and the volatile type. These are not supported by all compilers. -- In areas where the ANSI standard advances on the old K&R, but still allows the K&R form, follow K&R. An example is using function pointers. If you are unsure what areas this covers, don't worry, just stick with K&R. eg. Given: int (*prj_afunc) (); /* Pointer to function which returns int */ ANSI allows the pointed to function be called as so: prj_afunc (xxx, yyy); K&R specifies that it should be called: *prj-afunc (xxx, yyy); Use the K&R form, which ANSI still allows, and all compilers support. -- Do not use the new // comments. Stay with the /* comment */ form. -- Do not indent #ifdefs, #defines, #pragmas, or other preprocessor directives. Some compilers allow code as such: #ifdef DEBUG #define TEST 1 #endif or #ifdef FINAL # ifdef DEBUG # define TEST 1 # endif #endif But by no means all. Use white space if needed to delineate #ifdef/endif blocks and comment liberally: #ifdef FINAL #ifdef DEBUG #define TEST 1 #endif /* DEBUG*/ #endif /* FINAL */ -- Do not use the ANSI string literal concatenation features. eg. printf ("This is ANSI but" "unportable code.\n"); for long string literals. Under ANSI the the compiler should concatenate the two string literals into one, but not all ANSI compilers support this feature yet. If you need a very long string literal use a form as so: printf ("%s%s", "this is", "portable code.\n"); or just use a very long string literal. -- Stay away from ints except for trash and temp values. Ints vary in size depending upon the memory model under DOS, and legally may be any size between shorts and longs inclusive. Try to use shorts or longs if possible, as these are of fairly constant size on most platforms. On most platforms, but by no means all, shorts are usually words and longs word pairs. -- Beware of assigning a pointer of one type to a pointer of a higher type. Most platforms seem to insist that the addresses stored in pointers are alligned per the pointer's base type. What this means is that the value stored in a pointer to a long, in itself will be alligned as a long is. If longs are alligned on even word boundaries, then so will the value of long pointer. This can result in memory allignment errors which can be extremely difficult to track down. Casting will not help. DOS has few memory allignment requirements, but for Unix and VMS you can expect types to be alligned to their sizes (see the compiler manuals for specifics). What this means to pointers is that with code such as: short *pj2_value; /* Assume that shorts are alligned to words */ long *pj4_number; /* and longs to even word boundaries */ pj4_number = pj2_value; that the value assigned to pj4_number may be as far as two bytes different from that in pj2_value. ie Let's say that the address stored is pj2_value is: *pj2_value == 0000:0006 /* Alligned to word */ and you make the assignment: pj4_number = pj2_value; After this, the value of pj4_number will be either 0000:0004, or 0000:0008 to shift it to even word allignment. The direction of the shift seems to be compiler/implementation dependant. This bug is often erratic at runtime depending upon the allignment of automatics. This sort of bug is especically difficult to track when coming up from a void pointer. -- Be wary of relying on memory allignment in structures and unions. Different compiler implmentations allign differently, and #pragmas or command line arguments to the compiler can change allignment at compile time. See the compiler manuals for specific details. This will usually require you to either read in each member individually, or to perform explicit padding when reading structure data from disk. eg. lic1.c & v_lic_pad() in the Axiom library. -- Where possible use sizeof(identifier) rather than sizeof(type) or a #defined constant. This can help in tracing down bugs and makes for greater readability. eg. #define M_DATA 100 short aj2_numbers[M_DATA]; /* This example requires the reader to remember that aj2_numbers has M_DATA elements, is overly complex, and presumes that aj2_numbers will always be shorts. This code will likely break if anything is later changed. */ memcpy (aj2_numbers, pj2_input, M_DATA * sizeof (short)); /* This is ideal -- sizeof(aj2_numbers) will return the total space allocated to the array, no matter what the type may be, or what is changed later. It makes no assumptions of the reader. */ memcpy (aj2_numbers, pj2_input, sizeof (aj2_numbers)); -- Beware of comparing structures or unions with functions such as memcmp() as the padding/allignment spaces will have random and likely different values. If you need to compare structures you'll have to do it member by member. -- Never assign structures to each other directly. Some compilers allow structure assignments, some don't. struct t_data s_struc1; struct t_data s_struc2; s_struc2 = s_struc1; /* Unportable code */ Note however that you can copy structures via pointers as need be: struct t_data *ps_struc1; struct t_data *ps_struc2; ps_struc1 = xxx; ps_struc2 = yyy; *ps_struc2 = *ps_struc1; /* Copy structure 1 to 2 */ Rather than assigning each member over individually. The functions memcpy() and memmove() are other portable ways. -- Beware of passing chars or shorts to functions. These get promoted to ints, and with some compilers problems from there on out abound horrendously. This is especially true of chars where some compilers occassionally extract the wrong byte from the promoted int in the recieving function. -- Be careful passing floats to functions as some compilers promote floats to doubles when passing them as an argument. This can cause spurious warnings and and strange side effects. -- Explicitly cast assignments and expressions as needed, and carefully watch that you really don't need to make those identifiers of that type originally. While the promotion order is constant across implementations, the size of the types aren't. This can cause difficult side effects. If your code needs a lot of casts to get past Lint, then you probably need to rethink some of your approaches. -- Take care to cast all #defined constants if in doubt. For large values (longs), always cast as longs, or place an 'L' at the end of the constant. Some compilers handle this area erraticly if left up to them. -- Never ever rely on order of evaluation of function parameters. This can occur when listing a funtion call as a parameter to another funtion, or as an unintentional side effect from passing assignments or function calls as parameters. char *pc_modify (char *); printf ("This string [%s] becomes [%s]\n", pc_string, pc_modify (pc_string)); /* Bad code */ -- Do not use NULL for anything but pointers. Do not use NULL for string terminations: use the ASCII constant NUL, '\0', or a #defined type which equates to that. -- Never EVER pass a #defined macro an incremented or decremented value (++,or --) or an assignment as a parameter. This is because many #defined macros may reference their arguments multiple times. This is especially true of the macros #defined in ctype.h. eg. #define iscsymf(c) (isalpha(c) || ((c) == '_')) If called as so: iscsym(var++); it will be expanded by the preprocessor to: (isalpha(var++) || ((var++) == '_')) with var being incremented twice. -- Avoid passing any functions incremented or decremented values ("++" or "--"), or assignments. Some standard and commercial library calls are actually #defined macros. This type of "error" can lead to order of evaluation problems as different compilers process function arguments in different orders. -- Explicitly initialise pointers. Do not rely on calloc(), memset() or other such functions to initialise pointers. Initialise them explicitly. "K&R" as mentioned above refers to "The C Programming Language" written by Brian W Kernighan & Dennis M Ritchie. "PC-Lint" is a commercial version of Lint for the PC, as sold by Gimpel Software. PC-Lint is generally acknowledged as the tightest and most discerning Lint on any platform. There are several books which cover the areas of portable code which may also help: "C Programming Guidelines" by Thomas Plum pub. by Plum Hall ISBN 0-911537-03-1 "Portability and the C Language" by Rex Jaeschke pub. by Hayden Books ISBN 0-672-48428-5 "Portable C Software" by Mark R. Horton pub. by Prentice Hall ISBN 0-13-868050-7 "Portable C" by Henry Rabinowitz & Chaim Schaap pub. by Prentice Hall ISBN 0-13-685967-4 "Portable C and Unix System Programming" by J.E. Lapin pub. Prentice-Hall ISBN 0-13-686494-5 [END] c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/mystream.cpp0000755000076400001440000000732007055334122016642 // Mystream.cpp // Implementation of ios interface classes for Myio // // Written by David L. Nugent // # include # include "Mystream.h" # if defined(_MSC_VER) # include # else # include # endif // Mystreambuf constructor // This simply initialises the base class streambuf // (it is initially empty with no buffer allocated) // and register the Myio object // Note: we _could_ set the stream unbuffered here, // which is useful for stdio handles, so that the // streambuf functions overflow() and underflow() // get called on every character rather than when // the streambuf buffer is full Mystreambuf::Mystreambuf (Myio * mPtr) : streambuf (), mptr(mPtr) { // unbuffered(1); // Uncomment to make unbuffered } // Mystreambuf() // Called when streambuf owned buffer is full // or when stream is flushed // Our job here is to empty the streambuf // write buffer and reset the 'put' pointers. int Mystreambuf::overflow (int c) { int written; // Handle unbuffered stream if (unbuffered()) // Handle the simple case first { if (c == EOF) // Special case, this only flushes return 0; char ch = char(c); // Write the byte directly written = mptr->write (&ch, 1); return (written) ? c : EOF; } // Handle buffered stream if (!base()) // Need to allocate a buffer allocate(); if (base()) // Test for memory allocation error { char * ep = base() + (blen() / 2); if (!pbase()) // Set put pointers if not set up setp (base(), ep); int bytes = pptr() - pbase(); // Bytes to write if (bytes) { written = mptr->write (pbase(), bytes); if (!written) return EOF; bytes += written; if (bytes) // Some is still waiting to be written memcpy (base(), base() + written, bytes); } setp (base() + bytes, ep); // Reset 'put' pointers return (c == EOF) ? 0 : sputc (c); // Put pending chr in buf } return EOF; } // // underflow() indicates that the input queue // is empty and needs more data // int Mystreambuf::underflow (void) { int bytes; // Handle an unbuffered stream if (unbuffered()) { bytes = mptr->read (&_back[1], 1); if (!bytes) { setg (0, 0, 0); return EOF; } setg (_back, _back + 1, _back + 2); return (unsigned char)_back[1]; } // Handle a buffered stream if (!base()) // Need to allocate a buffer allocate(); if (base()) { char * gp = base() + blen() / 2; if (gptr() >= egptr()) { // Read into the buffer from stream overflow (); // Flush output in case we need it bytes = mptr->read (gp + 1, blen() / 2 - 1); setg (gp, gp + 1, gp + bytes + 1); } if (gptr() < egptr()) // Get from buffer return (unsigned char) *gptr(); } return EOF; } // // sync() needs to empty both put and get // buffered. It will do this by calling // overflow and simply resetting the get // pointers to their default location. // int Mystreambuf::sync (void) { if (!unbuffered()) { overflow (); // Force output char * gp = base(); setp (gp, gp + blen() / 2); gp = base() + blen() / 2; setg (0, 0, 0); } return 0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/drivsrch.c0000755000076400001440000000442207055333733016274 /* ** DRIVSRCH.C - public domain by Marty Connelly, Victoria, BC 1992 ** ** Modified by Bob Stout ** ** Routine checks how many valid disk drives are available on machine, ** both physical and logical drives */ /* ** Includes drive letters assigned with DOS SUBST command ** ** Networked drives are left as an exercise as I don't have access ** to them to check. ** ** The routine uses undocumented DOS interrupt 32H. ** ** Compatible with MSC 5 and 6, ZTC++, BC++, other DOS compilers ** ** DS:BX contains the address of the Disk Parameter Block (DPB) for a ** requested drive. If the drive letter at offset 0 of the DPB doesn't ** match the requested drive, then the drive has been SUBST'ed. */ #include #include #if !defined(MK_FP) #define MK_FP(seg,off) ((void far *)(((long)(seg) << 16)|(unsigned)(off))) #endif #ifdef __TURBOC__ #define _far far #endif void main(void) { int i; int unsigned result; int drivestatus[26]; unsigned char _far *DPB; union REGS regs; struct SREGS sregs; /* routine checks for all valid drive possibilities from A to Z */ /* ** if removeable media drive ie. floppy drive A: has a latch door ** open you will get "Abort Retry" panic message */ for (i = 0; i < 26; i++) { /* drive number (0=default, 1=A, 2=B,etc.)*/ regs.h.dl = (unsigned char)(i + 1); segread(&sregs); regs.h.ah=0x32; /* DOS interrupt 32H */ /* was undocumented for DOS release 3.2 */ intdosx(®s,®s, &sregs); result=regs.h.al; DPB = MK_FP(sregs.ds, regs.x.bx); /* ** result =0 then valid drive ** =255 or ff hex then invalid or non-existent drive */ if (0 == result && *DPB != (unsigned char)i) drivestatus[i] = 1; else drivestatus[i]=result; } for (i = 0; i < 26; i = i + 2) { printf("drive %c: status code =%3d drive %c: status code =%3d\n", 'A' + i,drivestatus[i],'B' + i,drivestatus[i+1]); } return; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/wb_fcopy.c0000755000076400001440000000504407055334332016255 /* ** by: Walter Bright via Usenet C newsgroup ** ** modified by: Bob Stout based on a recommendation by Ray Gardner ** ** modified by: David Gersic to deal with binary files ** ** There is no point in going to asm to get high speed file copies. Since it ** is inherently disk-bound, there is no sense (unless tiny code size is ** the goal). Here's a C version that you'll find is as fast as any asm code ** for files larger than a few bytes (the trick is to use large disk buffers): ** ** To compile file_copy(), define Afilecopy=1 on the command line ** To compile file_append(), define Afileappe=1 on the command line */ #include #include #include #if !defined(__ZTC__) && !defined(__TURBOC__) #include #endif #include #if Afilecopy int file_copy(char *from, char *to) #else int file_append(char *from, char *to) #endif { int fdfrom,fdto; int bufsiz; fdfrom = open(from,O_RDONLY|O_BINARY,0); if (fdfrom < 0) return 1; #if Afileappe /* Open R/W by owner, R by everyone else */ fdto=open(to,O_BINARY|O_CREAT|O_APPEND|O_RDWR,S_IREAD|S_IWRITE); if (fdto < 0) goto err; #else fdto=open(to,O_BINARY|O_CREAT|O_TRUNC|O_RDWR,S_IREAD|S_IWRITE); if (fdto < 0) goto err; #endif /* Use the largest buffer we can get */ for (bufsiz = 0x4000; bufsiz >= 128; bufsiz >>= 1) { register char *buffer; buffer = (char *) malloc(bufsiz); if (buffer) { while (1) { register int n; n = read(fdfrom,buffer,bufsiz); if (n == -1) /* if error */ break; if (n == 0) /* if end of file */ { free(buffer); close(fdto); close(fdfrom); return 0; /* success */ } if (n != write(fdto,buffer,(unsigned) n)) break; } free(buffer); break; } } err2: close(fdto); remove(to); /* delete any partial file */ err: close(fdfrom); return 1; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/playdemo.c0000755000076400001440000000142007055334137016254 /* ** PLAYDEMO.C - demo of background music functions ** ** public domain by Bob Stout */ #include #include "uclock.h" #include "sound.h" main() { int i; if (!playb_open(1024)) { puts("\aError opening play buffer"); return -1; } playb_note(C3, 8); playb_note(REST, 2); playb_note(C3, 8); playb_note(REST, 2); playb_note(E3, 8); playb_note(REST, 2); playb_note(E3, 8); playb_note(REST, 2); playb_note(G3, 8); playb_note(REST, 2); playb_note(G3, 8); playb_note(REST, 2); playb_note(E3, 18); playb_note(REST, 2); for (i = 0; i < 500; ++i) printf("i = %d\n", i); playb_close(); } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/srchfile.c0000755000076400001440000001360107055334250016241 /* ** SRCHFILE.C - Functions for searching files ** ** public domain by Bob Stout ** ** Note: Although this snippet demonstrates some useful techniques, even ** the fast text searching algorithm used can't provide particularly ** good performance. Left as an exercise for the user is to perform ** explicit buffering using fread() rather than fgets() as is used ** here. See CHBYTES.C in SNIPPETS for how to perform searches in ** user-managed buffers. */ #include #include #include #define SUCCESS 0 /* ** Allocate a big buffer, use it to buffer a specified stream */ static size_t fsetup(FILE *fp, size_t minbuf) { register size_t bufsize; register char *buffer; /* Allocate the largest buffer we can */ for (bufsize = 0x4000; bufsize >= minbuf; bufsize >>= 1) { if (NULL != (buffer = (char *) malloc(bufsize))) break; } if (NULL == buffer) return 0; /* Use the buffer to buffer the file */ if (SUCCESS == setvbuf(fp, buffer, _IOFBF, bufsize)) return bufsize; else return 0; } /* ** Search a file for a pattern match (forward) ** ** Arguments: FILE pointer ** pattern to search for ** size of pattern ** find Nth occurance ** ** Returns: -1L if pattern not found ** -2L in case of error */ long ffsearch(FILE *fp, const char *pattern, const size_t size, int N) { long pos = -2L, tempos = 0L; char *sbuf, *p; size_t i, skip; int ch = 0; /* Allocate a search buffer */ if (NULL == (sbuf = (char *)malloc(size - 1))) goto FDONE; /* Buffer the file and position us within it */ if (0 == fsetup(fp, size)) goto FDONE; pos = -1L; fseek(fp, 0L, SEEK_SET); /* Set up for smart searching */ if (1 < strlen(pattern) && NULL != (p = strchr(pattern + 1, *pattern))) skip = p - (char *)pattern; else skip = strlen(pattern); /* Look for the pattern */ while (EOF != ch) { if (EOF == (ch = fgetc(fp))) break; if ((int)*pattern == ch) { tempos = ftell(fp); if (size - 1 > fread(sbuf, sizeof(char), size - 1, fp)) goto FDONE; if (SUCCESS == memcmp(sbuf, &pattern[1], size - 1)) { if (0 == --N) { pos = tempos - 1L; goto FDONE; } } fseek(fp, tempos + skip, SEEK_SET); } } /* Clean up and leave */ FDONE: free(sbuf); return pos; } /* ** Search a file for a pattern match (backwards) ** ** Arguments: FILE pointer ** pattern to search for ** size of pattern ** find Nth occurance ** ** Returns: -1L if pattern not found ** -2L in case of error */ long rfsearch(FILE *fp, const char *pattern, const size_t size, int N) { long pos = -2L, tempos; char *sbuf, *p; size_t i, skip; int ch = 0; /* Allocate a search buffer */ if (NULL == (sbuf = (char *)malloc(size - 1))) goto RDONE; /* Buffer the file and position us within it */ if (0 == fsetup(fp, size)) goto RDONE; pos = -1L; fseek(fp, -1L, SEEK_END); tempos = ftell(fp) - strlen(pattern); /* Set up for smart searching */ if (1 < strlen(pattern) && NULL != (p = strrchr(pattern + 1, *pattern))) skip = strlen(pattern) - (p - (char *)pattern); else skip = strlen(pattern); /* Look for the pattern */ while (0L <= tempos) { fseek(fp, tempos, SEEK_SET); if (EOF == (ch = fgetc(fp))) break; if ((int)*pattern == ch) { if (size - 1 <= fread(sbuf, sizeof(char), size - 1, fp)) { if (SUCCESS == memcmp(sbuf, &pattern[1], size - 1)) { if (0 == --N) { pos = tempos; goto RDONE; } } } tempos -= skip; } else --tempos; } /* Clean up and leave */ RDONE: free(sbuf); return pos; } #ifdef TEST int main(int argc, char *argv[]) { long pos; int N = 1; size_t size = strlen(argv[1]); char buf[256], *fname = "SRCHFILE.C"; FILE *fp; if (2 > argc) { puts("Usage: SRCHFILE string [N] [file]"); puts("where: N = find Nth occurance"); puts(" If file is specified, N must be given"); return EXIT_FAILURE; } if (2 < argc) N = atoi(argv[2]); if (3 < argc) fname = strupr(argv[3]); fp = fopen(fname, "r"); printf("ffsearch(%s, %s) returned %ld\n", fname, argv[1], pos = ffsearch(fp, argv[1], size, N)); fseek(fp, pos, SEEK_SET); fgets(buf, 256, fp); printf("...which contains \"%s\"\n\n", buf); fclose(fp); fp = fopen(fname, "rb"); printf("rfsearch(%s, %s) returned %ld\n", fname, argv[1], pos = rfsearch(fp, argv[1], size, N)); fseek(fp, pos, SEEK_SET); fgets(buf, 256, fp); printf("...which contains \"%s\"\n\n", buf); fclose(fp); return EXIT_SUCCESS; } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/setimeto.c0000755000076400001440000000252707055334221016276 /* ** SETIMETO.C - Set the timestamp of one file to match another. ** ** public domain demo by Bob Stout */ #include #include #include #include #include #ifdef __ZTC__ #define GETFTIME dos_getftime #define SETFTIME dos_setftime #else #define GETFTIME _dos_getftime #define SETFTIME _dos_setftime #endif int main(int argc, char *argv[]) { int fd0, fd1; #ifdef __TURBOC__ struct ftime Ftime; #else unsigned date, time; #endif if (3 > argc) { puts("Usage: SETIMETO old_filename new_filename"); return EXIT_FAILURE; } if (-1 == (fd0 = open(argv[1], O_RDONLY))) { printf("Unable to open %s\n", argv[1]); return EXIT_FAILURE; } #ifdef __TURBOC__ /* Save the time/date */ getftime(fd0, &Ftime); #else GETFTIME(fd0, &date, &time); #endif if (-1 == (fd1 = open(argv[2], O_WRONLY))) { printf("Unable to open %s\n", argv[2]); return EXIT_FAILURE; } #ifdef __TURBOC__ /* Set the time/date */ setftime(fd1, &Ftime); #else SETFTIME(fd1, date, time); #endif close(fd0); close(fd1); return EXIT_SUCCESS; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/isqrt.c0000755000076400001440000000466107055334024015611 #include #define BITSPERLONG 32 #define TOP2BITS(x) ((x & (3 << (BITSPERLONG-2))) >> (BITSPERLONG-2)) /* usqrt: ENTRY x: unsigned long EXIT returns floor(sqrt(x) * pow(2, BITSPERLONG/2)) Since the square root never uses more than half the bits of the input, we use the other half of the bits to contain extra bits of precision after the binary point. EXAMPLE suppose BITSPERLONG = 32 then usqrt(144) = 786432 = 12 * 65536 usqrt(32) = 370727 = 5.66 * 65536 NOTES (1) change BITSPERLONG to BITSPERLONG/2 if you do not want the answer scaled. Indeed, if you want n bits of precision after the binary point, use BITSPERLONG/2+n. The code assumes that BITSPERLONG is even. (2) This is really better off being written in assembly. The line marked below is really a "arithmetic shift left" on the double-long value with r in the upper half and x in the lower half. This operation is typically expressible in only one or two assembly instructions. (3) Unrolling this loop is probably not a bad idea. ALGORITHM The calculations are the base-two analogue of the square root algorithm we all learned in grammar school. Since we're in base 2, there is only one nontrivial trial multiplier. Notice that absolutely no multiplications or divisions are performed. This means it'll be fast on a wide range of processors. */ struct int_sqrt { unsigned sqrt, frac; }; void usqrt(unsigned long x, struct int_sqrt *q) { unsigned long a = 0L; /* accumulator */ unsigned long r = 0L; /* remainder */ unsigned long e = 0L; /* trial product */ int i; for (i = 0; i < BITSPERLONG; i++) /* NOTE 1 */ { r = (r << 2) + TOP2BITS(x); x <<= 2; /* NOTE 2 */ a <<= 1; e = (a << 1) + 1; if (r >= e) { r -= e; a++; } } memcpy(q, &a, sizeof(long)); } #ifdef TEST #include #include main(void) { int i; unsigned long l = 0x3fed0169; struct int_sqrt q; for (i = 0; i < 101; ++i) { usqrt(i, &q); printf("sqrt(%3d) = %2d, remainder = %2d\n", i, q.sqrt, q. frac); } usqrt(l, &q); printf("\nsqrt(%lX) = %X, remainder = %X\n", l, q.sqrt, q.frac); return 0; } #endif /* TEST */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/xfile.c0000755000076400001440000001214307055334352015554 /* xfile.c -- implementation for fast line buffered files ** ** Currently (Sat 06-15-1991) XFILEs are for reading CR-LF terminated lines ** from MS-DOS text files. Period. It's not that the method can't be used ** as well for output buffering, or (in some form) for binary files, it's ** that such are handled fast enough to suit me already, whereas text mode ** input performance leaves me wishing for more speed. This attempts to ** solve that problem. ** ** Sun 06-16-1991 -- CR-LF accepted, but so is bare LF now; the extracted ** line does NOT have a NEWLINE at the end anymore (which will likely be ** a mixed blessing...) ** ** The code should be fairly portable: if/when I get around to polishing it ** (and that won't be until I've used it some and am sure it's stable) I'll ** be aiming for near-ANSI portability; for now I'm not pushing so very hard ** for that. ** ** The semantics are a bit odd: the lines are returned in a buffer that the ** XFILE owns, and may be altered by a call to xgetline or xclose. For ** applications that resent this, XFILEs probably aren't a big win anyway, ** but there might be some cases where using XFILE and copying (some) lines ** is still a good idea. The performance with long lines is good: it can ** handle lines the size of the buffer, though it may truncate up to one ** QUANTUM less one bytes "early": this depends on the location of the start ** of the line in the buffer when we begin scanning. In practice, XBUFSIZE ** is probably larger than you'd set for a line buffer size anyway... ** ** INTERNALS: ** ** Reading the first buffer's worth at open time makes the EOF case easier to ** detect. ** ** TO DO: ** ** clean up xgetline! */ #include #include #include "xfile.h" #if !defined(__ZTC__) && !defined(__TURBOC__) static int DOS_OPEN(const char *name, int mode, ...) { int hdl; if (0 == _dos_open(name, mode, &hdl)) return hdl; else return -1; } static int READ(int fd, void *buf, size_t len) { unsigned count; if (0 == _dos_read(fd, buf, len, &count)) return count; else return -1; } #endif #ifndef XBUFN /* set default # of quanta in buffer, allow -D */ #define XBUFN 8 #endif #define QUANTUM 512 #define XBUFSIZE (XBUFN * QUANTUM) /* xopen -- allocate and open an XFILE ** ** NB: currently I'm designing these for READ-ONLY TEXT FILES only: the xopen ** interface may have to be changed... ** ** returns pointer to XFILE of opened file or null pointer on error ** ** ? should it leave a better error description somewhere ? */ XFILE *xopen(char const *name) { XFILE *f = malloc(sizeof(XFILE) + XBUFSIZE + 1); int n; if (f == 0) goto error0; f->buf = (char *)f + sizeof(XFILE); if ((f->fd = DOS_OPEN(name, O_RDONLY)) < 0) goto error1; if ((n = READ(f->fd, f->buf, XBUFSIZE)) < 0) goto error2; f->buf[n] = 0; f->nextChar = f->buf; return f; error2: CLOSE(f->fd); error1: free(f); error0: return 0; } /* ** xclose -- close and deallocate an XFILE */ void xclose(XFILE *f) { CLOSE(f->fd); free(f); } /* ** xgetline -- get the next text line into memory ** ** returns a pointer to the line (a NUL-terminated string) or a null pointer */ char *xgetline(XFILE *f) { char *s = f->nextChar, *p; int n; for (p = s; *p != 0; ++p) { if (*p == '\n') { if (s < p && p[-1] == '\r') p[-1] = 0; else *p = 0; f->nextChar = p + 1; return s; } } /* ** end of line not found in buffer -- p points to the sentinel NUL */ if (p == f->buf) /* iff empty, EOF */ return 0; /* ** move prefix of line to bottom of buffer */ if (s != f->buf) { for (p = f->buf; (*p = *s) != 0; ++p, ++s) ; s = f->buf; } n = XBUFSIZE - (p - f->buf); if (n < QUANTUM) /* insufficent room, break line */ { f->nextChar = p; return s; } n = (n / QUANTUM) * QUANTUM; /* quantize: count to read */ n = READ(f->fd, p, n); /* ** read error is sort of ignored here... same return as EOF. ** we'll see if this proves to be sufficent... */ if (n < 0) { f->nextChar = f->buf; f->buf[0] = 0; return 0; } p[n] = 0; for ( ; *p != 0; ++p) { if (*p == '\n') { if (s < p && p[-1] == '\r') p[-1] = 0; else *p = 0; ++p; break; } } f->nextChar = p; return p == s ? 0 : s; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/xfile.h0000755000076400001440000000135407055334352015563 /* ** xfile.h -- definitions for fast line buffered files */ #ifndef __XFILE_H__ #define __XFILE_H__ struct _xfile { int fd; int bufSize; char *buf; char *nextChar; char *lastChar; }; typedef struct _xfile XFILE; #include #if defined(__ZTC__) #include #define DOS_OPEN dos_open #define READ read #define CLOSE close #elif defined(__TURBOC__) #include #include #define DOS_OPEN _open #define READ _read #define CLOSE _close #else /* MSC */ #include #include #define CLOSE _dos_close #endif XFILE *xopen(char const *); void xclose(XFILE *); char *xgetline(XFILE *); #endif /* __XFILE_H__ */ c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/pbmsrch.c0000755000076400001440000000505607055334130016102 /* ** A Pratt-Boyer-Moore string search, written by Jerry Coffin ** sometime or other in 1991. Removed from original program, and ** (incorrectly) rewritten for separate, generic use in early 1992. ** Corrected with help from Thad Smith, late March and early ** April 1992...hopefully it's correct this time. Revised by Bob Stout. ** ** This is hereby placed in the Public Domain by its author. ** ** 10/21/93 rdg Fixed bug found by Jeff Dunlop */ #include #include #include static size_t table[UCHAR_MAX]; static size_t len; static char *findme; /* ** Call this with the string to locate to initialize the table */ void init_search(const char *string) { size_t i; len = strlen(string); for (i = 0; i <= UCHAR_MAX; i++) /* rdg 10/93 */ table[i] = len; for (i = 0; i < len; i++) table[(unsigned char)string[i]] = len - i - 1; findme = (char *)string; } /* ** Call this with a buffer to search */ char *strsearch(const char *string) { register size_t shift; register size_t pos = len - 1; char *here; size_t limit=strlen(string); while (pos < limit) { while( pos < limit && (shift = table[(unsigned char)string[pos]]) > 0) { pos += shift; } if (0 == shift) { if (0 == strncmp(findme, here = (char *)&string[pos-len+1], len)) { return(here); } else pos++; } } return NULL; } #ifdef TEST #include void main(void) { char *here; char *find_strings[] = {"abb", "you", "not", "it", "dad", "yoo", "hoo", "oo", "oh", "xx", "xx", "x", "x", NULL}; char *search_strings[] = {"cabbie", "your", "It isn't here", "But it is here", "hodad", "yoohoo", "yoohoo", "yoohoo", "yoohoo", "yoohoo", "xx", "x", "."}; int i; for (i = 0; find_strings[i]; i++) { init_search(find_strings[i]); here = strsearch(search_strings[i]); printf("\"%s\" is%s in \"%s\"", find_strings[i], here ? "" : " not", search_strings[i]); if (here) printf(" [\"%s\"]", here); putchar('\n'); } } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/myline.cpp0000755000076400001440000000345607055334120016302 // myLine.cpp // // 13 Jun 93 Init array[0] = NUL in case it is reference before use // memcpy() adjusted to also copy terminating NUL from is.get() // when extending buffer // # include # include "myLine.h" # if defined(_MSC_VER) # include # else # include # endif // Class implementation myLine::myLine (short buflen) : len(buflen), mybuf(new char[len]), xalloc(1) { mybuf[0] = 0; } myLine::myLine (char * usebuf, short buflen) : len(buflen), mybuf(usebuf), xalloc(0) { mybuf[0] = 0; } myLine::~myLine (void) { if (xalloc) delete [] mybuf; } istream & operator>> (istream & is, myLine & l) { # if AUTO_GROW if (!l.xalloc) // It's not my buf, so it can't be grown { # endif is.get (l.mybuf, l.len); if (is.peek() == '\n') is.get(); // Remove newline from stream # if AUTO_GROW } else { int idx = 0; l.mybuf[0] = 0; // Terminate in case is.good() isn't for (int eol = 0; !eol && is.good(); ) { int toget = l.len - idx; is.get (l.mybuf + idx, toget); int chrs = is.gcount(); if (is.peek() == '\n') { ++eol; // Must be eol or eof is.get(); // Clear newline } else if (chrs) { // Extend buffer idx += chrs; // Add to index l.len = short(l.len + ALLOC_LEN); char * tmp = new char[l.len]; memcpy (tmp, l.mybuf, idx + 1); delete [] l.mybuf; l.mybuf = tmp; } } } # endif return is; } c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/hugesort.c0000755000076400001440000000544207055334014016304 /* ** hugesort.c -- huge qsort() -- public domain by Raymond Gardner 6/92 ** tested with Borland C++ 3.0 (C mode) */ static void swap(char huge *a, char huge *b, unsigned n) { char tmp; do { tmp = *a; *a++ = *b; *b++ = tmp; } while ( --n ); } void hugesort(void huge *basep, unsigned nel, unsigned width, int (*comp)(void huge *, void huge *)) { char huge *i, huge *j; unsigned int lnel, rnel; char huge *base = (char huge *)basep; while (nel > 1) { swap(base, base + (long)width * (nel / 2), width); for (i = base, j = base + (long)width * nel; ; ) { do j -= width; while ( (*comp)(j, base) > 0 ); do i += width; while ( i < j && (*comp)(i, base) < 0 ); if (i >= j) break; swap(i, j, width); } swap(j, base, width); lnel = (unsigned)((long)(j - base) / width); rnel = nel - lnel - 1; j += width; if (lnel < rnel) { hugesort(base, lnel, width, comp); base = j; nel = rnel; } else { hugesort(j, rnel, width, comp); nel = lnel; } } } #ifdef TEST #include #include #include #include #define PADSIZE 300 typedef struct x { int key; char pad[PADSIZE]; } X; int cmpv(void huge *a, void huge *b) /* (note void huge *) passed here */ { return ((X huge *)a)->key < ((X huge *)b)->key ? -1 : ((X huge *)a)->key > ((X huge *)b)->key ? 1 : 0; } int main(int argc, char **argv) { X huge *v; int n; int i, j; n = 300; /* default element count */ if (argc > 1) n = atoi(argv[1]); printf("test with %d elements\n", n); v = farmalloc(sizeof(X) * (long)n); assert(v); /* be sure we got memory */ for (i = 0; i < n; ++i) /* random init */ { v[i].key = rand(); for (j = 0; j < PADSIZE; ++j) v[i].pad[j] = rand(); } for (i = 0; i < n; ++i) /* display before */ printf(" %d", v[i].key); printf("\n"); hugesort(v, n, sizeof(X), cmpv); /* sort it */ for ( i = 0; i < n; ++i ) /* display after */ printf(" %d", v[i].key); printf("\n"); return 0; } #endif c_cpp_reference-2.0.2/reference/C/CONTRIB/SNIP/memrev.c0000755000076400001440000000267707055334103015745 /* ** Public domain demo by Ray Gardner, 7 dec 88 ** ** Here's an old programming trick that (I bet) will be new to at least a ** few of you out there, even some "old hands". I don't remember where I ** saw this; it might have been Jon Bentley's "Programming Pearls" column in ** Communications of the ACM. ** ** Have you ever wanted to exchange two adjacent areas of storage which ** might be of two different lengths? There are some tricky and complicated ** "efficient" methods to do this without using a lot of extra temporary ** storage. But there is also an old and simple way: Assume that the buffer ** looks like this: ** ** |...... head .......|.................. tail .................| ** ** You reverse the head, reverse the tail, then reverse the entire buffer. ** That's all there is to it. It will leave you with: ** ** |.................. tail .................|...... head .......| ** ** Here's code: */ #include /* ** reverse "count" bytes starting at "buf" */ void memrev(char *buf, size_t count) { char *r; for (r = buf + count - 1; buf < r; buf++, r--) { *buf ^= *r; *r ^= *buf; *buf ^= *r; } } /* ** swap "head" bytes with "tail" bytes at "buf" */ void aswap(char *buf, size_t head, size_t tail) { memrev(buf, head); memrev(buf + head, tail); memrev(buf, head + tail); } c_cpp_reference-2.0.2/reference/C/CONTRIB/YABL/0000777000076400001440000000000007474405222014337 5c_cpp_reference-2.0.2/reference/C/CONTRIB/YABL/yabl0000644000076400001440000030041307055333627015132 TITLE: *** YABL *** AUTHOR: Mitch Wright AUTHOR: Fellow USENET Readers... DATE: Tue Dec 7 11:53:54 PST 1993 COMMENTS For complaints, kudos, suggestions, corrections, additions, donations, ... drop me an E-mail note -- mitch@oz.com. The latest version of this list can be obtained via anonymous ftp from ftp.rahul.net pub/mitch/YABL/yabl TITLE: !%@:: A Guide to Electronic Mail Addressing, 2nd edition AUTHOR: Frey, Donnalyn AUTHOR: Adams, Rick SUBJECT: Introduction PUBLISHER: O'Reilly & Associates, Inc. DATE: 1993 PAGES: 458 ISBN: 0-56592-03107 APPROX_COST: $24.95 KEYWORDS: e-mail COMMENTS Answers the problem of addressing mail to people you've never met, on networks you've never heard of. Includes a general introduction to e-mail, followed by detailed reference sections for over 130 networks. ** This has been completely updated since the 1990 version!!! ** Topics covered include: * An introduction to e-mail for beginners * For over 180 networks: a description of the network, the services it provides, the format of the e-mail addresses needed to reach users on that network * Index to networks by network name, country or area name, and country code * Index to second and third level domains and many sites within each network TITLE: ANSI C Card AUTHOR: SSC Staff SUBJECT: Pocket-sized reference card on the ANSI C language PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: June, 1991 (revised) PAGES: 8 ISBN: 0-916151-48-4 APPROX_COST: $3.00 KEYWORDS: ANSI C, pocket reference SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS Includes constants, variables, functions, statements, proprocessor directives, common I/O functions, formatted I/O, ASCII chart. Operator precidence chart. TITLE: The AWK Programming Language AUTHOR: Aho, Al AUTHOR: Kernighan, Brian AUTHOR: Weinberger, Peter SUBJECT: AWK Programming PUBLISHER: Addison Wesley DATE: 1988 PAGES: 210 ISBN: 0-201-07981-X LC: 87-17566 APPROX_COST: 23.75 TITLE: Algorithms in C AUTHOR: Sedgewick, Robert PUBLISHER: Addison-Wesley DATE: 1990 PAGES: ISBN: 0-201-51425-7 APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS Many useful algorightms expressed in C TITLE: The Art of Distributed Appl., Programming Techniques for RPC AUTHOR: Corbin, John R. PUBLISHER: Springer-Verlag (Part of Sun Techincal Reference Library) DATE: 1991 PAGES: 558 ISBN: 0-387-97247-1 APPROX_Cost: 39.95 SUGGESTED_BY: "Betty Jo Armstead, Sverdrup" COMMENTS An excellent book for anyone starting to develop RPC applications.his The book covers SUN style RPC programming with lots of examples. the It covers XDR, RPC Protocol, RPC programming, Low-level RPC Programming, Additional RPC Library Features, RPCGEN, Developing RPC-based Distributed Applications and the future of RPC programming. The books also hints at multithreaded RPC applications, but provides no examples and very little discussion on this topic. TITLE: Advanced C Programming for Displays AUTHOR: Rochkind, Marc J. SUBJECT: Programming PUBLISHER: Prentice-Hall DATE: 1988 PAGES: 331 ISBN: 0-13-010240-07 APPROX_COST: 32.95 SUGGESTED_BY: "Michael J. Chinni, SMCAR-CCS-E" COMMENTS Covers Character Displays, Windows, and Keyboards for UNIX and MS-DOS. TITLE: Advanced UNIX Programming AUTHOR: Rochkind, Marc J. SUBJECT: Programming PUBLISHER: Prentice-Hall EDITION: 1985, pp 265 ISBN: 0-13-011818-4 HBK ISBN: 0-13-011800-1 PBK APPROX_COST: 32.95 HBK APPROX_COST: 24.95 PBK KEYWORDS: SYSV COMMENTS Rochkind is a former Bell Labs UNIX guru who wrote SCCS back in the mid 70's. This book is exactly what the title states, basically an extremely thorough treatment of programming using the UNIX System Call Interface. System V, System III, V7, 4.2 BSD, and Xenix are all discussed. The system calls are organized functionally into chapters that cover file i/o, terminal i/o, process control, interprocess communication, and miscellaneous calls. The opening chapter is an overvview of fundamental concepts of UNIX. Anytime I have a question on the usage of system calls I consult this book. The only problem with it is that it needs to be updated per System V Rel 3, 4.3 BSD and the efforts of Sun and AT&T to bring SunOS and System V together as well as the efforts in the UNIX 386 world. TITLE: Advanced UNIX: A Programmer's Guide AUTHOR: Prata, Stephen SUBJECT: Programming Guide PUBLISHER: Howard W. Sams & Co. DATE: 1985 PAGES: 484 ISBN: 0-067-22403-8. APPROX_COST: 24.95 KEYWORDS: SYSV COMMENTS Prata assumes you know how to login and use an editor. It's very good for shell programing. TITLE: The Art of Computer Programming (V1), Fundamental Algorithms AUTHOR: Knuth, Donald E. PUBLISHER: Addison-Wesley DATE: 1973 ISBN: PAGES: APPROX_COST: <$$.cc> KEYWORDS: Algorithms TITLE: The Art of Computer Programming (V2), Seminumerical Algorithms AUTHOR: Knuth, Donald E. PUBLISHER: Addison-Wesley DATE: 1981 ISBN: 0-201-03822-6 PAGES: APPROX_COST: <$$.cc> KEYWORDS: Algorithms TITLE: The Art of Computer Programming (V3), Sorting and Searching AUTHOR: Knuth, Donald E. PUBLISHER: Addison-Wesley DATE: 1973 ISBN: 0-201-03803-X PAGES: APPROX_COST: <$$.cc> KEYWORDS: Algorithms TITLE: BSD 4.3 Manual Set AUTHOR: University of California Berkeley SUBJECT: 4.3 BSD UNIX Operating System DATE: June 1988 PAGES: ISBN: APPROX_COST: 60.00/set SUGGESTED_BY: An anonymous BSD zealot COMMENTS This is a must for programmers, administrator, and users alike. If you are in contact with the BSD UNIX Operating system, YOU need these manuals! Kudos to the boys at Cory and Evans! *Printed by the USENIX Association as a service to the UNIX Comm. TITLE: Beginning UNIX Commands AUTHOR: SSC Staff SUBJECT: Pocket-sized reference card on basic UNIX System commands PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: January, 1992 (revised) PAGES: 4 ISBN: 0-916151-55-7 APPROX_COST: FREE with order of send #10 SASE KEYWORDS: UNIX, pocket reference SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS Lists 30 generic UNIX commands with examples of usage. TITLE: The Berkeley UNIX Environment AUTHOR: Horspool, R. Nigel SUBJECT: C Programming, BSD Unix PUBLISHER: Prentice Hall DATE: 1992 PAGES: 379 ISBN: 0-13-089368-4 APPROX_COST: 30.00 KEYWORDS: BSD, C SUGGESTED_BY: Chet Creider COMMENTS An excellent introduction to workstation use. Sections on vi, Gnu emacs, csh (including C shell programming), lex, yacc, systems programming in C (5 chapters), make, SCCS, RCS, dbx, and much more. TITLE: A Book on C AUTHOR: Kelley, Al AUTHOR: Pohl, Ira SUBJECT: C Programming PUBLISHER: Benjamin/Cummings Publishing Company, Inc. DATE: 1984 PAGES: 362 ISBN: 0-8053-6860-4 APPROX_COST: 32.25 SUGGESTED_BY: Mitch Wright COMMENTS This is a book written with the beginning C programmer in mind. TITLE: Checking C Programs with lint AUTHOR: Darwin, Ian F. SUBJECT: lint PUBLISHER: O'Reilly & Associates DATE: 1990 PAGES: 84 ISBN: 0-937175-30-7 APPROX_COST: 12.95 KEYWORDS: lint, C, nutshell COMMENTS: The lint program checker has proven itself time and again to be one of the best tools for finding portability problems and certain types of coding errors in C programs. This book introduces you to lint, guides you through running it on your programs and helps you to interpret lint's output. TITLE: The C Answer Book AUTHOR: Tondo, Clovis L. AUTHOR: Gimpel, Scott E. SUBJECT: C programming PUBLISHER: Prentice-Hall DATE: 1989 PAGES: 208 ISBN: 0-13-109877-2 APPROX_COST: 30.00 KEYWORDS: K&R answers COMMENTS This book provides the answers to the exercises found in K&R. I believe that a second edition of this book has also been recently published corresponding with the 2nd edition of K&R. TITLE: C Language for Programmers, 2nd ed. AUTHOR: Pugh, Kenneth SUBJECT: C Programming PUBLISHING: QED Information Sciences DATE: 1989 PAGES: 320 ISBN: 0-89435-367-5 APPROX_COST: $29.95 KEYWORDS: C, tutorial COMMENTS: Teaches non-C programmers how to code in C TITLE: C Library Reference AUTHOR: SSC Staff SUBJECT: Pocket-sized reference on the C library PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: 1985 PAGES: 33 ISBN: 0-916151-11-5 APPROX_COST: $6.00 KEYWORDS: C library, pocket reference SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS Documents the UNIX System 5.2 C library. Includes index to UNIX man pages. The cover is a condensed explanation of the C language. TITLE: C Pointers and Dynamic Memory Management AUTHOR: Daconta, Michael C. SUBJECT: C Pointers, Mem Management, Traps PUBLISHER: QED Publishing DATE: 1993 PAGES: 340 ISBN: 0-89435-473-6 APPROX_COST: 39.95 SUGGESTED_BY: Roger Smith KEYWORDS: C Programming, pointers, memory management, data structures COMMENTS Saves lots of time using some of the parser code. Cements pointer and memory management concepts. Good diagrams and plenty of examples. Lots of other stuff explained well: pointer pointers, function pointers, pointer traps, memory debugger ... highly recommend for a C programmers bookshelf! TITLE: C Primer Plus Revised Edition AUTHOR: Waite, Mitchell AUTHOR: Prata, Stephen AUTHOR: Martin, Donald SUBJECT: C programming PUBLISHER: Howard W. Samms & Company DATE: 1987 PAGES: 558 ISBN: 0-672-22582-4 APPROX_COST: 23.95 SUGGESTED_BY: "Michael J. Chinni, SMCAR-CCS-E" COMMENTS An excellent beginners guide to C programming. I found out about this book through a vendor's training class on C, where they used it as the textbook. TITLE: C Programming Guide, 3rd Ed. AUTHOR: Purdum, J.J. SUBJECT: C Programming PUBLISHER: Que Corporation DATE: 1988 PAGES: 456 ISBN: 0-88022-356-1 LCCN: 88-61496 OCLC: 18865012 TITLE: The C Programmer's Handbook AUTHOR: Bolsky, Morris I. SUBJECT: Reference PUBLISHER: Prentice-Hall DATE: 1985 PAGES: 84 ISBN: 0-13-110073-4 APPROX_COST: 22.95 KEYWORDS: C Programming COMMENTS This is a handbook for experience programmers, not a book for reading. Information is intended as a quickie reference and is not that detailed. TITLE: The C Programming Language, First Edition AUTHOR: Kernigan, Brian W. AUTHOR: Ritchie, Dennis M. SUBJECT: C Programming PUBLISHER: Prentice-Hall DATE: 1978 PAGES: 228 ISBN: 0-13-110163-3 APPROX_COST: 27.00 KEYWORDS: C, UNIX, K&R C SUGGESTED_BY: Mitch Wright COMMENTS ** The Original Bible of C programming ** "... a book that ocntains a tutorial introduction to get new userss started as soon as possible, separate chapters on major features and a reference manual" TITLE: The C Programming Language, Second Edition AUTHOR: Kernigan, Brian W. AUTHOR: Ritchie, Dennis M. SUBJECT: C Programming PUBLISHER: Prentice-Hall DATE: 1988 PAGES: 272 ISBN: 0-13-110362-8 APPROX_COST: 28.00 SUGGESTED_BY: "Michael J. Chinni, SMCAR-CCS-E" COMMENTS The Bible of C programming TITLE: C Programmer's Library, 2nd Ed. AUTHOR: Purdum, J.J. SUBJECT: C language PUBLISHER: Que Corporation DATE: 1985 PAGES: 319 ISBN: 0-88022-157-7 LCCN: 85-60689 OCLC: 12819701 TITLE: C Programmer's Toolkit AUTHOR: Purdum, Jack J. SUBJECT: C language PUBLISHER: Que Corporation DATE: 1989 PAGES: 350 ISBN: 0-88022-457-6 LCCN: 89-61069 OCLC: 21130331 TITLE: The C Puzzle Book: Puzzles for the C Programming Language, 2nd Ed. AUTHOR: Feuer, Alan R. SUBJECT: C programming PUBLISHER: Prentice-Hall DATE: 1982 PAGES: 173 ISBN: 0-13-109934-5 HBK ISBN: 0-13-109926-4 PBK APPROX_COST: 26.00 COMMENTS Exactly what the title indicates. The puzzles are organized by chapter: basic arithmetic operators, assignment operators, logic and increment operators, bitwise operators, relational and conditional operators, operator precedence and evaluation. The answers for all of the puzzles are also provided. This is an excellent way to learn some of the more advanced expressions that can be concocted with C. TITLE: C Self-Study Guide AUTHOR: Purdum, J.J. SUBJECT: C language PUBLISHER: Que Corporation DATE: 1985 PAGES: 249 ISBN: 0-88022-149-6 OCLC: 12790605 B-NO: 411153F TITLE: C Standard Library AUTHOR: Purdum, Jack J. AUTHOR: Leslie, Timothy C SUBJECT: C language PUBLISHER: Que Corporation DATE: 1987 PAGES: 437 ISBN: 0-88022-279-4 LCCN: 86-62528 OCLC: 16411542 TITLE: C Traps and Pitfalls AUTHOR: Koenig, Andrew SUBJECT: C programming PUBLISHER: Addison-Wesley DATE: 1988 PAGES: 147 ISBN: 0-201-17928-8 APPROX_COST: 17.50 COMMENTS Andrew published a BTL Technical Memorandum by this title several years back. Later it was published as a Technical Report. It has now been expanded into a book. I read the TR and it was excellent. I just recently finished the book and would recommend it to anyone who uses C. TITLE: The C and Unix Dictionary AUTHOR: Christian, Kaare SUBJECT: Definitions of terms PUBLISHER: John Wiley & Sons, Inc. DATE: 1988 PAGES: 216 ISBN: 0-471-60929-3 HBK ISBN: 0-471-60931-5 PBK APPROX_COST: 24.95 COMMENTS Definitions of over 1000 terms in the C and Unix lexicon. TITLE: C: A Reference Manual, 2nd Edition AUTHOR: Harbison, Samuel P. AUTHOR: Steele Jr., Guy L. SUBJECT: C Programming PUBLISHER: Prentice-Hall DATE: 1987 PAGES: 404 ISBN: 0-13-109810-1 HBK ISBN: 0-13-109802-0 PBK APPROX_COST: 31.95 COMMENTS An excellent book on C. It is not really an introductory level book, and is a great companion to K&R (2nd Ed.). Both this book and K&R (2nd Ed.) cover the draft-proposed ANSI standards. Where H&S really stands out is in the sections that cover the UNIX library calls. If you have ever struggled with any of printf or scanf family of library calls in trying to figure out the conversion rules in the format string, this book is the answer. TITLE: Compiler Design in C AUTHOR: Holub, Allen I. SUBJECT: Compiler Design PUBLISHER: Prentice-Hall DATE: 1990 PAGES: 924 ISBN:0-13-155045-4 KEYWORDS: C Compilers, YACC SUGGESTED_BY: Mitch Wright COMMENTS Great book! And lots of source examples to boot. TITLE: Compilers, Principles, Techniques, and Tools AUTHOR: Aho, Alfred V. AUTHOR: Sethi, Ravi AUTHOR: Ullman, Jefferey D. PUBLISHER: Addison-Wesley DATE: 1985 PAGES: ISBN: 0-201-10088-6 APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS Very good compile book. Covers yacc and lex theory and practice. TITLE: Computer Security Basics AUTHOR: Russell, Deborah AUTHOR: Gangemi Sr., G.T. SUBJECT: Computer Security PUBLISHER: O'Reilly and Associates DATE: 1992 PAGES: 464 ISBN: 0-937175-71-4 APPROX_COST: 29.95 KEYWORDS: Security, UNIX SUGGESTED_BY: "Cliff Stoll" COMMENTS For computer managers who use Orange Book sytems -- trusted computer systems. A lot about government standards and what it means to have a certified secure system. TITLE: Computers Under Attack AUTHOR: Denning, Peter [editor] PUBLISHER: ACM Press / Addison-Wesley Publishing Co. DATE: 1990 PAGES: 554 ISBN: 0-201-53067-8 APPROX_COST: 35.00 SUGGESTED_BY: "Cliff Stoll" COMMENTS A collection of articles about computer security. Good history of networks and an introduction to the internet, with emphasis on security problems. Reviews of the internet worm of 1988, computer viruses, and the nature of openness in a networked community. TITLE: Computerization and Controversy AUTHOR: Dunlop & Kling [editor] PUBLISHER: Academic Press DATE: 1991 PAGES: 758 ISBN: 0-12-224356-0 APPROX_COST: 65.00 SUGGESTED_BY: "Cliff Stoll" COMMENTS A splendid collection of articles on the social impact of computers. Check out "The Strange Case of the Electronic Lover" (from Ms. Magazine), or "Safety-Critical Computing" or "Social Analysis of Computing". Technically solid and socially important writing in here. TITLE: Connecting to the Internet AUTHOR: Estrada, Susan SUBJECT: Networking PUBLISHER: O'Reilly & Associates DATE: Aug 1993 PAGES: 170 ISBN: 1-56592-061-9 APPROX_COST: KEYWORDS: networking, internet TITLE: Cryptography and Data Security AUTHOR: Denning, Dorothy E. PUBLISHER: Addison-Wesley DATE: 1983 PAGES: ISBN: 0-201-10150-5 APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS Scientific treatment of cryptography and security. TITLE: The Cuckoo's Egg AUTHOR: Stoll, Cliff PUBLISHER: Pocketbooks, New York City DATE: 1989, 1990 PAGES: 356 ISBN: 0-671-72688-9 APPROX_Cost: Paperback - $5.95 (cheap at half the price) HARDBACK: Doubleday, ISBN 0-385-24946-2, $20 (acid free!) SUGGESTED_BY: "Cliff Stoll" [see disclaimer] COMMENTS This is the true story of catching a spy over the Internet. A hacker broke into a Berkeley astronomy computer, then entered dozens of military computers through networks. Here's how to catch a spy, without much help from the FBI, the CIA, and the NSA. Six months on the NY Times best-seller list, two weeks on the Usenet most-flamed about list. "A spy story for the 90's -- and it's all true!" - Tom Clancy "A nonfiction book that reads like a Le Carre spy novel"- Seattle Times "A gripping spy thriller" -- New York Times Book Review "Indiana Jones & Tron, with a dash of Berkeley" -- William Press "Fast-moving - read it straight through in one evening" -- Evelyn Leeper "Not bad" - Cliff's Mom Disclaimer: I caught the hacker, wrote the book, and stand to earn two bits if you buy a copy. - Cliff Stoll TITLE: Cyberpunk AUTHOR: Hafner and Markoff PUBLISHER: Simon and Schuster DATE: 1991 PAGES: 362 ISBN: 0-671-68322-5 APPROX_COST: 22.00 SUGGESTED_BY: "Cliff Stoll" COMMENTS This book tells of the computing counterculture -- the underground of computing. Three people who became known for their exploits: Kevin Mitnick, who obsessively broke into DEC systems in Southern California; Hans Hubner, who was a part of the German group that stole American military information and sold it to the KGB; and Robert T. Morris, who wrote the Internet worm of 1988. Perhaps the title of this book is misleading, but the subtitle isn't: Outlaws and hackers on the Computer Frontier TITLE: The C++ Programming Language AUTHOR: Stroustrup, Bjarne PUBLISHER: Addison-Wesley ISBN: 0-201-12078-X PAGES: APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS The standard C++ book. TITLE: A C++ Primer AUTHOR: Lippman, Stanley B. PUBLISHER: Addison-Wesley DATE: 1989 PAGES: ISBN: 0-201-16487-6 APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS A good introduction to C++ programming. TITLE: C++ Reference AUTHOR: SSC Staff SUBJECT: Pocket-sized reference card on C++ language, Version 2 PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: July, 1991 PAGES: 16 ISBN: 0-916151-49-2 APPROX_COST: $4.50 KEYWORDS: C++, pocket reference SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com TITLE: DNS and BIND AUTHOR: Albitz, Paul AUTHOR: Liu, Cricket SUBJECT: DNS, BIND PUBLISHER: O'Reilly and Associates DATE: October 1992 PAGES: 381 ISBN: 1-56592-010-4 APPROX_COST: $27.95 KEYWORDS: Domain Name Service, DNS, BIND, named, resolve SUGGESTED_BY: Mitch Wright COMMENTS: I'm just starting to read mine (got it today), and so far so good. For the moment, let me leave you with an excerpt from the cover: ``Whether you're an administrator involved with DNS on a daily basis, or a user who wants to be mroe informed about the internet and how it works, you'll find that this book is essential reading.'' Topics include: . What DNS does, how it works, and when you need to use it . How to find your own place in the Internet's name space . Setting up name servers . Using MX records to route mail . Configuring hosts to use DNS name servers . Subdividing domains (parenting) . Long-term maintenance . Troubleshooting: using nslookup, reading debug output, and common problems . Low-level programming with the resolver library TITLE: DOS Meets UNIX AUTHOR: Dougherty, Dale AUTHOR: O'Reilly, Tim SUBJECT: Introduction PUBLISHER: O'Reilly & Associates, Inc. DATE: 1988 PAGES: 148 ISBN: 0-937175-21-8 APPROX_COST: 15.00 KEYWORDS: Nutshell Handbook COMMENTS Describes the solutions available for integrating DOS and UNIX. It also briefly introduces UNIX for DOS users. TITLE: Data Structures and C Programs. AUTHOR: Van Wyk, Christopher SUBJECT: C programming DATE: 1989 PAGES: 387 ISBN: 0-201161-16-8 APPROX_COST: 41.95 SUGGESTED_BY: srvarma@rodan.acs.syr.edu KEYWORDS: C, Data Structures COMMENTS The author is from Bell Labs and this is also one of my favorite books for learing C programming with different kinds of data structures." [ *** NOTE: Has been reprinted with corrections *** ] TITLE: Data Structures and Program Design in C AUTHOR: Kruse, Robert L. AUTHOR: Leung, Bruce P. AUTHOR: Tondo Clovis L. SUBJECT: C Programming PUBLISHER: Prentice Hall DATE: 1991 PAGES: 525 ISBN: 0-13-725649-3 APPROX_COST: 47.00 KEYWORDS: C, Data Structures COMMENTS: From back cover: This introduction to data structures using the C programming language emphasizes problem specification and program design; analysis, testing, and verification; and program correctness TITLE: The Design and Implementation of the 4.3BSD Unix Operating System AUTHOR: Leffler, Samuel J. AUTHOR: McKusick, Marshall Kirk AUTHOR: Karels, Michael J. AUTHOR: Quarterman, John S. SUBJECT: Design of BSD UNIX PUBLISHER: Addison-Wesley DATE: 1989 PAGES: 471 ISBN: 0-201-06196-1 APPROX_COST: 39.00 KEYWORDS: Internals, Kernel, BSD SUGGESTED_BY: Mitch Wright COMMENTS These are the primary people who are responsible for 4.3 BSD. --From back cover-- This book is the first authoritative description of the design and implementation of the research version of the UNIX System developed at the University of California at Berkeley. It covers the INTERNAL structure of the 4.3BSD system and the concetps, data structures, and algorithms used in implementing the system facilites. The book also includes a chaper on the implementation of TCP/IP -- a networking protocol suite widely implemented throughout the world. Both philosophical and design issues of 4.3BSD are discussed, as well as details of the actual implementation. In most cases, the discussion starts at the system-call level and descends from the interface to the kernel down to the hardware itself. The kernel includes system facilities such as process management, memory management, the I/O system, the filesystem, the socket IPC mechanism, and network-protocol implementations. The Design and Implemenation of the 4.3BSD UNIX Operating System is an in-depth study of a contemporary operating system. This book assumes that the reader understands basic operating-system terminology and has some familiarity with any version of the UNIX System and with the C programming language. Therefore, this book is suitable for operating-system implementors, systems programmers, and UNIX application developers. TITLE: The Design of the Unix Operating System AUTHOR: Bach, Maurice J. SUBJECT: Design of UNIX PUBLISHER: Prentice-Hall DATE: 1986 PAGES: 471 ISBN: 0-13-201799-7 APPROX_COST: 47.20 KEYWORDS: SYSV, AT&T COMMENTS A good generic introduction to kernel operation. (System V) TITLE: The Elements of Programming Style AUTHOR: Kernighan, Brian W. AUTHOR: Plauger, P. J. PUBLISHER: McGraw-Hill DATE: 1978 PAGES: ISBN: 0-07-034207-5 APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS A very good book on style. Although dated, most of it is still important and relevant. TITLE: Efficient C AUTHOR: Plum, Thomas AUTHOR: Brodie, Jim SUBJECT: C programming PUBLISHER: Plum Hall DATE: 1985 PAGES: 150 ISBN: 0-911537-05-8 APPROX_COST: 25.00 COMMENTS This is a useful book. Portability is one aspect of programming in C. Efficiency is the other. Many use C because it allows them the freedom to tie the programs down to the hardware in order to run efficiently. This book is an excellent guide and when combined with Jon Bentley's book on writting efficient programs gives one an excellent background in measuring programs and fine tuning them. TITLE: Emacs Reference Card AUTHOR: Dennis Gentry SUBJECT: Pocket-sized reference card on the Gnu Emacs editor PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: August, 1992 PAGES: 16 ISBN: 0-916151-59-2 APPROX_COST: $4.50 KEYWORDS: Gnu, Emacs, pocket reference SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com TITLE: Essential System Administration AUTHOR: Frisch, AEleen SUBJECT: Administration PUBLISHER: O'Reilly and Associates DATE: 1992 PAGES: 466 ISBN: 0-937175-80-3 APPROX_COST: 29.95 KEYWORDS: System admin., SVR3, SVR4, SunOS, AIX, BSD, XENIX COMMENTS -From back cover- Topics covered include: . Starting your system and shutting it down . Adding new users . Managing UNIX processes . Making the sytem secure . Organizing and planning filesystems . Planning and performing backups . Restoring lost files from a backup tape . Setting up a printer and the spooling system . Overseeing a TCP/IP network (including NFS) . Adding new terminals and disk drives . Setting up and using the accounting system Essential System Administration covers all of the major versions of UNIX, including BSD, Systems V.3 and V.4, SunOS, XENIX, and AIX 3.1. TITLE: Exploring the UNIX system AUTHOR: Kochan, Stephen G. AUTHOR: Wood, Patrick H. SUBJECT: Introduction to UNIX PUBLISHER: Hayden Book Company DATE: 1984 PAGES: 370 ISBN: 0-8104-6268-0 APPROX_COST: 22.95 SUGGESTED_BY: "Michael J. Chinni, SMCAR-CCS-E" KEYWORDS: Introduction COMMENTS A very good intro. book to UNIX. Has chapters on UNIX file system, Bourne shell, vi, Program development, security, communications, and administration. TITLE: GNU Emacs: UNIX Text Editing and Programming AUTHOR: Schoonover, Michael AUTHOR: Bowie, John AUTHOR: Arnold, Bill SUBJECT: GNU Emacs PUBLISHER: Addison-Wesley / HP Press DATE: 1991 PAGES: 640 ISBN: 0-201563-45-2 APPROX_COST: 26.95 KEYWORDS: Emacs, Editor, GNU SUGGESTED_BY: Michael Schoonover SUPPLIERS Ordering info: 1-800-333-0088 COMMENTS . Examples, examples, examples. . Appendix on switching from vi to Emacs; has vi-to-Emacs command mappings for all your favorite vi commands. . Separate chapters on general programming, C mode, Fortran mode, and Lisp modes; also, an appendix on the non-standard Pascal mode written by Vincent Broman. . Extensive chapter on customizing Emacs, with many examples. . Emacs-Lisp programming appendix (40 pages worth of info), with examples of using common Emacs-Lisp functions. . Comprehensive command reference with commands and variables grouped together by function, so you don't have to wade through voluminous alphabetical lists of commands and functions. In addition, the command reference refers you to pages in the manual where detailed info is found. . Command summary at the end of each chapter. . Printed on recycled paper! TITLE: Guide to OSF/1: A Technical Synopsis AUTHOR: Staff at O'Reilly & Associates SUBJECT: OSF PUBLISHER: O'Reilly and Associates DATE: PAGES: 304 ISBN: 0-937175-78-1 APPROX_COST: 21.95 KEYWORDS: OSF, Unix COMMENTS: This technically-competent introduction to OSF/1 is based on OSF technical seminars. In addition to its description of OSF/1, it includes the differences between OSF/1 and System V Release 4, and a look ahead at DCE. TITLE: The New Hackers Dictionary AUTHOR: Raymond, Eric PUBLISHER: MIT Press DATE: 1991 PAGES: ISBN: APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS A dictionary of most words, acronyms and slang used by people using computers. TITLE: The Internet Message, Closing the book with Electronic Mail AUTHOR: Rose, Marshall T. PUBLISHER: Prentice Hall DATE: 1993 PAGES: 370 ISBN: 0-13-092941-7 APPROX_COST: <$$.cc> TITLE: Internetworking with TCP/IP AUTHOR: Comer, Douglas SUBJECT: Networking PUBLISHER: Prentice-Hall DATE: 1988 PAGES: 382 ISBN: 0-13-470154-2 APPROX_COST: 47.00 SUGGESTED_BY: Mitch Wright COMMENTS -- From back of book This comprehensive book begins with a discussion of the TCP/IP technology and the Internet in general terms, summarizing the services provided and the history of their development. The remainder of the book looks at the architecture of the Internet, the TCP/IP technology, and the applications that use it in more detail. It discusses the fundamentals of protocols like TCP/IP as well as showing how they fit into the internet. In additon to providing details, the book highlights the general principles underlying network protocols, and explains why the TCP/IP protocols adapt easily to so many underlying network technologies. Readers will find a brief summary of the network hardware used throughout the Internet that focuses on the features of each technology that are of primary importance to an Internet architect. TITLE: Internetworking with TCP/IP Volume 1, 2nd Edition AUTHOR: Comer, Douglas E. SUBJECT: Networking: Principles, Protocols, and Architecture PUBLISHER: Prentice Hall DATE: 1991 PAGES: 547 ISBN: 0-13-468505-9 APPROX_COST: 52.00 SUGGESTED_BY: Mitch Wright COMMENTS: If you thought the first book was good, wait until you get ahold of this second set. Now it's two volumes.... TITLE: Internetworking with TCP/IP Volume 2, 2nd Edition AUTHOR: Comer, Douglas E. AUTHOR: Stevens, David L. SUBJECT: Networking: Design, Implementation, and Internals PUBLISHER: Prentice Hall DATE: 1991 PAGES: 532 ISBN: 0-13-472242-6 APPROX_COST: 49.00 SUGGESTED_BY: Mitch Wright TITLE: Internetworking with TCP/IP Volume 3 AUTHOR: Comer, Douglas E. AUTHOR: Stevens, David L. SUBJECT: Networking: Design, Implementation, and Internals PUBLISHER: Prentice Hall DATE: 1992 PAGES: 417 ISBN: APPROX_COST: $50.00 SUGGESTED_BY: Mitch Wright COMMENTS I got a glimse last month of this book... Needless to say I have mine on order from my book club. With luck it will be here soon. Looks like Comer and Stevens have another fine text on the shelf. TITLE: Introducing The UNIX System AUTHOR: McGilton, Henry AUTHOR: Morgan, Rachel SUBJECT: Introduction to UNIX PUBLISHER: McGraw-Hill Book Company DATE: 1983 PAGES: 556 ISBN: 0-07-045001-3 APPROX_COST: 27.95 SUGGESTED_BY: "Michael J. Chinni, SMCAR-CCS-E" COMMENTS Introductory for the most part, but far more extensive than Gauthier's book. There are two chapters on editors and two on text formatting that are the best I have seen in this type book. There is even a chapter on system management. ... a later edition of this book was targeted specifically to System V. -- Henry TITLE: Introducing UNIX System V AUTHOR: Morgan, Rachel AUTHOR: McGilton, Henry SUBJECT: Introduction PUBLISHER: McGraw-Hill DATE: 1987 PAGES: 612 ISBN: 0-07-043152-3 APPROX_COST: 24.95 COST: 19.95 PBK COMMENTS It gives the user a good working knowledge of a number of commands and packages. I emphasize that it is a user book, by no means a technical manual. I assume by the difficulty in getting it in these parts that it is pretty popular. TITLE: An Introduction to Berkeley Unix AUTHOR: Wang, Paul SUBJECT: Introduction PUBLISHER: Wadsworth Publishing Company DATE: 1988 PAGES: 512 ISBN: 0-534-08862-7 APPROX_COST: 36.75 KEYWORDS: BSD COMMENTS If you need a BSD oriented book, then I don't think you would find a more thorough introductory book. TITLE: The Kornshell, Command and Programming Language AUTHOR: Korn, David G. AUTHOR: Bolsky, Morris I. SUBJECT: Korn shell programming PUBLISHER: Prentice-Hall DATE: 1989 PAGES: 356 ISBN: 0-13-516972-0 APPROX_COST: 30.00 KEYWORDS: ksh, SYSV SUGGESTED_BY: Mitch Wright COMMENTS The book to have if you are beginning to learn the ksh. TITLE: LATEX: A Document Preparation System AUTHOR: Lamport, Leslie PUBLISHER: Addisson-Wesley DATE: 1985 PAGES: ISBN: 0-201-15790-X APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS Have it by your side when using LaTeX TITLE: Learning GNU Emacs AUTHOR: Cameron, Deb AUTHOR: Rosenblatt, Bill SUBJECT: Editing PUBLISHER: O'Reilly and Associates DATE: 1992 PAGES: 442 ISBN: 0-937175-84-6 APPROX_COST: 27.95 KEYWORDS: Emacs, Editor, GNU COMMENTS: A book aimed at new Emacs users, whether or not they are programmers. TITLE: Learning the Korn Shell AUTHOR: Rosenblatt, Bill SUBJECT: Shell PUBLISHER: O'Reilly & Associates DATE: 1993 PAGES: 338 ISBN: 1-56592-054-6 APPROX_COST: $27.95 KEYWORDS: shell, korn, programming COMMENTS: TABLE OF CONTENTS 1 - Korn Shell Basics 7 - Input/Output and Command-line 2 - Command-line Editing Processing 3 - Customizing Your Environment 8 - Process Handling 4 - Basic Shell Programming 9 - Debugging Shell Programs 5 - Flow Control 10 - Korn Shell Administration 6 - Command-line Options & Typed Variables TITLE: Learning the UNIX Operating System AUTHOR: Todino, Grace SUBJECT: Introduction PUBLISHER: O'Reilly & Associates, Inc. DATE: 1987 PAGES: 76 ISBN: 0-937175-16-1 APPROX_COST: 9.00 KEYWORDS: Nutshell Handbook TITLE: Learning the vi Editor, 5th Edition AUTHOR: Lamb, Linda SUBJECT: Introduction PUBLISHER: O'Reilly & Associates, Inc. DATE: 1991 PAGES: 192 ISBN: 0-937175-67-6 APPROX_COST: 21.95 KEYWORDS: Nutshell Handbook TITLE: Learning to Program in C AUTHOR: Plum, Thomas SUBJECT: C Programming PUBLISHER: Prentice Hall DATE: 1983 PAGES: 300 ISBN: 0-13-527847-3 (pbk) APPROX_COST: 20.00 SUGGESTED_BY: Chet Creider COMMENTS An old classic. TITLE: Learning Perl AUTHOR: Schwartz, Randal L. SUBJECT: Programming PUBLISHER: O'Reilly & Associates DATE: 1993 PAGES: 246 ISBN: 1-56592-04202 APPROX_COST: $24.95 KEYWORDS: Perl, programming. llama SUGGESTED_BY: Mitch Wright COMMENTS: Yowza! Well, here it is folks, "the" book to teach you perl. No more excuses no to learn one of the most useful and effective programming languages of our time. This book provides a quick ramp up for those with little time to spend, but need the power perl provides. TITLE: Life With UNIX AUTHOR: Libes, Don AUTHOR: Ressler, Sandy SUBJECT: Introduction and Overview of UNIX PUBLISHER: Prentice-Hall DATE: 1989 PAGES: 350 ISBN: 0-13-536657-7 APPROX_COST: 30.95 KEYWORDS: Introduction, Overview COMMENTS - A comprehensive overview of UNIX. Major sections are: UNIX in Time - Usual trash plus history of user groups, universities, with a comprehensive "who's who" in UNIX history. Present & Future deals with where UNIX is now and where its going - companies, standards and dialects are treated at length. UNIX Information - How people really learn about UNIX. Discussion of books, magazines, conferences, and, of course, source code. Inside UNIX - In-depth descriptions of UNIX from three different perspectives - user, programmer and adminstrator. Outside UNIX - Third-party stuff. Discussions of how UNIX has prospered/withered in face of real-world problems. Underground - archives, USENET, public access UNIX, GNU, MINIX, public-domain and/or free software, etc. This book is quite unusual, not only because of its scope, but because it prints things that have never appeared in print (for one reason or another) - things that most people don't realize or find until years after they have used UNIX. It is essentially a "reading between the lines" of all the other UNIX manuals, books and magazines. Lastly, "Life With UNIX" is chock full of amusing UNIX stories and anecdotes, all designed to provide you with key insights into why UNIX is the way it is. "Life with UNIX" is a must book for UNIX beginners to UNIX gurus. { Best! Best! Best! Hooray -- loved it!!! S.B.Bassett } TITLE: lex & yacc, 2nd Edition AUTHOR: Mason, Tony AUTHOR: Brown, Doug AUTHOR: Levine, John SUBJECT: Unix lex and yacc utilites PUBLISHER: O'Reilly and Associates DATE: October 1992 PAGES: 400 ISBN: 1-56592-000-7 APPROX_COST: 29.95 KEYWORDS: lex, yacc COMMENTS: Shows programmers how to use two UNIX utilities, lex and yacc, to solve problems in program development. Includes explanations of the concepts and tutorial examples, as well as detailed technical information for advanced users. LEX & YACC, 2nd edition, continues to be the only book exclusively devoted to these two important UNIX programming tools. Every chapter from the first edition has been wholly revised, with new, expanded examples replacing old ones. Major changes (From 1st Edition) include: * Lex and yacc each have a chapter devoted to understanding basic usage and simple, stand-alone applications; * A new chapter with full SQL grammar; * Greatly expanded reference chapters; * Coverage of the new POSIX 1003.2 standard versions of lex and yacc; * Full coverage of all major MS-DOS and UNIX versions of lex and yacc, including AT&T lex and yacc, Berkeley yacc, Berkeley/Gnu flex, Gnu bison, MKS Lex and Yacc, and Abraxas PCYACC. TITLE: MH & xmh: E-mail for Users & Programmers, 2nd Edition AUTHOR: Peek, Jerry SUBJECT: Electronic mail PUBLISHER: O'Reilly and Associates DATE: September 1992 PAGES: 728 ISBN: 1-56592-027-9 APPROX_COST: 29.95 KEYWORDS: E-mail, MH Customizing your e-mail environment to save time and make communicating more enjoyable. MH & xmh: E-Mail for Users & Programmers explains how to use, customize, and program with the MH electronic mail commands, available on virtually any UNIX system. The handbook also covers xmh, an X Window System client that runs MH programs. The new 2nd edition has been updated for X Release 5 and MH 6.7.2. We've added a chapter on "mhook", new sections explaining under-appreciated small commands and features, and more examples showing how to use MH to handle common situations. NOTE: Over 100 pages added since the 1st edition. TITLE: Managing NFS and NIS AUTHOR: Stern, Hal SUBJECT: Networking PUBLISHER: O'Reilly & Associates, Inc. DATE: 1991 PAGES: 436 ISBN: 0-937175-75-7 APPROX_COST: 27.95 KEYWORDS: YP, NIS, NFS, PC/NFS SUGGESTED_BY: stern@sunne.East.Sun.COM (Hal Stern - Consultant) COMMENTS: The book includes the usual discussions of setting up and administering NFS and NIS, but it focuses much more on the system design, on-going maintenance, growth management and performance tuning issues that seem to create the most problems. The chapters include: - NIS applications: how to build your own maps, and write applications that use NIS map files - NFS design and operation: what biod and nfsd really do. how file attribute caching works. - Using NFS and NIS to centralize mail delivery - Network Security, including a discussion of Secure RPC/NFS - Diagnostic Tools, focusing on debugging and problem isolation - Performance Analysis and Tuning - The Automounter - PC/NFS There's also an appendix describing various NFS benchmarking techniques and tools. TITLE: Managing Projects with Make, 2nd Edition AUTHOR: Oram, Andrew AUTHOR: Talbot, Steve SUBJECT: Introduction to make(1) PUBLISHER: O'Reilly & Associates, Inc. DATE: 1991 PAGES: 135 ISBN: 0-937175-90-0 APPROX_COST: 17.95 KEYWORDS: Nutshell Handbook TITLE: Managing UUCP and USENET, 10th Edition AUTHOR: O'Reilly, Tim AUTHOR: Todino, Grace SUBJECT: Introduction to UUCP and Usenet PUBLISHER: O'Reilly & Associates, Inc. DATE: 1991 PAGES: 368 ISBN: 0-937175-93-5 APPROX_COST: 27.95 KEYWORDS: Nutshell Handbook SUGGESTED_BY: Mitch Wright COMMENTS For all its widespread use, UUCP is one of the most difficult UNIX utilities to master. This book is for system administrators who want to install and manage UUCP and Usenet software. "Don't even TRY to install UUCP without it!" -- Usenet message 456@nitrex.UUCP TITLE: Modern Operating Systems AUTHOR: Tanenbaum, Andrew S. SUBJECT: Operating systems PUBLISHER: Prentice Hall DATE: 1992 PAGES: <715+> ISBN: 0-13-588187-0 APPROX_COST: KEYWORDS: OS, UNIX, Plan 9, MACH COMMENTS From the preface... [...] During the past 15 years, I have personally helped design and implement three different operating systems: TSS-11 (PDP-11), MINIX (IBM PC, Atari, Amiga, Macintosh, and SPARC), and Amoeba (80386, Sun-3, SPARC, and VAX). I have drawn on this long experience to emphasize those topics that actually matter in real systems. All the subjects that are expected in an undergraduate text on operating systems are included here, including processes, interprocess communication, semaphores, monitors, message passing, classical IPC problems, scheduling, swapping, virtual memory, paging algorithms, segmentation, file systems, security, [...] -- Andrew S. Tanenbaum TITLE: Notes on the Draft C Standard AUTHOR: Plum, Thomas SUBJECT: C Programming PUBLISHER: Plum Hall DATE: 1987 PAGES: 92 ISBN: 0-911537-06-6 APPROX_COST: 10.00 COMMENTS Tom Plum is the Vice Chair of the ANSI X3J11 committee, so who better to write this book than he? However, as with any of the other C books that treat the ANSI C Standard, it does not cover the Standard in it's final form due to the fact that it has yet to be adopted. However, the price is about $10, so it makes a good pickup to keep informed about the standard and how it differs from K&R C. TITLE: Numerical Recipes in C, The Art of Scientific Computing AUTHOR: Press, William H. AUTHOR: Flannery, Brian AUTHOR: Teukolsky, Saul AUTHOR: Vetterling, William SUBJECT: C Programming PUBLISHER: Cambridge University Press DATE: 1988 PAGES: 735 ISBN: 0-521-35465-X APPROX_COST: 44.50 SUGGESTED_BY: Mitch Wright COMMENTS ". . . it is the one book to buy if you are going to have to solve anything numerically on a computer." - Dr. Dobb's Journal TITLE: Obfuscated C and Other Mysteries AUTHOR: Libes, Don SUBJECT: C Programming PUBLISHER: John Wiley & Sons DATE: 1993 PAGES: 425, including disk with complete source code ISBN: 0-471-57805-3 COMMENTS Finally, an educational yet entertaining book for C programmers - or anyone else who wants to make fun of the language. "Obfuscated C ..." contains 40 essays that explain various mysteries of the language (or perhaps just the author's confusion over it) in an enjoyably light-hearted and humorous style. Included are explanations of all of the winners of the Obfuscated C Code Contest from 1985 to 1991. You've seen them before, but a superficial glance doesn't do them justice. Each of these seemingly short programs are wonderfully constructed knots of clever syntax and logic. You'll cry for hours and laugh for days. Keep this book away from children! You've been warned! TITLE: Object-oriented Software Construction AUTHOR: Meyer, Berstrand PUBLISHER: Prentice Hall DATE: 1988 PAGES: ISBN: 0-13-629031-0 APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS A strong, personal view on object oriented programming. A good introduction to the Eiffel language. TITLE: The Open Book AUTHOR: Rose, Marshall T. SUBJECT: OSI PUBLISHER: Prentice-Hall DATE: 1990 PAGES: 651 ISBN: 0-13-643016-3 APPROX_COST: KEYWORDS: Networking SUGGESTED_BY: Mitch Wright COMMENTS: -- From back cover -- This book is an important contribution to the networking literature for two reasons. First, it is one of the clearest expositions of the OSI architecture and protocols, and it deals with concrete issues, including implementation matters. Second, it seeks to explicate ways in which the TCP/IP Internet community may accommodate the phased introduction of OSI protocols. This latter contribution is of prime importance if this large and rapidly growing community is to benefit from the heavy vendor community investment in OSI software and services. -- Vint Cerf, Chariman, Internet Activities Board TITLE: Operating Systems, Design and Implementation AUTHOR: Tanenbaum, Andrew S. SUBJECT: OS Design PUBLISHER: Prentice-Hall DATE: 1987 PAGES: 719 ISBN: 0-13-637406-9 APPROX_COST: 40.00 KEYWORDS: MINIX, UNIX SUGGESTED_BY: Mitch Wright COMMENTS -- From back cover -- o Covers the fundamental principles in detail including processes, interporcess communication, semaphores, monitors, message passing, remote procedure call, scheduling algorithms input/output, deadlocks, device drivers, memory management, paging algorithms, file system design, network file servers, atomic transactions, security, and protection mechanisms. o discusses one system -- MINIX, a UNIXX-compatible operating system -- in detail to illustrate the principles. o provides a complete source code listing of MINIX for study. TITLE: Operating System Design, The XINU approach AUTHOR: Comer, Douglas SUBJECT: OS Design Publisher: Prentice-Hall DATE: 1984 PAGES: 486 ISBN: 0-13-637539-1 APPROX_COST: 39.95 SUGGESTED_BY: Mitch Wright COMMENTS: -- From back cover -- In this book, Douglas Comer, dispels the magic from operating system design and consolidates the body of material into a systematic discipline... The author guides you through the construction of a conventional process-based system, using practical straightforward primitives... TITLE: POSIX Programmer's Guide AUTHOR: Lewine, Donald SUBJECT: POSIX PUBLISHER: O'Reilly and Associates DATE: 1991 PAGES: 640 ISBN: 0-937175-73-0 APPROX_COST: 34.95 KEYWORDS: Posix, standards TITLE: Peter Norton's Guide to Unix AUTHOR: Norton, Peter AUTHOR: Hahn, Harley PUBLISHER: Bantam Books DATE: 1991 PAGES: 560 ISBN: 0-553-35260-1 APPROX_COST: 26.95 SUGGESTED_BY: Lawrence R. Gibes TITLE: Portable C Software AUTHOR: Horton, Mark SUBJECT: C programming PUBLISHER: Prentice Hall DATE: 1990 PAGES: 400 ISBN: 0-13-868050-7 APPROX_COST: 32.95 COMMENTS: ** From the back jacket: Portable C Software is designed for professional programmers and students who want to write portable C code between System V implementations, POSIX, MS DOS, and other operating systems. Assuming a working knowledge of C, this book addresses and rates each feature of the C software environment. Shell commands, system calls, external variables, and macros are discussed and examined in detail. The author provides an advanced introduction to C, describes how best to write portable software, examines what not to do, discusses common mistakes, and includes an invaluable portability reference manual. In this extensive manual, the author rates the portability of the following o subroutines available in C libraries o operating system calls o header include files o predefined variables in the C library o UNIX(R) system shell commands Portable C Software offers concise, current coverage of C, and will be an important reference for anyone who writes C programs. Of the nearly 400 pages, about 250 are reference material. Some of it is fairly detailed. If you find any errors, or have any suggestions for the next edition, please drop me a note at Mark.Horton@ATT.COM Thanks to everyone who made helpful suggestions or otherwise contributed to the book. -- Mark TITLE: Portable C and UNIX System Programming AUTHOR: Lapin, J.E. SUBJECT: C programming PUBLISHER: Prentice-Hall DATE: 1987 PAGES: 249 ISBN: 0-13-686494-5 KEYWORDS: Portable C COMMENTS A useful book, mostly because there are no others written on this topic, yet... TITLE: Postscript Language Program Design AUTHOR: Adobe Systems Incorporated PUBLISHER: Addison-Wesley DATE: 1988 PAGES: ISBN: 0-201-14396-8 APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS A must for writing serious PostScript programs. TITLE: Postscript Language Reference Manual AUTHOR: Adobe Systems Incorporated PUBLISHER: Addison-Wesley DATE: PAGES: ISBN: 0-201-10174-2 APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS The standard PostScript reference. TITLE: Practical C Programming AUTHOR: Oualline, Steve SUBJECT: C programming PUBLISHER: O'Reilly and Associates DATE: 1992 PAGES: 420 ISBN: 0-937175-65-X APPROX_COST: 24.95 KEYWORDS: C, programming TITLE: A Practical guide to UNIX System V AUTHOR: Sobell, Mark G. SUBJECT: UNIX System V PUBLISHER: Benjamin/Cummings Publishing Co. DATE: 1985 PAGES: 577 ISBN: 0-80-538915-6 APPROX_COST: 32.25 TITLE: A Practical Guide to the Unix System (2nd ed.) AUTHOR: Sobell, Mark G. SUBJECT: UNIX Guide PUBLISHER: Benjamin/Cummings Publishing Co. DATE: 1989 PAGES: 632 ISBN: 0-80-530243-3 APPROX_COST: 27.95 TITLE: Practical UNIX Security AUTHOR: Garfinkel, Simson AUTHOR: Spafford, Gene SUBJECT: Unix security PUBLISHER: O'Reilly and Associates DATE: 1991 PAGES: 512 ISBN: 0-937175-72-2 APPROX_COST: 29.95 KEYWORDS: security SUGGESTED_BY: "Cliff Stoll" COMMENTS Here's how to secure your Unix system -- where the security holes are, what to watch out for, how outsiders break in, how to secure your system in a networked environment. The best technical book on the subject that I've seen, written for systems people who need to know. It'll save you its purchase price in asprin. TITLE: Power Programming with RPC AUTHOR: Bloomer, John SUBJECT: RPC Programming PUBLISHER: O'Reilly and Associates DATE: 1991 PAGES: 494 ISBN: 0-937175-77-3 APPROX_COST: 29.95 KEYWORDS: RPC, Nutshell COMMENTS Contents include: -- The foundations of remote procedure calling; what it is, how it works and what vendors support it. -- What RPC offers to application and product developers. -- How RPC fits into a distributed computing environment -- ONC and DCE, a comparison of their similarities and differences. -- How to develop, debug and deploy networked applications. -- Understanding the interprocess control (IPC) mechanisms on which RPC is based. -- Using remote procedure calling in parallel/distributed processing and scheduling. -- Using remote procedure calling with windowing systems. -- Examples of distributed applications using both single and multiple concurrent servers. TITLE: Programming perl AUTHOR: Wall, Larry AUTHOR: Schwartz, Randal L. SUBJECT: Programming in perl PUBLISHER: O'Reilly & Associates, Inc. DATE: 1991 PAGES: 465 ISBN: 0-937175-64-1 APPROX_COST: 29.95 KEYWORDS: perl, nutshell SUGGESTED_BY: Mitch Wright COMMENTS: OUTSTANDING!!!!!!! I've had mine since USENIX and it's been with me since then. I just don't leave home without it. This book is for you if you are even slightly interested in perl as a language, and it's easy reading and excellent examples will make you, as Randal would say ``Just Another Perl Hacker''. It is even worth reading if you are not *yet* interested in the language. Programming perl is very light reading and in the words of Larry: "...mildly amusing in some spots (and wildly amusing in others)." From back cover: Perl is a language for easily manipulating text files and processes. Perl provides a more concise and readable way to do many jobs that were formally accomplished (with difficulty) by programming in the C language or one of the shells. Even though Perl is not yet a standard part of UNIX, it is likely to be available at any UNIX site. And if it isn't, users can get it and install it easily and FREE of charge. TITLE: Programming with Curses AUTHOR: Strang, John SUBJECT: Introduction PUBLISHER: O'Reilly & Associates, Inc. DATE: 1986 PAGES: 76 ISBN: 0-937175-02-1 APPROX_COST: 12.95 KEYWORDS: Nutshell Handbook COMMENTS curses is a UNIX library of functions for controlling a terminal's display screen from a C program. This handbook helps you make use of the curses library. TITLE: RS-232 Card AUTHOR: SSC Staff SUBJECT: Pocket-sized reference card RS-232 serial communications PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: 1990 PAGES: 8 ISBN: 0-916151-42-7 APPROX_COST: $3.00 KEYWORDS: RS-232, serial communications, reference card SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS Concise explanation of the RS-232 standard for serial communications. Includes signal descriptions, pinouts for both DB-25 and DB-9 connectors, null modem wiring and an ASCII code chart. TITLE: Recommended C Stype and Coding Standards AUTHOR: Keppel, David AUTHOR: ...others... SUBJECT: Revision of Indian Hill C Style paper PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: June, 1991 PAGES: 40 ISBN: 0-916151-46-8 APPROX_COST: $5.00 KEYWORDS: C language, programming style SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS Describes a recommended coding standard for C language programs. TITLE: sed & awk AUTHOR: Dougherty, Dale SUBJECT: Sed and awk programming PUBLISHER: O'Reilly and Associates DATE: 1990 PAGES: 414 ISBN: 0-937175-59-5 APPROX_COST: 27.95 KEYWORDS: sed, awk TITLE: sendmail AUTHOR: Costales, Bryan AUTHOR: Allman, Eric AUTHOR: Rickert, Neil SUBJECT: sendmail admin. PUBLISHER: O'Reilly & Associates DATE: 1993 PAGES: 792 ISBN: 1-56592-056-2 APPROX_COST: $32.95 KEYWORDS: sendmail, e-mail SUGGESTED_BY: Mitch Wright COMMENTS: It's been a long time waiting, but Bryan Costales has created an excellent and authoratative work on one of the most "magical" programs in UNIX. The black art of sendmail has been uncovered and it's mysteries (most of them) have been solved. With help from Eric Allman (creator of sendmail) and Neil Rickert this book covers not only the traditional Version 5.x of sendmail, but things like the new V8 and IDA sendmail. The book is well broken up and provides a tutorial, followed by an administration section, then a reference section, and finally (670 pages later) the appendices. TITLE: The SPARC System Developer's Guide AUTHOR: Leventhal, L. AUTHOR: Rohner, J. SUBJECT: SPARC Assemble Language PUBLISHER: Springer-Verlag DATE: 1989 PAGES: ISBN: 0-387-97251-X APPROX_COST: 39.95 KEYWORDS: SPARC TITLE: The Standard C Library AUTHOR: Plauger, P.J. SUBJECT: C Programming PUBLISHER: Prentice Hall DATE: 1990 PAGES: 498 ISBN: 0-13-131509-9 APPROX_COST: 28.00 KEYWORDS: C, libc, programming TITLE: A Student's Guide to UNIX AUTHOR: Hahn, Harley SUBJECT: UNIX PUBLISHER: McGraw-Hill DATE: 1993 PAGES: 633 ISBN: 0-07-025511-3 APPROX_COST: COMMENTS: Here is a book that will help you ramp up your UNIX expertise quickly. The book is organized well and takes an honest view of what is out there. Harley even tells you about MUD (p.430), but kindly warns you about it's effects on the graduation rate... I suppose the time I saved reading this book will allow me the time for a few minutes of studying... [This is the first book I have read that actually spells out the infamous RTFM -- in fine fashion I might add. Page 430 ~mitch] TITLE: Software Copyright Handbook AUTHOR: Joel B. Gilman SUBJECT: Step-by-step guide to obtaining a software copyright PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: June, 1991 (revised) PAGES: 29 ISBN: 0-916151-45-X APPROX_COST: $9.95 KEYWORDS: software copyrights SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS "Understandability: Almost Crystal Clear" and "Summary: A quick rundown of the simple requirements for gaining copyright protection." -- Walter Zintz, UNIX World, September, 1991 TITLE: Software Engineering in C. AUTHOR: Darnell, Peter A. AUTHOR: Margolis, Philip E. SUBJECT: C programming PUBLISHER: Springer-Verlag DATE: 1988 PAGES: 612 ISBN: 0-387-96574-2 APPROX_COST: 29.95 SUGGESTED_BY: srvarma@rodan.acs.syr.edu COMMENTS One of the finest books I have seen for beginners. Highly recommended even for intermediate-level C programmers. TITLE: Software Tools AUTHOR: Kernighan, Brian W. AUTHOR: Plauger, P. J. SUBJECT: How to write programs that make good tools. PUBLISHER: Addison-Wesley DATE: 1976 PAGES: 338 ISBN: 0-201-03669-X APPROX_COST: 20.00 KEYWORDS: programming, top-down design, software engineering. COMMENTS The language used is RATFOR but it looks enough like C to be used by anyone who knows or is learning C. The book purports to contain generic examples that might be on any system; the reader will recognise many similarities to UNIX. Several UNIX-like commands and features are discussed in detail. Many UNIX design considerations and philosophies are explained. TITLE: System Performance Tuning AUTHOR: Loukides, Mike SUBJECT: System Performance PUBLISHER: O'Reilly & Associates, Inc. DATE: 1991 PAGES: 336 ISBN: 0-937175-60-9 APPROX_COST: 24.95 KEYWORDS: performance, nutshell COMMENTS: *** From: ORA Fall/Winter 1990 Catalog System Performance Tuning answers one of the most fundamental questions you can ask abou your computer: "How can I get it to do more work without buying more hardware?" Anyone who has ever used a computer has periodically wished that the system was faster, particularly at times when it was under heavy load. TITLE: Software Portability with imake AUTHOR: DuBois, Paul SUBJECT: programming PUBLISHER: O'Reilly & Associates DATE: 1993 PAGES: 390 ISBN: 1-56592-055-4 APPROX_COST: $27.95 KEYWORDS: X, programming, make COMMENTS: From a marketing blurb: imake is a utility that works with make to enable code to be compilied and installed on different UNIX machines. This new nutshell handbook -- the only book available on imake -- is ideal for X and UNIX programmers who want their software to be portable. It includes a general explanation of imake, how to write and debug an Imakefile, and how to write configuration files. TITLE: The TCP/IP Companion: A Guide for the Common User AUTHOR: Arick, Martin R. SUBJECT: Using TCP/IP PUBLISHER: QED Publishing Group DATE: August 1993 PAGES: 263 ISBN: 0-89435-466-3 APPROX_COST: $29.95 KEYWORDS: TCP/IP INTERNET NETWORKING SUGGESTED BY: Rich O'Hanley, QED, 76620.2720@compuserve.com COMMENTS: Step-by-step instructions on how to use TCP/IP protocols: rlogin, telnet, rcp, rsh, tftp and smtp, ftp, mail, mount, and network services. TITLE: TCP/IP Network Administration AUTHOR: Hunt, Craig SUBJECT: TCP/IP Networking PUBLISHER: O'Reilly and Associates DATE: July 1992 PAGES: 502 ISBN: 0-937175-X APPROX_COST: $29.95 KEYWORDS: TCP, IP, Networking, Admin COMMENTS: A complete guide to setting up and running a TCP/IP network for practicing system administrators. Covers how to set up your network, how to configure important network applications including sendmail, and discusses troubleshooting and security. Covers BSD and System V TCP/IP implementations. TITLE: TCP/IP and Related Protocols AUTHOR: Black, Uyless SUBJECT: TCP/IP Networking PUBLISHER: McGraw Hill DATE: 1992 PAGES: ISBN: 0-07-005553-X SUGGESTED_BY: James Petts COMMENTS Chapter 1. TCP/IP and the Internet Chapter 2. Introduction to Betworks, Bridges, Gateways, and Routers Chapter 3. Naming, Addressing, and Routing in an Internet Chapter 4. The Domain Name System (DNS) Chapter 5. The Internet Protocol (IP) Chapter 6. Internet Control Message Protocol (ICMP) Chapter 7. Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) Chapter 8. Route Discover Protocols Chapter 9. The Major Application Layer Protocols Chapter 10. Other Protocols Chapter 11. Internet Network Management Systems Chapter 12. Operating TCP/IP with Other Protocols (and Other Protocols without TCP/IP) Chapter 13. TCP/IP and Operating Systems Chapter 14. Management Considerations A book written in an "advanced tutorial style", this gives a thorough and clear introduction to TCP/IP from a technical point of view, but also gives some emphasis to the place of TCP/IP in internetworking from an integration and management point of view. TITLE: The TeXbook AUTHOR: Knuth, Donald E. PUBLISHER: Addisson-Wesley DATE: 1989 PAGES: ISBN: 0-201-13448-9 APPROX_COST: <$$.cc> SUGGESTED_BY: "Diomidis Spinellis" COMMENTS The standard book on TeX. TITLE: Termcap & Terminfo, 3rd Edition AUTHOR: Strang, John AUTHOR: Mui, Linda AUTHOR: O'Reilly, Tim SUBJECT: Introduction PUBLISHER: O'Reilly & Associates, Inc. DATE: 1990 PAGES: 270 ISBN: 0-937175-22-6 APPROX_COST: 21.95 KEYWORDS: Nutshell Handbook SUPPLIERS E-mail: ... uunet!ora!nuts Phone#: 1-800-338-NUTS TITLE: Tricks of the UNIX Masters AUTHOR: Sage, Russel G. SUBJECT: Reference PUBLISHER: Howard Sams & Co DATE: 1987 PAGES: 400 ISBN: 0-672-22449-6. APPROX_COST: 24.95 COMMENTS a "must add" to your list of UNIX books. For about $20, you'll get a lot of nifty little tricks & tips you won't pick up unless you've got a good UNIX guru to coach you. The style is relaxed & aimed at a bit above the novice UNIX user (experienced programmer with sparse UNIX exposure). TITLE: Typesetting Tables on the UNIX System AUTHOR: McGilton, Henry AUTHOR: McNabb, Mary SUBJECT: Using the 'tbl' utility PUBLISHER: Trilithon Press, 334 State St., Ste. 106 Los Altos CA 94022 DATE: 1990 PAGES: 280 ISBN: 0-9626289-0-5 APPROX_COST: 24.95 KEYWORDS: Typesetting, tbl, troff COMMENTS -- From the back cover: Reviewers said: "You're a pair of lunatics!" -- James Gosling, Sun Micro "Good Grief!" -- Ken Greer, Elan Computer Group, Inc. "Three Hundred Pages on TBL?!?" -- Prof. Powell, U. Minn I (S.B.Bassett) rather agree, but I wish there were more lunatics like these two, who would do a thorough job of documenting the workings of various cryptic, arcane, and downright quirky UNIX utilities for the benefit of those of us without source . . . I actually enjoyed reading this -- Henry sent me a complimentary copy in the hopes that I would review it here (thanks, Henry, I did), and I figured out why I had so much trouble with 'tbl' on a former job -- I'd have paid several times the price for a copy of this 2 years ago. Too bad I'm not doing tech writing any more . . . ;^) TITLE: UNIX C Shell Desk Reference AUTHOR: Arick, Martin K. SUBJECT: UNIX C Shell PUBLISHER: QED Information Sciences DATE: 1991 PAGES: 220 ISBN: 0-89435-321-4 APPROX_COST: $29.95 KEYWORDS: C_Shell SUGGESTED_BY: R O'Hanley, 76620.2720@compuserve.com TITLE: The UNIX C Shell Field Guide AUTHOR: Anderson, Gail AUTHOR: Anderson, Paul SUBJECT: C-Shell Guide PUBLISHER: Prentice-Hall DATE: 1986 PAGES: 374 ISBN: 0-13-937468-X APPROX_COST: 31.00 KEYWORDS: C-shell, csh SUGGESTED_BY: "Michael J. Chinni, SMCAR-CCS-E" COMMENTS I have heard this called the C-Shell Bible. TITLE: UNIX Curses Explained AUTHOR: Goodheart, Berny SUBJECT: Complete Curses and Terminfo reference PUBLISHER: Prentice-Hall DATE: 1990 PAGES: 304 ISBN: 0-13-931957-3 SUGGESTED_BY: goodheart_berny@tandem.com KEYWORDS: Introduction, Overview, Curses COMMENTS This is a complete text and reference book on UNIX Curses. It provides C programmers and UNIX users with the expertise to create, install and debug, Curses written applications and terminfo description files using the UNIX System V.3 Operating System. Will enable any C programmer to create UNIX Curses or terminfo based programs. The text is based on UNIX System V.3 and refers to earlier releases where appropriate. In text examples on: using Curses; using Windows; color manipulation; using an alternative character set; pads; and terminfo. The book includes a full alphabetical reference section (120pp) documenting all curses functions from both past and present versions of the UNIX operating system. An appendix with terminfo reference tables for both the terminfo description designer and the C programmer. TITLE: The UNIX Industry: Evolution, Concepts, Architecture, Applications, and Standards AUTHOR: Dunphy, Edward P. SUBJECT: UNIX market analysis PUBLISHER: QED Information Sciences DATE: 1991 PAGES: 338 ISBN: 0-89435-390-X APPROX_COST: $34.95 SUGGESTED_BY: R O'Hanley, 76620.2720@compuserve.com TITLE: UNIX Network Programming AUTHOR: Stevens, W. Richard SUBJECT: UNIX Networking PUBLISHER: Prentice Hall DATE: 1990 PAGES: 772 ISBN: 0-13-949876-1 EDITION: 1990 APPROX_COST: 40.00 KEYWORDS: TCP/IP, XNS, SNA, NetBIOS, OSI, UUCP SUGGESTED_BY: Richard Stevens ... { uunet | yale } ! hsi ! stevens SUPPLIERS (201) 767-5937 for fewer than 20 copies (201) 592-2498 for corporate customers ordering 20 or more (201) 767-5994 for Government orders COMMENTS -- From back cover As networking software becomes increasingly importat in today's world, a book that teaches programmers how to write and how better to use this technology has finally arrived. ... is unique because it includes numerous case studies of real network applications, as well as approximately 15,000 lines of C source code, take directly from their source files, to help further understanding of networking software. [ Source is available for anon. ftp at uunet.uu.net ~mitch ] TITLE: UNIX Networking AUTHOR: Kochan, Stephen G. AUTHOR: Wood, Patrick H. SUBJECT: UNIX Networking PUBLISHER: Hayden Books DATE: 1989 PAGES: 400 ISBN: 0-672-48440-4 APPROX_COST: 29.95 KEYWORDS: Networking, TCP, NFS SUGGESTED_BY: Frank W. Peters COMMENTS An excellent book covering UUCP, TCP/IP, NFS, RPC, Streams, OSI, RFS, X11 and NeWS (Sun's postscript based graphical protocol). Each chapter serves as an excellent programmers introduction to the topic discussed." TITLE: UNIX Papers for UNIX Developers & Power Users AUTHOR: The Waite Group Editors - edited by Mitchell Waite SUBJECT: UNIX Reference PUBLISHER: Howard W. Sams & Co DATE: 1987 PAGES: 518 ISBN: 0-672-22578-6 APPROX_COST: 26.95 COMMENTS This is a collection of papers. Some of the them are introductions and others cover more arcane bits of knowledge. TITLE: UNIX Power Tools AUTHOR: Peek, Jerry AUTHOR: Loukides, Mike AUTHOR: O'Reilly, Tim AUTHOR: "other contributors" SUBJECT: UNIX PUBLISHER: O'Reilly & Associates DATE: 1993 PAGES: 1,162 ISBN: 0-553-35402-7 APPROX_COST: $59.95 (w/ CD) KEYWORDS: CD, UNIX, "Arr, Arr, Arr" SUGGESTED_BY: Mitch Wright COMMENTS: Hey! It's "tool time". You need a book with "more power"? Well, this is the one -- Arr, Arr, Arr. No need for Al to help out on with using this tool. This book is made for *power*. It has 1100+ pages firmly planted on a layflat binding (arr, arr, arr)... real paper pages filled with high levels of toner for maximum power in those learning curves (arr, arr, arr, arr). It even comes equipped with a CD (AM/FM radio and player not included!). TITLE: UNIX time-sharing system : UNIX programmer's manual vol 1&2 AUTHOR: BELL Laboratories PUBLISHERS: Holt, Rinehart and Winston SUBJECT: UNIX... PUBLISHER: Bell Laboratories DATE: 1983 PAGES: ISBN: 0-03-061742-1 (v1) ISBN: 0-03-061742-X (v2) APPROX_COST: TITLE: The UNIX Programming Environment AUTHOR: Kernighan, Brian W. AUTHOR: Pike, Rob SUBJECT: Basic UNIX Programming PUBLISHER: Prentice-Hall YEAR: 1984 PAGES: 357 ISBN: 0-13-937699-2 HBK ISBN: 0-13-937681-X PBK APPROX_COST: 25.95 SUGGESTED_BY: *Everyone* COMMENTS This book is what I call a classic. Just buy it. A good programmer's introduction. TITLE: UNIX SVR4, The Complete Reference AUTHOR: Coffin, Stephen SUBJECT: UNIX Reference PUBLISHER: Osborne-McGraw Hill DATE: 1990 PAGES: 882 ISBN: 0-07-881653-X APPROX_COST: 29.95 SUGGESTED_BY: S.Coffin COMMENTS An update, revision, expansion, and overall improvement of the best-selling UNIX, The Complete Reference (ISBN 0-07-881299-2). Written especially for SVR4. New chapters on csh and ksh, troff, NFS and networking, and X Window System, as well as wholesale revision of many other chapters. Well-written, readable, complete; but does not cover UNIX internals or software development. TITLE: UNIX System 5 (Bourne) Shell Tutorial AUTHOR: SSC Staff SUBJECT: Pocket-sized tutorial card on the System 5 shell PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: 1990 PAGES: 48 ISBN: 0-916151-39-5 APPROX_COST: $6.00 KEYWORDS: shell programming, pocket tutorial SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS Tutorial on the use of the shell. Covers the shell as a command interpreter and as a programming language. Includes a reference section and a summary of commonly used commands. TITLE: UNIX V.4 C Library Reference AUTHOR: SSC Staff SUBJECT: Pocket reference on C library functions of SVR4 PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: June, 1991 PAGES: 80 ISBN: 0-916151-47-6 APPROX_COST: $8.00 KEYWORDS: C library, ANSI C library, pocket reference SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS Documents the functions and system calls available to the C programming using UNIX System V, Release 4. ANSI prototypes are used to illustrate the calling conventions of the functions. Functions that are part of the ANSI standard library are flagged. Designed to complement the SSC ANSI C card. TITLE: UNIX System V.4 Command Summary AUTHOR: SSC Staff SUBJECT: Pocket-sized book listing SVR4 commands PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: December, 1990 PAGES: 80 ISBN: 0-916151-44-1 APPROX_COST: $8.00 KEYWORDS: UNIX SVR4, commands, pocket reference SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS Includes commands, options and explanations as well as special sections on awk/nawk, sed, ftp, sdb and telnet. TITLE: UNIX System 5.2/5.3 Command Summary AUTHOR: SSC Staff SUBJECT: Pocket-sized book listing UNIX Systems 5.2 and 5.3 commands PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: 1989 (revised) PAGES: 56 ISBN: 0-916151-23-9 APPROX_COST: $6.00 KEYWORDS: UNIX system V, commands, pocket reference SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS Includes commands, options and explanations as well as special sections on awk and sdb. TITLE: UNIX Shell Programming AUTHOR: Kochan, Stephen G. AUTHOR: Wood, Patrick H. SUBJECT: Shell Programming PUBLISHER: Hayden Book Company DATE: 1985 PAGES: 442 ISBN: 0-8104-6309-1 APPROX_COST: 24.95 KEYWORDS: Bourne Shell, sh COMMENTS I own this book, but I rarely crack it open. I guess the main reason is that I am still a Bourne-again shell user. For years I worked with a variety of systems where one might find csh and/or ksh. However, /bin/sh was the only common denominator. I find that most often I refer to Kernighan and Pike for shell programming questions. However, they don't address the C Shell (csh) or Korn Shell (ksh). This book does offer a chapter on each. In addition, this book may be more suited for a beginner than an experienced UNIX programmer. TITLE: UNIX System Administration Handbook AUTHOR: Nemeth, Evi AUTHOR: Snyder, Garth AUTHOR: Seebass, Scott SUBJECT: System Administration PUBLISHER: Prentice Hall ISBN: 0-13-933441-6 DATE: 1989 PAGES: 593 APPROX_COST: 32.00 KEYWORDS: SunOS, BSD, Administration SUGGESTED_BY: Michael S. Cross COMMENTS { I'm recommending it for all of the people who get workstations from us, and for all of the User Services people here -- an added plus is that the programs listed are available by anonymous ftp from the authors' home system. S.B.Bassett } The book does a pretty good job of explaining the differences between the types of UNIX(R) systems and administering them. It's also on the light or humorous side which is a definite plus. TITLE: UNIX System Command Summary for SVR4/Solaris 2.1 AUTHOR: SSC SUBJECT: UNIX: Solaris 2.x PUBLISHER: SCC Inc. DATE: 1992 PAGES: 159 ISBN: 0-916151-61-1 APPROX_COST: 10.00 KEYWORDS: Solaris, SVR4 COMMENTS: Pocket reference? Pocket Book! Here is alot of information concisely placed in a pocket sized book and easy on the pocket book. It is jam packed with information ranging from your favorite options to adb, through NIS+, and on to vgrind and yacc. It has alot of "pkginfo(1)"... TITLE: UNIX System Programming AUTHOR: Haviland, Keith AUTHOR: Salama, Ben SUBJECT: Programming PUBLISHER: Addison-Wesley DATE: 1987 PAGES: 339 ISBN: 0-201-12919-1 APPROX_COST: 27.95 COMMENTS Concentrates on the UNIX System call interface. TITLE: UNIX System Security AUTHOR: Wood, Patrick H. AUTHOR: Kochan, Stephen G. SUBJECT: UNIX Security PUBLISHER: Hayden Book Company DATE: 1985 PAGES: 299 ISBN: 0-8104-6267-2 APPROX_COST: 34.95 KEYWORDS: Security SUGGESTED_BY: Mitch Wright COMMENTS -- From back cover Here is a practical guide to computer security on the UNIX system for the user, administrator, or potential UNIX system buyer. It will teach you everything you need to know ot make your system secure and keep it that way. Topics covered include: - file and directory permissions - password security - how the setuid/gid permissions work and how to use them - how the various security-related UNIX commands and functions work - how to write secure programs - different methods of data encryption -- including the government standard DES algorithm -- and how secure they are - data encryption over communication networks - how to discover and plug potential security holes in your system - how to periodically monitor your system to maintain security Also included is the complete source for several security auditing and administration programs. TITLE: UNIX System V Bible AUTHOR: Prata, Stephen AUTHOR: Martin, Donald AUTHOR: The Waite Group SUBJECT: SYSV Reference PUBLISHER: Howard Sams & Company DATE: 1987 PAGES: 516 ISBN: 0-672-22562-X APPROX_COST: 24.95 COMMENTS This is a comprehenisve reference for programmers working with the UNIX operating system documentation, covering intermediate to advanced level programming for professionals who have prior experience programming in C or using UNIX. TITLE: The UNIX System V Environment AUTHOR: Bourne, Steven R. SUBJECT: Users Guide PUBLISHER: Addison-Wesley DATE: 1987 PAGES: 378 ISBN: 0-201-18484-2 APPROX_COST: 26.95 SUGGESTED_BY: Steen Hammerum COMMENTS Steen Hammerum Department of Chemistry, University of Copenhagen says: "has been _very_ useful to me (proof: I'm on my second copy)" TITLE: UNIX System: Readings and Applications AUTHOR: AT&T SUBJECT: Reference PUBLISHER: Prentice-Hall DATE: 1987 PAGES: ISBN: 013-938532-0 (v1) ISBN: 013-939845-7 (v2) APPROX_COST: 19.00 each COMMENTS Vol 1: UNIX Time-Sharing System Vol.2: The UNIX System These two volumes are reprints of the two volumes of the Bell Labs Technical Journal (now AT&T Tech J.) that were devoted to UNIX: Vol. 57, No. 6, Part 2, July-August, 1987, and Vol. 63, No. 8, October, 1984. TITLE: Unix System Security AUTHOR: Rik Farrow SUBJECT: UNIX security PUBLISHER: Addison-Wesley DATE: 1991 PAGES: 278 ISBN: 0-201-57030-0 APPROX_COST: 22.95 KEYWORDS: Security COMMENTS: Farrow is editor-at-large for UNIXWorld magazine and also wrote "Unix administration guide for System V". This book is well-done, containing lots of examples of how to break and fix Unix security, although a lot of it seems to be a rehash of material that's been printed before. It's a worthwhile addition to any Unix system admin's library. TITLE: Unix System Security - A Guide for Users and System Administrators AUTHOR: Curry, David SUBJECT: Security PUBLISHER: Addison Wesley DATE: 1992 PAGES: ISBN: 0-201-56327-4 APPROX_COST: KEYWORDS: UNIX security SUGGESTED_BY: Rob Slade COMMENTS What do you say about a computer security book that has a picture of a cute little cartoon devil on the cover? Well, in this case, the cover hides a competent and fairly thorough treatment of security on UNIX systems. Nothing terribly surprising, but a step-by-step exploration of the various aspects of UNIX security, potential threats, and suggestions to reduce the level of vulnerability. The subtitle explains that the book is "A Guide for Users and System Administrators" and the preface further provides that the attempt has been made to provide sufficient information that administrators can protect their systems, while not giving away details that can help crackers. By and large the book succeeds. The book is clear and simple enough that users (intelligent ones, anyway) should be able to understand the concepts and need for security. System administrators will find a fairly comprehensive overview of the topic. (Some areas, such as the reading list, could use a bit more material, but there is, at least, a "good start".) "Crackers" may find some help (such as the password cracking program), but definitely won't be able to use this as a "cookbook". copyright Robert M. Slade, 1993 BKCURRY.RVW 930802 TITLE: UNIX Text Processing AUTHOR: Dougherty, Dale AUTHOR: O'Reilly, Tim SUBJECT: Text Processing PUBLISHER: Hayden Books DATE: 1987 PAGES: 665 ISBN: 0-672-46291-5 APPROX_COST: 26.95 SUGGESTED_BY: Mitch Wright COMMENTS This is a MUST for all [nt]roff users. TITLE: The UNIX Text Processing System AUTHOR: Christian, Kaare SUBJECT: Text Processing PUBLISHER: John Wiley & Sons, Inc. DATE: 1987 PAGES: 250 ISBN: 0-471-85581-2 APPROX_COST: 24.95 SUGGESTED_BY: "Michael J. Chinni, SMCAR-CCS-E" COMMENTS I have found this to be a very good guide to nroff, and the -mm macros. It also covers the -ms macros, vi, eqn, tbl, refer, and pic TITLE: UNIX for Super-Users AUTHOR: Foxley, Eric SUBJECT: Users Guide PUBLISHER: Addison-Wesley DATE: 1985 PAGES: 213 ISBN: 0-201-14228-7 APPROX_COST: 27.95 KEYWORDS: SYSV TITLE: UNIX for the impatient AUTHOR: Abrahams, Paul W. AUTHOR: Larson, Bruce A. SUBJECT: UNIX, patience PUBLISHER: Addison Wesley DATE: 1992 PAGES: 559 ISBN: 0-201-55703-7 APPROX_COST: $26.95 KEYWORDS: UNIX, Shell, X, Intro SUGGESTED_BY: Lawrence P. O'Keefe, COMMENTS: From the preface: "... an in-depth, comprehensive guide to UNIX - a handbook you can use both as a manual to learn UNIX and as a ready reference for fast answers to specific UNIX questions" Chapters: Introduction Concepts Basic operations on files Utility programs Shells Standard editors The GNU Emacs editor Data manipulation using filters Sending and receiving mail Communicating with remote computers The X window system Appendices: Alphabetical summary of commands Comparison of MS-DOS and UNIX Resources Glossary Lawrence says: ``I find the book very useful, particularly the command summary and the section on filters.'' TITLE: UNIX in a Nutshell (BSD) AUTHOR: SUBJECT: Introduction PUBLISHER: O'Reilly & Associates, Inc. DATE: 1987 PAGES: 272 ISBN: 0-937175-20-X APPROX_COST: 19.50 KEYWORDS: Nutshell Handbook TITLE: UNIX in a Nutshell (System V) AUTHOR: SUBJECT: Introduction PUBLISHER: O'Reilly & Associates, Inc. DATE: 1987 PAGES: 296 ISBN: 0-937175-19-6 APPROX_COST: 19.50 KEYWORDS: Nutshell Handbook TITLE: UNIX in a Nutshell: Desktop Quick Reference for SV & Solaris 2.0 AUTHOR: Gilly, Daniel AUTHOR: ORA Staff SUBJECT: UNIX PUBLISHER: O'Reilly and Associates DATE: June 1992 PAGES: 444 ISBN: 1-56592-001-5 APPROX_COST: $9.95 KEYWORDS: UNIX, Solaris, SVR4 You may have seen UNIX quick reference guides, but you've never seen anything like UNIX in a Nutshell. Not a scaled-down quick-reference of common commands, UNIX in a Nutshell is a complete reference containing all commands and options, along with generous descriptions and examples that put the commands in context. For all but the thorniest UNIX problems this one reference should be all the documentation you need. Covers System V Releases 3 and 4 and Solaris 2.0. TITLE: UNIX, The Complete Reference AUTHOR: Coffin, Stephen SUBJECT: UNIX Reference PUBLISHER: Osborne-McGraw Hill DATE: 1988 PAGES: 704 ISBN: 0-07-881299-2 APPROX_COST: 24.95 COMMENTS An inexpensive reference and guide to System V in a style familiar to those from the micro world where OMH and QUE have many best selling guides to Lotus, DOS, Word, etc. TITLE: Understanding and Using COFF AUTHOR: Gircys, Gintaras R. SUBJECT: Introduction PUBLISHER: O'Reilly & Associates, Inc. DATE: 1988 PAGES: 196 ISBN: 0-937175-31-5 APPROX_COST: 21.95 KEYWORDS: Nutshell Handbook SUGGESTED_BY: Mitch Wright COMMENTS -- From back cover This handbook explains the COFF data structure and its manipulation. Contents include: - The basics of COFF - Assembley code relocation process - COFF file headers - Relocation structures - The linking process - The COFF system in UNIX - Magic numbers - The COFF symbolic debug system - COFF and shared libraries - Utilities and techniques for working with COFF files - A sample program to manipulate COFF [ Source used in this book is available via ftp from UUNET ~mitch ] TITLE: Unix Administrations Guide for System V AUTHOR: Thomas, Rebecca AUTHOR: Farrow, Rik SUBJECT: System Administration PUBLISHER: Prentice-Hall DATE: 1989 PAGES: 636 ISBN: 0-139-42889-5 APPROX_COST: 34.95 SUGGESTED_BY: Lars Tunkrans COMMENTS Bought this book last week, seems to me to be the most comprehensive and fact-packed book on the subject I've ever seen. TITLE: UNIX Applications Programming Mastering the Shell AUTHOR: Swartz, Ray SUBJECT: Bourne Shell programming, grep, sed, awk, sort PUBLISHER: SAMS, A Division of Macmillan Computer Publishing DATE: 1990 PAGES: 452 ISBN: 0-672-22715-0 LCCN: 90-61476 APPROX_COST: 26.95 KEYWORDS: Unix, Bourne shell programming, tools SUGGESTED_BY: zwbm07@hou.amoco.com (Walter Moore) COMMENTS I find this book a VERY good primer and an excellent reference book on Unix tools and shell programming. TITLE: The Unix Command Reference Guide AUTHOR: Christian, Kaare SUBJECT: Topically organized reference for about 50 Unix commands PUBLISHER: John Wiley & Sons, Inc. DATE: 1988 PAGES: 361 ISBN: 0-471-85580-4 PBK APPROX_COST: 24.95 COMMENTS This book is a guide to the most useful Unix commands, organized topically. It is used both as a handy reference, and as a quick start guide for technically adept users who are starting to use the Unix system. The book contains comprehensive sections on awk, sed, vi, and the Bourne shell. There are many examples. TITLE: Unix Communications AUTHOR: Anderson, Bart AUTHOR: Costales, Barry AUTHOR: Henderson, Harry SUBJECT: Communication Reference PUBLISHER: The Waite Group DATE: 1991 PAGES: 736 ISBN: 0-672-22773-8 APPROX_COST: 29.95 KEYWORDS: UUCP, USENET COMMENTS Covers everything the end user needs to know about email, USENET and UUCP. TITLE: The Unix Environment AUTHOR: Walker, A. N. SUBJECT: UNIX PUBLISHER: John Wiley & Sons DATE: 1984 PAGES: 151 ISBN: 0-471-90564-X APPROX_COST: 20.40 COMMENTS An excellent user's introduction. I have a special affection for this book, as it introduced me to the plural forms VAXen and Unices. TITLE: The Unix Operating System, Second Edition AUTHOR: Christian, Kaare SUBJECT: Comprehensive introduction to Unix PUBLISHER: John Wiley & Sons, Inc. DATE: 1988 PAGES: 455 ISBN: 0-471-84782-8 HBK ISBN: 0-471-84781-X PBK APPROX_COST: 24.95 COMMENTS This is the second edition of a widely used, widely translated primeval Unix book. It is a comprehensive introductory book that goes into more detail than most. While it is not a very good introduction for people who will only use the system superficially, it is an excellent introduction for those who plan to master the Unix system. It includes sections on the most useful utilities, shell programming, vi editing, and system internals. TITLE: Unix Power Utilities for Power Users AUTHOR: Muster, John AUTHOR: Birns, Peter SUBJECT: Introduction to UNIX PUBLISHER: MIS Press DATE: 1989 PAGES: 420 ISBN: 1-55828-000-6 APPROX_COST: 24.95 COMMENTS ** From Page 2... Overview of Contents If you have the ability to log on the system, create, move, copy and remove files, create and change directories, and issue basic shell commands, you will be able to complete the exercises in these modules. If you are more experienced, you may be able to proceed quickly through part or all of Modules 2 and 3, and the introductory steps to several of the other modules. TITLE: The UNIX Survival Guide AUTHOR: Nichols, Elizabeth A. AUTHOR: Balin, Sidney C. AUTHOR: Nichols, Joseph C. SUBJECT: Introduction to UNIX basics PUBLISHER: Holt, Rinehart & Winston DATE: 1987 PAGES: 311 ISBN: 0-03-000773-9 SUGGESTED_BY: Andrew T. Young COMMENTS: It contains good tutorial information for new owners of UNIX systems, as well as for new users. There is a useful introduction to the nuts and bolts of the file system, for example, as well as info on basic commands, and a chapter on processes and signals. TITLE: Unix System Administration AUTHOR: Fiedler, David AUTHOR: Hunter, Bruce H. SUBJECT: System Administration PUBLISHER: Hayden Books (Howard Sams & Co) DATE: 1986 PAGES: 320 ISBN: 0-8104-6289-3 APPROX_COST: 24.94 KEYWORDS: Administration COMMENTS -- From back cover -- An essential guide for anyone who owns or operates a UNIX system. The clear presentation and easy-to-follow style make it suitable for the user who does not have a technical background. [...] Using step-by-step guidelines for complex procedures, the book includes information on: - making back-ups - configuring systems - writing shell programs - connecting a printer, a terminal, and other devices - communicating with other systems TITLE: UNIX System V, Release 4 Administration AUTHOR: Fiedler, David AUTHOR: Hunter, Bruce H. SUBJECT: System Administration PUBLISHER: Hayden Books DATE: 1992 PAGES: 436 ISBN: 0-672-22810-6 APPROX_COST: 29.95 KEYWORDS: Administration, SVR4 COMMENTS -- From back cover -- UNIX(r) Sytem V Release 4 Administration, Second Editoin, starts with a quick overview and shows you how to set up file systems, add and remove users, and improve the security of your UNIX system. Explicit troubleshooting charts help you find and solve typical system problems, including those that invade networks. This updated edition also presents expert UNIX coverage of mail and news systems, workstations, X terminals, and PCs. You'll also find timesaving, ready-to-run programs so that you can administrate your system with ease. TITLE: Unix for People AUTHOR: Birns, Peter M. AUTHOR: Brown, Patrick B. AUTHOR: Muster, John C. SUBJECT: Introduction PUBLISHER: Prentice-Hall DATE: 1985 PAGES: 528 ISBN: 0-13-937442-6 PBK ISBN: 0-13-937459-0 HBK APPROX_COST: 28.00 TITLE: Using the UNIX system AUTHOR: Gauthier, Richard L. SUBJECT: Introduction to UNIX PUBLISHER: DATE: 1981 PAGES: 297 ISBN: 0-8359-8164-9 HBK ISBN: 0-8359-8162-2 PBK COMMENTS Introductory level book, extremely basic and easy reading. I read this on a plane trip between Newark, NJ and Columbus, OH before I ever worked seriously with UNIX. Unlike, Rebecca Thomas and Jean Yates Tutorial style book this one does not require you to be sitting down in front of a crt in order to derive benefit from it. TITLE: Using C on the UNIX system AUTHOR: Curry, David A. SUBJECT: C programming PUBLISHER: O'Reilly & Associates, Inc. DATE: 1989 PAGES: 250 ISBN: 0-937175-23-4 APPROX_COST: 24.95 KEYWORDS: C, UNIX SUGGESTED_BY: Mitch Wright SUPPLIERS E-mail: ... uunet!ora!nuts Phone#: 1-800-338-NUTS COMMENTS This is a must for the Beginning UNIX programmer. TITLE: Using C with Curses, Lex and YACC AUTHOR: Schreiner, Axel T. SUBJECT: Programming PUBLISHER: Prentice-Hall DATE: 1990 PAGES: 257 ISBN: 0-13-932864-5 APPROX_COST: 44.95 KEYWORDS: C, Curses, Lex, YACC COMMENTS: -- From back cover -- This book presents the development of programs that make extensive use of curses and provides solutions to the typical problems encountered when implementing full-screen applications with curses. The book illustrates how to work in the Unix C environment: - how to build command languages with the compiler generatores lex and yacc - how to make portable full-screen dialogs with the curses library - how to build symbol tables and manage variable-length argument lists using C library functions - how to manage program development with the make program - how to manage multiple processes from a program and how to communicate with them. Throughout the book the full source code of a major example is shown. TITLE: Using UUCP and USENET AUTHOR: Todino, Grace AUTHOR: Dougherty, Dale SUBJECT: Introduction PUBLISHER: O'Reilly & Associates, Inc. DATE: 1990 PAGES: 210 ISBN: 0-937175-10-2 APPROX_COST: 21.95 KEYWORDS: Nutshell Handbook SUGGESTED_BY: Mitch Wright TITLE: UNIX for FORTRAN Programmers AUTHOR: Loukides, Mike SUBJECT: UNIX DATE: PUBLISHER: O'Reilly and Associates PAGES: 264 ISBN: 0-937175-51-X APPROX_COST: 24.95 COMMENTS This handbook minimizes the UNIX entry barrier, by providing the serious scientific programmer with an introduction to the UNIX operating system and its tools. Assumes some knowledge of FORTRAN, but none of UNIX nor C. TITLE: UNIX/Xenix Text Processing Reference AUTHOR: SSC Staff SUBJECT: Pocket-sized reference card on nroff, troff, tbl, eqn and mm macros PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: 1987 PAGES: 33 ISBN: 0-916151-22-0 APPROX_COST: $6.00 KEYWORDS: troff, nroff, tbl, eqn, mm, text processing, pocket reference SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com TITLE: VI Reference AUTHOR: SSC Staff SUBJECT: Pocket-sized reference card on the VI editor PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: January, 1991 (revised) PAGES: 10 ISBN: 0-916151-41-7 APPROX_COST: $3.00 KEYWORDS: vi, pocket reference, UNIX SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS First published in 1984, updated regularly since then TITLE: VI Tutorial AUTHOR: Frazier, Belinda SUBJECT: Pocket-sized tutorial on the VI editor PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: January, 1992 (revised) PAGES: 56 ISBN: 0-916151-54-9 APPROX_COST: $6.00 KEYWORDS: vi, pocket tutorial, UNIX SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS Complements the SSC VI Reference TITLE: The Whole Internet User's Guide & Catalog AUTHOR: Krol, Ed SUBJECT: Use of the Internet PUBLISHER: O'Reilly and Associates DATE: September 1992 PAGES: 397 ISBN: 1-56592-025-2 APPROX_COST: $24.95 KEYWORDS: Internet, Archie, WAIS, Gopher SUGGESTED_BY: Mitch Wright COMMENTS [taken from ORA literature] A comprehensive introduction to the Internet, the international network that includes virtually every major computer site in the world. The Internet is a resource of almost unimaginable wealth. In addition to electronic mail and news services, thousands of public archives, databases, and other special services are available: everything from space flight announcements to ski reports. This book is a comprehensive introduction to what's available and how to find it. In addition to electronic mail, file transfer, remote login, and network news, The Whole Internet User's Guide pays special attention to some new tools for helping you find information. Whether you're a researcher, a student, or just someone who likes electronic mail, this book will help you to explore what's possible. Also includes a pull-out quick-reference card. Be sure to see page 294! :-) TITLE: Writing a Unix Device Driver AUTHOR: Egan, Janet I. AUTHOR: Teixeira, Thomas J. SUBJECT: Programming PUBLISHER: John Wiley & Sons. DATE: 1988 PAGES: 357 ISBN: 0-471-62811-5, paperback: 0-471-62859-X APPROX_COST: 24.95 KEYWORDS: BSD, Xenix TITLE: X Window System Administrator's Guide AUTHOR: Mui, Linda AUTHOR: Pearce, Eric SUBJECT: X, Admin PUBLISHER: O'Reilly & Associates DATE: October 1992 PAGES: 372 ISBN: 0-937175-83-8 APPROX_COST: 29.95 KEYWORDS: X11R4, X11R5 COMMENTS: Ever wonder what is involved in setting up and maintaining X. Wonder no more... buy this book! TITLE: The X Window System in a Nutshell AUTHOR: Cutler, Ellie AUTHOR: Gilly, Daniel AUTHOR: O'Reilly, Tim PUBLISHER: O'Reilly & Associates DATE: 1993 PAGES: 424 ISBN: 1-56592-017-1 APPROX_COST: 9.95 KEYWORDS: X COMMENTS: From ORA mailing We have lowered the price of this book to $9.95 from $24.95. It contains essential information in a boiled-down quick-reference format that makes it easy to find the answers needed most often: - Command line options and resources for the standard MIT X clients. - Calling sequence for all Xlib and Xt functions and macros. - Detailed description of structures, enums, and other X data types used as arguments or return values in Xlib or Xt functions. - Description of the code inside a basic widget. - Quick reference to the event structures. - Font name syntax, color names, resource file and translations table syntax, and cursors. - Xlib and Xt error messages. The descriptions of the functions have been expanded and clarified, with improved cross-referencing to important related functions. Includes material on Xcms and the internationalization features of R5. TITLE: X Window System User's Guide AUTHOR: Quercia, Valerie AUTHOR: O'Reilly, Tim SUBJECT: X PUBLISHER: O'Reilly & Associates DATE: May 1993 PAGES: 752 ISBN: 1-56592-014-7 APPROX_COST: 34.95 KEYWORDS: X11R5 COMMENTS: X is just too darn configurable. And why does the client/server seem so strange. This book will help you wrestle with those concepts and help you create a usable X environment. It is also an excellent guide for admins -- just point to it on your desk when some user comes up to you and asks ``how do I...'' TITLE: The Xenix Command Reference Guide AUTHOR: Christian, Kaare AUTHOR: Richter, Susan SUBJECT: Topically organized reference for about 50 Xenix commands PUBLISHER: John Wiley & Sons, Inc. DATE: 1988 PAGES: 420 ISBN: 0-471-61707-5 (pbk) APPROX_COST: 24.95 COMMENTS This book is a guide to the most useful Xenix commands, organized topically. It is used both as a handy reference, and as a quick start guide for technically adept users who are starting to use the Xenix system. The book contains comprehensive sections on awk, sed, vi, the Bourne shell, and system administration. There are many examples. TITLE: Xenix System V Command Summary AUTHOR: SSC Staff SUBJECT: Pocket-sized book listing SCO Xenix System V commands PUBLISHER: SSC (Specialized Systems Consultants, Inc.) DATE: 1989 PAGES: 60 ISBN: 0-916151-35-2 APPROX_COST: $6.00 KEYWORDS: vi, pocket reference SUGGESTED_BY: Phil Hughes fyl@ssc.wa.com COMMENTS Includes commands, options and explanations as well as special sections on awk, C Shell and sdb. TITLE: The Z-Mail Handbook: 3 Interfaces for E-mail AUTHOR: Nelson, Hanna SUBJECT: Electronic mail PUBLISHER: O'Reilly and Associates DATE: PAGES: 462 ISBN: 0-937175-76-5 APPROX_COST: 29.95 KEYWORDS: E-mail, Z-mail, mush SUGGESTED_BY: COMMENTS: Z-Mail is a superset of the widely-used public-domain program, Mush. Z-Mail runs on UNIX terminals or on graphic workstations running the X Window System, and even supports multimedia attachments (so you can mail anything that you can store on disk). This is the complete guide to this powerful mail program. Also covers Mush. TITLE: Zen and the Art of the Internet, A Beginner's Guide AUTHOR: Kehoe, Brendan P. SUBJECT: networking PUBLISHER: DATE: 1992 PAGES: 113 ISBN: APPROX_COST: $22.00 KEYWORDS: network, internet COMMENTS: A fun introduction and quick-access reference for once and future travelers on the Internet. This complete guide covers searching databases, sending and receiving e-mail, accessing Usenet news, remote and commercial information services, using the FTP, and much more. TITLE: ** Publishers ** SUBJECT: Suppliers COMMENTS >> Tell 'em Mitch sent ya. :-) ---------------------------------------------------------- Addison-Wesley Publishing Co. 1 Jacob Way Reading, MA 01867-9984 800-527-5210 617-944-3700 5851 Guion Road Indianapolis, IN 46254 800-447-2226 ---------------------------------------------------------- O'Reilly and Associates 103 Morris Street, Suite A Sebastopol, CA 95472 ** (800) 998-9938 ** Local/Overseas: 1-707-829-0515 (7am-5pm PST) FAX: (707) 829-0104 E-mail: nuts@ora.com uunet!ora!nuts Gopher: gopher.ora.com WWW users can use the following http addr: "gopher://gopher.ora.com" ---------------------------------------------------------- SSC P.O. Box 55549 Seattle, WA 98155 (206) FOR-UNIX / (206)527-3385 FAX: (206) 527-2806 E-mail: sales@ssc.wa.com ---------------------------------------------------------- QED Publishing Group PO Box 812070 Wellesley, MA 02181-0013 tel: 617-237-5656-, 800-343-4848 fax: 627-235-0826 e-mail: 76620.2720@compuserve.com ---------------------------------------------------------- As a note, I'm only including publisher names, addresses, ... IFF they have a phone number or E-mail address for ordering. Local Variables: mode: outline selective-display-ellipses: nil outline-regexp: "TITLE: " eval: (hide-body) End: c_cpp_reference-2.0.2/reference/C/CONTRIB/YABL/Makefile.am0000644000076400001440000000013507055333630016304 EXTRA_DIST = yabl docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/CONTRIB/YABL/Makefile.in0000644000076400001440000002347507474405126016336 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = yabl docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/CONTRIB/YABL mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/CONTRIB/YABL/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/YABL/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/YABL/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = ../../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/YABL/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/YABL/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/0000777000076400001440000000000007474405214014724 5c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/c-lesson.10000755000076400001440000001500107055334442016444 This archive contains a complete course for you to learn the 'C' computer language itself. The language used is correct conversational English, I have written the lessons using the same language constructions which I would use if I were teaching you directly. An outline of the course is available for you to read below The course is intended to demonstrate the language itself and a selection of the simpler standard library functions. I have assumed that you have had sufficient exposure to computing to be able to use a programmer's editor of your choice and are confident in the use of the command line interpreter, whether it be a unix shell, or a DOS ( shudder :-) prompt. Some knowledge, of computers and the jargon is assumed, but complicated concepts are fully explained. In other words the intent is to teach 'C' per se, not 'the fundamentals of how to program a computer using 'C' as a teaching medium.' 'C' is not a computer language for rank beginners. Start with an interpretive language and proceed to a compiled language which has an extensive error message vocabulary and run-time checking facilities. In the interests of speed of execution 'C' does very little to protect you from yourself! Throughout the course the fact that a compiler is a translater from a high level language to assembler code is kept to the fore, you are frequently advised to examine the assembler code which is output by the compiler. Some minimal knowledge of computer architecture is therefore assumed. Whilst I have taken considerable care to ensure that this material is free of errors I am well aware that to err is a common human failing, and in this I don't claim to be different from anybody else. Therefore your gentle critique is welcome together with notification of any factual errors. It is planned to make the lessons available as a printed book, complete with a programme diskette if there is sufficient interest. Syllabus for the 'C' Language Course. 1 a) Historical introduction to the Language. b) Demonstration of a very simple program. c) Brief explanation of how the computer turns your program text into an executing program. d) The basic differences between 'C' and other languages. The advantages and disadvantages. We make the assumption that you are able to turn on your machine, use the Operating System at the Control Line Interpreter prompt "$ ", "c:>" or whatever, and to use an editor to enter program text. 2 a) How the 'C' language arranges for the storage of data. An explanation of the keywords associated with data. The storage classes:- static auto volatile const. The variable types:- char int long float double The meaning of:- signed unsigned b) Introduction to the concept of pointers. c) Explanation of reading from the keyboard and writing to the screen. i.e. printf and scanf, the print formatted and scan formatted functions. d) The use of arguments to the main() function, argc argv env. e) A simple program to format text. 3 Structures, arrays and pointers. a) Explanation of more coplex data structures. b) Programs which demonstrate uses of pointers. 4 The operators of the language, arithmetic, pointer, logical, bitwise. a) Precedence. b) The unique bit and shifting operators. ( for a high level language ) 5 a) The Preprocesser. b) Header files What they are and what you put in them, both your own and those provided by the 'C' compiler vendor. A simple title which includes all sorts of things, both very useful and a number of traps. 6 The library, why we have them and some of the more useful routines. a) How to read the book. b) The string functions as an example. 7 a) Mistakes and how avoid making them. b) Debugging strategies. c) The assert macro. 8 a) More on the representation of data vis. struct, typdef. b) Tables of all sorts. Arrays of structures. Pre-initialisation of data structures. ( Including jump or dispatch tables ) The bit-field. c) Use of header files in this. 9 a) The control structures of the language, what (not) to use and when. 10 a) File IO This is an enormous subject and we we will really only just scratch on the surface. 11 a) Lint, and more on errors / bugs and how to avoid them. 12 The stack and a quick dip into assembler a) A study of the function calling mechanism used by most 'C' compilers and the effect on compiler output code of using the register storage class and the optimiser. 13 The heap. a) The 'heap', it's management, malloc(), calloc() and free(). 14 Portability Issues. a) Defaults for storage sizes. b) 'endianism'. Yes, there are big-endian and little-endian computers! c) Functions which can be called with a variable number of arguments. 15 Sample programs. Much is to be gained from examining public domain packages examining the code and reviewing the author's style. We will look at a number of functions and complete packages. in particular we will examine a number of sorting functions, a multi-threading technique, queues, lists, hashing, and trees. /* ----------------------------------------- */ Copyright notice:- (c) 1993 Christopher Sawtell. I assert the right to be known as the author, and owner of the intellectual property rights of all the files in this material, except for the quoted examples which have their individual copyright notices. Permission is granted for onward copying, but not modification, of this course and its use for personal study only, provided all the copyright notices are left in the text and are printed in full on any subsequent paper reproduction. -- +----------------------------------------------------------------------+ | NAME Christopher Sawtell | | SMAIL 215 Ollivier's Road, Linwood, Christchurch, 8001. New Zealand.| | EMAIL chris@gerty.equinox.gen.nz | | PHONE +64-3-389-3200 ( gmt +13 - your discretion is requested ) | +----------------------------------------------------------------------+ c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/c-lesson.20000755000076400001440000002253307055334445016460 Lesson One. Some Historical Background. The 'C' programming language was designed and developed by Brian Kernighan, and Dennis Ritchie at The Bell Research Labs. 'C' is a Language specifically created in order to allow the programmer access to almost all of the machine's internals - registers, I/O slots and absolute addresses. However, at the same time, 'C' allows for as much data hiding and programme text modularisation as is needed to allow very complex multi-programmer projects to be constructed in an organised and timely fashion. During the early 1960s computer Operating Systems started to become very much more complex with the introduction of multi-terminal and multi-process capabilities. Prior to this time Operating Systems had been carefully and laboriously crafted using assembler codes, and many programming teams realised that in order to have a working o/s in anything like a reasonable time this was now longer economically feasible. This then was the motivation to produce the 'C' Language, which was first implemented in assembler on a Digital Equipment Corporation PDP-7. Of course once a simple assembler version was working it was possible to rewrite the compiler in 'C' itself. This was done in short order and therefore as soon as the PDP-11 was introduced by DEC it was only necessary to change the code generator section of the compiler and the new machine had a compiler in just a few weeks. 'C' was then used to implement the UNIX o/s. This means, that a complete UNIX can be transported, or to use the simple jargon of today; 'ported to a new machine in literally just a few months by a small team of competent programmers. Enough of the past. Lets see the various actions, or compilation phases through which the `C' compilation system has to go in order that your file of `C' program text can be converted working program. Assuming that you are able to work an editor and can enter a script and create a file. Please enter the following tiny program. #ident "@(#) Hello World - my first program" #include char *format = "%s", *hello = "Hello World...\n"; main() { printf ( format, hello ); } Now save it in a file called hello.c. Lower case is allowed - encouraged, no less - under the UNIX operating system. Now type: cc -o hello hello.c The computer will apparently pause for a few moments and then the Shell, or Command Line Interpreter prompt will re-appear. Now type: hello Lo and behold the computer will print Hello World... Let's just look at what the computer did during the little pause. The first action is to activate a preliminary process called the pre-processor. In the case of hello.c all it does is to replace the line #include with the file stdio.h from the include files library. The file stdio.h provides us with a convenient way of telling the compiler that all the i/o functions exist. There are a few other little things in stdio.h but they need not concern us at this stage. In order to see what the pre-processor actually outputs, you might like to issue the command: cc -P hello.c The 'cc' command will activate the 'C' compilation system and the -P option will stop the compilation process after the pre-processing stage, and another file will have appeared in your directory. Have a look, find hello.i and use the editor in view mode to have a look at it. So issue the command: view hello.i You will see that a number of lines of text have been added at the front of the hello.c program. What's all this stuff? Well, have a look in the file called /usr/include/stdio.h again using the view command. view /usr/include/stdio.h Look familiar? Now the next stage of getting from your program text to an executing program is the compilation of your text into an assembler code program. After all that is what a compiler is for - to turn a high level language script into a program. Lets see what happens by issuing the command cc -S hello.c Once again there is another file in your directory - this time with a .s suffix. Lets have a look at it in the same way as the .i file view hello.s You will doubtless notice a few recognizable symbols and what appears to be a pile of gibberish. The gibberish is in fact the nmemonics for the machine instructions which are going to make the computer do what you have programmed it to do. Now this assembler code has to be turned into machine instructions. To do this issue the command. cc -g -c hello.s Now, yet again there is another file in your directory - this time the suffix is ".o". This file is called the object file. It contains the machine instructions corresponding exactly to the nmemonic codes in the .s file. If you wish you can look at these machine codes using one of the commands available to examine object files. dis -L -t .data hello.o >hello.dis The output from these commands won't be very meaningful to you at this stage, the purpose of asking you to use them is merely to register in your mind the fact that an object file is created as a result of the assembly process. The next stage in the compilation process is called by a variety of names - "loading", "linking", "link editing". What happens is that the machine instructions in the object file ( .o ) are joined to many more instructions selected from an enormous collection of functions in a library. This phase of the compilation process is invoked by the command:- cc -o hello hello.o Now, at last, you have a program to execute! So make it do it's thing by putting the name of the executable file as a response to the Shell or Command Line Interpreter prompt. hello Presto, the output from your program appears on the screen. Hello World... You are now allowed to rejoice and have a nice warm fuzzy to hold! You have successfully entered a `C' program, compiled it, linked it, and finally, executed it! Having gone through all the various stages of editing, pre-processing, compiling, assembling, linking, and finally executing, by hand as it were, you can now rest assured that all the stages are automated by the 'cc' command, and you can forget how to invoke them! Just remember that the computer has to do them in order for you to have a program to execute. The single command you use to activate the C Compiler is: cc -o hello hello.c The word after the -o option is the name of the executable file, if you don't provide a name here the compiler dreams up the name "a.out". The source file MUST have the .c extension otherwise the compiler complains and stops working. Notes: The command names used in the above text are those of standard UNIX, Your particular system may well use a different name for the 'C' compiler. bcc - for Borland 'C'. gcc - GNU 'C', which is standard on the Linux operating system. lc - Lattice 'C', available on IBM and clone P.C.s as well as the Amiga. Check in the Documentation which came with your compiler. The same notions apply to the text editor. Differences between 'C' and other languages. In the years since 'C' was developed it has changed remarkable little. This fact is a bouquet to the authors, who had the vision and understanding to create a language which has endured so well. The strengths and weaknesses should be pointed out here. The big plus is that it is possible to do everything ( well at least 99.9% ) in 'C' while other languages compel you to write a procedure, subroutine or function in assembler code. 'C' has very good facilities for creating tables of constant data within the source file. 'C' doesn't do very much to protect you from yourself. This means that the resulting code executes faster than most other high level languages, but a much greater degree of both care and understanding is demanded from the programmer. 'C' is not a closely typed language, although the newer compilers are offering type checking as part of the language itself as opposed to having to use a separate program for mechanised debugging. 'C' is a small language with very few intrinsic operations. All the heavy work is done by explicit library function calls. 'C' allows you to directly and conveniently access most of the internals of the machine ( the memory, input output slots, and CPU registers ) from the language without having to resort to assembler code. 'C' compilers have an optimisation phase which can be invoked if desired. The output code can be optimised for either speed or memory usage. The code will be just as good as that produced by an assembly code programmer of normal skill - real guru programmers can do only slightly better. Copyright notice:- (c) 1993 Christopher Sawtell. I assert the right to be known as the author, and owner of the intellectual property rights of all the files in this material, except for the quoted examples which have their individual copyright notices. Permission is granted for onward copying, but not modification, of this course and its use for personal study only, provided all the copyright notices are left in the text and are printed in full on any subsequent paper reproduction. -- +----------------------------------------------------------------------+ | NAME Christopher Sawtell | | SMAIL 215 Ollivier's Road, Linwood, Christchurch, 8001. New Zealand.| | EMAIL chris@gerty.equinox.gen.nz | | PHONE +64-3-389-3200 ( gmt +13 - your discretion is requested ) | +----------------------------------------------------------------------+ c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/c-lesson.30000755000076400001440000005737007055334454016470 Lesson 2 Data Storage Concepts. It has been stated that "data + algorithms = programs". This Lesson deals with with the first part of the addition sum. All information in a computer is stored as numbers represented using the binary number system. The information may be either program instructions or data elements. The latter are further subdivided into several different types, and stored in the computer's memory in different places as directed by the storage class used when the datum element is defined. These types are: a) The Character. This is a group of 8 data bits and in 'C' represents either a letter of the Roman alphabet, or a small integer in the range of 0 through to +255. So to arrange for the compiler to give you a named memory area in which to place a single letter you would "say": char letter; at the beginning of a program block. You should be aware that whether or not a char is signed or unsigned is dependant on the design of the processor underlying your compiler. In particular, note that both the PDP-11, and VAX-11 made by Digital Equipment Corporation have automatic sign extention of char. This means that the range of char is from -128 through to +127 on these machines. Consult your hardware manual, there may be other exceptions to the trend towards unsigned char as the default. This test program should clear things up for you. /* ----------------------------------------- */ #ident "@(#) - Test char signed / unsigned."; #include main() { char a; unsigned char b; a = b = 128; a >>= 1; b >>= 1; printf ( "\nYour computer has %ssigned char.\n\n", a == b ? "un" : "" ); } /* ----------------------------------------- */ Here ( Surprise! Surprise! ) is its output on a machine which has unsigned chars. Your computer has unsigned char. Cut this program out of the news file. Compile and execute it on your computer in order to find out if you have signed or unsigned char. b) The Integers. As you might imagine this is the storage type in which to store whole numbers. There are two sizes of integer which are known as short and long. The actual number of bits used in both of these types is Implementation Dependent. This is the way the jargonauts say that it varies from computer to computer. Almost all machines with a word size larger than sixteen bits have the the long int fitting exactly into a machine word and a short int represented by the contents of half a word. It's done this way because most machines have instructions which will perform arithmetic efficiently on both the complete machine word as well as the half-word. For the sixteen bit machines, the long integer is two machine words long, and the short integer is one. short int smaller_number; long int big_number; Either of the words short or long may be omitted as a default is provided by the compiler. Check your compiler's documentation to see which default you have been given. Also you should be aware that some compilers allow the you to arrange for the integers declared with just the word "int" to be either short or long. The range for a short int on a small computer is -32768 through to +32767, and for a long int -4294967296 through to +4294967295. c) The Real Numbers. Sometimes known as floating point numbers this number representation allows us to store values such as 3.141593, or -56743.098. So, using possible examples from a ship design program you declare floats and doubles like this: float length_of_water_line; /* in meters */ double displacement; /* in grammes */ In the same way that the integer type offers two sizes so does the floating point representation. They are called float and double. Taking the values from the file /usr/include/values.h the ranges which can be represented by float and double are: MAXFLOAT 3.40282346638528860e+38 MINFLOAT 1.40129846432481707e-45 MAXDOUBLE 1.79769313486231470e+308 MINDOUBLE 4.94065645841246544e-324 However you should note that for practical purposes the maximum number of significant digits that can be represented by a float is approximately six and that by a double is twelve. Also you should be aware that the above numbers are as defined by the IEEE floating point standard and that some older machines and compilers do not conform. All small machines bought retail will conform. If you are in doubt I suggest that refer to your machine's documentation for the whole and exact story! d) Signed and unsigned prefixes. For both the character and integer types the declaration can be preceded by the word "unsigned". This shifts the range so that 0 is the minimum, and the maximum is twice that of the signed data type in question. It's useful if you know that it is impossible for the number to go negative. Also if the word in memory is going to be used as a bit pattern or a mask and not a number the use of unsigned is strongly urged. If it is possible for the sign bit in the bit pattern to be set and the program calls for the bit pattern to be shifted to the right, then you should be aware that the sign bit will be extended if the variable is not declared unsigned. The default for the "int" types is always "signed", and, as discussed above that of the "char" is machine dependent. This completes the discussion on the allocation of data types, except to say that we can, of course, allocate arrays of the simple types simply by adding a pair of square brackets enclosing a number which is the size of the array after the variable's name: char client_surname[31]; This declaration reserves storage for a string of 30 characters plus the NULL character of value zero which terminates the string. Structures. Data elements which are logically connected, for example - to use the example alluded to above - the dimensions and other details about a sea going ship, can be collected together as a single data unit called a struct. One possible way of laying out the struct in the source code is: struct ship /* The word "ship" is known as the structure's "tag". */ { char name[30]; double displacement; /* in grammes */ float length_of_water_line; /* in meters */ unsigned short int number_of_passengers; unsigned short int number_of_crew; }; Note very well that the above fragment of program text does NOT allocate any storage, it merely provides a named template to the compiler so that it knows how much storage is needed for the structure. The actual allocation of memory is done either like this: struct ship cunarder; Or by putting the name of the struct variable between the "}" and the ";" on the last line of the definition. Personally I don't use this method as I find that the letters of the name tend to get "lost" in the - shall we say - amorphous mass of characters which make up the definition itself. The individual members of the struct can have values assigned to them in this fashion: cunarder.displacement = 97500000000.0; cunarder.length_of_water_line = 750.0 cunarder.number_of_passengers = 3575; cunarder.number_of_crew = 4592; These are a couple of files called demo1.c & demo1a.c which contain small 'C' programs for you to compile. So, please cut them out of the news posting file and do so. ---------------------------------------------------------------------- #ident demo1.c /* If your compiler complains about this line, chop it out */ #include struct ship { char name[31]; double displacement; /* in grammes */ float length_of_water_line; /* in meters */ unsigned short int number_of_passengers; unsigned short int number_of_crew; }; char *format = "\ Name of Vessel: %-30s\n\ Displacement: %13.3f\n\ Water Line: %5.1f\n\ Passengers: %4d\n\ Crew: %4d\n\n"; main() { struct ship cunarder; cunarder.name = "Queen Mary"; /* This is the bad line. */ cunarder.displacement = 97500000000.0; cunarder.length_of_water_line = 750.0 cunarder.number_of_passengers = 3575; cunarder.number_of_crew = 4592; printf ( format, cunarder.name, cunarder.displacement, cunarder.length_of_water_line, cunarder.number_of_passengers, cunarder.number_of_crew ); } ---------------------------------------------------------------------- Why is the compiler complaining at line 21? Well C is a small language and doesn't have the ability to allocate strings to variables within the program text at run-time. This program shows the the correct way to copy the string "Queen Mary", using a library routine, into the structure. ---------------------------------------------------------------------- #ident demo1a.c /* If your compiler complains about this line, chop it out */ #include /* ** This is the template which is used by the compiler so that ** it 'knows' how to put your data into a named area of memory. */ struct ship { char name[31]; double displacement; /* in grammes */ float length_of_water_line; /* in meters */ unsigned short int number_of_passengers; unsigned short int number_of_crew; }; /* ** This character string tells the printf() function how it is to output ** the data onto the screen. Note the use of the \ character at the end ** of each line. It is the 'continue the string on the next line' flag ** or escape character. It MUST be the last character on the line. ** This technique allows you to produce nicely formatted reports with all the ** ':' characters under each other, without having to count the characters ** in each character field. */ char *format = "\n\ Name of Vessel: %-30s\n\ Displacement: %13.1f grammes\n\ Water Line: %5.1f metres\n\ Passengers: %4d\n\ Crew: %4d\n\n"; main() { struct ship cunarder; strcpy ( cunarder.name, "Queen Mary" ); /* The corrected line */ cunarder.displacement = 97500000000.0; cunarder.length_of_water_line = 750.0; cunarder.number_of_passengers = 3575; cunarder.number_of_crew = 4592; printf ( format, cunarder.name, cunarder.displacement, cunarder.length_of_water_line, cunarder.number_of_passengers, cunarder.number_of_crew ); } ---------------------------------------------------------------------- I'd like to suggest that you compile the program demo1a.c and execute it. $ cc demo1a.c $ a.out Name of Vessel: Queen Mary Displacement: 97500000000.0 grammes Water Line: 750.0 metres Passengers: 3575 Crew: 4592 Which is the output of our totally trivial program to demonstrate the use of structures. Tip: To avoid muddles in your mind and gross confusion in other minds remember that you should ALWAYS declare a variable using a name which is long enough to make it ABSOLUTELY obvious what you are talking about. Storage Classes. The little dissertation above about the storage of variables was concerned with the sizes of the various types of data. There is just the little matter of the position in memory of the variables' storage. 'C' has been designed to maximise the the use of memory by allowing you to re-cycle it automatically when you have finished with it. A variable defined in this way is known as an 'automatic' one. Although this is the default behaviour you are allowed to put the word 'auto' in front of the word which states the variable's type in the definition. It is quite a good idea to use this so that you can remind yourself that this variable is, in fact, an automatic one. There are three other storage allocation methods, 'static' and 'register', and 'const'. The 'static' method places the variable in main storage for the whole of the time your program is executing. In other words it kills the 're-cycling' mechanism. This also means that the value stored there is also available all the time. The 'register' method is very machine and implementation dependent, and also perhaps somewhat archaic in that the optimiser phase of the compilation process does it all for you. For the sake of completeness I'll explain. Computers have a small number of places to store numbers which can be accessed very quickly. These places are called the registers of the Central Processing Unit. The 'register' variables are placed in these machine registers instead of stack or main memory. For program segments which are tiny loops the speed at which your program executes can be enhanced quite remarkably. The optimiser compilation phase places as many of your variables into registers as it can. However no machine can decide which of the variables should be placed in a register, and which may be left in memory, so if your program has many variables and two or three should be register ones then you should specify which ones the compiler. All this is dealt with at much greater detail later in the course. Pointers. 'C' has the very useful ability to set up pointers. These are memory cells which contain the address of a data element. The variable name is preceeded by a '*' character. So, to reserve an element of type char and a pointer to an element of type char, one would say. char c; char *ch_p; I always put the suffix '_p' on the end of all pointer variables simply so that I can easily remember that they are in fact pointers. There is also the companion unary operator '&' which yields the address of the variable. So to initialize our pointer ch_p to point at the char c, we have to say. ch_p = &c; Note very well that the process of indirection can procede to any desired depth, However it is difficult for the puny brain of a normal human to conceptualize and remember more that three levels! So be careful to provide a very detailed and precise commentry in your program if you put more than two or three stars. Getting data in and out of your programs. As mentioned before 'C' is a small language and there are no intrinsic operators to either convert between binary numbers and ascii characters or to transfer information to and fro between the computer's memory and the peripheral equipment, such as terminals or disk stores. This is all done using the i/o functions declared in the file stdio.h which you should have examined earlier. Right now we are going to look at the functions "printf" and "scanf". These two functions together with their derivatives, perform i/o to the stdin and stdout files, i/o to nominated files, and internal format conversions. This means the conversion of data from ascii character strings to binary numbers and vice versa completely within the computer's memory. It's more efficient to set up a line of print inside memory and then to send the whole line to the printer, terminal, or whatever, instead of "squirting" the letters out in dribs and drabs! Study of them will give you understanding of a very convenient way to talk to the "outside world". So, remembering that one of the most important things you learn in computing is "where to look it up", lets do just that. If you are using a computer which has the unix operating system, find your copy of the "Programmer Reference Manual" and turn to the page printf(3S), alternatively, if your computer is using some other operating system, then refer to the section of the documentation which describes the functions in the program library. You will see something like this:- NAME printf, fprintf, sprintf - print formatted output. SYNOPSIS #include int printf ( format [ , arg ] ... ) char *format; int fprintf ( stream, format [ , arg ] ... ) FILE *stream; char *format; int sprintf ( s, format [ , arg ] ... ) char *s, *format; DESCRIPTION etc... etc... The NAME section above is obvious isn't it? The SYNOPSIS starts with the line #include . This tells you that you MUST put this #include line in your 'C' source code before you mention any of the routines. The rest of the paragraph tells you how to call the routines. The " [ , arg ] ... " heiroglyph in effect says that you may have as many arguments here as you wish, but that you need not have any at all. The DESCRIPTION explains how to use the functions. Important Point to Note: Far too many people ( including the author ) ignore the fact that the printf family of functions return a useful number which can be used to check that the conversion has been done correctly, and that the i/o operation has been completed without error. Refer to the format string in the demonstration program above for an example of a fairly sophisticated formatting string. In order to fix the concepts of printf in you mind, you might care to write a program which prints some text in three ways: a) Justified to the left of the page. ( Normal printing. ) b) Justified to the right of the page. c) Centred exactly in the middle of the page. Suggestions and Hint. Set up a data area of text using the first verse of "Quangle" as data. Here is the program fragment for the data:- /* ----------------------------------------- */ char *verse[] = { "On top of the Crumpetty Tree", "The Quangle Wangle sat,", "But his face you could not see,", "On account of his Beaver Hat.", "For his Hat was a hundred and two feet wide.", "With ribbons and bibbons on every side,", "And bells, and buttons, and loops, and lace,", "So that nobody ever could see the face", "Of the Quangle Wangle Quee.", NULL }; /* ----------------------------------------- */ Cut it out of the news file and use it in a 'C' program file called verse.c Now write a main() function which uses printf alone for (a) & (b) You can use both printf() and sprintf() in order to create a solution for (c) which makes a good use of the capabilities of the printf family. The big hint is that the string controlling the format of the printing can change dynamically as program execution proceeds. A possible solution is presented in the file verse.c which is appended here. I'd like to suggest that you have a good try at making a program of you own before looking at my solution. ( One of many I'm sure ) /* ----------------------------------------- */ #include char *verse[] = { "On top of the Crumpetty Tree", "The Quangle Wangle sat,", "But his face you could not see,", "On account of his Beaver Hat.", "For his Hat was a hundred and two feet wide.", "With ribbons and bibbons on every side,", "And bells, and buttons, and loops, and lace,", "So that nobody ever could see the face", "Of the Quangle Wangle Quee.", NULL }; main() { char **ch_pp; /* ** This will print the data left justified. */ for ( ch_pp = verse; *ch_pp; ch_pp++ ) printf ( "%s\n", *ch_pp ); printf( "\n" ); /* ** This will print the data right justified. ** ** ( As this will print a character in column 80 of ** the terminal you should make sure any terminal setting ** which automatically inserts a new line is turned off. ) */ for ( ch_pp = verse; *ch_pp; ch_pp++ ) printf ( "%79s\n", *ch_pp ); printf( "\n" ); /* ** This will centre the data. */ for ( ch_pp = verse; *ch_pp; ch_pp++ ) { int length; char format[10]; length = 40 + strlen ( *ch_pp ) / 2; /* Calculate the field length */ sprintf ( format, "%%%ds\n", length ); /* Make a format string. */ printf ( format, *ch_pp ); /* Print line of verse, using */ } /* generated format string */ printf( "\n" ); } /* ----------------------------------------- */ If you cheated and looked at my example before even attempting to have a go, you must pay the penalty and explain fully why there are THREE "%" signs in the line which starts with a call to the sprintf function. It's a good idea to do this anyway! So much for printf(). Lets examine it's functional opposite - scanf(), Scanf is the family of functions used to input from the outside world and to perform internal format conversions from character strings to binary numbers. Refer to the entry scanf(3S) in the Programmer Reference Manual. ( Just a few pages further on from printf. ) The "Important Point to Note" for the scanf family is that the arguments to the function are all POINTERS. The format string has to be passed in to the function using a pointer, simply because this is the way 'C' passes strings, and as the function itself has to store its results into your program it ( the scanf function ) has to "know" where you want it to put them. Copyright notice:- (c) 1993 Christopher Sawtell. I assert the right to be known as the author, and owner of the intellectual property rights of all the files in this material, except for the quoted examples which have their individual copyright notices. Permission is granted for onward copying, but not modification, of this course and its use for personal study only, provided all the copyright notices are left in the text and are printed in full on any subsequent paper reproduction. -- +----------------------------------------------------------------------+ | NAME Christopher Sawtell | | SMAIL 215 Ollivier's Road, Linwood, Christchurch, 8001. New Zealand.| | EMAIL chris@gerty.equinox.gen.nz | | PHONE +64-3-389-3200 ( gmt +13 - your discretion is requested ) | +----------------------------------------------------------------------+ c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/c-lesson.40000755000076400001440000002504107055334456016461 Lesson 3 Arrays and Pointers. You can allocate space for an array of elements at compile time with fixed dimension sizes of any data type, even functions and structs. So these are legal array definitions: char name[30]; /* An array of 30 signed characters. */ char *strings[50]; /* 50 pointers to strings. */ unsigned long int *(*func)()[20];/* An array of pointers to functions which */ /* return pointers to unsigned long ints. */ You can declare a pointer to point at any type of data element, and as in the array situation above functions and structs are included. struct ship { char name[30]; double displacement; /* in grammes */ float length_of_water_line; /* in meters */ unsigned short int number_of_passengers; unsigned short int number_of_crew; }; So using the ship concept from Lesson 2 you can declare a pointer to point at one of the ship structs in an array. struct ship *vessel_p; Note the use of the suffix "_p". This is my way of reminding myself that the variable is a pointer. struct ship fleet[5]; /* This allocates enough storage for 5 ships' info. */ Now lets set the pointer to point at the first vessel in the fleet. vessel_p = fleet; This pointer can be made to point at other ships in the fleet by incrementing it or doing additive arithmetic on it: vessel_p++; /* point a the next ship in the fleet array. */ vessel_p = fleet + 3; Also we can find out the index of the ship in the fleet at which we are pointing: i = vessel_p - fleet; It is also legal to find out the separation of two pointers pointing at elements in an array: d = vessel_p - another_vessel_p; /* This gives the separation in elements. */ So summarising, pointers may be, incremented, decremented, and subtracted one from another or have a constant subtracted from them. Any other mathematical operation is meaningless and not allowed. Assembler programmers should note that while the pointer variables contain a byte machine address, when the arithmetic is done using pointers the compiler also issues either a multiply or a divide as well as the add or subtract instruction so that the result is ALWAYS expressed in elements rather than bytes. Have a go and write yourself a trivial little program, and have a look at the compiler ouput code. Lesson 1 told you how! When using a pointer to reference a structure we have to use a "pointer offset" operator in order to access the member of the struct we require: vessel_p = fleet; vessel_p->name = "Queen Mary"; vessel_p->displacement = 97500000000.0; vessel_p->length_of_water_line = 750.0 vessel_p->number_of_passengers = 3575; vessel_p->number_of_crew = 4592; Remember: It's a "." when accessing a struct which is in storage declared in the program. It's a "->" when accessing a struct at which a pointer is pointing. Initialisation of arrays. 'C' has the facility to initialise variables in a program script. Some examples: char *qbf = "The quick brown fox jumped over the lazy dogs back"; int tic_tac_toe[3][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; struct ship fleet[2] = { { "Queen Elizabeth", 97500000000.0, 750.0, 3575, 4592 }, { "Queen Mary", 115000000000.0, 875.0, 4500, 5500 } }; Take a careful note of where the commas and semi-colons go ( and don't go )! Initialised Tables of Indeterminate Length. One nice feature 'C' offers is that it is able to calculate the amount of storage required for a table by 'looking' at the number of initialisers. char *verse[] = { "On top of the Crumpetty Tree", "The Quangle Wangle sat,", "But his face you could not see,", "On account of his Beaver Hat.", "For his Hat was a hundred and two feet wide.", "With ribbons and bibbons on every side,", "And bells, and buttons, and loops, and lace,", "So that nobody ever could see the face", "Of the Quangle Wangle Quee." NULL }; Note the * character in the definition line. This means that we are going to make an array of pointers to variables of type char. As there is no number between the [ ] characters the compiler calculates it for us. With this kind of set-up it is nice and easy to add extra information to the table as program development proceeds. The compiler will calculate the new dimension for you. The point to remember is that the program has to know - from the contents of the table - that it has come to the end of the table! So you have to make a special entry which CANNOT under any circumstances be a real data element. We usually use NULL for this. The other way is to calculate the size of the table by using the sizeof operator - Note that although use of sizeof looks like a function call it is in fact an intrinsic operator of the language. The result is available at compile time. So one can say:- #define SIZE_OF_VERSE sizeof verse There is one final initialised data type, the enum. It is a fairly recent addition to the language. enum spectrum { red, orange, yellow, green, blue, indigo, violet } colour; In this construct the first symbol is given the value of 0 and for each following symbol the value is incremented. It is however possible to assign specific values to the symbols like this: enum tub { anorexic = 65, slim = 70, normal = 80, fat = 95, obese = 135 }; Some compilers are bright enough to detect that it is an error if an attempt is made to assign a value to an enum variable which is not in the list of symbols, on the other hand many are not. Take care! In practice there is little difference between the enum language construct and a number of define statements except perhaps aesthetics. Here is another trivial program which demonstrates the use of enum and a pre-initialised array. #include enum spectrum { red, orange, yellow, green, blue, indigo, violet } colour; char *rainbow[] = { "red", "orange", "yellow", "green", "blue", "indigo", "violet" }; main() { for ( colour = red; colour <= violet; colour++ ) { printf ( "%s ", rainbow[colour]); } printf ( "\n" ); } The output of which is ( not surprisingly ): red orange yellow green blue indigo violet One quite advanced use of initialised arrays and pointers is the jump or dispatch table. This is a efficient use of pointers and provides a very much better ( In my opinion ) method of controlling program flow than a maze of case or ( heaven forbid ) if ( ... ) goto statements. Please cut out this program, read and compile it. ------------------------------------------------------------------------ char *ident = "@(#) tellme.c - An example of using a pointer to a function."; #include #include #include /* These declarations are not in fact needed as they are all declared extern in math.h. However if you were to use routines which are not in a library and therefore not declared in a '.h' file you should declare them. Remember you MUST declare external routines which return a type other than the int type. extern double sin (); extern double cos (); extern double tan (); extern double atof (); */ struct table_entry { char *name; /* The address of the character string. */ double (*function)(); /* The address of the entry point of the function. */ }; typedef struct table_entry TABLE; double help ( tp ) TABLE *tp; { printf ( "Choose one of these functions:- " ); fflush ( stdout ); for ( ; tp -> name; tp++ ) printf ( "%s ", tp -> name ); printf ( "\nRemember the input is expressed in Radians\n" ); exit ( 0 ); return ( 0.0 ); /* Needed to keep some nit-picking dumb compilers happy! */ } /* * This is the array of pointers to the strings and function entry points. * Is is initialised at linking time. You may add as many functions as you * like in here PROVIDED you declare them to be extern, either in some .h * file or explicitly. */ TABLE interpretation_table [ ] = { { "sin", sin }, { "tan", tan }, { "cos", cos }, { "help", help }, { NULL, NULL } /* To flag the end of the table. */ }; char *output_format = { "\n %s %s = %g\n" }; extern int errno; extern void perror(); main( argc, argv ) int argc; char **argv; { TABLE *tp; double x, answer; if ( argc > 3 ) { errno = E2BIG; perror ( "tellme" ); exit ( -1 ); } for (;;) /* This is the way to set up a continuous loop. */ { for ( tp = interpretation_table; ( tp -> name && strcmp ( tp -> name, argv[1] )); tp++ ) ; /* Note use of empty for loop to position tp. */ if ( tp -> function == help ) (*tp -> function )( interpretation_table ); if ( tp -> name == NULL ) { printf ( "Function %s not implemented yet\n", argv[1] ); exit ( 1 ); } break; /* Leave the loop. */ } x = atof ( argv[2] ); /* Convert the character string to a double. */ answer = ( *tp -> function )( x );/* Execute the desired function. */ printf ( output_format, /* Pointer to printf()'s format string. */ argv[1], /* Pointer to the name of the function. */ argv[2], /* Pointer to the input number ascii string. */ answer /* Value ( in double floating point binary ) */ ); } Copyright notice:- (c) 1993 Christopher Sawtell. I assert the right to be known as the author, and owner of the intellectual property rights of all the files in this material, except for the quoted examples which have their individual copyright notices. Permission is granted for onward copying, but not modification, of this course and its use for personal study only, provided all the copyright notices are left in the text and are printed in full on any subsequent paper reproduction. -- +----------------------------------------------------------------------+ | NAME Christopher Sawtell | | SMAIL 215 Ollivier's Road, Linwood, Christchurch, 8001. New Zealand.| | EMAIL chris@gerty.equinox.gen.nz | | PHONE +64-3-389-3200 ( gmt +13 - your discretion is requested ) | +----------------------------------------------------------------------+ c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/c-lesson.50000755000076400001440000002435607055334461016466 Lesson 4. The operators of the language. I have mentioned that 'C' is a small language with most of the heavy work being done by explicit calls to library functions. There is however a rich mix of intrinsic operators which allow you to perform bit level operations, use pointers, and perform immediate operations on varables. In other words, most of a machine's instruction set is able to be used in the object program. At the time when 'C' was designed and first written these were unique for a high level language. Lets start with a discussion about precedence. This really means that the compiler puts invisable parentheses into your expression. Casting your mind back to Arithmetic in the primary school I expect you remember the nmemonic "My Dear Aunt Sally". The 'C' language does as well! So the following expression is correct 15 + 4 * 11 = 59 The compiler has rendered the expression as: 15 + ( 4 * 11 ) = 59 Now the 'C' language has a much larger collection of operators than just Multiply Divide Add Subtract, in fact much too big to try to remember the precedence of all of them. So my recomendation is to ALWAYS put in the parentheses, except for simple arithmetic. However, for the sake of completeness as much as anything else, here is the list. First up come what are called the primary-expression operators: () Function. [] Array. . struct member ( variable ). -> struct member ( pointer ). The unary operators: * Indirection via a Pointer. & Address of Variable. - Arithmetic Negative. ! Logical Negation or Not. ~ Bit-wise One's Complement. ++ Increment. -- Decrement. sizeof Which is self explanitary. Now the binary operators: Arithmetic Operators. * Multiply. My / Divide. Dear % Modulo, or Remainder of Integer Division. + Addition. Aunt - Subtraction. Sally The Shifting Operators. >> Bit-wise Shift to the Right. << Bit-wise Shift to the Left. Logical Relation Operators. < Less Than. > Greater Than. <= Less Than or Equal. >= Greater Than or Equal. == Equal. != Not Equal. Bit-wise Boolean Operators. & Bit-wise And. ^ Bit-wise Exclusive-or. | Bit-wise Or. The Logical Operators. && Logical And. || Logical Or. The Assignment Operators. ( They all have the same priority. ) = The normal assignment operator. The Self-referencing Assignment Operators. += -= *= /= %= >>= <<= &= ^= |= Some explanation is in order here. The machine instructions in your computer include a suit of what are called "immediate operand" instructions. These instructions have one of the operands in a register and the other is either part of the instruction word itself ( if it is numerically small enough to fit ) or is the next word in the address space "immediately" after the instruction code word. 'C' makes efficient use of this machine feature by providing the above set of operations each of which translates directly to its corresponding machine instruction. When the variable in question is a 'register' one, or the optimiser is in use, the compiler output is just the one "immediate" machine instruction. Efficiency Personified!!! These two lines will make things clearer. a = 8; a += 2; /* The result is 10 */ The exclusive-or operation is very useful you can toggle any combination of bits in the variable using it. a = 7; a ^= 2; /* Now a is 5 */ a ^= 2; /* and back to 7. */ Naturally, you can use the other operations in exactly the same way, I'd like to suggest that you make a utterly simplistic little program and have a look at the assembler code output of the compiler. Don't be afraid of the assembler codes - they don't bite - and you will see what I was on about in the paragraph above. Historical Note and a couple of Cautions. In the Oldend Days when 'C' was first written all the self-referencing operations had the equals symbol and the operand around the other way. Until quite recently ( unix system V release 3.0 ) the 'C' compiler had a compatability mode and could cope with the old style syntax. A sample or test program is probably in order here. /* ----------------------------------------- */ #include char *mes[] = { "Your compiler", " understands", " does not understand", " the old-fashioned self-referencing style." }; main() { int a; a = 5; a=-2; printf ( "%s %s %s\n", mes [ 0 ], mes [ ( a == -2 ) ? 2 : 1 ], mes [ 3 ] ); } /* ----------------------------------------- */ The 'C' compiler issued with unix System V release 3.2 seems to have ( thankfully ) dropped the compatability mode. However a collegue, who was using an old compiler, and I spent hours trying to find this strange bug! The cure for the problem is either to put spaces on either side of the '=' sign or to bracket the unary minus to the operand. a=(-2); a = -2; Either is acceptable, and might save you a lot of spleen if sombody tries to install your work of art program on an ancient machine. The other caution is the use of the shifting instructions with signed and unsigned integers. If you shift a signed integer to the right when the sign bit is set then in all probability the sign will be extended. Once again a little demo program. Please cut it out of the news file with your editor and play with it. /* ----------------------------------------- */ #ident "#(@) shifts.c - Signed / Unsigned integer shifting demo." #include #define WORD_SIZE ( sizeof ( INTEGER int ) * 8 ) #define NIBBLE_SIZE 4 #define NIBBLES_IN_WORD (( WORD_SIZE ) / NIBBLE_SIZE ) #define SIGN_BIT ( 1 << ( WORD_SIZE - 1 )) char *title[] = { " Signed Unsigned", " Signed Unsigned" }; main () { INTEGER int a; unsigned INTEGER int b, mask; int ab, i, j, bit_counter, line_counter; a = b = SIGN_BIT; printf ( "%s\n\n", title [ ( WORD_SIZE == 16 ) ? 0 : 1 ] ); for ( line_counter = 0; line_counter < WORD_SIZE; line_counter++ ) { for ( ab = 0; ab < 2; ab++ ) { mask = SIGN_BIT; for ( i = 0; i < NIBBLES_IN_WORD; i++ ) { for ( j = 0; j < NIBBLE_SIZE; j++ ) { printf ( "%c", ((( ab ) ? b : a ) & mask ) ? '1' : '0' ); mask >>= 1; } printf ( " " ); } printf ( "%s", ( ab ) ? "\n" : " " ); if ( ab ) { b >>= 1; } else { a >>= 1; #if defined(FIX_COMPILER_BUG) # if (INTEGER == long) a |= SIGN_BIT; /* This is a work-around for the 3b2 compiler bug. */ # endif #endif } } } } /* ----------------------------------------- */ This little program might well produce some interesting surprises on your machine in the same way it did on mine. I have an AT&T 3b2/400 and use the K & R style compiler. Interestingly, the above program did what I expected it to do when the integers were short, the sign bit is extended, but when the integers are long the sign bit is NOT extended. In this case the different behaviour is caused by the compiler always issuing a Logical Shift instruction, when it should issue a Arithmetic Shift instruction for signed integers and a Logical Shift instructon for unsigned ones. In the case of the short int the varable is loaded from memory into the register with a sign extend load instruction, this makes the Logical Shift instruction right work correctly for short ints, but not for longs. I had to examine the assember codes output by the compiler in order to discover this. Here are the compiler invocation lines. cc -olong.shifts -DFIX_COMPILER_BUG -DINTEGER=long shifts.c and cc -oshort.shifts -DINTEGER=short shifts.c Experiment with the "-DFIX_COMPILER_BUG" and see what your compiler does. Copyright notice:- (c) 1993 Christopher Sawtell. I assert the right to be known as the author, and owner of the intellectual property rights of all the files in this material, except for the quoted examples which have their individual copyright notices. Permission is granted for onward copying, but not modification, of this course and its use for personal study only, provided all the copyright notices are left in the text and are printed in full on any subsequent paper reproduction. -- +----------------------------------------------------------------------+ | NAME Christopher Sawtell | | SMAIL 215 Ollivier's Road, Linwood, Christchurch, 8001. New Zealand.| | EMAIL chris@gerty.equinox.gen.nz | | PHONE +64-3-389-3200 ( gmt +13 - your discretion is requested ) | +----------------------------------------------------------------------+ c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/c-lesson.60000755000076400001440000002670307055334464016470 Lesson 5. The Pre-processor and Header Files. The pre-processor is activated by a '#' character in column one of the source code. There are several statements vis: #include #define #undef #if #else #endif #ifdef #ifndef #pragma #include. In the programming examples presented in the previous lessons you will probably have noticed that there is this statement: #include right at the start of the program text. This statement tells the pre-processor to include the named file in the your program text. As far as the compiler is concerned this text appears just as if you had typed it yourself! This is one of the more useful facilities provided by the 'C' language. The #include statement is frequently combined with the #if construct. In this program fragment the file "true.h" is included in your program if the pre-processor symbol FLAG is true, and "false.h" included if FLAG is false. #if ( FLAG ) # include "true.h" #else # include "false.h" #endif This mechanism has many uses, one of which is to provide portability between all the 57,000 slightly different versions of unix and also other operating systems. Another use is to be able to alter the way in which your program behaves according to the preference of the user. Of course, you will be asking the question "Where is the file stored?". Well, if the filename is delimited by the "<" and ">" characters as in the example above the file comes from the /usr/include directory, but if the name of the file is delimited by quotes then the file is to be found in your current working directory. (This is not quite the whole truth as 'C' compilers allow you to extend the search path for the include files using command line option switches. - See your compiler manual for the whole story. ) So, I would like to suggest that you to have a look around the /usr/include directory and its /sys sub-directory. You should use either your editor in 'view' mode or the pg utility. This will ensure that you can't have an accident and alter one of the files by mistake if you are slightly silly and just happen to be logged on as the super-user. A typical file to examine is usr/include/time.h. It's quite small so here it is. /* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ #ident "@(#)/usr/include/time.h.sl 1.5 4.2 04/20/87 18195 AT&T-SF" /* 3.0 SID # 1.2 */ struct tm { /* see ctime(3) */ int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; extern struct tm *gmtime(), *localtime(); extern char *ctime(), *asctime(); int cftime(), ascftime(); extern void tzset(); extern long timezone, altzone; extern int daylight; extern char *tzname[]; As you can see ( forgetting about the comments and #ident ) there are three different uses for the file. a) The definition of data structures and types. b) The declaration of functions which use the data structures. c) The declaration of of external data objects. These lines of code are all you need in your program in order to be able to use, in this case, the library routine to access the clock in the computer, but of course the paradigm applies to all programs which are created by one programmer and used by another member of the programming team. Note that, by proxy, or whatever, the author of the library routines has in effect become a member of your programming team. You might care to write a program or two which use this header file, and for those who are motivated it might be an idea to re-implement localtime so that it understands Summer Time in the Southern Hemisphere. (!) Using another totally trivial example in order to get the idea across please examine the hello world program printed immediately below. /* ------------------------------------------------------------ */ #ident "@(#) hw_uc.h UPPER CASE version." #define HELLO_MESSAGE "HELLO WORLD...\n"; /* ------------------------------------------------------------ */ #ident "@(#) Hello World" #include #include HW_H #if !defined( HELLO_MESSAGE ) # error "You have forgotten to define the header file name." #endif char *format = "%s", *hello = HELLO_MESSAGE; main() { printf ( format, hello ); } /* ------------------------------------------------------------ */ You will no doubt notice that the symbol HW_H is used instead of a header file name. This gives us the ability to force the inclusion of any file we wish by defining the symbol HW_H to be the desired file name. It can be done like this: cc -DHW_H="\"hw_uc.h\"" hello.c The compiler output is placed, by default, in the file a.out, so to execute it issue the command: a.out Which, fairly obviously, produces the output: HELLO WORLD... As we are going to generate another version of the program we had better move the executable image file to another file name: mv a.out hello_uc Now to produce the other version issue the command line: cc -DHW_H="\"hw_lc.h\"" hello.c; mv a.out hello_lc; hello_lc Which compiles the other version of the hello.c program, using this version of the include file: /* ------------------------------------------------------------ */ #ident "@(#) hw_lc.h Lower Case version." #define HELLO_MESSAGE "Hello World...\n"; /* ------------------------------------------------------------ */ and then moves the executable image to a different file and executes it. Note that more than one command per line can be issued to the shell by separating the commands with the ';' delimiting character. Here - Surprise, Surprise - is the output of the second version. Hello World... I'd like to suggest that you use your editor to cut these example programs and the shell file below out of the mail file and have a play with them. /* ----------------------------------------- */ # @(#) Shell file to do the compilations. cc -o hello_uc -DHW_H="\"hw_uc.h\"" hello.c cc -o hello_lc -DHW_H="\"hw_lc.h\"" hello.c /* ----------------------------------------- */ #define This statement allows you to set up macro definitions. The word immediately after the #define, together with its arguments, is expanded in the program text to the whole of the rest of the line. #define min(a, b) ((a #define min(a, b) ((a so you have to put it in your program text. Once more an example to make it all clear. /* ----------------------------------------- */ #ident "@(#) qsort-demo.c" #include #include #include extern void qsort (); extern int strcmp(); /* Some compilers need this defined, most don't. */ char names[22][25] = /* Here are some names to sort. */ { "John Nagle", "Colin Douthwaite", "Ian Lance Taylor", "Brian J. Murrell", "Pete", "Geoff Mccaughan", "David Liebert", "Operator", "Bill Baucum", "Victor Volkman", "Chay R Harley", "Dan Romanchik", "Larry Kollar", "Gaston Ormazabal", "Arijit Chandra", "Kenneth Mark Hopkinson", "Kerr Hatrick", "Tim Love", "Robert M. Juranitch", "Jeffrey Micke", "Duong Quoc", "Jagadesh Vasudevamurthy" }; #define NUMBER_OF_NAMES sizeof ( names ) / sizeof ( names[0] ) main() { int i; /* ** Print the unsorted names. */ printf ( "The Unsorted Names.\n" ); for ( i = 0; i < NUMBER_OF_NAMES; i++ ) printf ( "%s\n", names[i] ); /* ** Print a prompt, and wait. */ printf ( "Press RETURN to continue: " ); fflush ( stdout ); getchar(); /* ** Now apply qsort to the arrary of character strings. */ qsort (( char * ) names, NUMBER_OF_NAMES, sizeof ( *names ), strcmp ); assert ( names[0][0] < names[1][0] ); /* Quick check to see it's done it. */ /* ** Print the sorted names. */ printf ( "The Sorted Names.\n" ); for ( i = 0; i < NUMBER_OF_NAMES; i++ ) printf ( "%s\n", names[i] ); } /* ----------------------------------------- */ Note very well:- I wanted 22 short character strings for the data items for the demo to sort. So grep, uniq, cut, tail, and finally a tiny bit of vi fished eminently suitable strings out of "mail.received". If your name is not on the list, well I'm sorry, but the world is not a fair place! So that's how you use library routines. I chose qsort because it is simple to use, and shows off a feature of 'C' well, that's the ability to use a name of a function as a pointer and then execute that function from within the called function. It's strcmp in this case. A quick look at the compiler output is instructive. As is the nature of the animal, a tin-pot little program, which should have taken all of ten minutes to get going in fact took more like two hours. I put it down to the fact that the Fine Manual did not make it adequately obvious that the data array acted on by qsort was the data itself. From reading the Fine Manual I got the impression that the array acted on was an array of pointers. You live and learn. It would be a much faster qsort if, in fact, the sorting function sorted pointers to data instead of the data itself. You might like to make a function qsort_p which worked in in this way. The qsort algorithm is well documented elsewhere. There is just one more point to notice about using function libraries. The 'C' compilation system will load functions from the library /lib/libc.a as a default. All others have to be indicated to the linking loader by a switch on the shell interactive command line. $ cc -o prog prog.c -L /usr/local/lib -lgdbm -lmalloc You might use this command line to compile and link a program which uses both the GNU gdbm data-base manager library, which is installed in the directory /usr/local/lib, and the enhanced malloc library. Now, there hangs a tale! I remember having to compile a program suit off Usenet and it just would not work properly. No error messages, no warnings, no missing linking-loader symbols. It just "died" when I tried to run it. After many, many hours of total frustration, I thought that I would try linking in the enhanced malloc library. Presto! It worked. Note very well. A common misconception is the notion that having a #include line in the source text will automagically tell the linking loader to get the functions from the appropriate library. Remove this erroroneous notion from your mind. It won't. The -lwhatever flag on the shell command line which initiates execution of "cc" or "ld" is the only way to tell the loader where to look for the required library. -- +----------------------------------------------------------------------+ | NAME Christopher Sawtell | | SMAIL 215 Ollivier's Road, Linwood, Christchurch, 8001. New Zealand.| | EMAIL chris@gerty.equinox.gen.nz | | PHONE +64-3-389-3200 ( gmt +13 - your discretion is requested ) | +----------------------------------------------------------------------+ c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/c-lesson.80000755000076400001440000004551707055334473016476 Lesson 7. De-bugging Strategies. >>>>>>>> Proper Preparation Prevents Piss-Poor Performance. <<<<<<<< This lesson is really a essay about how to go about writing programs. I know that by far the best way to greatly reduce the amount of effort required to get a program going properly is to avoid making mistakes in the first palace! Now this might seem to be stating the absolute obvious, and it is but after looking at many programs it would seem that there is a very definite need to say it. So how does one go about reducing the probability of making mistakes? There are many strategies, and over the years I have evolved my own set. I have found that some of the most important are: 1) Document what you are going to do before yes BEFORE you write any code. Set up the source files for the section of the program you are going to write and put some lines of explanation as to what you intend to do in this file. Be as precise as you can, but don't go into the detail of explaining in English, or your First Language, exactly what every statement does. 2) Make sure that you keep each file as small as is sensible. Some program authors say that one should put only one function in a file. It's my personal opinion that this is going a little bit over the top, but certainly you should not have more than one logical activity in a source file. It's easier to find a needle in a tiny haystack than in a big one! 3) Always use names for the objects in your program which are fully descriptive, or at the very least are meaningful nmemonics. Put yourself in the position of some poor soul who - a couple of years later, after you have long finished with the project, and left the country - has been given the task of adding a small feature to your exquisite program. Now in the rush to get your masterpiece finished you decided to use variable names like "a4" and "isb51" simply so that you can get the line typed a fraction of a second faster than if you used something like "customer_address[POST_CODE]" and "input_status_block[LOW_FUEL_TANK_#3]. The difference in ease of understanding is obvious, isn't it? However judging by some programs which I have seen published in both magazines and in the public domain program sources, the point has still to be made. 4) ALWAYS take great care with the layout of your code. It's my opinion that the opening brace of ALL program structures should be on a new line. Also if you put them in the leftmost column for structs, enums, and initialised tables, as well as functions, then the 'find function' keystrokes ( "[[" and "]]" ) in vi will find them as well as the functions themselves. Make sure you have the "showmatch" facility in vi turned on. ( And watch the cursor jump when you enter the right hand brace, bracket, or parenthesis. ) 5) Try as hard as you can to have as few global variables as possible. Some people say never have any globals. This is perhaps a bit too severe but global variables are a clearly documented source of programming errors. If it's impossible to perform a logical activity in an efficient way without having a global or two, then confine the scope of the globals to just the one file by marking the defining declaration "static". This stops the compiler producing a symbol which the linking loader will make available to all the files in your source. 6) Never EVER put 'magic numbers' in you source code. Always define constants in a header file with #define lines or enum statements. Here is an example:- /* ----------------------------------------- */ #include enum status_input_names { radiator_temperature, oil_temperature, fuel_pressure, energy_output, revolutions_per_minute }; char *stats[] = { "radiator_temperature", "oil_temperature", "fuel_pressure", "energy_output", "revolutions_per_minute" }; #define NUMBER_OF_INPUTS ( sizeof ( stats ) / sizeof ( stats[0])) main() { enum status_input_names name; printf ( "Number of Inputs is: %d\n", NUMBER_OF_INPUTS ); for ( name = radiator_temperature; name < NUMBER_OF_INPUTS; name++) { printf ( "\n%s", stats[ name ] ); } printf ( "\n\n" ); } /* ----------------------------------------- */ Note that as a side effect we have available the meaningful symbols radiator_temperature etc. as indices into the array of status input names and the symbol NUMBER_OF_INPUTS available for use as a terminator in the 'for' loop. This is quite legal because sizeof is a pseudo-function and the value is evaluated at the time of compilation and not when the program is executed. This means that the result of the division in the macro is calculated at the time of compilation and this result is used as a literal in the 'for' loop. No division takes place each time the loop is executed. To illustrate the point I would like to tell you a little story which is fictitious, but which has a ring of truth about it. Your employer has just landed what seems to be a lucrative contract with an inventor of a completely new type of engine. We are assured that after initial proving trials one of the larger Japanese motor manufactures is going to come across with umpteen millions to complete the development of the design. You are told to write a program which has to be a simple and straightforward exercise in order to do the job as cheaply as possible. Now, the customer - a some-what impulsive type - realises that his engine is not being monitored closely enough when it starts to rapidly dis-assemble itself under high speed and heavy load. You have to add a few extra parameters to the monitoring program by yesterday morning! You just add the extra parameters into the enumand the array of pointers to the character strings. So: enum status_input_names { radiator_temperature, radiator_pressure, fuel_temperature, fuel_pressure, oil_temperature, oil_pressure, exhaust_manifold_temperature }; Let's continue the story about the Japanese purchase. Mr. Honda ( jun ) has come across with the money and the result is that you are now a team leader in the software section of Honda Software ( YourCountry ) Ltd. The project of which you are now leader is to completely rewrite your monitoring program and add a whole lot of extra channels as well as to make the printouts much more readable so that your cheap, cheerful, and aesthetic-free program can be sold as the "Ultimate Engine Monitoring Package" from the now world famous Honda Real-time Software Systems. You set to work, Honda et. al. imagine that there is going to be a complete redesign of the software at a cost of many million Yen. You being an ingenious type have written the code so that it is easy to enhance. The new features required are that the printouts have to be printed with the units of measure appended to the values which have to scaled and processed so that the number printed is a real physical value instead of the previous arrangement where the raw transducer output was just dumped onto a screen. What do you have to do? Thinking along the line of "Get the Data arranged correctly first". You take you old code and expand it so that all the items of information required for each channel are collected into a struct. enum status_input_names { radiator_temperature, radiator_pressure, fuel_temperature, fuel_pressure, oil_temperature, oil_pressure, exhaust_manifold_temperature, power_output, torque }; typedef struct channel { char *name; /* Channel Name to be displayed on screen. */ int nx; /* position of name on screen x co-ordinate. */ int ny; /* ditto for y */ int unit_of_measure; /* index into units of measure array */ char value; /* raw datum value from 8 bit ADC */ char lower_limit; /* For alarms. */ char upper_limit; float processed_value; /* The number to go on screen. */ float offset; float scale_factor; int vx; /* Position of value on screen. */ int vy; }CHANNEL; enum units_of_measure { kPa, degC, kW, rpm, Volts, Amps, Newtons }; char *units { "kPa", "degC", "kW", "rpm", "Volts", "Amps", "Newtons" }; CHANNEL data [] = { { "radiator temperature", { "radiator pressure", { "fuel temperature", { "fuel pressure", { "oil temperature", { "oil pressure", { "exhaust manifold temperature", { "power output", { "torque", }; #define NUMBER_OF_INPUTS sizeof (data ) / sizeof ( data[0] ) Now the lesson preparation is to find the single little bug in the above program fragment, to finish the initialisation of the data array of type CHANNEL and to have a bit of a crack at creating a screen layout program to display its contents. Hint: Use printf(); ( Leave all the values which originate from the real world as zero. ) Here are some more tips for young players. 1) Don't get confused between the logical equality operator, == and the assignment to a variable operator. = This is probably the most frequent mistake made by 'C' beginners, and has the great disadvantage that, under most circumstances, the compiler will quite happily accept your mistake. 2) Make sure that you are aware of the difference between the logical and bit operators. && This is the logical AND function. || This is the logical OR function. The result is ALWAYS either a 0 or a 1. & This is the bitwise AND function used for masks etc. The result is expressed in all the bits of the word. 3) Similarly to 2 be aware of the difference between the logical complementation and the bitwise one's complement operators. ! This is the logical NOT operator. ~ This is the bitwise ones complement op. Some further explanation is required. In deference to machine efficiency a LOGICAL variable is said to be true when it is non-zero. So let's set a variable to be TRUE. 00000000000000000000000000000001 A word representing TRUE. Now let's do a logical NOT !. 00000000000000000000000000000000 There is a all zero word, a FALSE. 00000000000000000000000000000001 That word again. TRUE. Now for a bitwise complement ~. 11111111111111111111111111111110 Now look we've got a word which is non-zero, still TRUE. Is this what you intended? 4) It is very easy to fall into the hole of getting the '{' & '}'; '[' & ']'; '(' & ')'; symbol pairs all messed up and the computer thinks that the block structure is quite different from that which you intend. Make sure that you use an editor which tells you the matching symbol. The UNIX editor vi does this provided that you turn on the option. Also take great care with your layout so that the block structure is absolutely obvious, and whatever style you choose do take care to stick by it throughout the whole of the project. A personal layout paradigm is like this: Example 1. function_type function_name ( a, b ) type a; type b; { type variable_one, variable_two; if ( logical_expression ) { variable_one = A_DEFINED_CONSTANT; if ( !return_value = some_function_or_other ( a, variable_one, &variable_two ) ) { error ( "function_name" ); exit ( FAILURE ); } else { return ( return_value + variable_two ); } } /* End of "if ( logical_expression )" block */ } /* End of function */ This layout is easy to do using vi with this initialisation script in either the environment variable EXINIT or the file ${HOME}/.exrc:- set showmode autoindent autowrite tabstop=2 shiftwidth=2 showmatch wm=1 Example 2. void printUandG() { char *format = "\n\ User is: %s\n\ Group is: %s\n\n\ Effective User is: %s\n\ Effective Group is: %s\n\n"; ( void ) fprintf ( tty, format, passwd_p->pw_name, group_p->gr_name, epasswd_p->pw_name, egroup_p->gr_name ); } Notice how it is possible to split up format statements with a '\' as the last character on the line, and that it is convenient to arrange for a nice output format without having to count the field widths. Note however that when using this technique that the '\' character MUST be the VERY LAST one on the line. Not even a space may follow it! In summary I *ALWAYS* put the opening brace on a new line, set the tabs so that the indentation is just two spaces, ( use more and you very quickly run out of "line", especially on an eighty column screen ). If a statement is too long to fit on a line I break the line up with the arguments set out one to a line and I then the indentation rule to the parentheses "()" as well. Sample immediately above. Probably as a hang-over from a particular pretty printing program which reset the indentation position after the printing of the closing brace "}", I am in the habit of doing it as well. Long "if" and "for" statements get broken up in the same way. This is an example of it all. The fragment of code is taken from a curses oriented data input function. /* ** Put all the cursor positions to zero. */ for ( i = 0; s[i].element_name != ( char *) NULL && s[i].element_value != ( char *) NULL; i = ( s[i].dependent_function == NULL ) ? s[i].next : s[i].dependent_next ) { /* Note that it is the brace and NOT the */ /* "for" which moves the indentation level. */ s[i].cursor_position = 0; } /* ** Go to start of list and hop over any constants. */ for ( i = edit_mode = current_element = 0; s[i].element_value == ( char *) NULL ; current_element = i = s[i].next ) continue; /* Note EMPTY statement. */ /* ** Loop through the elements, stopping at end of table marker, ** which is an element with neither a pointer to an element_name nor ** one to a element_value. */ while ( s[i].element_name != ( char *) NULL && s[i].element_value != ( char *) NULL ) { int c; /* Varable which holds the character from the keyboard. */ /* ** Et Cetera for many lines. */ } Note the commenting style. The lefthand comments provide a general overview of what is happening and the righthand ones a more detailed view. The double stars make a good marker so it is easy to separate the code and the comments at a glance. The null statement. You should be aware that the ";" on its own is translated by the compiler as a no-operation statement. The usefullness of this is that you can do little things, such as counting up a list of objects, or positioning a pointer entirely within a "for" or "while" statement. ( See example above ). There is, as always, a flip side. It is HORRIBLY EASY to put a ";" at the end of the line after the closing right parenthesis - after all you do just that for function calls! The suggestion is to both mark deliberate null statements with a comment and to use the statement "continue;". Using the assert macro will pick up these errors at run time. The assert macro. Refer to the Programmers Reference Manual section 3X and find the documentation on this most useful tool. As usual an example is by far the best wasy to explain it. /* ----------------------------------------- */ #ident "@(#) assert-demo.c" #include #include #define TOP_ROW 10 #define TOP_COL 10 main() { int row, col; for ( row = 1; row <= TOP_ROW; row++); { assert ( row <= TOP_ROW ); for ( col = 1; col <= TOP_COL; col++ ) { assert ( col <= TOP_COL ); printf ( "%4d", row * col ); } printf ( "\n" ); } } /* ----------------------------------------- */ Which produces the output:- Assertion failed: row <= TOP_ROW , file assert-demo.c, line 15 ABORT instruction (core dumped) It does this because the varable "row" is incremented to one greater than The value of TOP_ROW. Note two things: 1) The sense of the logical condition. The assert is asserted as soon as the result of the logical condition is FALSE. Have a look at the file /usr/include/assert. Where is the ";" being used as an empty program statement? 2) The unix operating system has dumped out an image of the executing program for examination using a symbolic debugger. Have a play with "sdb" in preparation for the lesson which deals with it in more detail. Lets remove the errant semi-colon, re-compile and re-run the program. 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36 42 48 54 60 7 14 21 28 35 42 49 56 63 70 8 16 24 32 40 48 56 64 72 80 9 18 27 36 45 54 63 72 81 90 10 20 30 40 50 60 70 80 90 100 Here's the ten times multiplication table, for you to give to to the nearest primary-school child! I would agree that it is not possible to compare the value of a program layout with a real work of fine art such as a John Constable painting or a Michaelangelo statue, I do think a well laid out and literate example of programming is not only much easier to read and understand, but also it does have a certain aesthetic appeal. Copyright notice:- (c) 1993 Christopher Sawtell. I assert the right to be known as the author, and owner of the intellectual property rights of all the files in this material, except for the quoted examples which have their individual copyright notices. Permission is granted for onward copying, but not modification, of this course and its use for personal study only, provided all the copyright notices are left in the text and are printed in full on any subsequent paper reproduction. -- +----------------------------------------------------------------------+ | NAME Christopher Sawtell | | SMAIL 215 Ollivier's Road, Linwood, Christchurch, 8001. New Zealand.| | EMAIL chris@gerty.equinox.gen.nz | | PHONE +64-3-389-3200 ( gmt +13 - your discretion is requested ) | +----------------------------------------------------------------------+ c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/c-lesson.90000755000076400001440000003307707055334477016501 Lesson 8. This lesson and the following one will examine how to use the program structure - as opposed to data structure - reserved words. Lets start with the looping structures: do repeated_statement while ( logical_expression ); repeated_statement, which may be a block of code, will be executed repetitively until the logical_expression, becomes false. If you have been exposed to ( corrupted by? ) another language remember that there is no `until' test at the end of a loop. Note that the repeated_statement is always executed once irrespective of the state of the logical_expression. while ( logical_expression ) repeated_statement; repeated_statement is executed repetitively while the logical_expression is true. Once again statement may be a block of code. Note that if the logical_expression evaluates to FALSE then the repeated_statement is NEVER executed. Associated with the looping structures are the control words: break; continue; break; allows you to leave a loop in the middle of a block, and continue; allows you to re-start it from the top. Finally we must not forget the most common and useful looping construct: for ( initialising statement; logical_expression; incremental_statement ) repeated_statement; Some further explanation is needed. The initialising statement is executed once, but to allow for the need to initialise several separate variables the assignment statements may be separated by commas. The logical_expression must be true for the loop to run, and the incremental_statement is executed once each time the loop is run. The for statement is completely general and may, for example, be used to manipulate a set of pointers to operate on a linked list. Some examples. A do loop program. #ident "@(#) do_demo.c - An example of the do loop" #include main() { char character; character = 'a'; do printf ( "%c", character ); while ( character++ < 'z' ); printf ( "\n" ); } Fairly obviously it prints: abcdefghijklmnopqrstuvwxyz A while loop example. #ident "@(#) while_demo.c - An example of the while loop" #include main() { char character; character = 'a'; while ( character <= 'z' ) printf ( "%c", character++ ); printf ( "\n" ); } Its output is exactly the same as the previous example: abcdefghijklmnopqrstuvwxyz In this totally trivial case it is irrelevant which program structure you use, however you should note that in the `do' program structure the repeated statement is always executed at least once. A for loop example. The `for' looping structure. #ident "@(#) for_demo.c - An example of the for loop" #include main() { char character; for ( character = 'a'; character <= 'z' ; character++ ) { printf ( "%c", character ); } printf ( "\n" ); } Surprise, Surprise! abcdefghijklmnopqrstuvwxyz You should be aware that in all the looping program structures, the repeated statement can be a null statement ( either just a `;' or the reserved word `continue;' ). This means that it is possible to - for example - position a pointer, or count up some items of something or other. It isn't particularly easy to think up a trivial little program which demonstrates this concept, however the two `for' loops give some indication of the idea. #ident "@(#) pointer_demo.c - Pointer operations with the for loop" #include main() { char character, *character_pointer, alphabets [ 53 ]; for ( character = 'a', character_pointer = alphabets; /* Start conditions */ character <= 'z'; /* Run while true */ *character_pointer++ = character++ /* All the work */ )TRUE continue; for ( character = 'A'; /* character_pointer is at the right place already */ character <= 'Z'; *character_pointer++ = character++ ) continue; *character_pointer = (char) '\000'; /* NULL character to terminate string. */ printf ( "%s\n\n", alphabets ); } Another Surprise! abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ So much for the looping structures provided by the `C' language. The other main structures required to program a computer are the ones which alter the program flow. These are the switch, and the if and its extension the if ... else combination. More demo programs are much the best way of getting the message across to you, so here they are, first the if construct. #ident "if_demo.c" #include main(argc, argv) int argc; char **argv; { if ( argc > 1 ) printf ( "You have initiated execution with arguments."}; } And the if ... else demo. #ident "if_else_demo.c" /* ** The Language #define could go in the compiler invocation line if desired. */ #define ENGLISH #include /* ** The message and text fragments output by the program. */ char *messages[] = { #if defined( ENGLISH ) #ident "@(#)ENGLISH Version" "\nUsage: if_else_demo \n\n", "The first argument is ", "the second", "equal to ", "bigger than ", "smaller than " #endif #if defined( FRANCAIS ) #ident "@(#)FRENCH Version" put the French translation in here so that we are ready to export to French speaking Countries. I'd be grateful if a French speaker could make the translation for me. #endif }; /* ** Meaningful words defined to constants */ #define USAGE 0 #define FIRST 1 #define SECOND 2 #define EQUAL 3 #define BIGGER 4 #define SMALLER 5 #define SUCCESS 0 #define FAILURE 1 /* ** We need this more than once so it can be put in a function. */ void usage() { printf ( messages[USAGE]); exit ( FAILURE ); } /* ** Main program function starts here. ( At the top of a page no less! ) */ int main ( argc, argv ) int argc; char **argv; { int message_index; double i, j, strtod(); char *ptr; if ( argc != 3 ) usage(); /* have we been given the right */ /* number of arguments. */ i = strtod ( argv[1], &ptr); /* Convert to a double float. */ if ( ptr == argv[1] ) usage(); /* Successful conversion? */ j = strtod ( argv[2], &ptr); /* Convert to a double float. */ if ( ptr == argv[2] ) usage(); /* Successful conversion? */ /* ** This statement uses the "ternary conditional assignment" language ** construction to assign the value required to the message indexing variable. ** Note that this concept is efficient in both the generation of machine code ** output ( compile the program with a -S switch and have a look ) and in the ** ease with which it can be understood. The assignment is obvious instead of ** being buried under a litter of `if' and `else' keywords. */ message_index = ( i == j ) ? EQUAL : ( i > j ) ? BIGGER : SMALLER; /* ** Now print the message. */ (void) printf ( "\n%s%s%s\n\n", /* Format string specifying 3 strings. */ messages[ FIRST ], /* Address of string. */ messages[ message_index ], /* ditto. */ messages[ SECOND ] /* ditto. */ ); return ( SUCCESS ); } Well as you can no doubt gather it simply compares two numbers on the command line and ejects a little message depending on the relative magnitude of the numbers. In the UNIX tradition the help message is perhaps somewhat terse, but it serves the purpose of getting you - the student - to think about the importance of creating programs which always cope with nonsensical input in a civilised way. Here are the lines of output. Usage: if_else_demo The first argument is equal to the second The first argument is smaller than the second The first argument is bigger than the second Now that the international community is shrinking with vastly improved telecommunications, it is perhaps a good idea to think carefully about creating programs which can talk in many languages to the users. The method of choice is - I believe - that presented above. The #if defined( LANGUAGE ) gives us an easy method of changing the source code to suit the new sales area. Another possibility is to put all the text output needed from a program into a file. The file would have to have a defined layout and some consistent way of `getting at' the message strings. From a commercial point of view this may or may not be a good business plan. Quite definitely it is an absolute no no to scatter a mass of string literals containing the messages and message fragments all over your program script. There are two more methods of altering the program flow. 1 ) The goto a label. 2 ) The setjump / longjmp library routines. The concept of the go to a label construction has had reams of literary verbiage written about it and this author does not intend to add to the pile. Suffice it to say that a goto is a necessary language construct. There are a few situations which require the language to have ( in practice ) some form of unconditional jump. Treat this statement with great caution if you wish your code to be readable by others. An example of legitimate use. for ( a = 0; a < MATRIX_SIZE; a++ ) { for ( b = 0; b < MATRIX_SIZE; b++ ) { if ( process ( matrix, a, b )) goto bad_matrix; } } return ( OK ); bad_matrix: perror ( progname, "The data in the matrix seems to have been corrupted" ); return ( BAD ); This is one of the very few "legitimate" uses of goto, as there is no "break_to_outer_loop" in `C'. Note that some compilers complain if the label is not immediately followed by a statement. If your compiler is one of these naughty ones, you can put either a `;' or a pair of braces `{}' after the `:' as a null statement. An example of a program package which makes extensive use of the goto is the rz and sz modem communications protocol implementation by Chuck Forsberg of Omen Technology. You should download it and study the code, but do remember that the proof of the pudding argument must apply as the rz & sz system has become extremely popular in its application because it works so well. The other method of changing program flow is the setjump and longjmp pair of library functions. The idea is to provide a method of recovery from errors which might be detected anywhere within a large program - perhaps a compiler, interpreter or large data acquisition system. Here is the trivial example: #ident "set_jmp_demo.c" #include #include jmp_buf save; main() { char c; for ( ;; ) /* This is how you set up a continuous loop. */ { switch ( setjmp( save )) { case 0: printf ( "We get a zero returned from setjmp on setup.\n\n"); break; /* This is the result from setting up. */ case 1: printf ( "NORMAL PROGRAM OPERATION\n\n" ); break; case 2: printf ( "WARNING\n\n" ); break; case 3: printf ( "FATAL ERROR PROGRAM TERMINATED\n\nReally Terminate? y/n: " ); fflush ( stdout ); scanf ( "%1s", &c ); c = tolower ( c ); if ( c == 'y' ) return ( 1 ); printf ( "\n" ); break; default: printf ( "Should never return here.\n" ); break; } process (); } } process () { int i; printf ( "Input a number to simulate an error condition: " ); fflush ( stdout ); scanf ( "%d", &i ); i %= 3; i++; /* So that we call longjmp with 0 < i < 4 */ longjmp ( save, i); } Although in this silly little demo the call to longjmp is in the same file as the call to setjmp, this does not have to be the case, and in the practical situation the call to longjmp will be a long way from the call to setjmp. The mechanism is that setjmp saves the entire state of the computer's CPU in a buffer declared in the jmp_buf save; statement and longjmp restores it exactly with the exception of the register which carries the return value from longjmp. This value is the same as the second argument in the longjmp call - i in our little demo. This means, of course, that the stack and frame pointer registers are reset to the old values and all the local variables being used at the time of the longjmp call are going to be lost forever. One consequence of this is that any pointer to memory allocated from the heap will also be lost, and you will be unable to access the data stored in the buffer. This is what the jargonauts call "memory leakage", and is really very difficult bug to find. Your program runs out of dynamic memory long before it should. Take care. So you have to keep a record of the buffers' addresses and free them before the call to longjmp. More details later on when we learn about the heap memory allocation routines. Copyright notice:- (c) 1993 Christopher Sawtell. I assert the right to be known as the author, and owner of the intellectual property rights of all the files in this material, except for the quoted examples which have their individual copyright notices. Permission is granted for onward copying, but not modification, of this course and its use for personal study only, provided all the copyright notices are left in the text and are printed in full on any subsequent paper reproduction. -- +----------------------------------------------------------------------+ | NAME Christopher Sawtell | | SMAIL 215 Ollivier's Road, Linwood, Christchurch, 8001. New Zealand.| | EMAIL chris@gerty.equinox.gen.nz | | PHONE +64-3-389-3200 ( gmt +13 - your discretion is requested ) | +----------------------------------------------------------------------+ c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/Makefile.am0000644000076400001440000000020207055334500016660 EXTRA_DIST = $(wildcard *.html) $(wildcard c-lesson.*) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/Makefile.in0000644000076400001440000002411007474405126016705 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard c-lesson.*) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/CONTRIB/SAWTELL mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/CONTRIB/SAWTELL/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/SAWTELL/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/SAWTELL/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=intro.html c-lesson.1 c-lesson.2 c-lesson.3 c-lesson.4 c-lesson.5 c-lesson.6 c-lesson.7 c-lesson.8 c-lesson.9 DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/SAWTELL/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/SAWTELL/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/CONTRIB/SAWTELL/intro.html0000644000076400001440000000170407055334500016655 C Lesson by Chris Sawtell

    C Lesson by Chris Sawtell

    This copy was taken in May 94. The latest version is available by clicking here
    Introduction
    History
    Data Storage.
    Arrays & Pointers
    Operators
    Pre-processor
    Libraries
    Debugging
    Structure c_cpp_reference-2.0.2/reference/C/CONTRIB/Makefile.am0000644000076400001440000000026307055333574015566 EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) SUBDIRS = OR_PRACTICAL_C OR_USING_C SAWTELL SNIP YABL docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/CONTRIB/Makefile.in0000644000076400001440000003403307474405126015577 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) SUBDIRS = OR_PRACTICAL_C OR_USING_C SAWTELL SNIP YABL docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/CONTRIB mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = Makefile.am Makefile.in DIST_SUBDIRS = $(SUBDIRS) #>- all: all-recursive #>+ 1 all: docs-am all-recursive .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/CONTRIB/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) GTAGS: here=`CDPATH=: && cd $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=intro.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done for subdir in $(SUBDIRS); do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-recursive #>+ 1 clean: kde-rpo-clean clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-generic clean-libtool clean-recursive distclean \ distclean-generic distclean-libtool distclean-recursive \ distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ info-recursive install install-am install-data install-data-am \ install-data-recursive install-docsDATA install-exec \ install-exec-am install-exec-recursive install-info \ install-info-am install-info-recursive install-man \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-libtool mostlyclean-recursive tags tags-recursive \ uninstall uninstall-am uninstall-docsDATA uninstall-info-am \ uninstall-info-recursive uninstall-recursive # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/CONTRIB/intro.html0000755000076400001440000001236607055333574015565 Internet References

    Internet References.


    Where possible these links are to other sites. Some of the references are uncompressed or de-archived copies of the originals.


    Mirror Sites

    This page is available at the following sites. I would like to thank the administrators of these sites for hosting the guide.

    o
    USA - Maintained by Gary Greenburg.

    o
    Maintained by Javier Gutierrez on a IRIX 5.2 server.

    o
    Maintained by Javier Gutierrez on a IRIX 5.2 server.

    o
    French site.

    o
    English site.

    o
    Bernd Petrovitsch.

    o
    The latest home site. The home site has moved three times in three years. Maybe this will be the final resting place :-)


    C Tutorials on the net.

    o
    David Marshall's 'Programming in C' tutorial

    o
    'C' course from Chris Sawtell.

    o
    'C Programming' from Steve Holmes.
    University of Strathclyde Computer Centre.
    Curran Building.
    100 Cathedral Street.
    Glasgow.

    o
    Tim Loves 'C for Programmers'. This is a LARGE postscript document. Only download if you have a Postscript viewer or printer.

    o
    Tim Loves documentation in HTML form.

    o
    Introduction to C Programming by Marshall Brian


    C Reference documents.

    o ANSI C Programming from Phil Willis


    C Resources.

    o Martin Brown's Hot List

    o C Language Resource List


    Items of interest from the net.

    o
    Snippets - program examples. Compiled by Bob Stout.

    o
    Learn C/C++ A comprehensive list of C related links maintained by Vinny Carpenter.

    o
    C news group. Catch up on C related topics.

    o
    C frequently-asked questions (FAQ) maintained by Steve Summit.

    HTML version of Steves FAQ

    o
    Books list (mostly C related) compiled by Mitch Wright.

    o
    Copies of the programs provided in the following O'Reilly Nutshell books.

    Compilers

    o
    Pacific C compiler for MS-DOS


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/0000777000076400001440000000000007474405213015754 5c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/troff.test0000644000076400001440000000104207055334403017703 Test file for the troff line program .tm this is a test .tm test is more test .tm test once again .xx this is an error Test of macro that has no arguments .br Put an argument where there should be none .br Expect string argument .tm string Two strings .tm string string Integer .br 12+34 String where number expected .br test Vertical bar .lt |0 No vertical bar .lt 0 Font check Bad font check Character 'left'middle'right' bad 'bad 'bad'bad 'bad'bad' "quoted string" "almost quoted string .sp 12.0 Cause an expression error .sp 12.0_12.0 c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/gen.h0000644000076400001440000000160707055334373016621 /******************************************************** * gen.h -- general purpose macros. * ********************************************************/ /* * Define a boolean type */ #ifndef TRUE typedef int boolean; #define TRUE 1 #define FALSE 0 #endif /* TRUE */ /******************************************************** * SKIP_WHITESPACE -- move a character pointer * * past whitespace * * * * Parameters * * cur_char -- pointer to current character * * (will be moved) * ********************************************************/ /* Move past whitespace */ #define SKIP_WHITESPACE(cur_char) \ while ((*(cur_char) <= ' ') && (*(cur_char) != '\0')) \ (cur_char)++; c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/makefile.tcc0000644000076400001440000000073407055334377020153 CC=tcc CFLAGS=-ml -g -w -A SRCS=tlint.c macros.c symbol.c fonts.c OBJS=tlint.obj macros.obj symbol.obj fonts.obj tlint: $(OBJS) $(CC) $(CFLAGS) -etlint $(OBJS) fonts.obj: fonts.c gen.h symbol.h $(CC) $(CFLAGS) -c fonts.c macros.obj: font.h gen.h macro.h macros.c symbol.h $(CC) $(CFLAGS) -c macros.c symbol.obj: symbol.c symbol.h $(CC) $(CFLAGS) -c symbol.c tlint.obj: font.h gen.h macro.h tlint.c $(CC) $(CFLAGS) -c tlint.c c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/macros.c0000644000076400001440000003326007055334377017333 /******************************************************** * macros -- Handle macro related data structure. * * * * Functions * * load_macros -- load a macro file into the macro * * symbol table * * macro_check -- check macro line * ********************************************************/ #include #include "gen.h" #include "symbol.h" #include "macro.h" #include "font.h" #include #include #include extern void error(char *); /* Write error message */ /* * Each argument to a macro has the following structure */ struct arg { char type; /* Type of argument */ boolean many; /* True if we can repeat this argument */ }; #define MAX_ARGS 10 /* Max arguments for each macro */ struct arg_list { int num_args; /* Number of arguments */ struct arg args[MAX_ARGS]; /* The arguments */ }; /* the top of the symbol table */ static struct symbol *macro_symbol_ptr = NULL; /* * Skip past remaining argument */ #define SKIP_ARG(cur_char) \ while (*(cur_char) > ' ') \ (cur_char)++; /******************************************************** * load_macros -- load macros into symbol table * * * * Parameters * * name -- filename of file to load * * * * Aborts on error. * *------------------------------------------------------* * Input file format: * * # line -- comment * * mac arg arg # comment * * * * mac -- one or two-character macro name * * arg -- argument type letter * * | -- vertical bar * * s -- string * * n -- number * * c -- single character * * f -- font specification * * t -- three-part title * * * * If followed by a star, set the many flag. * ********************************************************/ void load_macros(char *name) { FILE *in_file; /* Input file */ int line_number; /* Line number of the input file */ char *type_list = "|sncft"; /* Characters for argument type */ int num_args;/* Number of arguments we've seen */ char macro_name[3]; /* Name of the current macro */ /* The macro we are working on */ struct arg_list *arg_list_ptr; in_file = fopen(name, "r"); if (in_file == NULL) { (void) fprintf(stderr, "Error:Can't open %s for reading\n", name); exit(8); } line_number = 0; while (1) { char line[80]; /* Input line from data file */ char *cur_char; /* Pointer to current input character */ if (fgets(line, sizeof(line), in_file) == NULL) { (void) fclose(in_file); return; } line_number++; cur_char = line; /* Trim off leading whitespace */ SKIP_WHITESPACE(cur_char); /* Continue on comment or blank line */ if ((*cur_char == '#') || (cur_char == '\0')) continue; /* Copy two-character macro name */ macro_name[0] = *cur_char; cur_char++; if (*cur_char > ' ') { macro_name[1] = *cur_char; cur_char++; macro_name[2] = '\0'; } else macro_name[1] = '\0'; /* * create new argument list */ arg_list_ptr = (struct arg_list *) malloc(sizeof(struct arg_list)); for (num_args = 0; num_args < MAX_ARGS; num_args++) { /* Move past whitespace */ SKIP_WHITESPACE(cur_char); /* End of list? */ if ((*cur_char == '#') || (cur_char == '\0')) break; /* Check for legal character */ if (strchr(type_list, *cur_char) == NULL) { (void) fprintf(stderr, "Error on line %d:Bad argument character %c\n", line_number, *cur_char); } arg_list_ptr->args[num_args].type = *cur_char; cur_char++; if (*cur_char == '*') { arg_list_ptr->args[num_args].many = TRUE; cur_char++; } else arg_list_ptr->args[num_args].many = FALSE; } arg_list_ptr->num_args = num_args; enter(¯o_symbol_ptr, macro_name, (generic *) arg_list_ptr); } } /******************************************************** * macro_check -- check a macro line for correctness * * * * Parameters * * line -- line to check * ********************************************************/ void macro_check(char *line) { char *cur_char = &line[1]; /* Pointer to current character */ char name[3]; /* Macro name */ struct arg_list *arg_list_ptr; /* The argument list */ int arg_index; /* Index into argument list */ extern char *check_string(char *); /* String? */ extern char *check_number(char *); /* Number? */ extern char *check_char(char *); /* Character? */ extern char *check_font(char *); /* Font specification? */ extern char *check_title(char *); /* Three-part title? */ SKIP_WHITESPACE(cur_char); /* Copy two-character macro name */ name[0] = *cur_char; cur_char++; if (*cur_char > ' ') { name[1] = *cur_char; cur_char++; name[2] = '\0'; } else name[1] = '\0'; arg_list_ptr = (struct arg_list *) lookup(macro_symbol_ptr, name); if (arg_list_ptr == NULL) { char error_msg[30]; (void) sprintf(error_msg, "No such macro %s", name); error(error_msg); return; } arg_index = 0; while (1) { if (arg_index >= arg_list_ptr->num_args) break; /* Start at beginning of next macro */ SKIP_WHITESPACE(cur_char); /* Check for end of string */ if (*cur_char == '\0') break; switch (arg_list_ptr->args[arg_index].type) { /* Vertical Bar (optional) */ case '|': if (*cur_char == '|') cur_char++; break; /* s -- a string */ case 's': cur_char = check_string(cur_char); break; /* n -- number */ case 'n': cur_char = check_number(cur_char); break; /* c -- character */ case 'c': cur_char = check_char(cur_char); break; /* f -- font specification */ case 'f': cur_char = check_font(cur_char); break; /* t -- three-part title */ case 't': cur_char = check_title(cur_char); break; default: (void) printf("Internal error, bad type %c\n", arg_list_ptr->args[arg_index].type); break; } if (arg_list_ptr->args[arg_index].many == FALSE) arg_index++; } SKIP_WHITESPACE(cur_char); if (*cur_char != '\0') error("Too many arguments"); } /******************************************************** * check_string -- check argument to make sure it's * * pointing to a string * * * * A string is a word or a set of words enclosed in * * double quotes. * * * * I.E. sam "This is a test" * * * * Parameters * * cur_char -- pointer to the string * * * * Returns * * pointer to character after the string * ********************************************************/ char *check_string(char *cur_char) { /* What type of string is it? */ /* Quoted string? */ if (*cur_char == '"') { cur_char++; /* Move to end of string */ while ((*cur_char != '"') && (*cur_char != '\0')) cur_char++; /* Check for proper termination */ if (*cur_char == '\0') error("Missing closing \" on string parameter"); else cur_char++; /* Move past closing quote */ } else { /* Simple word string */ while (!isspace(*cur_char)) cur_char++; } return (cur_char); } /******************************************************** * check_number -- check argument to make sure it's * * pointing to a expression * * * * Parameters * * cur_char -- pointer to the integer expression * * * * * * Returns * * pointer to character after the integer exp * ********************************************************/ char *check_number(char *cur_char) { /* Characters allowed in expressions */ static char *number_chars = "0123456789+-*/%."; if (strchr(number_chars, *cur_char) == NULL) { error("Expression expected"); SKIP_ARG(cur_char); return (cur_char); } while (strchr(number_chars, *cur_char) != NULL) cur_char++; if (!(isspace(*cur_char) || (*cur_char == '\0'))) { SKIP_ARG(cur_char); error("Illegal expression"); } return (cur_char); } /******************************************************** * check_char -- check argument to make sure it's * * pointing to a char * * * * Parameters * * cur_char -- pointer to the char * * * * Returns * * pointer to character after the char * * * * Note: This is a simple character check and does not * * try to figure out all of the crazy \ * * characters that can be used in troff. * ********************************************************/ char *check_char(char *cur_char) { cur_char++; if (!(isspace(*cur_char) || (*cur_char == '\0'))) error("Expected single character"); return (cur_char); } /******************************************************** * check_font -- check argument to make sure it's * * pointing to a legal font * * * * Parameters * * cur_char -- pointer to the font * * * * Returns * * pointer to character after the font * ********************************************************/ char *check_font(char *cur_char) { char name[3]; /* Font name */ name[0] = *cur_char; cur_char++; if (isalnum(*cur_char)) { name[1] = *cur_char; cur_char++; name[2] = '\0'; } else name[1] = '\0'; if (lookup(font_symbol_ptr, name) == NULL) error("Expected font"); return (cur_char); } /******************************************************** * check_title -- check argument to make sure it's * * pointing to a three-part title * * of the form: 'xxxx'yyyy'zzz'. * * * * Parameters * * cur_char -- pointer to the title * * * * Returns * * pointer to character after the title * ********************************************************/ char *check_title(char *cur_char) { if (*cur_char != '\'') { error("Expected beginning of three-part title"); SKIP_ARG(cur_char); return (cur_char); } cur_char++; while ((*cur_char != '\'') && (*cur_char != '\0')) cur_char++; if (*cur_char != '\'') { error("Expected middle part of three-part title"); SKIP_ARG(cur_char); return (cur_char); } cur_char++; while ((*cur_char != '\'') && (*cur_char != '\0')) cur_char++; if (*cur_char != '\'') { error("Expected third part of three-part title"); SKIP_ARG(cur_char); return (cur_char); } cur_char++; while ((*cur_char != '\'') && (*cur_char != '\0')) cur_char++; if (*cur_char != '\'') { error("Expected end of three-part title"); SKIP_ARG(cur_char); return (cur_char); } cur_char++; return (cur_char); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/macro.h0000644000076400001440000000247507055334374017156 /******************************************************** * macros.h -- Definitions for the macro lookup * * package. * * * * Procedures * * load_macros -- load a macro onto the symbol tbl * * * * macro_check -- check a macro line for * * correctness * ********************************************************/ /******************************************************** * load_macros -- load macros into symbol table * * * * Parameters * * name -- filename of file to load * ********************************************************/ void load_macros(char *name); /******************************************************** * macro_check -- check a macro line for correctness * * * * Parameters * * line -- line to check * ********************************************************/ void macro_check(char *name); c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/test.csh0000644000076400001440000000144307055334401017343 #!/bin/csh # # Test file for the program tlint # #---------------------------------------- # Print commands as they are executed # set echo #---------------------------------------- # Try something normal # tlint troff.test #---------------------------------------- # Try non-existent macro and font file tlint -mno-name tlint -fno-name #---------------------------------------- # Try a bad macro file tlint -mbad.mac Add the data from * * to the tables used for syntax * * checking. * * -f Add font data from * * to list of legal fonts. * * * * [files] is a list of files to check. * * (none=check standard in.) * * * ********************************************************/ #include #include "gen.h" #include "macro.h" #include "font.h" #include #define MAX_LINE 100 /* longest line we can expect */ #define MACRO_START_1 '.' /* Macros can begin with a dot */ #define MACRO_START_2 '\'' /* or an apostrophe */ main(int argc, char *argv[]) { void usage(void); /* Tell the user what to do */ void do_file(char *, FILE *); /* Process a file */ load_macros("standard.mac"); load_fonts("standard.fonts"); while ((argc > 1) && (argv[1][0] == '-')) { switch (argv[1][1]) { case 'm': load_macros(&argv[1][2]); break; case 'f': load_fonts(&argv[1][2]); break; default: usage(); } argc--; argv++; } if (argc == 1) { do_file("standard-in", stdin); } else { while (argc > 1) { FILE *in_file; /* File for reading data */ in_file = fopen(argv[1], "r"); if (in_file == NULL) { (void)fprintf(stderr,"Unable to open %s\n", argv[1]); } else { do_file(argv[1], in_file); (void)fclose(in_file); } argc--; argv++; } } return (0); } /******************************************************** * usage -- tell the user what to do * ********************************************************/ static void usage(void) { (void)printf("Usage is:\n"); (void)printf(" tlint [options] [file1] [file2] ...\n"); (void)printf("Options:\n"); (void)printf(" -m -- add to list\n"); (void)printf(" of macro files\n"); (void)printf(" -f -- specify additional font file\n"); exit (8); } static char *file_name; /* Name of the file we are processing */ static int line_number; /* Current line number */ static char line[MAX_LINE]; /* A line from the input file */ static int line_out; /* True if a line has been output */ /******************************************************** * do_file -- process a single file * * * * Parameters * * name -- name of the file to use * * in_file -- file to check * ********************************************************/ static void do_file(char *name, FILE *in_file) { file_name = name; line_number = 0; while (1) { if (fgets(line, sizeof(line), in_file) == NULL) break; line_out = 0; /* We have not written the line */ line_number++; if ((line[0] == MACRO_START_1) || (line[0] == MACRO_START_2)) macro_check(line); } } /******************************************************** * error -- tell the user that there is an error * * * * Parameters * * message -- error message * ********************************************************/ void error(char *message) { if (line_out == 0) { (void)fprintf(stderr,"%s", line); line_out = 1; } (void)fprintf(stderr,"Error %s in file %s Line %d\n", message, file_name, line_number); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/fonts.c0000644000076400001440000000417407055334373017176 /******************************************************** * fonts -- handle font-related data structures * * * * Functions * * load_fonts -- load a font file * ********************************************************/ #include #include "gen.h" #include "symbol.h" #include #include /* the top of the symbol table */ struct symbol *font_symbol_ptr = NULL; /******************************************************** * load_fonts -- load fonts into symbol table * * * * Parameters * * file_name -- filename of file to load * * * * Aborts on error. * ********************************************************/ void load_fonts(char *file_name) { FILE *in_file; /* Input file */ char name[3]; /* Name of the current font */ /* We have to point to something for our data */ static char *an_object = "an object"; in_file = fopen(file_name, "r"); if (in_file == NULL) { (void) fprintf(stderr, "Error:Can't open %s for reading\n", file_name); exit(8); } while (1) { char line[80]; /* Input line from data file */ char *cur_char; /* Pointer to current input character */ if (fgets(line, sizeof(line), in_file) == NULL) { (void) fclose(in_file); return; } cur_char = line; while (*cur_char != '\0') { SKIP_WHITESPACE(cur_char); if (*cur_char == '\0') break; /* Copy two-character macro name */ name[0] = *cur_char; cur_char++; if (*cur_char > ' ') { name[1] = *cur_char; cur_char++; name[2] = '\0'; } else name[1] = '\0'; enter(&font_symbol_ptr, name, (generic *) an_object); } } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/font.h0000644000076400001440000000204407055334372017011 /******************************************************** * font.h -- Definitions for the font package * * package. * * * * Procedures * * load_fonts -- load a font file onto the symbol * * table * ********************************************************/ extern struct symbol *font_symbol_ptr; /* A list of legal fonts */ /******************************************************** * load_fonts -- load fonts into symbol table * * * * Parameters * * file_name -- filename of file to load * * * * Aborts on error * ********************************************************/ void load_fonts(char *name); c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/Makefile.am0000644000076400001440000000031207055334410017713 EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) $(wildcard *.h) troff.test test.csh \ makefile.tcc makefile.unix standard.mac docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/Makefile.in0000644000076400001440000002517707474405126017754 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) $(wildcard *.h) troff.test test.csh \ makefile.tcc makefile.unix standard.mac docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/CONTRIB/OR_PRACTICAL_C mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/CONTRIB/OR_PRACTICAL_C/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/OR_PRACTICAL_C/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/OR_PRACTICAL_C/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=12_3.c 14_18.c 05_2.c 04_4.c 14_01.c 15_1.c 12_7.c 01_1.c 07_2.c 14_13.c 17_1.c 16_3.c 14_05.c 03_1.c 09_2.c 12_2.c 14_17.c 14_09.c 05_1.c 04_3.c 12_6.c tlint.c 07_1.c 06_3.c 14_12.c 10_1.c 04_7.c 16_2.c 14_04.c gen.h 09_1.c symbol.c 08_3.c font.h 12_1.c 14_16.c 14_08.c macro.h 04_2.c 03_4.c 09_5.c 12_5.c fonts.c 06_2.c 14_11.c 04_6.c 16_1.c 14_03.c 02_1.c 08_2.c 14_15.c 14_07.c 04_1.c 03_3.c 09_4.c 13_2.c 12_4.c 14_19.c HEADER.html macros.c 06_1.c 05_3.c 14_10.c 04_5.c 14_02.c 12_8.c 01_2.c 08_1.c 07_3.c 11_1.c 14_14.c 17_2.c 14_06.c 03_2.c 09_3.c 13_1.c DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/OR_PRACTICAL_C/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/OR_PRACTICAL_C/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/standard.mac0000644000076400001440000000627607055334400020157 # # This file contains the definitions for the built-in # macros used by troff # # The format of the file is # macro # # Arguments are: # | Vertical bar # s String # n Numeric expression # c Single character # f Font specification # t Three-part title # # If followed by a * they can be repeated 0 or more # times # # Anything past a # is considered a comment br # Break ad s # Adjust margins na # No adjust nf # No fill fi # Fill nh # No hyphen hy n # Set hyphenation mode hw s* # Specify how to hyphenate words hc c # Hyphenation character ce n # Center lines ul n # Underline cu n # Continuous underline uf f # Select font for underline po | n # Page offset ll n # Line length in | n # Indent ti | n # Temporary indent pl | n # Page length bp n # Begin page pn n # Page number ne n # Specify need space mk s # Mark current location sp | n # Vertical space ps n # Point size vs | n # Vertical space ls n # Line spacing sv n # Save space os # Output saved space ns # Set no-space mode rs # Set restore-space mode ss n # Set character space size cs s n n # Constant space mode ft f # Specify font fp f n # Set font position fz f n # Font size request bd f n # Specify how to bold a font lg n # Select ligatures ta n* # Specify tabs tc c # Tab character lc c # Leader character fc c s # Field character lt | n # Title length pc c # Page character tl t # Title so s # Source another file nx s # Change to another file pi s # Pipe output to a program rd s # Read data from keyboard ex s # Exit tm s* # Send message to standard output ds s s # Define string as s s # Append string de s s # Define macro . # End of macro rm s # Remove macro rn s s # Rename macro am s s # Append to macro di s # Divert to macro da s # Append to diversion wh n s # Set place to execute macro ch s n # Change place macro executes dt n s # Set diversion trap it n s # Set input trap em s # Set macro for end of input nr s n n # Define number register af s c # Assign format rr s # Remove register mc c # Margin character ec c # Set escape character eo # Turn off escape cc c # Set control character c2 # Set second control character tr s # Translate characters nm n n n n # Line number nn n # No numbering ig s # Ignore input pm s # Print macros fl # Flush output ab s # Abort ev n # Set environment \" s* # Comment c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/HEADER.html0000644000076400001440000000056007055334372017511

    Practical C - O'Reilly

    Reprinted with permission from 'Practical C Programming' copyright 1993 O'Reilly and Associates, Inc. For orders and information, call 1-800-988-9938.

    Source directory can be extracted from ftp.uu.net:/published/oreilly/nutshell/practical_c.

    I strongly recomended you get the book to put these examples into context. Martin c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/symbol.c0000644000076400001440000000533307055334401017340 /******************************************************** * symbol -- handle the symbol table * * * * Functions * * enter -- put a symbol in a symbol table * * lookup -- get the data associated with a symbol * ********************************************************/ #include #include "symbol.h" #include #include /******************************************************** * enter -- enter a word into the symbol table * * * * Parameters * * node -- top node of the symbol table for add * * symbol -- symbol name to add (1 or 2 chars) * * data -- data associated with the symbol * ********************************************************/ void enter(struct symbol **node_ptr, char *symbol, generic *data) { int result; /* result of strcmp */ /* New node that we are creating */ struct symbol *new_node_ptr; /* see if we have reached the end */ if ((*node_ptr) == NULL) { new_node_ptr = (struct symbol *) malloc(sizeof(struct symbol)); (void)strcpy(new_node_ptr->name, symbol); new_node_ptr->data = data; new_node_ptr->left_ptr = NULL; new_node_ptr->right_ptr = NULL; *node_ptr = new_node_ptr; return; } /* * Need to sub-divide the symbol table and try again */ result = strcmp((*node_ptr)->name, symbol); if (result == 0) return; if (result > 0) enter(&(*node_ptr)->left_ptr, symbol, data); else enter(&(*node_ptr)->right_ptr, symbol, data); } /******************************************************** * lookup -- lookup a symbol in a table * * * * Parameters * * root -- root of the symbol table to search * * name -- name to lookup. * * * * Returns * * Pointer to the data or NULL if not found. * ********************************************************/ generic *lookup(struct symbol *root_ptr, char *name) { int result; /* Result of string compare */ if (root_ptr == NULL) return (NULL); result = strcmp(root_ptr->name, name); if (result == 0) { return (root_ptr->data); } if (result > 0) return (lookup(root_ptr->left_ptr, name)); else return (lookup(root_ptr->right_ptr, name)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/01_1.c0000644000076400001440000000012207055334404016465 #include main() { (void) printf("Hello World\n"); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/01_2.c0000644000076400001440000000012207055334377016477 #include main() { (void) printf("Hello World\n"); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/02_1.c0000644000076400001440000000136007055334404016473 /******************************************************** * hello -- program to print out "Hello World". * * Not an especially earth-shattering program. * * * * Author: Steve Oualline * * * * Purpose: Demonstration of a simple program * * * * Usage: * * Run the program and the message appears * ********************************************************/ #include main() { /* Tell the world hello */ (void) printf("Hello World\n"); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/03_1.c0000644000076400001440000000005407055334366016502 main() { (1 + 2) * 4; return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/03_2.c0000644000076400001440000000035307055334366016505 #include int term; /* term used in two expressions */ int term_2; /* twice term */ int term_3; /* three times term */ main() { term = 3 * 5; term_2 = 2 * term; term_3 = 3 * term; return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/03_3.c0000644000076400001440000000034207055334366016504 #include int term; /* term used in two expressions */ main() { term = 3 * 5; (void)printf("Twice %d is %d\n", term, 2*term); (void)printf("Three time %d is %d\n", term, 3*term); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/03_4.c0000644000076400001440000000050107055334404016473 #include char char1; /* first character */ char char2; /* second character */ char char3; /* third character */ main() { char1 = 'A'; char2 = 'B'; char3 = 'C'; (void)printf("%c%c%c reversed is %c%c%c\n", char1, char2, char3, char3, char2, char1); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/04_1.c0000644000076400001440000000066607055334366016514 #include float data[5]; /* data to average and total */ float total; /* the total of the data items */ float average; /* average of the items */ main() { data[0] = 34.0; data[1] = 27.0; data[2] = 45.0; data[3] = 82.0; data[4] = 22.0; total = data[0] + data[1] + data[2] + data[3] + data[4]; average = total / 5.0; (void)printf("Total %f Average %f\n", total, average); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/04_2.c0000644000076400001440000000033007055334366016501 #include #include char name[30]; /* First name of someone */ main() { (void)strcpy(name, "Sam"); /* Initialize the name */ (void)printf("The name is %s\n", name); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/04_3.c0000644000076400001440000000117107055334367016507 #include #include char first[100]; /* first name */ char last[100]; /* last name */ char full_name[200]; /* full version of first and last name */ main() { (void)strcpy(first, "Steve"); /* Initialize first name */ (void)strcpy(last, "Oualline"); /* Initialize last name */ (void)strcpy(full_name, first); /* full = "Steve" */ /* Note: strcat not strcpy */ (void)strcat(full_name, " "); /* full = "Steve " */ (void)strcat(full_name, last); /* full = "Steve Oualline" */ (void)printf("The full name is %s\n", full_name); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/04_4.c0000644000076400001440000000035007055334404016476 #include #include char line[100]; main() { (void)printf("Enter a line: "); (void)fgets(line, sizeof(line), stdin); (void)printf("The length of the line is: %d\n", strlen(line)); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/04_5.c0000644000076400001440000000106507055334367016513 #include #include char first[100]; /* first name of person we are working with */ char last[100]; /* His last name */ /* First and last name of the person (computed) */ char full[200]; main() { (void)printf("Enter first name: "); (void)fgets(first, sizeof(first), stdin); (void)printf("Enter last name: "); (void)fgets(last, sizeof(last), stdin); (void)strcpy(full, first); (void)strcat(full, " "); (void)strcat(full, last); (void)printf("The name is %s\n", full); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/04_6.c0000644000076400001440000000127507055334367016517 #include #include char first[100]; /* first name of person we are working with */ char last[100]; /* His last name */ /* First and last name of the person (computed) */ char full[100]; main() { (void)printf("Enter first name: "); (void)fgets(first, sizeof(first), stdin); /* trim off last character */ first[strlen(first)-1] = '\0'; (void)printf("Enter last name: "); (void)fgets(last, sizeof(last), stdin); /* trim off last character */ last[strlen(last)-1] = '\0'; (void)strcpy(full, first); (void)strcat(full, " "); (void)strcat(full, last); (void)printf("The name is %s\n", full); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/04_7.c0000644000076400001440000000052007055334367016510 #include char line[100]; /* input line from console */ int value; /* a value to double */ main() { (void) printf("Enter a value: "); (void) fgets(line, sizeof(line), stdin); (void) sscanf(line, "%d", &value); (void) printf("Twice %d is %d\n", value, value * 2); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/05_1.c0000644000076400001440000000105007055334404016472 #include int old_number; /* previous Fibonacci number */ int current_number; /* current Fibonacci number */ int next_number; /* next number in the series */ main() { /* start things out */ old_number = 1; current_number = 1; (void)printf("1\n"); /* Print first number */ while (current_number < 100) { (void) printf("%d\n", current_number); next_number = current_number + old_number; old_number = current_number; current_number = next_number; } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/05_2.c0000644000076400001440000000107307055334367016510 #include char line[100];/* line of data for input */ /* Running total of all numbers so far */ int total; /* next item to add to the list */ int item; main() { total = 0; while (1) { (void) printf("Enter # to add \n"); (void) printf(" or 0 to stop:"); (void) fgets(line, sizeof(line), stdin); (void) sscanf(line, "%d", &item); if (item == 0) break; total += item; (void) printf("Total: %d\n", total); } (void) printf("Final total %d\n", total); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/05_3.c0000644000076400001440000000146607055334370016511 #include char line[100]; /* line from input */ /* Running total of all numbers so far */ int total; /* next item to add to the list */ int item; /* number of negative items */ int minus_items; main() { total = 0; minus_items = 0; while (1) { (void) printf("Enter # to add\n"); (void) printf(" or 0 to stop:"); (void) fgets(line, sizeof(line), stdin); (void) sscanf(line, "%d", &item); if (item == 0) break; if (item < 0) { minus_items++; continue; } total += item; (void) printf("Total: %d\n", total); } (void) printf("Final total %d\n", total); (void) printf("with %d negative items omitted\n", minus_items); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/06_1.c0000644000076400001440000000132507055334370016502 #include char line[100];/* line of data from the input */ int result; /* the result of the calculations */ char operator; /* operator the user specified */ int value; /* value specified after the operator */ main() { result = 0; /* initialize the result */ /* Loop forever (or till we hit the break statement) */ while (1) { (void) printf("Result: %d\n", result); (void) printf("Enter operator and number: "); (void) fgets(line, sizeof(line), stdin); (void) sscanf(line, "%c %d", &operator, &value); if (operator = '+') { result += value; } else { (void) printf("Unknown operator %c\n", operator); } } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/06_2.c0000644000076400001440000000221407055334405016500 #include char line[100];/* line of text from input */ int result; /* the result of the calculations */ char operator; /* operator the user specified */ int value; /* value specified after the operator */ main() { result = 0; /* initialize the result */ /* loop forever (or until break reached) */ while (1) { (void) printf("Result: %d\n", result); (void) printf("Enter operator and number: "); (void) fgets(line, sizeof(line), stdin); (void) sscanf(line, "%c %d", &operator, &value); if ((operator == 'q') || (operator == 'Q')) break; if (operator == '+') { result += value; } else if (operator == '-') { result -= value; } else if (operator == '*') { result *= value; } else if (operator == '/') { if (value == 0) { (void)printf("Error:Divide by zero\n"); (void)printf(" operation ignored\n"); } else result /= value; } else { (void) printf("Unknown operator %c\n", operator); } } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/06_3.c0000644000076400001440000000505207055334370016505 /******************************************************** * guess -- a simple guessing game * * * * Usage: * * guess * * * * A random number is chosen between 1 and 100. * * The player is given a set of bounds and * * must choose a number between them. * * If the player chooses the correct number he wins* * Otherwise the bounds are adjusted to reflect * * the player's guess and the game continues. * * * * * * Restrictions: * * The random number is generated by the statement * * rand() % 100. Because rand() returns a number * * 0 <= rand() <= maxint this slightly favors * * the lower numbers. * ********************************************************/ #include #include /* ANSI Standard only */ int number_to_guess; /* random number to be guessed */ int low_limit; /* current lower limit of player's range */ int high_limit; /* current upper limit of player's range */ int guess_count; /* number of times player guessed */ int player_number; /* number gotten from the player */ char line[80]; /* input buffer for a single line */ main() { while (1) { /* * Not a pure random number, see restrictions */ number_to_guess = rand() % 100 + 1; /* Initialize variables for loop */ low_limit = 0; high_limit = 100; guess_count = 0; while (1) { /* tell user what the bounds are and get his guess */ (void) printf("Bounds %d - %d\n", low_limit, high_limit); (void) printf("Value[%d]? ", guess_count); guess_count++; (void) fgets(line, sizeof(line), stdin); (void) sscanf(line, "%d", &player_number); /* did he guess right? */ if (player_number == number_to_guess) break; /* adjust bounds for next guess */ if (player_number < number_to_guess) low_limit = player_number; else high_limit = player_number; } (void) printf("Bingo\n"); } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/07_1.c0000644000076400001440000000100607055334370016477 #include int total; /* total of all the numbers */ int current; /* current value from the user */ int counter; /* while loop counter */ char line[80]; /* Line from keyboard */ main() { total = 0; counter = 0; while (counter < 5) { (void)printf("Number? "); (void)fgets(line, sizeof(line), stdin); (void)sscanf(line, "%d", ¤t); total += current; counter++; } (void)printf("The grand total is %d\n", total); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/07_2.c0000644000076400001440000000076507055334371016514 #include int total; /* total of all the numbers */ int current; /* current value from the user */ int counter; /* for loop counter */ char line[80]; /* Input from keyboard */ main() { total = 0; for (counter = 0; counter < 5; counter++) { (void)printf("Number? "); (void)fgets(line, sizeof(line), stdin); (void)sscanf(line, "%d", ¤t); total += current; } (void)printf("The grand total is %d\n", total); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/07_3.c0000644000076400001440000000231407055334405016503 #include char line[100]; /* line of text from input */ int result; /* the result of the calculations */ char operator; /* operator the user specified */ int value; /* value specified after the operator */ main() { result = 0; /* initialize the result */ /* loop forever (or until break reached) */ while (1) { (void) printf("Result: %d\n", result); (void) printf("Enter operator and number: "); (void) fgets(line, sizeof(line), stdin); (void) sscanf(line, "%c %d", &operator, &value); if ((operator == 'q') || (operator == 'Q')) break; switch (operator) { case '+': result += value; break; case '-': result -= value; break; case '*': result *= value; break; case '/': if (value == 0) { (void)printf("Error:Divide by zero\n"); (void)printf(" operation ignored\n"); } else result /= value; break; default: (void) printf("Unknown operator %c\n", operator); break; } } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/08_1.c0000644000076400001440000000051307055334371016503 #include main() { int counter; /* loop counter */ for (counter = 0; counter < 3; counter++) { int temporary = 1; static int permanent = 1; (void)printf("Temporary %d Permanent %d\n", temporary, permanent); temporary++; permanent++; } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/08_2.c0000644000076400001440000000161307055334371016506 #include main() { /* Compute a triangle */ float triangle(float width, float height); (void)printf("Triangle #1 %f\n", triangle(1.3, 8.3)); (void)printf("Triangle #2 %f\n", triangle(4.8, 9.8)); (void)printf("Triangle #3 %f\n", triangle(1.2, 2.O)); return (0); } /******************************************** * triangle -- compute area of a triangle * * * * Parameters * * width -- width of the triangle * * height -- height of the triangle * * * * Returns * * area of the triangle * ********************************************/ float triangle(float width, float height) { float area; /* Area of the triangle */ area = width * height / 2.0; return (area); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/08_3.c0000644000076400001440000000007707055334371016512 main() { init(); solve_problems(); finish_up(); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/09_1.c0000644000076400001440000000040007055334405016475 int data[10]; /* some data */ int twice[10]; /* twice some data */ main() { int index; /* index into the data */ for (index = 0; index < 10; index++) { data[index] = index; twice[index] = index * 2; } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/09_2.c0000644000076400001440000000045407055334371016511 #define SIZE 20 /* work on 20 elements */ int data[SIZE]; /* some data */ int twice[SIZE]; /* twice some data */ main() { int index; /* index into the data */ for (index = 0; index < SIZE; index++) { data[index] = index; twice[index] = index * 2; } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/09_3.c0000644000076400001440000000036607055334371016514 #define BIG_NUMBER 10 ** 10 main() { /* index for our calculations */ int index; index = 0; /* syntax error on next line */ while (index < BIG_NUMBER) { index = index * 8; } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/09_4.c0000644000076400001440000000037507055334371016515 #include #define SQR(x) (x * x) main() { int counter; /* counter for loop */ for (counter = 0; counter < 5; counter++) { (void)printf("x %d, x squared %d\n", counter+1, SQR(counter+1)); } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/09_5.c0000644000076400001440000000035607055334405016513 #include #define SQR(x) ((x) * (x)) main() { int counter; /* counter for loop */ counter = 0; while (counter < 5) (void)printf("x %d square %d\n", counter, SQR(counter++)); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/10_1.c0000644000076400001440000000253007055334372016476 #include #define X_SIZE 40 /* size of array in the X direction */ #define Y_SIZE 60 /* size of the array in Y direction */ /* * We use X_SIZE/8 since we pack 8 bits per byte */ char graphics[X_SIZE / 8][Y_SIZE]; /* the graphics data */ #define SET_BIT(x,y) graphics[(x)/8][y] |= (0x80 >>((x)%8)) main() { int loc; /* current location we are setting */ void print_graphics(void); /* print the data */ for (loc = 0; loc < X_SIZE; loc++) SET_BIT(loc, loc); print_graphics(); return (0); } /******************************************************** * print_graphics -- print the graphics bit array * * as a set of X and .'s. * ********************************************************/ void print_graphics(void) { int x; /* current x BYTE */ int y; /* current y location */ int bit; /* bit we are testing in the current byte */ for (y = 0; y < Y_SIZE; y++) { /* Loop for each byte in the array */ for (x = 0; x < X_SIZE / 8; x++) { /* Handle each bit */ for (bit = 0x80; bit > 0; bit = (bit >> 1)) { if ((graphics[x][y] & bit) != 0) (void) printf("X"); else (void) printf("."); } } (void) printf("\n"); } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/11_1.c0000644000076400001440000000122007055334372016472 /* * Define a variable to hold an integer or * a real number (but not both) */ union value { long int i_value; /* The real number */ float f_value; /* The floating-point number */ } data; int i; /* Random integer */ float f; /* Random floating-point number */ main() { data.f_value = 5.0; data.i_value = 3; /* data.f_value overwritten */ i = data.i_value; /* legal */ f = data.f_value; /* not legal, will generate unexpected results */ data.f_value = 5.5; /* put something in f_value/clobber i_value */ i = data.i_value; /* not legal, will generate unexpected results */ } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/12_1.c0000644000076400001440000000107207055334353016477 #include main() { int thing_var; /* define a variable for thing */ int *thing_ptr; /* define a pointer to thing */ thing_var = 2; /* assigning a value to thing */ (void)printf("Thing %d\n", thing_var); thing_ptr = &thing_var; /* make the pointer point to thing */ *thing_ptr = 3; /* thing_ptr points to thing_var so */ /* thing_var changes to 3 */ (void)printf("Thing %d\n", thing_var); /* another way of doing the printf */ (void)printf("Thing %d\n", *thing_ptr); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/12_2.c0000644000076400001440000000040407055334354016477 #include main() { int count = 0; /* number of times through */ void inc_count(int *);/* update the counter */ while (count < 10) inc_count(&count); return (0); } void inc_count(int *count_ptr) { (*count_ptr)++; } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/12_3.c0000644000076400001440000000062307055334354016503 #define ARRAY_SIZE 10 /* Number of characters in array */ /* Array to print */ char array[ARRAY_SIZE] = "012345678"; main() { int index; /* Index into the array */ for (index = 0; index < ARRAY_SIZE; index++) { (void)printf( "&array[index]=0x%x (array+index)=0x%x array[index]=0x%x\n", &array[index], (array+index), array[index]); } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/12_4.c0000644000076400001440000000037507055334405016505 #include int array[10] = {4, 5, 8, 9, 8, 1, 0, 1, 9, 3}; int index; main() { index = 0; while (array[index] != 0) index++; (void) printf("Number of elements before zero %d\n", index); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/12_5.c0000644000076400001440000000043307055334354016504 #include int array[10] = {4, 5, 8, 9, 8, 1, 0, 1, 9, 3}; int *array_ptr; main() { array_ptr = array; while ((*array_ptr) != 0) array_ptr++; (void) printf("Number of elements before zero %d\n", array_ptr - array); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/12_6.c0000644000076400001440000000256107055334354016511 #define MAX 10 main() { int array[MAX]; void init_array_1(); void init_array_2(); /* one way of initializing the array */ init_array_1(array); /* another way of initializing the array */ init_array_1(&array[0]); /* works, but the compiler generates a warning */ init_array_1(&array); /* Similar to the first method but */ /* function is different */ init_array_2(array); return (0); } /******************************************************** * init_array_1 -- Zero out an array * * * * Parameters * * data -- the array to zero * ********************************************************/ void init_array_1(int data[]) { int index; for (index = 0; index < MAX; index++) data[index] = 0; } /******************************************************** * init_array_2 -- Zero out an array * * * * Parameters * * data_ptr -- pointer to array to zero * ********************************************************/ void init_array_2(int *data_ptr) { int index; for (index = 0; index < MAX; index++) *(data_ptr + index) = 0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/12_7.c0000644000076400001440000000413307055334355016510 /******************************************************** * split -- split an entry of the form Last/First * * into two parts. * ********************************************************/ #include #include /* Our version of the library function */ char *strchr(char *, char); main() { char line[80]; /* The input line */ char *first_ptr; /* pointer to the first name */ char *last_ptr; /* pointer to the last name */ (void)fgets(line, sizeof(line), stdin); /* Get rid of trailing newline */ line[strlen(line)-1] = '\0'; last_ptr = line; /* last name is at beginning of line */ first_ptr = strchr(line, '/'); /* Find slash */ /* Check for an error */ if (first_ptr == NULL) { (void)fprintf(stderr, "Error: Unable to find slash in %s\n", line); exit (8); } *first_ptr = '\0'; /* Zero out the slash */ first_ptr++; /* Move to first character of name */ (void)printf("First:%s Last:%s\n", first_ptr, last_ptr); return (0); } /******************************************************** * strchr -- find a character in a string * * Duplicate of a standard library function, * * put here for illustrative purposes. * * * * Parameters * * string_ptr -- string to look through * * find -- character to find * * * * Returns * * pointer to 1st occurrence of character * * in string or NULL for error * ********************************************************/ char *strchr(char * string_ptr, char find) { while (*string_ptr != find) { /* Check for end */ if (*string_ptr == '\0') return (NULL); /* not found */ string_ptr++; } return (string_ptr); /* Found */ } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/12_8.c0000644000076400001440000000627607055334406016520 /******************************************************** * print -- format files for printing * ********************************************************/ #include #include /* ANSI Standard only */ int verbose = 0; /* verbose mode (default = false) */ char *out_file = "print.out"; /* output filename */ char *program_name; /* name of the program (for errors) */ int line_max = 66; /* number of lines per page */ main(int argc, char *argv[]) { void do_file(char *); /* print a file */ void usage(void); /* tell user how to use the program */ /* save the program name for future use */ program_name = argv[0]; /* * loop for each option. * Stop if we run out of arguments * or we get an argument without a dash. */ while ((argc > 1) && (argv[1][0] == '-')) { /* * argv[1][1] is the actual option character. */ switch (argv[1][1]) { /* * -v verbose */ case 'v': verbose = 1; break; /* * -o output file * [0] is the dash * [1] is the "o" * [2] starts the name */ case 'o': out_file = &argv[1][2]; break; /* * -l set max number of lines */ case 'l': line_max = atoi(&argv[1][2]); break; default: (void)fprintf(stderr,"Bad option %s\n", argv[1]); usage(); } /* * move the argument list up one * move the count down one */ argv++; argc--; } /* * At this point all the options have been processed. * Check to see if we have no files in the list * and if so, we need to process just standard in. */ if (argc == 1) { do_file("print.in"); } else { while (argc > 1) { do_file(argv[1]); argv++; argc--; } } return (0); } /******************************************************** * do_file -- dummy routine to handle a file * * * * Parameter * * name -- name of the file to print * ********************************************************/ void do_file(char *name) { (void)printf("Verbose %d Lines %d Input %s Output %s\n", verbose, line_max, name, out_file); } /******************************************************** * usage -- tell the user how to use this program and * * exit * ********************************************************/ void usage(void) { (void)fprintf(stderr,"Usage is %s [options] [file-list]\n", program_name); (void)fprintf(stderr,"Options\n"); (void)fprintf(stderr," -v verbose\n"); (void)fprintf(stderr," -l Number of lines\n"); (void)fprintf(stderr," -o Set output filename\n"); exit (8); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/13_1.c0000644000076400001440000000125407055334355016504 #include #define FILE_NAME "input.txt" #include /* ANSI Standard C file */ main() { int count = 0; /* number of characters seen */ FILE *in_file; /* input file */ /* character or EOF flag from input */ int ch; in_file = fopen(FILE_NAME, "r"); if (in_file == NULL) { (void)printf("Can not open %s\n", FILE_NAME); exit(8); } while (1) { ch = fgetc(in_file); if (ch == EOF) break; count++; } (void) printf("Number of characters in %s is %d\n", FILE_NAME, count); (void) fclose(in_file); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/13_2.c0000644000076400001440000000412607055334356016507 /**************************************** * copy -- copy one file to another. * * * * Usage * * copy * * * * -- the file to copy from * * -- the file to copy into * ****************************************/ #include #ifndef __MSDOS__ /* if we are not MS-DOS */ #define __UNIX__ /* then we are UNIX */ #endif __MSDOS__ #include /* ANSI Standard C file */ #ifdef __UNIX__ #include /* file defines for UNIX filesystem */ #include #include #endif __UNIX__ #ifdef __MSDOS__ #include /* file defines for DOS filesystem */ #include #include #endif __MSDOS__ void exit(); /* lib routine */ #define BUFFER_SIZE (16 * 1024) /* use 16K buffers */ main(int argc, char *argv[]) { char buffer[BUFFER_SIZE]; /* buffer for data */ int in_file; /* input file descriptor */ int out_file; /* output file descriptor */ int read_size; /* number of bytes on last read */ if (argc != 3) { (void) fprintf(stderr, "Error:Wrong number of arguments\n"); (void) fprintf(stderr, "Usage is: copy \n"); exit(8); } in_file = open(argv[1], O_RDONLY); if (in_file < 0) { (void) fprintf("Error:Unable to open %s\n", argv[1]); exit(8); } out_file = open(argv[2], O_WRONLY | O_TRUNC | O_CREAT, 0666); if (out_file < 0) { (void) fprintf("Error:Unable to open %s\n", argv[2]); exit(8); } while (1) { read_size = read(in_file, buffer, sizeof(buffer)); if (read_size == 0) break; /* end of file */ if (read_size < 0) { (void) fprintf(stderr, "Error:Read error\n"); exit(8); } (void) write(out_file, buffer, (unsigned int) read_size); } (void) close(in_file); (void) close(out_file); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/15_1.c0000644000076400001440000000133207055334407016501 #include main() { /* two numbers to work with */ float number1, number2; float result; /* result of calculation */ int counter; /* loop counter and accuracy check */ number1 = 1.0; number2 = 1.0; counter = 0; while (number1 + number2 != number1) { counter++; number2 = number2 / 10.0; } (void) printf("%2d digits accuracy in calculations\n", counter); number2 = 1.0; counter = 0; while (1) { result = number1 + number2; if (result == number1) break; counter++; number2 = number2 / 10.0; } (void) printf("%2d digits accuracy in storage\n", counter); return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/16_1.c0000644000076400001440000000017307055334362016504 #include /* using ANSI C standard libraries */ main() { char *string_ptr; string_ptr = malloc(80); c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/16_2.c0000644000076400001440000000174507055334362016513 /******************************************************** * find -- look for a data item in the list * * * * Parameters * * name -- name to look for in the list * * * * Returns * * 1 if name is found * * 0 if name is not found * ********************************************************/ int file(char *name) { /* current structure we are looking at */ struct linked_list *current_ptr; current_ptr = first_ptr; while ((strcmp(current_ptr->data, name) != 0) && (current_ptr != NULL)) current_ptr = current_ptr->next_ptr; /* * If current_ptr is null, we fell off the end of the list and * didn't find the name */ return (current_ptr != NULL); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/16_3.c0000644000076400001440000001244007055334363016507 /******************************************************** * words -- scan a file and print out a list of words * * in ASCII order. * * * * Usage: * * words * ********************************************************/ #include #include #include #include /* ANSI Standard only */ struct node { struct node *right; /* tree to the right */ struct node *left; /* tree to the left */ char *word; /* word for this tree */ }; /* the top of the tree */ static struct node *root = NULL; main(int argc, char *argv[]) { void scan(char *); /* scan the files for words */ void print_tree(struct node *);/* print the words in the file */ if (argc != 2) { (void) fprintf(stderr, "Error:Wrong number of parameters\n"); (void) fprintf(stderr, " on the command line\n"); (void) fprintf(stderr, "Usage is:\n"); (void) fprintf(stderr, " words 'file'\n"); exit(8); } scan(argv[1]); print_tree(root); return (0); } /******************************************************** * scan -- scan the file for words * * * * Parameters * * name -- name of the file to scan * ********************************************************/ void scan(char *name) { char word[100]; /* word we are working on */ int index; /* index into the word */ int ch; /* current character */ FILE *in_file; /* input file */ /* enter a word into the tree */ void enter(struct node **, char *); in_file = fopen(name, "r"); if (in_file == NULL) { (void) fprintf(stderr, "Error:Unable to open %s\n", name); exit(8); } while (1) { /* scan past the whitespace */ while (1) { ch = fgetc(in_file); if (isalpha(ch) || (ch == EOF)) break; } if (ch == EOF) break; word[0] = ch; for (index = 1; index < sizeof(word); index++) { ch = fgetc(in_file); if (!isalpha(ch)) break; word[index] = ch; } /* put a null on the end */ word[index] = '\0'; enter(&root, word); } (void) fclose(in_file); } /******************************************************** * enter -- enter a word into the tree * * * * Parameters * * node -- current node we are looking at * * word -- word to enter * ********************************************************/ void enter(struct node **node, char *word) { int result; /* result of strcmp */ char *save_string(char *); /* save a string on the heap */ void memory_error(void); /* tell user no more room */ /* see if we have reached the end */ if ((*node) == NULL) { (*node) = (struct node *) malloc(sizeof(struct node)); if ((*node) == NULL) memory_error(); (*node)->left = NULL; (*node)->right = NULL; (*node)->word = save_string(word); } result = strcmp((*node)->word, word); if (result == 0) return; if (result < 0) enter(&(*node)->right, word); else enter(&(*node)->left, word); } /******************************************************** * save_string -- save a string on the heap * * * * Parameters * * string -- string to save * * * * Returns * * pointer to malloc-ed section of memory with * * the string copied into it. * ********************************************************/ char *save_string(char *string) { char *new_string; /* where we are going to put string */ new_string = malloc((unsigned) (strlen(string) + 1)); if (new_string == NULL) memory_error(); (void) strcpy(new_string, string); return (new_string); } /******************************************************** * memory_error -- write error and die * ********************************************************/ void memory_error(void) { (void) fprintf(stderr, "Error:Out of memory\n"); exit(8); } /******************************************************** * print_tree -- print out the words in a tree * * * * Parameters * * top -- the root of the tree to print * ********************************************************/ void print_tree(struct node *top) { if (top == NULL) return; /* short tree */ print_tree(top->left); (void) printf("%s\n", top->word); print_tree(top->right); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/17_1.c0000644000076400001440000001124507055334410016501 /******************************************************** * infinite-array -- routines to handle infinite arrays * * * * An infinite array is an array that grows as needed. * * There is no index too large for an infinite array * * (unless we run out of memory). * ********************************************************/ #include "ia.h" /* get common definitions */ #include #include /* ANSI Standard only */ /* * the following three variables implement * a very simple pointer cache * * They store information on the last infinite array used, * the last bucket we had and the last index used * * They are initialized to values we know will never * be used by any real array. */ static struct infinite_array *cache_array_ptr = NULL; static struct infinite_array *cache_bucket_ptr = NULL; static int cache_index = -1; /******************************************************** * ia_store -- store an element into an infinite array. * * * * Parameters * * array_ptr -- pointer to the array to use * * index -- index into the array * * store_data -- data to store * ********************************************************/ void ia_store(struct infinite_array * array_ptr, int index, float store_data) { /* pointer to the current bucket */ struct infinite_array *current_ptr; int current_index; /* index into the current bucket */ /* get the location in an infinite array cell */ struct infinite_array *ia_locate( struct infinite_array *, int, int *); current_ptr = ia_locate(array_ptr, index, ¤t_index); current_ptr->data[current_index] = store_data; } /******************************************************** * ia_get -- get an element from an infinite array. * * * * Parameters * * array_ptr -- pointer to the array to use * * index -- index into the array * * * * Returns * * the value of the element * ********************************************************/ float ia_get(struct infinite_array *array_ptr, int index) { /* pointer to the current bucket */ struct infinite_array *current_ptr; int current_index; /* index into the current bucket */ /* get the location an infinite array cell */ struct infinite_array *ia_locate(); current_ptr = ia_locate(array_ptr, index, ¤t_index); return (current_ptr->data[current_index]); } /******************************************************** * ia_locate -- get the location of an infinite array * * element. * * * * Parameters * * array_ptr -- pointer to the array to use * * index -- index into the array * * current_index -- pointer to the index into this * * bucket (returned) * * * * Returns * * pointer to the current bucket * ********************************************************/ static struct infinite_array ia_locate( struct infinite_array *array_ptr, int index int *current_index_ptr) { /* pointer to the current bucket */ struct infinite_array *current_ptr; /* see if the cache will do us any good */ if ((cache_array_ptr == array_ptr) && (index >= cache_index)) { current_ptr = cache_bucket_ptr; *current_index_ptr = index - cache_index; } else { current_ptr = array_ptr; *current_index_ptr = index; } while (*current_index_ptr > BLOCK_SIZE) { if (current_ptr->next == NULL) { current_ptr->next = (struct infinite_array *) malloc(sizeof(struct infinite_array)); if (current_ptr->next == NULL) { (void) fprintf(stderr, "Error:Out of memory\n"); exit(8); } } current_ptr = current_ptr->next; *current_index_ptr -= BLOCK_SIZE; } cache_index = index - (index % BLOCK_SIZE); cache_array_ptr = array_ptr; cache_bucket_ptr = current_ptr; return (current_ptr); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/17_2.c0000644000076400001440000001074707055334365016521 /******************************************************** * hist -- generate a histogram of an array of numbers * * * * Usage * * hist * * * * Where * * file is the name of the file to work on * ********************************************************/ #include "ia.h" #include #include /* ANSI Standard only */ #include /* * the following definitions define the histogram */ #define NUMBER_OF_LINES 50 #define LOW_BOUND 0.0 #define HIGH_BOUND 99.0 /* * if we have NUMBER_OF_LINES data to * output then each item must use * the following factor */ #define FACTOR \ ((HIGH_BOUND - LOW_BOUND) / ((float) (NUMBER_OF_LINES-1))) /* number of characters wide to make the histogram */ #define WIDTH 60 static struct infinite_array data_array; static int data_items; main(int argc, char *argv[]) { void read_data(char *); /* get the data into the array */ void print_histogram(void);/* print the data */ if (argc != 2) { (void) fprintf(stderr, "Error:Wrong number of arguments\n"); (void) fprintf(stderr, "Usage is:\n"); (void) fprintf(stderr, " hist \n"); exit(8); } ia_init(&data_array); data_items = 0; read_data(argv[1]); print_histogram(); return (0); } /******************************************************** * read_data -- read data from the input file into * * the data_array. * * * * Parameters * * name -- the name of the file to read * ********************************************************/ void read_data(char *name) { char line[100]; /* line from input file */ FILE *in_file; /* input file */ float data; /* data from input */ in_file = fopen(name, "r"); if (in_file == NULL) { (void) fprintf(stderr, "Error:Unable to open %s\n", name); exit(8); } while (1) { if (fgets(line, sizeof(line), in_file) == NULL) break; if (sscanf(line, "%f", &data) != 1) { (void) fprintf(stderr, "Error: Input data not floating point number\n"); (void) fprintf(stderr, "Line:%s", line); } ia_store(&data_array, data_items, data); data_items++; } fclose(in_file); } /******************************************************** * print_histogram -- print the histogram output. * ********************************************************/ void print_histogram(void) { /* upper bound for printout */ int counters[NUMBER_OF_LINES]; float low; /* lower bound for printout */ int out_of_range = 0;/* number of items out of bounds */ int max_count = 0;/* biggest counter */ float scale; /* scale for outputting dots */ int index; /* index into the data */ (void) memset((char *) counters, '\0', sizeof(counters)); for (index = 0; index < data_items; index++) { float data;/* data for this point */ data = ia_get(&data_array, index); if ((data < LOW_BOUND) || (data > HIGH_BOUND)) out_of_range++; else { /* index into counters array */ int count_index; count_index = (data - LOW_BOUND) / FACTOR; counters[count_index]++; if (counters[count_index] > max_count) max_count = counters[count_index]; } } scale = ((float) max_count) / ((float) WIDTH); low = LOW_BOUND; for (index = 0; index < NUMBER_OF_LINES; index++) { /* index for outputting the dots */ int char_index; int number_of_dots; /* number of * to output */ (void) printf("%2d:%3.0f-%3.0f (%4d): ", index, low, low + FACTOR -1, counters[index]); number_of_dots = (int) (((float) counters[index]) / scale); for (char_index = 0; char_index < number_of_dots; char_index++) (void) printf("*"); (void) printf("\n"); low += FACTOR; } (void) printf("%d items out of range\n", out_of_range); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/makefile.unix0000644000076400001440000000047207055334377020364 SRCS=tlint.c macros.c symbol.c fonts.c OBJS=tlint.o macros.o symbol.o fonts.o tlint:$(OBJS) cc $(CFLAGS) -o tlint $(OBJS) lint: lint -xh $(SRCS) fonts.o: fonts.c gen.h symbol.h macros.o: font.h gen.h macro.h macros.c symbol.h symbol.o: symbol.c symbol.h tlint.o: font.h gen.h macro.h tlint.c c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_01.c0000644000076400001440000000451507055334357016572 /******************************************************** * Database -- A very simple database program to * * look up names in a hardcoded list. * * * * Usage: * * database * * Program will ask you for a name. * * Enter the name; it will tell you if * * it is the list. * * * * A blank name terminates the program. * ********************************************************/ #define STRING_LENGTH 80 /* Length of typical string */ #include main() { char name[STRING_LENGTH]; /* a name to lookup */ int lookup(char *); /* lookup a name */ while (1) { (void)printf("Enter name: "); (void)fgets(name, sizeof(name), stdin); /* Check for blank name */ /* (remember 1 character for newline) */ if (strlen(name) <= 1) break; /* Get rid of newline */ name[strlen(name)-1] = '\0'; if (lookup(name)) (void)printf("%s is in the list\n", name); else (void)printf("%s is not in the list\n", name); } return (0); } /******************************************************** * lookup -- lookup a name in a list * * * * Parameters * * name -- name to lookup * * * * Returns * * 1 -- name in the list * * 0 -- name not in the list * ********************************************************/ int lookup(char *name) { /* List of people in the database */ /* Note: Last name is a NULL for end of list */ static char *list[] = { "John", "Jim", "Jane", "Clyde", NULL }; int index; /* index into list */ for (index = 0; list[index] != NULL; index++) { if (strcmp(list[index], name) == 0) return (1); } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_02.c0000644000076400001440000000240007055334403016552 #include /* * The main program will open this file if -S is on * the command line. */ FILE *save_file = NULL; /******************************************************** * extended_fgets -- get a line from the input file * * and record it in a save file if needed. * * * * Parameters * * line -- the line to read * * size -- sizeof(line) -- maximum number of * * characters to read * * file -- file to read data from * * (normally stdin) * * * * Returns * * NULL -- error or end of file in read * * otherwise line (just like fgets) * ********************************************************/ char *extended_fgets(char *line, int size, FILE *file) { char *result; /* result of fgets */ result = fgets(line, size, file); /* did someone ask for a save file */ if (save_file != NULL) (void)fputs(line, save_file); return (result); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_03.c0000644000076400001440000000363507055334356016575 /******************************************************** * Database -- A very simple database program to * * lookup names in a hardcoded list. * * * * Usage: * * database [-S] * * * * -S Specify save file for * * debugging purposes * * * * Program will ask you for a name. * * Enter the name; it will tell you if * * it is the list. * * * * A blank name terminates the program. * ********************************************************/ #include FILE *save_file = NULL; /* Save file if any */ char *extended_fgets(char *, int, FILE *); main(int argc, char *argv[]) { char name[80]; /* a name to lookup */ char *save_file_name; /* Name of the save file */ int lookup(char *); /* lookup a name */ while ((argc > 1) && (argv[1][0] == '-')) { switch (argv[1][1]) { case 'S': save_file_name = &argv[1][2]; save_file = fopen(save_file_name, "w"); if (save_file == NULL) (void)fprintf(stderr, "Warning:Unable to open save file %s\n", save_file_name); break; default: (void)fprintf(stderr,"Bad option: %s\n", argv[1]); exit (8); } argc--; argv++; } while (1) { (void)printf("Enter name: "); (void)extended_fgets(name, sizeof(name), stdin); /* ... Rest of program ... */ c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_04.c0000644000076400001440000000312607055334360016564 #include FILE *save_file = NULL; /* Save input in this file */ FILE *playback_file = NULL; /* Playback data from this file */ /******************************************************** * extended_fgets -- get a line from the input file * * and record it in a save file if needed * * * * Parameters * * line -- the line to read * * size -- sizeof(line) -- maximum number of * * characters to read * * file -- file to read data from * * (normally stdin) * * * * Returns * * NULL -- error or end of file in read * * otherwise line (just like fgets) * ********************************************************/ char *extended_fgets(char *line, int size, FILE *file) { extern FILE *save_file; /* file to save strings in */ extern FILE *playback_file; /* file for alternate input */ char *result; /* result of fgets */ if (playback_file != NULL) { result = fgets(line, size, file); /* echo the input to the standard out so the user sees it */ (void)fputs(line, stdout); } else result = fgets(line, size, file); /* did someone ask for a save file */ if (save_file != NULL) (void)fputs(line, save_file); return (result); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_05.c0000644000076400001440000000503707055334360016570 /******************************************************** * Database -- A very simple database program to * * lookup names in a hardcoded list. * * * * Usage: * * database [-S] [-P] * * * * -S Specify save file for * * debugging purposes. * * * * -P Specify playback file for * * debugging or demonstration. * * * * * * Program will ask you for a name. * * Enter the name; it will tell you if * * it is the list. * * * * A blank name terminates the program. * ********************************************************/ #include FILE *save_file = NULL; /* Save file if any */ FILE *playback_file = NULL; /* Playback file if any */ char *extended_fgets(char *, int, FILE *); main(int argc, char *argv[]) { char name[80]; /* a name to lookup */ char *save_file_name; /* Name of the save file */ char *playback_file_name; /* Name of the playback file */ int lookup(char *); /* lookup a name */ while ((argc > 1) && (argv[1][0] == '-')) { switch (argv[1][1]) { case 'S': save_file_name = &argv[1][2]; save_file = fopen(save_file_name, "w"); if (save_file == NULL) (void)fprintf(stderr, "Warning:Unable to open save file %s\n", save_file_name); break; case 'P': playback_file_name = &argv[1][2]; playback_file = fopen(playback_file_name, "r"); if (playback_file == NULL) { (void)fprintf(stderr, "Error:Unable to open playback file %s\n", playback_file_name); exit (8); } break; default: (void)fprintf(stderr,"Bad option: %s\n", argv[1]); exit (8); } argc--; argv++; } /* ... rest of program ... */ c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_06.c0000644000076400001440000000202007055334361016557 #include int seven_count; /* number of seven's in the data */ int data[5]; /* the data to count 3 and 7 in */ int three_count; /* the number of threes in the data */ main() { int index; /* index into the data */ void get_data(int data[]); seven_count = 0; three_count = 0; get_data(data); for (index = 1; index <= 5; index++) { if (data[index] == 3) three_count++; if (data[index] == 7) seven_count++; } (void)printf("Three's %d Seven's %d\n", three_count, seven_count); return (0); } /******************************************************** * get_data -- get 5 numbers from the command line * ********************************************************/ void get_data(int data[]) { char line[100]; /* line of input */ (void)printf("Enter 5 numbers\n"); (void)fgets(line, sizeof(line), stdin); (void)sscanf(line, "%d %d %d %d %d", &data[1], &data[2], &data[3], &data[4], &data[5]); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_07.c0000644000076400001440000000434607055334404016573 /******************************************************** * search -- Search a set of numbers. * * * * Usage: * * search * * you will be asked numbers to lookup * * * * Files: * * numbers.dat -- numbers 1 per line to search * * (Numbers must be ordered) * ********************************************************/ #include #define MAX_NUMBERS 1000 /* Max numbers in file */ #define DATA_FILE "numbers.dat" /* File with numbers */ int data[MAX_NUMBERS]; /* Array of numbers to search */ int max_count; /* Number of valid elements in data */ main() { FILE *in_file; /* Input file */ int middle; /* Middle of our search range */ int low, high; /* Upper/lower bound */ int search; /* number to search for */ char line[80]; /* Input line */ in_file = fopen(DATA_FILE, "r"); if (in_file == NULL) { (void)fprintf(stderr,"Error:Unable to open %s\n", DATA_FILE); exit (8); } /* * Read in data */ max_count = 0; while (1) { if (fgets(line, sizeof(line), in_file) == NULL) break; /* convert number */ (void)sscanf(line, "%d", data[max_count]); max_count++; } while (1) { (void)printf("Enter number to search for or -1 to quit:" ); (void)fgets(line, sizeof(line), stdin); (void)sscanf(line, "%d", &search); if (search == -1) break; low = 0; high = max_count; while (1) { middle = (low + high) / 2; if (data[middle] == search) { (void)printf("Found at index %d\n", middle); } if (low == high) { (void)printf("Not found\n"); break; } if (data[middle] < search) low = middle; else high = middle; } } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_08.c0000644000076400001440000000437607055334362016602 /******************************************************** * search -- Search a set of numbers. * * * * Usage: * * search * * you will be asked numbers to lookup * * * * Files: * * numbers.dat -- numbers 1 per line to search * * (Numbers must be ordered) * ********************************************************/ #include #define MAX_NUMBERS 1000 /* Max numbers in file */ #define DATA_FILE "numbers.dat" /* File with numbers */ int data[MAX_NUMBERS]; /* Array of numbers to search */ int max_count; /* Number of valid elements in data */ main() { FILE *in_file; /* Input file */ int middle; /* Middle of our search range */ int low, high; /* Upper/lower bound */ int search; /* number to search for */ char line[80]; /* Input line */ in_file = fopen(DATA_FILE, "r"); if (in_file == NULL) { (void)fprintf(stderr,"Error:Unable to open %s\n", DATA_FILE); exit (8); } /* * Read in data */ max_count = 0; while (1) { if (fgets(line, sizeof(line), in_file) == NULL) break; /* convert number */ (void)sscanf(line, "%d", &data[max_count]); max_count++; } while (1) { (void)printf("Enter number to search for or -1 to quit:" ); (void)fgets(line, sizeof(line), stdin); (void)sscanf(line, "%d", &search); if (search == -1) break; low = 0; high = max_count; while (1) { if (low >= high) { (void)printf("Not found\n"); break; } middle = (low + high) / 2; if (data[middle] == search) { (void)printf("Found at index %d\n", middle); break; } if (data[middle] < search) low = middle +1; else high = middle -1; } } return (0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_09.c0000644000076400001440000000046307055334362016574 float point_color(point_number) int point_number; { float correction; /* color correction factor */ extern float red,green,blue;/* current colors */ correction = lookup(point_number); return (red*correction * 100.0 + blue*correction * 10.0 + green*correction); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_10.c0000644000076400001440000000037407055334406016564 #include main() { int i,j; /* two random integers */ i = 1; j = 0; (void)printf("Starting\n"); (void)printf("Before divide..."); i = i / j; /* divide by zero error */ (void)printf("After\n"); return(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_11.c0000644000076400001440000000051207055334356016563 #include main() { int i,j; /* two random integers */ i = 1; j = 0; (void)printf("Starting\n"); (void)fflush(stdout); (void)printf("Before divide..."); (void)fflush(stdout); i = i / j; /* divide by zero error */ (void)printf("After\n"); (void)fflush(stdout); return(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_12.c0000644000076400001440000000040507055334356016565 #define X_SIZE 60 #define Y_SIZE 30 int matrix[X_SIZE][Y_SIZE]; void init_matrix(void) { int x,y; /* current element to zero */ for (x = 0; x < X_SIZE; x++) { for (y = 0; y < Y_SIZE; y++) { matrix[x][y] = -1; } } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_13.c0000644000076400001440000000041607055334356016570 #define X_SIZE 60 #define Y_SIZE 30 int matrix[X_SIZE][Y_SIZE]; void init_matrix(void) { register int x,y; /* current element to zero */ for (x = 0; x < X_SIZE; x++) { for (y = 0; y < Y_SIZE; y++) { matrix[x][y] = -1; } } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_14.c0000644000076400001440000000041607055334356016571 #define X_SIZE 60 #define Y_SIZE 30 int matrix[X_SIZE][Y_SIZE]; void init_matrix(void) { register int x,y; /* current element to zero */ for (y = 0; y < Y_SIZE; y++) { for (x = 0; x < X_SIZE; x++) { matrix[x][y] = -1; } } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_15.c0000644000076400001440000000041607055334356016572 #define X_SIZE 60 #define Y_SIZE 32 int matrix[X_SIZE][Y_SIZE]; void init_matrix(void) { register int x,y; /* current element to zero */ for (y = 0; y < Y_SIZE; y++) { for (x = 0; x < X_SIZE; x++) { matrix[x][y] = -1; } } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_16.c0000644000076400001440000000050007055334356016565 #define X_SIZE 60 #define Y_SIZE 30 int matrix[X_SIZE][Y_SIZE]; void init_matrix(void) { register int index; /* element counter */ register int *matrix_ptr; matrix_ptr = &matrix[0][0]; for (index = 0; index < X_SIZE * Y_SIZE; index++) { *matrix_ptr = -1; matrix_ptr++; } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_17.c0000644000076400001440000000043007055334357016571 #define X_SIZE 60 #define Y_SIZE 30 int matrix[X_SIZE][Y_SIZE]; void init_matrix(void) { register int *matrix_ptr; for (matrix_ptr = &matrix[0][0]; matrix_ptr <= &matrix[X_SIZE-1][Y_SIZE-1]; matrix_ptr++) { *matrix_ptr = -1; } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_18.c0000644000076400001440000000021207055334357016570 #define X_SIZE 60 #define Y_SIZE 30 int matrix[X_SIZE][Y_SIZE]; void init_matrix(void) { (void)memset(matrix, -1, sizeof(matrix)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_PRACTICAL_C/14_19.c0000644000076400001440000000021007055334357016567 #define X_SIZE 60 #define Y_SIZE 30 int matrix[X_SIZE][Y_SIZE]; #define init_matrix() \ (void)memset(matrix, -1, sizeof(matrix)); c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/0000777000076400001440000000000007474405214015340 5c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/10.h0000644000076400001440000000124107055334412015637 extern int MyPid; /* the shell's process id */ extern int MyPgrp; /* the shell's process group */ extern int TermPgrp; /* the terminal's process group */ #define JSTOPPED (1L<<1) #define JRUNNING (1L<<2) #define JNEEDNOTE (1L<<3) #define PTTYINPUT (1L<<1) #define PTTYOUTPUT (1L<<2) #define PSTOPSIGNAL (1L<<3) #define PSTOPPED (1L<<4) #define PDONE (1L<<5) #define PEXITED (1L<<6) #define PCOREDUMP (1L<<7) #define PSIGNALED (1L<<8) struct _PROC { int pid; int status; int exitcode; int termsig; struct _PROC *next; }; typedef struct _PROC PROC; struct _JOB { int status; int pgrp; PROC *procs; }; typedef struct _JOB JOB; c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/a.1.c0000644000076400001440000000010007055334434015766 hello_() /* note underscore */ { printf("Hello, world.\n"); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/a.2.c0000644000076400001440000000005207055334434015775 extern hello(); main() { hello_(); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/a.3.c0000644000076400001440000000013307055334434015776 main() { extern long y_(); long i; i = y_(); } long x_() { return(5L); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/a.4.c0000644000076400001440000000024107055334434015777 typedef struct { float r, i; } complex; main() { extern complex y_(); complex i; y_(&i); } x_(c) complex *c; { c->r = 1.0; c->i = 2.0; } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/a.5.c0000644000076400001440000000053407055334434016005 main() { extern char *y_(); char s[15]; y_(s, 15L); } x_(s, len) char *s; long len; { s[0] = 'a'; s[1] = 'b'; s[2] = 'c'; s[3] = 'd'; s[4] = 'e'; s[5] = 'f'; s[6] = 'g'; s[7] = 'h'; s[8] = 'i'; s[9] = 'j'; s[10] = 'k'; s[11] = 'l'; s[12] = 'm'; s[13] = 'n'; s[14] = 'o'; } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/a.6.c0000644000076400001440000000025607055334434016007 main() { extern y_(); long a, b, c; a = 4; b = 5; c = 6; y_(&a, &b, &c); } x_(u, v, w) long *u, *v, *w; { *u *= 2; *v *= 3; *w *= 4; } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/a.7.c0000644000076400001440000000021507055334434016003 main() { extern char *y_(); char *i; i = "hi there"; y_(i, 8L); } x_(s, len) char *s; long len; { write(1, s, len); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/b.1.c0000644000076400001440000001007207055334435016001 #include #include #include #include #include ptyopen(cmd, ifp, ofp) char *cmd; FILE **ifp, **ofp; { int i; char *args[16]; register int tty; long ldisc, lmode; register char *s, *t; struct sgttyb sgttyb; struct tchars tchars; struct ltchars ltchars; char ttybuf[16], ptybuf[16]; /* * Split up the arguments in the command * into an argv-like structure. */ i = 0; s = cmd; while (*s) { /* * Skip white space. */ while ((*s == ' ') || (*s == '\t')) *s++ = NULL; args[i++] = s; /* * Skip over this word to next white space. */ while ((*s != NULL) && (*s != ' ') && (*s != '\t')) s++; } args[i] = NULL; /* * Get a pseudo-tty. We do this by cycling through all * the possible names. The operating system will not * allow us to open a master which is already in use, * so we simply go until the open succeeds. */ for (s = "pqrs"; *s != NULL; s++) { for (t = "0123456789abcdef"; *t != NULL; t++) { sprintf(ptybuf, "/dev/pty%c%c", *s, *t); if ((tty = open(ptybuf, O_RDWR)) >= 0) goto out; } } out: /* * If s and t are NULL, we ran out of pseudo ttys * before we found one we can use. */ if ((*s == NULL) && (*t == NULL)) return(-1); /* * Change "ptyXX" (master) to "ttyXX" (slave). */ strcpy(ttybuf, ptybuf); ttybuf[5] = 't'; /* * Get the modes of the current terminal. We * will duplicate these on the pseudo terminal. */ ioctl(0, TIOCGETD, &ldisc); ioctl(0, TIOCLGET, &lmode); ioctl(0, TIOCGETP, &sgttyb); ioctl(0, TIOCGETC, &tchars); ioctl(0, TIOCGLTC, <chars); /* * Fork a child process. */ if ((i = fork()) < 0) { close(tty); return(-1); } /* * In the child... */ if (i == 0) { /* * Close all open files. */ for (i = 0; i < NOFILE; i++) close(i); /* * Clear the controlling tty. This means * that we will not have a controlling * tty until we open another terminal * device. */ if ((i = open("/dev/tty", O_RDWR)) >= 0) { ioctl(i, TIOCNOTTY, 0); close(i); } /* * Make our controlling tty the pseudo tty. * This happens because we cleared our * original controlling terminal above. */ i = open(ttybuf, O_RDWR); /* * Set stdin, stdout, and stderr to be the * pseudo terminal. */ dup2(i, 0); dup2(i, 1); dup2(i, 2); /* * Set the pseudo terminal's tty modes to * those of the original terminal. We * turn off ECHO and CBREAK modes, since * we don't want characters "typed" to be * printed. */ sgttyb.sg_flags &= ~ECHO; sgttyb.sg_flags &= ~CRMOD; ioctl(0, TIOCSETD, &ldisc); ioctl(0, TIOCLGET, &lmode); ioctl(0, TIOCSETP, &sgttyb); ioctl(0, TIOCSETC, &tchars); ioctl(0, TIOCSLTC, <chars); /* * Set the process group of the process * to be the process group of the * terminal. */ ioctl(0, TIOCGPGRP, &i); setpgrp(0, i); /* * Now change the process group of the * terminal and process to be the * process id; this takes them out * of the calling process's process * group. */ i = getpid(); ioctl(0, TIOCSPGRP, &i); setpgrp(0, i); /* * Execute the program. */ execv(*args, args); exit(1); } /* * Set up the input and output file pointers * so that they can write and read the pseudo * terminal. */ *ifp = fdopen(tty, "w"); *ofp = fdopen(tty, "r"); return(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/c.1.c0000644000076400001440000000451207055334436016005 #include #include #include #include #include /* * We declare an array of nlist structures, * and initialize them to the names of the * variables we want. The last entry is * to terminate the list. */ struct nlist nl[] = { #define X_BOOTTIME 0 { "_boottime" }, #define X_AVENRUN 1 { "_avenrun" }, { 0 } }; main() { int kmem; char *ctime(); struct timeval boottime; /* * _avenrun is an array of three numbers. * Most machines use floating point; Sun * workstations use long integers. */ #ifdef sun long avenrun[3]; #else double avenrun[3]; #endif /* * Open kernel memory. */ if ((kmem = open("/dev/kmem", O_RDONLY)) < 0) { perror("/dev/kmem"); exit(1); } /* * Read the kernel namelist. If nl[0].n_type is * 0 after this, then the call to nlist() failed. */ if ((nlist("/vmunix", nl) < 0) || (nl[0].n_type == 0)) { fprintf(stderr, "/vmunix: no namelist\n"); exit(1); } /* * Read the _boottime variable. We do this by * seeking through memory to the address found * by nlist, and then reading. */ lseek(kmem, (long) nl[X_BOOTTIME].n_value, L_SET); read(kmem, (char *) &boottime, sizeof(boottime)); /* * Read the load averages. */ lseek(kmem, (long) nl[X_AVENRUN].n_value, L_SET); read(kmem, (char *) avenrun, sizeof(avenrun)); /* * Now print the system boot time. */ printf("System booted at %s\n", ctime(&boottime.tv_sec)); /* * Print the load averages. Sun workstations use * FSCALE to convert the long integers to floating * point. The three elements of _avenrun are the * load average over the past one, five, and ten * minutes. */ #ifdef sun printf("One minute load average: %.2f\n", (double) avenrun[0] / FSCALE); printf("Five minute load average: %.2f\n", (double) avenrun[1] / FSCALE); printf("Ten minute load average: %.2f\n", (double) avenrun[2] / FSCALE); #else printf("One minute load average: %.2f\n", avenrun[0]); printf("Five minute load average: %.2f\n", avenrun[1]); printf("Ten minute load average: %.2f\n", avenrun[2]); #endif close(kmem); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/d.1.c0000644000076400001440000000425107055334437016007 /* * Non-BSD systems only. */ #include #include #include #include #define DIRSIZE(e) (min(strlen(e->d_name), DIRSIZ)) typedef struct { int d_fd; } DIR; char *malloc(); DIR * opendir(dir) char *dir; { struct stat stbuf; DIR *dp = (DIR *) malloc(sizeof *dp); if ((dp->d_fd = open(dir, 0)) < 0) return(0); if ((fstat(dp->d_fd, &stbuf) < 0) || ((stbuf.st_mode & S_IFDIR) == 0)) { closedir(dp); return(0); /* this isn't a directory! */ } return(dp); } closedir(dp) DIR *dp; { (void) close(dp->d_fd); free((char *) dp); } struct direct * readdir(dp) DIR *dp; { static struct direct dir; do { if (read(dp->d_fd, &dir, sizeof(dir)) != sizeof(dir)) return(0); } while (dir.d_ino == 0); return(&dir); } /* * Scandir returns the number of entries or -1 if the * directory cannot be opened or malloc fails. */ scandir(dir, nmptr, select, compar) char *dir; char ***nmptr; int (*select)(); int (*compar)(); { DIR *dirp; char **array; char **realloc(); struct direct *ent; unsigned int nalloc = 10, nentries = 0; if ((dirp = opendir(dir)) == NULL) return(-1); array = (char **) malloc(nalloc * sizeof (char *)); if (array == NULL) return(-1); while ((ent = readdir(dirp)) != NULL) { if (select && ((*select)(ent->d_name) == 0)) continue; if (nentries == nalloc) { array = realloc(array, (nalloc += 10) * sizeof(char *)); if (array == NULL) return(-1); } array[nentries] = (char *) malloc(DIRSIZE(ent)+1); strncpy(array[nentries], ent->d_name, DIRSIZE(ent)); array[nentries][DIRSIZE(ent)] = NULL; nentries++; } closedir(dirp); if ((nentries + 1) != nalloc) array = realloc(array, ((nentries + 1) * sizeof (char *))); if (compar != 0) qsort(array, nentries, sizeof(char **), compar); *nmptr = array; array[nentries] = 0; /* guaranteed 0 pointer */ return(nentries); } alphasort(a, b) char **a, **b; { return(strcmp(*a, *b)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/e.1.c0000644000076400001440000000334107055334440016001 #include #include #define setvec(vec, a) \ vec.sv_handler = a; \ vec.sv_mask = vec.sv_flags = 0 static int ringring; nap(n) unsigned n; { void napx(); int omask; struct sigvec vec, ovec; struct itimerval itv, oitv; register struct itimerval *itp = &itv; if (n == 0) return; timerclear(&itp->it_interval); timerclear(&itp->it_value); if (setitimer(ITIMER_REAL, itp, &oitv) < 0) return; setvec(ovec, SIG_DFL); omask = sigblock(sigmask(SIGALRM)); itp->it_value.tv_sec = n/60; itp->it_value.tv_usec = (n%60)*1000000/60; if (timerisset(&oitv.it_value)) { if (oitv.it_value.tv_sec >= itp->it_value.tv_sec) { if (oitv.it_value.tv_sec == itp->it_value.tv_sec && oitv.it_value.tv_usec > itp->it_value.tv_usec) oitv.it_value.tv_usec -= itp->it_value.tv_usec; oitv.it_value.tv_sec -= itp->it_value.tv_sec; } else { itp->it_value = oitv.it_value; /* * This is a hack, but we must have time to return from * the setitimer after the alarm or else it will restart. * And, anyway, sleep never did more than this before. */ oitv.it_value.tv_sec = 1; oitv.it_value.tv_usec = 0; } } setvec(vec, napx); ringring = 0; sigvec(SIGALRM, &vec, &ovec); setitimer(ITIMER_REAL, itp, (struct itimerval *)0); while (!ringring) sigpause(omask &~ sigmask(SIGALRM)); sigvec(SIGALRM, &ovec, (struct sigvec *)0); setitimer(ITIMER_REAL, &oitv, (struct itimerval *)0); sigsetmask(omask); } static void napx() { ringring = 1; } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/nap.c0000644000076400001440000000334107055334440016174 #include #include #define setvec(vec, a) \ vec.sv_handler = a; \ vec.sv_mask = vec.sv_flags = 0 static int ringring; nap(n) unsigned n; { void napx(); int omask; struct sigvec vec, ovec; struct itimerval itv, oitv; register struct itimerval *itp = &itv; if (n == 0) return; timerclear(&itp->it_interval); timerclear(&itp->it_value); if (setitimer(ITIMER_REAL, itp, &oitv) < 0) return; setvec(ovec, SIG_DFL); omask = sigblock(sigmask(SIGALRM)); itp->it_value.tv_sec = n/60; itp->it_value.tv_usec = (n%60)*1000000/60; if (timerisset(&oitv.it_value)) { if (oitv.it_value.tv_sec >= itp->it_value.tv_sec) { if (oitv.it_value.tv_sec == itp->it_value.tv_sec && oitv.it_value.tv_usec > itp->it_value.tv_usec) oitv.it_value.tv_usec -= itp->it_value.tv_usec; oitv.it_value.tv_sec -= itp->it_value.tv_sec; } else { itp->it_value = oitv.it_value; /* * This is a hack, but we must have time to return from * the setitimer after the alarm or else it will restart. * And, anyway, sleep never did more than this before. */ oitv.it_value.tv_sec = 1; oitv.it_value.tv_usec = 0; } } setvec(vec, napx); ringring = 0; sigvec(SIGALRM, &vec, &ovec); setitimer(ITIMER_REAL, itp, (struct itimerval *)0); while (!ringring) sigpause(omask &~ sigmask(SIGALRM)); sigvec(SIGALRM, &ovec, (struct sigvec *)0); setitimer(ITIMER_REAL, &oitv, (struct itimerval *)0); sigsetmask(omask); } static void napx() { ringring = 1; } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/dircom.c0000644000076400001440000000425107055334437016702 /* * Non-BSD systems only. */ #include #include #include #include #define DIRSIZE(e) (min(strlen(e->d_name), DIRSIZ)) typedef struct { int d_fd; } DIR; char *malloc(); DIR * opendir(dir) char *dir; { struct stat stbuf; DIR *dp = (DIR *) malloc(sizeof *dp); if ((dp->d_fd = open(dir, 0)) < 0) return(0); if ((fstat(dp->d_fd, &stbuf) < 0) || ((stbuf.st_mode & S_IFDIR) == 0)) { closedir(dp); return(0); /* this isn't a directory! */ } return(dp); } closedir(dp) DIR *dp; { (void) close(dp->d_fd); free((char *) dp); } struct direct * readdir(dp) DIR *dp; { static struct direct dir; do { if (read(dp->d_fd, &dir, sizeof(dir)) != sizeof(dir)) return(0); } while (dir.d_ino == 0); return(&dir); } /* * Scandir returns the number of entries or -1 if the * directory cannot be opened or malloc fails. */ scandir(dir, nmptr, select, compar) char *dir; char ***nmptr; int (*select)(); int (*compar)(); { DIR *dirp; char **array; char **realloc(); struct direct *ent; unsigned int nalloc = 10, nentries = 0; if ((dirp = opendir(dir)) == NULL) return(-1); array = (char **) malloc(nalloc * sizeof (char *)); if (array == NULL) return(-1); while ((ent = readdir(dirp)) != NULL) { if (select && ((*select)(ent->d_name) == 0)) continue; if (nentries == nalloc) { array = realloc(array, (nalloc += 10) * sizeof(char *)); if (array == NULL) return(-1); } array[nentries] = (char *) malloc(DIRSIZE(ent)+1); strncpy(array[nentries], ent->d_name, DIRSIZE(ent)); array[nentries][DIRSIZE(ent)] = NULL; nentries++; } closedir(dirp); if ((nentries + 1) != nalloc) array = realloc(array, ((nentries + 1) * sizeof (char *))); if (compar != 0) qsort(array, nentries, sizeof(char **), compar); *nmptr = array; array[nentries] = 0; /* guaranteed 0 pointer */ return(nentries); } alphasort(a, b) char **a, **b; { return(strcmp(*a, *b)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/Makefile.am0000644000076400001440000000021307055334441017302 EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) $(wildcard *.h) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/Makefile.in0000644000076400001440000002463107474405126017331 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.c) $(wildcard *.h) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/C/CONTRIB/OR_USING_C mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/C/CONTRIB/OR_USING_C/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/OR_USING_C/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/OR_USING_C/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=05.2.c a.4.c 10.2.c 03.1.c 09.2.c 02.3.c 08.4.c 12.2.c 11.4.c 05.1.c 04.3.c b.1.c a.3.c 10.h 14.2.c 07.1.c d.1.c 10.1.c a.7.c 09.1.c 02.2.c 08.3.c 12.1.c 11.3.c 10.5.c 04.2.c a.2.c 14.1.c 08.7.c 13.3.c 11.7.c nap.c a.6.c 02.1.c 08.2.c 11.2.c 10.4.c 04.1.c a.1.c 09.4.c 02.5.c 08.6.c 13.2.c 11.6.c 06.1.c 05.3.c c.1.c a.5.c HEADER.html 08.1.c e.1.c 11.1.c 10.3.c dircom.c 03.2.c 09.3.c 02.4.c 08.5.c 13.1.c 12.3.c 11.5.c DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/C/CONTRIB/OR_USING_C/Makefile cd $(top_srcdir) && perl admin/am_edit reference/C/CONTRIB/OR_USING_C/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/HEADER.html0000644000076400001440000000026707055334441017075

    Using C - O'Reilly

    Reprinted with permission from 'Using C on the UNIX System' copyright 1989 O'Reilly and Associates, Inc. For orders and information, call 1-800-988-9938. c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/02.1.c0000644000076400001440000000155107055334440015777 #include main(argc, argv) int argc; char **argv; { int c; FILE *from, *to; /* * Check our arguments. */ if (argc != 3) { fprintf(stderr, "Usage: %s from-file to-file\n", *argv); exit(1); } /* * Open the from-file for reading. */ if ((from = fopen(argv[1], "r")) == NULL) { perror(argv[1]); exit(1); } /* * Open the to-file for appending. If to-file does * not exist, fopen will create it. */ if ((to = fopen(argv[2], "a")) == NULL) { perror(argv[2]); exit(1); } /* * Now read characters from from-file until we * hit end-of-file, and put them onto to-file. */ while ((c = getc(from)) != EOF) putc(c, to); /* * Now close the files. */ fclose(from); fclose(to); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/02.2.c0000644000076400001440000000156107055334423016002 #include main(argc, argv) int argc; char **argv; { FILE *from, *to; char line[BUFSIZ]; /* * Check our arguments. */ if (argc != 3) { fprintf(stderr, "Usage: %s from-file to-file\n", *argv); exit(1); } /* * Open the from-file for reading. */ if ((from = fopen(argv[1], "r")) == NULL) { perror(argv[1]); exit(1); } /* * Open the to-file for appending. If to-file does * not exist, fopen will create it. */ if ((to = fopen(argv[2], "a")) == NULL) { perror(argv[2]); exit(1); } /* * Now read a line at a time from the from-file, * and write it to the to-file. */ while (fgets(line, BUFSIZ, from) != NULL) fputs(line, to); /* * Now close the files. */ fclose(from); fclose(to); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/02.3.c0000644000076400001440000000170407055334424016003 #include main(argc, argv) int argc; char **argv; { int n; FILE *from, *to; char buf[BUFSIZ]; /* * Check our arguments. */ if (argc != 3) { fprintf(stderr, "Usage: %s from-file to-file\n", *argv); exit(1); } /* * Open the from-file for reading. */ if ((from = fopen(argv[1], "r")) == NULL) { perror(argv[1]); exit(1); } /* * Open the to-file for appending. If to-file does * not exist, fopen will create it. */ if ((to = fopen(argv[2], "a")) == NULL) { perror(argv[2]); exit(1); } /* * Note that we only write the number of characters fread * read in, rather than always writing BUFSIZ characters. */ while ((n = fread(buf, sizeof(char), BUFSIZ, from)) > 0) fwrite(buf, sizeof(char), n, to); /* * Now close the files. */ fclose(from); fclose(to); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/02.4.c0000644000076400001440000000041007055334424015775 #include main() { int n, m; printf("Enter a number: "); scanf("%d", &n); m = fact(n); printf("The factorial of %d is %d.\n", n, m); exit(0); } fact(n) int n; { if (n == 0) return(1); return(n * fact(n-1)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/02.5.c0000644000076400001440000000221707055334424016005 /* * */ #include struct record { int uid; char login[9]; }; char *logins[] = { "user1", "user2", "user3", "user4", "user5" }; main() { int i; FILE *fp; struct record rec; /* * Open the data file for writing. */ if ((fp = fopen("datafile", "w")) == NULL) { perror("datafile"); exit(1); } /* * For each user, going backwards... */ for (i = 4; i >= 0; i--) { /* * Create the record. */ rec.uid = i; strcpy(rec.login, logins[i]); /* * Output the record. Notice we pass the * address of the structure. */ putrec(fp, i, &rec); } fclose(fp); exit(0); } /* * putrec--write the record in the i'th position. */ putrec(fp, i, r) int i; FILE *fp; struct record *r; { /* * Seek to the i'th position from the beginning * of the file. */ fseek(fp, (long) i * sizeof(struct record), 0); /* * Write the record. We want to write one * object the size of a record structure. */ fwrite(r, sizeof(struct record), 1, fp); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/03.1.c0000644000076400001440000000257607055334424016012 /* Change to if you're on System V. */ #include main(argc, argv) int argc; char **argv; { int n; int from, to; char buf[1024]; /* * Check our arguments. Note that to write the error * message we can't just use "%s" as we did in Example * 2-3; we have to write each string separately. */ if (argc != 3) { write(2, "Usage: ", 7); write(2, *argv, strlen(*argv)); write(2, " from-file to-file\n", 19); exit(1); } /* * Open the from-file for reading. */ if ((from = open(argv[1], O_RDONLY)) < 0) { perror(argv[1]); exit(1); } /* * Open the to-file for appending. If to-file does * not exist, open will create it with mode 644 * (-rw-r--r--). Note that we specify the mode * in octal, not decimal */ if ((to = open(argv[2], O_WRONLY|O_CREAT|O_APPEND, 0644)) < 0) { perror(argv[2]); exit(1); } /* * Now read a buffer-full at a time from the from-file, * and write it to the to-file. Note that we only * write the number of characters read read in, * rather than always writing 1024 characters. */ while ((n = read(from, buf, sizeof(buf))) > 0) write(to, buf, n); /* * Now close the files. */ close(from); close(to); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/03.2.c0000644000076400001440000000231507055334425016003 /* * If you're on System V, change to . */ #include struct record { int uid; char login[9]; }; char *logins[] = { "user1", "user2", "user3", "user4", "user5" }; main() { int i, fd; struct record rec; /* * Open the data file for writing. */ if ((fd = open("datafile", O_WRONLY | O_CREAT, 0644)) < 0) { perror("datafile"); exit(1); } /* * For each user, going backwards... */ for (i = 4; i >= 0; i--) { /* * Create the record. */ rec.uid = i; strcpy(rec.login, logins[i]); /* * Output the record. Notice we pass the * address of the structure. */ putrec(fd, i, &rec); } close(fd); exit(0); } /* * putrec--write the record in the i'th position. */ putrec(fd, i, r) int i, fd; struct record *r; { /* * Seek to the i'th position from the beginning * of the file. */ lseek(fd, (long) i * sizeof(struct record), L_SET); /* * Write the record. We want to write one * object the size of a record structure. */ write(fd, r, sizeof(struct record)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/04.1.c0000644000076400001440000000160007055334425015777 /* * Non-BSD systems only. */ #include #include #include main() { FILE *fp; struct direct dir; int n; if ((fp = fopen(".", "r")) == NULL) { perror("current directory"); exit(1); } /* * Read directory entries. Since we're reading * entries one at a time, we use the fread routine, * which buffers them internally. Don't use the * low-level read to do things this way, since * reading very small quantities of data (16 bytes) * at a time is very inefficient. */ while ((n = fread(&dir, sizeof(dir), 1, fp)) > 0) { /* * Skip removed files. */ if (dir.d_ino == 0) continue; /* * Make sure we print no more than DIRSIZ * characters. */ printf("%.*s\n", DIRSIZ, dir.d_name); } fclose(fp); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/04.2.c0000644000076400001440000000103207055334425015777 /* * For use with 4.2 and 4.3BSD systems. */ #include #include #include main() { DIR *dp; struct direct *dir; if ((dp = opendir(".")) == NULL) { fprintf(stderr, "cannot open directory.\n"); exit(1); } /* * Read entries... */ while ((dir = readdir(dp)) != NULL) { /* * Skip removed files. */ if (dir->d_ino == 0) continue; printf("%s\n", dir->d_name); } closedir(dp); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/04.3.c0000644000076400001440000000726207055334426016014 #include #include #include #include char *modes[] = { "---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx" }; main(argc, argv) int argc; char **argv; { struct stat sbuf; /* * If no arguments, list current directory. */ if (argc < 2) { list("."); exit(0); } /* * Process arguments. */ while (--argc) { /* * See what the file is. */ if (stat(*++argv, &sbuf) < 0) { perror(*argv); continue; } /* * If it's a directory we list it, * otherwise just print the info about * the file. */ if ((sbuf.st_mode & S_IFMT) == S_IFDIR) list(*argv); else printout(".", *argv); } exit(0); } /* * list--read a directory and list the files it * contains. */ list(name) char *name; { DIR *dp; struct direct *dir; /* * Open the directory. */ if ((dp = opendir(name)) == NULL) { fprintf(stderr, "%s: cannot open.\n", name); return; } /* * For each entry... */ while ((dir = readdir(dp)) != NULL) { /* * Skip removed files. */ if (dir->d_ino == 0) continue; /* * Print it out. */ printout(name, dir->d_name); } closedir(dp); } /* * printout--print out the information about * a file. */ printout(dir, name) char *dir, *name; { int i, j; char perms[10]; struct stat sbuf; char newname[1024]; /* * Make full path name, so * we have a legal path. */ sprintf(newname, "%s/%s", dir, name); /* * At this point we know the file exists, * so this won't fail. */ stat(newname, &sbuf); /* * Print size in kbytes. */ printf("%5d ", (sbuf.st_size + 1023) / 1024); /* * Get the file type. For convenience (and to * make this example universal), we ignore the * other types which are version-dependent. */ switch (sbuf.st_mode & S_IFMT) { case S_IFREG: putchar('-'); break; case S_IFDIR: putchar('d'); break; case S_IFCHR: putchar('c'); break; case S_IFBLK: putchar('b'); break; default: putchar('?'); break; } /* * Get each of the three groups of permissions * (owner, group, world). Since they're just * bits, we can count in binary and use this * as a subscript (see the modes array, above). */ *perms = NULL; for (i = 2; i >= 0; i--) { /* * Since we're subscripting, we don't * need the constants. Just get a * value between 0 and 7. */ j = (sbuf.st_mode >> (i*3)) & 07; /* * Get the perm bits. */ strcat(perms, modes[j]); } /* * Handle special bits which replace the 'x' * in places. */ if ((sbuf.st_mode & S_ISUID) != 0) perms[2] = 's'; if ((sbuf.st_mode & S_ISGID) != 0) perms[5] = 's'; if ((sbuf.st_mode & S_ISVTX) != 0) perms[8] = 't'; /* * Print permissions, number of links, * user and group ids. */ printf("%s%3d %5d/%-5d ", perms, sbuf.st_nlink, sbuf.st_uid, sbuf.st_gid); /* * Print the size of the file in bytes, * and the last modification time. The * ctime routine converts a time to ASCII; * it is described in Chapter 7, Telling * Time and Timing Things. */ printf("%7d %.12s ", sbuf.st_size, ctime(&sbuf.st_mtime)+4); /* * Finally, print the filename. */ printf("%s\n", name); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/05.1.c0000644000076400001440000000360307055334427016007 #include #include main(argc, argv) int argc; char **argv; { struct sgttyb sgo, sgn; struct tchars tco, tcn; if (argc < 2) { fprintf(stderr, "Usage: %s file [file ...]\n", *argv); exit(1); } /* * In real life we'd check the return values of * these, since if the input is redirected from * a file they will fail. We are assuming the * terminal is always connected to the standard * input. */ ioctl(0, TIOCGETP, &sgo); ioctl(0, TIOCGETC, &tco); sgn = sgo; sgn.sg_flags &= ~ECHO; /* turn off ECHO */ sgn.sg_flags |= CBREAK; /* turn on CBREAK */ tcn = tco; tcn.t_intrc = -1; /* disable int key */ /* * Set the new modes. Again we ignore return * values. */ ioctl(0, TIOCSETP, &sgn); ioctl(0, TIOCSETC, &tcn); while (--argc) more(*++argv); /* * Reset the old tty modes. */ ioctl(0, TIOCSETP, &sgo); ioctl(0, TIOCSETC, &tco); exit(0); } /* * more--display the file. */ more(file) char *file; { FILE *fp; int line; char linebuf[1024]; if ((fp = fopen(file, "r")) == NULL) { perror(file); return; } /* * Print 22 lines at a time. */ for (;;) { line = 1; while (line < 22) { /* * If end-of-file, let them hit a key one * more time and then go back. */ if (fgets(linebuf, sizeof(linebuf), fp) == NULL) { fclose(fp); prompt(); return; } fwrite(linebuf, 1, strlen(linebuf), stdout); line++; } prompt(); } } /* * prompt--prompt for a character. */ prompt() { char answer; printf("Type any character for next page: "); answer = getchar(); putchar('\n'); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/05.2.c0000644000076400001440000000342507055334427016012 #include #include main(argc, argv) int argc; char **argv; { struct termio tio, tin; if (argc < 2) { fprintf(stderr, "Usage: %s file [file ...]\n", *argv); exit(1); } /* * In real life we'd check the return value of * this, since if the input is redirected from a * file it will fail. We are assuming the * terminal is always connected to the standard * input. */ ioctl(0, TCGETA, &tio); tin = tio; tin.c_lflag &= ~ECHO; /* turn off ECHO */ tin.c_lflag &= ~ICANON; /* turn off ICANON */ /* * Emulate CBREAK mode. */ tin.c_cc[VMIN] = 1; tin.c_cc[VTIME] = 0; /* * Set the new modes. Again we ignore return * values. */ ioctl(0, TCSETA, &tin); while (--argc) more(*++argv); /* * Reset the old tty modes. */ ioctl(0, TCSETA, &tio); exit(0); } /* * more--display the file. */ more(file) char *file; { FILE *fp; int line; char linebuf[1024]; if ((fp = fopen(file, "r")) == NULL) { perror(file); return; } /* * Print 22 lines at a time. */ for (;;) { line = 1; while (line < 22) { /* * If end-of-file, let them hit a key one * more time and then go back. */ if (fgets(linebuf, sizeof(linebuf), fp) == NULL) { fclose(fp); prompt(); return; } fwrite(linebuf, 1, strlen(linebuf), stdout); line++; } prompt(); } } /* * prompt--prompt for a character. */ prompt() { char answer; printf("Type any character for next page: "); answer = getchar(); putchar('\n'); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/05.3.c0000644000076400001440000000243307055334430016003 #include #include #include main() { int n, nfds; char buf[32]; fd_set readfds; struct timeval tv; /* * We will be reading from standard input (file * descriptor 0), so we want to know when the * user has typed something. */ FD_ZERO(&readfds); FD_SET(0, &readfds); /* * Set the timeout for 15 seconds. */ tv.tv_sec = 15; tv.tv_usec = 0; /* * Prompt for input. */ printf("Type a word; if you don't in 15 "); printf("seconds I'll use \"WORD\": "); fflush(stdout); /* * Now call select. We pass NULL for * writefds and exceptfds, since we * aren't interested in them. */ nfds = select(1, &readfds, NULL, NULL, &tv); /* * Now we check the results. If nfds is zero, * then we timed out, and should assume the * default. Otherwise, if file descriptor 0 * is set in readfds, that means that it is * ready to be read, and we can read something * from it. */ if (nfds == 0) { strcpy(buf, "WORD"); } else { if (FD_ISSET(0, &readfds)) { n = read(0, buf, sizeof(buf)); buf[n-1] = '\0'; } } printf("\nThe word is: %s\n", buf); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/06.1.c0000644000076400001440000000237007055334430016002 #include #include #include #define UTMP "/etc/utmp" #define NAMELEN 8 main() { FILE *fp; struct utmp u; struct passwd *p; char tmp[NAMELEN+1]; struct passwd *getpwnam(); if ((fp = fopen(UTMP, "r")) == NULL) { perror(UTMP); exit(1); } /* * For each entry... */ while (fread(&u, sizeof(u), 1, fp) != NULL) { /* * Skip non-logged in ports. */ if (u.ut_name[0] == NULL) continue; /* * Make sure name is null-terminated. */ strncpy(tmp, u.ut_name, NAMELEN); /* * Skip non-existent users (shouldn't * be any). */ if ((p = getpwnam(tmp)) == NULL) continue; /* * Print the line. ctime() converts the time * to ASCII format, it is described in Chapter * 7, Telling Time and Timing Things. We * ignore the format of the gecos field and * just print the first 30 characters; in real * life we would stop at a comma or some such. */ printf("%-10.8s %-10.8s %-30.30s %s", u.ut_name, u.ut_line, p->pw_gecos, ctime(&u.ut_time)); } fclose(fp); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/07.1.c0000644000076400001440000000055207055334430016003 #include #include main() { struct tms before, after; times(&before); /* ... place code to be timed here ... */ times(&after); printf("User time: %ld seconds\n", after.tms_utime - before.tms_utime); printf("System time: %ld seconds\n", after.tms_stime - before.tms_stime); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/08.1.c0000644000076400001440000000024707055334430016005 #include main() { signal(SIGINT, SIG_IGN); /* * pause() just suspends the process until a * signal is received. */ pause(); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/08.2.c0000644000076400001440000000106107055334430016001 #include main() { /* * Declare handler routine so we can use its name. */ extern int handler(); /* * Send signal to handler routine. */ signal(SIGINT, handler); /* * Loop here. */ for (;;) pause(); } /* * handler--handle the signal. */ handler() { /* * Users of 4.2 and 4.3BSD systems should un-comment * this line, which will make this program * behave as if it were on a non-Berkeley system. */ /* signal(SIGINT, SIG_DFL); */ printf("OUCH\n"); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/08.3.c0000644000076400001440000000122107055334430016000 #include main() { /* * Declare handler routine so we can use its * name. */ extern int handler(); /* * Send signal to handler routine. */ signal(SIGINT, handler); /* * Loop here. */ for (;;) pause(); } /* * handler--handle the signal. */ handler() { /* * Users of 4.2 and 4.3BSD systems should un-comment * this line, which will make this program * behave as if it were on a non-Berkeley system. */ /* signal(SIGINT, SIG_DFL); */ printf("OUCH\n"); /* * Reset the signal to come here again. */ signal(SIGINT, handler); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/08.4.c0000644000076400001440000000172107055334431016007 #include main() { /* * Declare handler routine so we can use its * name. */ extern int handler(); /* * Send signal to handler routine. Only do so * if the signal is not already being ignored. */ if (signal(SIGINT, SIG_IGN) != SIG_IGN) signal(SIGINT, handler); /* * Loop here. */ for (;;) pause(); } /* * handler--handle the signal. sig is the signal * number which interrupted us. */ handler(sig) int sig; { /* * Users of 4.2 and 4.3BSD systems should un-comment * this line, which will make this program * behave as if it were on a non-Berkeley * system (we reset the signal by hand). */ /* signal(sig, SIG_DFL); */ /* * Ignore the signal for the duration of this * routine. */ signal(sig, SIG_IGN); printf("OUCH\n"); /* * Reset the signal to come here again. */ signal(SIGINT, handler); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/08.5.c0000644000076400001440000000270207055334431016010 #include #include /* * The environment for setjmp. */ jmp_buf env; main() { int i; char buf[16]; extern int timeout(); /* * Inform the system we want to catch the * alarm signal. */ signal(SIGALRM, timeout); /* * The code inside the if gets executed the first * time through setjmp, the code inside the else * the second time. */ if (setjmp(env) == 0) { /* * Issue a request for an alarm to be * delivered in 15 seconds. */ alarm(15); /* * Prompt for input. */ printf("Type a word; if you don't in 15 "); printf("seconds I'll use \"WORD\": "); gets(buf); /* * Turn off the alarm. */ alarm(0); } else { /* * Assume the default. */ strcpy(buf, "WORD"); } printf("\nThe word is: %s\n", buf); exit(0); } /* * timeout--catch the signal. */ timeout(sig) int sig; { /* * Ignore the signal for the duration of this * routine. */ signal(sig, SIG_IGN); /* * We would perform any timeout-related * functions here; in this case there * are none. */ /* * Restore the action of the alarm signal. */ signal(SIGALRM, timeout); /* * Return to the main routine at setjmp, * and make setjmp return 1. */ longjmp(env, 1); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/08.6.c0000644000076400001440000000067307055334431016016 #include /* * work, work, work, all I ever do is work! */ dowork() { } main() { int mask; /* * Block SIGIO, which will indicate more * work to be done. */ mask = sigmask(SIGIO); for (;;) { /* * Go do work. */ dowork(); /* * Pause until we receive a signal. * SIGIO is not blocked in mask. */ sigpause(mask); } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/08.7.c0000644000076400001440000000422407055334432016014 #include #include #include #include #include char *stack; /* pointer to signal stack base */ int tooksig = 0; /* 1 after we take the signal */ main() { extern void x(); struct sigvec sv; struct sigstack ss; struct rlimit rlimit; /* * Set stack size limit to 50 kbytes. */ getrlimit(RLIMIT_STACK, &rlimit); rlimit.rlim_cur = 50 * 1024; if (setrlimit(RLIMIT_STACK, &rlimit) < 0) { perror("setrlimit"); exit(1); } /* * Take illegal instruction and process it with x, * on the interrupt stack. For 4.2BSD, change * sv_flags to sv_onstack and SV_ONSTACK to 1. */ sv.sv_mask = 0; sv.sv_handler = x; sv.sv_flags = SV_ONSTACK; sigvec(SIGILL, &sv, (struct sigvec *) 0); /* * Allocate memory for the signal stack. The * kernel assumes the addresses grow in the same * direction as on the process stack (toward * lower addresses, on a VAX). */ if ((stack = (char *) malloc(10240)) == NULL) { fprintf(stderr, "Out of memory.\n"); exit(1); } /* * Issue the call to tell the system about the * signal stack. We pass the end of the signal * stack, not the beginning, since the stack * grows toward lower addresses. */ ss.ss_onstack = 0; ss.ss_sp = (caddr_t) stack + 10240; if (sigstack(&ss, (struct sigstack *) 0) < 0) { perror("sigstack"); exit(1); } /* * Start using up stack space. */ y(); } y() { /* * Take up 5k of stack space. */ char buf[5120]; printf("%s\n", tooksig ? "Now on extended stack." : "On 50k stack."); /* * Recurse. */ y(); } /* * Handle the signal. */ void x(sig, code, scp) int sig, code; struct sigcontext *scp; { struct rlimit rlimit; /* * Increase the stack limit to the maximum. */ getrlimit(RLIMIT_STACK, &rlimit); rlimit.rlim_cur = rlimit.rlim_max; if (setrlimit(RLIMIT_STACK, &rlimit) < 0) { perror("setrlimit"); exit(1); } tooksig = 1; return; } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/09.1.c0000644000076400001440000000307107055334433016007 #include main() { char buf[1024]; char *args[64]; for (;;) { /* * Prompt for and read a command. */ printf("Command: "); if (gets(buf) == NULL) { printf("\n"); exit(0); } /* * Split the string into arguments. */ parse(buf, args); /* * Execute the command. */ execute(args); } } /* * parse--split the command in buf into * individual arguments. */ parse(buf, args) char *buf; char **args; { while (*buf != NULL) { /* * Strip whitespace. Use nulls, so * that the previous argument is terminated * automatically. */ while ((*buf == ' ') || (*buf == '\t')) *buf++ = NULL; /* * Save the argument. */ *args++ = buf; /* * Skip over the argument. */ while ((*buf != NULL) && (*buf != ' ') && (*buf != '\t')) buf++; } *args = NULL; } /* * execute--spawn a child process and execute * the program. */ execute(args) char **args; { int pid, status; /* * Get a child process. */ if ((pid = fork()) < 0) { perror("fork"); exit(1); } /* * The child executes the code inside the if. */ if (pid == 0) { execvp(*args, args); perror(*args); exit(1); } /* * The parent executes the wait. */ while (wait(&status) != pid) /* empty */ ; } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/09.2.c0000644000076400001440000000204607055334433016011 execute(args, sin, sout, serr) char **args; int sin, sout, serr; { int pid, status; /* * Get a child process. */ if ((pid = fork()) < 0) { perror("fork"); exit(1); } /* * The child executes the code inside the if. */ if (pid == 0) { /* * For each of standard input, output, * and error output, set the child's * to the passed-down file descriptor. * Note that we can't just close 0, 1, * and 2 since we might need them. */ if (sin != 0) { close(0); dup(sin); /* will give us fd #0 */ } if (sout != 1) { close(1); dup(sout); /* will give us fd #1 */ } if (serr != 2) { close(2); dup(serr); /* will give us fd #2 */ } execvp(*args, args); perror(*args); exit(1); } /* * The parent executes the wait. */ while (wait(&status) != pid) /* empty loop */; } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/09.3.c0000644000076400001440000000314207055334433016010 #include main() { FILE *fp; int pid, pipefds[2]; char *username, *getlogin(); /* * Get the user's name. */ if ((username = getlogin()) == NULL) { fprintf(stderr, "Who are you?\n"); exit(1); } /* * Create the pipe. This has to be done * BEFORE the fork. */ if (pipe(pipefds) < 0) { perror("pipe"); exit(1); } if ((pid = fork()) < 0) { perror("fork"); exit(1); } /* * The child process executes the stuff inside * the if. */ if (pid == 0) { /* * Make the read side of the pipe our * standard input. */ close(0); dup(pipefds[0]); close(pipefds[0]); /* * Close the write side of the pipe; * we'll let our output go to the screen. */ close(pipefds[1]); /* * Execute the command "mail username". */ execl("/bin/mail", "mail", username, 0); perror("exec"); exit(1); } /* * The parent executes this code. */ /* * Close the read side of the pipe; we * don't need it (and the child is not * writing on the pipe anyway). */ close(pipefds[0]); /* * Convert the write side of the pipe to stdio. */ fp = fdopen(pipefds[1], "w"); /* * Send a message, close the pipe. */ fprintf(fp, "Hello from your program.\n"); fclose(fp); /* * Wait for the process to terminate. */ while (wait((int *) 0) != pid) ; exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/09.4.c0000644000076400001440000000327107055334434016015 /* * mailer - open a pipe to the mail command and send the user * mail. */ #include main() { FILE *fp; int pid, pipefds[2]; char *username, *getlogin(); /* * Get the user's name. */ if ((username = getlogin()) == NULL) { fprintf(stderr, "Who are you?\n"); exit(1); } /* * Create the pipe. This has to be done * BEFORE the fork. */ if (pipe(pipefds) < 0) { perror("pipe"); exit(1); } if ((pid = fork()) < 0) { perror("fork"); exit(1); } /* * The child process executes the stuff inside * the if. */ if (pid == 0) { /* * Make the read side of the pipe our * standard input. */ close(0); dup(pipefds[0]); close(pipefds[0]); /* * Close the write side of the pipe; * we'll let our output go to the screen. */ close(pipefds[1]); /* * Execute the command "mail username". */ execl("/bin/mail", "mail", username, 0); perror("exec"); exit(1); } /* * The parent executes this code. */ /* * Close the read side of the pipe; we * don't need it (and the child is not * writing on the pipe anyway). */ close(pipefds[0]); /* * Convert the write side of the pipe to stdio. */ fp = fdopen(pipefds[1], "w"); /* * Send a message, close the pipe. */ fprintf(fp, "Hello from your program.\n"); fclose(fp); /* * Wait for the process to terminate. */ while (wait((int *) 0) != pid) ; exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/10.1.c0000644000076400001440000000141707055334410015774 #include #include "10.h" int MyPid; /* the shell's process id */ int MyPgrp; /* the shell's process group */ int TermPgrp; /* the terminal's process group */ setup() { /* * Obtain shell's process id. */ MyPid = getpid(); /* * Just use pid for process group. This is * not a requirement, just convenient. Other * ways of picking a process group can be used. */ MyPgrp = MyPid; TermPgrp = MyPid; /* * Set the shell's process group. */ if (setpgrp(MyPid, MyPgrp) < 0) { perror("setpgrp"); exit(1); } /* * Set the terminal's process group. */ if (ioctl(1, TIOCSPGRP, &MyPgrp) < 0) { perror("ioctl"); exit(1); } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/10.2.c0000644000076400001440000000132307055334410015771 #include #include #include "10.h" stop(j) JOB *j; { /* * If the job is already stopped, we don't * need to do anything. */ if (j->status & JSTOPPED) return; /* * If the job's process group is not that of the * terminal, then the job is in the background * and must be sent a stop signal. */ if (j->pgrp != TermPgrp) killpg(j->pgrp, SIGSTOP); /* * Mark the job as stopped. */ j->status |= JSTOPPED; /* * If the terminal is not in the shell's process * group, we need to put it there. */ if (TermPgrp != MyPgrp) { ioctl(1, TIOCSPGRP, &MyPgrp); TermPgrp = MyPgrp; } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/10.3.c0000644000076400001440000000060107055334411015771 #include #include #include "10.h" bg(j) JOB *j; { /* * If the job is already running, * there's no need to start it. */ if (j->status & JRUNNING) return; /* * Start the job. */ killpg(j->pgrp, SIGCONT); /* * Mark the job as running. */ j->status &= ~JSTOPPED; j->status |= JRUNNING; } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/10.4.c0000644000076400001440000000110507055334411015772 #include #include #include "10.h" fg(j) JOB *j; { /* * If the terminal is not in the job's process * group, change the process group of the * terminal. */ if (j->pgrp != TermPgrp) { ioctl(1, TIOCSPGRP, &j->pgrp); TermPgrp = j->pgrp; } /* * If the job is not running, start it up. */ if (j->status & JSTOPPED) { killpg(j->pgrp, SIGCONT); j->status &= ~JSTOPPED; j->status |= JRUNNING; } /* * Go wait for the job to complete. */ waitfor(); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/10.5.c0000644000076400001440000000642307055334411016003 #include #include #include #include "10.h" waitfor() { int pid; JOB *j; PROC *p; JOB *findjob(); union wait status; /* * As long as we get something's status back... */ while ((pid = wait3(&status, WUNTRACED, 0)) >= 0) { /* * Find the job structure which has this * process. */ j = findjob(pid); /* * Find the process structure. */ for (p = j->procs; p->pid != pid; p = p->next) /* empty */ ; /* * Find out what happened to the process. */ if (WIFSTOPPED(status)) { /* * See if we know the reason it was * stopped. The w_stopsig element of * the structure contains the number * of the signal which stopped the * process. */ switch (status.w_stopsig) { case SIGTTIN: p->status |= PTTYINPUT; break; case SIGTTOU: p->status |= PTTYOUTPUT; break; case SIGSTOP: p->status |= PSTOPSIGNAL; break; default: break; } p->status |= PSTOPPED; j->status |= JNEEDNOTE; } else if (WIFEXITED(status)) { /* * Normal termination. */ if (status.w_retcode == 0) p->status |= PDONE; else p->status |= PEXITED; p->exitcode = status.w_retcode; /* * We're only going to note processes * exiting if all the processes in the * job are complete. */ if (alldone(j)) j->status |= JNEEDNOTE; } else if (WIFSIGNALED(status)) { p->status |= PSIGNALED; /* * Save the termination signal. */ p->termsig = status.w_termsig; /* * Check for a core dump. */ if (status.w_coredump) p->status |= PCOREDUMP; /* * We're only going to note processes * exiting if all the processes in the * job are complete. */ if (alldone(j)) j->status |= JNEEDNOTE; } /* * If this process is the one which was in the * foreground, we need to do special things, * and then return to the main control section * of the shell. */ if (j->pgrp == TermPgrp) { /* * If the job is stopped, we need to call * the stop routine. */ if (WIFSTOPPED(status)) { stop(j); printf("Stopped\n"); } /* * If the job exited or died somehow, we * need to regain control of the terminal. */ if (WIFEXITED(status) || WIFSIGNALED(status)) { ioctl(1, TIOCSPGRP, &MyPgrp); TermPgrp = MyPgrp; } /* * Go back. */ return; } } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/11.1.c0000644000076400001440000000372307055334412016001 #include #include #include #include #define NSTRS 3 /* no. of strings */ #define ADDRESS "mysocket" /* addr to connect */ /* * Strings we send to the server. */ char *strs[NSTRS] = { "This is the first string from the client.\n", "This is the second string from the client.\n", "This is the third string from the client.\n" }; main() { char c; FILE *fp; register int i, s, len; struct sockaddr_un saun; /* * Get a socket to work with. This socket will * be in the UNIX domain, and will be a * stream socket. */ if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { perror("client: socket"); exit(1); } /* * Create the address we will be connecting to. */ saun.sun_family = AF_UNIX; strcpy(saun.sun_path, ADDRESS); /* * Try to connect to the address. For this to * succeed, the server must already have bound * this address, and must have issued a listen() * request. * * The third argument indicates the "length" of * the structure, not just the length of the * socket name. */ len = sizeof(saun.sun_family) + strlen(saun.sun_path); if (connect(s, &saun, len) < 0) { perror("client: connect"); exit(1); } /* * We'll use stdio for reading * the socket. */ fp = fdopen(s, "r"); /* * First we read some strings from the server * and print them out. */ for (i = 0; i < NSTRS; i++) { while ((c = fgetc(fp)) != EOF) { putchar(c); if (c == '\n') break; } } /* * Now we send some strings to the server. */ for (i = 0; i < NSTRS; i++) send(s, strs[i], strlen(strs[i]), 0); /* * We can simply use close() to terminate the * connection, since we're done with both sides. */ close(s); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/11.2.c0000644000076400001440000000451507055334413016003 #include #include #include #include #define NSTRS 3 /* no. of strings */ #define ADDRESS "mysocket" /* addr to connect */ /* * Strings we send to the client. */ char *strs[NSTRS] = { "This is the first string from the server.\n", "This is the second string from the server.\n", "This is the third string from the server.\n" }; main() { char c; FILE *fp; int fromlen; register int i, s, ns, len; struct sockaddr_un saun, fsaun; /* * Get a socket to work with. This socket will * be in the UNIX domain, and will be a * stream socket. */ if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { perror("server: socket"); exit(1); } /* * Create the address we will be binding to. */ saun.sun_family = AF_UNIX; strcpy(saun.sun_path, ADDRESS); /* * Try to bind the address to the socket. We * unlink the name first so that the bind won't * fail. * * The third argument indicates the "length" of * the structure, not just the length of the * socket name. */ unlink(ADDRESS); len = sizeof(saun.sun_family) + strlen(saun.sun_path); if (bind(s, &saun, len) < 0) { perror("server: bind"); exit(1); } /* * Listen on the socket. */ if (listen(s, 5) < 0) { perror("server: listen"); exit(1); } /* * Accept connections. When we accept one, ns * will be connected to the client. fsaun will * contain the address of the client. */ if ((ns = accept(s, &fsaun, &fromlen)) < 0) { perror("server: accept"); exit(1); } /* * We'll use stdio for reading the socket. */ fp = fdopen(ns, "r"); /* * First we send some strings to the client. */ for (i = 0; i < NSTRS; i++) send(ns, strs[i], strlen(strs[i]), 0); /* * Then we read some strings from the client and * print them out. */ for (i = 0; i < NSTRS; i++) { while ((c = fgetc(fp)) != EOF) { putchar(c); if (c == '\n') break; } } /* * We can simply use close() to terminate the * connection, since we're done with both sides. */ close(s); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/11.3.c0000644000076400001440000000206307055334414016001 #include #include #include #include #define MSGSZ 128 #ifdef NOT_USED /* * Declare the message structure. */ struct msgbuf { long mtype; char mtext[MSGSZ]; }; #endif /* NOT_USED */ main() { int msqid; key_t key; struct msgbuf sbuf, rbuf; /* * Create a message queue with "name" 1234. */ key = 1234; /* * We want to let everyone read and * write on this message queue, hence * we use 0666 as the permissions. */ if ((msqid = msgget(key, IPC_CREAT | 0666)) < 0) { perror("msgget"); exit(1); } /* * Receive a message. */ if (msgrcv(msqid, &rbuf, MSGSZ, 0, 0) < 0) { perror("msgrcv"); exit(1); } /* * We send a message of type 2. */ sbuf.mtype = 2; sprintf(sbuf.mtext, "I received your message."); /* * Send an answer. */ if (msgsnd(msqid, &sbuf, strlen(sbuf.mtext) + 1, 0) < 0) { perror("msgsnd"); exit(1); } exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/11.4.c0000644000076400001440000000212007055334414015774 #include #include #include #include #define MSGSZ 128 #ifdef NOT_USED /* * Declare the message structure. */ struct msgbuf { long mtype; char mtext[MSGSZ]; }; #endif /* NOT_USED */ main() { int msqid; key_t key; struct msgbuf sbuf, rbuf; /* * Get the message queue id for the * "name" 1234, which was created by * the server. */ key = 1234; if ((msqid = msgget(key, 0666)) < 0) { perror("msgget"); exit(1); } /* * We'll send message type 1, the server * will send message type 2. */ sbuf.mtype = 1; sprintf(sbuf.mtext, "Did you get this?"); /* * Send a message. */ if (msgsnd(msqid, &sbuf, strlen(sbuf.mtext) + 1, 0) < 0) { perror("msgsnd"); exit(1); } /* * Receive an answer of message type 2. */ if (msgrcv(msqid, &rbuf, MSGSZ, 2, 0) < 0) { perror("msgrcv"); exit(1); } /* * Print the answer. */ printf("%s\n", rbuf.mtext); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/11.5.c0000644000076400001440000000201107055334414015774 #include #include #include #include #define SHMSZ 27 main() { char c; int shmid; key_t key; char *shmat(); char *shm, *s; /* * We'll name our shared memory segment * "5678". */ key = 5678; /* * Create the segment. */ if ((shmid = shmget(key, SHMSZ, IPC_CREAT | 0666)) < 0) { perror("shmget"); exit(1); } /* * Now we attach the segment to our data space. */ if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) { perror("shmat"); exit(1); } /* * Now put some things into the memory for the * other process to read. */ s = shm; for (c = 'a'; c <= 'z'; c++) *s++ = c; *s = NULL; /* * Finally, we wait until the other process * changes the first character of our memory * to '*', indicating that it has read what * we put there. */ while (*shm != '*') sleep(1); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/11.6.c0000644000076400001440000000162607055334414016010 #include #include #include #include #define SHMSZ 27 main() { int shmid; key_t key; char *shmat(); char *shm, *s; /* * We need to get the segment named * "5678", created by the server. */ key = 5678; /* * Locate the segment. */ if ((shmid = shmget(key, SHMSZ, 0666)) < 0) { perror("shmget"); exit(1); } /* * Now we attach the segment to our data space. */ if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) { perror("shmat"); exit(1); } /* * Now read what the server put in the memory. */ for (s = shm; *s != NULL; s++) putchar(*s); putchar('\n'); /* * Finally, change the first character of the * segment to '*', indicating we have read * the segment. */ *shm = '*'; exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/11.7.c0000644000076400001440000000173107055334415016007 /* * shm-client - client program to demonstrate shared memory. */ #include #include #include #include #define SHMSZ 27 main() { int shmid; key_t key; char *shmat(); char *shm, *s; /* * We need to get the segment named * "5678", created by the server. */ key = 5678; /* * Locate the segment. */ if ((shmid = shmget(key, SHMSZ, 0666)) < 0) { perror("shmget"); exit(1); } /* * Now we attach the segment to our data space. */ if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) { perror("shmat"); exit(1); } /* * Now read what the server put in the memory. */ for (s = shm; *s != NULL; s++) putchar(*s); putchar('\n'); /* * Finally, change the first character of the * segment to '*', indicating we have read * the segment. */ *shm = '*'; exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/12.1.c0000644000076400001440000000460407055334415016004 /* * Connects to the local host at port 1234. */ #include #include #include #include #include #define NSTRS 3 /* no. of strings */ /* * Strings we send to the server. */ char *strs[NSTRS] = { "This is the first string from the client.\n", "This is the second string from the client.\n", "This is the third string from the client.\n" }; extern int errno; main() { char c; FILE *fp; char hostname[64]; register int i, s; struct hostent *hp; struct sockaddr_in sin; /* * Before we can do anything, we need to know * our hostname. */ gethostname(hostname, sizeof(hostname)); /* * Next, we need to look up the network * address of our host. */ if ((hp = gethostbyname(hostname)) == NULL) { fprintf(stderr, "%s: unknown host.\n", hostname); exit(1); } /* * Get a socket to work with. This socket will * be in the Internet domain, and will be a * stream socket. */ if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror("client: socket"); exit(1); } /* * Create the address we will be connecting to. * We use port 1234 but put it into network * byte order. Also, we use bcopy (see Chapter * 14) to copy the network number. */ sin.sin_family = AF_INET; sin.sin_port = htons(1234); bcopy(hp->h_addr, &sin.sin_addr, hp->h_length); /* * Try to connect to the address. For this to * succeed, the server must already have bound * this address, and must have issued a listen() * request. */ if (connect(s, &sin, sizeof(sin)) < 0) { perror("client: connect"); exit(1); } /* * We'll use stdio for reading * the socket. */ fp = fdopen(s, "r"); /* * First we read some strings from the server * and print them out. */ for (i = 0; i < NSTRS; i++) { while ((c = fgetc(fp)) != EOF) { putchar(c); if (c == '\n') break; } } /* * Now we send some strings to the server. */ for (i = 0; i < NSTRS; i++) send(s, strs[i], strlen(strs[i]), 0); /* * We can simply use close() to terminate the * connection, since we're done with both sides. */ close(s); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/12.2.c0000644000076400001440000000523607055334416016010 /* * Connects to port 1234 on the local host. */ #include #include #include #include #include #define NSTRS 3 /* no. of strings */ /* * Strings we send to the client. */ char *strs[NSTRS] = { "This is the first string from the server.\n", "This is the second string from the server.\n", "This is the third string from the server.\n" }; extern int errno; main() { char c; FILE *fp; int fromlen; char hostname[64]; struct hostent *hp; register int i, s, ns; struct sockaddr_in sin, fsin; /* * Before we can do anything, we need * to know our hostname. */ gethostname(hostname, sizeof(hostname)); /* * Now we look up our host to get * its network number. */ if ((hp = gethostbyname(hostname)) == NULL) { fprintf(stderr, "%s: host unknown.\n", hostname); exit(1); } /* * Get a socket to work with. This socket will * be in the Internet domain, and will be a * stream socket. */ if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror("server: socket"); exit(1); } /* * Create the address that we will be binding to. * We use port 1234 but put it into network * byte order. Also, we use bcopy (see * Chapter 14) to copy the network number. */ sin.sin_family = AF_INET; sin.sin_port = htons(1234); bcopy(hp->h_addr, &sin.sin_addr, hp->h_length); /* * Try to bind the address to the socket. */ if (bind(s, &sin, sizeof(sin)) < 0) { perror("server: bind"); exit(1); } /* * Listen on the socket. */ if (listen(s, 5) < 0) { perror("server: listen"); exit(1); } /* * Accept connections. When we accept one, ns * will be connected to the client. fsin will * contain the address of the client. */ if ((ns = accept(s, &fsin, &fromlen)) < 0) { perror("server: accept"); exit(1); } /* * We'll use stdio for reading the socket. */ fp = fdopen(ns, "r"); /* * First we send some strings to the client. */ for (i = 0; i < NSTRS; i++) send(ns, strs[i], strlen(strs[i]), 0); /* * Then we read some strings from the client * and print them out. */ for (i = 0; i < NSTRS; i++) { while ((c = fgetc(fp)) != EOF) { putchar(c); if (c == '\n') break; } } /* * We can simply use close() to terminate the * connection, since we're done with both sides. */ close(s); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/12.3.c0000644000076400001440000000360607055334417016011 #include #include #include #include #include #define BUFSZ 256 #define SERVICE "daytime" main(argc, argv) int argc; char **argv; { int s, n, len; char buf[BUFSZ]; struct hostent *hp; struct servent *sp; struct sockaddr_in sin; /* * Get a datagram socket in the Internet * domain. */ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { perror("socket"); exit(1); } /* * Look up the port number of the service. */ if ((sp = getservbyname(SERVICE, "udp")) == NULL) { fprintf(stderr, "%s/udp: unknown service.\n", SERVICE); exit(1); } /* * For each host on the command line... */ while (--argc) { /* * Look up the network number of * the host. */ if ((hp = gethostbyname(*++argv)) == NULL) { fprintf(stderr, "%s: host unknown.\n", *argv); continue; } /* * Build the address of the server on * the remote machine. */ sin.sin_family = AF_INET; sin.sin_port = sp->s_port; bcopy(hp->h_addr, &sin.sin_addr, hp->h_length); /* * Print the name of the host. */ printf("%s: ", *argv); fflush(stdout); /* * Send a datagram to the server. */ if (sendto(s, buf, BUFSZ, 0, &sin, sizeof(sin)) < 0) { perror("sendto"); continue; } /* * Receive a datagram back. */ len = sizeof(sin); n = recvfrom(s, buf, sizeof(buf), 0, &sin, &len); if (n < 0) { perror("recvfrom"); continue; } /* * Print the datagram. */ buf[n] = NULL; printf("%s\n", buf); } close(s); exit(0); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/13.1.c0000644000076400001440000001217207055334420016000 /* * Sys V version * * Reads the i-node structures from a raw disk * device and then sums up the disk usage for * each user. Prints out the number of blocks * each user is using. */ #include #include #include #include #include #include #include #include #include /* * Maximum user id. */ #ifndef MAXUID #define MAXUID 32768 #endif #define SBSIZE BSIZE /* size of super-block */ #define sblock sb_un.u_sblock /* * The super-block. We allow enough room for * a complete disk block. */ union { char dummy[SBSIZE]; struct filsys u_sblock; } sb_un; int nfiles; /* no. of files in filsys */ char *pname; /* program name (argv[0]) */ char *device; /* name of disk device */ char *filsys; /* name of file system */ size_t blocks[MAXUID]; /* count of blocks used */ struct dinode *dinode; /* will hold the i-nodes */ main(argc, argv) int argc; char **argv; { int i, fd; register ino_t ino; register struct dinode *di; /* * Save the program name and check our arguments. */ pname = *argv; if (argc != 2) { fprintf(stderr, "Usage: %s raw-disk-device\n", pname); exit(1); } /* * Open the device for reading. */ device = *++argv; if ((fd = open(device, O_RDONLY)) < 0) { perror(device); exit(1); } /* * Get the super-block from the device. */ getsblock(fd); /* * Get the i-node structures from the device. */ getinodes(fd); close(fd); /* * Zero the block counts. */ for (i = 0; i < MAXUID; i++) blocks[i] = 0; /* * Add up the number of blocks being used by each * user id. */ for (ino = 0; ino < nfiles; ino++) { /* * ROOTINO is the first i-node; skip any * before it. */ if (ino < ROOTINO) continue; di = &dinode[ino]; /* * If this is zero, the i-node is free (not * in use). */ if ((di->di_mode & IFMT) == 0) continue; /* * Count the number of blocks being used by * this file. We round the number of bytes to * the next highest multiple of 512. */ blocks[di->di_uid] += (di->di_size + 511) / 512; } /* * Print out what we added up. */ printusage(); exit(0); } /* * getsblock--get the super-block from the device referred * to by fd. */ getsblock(fd) int fd; { /* * Make sure the disk information is current. This * causes all disk writes to be scheduled. */ sync(); /* * Read in the super-block. It is stored at file * system address SUPERBOFF. */ lseek(fd, (long) SUPERBOFF, 0); read(fd, &sblock, SBSIZE); /* * The number of files (i-nodes) is calculated by * multiplying the number of blocks used to hold * i-nodes by the number of i-nodes in a block. */ nfiles = sblock.s_isize * INOPB; /* * Save the name of the file system. */ filsys = sblock.s_fname; } /* * getinodes--read in the i-node structures from the device * referred to by fd. */ getinodes(fd) int fd; { register ino_t ino; register daddr_t iblk; struct dinode *malloc(); /* * Allocate space for them all. */ dinode = malloc(nfiles * sizeof(struct dinode)); if (dinode == NULL) { fprintf(stderr, "%s: out of memory.\n", pname); exit(1); } /* * We read in i-nodes a disk block-full at a time. * The INOPB constant is the number of i-nodes in * a block. */ for (ino = 0; ino < nfiles; ino += INOPB) { /* * The i-node's disk block number is given by * the itod macro. */ iblk = itod(ino); /* * Read in this block of i-nodes. */ bread(fd, iblk, &dinode[ino], BSIZE); } } /* * bread--read cnt bytes from fd into buf, starting at * address bno. */ bread(fd, bno, buf, cnt) daddr_t bno; char *buf; int cnt; { int n; /* * Seek to the proper block. The shifting by BSHIFT * converts the block number to a byte address. */ lseek(fd, (long) (bno << BSHIFT), 0); /* * Read in the data. */ if ((n = read(fd, buf, cnt)) != cnt) { perror(filsys); exit(1); } } /* * printusage--print out the disk usage in blocks. */ printusage() { register int i; struct passwd *pwd; struct passwd *getpwuid(); printf("%s (%s):\n", device, filsys); printf(" Blocks \t User\n"); for (i = 0; i < MAXUID; i++) { if (blocks[i] == 0) continue; /* * Look up the login name, and use it if * we find it. */ if ((pwd = getpwuid(i)) != NULL) printf("%8d\t%s\n", blocks[i], pwd->pw_name); else printf("%8d\t#%d\n", blocks[i], i); } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/13.2.c0000644000076400001440000001300007055334422015772 /* * Reads the i-node structures from a raw disk device and * then sums up the disk usage for each user. Prints out * the number of blocks each user is using. * * If you are on a Sun workstation or other system using Sun's * Network File System (NFS), be sure to define the constant * NFS so that the proper files get included. */ #ifdef sun #define NFS 1 #endif #ifdef NFS #include #include #include #include #include #include #include #include #else #include #include #include #include #include #include #endif /* * Maximum user id. */ #ifndef MAXUID #define MAXUID 32768 #endif #define sblock sb_un.u_sblock /* * The super block. We allow enough room for * a complete disk block. */ union { struct fs u_sblock; char dummy[SBSIZE]; } sb_un; int nfiles; /* number of files in file system */ char *pname; /* program name (argv[0]) */ char *device; /* name of the disk device given */ char *filsys; /* name of the file system on device */ size_t blocks[MAXUID]; /* count of blocks used */ struct dinode *dinode; /* will hold all the i-node structures */ main(argc, argv) int argc; char **argv; { int i, fd; register ino_t ino; register struct dinode *di; /* * Save the program name and check our arguments. */ pname = *argv; if (argc != 2) { fprintf(stderr, "Usage: %s raw-disk-device\n", pname); exit(1); } /* * Open the device for reading. */ device = *++argv; if ((fd = open(device, O_RDONLY)) < 0) { perror(device); exit(1); } /* * Get the super-block from the device. */ getsblock(fd); /* * Get the i-node structures from the device. */ getinodes(fd); close(fd); /* * Zero the block counts. */ for (i = 0; i < MAXUID; i++) blocks[i] = 0; /* * Add up the number of blocks being used by * each user id. */ for (ino = 0; ino < nfiles; ino++) { /* * ROOTINO is the first i-node; skip any * before it. */ if (ino < ROOTINO) continue; di = &dinode[ino]; /* * If this is zero, the i-node is free (not * in use). */ if ((di->di_mode & IFMT) == 0) continue; /* * Count the number of blocks being used by * this file. */ blocks[di->di_uid] += di->di_blocks; } /* * Print out what we added up. */ printusage(); exit(0); } /* * getsblock--get the super-block from the device * referred to by fd. */ getsblock(fd) int fd; { /* * Make sure the disk information is current. * This causes all disk writes to be scheduled. */ sync(); /* * Read in the super-block. It is stored at file * system block number SBLOCK. */ bread(fd, SBLOCK, &sblock, SBSIZE); /* * The number of files (i-nodes) is calculated by * multiplying the number of i-nodes per cylinder * group by the number of cylinder groups. */ nfiles = sblock.fs_ipg * sblock.fs_ncg; /* * Save the name of the file system. */ filsys = sblock.fs_fsmnt; } /* * getinodes--read in the i-node structures from the device * referred to by fd. */ getinodes(fd) int fd; { register ino_t ino; register daddr_t iblk; struct dinode *malloc(); /* * Allocate space for them all. */ dinode = malloc(nfiles * sizeof(struct dinode)); if (dinode == NULL) { fprintf(stderr, "%s: out of memory.\n", pname); exit(1); } /* * We read in i-nodes a disk block-full at a time. * The INOPB macro returns the number of i-nodes * in a block; it uses the super-block to determine * the file system block size. */ for (ino = 0; ino < nfiles; ino += INOPB(&sblock)) { /* * The i-node file system block number is given by * the itod macro. The disk block number is computed * from the file system block number by the fsbtodb macro. */ iblk = fsbtodb(&sblock, itod(&sblock, ino)); /* * Read in this block of i-nodes. */ bread(fd, iblk, &dinode[ino], sblock.fs_bsize); } } /* * bread-read cnt bytes form fd into buf, starting at * address bno. */ bread(fd, bno, buf, cnt) daddr_t bno; char *buf; int cnt; { int n; /* * Seek to the proper block. The dtob macro converts * the block number to a byte address. */ lseek(fd, (long) dtob(bno), L_SET); /* * Round cnt up to a multiple of the device block size. */ cnt = roundup(cnt, DEV_BSIZE); /* * Read in the data. */ if ((n = read(fd, buf, cnt)) != cnt) { perror(filsys); exit(1); } } /* * printusage-print out the disk usage in blocks. */ printusage() { register int i; struct passwd *pwd; printf("%s (%s):\n", device, filsys); printf(" Blocks \\t User\n"); for (i=0; i < MAXUID; i++) { if (blocks[i] == 0) continue; /* * Look up the login name, and use it if we find it. */ if ((pwd = getpwuid(i)) != NULL) printf("%8d\\t%s\n", blocks[i], pwd->pw_name); else printf("%8d\\t#%d\n", blocks[i], i); } } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/13.3.c0000644000076400001440000000545607055334422016013 #include #include #include #include #include #define sblock sb_un.u_sblock /* * The super block. We allow enough room for * a complete disk block. */ union { struct fs u_sblock; char dummy[SBSIZE]; } sb_un; read_blocks(dp) struct dinode *dp; { int count; register int i, n; char dblock[MAXBSIZE]; count = dp->di_size; /* * For each direct block in the file (NDADDR indicates * the number of direct addresses stored)... */ for (i = 0; (i < NDADDR) && (count > 0); i++) { /* * Read in the block from disk. Read in count * bytes or a disk block, whichever is less. */ bread(fsbtodb(&sblock, dp->di_db[i]), dblock, n = min(count, sblock.fs_bsize)); count -= n; /* process data block ... */ } /* * Now start reading the indirect blocks. NIADDR is * the number of indirect addresses. Recall that * the first indirect address is singly indirect, * the second is doubly indirect, an so on. */ for (i = 0; (i < NIADDR) && (count > 0); i++) read_indirect (dp->di_ib[i], i, &count); } /* * read_indirect--read the indirect blocks of the file. The * level argument indicates our level of indirection; 0 is * singly indirect, 1 is doubly indirect, and so on. */ read_indirect (blkno, level, count) ino_t blkno; int *count; int level; { register int i, n; char dblock[MAXBSIZE]; daddr_t idblk[MAXBSIZE / sizeof(daddr_t)]; /* * Read in the block from disk. */ if (blkno) bread(fsbtodb(&sblock, blkno), idblk, sblock.fs_bsize); else bzero(idblk, sblock.fs_bsize); /* * If level is zero, then this block contains disk block * addresses, since blkno was a singly indirect address. * If level is non-zero, then this block contains addresses * of more indirect blocks. */ if (level <= 0) { /* * For each disk block (the NINDIR macro returns * the number of indirect addresses in a block)... */ for (i = 0; (i < NINDIR(&sblock)) && (*count > 0); i++) { /* * Read in the block from disk. */ bread(fsbtodb(&sblock, idblk[i]), dblock, n = min(*count, sblock.fs_bsize)); *count -= n; /* process data block ... */ } /* * Done processing. */ return; } /* * Decrement the level we're at. */ level--; /* * Handle the next level of indirection by calling * ourselves recursively with each address in this * block. */ for (i = 0; i < NINDIR(&sblock); i++) read_indirect(idblk[i], level, count); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/14.1.c0000644000076400001440000000073307055334422016003 #include #include #include /* * setlim--set the resource limit lim to the value val. */ setlim(lim, val) int lim, val; { struct rlimit rlim; /* * First get the current limits so we * will know the maximum value. */ getrlimit(lim, &rlim); /* * Now change the current limit. */ rlim.rlim_cur = val; /* * Now set the new limit. */ return(setrlimit(lim, &rlim)); } c_cpp_reference-2.0.2/reference/C/CONTRIB/OR_USING_C/14.2.c0000644000076400001440000000324307055334423016004 #include #define NSTRS 10 /* number of strings */ #define STRLEN 16 /* length of each string */ char strs[NSTRS][STRLEN]; /* array of strings */ main() { int i; extern int compare1(), compare2(); /* * Prompt the user for NSTRS strings. */ for (i = 0; i < NSTRS; i++) { printf("Enter string #%d: ", i); gets(strs[i]); } /* * Sort the strings into ascending order. There * are NSTRS array elements, each one is STRLEN * characters long. Note we give the size of * the array element, not the length of the * string in it. */ qsort(strs, NSTRS, STRLEN, compare1); /* * Print the strings. */ printf("\nSorted in ascending order:\n"); for (i = 0; i < NSTRS; i++) printf("\t%s\n", strs[i]); /* * Now sort the strings in descending order. */ qsort(strs, NSTRS, STRLEN, compare2); printf("\nSorted in descending order:\n"); for (i = 0; i < NSTRS; i++) printf("\t%s\n", strs[i]); exit(0); } /* * compare1--compare a and b, and return less than, * greater than, or equal to zero. Since * we are comparing character strings, we * can just use strcmp to do the work for us. */ compare1(a, b) char *a, *b; { return(strcmp(a, b)); } /* * compare2--this compares a and b, but is used for * sorting in the opposite order. Thus it * returns the opposite of strcmp. We can * simulate this by simply reversing the * arguments when we call strcmp. */ compare2(a, b) char *a, *b; { return(strcmp(b, a)); } c_cpp_reference-2.0.2/reference/C/glossary.html0000644000076400001440000002174507055333530015163 Glossary of C terms.

    Glossary of C terms.


    Address.
    Reference to a memory location. In C pointers are used to hold addresses.

    ANSI
    American

    API
    Application Programming Interface

    Argument.
    A value passed to a function (see parameter).

    Base Class
    See C++ glossary.

    Block.
    A sequence of definitions, declarations and statements, enclosed within braces {}.

    Character Array.
    A set of elements of type char. (Can be used to store a string).

    Class
    See C++ glossary.

    Compilation error.
    Error which occurs during the translation of source code into machine code.

    Compiler.
    A program which converts source code into machine code.

    Compound Statement.
    A sequence of simple statements.

    Constant (common all garden)
    An item that represents a value that cannot be changed. For Example:
       
            123
            'x'
    
    Constant (symbolic)
    A symbol defined in a #define preprocessor directive to represent a constant value.

    Data type.
    Definition of the data. int, char, float.

    Declaration.
    A construct which associates attributes to a variable name or function.
    No storage is reserved.

    For example:

            extrn int  a;
            extrn char c;
    
    variable declaration

    A structure decleration could look like:

            struct per_rec
            {
                int   age;
                char *surname;
                char *firstname;
            };
    

    Definition.
    1. Variable definition is a declaration with storage allocation.

              int a;
              char c;
              struct per_rec person;
      
    2. A construct which specifies the name,parameters and return type of a function.
      For example a function definition would be:
              long sqr(int num)
              {
                  return(num*num);
              }
      
    Derived Class
    See C++ glossary.

    Encapsulation.
    The C++ concept of grouping related variables and controlling the operations performed apon them. The encapsulated variables can be considered to be contained in their own environment.

    Escape sequence.
    Control codes comprising combinations of a backslash followed by letters or digits which represent non printing characters.

    Executable program.
    Program which will run in the environment of the operating system or within an appropriate run time environment.

    Executable (stand-alone) program.
    Program which will run within the environment of the operating system without additional utilities or support.

    Expression.
    A sequence of operators and operands which may yield a single value.

    File.
    Data stored as an electronic file.

    File descriptor.
    This is used in low level I/O (open/read/write/close functions) to identify a file. It is an integer number assigned to a file name by open and then used as a unique identifier by read/write and close.

    Floating-point Number.
    Number having a decimal place or exponent.

    Format specification.
    A string which controls how input or output shall be presented.

    Identifier.
    The names used to refer to stored data values such as constants, variables or functions.
    Integer.
    A number without a fractional part.

    Keyword.
    A word which has a predefined meaning to a 'C' compiler and therefore must not be used for any other purpose.

    library file.
    The file which contains compiled versions of commonly used functions which can be linked to an object file to make an executable program.

    Library function.
    A function whose code is contained in the external library file.
    Line.
    One line of input from the standard input device (keyboard) which is terminated with a newline character. The newline character is replaced by a null character.

    Literal.
    Characters, letters or strings which are to be taken literally and used as constants rather than identifiers.

    Method.
    C++ talk meaning a member function of a class.

    Object
    See C++ glossary.

    Object Code.
    Code which is directly understandable by the machine (machine code).

    Operand.
    An expression acted on by an operator. For example:
            z = a + b;
    
    a and b are both operands of the + operator.
    Parameter.
    A value received by a function.

    Pointer.
    Variable containing an address.

    Polymorphism
    See C++ glossary.

    POSIX
    Portable Operating System Interface.

    Precedence (of operators)
    The order in which operators are dealt with during the evaluation of an expression.

    Preprocessor.
    A processor which manipulates the initial directives of the source file which contains instructions about how the source file shall be processed and compiled.

    Preprocessor directive.
    Source file instruction about how the file shall be processed and compiled.

    Program.
    A text file comprising code which can be compiled.

    Run time error.
    An error which occurs when a program is executed.

    Reserved word. (keyword)
    A word which has a predefined meaning to a 'C' compiler and therefore must not be used for any other purpose.

    Scope.

    Source code.
    A text file comprising code which can be compiled.

    Statement.
    A simple statement is an expression followed by a semicolon. (See compound statement and block).

    String.
    A string in 'C' is an array of characters terminated by a Null character ('\0').

    SubClass
    See C++ glossary.

    SuperClass
    See C++ glossary.

    Syntax error.
    A mistake in the source code which prevents the compiler from converting it into object code.

    Threads.
    A process has five fundamental parts: code ("text"), data (VM), stack, file I/O, and signal tables. Theads are spawned from a process and can share these parts to comunicate with each other.

    The traditional method of spawning processes (fork) could only communicate with other forked processes via pipes and and "shared memory". The result is threads can communicate easily and have a low CPU overhead.

    Variable.
    An identifier (and storage) for a data type and for which the data value is allowed to change as the program runs.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/0000777000076400001440000000000007474405232013721 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/GDB/0000777000076400001440000000000007474405231014314 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/GDB/Makefile.am0000644000076400001440000000011207055335222016253 EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/GDB/Makefile.in0000644000076400001440000002344007474405126016303 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/GDB mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/GDB/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/GDB/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/GDB/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/GDB/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/GDB/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/MISC/0000777000076400001440000000000007474405231014453 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/MISC/Makefile.am0000644000076400001440000000011207055335223016413 EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/MISC/Makefile.in0000644000076400001440000002344607474405126016450 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/MISC mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/MISC/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/MISC/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/MISC/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/MISC/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/MISC/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/X_EXAMPLES/0000777000076400001440000000000007474405232015426 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/X_EXAMPLES/Makefile.am0000644000076400001440000000011207055335234017367 EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/X_EXAMPLES/Makefile.in0000644000076400001440000002351207474405126017414 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/X_EXAMPLES mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/X_EXAMPLES/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/X_EXAMPLES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/X_EXAMPLES/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/X_EXAMPLES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/X_EXAMPLES/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/0000777000076400001440000000000007474405232014747 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/inline.html0000644000076400001440000000215107055335223017023 INLINE keyword


    INLINE keyword


    The inline keyword allows C++ programmers to dispence macros created with the #define preprocessor.


    Examples:

    o Example program.

    See Also:


    C References

    o macros.


    Top Master Index C++ Keywords Functions


    Martin Leslie 17-Feb-96

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/Master.html0000644000076400001440000000125207055335231017000


    C++ Syntax


    Text goes here.

    Top Master Index C++ Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/keywords.html0000644000076400001440000000424707055335227017430 C++ keywords.


    C++ keywords.


    Some of the keywords on C have new meanings or have been overloaded in the world of C++, the following list shows the keywords that have changed.
    struct static const enum


    The following list shows the keywords that have been added to C++.
    bool catch class delete friend inline
    new namespace operator private  protected  public 
    tempate  this  throw  try  template 


    The base C keywords are here
    Top Master Index C++ Keywords Functions


    Martin Leslie 08-Dec-96
    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/syntax.htm0000644000076400001440000000454307055335231016725 C++ Syntax

    C++ Syntax


    o C++ Keywords
    o C Keywords
    o C++ Comments.
    o C++ Operators.
    o C++ Cast

    Function Enhancements in C++


    o Function Overloading
    o Default Parameters values.
    o Reference variables.

    Object Oriented features within C++


    o class statement
    o Constructors and Destructors.
    o Inline methods.
    o Inheritance
    o Friends of classes.
    o Operator Ovrloading.


    Top  Master Index  C++ Keywords  Functions 


    Martin Leslie
    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/struct.html0000644000076400001440000000433207055335232017074 STRUCT keyword

    struct keyword in C++


    The struct keyword was introduced in 'C', its original functionality is documented here.

    C++ has added two new features to structures.

    1. The syntax has been improved slightly so you no longer have to mess around with typedef statements.

      ANSI C approch to structures.

      
          typedef struct Person {int age; char *name} Person_t;   
      
          struct Person FirstMan;
          Person_t      SecondMan;
          

      C++ structures.

      
          struct Person {int age; char *name};   
      
          Person FirstMan;
          Person SecondMan;
          

    2. C++ also took the original idea of structures and added the ability to associate functions with the data within the structure. This feature was wrapped up with the introduction of the class keyword.


    Examples:

    Example program.


    See Also:

    o C++ Keywords
    o C Keywords


    Top Master Index C++ Keywords Functions


    Martin Leslie 12 Nov 98

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/const.html0000644000076400001440000000217007055335227016700 const keyword


    const keyword


    In the C++ world, the use of const is considered to be an improvement over #define in general the usual C programming rules apply. There is one exception within a class, this is because the class syntax does not allow the assignment of a variable when it is declared. The result is a rather strange looking syntax. Please see the example below.


    Examples:

    o Example program.

    See Also:


    C References

    o C version of const.
    o Theory of constants.

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/namespace.html0000644000076400001440000000203007055335231017474 NAMESPACE keyword


    namespace keyword


    The namespace keyword is a new addition to C++. Not all compilers support the namespace features. As my compiler does not support is feature, I am unable to document it at this time :-(


    Examples:

    Example program not written.....

    See Also:


    C References


    Top Master Index C++ Keywords Functions


    Martin Leslie 08-Aug-97

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/Makefile.am0000644000076400001440000000021707055335233016715 EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/Makefile.in0000644000076400001440000002425407474405126016741 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/SYNTAX mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/SYNTAX/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/SYNTAX/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/SYNTAX/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=static.htm new.html syntax.htm class.html namespace.html ops.html keywords.html inline.html throw.html struct.html Master.html comment.html enum.html delete.html friend.html const.html bool.html operator.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/SYNTAX/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/SYNTAX/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/comment.html0000644000076400001440000000262407055335225017216 C++ Comments.


    C++ Comments.


    C++ allows // as an inline comment, it can be used on any line and is delimited by the newline character (return).

    
      main()
      {
          int Counter = 0;       // Initalise Counter.
    
          /* Start the main processing here. */
      }
    
    

    A handy feature of the new comments is the ability to nest them within the old style comments.

    This provides a handy debugging tool. If you write your normal comments using the // syntax, you can then comment out blocks of code while debugging with /* */


    C comments

    /* ... */ comments


    Top Master Index C++ Keywords Functions


    Martin Leslie 30-Jan-96
    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/new.html0000644000076400001440000000535007055335224016343 NEW operator

    NEW operator.


    The new operator replaces the malloc function provided in C to reserve storage taken from the heap.

    The new operator requires one operand that describes the type of data to be stored in the memory. Here are some examples.

    
        int *ptr1;                  // Declare a pointer to int.
        ptr1 = new int;             // Reserve storage and point to it.
        
        float *ptr2 = new float;    // Do it all in one statement.
        
        delete ptr1;                // Free the storage.
        delete ptr2;
        
        struct House                // Declare a complex structure.
        {
            int Floors;
            int Windows;
        };
        
        House *ptr3 = new House;    // Reserve storage and point to it.
    
        delete ptr3;
    

    Blocks or arrays of storage can also be reserved as show in the next example.

    
        char *ptr
        ptr = new char[80];
        
        delete [] ptr;          // Free the storage.
    

    Although new and malloc can be intermixed in the same code, it is probably best to continue using malloc in existing code and new in new code. This is because you can not use delete with storage thats been reserved with malloc and visa versa. If you keep to one method or the other you are less likely to make a mistake.


    Examples:

    Example program.

    See Also:

    delete keyword.

    C References

    malloc function.

    free function.


    Top Master Index C++ Keywords Functions


    Martin Leslie 17-Feb-96

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/throw.html0000644000076400001440000000155607055335232016720 catch, throw and try keywords.


    catch, throw and try keywords.


    Text goes here.

    Examples:

    A quick example.

    See Also:



    Top Master Index C++ Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/delete.html0000644000076400001440000000433607055335225017020 DELETE keyword


    DELETE keyword


    The delete keyword replaces the free function in C and will release storage reserved with new.

    
        int *ptr1;                  // Declare a pointer to int.
        ptr1 = new int;             // Reserve storage and point to it.
        
        float *ptr2 = new float;    // Do it all in one statement.
        
        delete ptr1;                // Free the storage.
        delete ptr2;
        
        struct House                // Declare a complex structure.
        {
            int Floors;
            int Windows;
        };
        
        House *ptr3 = new House;    // Reserve storage and point to it.
    
        delete ptr3;
    

    Blocks or arrays of storage can also be freed as shown in the next example.

    
        char *ptr
        ptr = new char[80];
        
        delete [] ptr;          // Free the storage.
    


    Examples:

    o Example program.

    See Also:

    o new keyword.

    C References

    o malloc function.

    o free function.


    Top Master Index C++ Keywords Functions


    Martin Leslie 17-Feb-96

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/static.htm0000644000076400001440000000325007055335230016657 static keyword


    static keyword


    The static keyword has been extended in C++ to have the following meanings.

    C++ Context Action
    A variable outside of a function. Variable can be seen by all functions in the file. Default.
    Variable inside a function. The variable is permanent. The variable can only be initalised once and only one copy of the variable exists. Recursive calls use the same variable.
    A class member variable Only one copy of the variable exists. All instances of the object use the same variable (memory location).
    A class member function (method). Function can only access static members of the class


    Here is the way static works in C

    Examples:

    No example programs yet.

    See Also:


    C References


    Top Master Index C++ Keywords Functions


    Martin Leslie 08-Dec-96
    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/ops.html0000644000076400001440000000271307055335233016353 C++ Operators

    C++ Operators


    The following operators have been introducedor overloaded within C++.

             ::     Scope. Identifies a global variable.
             <<     Insertion.
             >>     Extraction.
             
            Apparantly new and delete are operators, not keywords.
            
             new Dynamc allocation operator
             delete Free memory.
             
    

    Examples:


    See Also:


    C References

    Base operators offered by C


    Top Master Index C++ Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/bool.html0000644000076400001440000000165007055335232016503 bool keyword (datatype)


    bool keyword (datatype)


    bool is new to C++. It is not available in all versions of the compiler as it is a recent addition.

    The original datatypes fount in C are here


    Top Master Index C++ Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/enum.html0000644000076400001440000000454607055335233016524 ENUM keyword


    C++ changes to ENUM.


    In the C++ world, the rules applying to enum have been altered.

    • Definitions no longer require the enum prefix or a typedef fudge.
    
        main ()
        {
            enum Currancy = {STERLING, DOLLAR, RUPEE};
                                                                    
            enum Currancy GreenBack = DOLLAR;     // Valid in C and C++
            Currancy Pounds = STERLING;           // Valid in C++ only.
    
        }
    
    • An enum is no longer considered to be an int datatype. Because it has its own datatype you can not perform normal arithmatic apon enum variables. The following program is now invalid.
    
        main ()
        {
            enum Currancy = {STERLING, DOLLAR, RUPEE};
    
            Currancy Pounds = STERLING;
    
            Pounds = 2;             // Invalid Statement.
    
            Pounds++;               // Invalid Statement.
        }
    


    Examples:

    o Example program.  

    See Also:


    C References

    o C version of enum.


    Top Master Index C++ Keywords Functions


    Martin Leslie 25-Oct-98

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/operator.html0000644000076400001440000000161707055335223017406 INLINE keyword


    operator keyword


    The operator keyword


    Examples:

    o Example program.

    See Also:


    C References


    Top Master Index C++ Keywords Functions


    Martin Leslie 08-Dec-96

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/friend.html0000644000076400001440000000162407055335225017022 FRIEND keyword


    friend keyword


    The friend keyword


    Examples:

    o Example program.

    See Also:


    C References


    Top Master Index C++ Keywords Functions


    Martin Leslie 08-Dec-96

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/SYNTAX/class.html0000644000076400001440000000711607055335227016664 CLASS keyword


    class keyword


    The concept of a class allows you to encapsulate a set of related variables and only allow access to them via predetermined functions.

    The class keyword is used to declare the group of variables and functions and the visability of the variables and functions. Here is a basic example.

    
        class String 
        {
        public:
      
            void Set(char *InputStr)   // Declare an Access function
            { 
                strcpy(Str, InputStr); 
            }
    
        private:
            
            char Str[80];      // Declare a hidden variable.
      
        };
    

    • private: means that all variables and functions that follow are only visable from within the class.
    • public: all functions and variables that follow this statement can be accessed from outside the class.
    Now we have declared a class called String we need to use it.

    
        main()
        {
            String Title;
            
            Title.Set("My First Masterpiece.");
        }
    

    This code creates a String object called Title and then uses the Set member function to initialise the value of Str.

    In C++ the member function Set is also known as a method

    This is the strength of object oriented programming, the ONLY way to change Str is via the Set method.

    The final code example brings the last two examples together ands a new method (called Get) that shows the contents of Str

    
        #include <stdlib.h>
        #include <iostream.h>               // Instead of stdio.h
    
        class String 
        {
        public:
      
            void Set(char *InputStr)   // Declare an Access function
            { 
                strcpy(Str, InputStr); 
            }
            
        char *Get(void)                // Declare an Access function
            { 
                return(Str); 
            }
            
    
        private:
            
            char Str[80];      // Declare a hidden variable.
      
        };
    
        main()
        {
            String Title;
            
            Title.Set("My First Masterpiece.");
            
            cout << Title.Get() << endl;
        }
    


    Examples:

    Example program.

    See Also:

    Constructors and destructors.

    Class Inheritance.


    C References


    Top Master Index C++ Keywords Functions


    Martin Leslie 08-Feb-96

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/TECHNIC/0000777000076400001440000000000007474405232014776 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/TECHNIC/Makefile.am0000644000076400001440000000011207055335233016736 EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/TECHNIC/Makefile.in0000644000076400001440000002347007474405126016767 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/TECHNIC mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/TECHNIC/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/TECHNIC/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/TECHNIC/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/TECHNIC/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/TECHNIC/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/LIBRARIES/0000777000076400001440000000000007474405231015234 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/LIBRARIES/Makefile.am0000644000076400001440000000011207055335223017174 EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/LIBRARIES/Makefile.in0000644000076400001440000002350407474405126017224 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/LIBRARIES mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/LIBRARIES/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/LIBRARIES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/LIBRARIES/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/LIBRARIES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/LIBRARIES/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/PROBLEMS/0000777000076400001440000000000007474405231015143 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/PROBLEMS/Makefile.am0000644000076400001440000000011207055335223017103 EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/PROBLEMS/Makefile.in0000644000076400001440000002347607474405126017143 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/PROBLEMS mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/PROBLEMS/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/PROBLEMS/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/PROBLEMS/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/PROBLEMS/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/PROBLEMS/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/0000777000076400001440000000000007474405231015136 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/overload.cc0000644000076400001440000000103607055335222017171 #include void Add(int Left, int Right); void Add(double Left, double Right); main () { Add(5, 9); Add(3.2, 7.1); } // integer version of Add. void Add(int Left, int Right) { cout << Left << " + " << Right << " = " << Left+Right << endl; } // float version of Add. void Add(double Left, double Right) { cout << Left << " + " << Right << " = " << Left+Right << endl; } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/struct1.cc0000644000076400001440000000256107055335212016766 /****************************************************************** * * Purpose: Program to demonstrate struct in C++. * Date: 04-Aug-97 * Author: M J Leslie. * Descrip: * ******************************************************************/ #include // printf struct Person { // ... Declare the variables in the 'Person' structure. // ... This is normal C syntax. char Name[35]; int Age; // ... Declare a function within the structure. This is // ... new to C++ int YearsToRetire(void) // \ { // --- Function in a structure. return 65-Age; // --- } // / }; // ... Program to test the 'Person' structure. int main(int argc, char **argc ) { // ... Create a person called Mr Leslie. Person Mr_Leslie; // ... Put some data into the structure. strcpy(Mr_Leslie.Name, "Martin"); Mr_Leslie.Age=36; // ... Extract data from the structure. // ... Use the 'YearsToRetire' function to // ... Calculate the number of years this poor // ... soul has to work before retirement. printf("%s will retire in %d years\n", Mr_Leslie.Name, Mr_Leslie.YearsToRetire()); // <-- Call the function. return (0); } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/enum1.c0000644000076400001440000000061007055335221016234 /************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ // #include main() { enum Colour { Red=1, Amber, Green}; Colour TraficLight; TraficLight++; return 0; } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/const1.cc0000644000076400001440000000151207055335213016564 /************************************************************************** * * Language: C++ * Purpose: Program to demonstrate the 'new' statement. * Author: M J Leslie * Date: 27-Sep-98 * * Initialise a constant within a class. * **************************************************************************/ #include // For cout. class Math { public: // Constructor contains the definition of PI. Math() : PI(3.142) {} ~Math() {} float Diameter (float Radius) { return (Radius * PI); } private: // Declare PI. We can not assign a value here. const float PI; }; main() { Math Formula; float Radius = 5; cout << " Radius is " << Radius << endl; cout << " Diameter is " << Formula.Diameter(Radius) << endl; } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/scope.cc0000644000076400001440000000076507055335214016500 /************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ #include // cout, cin int Counter = 1; main() { int Counter = 1; for (int i=0; i< 10; i++) { cout << Counter << " " << ::Counter << endl; Counter++; } return 0; } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/Makefile.am0000644000076400001440000000017207055335222017103 EXTRA_DIST = $(wildcard *.cc) $(wildcard *.CC) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/Makefile.in0000644000076400001440000002417307474405126017131 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.cc) $(wildcard *.CC) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/EXAMPLES mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/EXAMPLES/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/EXAMPLES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/EXAMPLES/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=refvar.cc enum1.c scope.cc struct1.cc inherit.cc inline.cc class1.cc cast.cc io1.cc overload.cc const1.cc throw.cc mjl_test.cc new.cc class2.cc MGREP.CC enum1.cc io2.cc DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/EXAMPLES/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/EXAMPLES/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/io1.cc0000644000076400001440000000073507055335211016051 /************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ #include // cout, cin main() { char buf[255]; cout << "Please enter a string ==> "; // O/P to STDOUT (screen). cin >> buf; // I/P from STDIN (keyboard). cout << "Entered string is " << buf << endl; } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/io2.cc0000644000076400001440000000134707055335212016053 /************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ #include // ifstream, ofstream, fstream #include // cin, cout main() { char buf[255]; char File[]="tempfile"; cout << "Please enter a string => "; // O/P to STDOUT (screen). cin >> buf; // Read from STDIN (keyboard). cout << " Writing string to " << File << "\n"; ofstream fp(File); // Open file for O/P fp << buf << "\n"; // Write to the file. // ... File is closed at program end. } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/new.cc0000644000076400001440000000164707055335212016156 /************************************************************************** * * Language: C++ * Purpose: Program to demonstrate the 'new' statement. * Author: M J Leslie * Date: 14-Feb-96 * **************************************************************************/ #include // For cout. typedef struct { char Model[256]; int Wheels; int Doors; int EngineSize; } Car_t; main() { Car_t *Models; // Create a pointer. Models = new Car_t; // Allocate stoarage. // Load with data. strcpy(Models->Model, "Escort"); Models->Wheels = 4; Models->Doors = 3; Models->EngineSize = 1499; // Display data. cout << Models->Model << " has " << Models->Doors << "doors" << endl; delete Models; // Free the storage. } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/enum1.cc0000644000076400001440000000060707055335221016405 /************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ #include main() { enum Colour { Red=1, Amber, Green}; Colour TraficLight++; TraficLight++; return 0; } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/class1.cc0000644000076400001440000000135107055335211016542 /************************************************************************ * * Purpose: First example of the class statement. * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ #include #include // Instead of stdio.h class String { public: void Set(char *InputStr) // Declare an Access function { strcpy(Str, InputStr); } char *Get(void) // Declare an Access function { return(Str); } private: char Str[80]; // Declare a hidden variable. }; main() { String Title; Title.Set("My First Masterpiece."); cout << Title.Get() << endl; } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/class2.cc0000644000076400001440000000154607055335222016553 /************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ #include #include // Instead of stdio.h class string { public: // Constructor. string() { Age=35; } // Destructors (Clear storage - free()). ~String() {} // ... Overloaded functions. void print() { cout << "Martin is " << Age << endl ; } void print(char * str) { cout << "** " << str << " **\n"; } private: int Age; // Declare Age }; main() { string test; // Constructor inserted by the compiler here. test.print(); test.print("Leslie"); } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/inherit.cc0000644000076400001440000000312607055335213017022 /************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ #include #include // Instead of stdio.h // ... The base class 'Fabric' // ... is no different to normal. class Fabric { public: Fabric() {}; ~Fabric(){}; SetSize(int x, int y) { Length = x; Width = y; } SetColour(char *C) { strcpy(Colour, C); } private: int Length; int Width; char Colour[20]; }; // ... The derived class 'Tent' // ... names 'Fabric' as a base class. class Tent : public Fabric { public: Tent() {}; ~Tent() {}; SetNumOfPoles(int P) { Poles = P; } private: int Poles; }; // ... The derived class 'Clothes' also // ... names 'Fabric' as a base class. class Clothes : public Fabric { public: Clothes() {}; ~Clothes() {}; void SetNumOfButtons(int B) { Buttons = B; }; int GetNumOfButtons(void) { return (Buttons); }; private: int Buttons; }; // ... Function definitions. void Init(Fabric &Material); main() { Tent Frame; Clothes Jacket; // ... Initialise using the derived methods. Init(Frame); Init(Jacket); // .. Initialise using the unique methods. Frame.SetNumOfPoles(5); Jacket.SetNumOfButtons(2); } void Init(Fabric &Material) { Material.SetColour("Red"); Material.SetSize (10, 20); } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/throw.cc0000644000076400001440000000170307055335213016522 /************************************************************************** * * Language: C++ * Purpose: Program to demonstrate the 'try', 'catch' and 'throw' statements. * Author: M J Leslie * Date: 21-Mar-98 * * Compile: The following command was used to compile. * * g++ -fhandle-exceptions throw.cc -o throw * **************************************************************************/ #include // For cout. void ErrorFunc(int Error); main() { ErrorFunc(0); ErrorFunc(1); } void ErrorFunc(int Error) { try { cout << "Error code is " << Error << endl; if (Error > 0 ) { throw(Error); // This statement causes control to jump // to the 'catch' statement } cout << "No Error occoured" << endl; } catch(int n) { cout << "Error number is " << n << endl;; } } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/inline.cc0000644000076400001440000000050507055335212016633 /************************************************************************** * * Language: C++ * Purpose: Program to demonstrate the 'inline' statement. * Author: M J Leslie * Date: 14-Feb-96 * Descrip: To be written. * **************************************************************************/ main() { } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/cast.cc0000644000076400001440000000047107055335221016311 /************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ main() { int var1; float var2; var2 = float(var1); return 0; } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/MGREP.CC0000644000076400001440000004655407055335221016145 /************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ /* Known problems. Serious memory leaks not enough comments Has problems with vi swp files on Linux (so does normal grep). */ extern "C" { #include #include #include #include #include #include } #include // DEBUG 1 == Debugging information is required. // DEBUG 0 == Debugging info is suppresed. #define DEBUG 0 class List { public: List() { Reset(); } ~List() { } void Add(int Number) { Add(Number, ':'); } void Add(int Number, char Prefix) { // Are we adding the first item in the list? if ( pFirstItem == 0 ) { // Yes. pFirstItem = new IntList; pCurrentItem = pFirstItem; } else { // No. Add the number to the end of the list. pCurrentItem->pNext = new IntList; pCurrentItem = pCurrentItem->pNext; } pCurrentItem->Item = Number; pCurrentItem->Prefix = Prefix; pCurrentItem->pNext = 0; } void PointToFirstEntry(void) { pCurrentItem = pFirstItem; } void Reset(void) { // This is going to cause seriuos memory leaks! pFirstItem = 0; pCurrentItem = 0; } int GetCurrentEntry(void) { // Check we have a valid Item. if (pCurrentItem) { return (pCurrentItem->Item); } else { // No Item. This could happen when the list is empty. return (0); } } int GetNextEntry(void) { // Is there another entry in the list? if ( pCurrentItem->pNext != 0 ) { // Yes. Give it to the caller. pCurrentItem = pCurrentItem->pNext; return (pCurrentItem->Item); } else { // No. return (0); } } char GetCurrentPrefix(void) { // pCurrentItem = pCurrentItem->pNext; return (pCurrentItem->Prefix); } char GetNextPrefix(void) { pCurrentItem = pCurrentItem->pNext; return (pCurrentItem->Prefix); } private: struct IntList { int Item; char Prefix; IntList *pNext; }; IntList *pFirstItem; IntList *pCurrentItem; }; class grep { public: // enum { LL = 512 } LineLength ; // ....................................................................... grep() // Constructor. { OFF = 0; ON = 1; LineNumbering = ON; LinesBefore = 2; LinesAfter = 2; LinesInFile = 0; pFileName = 0; SearchString = '\0'; InsensitiveSearch = OFF; } // ....................................................................... ~grep () // Distructor. { delete[] pFileName; } // ....................................................................... void BuildMatrix(void) { int Line = 0; int StartPos = 0; int EndPos = 0; int NextPos = 0; Debug("BuildMatrix"); FoundLines.PointToFirstEntry(); Line = FoundLines.GetCurrentEntry(); Debug(Line); // Loop until we run out of line numbers. while ( Line > 0 ) { // Find the first line to display. StartPos = Line - LinesBefore; if ( StartPos <= EndPos ) { StartPos = EndPos + 1; } while ( StartPos < Line ) { LineMatrix.Add(StartPos, ':'); Debug(StartPos, 's'); StartPos++; } LineMatrix.Add(Line, '*'); Debug(Line, '*'); EndPos = Line + LinesAfter; if ( EndPos > LinesInFile ) { EndPos = LinesInFile; } NextPos = FoundLines.GetNextEntry(); if ( NextPos > 0 && EndPos >= NextPos ) { EndPos = NextPos - 1; } Line++; while ( Line <= EndPos ) { LineMatrix.Add(Line, ':'); Debug(Line, 'e'); Line++; } Line = NextPos; Debug(Line); } } // ....................................................................... void CaseInsensitive(void) { InsensitiveSearch = ON; } // ....................................................................... void Diagnostic(void) { cout << endl << "Extra lines before the found line: " << LinesBefore << endl; if ( InsensitiveSearch ) { cout << "Search is: Case Insensitive." << endl; } else { cout << "Search is: Case Sensitive." << endl; } } // ....................................................................... int Exists(void) { // Have we got the file name? if ( pFileName == 0 ) { // No. return (0); } else { // Yes. Check the file exists. struct stat stat_p; /* 'stat_p' is a pointer to a structure * of type 'stat'. */ /* Get stats for file and place them in * the structure. */ if ( -1 == stat (pFileName, &stat_p) ) { // File name not found. return (0); } if(!S_ISREG(stat_p.st_mode)) { // This is not a regular file. It may be a directory. // Ignore it. return(0); } // File name is OK. return (1); } } // ....................................................................... void Name(char *pFN) { Debug("Name", pFN); pFileName = new char[strlen(pFN)+1]; strcpy(pFileName, pFN); } // ....................................................................... void NoLineNumbers(void) { LineNumbering = OFF; } // ....................................................................... void ProcessFile(void) { int Line; int PreviousLine= 0; char Prefix; int CurrentLine = 0; char Buffer[512]; int LineCount = 0; FILE *fp; Debug("ProcessFile"); cout << endl << "Search String is: " << SearchString << endl; cout << "File Name is: " << pFileName << endl; fp = fopen (pFileName, "r"); LineMatrix.PointToFirstEntry(); Line = LineMatrix.GetCurrentEntry(); Prefix = LineMatrix.GetCurrentPrefix(); while ( Line > 0 ) { do { fgets(Buffer, 512, fp); LineCount ++; } while ( LineCount < Line ); // Put in a seperator between blocks. if ( PreviousLine+1 < Line ) { Seperator(); } if ( LineNumbering ) { cout << Line << Prefix << " " << Buffer; } else { cout << Prefix << " " << Buffer; } PreviousLine = Line; Line = LineMatrix.GetNextEntry(); Prefix = LineMatrix.GetCurrentPrefix(); } Seperator(); fclose(fp); } // ....................................................................... void PutSearchString(char *String) { Debug("PutSearchString"); Debug(String); SearchString = new char[strlen(String)+1]; strcpy(SearchString, String); if ( InsensitiveSearch ) { // Yes. Convert the buffer to uppercase. Uppercase(SearchString); } } // ....................................................................... void Reset(void) { FoundLines.Reset(); LineMatrix.Reset(); } // ....................................................................... int ScanFile(void) { FILE *fp; char Buffer[512]; int LineCounter = 0; int Found = 0; // Number of lines that matched the search string. fp = fopen(pFileName, "r"); Debug ("ScanFile"); while ( !feof(fp) ) { LineCounter++; fgets(Buffer, 512, fp); // Check the Buffer was big enough. if (strlen(Buffer) == 512 -1 ) { cout << __FILE__ << ": Warning! Lines in " << pFileName << " exceed the max line length of " << 512 << endl; } // Are we doing a case insensitive search? if ( InsensitiveSearch ) { // Yes. Convert the buffer to uppercase. Uppercase(Buffer); } if ( strstr(Buffer, SearchString) ) { FoundLines.Add(LineCounter); Found++; } } fclose (fp); LinesInFile = LineCounter; return(Found); } // ....................................................................... void SetLines(int Lines) { SetLinesBefore(Lines); SetLinesAfter(Lines); } // ....................................................................... void SetLinesBefore(int Lines) { LinesBefore = Lines; } // ....................................................................... void SetLinesAfter(int Lines) { LinesAfter = Lines; } private: // Debugging methods. void Debug(char *Message) { if ( DEBUG ) { cout << "Debug: " << Message << endl; } } // ....................................................................... void Debug(int Value) { if ( DEBUG ) { cout << "Debug: " << Value << endl; } } // ....................................................................... void Debug(int Value, char Char) { if ( DEBUG ) { cout << "Debug: " << Char << " " << Value << endl; } } // ....................................................................... void Debug(char * Str, int Value) { if ( DEBUG ) { cout << "Debug: " << Str << " " << Value << endl; } } // ....................................................................... void Debug(char * Str1, char * Str2) { if ( DEBUG ) { cout << "Debug: " << Str1 << " " << Str2 << endl; } } // ....................................................................... // Seperate blocks of data. void Seperator(void) { cout << "------" << endl; } // ....................................................................... void Uppercase(char *String) { int Offset = 0; while ( String[Offset] != (char)NULL ) { String[Offset] = toupper(String[Offset]); Offset++; } } int LineNumbering; // ON = Line numbering required. int LinesBefore; int LinesAfter; int LinesInFile; // Number of lines in the file. int InsensitiveSearch; // ON = Case insensitive search required. char *pFileName; // File to be searched. char *SearchString; List FoundLines; // List of lines that contain the search string. List LineMatrix; // List of lines that will be displayed. // Handy variables to set boolean variables. int OFF; int ON; }; // Private functions. void Debug(char *Message); void Help(void); void ProcessTheCommandLine( int argc, char **Argv); // // Start point in the program. // main( int Argc, char **Argv) { ProcessTheCommandLine(Argc, Argv); } // ....................................................................... void Help(void) { cout << endl << " mgrep (Martins grep or Multi line grep) is an alternative to grep. " << endl << " The purpose is the same as grep in that it searches files " << endl << " looking for a supplied string. The difference is in the output, " << endl << " aswell as showing the line that contains the string, it also " << endl << " shows the lines around the found line." << endl; cout << endl << " When reading from stdin, mgrep works a little differently to grep." << endl << " grep will scan the data on stdin looking for the search string." << endl << " mgrep assumes it is being passed file names, therefore it attempts " << endl << " to open the files and search the contents. " << endl; cout << endl << " Please note that mgrep is slower than grep, this is because it " << endl << " performs two passes over the files being searched. " << endl; cout << endl << "Syntax:" << endl << endl; // cout << " mgrep [ -d -h -l n -b n -a n -s] string [filenames]" << endl; cout << " mgrep [ -d -h -l n -b n -a n ] string [filenames]" << endl; cout << "" << endl; cout << " -h --------- Display this help." << endl; cout << " -d --------- Basic diagnostic information is printed." << endl; cout << " -i --------- Case insensitive search." << endl; cout << " -n --------- No line numbering required." << endl; cout << " -l n ------- Number of lines to show either side of the found line." << endl; cout << " Default is 2." << endl; cout << " -b n ------- Number of lines to show before the found line." << endl; cout << " Default is 2." << endl; cout << " -a n ------- Number of lines to show after the found line." << endl; cout << " Default is 2." << endl; cout << " -s --------- Look for the list of files on STDIN." << endl; cout << " string ----- The string to search for." << endl; cout << " filenames -- List of files to search." << endl << endl; } // ....................................................................... void Debug(char *Message) { if ( DEBUG ) { cout << "Debug: " << Message << endl; } } // // Read the command line and act on its contents. // void ProcessTheCommandLine( int Argc, char **Argv) { grep File; int Flag = 'x'; int LookAtStdin = 0; int FirstFile = 1; int DiagnosticRequired = 0; Debug("ProcessTheCommandLine"); // Process the command line. for ( int Inc = 1; Inc < Argc; Inc++ ) { // Have we got a flag? if ( *(Argv[Inc]) == '-' ) { // Yes. Flag = *((Argv[Inc])+1); switch ( Flag ) { case 'd': // Diagnostics requested DiagnosticRequired = 1; break; case 'h': // Help requested Help(); exit(0); break; case 'i': // Case insensitive search File.CaseInsensitive(); break; case 'l': // Number of lines to show either side of the found line. Inc++; File.SetLines(atoi(Argv[Inc])); break; case 'n': File.NoLineNumbers(); break; case 'b': Inc++; File.SetLinesBefore(atoi(Argv[Inc])); break; case 'a': Inc++; File.SetLinesAfter(atoi(Argv[Inc])); break; case 's': LookAtStdin = 1; default: cout << Argv[Inc] << " is an invalid flag" << endl; } } else { // This is not a flag, it has to be // the search string or a file name. if ( FirstFile ) { // Assume the first word following // the flags is the search string. File.PutSearchString(Argv[Inc]); if ( DiagnosticRequired ) { File.Diagnostic(); } FirstFile = 0; } else { File.Name(Argv[Inc]); // ... If the file exists, // ... find and display the lines that contain // ... the search string. if ( !File.Exists() ) { // cout << "File " << Argv[Inc] << " not found. " << endl; } else { int Found = 0; Debug("File Found"); Found = File.ScanFile(); // Only proceed with this file if we found matching records. if (Found > 0) { File.BuildMatrix(); File.ProcessFile(); } File.Reset(); } } } } // Should we scan stdin for file names? // This is a bodge because I cant figure out how to do a non blocking // read on sdtin. if (LookAtStdin) { // Yes. char FileName[256]; // check we have a search string before looking in STDIN for filenames. if (FirstFile) { cout << __FILE__ << ": Search string not Supplied. " << endl; Help(); return; } // Disable buffering on stdin. This mean that stdin can be // read without special cmd line flags and fgets does not // lock up the program. char Buffer[BUFSIZ]; // setvbuf(stdin, Buffer); // Now check STDIN for file names. while (fgets(FileName, 256, stdin)) { FileName[strlen(FileName)-1] = '\0'; // cout << "stdin loop" << FileName << endl; File.Name(FileName); // ... If the file exists, // ... find and display the lines that contain // ... the search string. if ( !File.Exists() ) { // cout << "File " << FileName << " not found. " << endl; } else { int Found = 0; Debug("File Found"); Found = File.ScanFile(); // Only proceed with this file if we found matching records. if (Found > 0) { File.BuildMatrix(); File.ProcessFile(); } File.Reset(); } } } } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/refvar.cc0000644000076400001440000000066107055335212016645 /************************************************************************ * * Purpose: Demonstrate the use of reference variables. * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ #include int Square(int &Val); main() { int Number=10; Square(Number); printf("Number is %d\n", Number); } int Square(int &Val) { Val *= Val; } c_cpp_reference-2.0.2/reference/CPLUSPLUS/EXAMPLES/mjl_test.cc0000644000076400001440000000103607055335222017177 #include void Add(int Left, int Right); void Add(double Left, double Right); main () { Add(5, 9); Add(3.2, 7.1); } // integer version of Add. void Add(int Left, int Right) { cout << Left << " + " << Right << " = " << Left+Right << endl; } // float version of Add. void Add(double Left, double Right) { cout << Left << " + " << Right << " = " << Left+Right << endl; } c_cpp_reference-2.0.2/reference/CPLUSPLUS/Makefile.am0000644000076400001440000000034307055335116015667 EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) SUBDIRS = CONCEPT CONTRIB EXAMPLES FUNCTIONS GDB LIBRARIES MISC PROBLEMS SYNTAX TECHNIC \ X_EXAMPLES docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/Makefile.in0000644000076400001440000003412307474405126015707 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) SUBDIRS = CONCEPT CONTRIB EXAMPLES FUNCTIONS GDB LIBRARIES MISC PROBLEMS SYNTAX TECHNIC \ X_EXAMPLES docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = Makefile.am Makefile.in DIST_SUBDIRS = $(SUBDIRS) #>- all: all-recursive #>+ 1 all: docs-am all-recursive .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) GTAGS: here=`CDPATH=: && cd $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=glossary.html cref.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done for subdir in $(SUBDIRS); do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-recursive #>+ 1 clean: kde-rpo-clean clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-generic clean-libtool clean-recursive distclean \ distclean-generic distclean-libtool distclean-recursive \ distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ info-recursive install install-am install-data install-data-am \ install-data-recursive install-docsDATA install-exec \ install-exec-am install-exec-recursive install-info \ install-info-am install-info-recursive install-man \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-libtool mostlyclean-recursive tags tags-recursive \ uninstall uninstall-am uninstall-docsDATA uninstall-info-am \ uninstall-info-recursive uninstall-recursive # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/cref.html0000644000076400001440000000412207055335116015437 C++ Programming Reference


    C++ Programming Reference.

    Release 0.1


    The "C++ Programming Reference" contains my personnel notes on C++ and are not released to the public. If you are reading this BEWARE, it is not complete or factual. Martin Leslie


    o Introduction.

    o C++ Syntax
    o C++ Example programs
    o C programming problems.
    o C Technique and Style.

    o C Function Quick reference.
    o C Creating your own function library.

    o GCC Compiler errors.
    o GDB Debugger.

    o Glossary of terms.
    o Master Index.

    o Interesting C++ related items from the net.


    o Latest updates and future enhancements.


    o Download the source to this guide.

    Martin Leslie 01-Oct-98
    c_cpp_reference-2.0.2/reference/CPLUSPLUS/FUNCTIONS/0000777000076400001440000000000007474405231015270 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/FUNCTIONS/Makefile.am0000644000076400001440000000011207055335222017227 EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/FUNCTIONS/Makefile.in0000644000076400001440000002350407474405126017260 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = docs_DATA = docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/FUNCTIONS mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/FUNCTIONS/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/FUNCTIONS/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/FUNCTIONS/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/FUNCTIONS/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/FUNCTIONS/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/0000777000076400001440000000000007474405231015013 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/constructor.html0000644000076400001440000000315107055335242020201 Constructors and Destructors.

    Constructors and Destructors.


    Constructor

    The constructor is executed when an object is created. Its purpose is to initalise variables with in an object before they can be used.
    • If you do not provide a constructor for a class, the compiler will create a default constructor for you.
    • If the object has global scope, the constructor is executed before main()

    Copy Constructor

    Assignment Constructor

    Destructor


    Examples:

    o
    Example program.


    See Also:


    C References

    o data types.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/fundefault.html0000644000076400001440000000511407055335241017751 Default Parameters.


    Default Parameters.


    Within C you could not provide default values for function parameters. Well, C++ has come to your rescue.

    
        #include <iostream.h>
        
        void Func( int one, int two=2, int three=3);
        
        main ()
        {
            Func(10, 20, 30);
            Func(10, 20);   // Let the last parm default
            Func(10);       // Just provide the required parm.
        }
        
    
        void Func( int one, int two, int three)
        {
            cout << "One   = " << one   << endl;
            cout << "Two   = " << two   << endl;
            cout << "Three = " << three << endl << endl;
        }
    

    From this example, you can see that the prototype/function declaration gives default values for the second and third parameters. It is now down to the programmer calling the function to decide how many s/he wants to provide.

    There are some basic rules that should be applied when using default parameter values.

    • When a default is provided, all remaining parameters must be given defaults. There can not be any holes.
    • Default values must be of the correct type.
    • Defaults can be placed on the function prototype or the function definition. They can also be placed in both locations at the same time. I have been told its good practice to place them in the prototype only.


    Examples:


    See Also:

    o Function Name Overloading.

    C References

    o Function basics.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/Master.html0000644000076400001440000000205207055335236017051 Title here


    Title here.



    Examples:

    o Example program.


    See Also:


    C References

    o data types.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/local_var.html0000644000076400001440000000601707055335240017560 C++ Local Variables.


    C++ Local Variables.


    There is not much difference between C local variables but there is one important feature that should be noted.

    • Variable definitions are now considered to be executable statements.
    This means that you can now put variable definitions anywhere in the code and not jut at the start of a block. Here is an example.

    
        main()
        {
            float pi = 3.142;   // Usual location for variable definitions
            
            cout << "PI is " << pi << endl;
            
            int Count = 1;      // C++ allows us to place a definition here.
            
            while (Count < 10)
            {
                cout << Count << endl;
            }
        }
    

    It should be noted that Count is only in scope (usable) from the point of definition and to the end of the block. It can not be used in the previous cout statement.

    The idea of this feature is to allow you to put variable declarations near to the place you wish to use them. Personnaly, I feel this should not be neccasary if you write small concise functions.... There is one natty feature of this facility though. Check this example out.

    
        main()
        {
            int Last = 10;      
            
            while (int Count; Count < Last; Count++)
            {
                cout << Count << endl;
            }
        }
    

    In this example, Count is defined inside the for statement and only exists while the for block is being executed.


    Examples:


    See Also:


    C References

    o C local variables

    o data types.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/reference_variable.html0000644000076400001440000000570307055335235021426 Reference variables


    Reference Variables.


    Reference variables allow two variable names to address the same memory location. The following example shows the technique in its simplest form.

            
        #include 
        
        main()
        {
            int var1;
            int &var2 = var1;       // var2 is a reference variable.
    
            var1 = 10;
        
            cout << "var1 = " << var1 << endl;
            cout << "var2 = " << var2 << endl;
        }
    

    Generally, you would not use a reference variable in this way. Its more likely that they would be used in function parameter lists to make the passing of pointers more readable.

    This gives C++ the ability to provide a different approch to changing a variable from within a function. Consider the two following programs.

    
        #include <stdio.h>
    
        void Square(int *pVal);
    
        main()
        {
            int Number=10;
    
            printf("Number is %d\n", Number);
    
            Square(&Number);
    
            printf("Number is %d\n", Number);
        }
    
        void Square(int *pVal)
        {
            *pVal *= *pVal;            
            
            printf("Number is %d\n", *pVal);
        }
    
    
    
        #include <stdio.h>
    
        void Square(int &Val);
    
        main()
        {
            int Number=10;
    
            printf("Number is %d\n", Number);
    
            Square(Number);
    
            printf("Number is %d\n", Number);
        }
    
        void Square(int &Val)
        {
            Val *= Val;
            
            printf("Number is %d\n", Val);
        }
    
    

    The program on the right should be clearer to read because you do not need to worry about pointer dereferencing.


    Examples:

    o Example program.

    o Example C program.


    See Also:


    C References

    o data types.


    Top Master Index Keywords Functions


    Martin Leslie 29-Sep-96

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/Makefile.am0000644000076400001440000000017507055335242016765 EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/Makefile.in0000644000076400001440000002413307474405126017002 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/CONCEPT mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/CONCEPT/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/CONCEPT/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/CONCEPT/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=constructor.html inheritance.html cast.html scope.html funcoverload.html Master.html local_var.html reference_variable.html fundefault.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/CONCEPT/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/CONCEPT/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/scope.html0000644000076400001440000000373307055335237016737 Scope in C++


    Scope in C++.


    The :: operator is used within C++ to identify global variables that conflict with local variable names. Obviously it would be good programming practice to use suitable names in the first place......

    
            #include 
            
            int Counter = 1;
            
            main()     
            {
                int Counter = 1;
                
                for (int i=0; i< 10; i++)
                {
                    cout << Counter << " " << ::Counter << endl;
                    Counter++; 
                }
                
                return 0;
            }
    


    Examples:

    o Example program.


    See Also:

    o C++ operators..

    C References

    o Global Variables.

    o C Expressions and Operators.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/cast.html0000644000076400001440000000305607055335240016550 C++ casting


    C++ casting.


    C++ has added a new feature to cast that allows you to cast variables by using a slightly more familuar syntax. Have a look at the example below.

            
        main()
        {
            int var1;
            float var2;
    
            var2 = float(var1);
        }
    

    The example shows that casting can now look like a function call.


    Examples:

    o C++ Example program.

    See Also:


    C References

    o C casting.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/inheritance.html0000644000076400001440000001047607055335236020120 Inheritance


    Inheritance.


    Inheritance enables classes to use the properties of other classes and add to those properties.

    The thing to remember about object programming is that it attempts to create a software model as close to the real world as possible. Inheritance forms an important role to meet this need. Take the following example.

    A fabric can have a colour and size and it is also used to make clothes as well as tents. Now looking at this from the other angle tents are made from fabric and poles but clothes are made from fabric and buttons. So, Tents and clothes have something in common, fabric! If we described tents and clothes in C++, we can seperate fabric into a seperate class that the Tent and Clothes classes can inherit.

    
           -----------         
          |  Fabric   |        
           -----------         
              A    A           
              |    |           
           ---      ---        
          |            |       
     ---------     ----------- 
    |  Tent   |   |  Clothes  |
     ---------     ----------- 
    
    
    

    Now for some buzz words:

    1. Fabric is a base class
    2. Tent and Clothes are derived classes
    This is what the code looks like:

    
    // ... The base class 'Fabric'
    // ... is no different to normal.
    
    
      class Fabric
      {
      public:
    
           Fabric() {};
          ~Fabric() {};
    
          SetSize(int x, int y)
          {
              Length = x;
              Width  = y;
          };
    
          SetColour(char *C)
          {
             strcpy(Colour, C); 
          }
    
      private:
          int  Length;
          int  Width;
          char Colour[20];
      };
    
    

    
    // ... The derived class 'Tent'
    // ... names 'Fabric' as a base class.
    
    
    // ... The derived class 'Clothes' also
    // ... names 'Fabric' as a base class.
    
    
      class Tent : public Fabric
      {
      public:
    
           Tent() {};
          ~Tent() {};
    
          SetNumOfPoles(int P)
          {
              Poles = P;
          };
    
      private:
          int  Poles;
      };
            
    
    
      class Clothes : public Fabric
      {
      public:
    
          Clothes() {};
          ~Clothes() {};
    
          SetNumOfButtons(int B)
          {
              Buttons = B;
          };
    
      private:
          int  Buttons;
      };
            
    

    What we now have are three classes with the following public methods.

    • Fabric
      1. SetSize
      2. SetColour
    • Tents
      1. SetSize
      2. SetColour
      3. SetNumOfPoles
    • Clothes
      1. SetSize
      2. SetColour
      3. SetNumOfButtons

    Using the classes

    So we have three classes, they are used in the same way as before but with one extra feature.

    Consider this piece of code.

      void Init(Fabric &Material);
    
      main()
      {
          Tent       Frame;
          Clothes    Jacket;
    
          Init(Frame);
          Init(Jacket);
      }
    
      void Init(Fabric &Material)
      {
          Material.SetColour("Red");
          Material.SetSize  (10, 20);
      }
         
    

    The function 'Init' expects an object of type 'Fabric' but we are passing objects of type 'Tents' and 'Clothes', this is OK as 'Tents' and 'Clothes' are derived from Fabric.


    Examples:

    o The final program.


    See Also:


    Top Master Index Keywords Functions


    Martin Leslie 29-Dec-97

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONCEPT/funcoverload.html0000644000076400001440000000624307055335242020310 Function Overloading.


    Function Overloading.


    Overloading is a technique that allows you to give a several functions with the same name but different parameter lists.

    Consider the following program.

    
        #include <iostream.h>
        
        void Add(int Left,   int Right);
    
        main ()
        {
            Add(5, 9);              // Integer Add.
            Add(3.2, 7.1);          // Floating point Add.
        }
     
        // Integer version of Add.
           
        void Add(int Left, int Right)
        {
            cout << Left << " + " << Right << " = " << Left+Right << endl;
        }
    

    The program contains the Add function that adds integers. But the main calls it twice, once passing integers and the second time passing floating point numbers. The program will compile and run but you will get incorrect results because the floats will be cast to integers.

    The second program offers a solution by overloading the Add function.

    
        #include <iostream.h>
        
        void Add(int    Left, int    Right);
        void Add(double Left, double Right);
    
        main ()
        {
            Add(5, 9);             // Integer Add.        
            Add(3.2, 7.1);         // Floating point Add. 
        }
     
        // Integer version of Add.
           
        void Add(int Left, int Right)
        {
            cout << Left << " + " << Right << " = " << Left+Right << endl;
        }
     
        // float version of Add.
        
        void Add(double Left, double Right)
        {
            cout << Left << " + " << Right << " = " << Left+Right << endl;
        }
    
    
    The compiler can now look at the call list and match it with a function with the correct parameter list and the floating point addition is performed correctly.

    Please note that the returned argument is not used when matching overloaded functions.


    Examples:

    o Example program.


    See Also:

    o Default Parameter Values..

    C References

    o Function Basics.


    Top Master Index Keywords Functions


    Martin Leslie

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONTRIB/0000777000076400001440000000000007474405231015020 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONTRIB/Makefile.am0000644000076400001440000000022207055335117016764 EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) SUBDIRS = GNU_STDLIB docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONTRIB/Makefile.in0000644000076400001440000003405207474405126017010 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) SUBDIRS = GNU_STDLIB docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/CONTRIB mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = Makefile.am Makefile.in DIST_SUBDIRS = $(SUBDIRS) #>- all: all-recursive #>+ 1 all: docs-am all-recursive .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/CONTRIB/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/CONTRIB/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/CONTRIB/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) GTAGS: here=`CDPATH=: && cd $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=intro.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done for subdir in $(SUBDIRS); do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-recursive #>+ 1 clean: kde-rpo-clean clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-generic clean-libtool clean-recursive distclean \ distclean-generic distclean-libtool distclean-recursive \ distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ info-recursive install install-am install-data install-data-am \ install-data-recursive install-docsDATA install-exec \ install-exec-am install-exec-recursive install-info \ install-info-am install-info-recursive install-man \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-libtool mostlyclean-recursive tags tags-recursive \ uninstall uninstall-am uninstall-docsDATA uninstall-info-am \ uninstall-info-recursive uninstall-recursive # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/CONTRIB/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/CONTRIB/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONTRIB/intro.html0000644000076400001440000000072007055335117016754 C++ Internet References.


    C++ Internet References.


    Goodies I have found on the net.


    GNU Standard C++ library. Found at c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/0000777000076400001440000000000007474405231016512 5c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/Makefile.am0000644000076400001440000000017507055335211020460 EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/Makefile.in0000644000076400001440000002406307474405126020503 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/CPLUSPLUS/CONTRIB/GNU_STDLIB mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=libgpp_toc.html libgpp.html DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/Makefile cd $(top_srcdir) && perl admin/am_edit reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/libgpp_toc.html0000644000076400001440000001516107055335121021435 to the GNU C++ Library - Table of Contents

    to the GNU C++ Library

    last updated April 29, 1992

    for version 2.0

    Doug Lea (dl@g.oswego.edu)

    c_cpp_reference-2.0.2/reference/CPLUSPLUS/CONTRIB/GNU_STDLIB/libgpp.html0000644000076400001440000062534107055335211020577 to the GNU C++ Library

    to the GNU C++ Library

    Copyright (C) 1988, 1991, 1992 Free Software Foundation, Inc.

    Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

    Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the section entitled "GNU Library General Public License" is included exactly as in the original, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

    Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that the section entitled "GNU Library General Public License" may be included in a translation approved by the author instead of in the original English.

    Note: The GNU C++ library is still in test release. You will be performing a valuable service if you report any bugs you encounter.

    GNU LIBRARY GENERAL PUBLIC LICENSE

    Version 2, June 1991

    Copyright (C) 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.
    
    [This is the first released version of the library GPL.  It is
     numbered 2 because it goes with version 2 of the ordinary GPL.]
    

    Preamble

    The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.

    This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, 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 library, or if you modify it.

    For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights.

    Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library.

    Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, 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 companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

    Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license.

    The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such.

    Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better.

    However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries.

    The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library.

    Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one.

    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

    1. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you".

      A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.

      The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)

      "Source code" for a work means the preferred form of the work for making modifications to it. For a library, 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 library.

      Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.

    2. You may copy and distribute verbatim copies of the Library's complete 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 distribute a copy of this License along with the Library.

      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.

    3. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

      1. The modified work must itself be a software library.

      2. You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.

      3. You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.

      4. If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.

        (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)

      These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, 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 Library, 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 Library.

      In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

    4. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.

      Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.

      This option is useful when you wish to copy part of the code of the Library into a program that is not a library.

    5. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you 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.

      If distribution of 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 satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.

    6. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.

      However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.

      When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.

      If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)

      Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.

    7. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.

      You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:

      1. Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)

      2. Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.

      3. If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.

      4. Verify that the user has already received a copy of these materials or that you have already sent this user a copy.

      For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. 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.

      It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.

    8. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:

      1. Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.

      2. Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

    9. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library 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.

    10. 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 Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.

    11. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library 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.

    12. 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 Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library 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 Library.

      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.

    13. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library 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.

    14. The Free Software Foundation may publish revised and/or new versions of the Library 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 Library 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 Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.

    15. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, 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

    16. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "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 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

    17. 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 LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

    END OF TERMS AND CONDITIONS

    How to Apply These Terms to Your New Libraries

    If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).

    To apply these terms, attach the following notices to the library. 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.

    one line to give the library's name and an idea of what it does.
    Copyright (C) year  name of author
    
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.
    
    This library 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
    Library General Public License for more details.
    
    You should have received a copy of the GNU Library General Public
    License along with this library; 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.

    You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names:

    Yoyodyne, Inc., hereby disclaims all copyright interest in
    the library `Frob' (a library for tweaking knobs) written
    by James Random Hacker.
    
    signature of Ty Coon, 1 April 1990
    Ty Coon, President of Vice
    

    That's all there is to it!

    Contributors to GNU C++ library

    Aside from Michael Tiemann, who worked out the front end for GNU C++, and Richard Stallman, who worked out the back end, the following people (not including those who have made their contributions to GNU CC) should not go unmentioned.

    • Doug Lea contributed most otherwise unattributed classes.

    • Per Bothner contributed the iostream I/O classes.

    • Dirk Grunwald contributed the Random number generation classes, and PairingHeaps.

    • Kurt Baudendistel contributed Fixed precision reals.

    • Doug Schmidt contributed ordered hash tables, a perfect hash function generator, and several other utilities.

    • Marc Shapiro contributed the ideas and preliminary code for Plexes.

    • Eric Newton contributed the curses window classes.

    • Some of the I/O code is derived from BSD 4.4, and was developed by the University of California, Berkeley.

    • The code for converting accurately between floating point numbers and their string representations was written by David M. Gay of AT&T.

    Installing GNU C++ library

    1. Read through the README file and the Makefile. Make sure that all paths, system-dependent compile switches, and program names are correct.

    2. Check that files `values.h', `stdio.h', and `math.h' declare and define values appropriate for your system.

    3. Type `make all' to compile the library, test, and install. Current details about contents of the tests and utilities are in the `README' file.

    Trouble in Installation

    Here are some of the things that have caused trouble for people installing GNU C++ library.

    1. Make sure that your GNU C++ version number is at least as high as your libg++ version number. For example, libg++ 1.22.0 requires g++ 1.22.0 or later releases.

    2. Double-check system constants in the header files mentioned above.

    GNU C++ library aims, objectives, and limitations

    The GNU C++ library, libg++ is an attempt to provide a variety of C++ programming tools and other support to GNU C++ programmers.

    Differences in distribution policy are only part of the difference between libg++.a and AT&T libC.a. libg++ is not intended to be an exact clone of libC. For one, libg++ contains bits of code that depend on special features of GNU g++ that are either different or lacking in the AT&T version, including slightly different inlining and overloading strategies, dynamic local arrays, etc. All of these differences are minor. For example, while the AT&T and GNU stream classes are implemented in very different ways, the vast majority of C++ programs compile and run under either version with no visible difference. Additionally, all g++-specific constructs are conditionally compiled; The library is designed to be compatible with any 2.0 C++ compiler.

    libg++ has also contained workarounds for some limitations in g++: both g++ and libg++ are still undergoing rapid development and testing--a task that is helped tremendously by the feedback of active users. This manual is also still under development; it has some catching up to do to include all the facilities now in the library.

    libg++ is not the only freely available source of C++ class libraries. Some notable alternative sources are Interviews and NIHCL. (InterViews has been available on the X-windows X11 tapes and also from interviews.stanford.edu. NIHCL is available by anonymous ftp from GNU archives (such as the pub directory of prep.ai.mit.edu), although it is not supported by the FSF - and needs some work before it will work with g++.)

    As every C++ programmer knows, the design (moreso than the implementation) of a C++ class library is something of a challenge. Part of the reason is that C++ supports two, partially incompatible, styles of object-oriented programming -- The "forest" approach, involving a collection of free-standing classes that can be mixed and matched, versus the completely hierarchical (smalltalk style) approach, in which all classes are derived from a common ancestor. Of course, both styles have advantages and disadvantages. So far, libg++ has adopted the "forest" approach. Keith Gorlen's OOPS library adopts the hierarchical approach, and may be an attractive alternative for C++ programmers who prefer this style.

    Currently (and/or in the near future) libg++ provides support for a few basic kinds of classes:

    The first kind of support provides an interface between C++ programs and C libraries. This includes basic header files (like `stdio.h') as well as things like the File and stream classes. Other classes that interface to other aspects of C libraries (like those that maintain environmental information) are in various stages of development; all will undergo implementation modifications when the forthcoming GNU libc library is released.

    The second kind of support contains general-purpose basic classes that transparently manage variable-sized objects on the freestore. This includes Obstacks, multiple-precision Integers and Rationals, arbitrary length Strings, BitSets, and BitStrings.

    Third, several classes and utilities of common interest (e.g., Complex numbers) are provided.

    Fourth, a set of pseudo-generic prototype files are available as a mechanism for generating common container classes. These are described in more detail in the introduction to container prototypes. Currently, only a textual substitution mechanism is available for generic class creation.

    GNU C++ library stylistic conventions

    • C++ source files have file extension `.cc'. Both C-compatibility header files and class declaration files have extension `.h'.

    • C++ class names begin with capital letters, except for istream and ostream, for AT&T C++ compatibility. Multi-word class names capitalize each word, with no underscore separation.

    • Include files that define C++ classes begin with capital letters (as do the names of the classes themselves). `stream.h' is uncapitalized for AT&T C++ compatibility.

    • Include files that supply function prototypes for other C functions (system calls and libraries) are all lower case.

    • All include files define a preprocessor variable _X_h, where X is the name of the file, and conditionally compile only if this has not been already defined. The #pragma once facility is also used to avoid re-inclusion.

    • Structures and objects that must be publicly defined, but are not intended for public use have names beginning with an underscore. (for example, the _Srep struct, which is used only by the String and SubString classes.)

    • The underscore is used to separate components of long function names,
      e.g., set_File_exception_handler().

    • When a function could be usefully defined either as a member or a friend, it is generally a member if it modifies and/or returns itself, else it is a friend. There are cases where naturalness of expression wins out over this rule.

    • Class declaration files are formatted so that it is easy to quickly check them to determine function names, parameters, and so on. Because of the different kinds of things that may appear in class declarations, there is no perfect way to do this. Any suggestions on developing a common class declaration formatting style are welcome.

    • All classes use the same simple error (exception) handling strategy. Almost every class has a member function named error(char* msg) that invokes an associated error handler function via a pointer to that function, so that the error handling function may be reset by programmers. By default nearly all call *lib_error_handler, which prints the message and then aborts execution. This system is subject to change. In general, errors are assumed to be non-recoverable: Library classes do not include code that allows graceful continuation after exceptions.

    Support for representation invariants

    Most GNU C++ library classes possess a method named OK(), that is useful in helping to verify correct performance of class operations.

    The OK() operations checks the "representation invariant" of a class object. This is a test to check whether the object is in a valid state. In effect, it is a (sometimes partial) verification of the library's promise that (1) class operations always leave objects in valid states, and (2) the class protects itself so that client functions cannot corrupt this state.

    While no simple validation technique can assure that all operations perform correctly, calls to OK() can at least verify that operations do not corrupt representations. For example for String a, b, c; ... a = b + c;, a call to a.OK(); will guarantee that a is a valid String, but does not guarantee that it contains the concatenation of b + c. However, given that a is known to be valid, it is possible to further verify its properties, for example via a.after(b) == c && a.before(c) == b. In other words, OK() generally checks only those internal representation properties that are otherwise inaccessible to users of the class. Other class operations are often useful for further validation.

    Failed calls to OK() call a class's error method if one exists, else directly call abort. Failure indicates an implementation error that should be reported.

    With only rare exceptions, the internal support functions for a class never themselves call OK() (although many of the test files in the distribution call OK() extensively).

    Verification of representational invariants can sometimes be very time consuming for complicated data structures.

    Introduction to container class prototypes

    As a temporary mechanism enabling the support of generic classes, the GNU C++ Library distribution contains a directory (`g++-include') of files designed to serve as the basis for generating container classes of specified elements. These files can be used to generate `.h' and `.cc' files in the current directory via a supplied shell script program that performs simple textual substitution to create specific classes.

    While these classes are generated independently, and thus share no code, it is possible to create versions that do share code among subclasses. For example, using typedef void* ent, and then generating a entList class, other derived classes could be created using the void* coercion method described in Stroustrup, pp204-210.

    This very simple class-generation facility is useful enough to serve current purposes, but will be replaced with a more coherent mechanism for handling C++ generics in a way that minimally disrupts current usage. Without knowing exactly when or how parametric classes might be added to the C++ language, provision of this simplest possible mechanism, textual substitution, appears to be the safest strategy, although it does require certain redundancies and awkward constructions.

    Specific classes may be generated via the `genclass' shell script program. This program has arguments specifying the kinds of base types(s) to be used. Specifying base types requires two arguments. The first is the name of the base type, which may be any named type, like int or String. Only named types are supported; things like int* are not accepted. However, pointers like this may be used by supplying the appropriate typedefs (e.g., editing the resulting files to include typedef int* intp;). The type name must be followed by one of the words val or ref, to indicate whether the base elements should be passed to functions by-value or by-reference.

    You can specify basic container classes using genclass base [val,ref] proto, where proto is the name of the class being generated. Container classes like dictionaries and maps that require two types may be specified via genclass -2 keytype [val, ref], basetype [val, ref] proto, where the key type is specified first and the contents type second. The resulting classnames and filenames are generated by prepending the specified type names to the prototype names, and separating the filename parts with dots. For example, genclass int val List generates class intList residing in files `int.List.h' and `int.List.cc'. genclass -2 String ref int val VHMap generates (the awkward, but unavoidable) class name StringintVHMap. Of course, programmers may use typedef or simple editing to create more appropriate names. The existence of dot seperators in file names allows the use of GNU make to help automate configuration and recompilation. An example Makefile exploiting such capabilities may be found in the `libg++/proto-kit' directory.

    The genclass utility operates via simple text substitution using sed. All occurrences of the pseudo-types <T> and <C> (if there are two types) are replaced with the indicated type, and occurrences of <T&> and <C&> are replaced by just the types, if val is specified, or types followed by "&" if ref is specified.

    Programmers will frequently need to edit the `.h' file in order to insert additional #include directives or other modifications. A simple utility, `prepend-header' to prepend other `.h' files to generated files is provided in the distribution.

    One dubious virtue of the prototyping mechanism is that, because sources files, not archived library classes, are generated, it is relatively simple for programmers to modify container classes in the common case where slight variations of standard container classes are required.

    It is often a good idea for programmers to archive (via ar) generated classes into `.a' files so that only those class functions actually used in a given application will be loaded. The test subdirectory of the distribution shows an example of this.

    Because of #pragma interface directives, the `.cc' files should be compiled with -O or -DUSE_LIBGXX_INLINES enabled.

    Many container classes require specifications over and above the base class type. For example, classes that maintain some kind of ordering of elements require specification of a comparison function upon which to base the ordering. This is accomplished via a prototype file `defs.hP' that contains macros for these functions. While these macros default to perform reasonable actions, they can and should be changed in particular cases. Most prototypes require only one or a few of these. No harm is done if unused macros are defined to perform nonsensical actions. The macros are:

    DEFAULT_INITIAL_CAPACITY
    The initial capacity for containers (e.g., hash tables) that require an initial capacity argument for constructors. Default: 100

    <T>EQ(a, b)
    return true if a is considered equal to b for the purposes of locating, etc., an element in a container. Default: (a == b)

    <T>LE(a, b)
    return true if a is less than or equal to b Default: (a <= b)

    <T>CMP(a, b)
    return an integer < 0 if a<b, 0 if a==b, or > 0 if a>b. Default: (a <= b)? (a==b)? 0 : -1 : 1

    <T>HASH(a)
    return an unsigned integer representing the hash of a. Default: hash(a) ; where extern unsigned int hash(<T&>). (note: several useful hash functions are declared in builtin.h and defined in hash.cc)

    Nearly all prototypes container classes support container traversal via Pix pseudo indices, as described elsewhere.

    All object containers must perform either a X::X(X&) (or X::X() followed by X::operator =(X&)) to copy objects into containers. (The latter form is used for containers built from C++ arrays, like VHSets). When containers are destroyed, they invoke X::~X(). Any objects used in containers must have well behaved constructors and destructors. If you want to create containers that merely reference (point to) objects that reside elsewhere, and are not copied or destroyed inside the container, you must use containers of pointers, not containers of objects.

    All prototypes are designed to generate HOMOGENOUS container classes. There is no universally applicable method in C++ to support heterogenous object collections with elements of various subclasses of some specified base class. The only way to get heterogenous structures is to use collections of pointers-to-objects, not collections of objects (which also requires you to take responsibility for managing storage for the objects pointed to yourself).

    For example, the following usage illustrates a commonly encountered danger in trying to use container classes for heterogenous structures:

    class Base { int x; ...}
    class Derived : public Base { int y; ... }
    
    BaseVHSet s; // class BaseVHSet generated via something like
                 // `genclass Base ref VHSet'
    
    void f()
    {
      Base b;
      s.add(b); // OK
    
      Derived d;
      s.add(d);  // (CHOP!)
    }
    

    At the line flagged with `(CHOP!)', a Base::Base(Base&) is called inside Set::add(Base&)---not Derived::Derived(Derived&). Actually, in VHSet, a Base::operator =(Base&), is used instead to place the element in an array slot, but with the same effect. So only the Base part is copied as a VHSet element (a so-called chopped-copy). In this case, it has an x part, but no y part; and a Base, not Derived, vtable. Objects formed via chopped copies are rarely sensible.

    To avoid this, you must resort to pointers:

    typedef Base* BasePtr;
    
    BasePtrVHSet s; // class BaseVHSet generated via something like
                    // `genclass BasePtr val VHSet'
    
    void f()
    {
      Base* bp = new Base;
      s.add(b);
    
      Base* dp = new Derived;
      s.add(d);  // works fine.
    
      // Don't forget to delete bp and dp sometime.
      // The VHSet won't do this for you.
    }
    

    Example

    The prototypes can be difficult to use on first attempt. Here is an example that may be helpful. The utilities in the `proto-kit' simplify much of the actions described, but are not used here.

    Suppose you create a class Person, and want to make an Map that links the social security numbers associated with each person. You start off with a file `Person.h'

    
    #include <String.h>
    
    class Person
    {
      String nm;
      String addr;
      //...
    public:
      const String& name() { return nm; }
      const String& address() { return addr; }
      void          print() { ... }
      //...
    }
    
    

    And in file `SSN.h',

    typedef unsigned int SSN;
    

    Your first decision is what storage/usage strategy to use. There are several reasonable alternatives here: You might create an "object collection" of Persons, a "pointer collection" of pointers-to-Persons, or even a simple String map, housing either copies of pointers to the names of Persons, since other fields are unused for purposes of the Map. In an object collection, instances of class Person "live" inside the Map, while in a pointer collection, the instances live elsewhere. Also, as above, if instances of subclasses of Person are to be used inside the Map, you must use pointers. In a String Map, the same difference holds, but now only for the name fields. Any of these choices might make sense in particular applications.

    The second choice is the Map implementation strategy. Either a tree or a hash table might make sense. Suppose you want an AVL tree Map. There are two things to now check. First, as an object collection, the AVLMap requires that the elsement class contain an X(X&) constructor. In C++, if you don't specify such a constructor, one is constructed for you, but it is a very good idea to always do this yourself, to avoid surprises. In this example, you'd use something like

    class Person 
    { ...; 
        Person(const Person& p) :nm(p.nm), addr(p.addr) {}
    };
    

    Also, an AVLMap requires a comparison function for elements in order to maintain order. Rather than requiring you to write a particular comparison function, a `defs' file is consulted to determine how to compare items. You must create and edit such a file.

    Before creating `Person.defs.h', you must first make one additional decision. Should the Map member functions like m.contains(p) take arguments (p) by reference (i.e., typed as int Map::contains(const Person& p) or by value (i.e., typed as int Map::contains(const Person p). Generally, for user-defined classes, you want to pass by reference, and for builtins and pointers, to pass by value. SO you should pick by-reference.

    You can now create `Person.defs.h' via genclass Person ref defs. This creates a simple skeleton that you must edit. First, add #include "Person.h" to the top. Second, edit the <T>CMP(a,b) macro to compare on name, via

    #define <T>CMP(a, b) ( compare(a.name(), b.name()) )
    

    which invokes the int compare(const String&, const String&) function from `String.h'. Of course, you could define this in any other way as well. In fact, the default versions in the skeleton turn out to be OK (albeit inefficient) in this particular example.

    You may also want to create file `SSN.defs.h'. Here, choosing call-by-value makes sense, and since no other capabilities (like comparison functions) of the SSNs are used (and the defaults are OK anyway), you'd type

    genclass SSN val defs
    

    and then edit to place #include "SSN.h" at the top.

    Finally, you can generate the classes. First, generate the base class for Maps via

    genclass -2 Person ref SSN val Map
    

    This generates only the abstract class, not the implementation, in file `Person.SSN.Map.h' and `Person.SSN.Map.cc'. To create the AVL implementation, type

    genclass -2 Person ref SSN val AVLMap
    

    This creates the class PersonSSNAVLMap, in `Person.SSN.AVLMap.h' and `Person.SSN.AVLMap.cc'.

    To use the AVL implementation, compile the two generated `.cc' files, and specify `#include "Person.SSN.AVLMap.h"' in the application program. All other files are included in the right ways automatically.

    One last consideration, peculiar to Maps, is to pick a reasonable default contents when declaring an AVLMap. Zero might be appropriate here, so you might declare a Map,

    PersonSSNAVLMap m((SSN)0);
    

    Suppose you wanted a VHMap instead of an AVLMap Besides generating different implementations, there are two differences in how you should prepare the `defs' file. First, because a VHMap uses a C++ array internally, and because C++ array slots are initialized differently than single elements, you must ensure that class Person contains (1) a no-argument constructor, and (2) an assignment operator. You could arrange this via

    class Person 
    { ...; 
        Person() {}
      void operator = (const Person& p) { nm = p.nm; addr = p.addr; }
    };
    

    (The lack of action in the constructor is OK here because Strings possess usable no-argument constructors.)

    You also need to edit `Person.defs.h' to indicate a usable hash function and default capacity, via something like

    #include <builtin.h>
    #define <T>HASH(x)  (hashpjw(x.name().chars()))
    #define DEFAULT_INITIAL_CAPACITY 1000
    

    Since the hashpjw function from `builtin.h' is appropriate here. Changing the default capacity to a value expected to exceed the actual capacity helps to avoid "hidden" inefficiencies when a new VHMap is created without overriding the default, which is all too easy to do.

    Otherwise, everything is the same as above, substituting VHMap for AVLMap.

    Variable-Sized Object Representation

    One of the first goals of the GNU C++ library is to enrich the kinds of basic classes that may be considered as (nearly) "built into" C++. A good deal of the inspiration for these efforts is derived from considering features of other type-rich languages, particularly Common Lisp and Scheme. The general characteristics of most class and friend operators and functions supported by these classes has been heavily influenced by such languages.

    Four of these types, Strings, Integers, BitSets, and BitStrings (as well as associated and/or derived classes) require representations suitable for managing variable-sized objects on the free-store. The basic technique used for all of these is the same, although various details necessarily differ from class to class.

    The general strategy for representing such objects is to create chunks of memory that include both header information (e.g., the size of the object), as well as the variable-size data (an array of some sort) at the end of the chunk. Generally the maximum size of an object is limited to something less than all of addressable memory, as a safeguard. The minimum size is also limited so as not to waste allocations expanding very small chunks. Internally, chunks are allocated in blocks well-tuned to the performance of the new operator.

    Class elements themselves are merely pointers to these chunks. Most class operations are performed via inline "translation" functions that perform the required operation on the corresponding representation. However, constructors and assignments operate by copying entire representations, not just pointers.

    No attempt is made to control temporary creation in expressions and functions involving these classes. Users of previous versions of the classes will note the disappearance of both "Tmp" classes and reference counting. These were dropped because, while they did improve performance in some cases, they obscure class mechanics, lead programmers into the false belief that they need not worry about such things, and occasionally have paradoxical behavior.

    These variable-sized object classes are integrated as well as possible into C++. Most such classes possess converters that allow automatic coercion both from and to builtin basic types. (e.g., char* to and from String, long int to and from Integer, etc.). There are pro's and con's to circular converters, since they can sometimes lead to the conversion from a builtin type through to a class function and back to a builtin type without any special attention on the part of the programmer, both for better and worse.

    Most of these classes also provide special-case operators and functions mixing basic with class types, as a way to avoid constructors in cases where the operations do not rely on anything special about the representations. For example, there is a special case concatenation operator for a String concatenated with a char, since building the result does not rely on anything about the String header. Again, there are arguments both for and against this approach. Supporting these cases adds a non-trivial degree of (mainly inline) function proliferation, but results in more efficient operations. Efficiency wins out over parsimony here, as part of the goal to produce classes that provide sufficient functionality and efficiency so that programmers are not tempted to try to manipulate or bypass the underlying representations.

    Some guidelines for using expression-oriented classes

    The fact that C++ allows operators to be overloaded for user-defined classes can make programming with library classes like Integer, String, and so on very convenient. However, it is worth becoming familiar with some of the inherent limitations and problems associated with such operators.

    Many operators are constructive, i.e., create a new object based on some function of some arguments. Sometimes the creation of such objects is wasteful. Most library classes supporting expressions contain facilities that help you avoid such waste.

    For example, for Integer a, b, c; ...; c = a + b + a;, the plus operator is called to sum a and b, creating a new temporary object as its result. This temporary is then added with a, creating another temporary, which is finally copied into c, and the temporaries are then deleted. In other words, this code might have an effect similar to Integer a, b, c; ...; Integer t1(a); t1 += b; Integer t2(t1); t2 += a; c = t2;.

    For small objects, simple operators, and/or non-time/space critical programs, creation of temporaries is not a big problem. However, often, when fine-tuning a program, it may be a good idea to rewrite such code in a less pleasant, but more efficient manner.

    For builtin types like ints, and floats, C and C++ compilers already know how to optimize such expressions to reduce the need for temporaries. Unfortunately, this is not true for C++ user defined types, for the simple (but very annoying, in this context) reason that nothing at all is guaranteed about the semantics of overloaded operators and their interrelations. For example, if the above expression just involved ints, not Integers, a compiler might internally convert the statement into something like c += a; c += b; c+= a; , or perhaps something even more clever. But since C++ does not know that Integer operator += has any relation to Integer operator +, A C++ compiler cannot do this kind of expression optimization itself.

    In many cases, you can avoid construction of temporaries simply by using the assignment versions of operators whenever possible, since these versions create no temporaries. However, for maximum flexibility, most classes provide a set of "embedded assembly code" procedures that you can use to fully control time, space, and evaluation strategies. Most of these procedures are "three-address" procedures that take two const source arguments, and a destination argument. The procedures perform the appropriate actions, placing the results in the destination (which is may involve overwriting old contents). These procedures are designed to be fast and robust. In particular, aliasing is always handled correctly, so that, for example add(x, x, x); is perfectly OK. (The names of these procedures are listed along with the classes.)

    For example, suppose you had an Integer expression a = (b - a) * -(d / c);

    This would be compiled as if it were Integer t1=b-a; Integer t2=d/c; Integer t3=-t2; Integer t4=t1*t3; a=t4;

    But, with some manual cleverness, you might yourself some up with sub(a, b, a); mul(a, d, a); div(a, c, a);

    A related phenomenon occurs when creating your own constructive functions returning instances of such types. Suppose you wanted to write function Integer f(const Integer& a) { Integer r = a; r += a; return r; }

    This function, when called (as in a = f(a); ) demonstrates a similar kind of wasted copy. The returned value r must be copied out of the function before it can be used by the caller. In GNU C++, there is an alternative via the use of named return values. Named return values allow you to manipulate the returned object directly, rather than requiring you to create a local inside a function and then copy it out as the returned value. In this example, this can be done via Integer f(const Integer& a) return r(a) { r += a; return; }

    A final guideline: The overloaded operators are very convenient, and much clearer to use than procedural code. It is almost always a good idea to make it right, then make it fast, by translating expression code into procedural code after it is known to be correct.

    Pseudo-indexes

    Many useful classes operate as containers of elements. Techniques for accessing these elements from a container differ from class to class. In the GNU C++ library, access methods have been partially standardized across different classes via the use of pseudo-indexes called Pixes. A Pix acts in some ways like an index, and in some ways like a pointer. (Their underlying representations are just void* pointers). A Pix is a kind of "key" that is translated into an element access by the class. In virtually all cases, Pixes are pointers to some kind internal storage cells. The containers use these pointers to extract items.

    Pixes support traversal and inspection of elements in a collection using analogs of array indexing. However, they are pointer-like in that 0 is treated as an invalid Pix, and unsafe insofar as programmers can attempt to access nonexistent elements via dangling or otherwise invalid Pixes without first checking for their validity.

    In general it is a very bad idea to perform traversals in the the midst of destructive modifications to containers.

    Typical applications might include code using the idiom

    for (Pix i = a.first(); i != 0; a.next(i)) use(a(i));
    
    for some container a and function use.

    Classes supporting the use of Pixes always contain the following methods, assuming a container a of element types of Base.

    Pix i = a.first()
    Set i to index the first element of a or 0 if a is empty.

    a.next(i)
    advance i to the next element of a or 0 if there is no next element;

    Base x = a(i); a(i) = x;
    a(i) returns a reference to the element indexed by i.

    int present = a.owns(i)
    returns true if Pix i is a valid Pix in a. This is often a relatively slow operation, since the collection must usually traverse through elements to see if any correspond to the Pix.

    Some container classes also support backwards traversal via

    Pix i = a.last()
    Set i to the last element of a or 0 if a is empty.

    a.prev(i)
    sets i to the previous element in a, or 0 if there is none.

    Collections supporting elements with an equality operation possess

    Pix j = a.seek(x)
    sets j to the index of the first occurrence of x, or 0 if x is not contained in a.

    Bag classes possess

    Pix j = a.seek(x, Pix from = 0)
    sets j to the index of the next occurrence of x following i, or 0 if x is not contained in a. If i == 0, the first occurrence is returned.

    Set, Bag, and PQ classes possess

    Pix j = a.add(x) (or a.enq(x) for priority queues)
    add x to the collection, returning its Pix. The Pix of an item can change in collections where further additions and deletions involve the actual movement of elements (currently in OXPSet, OXPBag, XPPQ, VOHSet), but in all other cases, an item's Pix may be considered a permanent key to its location.

    Header files for interfacing C++ to C

    The following files are provided so that C++ programmers may invoke common C library and system calls. The names and contents of these files are subject to change in order to be compatible with the forthcoming GNU C library. Other files, not listed here, are simply C++-compatible interfaces to corresponding C library files.

    `values.h'
    A collection of constants defining the numbers of bits in builtin types, minimum and maximum values, and the like. Most names are the same as those found in `values.h' found on Sun systems.

    `std.h'
    A collection of common system calls and `libc.a' functions. Only those functions that can be declared without introducing new type definitions (socket structures, for example) are provided. Common char* functions (like strcmp) are among the declarations. All functions are declared along with their library names, so that they may be safely overloaded.

    `string.h'
    This file merely includes `<std.h>', where string function prototypes are declared. This is a workaround for the fact that system `string.h' and `strings.h' files often differ in contents.

    `osfcn.h'
    This file merely includes `<std.h>', where system function prototypes are declared.

    `libc.h'
    This file merely includes `<std.h>', where C library function prototypes are declared.

    `math.h'
    A collection of prototypes for functions usually found in libm.a, plus some #defined constants that appear to be consistent with those provided in the AT&T version. The value of HUGE should be checked before using. Declarations of all common math functions are preceded with overload declarations, since these are commonly overloaded.

    `stdio.h'
    Declaration of FILE (_iobuf), common macros (like getc), and function prototypes for `libc.a' functions that operate on FILE*'s. The value BUFSIZ and the declaration of _iobuf should be checked before using.

    `assert.h'
    C++ versions of assert macros.

    `generic.h'
    String concatenation macros useful in creating generic classes. They are similar in function to the AT&T CC versions.

    `new.h'
    Declarations of the default global operator new, the two-argument placement version, and associated error handlers.

    Utility functions for built in types

    Files `builtin.h' and corresponding `.cc' implementation files contain various convenient inline and non-inline utility functions. These include useful enumeration types, such as TRUE, FALSE ,the type definition for pointers to libg++ error handling functions, and the following functions.

    long abs(long x); double abs(double x);
    inline versions of abs. Note that the standard libc.a version, int abs(int) is not declared as inline.

    void clearbit(long& x, long b);
    clears the b'th bit of x (inline).

    void setbit(long& x, long b);
    sets the b'th bit of x (inline)

    int testbit(long x, long b);
    returns the b'th bit of x (inline).

    int even(long y);
    returns true if x is even (inline).

    int odd(long y);
    returns true is x is odd (inline).

    int sign(long x); int sign(double x);
    returns -1, 0, or 1, indicating whether x is less than, equal to, or greater than zero (inline).

    long gcd(long x, long y);
    returns the greatest common divisor of x and y.

    long lcm(long x, long y);
    returns the least common multiple of x and y.

    long lg(long x);
    returns the floor of the base 2 log of x.

    long pow(long x, long y); double pow(double x, long y);
    returns x to the integer power y using via the iterative O(log y) "Russian peasant" method.

    long sqr(long x); double sqr(double x);
    returns x squared (inline).

    long sqrt(long y);
    returns the floor of the square root of x.

    unsigned int hashpjw(const char* s);
    a hash function for null-terminated char* strings using the method described in Aho, Sethi, & Ullman, p 436.

    unsigned int multiplicativehash(int x);
    a hash function for integers that returns the lower bits of multiplying x by the golden ratio times pow(2, 32). See Knuth, Vol 3, p 508.

    unsigned int foldhash(double x);
    a hash function for doubles that exclusive-or's the first and second words of x, returning the result as an integer.

    double start_timer()
    Starts a process timer.

    double return_elapsed_time(double last_time)
    Returns the process time since last_time. If last_time == 0 returns the time since the last start_timer. Returns -1 if start_timer was not first called.

    File `Maxima.h' includes versions of MAX, MIN for builtin types.

    File `compare.h' includes versions of compare(x, y) for builtin types. These return negative if the first argument is less than the second, zero for equal, and positive for greater.

    Library dynamic allocation primitives

    Libg++ contains versions of malloc, free, realloc that were designed to be well-tuned to C++ applications. The source file `malloc.c' contains some design and implementation details. Here are the major user-visible differences from most system malloc routines:

    1. These routines overwrite storage of freed space. This means that it is never permissible to use a delete'd object in any way. Doing so will either result in trapped fatal errors or random aborts within malloc, free, or realloc.

    2. The routines tend to perform well when a large number of objects of the same size are allocated and freed. You may find that it is not worth it to create your own special allocation schemes in such cases.

    3. The library sets top-level operator new() to call malloc and operator delete() to call free. Of course, you may override these definitions in C++ programs by creating your own operators that will take precedence over the library versions. However, if you do so, be sure to define both operator new() and operator delete().

    4. These routines do not support the odd convention, maintained by some versions of malloc, that you may call realloc with a pointer that has been free'd.

    5. The routines automatically perform simple checks on free'd pointers that can often determine whether users have accidentally written beyond the boundaries of allocated space, resulting in a fatal error.

    6. The function malloc_usable_size(void* p) returns the number of bytes actually allocated for p. For a valid pointer (i.e., one that has been malloc'd or realloc'd but not yet free'd) this will return a number greater than or equal to the requested size, else it will normally return 0. Unfortunately, a non-zero return can not be an absolutely perfect indication of lack of error. If a chunk has been free'd but then re-allocated for a different purpose somewhere elsewhere, then malloc_usable_size will return non-zero. Despite this, the function can be very valuable for performing run-time consistency checks.

    7. malloc requires 8 bytes of overhead per allocated chunk, plus a mmaximum alignment adjustment of 8 bytes. The number of bytes of usable space is exactly as requested, rounded to the nearest 8 byte boundary.

    8. The routines do not contain any synchronization support for multiprocessing. If you perform global allocation on a shared memory multiprocessor, you should disable compilation and use of libg++ malloc in the distribution `Makefile' and use your system version of malloc.

    The new input/output classes

    The iostream classes implement most of the features of AT&T version 2.0 iostream library classes, and most of the features of the ANSI X3J16 library draft (which is based on the AT&T design). These classes are available in libg++ for convenience and for compatibility with older releases; however, since the iostream classes are licensed under less stringent terms than libg++, they are now also available in a separate library called libio---and documented in a separate manual, corresponding to that library.

    See section 'Introduction' in The GNU C++ Iostream Library.

    The old I/O library

    WARNING: This chapter describes classes that are obsolete. These classes are normally not available when libg++ is installed normally. The sources are currently included in the distribution, and you can configure libg++ to use these classes instead of the new iostream classes. This is only a temporary measure; you should convert your code to use iostreams as soon as possible. The iostream classes provide some compatibility support, but it is very incomplete (there is no longer a File class).

    File-based classes

    The File class supports basic IO on Unix files. Operations are based on common C stdio library functions.

    File serves as the base class for istreams, ostreams, and other derived classes. It contains the interface between the Unix stdio file library and these more structured classes. Most operations are implemented as simple calls to stdio functions. File class operations are also fully compatible with raw system file reads and writes (like the system read and lseek calls) when buffering is disabled (see below). The FILE* stdio file pointer is, however maintained as protected. Classes derived from File may only use the IO operations provided by File, which encompass essentially all stdio capabilities.

    The class contains four general kinds of functions: methods for binding Files to physical Unix files, basic IO methods, file and buffer control methods, and methods for maintaining logical and physical file status.

    Binding and related tasks are accomplished via File constructors and destructors, and member functions open, close, remove, filedesc, name, setname.

    If a file name is provided in a constructor or open, it is maintained as class variable nm and is accessible via name. If no name is provided, then nm remains null, except that Files bound to the default files stdin, stdout, and stderr are automatically given the names (stdin), (stdout), (stderr) respectively. The function setname may be used to change the internal name of the File. This does not change the name of the physical file bound to the File. The member function close closes a file. The ~File destructor closes a file if it is open, except that stdin, stdout, and stderr are flushed but left open for the system to close on program exit since some systems may require this, and on others it does not matter. remove closes the file, and then deletes it if possible by calling the system function to delete the file with the name provided in the nm field.

    Basic IO

    • read and write perform binary IO via stdio fread and fwrite.

    • get and put for chars invoke stdio getc and putc macros.

    • put(const char* s) outputs a null-terminated string via stdio fputs.

    • unget and putback are synonyms. Both call stdio ungetc.

    File Control

    flush, seek, tell, and tell call the corresponding stdio functions.

    flush(char) and fill() call stdio _flsbuf and _filbuf respectively.

    setbuf is mainly useful to turn off buffering in cases where nonsequential binary IO is being performed. raw is a synonym for setbuf(_IONBF). After a f.raw(), using the stdio functions instead of the system read, write, etc., calls entails very little overhead. Moreover, these become fully compatible with intermixed system calls (e.g., lseek(f.filedesc(), 0, 0)). While intermixing File and system IO calls is not at all recommended, this technique does allow the File class to be used in conjunction with other functions and libraries already set up to operate on file descriptors. setbuf should be called at most once after a constructor or open, but before any IO.

    File Status

    File status is maintained in several ways.

    A File may be checked for accessibility via is_open(), which returns true if the File is bound to a usable physical file, readable(), which returns true if the File can be read from (opened for reading, and not in a _fail state), or writable(), which returns true if the File can be written to.

    File operations return their status via two means: failure and success are represented via the logical state. Also, the return values of invoked stdio and system functions that return useful numeric values (not just failure/success flags) are held in a class variable accessible via iocount. (This is useful, for example, in determining the number of items actually read by the read function.)

    Like the AT&T i/o-stream classes, but unlike the description in the Stroustrup book, p238, rdstate() returns the bitwise OR of _eof, _fail and _bad, not necessarily distinct values. The functions eof(), fail(), bad(), and good() can be used to test for each of these conditions independently.

    _fail becomes set for any input operation that could not read in the desired data, and for other failed operations. As with all Unix IO, _eof becomes true only when an input operations fails because of an end of file. Therefore, _eof is not immediately true after the last successful read of a file, but only after one final read attempt. Thus, for input operations, _fail and _eof almost always become true at the same time. bad is set for unbound files, and may also be set by applications in order to communicate input corruption. Conversely, _good is defined as 0 and is returned by rdstate() if all is well.

    The state may be modified via clear(flag), which, despite its name, sets the corresponding state_value flag. clear() with no arguments resets the state to _good. failif(int cond) sets the state to _fail only if cond is true.

    Errors occuring during constructors and file opens also invoke the function error. error in turn calls a resetable error handling function pointed to by the non-member global variable File_error_handler only if a system error has been generated. Since error cannot tell if the current system error is actually responsible for a failure, it may at times print out spurious messages. Three error handlers are provided. The default, verbose_File_error_handler calls the system function perror to print the corresponding error message on standard error, and then returns to the caller. quiet_File_error_handler does nothing, and simply returns. fatal_File_error_handler prints the error and then aborts execution. These three handlers, or any other user-defined error handlers can be selected via the non-member function set_File_error_handler.

    All read and write operations communicate either logical or physical failure by setting the _fail flag. All further operations are blocked if the state is in a _fail or_bad condition. Programmers must explicitly use clear() to reset the state in order to continue IO processing after either a logical or physical failure. C programmers who are unfamiliar with these conventions should note that, unlike the stdio library, File functions indicate IO success, status, or failure solely through the state, not via return values of the functions. The void* operator or rdstate() may be used to test success. In particular, according to c++ conversion rules, the void* coercion is automatically applied whenever the File& return value of any File function is tested in an if or while. Thus, for example, an easy way to copy all of stdin to stdout until eof (at which point get fails) or some error is char c; while(cin.get(c) && cout.put(c));.

    The current version of istreams and ostreams differs significantly from previous versions in order to obtain compatibility with AT&T 1.2 streams. Most code using previous versions should still work. However, the following features of File are not incorporated in streams (they are still present in File): scan(const char* fmt...), remove(), read(), write(), setbuf(), raw(). Additionally, the feature of previous streams that allowed free intermixing of stream and stdio input and output is no longer guaranteed to always behave as desired.

    The Obstack class

    The Obstack class is a simple rewrite of the C obstack macros and functions provided in the GNU CC compiler source distribution.

    Obstacks provide a simple method of creating and maintaining a string table, optimized for the very frequent task of building strings character-by-character, and sometimes keeping them, and sometimes not. They seem especially useful in any parsing application. One of the test files demonstrates usage.

    A brief summary:

    grow
    places something on the obstack without committing to wrap it up as a single entity yet.

    finish
    wraps up a constructed object as a single entity, and returns the pointer to its start address.

    copy
    places things on the obstack, and does wrap them up. copy is always equivalent to first grow, then finish.

    free
    deletes something, and anything else put on the obstack since its creation.

    The other functions are less commonly needed:

    blank
    is like grow, except it just grows the space by size units without placing anything into this space
    alloc
    is like blank, but it wraps up the object and returns its starting address.
    chunk_size, base, next_free, alignment_mask, size, room
    returns the appropriate class variables.
    grow_fast
    places a character on the obstack without checking if there is enough room.
    blank_fast
    like blank, but without checking if there is enough room.
    shrink(int n)
    shrink the current chunk by n bytes.
    contains(void* addr)
    returns true if the Obstack holds the address addr.

    Here is a lightly edited version of the original C documentation:

    These functions operate a stack of objects. Each object starts life small, and may grow to maturity. (Consider building a word syllable by syllable.) An object can move while it is growing. Once it has been "finished" it never changes address again. So the "top of the stack" is typically an immature growing object, while the rest of the stack is of mature, fixed size and fixed address objects.

    These routines grab large chunks of memory, using the GNU C++ new operator. On occasion, they free chunks, via delete.

    Each independent stack is represented by a Obstack.

    One motivation for this package is the problem of growing char strings in symbol tables. Unless you are a "fascist pig with a read-only mind" [Gosper's immortal quote from HAKMEM item 154, out of context] you would not like to put any arbitrary upper limit on the length of your symbols.

    In practice this often means you will build many short symbols and a few long symbols. At the time you are reading a symbol you don't know how long it is. One traditional method is to read a symbol into a buffer, realloc()ating the buffer every time you try to read a symbol that is longer than the buffer. This is beaut, but you still will want to copy the symbol from the buffer to a more permanent symbol-table entry say about half the time.

    With obstacks, you can work differently. Use one obstack for all symbol names. As you read a symbol, grow the name in the obstack gradually. When the name is complete, finalize it. Then, if the symbol exists already, free the newly read name.

    The way we do this is to take a large chunk, allocating memory from low addresses. When you want to build a symbol in the chunk you just add chars above the current "high water mark" in the chunk. When you have finished adding chars, because you got to the end of the symbol, you know how long the chars are, and you can create a new object. Mostly the chars will not burst over the highest address of the chunk, because you would typically expect a chunk to be (say) 100 times as long as an average object.

    In case that isn't clear, when we have enough chars to make up the object, they are already contiguous in the chunk (guaranteed) so we just point to it where it lies. No moving of chars is needed and this is the second win: potentially long strings need never be explicitly shuffled. Once an object is formed, it does not change its address during its lifetime.

    When the chars burst over a chunk boundary, we allocate a larger chunk, and then copy the partly formed object from the end of the old chunk to the beginning of the new larger chunk. We then carry on accreting characters to the end of the object as we normally would.

    A special version of grow is provided to add a single char at a time to a growing object.

    Summary:

    • We allocate large chunks.
    • We carve out one object at a time from the current chunk.
    • Once carved, an object never moves.
    • We are free to append data of any size to the currently growing object.
    • Exactly one object is growing in an obstack at any one time.
    • You can run one obstack per control block.
    • You may have as many control blocks as you dare.
    • Because of the way we do it, you can `unwind' a obstack back to a previous state. (You may remove objects much as you would with a stack.)

    The obstack data structure is used in many places in the GNU C++ compiler.

    Differences from the the GNU C version

    1. The obvious differences stemming from the use of classes and inline functions instead of structs and macros. The C init and begin macros are replaced by constructors.

    2. Overloaded function names are used for grow (and others), rather than the C grow, grow0, etc.

    3. All dynamic allocation uses the the built-in new operator. This restricts flexibility by a little, but maintains compatibility with usual C++ conventions.

    4. There are now two versions of finish:

      1. finish() behaves like the C version.

      2. finish(char terminator) adds terminator, and then calls finish(). This enables the normal invocation of finish(0) to wrap up a string being grown character-by-character.

    5. There are special versions of grow(const char* s) and copy(const char* s) that add the null-terminated string s after computing its length.

    6. The shrink and contains functions are provided.

    The AllocRing class

    An AllocRing is a bounded ring (circular list), each of whose elements contains a pointer to some space allocated via new char[some_size]. The entries are used cyclicly. The size, n, of the ring is fixed at construction. After that, every nth use of the ring will reuse (or reallocate) the same space. AllocRings are needed in order to temporarily hold chunks of space that are needed transiently, but across constructor-destructor scopes. They mainly useful for storing strings containing formatted characters to print across various functions and coercions. These strings are needed across routines, so may not be deleted in any one of them, but should be recovered at some point. In other words, an AllocRing is an extremely simple minded garbage collection mechanism. The GNU C++ library used to use one AllocRing for such formatting purposes, but it is being phased out, and is now only used by obsolete functions. These days, AllocRings are probably not very useful.

    Support includes:

    AllocRing a(int n)
    constructs an Alloc ring with n entries, all null.

    void* mem = a.alloc(sz)
    moves the ring pointer to the next entry, and reuses the space if their is enough, also allocates space via new char[sz].

    int present = a.contains(void* ptr)
    returns true if ptr is held in one of the ring entries.

    a.clear()
    deletes all space pointed to in any entry. This is called automatically upon destruction.

    a.free(void* ptr)
    If ptr is one of the entries, calls delete of the pointer, and resets to entry pointer to null.

    The String class

    The String class is designed to extend GNU C++ to support string processing capabilities similar to those in languages like Awk. The class provides facilities that ought to be convenient and efficient enough to be useful replacements for char* based processing via the C string library (i.e., strcpy, strcmp, etc.) in many applications. Many details about String representations are described in the Representation section.

    A separate SubString class supports substring extraction and modification operations. This is implemented in a way that user programs never directly construct or represent substrings, which are only used indirectly via String operations.

    Another separate class, Regex is also used indirectly via String operations in support of regular expression searching, matching, and the like. The Regex class is based entirely on the GNU Emacs regex functions. See section 'Syntax of Regular Expressions' in GNU Emacs Manual, for a full explanation of regular expression syntax. (For implementation details, see the internal documentation in files `regex.h' and `regex.c'.)

    Constructors

    Strings are initialized and assigned as in the following examples:

    String x; String y = 0; String z = "";
    Set x, y, and z to the nil string. Note that either 0 or "" may always be used to refer to the nil string.

    String x = "Hello"; String y("Hello");
    Set x and y to a copy of the string "Hello".

    String x = 'A'; String y('A');
    Set x and y to the string value "A"

    String u = x; String v(x);
    Set u and v to the same string as String x

    String u = x.at(1,4); String v(x.at(1,4));
    Set u and v to the length 4 substring of x starting at position 1 (counting indexes from 0).

    String x("abc", 2);
    Sets x to "ab", i.e., the first 2 characters of "abc".

    String x = dec(20);
    Sets x to "20". As here, Strings may be initialized or assigned the results of any char* function.

    There are no directly accessible forms for declaring SubString variables.

    The declaration Regex r("[a-zA-Z_][a-zA-Z0-9_]*"); creates a compiled regular expression suitable for use in String operations described below. (In this case, one that matches any C++ identifier). The first argument may also be a String. Be careful in distinguishing the role of backslashes in quoted GNU C++ char* constants versus those in Regexes. For example, a Regex that matches either one or more tabs or all strings beginning with "ba" and ending with any number of occurrences of "na" could be declared as Regex r = "\\(\t+\\)\\|\\(ba\\(na\\)*\\)" Note that only one backslash is needed to signify the tab, but two are needed for the parenthesization and virgule, since the GNU C++ lexical analyzer decodes and strips backslashes before they are seen by Regex.

    There are three additional optional arguments to the Regex constructor that are less commonly useful:

    fast (default 0)
    fast may be set to true (1) if the Regex should be "fast-compiled". This causes an additional compilation step that is generally worthwhile if the Regex will be used many times.

    bufsize (default max(40, length of the string))
    This is an estimate of the size of the internal compiled expression. Set it to a larger value if you know that the expression will require a lot of space. If you do not know, do not worry: realloc is used if necessary.

    transtable (default none == 0)
    The address of a byte translation table (a char[256]) that translates each character before matching.

    As a convenience, several Regexes are predefined and usable in any program. Here are their declarations from `String.h'.

    extern Regex RXwhite;      // = "[ \n\t]+"
    extern Regex RXint;        // = "-?[0-9]+"
    extern Regex RXdouble;     // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
                               //    \\([0-9]+\\)\\|
                               //    \\(\\.[0-9]+\\)\\)
                               //    \\([eE][---+]?[0-9]+\\)?"
    extern Regex RXalpha;      // = "[A-Za-z]+"
    extern Regex RXlowercase;  // = "[a-z]+"
    extern Regex RXuppercase;  // = "[A-Z]+"
    extern Regex RXalphanum;   // = "[0-9A-Za-z]+"
    extern Regex RXidentifier; // = "[A-Za-z_][A-Za-z0-9_]*"
    
    

    Examples

    Most String class capabilities are best shown via example. The examples below use the following declarations.

        String x = "Hello";
        String y = "world";
        String n = "123";
        String z;
        char*  s = ",";
        String lft, mid, rgt;
        Regex  r = "e[a-z]*o";
        Regex  r2("/[a-z]*/");
        char   c;
        int    i, pos, len;
        double f;
        String words[10];
        words[0] = "a";
        words[1] = "b";
        words[2] = "c";
        
    

    Comparing, Searching and Matching

    The usual lexicographic relational operators (==, !=, <, <=, >, >=) are defined. A functional form compare(String, String) is also provided, as is fcompare(String, String), which compares Strings without regard for upper vs. lower case.

    All other matching and searching operations are based on some form of the (non-public) match and search functions. match and search differ in that match attempts to match only at the given starting position, while search starts at the position, and then proceeds left or right looking for a match. As seen in the following examples, the second optional startpos argument to functions using match and search specifies the starting position of the search: If non-negative, it results in a left-to-right search starting at position startpos, and if negative, a right-to-left search starting at position x.length() + startpos. In all cases, the index returned is that of the beginning of the match, or -1 if there is no match.

    Three String functions serve as front ends to search and match. index performs a search, returning the index, matches performs a match, returning nonzero (actually, the length of the match) on success, and contains is a boolean function performing either a search or match, depending on whether an index argument is provided:

    x.index("lo")
    returns the zero-based index of the leftmost occurrence of substring "lo" (3, in this case). The argument may be a String, SubString, char, char*, or Regex.

    x.index("l", 2)
    returns the index of the first of the leftmost occurrence of "l" found starting the search at position x[2], or 2 in this case.

    x.index("l", -1)
    returns the index of the rightmost occurrence of "l", or 3 here.

    x.index("l", -3)
    returns the index of the rightmost occurrence of "l" found by starting the search at the 3rd to the last position of x, returning 2 in this case.

    pos = r.search("leo", 3, len, 0)
    returns the index of r in the char* string of length 3, starting at position 0, also placing the length of the match in reference parameter len.

    x.contains("He")
    returns nonzero if the String x contains the substring "He". The argument may be a String, SubString, char, char*, or Regex.

    x.contains("el", 1)
    returns nonzero if x contains the substring "el" at position 1. As in this example, the second argument to contains, if present, means to match the substring only at that position, and not to search elsewhere in the string.

    x.contains(RXwhite);
    returns nonzero if x contains any whitespace (space, tab, or newline). Recall that RXwhite is a global whitespace Regex.

    x.matches("lo", 3)
    returns nonzero if x starting at position 3 exactly matches "lo", with no trailing characters (as it does in this example).

    x.matches(r)
    returns nonzero if String x as a whole matches Regex r.

    int f = x.freq("l")
    returns the number of distinct, nonoverlapping matches to the argument (2 in this case).

    Substring extraction

    Substrings may be extracted via the at, before, through, from, and after functions. These behave as either lvalues or rvalues.

    z = x.at(2, 3)
    sets String z to be equal to the length 3 substring of String x starting at zero-based position 2, setting z to "llo" in this case. A nil String is returned if the arguments don't make sense.

    x.at(2, 2) = "r"
    Sets what was in positions 2 to 3 of x to "r", setting x to "Hero" in this case. As indicated here, SubString assignments may be of different lengths.

    x.at("He") = "je";
    x("He") is the substring of x that matches the first occurrence of it's argument. The substitution sets x to "jello". If "He" did not occur, the substring would be nil, and the assignment would have no effect.

    x.at("l", -1) = "i";
    replaces the rightmost occurrence of "l" with "i", setting x to "Helio".

    z = x.at(r)
    sets String z to the first match in x of Regex r, or "ello" in this case. A nil String is returned if there is no match.

    z = x.before("o")
    sets z to the part of x to the left of the first occurrence of "o", or "Hell" in this case. The argument may also be a String, SubString, or Regex. (If there is no match, z is set to "".)

    x.before("ll") = "Bri";
    sets the part of x to the left of "ll" to "Bri", setting x to "Brillo".

    z = x.before(2)
    sets z to the part of x to the left of x[2], or "He" in this case.

    z = x.after("Hel")
    sets z to the part of x to the right of "Hel", or "lo" in this case.

    z = x.through("el")
    sets z to the part of x up and including "el", or "Hel" in this case.

    z = x.from("el")
    sets z to the part of x from "el" to the end, or "ello" in this case.

    x.after("Hel") = "p";
    sets x to "Help";

    z = x.after(3)
    sets z to the part of x to the right of x[3] or "o" in this case.

    z = " ab c"; z = z.after(RXwhite)
    sets z to the part of its old string to the right of the first group of whitespace, setting z to "ab c"; Use gsub(below) to strip out multiple occurrences of whitespace or any pattern.

    x[0] = 'J';
    sets the first element of x to 'J'. x[i] returns a reference to the ith element of x, or triggers an error if i is out of range.

    common_prefix(x, "Help")
    returns the String containing the common prefix of the two Strings or "Hel" in this case.

    common_suffix(x, "to")
    returns the String containing the common suffix of the two Strings or "o" in this case.

    Concatenation

    z = x + s + ' ' + y.at("w") + y.after("w") + ".";
    sets z to "Hello, world."

    x += y;
    sets x to "Helloworld"

    cat(x, y, z)
    A faster way to say z = x + y.

    cat(z, y, x, x)
    Double concatenation; A faster way to say x = z + y + x.

    y.prepend(x);
    A faster way to say y = x + y.

    z = replicate(x, 3);
    sets z to "HelloHelloHello".

    z = join(words, 3, "/")
    sets z to the concatenation of the first 3 Strings in String array words, each separated by "/", setting z to "a/b/c" in this case. The last argument may be "" or 0, indicating no separation.

    Other manipulations

    z = "this string has five words"; i = split(z, words, 10, RXwhite);
    sets up to 10 elements of String array words to the parts of z separated by whitespace, and returns the number of parts actually encountered (5 in this case). Here, words[0] = "this", words[1] = "string", etc. The last argument may be any of the usual. If there is no match, all of z ends up in words[0]. The words array is not dynamically created by split.

    int nmatches x.gsub("l","ll")
    substitutes all original occurrences of "l" with "ll", setting x to "Hellllo". The first argument may be any of the usual, including Regex. If the second argument is "" or 0, all occurrences are deleted. gsub returns the number of matches that were replaced.

    z = x + y; z.del("loworl");
    deletes the leftmost occurrence of "loworl" in z, setting z to "Held".

    z = reverse(x)
    sets z to the reverse of x, or "olleH".

    z = upcase(x)
    sets z to x, with all letters set to uppercase, setting z to "HELLO"

    z = downcase(x)
    sets z to x, with all letters set to lowercase, setting z to "hello"

    z = capitalize(x)
    sets z to x, with the first letter of each word set to uppercase, and all others to lowercase, setting z to "Hello"

    x.reverse(), x.upcase(), x.downcase(), x.capitalize()
    in-place, self-modifying versions of the above.

    Reading, Writing and Conversion

    cout << x
    writes out x.

    cout << x.at(2, 3)
    writes out the substring "llo".

    cin >> x
    reads a whitespace-bounded string into x.

    x.length()
    returns the length of String x (5, in this case).

    s = (const char*)x
    can be used to extract the char* char array. This coercion is useful for sending a String as an argument to any function expecting a const char* argument (like atoi, and File::open). This operator must be used with care, since the conversion returns a pointer to String internals without copying the characters: The resulting (char*) is only valid until the next String operation, and you must not modify it. (The conversion is defined to return a const value so that GNU C++ will produce warning and/or error messages if changes are attempted.)

    The Integer class.

    The Integer class provides multiple precision integer arithmetic facilities. Some representation details are discussed in the Representation section.

    Integers may be up to b * ((1 << b) - 1) bits long, where b is the number of bits per short (typically 1048560 bits when b = 16). The implementation assumes that a long is at least twice as long as a short. This assumption hides beneath almost all primitive operations, and would be very difficult to change. It also relies on correct behavior of unsigned arithmetic operations.

    Some of the arithmetic algorithms are very loosely based on those provided in the MIT Scheme `bignum.c' release, which is Copyright (c) 1987 Massachusetts Institute of Technology. Their use here falls within the provisions described in the Scheme release.

    Integers may be constructed in the following ways:

    Integer x;
    Declares an uninitialized Integer.

    Integer x = 2; Integer y(2);
    Set x and y to the Integer value 2;

    Integer u(x); Integer v = x;
    Set u and v to the same value as x.

    Method: long Integer::as_long() const

    Used to coerce an Integer back into longs via the long coercion operator. If the Integer cannot fit into a long, this returns MINLONG or MAXLONG (depending on the sign) where MINLONG is the most negative, and MAXLONG is the most positive representable long.

    Method: int Integer::fits_in_long() const

    Returns true iff the Integer is < MAXLONG and > MINLONG.

    Method: double Integer::as_double() const

    Coerce the Integer to a double, with potential loss of precision. +/-HUGE is returned if the Integer cannot fit into a double.

    Method: int Integer::fits_in_double() const

    Returns true iff the Integer can fit into a double.

    All of the usual arithmetic operators are provided (+, -, *, /, %, +=, ++, -=, --, *=, /=, %=, ==, !=, <, <=, >, >=). All operators support special versions for mixed arguments of Integers and regular C++ longs in order to avoid useless coercions, as well as to allow automatic promotion of shorts and ints to longs, so that they may be applied without additional Integer coercion operators. The only operators that behave differently than the corresponding int or long operators are ++ and --. Because C++ does not distinguish prefix from postfix application, these are declared as void operators, so that no confusion can result from applying them as postfix. Thus, for Integers x and y, ++x; y = x; is correct, but y = ++x; and y = x++; are not.

    Bitwise operators (~, &, |, ^, <<, >>, &=, |=, ^=, <<=, >>=) are also provided. However, these operate on sign-magnitude, rather than two's complement representations. The sign of the result is arbitrarily taken as the sign of the first argument. For example, Integer(-3) & Integer(5) returns Integer(-1), not -3, as it would using two's complement. Also, ~, the complement operator, complements only those bits needed for the representation. Bit operators are also provided in the BitSet and BitString classes. One of these classes should be used instead of Integers when the results of bit manipulations are not interpreted numerically.

    The following utility functions are also provided. (All arguments are Integers unless otherwise noted).

    Function: void divide(const Integer& x, const Integer& y, Integer& q, Integer& r)

    Sets q to the quotient and r to the remainder of x and y. (q and r are returned by reference).

    Function: Integer pow(const Integer& x, const Integer& p)

    Returns x raised to the power p.

    Function: Integer Ipow(long x, long p)

    Returns x raised to the power p.

    Function: Integer gcd(const Integer& x, const Integer& p)

    Returns the greatest common divisor of x and y.

    Function: Integer lcm(const Integer& x, const Integer& p)

    Returns the least common multiple of x and y.

    Function: Integer abs(const Integer& x

    Returns the absolute value of x.

    Method: void Integer::negate()

    Negates this in place.

    Integer sqr(x)
    returns x * x;

    Integer sqrt(x)
    returns the floor of the square root of x.

    long lg(x);
    returns the floor of the base 2 logarithm of abs(x)

    int sign(x)
    returns -1 if x is negative, 0 if zero, else +1. Using if (sign(x) == 0) is a generally faster method of testing for zero than using relational operators.

    int even(x)
    returns true if x is an even number

    int odd(x)
    returns true if x is an odd number.

    void setbit(Integer& x, long b)
    sets the b'th bit (counting right-to-left from zero) of x to 1.

    void clearbit(Integer& x, long b)
    sets the b'th bit of x to 0.

    int testbit(Integer x, long b)
    returns true if the b'th bit of x is 1.

    Integer atoI(char* asciinumber, int base = 10);
    converts the base base char* string into its Integer form.

    void Integer::printon(ostream& s, int base = 10, int width = 0);
    prints the ascii string value of (*this) as a base base number, in field width at least width.

    ostream << x;
    prints x in base ten format.

    istream >> x;
    reads x as a base ten number.

    int compare(Integer x, Integer y)
    returns a negative number if x<y, zero if x==y, or positive if x>y.

    int ucompare(Integer x, Integer y)
    like compare, but performs unsigned comparison.

    add(x, y, z)
    A faster way to say z = x + y.

    sub(x, y, z)
    A faster way to say z = x - y.

    mul(x, y, z)
    A faster way to say z = x * y.

    div(x, y, z)
    A faster way to say z = x / y.

    mod(x, y, z)
    A faster way to say z = x % y.

    and(x, y, z)
    A faster way to say z = x & y.

    or(x, y, z)
    A faster way to say z = x | y.

    xor(x, y, z)
    A faster way to say z = x ^ y.

    lshift(x, y, z)
    A faster way to say z = x << y.

    rshift(x, y, z)
    A faster way to say z = x >> y.

    pow(x, y, z)
    A faster way to say z = pow(x, y).

    complement(x, z)
    A faster way to say z = ~x.

    negate(x, z)
    A faster way to say z = -x.

    The Rational Class

    Class Rational provides multiple precision rational number arithmetic. All rationals are maintained in simplest form (i.e., with the numerator and denominator relatively prime, and with the denominator strictly positive). Rational arithmetic and relational operators are provided (+, -, *, /, +=, -=, *=, /=, ==, !=, <, <=, >, >=). Operations resulting in a rational number with zero denominator trigger an exception.

    Rationals may be constructed and used in the following ways:

    Rational x;
    Declares an uninitialized Rational.

    Rational x = 2; Rational y(2);
    Set x and y to the Rational value 2/1;

    Rational x(2, 3);
    Sets x to the Rational value 2/3;

    Rational x = 1.2;
    Sets x to a Rational value close to 1.2. Any double precision value may be used to construct a Rational. The Rational will possess exactly as much precision as the double. Double values that do not have precise floating point equivalents (like 1.2) produce similarly imprecise rational values.

    Rational x(Integer(123), Integer(4567));
    Sets x to the Rational value 123/4567.

    Rational u(x); Rational v = x;
    Set u and v to the same value as x.

    double(Rational x)
    A Rational may be coerced to a double with potential loss of precision. +/-HUGE is returned if it will not fit.

    Rational abs(x)
    returns the absolute value of x.

    void x.negate()
    negates x.

    void x.invert()
    sets x to 1/x.

    int sign(x)
    returns 0 if x is zero, 1 if positive, and -1 if negative.

    Rational sqr(x)
    returns x * x.

    Rational pow(x, Integer y)
    returns x to the y power.

    Integer x.numerator()
    returns the numerator.

    Integer x.denominator()
    returns the denominator.

    Integer floor(x)
    returns the greatest Integer less than x.

    Integer ceil(x)
    returns the least Integer greater than x.

    Integer trunc(x)
    returns the Integer part of x.

    Integer round(x)
    returns the nearest Integer to x.

    int compare(x, y)
    returns a negative, zero, or positive number signifying whether x is less than, equal to, or greater than y.

    ostream << x;
    prints x in the form num/den, or just num if the denominator is one.

    istream >> x;
    reads x in the form num/den, or just num in which case the denominator is set to one.

    add(x, y, z)
    A faster way to say z = x + y.

    sub(x, y, z)
    A faster way to say z = x - y.

    mul(x, y, z)
    A faster way to say z = x * y.

    div(x, y, z)
    A faster way to say z = x / y.

    pow(x, y, z)
    A faster way to say z = pow(x, y).

    negate(x, z)
    A faster way to say z = -x.

    The Complex class.

    Class Complex is implemented in a way similar to that described by Stroustrup. In keeping with libg++ conventions, the class is named Complex, not complex. Complex arithmetic and relational operators are provided (+, -, *, /, +=, -=, *=, /=, ==, !=). Attempted division by (0, 0) triggers an exception.

    Complex numbers may be constructed and used in the following ways:

    Complex x;
    Declares an uninitialized Complex.

    Complex x = 2; Complex y(2.0);
    Set x and y to the Complex value (2.0, 0.0);

    Complex x(2, 3);
    Sets x to the Complex value (2, 3);

    Complex u(x); Complex v = x;
    Set u and v to the same value as x.

    double real(Complex& x);
    returns the real part of x.

    double imag(Complex& x);
    returns the imaginary part of x.

    double abs(Complex& x);
    returns the magnitude of x.

    double norm(Complex& x);
    returns the square of the magnitude of x.

    double arg(Complex& x);
    returns the argument (amplitude) of x.

    Complex polar(double r, double t = 0.0);
    returns a Complex with abs of r and arg of t.

    Complex conj(Complex& x);
    returns the complex conjugate of x.

    Complex cos(Complex& x);
    returns the complex cosine of x.

    Complex sin(Complex& x);
    returns the complex sine of x.

    Complex cosh(Complex& x);
    returns the complex hyperbolic cosine of x.

    Complex sinh(Complex& x);
    returns the complex hyperbolic sine of x.

    Complex exp(Complex& x);
    returns the exponential of x.

    Complex log(Complex& x);
    returns the natural log of x.

    Complex pow(Complex& x, long p);
    returns x raised to the p power.

    Complex pow(Complex& x, Complex& p);
    returns x raised to the p power.

    Complex sqrt(Complex& x);
    returns the square root of x.

    ostream << x;
    prints x in the form (re, im).

    istream >> x;
    reads x in the form (re, im), or just (re) or re in which case the imaginary part is set to zero.

    Fixed precision numbers

    Classes Fix16, Fix24, Fix32, and Fix48 support operations on 16, 24, 32, or 48 bit quantities that are considered as real numbers in the range [-1, +1). Such numbers are often encountered in digital signal processing applications. The classes may be be used in isolation or together. Class Fix32 operations are entirely self-contained. Class Fix16 operations are self-contained except that the multiplication operation Fix16 * Fix16 returns a Fix32. Fix24 and Fix48 are similarly related.

    The standard arithmetic and relational operations are supported (=, +, -, *, /, <<, >>, +=, -=, *=, /=, <<=, >>=, ==, !=, <, <=, >, >=). All operations include provisions for special handling in cases where the result exceeds +/- 1.0. There are two cases that may be handled separately: "overflow" where the results of addition and subtraction operations go out of range, and all other "range errors" in which resulting values go off-scale (as with division operations, and assignment or initialization with off-scale values). In signal processing applications, it is often useful to handle these two cases differently. Handlers take one argument, a reference to the integer mantissa of the offending value, which may then be manipulated. In cases of overflow, this value is the result of the (integer) arithmetic computation on the mantissa; in others it is a fully saturated (i.e., most positive or most negative) value. Handling may be reset to any of several provided functions or any other user-defined function via set_overflow_handler and set_range_error_handler. The provided functions for Fix16 are as follows (corresponding functions are also supported for the others).

    Fix16_overflow_saturate
    The default overflow handler. Results are "saturated": positive results are set to the largest representable value (binary 0.111111...), and negative values to -1.0.

    Fix16_ignore
    Performs no action. For overflow, this will allow addition and subtraction operations to "wrap around" in the same manner as integer arithmetic, and for saturation, will leave values saturated.

    Fix16_overflow_warning_saturate
    Prints a warning message on standard error, then saturates the results.

    Fix16_warning
    The default range_error handler. Prints a warning message on standard error; otherwise leaving the argument unmodified.

    Fix16_abort
    prints an error message on standard error, then aborts execution.

    In addition to arithmetic operations, the following are provided:

    Fix16 a = 0.5;
    Constructs fixed precision objects from double precision values. Attempting to initialize to a value outside the range invokes the range_error handler, except, as a convenience, initialization to 1.0 sets the variable to the most positive representable value (binary 0.1111111...) without invoking the handler.

    short& mantissa(a); long& mantissa(b);
    return a * pow(2, 15) or b * pow(2, 31) as an integer. These are returned by reference, to enable "manual" data manipulation.

    double value(a); double value(b);
    return a or b as floating point numbers.

    Classes for Bit manipulation

    libg++ provides several different classes supporting the use and manipulation of collections of bits in different ways.

    • Class Integer provides "integer" semantics. It supports manipulation of bits in ways that are often useful when treating bit arrays as numerical (integer) quantities. This class is described elsewhere.

    • Class BitSet provides "set" semantics. It supports operations useful when treating collections of bits as representing potentially infinite sets of integers.

    • Class BitSet32 supports fixed-length BitSets holding exactly 32 bits.

    • Class BitSet256 supports fixed-length BitSets holding exactly 256 bits.

    • Class BitString provides "string" (or "vector") semantics. It supports operations useful when treating collections of bits as strings of zeros and ones.

    These classes also differ in the following ways:

    • BitSets are logically infinite. Their space is dynamically altered to adjust to the smallest number of consecutive bits actually required to represent the sets. Integers also have this property. BitStrings are logically finite, but their sizes are internally dynamically managed to maintain proper length. This means that, for example, BitStrings are concatenatable while BitSets and Integers are not.

    • BitSet32 and BitSet256 have precisely the same properties as BitSets, except that they use constant fixed length bit vectors.

    • While all classes support basic unary and binary operations ~, &, |, ^, -, the semantics differ. BitSets perform bit operations that precisely mirror those for infinite sets. For example, complementing an empty BitSet returns one representing an infinite number of set bits. Operations on BitStrings and Integers operate only on those bits actually present in the representation. For BitStrings and Integers, the the & operation returns a BitString with a length equal to the minimum length of the operands, and |, ^ return one with length of the maximum.

    • Only BitStrings support substring extraction and bit pattern matching.

    BitSet

    BitSets are objects that contain logically infinite sets of nonnegative integers. Representational details are discussed in the Representation chapter. Because they are logically infinite, all BitSets possess a trailing, infinitely replicated 0 or 1 bit, called the "virtual bit", and indicated via 0* or 1*.

    BitSet32 and BitSet256 have they same properties, except they are of fixed length, and thus have no virtual bit.

    BitSets may be constructed as follows:

    BitSet a;
    declares an empty BitSet.

    BitSet a = atoBitSet("001000");
    sets a to the BitSet 0010*, reading left-to-right. The "0*" indicates that the set ends with an infinite number of zero (clear) bits.

    BitSet a = atoBitSet("00101*");
    sets a to the BitSet 00101*, where "1*" means that the set ends with an infinite number of one (set) bits.

    BitSet a = longtoBitSet((long)23);
    sets a to the BitSet 111010*, the binary representation of decimal 23.

    BitSet a = utoBitSet((unsigned)23);
    sets a to the BitSet 111010*, the binary representation of decimal 23.

    The following functions and operators are provided (Assume the declaration of BitSets a = 0011010*, b = 101101*, throughout, as examples).

    ~a
    returns the complement of a, or 1100101* in this case.

    a.complement()
    sets a to ~a.

    a & b; a &= b;
    returns a intersected with b, or 0011010*.

    a | b; a |= b;
    returns a unioned with b, or 1011111*.

    a - b; a -= b;
    returns the set difference of a and b, or 000010*.

    a ^ b; a ^= b;
    returns the symmetric difference of a and b, or 1000101*.

    a.empty()
    returns true if a is an empty set.

    a == b;
    returns true if a and b contain the same set.

    a <= b;
    returns true if a is a subset of b.

    a < b;
    returns true if a is a proper subset of b;

    a != b; a >= b; a > b;
    are the converses of the above.

    a.set(7)
    sets the 7th (counting from 0) bit of a, setting a to 001111010*

    a.clear(2)
    clears the 2nd bit bit of a, setting a to 00011110*

    a.clear()
    clears all bits of a;

    a.set()
    sets all bits of a;

    a.invert(0)
    complements the 0th bit of a, setting a to 10011110*

    a.set(0,1)
    sets the 0th through 1st bits of a, setting a to 110111110* The two-argument versions of clear and invert are similar.

    a.test(3)
    returns true if the 3rd bit of a is set.

    a.test(3, 5)
    returns true if any of bits 3 through 5 are set.

    int i = a[3]; a[3] = 0;
    The subscript operator allows bits to be inspected and changed via standard subscript semantics, using a friend class BitSetBit. The use of the subscript operator a[i] rather than a.test(i) requires somewhat greater overhead.

    a.first(1) or a.first()
    returns the index of the first set bit of a (2 in this case), or -1 if no bits are set.

    a.first(0)
    returns the index of the first clear bit of a (0 in this case), or -1 if no bits are clear.

    a.next(2, 1) or a.next(2)
    returns the index of the next bit after position 2 that is set (3 in this case) or -1. first and next may be used as iterators, as in for (int i = a.first(); i >= 0; i = a.next(i))....

    a.last(1)
    returns the index of the rightmost set bit, or -1 if there or no set bits or all set bits.

    a.prev(3, 0)
    returns the index of the previous clear bit before position 3.

    a.count(1)
    returns the number of set bits in a, or -1 if there are an infinite number.

    a.virtual_bit()
    returns the trailing (infinitely replicated) bit of a.

    a = atoBitSet("ababX", 'a', 'b', 'X');
    converts the char* string into a bitset, with 'a' denoting false, 'b' denoting true, and 'X' denoting infinite replication.

    a.printon(cout, '-', '.', 0)
    prints a to cout represented with '-' for falses, '.' for trues, and no replication marker.

    cout << a
    prints a to cout (representing lases by 'f', trues by 't', and using '*' as the replication marker).

    diff(x, y, z)
    A faster way to say z = x - y.

    and(x, y, z)
    A faster way to say z = x & y.

    or(x, y, z)
    A faster way to say z = x | y.

    xor(x, y, z)
    A faster way to say z = x ^ y.

    complement(x, z)
    A faster way to say z = ~x.

    BitString

    BitStrings are objects that contain arbitrary-length strings of zeroes and ones. BitStrings possess some features that make them behave like sets, and others that behave as strings. They are useful in applications (such as signature-based algorithms) where both capabilities are needed. Representational details are discussed in the Representation chapter. Most capabilities are exact analogs of those supported in the BitSet and String classes. A BitSubString is used with substring operations along the same lines as the String SubString class. A BitPattern class is used for masked bit pattern searching.

    Only a default constructor is supported. The declaration BitString a; initializes a to be an empty BitString. BitStrings may often be initialized via atoBitString and longtoBitString.

    Set operations ( ~, complement, &, &=, |, |=, -, ^, ^=) behave just as the BitSet versions, except that there is no "virtual bit": complementing complements only those bits in the BitString, and all binary operations across unequal length BitStrings assume a virtual bit of zero. The & operation returns a BitString with a length equal to the minimum length of the operands, and |, ^ return one with length of the maximum.

    Set-based relational operations (==, !=, <=, <, >=, >) follow the same rules. A string-like lexicographic comparison function, lcompare, tests the lexicographic relation between two BitStrings. For example, lcompare(1100, 0101) returns 1, since the first BitString starts with 1 and the second with 0.

    Individual bit setting, testing, and iterator operations (set, clear, invert, test, first, next, last, prev) are also like those for BitSets. BitStrings are automatically expanded when setting bits at positions greater than their current length.

    The string-based capabilities are just as those for class String. BitStrings may be concatenated (+, +=), searched (index, contains, matches), and extracted into BitSubStrings (before, at, after) which may be assigned and otherwise manipulated. Other string-based utility functions (reverse, common_prefix, common_suffix) are also provided. These have the same capabilities and descriptions as those for Strings.

    String-oriented operations can also be performed with a mask via class BitPattern. BitPatterns consist of two BitStrings, a pattern and a mask. On searching and matching, bits in the pattern that correspond to 0 bits in the mask are ignored. (The mask may be shorter than the pattern, in which case trailing mask bits are assumed to be 0). The pattern and mask are both public variables, and may be individually subjected to other bit operations.

    Converting to char* and printing ((atoBitString, atoBitPattern, printon, ostream <<)) are also as in BitSets, except that no virtual bit is used, and an 'X' in a BitPattern means that the pattern bit is masked out.

    The following features are unique to BitStrings.

    Assume declarations of BitString a = atoBitString("01010110") and b = atoBitSTring("1101").

    a = b + c;
    Sets a to the concatenation of b and c;

    a = b + 0; a = b + 1;
    sets a to b, appended with a zero (one).

    a += b;
    appends b to a;

    a += 0; a += 1;
    appends a zero (one) to a.

    a << 2; a <<= 2
    return a with 2 zeros prepended, setting a to 0001010110. (Note the necessary confusion of << and >> operators. For consistency with the integer versions, << shifts low bits to high, even though they are printed low bits first.)

    a >> 3; a >>= 3
    return a with the first 3 bits deleted, setting a to 10110.

    a.left_trim(0)
    deletes all 0 bits on the left of a, setting a to 1010110.

    a.right_trim(0)
    deletes all trailing 0 bits of a, setting a to 0101011.

    cat(x, y, z)
    A faster way to say z = x + y.

    diff(x, y, z)
    A faster way to say z = x - y.

    and(x, y, z)
    A faster way to say z = x & y.

    or(x, y, z)
    A faster way to say z = x | y.

    xor(x, y, z)
    A faster way to say z = x ^ y.

    lshift(x, y, z)
    A faster way to say z = x << y.

    rshift(x, y, z)
    A faster way to say z = x >> y.

    complement(x, z)
    A faster way to say z = ~x.

    Random Number Generators and related classes

    The two classes RNG and Random are used together to generate a variety of random number distributions. A distinction must be made between random number generators, implemented by class RNG, and random number distributions. A random number generator produces a series of randomly ordered bits. These bits can be used directly, or cast to other representations, such as a floating point value. A random number generator should produce a uniform distribution. A random number distribution, on the other hand, uses the randomly generated bits of a generator to produce numbers from a distribution with specific properties. Each instance of Random uses an instance of class RNG to provide the raw, uniform distribution used to produce the specific distribution. Several instances of Random classes can share the same instance of RNG, or each instance can use its own copy.

    RNG

    Random distributions are constructed from members of class RNG, the actual random number generators. The RNG class contains no data; it only serves to define the interface to random number generators. The RNG::asLong member returns an unsigned long (typically 32 bits) of random bits. Applications that require a number of random bits can use this directly. More often, these random bits are transformed to a uniform random number:

        //
        // Return random bits converted to either a float or a double
        //
        float asFloat();
        double asDouble();
    };
    

    using either asFloat or asDouble. It is intended that asFloat and asDouble return differing precisions; typically, asDouble will draw two random longwords and transform them into a legal double, while asFloat will draw a single longword and transform it into a legal float. These members are used by subclasses of the Random class to implement a variety of random number distributions.

    ACG

    Class ACG is a variant of a Linear Congruential Generator (Algorithm M) described in Knuth, Art of Computer Programming, Vol III. This result is permuted with a Fibonacci Additive Congruential Generator to get good independence between samples. This is a very high quality random number generator, although it requires a fair amount of memory for each instance of the generator.

    The ACG::ACG constructor takes two parameters: the seed and the size. The seed is any number to be used as an initial seed. The performance of the generator depends on having a distribution of bits through the seed. If you choose a number in the range of 0 to 31, a seed with more bits is chosen. Other values are deterministically modified to give a better distribution of bits. This provides a good random number generator while still allowing a sequence to be repeated given the same initial seed.

    The size parameter determines the size of two tables used in the generator. The first table is used in the Additive Generator; see the algorithm in Knuth for more information. In general, this table is size longwords long. The default value, used in the algorithm in Knuth, gives a table of 220 bytes. The table size affects the period of the generators; smaller values give shorter periods and larger tables give longer periods. The smallest table size is 7 longwords, and the longest is 98 longwords. The size parameter also determines the size of the table used for the Linear Congruential Generator. This value is chosen implicitly based on the size of the Additive Congruential Generator table. It is two powers of two larger than the power of two that is larger than size. For example, if size is 7, the ACG table is 7 longwords and the LCG table is 128 longwords. Thus, the default size (55) requires 55 + 256 longwords, or 1244 bytes. The largest table requires 2440 bytes and the smallest table requires 100 bytes. Applications that require a large number of generators or applications that aren't so fussy about the quality of the generator may elect to use the MLCG generator.

    MLCG

    The MLCG class implements a Multiplicative Linear Congruential Generator. In particular, it is an implementation of the double MLCG described in "Efficient and Portable Combined Random Number Generators" by Pierre L'Ecuyer, appearing in Communications of the ACM, Vol. 31. No. 6. This generator has a fairly long period, and has been statistically analyzed to show that it gives good inter-sample independence.

    The MLCG::MLCG constructor has two parameters, both of which are seeds for the generator. As in the MLCG generator, both seeds are modified to give a "better" distribution of seed digits. Thus, you can safely use values such as `0' or `1' for the seeds. The MLCG generator used much less state than the ACG generator; only two longwords (8 bytes) are needed for each generator.

    Random

    A random number generator may be declared by first declaring a RNG and then a Random. For example, ACG gen(10, 20); NegativeExpntl rnd (1.0, &gen); declares an additive congruential generator with seed 10 and table size 20, that is used to generate exponentially distributed values with mean of 1.0.

    The virtual member Random::operator() is the common way of extracting a random number from a particular distribution. The base class, Random does not implement operator(). This is performed by each of the subclasses. Thus, given the above declaration of rnd, new random values may be obtained via, for example, double next_exp_rand = rnd(); Currently, the following subclasses are provided.

    Binomial

    The binomial distribution models successfully drawing items from a pool. The first parameter to the constructor, n, is the number of items in the pool, and the second parameter, u, is the probability of each item being successfully drawn. The member asDouble returns the number of samples drawn from the pool. Although it is not checked, it is assumed that n>0 and 0 <= u <= 1. The remaining members allow you to read and set the parameters.

    Erlang

    The Erlang class implements an Erlang distribution with mean mean and variance variance.

    Geometric

    The Geometric class implements a discrete geometric distribution. The first parameter to the constructor, mean, is the mean of the distribution. Although it is not checked, it is assumed that 0 <= mean <= 1. Geometric() returns the number of uniform random samples that were drawn before the sample was larger than mean. This quantity is always greater than zero.

    HyperGeometric

    The HyperGeometric class implements the hypergeometric distribution. The first parameter to the constructor, mean, is the mean and the second, variance, is the variance. The remaining members allow you to inspect and change the mean and variance.

    NegativeExpntl

    The NegativeExpntl class implements the negative exponential distribution. The first parameter to the constructor is the mean. The remaining members allow you to inspect and change the mean.

    Normal

    The Normalclass implements the normal distribution. The first parameter to the constructor, mean, is the mean and the second, variance, is the variance. The remaining members allow you to inspect and change the mean and variance. The LogNormal class is a subclass of Normal.

    LogNormal

    The LogNormalclass implements the logarithmic normal distribution. The first parameter to the constructor, mean, is the mean and the second, variance, is the variance. The remaining members allow you to inspect and change the mean and variance. The LogNormal class is a subclass of Normal.

    Poisson

    The Poisson class implements the poisson distribution. The first parameter to the constructor is the mean. The remaining members allow you to inspect and change the mean.

    DiscreteUniform

    The DiscreteUniform class implements a uniform random variable over the closed interval ranging from [low..high]. The first parameter to the constructor is low, and the second is high, although the order of these may be reversed. The remaining members allow you to inspect and change low and high.

    Uniform

    The Uniform class implements a uniform random variable over the open interval ranging from [low..high). The first parameter to the constructor is low, and the second is high, although the order of these may be reversed. The remaining members allow you to inspect and change low and high.

    Weibull

    The Weibull class implements a weibull distribution with parameters alpha and beta. The first parameter to the class constructor is alpha, and the second parameter is beta. The remaining members allow you to inspect and change alpha and beta.

    RandomInteger

    The RandomInteger class is not a subclass of Random, but a stand-alone integer-oriented class that is dependent on the RNG classes. RandomInteger returns random integers uniformly from the closed interval [low..high]. The first parameter to the constructor is low, and the second is high, although both are optional. The last argument is always a generator. Additional members allow you to inspect and change low and high. Random integers are generated using asInt() or asLong(). Operator syntax (()) is also available as a shorthand for asLong(). Because RandomInteger is often used in simulations for which uniform random integers are desired over a variety of ranges, asLong() and asInt have high as an optional argument. Using this optional argument produces a single value from the new range, but does not change the default range.

    Data Collection

    Libg++ currently provides two classes for data collection and analysis of the collected data.

    SampleStatistic

    Class SampleStatistic provides a means of accumulating samples of double values and providing common sample statistics.

    Assume declaration of double x.

    SampleStatistic a;
    declares and initializes a.

    a.reset();
    re-initializes a.

    a += x;
    adds sample x.

    int n = a.samples();
    returns the number of samples.

    x = a.mean;
    returns the means of the samples.

    x = a.var()
    returns the sample variance of the samples.

    x = a.stdDev()
    returns the sample standard deviation of the samples.

    x = a.min()
    returns the minimum encountered sample.

    x = a.max()
    returns the maximum encountered sample.

    x = a.confidence(int p)
    returns the p-percent (0 <= p < 100) confidence interval.

    x = a.confidence(double p)
    returns the p-probability (0 <= p < 1) confidence interval.

    SampleHistogram

    Class SampleHistogram is a derived class of SampleStatistic that supports collection and display of samples in bucketed intervals. It supports the following in addition to SampleStatisic operations.

    SampleHistogram h(double lo, double hi, double width);
    declares and initializes h to have buckets of size width from lo to hi. If the optional argument width is not specified, 10 buckets are created. The first bucket and also holds samples less than lo, and the last one holds samples greater than hi.

    int n = h.similarSamples(x)
    returns the number of samples in the same bucket as x.

    int n = h.inBucket(int i)
    returns the number of samples in bucket i.

    int b = h.buckets()
    returns the number of buckets.

    h.printBuckets(ostream s)
    prints bucket counts on ostream s.

    double bound = h.bucketThreshold(int i)
    returns the upper bound of bucket i.

    Curses-based classes

    The CursesWindow class is a repackaging of standard curses library features into a class. It relies on `curses.h'.

    The supplied `curses.h' is a fairly conservative declaration of curses library features, and does not include features like "screen" or X-window support. It is, for the most part, an adaptation, rather than an improvement of C-based `curses.h' files. The only substantive changes are the declarations of many functions as inline functions rather than macros, which was done solely to allow overloading.

    The CursesWindow class encapsulates curses window functions within a class. Only those functions that control windows are included: Terminal control functions and macros like cbreak are not part of the class. All CursesWindows member functions have names identical to the corresponding curses library functions, except that the "w" prefix is generally dropped. Descriptions of these functions may be found in your local curses library documentation.

    A CursesWindow may be declared via

    CursesWindow w(WINDOW* win)
    attaches w to the existing WINDOW* win. This is constructor is normally used only in the following special case.

    CursesWindow w(stdscr)
    attaches w to the default curses library standard screen window.

    CursesWindow w(int lines, int cols, int begin_y, int begin_x)
    attaches to an allocated curses window with the indicated size and screen position.

    CursesWindow sub(CursesWindow& w,int l,int c,int by,int bx,char ar='a')
    attaches to a subwindow of w created via the curses `subwin' command. If ar is sent as `r', the origin (by, bx) is relative to the parent window, else it is absolute.

    The class maintains a static counter that is used in order to automatically call the curses library initscr and endscr functions at the proper times. These need not, and should not be called "manually".

    CursesWindows maintain a tree of their subwindows. Upon destruction of a CursesWindow, all of their subwindows are also invalidated if they had not previously been destroyed.

    It is possible to traverse trees of subwindows via the following member functions

    CursesWindow* w.parent()
    returns a pointer to the parent of the subwindow, or 0 if there is none.

    CursesWindow* w.child()
    returns the first child subwindow of the window, or 0 if there is none.

    CursesWindow* w.sibling()
    returns the next sibling of the subwindow, or 0 if there is none.

    For example, to call some function visit for all subwindows of a window, you could write

    
    void traverse(CursesWindow& w)
    {
      visit(w);
      if (w.child() != 0) traverse(*w.child);
      if (w.sibling() != 0) traverse(*w.sibling);
    }
    
    

    List classes

    The files `g++-include/List.hP' and `g++-include/List.ccP' provide pseudo-generic Lisp-type List classes. These lists are homogeneous lists, more similar to lists in statically typed functional languages like ML than Lisp, but support operations very similar to those found in Lisp. Any particular kind of list class may be generated via the genclass shell command. However, the implementation assumes that the base class supports an equality operator ==. All equality tests use the == operator, and are thus equivalent to the use of equal, not eq in Lisp.

    All list nodes are created dynamically, and managed via reference counts. List variables are actually pointers to these list nodes. Lists may also be traversed via Pixes, as described in the section describing Pixes. See section Pseudo-indexes

    Supported operations are mirrored closely after those in Lisp. Generally, operations with functional forms are constructive, functional operations, while member forms (often with the same name) are sometimes procedural, possibly destructive operations.

    As with Lisp, destructive operations are supported. Programmers are allowed to change head and tail fields in any fashion, creating circular structures and the like. However, again as with Lisp, some operations implicitly assume that they are operating on pure lists, and may enter infinite loops when presented with improper lists. Also, the reference-counting storage management facility may fail to reclaim unused circularly-linked nodes.

    Several Lisp-like higher order functions are supported (e.g., map). Typedef declarations for the required functional forms are provided int the `.h' file.

    For purposes of illustration, assume the specification of class intList. Common Lisp versions of supported operations are shown in brackets for comparison purposes.

    Constructors and assignment

    intList a; [ (setq a nil) ]
    Declares a to be a nil intList.

    intList b(2); [ (setq b (cons 2 nil)) ]
    Declares b to be an intList with a head value of 2, and a nil tail.

    intList c(3, b); [ (setq c (cons 3 b)) ]
    Declares c to be an intList with a head value of 3, and b as its tail.

    b = a; [ (setq b a) ]
    Sets b to be the same list as a.

    Assume the declarations of intLists a, b, and c in the following. See section Pseudo-indexes.

    List status

    a.null(); OR !a; [ (null a) ]
    returns true if a is null.

    a.valid(); [ (listp a) ]
    returns true if a is non-null. Inside a conditional test, the void* coercion may also be used as in if (a) ....

    intList(); [ nil ]
    intList() may be used to null terminate a list, as in intList f(int x) {if (x == 0) return intList(); ... } .

    a.length(); [ (length a) ]
    returns the length of a.

    a.list_length(); [ (list-length a) ]
    returns the length of a, or -1 if a is circular.

    heads and tails

    a.get(); OR a.head() [ (car a) ]
    returns a reference to the head field.

    a[2]; [ (elt a 2) ]
    returns a reference to the second (counting from zero) head field.

    a.tail(); [ (cdr a) ]
    returns the intList that is the tail of a.

    a.last(); [ (last a) ]
    returns the intList that is the last node of a.

    a.nth(2); [ (nth a 2) ]
    returns the intList that is the nth node of a.

    a.set_tail(b); [ (rplacd a b) ]
    sets a's tail to b.

    a.push(2); [ (push 2 a) ]
    equivalent to a = intList(2, a);

    int x = a.pop() [ (setq x (car a)) (pop a) ]
    returns the head of a, also setting a to its tail.

    Constructive operations

    b = copy(a); [ (setq b (copy-seq a)) ]
    sets b to a copy of a.

    b = reverse(a); [ (setq b (reverse a)) ]
    Sets b to a reversed copy of a.

    c = concat(a, b); [ (setq c (concat a b)) ]
    Sets c to a concatenated copy of a and b.

    c = append(a, b); [ (setq c (append a b)) ]
    Sets c to a concatenated copy of a and b. All nodes of a are copied, with the last node pointing to b.

    b = map(f, a); [ (setq b (mapcar f a)) ]
    Sets b to a new list created by applying function f to each node of a.

    c = combine(f, a, b);
    Sets c to a new list created by applying function f to successive pairs of a and b. The resulting list has length the shorter of a and b.

    b = remove(x, a); [ (setq b (remove x a)) ]
    Sets b to a copy of a, omitting all occurrences of x.

    b = remove(f, a); [ (setq b (remove-if f a)) ]
    Sets b to a copy of a, omitting values causing function f to return true.

    b = select(f, a); [ (setq b (remove-if-not f a)) ]
    Sets b to a copy of a, omitting values causing function f to return false.

    c = merge(a, b, f); [ (setq c (merge a b f)) ]
    Sets c to a list containing the ordered elements (using the comparison function f) of the sorted lists a and b.

    Destructive operations

    a.append(b); [ (rplacd (last a) b) ]
    appends b to the end of a. No new nodes are constructed.

    a.prepend(b); [ (setq a (append b a)) ]
    prepends b to the beginning of a.

    a.del(x); [ (delete x a) ]
    deletes all nodes with value x from a.

    a.del(f); [ (delete-if f a) ]
    deletes all nodes causing function f to return true.

    a.select(f); [ (delete-if-not f a) ]
    deletes all nodes causing function f to return false.

    a.reverse(); [ (nreverse a) ]
    reverses a in-place.

    a.sort(f); [ (sort a f) ]
    sorts a in-place using ordering (comparison) function f.

    a.apply(f); [ (mapc f a) ]
    Applies void function f (int x) to each element of a.

    a.subst(int old, int repl); [ (nsubst repl old a) ]
    substitutes repl for each occurrence of old in a. Note the different argument order than the Lisp version.

    Other operations

    a.find(int x); [ (find x a) ]
    returns the intList at the first occurrence of x.

    a.find(b); [ (find b a) ]
    returns the intList at the first occurrence of sublist b.

    a.contains(int x); [ (member x a) ]
    returns true if a contains x.

    a.contains(b); [ (member b a) ]
    returns true if a contains sublist b.

    a.position(int x); [ (position x a) ]
    returns the zero-based index of x in a, or -1 if x does not occur.

    int x = a.reduce(f, int base); [ (reduce f a :initial-value base) ]
    Accumulates the result of applying int function f(int, int) to successive elements of a, starting with base.

    Linked Lists

    SLLists provide pseudo-generic singly linked lists. DLLists provide doubly linked lists. The lists are designed for the simple maintenance of elements in a linked structure, and do not provide the more extensive operations (or node-sharing) of class List. They behave similarly to the slist and similar classes described by Stroustrup.

    All list nodes are created dynamically. Assignment is performed via copying.

    Class DLList supports all SLList operations, plus additional operations described below.

    For purposes of illustration, assume the specification of class intSLList. In addition to the operations listed here, SLLists support traversal via Pixes. See section Pseudo-indexes

    intSLList a;
    Declares a to be an empty list.

    intSLList b = a;
    Sets b to an element-by-element copy of a.

    a.empty()
    returns true if a contains no elements

    a.length();
    returns the number of elements in a.

    a.prepend(x);
    places x at the front of the list.

    a.append(x);
    places x at the end of the list.

    a.join(b)
    places all nodes from b to the end of a, simultaneously destroying b.

    x = a.front()
    returns a reference to the item stored at the head of the list, or triggers an error if the list is empty.

    a.rear()
    returns a reference to the rear of the list, or triggers an error if the list is empty.

    x = a.remove_front()
    deletes and returns the item stored at the head of the list.

    a.del_front()
    deletes the first element, without returning it.

    a.clear()
    deletes all items from the list.

    a.ins_after(Pix i, item);
    inserts item after position i. If i is null, insertion is at the front.

    a.del_after(Pix i);
    deletes the element following i. If i is 0, the first item is deleted.

    Doubly linked lists

    Class DLList supports the following additional operations, as well as backward traversal via Pixes.

    x = a.remove_rear();
    deletes and returns the item stored at the rear of the list.

    a.del_rear();
    deletes the last element, without returning it.

    a.ins_before(Pix i, x)
    inserts x before the i.

    a.del(Pix& iint dir = 1)
    deletes the item at the current position, then advances forward if dir is positive, else backward.

    Vector classes

    The files `g++-include/Vec.ccP' and `g++-include/AVec.ccP' provide pseudo-generic standard array-based vector operations. The corresponding header files are `g++-include/Vec.hP' and `g++-include/AVec.hP'. Class Vec provides operations suitable for any base class that includes an equality operator. Subclass AVec provides additional arithmetic operations suitable for base classes that include the full complement of arithmetic operators.

    Vecs are constructed and assigned by copying. Thus, they should normally be passed by reference in applications programs.

    Several mapping functions are provided that allow programmers to specify operations on vectors as a whole.

    For illustrative purposes assume that classes intVec and intAVec have been generated via genclass.

    Constructors and assignment

    intVec a;
    declares a to be an empty vector. Its size may be changed via resize.

    intVec a(10);
    declares a to be an uninitialized vector of ten elements (numbered 0-9).

    intVec b(6, 0);
    declares b to be a vector of six elements, all initialized to zero. Any value can be used as the initial fill argument.

    a = b;
    Copies b to a. a is resized to be the same as b.

    a = b.at(2, 4)
    constructs a from the 4 elements of b starting at b[2].

    Assume declarations of intVec a, b, c and int i, x in the following.

    Status and access

    a.capacity();
    returns the number of elements that can be held in a.

    a.resize(20);
    sets a's length to 20. All elements are unchanged, except that if the new size is smaller than the original, than trailing elements are deleted, and if greater, trailing elements are uninitialized.

    a[i];
    returns a reference to the i'th element of a, or produces an error if i is out of range.

    a.elem(i)
    returns a reference to the i'th element of a. Unlike the [] operator, i is not checked to ensure that it is within range.

    a == b;
    returns true if a and b contain the same elements in the same order.

    a != b;
    is the converse of a == b.

    Constructive operations

    c = concat(a, b);
    sets c to the new vector constructed from all of the elements of a followed by all of b.

    c = map(f, a);
    sets c to the new vector constructed by applying int function f(int) to each element of a.

    c = merge(a, b, f);
    sets c to the new vector constructed by merging the elements of ordered vectors a and b using ordering (comparison) function f.

    c = combine(f, a, b);
    sets c to the new vector constructed by applying int function f(int, int) to successive pairs of a and b. The result has length the shorter of a and b.

    c = reverse(a)
    sets c to a, with elements in reverse order.

    Destructive operations

    a.reverse();
    reverses a in-place.

    a.sort(f)
    sorts a in-place using comparison function f. The sorting method is a variation of the quicksort functions supplied with GNU emacs.

    a.fill(0, 4, 2)
    fills the 2 elements starting at a[4] with zero.

    Other operations

    a.apply(f)
    applies function f to each element in a.

    x = a.reduce(f, base)
    accumulates the results of applying function f to successive elements of a starting with base.

    a.index(int targ);
    returns the index of the leftmost occurrence of the target, or -1, if it does not occur.

    a.error(char* msg)
    invokes the error handler. The default version prints the error message, then aborts.

    AVec operations.

    AVecs provide additional arithmetic operations. All vector-by-vector operators generate an error if the vectors are not the same length. The following operations are provided, for AVecs a, b and base element (scalar) s.

    a = b;
    Copies b to a. a and b must be the same size.

    a = s;
    fills all elements of a with the value s. a is not resized.

    a + s; a - s; a * s; a / s
    adds, subtracts, multiplies, or divides each element of a with the scalar.

    a += s; a -= s; a *= s; a /= s;
    adds, subtracts, multiplies, or divides the scalar into a.

    a + b; a - b; product(a, b), quotient(a, b)
    adds, subtracts, multiplies, or divides corresponding elements of a and b.

    a += b; a -= b; a.product(b); a.quotient(b);
    adds, subtracts, multiplies, or divides corresponding elements of b into a.

    s = a * b;
    returns the inner (dot) product of a and b.

    x = a.sum();
    returns the sum of elements of a.

    x = a.sumsq();
    returns the sum of squared elements of a.

    x = a.min();
    returns the minimum element of a.

    x = a.max();
    returns the maximum element of a.

    i = a.min_index();
    returns the index of the minimum element of a.

    i = a.max_index();
    returns the index of the maximum element of a.

    Note that it is possible to apply vector versions other arithmetic operators via the mapping functions. For example, to set vector b to the cosines of doubleVec a, use b = map(cos, a);. This is often more efficient than performing the operations in an element-by-element fashion.

    Plex classes

    A "Plex" is a kind of array with the following properties:

    • Plexes may have arbitrary upper and lower index bounds. For example a Plex may be declared to run from indices -10 .. 10.

    • Plexes may be dynamically expanded at both the lower and upper bounds of the array in steps of one element.

    • Only elements that have been specifically initialized or added may be accessed.

    • Elements may be accessed via indices. Indices are always checked for validity at run time. Plexes may be traversed via simple variations of standard array indexing loops.

    • Plex elements may be accessed and traversed via Pixes.

    • Plex-to-Plex assignment and related operations on entire Plexes are supported.

    • Plex classes contain methods to help programmers check the validity of indexing and pointer operations.

    • Plexes form "natural" base classes for many restricted-access data structures relying on logically contiguous indices, such as array-based stacks and queues.

    • Plexes are implemented as pseudo-generic classes, and must be generated via the genclass utility.

    Four subclasses of Plexes are supported: A FPlex is a Plex that may only grow or shrink within declared bounds; an XPlex may dynamically grow or shrink without bounds; an RPlex is the same as an XPlex but better supports indexing with poor locality of reference; a MPlex may grow or shrink, and additionally allows the logical deletion and restoration of elements. Because these classes are virtual subclasses of the "abstract" class Plex, it is possible to write user code such as void f(Plex& a) ... that operates on any kind of Plex. However, as with nearly any virtual class, specifying the particular Plex class being used results in more efficient code.

    Plexes are implemented as a linked list of IChunks. Each chunk contains a part of the array. Chunk sizes may be specified within Plex constructors. Default versions also exist, that use a #define'd default. Plexes grow by filling unused space in existing chunks, if possible, else, except for FPlexes, by adding another chunk. Whenever Plexes grow by a new chunk, the default element constructors (i.e., those which take no arguments) for all chunk elements are called at once. When Plexes shrink, destructors for the elements are not called until an entire chunk is freed. For this reason, Plexes (like C++ arrays) should only be used for elements with default constructors and destructors that have no side effects.

    Plexes may be indexed and used like arrays, although traversal syntax is slightly different. Even though Plexes maintain elements in lists of chunks, they are implemented so that iteration and other constructs that maintain locality of reference require very little overhead over that for simple array traversal Pix-based traversal is also supported. For example, for a plex, p, of ints, the following traversal methods could be used.

    for (int i = p.low(); i < p.fence(); p.next(i)) use(p[i]);
    for (int i = p.high(); i > p.ecnef(); p.prev(i)) use(p[i]);
    for (Pix t = p.first(); t != 0; p.next(t)) use(p(i));
    for (Pix t = p.last(); t != 0; p.prev(t)) use(p(i));
    

    Except for MPlexes, simply using ++i and --i works just as well as p.next(i) and p.prev(i) when traversing by index. Index-based traversal is generally a bit faster than Pix-based traversal.

    XPlexes and MPlexes are less than optimal for applications in which widely scattered elements are indexed, as might occur when using Plexes as hash tables or "manually" allocated linked lists. In such applications, RPlexes are often preferable. RPlexes use a secondary chunk index table that requires slightly greater, but entirely uniform overhead per index operation.

    Even though they may grow in either direction, Plexes are normally constructed so that their "natural" growth direction is upwards, in that default chunk construction leaves free space, if present, at the end of the plex. However, if the chunksize arguments to constructors are negative, they leave space at the beginning.

    All versions of Plexes support the following basic capabilities. (letting Plex stand for the type name constructed via the genclass utility (e.g., intPlex, doublePlex)). Assume declarations of Plex p, q, int i, j, base element x, and Pix pix.

    Plex p;
    Declares p to be an initially zero-sized Plex with low index of zero, and the default chunk size. For FPlexes, chunk sizes represent maximum sizes.

    Plex p(int size);
    Declares p to be an initially zero-sized Plex with low index of zero, and the indicated chunk size. If size is negative, then the Plex is created with free space at the beginning of the Plex, allowing more efficient add_low() operations. Otherwise, it leaves space at the end.

    Plex p(int low, int size);
    Declares p to be an initially zero-sized Plex with low index of low, and the indicated chunk size.

    Plex p(int low, int high, Base initval, int size = 0);
    Declares p to be a Plex with indices from low to high, initially filled with initval, and the indicated chunk size if specified, else the default or (high - low + 1), whichever is greater.

    Plex q(p);
    Declares q to be a copy of p.

    p = q;
    Copies Plex q into p, deleting its previous contents.

    p.length()
    Returns the number of elements in the Plex.

    p.empty()
    Returns true if Plex p contains no elements.

    p.full()
    Returns true if Plex p cannot be expanded. This always returns false for XPlexes and MPlexes.

    p[i]
    Returns a reference to the i'th element of p. An exception (error) occurs if i is not a valid index.

    p.valid(i)
    Returns true if i is a valid index into Plex p.

    p.low(); p.high();
    Return the minimum (maximum) valid index of the Plex, or the high (low) fence if the plex is empty.

    p.ecnef(); p.fence();
    Return the index one position past the minimum (maximum) valid index.

    p.next(i); i = p.prev(i);
    Set i to the next (previous) index. This index may not be within bounds.

    p(pix)
    returns a reference to the item at Pix pix.

    pix = p.first(); pix = p.last();
    Return the minimum (maximum) valid Pix of the Plex, or 0 if the plex is empty.

    p.next(pix); p.prev(pix);
    set pix to the next (previous) Pix, or 0 if there is none.

    p.owns(pix)
    Returns true if the Plex contains the element associated with pix.

    p.Pix_to_index(pix)
    If pix is a valid Pix to an element of the Plex, returns its corresponding index, else raises an exception.

    ptr = p.index_to_Pix(i)
    if i is a valid index, returns a the corresponding Pix.

    p.low_element(); p.high_element();
    Return a reference to the element at the minimum (maximum) valid index. An exception occurs if the Plex is empty.

    p.can_add_low(); p.can_add_high();
    Returns true if the plex can be extended one element downward (upward). These always return true for XPlex and MPlex.

    j = p.add_low(x); j = p.add_high(x);
    Extend the Plex by one element downward (upward). The new minimum (maximum) index is returned.

    j = p.del_low(); j = p.del_high()
    Shrink the Plex by one element on the low (high) end. The new minimum (maximum) element is returned. An exception occurs if the Plex is empty.

    p.append(q);
    Append all of Plex q to the high side of p.

    p.prepend(q);
    Prepend all of q to the low side of p.

    p.clear()
    Delete all elements, resetting p to a zero-sized Plex.

    p.reset_low(i);
    Resets p to be indexed starting at low() = i. For example. if p were initially declared via Plex p(0, 10, 0), and then re-indexed via p.reset_low(5), it could then be indexed from indices 5 .. 14.

    p.fill(x)
    sets all p[i] to x.

    p.fill(x, lo, hi)
    sets all of p[i] from lo to hi, inclusive, to x.

    p.reverse()
    reverses p in-place.

    p.chunk_size()
    returns the chunk size used for the plex.

    p.error(const char * msg)
    calls the resettable error handler.

    MPlexes are plexes with bitmaps that allow items to be logically deleted and restored. They behave like other plexes, but also support the following additional and modified capabilities:

    p.del_index(i); p.del_Pix(pix)
    logically deletes p[i] (p(pix)). After deletion, attempts to access p[i] generate a error. Indexing via low(), high(), prev(), and next() skip the element. Deleting an element never changes the logical bounds of the plex.

    p.undel_index(i); p.undel_Pix(pix)
    logically undeletes p[i] (p(pix)).

    p.del_low(); p.del_high()
    Delete the lowest (highest) undeleted element, resetting the logical bounds of the plex to the next lowest (highest) undeleted index. Thus, MPlex del_low() and del_high() may shrink the bounds of the plex by more than one index.

    p.adjust_bounds()
    Resets the low and high bounds of the Plex to the indexes of the lowest and highest actual undeleted elements.

    int i = p.add(x)
    Adds x in an unused index, if possible, else performs add_high.

    p.count()
    returns the number of valid (undeleted) elements.

    p.available()
    returns the number of available (deleted) indices.

    int i = p.unused_index()
    returns the index of some deleted element, if one exists, else triggers an error. An unused element may be reused via undel.

    pix = p.unused_Pix()
    returns the pix of some deleted element, if one exists, else 0. An unused element may be reused via undel.

    Stacks

    Stacks are declared as an "abstract" class. They are currently implemented in any of three ways.

    VStack
    implement fixed sized stacks via arrays.

    XPStack
    implement dynamically-sized stacks via XPlexes.

    SLStack
    implement dynamically-size stacks via linked lists.

    All possess the same capabilities. They differ only in constructors. VStack constructors require a fixed maximum capacity argument. XPStack constructors optionally take a chunk size argument. SLStack constructors take no argument.

    Assume the declaration of a base element x.

    Stack s; or Stack s(int capacity)
    declares a Stack.

    s.empty()
    returns true if stack s is empty.

    s.full()
    returns true if stack s is full. XPStacks and SLStacks never become full.

    s.length()
    returns the current number of elements in the stack.

    s.push(x)
    pushes x on stack s.

    x = s.pop()
    pops and returns the top of stack

    s.top()
    returns a reference to the top of stack.

    s.del_top()
    pops, but does not return the top of stack. When large items are held on the stack it is often a good idea to use top() to inspect and use the top of stack, followed by a del_top()

    s.clear()
    removes all elements from the stack.

    Queues

    Queues are declared as an "abstract" class. They are currently implemented in any of three ways.

    VQueue
    implement fixed sized Queues via arrays.

    XPQueue
    implement dynamically-sized Queues via XPlexes.

    SLQueue
    implement dynamically-size Queues via linked lists.

    All possess the same capabilities; they differ only in constructors. VQueue constructors require a fixed maximum capacity argument. XPQueue constructors optionally take a chunk size argument. SLQueue constructors take no argument.

    Assume the declaration of a base element x.

    Queue q; or Queue q(int capacity);
    declares a queue.

    q.empty()
    returns true if queue q is empty.

    q.full()
    returns true if queue q is full. XPQueues and SLQueues are never full.

    q.length()
    returns the current number of elements in the queue.

    q.enq(x)
    enqueues x on queue q.

    x = q.deq()
    dequeues and returns the front of queue

    q.front()
    returns a reference to the front of queue.

    q.del_front()
    dequeues, but does not return the front of queue

    q.clear()
    removes all elements from the queue.

    Double ended Queues

    Deques are declared as an "abstract" class. They are currently implemented in two ways.

    XPDeque
    implement dynamically-sized Deques via XPlexes.

    DLDeque
    implement dynamically-size Deques via linked lists.

    All possess the same capabilities. They differ only in constructors. XPDeque constructors optionally take a chunk size argument. DLDeque constructors take no argument.

    Double-ended queues support both stack-like and queue-like capabilities:

    Assume the declaration of a base element x.

    Deque d; or Deque d(int initial_capacity)
    declares a deque.

    d.empty()
    returns true if deque d is empty.

    d.full()
    returns true if deque d is full. Always returns false in current implementations.

    d.length()
    returns the current number of elements in the deque.

    d.enq(x)
    inserts x at the rear of deque d.

    d.push(x)
    inserts x at the front of deque d.

    x = d.deq()
    dequeues and returns the front of deque

    d.front()
    returns a reference to the front of deque.

    d.rear()
    returns a reference to the rear of the deque.

    d.del_front()
    deletes, but does not return the front of deque

    d.del_rear()
    deletes, but does not return the rear of the deque.

    d.clear()
    removes all elements from the deque.

    Priority Queue class prototypes.

    Priority queues maintain collections of objects arranged for fast access to the least element.

    Several prototype implementations of priority queues are supported.

    XPPQs
    implement 2-ary heaps via XPlexes.

    SplayPQs
    implement PQs via Sleator and Tarjan's (JACM 1985) splay trees. The algorithms use a version of "simple top-down splaying" (described on page 669 of the article). The simple-splay mechanism for priority queue functions is loosely based on the one used by D. Jones in the C splay tree functions available from volume 14 of the uunet.uu.net archives.

    PHPQs
    implement pairing heaps (as described by Fredman and Sedgewick in Algorithmica, Vol 1, p111-129). Storage for heap elements is managed via an internal freelist technique. The constructor allows an initial capacity estimate for freelist space. The storage is automatically expanded if necessary to hold new items. The deletion technique is a fast "lazy deletion" strategy that marks items as deleted, without reclaiming space until the items come to the top of the heap.

    All PQ classes support the following operations, for some PQ class Heap, instance h, Pix ind, and base class variable x.

    h.empty()
    returns true if there are no elements in the PQ.

    h.length()
    returns the number of elements in h.

    ind = h.enq(x)
    Places x in the PQ, and returns its index.

    x = h.deq()
    Dequeues the minimum element of the PQ into x, or generates an error if the PQ is empty.

    h.front()
    returns a reference to the minimum element.

    h.del_front()
    deletes the minimum element.

    h.clear();
    deletes all elements from h;

    h.contains(x)
    returns true if x is in h.

    h(ind)
    returns a reference to the item indexed by ind.

    ind = h.first()
    returns the Pix of first item in the PQ or 0 if empty. This need not be the Pix of the least element.

    h.next(ind)
    advances ind to the Pix of next element, or 0 if there are no more.

    ind = h.seek(x)
    Sets ind to the Pix of x, or 0 if x is not in h.

    h.del(ind)
    deletes the item with Pix ind.

    Set class prototypes

    Set classes maintain unbounded collections of items containing no duplicate elements.

    These are currently implemented in several ways, differing in representation strategy, algorithmic efficiency, and appropriateness for various tasks. (Listed next to each are average (followed by worst-case, if different) time complexities for [a] adding, [f] finding (via seek, contains), [d] deleting, elements, and [c] comparing (via ==, <=) and [m] merging (via |=, -=, &=) sets).

    XPSets
    implement unordered sets via XPlexes. ([a O(n)], [f O(n)], [d O(n)], [c O(n^2)] [m O(n^2)]).

    OXPSets
    implement ordered sets via XPlexes. ([a O(n)], [f O(log n)], [d O(n)], [c O(n)] [m O(n)]).

    SLSets
    implement unordered sets via linked lists ([a O(n)], [f O(n)], [d O(n)], [c O(n^2)] [m O(n^2)]).

    OSLSets
    implement ordered sets via linked lists ([a O(n)], [f O(n)], [d O(n)], [c O(n)] [m O(n)]).

    AVLSets
    implement ordered sets via threaded AVL trees ([a O(log n)], [f O(log n)], [d O(log n)], [c O(n)] [m O(n)]).

    BSTSets
    implement ordered sets via binary search trees. The trees may be manually rebalanced via the O(n) balance() member function. ([a O(log n)/O(n)], [f O(log n)/O(n)], [d O(log n)/O(n)], [c O(n)] [m O(n)]).

    SplaySets
    implement ordered sets via Sleator and Tarjan's (JACM 1985) splay trees. The algorithms use a version of "simple top-down splaying" (described on page 669 of the article). (Amortized: [a O(log n)], [f O(log n)], [d O(log n)], [c O(n)] [m O(n log n)]).

    VHSets
    implement unordered sets via hash tables. The tables are automatically resized when their capacity is exhausted. ([a O(1)/O(n)], [f O(1)/O(n)], [d O(1)/O(n)], [c O(n)/O(n^2)] [m O(n)/O(n^2)]).

    VOHSets
    implement unordered sets via ordered hash tables The tables are automatically resized when their capacity is exhausted. ([a O(1)/O(n)], [f O(1)/O(n)], [d O(1)/O(n)], [c O(n)/O(n^2)] [m O(n)/O(n^2)]).

    CHSets
    implement unordered sets via chained hash tables. ([a O(1)/O(n)], [f O(1)/O(n)], [d O(1)/O(n)], [c O(n)/O(n^2)] [m O(n)/O(n^2)]).

    The different implementations differ in whether their constructors require an argument specifying their initial capacity. Initial capacities are required for plex and hash table based Sets. If none is given DEFAULT_INITIAL_CAPACITY (from `<T>defs.h') is used.

    Sets support the following operations, for some class Set, instances a and b, Pix ind, and base element x. Since all implementations are virtual derived classes of the <T>Set class, it is possible to mix and match operations across different implementations, although, as usual, operations are generally faster when the particular classes are specified in functions operating on Sets.

    Pix-based operations are more fully described in the section on Pixes. See section Pseudo-indexes

    Set a; or Set a(int initial_size);
    Declares a to be an empty Set. The second version is allowed in set classes that require initial capacity or sizing specifications.

    a.empty()
    returns true if a is empty.

    a.length()
    returns the number of elements in a.

    Pix ind = a.add(x)
    inserts x into a, returning its index.

    a.del(x)
    deletes x from a.

    a.clear()
    deletes all elements from a;

    a.contains(x)
    returns true if x is in a.

    a(ind)
    returns a reference to the item indexed by ind.

    ind = a.first()
    returns the Pix of first item in the set or 0 if the Set is empty. For ordered Sets, this is the Pix of the least element.

    a.next(ind)
    advances ind to the Pix of next element, or 0 if there are no more.

    ind = a.seek(x)
    Sets ind to the Pix of x, or 0 if x is not in a.

    a == b
    returns true if a and b contain all the same elements.

    a != b
    returns true if a and b do not contain all the same elements.

    a <= b
    returns true if a is a subset of b.

    a |= b
    Adds all elements of b to a.

    a -= b
    Deletes all elements of b from a.

    a &= b
    Deletes all elements of a not occurring in b.

    Bag class prototypes

    Bag classes maintain unbounded collections of items potentially containing duplicate elements.

    These are currently implemented in several ways, differing in representation strategy, algorithmic efficiency, and appropriateness for various tasks. (Listed next to each are average (followed by worst-case, if different) time complexities for [a] adding, [f] finding (via seek, contains), [d] deleting elements).

    XPBags
    implement unordered Bags via XPlexes. ([a O(1)], [f O(n)], [d O(n)]).

    OXPBags
    implement ordered Bags via XPlexes. ([a O(n)], [f O(log n)], [d O(n)]).

    SLBags
    implement unordered Bags via linked lists ([a O(1)], [f O(n)], [d O(n)]).

    OSLBags
    implement ordered Bags via linked lists ([a O(n)], [f O(n)], [d O(n)]).

    SplayBags
    implement ordered Bags via Sleator and Tarjan's (JACM 1985) splay trees. The algorithms use a version of "simple top-down splaying" (described on page 669 of the article). (Amortized: [a O(log n)], [f O(log n)], [d O(log n)]).

    VHBags
    implement unordered Bags via hash tables. The tables are automatically resized when their capacity is exhausted. ([a O(1)/O(n)], [f O(1)/O(n)], [d O(1)/O(n)]).

    CHBags
    implement unordered Bags via chained hash tables. ([a O(1)/O(n)], [f O(1)/O(n)], [d O(1)/O(n)]).

    The implementations differ in whether their constructors require an argument to specify their initial capacity. Initial capacities are required for plex and hash table based Bags. If none is given DEFAULT_INITIAL_CAPACITY (from `<T>defs.h') is used.

    Bags support the following operations, for some class Bag, instances a and b, Pix ind, and base element x. Since all implementations are virtual derived classes of the <T>Bag class, it is possible to mix and match operations across different implementations, although, as usual, operations are generally faster when the particular classes are specified in functions operating on Bags.

    Pix-based operations are more fully described in the section on Pixes. See section Pseudo-indexes

    Bag a; or Bag a(int initial_size)
    Declares a to be an empty Bag. The second version is allowed in Bag classes that require initial capacity or sizing specifications.

    a.empty()
    returns true if a is empty.

    a.length()
    returns the number of elements in a.

    ind = a.add(x)
    inserts x into a, returning its index.

    a.del(x)
    deletes one occurrence of x from a.

    a.remove(x)
    deletes all occurrences of x from a.

    a.clear()
    deletes all elements from a;

    a.contains(x)
    returns true if x is in a.

    a.nof(x)
    returns the number of occurrences of x in a.

    a(ind)
    returns a reference to the item indexed by ind.

    int = a.first()
    returns the Pix of first item in the Bag or 0 if the Bag is empty. For ordered Bags, this is the Pix of the least element.

    a.next(ind)
    advances ind to the Pix of next element, or 0 if there are no more.

    ind = a.seek(x. Pix from = 0)
    Sets ind to the Pix of the next occurrence x, or 0 if there are none. If from is 0, the first occurrence is returned, else the following from.

    Map Class Prototypes

    Maps support associative array operations (insertion, deletion, and membership of records based on an associated key). They require the specification of two types, the key type and the contents type.

    These are currently implemented in several ways, differing in representation strategy, algorithmic efficiency, and appropriateness for various tasks. (Listed next to each are average (followed by worst-case, if different) time complexities for [a] accessing (via op [], contains), [d] deleting elements).

    AVLMaps
    implement ordered Maps via threaded AVL trees ([a O(log n)], [d O(log n)]).

    RAVLMaps
    Similar, but also maintain ranking information, used via ranktoPix(int r), that returns the Pix of the item at rank r, and rank(key) that returns the rank of the corresponding item. ([a O(log n)], [d O(log n)]).

    SplayMaps
    implement ordered Maps via Sleator and Tarjan's (JACM 1985) splay trees. The algorithms use a version of "simple top-down splaying" (described on page 669 of the article). (Amortized: [a O(log n)], [d O(log n)]).

    VHMaps
    implement unordered Maps via hash tables. The tables are automatically resized when their capacity is exhausted. ([a O(1)/O(n)], [d O(1)/O(n)]).

    CHMaps
    implement unordered Maps via chained hash tables. ([a O(1)/O(n)], [d O(1)/O(n)]).

    The different implementations differ in whether their constructors require an argument specifying their initial capacity. Initial capacities are required for hash table based Maps. If none is given DEFAULT_INITIAL_CAPACITY (from `<T>defs.h') is used.

    All Map classes share the following operations (for some Map class, Map instance d, Pix ind and key variable k, and contents variable x).

    Pix-based operations are more fully described in the section on Pixes. See section Pseudo-indexes

    Map d(x); Map d(x, int initial_capacity)
    Declare d to be an empty Map. The required argument, x, specifies the default contents, i.e., the contents of an otherwise uninitialized location. The second version, specifying initial capacity is allowed for Maps with an initial capacity argument.

    d.empty()
    returns true if d contains no items.

    d.length()
    returns the number of items in d.

    d[k]
    returns a reference to the contents of item with key k. If no such item exists, it is installed with the default contents. Thus d[k] = x installs x, and x = d[k] retrieves it.

    d.contains(k)
    returns true if an item with key field k exists in d.

    d.del(k)
    deletes the item with key k.

    d.clear()
    deletes all items from the table.

    x = d.dflt()
    returns the default contents.

    k = d.key(ind)
    returns a reference to the key at Pix ind.

    x = d.contents(ind)
    returns a reference to the contents at Pix ind.

    ind = d.first()
    returns the Pix of the first element in d, or 0 if d is empty.

    d.next(ind)
    advances ind to the next element, or 0 if there are no more.

    ind = d.seek(k)
    returns the Pix of element with key k, or 0 if k is not in d.

    C++ version of the GNU getopt function

    The GetOpt class provides an efficient and structured mechanism for processing command-line options from an application program. The sample program fragment below illustrates a typical use of the GetOpt class for some hypothetical application program:

    #include <stdio.h>
    #include <GetOpt.h>
    //...
    int debug_flag, compile_flag, size_in_bytes;
    
    int
    main (int argc, char **argv)
    {
      // Invokes ctor `GetOpt (int argc, char **argv, 
      //                       char *optstring);'
      GetOpt getopt (argc, argv, "dcs:");
      int option_char;
      
      // Invokes member function `int operator ()(void);'
      while ((option_char = getopt ()) != EOF)
        switch (option_char)
          {  
             case 'd': debug_flag = 1; break;
             case 'c': compile_flag = 1; break;
             case 's': size_in_bytes = atoi (getopt.optarg); break;
             case '?': fprintf (stderr, 
                                "usage: %s [dcs<size>]\n", argv[0]);
          }
    }
    

    Unlike the C library version, the libg++ GetOpt class uses its constructor to initialize class data members containing the argument count, argument vector, and the option string. This simplifies the interface for each subsequent call to member function int operator ()(void).

    The C version, on the other hand, uses hidden static variables to retain the option string and argument list values between calls to getopt. This complicates the getopt interface since the argument count, argument vector, and option string must be passed as parameters for each invocation. For the C version, the loop in the previous example becomes:

      while ((option_char = getopt (argc, argv, "dcs:")) != EOF)
        // ...
    

    which requires extra overhead to pass the parameters for every call.

    Along with the GetOpt constructor and int operator ()(void), the other relevant elements of class GetOpt are:

    char *optarg
    Used for communication from operator ()(void) to the caller. When operator ()(void) finds an option that takes an argument, the argument value is stored here.
    int optind
    Index in argv of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to operator ()(void). When operator ()(void) returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, optind communicates from one call to the next how much of argv has been scanned so far.

    The libg++ version of GetOpt acts like standard UNIX getopt for the calling routine, but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As GetOpt works, it permutes the elements of argv so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order.

    Setting the environment variable _POSIX_OPTION_ORDER disables permutation. Then the behavior is completely standard.

    Projects and other things left to do

    Coming Attractions

    Some things that will probably be available in libg++ in the near future:

    • Revamped C-compatibility header files that will be compatible with the forthcoming (ANSI-based) GNU libc.a

    • A revision of the File-based classes that will use the GNU stdio library, and also be 100% compatible (even at the streambuf level) with the AT&T 2.0 stream classes.

    • Additional container class prototypes.

    • generic Matrix class prototypes.

    • A task package probably based on Dirk Grunwald's threads package.

    Wish List

    Some things that people have mentioned that they would like to see in libg++, but for which there have not been any offers:

    • A method to automatically convert or incorporate libg++ classes so they can be used directly in Gorlen's OOPS environment.

    • A class browser.

    • A better general exception-handling strategy.

    • Better documentation.

    How to contribute

    Programmers who have written C++ classes that they believe to be of general interest are encourage to write to dl at rocky.oswego.edu. Contributing code is not difficult. Here are some general guidelines:

    • FSF must maintain the right to accept or reject potential contributions. Generally, the only reasons for rejecting contributions are cases where they duplicate existing or nearly-released code, contain unremovable specific machine dependencies, or are somehow incompatible with the rest of the library.

    • Acceptance of contributions means that the code is accepted for adaptation into libg++. FSF must reserve the right to make various editorial changes in code. Very often, this merely entails formatting, maintenance of various conventions, etc. Contributors are always given authorship credit and shown the final version for approval.

    • Contributors must assign their copyright to FSF via a form sent out upon acceptance. Assigning copyright to FSF ensures that the code may be freely distributed.

    • Assistance in providing documentation, test files, and debugging support is strongly encouraged.

    Extensions, comments, and suggested modifications of existing libg++ features are also very welcome. c_cpp_reference-2.0.2/reference/CPLUSPLUS/glossary.html0000644000076400001440000000303507055335116016365 Glossary of C++ terms.


    Glossary of C++ terms.


    o Base Class - A class that is inherited by other classes.

    o Derived Class - A class that inherits methods from a base class and add its own methods.

    o Class -

    o method -

    o Object -

    o polymorphism -

    o SubClass - See Derived Classes

    o SuperClass - See Base Classes


    Top Master Index C++ Keywords Functions


    Martin Leslie 20-Mar-96

    c_cpp_reference-2.0.2/reference/Makefile.am0000644000076400001440000000022707055333524014277 EXTRA_DIST = AUTOMAKE_OPTIONS = foreign 1.4 DISTCLEANFILES =inst-apps SUBDIRS = C CPLUSPLUS GRAPHICS docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/Makefile.in0000644000076400001440000003232107474405126014313 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = AUTOMAKE_OPTIONS = foreign 1.4 DISTCLEANFILES = inst-apps SUBDIRS = C CPLUSPLUS GRAPHICS docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = Makefile.am Makefile.in DIST_SUBDIRS = $(SUBDIRS) #>- all: all-recursive #>+ 1 all: docs-am all-recursive .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --foreign reference/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --foreign reference/Makefile cd $(top_srcdir) && perl admin/am_edit reference/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) GTAGS: here=`CDPATH=: && cd $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done for subdir in $(SUBDIRS); do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-recursive #>+ 1 clean: kde-rpo-clean clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-generic clean-libtool clean-recursive distclean \ distclean-generic distclean-libtool distclean-recursive \ distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ info-recursive install install-am install-data install-data-am \ install-data-recursive install-exec install-exec-am \ install-exec-recursive install-info install-info-am \ install-info-recursive install-man install-recursive \ install-strip installcheck installcheck-am installdirs \ installdirs-am installdirs-recursive maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive mostlyclean \ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ tags tags-recursive uninstall uninstall-am uninstall-info-am \ uninstall-info-recursive uninstall-recursive # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --foreign reference/Makefile cd $(top_srcdir) && perl admin/am_edit reference/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/GRAPHICS/0000777000076400001440000000000007474405232013527 5c_cpp_reference-2.0.2/reference/GRAPHICS/ptr.gif0000644000076400001440000000137607055335310014740 GIF87a_,_k޼H扦 Lm΋w L֌ʦ@T*ڮ7ǥ0ޘl Ͼt輎Oe|X%"G(dxq!@ؒɢؙhɩizyjz)Rk[l[{jȄ-+kM(=< |=^=í~.lM;~¨j|o7hc#/U?SY',s_ƑD0"ҏI)ij2˒$=1s[I9ّLϋ@Y@iQ4򰊆 ,*UW|% Nd-IP6lH}Jջo_xH(E\ NJ32n|f拆ah1͗J9/Ћ\fd[n]6ᅊ"dB˕&W=iϾH,:RY}\FԞ; r%?Q}ֱ eh%cN@1tzBWa4|B!R$QK|Xĉ8IaLC[PUwZhH|SP֐M8wQ-t(GM[8fZx\8}fQ)V,FAo ^)'vygɧ'}i>%YjP&*JENj]馇x*颠."K‰j*;c_cpp_reference-2.0.2/reference/GRAPHICS/master.gif0000644000076400001440000000225207055335316015426 GIF89aL*!,L*ڋ Vؕd z1G:BX_ DWjD6Tгa]K4 !qci|Q5  -\_g`'H&rX২7'7q&YSH`%*vjyש:xi Qvz8+{& zǪ'ul ](;=;ȂpSmqZ <`r!uLPޜ/,;Q^7{Q̗a8t`_au ; qw= #Yxacb饔`8S2XOF( 7)PW&tqHOM,J."*Q2+S:ReSίYAGhԫvu=if&Jz=sZYkUf̹0O-*5VظT]oWmGܥҭj7pgB[;un)׻=Rϧ}kisMlf[@Yv w^dα3!h9]}q{>tޅ5l/HЍ)GZx`w&θБؓj[)ya%Yl6"۔If!tH^uxb]ʕ!B!#I&ُѢ\vNyVAVК,A`N L :Rι_Jy\opb4[ClX:oPhin"}#:ѫKIBמb "Dj h. ꉪrS>k>#Q"~*\bgb,[n2Bj-j^<-+bT龜Ks.z7ƻ/m^-&lCH!fg&WLB}|{їm w<3F6].{VcXvRI +y g*~pj/v\^f'V N9 yfHcV}26#9[B[S3gcLGZ{gA]C+$Co9%rl:xu fj6P;c_cpp_reference-2.0.2/reference/GRAPHICS/blueball.gif0000644000076400001440000000050607055335310015707 GIF87a14(!޿eclcGBο{{Ɓ{ KJ41sskcZZJJ,k@pH,DKD"XH\ @N9%`tBBh%yBw&("B!#%)(E$$'(E"''"CD A;c_cpp_reference-2.0.2/reference/GRAPHICS/redball2.gif0000644000076400001440000000051007055335306015614 GIF87a{BkJc{BRJB9{9Z1{RB)R9)1!cB)ZB1c11Z!Js1s!JJcck!1J,m@pH,Ȥr) Ay$ "A x$ P`pD$bQGァ@2v j !"v #$!%v&''!(B ""A;c_cpp_reference-2.0.2/reference/GRAPHICS/function.gif0000644000076400001440000000201607055335312015752 GIF89a1*!,1*jڋ޼" B>f r,gp_%Sno6cDžV&e8%q@XyGrsiቅ 8Z' 5yB!뚥r+ak›p; U"XvkLV: | 8"=Dv} KGP.nO#. @IVQ30" |N:ZdaȀr,v2Zt,V@.7mt#XgGEpн=-lesBL)]F5tW xr)$\t6.g2yc K(psfV4u){yӦk[戼b]fRG<|;g :Rxew]}O؇~鷜dWayqӅ^s?@("cEGy(V $ŖkMW%(`6^n=U]Xwg!z"jb٥h Ng n3>XHl%F*"$IOdbm!x$`ܕ%wl/ҖᐇJ8ZoBՠhg~£gVMxVɹ`s**f݃i}ʏfTrg%}$[-c7N*'_mI陨~ys'QfTJ>8FU9k ;鍵h9f(dE7[W#GƩ&| k-"{Rz))ųD Z(<3F&I5-~Bt[K~R)d钏' 3=ăvH`{iZ\;c_cpp_reference-2.0.2/reference/GRAPHICS/bluelne.gif0000644000076400001440000001231607055335312015557 GIF89a? f3̙f3f3ffffff3f3333f333f3f3̙f3̙̙̙̙f̙3̙ffffff3f3333f333f3̙f3̙̙f3̙f3ff̙ffff3f33̙33f333̙f3ffffff3ffff̙fff3fffffff3ffffffffffff3fff3f3f3f3ff33f3ffffff3f3333f333333̙3f3333333f3333f3f3f3ff3f33f33333333f333333333f333f3̙f3f3ffffff3f3333f333f3wUD"wUD"wUD"ݻwwwUUUDDD"""! NETSCAPE2.0! ,?  H*\ȰÇ#JHBp0ȑƌy IDtYr>2N쇨#ş@ JѣH*]ʴQP}0F9BO%|8SIVpԹBNʝK.Aix˷߿ LÈ+^|ؕ4Lj]L-3f0CO4dȌS^ͺװc˞M۸~\XО5sެٳ-QB4fNiiνËOӫ_ϾxHw>>w6#ُD~a$ނ 6F(ᄴc 0bxan衆 v"H#h(b0(3H6 0c#D*$YL֓ NP!E=b㎢9)dYfgݛp)`ᵛ`u*geiYL` 'ZeXty9磐F*餔Vj)cuh_J\hi d0Pv6zz鬴ʚ]ApՓURUH2.ZHɓ(S\ɲ?"3v1H.sɳϟ@&L"~9Ño&HJJ*AFv\ڴSVÊ *ٳhӪ]˶۷pʝK7+BxhK߿{KPÈ+^̸ciwo`- ~̹ϠCMzmɕ GKaTc˞MiauINȓ+_μУK?Φ:HHh߾;LOӫ;W_O'X&6 >(aB( *tX ӡ NPa_B"2X38n8!X)82cP>)g啉)"}u"`oaihJ%!zq 9~x睄_*`[fx碌2^ JT[6֦d"I#=S=# CH NkNέizjEΚ&lDѪBTԲvSd<+CL{Of{#޶i@! ,?  H*\Ȱ~IDoL/#o~Iɓ(S\ɲ˗=V̘qcG _ɳO9B"|8QϧPJJȠCfD4#ӦVöFٳhӪ]˶۷h] F]*0kܿ LÈ+^̸rū7/_-~~̹Ϡ\9/^~Fװc˞-x0NMƴ Nȓ+_μ8H#!AzuHkgӼËOӫ׎ݺ{۟O<0cǯ?蟀h` N8„`a=: 1(1 `(.x")(.c4Ψ c:haVxav!~>6;BoTdZ5eiVdi晋]IH]Y°^bidy`Nn&袜iW%ƨbeP PO=p 2`髰I8jAz NjP^*>`*>2tE>7 efNȒ =JKDlkk@! ,?  H놨!}cH(q~CǏ CIɓ(S\ɲ˗0_."E3nɳD!qb>l^ЧӧPJJի %JhRKbE(ٳhӪ]`ȥ]rK߿ LÈ+^̸ǐ#Cv /]uj˷Ϡ򵌹.]~Eװc˞Mm疆qZnշNȓ'gs$$K lkνËOӫ_Ͼ=է˯{˿_?߀hLx$N`=DX*8AŅN(v!($"0b35(H#>Yb~(G(i JHjcFx"iA` Yphll\0ejǙoֶWjZԥD oqk}6裐F*c%(IEP PO=p 2LP3֬j+Jz뮼 CZPJ*>*>2|E>9v,C:! ,? ӥCĐa#JHŋ3jȱǏ CIɓ(S\ɲK5Hj̇#M3JѣH*]ʴӕ9B OhJׯ[!DhӪ]˶۷pʝKݻx˷߿ Lp[Wekōv GKYB3k̹ϠCMZeȑ'oEׯYfC6۸sͻ Nȓ+_μУKNzڲ[Æ-ۉ]*Y o/~߯ Hև` ~ >_&Ha^Vaz1~h"*ha'"·zNxxyZtV~\VڑH&L6䓄)Bb=xAW*`x@chlfYmi` 9]#=S=# CFCO%袌68:*餔j4"5ɧ JhA #VdC꫰*묰Fe(2zU@!This GIF file was assembled with GIF Construction Set from: Alchemy Mindworks Inc. P.O. Box 500 Beeton, Ontario L0G 1A0 CANADA. This comment block will not appear in files created with a registered version of GIF Construction Set;c_cpp_reference-2.0.2/reference/GRAPHICS/whiteball.gif0000644000076400001440000000032707055335243016106 GIF89a3瞞YYY߶aaaIIIqqqiii!,T di0tª@Fp8nGh<$ʑ`aX4 `9N$xHDܖEBy"!;c_cpp_reference-2.0.2/reference/GRAPHICS/directory.gif0000644000076400001440000000056707055335306016145 GIF87a@@}}}u8,@@0I8ͻ`(dihkಟ+ _- S]-:&A"`z̐vK~! \٥Vc|Y"nzf4iuwq~k[y.obzeǯ\Èͨv6mҩ~؞ɐ◑ܻvU j~V2?;~s9A) EIGȃ%MkH1jt3 ΄̎.raIN7me*!5?,yDXҦPJJ ;c_cpp_reference-2.0.2/reference/GRAPHICS/grey.gif0000644000076400001440000000035107055335242015075 GIF87a,Ȅڋ޼H扦ʶ L ĢL*̦ JԪjܮ N (8HXhx)9IYiy *:JZjz +;K[k{ ,N^>[;c_cpp_reference-2.0.2/reference/GRAPHICS/syntax.gif0000644000076400001440000000157007055335317015464 GIF89a6!,6jZuHUnpLmRxEpĢ[mP5`KJgE>]ԮwjfB2MUG VމvuxWdhWh#Gx&"S(2b٩WIS!Z:7ci'[73{AHd.O+jRuWzڪ6޽tJ+BR )k-> *ܧS"į3ߕ(O&D@KMq )di/Mgir&D]Z%OPЭs*u9'fjiI|~H!+7OB%7Y@eWh?fؼs T夙Q1\7`o1o.{'/NE9:ne M;+V}pˉ/x-N6={җdgM%fO<+SEwPKyǿL ދ^~v_kE}9w1^jiV}^(5]l҈ǟ]ǥa<48IS!y`~7˔R |#aUIh>8$(>ԝk c erc]rdo.Rqe^NX"O %_*8Qus"r%q<; 2`$уٗ$YX.Ti'bnYڥl RjaM>5ˠU]:t~b!VLLBN{^-+[fmx nK.2Yn9sRKp޻Q;c_cpp_reference-2.0.2/reference/GRAPHICS/mart5.gif0000644000076400001440000001342007055335305015160 GIF89a]iII{x_sfinV>YB78[JqGLi_zrdPVGPJL^JY3M6G_J?oVc][b[U}awcD?]Y6ZA[IEK4F:H_QAGgAj6Ks>1BngGk{\\zcg]{wjydukrftg{tvt{wz|_x~i{i^{mzxw}nws{wu|y~vtgȧuzn|z}~iнIJňqr}u׮Ή؋xjǽƽƵΫвֵDzǭŷĪѹĺȟзzrΝͼ״۽ϲٹ㫲!,]iH*\ȰÇ#JH3jȱǃ(`SNTA <` 8PAτ,\  4(P C `XP`AM3(`kM9lPj֏@p@C"!B6h@ 0x3  4!D0c ` "d`!28;p ,Ga4E !.BRnzi`x9oPpG^`9떰† `-{ = !mp6s0 B$H Tp-EDAD& IGk:@pD;@\C;4Q+|!D T@aNù`Ea Z %,Xe c AU| LA @!5R}@& (p2& O8+`@(0 q ţ0@.@f" @@dh0A ^XCP(```BH=(f0 |7 q@:ء*HRn#P0(AE`.d D@0<x(@j$ [k`' L BDLzPt! SP7  p 3`Z! >8G3hȁа\ I0F>d 4j;@Ҁ @H)<2 `P<-7@$I!ґzJ&Cy4?z&a'؀b<,^4P2Ь% zT h@M bAP@8&c42@(ZҀ < ? @B@!r"a0XAzp2AH @#u8P A c("Q&4H!tP$pV'h @L@'@!~+P3GWY s?c+p D &2YF(338afcRzGY R`/k@[Sw `dg81a5N@@@`^3@y" .Lr zpz z]J`d`A}fJP*JUI@'@w2z* L8{@gb#d`~uT@5HY.Hz3@(J,V  j`C6Ђ] *e)NX&  p ]dV X@q @nPF)А0)4+ 8^tP 60Wn ;>#0L 8+  N TP8J ?AU) WVisi0I$g.&j)4h0=NP`'8Y I(4p0E4H 45>4W`#A+@%9( p(Q0IWpUdCYhHQ@IAD y 0N"AUpD4@'[Pp-PmN'b(@p6F :X '@PfTW b% JR@jp+0*O5`bjN zH8_-@pi^p T?pۦ \'txRP ^?X M?d o@ _pD*hjP 0R`P (`r++E v`edpg00Z0> 45o 6Zpf` dP:Buov;08& `i 5p PvPtc y p p j) Rp :@kepuz ^ B0 Np N` `0bb p @N`ee _;Y [It`;IPt p@P * `_Pp@ j "u `p .` GYk@t{ j:M`0 F } P %B | 5k @ Ӻ _0۶ %{ @ѷ 0 YAE_P@Y 0 kЮ;+pu P * 0 `L'Frv@ v4@ vV@ &!} P _gpEK 0KG 0j^pwu , O ZK K|0 C[ P i ` { P @ pe Y]3;wʿ u |`60RLs 0 0PpP ` 0< P 0:m Te0CKs  `DZp ` `p*A  @ C= wJkȤǔ KȲnu@ ` p ` põ  0 0  ~v@~`6 M< N1 D.эs0.'u0~~~ yl.?N.~ "?F;c_cpp_reference-2.0.2/reference/GRAPHICS/mart7.gif0000644000076400001440000026304607055335303015173 GIF87a#Ĵp  ,ȨDxHT0@@DXLDP$0PLT0Lp\Xl\(D<(4Tl8pLD(h`PL(H 0$,hxD,dPԴ(@L48 ((Ȁ4@ 0|T4XPH\DPh@<0DPLDH$TXȨDhl `ܐȠD< txx X`\@PxxTXl(,t\, 4X4@0̰XH@DP4x(8($,D@p\P\\(`(hXTHLDXl ,DP TX\P0`LTx̨x ܜ\ ,,480phDP`,<(4PThШX(DH4\Dؠ<PS\tk -k(2_kD"@NydX(tD %];H621p=ŃSzKc8M /HB* TL k(">WB8mqOX!$q Oo νNղԨKrxUZ^ RZz,B &mLn\IfcM.MS"`|o%_X#SV5tF.`䁏.pq%Q t-=Qd +$qg*+-|oDx"G\b8${}YK| ;cK6h1\*r:@zzGURI7dQ*ػc+ԊzYY41'F'"FE4IkxBLFk_ rQ  ^{1 ܃+k%V .4$.HrYX/ q *Ic> \'xRr[0q q Mт[/A _)lzs5Ӭ>Y5( hia&V2!_Y{; l KR_ VID 7h0qP p i EH:t+osbodeܼB-p'uB C@,1G֢3TG%S pQu&q=@aC58,K!Ap'4`Č#-\Հ@^q0!;4(,b7S=V GhH!L`DP:)$y 3SB{DZS@>fI[@%GHӾ>@#x .|DJU@D(BE eMňTF w\TP{ ঳&YPt$@NV@ ;Xh/A1pE#82ECI2w$pVvJ gd<1w('3$28ȡ6YbK/BE!#P}U_UpDc W?i4!hq|łpg%6iAP*F%WЭG^ Wd$b(^"FZ8b W@]n-hqpCxGTd 2K#IVzUl!;܁ z j>RV -F,urr|(W$^_|HjR.|QqB\5E00qp M$ݬz+k{'LMZ(g{mS1*d+ co&qO0VZ܃M?+ay^ X c "wHiLR81 ZgӐCF^a(<>"R(*[DEFr{#d CV*)LNʆbQgnCX!-p%B}aq] "'$W gg8\-yp<<5n.*i/:tqNmjT+4`/Ϲde"@ Ȱ0 pK]=㖄xQb'cm6OWmȹ>{.onrHlHK3 8Cea@G +"-;` *E"ݘ&]8L\p7e+IgJY>0q)L$qXQx+_aYtQ?Ip2W s4/3];Y{`WGps"$'4+3(0w2~UW{[@qp'0'0 O#gXsta$ajt3!R24A J r0*-w]~4F|Nr FPv!,4eZ%b Z,Ų9p aPh$j/Y>+p$Ps|IwX pų.bx Bb18ms`xQ<Hq g %OX;FgzwZ[`Ų[$pkEb=[pYk$.1@d `4FPVMvIZ=ERV/(0yen#R a={4>g%PH۸'XFE 0uT2;'EtyM'Uq >1*x")zÀ-y0 ycc1%jQ 11,P44=` zd ِ  301dyD &%oH1C"J a^R0d@ QaW^ bg/P'GPu0G  X`{7%P wb(M1'ӐbIuE1P| OqrӣOw5U&à -Z+RWF .-.4 {p *Aҳ< `HD=EmD m\.Q `U#D #0(P֦ vi:"4^$11Spp1 5((F[C'a#3'0EvyP =Q  07U3PaҤ5MJMqwœ32^qf#0kcZ,PjL2 qd!,=p @Pd0 %IfCC!?&#pHb!tZ ECc~jmy @ ?TGbfx#B];? Z1ɀ;D' ( x=PDkea(D[`FA`C8 A)U:ƹ3O )?ZgSb? "GJnAp6ق O0bQ S I%k X1 u5$Za%B9[;DC:TF5_ i8E *Nb&F*;  2op n9Ȣ6L]#^!xAOPO ]a`roӀvۺڵ[qQ*3s"i&*AyR"kbo Zm{12 ?svQd,\, Ŝ P!ΡrpĦ"L,j3,\]bI"+ P fv;;6+ N3B D+4V!sPg8R0C'G ЁyrQP:Z#p#5F$˰I!S!sE ^ G/X ERA&&3 `E !!T[C*|QwfAl/SRt>/DL!S 6 7v6р )$ ~ơ.[8;+6/ 0 w1ױKp iDK2ršۘAOMdq#qarѤѾn̾K+etI?)/P g -p$h:v-ep!Ua&pC|)ZC! !Z+"R?VUkU5fu IrZf:.v)Yyg p' 9:OsBxHk1q(+T?Q ?Ex :uLs,%a,=+WGh,][o! kP@@?J|Rp60Ȋ+?(!PڑCluP:| p 2ry@0N/ηA. 2 q׋;R &YD{q <4  L3e]&B8'(z 31q `q`\>u=dp5Pb0Z>?g[h1 \p#`=#oCp0cl&Fpiqi࡯g6c[᪫  jCl6d! / $Lą`C BGܽ'tBۈ$MaO ~ B bqoAƅw,3Eʿ%,#ߘr 9 !S_]vkAOd5*jGpH#[:,z+;~ )$>H13+ց*NU 9 O($2(H POY`d !SwQr|[K !_P4W  ?Stѥ0moS[a!KXk0<YGq0u ¶^1}U6"MR/ Hg`1gy!1G&԰4-}4FD aHt]!ǁ滭޿y *Y0 pΈpg9j2Qr $ʿ=IW%??; |H5YQG0t$! ^bXBNc^p"C&Ds[Id+f'Q+bC@[P  .@6q:pex{2D2#W[ /#ptpsUP\0YW&Z53[6"\ojɸpWXoxKFR MU XQft/pZEP'%wì;V,T32#y zsau]p#m5aI"4+>-Du ``jL-  rڒR\𵨴%X\*ExW"DI$VZ[  !Um Wo -^Lڲ%GoM>ʍ4.UkSnh ǍZ 7Ixj R E-pzs=.q<maob@ 59{ТKwL:P;_$1dlgZHR2g o9"Oo+҂ƛhƓ"oi/b_s"F^, ָR+45 n6чrc-^@N#7!>,p Pajp{&">xk1©0ⰿF-o@->& I$)wD©eZAp4{@K <#4F]!`\mZΨ-)hHEpk!:I`.$O \{㍔ IyɶgQn Wf p 0-Dƙ&"0,G#|$J* 0٧*q$pJylaB E+bBsDHn`$G rHIr[p,jp,EPc3,ʹ3<M #ƅ*,d `䐠h"IRIH@ \$&ac\pѨ# `z$)hh"PgU @'hq#F#\!g"Rd5l#e3 )pt&Ib!0h.%kn|-BV^$Ohi gU .K0SLRL@ѥJzGK-z$Ʌ8",i-TR鹓ah Mu;!i:in w8+gxu3ʡ':AB!B@T! ߶%9"ZG)qF-X)*F82D7Qih VI;:yI3L .v&03`n" qB3df6R*u7O2gN*F -<@KNu4\ w֌%t `hpܢIIJ,KDhpDuFw#kҫVN(¦@<2.0 C0G B'iP8/$Q̊1M4ьf5`>Q)(DJ* A%q,?XP'(h< ࢎ(H Y "7җOP8Jt'@up .i! =XId7[ R *4B De=LpI*!s-B8BHS%59H<Ԁ&wdJwZd8=l5VbfŁPO*)moP"ƣlz@2@fq˂Gq+ƒa%O:;p ŭZ 5Y~,"ղ">DNqD|ՂG,Ui"QKV2^`~Ƞ)vr,[F ܔ5)ARaF I=b0 $`" Ru_7Nrxi;d(j 'KQ5[&V>@H'_:/wq0G8BaZTsU ]D#-ӾB Eْ`遚eA$\o$1/>c H$":)虤s4|XP@L\hzf\ T @0b8) a  I,C@57T^ieP", ,.ˆ{c{/k)Yň1'gP 5f)w }2BA2Nh&Q|9hҠ[h}L" @qS{A8o P HfU/@vn[1(G `řގr<1`1ra Kȼ/{ϊ!\ @X?p.XrSxpH+3?m  |эRz1H+Dx|xGa p9:DȄ.ԃS|ǣ_`E`5J8:桧8`(Zc Rdp"HIىqIт*ꨄl/I3  c 3z܀* pATSEI,˿t*Pm, ph.Z ti G8p;,ȭ-"2=*9xtL-`LTTАЃLDQ;xn0u2IoH\K9TE%i"(IP5h;_ 0؃ۃ֧ ǒ(Ul\+Pxؚvn36zU0X Mʏ/`>ȏx$Dh1]pA-"͓+u4X҅TSTn`%Oݛd3YRuWo؂o88a~U Pтa\T9!Nx=?_Ѐ;P0ȆQK8R ` <Z0<8r{8 #ЈۿXG*Y⚩/RT7@>*RlGxqGDx,H:9)G T28K}IHPs@<0%$9:oWPZ(\ ۰<ϕ+:hHAa(apX(F#e_Zee8:2XB[׫01J/ & (I!X$ÐRU*(݂{xv AHXI)Hp1?8=A)&O7qpR3¡5H a.Kn Ф!oI'8mn Ds<:) #љA5wQhP]c (;HJ@^G 2 0!M\`&!m,h/ʅ苦xA,3x ڂ؋y>]ތ\p= ȑpΓ\@aLX_xpHScx]T3m 0N^4߶N.V0XڟBꆗiuP!pRʏg+HV . 7#=` F8 !x+l'М&Ek}2xxშ&X?}%lZ@WA$InaXa8]S؀EpH{ <4ߥ#uBI]y(MV"w7pӁsd`#)p#(TH[&5 `0ipp(:8nȓ?Y(d9 >p=lk[*` P"P0>a1 p15>dnnԥ._UQlu]Y i84Xc11pu⣍NCA5$09FuVq#G5J1H[ a8%#C*3]m{p̨R0=qII@r8Cp17q0,s(#P:>1˰RߐA ģ.]]c6s ݀aD7W(` mWG3U\( 9MN(^_mC=Igj@Z[w%\9+0ɾ.L:nZx%6mpOnqP"~h7[!1].x,XR?rrh)T໾s:XG֯`>s ]W~EoM|Xxx4rNX `(I2>1-!WBŨyJ# W*S܂t'|!z X)3d2}|٠?ɝ/YXp3nP8rHD`ېE]a3H3Ʉ`>Ny(쁮[zR-Kgbx3Z %XZ5s ~h!ŖR^ .E` gt>4 E4ymq\ƨycKJ4qmhx"> P֓"Eր{( ԋ1V冨q|; ԕ-4'r7'ǃD^ɔq )7nPe9C`KRYj̭- ^N҈sfbWq\h “R$I$F ,oQGђ:K=\*K5Yjmi`].lqF.-TRD#N\S`b!PD [|SeDU<sUoB%/ oƌl!ARDP78{U "&㼀H/|E8=14I?Qfq4$pRlc#4g4yp"\pA'AJtL38g)CnQ^URw}@vxAFyw%X%-e{R7$`-HQJ.gB (҉"ѼacD$Rq0`B>E̛!f4Mkn;`,B 4ܒBC-\1C)7%9Me͐M&48.VN7,("ihrF8Y8~Y`(D]%[CN'0B <L*)Z-tTRIz]jL> "de2TyӚfcdm&yFYLCko8Y3M-C^AHt(rDI@ .RXTU pKuYhGk@z ī#V˗@Dd$h $ D,'R!P(o[vht"ZH &8yCξ"<"8]KZZtOA_9B,T㼃BbasG8ד 5+dF"H*i\Q ,,J"_ ,d -p\؝f &D>F@܃`B%R)#q E(`=T#b ,U 2\"=a#[ߣm#"Hچ& p^oX] 5hAEYM"a8!E)Q G@ђTёDa VBMD1!W.c34IǾ!v9ֹT8!sLB>)/7ׄ#Jc PR>WKUB¤3L#g ;> 5\jieWjM A:q|#=̞p<$C GjaQ0N 0`n9ą ggGE!?Wxdhɂ" 9!4@x")oxA.`WDa)HP.B"#&0i4 b"N8od6 T|p4,Ewsd8姈 p I-,W""X.$9HRDf ZG*kYt18ZrP>r8,c``dZ+eƒ$䈤ŀ\@"dn0X*^xpT)HRpŜR:~Al0C(CgLH"Ip 8E{`PҸ|Z^psdϱ$|80hZHB.0 ,)*%3P%$ A] ~pRzT@H\ SŎܕ6I XmAZ]Xt4Pjh+xP.;NDސXac78Q`4$֘$G8 ZF|A|`8$( E@BtT "˜B+`D+pRZōH ăT@$-BUr`D(A9K _lQ b~ CZ=Dy~@ ҼFa$l~1~>Hf_%(ԃb̔\4<иB.4p$+>|xa􀊮pDPj TZ (/Xp ʱdX޹X-XX'߀$Х8h @E0A0=xD0` @:8Hm'c`Gx Eq `S̙E|C%ċp4C -8@-F- [hija#fYW I \HY=f) V @up"";xa07\% T<A |-`-`^̹tULn0|аZ= \5H_(B \c}`@-T-I@DÏā p艾2XY mɧKE@F."AU=Edۜ=-^N$VDhzyzM0hĮEĠY]E 8Ȭ>$[eKEtH-SK^{$ mQ|E(0k)jhJ -ҌCBB2xNp|yTj1݇͹$;XTܑE\4XAR`^ǕxC(Z1T^!""p + }$-J7K=1yEr28,?G‰$`,t@͉" UOpYe`]pOV0h8,9 YK(0^G[".(CMUeOG.A8.D@M=~u΁Zߒ zU< "U.d np3Ij']B. # I ,K )BZvB4,CG1.lxKmxxjeg>kGli Hחp^4I셟 J W0 A%h%"(؆ut@ASPEA k◸B*;3Y)|B46Sv*+C£Ke݄IWxtsHB$7@@dA4=A&B%@c*C>6dj̒'@"SJKSZVc͖jcRECf)JGm<9Ad7lA-(- @uĵ.LӘUi\f +*TOrΞ0C(P0Q4ܻܰbPD߈B2 IfT4SAlA(˳01!nDKbqȄQ(`}ŠQvy4HXN}ˏ2tISA+ ܸ'FI(ױp;L2hp)9:\_X0^JUZ8d㔋S-B%(X$^nqiuֳWD/Gp8 l%H@3 #EAEiy]|HNyj 'I4T0+DhmEiGrn@G(lkO$pԛ px<،땷G) ;|R^XP]. 2'Ll&#B|N#D(8tPh`S0ʑ'$CgG!06qB O9띕D2`'JT f GD|pj҉&.FJ|Z<̷#@6n G$V;ErmiaR 0S:+L02cȐ`ƄoܷJWhlQZQe93^QGN۲%YqF%:jU2!BPH" ElZJA{&XEcaI[$y!eJHz Ñ`"p khgX7hhi3^{܇J4^Zj%W 1 4PB U+FZrQsZ%pMfIK AnLđҢє.2=R(X})ӶiMB)-|):Z渂)b*$.I$I1Εz3zA7*jRTdQ#^pa)h hP\ZH iE޸EZ`-YJ,`XZB!ɛ;P\Màjyr;3,*DE\3΀Nh@3IZ P):2%U?z =* !,,*@y"R`"T& LZ-Dʕm˸3\xED4^.J(3*)lz(A3겅&I/NJ9cl!JಈLL * n{i4kJH,pa DqH*3rgjb)^7WⵞlaLVdv6S{[:#|!Zud'ȕ* &hlPYi"`lKf9*q 4KH_xf U`f~$`!hNZBg1 kb#- +G4x)q-0YdâTz2apWIUc5K,pȂ:EPp)kBp 0h4x(膛#`b:E$~VQ&`t6(gv)Dd '‹a XqzT8'8ntyUsHb .pΰs1yo*+@,-j8lB¤xw)Ō N%{@ atd#4EO? /iEH#ydK亷 2'D!i(dH w92ͧXWUF?BD8I#P'"[TB"r; If+>e r $ l;{Af2F!@D <8 p"~HҊ$bH#hq/2yR$|_hFFr Ha  B=ndqAjAy1E.(Jts5F!E3m)I!ɐDdDD70L,; E+:փ dŭX +[}zoeF₁`ELa- &DD @ Ek/C#|+$FzǕiDTq|xB E'L<]JZ\, ц`RX|f-"q?\`+yC#Si:1x_3-[b!D YuW9bPsz0Aa"/ Qs`Ip#@F%M d~,TEƘ: WD%VoNB"A#=F^襕kX pֳ畲}q q1 @HhW\F;ʇ3> W7hHAͽ)&2a)`RGNJ#%adDdYQ Lͦeu; eFsw"yH:m\aZL4&"|g:.nޫ,L ]E8 Y*dsڂ9\Aq,/+J^t.*DzdsjO`` 2% Ch+ Yb8*7\ NtpO` ·!$%0t|Ƣi$A8a XI $6B䏧HR*!,h L‰Z dr *vscΠB|`<24jC'+sh* b nrFO8 mjA KC,k [@D JGG'h/T<`*a P%ݦk惺) *Y:!:.#Jb$4ffzP)Ă)%r m4O nx( J)^fj! ”D3j Q" `` b !zȡZFb7ƼA+[4DqfrC(y,*aE^-k.>R$L$A%a -r~@:2!+A3n b!n((t@ ĻR9 &00'8go\ar`c% \AC$g,PfzX&}@ iv|ɗ@Dr*4+'G kMcqBG0G)z"~&B3ځ4I7.n⓺@4h@*i ` P 2XoҫLH_X `9z2gJ c,@ D:@H-l8&6  &d"Y@K:Ÿ CFvR`  ^(v(*c\FG3c)]8AD & 3L*=sU Sp \ /20@"@R > 2_@ր&z"8!8 |& @a.`%7dXb)$e)d 7ZS. 1 t, bKX ^b"6'("hVcDbrAR*ncs\ V`<|[|#Tgz vc߅n,фó8 .&-9.HSaǎt$@,\88tC`^@0 ٲ>NCBvJ@p2 14t4',/8h"@18 *E\&a ( a2S_`V7.@bJ"ORW FfB|,ŗj(G Jt!\BJN oRԸb=BD'a,ah H`X$A QNVݤ+>ݒ` -' axh.rr14"-t5e6 `*LE 4@`(  u_>6+\A7>)bsC.ȇ8KE)X&:@L25PIJ J,q&vaM)|'S0^1\ U5OS aZ1!OКB3g0,b\3!US*e_)`:U̠^KA @ BRL6Z#6$ ,Je" %\ #B{r$C, )l$Jb v~c)!J4'rG[E V37os>NMZ8aWK@$`q8`[y42GNHWVE-`\! !Afe^uy0 Ef/O^kx (ia"(3PK٧ BkiA  Ved\~h+rŦ/\\@386>;N@tL܁,l218=i }hD0ed1nU f!| 8h쫍!z4kKlj"bLaHI4i>iPG@^)㕚27¢zrKi [,[LD0tDÅ~EwӢ*F,S. ,#@#HQĸp5{>6^` 1f,4"K&*j:jAzB $B.ʮ`mMPRRX @hNh6^P O؄&G[aBQaLHm}447׌2`j *Jf!jQN %bb@A Uw@ps\JAbR;>! `-<n2L!pn+Zıb>n.J@Co4wF@9Bz;bV @HvV .X$( F_2J("gl&aE;!^a)>YJۨ $ xCj$+Π=Jd@6azD>dAsA+z)zh;zj/u<+³F;P #B=naB"`@4rdUd,z׏V_a:da6 HA &R 49F`EB Ƣ6Ҿ- P*`F9BL%nL ,) h v`BA`L֐.7rEtc@y"IY&E§ʫVC$ֆ r3`e0*,,s%OyQjS9ԡV \ /~/vㅔn ~|ls"8;xqv9T-1j0Xci㲌VP8 :3-g8D  P/T I%[iQ_RJ!ZI,L2xp`R1:# ыh x YP9z'HyWo  PHJxP @<,[C*"@E0#q p KP*'߈A pH"Cx"G13p$]G0 H.:,\daԳQpdC ƙN74͎rJJaclzwq@]~h 3/G$T{!GY -elZJ\7PJXf GcTV $@ R))iFve0cP A*6D b X U2ݱt[`v `qCjuQ /r SрJR DU?9H>ɐyEpQE30gQs{f: # VL0 "ݒb~3a:9`@OU=yf0E0oTg*6)a*C@2JMC10 c %A^BY2@|Ѐ,f80.c5+'W/P/0)2 aiz%ÀODFpk3˰1kp --P eGeG;Ux((evE.oNҚOJkt}7.sQ#5'Ps "%fpJz("&.0R U*"#a)NJM* Ub|O0"%ў $9 JY@a @n&5b"T S?H[iv 5|BP2/r%2 3 2! @\UH?bq3_d08O[[()b L(Æ:iU$[mu퐚aW09b# "@IW#5{'&PT$d)fYV gPw# @,&9W(Dg3M3- 3k0<2Ђ Ax' F>v d viO5Pk G]XS( ^L` L=m,Rc=G000r3^ JI3 n0+` ;i  ~eQ(O~aB sWaUFKu+1D\ !8 O+10 [Rc@ܶW@7Egk]S0P.lG-P3,,k$_ Eub Mŗ=@]}y0 jߣTePcRˠh% vc! 3 3M% L@I nA̐qȰh;-F%JfҬzR=};cV$ױ?1Yp;Vbcx"0 2r+rK)b|VJ&o:](ԷƄ1! 瀕lY"IR D(Y Z7kл;>18C@/oF@ RЭ| ] H98@ģWlRPP+wW3Epf $&u"g-'!Ptea{D!eњPq2g}Zp"<pa@, YPW` R\h^;W rp`Y6嗋GG]4zTSbן \E&j0s4< uɉ"@"TX0 a~, Ѩ w'T40T# %R0.ޞGRƚL"E/p->6廁߲Ӊm4Q 1p`/Յv콯=P$@kF |zK ^t_Rs<WBxk È ~Qj ٶU_: `} 2 :M ,f8t#\ c ׌@0M y KQsP #0S?14V GVAW[$BqfR{W,qC•i+=^@)aTn(J!o(GދVS>Jm(P 1#v p.(Pa _$ʅ, (`ċBH;%Svୋ אZ\e'0𜎉9?6`?Mt-2?5I[G@. @ &Q=-p` q(q!nv2ѹ$# V[,RR q }iA(О= 犸$cSn@]93|1x/iPĤg`P`\teQe xfź[dQ-+d3!{dz@`  Jp p.DdłiŻ#4H\WIFIa@m,XZeʬ7^TE`[z$+c\p[I,˖d[dx4˷($F8iܴZ`1L->ƸR$bW' vIa;.F`1e9֐{.*I҇/l1IP[H!BI&Z` kL8N6ț Mɼ H%LțWDÖzLeKJ\HF'\oD-d}W.IJlpf(!̐3Bc\c#!@9]vLiΩZj&B od`ڢu^"1l D^JfGC&o\hapIhYkIv d)HCjZɢzȢ8aBd5I^("@) P 3^BL58qJöeIv'r$>J$rMiG&,\L%H^X%-biR-rX"¾x@ <-Tȥ1x)\PX1|F7Eͮ "s@i @ȲL'NRS\f(D*N$春9$!8X38VJ>UpŒ\Y%ZC)"Cl4\oZƫEr:\B!EՐˌz9GA9-yQvCEO*ਂ½*ax, \i٪\jJk6/w#T$B`wx*`Ue8hG$gr|٢Ea[" EQTBkXD& $<`J޶49s#oBEIɑ+ËB-x֦ L /N00-DĄI @ o |``̯]C=ƀZ q,ЀP!;bXbl =e<\8\XFL$,C\ Ђ+ #B>rܒUBZRIpI-LRpvBq \RJИ!i%``?,0 N6UÅ2e RJŰMNL %j*Y9pe 0R,' C^B˼P4tgX-ЛFCvN~_iҀ2j38R1IwLRB꿚I+ȿq .dh7 ,ep@ 2(2kZ݈ߠNʺۍ1 wc'VQ7𰬸@tiUf9"&jW`&ݡ/Cʊi Pв`%0R Q D8݁vii8!p ..HMPH(-TP!*D`@ 2ié5 /II9*YKp(A 0D+Ӎh@P:XCNTxSYlX;p@MqȚ #h@n($0% rZ((P#x7S4Ó$ۜp(",Ho`<` HE(-dN2\D7+Hq a3@.(E-:脤T08!(pP9I8 Q`9?H#I))o-NYJ< aEN722TQ"\J'<nEHӢEcIF@$'N]WQgyoPdz!ZoAKLs Psr7P tYʔZe<$xOQFHw`,m3L b=<;!!XNE"deL!!@nIh$`o-v؅<uMU1 HO&9꭯N:p˷qџ2P0Np.O7/ښ``q 5\dKH] 2Z1Yۓ|0,8=a3+ppOQ0PD`Dd%T`^%`*0J@1# NxN@2 )@ Z$J NSULKd,UlgQr L@Z0LHtmZN`;$PmxpiBBzNۡvH]-REv0O)Ydp` $!` i'ҡ"X 0&H1XN(z"Boyq3C^O* 0TLPLEfV0'`DXX0VЂl"XƋtPFHp'@jOX\Ȕa`m D$e'dX  K^c![Qڊ!)s^3(33ӣ x` d 3țꘐ_+Wl#7T0O$,!h䀡r27^)Sh52 Ȅd]@ْ0"2 `l N8Dh b z(0 H5x{-jyʞ cUd TS N@9 ]V% ?]%,* p`ffxnfiVFi'h'OXF#Xah pOf)LSPEoB&rjh!`g12gQp!xA} A L)' +ŀ34)$+(zxI%HI= (>`xZZ1`sZbL읅0-_#a"(sH8::ة_G^nVMFVsVS|;#xݨZWUzs |;H<;FPY)@FrE]r:hg& P`( Km^ \3X5ʻܭ`>62I/ΐ/9vХ%U3(*))٧(?N Bۅ$ʣ<@㥋؏Aj&Y %Xjf'nfxLx=`Y3fM :QL: KhÅaȶ6r+eE`=QJKcR[W2U Ȗ˓y#HC]b I /;>) 5)a=oمv8s@B2P(5RA띅&PXDȷ^sߐ -Ղ5#H< h:&Dqrc5Xt. hi>goiI[xJ`,\X#` b< 4P a(FlhTBUXeVX$f5<-?"@Ӟ-X8"II`J)(BYW9'ppnZpYjŐ$ƂR@aaG̘ 0AL%u1P7R(z4$ƷᮂE&XpuС[4v^  @N$ (ъoJ$R \pvd2HQ12ICEan=*G[[ eD@;DrP+$2=v ̦f/{ANa ĉ`؂((@" tEX:DF0<@@Op=NsXg8Yァ=hwer=4q(|#xIJ 9uW`qb@pA B `$Avǻ* +hX~8 @A*& ьR1vbGQ~!e SXJ껒p]/@9 0.q˛Z9z &Љ61t"k='0 I9dOB:vp h:QF Z "§Rś*8!{cS}su8"r ݀4nkƙ&psE @ ?p#D ax [1H9 Ѓ=&0!`.úd|?PT4~z|8HROj 5e`&gX5h7)!#PQgiL ROLA`@4@:pI ЁtI`Ad[F`@^_@hBI%x .J LDa$@CN@ tMĔM4xBU:BqGqFse:s 48pAFAW}$ KJK-€ u+|]}] UKhAA. %q IDp:Ŋ@m4aL.@LрSEùuU7vchAOTB  E]x;4EƨlqV(B6E*AvTɨViJ;zPa0l<4Aܱh%>}$0G-IZA2Jϩ:w&e繁 l9  P9 "K̃ RPp̏\uI( x㹭(>ki܂'x tj`%0 03jޘAjÏ] A=;r̯8,ÌDFF=h S2<*{`5$—5Vڭc:8 1BricN@ep£H@I3rL"\'Cn.X0ï$î=CHW\=T%?l)Bf傹HA,Q  ^ H%̶wuow w+6*0*r>B PVC#PBt4lXUȏ뿽*EL9f_~YFH"È9:k-P,+b5]:"OcƏ1“ebaAQpD#ڮN.$&3/9<2,plq7lELTB;@U*u-w9ӽ==VyHC=:^z؛$`;L' L0 .p;@%5UME4LHؖĈhZHI o5È N4bC^L1t+囫d\s! $\yEIbLٰi@ 7i`Ʉ$)rz: z0pc\sf̐;"6nY V4jb6V1Ev4@ᇢN4r0pY)ZD1 #oԹ h͈$вN t.tJY n` f 4bŊ ӧ+gSR*3 w*mY2[Tj ".&feMRy%o%Z{!¨xAbh$"R&D P e)yl,B9# er  TpBP%؋.ZgILxA8 [LEbNPF$:Q <@::D} QEqfa4 08fV@Jk \ɹ F5Ra5I-;E*e @B~O9S0؉ֈNK\I*ɒo "#-ޥJƤJ&\9)o&edD\\3e)^Z+)aa8c&+M7:{,OB PD` !G‰$䘻JP"EXc O28e5fY&C&Lō"@-" wܯ=)f!t݇(h{bq`aB?t $b)\&\ WYx'^y ]8Cb ur&F9p#JOn%l2S*D*@VЊ n^P#01ܦUo.# C#HJ.4#^aMef1`7@p*q JPb9H[AJTf r OvA F 7,JC:q<@ 8JA %ft cG\ `cXJ-N2eFA$Q 1D&L3oR¡1' *T I !HJlœt ڥ YL`L0Z @A7$&OzM4ED  BcFX;E^brFļ-=OO#O2Ɣ)lDFV 0E8>fkWhۥ+Mb*;3{R\u%` a_nhC$&N|} Рq"`I@m>a! J`iG@cJt*0[ftB`(~sA>:peWAw0p 9 t.Z]f` J#ŚL@$IR"' >&2Ia$F \*2ABB($8`P%bg\@,va@!g fhP/'\`ުij$NM7 .2k0 N4C3(b.z#@ CrO:Ɍ` ?EsR.@ 3Qpnn p!˴ b !< 0!AdJ0l: \a@Z)@!}ZrU ZήD1@B,J \ *fJ':&B,j%(vA,*JF- , p(x,`C N)/^`j .FRD`ZP6$.$?X#(&Q!~9#V:9f+.R~7W^+sXAh fx f > @|IA&b~1@D[4!@У\S GP7`Ǒ`@bL3b%F$F4eYR$vMvH`pWG7$E(m dIC%b_ OOX ހSj#@ F&WT 8V ~J6O~TZ%q`rn*@xCE ry>*!LDl/I/"t$aO Kٚ 0|iqHVD̵L%&`nBDBaY롗P`{J&~T (A6HMv0L@An?Q@vrMz<>,`SEf!;!thorUdcpV47!ɐ,KhJZ*aRʪβfaf,kX2#ƣ kvaZs2!E! i ڡfNL([WDUMLG!&!!OB``1w I`I 9A !&VmC$A_{7M@&? :*aMlP<=#Tlc 1/m1$id8"1h3hhRA֨,~`Q2 h@C tA0%fL'Xe5Ozé  ZHB[wA4Z!ZZ!2@3 f@([o7Xp~b: bߙAB( :uQVip7eԴV϶#z00 b+qN`p>"ňOl$@P{sCR;i hhA6s?L{{3 4TFuX;]Ӳr&XD% b1l2j 0`@6 !6Y @8\A ,@G^ {5+^bXgp=A ~O 5؀X$A!/_MF&#~`"Jd& QD Sk$Z%9ACr Ԩ| jWm \>2jKk` e211M^)O6mU-]2m4uif!X 1W&6}=6 0 8<ځ]c۴Px&ҋH,۵<5[܎@B H/(JŚKܖؔj7XeئaZ` J?bRMď2cSJR j䔃9:92UQ= yx!Xˀnc` ZWyUv@" ^ ˠA ܁'`{@-!CrC8 |a1YָQĉVl'N=q2jhF'4QN\N2"II-d)E t3j.PΑ;Q6z5.9tC@ P-^hQ@aPm#@U+J/&-"PtEp% Lax: |$cG@N00`Paɂ\o7c)۵oמ!74 &v"yœ aμ5֯C"iM.O*ܲ@`|j$v&fFPQ>,`Pӊ=P#&& B?aI:q%.bQ&G_5( E IO?q΍5q 9Ut+BN;p#HbXc  T\q(_I!$l_6$ --r]p"DxyMa#\QD4$ 0t` 0À(֥rw 5e!BeLN ALw;Ø:mPɮՖ ֍Zu<7  R$Ӟp_,A&U#raD* L.dt( (-paBR$.N-HJK2sA䠢B"F]D6At PuE[Ӗ /Hr%.@R4"S #ZG\!'oddoDB*܂WDECJ3 @: If\a^~qH$~nx$Rji0tCJ x(H)"`N b.ܡ'P%9&d@_m>SE+!I%B G*r%e Ӊ-N&k?TU~;f`9A$H+`C?D2mHDUAn7`ځ,K[vԣ@@I-ŅUsR#`E09-48;<1 0DW@"ƀ`RJ0XSo(p_ȃHx8Е F0&܁j0Jt2 3!]hK%N$ ȡ`t#$[ ֠Mh NJTɕU '/P|gA*|Ǿb CA1 Lz؊l,u@SvK`م$@"} ?] q|B &o-" ~`  ::Du'%IɍAa ,jA<yAv0@P*C26k'&7j*W)L:1 H$ b,*av!,@A;~9rUPB>4 Hn9XCe75TiD$KE;<`wT9 ,8fG%t ~X!@m?Im|SlB"0CdD͝#-s.(> 0Ҏf#(rp?.\R}P80+0@4+-C[Xꠊ V}yV .t#`iz4; 7hA̠-ґhBS-HѪ߁v(`;h@+2nx `zk[3`S\p;0qb{$/[C ߩ`APER@%1|̠ n@ZJhRjO6pdуan ڎ$I?&"  E:b) =q&'bFE ] h0<\`[EnT%2bN tb3P OV~%@Ta 3.\Fp? X,@AP% LeϤ P}h@f)7Y}ss !72]~%ӊ׊PSPkA$qq e/gCulw}153 ] ^!R3hXRUTO_T_PcOKU*F w b Cn@ < b"";?]haqr%os  ԐՀ>?X ! Nb ia'X}W}h}`c~cYX 1G ٴSr8g$sT:Pf b"~E m EfR@B@xq-RC&h/n6y5 uuk P3pR(l؎b!\p  xb   aЛ)A@;?Z`gsUJUP2dMHWN  `N3}Y&rhK0@ X~K0r#wZ~չ8ZV0$!dU G,"r(-4PPR@eR CGDZh UE#vP((P03~* S ЙN꤁@RUmp xp3@qTqD`8P#ccԦ)VdL9bZ]-r"R\ @ PQ@4p)4@o EФU%U5 +Ħ;xUO 2 m] S0  @ Zf 2XN;;T7G>%FeIb'V*NprL*T#w>0r瓕h000~ ʕ%tu [7q@uRhiKs-WPE"E#0 ݨ(EP(yP'PSs Pk(: H@lOE׀ZS̑Mp HإK`n` A &=,;;Lk(9];`#F.p< Nųwh8[ȗr"Ǔ}}H+r :;8; n BR]Qa$@s?w@pla:C?v20`QFӥ̅" ÀCcjiR H9ۙ:y_"Z@`M0F7 B(Z i2  Xk-lLĴq q4юEV?)>z%)ྒྷ(D<+r)ɘLӃpǣ%32PӔfl`l 'tNyF*@f 0#O0hW@p>;  BfD޸RDJ(6: u3 kPf=E, _/U58_OPC UT8󸃌 SFK狩E<G =bg򧕪 @_D fpIl5 ̠po D -@Up#PA0wP a@ #6S1l+ B8le SOX=@ `s Nߠ3,czjLƋutŴ Ap,$p? @j8Ғ\ CpˤҨe) kN T;$UJ2Vɭݨwԭ '1#pN)AWkaP#P?k( )Bo)TҒk ! q S~*",lNdžH݀"`qEMF3@*,@  PcNcƄLsYƓB7Ԕ{#ZL[Ҫ0%`JY lN BA2rƕvNA}0xʵ c G `+P (f千R1 iɕ 0, -p[ p ׁ*B1Qf8c;h}}FM]*=aGˢ &?>ˋA0"C#3Si0>P>[ҙZ%}9J{W|l@mLQ?g ~ݪ~ ?mwf1)?U )A`+7]2 3_'@pwD-,G_1SSOS,1,i8["`2(*O J &<)fF+٢pV-Y$evf;C7AL4i@=)$0JVZ҅Muج%BSi I} G-9JY eV:*UicO=yEmN+(  '%mDiЍuQIIg];գS1(fTa 'Rq܈ ZPD 1s!l"`;-s`bf l1 A'la @,o`::vBj% `B)ڹF8˲J)Z)Rꀡ@#%9@ˮu.. nu  1*ʜymġ1JVH<X,p<`:NQfHD #N|y# ZXI$iL @]^؂_SL1bgEZՔURРnnx.ʈĔ5E " "b~Xfo4bA viGsհ]Ѓ]8 (i~N (Y)$!*FK 2TP=GV(tM= 'TŊ*QEAdjUвVN9x̞u]VLcfД0INhc`.":OpyJpZ`uI-17-ywMdF .o'8X*˜*(Bc|UJƫ B6K/X1 %/-=aJTM+hDd\ Oa9&FRET(x> 7T[B%P  ȝ@5<@ C A  D)B\!!s\0fE ,1t C PD 2 vt`VRs C::'JXaJ{ zHXSiGKAEHG+6],(  vq ,KR3cLI0M-LF#(шFTA+ t'Ae6QP[l[@.*ќZF0z@ R"E #<-r1>B~8Q-p15Tb tĈ`X߰HM!\0TVR#׏L8Ҍ0v$urGWTD9|"Xh*1r`ցT[F.,^zb>u0QEz6*t|aai`2zЋÆ>FJ- @33xb6` N`9[$Ѓ1=qp1؂" Hᒢ@FFvE QA$-vl  >ט Q]h`,`, 3 M/_F RZԓ=n Rp$U_,{j'#i5*d4X=1~E8y#)`׳O&R12m47XeAVDͲP,;d1kC m[p ^pdaE\-ty=ƣ9Dz,ZfNL )0\7j`( "ΑiSbyth#R5Нf!] )M`V`4"Âa%l1fO@zVbaILqYjV-pZaZ*i ,))`Ui3B_`be YZZϚAYB Ag'Щ:odI|\~끕 ~k 1m0fֳ sp e|XF9T薣Oظ/:NP_ 4PõH~gb05@jЊ/0Yy"E*fr<+"<;&(>1k H >Mp ГCi$*Qs`(I%pDQ0 &H)c2H _3&5虼J5RB !&cBm ˋ M Pq"a0h 788`'VزRq(dڂ'dQQXBhB JsB3/,ts1K?`16+(H. <>ꃾ)XHE>kK8r&6`8a T8iXÿ3Ih 1Y*+0H6[ A`뙨HċpPQmiEhrی [K 8#&C- p'. o `Xr p˽DGt$ulIc+eBy 4B#;2( Hĩ>ZY47;L;9.p[6huH8#$G{Īk 0C d%fS c G*ىT JE#Tʙ[x^Ѹ,J|xGZw*oA$/Ȇ%4/KJ˿Lu IutӑNHY0f)̂JL8p>A tk脑Hb͕8ck M"R8PIT+)&20h aPxIXi*UVT V h@( tMcb,tRE `J9HjOp-`u!l`=J==@TtKL2 (S p9.-d3sB ;(H .D{Q;.8*g,rXp*$"ݑY ZTHyh* G EaJ@7M  djV*H+(pue^t%gЌtHm "@-؇(J|zrY-̂Z8Oܺϊ2ȆT{B L=MKMmǙ$2(JSǜuB[Js7L]5CT88Z Vky I= '@r8ѿ5HDGͮ+ \y_Z+Қ0J*+ Ⱦ@ 14S1Tj]\V^\V!JQOpJZDm-2 Ѐ0]PTP&&L K L@ \YٞEL=̟50*Qc5U"(KV`,V 8XuP?1Ib%3) Љ*u(ܙ):Wh~ + Wr\ȵˠ0PN`O \KP}!-*`(յF@ lumBK=`="NY!KUU@PG\ Je=z-L`$U[^3<1U f01, (i jc[iq`Q1EUR S4E ˫Ia d« z9}̈qJa:(c2z8p]B8aJ W.;] h/ af 8Y!f]^&~b}bg^Y, mv\^1 #@H p:m(҃*_Mu_֥RZave%t=: Mpa*!;P0I% 9NY :b׼,aKh-xwxpP ʂwHdF$܀ Ple. l0fe=ߝYsgf@jB/(6lY9Zn(R6cJ1r.(b X9ccQYQ[ iFP\ V (ڟ*+>zJ&+U+&`+,} "`P#XIx2Ye-F {~݂0 H_""lE;n ؍]8ffRjY%~f2fKfdE.@;(Cr 1p7V_%cVY*nI1*/( 5PeҽH U B* +>7i J!:Cv*{zVy!ʲȂ,*K-dL.+K]B?.$ ̙na `=uB(hگvX\"0` H* 䀽`gb*8Dg"uDN;dJ"d%0I $*HhES*`-цa`,\ 3N}ނ˂$FdeHhWSXK݃ ؃%l @6'`F٭SYs˿\5~y7Io#HcPm Vq.PQ R8DC3HouƶI6 lﴋ`5Ҫ %0 ҤyJ?z9 @Z~qȂx-nF2$jT"ԁ$],nrK9PReb}w3[>ye8ܓ X^`Jda@Q ˏ$U?c͟ { V@`׃y5^ ?*ࠠ` &66@d]@I4oZdK-F- izz0]=ԻT9_:);%t=ޥPgdpP@@d bFaKo,CNE *VR2VU(ifO=6)TEVleX$|*2D*`Р)RJ.z( RuC]U.Y6NӥKJSյ:+%냯~HDU)Px J֩ժU6=ajH#XdblY,XdevZ1j= 0ҵKl_#_^K9ɿ1E:@""ԝ'_r0jr_Fr࠼. ՐD[ =䲌C4A@fHfU&JS+ha!̴T bP ptNW\5WEvdgYqZiO]YV_`3bXUa]cgÙiC I.V ԲE }g8|+Yfp `J7Lw1T{hˆuҞ_ ,d_@}JPCBBqAB'$bR" *ř64r"/ -+~3*GBeb)8ep%]C%tIVlu V[W=8`E>T6f 1yeǚ`g2x֒2oxƐ ")6NL4L4$c кs.iJ:}]B.,(,ª.L𪬨4vA ͢@! 1BwaHJ00RKFVnj0&0 3F}-*ƒ8aSUԛ5c^OACT." rTL'JH.gWVޢ, .w>(A!1TeYTDRƒ19zC#alai'Z܆{AY05 WXp ܁9Y_=$'jZLQm BtR(,ЍUB%J$ "-a ,&:쑭e ̐  `5?A qn[<%a)8˖" ]X\Fוue%+̋t.LT2ƅ1 ca$%#x[gG%oMy 97`#1PToQRcPa vG֢HM69ѩ-/̯0/|5_l``YQ!(@*xU,E%0].>Y ad C>ɺ3F 'tJYֱeD%%CV. `DR%qF6%6E8]t+)+;SA cXFw]SYIx~ ǣc6_܈ ! pd-&IMtjD`74Vʈv/ Q Fl;xjΥPNXO G=I@?'ł^Y`Z0,!̺aP!$H͗(G7ә8~l1 =ܬMoVJ3` ! cOz9<={xL;\z(~M-tyUjRl˘0YP"@juv@ B#aNءA9yp`F: wMh;hE,2&t鸆p C)hmid,sf-{ue"hl) +AogILF@~35nK 9051p+lf &zJΰgzgӛ^E4T0L<* ]lU/#@j- _~x\*<]PȐ ^׿~BB:i0XA*3&5$Nu]L 5\2,KmƼu bl ֎ț>]  lm^^0IB^,nƌ `gCD%!f8dơjL0 BlPzՀG݁}QА9_|axW] )Zq_״AhX CB]qAAZ$Z)BC:*NMp@(A NN'&&Re:^HUD޼֓: m+Qn5 +>ޚuz@],5 j+C-uaO+C6L.0|ka|U=<;fl1u#١@XTX=D h@2;[EV ]'(5:D`: hB+X"I Rc:UAW QpDYW c_QT %[|3 Ff(I# cXFVižՂ Ln4x9B0c#T]=AxX$X]c@AקUuU6[U "؍!71b* f,Ȥ q&q@؁%*)C DFhaœ >IDXЎeN#̈ …d4r^Ff舚]˿ˊ)j2<HH^CfcF+ 0H0D`^Zz_Tq;ʣ-W7re_]KDAx%;=$9A`B!&hB:tLIF`mI¤ TEhad F9^1]ܢQB>b cTEֿ]VBdt.QNzbس2xҩF癸 |&` 4-("'@bI~JhHBTBS9覹¥c>#Q=Hr8jhM"F.j;DD@)_7x[ɕ?h;ܧA;C;d&(+4؃"(B'XNL0mlN@QƫhCiKfShB>hAx@D:4Be=g]YVE#C B34 n)/4C6͝Id'ҁA񚁨 bBꂫarAZ_y zc~Z*|&hfTB ²A*t$A5hAd'2 *1dTAAHcKB^)QC+ n )QOQ oPY@cGG-I`Zt@3 B/)/B,-.*/(5 +J]>,̒I9ߧUͪH9-iL9f?AVqe؆)$;S:y\C:ȲB:̂ p2j0-joC`gVFoˡ,; ZA%At,ϞJ©N_cԵB ;fR|BB=h^$'@k@䤝T`UU Ԛ%`ſ"cv ΈWA#< ΚI\WZ\يQ u(393u3q<3(B3B=32WB tAatM%؄r]])O!PtqP+&$]7@-C v]"W9`Ă-B؂L$TB r*PZA4Ёv<0JpR:a %hQڃV%Tr@6€AUXK66f*34A_˃w()36a#^?C/\/ҨBV"<hUUB6h/Ta!qhR.թ*h XpU,v & HoqX37&P)A%l:U72B*"d6.g.FE36E7b *䃜HzEbTّZۂt.p ++3:?6:344;[@RayUZrr96P1eJ3H6Dԡ*;dG$\:Bb,Uq."PC (xG& BAY%5bu#u, ZTEׅi "l= 6HI (Nٙ]q]Ff)Zu+4 pB A ngB'{|8<3zsy! K._UuGhP%x'I.6kODCZ3;ͶT dAB$+d@V-$p(Sr y4p"LFɢ9l+ ī,whgB@b|q1]Zz#|12õaZ;5tں0BJ6"T_ B= v`T$S3 q樠[iEc { A 㺙eP#@"ɀj.L03Z0"EpX:E~PJ^X+IK\""+9ƮuZ晇byJr#S=ؠ1Ux2TGJJLD#-4LS-) ml6mͷFZtE (C)pL5 `;(0ghn-]y x:(Ho9px"htF@m%baH*DA/ |QX@Ö@"n Qf zEW`` .ʸtRERJ*#-X2drgKJd3nŠ,o+~PLQE&6 DYaxEHoM.X Sj:%E"2Lq[&BW@R*v aH8Api?\VFDXDL1)Ph6 T+ep c2JnYpI"u%F-9QTq(kcE.T0b2f@ JZȸ)I8\ xɲ%+$rR`/nF/2QA/4特 xM6ذJ B) BFjZ`` e@A L0 N6( 0 .H P*LڲaVU !qb E4h "@$t K hHx*DQtD@QtX*d!6gxu=i!% Z@'`N(bZ0N(*\0wHa (E)U\uTa7K(13+-iJԅJY0*%c@U hD \tf<(Bp4NE ƅ'`,X*̍[s;Us;rP( x$<)'BА.+F,C }kB<.ьp/a,X&` 1Bdt"{8. s`h&2LLDX@L-@%8M" ,k1Ni,D/Zn 2 bNBZ11ih e&."!5Pwy{8p h[bA6Zв :# Dx(k~EBz&O@o#L[FMB.t[Qk""둄 ^!H!c ,`ME䏈ʅI^R܊)@iA@a+au}) fWUfU-ɺgY`*M;o'QFP 3 …FE DZ A QوC+S#X@:yR15w6M;l hBBD !.aCf8g/ABL\݃udB mL>d54;D 2O%7eE:,V0b(l,~sX@ Ou@s+BR/SoE.Yʵk/g~fIfC.ZP2Oiia0%A6 @ "b {" *`j9>&`̞@!DpZ+\JA&*b4&V z ̨$B|9EC8H `D x@`xjCє@TJ &ll!AG  :F,j\wxFD..LN| /,lf,/''7NOT fm6!Rġ 8 |j-Z`0 hD4@Bk9l"QC qHO\kPdB^NH̰pP[Dި|A*¡ȑMC E"a^A @X!@ I,`#m IA b XVB.bֆI„e/2(@O4fQT@Ĵaim:Z@ L,8 pD` >KDKNrv0 " `+Ќ:o%&, [4kYT\>uz:3n'NxP^V@ w., S:e B2ca \Q2@F$lmen*g:alet0Z}  N4dT  6o0RR#ɢZ[İUM9*.:/_ rs81Q@^%&P` k: 7đ "]5bbAC,5F% S.Kn !q*R8XP 8 7 I \>aiz\uCO 6'f 0H^ 9A%6Y7lP`ICXO⦀s4 NX5@JZ |rRAkaab1Kt`9"WCF{Wb2p*ZaJ W 2mš( @Eyy4\If>F-cvˎ#N3OOYi(D1}Xi7|CskCā<]8&0Z~Wȋw0AʆzC h=qۂfA$hGa#L=y%Ɏl]4uEa a&Y*A2#;A˹` ӁG:`5]5Z⓶I q 䀦/`}rwa}.uU`֪ 1xî:iT1$QcWV!p!&H^H!ͱ3!8)h,= AELA D^&7FaAPg+CѿmFizTmEDx@EPĀ5* "u\ Tpg8&@忹Ѱj&MBG4`B|U ` UZZgp~tasCE|UYB]cO*WlE"J9&ԗ\NPIk<I@#*䠚p 5"тZ!p) åC0*)m u(IxAx){!*%4ԟ~$UM*p$46zL$8js(eB #FYdB\ĂI1L5 SYuXb4'g鳣>  Ve!MtG Fƒ_0Gbk 8fFť;Pg2Z d jhb  PC 2&Tb&\:,QΦZxjǦitv'ީㅷ U0`3 FA@dIU,JZt **B"UX!a#M?%]ғ#"#@.~0E5}( !KW5 bpoY=# ȣ4 )HT6rvQ2GĺB2df~ lje'mVh"D,@4+z& MqҜ,,H!ܣ2wiAS0 CԢ(OEGji`VEtRF b#fAJ OԈDJ IDVu$B"BB,fĄZȖЭ-/czP4Axr:itXXG.v㗿HbS(P1|a,@R"ƈII)xK%7iL1Ú&lO~-S@;oO`5f P#T!A9k $`@USSc< @h=U(F**j! V0+r pH 76J)+"F(" cD#EAunFx׌^T,f,[] aK-`A7|a7ST x^ap EX~tN ; At84!& *:_(e4RR0TUbjjB,5[vֱ@|4b7@P><*DdݕA~ *AX@DR2\ܙ…uk1=5O)u#A`q_°$y 0.4a`'f8iKT(R5 @hk_-sS(Exﱃ -X% =̔H֡43"|F 0$aE\{4 PIC$$<\ĩĢ.,f'hw_T0De tvƂa`TD@L`q@2.6'lA2h2Ƃep3 iR:)i,t 1"a4 giO4!k` ZJ G9"h 7MP6%nW# BDC Ҋ0> `܅UiD(a e"8 `B*𤧺^͢|K^*kl,tڷ. 8@IJˑS Hd[m!e'r@d`\M\ctCXGH}F@R.@[ɍ 0 _-y."#4k. ]NZ!*#\Twp 0?@T52@J`Ph?h @a !ku_Cw++  r7@W`shrDPt|Hu uc/XDZlҀ[l^/fdlg`cvZv{Pvǁ|.zdw3 cS=w2R'%<!W(T!(Q]D@\(ׁDR5vDvheXhԘg(v{K^LXA 6u!iU0B…0VMP! tjU' ~7lu\'P/֑-u yc1v%2RcE4&\=n$@$5q2pBx 8p'#4 ̠fTQSCJT d5)5Hp׍w xUl+07Q{N7UP8vz 0 Q'\!uٙE/bWvb7;$`њ"IOl )c[%2ca;v7 &r28+?PS< ny2 "fSQ5wV ÀSaq"*YS9en`eW(Aliݘ8{_* [ubA2 7 `ܧ] N颡) ak)P Y¶#-fY m'颰uZ<\&< [>P= ao*}Ip0Pɭwp]ʝH)J1<(b퉍Ж؈yyvVr[U`:*@807g s׷ #\G# V%OIb/6lcX uclPT2a q<ǣK&8=C: x/'[0<0F(A z]6{a(o{I.<4TUAn} 8$W+At7  s*4t:Mb"d Tᡚk* u+;/^F5P2G?+?8w`&f-D0Ֆ-#>@+}` 0 2T*\d4bf]TqI4oDaFTЯKW(d*_:|&7{ `AP+{7TC飐#$ƪT$,_P-gQ* ǃ3k [ :0Q 4[{ Q 8Q j)!GeF\ޘH(lI( {^j C+B+lUh*` 04 bװ PZlz#ë 'ӳkI\`H"@HH.O-cp[s O[s+Uljo}@Ņ'΄3@s0?r<2t7Zq=L&ܸ|ѩ HhLk%,1{;M`A`U(] @&&˸O/$FQÌܤS@` !" "$a9@ m?@ 0q\˙\K  rI?0-k F&3ZԝYGk(ІxZA篊JqK`*0`-!+` X%*l7k:16^"8EDC-9T2=T2Do+R\XZP\[k,`UjCo;AFձnpm_Gz2V\(h]M|ч^|* Ry, 080/9Pӭ>ö Y;ǣڒ0X7o yPS =6 F>0Z|9#0-@Sdb@JbI`x` f?Qy%=%EY{@Bl<ɔ={т|{`K'4}l $(*3;T#%$98D@HQf’vnk@nX Jj-<pd0U bU0NS] wNRE%6:yͯzao* nx@.c4 B6VM==j )QdPJ*$0DL*TjgJi-_QC1 AK]HnAʪUSYj T׬yK*5&L0S%kQ(P^ yJ\Y52Z0&Ɗhjb V:h.e4iNFX`dQ[ ,6-lYLȖMEANv~(bdxŝiwy 8gxyrǂ®]ң6Lq0JKxi(f2ħ^B$aې8@ 6|:*&:rb @ &C v)&[Sϥc E'6ȕV`,H11+ڬ qg/&X1HdIX@@A - Al)Cj7:M8(ӎa)ÏӸa!yx"6XX6z YXQBR,9#c&NRȺG-X#>cS؁)UzIhIiVʉ@^gREQn͵ $ȪiVEMD]`t bu D+ aыAA.F706 /;@Vt43*#AW6fmlp"vO@d %nAc 㰫њUQ7f!e|T">ϣceSi l_]|r?S5ڀ=(n+*tq+VJߺՍ',b8  nq}i>^ƙR fPs[AlѥQc3`@+/M(D^!f6f9~ ɑ٠ż̌{rws33,NZ#")}0!1 %LY KF[j3!+e('0Ű7Er@ @_pXa obSi*Qu+a$=p-A `HGX׊|2!5$C. D! qpm>֛(617Xo7OxY񲣲IqRPE>Y|<:g4vϠU{6G`}M >jVMa U څaC7PPx`4jw`"xhe ;50(.  I pÈ FH0tΙL fDY?b@Uζ=dMlZ7@x?pCscQJh la* {'ؘ=Q X >D$=8%MJ딥COkزEH]a 3H3v (` ,* yiN7TN!D`ZX`v.Eڗ#9Nh1ap!nj'`MICXbq.64 p_B Ne֛=́73gnJ++9ps4t)2į0"m  L8!kX"4[9v:$0b\A)ԠH<E܋J/q .tB (y`F &i8L +345::A$:>@ Dv3J''xRkSȸI؀ ;hKÙ&6l%*Xpt pA`BUHa6e˸7ymd5鄭{Э<P[G`V`7E(ɬ4[8Ze0-ă@>!H`My)Tv.)& jC:Sb)*MxXX9S`nhUjIvF$Nz8F 0d0j:j6G lONbRM.AGZ=}b0&YFAЭyA b IR(}hdhp5tTbWQ83{X8%|F`8K`%aaN3$OR/Z}( U8_!1@X_FNHZ`$<9, Mx9!cp'ۍy 8LhC* M(\2@MBS@EX-)0MeۜLGRN_ɚ ؂-X]Q |y3m|X))8]SR_ H332NJ 3H5$3~^x648^b(]Lƒgc ڠ-!(Z\dH^miHƐC`攊KMKVkc=V9Qe.j9ńE !$MUhLHCE09؂`fۼMMH|=24{ D%BeMP \p.hXDy; =$ Њ}644tɺN8 Ph46I4^8liZ.i zgx6Yq(C$HndS nZ hS;d KvbbX [E gXWn`9H(b$R~LS`W o$y?h>8C` H@H. 3 ΰfL:hpym;SB !mZe.SL)|MgixS~FmlBM^;Fd&~z MvdinB]ban)n1i}+[5Rfn$?B9vj50jx ^=PM8Cp42^If~k71/+ bB8j9p-?0F59 b92am4gXabכqЦGc8 bxvx6(r6 i8}m(9Gvi䖐L2- (mbz/HҀ$nRsƆbS[ s\p]ՔK9ftA}f8I.Vn*H/IEx!?āL45ySXQGQ!SUT[ToI) SlSm-F~6@Fv7v?C8H> (g^b8PPkz@)?w yyh,Znڭ⨀X$X|z[:s0?ٮSS<.둳c].R#}xA`>GU@MKTBNHyb:YxP\yS{ b4 ;_R #pv:tUz{c-(8b4A ^1vcϊH0'kڐ߳'#);S8{xF޳ۤAPTy @;FO$Vb7H6z! t=HiD!t$+V'/ ڪr =H8*ǫ;$E~ +Wd8q' *p!ס4iZCώ`WO?7=I.629 1ꆄΦ| ϐ!bżK'ɀ$j(SjLnݺc'A qҐ&MLZŬ=f ^n LEvS%EaRHM8 8NLa- E2\l hW/=𵃑"XO='DQdOp.d~|, mp y'/! ˙iZs7|h,]Q?Sxtyv#}E"1 HJ2NM|1/~'K%-K(EDp S=5:ل ("°A=88cȭXtfoS-a2`'Q 9TȬ;BlBM8= p #w#D@ BA pXC;*)Lѻ1(;1g mF!Գ^6P3̈́ c`,ًE𒋰Hh 0E'Ap1lЀ.Ãū'@Tm -EDuoF:`zAk@R5h [(h <0֬)Hcf$p~D̹%5 dB r$b#J܄wy`SiQx dhȘG'Rq qޝ'Ovd:f 4c d |Tey` pPJd =Lэ4 j 3:IPR܅%B+` Y·u;18K@*Ju$ f2 ` dz̀\` XAzS"HD!J|Bxħh iP1bBuq2֩ N8-DD,^@h5$C\b sCRV_AbC:4 ZC]0 Ԛ{wk]&0=Q^2 <3ц)6)Lu "@u$P 5B0Dߖ _HMP!:Etc R% bodf4!*mʷHB3 M `X0 NL y7ad` @ VpOSŽ) # a!I4ץ@Q۰%.hAi20A CMUJTۀ̠Jd=Y ߹߉ݩ DރaXPPC^T^\CE$q\m$F$`B(|Wh &*i_)*4@萀,P/B,̀hxI۱WtB:L5B3Xb,3NXBeͬ!) ֭K}M+@{,%"nē;"\bp.\0h$[2z #0TpW]:L%uctc݉Ҫtcu5P85#UD7\buPF8)4a! ,1K-1Kh BSs't/<FDkd\b@'553Ăj"50(rb,`Q@$B )L$AuFDMtF@ ;tDdƲɇxQ%UF 2,[1j CTC| K$cL; #T ֥Ctlz))x&?PtHFBP?ClL睾R‰RFY{bYcR`TL-LtC5(TFbblFdEE (fgVN|L {R(ntB.Z@!TMȉ9S]Ý&g B T ̜W@jD&hB R)5dĂ-$&+&<A9Ҟ')0B-8-\A42 (A̟)3t@+m-m1 -Fzio-mn),p/k,mm6& ,6]$u)(L*N(n\ΗfRjLH(N4 C5`Z~ .w jnvB*q'Xo$2\2X13P3#-NLm /Bk޲1on"qqoں/ k(Fl>Q!T̒lM!Aso\֯j0 ,6ws/615Wsr:OϺN-q=AɍY2HTMvA!ɂ'FneFmL,rjA¼4A,(-&+&,l,6pmM?CNoN#OOw@l;Ot9si <1B8q:ױ9#LVQVóWkVksQm9PEUU꬞h~h&s5K6 t7uHfU;bdπSYi&R4l!H3iDjv4kMkl6xJp'D5Ė4wYs5)"uWuT; Ö w; S35R7Y5<Qjnz\{|Ǽ(MKPP7H 7dmb( T O肋5Ãsԡddmaidge{6@LCA?4@<4<æk#ŧDxo0Ib: 246$|h0zm#nM>2)SĘbj*ΚxR'n*Jc;؋?ԣ+rl꽺),Ozư{/c.ˌB@@+ "T 6`Hta$bI7Zb \ RGtѩJ}+1B]O;cLɲ2JO2uK+_ɦU) ͅ P" Ol+4BM6B|SDbbT 2RksFJuNȶL5W*J.g%{̈i|IΈN" !lO ; [dK6)ƋX*׋F8I{(z7霾ǧSzLK;'S}2T\ΑЯWr g8ل94f7Ic5*j״H, Mczbܖ5&u%, ^l,^ޮ:C5Ok`(=5?NLp vt?Mddhe3qAPڶ|sIlԥW}9#}ơTGwzeG:sy&gI_(XQF<HX*lRc3bB0MCa^6HzaM g+y漀~±Ov ^QsrĩJ 0+J~D*r&4m ⁰{ܬQ!'%GdBJ;^z>P"}au1< X93gBb4^YJ$9=q(/xɋi6Zަ:ٱnHlzGZ-}3b`aUȣ '[ՒBH,ps&لN=({H&RL*G #B 'B h R  V4rsMg2v"vG R6h+pӛ@Uv" n\WH4# |s'(<C$ԇܓQI=ʙY 1 r %HK^7"JIҕf:?uӛuyfùquitҴ*<]O!z'~]YKI@ bC={r(h+9Gs)]]wU" K+Rs(BQ\ZkkO?p? $g4:+UZq'ބ=B jҪdnC9VA' TPHl`o@D]$!^"e,]!䙦nvNܰ@4~]Xh?R=x8,""R!%sfIBClpiO\u <!k4УϯEH4no8c@ݤNA- r+ thM8L:oz  3Vdo% h.j4Nnh/^ kޜ3Ť.fЯZB TnD\h@®Ͷ̫L mZєJ s(`K+HdE! q r*rD0{F/2P+0 T " m Mc!Q 7 6aMjzd!P$p8@Xq聫FI-2L{g#7Ll PoPFM?JpaP0?OpkpLc Nd p%MKN49dvoFfd E,&I(IrX/2@| a*χ@,.#K В$+ ޱYNo^ o,mRkL M.p Nf &9jA3)9CLF5Zs *5 mvDXNi !XT1|.px :'z#=/̮80 $A#1P<4+NCA bbPM | Α$6RY< 6W*6Yp>QzBmz|Lʒ ~P9?ipNM/:#IBӭ; 6$)DNp%A@VEAJ]d54C -4:ԒrkDD"g.w4 iX//aTF ;N%s01!AIK4PA`nS&1!3RTK4xFtTT5O@).bu FT`C,rtx2NoNO62;0VS0 I&[iF!u*!RgM4+qSw}tS=ϑ%,Y D_ _UP镮Ze3uzvLLԅ~A8#IŽMTcmtN/ Tdn̡:_Tz:2$'f[İMTY L\qZpJRJu $Y+_s u[6U PyAcVN!%~sRf cr:`ز95V yQiv4 v\T#p 7E2f[s6KgM1JA@ĖJN#A sKMAozpj_MWjUuu9c[_$pe lMq M](!W9`-8eQc5Y) p0i/so//~77qSfEU5tAApVi p} 5d5vyk7|uot{0[Xv UPCBw{uP0moC6T!0NWXr!ڨI Zpzw?pGr;GOWfHO7@@dZr_6jz8[j tLr0paBNw4MyǸ u3y2XxD~zdUoA2  {{ݪ|{^K~&OWuMWz+g{T7v ; yLBp&x!l|!5W7 XUYbeͤWOOoQo ́pa؉~YvFcQ#&YtTY_mwҹz yj N`[ev=?ol5t$I~82m38u5f 22@H.DvfYa=[v#ӍĔ{wkk;UuP~KWt WkixSy֊$4ݮzpw_ :m 61֡x՗{Y 2)z eaExVL;z uu3fZi~+;$44+xex{?E1!JL,C3Mix5n%M:4db(/zZx  8x<JM5_xjqF+x69V{xzYTOwx#:c;c'Zn٘.Y](* ZDdq SzYXFebקMJ sz3öRv ;IdpROKt׽;ٴ {4a\c9?cAx͒bͬ+~ͻY+i֯p !q8vW*bE}Uux>>9|C ҒOQͲ\в^͎۶u]{רPwZ~){Zz>^}JvJ޼9>~I~ENoIo}dpLr>cᕅם)?Zb ,Ixcn߫JBkQ lL&RKyNiR¤qx敺~,d%t9̥ns#\I,lqW2jTM3lETBV,g "jh]aXyU)LK d#V55­_~$S Eή(EP(BS4?nFZ5Q)җ FOpD=oǎd n/XUYuMn*=¡9| =< ~=ND8!5;g;=jd|uq+^@Ye+zC}MSU&zu8alVxш{8Ԋ:RM4"}q~ʿODtktDt`-b$ONǀ7B+v\_o{\ \ddǗPlcCE Y )[8%e9e)axf|BM@6pgcI (PE)i5xUH=x*xآPn kGKP%.[ x (0bѥȸD %OyeuĆi ۞rp ePȹ i^*֛| x{ ؟1w;fGz,:*4 䚿`u eP4o;cA`OKO͸RvBѢIbw%˽Jp,L(mK[.L++2VK*4[zkOb2BQl;c_cpp_reference-2.0.2/reference/GRAPHICS/sound_2.gif0000644000076400001440000000047607055335243015511 GIF87a((nnn,((pH+ ͻ`)fhZ0Tfel3308PQd]щl25>i7vt:c< lʌXX$lN+i: y e~FM-jbzLM w" Vzvv l%|  ũ$%_m2δƵBK&6؉ٲ!e!(HEo4Bh( bŠ CIC;c_cpp_reference-2.0.2/reference/GRAPHICS/man.gif0000644000076400001440000000023607055335243014705 GIF89ap!,c-J3j-TЍpIhJ%5ȴw>/ ǩs=vL/@ (i Zvpm-|eEU9"&Xo<}tO& ;c_cpp_reference-2.0.2/reference/GRAPHICS/mail.gif0000644000076400001440000000064707055335306015062 GIF89a00p޳22Ҵ.W!,00I8ͻ`di)Rp,:sHZ8] MȤ4Tl g&*LKNVC[~q.NEu=/b@}f0w8{:7S}xYkn|zH$H2^q,dsny'pNgaS1E4EiWI֠gF𠇦[7g,4ub DHC8U1 cďØ<mˊ*6$MLL3);n"4K*]gS@xU{i=ӯ`ÊAٳhF;c_cpp_reference-2.0.2/reference/GRAPHICS/mottled.gif0000644000076400001440000002152607055335316015610 GIF87a|̙,|PԖR tN`P"8#9MB5,X$$,#t :"PuE 10@`C\;];Go]!]OM!oOL$z# ]@:?=fCr% zd_ rc: .!x]=\v DK*w0DFz P?e_%MLOC(5:EjE#:!v@`@$CB`%K! |v@2 j*L gp4 6Ojj踄H @`pBdy$Uqjț2g(l9BCL ;xҀc*ˆ.-> P gErHńf 4a,@ʌQ좭!5 yґ Aֽ,DYI`ъW"HYb 1mClM5ҁe-~EWDTu) HҡboinOWrZu1-<8Jqі:L(]!ЇxzPRY>,PjW_aEBlp[Tp(n rT!wCE[0{"1 ď5`- h=X!E'$A 9MsfF \!q|'tILF DU,Vn%^%Ё 1`A"q[DD~BAqF7eBALj&B!ob }!G]c֌FjYXt`႘2k?OJBW*LX+@@;RĨ(]IyMf%1QVؖVEX-с38#lpz,3xdBE $Xb8әYx;2P̓EDP@<4 ݴ]/pYTT]ˢd͎vIѭ| x85b/t lHjl)5!L$C [$@`q b]3NQG8".15k֭_Bd 1U4E 9g "'@b/"dH0"ɬQdY@iS_HlktpY(SDu;etR爉:@k1D!ԬzU M%Q+@>)J ppeP F&y8H]CIIt #V^0j$+8sq8**I&sDhN)LIaK!ldh= dFХQ^ f25DX i""SS]=PYFA7D &7NrJtViXM#Vaޕ QbaA"i^rtBYQbGp_H f+Z|s ITl q (` h. GE:( bc#l)~@{WtP*tC0T@- + 'd=v^ӴDquJU!%C(>6KMAk5|WyQXL -ĭZgR S7w!\lb=^MNjK -B ۸y} PTQ6:Z͍fw;jǜ rW  R%;<&&TqB(Mb鐐T%% :ekb{_gcH;$Gy"c"}Y_ׄ'7sb"ps$+7$0h/$E):_AYE.NW30 ( AƩT:= Z,GreN9V佗V2&}g>1MjHVFTz[N2 !QtO3&и\d4p\Tb i0]Mv ХNJ62[xxH&n%L!]`Abb8ĩ`, XxW 9mɠoؘ!I!9;Jx=LOЅډt0%YeB\Bl wFFo6%@+ ' w׬"ҏ&t@m1\O'gK@2z.[S'W!> Ep"%TyP>"l ry<5F6h4a4ac~P I W1v<n+. G~ P.X"V*1 ڷE=a'x 3]zSgQJ#@*pnU49|u6E2#plj20G_W$ (8Q##&$ewpU yI2')aJ\gPN;'v͗!}7tff_qU{&2p.;ć b t< *bS8 dBY116 'UR2{ 4QP pU P*M KNv_C3"pDHZ@ SǀR*((U3c- #~7!+`He/ UU ;74Nq4; + dS1R?SP&#PL# AIc*PhN dBa2tBaB Wb# 43 9Wk o(H(yHs!p")YMBဏr;#8"OO,@Ri2*ƨ. g9[HA#1ҒEXʅ*Ė8v-. I$uf 3N0@ZQ!^E1cYxf&$6 DI/ ,`%˘ʲs?;0n9Q5qQsˑ^TNT4P$ w䓆72xd*O A5F?ZU/.E']AC" _p9΢) GR'7?$b&b5ŝ6ײ0b8ftx6a\,E!d;Fa avHx@0s&Gtњ &m@A$s -61$IV?3vLl1i 51&ZU Qc%(Y5V *dA&PycVZR$z,ٍJQPcc,,ARBBڔ !PbmH#]pd&8WZuikBg?c&fHrr0p(# JDqtdl;|ײ !ܰki WK8B6E+^\Bn`&:7;]8c OZE9S*|-a~њ:RX- 2"\DW5Ch`Xf 6j@t`la{&C7_6 6| 'C}pZ 5]:)c݄Wv` "T}8!wUZ.EG{ʞ QEKJ@/JYPI.6S/V1t4 U   *bR'rR!]1l#3@6J5ca9էBII'P&%V[ #rn1A0:$BdO6P"%9*%hw_h 1VW;{B.9iwn&2k1d(cNdhzw3-qA>l5adACTOra$BG>0v۷OcT5 <ޤ'Ƶ `st"x19{0b+Ա5 &9X#Jl@|tr t_A1KP@bx A~pjУRR9,0[F2 ʊ&&[+ *\(QC_hP{"c-fp^37d9+B>h"!))2 7[^q 7H#x&Tt$_#f%~30$3*L !sHۚ!z\VSQ%HQ "1Hϩ)<} $3{ qBEhV3 =g(b+X ىVҫam,/vT3C`&T*j$r^AA%ˀҶPY@~A A! sl@)1u>GAP>2V`g~iGP#97|V(?[]SH!NBpaR@/lDX*zp\eBw= }`qr-2xl$GAx:hk#RdjLV;l}!)}+s۵77RZlˡ{k;ve,+]="aP/9<'U)rOb'ܠk4.A}ٛL$iUS4[p&J%8T:SNu<6NakΦDٰOvgfm{fIKZF-x$0%HLذPxH.+g$t) 2.S4.GxԷOY&u<.S܈拿Tsp^+bہH 0JamOtUX S5`P2P'>C|>&Cȑ` 靯8,Ӿ?f22Uyk tw3u=@^) sӝ@7* l7~qgQ@1g̞\[!^r窏*wSz t8%1@ f @&6S[33 yt2&W :mxer`olbx#2Q>‰Ο@6U%--k#0*8೮9XR|ȶh0]&ye+߫-9W bOi!['g7)!`8WARBK5H4FvNu0+L?}Lnx3N~`) QL[_!ЃIR(NHEuDz_)c 3á"8B U2ǻmrq"xxq&=p_<+`1} IvJb4#{ $Y,̞c1D)-`  %qi x O34H:  F/b0Jhr>5 X( 8n+#,+?  ź$) A- >L:ׄO ++'6)>fݭ>B$(*KL-Z֥?_.'či RfQWC>Nv\&aI.m?dadp(Işkr RTЀWyS" y$WO, %CʅP )I d >MEH vK䌔H<8y Rк Bv;蒢P@hlhqS(H{,h=@Ÿdb)0Fi:;[nQXuǩp(J:'WF2!!%J _-`lΛ[!D 8h =:0Ft8: ak'D84U€X X"i+C5麘#lDžXG€!/ 8h|`m633F(H hhOT$f* lZ`X ,$Ʃ>BPP5Y3+P-dh9$C|@j@3gLF=j,H$¥R*Ba(0 ˈGp> V +BN>!'&8P7 !IldA DGԝDU),`mjЁISSA J2OX;2 RƜTg P*TN8EF&I9+b"2 DO%?B`_F;DAH@$8lG2)h^ (R\ZNx,@ R,) An)2Ğ<6$Ch KI8*xA] cuۏpB*99 O/Dv:e`VHj~\((*SPç+HjXڍj5s  f% CVJUO4%I%}U-! !ƦP \Hсx*+BIE\IEJ@';N>AA!=\@Ṣg0J1jRr-"; E~ AT`,@QD]`߼ {0`'KdGa0 k.(EH"@KE^n7Ҁ %7!s(@L BXeo2* yh?(!:ȅG$+je:@jj:uU; k+ш./KF JK5b-$$ >P !^.+aAyB^Hr;9{1Z@Tu[`??C3x,ޛF!)+n@?MnYŅ74!^!8poI{1a8K"Sʃ29uY9x1EtHjqgk5ÌPbp`+pl!1.U)&l#,hM/#G`UBۙM1o"FqpbI jF8BU}q-8͜D BbYTa"\ E*MG|ɮ,8&iH  kC)p9УdFI$o a;tag3hтh?vayxQx!ɏQ ^ ˥H7(xS%iւhhJ0 ?"ػw Uj#:ȂRA 8(?Xx;JD|˂p4 Ц"J?󨷘Hqn蘖qq{ҙh҉h _SLۓSbhs/k`ҁ IS8jG@)*mنK9؞R+I2P~H$뙖鍽*odQQq. @8K U3Ȭ dpwTDݰ;c_cpp_reference-2.0.2/reference/GRAPHICS/ski2.gif0000644000076400001440000000272507055335310015002 GIF89av  ( $ *85281% (  (  ( j~ 0%`{Oib RiTrLqhmhJXY3@:X -0ȌȸP6,n>4 ȯͭɜnԡPT<|W 5%h~ekXTI?& =BG_$#)QnCo$$$u'*% iϐN '샨$(RE ,X Td6t ( X 20C1 t=0* 5 L@؀A;)-.5X 2-9d4o,:t½ri2A, ? ^it1ȥt37r">r)?̥`P872 @DЌQDфD"@N!N^Z;c_cpp_reference-2.0.2/reference/GRAPHICS/Makefile.am0000644000076400001440000000017507055335324015501 EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) c_cpp_reference-2.0.2/reference/GRAPHICS/Makefile.in0000644000076400001440000002440707474405126015521 # KDE tags expanded automatically by am_edit - $Revision: 1.2 $ # Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ AMTAR = @AMTAR@ ARTSCCONFIG = @ARTSCCONFIG@ AS = @AS@ AUTODIRS = @AUTODIRS@ AWK = @AWK@ CC = @CC@ CONF_FILES = @CONF_FILES@ CPP = @CPP@ CXX = @CXX@ CXXCPP = @CXXCPP@ DCOPIDL = @DCOPIDL@ DCOPIDL2CPP = @DCOPIDL2CPP@ DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DPMSINC = @DPMSINC@ DPMSLIB = @DPMSLIB@ EXEEXT = @EXEEXT@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GLINC = @GLINC@ GLLIB = @GLLIB@ GMSGFMT = @GMSGFMT@ IDL = @IDL@ IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVAC = @JAVAC@ JAVAH = @JAVAH@ JVMLIBS = @JVMLIBS@ KDECONFIG = @KDECONFIG@ KDE_CXXFLAGS = @KDE_CXXFLAGS@ KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ KDE_INCLUDES = @KDE_INCLUDES@ KDE_LDFLAGS = @KDE_LDFLAGS@ KDE_PLUGIN = @KDE_PLUGIN@ KDE_RPATH = @KDE_RPATH@ KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ LIBCOMPAT = @LIBCOMPAT@ LIBCRYPT = @LIBCRYPT@ LIBDL = @LIBDL@ LIBGEN = @LIBGEN@ LIBJPEG = @LIBJPEG@ LIBMICO = @LIBMICO@ LIBOBJS = @LIBOBJS@ LIBPNG = @LIBPNG@ LIBPTHREAD = @LIBPTHREAD@ LIBPYTHON = @LIBPYTHON@ LIBQIMGIO = @LIBQIMGIO@ LIBRESOLV = @LIBRESOLV@ LIBSHADOW = @LIBSHADOW@ LIBSM = @LIBSM@ LIBSOCKET = @LIBSOCKET@ LIBTIFF = @LIBTIFF@ LIBTOOL = @LIBTOOL@ LIBUCB = @LIBUCB@ LIBUTIL = @LIBUTIL@ LIBXINERAMA = @LIBXINERAMA@ LIBZ = @LIBZ@ LIB_KAB = @LIB_KAB@ LIB_KDECORE = @LIB_KDECORE@ LIB_KDEUI = @LIB_KDEUI@ LIB_KFILE = @LIB_KFILE@ LIB_KFM = @LIB_KFM@ LIB_KFORMULA = @LIB_KFORMULA@ LIB_KHTML = @LIB_KHTML@ LIB_KIMGIO = @LIB_KIMGIO@ LIB_KIO = @LIB_KIO@ LIB_KPARTS = @LIB_KPARTS@ LIB_KSPELL = @LIB_KSPELL@ LIB_KSYCOCA = @LIB_KSYCOCA@ LIB_KWRITE = @LIB_KWRITE@ LIB_QT = @LIB_QT@ LIB_SMB = @LIB_SMB@ LIB_X11 = @LIB_X11@ LN_S = @LN_S@ MCOPIDL = @MCOPIDL@ MEINPROC = @MEINPROC@ MICO_INCLUDES = @MICO_INCLUDES@ MICO_LDFLAGS = @MICO_LDFLAGS@ MOC = @MOC@ MSGFMT = @MSGFMT@ NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ NOREPO = @NOREPO@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PAMLIBS = @PAMLIBS@ PASSWDLIBS = @PASSWDLIBS@ PYTHONINC = @PYTHONINC@ PYTHONLIB = @PYTHONLIB@ PYTHONMODDIR = @PYTHONMODDIR@ QT_INCLUDES = @QT_INCLUDES@ QT_LDFLAGS = @QT_LDFLAGS@ RANLIB = @RANLIB@ REPO = @REPO@ SETUIDFLAGS = @SETUIDFLAGS@ STRIP = @STRIP@ TOPSUBDIRS = @TOPSUBDIRS@ UIC = @UIC@ UIC_TR = @UIC_TR@ USER_INCLUDES = @USER_INCLUDES@ USER_LDFLAGS = @USER_LDFLAGS@ USE_EXCEPTIONS = @USE_EXCEPTIONS@ USE_RTTI = @USE_RTTI@ USE_THREADS = @USE_THREADS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XPMINC = @XPMINC@ XPMLIB = @XPMLIB@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_INCLUDES = @X_INCLUDES@ X_LDFLAGS = @X_LDFLAGS@ X_PRE_LIBS = @X_PRE_LIBS@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ idldir = @idldir@ install_sh = @install_sh@ jni_includes = @jni_includes@ kde_appsdir = @kde_appsdir@ kde_bindir = @kde_bindir@ kde_confdir = @kde_confdir@ kde_datadir = @kde_datadir@ kde_htmldir = @kde_htmldir@ kde_icondir = @kde_icondir@ kde_includes = @kde_includes@ kde_libraries = @kde_libraries@ kde_libs_htmldir = @kde_libs_htmldir@ kde_libs_prefix = @kde_libs_prefix@ kde_locale = @kde_locale@ kde_mimedir = @kde_mimedir@ kde_moduledir = @kde_moduledir@ kde_qtver = @kde_qtver@ kde_servicesdir = @kde_servicesdir@ kde_servicetypesdir = @kde_servicetypesdir@ kde_sounddir = @kde_sounddir@ kde_templatesdir = @kde_templatesdir@ kde_wallpaperdir = @kde_wallpaperdir@ micodir = @micodir@ qt_includes = @qt_includes@ qt_libraries = @qt_libraries@ x_includes = @x_includes@ x_libraries = @x_libraries@ EXTRA_DIST = $(wildcard *.html) $(wildcard *.gif) docs_DATA = $(EXTRA_DIST) docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) subdir = reference/GRAPHICS mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(docs_DATA) DIST_COMMON = Makefile.am Makefile.in #>- all: all-am #>+ 1 all: docs-am all-am .SUFFIXES: mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) #>- cd $(top_srcdir) && \ #>- $(AUTOMAKE) --gnu reference/GRAPHICS/Makefile #>+ 3 cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/GRAPHICS/Makefile cd $(top_srcdir) && perl admin/am_edit reference/GRAPHICS/Makefile.in Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status uninstall-info-am: install-docsDATA: $(docs_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(docsdir) @list='$(docs_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ done uninstall-docsDATA: @$(NORMAL_UNINSTALL) @list='$(docs_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ rm -f $(DESTDIR)$(docsdir)/$$f; \ done tags: TAGS TAGS: #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>+ 4 KDE_DIST=blueball.gif cref2.gif mail.gif star.gif ski2.gif mart5.gif syntax.gif orangeball.gif bg.gif purpleball.gif linux.gif man.gif redball2.gif utah.gif thumb.gif directory.gif mart7.gif grey.gif master.gif bg1.gif mottled.gif redball.gif computer.gif books.gif ptr.gif yellowball.gif whiteball.gif climb.gif news.gif function.gif linklist.gif help.gif sound_2.gif bluelne.gif DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) top_distdir = ../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ $(mkinstalldirs) "$(distdir)/$$dir"; \ fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(docsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." #>- clean: clean-am #>+ 1 clean: kde-rpo-clean clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-docsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool uninstall-am: uninstall-docsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-docsDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: #>+ 2 docs-am: #>+ 6 force-reedit: cd $(top_srcdir) && \ $(AUTOMAKE) --gnu reference/GRAPHICS/Makefile cd $(top_srcdir) && perl admin/am_edit reference/GRAPHICS/Makefile.in #>+ 2 final: $(MAKE) all-am #>+ 2 final-install: $(MAKE) install-am #>+ 2 no-final: $(MAKE) all-am #>+ 2 no-final-install: $(MAKE) install-am #>+ 3 cvs-clean: $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean #>+ 3 kde-rpo-clean: -rm -f *.rpo c_cpp_reference-2.0.2/reference/GRAPHICS/orangeball.gif0000644000076400001440000000050607055335312016235 GIF87aѥnj1!ނրyΠcΡcΔB|xýƦ{Ƨ{tknjexJ[Vf1TKsHsCk=c:Z3Z5J*J+,k@pH,DKD"XH\ @N9%`tBBh%yBw&("B!#%)(E$$'(E"''"CD A;c_cpp_reference-2.0.2/reference/GRAPHICS/star.gif0000644000076400001440000000043607055335310015100 GIF89aL!5multigif V1.0 (C) 1996 Andy Wardley ! NETSCAPE2.0!P,L*ڋ޼H扦ʶ L+!P,$Cd0@#gM]쇆obS;7ju9!h~B eK ꤒrVeTn*NK;ꝏw2˾zW ;c_cpp_reference-2.0.2/reference/GRAPHICS/bg1.gif0000644000076400001440000000035107055335303014576 GIF87a,Ȅڋ޼H扦ʶ L ĢL*̦ JԪjܮ N (8HXhx)9IYiy *:JZjz +;K[k{ ,N^>[;c_cpp_reference-2.0.2/reference/GRAPHICS/news.gif0000644000076400001440000000061207055335306015104 GIF89a@6!,@6ڋ޼mc+m~!T9G,Vo)y|2VQ|*_`hDcXg8aܕ&.=v1wxW'&CXhH#xEf$ IJAF#*8iv{ 8kŔt E܃ ; {:kD<7{Vj~~;a I;\(ߛZL'o 5unkTMmb}Am}V,2ˆi}ʙon=̈ķOw7MD5D-QJB^MUZjOQ=6ڵlۺ}{;c_cpp_reference-2.0.2/reference/GRAPHICS/cref2.gif0000644000076400001440000000262507055335316015140 GIF89aYU!,Yڋ޼H扦ʶ L ĢL*̦ JԪjܮ N (8HXhx)9IYiy *:JZjzJ Z[;{KQ@ k@\\||\-;m>.E}zn>~Cnu, PoC|R0I߿QmE1S jlIDBbia"qT@J0cy&?I煟3 uhHY@ЋPD3ZUZkStuYjQ@طNmڸH!㛔p1/ D!d^#'\r OAgIlZo8=T^h6m2t&iڮn Nݲoݚ7x+_7^|Mr<^zt=;XW mj%2q_CGk+T[%u3D(@!! 2 X`+ȢR7c2ڂܵhNأ4`J☣!dBNIdRZhd~\IoyazVāYIe ئ{Yy wy u]ҹu *_r9蔌iztPڑW٩r Yƣʚv4gZjp*k[㣴*? u~J!ͺ+v86zuגZ[{Ƹ(Bd.;+4ʻ+{j`^f/0.YGMRLbhrqO"rĽ\˨L3UR;^34JsHn_|tN-Xf,aӣYn -_ݲmmwAϰh|Kb Y}g)֘*,6E#"38Cn8/;g]#:ԑͷjڰ_-vvzԻ$~(0+ӻ|]k}kZ%`]gxn W+`.uZiǿ"0 *uzѳ?/6JjAmx[ ,5K!\E0VO NrxCph TƸD䑨;q}(> b(j1(l! Eipq5cx 8qtn?wVy}|kF [G5ۿyeOpz;PO^|?_O[dI?CvיH$ | :3V@`q v 'zb3^U=E!)գUb\? UCaZ7"!KeYyUWE[BRq9N9ԥIRY&kYb)U2DoYsiM*i򘨣yXhGmRZEFب}NUةb:AE>ڪjBڢ" ;\H";rlHqU߲ʠۭ[K[OAB럟rQOl[G"뜘my7I1+|h6汓1]ja] P]2/3r2@]|z\4.HT/WWW7c~ud *]!jvowsʳwqt{$x[xv#.S1ԆKy%/^n96Orޝ G-s1nr. :;Io^|ȧN|l :_/CϽ_cك}^9>?h_`[p/z k,Pk bw?)i/ jp?p$, Op,l _p4 op< qD,$*qLl(JqT,jq\F>;c_cpp_reference-2.0.2/reference/GRAPHICS/computer.gif0000644000076400001440000000063707055335306015775 GIF89a(,/OOp22R-ͅ?!,(,I8ͻ d Vg{:tsM&ݮq&]Kw=WX%]Q@l0,&j=ptȶ ogM@uwq{=~nz18me]c2RdycxrwdÇfӭ+w؇#D˥g=wD#|n$F1"A ;'pI ,0CMq /C+@h0ŏ#2PAbZT͋:SrC?D93EL˜T lX]e^v;c_cpp_reference-2.0.2/reference/GRAPHICS/yellowball.gif0000644000076400001440000000050607055335317016302 GIF87a1!ccBƽ{{J1ssqskk^cZYWZJJEJ,k@pH,DKD"XH\ @N9%`tBBh%yBw&("B!#%)(E$$'(E"''"CD A;c_cpp_reference-2.0.2/reference/GRAPHICS/linklist.gif0000644000076400001440000000273407055335307015771 GIF89a !, ڋH扦ʶ Ǧ!t bgL*& Jj׭ &v5>lO {ߛR_X6'X8g(D7hCe )# 噉YzFʲz֚X9b+ pk3勆 Rx0cY<#<,(pK3@\DWMNݾK>|̽>`_> (,/Ē黧wY;0D| q+rd(эÍ6%J-O1V1z.kƤXP~:YCܹ3"LO̫߈*MqWPcH6mU:Z\-,L~KQ*L4ӿCn {Up·;S'nزeҔlHǏGҸ&#OllU&{M~T-\V)N'ڭ?=$3yf>%wb>4Go??k}MH`Hw~ µ rp^6rBx(zq螈؞f(a0'c4ZxXm(uDaH&i~)MViPdXfuc5(udha kyYͩfav޹'$`(g~D(xrN舂f(m 褈ZJc&馻uj]:^rDmT$Ꜫeʃ"LCl8k/nAD홪Xδ`楫Yiյ8&oaOqdMI ZěPPx+UFCHWOҿFi_+vp)E2G!FWjZlԖ|-,T.چ"Sa?Y$3u1bx:kBrg KM4ј-r|Dq.AV+6O?i,>)  g`nD+8Aa y.i0C E>*'l[xZTO[F"ACِ{ȡ5BO)"Y B=F $BW>b*bn[t70FO"HFh<.>WR+1s{ZFc-̣hQD|> G9#5Njg$Iq͏aSW(Mit!D%6 ^iIw".wE`~V0 yL@su@yFZ-`0L}n$[yp@ع5^xSnrtcw|68z|hbyl~kuvk(wk]aT-Z'ǹs>|ױS ;c_cpp_reference-2.0.2/reference/GRAPHICS/utah.gif0000644000076400001440000001455407055335324015103 GIF89auƽ{{{ssskkkcccZZZRRRJJJBBB999111)))!!!{{ֽcZZ筜ֽεƭss1))ƥ{{ssZJJΥ{{ss֥kRRcc{{B11!kk9))R99kk{{1!!cBBZZZ99RRB))ZZcc)JJRRJJc111!k11s11999k))11Z!!Bs)){))c!!111k!!11R{!!Z!!B!!!))kJsR)!!Z!!!!!!1ks9{BJRZcks{{skcZRJB91)!1))!!!{s1)skkZs)!cRZ)!{B!ֽƭs{{{޽έZccBJJ{!))ss{!B9Bs{!{1BJ!)s9Bc19Zcc)1B{19{)1c!,uH*\ȰÇ#JHŋ3jȱǏa\Aȓ(S.a]&)`@B P8n\ŲEN[F!G=r1+XMf !ˈ澸eԷY U g ȑCܶ\u҂0Kw:W!M?0֡Zl&hGĄLZu*CkY-#6R,' `kXxetͮ[`՟u;'o lh(,Y[+Xl݀;R2X"+vpQ ȰBKh.2"Bm X2K.- ",͌ FH'+0-@C2@,\N7LT2ł/v.To@s 8¥14@,x30" 2(bX0?d%m,Yy2K q@+#,4BHb,v.4Pi-wyc[hŒ"8 lax3Kڲ+4W)B $&ytN̲Ꟑ "p-"˟(.#葕BhB+-\ߥk2pԂeUH"ԐK"Ҩe.#-5)bRɠKn+I@y"5QKPYY]P|)--<.QJo:Uh,8!g`&:D?<@ >H>EHb\,'皲C8>RsӇP)@ۢpPP@Nc$X ,Im"ˠ$1 (Br .~N-|-@_opllT9,`E$d$"zaTXoN GP"UA78 ּ aFC]N(x*$aU/< ^>p;s(E. # B?{ ˋ}*}`H 'a8F@YC ɳ:%NAW>_s`^vL@;BZ0u1r9#%P@CKdq =T,"*Y 8 bQ^oD V!9|  vVP w p ` ` w xMhE QW b$@t _P,4lBb|| v0Av 0 i`80 u@ye( iGoTB]gvap  P P cffBp/8v0lfFFFVhUhdP@ =0TT@On$ЌFPd{X||臵@h~(@iL yD`i 9I0`A@YdFFvq0G3 7 ^;}H8P `< PىXeFhfhfIPk0FlA[3aa b`u} a@4avh`XPaa9a͘aaIko@V֒!t) vo1 ^Lfv@P[wZfЕ@e6u^X01ٜv aZM1u ZvIxJ&gH`;鋿' `1)kYePz`h חfBP !:Zf0Y 9xilnydqh&9pzd& {)Bhop?jdʞ6Av P`ax kGNЋayԁmUyl9l`faP0쉨G^8 (x  v& `uZrAxj ilah&}*lPQ^{* pfJLjvhJ dU.QX>:iHIyaלfayꧺJ O:େʬW`l9Ve kPk`J3)vZ  z*i`Q|}*$: r(}Uh/*dXe ԡ3iѤXى @ lZorWG)їۯ8E: @gM{6{ck.W[xaײIQ[s5-P [aPfdZx:|>PG @e%Pe [4;(9Hٶ 7ELHdMjV 0yK`[@;Yxz;e*v JKv%nê p>*-k{ǫ 6z YQƞG鈫ˮh!kJ0^ Ћ8^`:̶!|198Zujko/<=±l*% "e٪y,[[`N EhaUR*[ b'palv)ۥ  lhsy'91yf™YLv1x([aTʞasFX(wy 1h;kv~ohZVZEʭ`h|5L,v lVkAa1y9aC+dZ꠿r+]W FP\r PpEi<H[̤ɪѲ.wd苤J6 eihhZeźku PԢӄa_ƯZȌ.Ѧ Ape qk׀/ Pk ؁ p؀b-{059A)$Sګ}۶ګڪMBR&i& ۼŽ۬m! 9#ԭ pBB$q-`[Mؿ'}f0ޫhPݐw< U6VQ0/^ac&h8akaLYքip{ËV ё P[ҫ:|Yι.hi Yƙ볾Raۑ m|;1X F6 =e*kF}&r'deu&Bf;/ &:[ \΄uaya/hT6-fkv\ YҮv~\їߺ|b뽫/x>cZ`1)I-]֭y̞#G9o}9~n|dnol)Bj," ^y-l!׮D je]]Fls9o |\j|^y)O `>y ' kKݨ.¡"\֎l1ahH+rvٹ_A>|u)[ZW<@!s0> 9Qv^=?1 ȸ" Y"҄#<;?O df|&␸u{1yoN*O!vojy$\Q?ˎҟğﶛZͥᏣwN*H` <၄ 1((@ 7(0G!E$Y$I6 H0Ѓ xGB 09QNJ@.@(@˘+0y3,p`&֢Co.,RU1 @X# +^` Hx-VV@_С la1 iF ZD*4>el'SXZI9TjS?)3\Id.-Eaz4Sycki?Q/ R͊Yi4C@1Pr@hd#`BTSa?WXڅfAz@REd89MA 1/ b uۅ䐂C>[6ce?TQ :WeFP4^INj@9TPa5bMCF 20RMU8Ԕ'p`OOP"d\H7U %QjJ*Z E =C0' Z&p%\p>CK%O$)a@۵yVo0F(@&YJ #qLKOER3%p$fjȢG6!]l 7Ó" r̹ rgQbPC (H(ΰ(D0c .9)$ BR. v/f0`tr `J9:Ȣa/)3²C&l7NS^ rxd]N"&u| e(C$HyBKO@Dn0N:yC HCF)B(-. v+ 9FdÂ$DO'O?%4gQ L]oҼ11Բƹ6W1`F D-*1kHR+P `%No;<[qڐ/hgc9N(tŒ~!v@խdx [P)"*\`vǏMȈ@0@CQ$Q@G;o0`q)0sa{Ղz8@>n"H"3X uja@ XFfԣeFtʗRU?C8^XU Ka@ 0鰀! ,(MGH*\Ȱ!A7%ʀŋ\}0u\EH QH!A1ɽFΛWl]96[h(S\as?=9 W ^t_*C=zbĐpJH7{ZU⇴gxFD$Ht01గL-NSJ/ kT+}U0vP֋`ŭ=IIͻW)k $Ağ`-+_nmْSS2nDDP.]!9p.Q̴ǯD?h( 3 ø?dEhXd!ogbNpn e0.bkOp3l \A1 !^)C. " }C$rV C?ۏ|?w<E1K1|߀[w 4A"p;^JEp@h/Pc (H''B= !<=5 1}<8m{؁蛚_.K!v^p4 ur/q.& E첎͓ &[)Ea)glŢ=lK2찒=j {PF& qS!G,Rx \p Lё.p:$sWP0p߬ FQi!nVvaDW%VƔJ'Y쓆rQفQ$ f*'uo!X/- ab`#]}@ X xp "#LcǮ <# /3$2X\R0X (ق ?r!aiCoXRly *)5Үdl !1#~DCeqEFa_Ci!a! *ԱT0kK~"YmdfA.`%Y"P1ʂ3#PKH RA "g481q|!:8X`DaAB0+A s-ECi4( ! R0!GNy.PhWQ;@IpTBv<2 PFu=?2 c{xF`($sI Ш#p 7h SR dЀ,A !,,(MGHA/:V-^H1@C(10PơF.]j#$ ߡ8#,S7_%ө޿z8CՊ ˘J5@•뤈$&Wj*K /~hP=ʥ1la_W?K,o|c04x4M=[-R<{ňJIUˊ9Z!c8nLK('H߲i,yu"֞j8)+[-ǣ2Y7`A5 9GS9Kbrx 줐" b* U[H%A .@ZWH N .CF!A7 vt8E:+3C&2E gH? +5+Ѓ| , 125`tvBd2l@"P%P1 u#,]'rӏhPJ@@1d oZ-\# J v!Ba^%"fIc!-\CÇᒾPx  Z,iL"9氖AbA?/Ԏ%Ȃ4x?NA : 8B.M5)4|K2!p(=8{C.Wݎ0 D/.P :h*TШ@Q9DGP`&H;c_cpp_reference-2.0.2/reference/GRAPHICS/redball.gif0000644000076400001440000000052007055335306015533 GIF89a{BkJc{BRJB9{9Z1{RB)R9)1!cB)ZB1c11Z!Js1s!JJcck!1J!,m@pH,Ȥr) Ay$ "A x$ P`pD$bQGァ@2v j !"v #$!%v&''!(B ""A;c_cpp_reference-2.0.2/reference/GRAPHICS/linux.gif0000644000076400001440000000136107055335243015271 GIF89aD=II    !,D=I6h!'`(Xi (h},kF3m84^@`5X >ԛ(ZHfܴ cdEܕ]B!QMxSylRl2)[Pn "D# _hTlja3D]A(_( ċnj&NNC '> DovTܻ6ĥbNŚPL|4Q (XЦ`sm"f&^TX?F)۳;Ce? _.4?[xUi(%T6ETRtA5ZOIzFf7]-X?1E,ᕥJloI4˳œh-\5wfkbGukU0Mһ+`Qɧ\S]иրM6cqߑ<1$cg7W1&]wa~vpuE1 Ump$t>qju +=rwT߆0tmחn]_}a_Rx}%]fZ8YBve6DWb=ww"4p*BW20IF22Bx p~>>BXN6+E6n0ecyiyB9Fک=xnf;c_cpp_reference-2.0.2/reference/GRAPHICS/help.gif0000644000076400001440000000041507055335306015061 GIF87a((nnn,((pH+ ͻ`)fh؆pY)0Mx?5l@,oWHh:p">'i v|hݜF&v hsfy=o~xj>o>}dmqw|7qrblKicCiZkA}!02¯1{F=ˢR1Χѽץӂ8^Hʕ>#+ ;c_cpp_reference-2.0.2/AUTHORS0000644000076400001440000000027307055341616011357 ***Content-Author*** Martin Leslie ***Main-Package-Developers*** KDevelop Team *** primary contact addresses *** kdevelop-team@barney.cs.uni-potsdam.de tasin@e-technik.fh-muenchen.de c_cpp_reference-2.0.2/libtool.m4.in0000644000076400001440000005501507244431673012631 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- ## Copyright (C) 1996-2000 Free Software Foundation, Inc. ## Originally by Gordon Matzigkeit , 1996 ## ## 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ## ## As a special exception to the GNU General Public License, if you ## distribute this file as part of a program that contains a ## configuration script generated by Autoconf, you may include it under ## the same distribution terms that you use for the rest of that program. # serial 42 AC_PROG_LIBTOOL AC_DEFUN(AC_PROG_LIBTOOL, [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl # Save cache, so that ltconfig can load it AC_CACHE_SAVE # Actually configure libtool. ac_aux_dir is where install-sh is found. AR="$AR" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC="$MAGIC" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $lt_target \ || AC_MSG_ERROR([libtool configure failed]) # Reload cache, that may have been modified by ltconfig AC_CACHE_LOAD # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) AC_DEFUN(AC_LIBTOOL_SETUP, [AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl AC_REQUIRE([AC_OBJEXT])dnl AC_REQUIRE([AC_EXEEXT])dnl dnl # Only perform the check for file, if the check method requires it case "$deplibs_check_method" in file_magic*) if test "$file_magic_cmd" = '${MAGIC}'; then AC_PATH_MAGIC fi ;; esac case "$target" in NONE) lt_target="$host" ;; *) lt_target="$target" ;; esac AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(STRIP, strip, :) # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], [libtool_flags="$libtool_flags --enable-dlopen"]) ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [libtool_flags="$libtool_flags --enable-win32-dll"]) AC_ARG_ENABLE(libtool-lock, [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" AC_ARG_WITH(pic, [ --with-pic try to use only PIC/non-PIC objects [default=use both]], pic_mode="$withval", pic_mode=default) test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" # Some flags need to be propagated to the compiler or linker for good # libtool support. case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_SAVE AC_LANG_C AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_RESTORE]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) # recent cygwin and mingw systems supply a stub DllMain which the user # can override, but on older systems we have to supply one AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, [AC_TRY_LINK([], [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); DllMain (0, 0, 0);], [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) case "$lt_target/$CC" in *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) # old mingw systems require "-dll" to link a DLL, while more recent ones # require "-mdll" SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -mdll" AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) CFLAGS="$SAVE_CFLAGS" ;; *-*-cygwin*) # cygwin systems need to pass --dll to the linker, and not link # crt.o which will require a WinMain@16 definition. lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; esac ;; ]) esac ]) # AC_LIBTOOL_DLOPEN - enable checks for dlopen support AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_SHARED, [dnl define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac], enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) # AC_DISABLE_SHARED - set the default shared flag to --disable-shared AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no)]) # AC_ENABLE_STATIC - implement the --enable-static flag # Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_STATIC, [dnl define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac], enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) # AC_DISABLE_STATIC - set the default static flag to --disable-static AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no)]) # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(fast-install, changequote(<<, >>)dnl << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac], enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl ]) # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no)]) # AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library AC_DEFUN(AC_PATH_TOOL_PREFIX, [AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC, [case "$MAGIC" in /*) lt_cv_path_MAGIC="$MAGIC" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_MAGIC="$MAGIC" # Let the user override the test with a dos path. ;; *) ac_save_MAGIC="$MAGIC" IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="ifelse([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC="$ac_dir/$1" if test -n "$file_magic_test_file"; then case "$deplibs_check_method" in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" MAGIC="$lt_cv_path_MAGIC" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | egrep "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$ac_save_ifs" MAGIC="$ac_save_MAGIC" ;; esac]) MAGIC="$lt_cv_path_MAGIC" if test -n "$MAGIC"; then AC_MSG_RESULT($MAGIC) else AC_MSG_RESULT(no) fi ]) # AC_PATH_MAGIC - find a file program which can recognise a shared library AC_DEFUN(AC_PATH_MAGIC, [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) if test -z "$lt_cv_path_MAGIC"; then if test -n "$ac_tool_prefix"; then AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) else MAGIC=: fi fi ]) # AC_PROG_LD - find the path to the GNU or non-GNU linker AC_DEFUN(AC_PROG_LD, [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) case $lt_target in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case "$ac_prog" in # Accept absolute paths. changequote(,)dnl [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' changequote([,])dnl # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(ac_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else ac_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$ac_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_PROG_LD_GNU ]) AC_DEFUN(AC_PROG_LD_GNU, [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then ac_cv_prog_gnu_ld=yes else ac_cv_prog_gnu_ld=no fi]) with_gnu_ld=$ac_cv_prog_gnu_ld ]) # AC_PROG_LD_RELOAD_FLAG - find reload flag for linker # -- PORTME Some linkers may need a different reload flag. AC_DEFUN(AC_PROG_LD_RELOAD_FLAG, [AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, [lt_cv_ld_reload_flag='-r']) reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" ]) # AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics AC_DEFUN(AC_DEPLIBS_CHECK_METHOD, [AC_CACHE_CHECK([how to recognise dependant libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='${MAGIC}' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [regex]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given egrep regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case "$host_os" in aix4* | beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi4*) changequote(,)dnl lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' changequote([, ])dnl lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin* | mingw*) lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='${OBJDUMP} -f' ;; freebsd*) lt_cv_deplibs_check_method=pass_all ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; irix5* | irix6*) case "$host_os" in irix5*) # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" ;; *) case "$LD" in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac # this will be overridden with pass_all, but let us keep it just in case changequote(,)dnl lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" changequote([, ])dnl ;; esac lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux-gnu*) case "$host_cpu" in alpha* | i*86 | powerpc* | sparc* ) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM changequote(,)dnl lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; changequote([, ])dnl esac lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` ;; osf3* | osf4* | osf5*) # this will be overridden with pass_all, but let us keep it just in case lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' lt_cv_file_magic_test_file=/shlib/libc.so lt_cv_deplibs_check_method=pass_all ;; sco3.2v5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all lt_cv_file_magic_test_file=/lib/libc.so ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) case "$host_vendor" in ncr) lt_cv_deplibs_check_method=pass_all ;; motorola) changequote(,)dnl lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' changequote([, ])dnl lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; esac ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method ]) # AC_PROG_NM - find the path to a BSD-compatible name lister AC_DEFUN(AC_PROG_NM, [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(ac_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. ac_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -p" break else ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm fi]) NM="$ac_cv_path_NM" AC_MSG_RESULT([$NM]) ]) # AC_CHECK_LIBM - check for math library AC_DEFUN(AC_CHECK_LIBM, [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case "$lt_target" in *-*-beos* | *-*-cygwin*) # These system don't have libm ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, main, LIBM="-lm") ;; esac ]) # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library, adds --enable-ltdl-convenience to # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed # to be `${top_builddir}/libltdl'. Make sure you start DIR with # '${top_builddir}/' (note the single quotes!) if your package is not # flat, and, if you're not using automake, define top_builddir as # appropriate in the Makefiles. AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case "$enable_ltdl_convenience" in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la INCLTDL=ifelse($#,1,-I$1,['-I${top_srcdir}/libltdl']) ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for # the libltdl installable library, and adds --enable-ltdl-install to # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed # to be `${top_builddir}/libltdl'. Make sure you start DIR with # '${top_builddir}/' (note the single quotes!) if your package is not # flat, and, if you're not using automake, define top_builddir as # appropriate in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, main, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la INCLTDL=ifelse($#,1,-I$1,['-I${top_srcdir}/libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" INCLTDL= fi ]) dnl old names AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl dnl This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL])dnl c_cpp_reference-2.0.2/INSTALL0000644000076400001440000001655007244442077011350 Basic 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 a while. While running, it prints some messages telling which features it is checking for. For installation to KDE 2.x you don't need to specify the version. For installation to KDE 1.x use : ./configure --with-kde-version=1 REMEMBER: often you have to use also --prefix= and --with-qt-dir= to specify the pathes AND: once you have used ./configure the pathes are in the cache file (config.cache), so if you want to change the configuration to use it with another KDE version, you have to delete config.cache first. 2. Type `make' to compile the package. 3. Type `make install' to install the programs and any data files and documentation. 4. You can remove the program binaries and object files from the source code directory by typing `make clean'. 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. 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. `--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. `--with-kde-version=(1|2)' Specify the kde version of the installation. `configure' also accepts some other, not widely useful, options.