bcpp-20050725/0000755000175100001440000000000010271257370012667 5ustar tomusers00000000000000bcpp-20050725/CHANGES0000644000175100001440000003333310271255542013666 0ustar tomusers00000000000000-- $Id: CHANGES,v 1.32 2005/07/25 21:36:34 tom Exp $ -- Thomas E. Dickey 2005/07/25 + add COPYING (request by Peter Hille). + fixes for Intel 9.0 compiler-warnings. + add AC_EXEEXT and AC_OBJEXT checks to configure properly with cygwin. 2005/05/16 + fixes to build with g++ 2.95.3 + add .SUFFIXES rule to build with Solaris make. 2005/04/10 + correct some regressions introduced by 2004/10/27: + check if a line began as part of a quoted string string before computing its indentation. + count indent-level for curly-braces within #define's. + improve configure check for g++ warnings (from ncurses). 2004/10/27 + correct logic that tracks state of preprocessor lines that continue from one line to the next. The additional lines were not marked as preprocessor lines (report by Edward Bishop). + update configure script, fixes a check that added some gcc warning options which are not recognized by g++. 2003/11/03 + correct one of the valgrind fixes from 2003/04/23 which used delete[] in a special case where delete was correct (reports by Gert van de Kraats and John Whitley ). 2003/04/23 + fix several mismatches between new and delete (versus delete[]) reported by valgrind. + add place_top_brace_on_new_line to config, with corresponding command-line options -tbcl and tbnl to disable or enable it respectively. This is for the special case of the top-level brace, e.g., at the function-level, to better match K&R style braces (request by Daniel Lin). + modified run-test script to facilitate testing variations of bcpp.cfg 2002/11/24 + check in OutputToOutFile() for a trailing C-comment fragment which happened to precede code on the same line, e.g., */ a = b; and split the line to avoid constructing a = b; */ (reports by Andreas Werner and Yanir Lubetkin + add isFinalComment() check to ensure that embedded comments are not moved, e.g., void myFunct(int /*number*/, float* /*data*/); (report by Andreas Werner). 2002/11/23 + add a simple configure script. + rename UNIX makefile to makefile.unx, changing compiler definition from "gcc -x g++" to "g++", since that no longer works with gcc 3.2 (report by Don Park ). + remove obsolete 'unix' subdirectory. 2002/05/18 + add indent_both_braces config-file option and corresponding command-line -nbbi, -ybbi options to allow user to indent both leading/trailing braces of a block by one level (adapted from patch by Brad Mettee ). + add brace_indent config-file option and corresponding command-line -nbi, -ybi options to allow user to indent the trailing brace of a block to align with its content rather than the beginning of the block (detailed request by Edwin Robert Tisdale ) + correct isContinuation() by ignoring backslash characters within comments. This makes it handle comment blocks such as /*******\ * BUG * \*******/ (reported by Andreas Werner ). + add makefile.blc for Borland C (from Chris Elliott ). + remove references to obsolete email address + add CHANGES file, document the sets of changes I marked in RCS + add MANIFEST file. 1999/08/10 + makefile: do not link with -lg++ anymore + makefile: change $D to "./", to make vile follow the compiler warnings more easily + add __FILE__ to traceOutput() calls + fixes to compile on SunOS 4.x, which needs the stuff prototyped also, change interface of traceInput() and traceOutput() to add __FILE__ + fix a case Jeff Gilliat pointed out - an inline C comment fragment resulted in commenting out the code on that line. + mods in IndentNonBraces() which serve to distinguish "public:" which is a class scope from "public" which is a Java type. Otherwise we get odd indention for the latter case. + backup.cpp: had allocated one char too few for ".orig" suffix 1999/01/21 + rename the backup file to .orig, since "~" confuses WinNT's directory scanning, making it return the same file more than once. + open the output in binary mode, so we get ^J's rather than ^M^J's 1999/01/04 + kludge to ifdef for g++ versus M$ Visual C++ + kludge to compile in case we have the misfortune to use gcc 2.8.1 with Solaris's header files (some idiot decided to undef __STDC__ in g++ because they disapprove of using __STDC__ for ifdef'ing). + change defaults in bcpp.cfg to use_tabs=yes, and comments_with_code=33 (the original bpp.cfg is in top-level). + baseq.cpp: fix so we do not try to peek into a negative index + add top-level bcpp.cfg, indent.bat, indent.cfg as part of port to win32. + add txtdocs/manual.txt to distribution, updated wpdocs/manual.doc 1999/01/02 + mods to "work" with tisca.h, which contains a number of comments within long multi-line comments. This isn't quite right, since lines containing only a backslash are deleted, where they should be combined just like blank lines. + add run-test file (used with regression test-cases not part of the distribution). + implement html.cpp, to provide limited support for indenting JavaScript embedded in HTML files. + split-out backup.cpp to support renaming of the original file, preserving its modification-time, to allow recovery if the indent is not needed (makes no change), or otherwise should be discarded. + implement verbose.cpp, to support interactions such as stopping processing a set of files on an error. + change scattered printf's to call verbose(), and fprintf(stderr's to warning(). + rewrote ReadLine so it doesn't use fseek/ftell (which is a porting problem). + config.cpp: removed a lot of ugly/repetitious code + config.cpp: moved ShowConfig here from bcpp.cpp + debug.cpp: change trace() calls to not use stderr explicitly. 1997/04/04 + first draft of logic to reset indent-stack at the end of a multi-line preprocessor command. also, fixed (?) a bug in splitting continuation-line (but there's more) + allow unrecognized preprocessor-lines to be indented + refine a change to allow for things like "else return;" + replaced a couple of strcmp calls by CompareKeyword to allow for matching both "else" and "else if" statements. + fixes for places where we split a line that has continuation-marker on the end. while I was at it, trim redundant whitespace before the '\', to make it uniform. 1997/01/07 + tabs.cpp: fix a place where I trimmed trailing blanks from data w/o trimming state, causing bogus results with baseobj.hh, due to overrun in later logic. + lots of spelling corrections. + fixes for stricter gcc warnings 1996/12/24 + update copyright notices. + refined adjustment of inline comments to work with hanging.cpp, which doesn't take that into account. + remove unused logic for adjustHangingComment, since I'm doing this in a different way. 1996/12/17 + execsql.cpp: refined hanging-indents to account for statements other than the two block-styles we use + make SqlStruct a class 1996/12/12 + shift-adjust dangling else{} block + makefile: record the debug-ifdefs + hanging.cpp: make HangStruct class to get rid of static variables + bcpp.h: made HangStruct class + change hang_state from an int to a class + made singleIndentLen obsolete via hanging.cpp 1996/12/06 + tabs.cpp: mods to allow tabs in OutputStruct.filler + fix a few leaks + ensure that hanging comments remain hanging when re-indenting. + use tabs for OutputStruct.filler 1996/12/05 + tabs.cpp: correct leading-whitespace conversion (space is printable ;-) + hanging.cpp: remove redundant reset of hang_state + debug.cpp: SunOS 4.x needs stdlib.h for size_t + add InputStruct.offset + add OutputStruct.splitElseIf + remove IndentStruct.firstPass, because hanging.cpp does it better + mods to preserve code-fragment's offset to use in shifting block-indented C-style comments + fixes for offset adjustment due to stripping whitespace from fragments in DecodeLine + first cut of logic to pass offset of code-fragments into InputStruct (to use for categorizing hanging comments) + revised logic for split else/if statement using flag 'splitElseIf'. this fixes the problem of indenting the code undef 'if'. + mods to make TestLineHasCode look at the parse-state (which is more reliable) + remove IndentStruct.firstPass logic, since hanging.cpp does it better + add pBFlag to OutputStruct to use in hanging.cpp 1996/11/15 + tabs.cpp: correct off-by-one in return from skipEscape() that ate trailing quote. + bcpp.h: rename OutputStruct.pState to OutputStruct.pCFlag + bcpp.h: add OutputStruct.pBFlag + use OutputStruct.indentHangs + split-out hanging.cpp + hanging.cpp: add 'do_aggreg' flag + hanging.cpp: use new member of OutputStruct, indentHangs to allow merge with info from execsql.cpp 1996/11/08 + move emptyString to bcpp.h + pass-in Config struct to IndentSQL, making it pass by ref everywhere + move some string-parsing to strings.cpp, to re-use in execsql.cpp + move debug/trace code to debug.cpp + move input/output/indent definitions to bcpp.h + align successive else/if + don't set interfunction-spacing for lines that happen to have R_CURL, if there's more on the line. + add indent_exec_sql to bcpp.cfg + execsql.cpp - quick hack to indent non-keyword stuff extra + move some functions to strings.cpp from bcpp.cpp, for use in execsql.cpp 1996/11/06 + restructured keyword-lookup to add 3rd type (blockLine). use this to fix case (successive lines) with "while", "switch" -- the curly-braces for "switch" weren't indented under "switch". + also, dropped special logic for singleIndentLen, making it the same as a standard indent (was too ugly). 1996/11/05 + propagate parse-state via InputStruct to OutputStruct. + correct potential indention of continued-string fragments. 1996/11/04 + moved string-table to config.cpp + fix uninitialized-memory-ref (Purify) + unused parameter. + add indent_preprocessor + simplify config.cpp a little using overloading + corrected some minor bugs affecting indention + add "#else" to typeOfPreP(), along with all other standard directives. + use enum rather than int for 'attrib' types. change name of one 'attrib' type to make it easier to maintain. fixes for TRACE. + first cut of indent_preprocessor option + modify so that both comma and semicolon are treated specially after '}', to make data lists work properly + correct a couple of special cases with multi-indent 1996/10/31 + fixes for memory leaks + corrections to tab computation + add special state for '#' pre-processor lines + makefile - move some symbols to accommodate non-g++ + add POUNDC + mods to track preprocessor-lines + reduce ConstructLine to a single-level switch, rather than the nested one that will get in the way of mods for execsql + refined logic in dontHangComment(), fixing a case I missed before. + correct a logical-reduction for matching against PreP types + suppress inter-function spacing before "#endif" + add pType to OutputStruct so I can tag them as PreP when needed + fix while-loop that was expressed as for-loop with break + undid unnecessary if-level in ConstructLine + restore leading tabs in comments if we're expanding tabs + moved the non-printing character conversion to tabs.cpp 1996/10/20 + moved delete for lineState into bcpp.cpp + make pString in/out for ExpandTabs + modify ExpandTabs to maintain a string of CharState values + corrected state: allow tab-expansion in // comments + add strings.cpp + make pString in/out for ExpandTabs + fixes for include-order (bcpp.h should be last) + reduce FindStartofComment and FindEndofComment to return index instead of pointers + revised FindPunctuation so it returns an index rather than a pointer, and uses the pLineState info so that we can easily discard quoted punctuation (which didn't work for a complicated string, e.g., "'\\0','\\0'}"). + changed allocation scheme of lineState + drop CComments param of DecodeLine, since pLineState contains proper info + fixes for blank-lines: ensure that we don't emit trailing blank-lines in a file, that except for inter-function blanks, we reduce runs of blank lines to a single blank, and that there's no lines (even comments) that come out with trailing whitespace. + simplify allocation/deallocation in DecodeLine by leaving pLineData alone. + a couple of Purify-fixes + modify ExpandTabs to maintain a string of CharState values; use this to retain parsing state so I can correct blank-trimming (so that continuation lines of a string aren't trimmed!). 1996/10/12 + split-out bcpp.h and tabs.cpp + moved tab-expansion (and tab-spacing) into separate file, first to fix an error in tab-expansion (wrong fill amount), then to allow rewrite to capture left/right CharState, to prevent quoted tabs from being expanded. Also, moved L_CURL, R_CURL, DQUOTE, SQUOTE into config.h, making capitalization consistent. + fixes for multi-line C comments + implement shiftToMatchSingleIndent, peekIndexOfBrace, chainedSingleIndent + better logic in resetSingleIndent(), to reset all pending single-indents + ifdef'd trace code so I don't have to uncomment it added clause in IndentNonBraceCode to (try to) reset singleIndentLen immediately after "{" -- works in one place but not another + eliminate single-char constant-strings to use strchr instead of strstr. use FindPunctuation to simplify some logic + new function CompareKeyword fixes parse ambiguity with strstr allow combination of tabs and spaces. bcpp-20050725/COPYING0000644000175100001440000000270310271256561013725 0ustar tomusers00000000000000$Id: COPYING,v 1.1 2005/07/25 21:45:21 tom Exp $ BCPP - Beautify C++ Source Files -------------------------------------------------------------------------------- Copyright 2005 by Thomas E. Dickey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, distribute with modifications, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. bcpp-20050725/MANIFEST0000644000175100001440000000653610271257156014034 0ustar tomusers00000000000000MANIFEST for bcpp-20050725, version t2005-07-25 -------------------------------------------------------------------------------- MANIFEST this file CHANGES change-log for BCPP COPYING copyright and license README top-level README for bcpp VERSION version of this package aclocal.m4 autoconf macros for BCPP bcpp.cfg default configuration for bcpp bcppall.bat run bcpp for a whole directory config.guess utility script config.sub utility script config_h.in template for config.h configure configure script for BCPP configure.in configure-script template for BCPP configure Configuration script for UNIX indent.bat script for format all C/C++/Java(Script) files indent.cfg alternate configuration (larger queue) install.sh install-script makefile.in top-level makefile templace for BCPP mkdirs.sh mkinstalldirs code subdirectory code/.vilerc vile settings code/anyobj.cpp the base class for all objects... code/anyobj.h interface of anyobj.cpp code/backup.cpp backup original file, restore if no change is made code/baseq.cpp objects which are descendents of ANYOBJECT code/baseq.h interface of baseq.cpp code/bcpp.cfg sample config-file for bcpp (used in testing also) code/bcpp.cpp main program (Beautify C++) code/bcpp.h common interface/defs for bcpp code/cb++ sample unix script, used for regression testing code/cmdline.cpp command-line options-parsing code/cmdline.h interface of cmdline.cpp code/config.cpp config-file reader code/config.h interface of config.cpp code/debug.cpp debug/trace functions for BCPP code/execsql.cpp module to indent embedded SQL statements code/hanging.cpp compute hanging-indent of multiline statements code/html.cpp test for HTML vs JavaScript code/makefile.blc makefile for Borland C code/makefile.in makefile template for BCPP program code/makefile.unx UNIX makefile (g++) code/makefile.wnt makefile for M$ Visual C++ code/run-test test-script code/stacklis.cpp container class that stores items in a linked list code/stacklis.h interface of stacklis.cpp code/strings.cpp simple string-utilities code/tabs.cpp tab expansion/conversion for BCPP code/verbose.cpp all output to stdout or stderr txtdocs subdirectory txtdocs/bcpp.1 manual, in UNIX manpage format txtdocs/hirachy.txt text-version of class-hierarchy txtdocs/manual.txt text-version of manual wpdocs subdirectory wpdocs/hirachy.doc document, in WP51 format wpdocs/manual.doc document, in WP51 format bcpp-20050725/README0000644000175100001440000001300107567703741013556 0ustar tomusers00000000000000-- $Id: README,v 1.2 2002/11/23 13:51:29 tom Exp $ -- This is the original README - see CHANGES for a current history -TD ------------------------------------------------------------------------------- History ------- Version 0.9 ----------- Heaps of bugs, should never been released. Version 1.0 ----------- Heaps of bug fixes, have tested the program heaps, and tried to extract 98% of the errors, any bugs found while using this program are to be considered as undocumented features. Future Versions will include most of the limitations of version 1 fixed. I haven't fixed these yet as I'd rather have a program that works happily instead of one that is giving me eternal hassles (plus project dead lines). The next updated version will be released within early December. Version 1.5 ----------- - Couple more bug fixes, and some code optimisation. - Unlimited (ram limited) amount of line decoding so even the most tangled code can be decoded (uses recursion). - Unlimited amount of single code indenting is provided (fixed from last version (uses recursion)) - Options for program can entered via command line, or configuration file. - Operating system I/O redirection is fully support within the program. - User definable line buffer size. I have tried to test this program rigorously to see that I have no rouge pointers lying within ... (fingers crossed). Anyways it ran fine under Qemm, and Windows (i.e. no exception errors due to incorrect memory access). Using Qemm V7.0, the program uses DPMI memory allocation so you the program allocate memory exceeding 640 k in MS-DOS memory model. This is done by processing large files (i.e. 1 meg+), and using a very large buffer (i.e. 10000). Large buffers above 10 are not really require and will slow processing because of extensive searching (plus my Queue object isn't the fastest of designs ever). Version 1.55 ------------ - The only real update is working the code so that it functions/compiles under Unix. - Removed all segmentation violations. - Fixed a couple of little things ... I forget. - Input redirection under DOS fails, but works under Unix. Version 1.6 (Final) ------------------- This will be the final release from me of this software. This version fixes a few more bugs, some small, some large, but I think this time the program is about as stable as I'm going to get it. The code will still be able to compile under both Unix, and MS-DOS. - Added a backup file feature. - Added a time feature just for the hell of it. - Fixed a decoding problem with quotes - Fixed a decoding/construction problem with tabs. The current method will expand all tabs to spaces that are ready via the input data stream. Version 1.61 (User Update) -------------------------- A Canadian programmer (Justin Slootsky) introduced a new feature into this program that allows code that has no accompanied code to be indented as per normal code. Although just a few lines of code, this new feature is very effective. Version 1.629 (Bug Update) --------------------------- Fixed a couple of minor bugs that would cause a little havock. Added preprocessor handling, so that any preprocessor commands are always place at position 1; Version 1.7 (Bug Update) ------------------------ Fixed C comment process bugs. fixed locating configuration file (i.e uses argv[0] now) unless -fnc switch is used. Version 1.75 (Bug Update) ------------------------- Fixed single statement formating over multiple lines (i.e. if, while type statements) Fixed a couple of simple errors that Manuel T. Petit pointed out in my code. Version 1.8 (Bug Of A Bug Update) ---------------------------------- This bug was created becuase of Unix's perdantic checking of memory (i.e. MNU). I haven't checked all the conditions of a certain section of code, this caused an 'if' statement within case structure to prematurely be trashed. The result of which is the indent structure is removed and the code output doesn't align correctly. Util ---- Text Conversion: I've provided a program than when compiled will convert MS-DOS text input UNIX text using standard output, or Unix text to MS-DOS text (OS dependant). Use this program to convert my source so that it can be compiled without worries of carriage returns. Compiling --------- The only OS type system that this program has been fully tested on is MS-DOS, so I give no guarantees that this program will function under any other OS other then DOS. It's up to you to fix any possible conflicts between compilers/operating systems. This software is provided on the "As Is Where Is" bases. Compiled using the following compilers ... Borland Turbo C V1.0 Borland Turbo C V3.0 GNU G++ V1.05 (DOS) GNU G++ V2.62 (UNIX) Feed Back --------- Thanks to the few people that sent me mail pointing out my deliberate mistakes :-) within my code/documentation. If people use this program for other projects, I wouldn't mind hearing about it, see DOCs for addresses. Notices ------- Thanks to: Pink Floyd (some of the best music ever written to program to) Black Jack, 8forty8, Knight Shade, Cold Shock ... (Some of the best heavy rock/metal bands in Hamilton/N.Z) GNU (For producing a brilliant compiler) Borland (Brilliant programming environment) bcpp-20050725/VERSION0000644000175100001440000000001410271243323013723 0ustar tomusers00000000000000t2005-07-25 bcpp-20050725/aclocal.m40000644000175100001440000002156410271251135014530 0ustar tomusers00000000000000dnl $Id: aclocal.m4,v 1.9 2005/07/25 20:58:05 tom Exp $ dnl autoconf macros for BCPP dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 dnl -------------- dnl Allow user to disable a normally-on option. AC_DEFUN([CF_ARG_DISABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl dnl --------------------------------------------------------------------------- dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31 dnl -------------- dnl Check if we're accidentally using a cache from a different machine. dnl Derive the system name, as a check for reusing the autoconf cache. dnl dnl If we've packaged config.guess and config.sub, run that (since it does a dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM dnl which is useful in cross-compiles. dnl dnl Note: we would use $ac_config_sub, but that is one of the places where dnl autoconf 2.5x broke compatibility with autoconf 2.13 AC_DEFUN([CF_CHECK_CACHE], [ if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then ifelse([$1],,[AC_CANONICAL_HOST],[$1]) system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) if test ".$system_name" != ".$cf_cv_system_name" ; then AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) AC_ERROR("Please remove config.cache and try again.") fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_OPTION version: 3 updated: 1997/10/18 14:42:41 dnl ------------- dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus dnl values. dnl dnl Parameters: dnl $1 = option name dnl $2 = help-string dnl $3 = action to perform if option is not default dnl $4 = action if perform if option is default dnl $5 = default option value (either 'yes' or 'no') AC_DEFUN([CF_ARG_OPTION], [AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes) if test "$enableval" != "$5" ; then ifelse($3,,[ :]dnl ,[ $3]) ifelse($4,,,[ else $4]) fi],[enableval=$5 ifelse($4,,,[ $4 ])dnl ])])dnl dnl --------------------------------------------------------------------------- dnl CF_DISABLE_ECHO version: 10 updated: 2003/04/17 22:27:11 dnl --------------- dnl You can always use "make -n" to see the actual options, but it's hard to dnl pick out/analyze warning messages when the compile-line is long. dnl dnl Sets: dnl ECHO_LT - symbol to control if libtool is verbose dnl ECHO_LD - symbol to prefix "cc -o" lines dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) dnl SHOW_CC - symbol to put before explicit "cc -c" lines dnl ECHO_CC - symbol to put before any "cc" line dnl AC_DEFUN([CF_DISABLE_ECHO],[ AC_MSG_CHECKING(if you want to see long compiling messages) CF_ARG_DISABLE(echo, [ --disable-echo display "compiling" commands], [ ECHO_LT='--silent' ECHO_LD='@echo linking [$]@;' RULE_CC=' @echo compiling [$]<' SHOW_CC=' @echo compiling [$]@' ECHO_CC='@' ],[ ECHO_LT='' ECHO_LD='' RULE_CC='# compiling' SHOW_CC='# compiling' ECHO_CC='' ]) AC_MSG_RESULT($enableval) AC_SUBST(ECHO_LT) AC_SUBST(ECHO_LD) AC_SUBST(RULE_CC) AC_SUBST(SHOW_CC) AC_SUBST(ECHO_CC) ])dnl dnl --------------------------------------------------------------------------- dnl CF_INTEL_COMPILER version: 2 updated: 2005/07/25 16:48:46 dnl ----------------- dnl Check if the given compiler is really the Intel compiler for Linux. It dnl tries to imitate gcc, but does not return an error when it finds a mismatch dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. dnl dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from dnl the wrappers for gcc and g++ warnings. dnl dnl $1 = GCC (default) or GXX dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS dnl $3 = CFLAGS (default) or CXXFLAGS AC_DEFUN([CF_INTEL_COMPILER],[ ifelse($2,,INTEL_COMPILER,[$2])=no if test "$ifelse($1,,[$1],GCC)" = yes ; then case $host_os in linux*|gnu*) AC_MSG_CHECKING(if this is really Intel compiler) cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])" ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc" AC_TRY_COMPILE([],[ #ifdef __INTEL_COMPILER #else make an error #endif ],[ifelse($2,,INTEL_COMPILER,[$2])=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" ],[]) ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2])) ;; esac fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_GXX_VERSION version: 4 updated: 2005/07/25 16:58:05 dnl -------------- dnl Check for version of g++ AC_DEFUN([CF_GXX_VERSION],[ AC_REQUIRE([AC_PROG_CPP]) GXX_VERSION=none if test "$GXX" = yes; then AC_MSG_CHECKING(version of g++) GXX_VERSION="`${CXX-g++} --version|sed -e '2,$d' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$GXX_VERSION" && GXX_VERSION=unknown AC_MSG_RESULT($GXX_VERSION) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_GXX_WARNINGS version: 4 updated: 2005/07/25 16:48:46 dnl --------------- dnl Check if the compiler supports useful warning options. dnl dnl Most of gcc's options apply to g++, except: dnl -Wbad-function-cast dnl -Wmissing-declarations dnl -Wnested-externs dnl dnl Omit a few (for now): dnl -Winline dnl dnl Parameter: dnl $1 is an optional list of g++ warning flags that a particular dnl application might want to use, e.g., "no-unused" for dnl -Wno-unused dnl Special: dnl If $with_ext_const is "yes", add a check for -Wwrite-strings dnl AC_DEFUN([CF_GXX_WARNINGS], [ CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS) AC_REQUIRE([CF_GXX_VERSION]) AC_LANG_SAVE AC_LANG_CPLUSPLUS cat > conftest.$ac_ext <&AC_FD_MSG ])dnl bcpp-20050725/bcpp.cfg0000644000175100001440000001306506644240721014302 0ustar tomusers00000000000000; This file contains configuration parameters that are used ; within the bcpp program. ; There are two types of parameter types : Boolean, and Integer. ; Boolean types can have only two valid values [On, Yes, or Off, No]. ; Integer types can have a valid range of 0 - 5000. ;------------------------------------------------------------------------ ; This parameter specifies how many lines separate between two ; functions. ;------------------------------------------------------------------------ function_spacing = 2 ; Integer ;------------------------------------------------------------------------ ; Specifies whether to use tabs in indenting code. ;------------------------------------------------------------------------ use_tabs = no ; Boolean ;------------------------------------------------------------------------ ; Specifies how many spaces to indent. This parameter is also used ; for tab indenting, as 1 tab may be worth 8 spaces if so desired. ; This parameter is used to position comments in TAB mode, and expanding ; of tabs within code! ;------------------------------------------------------------------------ indent_spacing = 4 ; Integer ;------------------------------------------------------------------------ ; Specifies whether to indent preprocessor controls to match the code ;------------------------------------------------------------------------ indent_preprocessor = yes ; Boolean ;------------------------------------------------------------------------ ; Specifies whether to indent embedded SQL statements ;------------------------------------------------------------------------ indent_exec_sql = yes ; Boolean ;------------------------------------------------------------------------ ; Defines at what start position comments that have code on the ; same line to be placed. ;------------------------------------------------------------------------ comments_with_code = 50 ; Integer ;------------------------------------------------------------------------ ; Defines at what start position comments with no code start. ;------------------------------------------------------------------------ comments_with_nocode = 0 ; Integer ;------------------------------------------------------------------------ ; Set this option to ON turns off setting indentation position of parameter ; "comments_with_nocode". Indentation is then set according to code ; position. ;------------------------------------------------------------------------ leave_comments_nocode = yes ; Boolean ;------------------------------------------------------------------------ ; Use this option is used to change non-ascii (non-printable) chars to ; octal notation if they lie within quotes. Either ; Ascii_Chars_Only, XOR Leave_Graphic_Chars parameters need to be set ; as a True value for this parameter to take effect. ;------------------------------------------------------------------------ NonAscii_Quotes_to_Octal = yes ; Boolean ;------------------------------------------------------------------------ ; Setting this parameter to yes will strip non-printable characters ; from the source files, but leave any character that are IBM ; graphics alone. Any non-printable characters that lie within ; quotes will be transformed into octal/character notation, if ; NonAscii_Quotes_To_Octal parameter is set to True. ;------------------------------------------------------------------------ ; leave_graphic_chars = yes ; Boolean ;------------------------------------------------------------------------ ; Setting this parameter to yes will strip any non-printable, ; non-ascii characters from the input file. Any non-printable ; octal/character notation if NonAscii_Quotes_To_Octal is set to ; True. Comment out this parameter if you are using ; Leave_Graphic_Chars parameter, as this parameter will override ; it. ;------------------------------------------------------------------------ ascii_chars_only = no ; Boolean ;------------------------------------------------------------------------ ; This parameter will place open braces on a new line after it's ; associated code if set on/yes. Else the brace will be place on ; next above line if possible, with it's code. ;------------------------------------------------------------------------ place_brace_on_new_line = yes ; Boolean ;------------------------------------------------------------------------ ; This parameter will stop output from the program corrupting output ; that may exit from the program via the standard output. ; If this parameter is set to off/no then no output is generated from ; the program, unless an error is encountered ;------------------------------------------------------------------------ program_output = yes ; Boolean ;------------------------------------------------------------------------ ; Specifies what the internal memory requirements will be in size of the ; line processing buffer. This essentially is used only for open brace ; relocation in kernighan/ritchie style. ;------------------------------------------------------------------------ Queue_Buffer = 10 ; Integer ;------------------------------------------------------------------------ ; If this option is set to true then the input file will be backup into a ; another file with a ".bac" extension added to the end of the file ; name. ;------------------------------------------------------------------------ Backup_File = yes ; Boolean bcpp-20050725/bcppall.bat0000644000175100001440000000003506016174262014772 0ustar tomusers00000000000000@for %f in (%1) do bcpp %f bcpp-20050725/code/0000755000175100001440000000000010271257370013601 5ustar tomusers00000000000000bcpp-20050725/code/.vilerc0000644000175100001440000000027007567731036015077 0ustar tomusers00000000000000; $Id: .vilerc,v 1.4 2002/11/23 16:51:42 tom Exp $ source ~/.vilerc ~with define-submode c notabinsert ts=4 sw=4 ~endwith ~with define-submode cpp notabinsert ts=4 sw=4 ~endwith bcpp-20050725/code/anyobj.h0000644000175100001440000000120106264572725015241 0ustar tomusers00000000000000#ifndef _ANYOBJECT_HEADER #define _ANYOBJECT_HEADER // Program code written by Steven De Toni ACBC 11 // This header contains a base class definition with a virtual destructor // so that existing objects that inherit from it use their proper destructor // no matter what type they are when being deleted. // ############################################################################### // #### ANYOBJECT Class #### // ######################### // Class used within container (TWOWAYLL) to store objects. // This is the base class for every other object to use. class ANYOBJECT { public: virtual ~ANYOBJECT (void); }; #endif bcpp-20050725/code/backup.cpp0000644000175100001440000000761307471511535015565 0ustar tomusers00000000000000//****************************************************************************** // Copyright 1999 by Thomas E. Dickey * // All Rights Reserved. * // * // Permission to use, copy, modify, and distribute this software and its * // documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) * // not be used in advertising or publicity pertaining to distribution of the * // software without specific, written prior permission. THE ABOVE LISTED * // COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * // EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, * // INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * // PERFORMANCE OF THIS SOFTWARE. * //****************************************************************************** // $Id: backup.cpp,v 1.8 2002/05/18 17:46:05 tom Exp $ #include "bcpp.h" #include inline const char *endOf(const char *s) { return (s + strlen(s)); } inline char *endOf(char *s) { return (s + strlen(s)); } inline bool isPathDelim(char ch) { return ((ch == '\\') || (ch == '/')); } static char *FileSuffix(char *name) { char * suffix = endOf(name); while ( ((*suffix != '.') && (suffix > name)) && !isPathDelim(*suffix) ) suffix--; if ((suffix <= name) || isPathDelim(*suffix)) suffix = endOf(name); return suffix; } // Function creates a backup of oldFilename, by renaming it to either // a ".orig" or ".bac" extension. Thereafter, the program will read // from the backup file, and write to the orignal filename. // int BackupFile (char*& oldFilename, char*& newFilename) { const char* suffix = ".bac"; newFilename = oldFilename; oldFilename = new char[strlen(newFilename)+6]; if (oldFilename == NULL) return -1; strcpy(oldFilename, newFilename); char * pLook = FileSuffix(oldFilename); strcat(oldFilename, ".orig"); if (rename(newFilename, oldFilename) != 0) { FILE *fp = fopen(oldFilename, "r"); if (fp != 0) { warning("backup already exists: %s\n", oldFilename); fclose(fp); return -1; } strcpy (pLook, suffix); if (rename(newFilename, oldFilename) != 0) { warning("cannot rename %s\n", newFilename); return -1; } } return 0; } void RestoreIfUnchanged(char *oldFilename, char *newFilename) { FILE *newFp = fopen(newFilename, "r"); FILE *oldFp = fopen(oldFilename, "r"); bool changed = False; int newCh = EOF; int oldCh = EOF; if (newFp != 0 && oldFp != 0) { do { newCh = fgetc(newFp); oldCh = fgetc(oldFp); if (newCh != oldCh) break; } while (newCh != EOF && oldCh != EOF); changed = (newCh != oldCh); } if (newFp != 0) fclose(newFp); if (oldFp != 0) fclose(oldFp); if (!changed) { if (remove(newFilename) != 0) warning("cannot remove %s\n", newFilename); else if (rename(oldFilename, newFilename) != 0) warning("cannot rename %s\n", oldFilename); } } bcpp-20050725/code/bcpp.cfg0000644000175100001440000001521407647372123015220 0ustar tomusers00000000000000; $Id: bcpp.cfg,v 1.10 2003/04/17 00:24:51 tom Exp $ ; This file contains configuration parameters that are used ; within the bcpp program. ; There are two types of parameter types : Boolean, and Integer. ; Boolean types can have only two valid values [On, Yes, or Off, No]. ; Integer types can have a valid range of 0 - 5000. ;------------------------------------------------------------------------ ; This parameter specifies how many lines separate between two ; functions. ;------------------------------------------------------------------------ function_spacing = 2 ; Integer ;------------------------------------------------------------------------ ; Specifies whether to use tabs in indenting code. ;------------------------------------------------------------------------ use_tabs = yes ; Boolean ;------------------------------------------------------------------------ ; Specifies how many spaces to indent. This parameter is also used ; for tab indenting, as 1 tab may be worth 8 spaces if so desired. ; This parameter is used to position comments in TAB mode, and expanding ; of tabs within code! ;------------------------------------------------------------------------ indent_spacing = 4 ; Integer ;------------------------------------------------------------------------ ; Specifies whether to indent preprocessor controls to match the code ;------------------------------------------------------------------------ indent_preprocessor = yes ; Boolean ;------------------------------------------------------------------------ ; Specifies whether to indent embedded SQL statements ;------------------------------------------------------------------------ indent_exec_sql = yes ; Boolean ;------------------------------------------------------------------------ ; Defines at what start position comments that have code on the ; same line to be placed. ;------------------------------------------------------------------------ comments_with_code = 33 ; Integer ;------------------------------------------------------------------------ ; Defines at what start position comments with no code start. ;------------------------------------------------------------------------ comments_with_nocode = 0 ; Integer ;------------------------------------------------------------------------ ; Set this option to ON turns off setting indentation position of parameter ; "comments_with_nocode". Indentation is then set according to code ; position. ;------------------------------------------------------------------------ leave_comments_nocode = yes ; Boolean ;------------------------------------------------------------------------ ; Use this option is used to change non-ASCII (non-printable) chars to ; octal notation if they lie within quotes. Either ; Ascii_Chars_Only, XOR Leave_Graphic_Chars parameters need to be set ; as a True value for this parameter to take effect. ;------------------------------------------------------------------------ NonAscii_Quotes_to_Octal = yes ; Boolean ;------------------------------------------------------------------------ ; Setting this parameter to yes will strip non-printable characters ; from the source files, but leave any character that are IBM ; graphics alone. Any non-printable characters that lie within ; quotes will be transformed into octal/character notation, if ; NonAscii_Quotes_To_Octal parameter is set to True. ;------------------------------------------------------------------------ ; leave_graphic_chars = no ; Boolean ;------------------------------------------------------------------------ ; Setting this parameter to yes will strip any non-printable, ; non-ascii characters from the input file. Any non-printable ; octal/character notation if NonAscii_Quotes_To_Octal is set to ; True. Comment out this parameter if you are using ; Leave_Graphic_Chars parameter, as this parameter will override ; it. ;------------------------------------------------------------------------ ascii_chars_only = yes ; Boolean ;------------------------------------------------------------------------ ; This parameter will place top-level open braces on a new line after its ; associated code if set on/yes. Else the brace will be placed on ; next above line if possible, with its code. ;------------------------------------------------------------------------ place_top_brace_on_new_line = yes ; Boolean ;------------------------------------------------------------------------ ; This parameter will place open braces on a new line after its ; associated code if set on/yes. Else the brace will be placed on ; next above line if possible, with its code. ;------------------------------------------------------------------------ place_brace_on_new_line = yes ; Boolean ;------------------------------------------------------------------------ ; This parameter will indent a trailing brace to align with the code ; which is enclosed, rather than with the "if" or similar statement which ; begins the compound statement. ;------------------------------------------------------------------------ brace_indent = no ; Boolean ;------------------------------------------------------------------------ ; This parameter will shift both leading/trailing braces to the right by ; one indent-level. ;------------------------------------------------------------------------ indent_both_braces = no ; Boolean ;------------------------------------------------------------------------ ; This parameter will stop output from the program corrupting output ; that may exit from the program via the standard output. ; If this parameter is set to off/no then no output is generated from ; the program, unless an error is encountered ;------------------------------------------------------------------------ program_output = no ; Boolean ;------------------------------------------------------------------------ ; Specifies what the internal memory requirements will be in size of the ; line processing buffer. This essentially is used only for open brace ; relocation in Kernighan/Ritchie style. ;------------------------------------------------------------------------ Queue_Buffer = 1000 ; Integer ;------------------------------------------------------------------------ ; If this option is set to true then the input file will be backup into a ; another file with a ".bac" extension added to the end of the file ; name. ;------------------------------------------------------------------------ Backup_File = no ; Boolean bcpp-20050725/code/cb++0000755000175100001440000000073506644442444014255 0ustar tomusers00000000000000#!/bin/sh # $Id: cb++,v 1.3 1999/01/05 17:00:20 tom Exp $ # Wrapper for 'bcpp', which does indention of C++ code (but doesn't trim # whitespace properly). OPTS="" TMP="$$" trap "rm -f $TMP" 0 1 2 5 15 for name in $* do case $name in -*) echo '...Ignored '$name ;; *.cpp|*.cc|*.hh|*.h|*.ppc|*.pc|*.ph|*.htm*) save=${name}.orig rm -f $save bcpp -fnc bcpp.cfg -yb $name test -f $save && echo '** Modified '$name ;; *) echo '...Skipping '$name ;; esac done bcpp-20050725/code/cmdline.h0000644000175100001440000000156307651627253015403 0ustar tomusers00000000000000#ifndef _CMDLINE_HEADER #define _CMDLINE_HEADER // $Id: cmdline.h,v 1.2 2003/04/24 00:24:11 tom Exp $ #include "config.h" // Config structure // ******* Define Prototypes ******** // Function converts a lower case string into upper case, any special // characters remain the same (i.e "$", "%" ...) void StrUpr (char* pUpCase); // This function displays brief command line help to the user. // Parameters: // char* argv[] : Pointer to command line parameter pointer array // void PrintProgramHelp (void); // integer assignment int intAssign (int& cmdCount, int argc, char* argv[] ); // string assignment char* strAssign (int& cmdCount, int argc, char* argv[]); // Function processes command line parameters int ProcessCommandLine (int argc, char* argv[], Config& settings, char*& pInFile, char*& pOutFile, char*& pConfig); #endif bcpp-20050725/code/config.h0000644000175100001440000001006607651571447015236 0ustar tomusers00000000000000#ifndef _CONFIG_HEADER #define _CONFIG_HEADER // $Id: config.h,v 1.14 2003/04/23 20:10:15 tom Exp $ // Program C(++) beautifier Written By Steven De Toni ACBC 11 10/94 // // This file contains prototypes, constants, enum declarations for the // source file config?.cpp. Prototypes declared can read data from a // text file a line at a time, and able to read parameters from a // configuration file. #include // FILE Structure enum Boolean {False = 0, True = -1}; // Commonly-used characters that are awkward to represent const char NULLC = '\0'; const char TAB = '\t'; const char LF = '\n'; const char CR = '\r'; const char SPACE = ' '; const char SEMICOLON = ';'; const char POUNDC = '#'; const char L_CURL = '{'; const char R_CURL = '}'; const char L_PAREN = '('; const char R_PAREN = ')'; const char DQUOTE = '"'; const char SQUOTE = '\''; const char ESCAPE = '\\'; // This structure is used to store the users settings that are read from a // configuration file. struct Config { int numOfLineFunc ; // number of lines between functions int tabSpaceSize ; // number of spaces a tab takes up {4} Boolean useTabs ; // True = use tabs in indenting, False = use spaces int posOfCommentsWC; // position of comments on line with code int posOfCommentsNC; // position of comments on line // JZAS Start Boolean leaveCommentsNC; // True = don't change the indentation of comments with code. // JZAS End Boolean quoteChars ; // change non-ASCII chars in quotes to octal notation int deleteHighChars; // 0 = no check , 1 = delete high chars, // 2 = don't delete graphics chars Boolean topBraceLoc ; // True = place on new line, False = at end of code Boolean braceLoc ; // True = place on new line, False = at end of code Boolean output ; // Set this True for normal program output int queueBuffer ; // Set the number if lines to store in memory at a time ! Boolean backUp ; // backup the original file, have output file become input file name ! Boolean indentPreP ; // indent preprocessor controls to match code Boolean indent_sql ; // indent embedded SQL statements Boolean braceIndent ; // True = indent trailing brace, False = don't Boolean braceIndent2 ; // True = indent both braces, False = don't }; // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // Allocates memory for line in file, and places that the data in it. // pInFile = the file handle to use when reading the file ! // EndOfFile variable is used to test if the end of the file has been reached. // When this is true, the variable is changed to -1 // // A string is returned with the contents the current line in the file, // memory is allocated via the ReadLine routine, and should be deleted // when not needed ! char* ReadLine (FILE *pInFile, int& EndOfFile); // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // This function is used to load the users configuration from a file. // // Parameters: // pConfigFile : Pointer to a FILE structure/handle that contains the // configuration data. // userSettings : Config structure that will contain the user settings. // // Return Values: // int : Returns the number of errors encountered when reading the // configuration file. // userSettings : This variable is altered to the user settings read from the // config file. // extern int SetConfig (FILE* pConfigFile, Config& userSettings); // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // This function is used to show the users configuration // // Parameters: // userSettings : Config structure that contains the user settings. // // Return Values: // int : Returns the number of errors encountered when reading the // configuration file. // extern int ShowConfig(Config& userSettings); #endif bcpp-20050725/code/html.cpp0000644000175100001440000000627607651344461015272 0ustar tomusers00000000000000//****************************************************************************** // Copyright 1999-2002,2003 by Thomas E. Dickey * // All Rights Reserved. * // * // Permission to use, copy, modify, and distribute this software and its * // documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) * // not be used in advertising or publicity pertaining to distribution of the * // software without specific, written prior permission. THE ABOVE LISTED * // COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * // EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, * // INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * // PERFORMANCE OF THIS SOFTWARE. * //****************************************************************************** // $Id: html.cpp,v 1.5 2003/04/22 22:58:57 tom Exp $ #include "bcpp.h" #include "cmdline.h" #include #include static char * UpperCase(const char *text) { while (isspace(*text)) text++; char *temp = new char[strlen(text)+1]; strcpy(temp, text); for (int n = strlen(temp); n > 0; n--) if (isspace(temp[n-1])) temp[--n] = 0; StrUpr(temp); return temp; } static bool BeginScript(const char *text) { char *temp = UpperCase (text); bool code = !strcmp("", temp) || !strcmp("", temp); delete[] temp; return code; } bool HtmlStruct::Active(const char *pLineData) { bool match = False; int n; switch (state) { case 0: for (n = 0; pLineData[n] != 0; n++) { if (!isspace(pLineData[n])) { if (pLineData[n] == '<') { state = 1; } else { state = -1; } break; } } // FALLTHRU case 1: if (BeginScript(pLineData)) { state = 2; match = True; } break; case 2: if (EndScript(pLineData)) { state = 1; match = True; } break; default: // We've decided it is not HTML + JavaScript break; } return ((state == 1) || match); } bcpp-20050725/code/makefile.blc0000644000175100001440000000114407366323772016053 0ustar tomusers00000000000000# Make file supplied by Chris Elliott D=..\code .SUFFIXES: .exe .cpp .obj SOURCE= $(D)\bcpp.obj\ $(D)\anyobj.obj\ $(D)\backup.obj\ $(D)\baseq.obj\ $(D)\cmdline.obj\ $(D)\config.obj\ $(D)\debug.obj\ $(D)\execsql.obj\ $(D)\hanging.obj\ $(D)\html.obj\ $(D)\stacklis.obj\ $(D)\strings.obj\ $(D)\tabs.obj\ $(D)\verbose.obj bcpp.exe: $(SOURCE) bcc32 $(SOURCE) clean: erase $(D)\*.obj erase $(D)\*.exe erase $(D)\*.tds .cpp.obj: bcc32 -c -n$(D) $< bcpp-20050725/code/makefile.unx0000644000175100001440000000125507567703226016127 0ustar tomusers00000000000000# $Id: makefile.unx,v 1.3 2002/11/23 13:45:58 tom Exp $ # Make file supplied by Piercarlo Grandi # This works on UNIX. D =./ CXX =g++ CXXFLAGS =-I$(D) -O2 -Wall #-DDEBUG -DDEBUG2 .SUFFIXES: .cpp .o .cpp.o: $(CXX) $(CXXFLAGS) -c $< -o $@ BCPP.o = \ $(D)bcpp.o \ $(D)anyobj.o \ $(D)backup.o \ $(D)baseq.o \ $(D)cmdline.o \ $(D)config.o \ $(D)debug.o \ $(D)execsql.o \ $(D)hanging.o \ $(D)html.o \ $(D)stacklis.o \ $(D)strings.o \ $(D)tabs.o \ $(D)verbose.o bcpp: $(BCPP.o) $(CXX) $(BCPP.o) -o $@ clean:: rm -f *.o bcpp *~ *# *.bak $(BCPP.o) : config.h $(D)bcpp.o \ $(D)debug.o \ $(D)execsql.o \ $(D)hanging.o \ $(D)tabs.o : bcpp.h bcpp-20050725/code/makefile.wnt0000644000175100001440000000206406644223332016112 0ustar tomusers00000000000000INTDIR = . OUTDIR = . LINK32=link.exe CPP_PROJ=/nologo /ML /W3 /GX /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\ /Fp"$(INTDIR)/bcpp.pch" /YX /Fo"$(INTDIR)/" /c LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:console /incremental:no\ /pdb:"$(OUTDIR)/bcpp.pdb" /machine:I386 /out:"$(OUTDIR)/bcpp.exe" CXX =gcc CXXFLAGS =-I$(D) -O2 -Wall .SUFFIXES: .cpp .obj .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< EXE = bcpp.exe OBJS = \ bcpp.obj \ anyobj.obj \ backup.obj \ baseq.obj \ cmdline.obj \ config.obj \ debug.obj \ execsql.obj \ hanging.obj \ html.obj \ stacklis.obj \ strings.obj \ tabs.obj \ verbose.obj $(EXE) : $(DEF_FILE) $(OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(OBJS) << clean:: - erase *.exe - erase *.obj $(OBJS) : config.h bcpp.obj \ tabs.obj : bcpp.h bcpp-20050725/code/run-test0000755000175100001440000000232307650611367015317 0ustar tomusers00000000000000#!/bin/sh # $Id: run-test,v 1.7 2003/04/20 21:36:55 tom Exp $ if (make) ; then if test $# != 0 ; then PATH=.:$PATH export PATH BCPP_OPT="-yb" DIFF_OPT="-u" rm -rf result mkdir result test -f output/.vilerc && cp output/.vilerc result/ # top-level directory "input" contains test-files. # subdirectories of "input" contain test-configs. for n in $* do N=`basename $n` if test -f input/$N ; then output=output/$N result=result/$N cp input/$N ${result} echo "** ${result}" ./bcpp -fnc bcpp.cfg $BCPP_OPT ${result} rm -f ${result}.orig diff $DIFF_OPT $output $result elif test -f input/$N/.bcpp ; then OUTPUT="output/$N" RESULT="result/$N" if test -d $RESULT ; then echo "? already exists: $RESULT" else mkdir $RESULT test -f output/.vilerc && cp output/.vilerc $RESULT/ for NN in input/* do if test -f $NN ; then output=$OUTPUT/`basename $NN` result=$RESULT/`basename $NN` cp $NN ${result} echo "** ${result}" ./bcpp -fnc input/$N/.bcpp $BCPP_OPT ${result} rm -f ${result}.orig diff $DIFF_OPT $output $result fi done fi fi done else eval $0 input/* fi fi bcpp-20050725/code/stacklis.h0000644000175100001440000000750610226270362015573 0ustar tomusers00000000000000// $Id: stacklis.h,v 1.3 2005/04/10 18:31:14 tom Exp $ #ifndef _STACK_LIST_HEADER #define _STACK_LIST_HEADER // Code written by Steven De Toni ACBC 11 // This header definition contains information of the construction, // operation of a container class that holds data in linked list // in stack form. #include // NULL Constant #include "anyobj.h" // use Base class definition // Structure definition used to link the items in the stack struct ListLink { ListLink* pLinkedItem; // linker (pointer to next item in the list) ANYOBJECT* pItem; // variable used to contain the data }; class StackList : public ANYOBJECT { protected: ListLink* pCurrentPos; // pointer to the end of the list int itemCount; // number of items in list int spaceAvailable; // used to test if memory // is still available public: //#### Constructors // Initialise internal variables. // StackList (void); // Initialise variables, and place item passed in a new list // // Parameters: // pItem : Pointer to the object that is will to be stored. // Item must be of descendant ANYOBJECT. // StackList (ANYOBJECT* pItem); // use the defaults here: StackList(const StackList&); StackList& operator=(const StackList&); //#### Access Methods // Places a new item in the list (i.e on the stack). // // Parameters: // pItem : Pointer to the object that is will to be stored. // Item must be of descendant ANYOBJECT. // // Return Values: // int : Returns a error code value to indicate whether operation // was successful or not. // Value: // 0 = No Worries, item stacked. // -1 = Item not stacked, memory allocation failure // int push (ANYOBJECT* pItem); // Removes a item from the list and returns the value contained within it // back to the user. A NULL value is returns if there are no more items // within the list. // // Return Values: // ANYOBJECT* : Pointer to the object last object that was placed // on the stack. Returns NULL pointer if operation // failed. // ANYOBJECT* pop (void); // Peeks at items within the linked list without removing // them from the list. // // Parameters: // int item : item number in list. // // Return Values: // ANYOBJECT* : Returns NULL if operation failed, else // pointer to the object contained at list // number selected! // ANYOBJECT* peek (int item); // Returns the number of items current being stacked. // // Returns Values: // int : Num of items within queue. // int status (void); // Method returns whether last operation failed due to memory allocation // failure. // // Return Values: // int : Returns 1 of two values ... // Values: // 0 = memory available // -1 = Last memory allocation failed. // int space (void); //#### Destructor // Method will remove all list items from memory if they still exist, // no garbage collection provided, or used. // ~StackList (void); }; #endif bcpp-20050725/code/verbose.cpp0000644000175100001440000000516707471511622015764 0ustar tomusers00000000000000//****************************************************************************** // Copyright 1999 by Thomas E. Dickey * // All Rights Reserved. * // * // Permission to use, copy, modify, and distribute this software and its * // documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) * // not be used in advertising or publicity pertaining to distribution of the * // software without specific, written prior permission. THE ABOVE LISTED * // COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * // EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, * // INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * // PERFORMANCE OF THIS SOFTWARE. * //****************************************************************************** // $Id: verbose.cpp,v 1.6 2002/05/18 17:46:58 tom Exp $ // verbose.cpp #include "bcpp.h" #include #if HAVE_UNISTD_H #include #else #include #endif #undef verbose // in case we defined it to 'printf' static int my_level = 1; void verbose(const char *format, ...) { if (my_level > 0) { va_list ap; va_start(ap, format); vprintf(format, ap); va_end(ap); } } void warning(const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } bool prompt(const char *format, ...) { int code; if (isatty(fileno(stdin)) && isatty(fileno(stdout))) { va_list ap; for(;;) { fprintf(stderr, "\n"); va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); fprintf(stderr, " [y/n] ? "); fflush(stderr); code = getc(stdin); if (code == 'y' || code == 'Y') return True; if (code == 'n' || code == 'n') break; } } return False; } bcpp-20050725/code/debug.cpp0000644000175100001440000000672510226341075015401 0ustar tomusers00000000000000//****************************************************************************** // Copyright 1996-2004,2005 by Thomas E. Dickey * // All Rights Reserved. * // * // Permission to use, copy, modify, and distribute this software and its * // documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) * // not be used in advertising or publicity pertaining to distribution of the * // software without specific, written prior permission. THE ABOVE LISTED * // COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * // EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, * // INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * // PERFORMANCE OF THIS SOFTWARE. * //****************************************************************************** // $Id: debug.cpp,v 1.17 2005/04/11 00:18:05 tom Exp $ // Debug/trace functions for BCPP #include #include #include "bcpp.h" void trace(const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } #if defined(DEBUG) || defined(DEBUG2) const char *traceDataType(DataTypes theType) { const char *it; switch (theType) { case CCom: it = "CCom"; break; case CppCom: it = "CppCom"; break; case Code: it = "Code"; break; case OBrace: it = "OBrace"; break; case CBrace: it = "CBrace"; break; case PreP: it = "PreP"; break; default: case ELine: it = "ELine"; break; } return it; } void traceInput(const char *file, int line, InputStruct *pIn) { if (pIn != 0) { TRACE(("%s@%d, %s%s (col:%d)\n", file, line, traceDataType(pIn->dataType), pIn->comWcode ? " comWcode" : "", pIn->offset)); if (pIn->pData != 0) TRACE(("---- data:%s\n", pIn->pData)); if (pIn->pState != 0) TRACE(("---- flag:%s\n", pIn->pState)); } } void traceOutput(const char *file, int line, OutputStruct *pOut) { if (pOut != 0) { TRACE(("%s@%d, indent %d(%d:%d), fill %d, OUT #%d:%s:%s:%s:\n", file, line, pOut->bracesLevel, pOut->indentSpace, pOut->indentHangs, pOut->filler, pOut->thisToken, pOut->pCode ? "code" : "", pOut->pBrace ? "brace" : "", pOut->pComment ? "comment" : "")); if (pOut->pCode) TRACE(("----- code:%s\n", pOut->pCode)); if (pOut->pCFlag) TRACE(("---- state:%s\n", pOut->pCFlag)); if (pOut->pBrace) TRACE(("---- brace:%s\n", pOut->pBrace)); if (pOut->pBFlag) TRACE(("---- state:%s\n", pOut->pBFlag)); if (pOut->pComment) TRACE(("-- comment:%s\n", pOut->pComment)); } } #endif bcpp-20050725/code/cmdline.cpp0000644000175100001440000001763410226342310015720 0ustar tomusers00000000000000#ifndef _CMDLINE_CODE #define _CMDLINE_CODE // $Id: cmdline.cpp,v 1.23 2005/04/11 00:28:56 tom Exp $ // Program C(++) Beautifier Written By Steven De Toni ACBC 11 12/94 // Revised 1999 - Thomas Dickey // // This module contains methods to parse the command line. #include // atoi() #include #include // strcmp() #include "bcpp.h" #include "cmdline.h" // prototypes // Function converts a lower case string into upper case, any special // characters remain the same (i.e "$", "%" ...) void StrUpr (char* pUpCase) { while (*pUpCase != '\0') { if (isalpha(*pUpCase) && islower(*pUpCase)) *pUpCase = toupper(*pUpCase); pUpCase++; } } // This function displays brief command line help to the user. // Parameters: // char* argv[] : Pointer to command line parameter pointer array // void PrintProgramHelp (void) { static const char *help[] = { "C(++) Beautifier " VERSION, "", "Program Was Written By Steven De Toni, December 1995", "Modified/revised by Thomas E. Dickey 1996-2003,2004", "All Parts Of This Program Are Freely Distributable.", "", "Usage: bcpp [Parameters] [Input File Name] [Output File Name]", "", "Options:", "", "[-bcl] [-bnl] [-cc ] [-f ] [-fi ] [-fnc ]", "[-fo ] [-h] [-i ] [-lg]", "[-na] [-nb] [-nbbi] [-nbi] [-nc] [-nlcnc] [-no] [-nq]", "[-qb] [-s] [-t]", "[-ya] [-yb] [-ybbi] [-ybi] [-ylcnc] [-yo] [-yq]", "[] []", "", "[] = Optional <> = Parameter Requirement", "", "* Support For I/O Redirection Is Provided *", }; unsigned n; for (n = 0; n < TABLESIZE(help); n++) verbose("%s\n", help[n]); if (prompt("More Detail")) { static const char *details[] = { "-bcl : Open braces on code line", "-bnl : Open braces on new line", "-cc : Column to align comments with code", "-f : Function line spacing", "-fi : Input file name", "-fnc : Load custom configuration file", "-fo : Output file name", "-h or -? : This help message", "-i : Indent space length", "-lg : Leave graphic chars", "-nc : Column to align comments with no code", "-qb : Define internal queue buffer size", "-s : Use spaces in indenting", "-t : Use tabs in indenting", "-tbcl : Top-level open braces on code line", "-tbnl : Top-level open braces on new line", "", "Options beginning with -n or -y disable/enable functions:", " a : Remove non-ASCII chars", " b : Backup input file with .bac extension", " bbi : Indent both braces of a block", " bi : Indent trailing brace of block", " lcnc : Leave comments with NoCode", " o : Program output", " q : Change non-ASCII chars in quotes to octal", }; for (n = 0; n < TABLESIZE(details); n++) verbose("%s\n", details[n]); } } // integer assignment static void intOption (int& cmdCount, int argc, char* argv[], int &result ) { if (cmdCount++ <= (argc-1)) { result = atoi (argv[cmdCount]); } else { warning ("Expected Another Integer Parameter For Command Directive %s\n", argv[cmdCount]); PrintProgramHelp (); } } // string assignment static void strOption (int& cmdCount, int argc, char* argv[], char * &result) { if (cmdCount++ <= (argc-1)) { result = argv[cmdCount]; } else { warning ("Expected Another String Parameter For Command Directive %s\n", argv[cmdCount]); PrintProgramHelp (); } } #define DecodeFlg(option, flag, value) \ if (strcmp (option, cmdRead) == 0) \ { \ flag = value; \ continue; \ } #define DecodeInt(option, flag) \ if (strcmp (option, cmdRead) == 0) \ { \ intOption (cmdCount, argc, argv, flag); \ continue; \ } #define DecodeStr(option, flag) \ if (strcmp (option, cmdRead) == 0) \ { \ strOption (cmdCount, argc, argv, flag); \ continue; \ } // Function processes command line parameters int ProcessCommandLine (int argc, char* argv[], Config& settings, char*& pInFile, char*& pOutFile, char*& pConfig) { int cmdCount = 0; char* cmdRead; while (cmdCount < argc-1) { // command line error if (cmdCount < 0) return cmdCount; // next command to process! cmdCount++; cmdRead = argv[cmdCount]; // this is a command directive if (cmdRead[0] == '-') { // upcase the command parameter StrUpr (cmdRead); cmdRead++; // miscellaneous flags, "sort +1" DecodeFlg ("BCL", settings.braceLoc, False); DecodeFlg ("BNL", settings.braceLoc, True); DecodeInt ("CC", settings.posOfCommentsWC); DecodeInt ("F", settings.numOfLineFunc); DecodeStr ("FI", pInFile); DecodeStr ("FNC", pConfig); DecodeStr ("FO", pOutFile); DecodeInt ("I", settings.tabSpaceSize); DecodeFlg ("LG", settings.deleteHighChars, 3); DecodeInt ("NC", settings.posOfCommentsNC); DecodeInt ("QB", settings.queueBuffer); DecodeFlg ("S", settings.useTabs, False); DecodeFlg ("T", settings.useTabs, True); DecodeFlg ("TBCL", settings.topBraceLoc, False); DecodeFlg ("TBNL", settings.topBraceLoc, True); // "No" flags DecodeFlg ("NA", settings.deleteHighChars, 0); DecodeFlg ("NB", settings.backUp, False); DecodeFlg ("NBBI", settings.braceIndent2, False); DecodeFlg ("NBI", settings.braceIndent, False); DecodeFlg ("NLCNC", settings.leaveCommentsNC, False); DecodeFlg ("NO", settings.output, False); DecodeFlg ("NQ", settings.quoteChars, False); // "Yes" flags DecodeFlg ("YA", settings.deleteHighChars, 1); DecodeFlg ("YB", settings.backUp, True); DecodeFlg ("YBBI", settings.braceIndent2, True); DecodeFlg ("YBI", settings.braceIndent, True); DecodeFlg ("YLCNC", settings.leaveCommentsNC, True); DecodeFlg ("YO", settings.output, True); DecodeFlg ("YQ", settings.quoteChars, True); // ### display help ### if( (strcmp ("?", cmdRead) == 0) || (strcmp ("H", cmdRead) == 0) ) { verbose ("*** Displaying Brief Help ***\n"); PrintProgramHelp (); return -1; } warning ("Unknown Command Directive %s \n", cmdRead); PrintProgramHelp (); return -1; } else if (pInFile == NULL) pInFile = argv [cmdCount]; else if (pOutFile == NULL) pOutFile = argv [cmdCount]; else { warning ("Command Line Error : Expected Command Directive, Not %s\n", argv[cmdCount]); PrintProgramHelp (); return -1; } } if (settings.queueBuffer < 2) settings.queueBuffer = 2; return 0; } #endif //_CMDLINE_CODE bcpp-20050725/code/hanging.cpp0000644000175100001440000001546510226341227015726 0ustar tomusers00000000000000//****************************************************************************** // Copyright 1996-2003,2005 by Thomas E. Dickey * // All Rights Reserved. * // * // Permission to use, copy, modify, and distribute this software and its * // documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) * // not be used in advertising or publicity pertaining to distribution of the * // software without specific, written prior permission. THE ABOVE LISTED * // COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * // EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, * // INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * // PERFORMANCE OF THIS SOFTWARE. * //****************************************************************************** // $Id: hanging.cpp,v 1.18 2005/04/11 00:19:35 tom Exp $ // Compute hanging-indent for most multiline statements. #include #include #include #include "bcpp.h" // Determine if the current OutputStruct should be indented for hanging // indent of a multi-line statement. Generally, we indent all lines after // the first for a statement, except when other conditions prevail: // // a. we encounter curly-braces (which have their own rules) // b. we encounter a keyword that has its own indention rules void HangStruct::ScanState(const char *code, const char *state) { if (code != 0) { for (int n = 0; code[n] != NULLC; n++) { if (state[n] == Normal) { int c = code[n]; if (isName(c) && (n == 0 || !isName(code[n-1]))) { int findWord = LookupKeyword(code + n); do_aggreg = False; if (findWord >= 0) { indent = 0; until_parn = 1; n += strlen(pIndentWords[findWord].name) - 1; if (pIndentWords[findWord].code == oneLine) stmt_level++; else stmt_level = 0; } else { if (CompareKeyword(code+n, "enum")) until_curl = 1; if (parn_level == 0) until_parn = 0; indent = 1; while (isName(code[n])) n++; n--; } } else if (!isspace(code[n])) { if (do_aggreg && code[n] != L_CURL) do_aggreg = False; switch (code[n]) { case '=': if (parn_level == 0) do_aggreg = True; break; case L_CURL: curl_level++; indent = 0; stmt_level = 0; until_parn = 0; if (do_aggreg) in_aggreg = curl_level; break; case R_CURL: curl_level--; indent = 0; stmt_level = 0; until_curl = 0; break; case ':': // "::" means something different entirely if (code[n+1] == ':') { n++; } else { indent = 0; stmt_level = 0; until_parn = 0; } break; case SEMICOLON: if (parn_level == 0) { indent = 0; stmt_level = 0; until_parn = 0; until_curl = 0; if (in_aggreg > curl_level) in_aggreg = 0; } break; case L_PAREN: parn_level++; indent = 1; break; case R_PAREN: parn_level--; if (until_parn && !parn_level) indent = 0; else indent = 1; break; case ESCAPE: break; default: indent = 1; break; } } } } } } void HangStruct::IndentHanging(OutputStruct *pOut) { #ifdef DEBUG2 traceOutput(__FILE__, __LINE__, pOut); TRACE(("state:%d/%d, parn:%d/%d, curl:%d, agg:%d/%d\n", indent, stmt_level, until_parn, parn_level, curl_level, do_aggreg, in_aggreg)); #endif if (indent != 0 && curl_level != 0 && (until_parn == 0 || parn_level != 0) && until_curl == 0 && in_aggreg < curl_level && !emptyString(pOut -> pCode) && !emptyString(pOut -> pCFlag) && (pOut -> pCFlag[0] == Normal || !ContinuedQuote(pOut))) { pOut -> indentHangs = indent; if (stmt_level && !until_parn) pOut -> indentHangs += stmt_level; TRACE(("HANG:%d\n", pOut -> indentHangs)); } if (pOut -> pType != PreP) { ScanState(pOut -> pCode, pOut -> pCFlag); ScanState(pOut -> pBrace, pOut -> pBFlag); } } bcpp-20050725/code/execsql.cpp0000644000175100001440000002170710226341222015746 0ustar tomusers00000000000000//****************************************************************************** // Copyright 1996-2003,2005 by Thomas E. Dickey * // All Rights Reserved. * // * // Permission to use, copy, modify, and distribute this software and its * // documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) * // not be used in advertising or publicity pertaining to distribution of the * // software without specific, written prior permission. THE ABOVE LISTED * // COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * // EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, * // INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * // PERFORMANCE OF THIS SOFTWARE. * //****************************************************************************** // $Id: execsql.cpp,v 1.16 2005/04/11 00:19:30 tom Exp $ // EXEC SQL parsing & indention #include #include #include "bcpp.h" #include "cmdline.h" // StrUpr() // skip to the beginning of the next word, inclusive of the starting position. int SqlStruct::NextWord(int start, OutputStruct *pOut) { int n = start; bool reset = False; TRACE(("next:%s\n", pOut -> pCode+start)); while (pOut -> pCode[n] != NULLC && (pOut -> pCFlag[n] != Normal || !isName(pOut -> pCode[n]))) { if ((pOut -> pCFlag[n] == Normal && !isName(pOut -> pCode[n])) || pOut -> pCFlag[n] == DQuoted || pOut -> pCFlag[n] == DQuoted) reset = True; n++; } // Maintain the level-counter as the maximum number of words we could // have matched. Punctuation resets it, since the SQL-keywords don't // bypass normal C/C++ syntax. if (reset) { matched[level = 0] = NULLC; if (state == 3 && pOut -> pCFlag[n-1] == Normal && pOut -> pCode[n-1] == SEMICOLON) { //TRACE(("FIXME2:%s\n", pOut->pCode + n - 1)) state = 0; } } return n; } int SqlStruct::SkipWord(int start, OutputStruct *pOut) { int n = start; TRACE(("skip:%s\n", pOut -> pCode+start)); // skip the current word while (pOut -> pCode[n] != NULLC && (ispunct(pOut -> pCFlag[n]) && isName(pOut -> pCode[n]))) n++; return n; } // return true if we've found a keyword which shouldn't be indented bool SqlStruct::SqlVerb(const char *code) { if (!emptyString(code)) { const char *table[] = { "ADD", "AND", "APPEND", "AS", "BEGIN", "BETWEEN", "BODY", "BY", "CANCEL", "CHANGE", "CLOSE", "COMMIT", "CONNECT", "CONTAIN", "CONTAINS", "COUNT", "CREATE", "CURRENT", "CURRVAL", "CURSOR", "DECLARE", "DELETE", "DISABLE", "DO", "DROP", "ELSE", "ELSIF", "ENABLE", "END", "ERASE", "EXCEPTION", "EXECUTE", "EXISTS", "FETCH", "FOR", "FROM", "FUNCTION", "GRANT", "GROUP", "HAVING", "IF", "IN", "INCLUDING", "INCREMENT", "INDEX", "INSERT", "INTO", "IS", "LAST", "LIKE", "MAX", "MIN", "MOD", "MODIFY", "NEW", "NEXT", "NEXTVAL", "NOT", "NULL", "NUMBER", "OF", "ON", "ONLY", "OPEN", "OR", "POSITION", "RAISE", "RANGE", "RAW", "READ", "RECOVER", "REM", "RENAME", "REPLACE", "RESUME", "RETURN", "REVERSE", "REVOKE", "ROLLBACK", "ROW", "ROWID", "SELECT", "SEQUENCE", "SET", "SORT", "SQL", "START", "STOP", "TABLE", "THEN", "THIS", "TO", "TRIGGER", "TRUE", "UNDER", "UNION", "UNIQUE", "UNTIL", "UPDATE", "USE", "USING", "VALIDATE", "VALUES", "VIEW", "WHEN", "WHENEVER", "WHERE", "WHILE", "WITH", }; for (size_t n = 0; n < TABLESIZE(table); n++) { if (CompareKeyword(code, table[n])) { return True; } } } return False; } void SqlStruct::IndentSQL(OutputStruct *pOut) { // (Yes, lex/yacc would be more powerful ;-) const struct { const char *name; int code; } state_keys[] = { { "EXEC", '+' }, { "SQL", 'S' }, { "EXECUTE", 'x' }, { "BEGIN", 'b' }, { "END-EXEC", 'E' }, // match this before "END" { "END", 'e' }, { "DECLARE", 'd' }, { "SECTION", 's' }, }; const struct { const char *text; int code; } state_strings[] = { { "+Sbds", 1 }, // begin declaration { "+Seds", 0 }, // end declaration { "+Sxb", 2 }, // begin statement { "E", 0 }, // end statement }; int old_state = state; char* pUprString = NULL; // First, look for SQL keywords to see when we've entered a block or // a statement. Ignore preprocessor-lines. if (pOut -> pType == Code && pOut -> pCode != NULL && pOut -> pCFlag != NULL) { pUprString = new char[strlen (pOut -> pCode) + 1]; if (pUprString == NULL) return; StrUpr (strcpy(pUprString, pOut->pCode)); TRACE(("HERE:%s\n", pUprString)); TRACE(("FLAG:%s\n", pOut->pCFlag)); for (int n = NextWord(0, pOut); pOut -> pCode[n] != NULLC; n = NextWord(n, pOut)) { bool found = False; for (size_t m = 0; m < TABLESIZE(state_keys); m++) { if (CompareKeyword(pUprString+n, state_keys[m].name)) { found = True; matched[level++] = state_keys[m].code; matched[level] = NULLC; n += strlen(state_keys[m].name); // fix for END-EXEC for (size_t j = 0; j < TABLESIZE(state_strings); j++) { if (!strcmp(state_strings[j].text, matched)) { state = state_strings[j].code; matched[level = 0] = NULLC; break; } } break; } } if (!found) { if (state == 0 && level >= 2 && !strncmp(matched, "+S", 2)) { state = 3; //TRACE(("FIXME:%s\n", pOut->pCode + n)) } matched[level = 0] = NULLC; } TRACE(("TEST:%d:%d:%s:%s\n", state, level, matched, pUprString+n)); n = SkipWord(n, pOut); if (pOut -> pCode[n] == NULLC) { break; } } } if (pOut -> pType != PreP) { if (state != 0 && old_state != 0) { pOut -> indentHangs = 1; if ((state == 2 || state == 3) && !SqlVerb(pUprString)) pOut -> indentHangs = 2; //TRACE(("FIXME-HANG:%d\n", pOut -> indentHangs)) } else if (state == 0 && old_state == 3) { pOut -> indentHangs = 1; if (!SqlVerb(pUprString)) pOut -> indentHangs = 2; //TRACE(("FIXME-HANG2:%d\n", pOut -> indentHangs)) } } delete[] pUprString; } bcpp-20050725/code/baseq.h0000644000175100001440000000767710226270301015053 0ustar tomusers00000000000000// $Id: baseq.h,v 1.3 2005/04/10 18:30:25 tom Exp $ #ifndef _QUEUE_LIST_HEADER #define _QUEUE_LIST_HEADER // Code written by Steven De Toni ACBC 11 // this header definition contains a container class that stores data // in a queued linked list. #include "anyobj.h" // include base class struct LinkItem { LinkItem* pLinkedItem; // linker (pointer to the next item in the list) ANYOBJECT* pStoredItem; // data that is store within a list item }; class QueueList { protected: int itemCount; LinkItem* pEndPos; int spaceAvailable; // set to 0 for space available, // -1 if no space available; // Create new list item and place programmer's data within it, // make new links with previous item if wished. // returns a pointer to the new item, NULL if operation failed. // // Parameters: // pItem : Pointer to the object to be stored. // LinkItem : Pointer to end of list where item to be added. // // Return Values: // LinkItem : returns pointer to newly added item in list, // NULL if operation failed. However items within list // before hand still exist. LinkItem* newItem (ANYOBJECT* pItem, LinkItem* pEndList); public: // constructors QueueList (void); // Parameters: // pItem : Pointer to a object to be stored, must be descendant of // base class ANYOBJECT. QueueList (ANYOBJECT* pItem); // use the defaults here QueueList(const QueueList&); QueueList& operator=(const QueueList&); // Place programmers object into list // // Parameters: // pItem : Pointer to a object to be stored, must be descendant of // base class ANYOBJECT. // // Return Values: // int : Returns a error code indicating whether operation was // successful. // Values: // 0 = No Worries // -1 = Arrgh ... No memory // int putLast (ANYOBJECT* pItem); // Take first item placed in Queue, out and return it. // Type casting is required to return object back to it's original // state. // // Return Values: // ANYOBJECT* : Pointer to the object that was stored within queue. // ANYOBJECT* takeNext (void); // Returns the number of items contained within the queue. // // Returns Values: // int : Num of items within queue. // int status (void); // Method returns whether last operation failed due to memory allocation // failure. // // Return Values: // int : Returns 1 of two values ... // Values: // 0 = memory available // -1 = Last memory allocation failed. // int space (void); // return Queue space left // Methods is used to peek within the queue at objects, and return there // pointer without taking them out of the queue. // // Parameters: // NumFromNext : The object number to look at from the start of the // queue. The start of the queue is 1, not 0. // // Return Values: // ANYOBJECT* : Pointer to the object that is stored within queue, // at said position. Returns NULL if operation failed. // ANYOBJECT* peek (int numFromNext); // Method will remove all list items from memory if they still exist, // no garbage collection provided, or used. // ~QueueList (void); }; #endif bcpp-20050725/code/tabs.cpp0000644000175100001440000004164010226341302015230 0ustar tomusers00000000000000//****************************************************************************** // Copyright 1996-2003,2005 by Thomas E. Dickey * // All Rights Reserved. * // * // Permission to use, copy, modify, and distribute this software and its * // documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) * // not be used in advertising or publicity pertaining to distribution of the * // software without specific, written prior permission. THE ABOVE LISTED * // COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * // EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, * // INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * // PERFORMANCE OF THIS SOFTWARE. * //****************************************************************************** // $Id: tabs.cpp,v 1.24 2005/04/11 00:20:18 tom Exp $ // Tab conversion & first-pass scanning #include #include // strlen(), strstr(), strchr(), strcpy(), strcmp() #include "bcpp.h" // ---------------------------------------------------------------------------- // Function takes a unsigned char and converts it to a C type string that // contains the char's value, but in octal (i.e "\000" = null char). // // Parameters: // value : The value that wishes to be converted // // Return Values: // char* : Returns a pointer to the string that was converted. // Memory is allocated via the new command, and once string has been used, // memory should be returned to the system. // static char* ConvertCharToOctal (unsigned char value) { const char octalVals[] = "01234567"; char* pOctalValue = new char[5]; // \000 digits plus null terminator if (pOctalValue != NULL) { int last = 1; switch (value) { case '\a': pOctalValue[1] = 'a'; break; case '\b': pOctalValue[1] = 'b'; break; case '\f': pOctalValue[1] = 'f'; break; case '\n': pOctalValue[1] = 'n'; break; case '\r': pOctalValue[1] = 'r'; break; case '\t': pOctalValue[1] = 't'; break; default: last = 3; for (int pos = last; pos >= 1; pos--) { pOctalValue[pos] = octalVals[(value & 7)]; value >>= 3; // left shift to next three bits } } pOctalValue[0] = ESCAPE; pOctalValue[last+1] = NULLC; } return pOctalValue; } // ---------------------------------------------------------------------------- // Compute the number of characters in an escape static int skipEscape(char *String) { int it = 1; int n = 1; if (isdigit(String[n])) { while (n <= 3) { if (isdigit(String[n++])) it = n-1; else break; } } else if (String[n] == 'x') { while (n <= 3) { if (isxdigit(String[++n])) it = n-1; else break; } } return it; } // ---------------------------------------------------------------------------- #ifdef DEBUG static const char *showCharState(CharState theState) { const char *it; switch (theState) { default: case Blank: it = "Blank"; break; case PreProc: it = "PreProc"; break; case Normal: it = "Normal"; break; case Comment: it = "Comment"; break; case Ignore: it = "Ignore"; break; case DQuoted: it = "DQuoted"; break; case SQuoted: it = "SQuoted"; break; } return it; } #endif // ---------------------------------------------------------------------------- // Compute the state after this character is processed static void nextCharState(char * &String, CharState &theState, int &skip) { if (skip-- <= 0) { skip = 0; if (theState == Blank) { if (!isspace(String[0])) theState = Normal; } if (theState == Normal) { switch (String[0]) { case ESCAPE: skip = skipEscape(String); break; case DQUOTE: theState = DQuoted; break; case SQUOTE: theState = SQuoted; break; case '/': switch (String[1]) { case '*': theState = Comment; skip = 1; break; case '/': theState = Ignore; break; default: break; } break; case SPACE: case TAB: theState = Blank; break; default: break; } } else if (theState == Comment) { if (String[0] == '*' && String[1] == '/') { theState = Normal; skip = 1; } } else if (theState == SQuoted) { switch (String[0]) { case SQUOTE: theState = Normal; break; case ESCAPE: skip = skipEscape(String); break; default: break; } } else if (theState == DQuoted) { switch (String[0]) { case DQUOTE: theState = Normal; break; case ESCAPE: skip = skipEscape(String); break; default: break; } } } } // ---------------------------------------------------------------------------- // Check for non-printable characters, which we'll either quote or remove, // depending on whether they're in strings or not. static int NonPrintable(char c, int mode) { int it = False; unsigned char check = static_cast(c); // remove chars below a space, but not if char is a TAB. if (check < SPACE && check != TAB) { it = True; } else if (mode == 1) { it = (check >= 127); /* non 7-bit ASCII? */ } else if (mode == 3) { it = (check >= 127) && (check < 160); /* ISO C1 character? */ } return it; } // ---------------------------------------------------------------------------- // Function expands tabs to spaces; the number of spaces to expand to is // dependent upon the tabSpaceSize parameter within user settings, and // tab column positions. // // Parameters: // pString : Pointer to the string to process ! // tabLen : How much a tab is worth in spaces. // deleteChars : mode to select non-printing characters for removal/quoting // quoteChars : quote non-printing characters // curState : character-state at beginning (end) of string // lineState : character-states within string // // curState and lineState are set as side-effects // void ExpandTabs (char* &pString, int tabLen, int deleteChars, Boolean quoteChars, CharState &curState, char * &lineState, Boolean &codeOnLine) { int col = 0; int skip = 0; size_t last = 0; char* pSTab = pString; bool expand = True; bool my_pString = False; bool had_print = False; CharState oldState = curState; lineState = new char[strlen (pString) + 1]; if (lineState == 0) return; lineState[0] = NullC; //TRACE((" ExpandTabs(%s)%s\n", pString, codeOnLine ? " code" : "")) while (*pSTab != NULLC) { col++; if (isgraph(*pSTab)) had_print = True; if (skip || !isspace(*pSTab)) last = col + skip; if (*pSTab == TAB // calculate tab positions ! && expand && skip == 0 && !(had_print && (curState == Ignore || curState == Comment)) && curState != SQuoted && curState != DQuoted) { int tabAmount = 0; // tab is first character !!!! if (col == 1) tabAmount = tabLen; else tabAmount = ((((col+tabLen-1) / tabLen)) * tabLen) - col + 1; //TRACE(("amount:%d, col:%d, state:%s (%d)\n", tabAmount, col, showCharState(curState), had_print)) if (tabAmount > 0) { // create newString, remove tab ! char* pNewString = new char[strlen (pString) + tabAmount + 1]; char* pNewStates = new char[strlen (pString) + tabAmount + 1]; if (pNewString == NULL || pNewStates == NULL) { if (my_pString) { delete[] pString; pString = 0; } delete[] lineState; return; } my_pString = True; strcpy (pNewStates, lineState); delete[] lineState; lineState = pNewStates; // copy first part strcpy (pNewString, pString); // add spaces char *pAddSpc = pNewString + col - 1; while (tabAmount-- > 0) *pAddSpc++ = SPACE; // add original trailing spaces strcpy (pAddSpc, pSTab+1); delete[] pString; // remove old string from memory pString = pNewString; pSTab = pString + col - 1; // point to the first blank //TRACE(("...%d:%s\n", col, pString)) } else *pSTab = SPACE; } // SCCS ID contains a tab that we don't want to touch else if (*pSTab == '@' && !strncmp(pSTab+1, "(#)", 3)) { expand = False; } else if (NonPrintable(*pSTab, deleteChars)) { if (quoteChars && (curState == SQuoted || curState == DQuoted)) { char* pOctal = ConvertCharToOctal(*pSTab); char* pTemp = new char[strlen(pString)+strlen(pOctal)+1]; if (pOctal == 0 || pTemp == 0) { delete[] pOctal; delete[] pTemp; return; } *pSTab = NULLC; strcpy(pTemp, pString); strcat(pTemp, pOctal); strcat(pTemp, pSTab+1); pSTab = pTemp + (pSTab - pString); delete[] pString; pString = pTemp; pTemp = new char[strlen(pString)+strlen(pOctal)+1]; if (pTemp == 0) { delete[] pOctal; delete[] pTemp; delete[] pString; pString = NULL; return; } strcpy(pTemp, lineState); delete[] lineState; lineState = pTemp; delete[] pOctal; } else // simply remove the character { int n = 0; while ((pSTab[n] = pSTab[n+1]) != NULLC) n++; } col--; //TRACE(("re-interpret col %d\n", col)) continue; // re-interpret character } if (skip == 0) oldState = curState; nextCharState(pSTab, curState, skip); // Set the saved-state based on whether we're transitioning from // something that's got quotes (which are part of it): lineState[col-1] = (curState == Normal) && ((oldState == DQuoted) || (oldState == SQuoted) || (oldState == Comment)) ? oldState : curState; // Override the first '#' on a non-continued line to mark a // preprocessor-control. if (*pSTab == POUNDC && !codeOnLine && ispunct(curState)) { lineState[col-1] = PreProc; } else if (ispunct(lineState[col-1])) { codeOnLine = True; } lineState[col] = NullC; pSTab++; } // Set up for the next time through this procedure if (curState == Ignore) curState = Normal; if (col == 0 || pString[col-1] != ESCAPE) { codeOnLine = False; } if (skip == 0 && (curState == DQuoted || curState == SQuoted)) curState = Normal; // recover from syntax error if (last < strlen(pString)) { pString[last] = NULLC; // trim trailing blanks lineState[last] = NullC; } TRACE((" Expanded (%s)\n", pString)); TRACE((" lineState (%s)\n", lineState)); TRACE(("%s %d/%d %s\n", last > strlen(pString)+1 ? "FIXME" : "", last, strlen(pString), showCharState(curState))); } // ---------------------------------------------------------------------------- // This function is used to allocate memory for indentation within function // OutputToOutFile(). Once the memory needed is allocated, it fills the memory // with spaces, or tabs depending upon the fill mode. // // Parameters: // Mode : Defines the fill mode of the memory that it allocate // 1 = tabs only // 2 = spaces only // 3 = both // len : Number of bytes needed to be allocated // spaceIndent:Number of memory locations a tab character take up // // Return Values: // char* : Returns a pointer to the memory/string that was allocated // char* TabSpacing (int mode, int col, int len, int spaceIndent) { char* pOutTab = NULL; char* pOutSpc = NULL; if ((mode & 1) == 1) { int numOfTabs = 0; // bypass exception error if (spaceIndent > 0) { numOfTabs = ((len+col) / spaceIndent) - (col / spaceIndent); if (len != 0) len = (len + col) % spaceIndent; } pOutTab = new char[numOfTabs + 1]; if (pOutTab != NULL) { for (int fillTabs = 0; fillTabs < numOfTabs; fillTabs++) pOutTab[fillTabs] = TAB; pOutTab[numOfTabs] = NULLC; } else return NULL; // memory allocation failed // If not in both tab, and space concatenation. if ((mode & 2) == 0) return pOutTab; }//bit 0 set ! if ((mode & 2) == 2) { if (pOutTab == NULL) //##### normal space allocation ! { pOutSpc = new char[len+1]; if (pOutSpc != NULL) { for (int fillSpcs = 0; fillSpcs < len; fillSpcs++) pOutSpc[fillSpcs] = SPACE; pOutSpc[len] = NULLC; return pOutSpc; //##### return end product } else return NULL; // memory allocation failed } else // else a mix of spaces & tabs { int numOfSpcs = 0; if (spaceIndent > 0) numOfSpcs = len % spaceIndent; pOutSpc = new char[numOfSpcs+1]; if (pOutSpc != NULL) { for (int fillSpcs = 0; fillSpcs < numOfSpcs; fillSpcs++) pOutSpc[fillSpcs] = SPACE; pOutSpc[numOfSpcs] = NULLC; } else return NULL; // memory allocation failed } }// bit 1 set //##### Concatenate tabs & spaces if ( ((mode & 1) == 1) && ((mode & 2) == 2) ) { char* pConCat = new char[(strlen (pOutTab) + strlen (pOutSpc) + 1)]; // #### Check memory allocation if (pConCat == NULL) { delete[] pOutTab; delete[] pOutSpc; return NULL; } strcpy (pConCat, pOutTab); strcpy (pConCat + strlen (pConCat), pOutSpc); delete[] pOutTab; delete[] pOutSpc; return pConCat; } return NULL; //##### illegal mode passed ! } bcpp-20050725/code/baseq.cpp0000644000175100001440000001407710226270172015404 0ustar tomusers00000000000000#ifndef _QUEUE_LIST_CODE #define _QUEUE_LIST_CODE // $Id: baseq.cpp,v 1.5 2005/04/10 18:29:14 tom Exp $ // Code written by Steven De Toni ACBC 11 // These class methods used to implement a object that holds other objects // that are descendant of ANYOBJECT (i.e universal container). #include "baseq.h" #include // NULL CONSTANT // ############################################################################ // #### QueueList Class #### // ######################### // ############################ Protected Methods ############################# // Create new list item and place programmer's data within it, // make new links with previous item if wished. // returns a pointer to the new item, NULL if operation failed. // // Parameters: // pItem : Pointer to the object to be stored. // LinkItem : Pointer to end of list where item to be added. // // Return Values: // LinkItem : returns pointer to newly added item in list, // NULL if operation failed. However items within list // before hand still exist. LinkItem* QueueList::newItem (ANYOBJECT* pItem, LinkItem* pEndList) { LinkItem* pNewStruct = new LinkItem; if (pNewStruct != NULL) { pNewStruct->pLinkedItem = pEndList; pNewStruct->pStoredItem = pItem; } return pNewStruct; } // ############################## Public Methods ############################## // ############################### Constructors ############################### #define MY_DEFAULT \ itemCount(0), \ pEndPos(NULL), \ spaceAvailable(0) QueueList::QueueList (void) : MY_DEFAULT { } // Parameters: // pItem : Pointer to a object to be stored, must be descendant of // base class ANYOBJECT. QueueList::QueueList (ANYOBJECT* pItem) : MY_DEFAULT { putLast(pItem); } #undef MY_DEFAULT // ########################### User Methods ################################### // Place programmers object into list // // Parameters: // pItem : Pointer to a object to be stored, must be descendant of // base class ANYOBJECT. // // Return Values: // int : Returns a error code indicating whether operation was // successful. // Values: // 0 = No Worries // -1 = Arrgh ... No memory // int QueueList::putLast (ANYOBJECT* pItem) { LinkItem* pNewItem = newItem (pItem, pEndPos); if (pNewItem != NULL) { pEndPos = pNewItem; itemCount++; return 0; } spaceAvailable = -1; return -1; // could not add item to list! } // Take first item placed in Queue, out and return it. // Type casting is required to return object back to its original // state. // // Return Values: // ANYOBJECT* : Pointer to the object that was stored within queue. // ANYOBJECT* QueueList::takeNext (void) { if (pEndPos != NULL) { LinkItem* pUpDateList = pEndPos; LinkItem* pStartPos = pEndPos; // move down list until start has been reached while (pStartPos->pLinkedItem != NULL) pStartPos = pStartPos->pLinkedItem; if (pStartPos != pUpDateList) // if not the last item in list { // retrieve data and delete item from list while (pUpDateList->pLinkedItem != pStartPos) pUpDateList = pUpDateList->pLinkedItem; } else { pEndPos = NULL; // start new list after all items gone } ANYOBJECT* pTemp = pStartPos->pStoredItem; // copy value to user pUpDateList->pLinkedItem = NULL; // make new start of list delete pStartPos; // delete object itemCount--; // one less if (spaceAvailable) // if no memory available before... spaceAvailable = 0; // there is now! return pTemp; } else return NULL; } // Returns the number of items contained within the queue. // // Returns Values: // int : Num of items within queue. // int QueueList::status (void) // return number of item in Queue { return itemCount; } // Method returns whether last operation failed due to memory allocation // failure. // // Return Values: // int : Returns 1 of two values ... // Values: // 0 = memory available // -1 = Last memory allocation failed. // int QueueList::space (void) // return Queue space left { return spaceAvailable; // return -1 if no space available } // Methods is used to peek within the queue at objects, and return their // pointer without taking them out of the queue. // // Parameters: // NumFromNext : The object number to look at from the start of the // queue. The start of the queue is 1, not 0. // // Return Values: // ANYOBJECT* : Pointer to the object that is stored within queue, // at said position. Returns NULL if operation failed. // ANYOBJECT* QueueList::peek (int numFromNext) { if (pEndPos != NULL) { //if (numFromNext > itemCount) //error checking ! // return NULL; int count = itemCount - numFromNext; LinkItem* pStartPos = pEndPos; if (count >= 0) { // move down list until start has been reached while (count > 0) { pStartPos = pStartPos->pLinkedItem; count--; } if (pStartPos != NULL) return pStartPos->pStoredItem; } } return NULL; } // ############################### Destructor ############################### // Method will remove all list items from memory if they still exist, // no garbage collection provided, or used. // QueueList::~QueueList (void) { LinkItem* pTemp = pEndPos; while (pEndPos != NULL) { pEndPos = pEndPos->pLinkedItem; // advance to next item delete pTemp ->pStoredItem; // kill data contained delete pTemp; // kill item pTemp = pEndPos; } } #endif bcpp-20050725/code/stacklis.cpp0000644000175100001440000001040710226270406016117 0ustar tomusers00000000000000// $Id: stacklis.cpp,v 1.3 2005/04/10 18:31:34 tom Exp $ #ifndef _STACK_LIST_CODE #define _STACK_LIST_CODE // Code written by Steven De Toni ACBC 11 // This file contains the methods that were defined in stacklist.h // header file (i.e container class that stores items in a linked list, // in stack form) #include "stacklis.h" #include // NULL Constant // ############################################################################ // #### StackList Class #### // ######################### // ############################## Public Methods ############################## // ############################### Constructors ############################### #define MY_DEFAULT \ pCurrentPos(NULL), \ itemCount(0), \ spaceAvailable(0) // Initialise internal variables. // StackList::StackList (void) : MY_DEFAULT { } // Initalise variables, and place item passed in a new list // // Parameters: // pItem : Pointer to the object that is will to be stored. // Item must be of descendant ANYOBJECT. // StackList::StackList (ANYOBJECT* pItem) : MY_DEFAULT { push (pItem); } // Places a new item in the list (i.e on the stack). // // Parameters: // pItem : Pointer to the object that is will to be stored. // Item must be of descendant ANYOBJECT. // // Return Values: // int : Returns a error code value to indicate whether operation // was successful or not. // Value: // 0 = No Worries, item stacked. // -1 = Item not stacked, memory allocation failure // int StackList::push (ANYOBJECT* pItem) { ListLink* newItem = new ListLink; if (newItem) // not NULL { // update contents of structure newItem->pItem = pItem; newItem->pLinkedItem = NULL; if (pCurrentPos) // not NULL newItem->pLinkedItem = pCurrentPos; // update start of stack pointer pCurrentPos = newItem; itemCount++; return spaceAvailable; } else { spaceAvailable = -1; return spaceAvailable; } } // Removes a item from the list and returns the value contained within it // back to the user. A NULL value is returns if there are no more items // within the list. // // Return Values: // ANYOBJECT* : Pointer to the object last object that was placed // on the stack. Returns NULL pointer if operation // failed. // ANYOBJECT* StackList::pop (void) { ListLink* pBackUp = pCurrentPos; if (pCurrentPos) // not NULL { ANYOBJECT* pTemp = pCurrentPos->pItem; pCurrentPos = pCurrentPos->pLinkedItem; delete pBackUp; itemCount--; return pTemp; } else return NULL; } // Peeks at items within the linked list without removing // them from the list. // // Parameters: // int item : item number in list. // // Return Values: // ANYOBJECT* : Returns NULL if operation failed, else // pointer to the object contained at list // number selected! // ANYOBJECT* StackList::peek (int item) { ListLink* pPeekPos = pCurrentPos; // invalid range ! if ( ((item < 1) || (item > itemCount)) || (pPeekPos == NULL) ) return NULL; while (item > 1) { pPeekPos = pPeekPos -> pLinkedItem; item--; } return pPeekPos -> pItem; } // Method returns whether last operation failed due to memory allocation // failure. // // Return Values: // int : Returns 1 of two values ... // Values: // 0 = memory available // -1 = Last memory allocation failed. // int StackList::space (void) { return spaceAvailable; } // Returns the number of items current being stacked. // // Returns Values: // int : Num of items within queue. // int StackList::status (void) { return itemCount; } // ############################### Destructor ############################### // Method will remove all list items from memory if they still exist, // no garbage collection provided, or used. // StackList::~StackList (void) { ANYOBJECT* pTest = pop(); while (pTest != NULL) { delete pTest; pTest = pop(); } } #endif bcpp-20050725/code/strings.cpp0000644000175100001440000000457410226341316016002 0ustar tomusers00000000000000//****************************************************************************** // Copyright 1996-2002,2005 by Thomas E. Dickey * // All Rights Reserved. * // * // Permission to use, copy, modify, and distribute this software and its * // documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) * // not be used in advertising or publicity pertaining to distribution of the * // software without specific, written prior permission. THE ABOVE LISTED * // COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * // EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, * // INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * // PERFORMANCE OF THIS SOFTWARE. * //****************************************************************************** // $Id: strings.cpp,v 1.12 2005/04/11 00:20:30 tom Exp $ // strings.cpp #include #include #include #include "bcpp.h" bool isName(char c) { return isalnum(c) || (c == '_') || (c == '$'); } bool CompareKeyword(const char *tst, const char *ref) { int n; for (n = 0; ref[n] != NULLC; n++) if (tst[n] != ref[n]) return False; TRACE(("Match (\"%s\",\"%s\")\n", tst, ref)); return !isName(tst[n]); } char *NewString (const char *src) { char* dst = new char[strlen (src)+1]; if (dst != 0) strcpy(dst, src); return dst; } char *NewSubstring (const char *src, size_t len) { char* dst = new char[len + 1]; if (dst != 0) { strncpy(dst, src, len); dst[len] = NULLC; } return dst; } const char *SkipBlanks(const char *s) { while (isspace(*s)) s++; return s; } bcpp-20050725/code/bcpp.h0000644000175100001440000003056410242220536014676 0ustar tomusers00000000000000/****************************************************************************** * Copyright 1996-2004,2005 by Thomas E. Dickey * * All Rights Reserved. * * * * Permission to use, copy, modify, and distribute this software and its * * documentation for any purpose and without fee is hereby granted, 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 the above listed copyright holder(s) * * not be used in advertising or publicity pertaining to distribution of the * * software without specific, written prior permission. THE ABOVE LISTED * * COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * * EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY * * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ******************************************************************************/ // $Id: bcpp.h,v 1.45 2005/05/16 22:40:30 tom Exp $ #ifndef _BCPP_HEADER #define _BCPP_HEADER #include #include #ifdef HAVE_CONFIG_H #include "autoconf.h" #endif #include "config.h" #include "anyobj.h" // Use ANYOBJECT base class #include "baseq.h" // QueueList class to store Output structures #include "stacklis.h" // StackList class to store indentStruct // Common/miscellaneous definitions for BCPP #define TABLESIZE(n) (sizeof(n)/sizeof(n[0])) #ifndef VERSION #define VERSION "" #endif #ifdef DEBUG #define TRACE(p) trace p #else #define TRACE(p) /*nothing*/ #endif #if defined(sun) && !defined(__SVR4) // SunOS extern "C" { extern char *strcat(char *, const char *); extern char *strncpy(const char *, const char *, size_t); extern char *strstr(const char *, const char *); extern int strncmp(const char *, const char *, size_t); }; #endif #ifdef __GNUC__ #define HAVE_UNISTD_H 1 #else #define bool int // FIXME #endif //----------------------------------------------------------------------------- // Character-state, chosen to allow storing as a null-terminated char-string enum CharState { NullC = 0, Blank = ' ', // whitespace not in other categories PreProc = '#', // preprocessor (first chunk, with '#') Normal = '.', // code DQuoted = '"', // "string" SQuoted = '\'', // 'c' Comment = 'c', // C comment Ignore = 'C' // C++ comment }; // ---------------------------------------------------------------------------- enum DataTypes { NoType = 0, CCom = 1, CppCom = 2, Code = 3, OBrace = 4, CBrace = 5, PreP = 6, ELine = 7 }; // ---------------------------------------------------------------------------- enum indentAttr { noIndent=0, oneLine=1, multiLine=2, blockLine=3 }; // ---------------------------------------------------------------------------- typedef struct { const char *name; indentAttr code; } IndentwordStruct; extern const IndentwordStruct pIndentWords[]; // ---------------------------------------------------------------------------- // This structure is used to store line data that is de-constructed from the // user's input file. #define MY_DEFAULT \ dataType(NoType), \ comWcode(False), \ offset(0), \ pData(), \ pState() class InputStruct : public ANYOBJECT { public: DataTypes dataType; // i.e "/*" or "*/" (CCom) // "//" (CppCom) // Code (a = 5; , if (a == b) .. (Code) // "{" (OBrace) // "}" (CBrace) // #define (PreP) // SPACES (nothing, blank line) (ELine) Boolean comWcode; // -1 : True, comment with code (for comment dataType) // 0 : False, comment with no Code int offset; // offset within original line's text char* pData; // pointer to queue data ! char* pState; // pointer to corresponding parse-state inline InputStruct (DataTypes theType, int theOffset) : MY_DEFAULT { dataType = theType; offset = theOffset; comWcode = False; pState = 0; // only non-null for code } // use defaults here: InputStruct(const InputStruct&); InputStruct& operator=(const InputStruct&); }; #undef MY_DEFAULT #if defined(DEBUG) || defined(DEBUG2) extern int totalTokens; // token count, for debugging #endif // ---------------------------------------------------------------------------- // The output structure is used to hold an entire output line. The structure is // expanded with its real tabs/spaces within the output function of the program. #if defined(DEBUG) || defined(DEBUG2) #define DBG_DEFAULT , thisToken(totalTokens++) #else #define DBG_DEFAULT #endif #define MY_DEFAULT \ pType(ELine), \ offset(0), \ bracesLevel(0), \ preproLevel(0), \ indentSpace(0), \ indentHangs(0), \ splitElseIf(False), \ pCode(NULL), \ pCFlag(NULL), \ pBrace(NULL), \ pBFlag(NULL), \ filler(0), \ pComment(NULL) DBG_DEFAULT class OutputStruct : public ANYOBJECT { public: DataTypes pType; int offset; // offset within original line's text int bracesLevel; // curly-brace level at beginning of line int preproLevel; // curly-brace level for preprocessor lines int indentSpace; // num of spaces int indentHangs; // num of indents for continuation bool splitElseIf; // special case for aligning else/if char* pCode; char* pCFlag; // state-flags for pCode char* pBrace; // "}" or "{", with possible code-fragment char* pBFlag; // state-flags for pBrace int filler; // num of spaces char* pComment; #if defined(DEBUG) || defined(DEBUG2) int thisToken; // current token number #endif public: // Constructor // Automate initalisation inline OutputStruct (DataTypes theType) : MY_DEFAULT { pType = theType; } inline OutputStruct (InputStruct* theIn) : MY_DEFAULT { pType = theIn -> dataType; offset = theIn -> offset; } inline OutputStruct (OutputStruct* theIn) : MY_DEFAULT { pType = theIn -> pType; offset = theIn -> offset; } // use defaults here OutputStruct(const OutputStruct &); OutputStruct& operator=(const OutputStruct&); // Destructor // Automate destruction inline ~OutputStruct (void) { delete[] pCode; delete[] pCFlag; delete[] pBrace; delete[] pBFlag; delete[] pComment; } }; #undef MY_DEFAULT #undef DBG_DEFAULT // ---------------------------------------------------------------------------- #define MY_DEFAULT \ stmt_level(0), \ until_parn(0), \ parn_level(0), \ until_curl(0), \ curl_level(0), \ in_aggreg(0), \ do_aggreg(False), \ indent(0) class HangStruct : public ANYOBJECT { private: int stmt_level; // statement-level (from oneLine=0) int until_parn; // suppress hang until right-parenthesis int parn_level; // parentheses-level int until_curl; // suppress hang until R_CURL int curl_level; // curly-brace-level int in_aggreg; // in aggregate, curly-brace-level bool do_aggreg; public: int indent; HangStruct() : MY_DEFAULT { } void IndentHanging (OutputStruct *pOut); private: void ScanState(const char *code, const char *state); }; #undef MY_DEFAULT // ---------------------------------------------------------------------------- class HtmlStruct : public ANYOBJECT { int state; public: HtmlStruct(void) : state(0) { } bool Active(const char *pLineData); }; // ---------------------------------------------------------------------------- #define MY_DEFAULT \ state(0), \ level(0), \ matched() class SqlStruct : public ANYOBJECT { int state; int level; char matched[80]; public: SqlStruct(void) : MY_DEFAULT { matched[0] = 0; } void IndentSQL(OutputStruct *pOut); private: int NextWord(int start, OutputStruct *pOut); int SkipWord(int start, OutputStruct *pOut); bool SqlVerb(const char *code); }; #undef MY_DEFAULT // ---------------------------------------------------------------------------- // This structure is used to hold indent data on non-brace code. // This includes case statements, single line if's, while's, for statements... #define MY_DEFAULT \ attrib(noIndent), \ pos(), \ singleIndentLen() class IndentStruct : public ANYOBJECT { public: // attribute values ... // value 1 = indent code one position, until a ';' is found ! // 2 = end on close brace, and at a position "pos" indentAttr attrib; int pos; // Indent double the amount for multiline single if, while ... // statements. int singleIndentLen; // constructor IndentStruct (void) : MY_DEFAULT { attrib = noIndent; pos = 0; singleIndentLen = 0; // number of spaces to indent ! } }; #undef MY_DEFAULT //----------------------------------------------------------------------------- // debug.cpp extern void trace (const char *format, ...); #ifdef DEBUG extern const char *traceDataType(DataTypes theType); extern void traceInput(const char *file, int line, InputStruct *pIn); extern void traceOutput(const char *file, int line, OutputStruct *pOut); #define TRACE_INPUT(pOut) traceInput(__FILE__, __LINE__, pOut); #define TRACE_OUTPUT(pOut) traceOutput(__FILE__, __LINE__, pOut); #else #define TRACE_INPUT(pOut) /* nothing */ #define TRACE_OUTPUT(pOut) /* nothing */ #endif inline bool emptyString(const char *s) { return s == 0 || *s == 0; } //----------------------------------------------------------------------------- // backup.cpp extern int BackupFile (char*& oldFilename, char*& newFilename); extern void RestoreIfUnchanged(char *oldFilename, char *newFilename); // exec_sql.cpp extern void IndentSQL (OutputStruct *pOut, int& state); // hanging.cpp extern void IndentHanging (OutputStruct *pOut, HangStruct& state); // FIXME extern int LookupKeyword(const char *tst); extern bool ContinuedQuote(OutputStruct *pOut); // strings.cpp extern bool isName(char c); extern bool CompareKeyword(const char *tst, const char *ref); extern char *NewString (const char *src); extern char *NewSubstring (const char *src, size_t len); extern const char *SkipBlanks(const char *s); // tabs.cpp extern void ExpandTabs (char* &pString, int tabLen, int deleteChars, Boolean quoteChars, CharState &curState, char * &lineState, Boolean &codeOnLine); extern char* TabSpacing (int mode, int col, int len, int spaceIndent); // verbose.cpp extern bool prompt (const char *format, ...); extern void verbose (const char *format, ...); extern void warning (const char *format, ...); #endif // _BCPP_HEADER bcpp-20050725/code/makefile.in0000644000175100001440000000305510271241752015706 0ustar tomusers00000000000000# $Id: makefile.in,v 1.8 2005/07/25 19:56:26 tom Exp $ # Makefile-template for 'bcpp' THIS = bcpp #### Start of system configuration section. #### srcdir = @srcdir@ VPATH = @srcdir@ CXX = @CXX@ CXXFLAGS = @CXXFLAGS@ EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ LINK = $(CXX) LIBS = @LIBS@ LDFLAGS = @LDFLAGS@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = $(DESTDIR)@bindir@ x = @EXEEXT@ o = .@OBJEXT@ #### End of system configuration section. #### SHELL = /bin/sh OBJS = \ bcpp$o \ anyobj$o \ backup$o \ baseq$o \ cmdline$o \ config$o \ debug$o \ execsql$o \ hanging$o \ html$o \ stacklis$o \ strings$o \ tabs$o \ verbose$o CPPFLAGS = -I. -I$(srcdir) \ -DVERSION=\"`cat $(srcdir)/../VERSION`\" \ -DHAVE_CONFIG_H # -DDEBUG -DDEBUG2 PROG = $(THIS)$x .SUFFIXES: .cpp $o .cpp$o: @RULE_CC@ @ECHO_CC@$(CXX) $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(CPPFLAGS) -c $< -o $@ all: $(PROG) $(PROG): $(OBJS) @ECHO_LD@$(LINK) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) install: all installdirs $(INSTALL_PROGRAM) $(PROG) $(bindir)/$(PROG) installdirs: $(SHELL) ${srcdir}/../mkdirs.sh $(bindir) uninstall: rm -f $(bindir)/$(PROG) mostlyclean: rm -f *$o core *~ *.out *.BAK *.atac clean: mostlyclean rm -f $(PROG) distclean: clean rm -f makefile config.log config.cache config.status autoconf.h realclean: distclean rm -f tags TAGS # don't remove configure! check: $(SHELL) ./run-test tags: ctags *.cpp *.h TAGS: etags *.cpp *.h $(OBJS): autoconf.h bcpp.h bcpp-20050725/code/config.cpp0000644000175100001440000003670010271250557015560 0ustar tomusers00000000000000// $Id: config.cpp,v 1.23 2005/07/25 20:54:07 tom Exp $ // Program C(++) beautifier Written By Steven De Toni ACBC 11 11/94 // // This program module contains routines to read data from a text file a // line at a time, and able to read parameters from a configuration file. #include // atol(), #include // strlen(), strstr(), strcpy(), strcmp(), strpbrk() #include // NULL constant, printf(), FILE, ftell(), fseek(), fprintf(), stderr #include "bcpp.h" #include "cmdline.h" // StrUpr() enum ConfigWords {ANYT = 0, FSPC, UTAB, ISPC, IPRO, ISQL, NAQTOOCT, COMWC, COMNC, LCNC, LGRAPHC, ASCIIO, BI, BI2, PTBNLINE, PBNLINE, PROGO, QBUF, BUF, EQUAL, YES, ON, NO, OFF}; static const struct { ConfigWords code; const char *name; } ConfigData[] = { { ANYT, ";" }, { FSPC, "FUNCTION_SPACING" }, { UTAB, "USE_TABS" }, { ISPC, "INDENT_SPACING" }, { IPRO, "INDENT_PREPROCESSOR" }, { ISQL, "INDENT_EXEC_SQL" }, { NAQTOOCT, "NONASCII_QUOTES_TO_OCTAL" }, { COMWC, "COMMENTS_WITH_CODE" }, { COMNC, "COMMENTS_WITH_NOCODE" }, { LCNC, "LEAVE_COMMENTS_NOCODE" }, { LGRAPHC, "LEAVE_GRAPHIC_CHARS" }, { ASCIIO, "ASCII_CHARS_ONLY" }, { BI, "BRACE_INDENT" }, { BI2, "INDENT_BOTH_BRACES" }, { PTBNLINE, "PLACE_TOP_BRACE_ON_NEW_LINE" }, { PBNLINE, "PLACE_BRACE_ON_NEW_LINE" }, { PROGO, "PROGRAM_OUTPUT" }, { QBUF, "QUEUE_BUFFER" }, { BUF, "BACKUP_FILE" }, { EQUAL, "=" }, { YES, "YES" }, { ON, "ON" }, { NO, "NO" }, { OFF, "OFF" } }; static const size_t SizeofData = TABLESIZE(ConfigData); // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // Allocates memory for line in file, and places that the data in it. // pInFile = the file handle to use when reading the file ! // EndOfFile variable is used to test if the end of the file has been reached. // When this is true, the variable is changed to -1 // // A string is returned with the contents the current line in the file, // memory is allocated via the ReadLine routine, and should be deleted // when not needed ! char* ReadLine (FILE *pInFile, int& EndOfFile) { const int nominal = 80; int used = nominal; int need = 0; int ch; char* pLineBuffer = new char [used]; for(;;) { ch = fgetc(pInFile); if (ch < 0) { EndOfFile = ch; break; } else if (ch == LF) { break; } if (need + 2 > used) { used = ((need + 2) * 3) / 2; char *temp = new char [used]; for (int n = 0; n < need; n++) temp[n] = pLineBuffer[n]; delete[] pLineBuffer; pLineBuffer = temp; } pLineBuffer[need++] = ch; } pLineBuffer[need] = 0; return pLineBuffer; } // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // Lookup keyword in ConfigData[] static const char *ConfigWordOf(ConfigWords code) { for (size_t i = 0; i < SizeofData; i++) if (ConfigData[i].code == code) return ConfigData[i].name; return 0; } // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // This function is used to generate a generic error message. // // Parameters: // LineNo : Line number where the error occurred // errorCode : Error type to output to the user // errorCount : This variable is increment when this function is used // pMessage : Use by programmer to add additional information about the error // // // Return Values: // errorCount : This variable is used to show how many errors have occurred! // static void ErrorMessage (int lineNo, int errorCode, int& errorCount, const char* pMessage = NULL) { switch (errorCode) { case (1): { warning ("Syntax Error After Key Word "); break; } case (2): { warning ("Range Error !"); break; } case (3): { warning ("Expected Numeric Data !"); break; } case (4): { warning ("Can't Decipher"); break; } } if (pMessage != NULL) warning ("%s", pMessage); warning (" At Line %d\n", lineNo); errorCount++; } // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // Functions finds keywords within a line of data. // // Parameters: // Type : // The parameter is used to define the type of keyword to find within // a configuration line. // // See ConfigWords enum for values, Use ANYT, or a value of 0 to search // for any valid keywords within the line. // // pConfigLine : // This parameter is a pointer to a string that contains the data that // is going to be searched. // // Return Values: // // Type : Returns the keyword value expected, or keyword value found if // searching for any. // // Char*: Returns a pointer in the string to the next starting location // AFTER the keyword found. Or returns NULL if no keyword found! // static char* FindConfigWords (char* pConfigLine, ConfigWords& type) { char* pWordLoc = NULL; // check is there is a comment in the line, if so then any chars // after a ";" will be ignored ! pWordLoc = strstr (pConfigLine, ConfigWordOf(ANYT)); // search for a comment ! if (pWordLoc != NULL) { *pWordLoc = NULLC; } if (type > ANYT) { pWordLoc = strstr (pConfigLine, ConfigWordOf(type)); if (pWordLoc != NULL) // if word found { // advance to next word ! pWordLoc += strlen (ConfigWordOf(type)); return pWordLoc; } } for (size_t typeCount = 1; typeCount < SizeofData; typeCount++) { const char *name = ConfigData[typeCount].name; pWordLoc = strstr (pConfigLine, name); if (pWordLoc != NULL) { type = ConfigData[typeCount].code; // advance to next word ! pWordLoc += strlen (name); return pWordLoc; } } type = ANYT; // not a keyword ! return NULL; } // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // ConfigAssignment function is used to assigned Boolean, or unsigned integer // values from 0 - 5000 to variables that are passed to it. // // Parameters: // errorCount : Variable used to define how many errors have occurred. If any errors // encountered within the function, then this var will be incremented. // PosInLine : Defines a pointer to the starting location to read in data for // assignment from config data line (string). // variable : This defines the variables that's going to be altered, be boolean, or // integer. // // Return Values: // errorCount : If any error occur within variable assignment, the a error // message is displayed, and this variable is incremented. // variable : If no errors have occurred, then this variable will contain the value // that was set by the user ! // static void ConfigAssignment (int& errorCount, int& configError, char* pPosInLine, int& variable) { // convert what's left in the string to an INTEGER ! if (strpbrk(pPosInLine, "0123456789") != NULL) variable = atoi (pPosInLine); else ErrorMessage (errorCount, 3, configError); // check range of lines numbers between functions! if ( (variable < 0) || (variable > 5000) ) ErrorMessage (errorCount, 2, configError, " Valid Range = 0 - 5000"); } static void ConfigAssignment (int& errorCount, int& configError, char* pPosInLine, Boolean& variable) { ConfigWords type = ANYT; // check if key words are there pPosInLine = FindConfigWords (pPosInLine, type); switch (type) { case (YES): // YES case (ON) : // ON variable = True; break; case (NO) : // NO case (OFF): // OFF variable = False; break; default: ErrorMessage (errorCount, 1, configError, ConfigWordOf(EQUAL)); } // switch } #define DecodeIt(value) \ { \ ConfigWords tesType = EQUAL; \ pPosInLine = FindConfigWords (pPosInLine, tesType); \ \ if (tesType != EQUAL) { \ ErrorMessage (lineCount, 1, configError, ConfigWordOf(type)); \ break; \ } else \ ConfigAssignment (lineCount, configError, pPosInLine, value); \ } // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // This function is used to load the users configuration from a file. // // Parameters: 2 // pConfigFile : Pointer to a FILE structure/handle that contains the // configuration data. // userSettings : Config structure that will contain the user settings. // // Return Values: // int : Returns the number of errors encountered when reading the // configuration file. // userSettings : This variable is altered to the user settings read from the // config file. // int SetConfig (FILE* pConfigFile, Config& userSettings) { int noMoreConfig = 0 ; char* pLineOfConfig = NULL; char* pPosInLine = NULL; ConfigWords type ; int lineCount = 0 ; int configError = 0 ; Boolean test; while (! noMoreConfig) { pLineOfConfig = ReadLine (pConfigFile, noMoreConfig); lineCount++; // upcase all characters in string ! StrUpr (pLineOfConfig); type = ANYT; pPosInLine = FindConfigWords (pLineOfConfig, type); switch (type) { case (FSPC): // FUNCTION_SPACING = (%d) DecodeIt (userSettings.numOfLineFunc); break; case (UTAB): // USE_TABS = {on, off, yes, no} DecodeIt (userSettings.useTabs); break; case (ISPC): // INDENT_SPACING = (%d) DecodeIt (userSettings.tabSpaceSize); break; case (IPRO): // INDENT_PREPROCESSOR = (%d) DecodeIt (userSettings.indentPreP); break; case (ISQL): // INDENT_EXEC_SQL = (%d) DecodeIt (userSettings.indent_sql); break; case (NAQTOOCT): // NONASCII_QUOTES_TO_OCTAL = {on, off, yes, no} DecodeIt (userSettings.quoteChars); break; case (COMWC): // COMMENTS_WITH_CODE = (%d) DecodeIt (userSettings.posOfCommentsWC); break; case (COMNC): // COMMENTS_WITH_NOCODE = (%d) DecodeIt (userSettings.posOfCommentsNC); break; case (LCNC): // LEAVE_COMMENTS_NOCODE = {on, off, yes, no} DecodeIt (userSettings.leaveCommentsNC); break; case (LGRAPHC): // LEAVE_GRAPHIC_CHARS = {on, off, yes, no} test = False; DecodeIt (test); if (test == True) userSettings.deleteHighChars = 3; // set bit 0, 1 else userSettings.deleteHighChars = 0; // unset bit 0, 1 break; case (ASCIIO): // ASCII_CHARS_ONLY = {on, off, yes, no} test = False; DecodeIt (test); if (test == True) userSettings.deleteHighChars = 1; // set bit 0 else userSettings.deleteHighChars = 0; // unset bit 0 break; case (BI): // BRACE_INDENT = {on, off, yes, no} DecodeIt (userSettings.braceIndent); break; case (BI2): // INDENT_BOTH_BRACES = {on, off, yes, no} DecodeIt (userSettings.braceIndent2); break; case (PTBNLINE): // PLACE_TOP_BRACE_ON_NEW_LINE = {on, off, yes, no} DecodeIt (userSettings.topBraceLoc); break; case (PBNLINE): // PLACE_BRACE_ON_NEW_LINE = {on, off, yes, no} DecodeIt (userSettings.braceLoc); break; case (PROGO): // PROGRAM_OUTPUT = {on, off, yes, no} DecodeIt (userSettings.output); break; case (QBUF): // queue_buffer = (%d) DecodeIt (userSettings.queueBuffer); if (userSettings.queueBuffer < 2) userSettings.queueBuffer = 2; break; case (BUF): // backup_file = {on, off, yes, no} DecodeIt (userSettings.backUp); break; case (ANYT): break; default: warning("Text:%s\n", pLineOfConfig); ErrorMessage (lineCount, 4, configError); break; }// switch delete[] pLineOfConfig; }// while return configError; } // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // This function is used to show the users configuration. // // Parameters: // userSettings : Config structure that contains the user settings. // // Return Values: // int : Returns the number of errors encountered when reading the // configuration file. // int ShowConfig (Config& userSettings) { const char* choices[2] = {"Yes", "No"}; int errorNum = 0; verbose ("Function Line Spacing : %d\n", userSettings.numOfLineFunc); verbose ("Use Tabs In Indenting : %s\n", choices[userSettings.useTabs+1]); verbose ("Indent Spacing Length : %d\n", userSettings.tabSpaceSize); verbose ("Comments With Code : %d\n", userSettings.posOfCommentsWC); if (userSettings.leaveCommentsNC != False) verbose ("Comments With No Code : Indented According To Code\n"); else verbose ("Comments With No Code : %d\n", userSettings.posOfCommentsNC); verbose ("Remove Non-ASCII Chars : "); switch (userSettings.deleteHighChars) { case (0): verbose ("No\n"); break; case (1): verbose ("Yes\n"); break; case (3): verbose ("Yes But Not Graphic Chars\n"); break; default: warning ("#### ERROR : Unexpected Value %d", userSettings.deleteHighChars); errorNum++; } verbose ("Non-ASCII Chars In Quotes To Octal : %s\n", choices[userSettings.quoteChars+1]); verbose ("Top-level Open Braces On New Line : %s\n", choices[userSettings.topBraceLoc+1]); verbose ("Open Braces On New Line : %s\n", choices[userSettings.braceLoc+1]); verbose ("Program Output : %s\n", choices[userSettings.output+1]); verbose ("Internal Queue Buffer Size : %d\n", userSettings.queueBuffer); if (errorNum > 0 && prompt("Do You Wish To Continue To Process Files ")) errorNum = 0; return errorNum; } bcpp-20050725/code/anyobj.cpp0000644000175100001440000000062710271250557015574 0ustar tomusers00000000000000#ifndef _ANYOBJECT_CODE #define _ANYOBJECT_CODE // Program code written by Steven De Toni ACBC 11 #include "anyobj.h" // ############################################################################### // #### ANYOBJECT Destructor #### // ############################## // Set to virtual so that objects can call there own destructors // without becoming confused. ANYOBJECT::~ANYOBJECT (void) {} #endif bcpp-20050725/code/bcpp.cpp0000644000175100001440000033603510271250516015236 0ustar tomusers00000000000000// C(++) Beautifier V1.61 Unix/MS-DOS update ! // ----------------------------------------- // $Id: bcpp.cpp,v 1.115 2005/07/25 20:53:34 tom Exp $ // // Program was written by Steven De Toni 1994 (CBC, ACBC). // Modified/revised by Thomas E. Dickey 1996-2002,2003. // // Steven's original notes follow: // ---------------------------------------------------------------------------- // This program attempts to alter C, C++ code so that it fits to a // format that the user wants. // This program is the result of a project that needed to be written // for a module that I was doing at the Waikato Polytech. // Course : Advanced Certificate In Business Computing (ACBC) // Module : PR-300. // Assignment : Project 1, approx 60 hours. // // The program reads a configuration file that has the user's settings. // Input, and output files are via the command line. // // If compiling under DOS, use Large memory model, any other // type of system (i.e., Unix, Amiga), use default. // I have tried to use all standard Unix functions for I/O to keep // the Unix programmers happy. // // NOTE: // This code has never been tested under any other system other than MS-DOS. // All program code is public domain, you can use any part of this // code on the condition that my name be placed somewhere within documentation, // or program. However, all rights are reserved as to the program logic, that // is to say, you can change it, give it to people, but my name must still // exist within the credits of the old, or newly altered program (Programmers Ethics). // // ################################################################################### // // Program Update : 14/11/94 V1.5 // // Removed a couple more bugs, optimized code (not that you notice it), // added the following features: // - Able to decode lines fully (uses recursion) // - Able to handle unlimited depth handling for single indent code. // - Added command line parameter processing (able use i/o redirection) // - Added variable internal buffer length (used for repositioning of braces) // // ################################################################################### // // Program Update : 21/11/94 V1.55 // // Compiling done using GNU G++, brilliant compiler ... // Dos debugger (debug32) sucked totally compared to Borlands programming // environment, ended up using a series of printf statements in debugging ! // // Program functions perfectly under Sun SPARC station running SunOs V??, // compiled using GNU G++ V2.6.?. Version 1.05 of the GNU running under // DOS functions brilliantly, except for input redirection fails. I think this // could be due to fseek() failing to move back, and forward within the input // stream. Under Unix, this isn't a problem as pipes/redirections are handled // properly ! // // Removed/fixed segmentation violations picked up by G++ within code! // // - Removed non-existing enum constant out of fseek() (I didn't know) // - Wrote my own string upper case routine as standard string.h // didn't have it (again I didn't know). // - Fix a couple of string constants, and few other odds and ends. // // ################################################################################### // // Program Update : 24/11/94 V1.6 // // Final version update of this program. // // - Added a time feature to show long processing of the input // data stream took ... just because I could. // // - Fixed tab space size so that code lines are calculated at correct // lengths according to indent spacing. // // - Implemented a backup feature for the input file, and changed the // selection of input/output file to the Unix standard. // // - fix the following decode problems // if (strcmp (pAString, "A String") == 0) // test for "A String" // ^ // | // Not recognized as a comment because of the quotes chars! // // - struct a { int b, c, d; } as; // The above now gets decoded properly. // // - able to indent multiple depthed switch like structures properly. // // ################################################################################### // // Program Update : 9/1/95 V1.61 // // - Able to set indentation of comments with no code the same as normal code, // this results in the comments lining up with the code. // // This option was brought to you by a Canadian user Justin Slootsky. // // ################################################################################### // // Program Update : 19/2/95 V1.62 // // Fixed error that was caused when C style comment was placed in the wrong // placed which caused program output to be wrong // // if (someCode) /* C Style Comment // // // // /* C Style Comment // if (someCode) // // Fixed output error is multi-if statements were nested together, and have // have code within braces after them. // // if (someCode) { someCode; } // if (someCode) { someCode; } // // // // if (someCode) { someCode; } // if (someCode) { someCode; } // // ################################################################################### // // Program Update : 10/3/95 V1.629 // // Fixed problems with preprocessor statements. All preprocessor statements // are place at column 1. // // ################################################################################### // // Program Update : 4/5/95 V1.7 // // Fixed removing of spaces in c style multiline comments // Remove bug with c style comment that has code before it (uses recursion as a fix) // Added location of program to use bcpp.cfg configuration without specifying // it with options (i.e. uses PATH variable to locate). // ################################################################################### // // Program Update : 27/11/95 V1.75 // // Fixed the indenting of single statements so they don't become corrupt, and // line up with previous code. // Also some simple logic errors where found by users and fixed. // // ################################################################################### // // Program Update : 06/12/95 V1.8 (Bug was created when ported to Unix and // trying to prevent segmentation errors, this has been fixed. The problem // caused incorrect indenting of code if a 'if' statement was within a case // structure. #include // getenv() #include // time() #include // strlen(), strstr(), strchr(), strcpy(), strcmp() #include // character-types #include "cmdline.h" // ProcessCommandLine() #include "bcpp.h" // ---------------------------------------------------------------------------- static const char *cppc_begin = "//"; static const char *ccom_begin = "/*"; static const char *ccom_end = "*/"; const IndentwordStruct pIndentWords[] = { { "if", oneLine }, { "while", oneLine }, { "for", oneLine }, { "else", oneLine }, { "case", multiLine }, { "default", multiLine }, { "public", multiLine }, { "protected", multiLine }, { "private", multiLine }, { "do", blockLine }, { "switch", blockLine }, { "while", blockLine }, }; #if defined(DEBUG) || defined(DEBUG2) int totalTokens; // token count, for debugging #endif // ---------------------------------------------------------------------------- static inline const char *endOf(const char *s) { return (s + strlen(s)); } static inline char *endOf(char *s) { return (s + strlen(s)); } static inline char lastChar(const char *s) { return ((s != NULL) && (*s != NULLC)) ? *(endOf(s)-1) : static_cast(NULLC); } static Boolean IsStartOfComment(char *pLineData, char *pLineState) { if (pLineState[0] == Comment) { if (!strncmp(pLineData, ccom_begin, 2)) return True; } return False; } static Boolean IsEndOfComment(char *pLineData, char *pLineState) { while (*pLineState++ == Comment) { if (!strncmp(pLineData++, ccom_end, 2)) return True; } return False; } static Boolean IsLeadingCommentFragment(char *pLineData, char *pLineState) { if (IsStartOfComment(pLineData, pLineState) && !IsEndOfComment(pLineData+2, pLineState+2)) return True; return False; } // Check if we've just extracted a comment fragment, i.e., a C comment // beginning on the current line that doesn't end there. We'll have to defer // the comment til after the code is flushed out, otherwise we end up // commenting it out. static Boolean ExtractedCCmtFragment(char *pLineData, InputStruct* pItem) { if (*SkipBlanks(pLineData) && IsLeadingCommentFragment(pItem->pData, pItem->pState)) { pItem->comWcode = False; pItem->offset = 0; return True; } return False; } static inline void ShiftLeft(char *s, int len) { if (len > 0) { char *t = s + len; while ((*s = *t) != '\0') { ++s; ++t; } } } int LookupKeyword(const char *tst) { size_t n; if (!emptyString(tst)) { for (n = 0; n < TABLESIZE(pIndentWords); n++) if (CompareKeyword(tst, pIndentWords[n].name)) return n; } return -1; } // Return true if the given data is a blockLine. static bool beginBlockLine(OutputStruct* pItem) { bool result = False; int findWord = LookupKeyword(pItem -> pCode); if (findWord >= 0) { if (pIndentWords[findWord].code == blockLine) result = True; } return result; } // Return true if the given data is a multiLine. static bool beginMultiLine(OutputStruct* pItem) { bool result = False; int findWord = LookupKeyword(pItem -> pCode); if (findWord >= 0) { if (pIndentWords[findWord].code == multiLine) result = True; } return result; } // Return true if the current line is a blockLine preceding L_CURL. static bool beginBlockLine(QueueList* pLines) { return beginBlockLine(reinterpret_cast(pLines -> peek(1))); } // ---------------------------------------------------------------------------- // Function removes leading, trailing, both leading/trailing characters // that are less than or equal to a space character (includes spaces, tabs etc) // // Parameters: // pLineData : Pointer to the start location of the string that's going to be processed // mode : Bit values that define the removal of characters from the string... // 1 = remove spaces from left // 2 = remove spaces from right // 3 = remove spaces from left, and right // // Returns: the number of spaces removed from the left. // static int StripSpacingLeftRight (char* pLineData, char* pLineState, int mode = 3) { int n; int result = 0; if (mode & 1) { for (n = -1; pLineState[n+1] == Blank; n++) ; if (n >= 0) { ShiftLeft(pLineData, n+1); ShiftLeft(pLineState, n+1); result = n+1; } } if (mode & 2) { for (n = strlen(pLineData); n > 0 && pLineState[n-1] == Blank; n--) { pLineData[n-1] = NULLC; pLineState[n-1] = NullC; } } return result; } // ---------------------------------------------------------------------------- // Function returns a Boolean value that shows where code is contained within // a string, given its parse-state. // // Parameters: // pLineState : Pointer to a string to process. // // Return Values: // Boolean : False = line has no code // True = line has some sort of code // static Boolean TestLineHasCode (char* pLineState) { if (pLineState != NULL) { while (*pLineState != NullC) { if (ispunct(*pLineState)) return True; pLineState++; } } return False; } static inline void TerminateLine(char *pData, char *pState, size_t n) { pData[n] = NULLC; pState[n] = NullC; } /* * Check if the indicated comment is the last item on the line. If it is not, * it is not safe to move to the end of the line, or to a different line, since * we are not sure of the context. */ static bool isFinalComment(int first, int last, char *pData, char *pState) { if (pState[first] == Ignore) { return True; } last += 2; // count the "*/" int limit = strlen(pState); if (last >= limit) { return True; } while (last < limit) { if (pData[last] != ESCAPE && pData[last] != SPACE) return False; ++last; } return True; } static bool isContinuation(size_t &len, char *pData, char *pState) { if (pData != 0 && pState != 0) { len = strlen(pState); if (len != 0 && pData[--len] == ESCAPE && pState[len] != Comment && pState[len] != Ignore) return True; } return False; } static bool isContinuation(InputStruct *pItem) { size_t len; return isContinuation(len, pItem->pData, pItem->pState); } static bool isContinuation(OutputStruct *pItem) { size_t len; return isContinuation(len, pItem->pCode, pItem->pCFlag); } static void TrimContinuation(char *pData, char *pState) { size_t len; if (isContinuation(len, pData, pState)) { while (len > 1 && isspace(pState[len-1]) && isspace(pState[len-2])) { len--; pData[len-1] = SPACE; pData[len] = ESCAPE; pData[len+1] = NULLC; pState[len] = Normal; pState[len+1] = NullC; } if (len > 0 && isspace(pState[len-1])) { pData[len-1] = SPACE; } } } // check if the given data is a preprocessor-line static inline bool isPreproLine(OutputStruct* pOut) { return ((pOut != 0) && (pOut->pCode != 0) && (pOut->pType == PreP)); } // check if the given data begins with a right curly-brace static inline bool BeginsCurly(OutputStruct* pOut) { bool result = False; for (int n = 0; pOut->pCode[n] != NULLC; ++n) { if (pOut->pCFlag[n] != Blank) { if (pOut->pCFlag[n] == Normal && pOut->pCode[n] == R_CURL) result = True; break; } } return result; } // ---------------------------------------------------------------------------- // This function is used within function DecodeLine(), it creates a new // InputStructure and stores what is contained in pLineData string in // the newly created structure. // // Parameters: // offset : offset within original line's text of this component // pLineData : Pointer to the string to store within the InputStructure. // dataType : Type of data that is to be stored within the InputStructure // see DataTypes enum. // removeSpace : true when we're to remove leading/trailing blanks // // Return Values: // InputStruct* : Returns a pointer to the newly constructed InputStructure, // returns a NULL value if unable to allocate memory. // static InputStruct* ExtractCode (int offset, char* pLineData, char* pLineState, DataTypes dataType = Code, Boolean removeSpace = True) { char* pNewCode = 0; char* pNewState = 0; InputStruct* pItem = 0; if ((pNewCode = NewString(pLineData)) != 0) { if ((pNewState = NewString(pLineState)) != 0) { // strip spacing in new string before storing if (removeSpace != False) { offset += StripSpacingLeftRight (pNewCode, pNewState); if (dataType == Code || dataType == PreP) TrimContinuation(pNewCode, pNewState); } if ((pItem = new InputStruct(dataType, offset)) != 0) { pItem -> pData = pNewCode; pItem -> pState = pNewState; return pItem; } delete pNewState; } delete pNewCode; } return 0; } // ---------------------------------------------------------------------------- // Extracting comments from the input line is a little more complicated than // the code fragments, since we'll strip the comments out of the input line // after extracting them. // static InputStruct* ExtractCCmt (int& offset, int start, int end, char* pLineData, char* pLineState, DataTypes dataType = CCom) { InputStruct* pItem = 0; char endData = NULLC; char endState = NULLC; size_t len = end >= 0 ? (end - start + 2) : strlen(pLineData); size_t last = start + len; if (end >= 0) { endData = pLineData[last]; endState = pLineState[last]; TerminateLine(pLineData, pLineState, last); } pItem = ExtractCode( offset + start, pLineData + start, pLineState + start, dataType, False); if (end >= 0) { pLineData[last] = endData; pLineState[last] = endState; ShiftLeft (pLineData +start, len); ShiftLeft (pLineState+start, len); } else { TerminateLine(pLineData, pLineState, start); } if (pItem != 0) { pItem -> comWcode = TestLineHasCode (pLineState); // Comment without code ? } offset += len; TRACE(("Updated offset to %d\n", offset)); return pItem; } // ---------------------------------------------------------------------------- // This Function is used to de-allocate memory in a InputStructure. // A destructor wasn't used because other objects may also own the // same memory. // // Parameters: // pDelStruct : Pointer to a dynamically allocated InputStructure within // string data allocated. // static inline void CleanInputStruct (InputStruct* pDelStruct) { if (pDelStruct != NULL) { delete[] pDelStruct -> pState; delete[] pDelStruct -> pData; delete pDelStruct; } } // ---------------------------------------------------------------------------- // Function is used within function DecodeLine() to de-allocate memory // that it is currently using. This function is called upon a memory // allocation failure. // // Parameters: // PDelQueue : Pointer to a QueueList object which in general will contain // InputStructures. // static int DecodeLineCleanUp (QueueList* pDelQueue) { // Don't implement destructor as other objects may be using the same // memory when using structure in output line processing (simple garbage collection) while (pDelQueue->status() > 0) CleanInputStruct ( reinterpret_cast(pDelQueue -> takeNext()) ); return -1; } static int FindStartofComment(char *pLineState, CharState code = Comment) { int it = -1; int n; for (n = 0; pLineState[n] != NullC; n++) { if (pLineState[n] == code) { it = n; break; } } return it; } static int FindEndofComment(char *pLineState) { int it = -1; int n; for (n = 0; pLineState[n] == Comment; n++) { if (pLineState[n+1] == Comment && pLineState[n+2] != Comment) { it = n; break; } } return it; } // find punctuation delimiting code, e.g., curly braces or semicolon static int FindPunctuation(char *pLineData, char *pLineState, char punct) { int it = -1; int n; for (n = 0; pLineData[n] != NULLC; n++) { if (pLineState[n] == Normal && pLineData[n] == punct) { it = n; break; } } return it; } // ---------------------------------------------------------------------------- // When splitting a line (e.g., to move an open brace), check to see if the // right fragment has a backslash escaping the newline. If so, append one to // the left fragment. // // pItem : pointer to structure that we may append continuation to. // pLineData : Pointer to a line of a users input file (string). // pLineState : Pointer to a state of a users input line (string). // static void splitContinuation(InputStruct *pItem, char *pLineData, char *pLineState, bool force) { size_t len; if (force && !strcmp(pLineData, pItem->pData)) force = False; if ((force || isContinuation(len, pLineData, pLineState)) && !isContinuation(len, pItem->pData, pItem->pState)) { char *s = new char[len + 4]; strcpy(s, pItem->pData); strcat(s, " \\"); delete[] pItem->pData; pItem->pData = s; s = new char[len + 4]; strcpy(s, pItem->pState); s[++len] = Blank; s[++len] = Normal; s[++len] = NullC; delete[] pItem->pState; pItem->pState = s; } } // ---------------------------------------------------------------------------- // This function is a single pass decoder for a line of input code that // is read from the user's input file. The function stores each part of a line, // be it a comment (with its attributes), code, open brace, close brace, or // blank line as a InputStructure, each InputStructure is stored within // a Queue Object. // // Parameters: // offset : offset within original line's text of this component // pLineData : Pointer to a line of a users input file (string). // pLineState : Pointer to a state of a users input line (string). // QueueList* : Pointer to a QueueList object will contains all of // a lines basic elements. If this object doesn't contain // any elements, then it suggests there was a processing // problem. // // Return Values: // int : returns a error code. // -1 : Memory allocation failure // 0 : No Worries // static int DecodeLine (bool afterSlash, int offset, char* pLineData, char *pLineState, QueueList* pInputQueue) { int SChar = -1; int EChar = -1; size_t commentLen = 0; // @@@@@@ C Comment processing, if over multiple lines @@@@@@ if (*pLineState == Comment && !IsStartOfComment(pLineData, pLineState)) { //#### Test to see if end terminating C comment has arrived ! EChar = FindEndofComment(pLineState); if (EChar >= 0) { InputStruct* pItem = ExtractCCmt(offset, 0, EChar, pLineData, pLineState, CCom); if (pItem == NULL) return DecodeLineCleanUp (pInputQueue); TRACE_INPUT(pItem) pInputQueue->putLast (pItem); } else //##### Place output as comment without code (C comment terminator not found) { InputStruct* pTemp = ExtractCode (offset, pLineData, pLineState, CCom, False); // don't remove spaces ! //#### Test if memory allocated if (pTemp == NULL) return DecodeLineCleanUp (pInputQueue); TRACE_INPUT(pTemp) pInputQueue->putLast (pTemp); return 0; } }// if multi-line C style comments // N.B Place this function here as to sure not to corrupt relative pointer // settings that may be used within pLinedata, and become altered through // using this routine. offset += StripSpacingLeftRight (pLineData, pLineState); //@@@@@@ Extract /* comment */ C type comments on one line SChar = FindStartofComment (pLineState); // find start of C Comment if (SChar >= 0) { //##### Check if there is a ending C terminator comment string EChar = FindEndofComment(pLineState+SChar) + SChar; //##### If negative then comments are on multiple lines ! if (EChar < 0) { InputStruct* pItem = ExtractCCmt(offset, SChar, -1, pLineData, pLineState, CCom); if (pItem == NULL) return DecodeLineCleanUp (pInputQueue); // make multi-line C style comments totally separate // from code to avoid some likely errors occurring if they // are shifted due to being over written by code. // apply recursion so that comment is last item placed // in queue ! if (DecodeLine (afterSlash, offset, pLineData, pLineState, pInputQueue) != 0) { // problems ! delete[] pItem -> pData; delete pItem; return -1; } TRACE_INPUT(pItem) pInputQueue->putLast (pItem); return 0; // no need to continue processing } else if (!isFinalComment(SChar, EChar, pLineData, pLineState)) { InputStruct* pItem = ExtractCode(offset, pLineData, pLineState); TRACE_INPUT(pItem) pInputQueue->putLast (pItem); return 0; // no need to continue processing } else if (!isContinuation(commentLen, pLineData, pLineState)) { InputStruct* pItem = ExtractCCmt(offset, SChar, EChar, pLineData, pLineState, CCom); if (pItem == NULL) return DecodeLineCleanUp (pInputQueue); if (ExtractedCCmtFragment(pLineData, pItem)) { if (DecodeLine (afterSlash, offset, pLineData, pLineState, pInputQueue) != 0) return DecodeLineCleanUp(pInputQueue); TRACE_INPUT(pItem) pInputQueue->putLast (pItem); return 0; } else { TRACE_INPUT(pItem) pInputQueue->putLast (pItem); } } //##### else }//##### If "/*" C comments present //##### Remove blank spacing from left & right of string offset += StripSpacingLeftRight (pLineData, pLineState); //@@@@@@ C++ Comment Processing ! SChar = FindStartofComment (pLineState, Ignore); if (SChar >= 0) { int myoff = offset; InputStruct* pItem = ExtractCCmt(myoff, SChar, -1, pLineData, pLineState, CppCom); if (pItem == NULL) return DecodeLineCleanUp (pInputQueue); if (ExtractedCCmtFragment(pLineData, pItem)) { if (DecodeLine (afterSlash, offset, pLineData, pLineState, pInputQueue) != 0) return DecodeLineCleanUp(pInputQueue); TRACE_INPUT(pItem) pInputQueue->putLast (pItem); return 0; } else { TRACE_INPUT(pItem) pInputQueue->putLast (pItem); } } //##### Remove blank spacing from left & right of string offset += StripSpacingLeftRight (pLineData, pLineState); //@@@@@@ #define (preprocessor extraction) if (pLineState[0] == POUNDC) { //#### create new queue structure ! InputStruct* pItem = ExtractCode(offset, pLineData, pLineState, PreP); //#### Test if memory allocated if (pItem == NULL) return DecodeLineCleanUp (pInputQueue); TRACE_INPUT(pItem) pInputQueue->putLast (pItem); return 0; // no worries ! } //################# Actual Code Extraction ################# offset += StripSpacingLeftRight (pLineData, pLineState); //@@@@@@ Test what's left in line for L_CURL, and R_CURL braces SChar = FindPunctuation(pLineData, pLineState, L_CURL); EChar = FindPunctuation(pLineData, pLineState, R_CURL); Boolean testEnumType = False; if ( ((SChar >= 0) && (EChar >= 0)) && (SChar < EChar)) { // test to see if there are multiple open/ close braces in enum // selective range // i.e. { if ( a == b ) { b = c } else { d = e } } int OBrace2 = FindPunctuation(pLineData+SChar+1, pLineState+SChar+1, L_CURL); if ( (OBrace2 < 0) || ((OBrace2 > EChar) && (OBrace2 >= 0)) ) testEnumType = True; } //##### If condition correct, then make rest of line just code ! (e.g enum) // if no items in input queue, and no multiple open, close braces in // line then .... extract as enum. if ( (testEnumType != False) && (pInputQueue -> status () <= 0) ) { //store code as enum type if follow-up condition is true EChar++; switch (pLineData[EChar]) // advance another char? { case SEMICOLON: case ',': EChar++; break; default: break; } char saveData = pLineData[EChar]; pLineData[EChar] = NULLC; char saveState = pLineState[EChar]; pLineState[EChar] = NULLC; InputStruct* pTemp = ExtractCode(offset, pLineData, pLineState); if (pTemp == NULL) return DecodeLineCleanUp (pInputQueue); pLineData[EChar] = saveData; pLineState[EChar] = saveState; splitContinuation(pTemp, pLineData, pLineState, afterSlash); TRACE_INPUT(pTemp) pInputQueue->putLast (pTemp); offset += EChar; ShiftLeft (pLineData, EChar); ShiftLeft (pLineState, EChar); // restart decoding line ! return DecodeLine (afterSlash, offset, pLineData, pLineState, pInputQueue); // end of recursive call ! } // if L_CURL and R_CURL exit on same line //##### Determine extraction precedence ! if ((SChar >= 0) && (EChar >= 0)) { if (SChar > EChar) SChar = -1; else EChar = -1; } //##### Place whatever is before the open brace L_CURL, or R_CURL as code if ((SChar >= 0) || (EChar >= 0)) { char saveCode; char saveFlag; int toSave = SChar >= 0 ? SChar : EChar; saveCode = pLineData[toSave]; pLineData[toSave] = NULLC; saveFlag = pLineState[toSave]; pLineState[toSave] = NULLC; //#### Store leading code if any if (TestLineHasCode (pLineState) != False) { char* pTemp = NewString(pLineData); if (pTemp == NULL) return DecodeLineCleanUp (pInputQueue); //#### strip spacing is handled within extractCode routine. This //#### means that pointers that are calculated before stripSpacing //#### function remain valid. InputStruct* pLeadCode = ExtractCode (offset, pTemp, pLineState); if (pLeadCode == NULL) return DecodeLineCleanUp (pInputQueue); pLineData[toSave] = saveCode; pLineState[toSave] = saveFlag; splitContinuation(pLeadCode, pLineData+toSave+1, pLineState+toSave+1, afterSlash); TRACE_INPUT(pLeadCode) pInputQueue->putLast (pLeadCode); delete[] pTemp; } //##### Update main string offset += toSave; pLineData[toSave] = saveCode; ShiftLeft (pLineData, toSave); pLineState[toSave] = saveFlag; ShiftLeft (pLineState, toSave); TrimContinuation(pLineData, pLineState); // extract open/closing brace from code, and place brace as separate // line from code. And create new structure for code InputStruct* pTemp = 0; int extractMode; if (pLineData[0] == L_CURL) extractMode = 1; // remove open brace else extractMode = 2; // remove close brace do { switch (extractMode) { case (1): // remove open brace { saveCode = pLineData[1]; pLineData[1] = NULLC; saveFlag = pLineState[1]; pLineState[1] = NULLC; pTemp = ExtractCode (offset, pLineData, pLineState, OBrace);//##### Define data type before storing offset += 1; pLineData[1] = saveCode; ShiftLeft (pLineData, 1); pLineState[1] = saveFlag; ShiftLeft (pLineState, 1); splitContinuation(pTemp, pLineData, pLineState, afterSlash); extractMode = 3; // apply recursive extraction break; } case (2): // remove close brace { // test the type of close brace extraction ! // check for following code ... // struct { int a, b, } aStructure; //@@@@@@ Test what's left in line for L_CURL, and R_CURL braces // start one after first char ! SChar = FindPunctuation(pLineData+1, pLineState+1, L_CURL); EChar = FindPunctuation(pLineData+1, pLineState+1, R_CURL); if ((SChar >= 0) || (EChar >= 0)) { int mark; if (pLineData[1] == SEMICOLON) // if true, extract after char mark = 2; else mark = 1; saveCode = pLineData[mark]; pLineData[mark] = NULLC; saveFlag = pLineState[mark]; pLineState[mark] = NULLC; pTemp = ExtractCode (offset, pLineData, pLineState, CBrace); offset += mark; pLineData[mark] = saveCode; ShiftLeft (pLineData, mark); pLineState[mark] = saveFlag; ShiftLeft (pLineState, mark); splitContinuation(pTemp, pLineData, pLineState, afterSlash); extractMode = 3; // apply recursive extraction } else // rest of data is considered as code ! { pTemp = ExtractCode (offset, pLineData, pLineState, CBrace); splitContinuation(pTemp, pLineData, pLineState, afterSlash); pLineState = NULL; // leave processing ! } break; } case (3): // remove what is left on line as code. { return DecodeLine (afterSlash, offset, pLineData, pLineState, pInputQueue); // end of recursive call ! } }// switch; //#### Test if memory allocated if (pTemp == NULL) return DecodeLineCleanUp (pInputQueue); TRACE_INPUT(pTemp) pInputQueue->putLast (pTemp); // store Item } while ((TestLineHasCode (pLineState) != False) && (pTemp != NULL)); } else //##### Line contains either code, or spacing { //##### If nothing in string, and nothing stored in queue, then blank line if ((pLineData[0] == NULLC) && ((pInputQueue->status()) <= 0)) { //##### implement blank space InputStruct* pTemp = ExtractCode (offset, pLineData, pLineState, ELine); if (pTemp == NULL) return DecodeLineCleanUp (pInputQueue); TRACE_INPUT(pTemp) pInputQueue->putLast (pTemp); } //##### If line has more than spacing/tabs then code else if (TestLineHasCode (pLineState) != False && strcmp(pLineData, "\\") != 0) { // implement blank space InputStruct* pTemp = ExtractCode (offset, pLineData, pLineState); if (pTemp == NULL) return DecodeLineCleanUp (pInputQueue); TRACE_INPUT(pTemp) pInputQueue->putLast (pTemp); } } return 0; // no worries } // If the comment (fragment) doesn't begin a comment, we may be continuing // a multi-line comment. Adjust its indention to line up with the beginning // to avoid a hanging-indent appearance. static void dontHangComment(InputStruct *pIn, OutputStruct *pOut, QueueList* pLines) { if (pIn -> dataType == CCom && strncmp(pOut -> pComment, ccom_begin, 2) != 0) { const char *text = SkipBlanks(pOut -> pComment); int count = pLines -> status(); int length = text - pOut -> pComment; // If the comment text begins with an '*', increase the indention by // one unless it follows a comment-line that didn't begin with '*'. if (count > 0) { bool star = (*text == '*'); while (count > 0) { OutputStruct *pTemp = reinterpret_cast(pLines -> peek(count--)); if (pTemp == 0 || pTemp -> pComment == 0) continue; text = SkipBlanks(pTemp -> pComment); if (!strncmp(text, ccom_begin, 2)) { if (!star) { if (length > pTemp -> offset) length = pTemp -> offset; } break; } if (*text != '*') star = False; } ShiftLeft(pOut -> pComment, length); if (star) pOut -> indentSpace += 1; } } } // if nothing in queue, or next item isn't code then some sort of error static bool inputIsCode(InputStruct *pItem) { if (pItem != NULL) { switch (pItem -> dataType) { case Code: case OBrace: case CBrace: case PreP: return True; case CCom: case CppCom: case ELine: case NoType: break; } } warning ("\n#### ERROR ! Error In Line Construction !"); warning ("\nExpected Some Sort Of Code ! Data Type Found = "); if (pItem == NULL) warning ("NULL"); else warning ("%d", pItem -> dataType); return False; // ##### incorrect dataType expected! } // ---------------------------------------------------------------------------- // Determine the type of preprocessor-control: // 0 = unknown (leave it alone!) // 1 = if-nesting // 2 = if-unnesting // 3 = nest/unnest // 4 = other static int typeOfPreP(InputStruct *pItem) { static const struct { const char *keyword; int code; } table[] = { { "define", 4 }, { "elif", 3 }, { "else", 3 }, { "endif", 2 }, { "error", 4 }, { "if", 1 }, { "ifdef", 1 }, { "ifndef", 1 }, { "include", 4 }, { "line", 4 }, { "pragma", 4 }, { "undef", 4 } }; const char *s = pItem -> pData; // FIXME: we should be using the "state", just in case there's quotes if (*s == POUNDC) { s = SkipBlanks(s+1); for (size_t i = 0; i < TABLESIZE(table); i++) { if (CompareKeyword(s, table[i].keyword)) return table[i].code; } } return 0; } // Returns the combination of brace-indent and preprocessor-indent static int combinedIndent(int indentStack, int prepStack, Config userS) { if (prepStack > userS.tabSpaceSize) return indentStack + prepStack - userS.tabSpaceSize; return indentStack; } // ---------------------------------------------------------------------------- // Analyze an OutputStruct to see if it began as a continued quoted-string. bool ContinuedQuote(OutputStruct *pOut) { if (pOut -> pCode != 0 && pOut -> pCFlag != 0) { if (pOut -> pCFlag[0] == SQuoted || pOut -> pCFlag[0] == DQuoted) { return (pOut -> pCFlag[0] != pOut -> pCode[0]); } } return False; } // ---------------------------------------------------------------------------- // Check if the given fragment ends a statement (i.e., there's a semicolon that // isn't quoted, and not within parentheses static bool EndsStatement(OutputStruct *pOut) { int nested = 0; for (int n = 0; pOut -> pCode[n] != NULLC; n++) { if (pOut -> pCFlag[n] == Normal) { if (pOut -> pCode[n] == L_PAREN) nested++; else if (pOut -> pCode[n] == R_PAREN) nested--; else if (nested == 0 && pOut -> pCode[n] == SEMICOLON) return True; } } return False; } // ---------------------------------------------------------------------------- // Check for an "else" or "else if" that doesn't finish the statement on the // given fragment. static bool BeginsElseClause(OutputStruct *pOut) { if (CompareKeyword(pOut -> pCode, "else")) { return !EndsStatement(pOut); } return False; } // ---------------------------------------------------------------------------- // Compute next curly-brace level after the given line static void computeBraces(OutputStruct *pOut, int& level) { TRACE_OUTPUT(pOut); if (pOut->pCode != 0 && pOut->pCFlag != 0) { for (int n = 0; pOut->pCFlag[n] != NullC; ++n) { if (pOut->pCFlag[n] == Normal) { if (pOut->pCode[n] == L_CURL) ++level; else if (pOut->pCode[n] == R_CURL) --level; } } } else if (pOut->pBrace != 0 && pOut->pBFlag != 0) { for (int n = 0; pOut->pBFlag[n] != NullC; ++n) { if (pOut->pBFlag[n] == Normal) { if (pOut->pBrace[n] == L_CURL) ++level; else if (pOut->pBrace[n] == R_CURL) --level; } } } // this could happen in a syntax-bending macro if (level < 0) level = 0; } // Check if the given output line was a preprocessor line that ended with // a backslash. static bool outputWasContinuedPreP (OutputStruct * pOut) { if (pOut != 0 && pOut -> pType == PreP && isContinuation(pOut)) { return true; } return false; } // ---------------------------------------------------------------------------- // Function takes a QueueList object that contains InputStructure items, and // uses these items to reconstruct a compressed version of a output line of // code, comment, or both. // // Parameters: // indentStack : Variable used to show how many spaces/tabs to indent when // creating a new OutputStructure. // pInputQueue : Pointer to the InputStructure queue object. // pOutputQueue: Pointer to the OutputStructure queue object. // userS : Structure that contains the users config settings. // // Return Values: // int : Return values of ... // 0 = No problems // -1 = Memory allocation failure // -2 = Line construction error, unexpected type found. static int ConstructLine ( bool &indentPreP, int &prepStack, // level of preprocessor-stack int& bracesLevel, // curly-brace level for normal line int& preproLevel, // curly-brace level for preprocesor line int& indentStack, bool& pendingElse, HangStruct& hang_state, SqlStruct& sql_state, QueueList* pInputQueue, QueueList* pOutputQueue, const Config& userS) { InputStruct* pTestType = NULL; char *pendingComment = NULL; TRACE(("ConstructLine indentStack=%d\n", indentStack)); while ( pInputQueue->status() > 0 ) { int tokenIndent = indentStack; pTestType = reinterpret_cast(pInputQueue -> takeNext()); OutputStruct* pOut = new OutputStruct(pTestType); if (pOut == NULL) return -1; // Special logic to make controls for MCCONFIG look "correct" if (pTestType -> dataType == CppCom) { const char *tst = SkipBlanks(pTestType -> pData + 2); static const char *keys[] = { "MCCONFIG{{", "MCCONFIG}}" }; if (CompareKeyword(tst, keys[0])) indentPreP = True; if (CompareKeyword(tst, keys[1])) indentPreP = False; } int theType = pTestType -> dataType; for (int p = pOutputQueue -> status(); p > 0; --p) { OutputStruct *pq = reinterpret_cast(pOutputQueue -> peek(p)); if (pq != 0 && pq -> pCFlag != 0) { if (outputWasContinuedPreP (pq)) { theType = PreP; } break; } } switch (theType) { //@@@@@@@ Processing of C type comments /* comment */ case (CCom): //@@@@@@@ Processing of C++ type comments // comment case (CppCom): { if (pTestType -> comWcode == True) //##### If true then comment has code { InputStruct *pNextItem = reinterpret_cast(pInputQueue -> peek(1)); if (pNextItem == 0) { // comment after nothing? pOut -> pComment = pTestType -> pData; dontHangComment(pTestType, pOut, pOutputQueue); break; } if (!inputIsCode(pNextItem)) return -2; // ##### incorrect dataType expected! // if pData length overwrites comments then place comments on new line if ( (indentStack + static_cast(strlen (pNextItem -> pData))) > (userS.posOfCommentsWC) ) { /* * Check if this is a comment or fragment which we will * delay after the code on the current line. If so, * indent it to align with code. */ if ((pTestType->dataType == CCom && !strncmp(pTestType->pData, ccom_begin, 2)) || (pTestType->dataType == CppCom)) { pOut -> filler = userS.posOfCommentsWC; } else { pOut -> filler = indentStack + 1; } pOut -> pComment = pTestType -> pData; TRACE(("@%d, Split Comment = %s:%d\n", __LINE__, pOut->pComment, pOut->thisToken)); } else { pendingComment = pTestType -> pData; TRACE(("@%d, Pending Comment = %s:%d\n", __LINE__, pendingComment, pOut->thisToken)); delete[] pTestType -> pState; delete pTestType; delete pOut; continue; } } else { // JZAS Start if (userS.leaveCommentsNC != False) { pOut -> indentSpace = combinedIndent(indentStack, prepStack, userS); if ((pOut -> offset >= userS.posOfCommentsWC) && (pOut -> indentSpace < userS.posOfCommentsWC)) { pOut -> indentSpace = 0; pOut -> filler = userS.posOfCommentsWC; } } else pOut -> indentSpace = userS.posOfCommentsNC; // JZAS End pOut -> pComment = pTestType -> pData; dontHangComment(pTestType, pOut, pOutputQueue); TRACE(("@%d, Set Comment = %s:%d indent %d\n", __LINE__, pOut->pComment, pOut->thisToken, pOut->indentSpace)); }// else a comment without code ! break; }// case // @@@@@@ Processing of code (i.e k = 1; enum show {one, two};) case (Code): { pOut -> pCode = pTestType -> pData; pOut -> pCFlag = pTestType -> pState; if (!ContinuedQuote(pOut)) { pOut -> indentSpace = combinedIndent(indentStack, prepStack, userS); // Special case: align "else" and "if" if they're on successive lines if (pendingElse && CompareKeyword(pOut -> pCode, "if")) pOut -> splitElseIf = True; pendingElse = BeginsElseClause(pOut); } TRACE(("@%d, Set Code = %s:%d indent %d\n", __LINE__, pOut->pCode, pOut->thisToken, pOut->indentSpace)); break; } // @@@@@@ Processing of open brackets "{ k = 1;" case (OBrace): // @@@@@@ Processing of closed brackets "} k = 1;" case (CBrace): { pendingElse = False; // indent back before adding brace, some error checking if ((pTestType -> dataType == CBrace) && !userS.braceIndent) { indentStack -= userS.tabSpaceSize; if (indentStack < 0) indentStack = 0; tokenIndent = indentStack; } pOut -> indentSpace = combinedIndent(indentStack, prepStack, userS); pOut -> pBrace = pTestType -> pData; pOut -> pBFlag = pTestType -> pState; TRACE(("@%d, Set pBrace = %s:%d indent %d\n", __LINE__, pOut->pBrace, pOut->thisToken, pOut->indentSpace)); // ##### advance to the right ! if (pTestType -> dataType == OBrace) indentStack += userS.tabSpaceSize; // indent back before adding brace, some error checking if ((pTestType -> dataType == CBrace) && userS.braceIndent) { indentStack -= userS.tabSpaceSize; if (indentStack < 0) indentStack = 0; tokenIndent = indentStack; } break; } // @@@@@@ Blank Line spacing case (ELine): { delete[] pTestType -> pData; break; } // @@@@@@ Preprocessor Line ! case (PreP): { pOut -> pType = PreP; pOut -> pCode = pTestType -> pData; pOut -> pCFlag = pTestType -> pState; if (userS.indentPreP) { int resetPreproLevel = 0; switch (typeOfPreP(pTestType)) { case 0: pOut -> indentSpace = indentStack + prepStack; resetPreproLevel = preproLevel; break; case 1: pOut -> indentSpace = indentStack + prepStack; if (indentPreP != False) prepStack += userS.tabSpaceSize; break; case 2: if (indentPreP != False) { prepStack -= userS.tabSpaceSize; if (prepStack < 0) prepStack = 0; } pOut -> indentSpace = indentStack + prepStack; break; case 3: pOut -> indentSpace = indentStack + prepStack; if (prepStack >= userS.tabSpaceSize) pOut -> indentSpace -= userS.tabSpaceSize; break; case 4: pOut -> indentSpace = indentStack + prepStack; break; } // If this was a "#" line and not a continuation, reset // the curly-brace level seen for indenting. preproLevel = resetPreproLevel; } else pOut -> indentSpace = 0; break; } } // switch if (pOut -> pCode == 0 && pOut -> pBrace == 0) { delete[] pTestType -> pState; } else if (pendingComment != NULL) { TRACE(("@%d, Use Pending Comment = %s:%d\n", __LINE__, pendingComment, pOut->thisToken)); pOut -> pComment = pendingComment; pOut -> filler = (userS.posOfCommentsWC - (tokenIndent + strlen (pTestType -> pData))); pendingComment = NULL; } hang_state.IndentHanging(pOut); if (userS.indent_sql) sql_state.IndentSQL(pOut); // set the braces level from a previous call to this function pOut->bracesLevel = bracesLevel; pOut->preproLevel = preproLevel; // compute the braces-level for the next line if (isPreproLine(pOut)) { computeBraces(pOut, preproLevel); if (beginMultiLine(pOut)) preproLevel += 1; } else { computeBraces(pOut, bracesLevel); preproLevel = 0; } pOutputQueue -> putLast (pOut); delete pTestType; // ##### Remove structure from memory, not its data // ##### (i.e., char* pData), this is stored // ##### in the output queue. if (indentStack < 0) indentStack = 0; } // while there are items to construct ! return 0; } #if 0 // purge an Indent-stack static void freeIndentStack(StackList* pImode) { while ((pImode -> pop()) != 0) TRACE(("freeing...\n")); } // copy one Indent-stack to another. The 'dst' stack is empty. // FIXME: this just copies pointers -- must revise to copy data static void copyIndentStack(StackList* src, StackList* dst) { int n = 1; ANYOBJECT* temp; while ((temp = src -> peek(n++)) != 0) { //TRACE(("copying %d...\n", ((IndentStruct *)temp) -> pos)); TRACE(("copying %d...\n", n-1)); dst -> push(temp); } } #endif // no extra indent immediately after any brace static void resetSingleIndent(StackList* pIMode) { int n = 1; IndentStruct* pIndentItem; while ((pIndentItem = reinterpret_cast(pIMode -> peek(n++))) != 0) { TRACE(("...reset single-indent (%d)\n", pIndentItem->singleIndentLen)); pIndentItem->singleIndentLen = 0; pIndentItem->attrib = noIndent; } } // returns index to the next OutputStruct iff it's an open brace (skipping // comments), or zero. static int peekIndexOBrace(QueueList* pLines, int first) { OutputStruct* pTemp; while ((pTemp = reinterpret_cast(pLines -> peek (first))) != 0) { if (pTemp -> pCode != 0) break; if ((pTemp -> pBrace != 0) && *(pTemp -> pBrace) == L_CURL) return first; first++; } return 0; } // Check for a chain of single-indents static bool chainedSingleIndent(StackList* pIMode) { int count; for (count = 1; count <= 2; count++) { IndentStruct* pIndentItem = reinterpret_cast(pIMode -> peek(count)); if (pIndentItem == 0 || pIndentItem -> attrib != oneLine || pIndentItem -> singleIndentLen == 0) return False; } return True; } // If we've had a chain of single indents before a L_CURL, we have to shift // the block to match the indent of the last indented code, because the // preceding logic was indenting solely on the basis of curly braces. static void shiftToMatchSingleIndent(QueueList* pLines, int indention, int first) { int baseIn = (reinterpret_cast(pLines -> peek (first))) -> indentSpace; int adjust = indention - baseIn; int state = 0; if (adjust > 0) { TRACE(("shiftToMatchSingleIndent, base %d adj %d\n", baseIn, adjust)); for (int i = first; i <= pLines -> status() ; i++) { OutputStruct* pAlterLine = reinterpret_cast(pLines -> peek (i)); if (pAlterLine == 0) break; // If there's an "else" immediately after the block-else, shift // it also. if (state == 1) { if (pAlterLine -> pCode == 0 || !BeginsElseClause(pAlterLine)) break; state = 2; } else if (pAlterLine -> pCode != 0) { if (pAlterLine -> pType == PreP) continue; } else if (pAlterLine -> pBrace == 0) { continue; } if (pAlterLine -> indentSpace < baseIn) break; TRACE(("...shift %2d %2d :%s\n", pAlterLine -> indentSpace, pAlterLine -> indentSpace + adjust, pAlterLine -> pCode ? pAlterLine -> pCode : pAlterLine -> pBrace)); pAlterLine -> indentSpace += adjust; if (pAlterLine -> indentSpace <= baseIn + adjust && pAlterLine -> pBrace != 0 && pAlterLine -> pBrace[0] == R_CURL) { if (state == 0) state = 1; else break; } } } } // check if an output-struct contains code, so we can distinguish it from // blank lines or comments static inline bool OutputContainsCode(OutputStruct *pOut) { return (pOut -> pCode != NULL || pOut -> pBrace != NULL); } // ---------------------------------------------------------------------------- // Function is used to indent single indented code such is found in if, while, // else statements. Also handles case like statements within switches'. // // Parameters: // pLines : Pointer to the output queue. // pIMode : Pointer to indent type stack. // userS : User configuration (i.e indent spacing, position of comments) // // Return Values: // QueueList* : Pointer to the output queue (may have been reconstructed), // returns NULL if failed to allocate memory // static QueueList* IndentNonBraceCode (QueueList* pLines, StackList* pIMode, const Config& userS, bool top) { // if there are items to check ! if ((pLines != NULL) && (pLines -> status () <= 0)) return pLines; // If there are indent items to process ! if (pIMode -> status() <= 0) return pLines; OutputStruct* pAlterLine = reinterpret_cast(pLines -> peek (1)); if (pAlterLine -> pType == PreP) return pLines; IndentStruct* pIndentItem = reinterpret_cast(pIMode -> pop()); if ( ((pAlterLine -> pCode != NULL) || ((pAlterLine -> pBrace != NULL) && (pIndentItem -> attrib == multiLine)) ) || ((userS.leaveCommentsNC != False) && ((pAlterLine -> pCode == NULL) && (pAlterLine -> pComment != NULL))) ) { bool adjusted = False; TRACE_OUTPUT(pAlterLine); switch (pIndentItem -> attrib) { case (blockLine): case (noIndent): break; // single indent case (oneLine): { int indentAmount; // Test for continued statements, suppressing indent until // it's complete. if (ContinuedQuote(pAlterLine)) indentAmount = 0; else if (pAlterLine -> indentHangs != 0) indentAmount = 0; else indentAmount = userS.tabSpaceSize; // Single line indentation calculation pAlterLine -> indentSpace += indentAmount; TRACE(("@%d, total indent %d (%d)\n", __LINE__, pAlterLine->indentSpace, indentAmount)); break; } // indent of a case statement ! case (multiLine): { // determine how many case-like items are stored within // list to determine how much to indent ! int pTest; pAlterLine -> indentSpace += (userS.tabSpaceSize * (pIMode -> status())); // test if not another case, or default, if so, don't indent ! pTest = LookupKeyword(pAlterLine -> pCode); if (pTest >= 0 && pIndentWords[pTest].code != multiLine) pTest = -1; // check for closing braces to end case indention if ((pTest < 0) && (pAlterLine -> pBrace != NULL)) { if ((*(pAlterLine -> pBrace) == R_CURL) && (pAlterLine -> indentSpace == pIndentItem -> pos)) { delete pIndentItem; pIndentItem = NULL; } } // indent as per normal ! if ((pIndentItem != NULL) && (pTest < 0)) { pIMode -> push (pIndentItem); // ok to indent next item ! if (OutputContainsCode(pAlterLine)) { pAlterLine -> indentSpace += userS.tabSpaceSize; adjusted = True; } else if (pAlterLine -> pComment != NULL) { if (pAlterLine -> filler == 0) pAlterLine -> indentSpace += userS.tabSpaceSize; } TRACE_OUTPUT(pAlterLine) } else if (pIndentItem != NULL) { // if end single indent keyword found, check to see // whether it is the correct one before removing it ! if ((pTest >= 0) && (pIndentItem -> pos+userS.tabSpaceSize < pAlterLine -> indentSpace)) { pIMode -> push (pIndentItem); // ok to indent next item ! if (OutputContainsCode(pAlterLine)) { pAlterLine -> indentSpace += userS.tabSpaceSize; adjusted = True; } TRACE_OUTPUT(pAlterLine) } else { delete pIndentItem; pIndentItem = NULL; } } break; } }// switch // test if code has started to overwrite comments, and // not a case, or default statement ... if so, adjust queue ! if ( ((pAlterLine -> pComment != NULL) && (pIndentItem != NULL)) && ((pAlterLine -> pCode != NULL) || (pAlterLine -> pBrace != NULL)) ) { // alter filler size for comment spacing ! pAlterLine -> filler -= userS.tabSpaceSize; // if less than 0, then code is overwriting comments ! if (pAlterLine -> filler < 0) { // reconstruct queue ! QueueList* pNewQueue = new QueueList(); OutputStruct* pNewItem = new OutputStruct(pAlterLine); pAlterLine = reinterpret_cast(pLines -> takeNext()); if (pNewItem == NULL) { delete pNewQueue; delete pIMode; delete pLines; return NULL;// out of memory } // load new structure pNewItem -> filler = userS.posOfCommentsWC; pNewItem -> pComment = pAlterLine -> pComment; pAlterLine -> filler = 0; // set this to zero as not to create filler // spaces at line output time. if (adjusted) // we'll add this back later pAlterLine -> indentSpace -= userS.tabSpaceSize; pAlterLine -> pComment = NULL; // reconstruct queue ! pNewQueue -> putLast (pNewItem); pNewQueue -> putLast (pAlterLine); // copy existing lines from old queue, into the newly created queue ! while (pLines -> status () > 0) pNewQueue -> putLast ( pLines -> takeNext() ); delete pLines; pLines = pNewQueue; // reassign new queue object } // if overwriting comments }// if comments exist on same line as code // Remove single line indentation from memory, if current line // does contain a if, else, while ... type keyword if (pIndentItem == NULL) ; else if (pIndentItem -> attrib == oneLine) { int block = 0; // recursive function call ! if (pIMode -> status() > 0) pLines = IndentNonBraceCode (pLines, pIMode, userS, False); TRACE(("#%d, brace=%p: %d\n", pAlterLine->thisToken, pAlterLine->pBrace, pIndentItem->attrib)); TRACE(("@%d, push indent %d\n", __LINE__, pIndentItem -> singleIndentLen)); pIMode -> push (pIndentItem); pIndentItem = NULL; if (top && (chainedSingleIndent(pIMode) || beginBlockLine(pLines)) && (block = peekIndexOBrace(pLines, 2)) != 0) { shiftToMatchSingleIndent(pLines, pAlterLine->indentSpace, block); } } //FIXME (leak): delete pIndentItem; } // if code to process else if (pIndentItem != NULL) { TRACE(("#%d, brace=%p: %d\n", pAlterLine->thisToken, pAlterLine->pBrace, pIndentItem->attrib)); // no indentation yet, maybe only blank line, or comment in case pIMode -> push (pIndentItem); // no extra indent immediately after any brace if (pAlterLine->pBrace != 0) resetSingleIndent(pIMode); } return pLines; } // ---------------------------------------------------------------------------- // Function allocates indent structures used to indent code that don't lie // within braces, but should still be indented. // // Parameters: // pIMode : Pointer to a indent stack. Contains indent structures used to // indent code without braces // pLines : Pointer to output queue, stores semi-finished output code. // userS : User settings. // // Return Values: // QueueList* : Pointer to the output queue (may have been reconstructed), // returns NULL if failed to allocate memory // static QueueList* IndentNonBraces (StackList* pIMode, QueueList* pLines, const Config& userS) { const int minLimit = 2; // used in searching output queue // for open braces // indent Items contained ! if (pIMode -> status () > 0) { char* pBraceOnNewLn = (reinterpret_cast(pLines -> peek (1))) -> pBrace; char* pBraceOnCurLn = (reinterpret_cast(pLines -> peek (1))) -> pCode; IndentStruct* pTestBrace = reinterpret_cast(pIMode -> pop()); if ( (pBraceOnNewLn != NULL) && ((pBraceOnNewLn[0] == L_CURL) && (pTestBrace -> attrib == oneLine)) ) { delete pTestBrace; } else if (lastChar(pBraceOnCurLn) == L_CURL && (pTestBrace -> attrib == oneLine)) { delete pTestBrace; } else pIMode -> push (pTestBrace); } //#### Indent code if code available, in a case statement if (pIMode -> status () > 0) pLines = IndentNonBraceCode (pLines, pIMode, userS, True); if (pLines -> status () < minLimit) return pLines; OutputStruct *pOut = reinterpret_cast(pLines -> peek (1)); // Cancel the indent applied by "else" to "if", and abandon the indent // that would be computed in this function for the code under "if". if (pOut -> splitElseIf) { pOut -> indentSpace -= userS.tabSpaceSize; return pLines; } // determine if current line has a single line keyword ! (if, else, while, for, do) const char* pTestCode = pOut -> pCode; if (pTestCode != NULL) { int findWord = LookupKeyword(pTestCode); // if keyword found, check if next line not a brace or, comment ! // Test if code not NULL, and No Hidden Open Braces // FIXME: punctuation need not be at end of line if (findWord >= 0) { if (pIndentWords[findWord].code == multiLine) { const char *pTmp = SkipBlanks(pTestCode + strlen(pIndentWords[findWord].name)); if (*pTmp != '\0' && *pTmp != ':' && lastChar(pTestCode) != ':') findWord = -1; } switch (lastChar(pTestCode)) { case L_CURL: case SEMICOLON: case R_CURL: findWord = -1; break; default: break; } } // Test if open brace not located on next line if (findWord >= 0) { pTestCode = (reinterpret_cast(pLines -> peek (minLimit))) -> pBrace; if ((pTestCode != NULL) && (pTestCode[0] == L_CURL)) findWord = -1; // Don't process line as a single indentation ! } if (findWord >= 0) // create new structure ! { IndentStruct* pIndent = new IndentStruct(); // #### memory allocation error if (pIndent == NULL) { delete pLines; delete pIMode; return NULL; } // do indent mode for (if, while, for, else) if (pIndentWords[findWord].code == oneLine) { pIndent -> attrib = oneLine; // single indent ! // determine how much to indent the next line of code ! pIndent -> singleIndentLen = userS.tabSpaceSize; TRACE(("#%d: set single-indent to %d\n", (reinterpret_cast(pLines->peek(1)))->thisToken, pIndent->singleIndentLen)); } else // it's a case or other block-statement ! { pIndent -> attrib = pIndentWords[findWord].code; pIndent -> pos = ((reinterpret_cast(pLines -> peek (1))) -> indentSpace) - userS.tabSpaceSize; TRACE(("#%d: set multi-indent %d, pos = %d\n", (reinterpret_cast(pLines->peek(1)))->thisToken, pIndent->attrib, pIndent->pos)); } // place item on stack ! pIMode -> push (pIndent); } else { // update pIMode indent queue, throw out single indents if // not needed (i.e multi line single if conditions) IndentStruct* pThrowOut = NULL; // Test code for single indentation, if semi-colon exits // within code, remove item from indent stack! pTestCode = (reinterpret_cast(pLines -> peek (1))) -> pCode ; while (pIMode -> status () > 0) { pThrowOut = reinterpret_cast(pIMode -> pop()); if (pThrowOut -> attrib == multiLine) { pIMode -> push (pThrowOut); break; } // Test single code indents for a semicolon ! else if (lastChar(pTestCode) == SEMICOLON) delete pThrowOut; // throw out the single indent item else { pIMode -> push (pThrowOut); // Place item back on stack! break; // Leave loop! } } } } return pLines; } // ---------------------------------------------------------------------------- // Check for a keyword which can precede a left curly-brace. static bool KeyBeforeBrace (const char *word, int length) { switch (length) { case 2: return (strncmp(word, "do", length)) ? False : True; case 4: return (strncmp(word, "else", length) && strncmp(word, "enum", length)) ? False : True; case 5: return (strncmp(word, "while", length)) ? False : True; } return False; } // ---------------------------------------------------------------------------- // Function reformats open braces to be on the same lines as the // code that it's assigned (if possible). // // Parameters: // pLines : Pointer to a OutputStructure queue object // userS : Users configuration settings. // // Return Values: // QueueList* : Returns a pointer to a newly constructed OutputStructure // queue, or the value of pLines if no work is needed. // The input pLines is freed unless it is the return-value. // static QueueList* ReformatBraces (QueueList* pLines, int first, const Config& userS) { int queueNum = pLines -> status (); // get queue number int findBrace; // position in queue where first brace line is located int findCode ; // position in queue where next code line is located OutputStruct* pBraceLine = NULL; OutputStruct* pCodeLine = NULL; TRACE(("ReformatBraces(%d:%d)\n", first, queueNum)); // Can't process less than two items (i.e. move brace from one line to next line to make one line ) if (queueNum < 2 || first > queueNum) { return pLines; } // search forward through queue to find the first appearance of a brace ! findBrace = first; while (findBrace <= queueNum) { pBraceLine = reinterpret_cast(pLines -> peek (findBrace)); if ((pBraceLine -> pBrace != NULL) && (pBraceLine -> pBrace[0] == L_CURL)) break; // leave queue search ! else findBrace++; } if (findBrace > queueNum) // open brace not found in queue ! { return pLines; } // find out if there is a place to place the brace in the code that // is currently stored ! for (findCode = findBrace-1; findCode >= first; findCode--) { if ((reinterpret_cast(pLines -> peek (findCode))) -> pCode != NULL) break; // found a code Line } if (findCode >= first) // o.k found a line that has code ! { OutputStruct* pNewItem = NULL; char* pNewMem = NULL; // we're here to join braces, but must check if this instance must // remain split: bool splitBraces = False; if (pBraceLine->bracesLevel == 0 && userS.topBraceLoc != False) { splitBraces = True; } else { int lastword = -1; int wordsize = 0; char lastchar = NullC; pCodeLine = reinterpret_cast(pLines -> peek(findCode)); if (pCodeLine->pCode != 0 && pCodeLine->pCFlag != 0) { for (int n = 0; pCodeLine->pCode[n] != NullC; ++n) { if (pCodeLine->pCFlag[n] == PreProc) { lastchar = NullC; lastword = -1; break; } else if (pCodeLine->pCFlag[n] == Normal) { lastchar = pCodeLine->pCode[n]; if (n > 0 && !isName(pCodeLine->pCode[n-1])) { lastword = -1; wordsize = 0; } if (!isName(pCodeLine->pCode[n])) { lastword = -1; wordsize = 0; } else if (lastword < 0 && isName(pCodeLine->pCode[n])) { lastword = n; wordsize = 0; } if (lastword >= 0) ++wordsize; } else if (pCodeLine->pCFlag[n] == DQuoted || pCodeLine->pCFlag[n] == SQuoted) { lastchar = NullC; lastword = -1; wordsize = 0; } } // we can join a left-curly after a right-paren, equals, or "else" if (lastchar != R_PAREN && lastchar != '=' && (lastword < 0 || KeyBeforeBrace(pCodeLine->pCode + lastword, wordsize) == False)) splitBraces = True; } } // place top-level open braces on same line as code if (splitBraces || userS.braceLoc == True) { TRACE(("...leave brace, restart\n")); return ReformatBraces (pLines, findBrace + 1, userS); } QueueList* pNewLines = new QueueList(); if (pNewLines == NULL) { return NULL; // out of memory } // load newQueue with lines up to code line found ! for (int loadNew = 1; loadNew < findCode; loadNew++) pNewLines -> putLast (pLines -> takeNext()); // take code line that is going to be altered ! pCodeLine = reinterpret_cast(pLines -> takeNext ()); // if code has comments, then it's placed on a new line ! if (pCodeLine -> pComment != NULL) { // len of indent + code + space + brace int overWrite = pCodeLine -> indentSpace + strlen (pCodeLine -> pCode) + 1 + strlen (pBraceLine -> pBrace); if (overWrite >= userS.posOfCommentsWC) // if true then place comment on new line ! { pNewItem = new OutputStruct(pCodeLine); if (pNewItem == NULL) return NULL; pNewItem -> filler = userS.posOfCommentsWC; pNewItem -> pComment = pCodeLine -> pComment; pCodeLine -> pComment = NULL;// make this NULL as not to be delete when // object destructor is called. pNewLines -> putLast (pNewItem); } } // place brace code onto new output structure ! pNewItem = new OutputStruct(pCodeLine); // code + space + brace + nullc pNewMem = new char [strlen (pCodeLine -> pCode) + strlen (pBraceLine -> pBrace) + 1 + 1]; if ((pNewItem == NULL) || (pNewMem == NULL)) { delete pCodeLine; delete pBraceLine; delete pLines; delete pNewLines; return NULL; // out of memory } // concatenate code + space + brace // ### CHECK IT pNewMem = strcpy (pNewMem, pCodeLine -> pCode); // copy code strcpy (endOf(pNewMem), " "); // copy space strcpy (endOf(pNewMem), pBraceLine -> pBrace); // copy brace // place attributes into queue pNewItem -> indentSpace = pCodeLine -> indentSpace; pNewItem -> pCode = pNewMem; // Add comments to new code line if they exist if (pCodeLine -> pComment != NULL) { pNewItem -> pComment = pCodeLine -> pComment; pCodeLine -> pComment = NULL;// make this NULL as not to be delete when // object destructor is called. // calculate filler spacing! pNewItem -> filler = userS.posOfCommentsWC - (pCodeLine -> indentSpace + strlen (pNewItem -> pCode)); } // store newly constructed output structure pNewLines -> putLast (pNewItem); int start = pNewLines->status(); // process brace Line !, create new output structure for brace comment if (pBraceLine -> pComment != NULL) { pNewItem = new OutputStruct(pBraceLine); if (pNewItem == NULL) { delete pCodeLine; delete pBraceLine; delete pLines; delete pNewLines; return NULL;// out of memory } // load comment pNewItem -> pComment = pBraceLine -> pComment; pBraceLine -> pComment = NULL; // positioning comment, use filler - not indentSpace - as this // will become screw when using tabs ... fillers use spaces! pNewItem -> filler = userS.posOfCommentsWC; pNewLines -> putLast (pNewItem); } delete pCodeLine; // copy existing lines from old queue, into the newly created queue ! // copy all objects from pLines up to pBraceLine pCodeLine = reinterpret_cast(pLines -> takeNext()); // read ahead rule while (pCodeLine != pBraceLine) { pNewLines -> putLast (pCodeLine); pCodeLine = reinterpret_cast(pLines -> takeNext()); } delete pCodeLine; // remove brace lines (in disguise) // code what's left in pLines queue to pNewLines ! while ((pLines -> status ()) > 0 ) { pNewLines -> putLast (pLines -> takeNext ()); } // remove old queue object from memory, return newly constructed one delete pLines; // Test if there are any more open brace lines in pNewLine queue. // Do a recursive call to check. pLines = ReformatBraces (pNewLines, start, userS); } return pLines; } // ---------------------------------------------------------------------------- // Function reformats the spacing between functions, structures, unions, classes. // // Parameters: // pOutFile : Pointer to the output FILE structure. // pLines : Pointer to the OutputStructure queue object. // userS : Users configuration settings. // FuncVar : Defines what type of mode the function is operating in. // inBraces : Set to true if we're within curly-braces. // pendingBlank : is used to control consecutive blank lines // // Return Values: // QueueList* : Pointer to the OutputStructure (sometimes altered) // FuncVar : Defines what mode function is currently in // 0 = don't delete blank lines // 1 = output blank lines // 2 = delete blank OutputStructures in queue until code is reached. // static void FunctionSpacing (QueueList* pLines, const Config& userS, int& FuncVar, int &pendingBlank, bool& inBraces ) { inBraces = False; if (pLines -> status () > 0) // if there are items in the queue ! { OutputStruct* pTestLine = reinterpret_cast(pLines -> peek (1)); inBraces = (pTestLine -> indentSpace > 0) ? True : False; // check if end of function, structure, class has been reached ! if ( ((FuncVar == 0) && (inBraces == False)) && (pTestLine -> pBrace != NULL) ) { if (pTestLine -> pBrace[0] == R_CURL && pTestLine -> pBrace[1] == NULLC) { FuncVar = 1; // add function spacing ! return; } } if (FuncVar == 1) { // go into blank line output mode between functions! pendingBlank = userS.numOfLineFunc; FuncVar = 2; } if ( (FuncVar == 2) && (((pTestLine -> pCode != NULL ) || (pTestLine -> pBrace != NULL)) || (pTestLine -> pComment != NULL)) ) FuncVar = 0; else if (FuncVar == 2) { OutputStruct* dump = reinterpret_cast(pLines -> takeNext()); // dump line from queue! delete dump; } } } // ---------------------------------------------------------------------------- // Putting an inter-function space before "#endif" looks ugly. This is used // to test for that condition. static bool PreProcessorEndif(OutputStruct *pOut) { if (pOut -> pType == PreP) { return CompareKeyword(SkipBlanks(pOut -> pCode + 1), "endif"); } return False; } // ---------------------------------------------------------------------------- // Check if the first statement on the input-queue begins a preprocessor // command, is a continuation of one, or is neither. static int beginningPrePro (QueueList *pInputQueue, int Current) { int n; int result = 0; InputStruct *pNextItem; if ((n = pInputQueue -> status()) != 0) { pNextItem = reinterpret_cast(pInputQueue -> peek(n)); switch (pNextItem -> dataType) { case PreP: result = isContinuation(pNextItem) ? 1 : 0; break; case Code: case CBrace: case OBrace: result = Current ? (isContinuation(pNextItem) ? Current+1 : 0) : 0; break; default: result = 0; break; } if (Current && !result) { TRACE(("FIXME:PEEK(%d)%s\n", Current, isContinuation(pNextItem) ? " CONT" : "")); TRACE_INPUT(pNextItem) } } return result; } // We may convert leading whitespace in a comment back to tabs static Boolean adjustLeadingSpaces(int fillMode, char *¬es, int &leading) { if ((fillMode & 1) != 0 && notes != NULL && *notes == SPACE) { while (*notes == SPACE) { notes++; leading++; } return True; } return False; } // ---------------------------------------------------------------------------- // Function is used to expand OutputStructures contained within a queue to the // user's output file. Function also reformats braces, function spacing, // braces indenting. // // Parameters: // pOutFile : Pointer to the users output FILE structure/handle // pLines : Pointer to the OutputStructures queue object // FuncVar : See FunctionSpacing() // userS : Users configuration settings. // stopLimit : Defines how many OutputStructures remain within the Queue not // processed. // pendingBlank : is used to control consecutive blank lines // // Return Values: // FuncVar : See FunctionSpacing() // QueueList*: Pointer to the Output queue object (sometimes modified!) // // returns NULL if memory allocation failed // static QueueList* OutputToOutFile (FILE* pOutFile, QueueList* pLines, StackList* pIMode, int& FuncVar, const Config& userS, int stopLimit, int &pendingBlank) { OutputStruct* pOut = NULL; char* pIndentation = NULL; char* pFiller = NULL; int fillMode = 2; // we can always use spaces bool inBraces; // determine fill mode if (userS.useTabs == True) fillMode |= 1; // set bit 0, tabs while (pLines -> status() > stopLimit) // stopLimit is used to search backward for L_CURL { // process function spacing !!!!! int testProcessing = pLines -> status(); FunctionSpacing (pLines, userS, FuncVar, pendingBlank, inBraces ); if (pLines -> status () < testProcessing) // line removed, test next line in buffer continue; // check indentation on case statements etc pLines = IndentNonBraces (pIMode, pLines, userS); if (pLines == NULL) return NULL; //#### Memory Allocation Failure // reformat open braces if user option set ! if (userS.topBraceLoc == False // place open braces on same line as code || userS.braceLoc == False) // place open braces on same line as code { pLines = ReformatBraces (pLines, 1, userS); if (pLines == NULL) return NULL; } pOut = reinterpret_cast(pLines -> takeNext()); TRACE_OUTPUT(pOut); // expand pOut structure to print to the output file if (!emptyString(pOut -> pCode) || !emptyString(pOut -> pBrace) || !emptyString(pOut -> pComment)) { int mark; int in_code = ((pOut -> pCode != 0) ? strlen(pOut -> pCode) : 0) + ((pOut -> pBrace != 0) ? strlen(pOut -> pBrace) : 0); int leading = pOut -> indentSpace + (pOut -> indentHangs * userS.tabSpaceSize); // FIXME: indentHangs should use separate param char *notes = pOut -> pComment; if (emptyString(notes)) notes = NULL; // Check for a trailing C-comment fragment. That must go before // any code! if (notes != NULL && (!emptyString(pOut -> pCode) || !emptyString(pOut -> pBrace)) && strncmp(notes, ccom_begin, 2) && strncmp(notes, cppc_begin, 2)) { adjustLeadingSpaces(fillMode, notes, leading); pIndentation = TabSpacing (fillMode, 0, leading, userS.tabSpaceSize); fprintf (pOutFile, "%s", pIndentation); delete[] pIndentation; fprintf (pOutFile, "%s\n", notes); notes = NULL; } // Just in case we only had a comment fragment, check again... if (!emptyString(pOut -> pCode) || !emptyString(pOut -> pBrace) || !emptyString(notes)) { if (!adjustLeadingSpaces(fillMode, notes, leading) && (in_code == 0) && !emptyString(notes)) { if (pOut -> filler > leading) leading = 0; } // compute the end-column of the code before filler, to use in // adjusting tab conversion. mark = leading + in_code; if (notes != 0) if (pOut -> filler > userS.posOfCommentsWC - mark) pOut -> filler = userS.posOfCommentsWC - mark; if (pOut -> filler < 0) pOut -> filler = 0; // 2-9-2 BTM - re-adjust location of braces & any comments that might follow them if ( pOut -> pBrace && userS.braceIndent2) { leading += userS.tabSpaceSize; if ( pOut->filler > userS.tabSpaceSize ) { pOut->filler -= userS.tabSpaceSize; } } if (ContinuedQuote(pOut)) pIndentation = NULL; else { if (isPreproLine(pOut)) { int next = pOut->preproLevel; if (next > 0 && BeginsCurly(pOut)) --next; leading += next * userS.tabSpaceSize; } pIndentation = TabSpacing (fillMode, 0, leading, userS.tabSpaceSize); } pFiller = TabSpacing (fillMode, mark, pOut -> filler, userS.tabSpaceSize); if (pendingBlank != 0) { if (PreProcessorEndif(pOut)) { pendingBlank = 0; FuncVar = 0; } else { while (pendingBlank > 0) { fputc (LF, pOutFile); // output line feed! pendingBlank--; } } } // Output data if (pIndentation != NULL) { fprintf (pOutFile, "%s", pIndentation); delete[] pIndentation; } if (pOut -> pCode != NULL) fprintf (pOutFile, "%s", pOut -> pCode); if (pOut -> pBrace != NULL) fprintf (pOutFile, "%s", pOut -> pBrace); if (pFiller != NULL) { fprintf (pOutFile, "%s", pFiller); delete[] pFiller; } if (notes != NULL) { size_t len = strlen(notes); fprintf (pOutFile, "%s", notes); if (len > 0 && notes[len-1] == ESCAPE) fprintf (pOutFile, " "); } fputc (LF, pOutFile); // output line feed! } } else pendingBlank = 1; // free memory delete pOut; } return pLines; } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Function will backspace the desired characters length according to // numeric size. static void backSpaceIt (unsigned long int num) { unsigned long int size = 1; while (num >= size) { printf ("\b"); size = size * 10; } printf ("\b"); // remove the trail zero, or space ! } // Parameters: // mode : 1 = set new time, 2 = compare current time with now time static unsigned long int GetStartEndTime (int mode) { static time_t newTime; switch (mode) { case (1): newTime = time (NULL); return 0; case (2): return (time (NULL) - newTime); } return 0; } // ---------------------------------------------------------------------------- // Function is used to bundle all of the input, and output line processing // functions together to create a final output file. // // Parameters: // pInFile : Pointer to the user's input FILE structure/handle. // pOutFile : Pointer to the user's output FILE structure/handle. // userS : User's configuration settings. // // Return Values: // int : Returns a value indicating whether there were any problems // in processing the input/output files. // 0 = no worries. // -1 = memory allocation failure, or line construction failure // static int ProcessFile (FILE* pInFile, FILE* pOutFile, const Config& userS) { const char* errorMsg = "\n\n#### ERROR ! Memory Allocation Failed\n"; const unsigned long lineStep = 10; // line number update period (show every 10 lines) unsigned long int lineNo = 0; int EndOfFile = 0; // Var used by readline() to show eof has been reached char* pData = 0; int pendingBlank = 0; // var used to control blank lines int indentStack = 0; // var used for brace spacing int indentStack2 = 0; // save/restore "indentStack" for preprocessor lines QueueList* pOutputQueue = new QueueList(); StackList* pIMode = new StackList(); StackList* pIMode2 = new StackList(); QueueList* pInputQueue = new QueueList(); int FuncVar = 0; // variable used in processing function spacing ! CharState curState = Blank; char* lineState = NULL; Boolean codeOnLine = False; bool indentPreP = False; bool pendingElse = False; int prepStack = 0; int bracesLevel = 0; int preproLevel = 0; int in_prepro = 0; HangStruct hang_state; HtmlStruct html_state; SqlStruct sql_state; size_t beforeSize; bool beforeSlash = False; bool afterSlash; // Check memory allocated ! if (((pOutputQueue == NULL) || (pIMode == NULL)) || (pInputQueue == NULL)) { delete pOutputQueue; delete pInputQueue; delete pIMode; warning ("%s", errorMsg); return -1; } if (userS.output != False) { verbose ("\nFeed Me, Feed Me Code ...\n"); verbose ("Number Of Lines Processed : "); } GetStartEndTime (1); // lets time the operation ! while (! EndOfFile) { if (pData != 0) delete[] pData; pData = ReadLine (pInFile, EndOfFile); if (lineState != 0) { delete[] lineState; lineState = NULL; } if (pData != NULL) { lineNo++; if ( (lineNo % lineStep == 0) && (userS.output != False) ) { if (lineNo > 0) backSpaceIt (lineNo - lineStep); // reposition cursor ! Don't used gotoxy() for Unix compatibility printf ("%lu ", lineNo); } if (html_state.Active(pData)) { if (EndOfFile) break; // flush queue ... pOutputQueue = OutputToOutFile ( pOutFile, pOutputQueue, pIMode, FuncVar, userS, 0, pendingBlank); fprintf(pOutFile, "%s\n", pData); continue; } ExpandTabs (pData, userS.tabSpaceSize, userS.deleteHighChars, userS.quoteChars, curState, lineState, codeOnLine); if (pData == NULL) { warning ("%s", errorMsg); delete pIMode; delete pInputQueue; delete pOutputQueue; return -1; } afterSlash = beforeSlash; beforeSlash = isContinuation(beforeSize, pData, lineState); if (DecodeLine (afterSlash, 0, pData, lineState, pInputQueue) == 0) // if there are input items to process { int old_prepro = in_prepro; bool restoreit = False; if ((in_prepro = beginningPrePro(pInputQueue, in_prepro)) != 0) { if (in_prepro == 1) { TRACE(("FIXME: save indentStack: %d (%d)\n", in_prepro, indentStack)); //copyIndentStack(pIMode, pIMode2); indentStack2 = indentStack; } else if (in_prepro == 2) { TRACE(("FIXME: increase indentStack\n")); indentStack += userS.tabSpaceSize; } } else if (old_prepro) { restoreit = True; if (old_prepro == 1) indentStack += userS.tabSpaceSize; } int errorCode = ConstructLine ( indentPreP, prepStack, bracesLevel, preproLevel, indentStack, pendingElse, hang_state, sql_state, pInputQueue, pOutputQueue, userS); switch (errorCode) { case (0) : break; case (-1) : { warning ("%s", errorMsg); delete pIMode; delete pInputQueue; delete pOutputQueue; return errorCode; } case (-2): // Construct line failed ! { // output final line position warning ("\nLast Line Read %ld", lineNo); delete pIMode; delete pInputQueue; delete pOutputQueue; return errorCode; } default: { warning ("\nSomething Weird %d\n", errorCode); return errorCode; } } pOutputQueue = OutputToOutFile ( pOutFile, pOutputQueue, pIMode, FuncVar, userS, restoreit ? 0 : userS.queueBuffer, pendingBlank ); if (pOutputQueue == NULL) { warning ("%s", errorMsg); delete pIMode; delete pInputQueue; return -1; // memory allocation error ! } if (restoreit) { TRACE(("FIXME: restore indentStack (%d) to %d\n", indentStack, indentStack2)); //copyIndentStack(pIMode2, pIMode); //freeIndentStack(pIMode2); indentStack = indentStack2; } } } // if there's data available }// while data // flush queue ... pOutputQueue = OutputToOutFile ( pOutFile, pOutputQueue, pIMode, FuncVar, userS, 0, pendingBlank); // output final line position if (userS.output != False) { if ((lineNo > 0) && (lineNo > lineStep)) backSpaceIt (lineNo - (lineNo % lineStep)); // reposition cursor printf ("%lu ", lineNo); } delete pIMode2; delete pIMode; delete pOutputQueue; delete pInputQueue; delete[] pData; delete[] lineState; if (userS.output != False) { unsigned long int t = GetStartEndTime (2); int hours = (t / 60) / 60, mins = (t / 60), secs = (t % 60); verbose ("(In %d Hours %d Minutes %d Seconds)", hours, mins, secs); } return 0; } // ---------------------------------------------------------------------------- // locates programs configuration file via the PATH command. // Should work for MS-DOS, and Unix environments. Amiga dos // may fail because PATH is not the name of their path variable. // pCfgName = Name of configuration file // pCfgFile = reference to FILE structure pointer. static void FindConfigFile (const char* pCfgName, FILE*& pCfgFile) { const char* sepCharList = ";,:"; // dos, amigaDos, unix char* pSPath = getenv ("PATH"); char* pEPath = NULL; char* pNameMem = NULL; char sepChar = NULLC; const char* pathSepChar; char backUp; int count = 0; // test to see if file is in current directory first ! if ((pCfgFile = fopen(pCfgName, "r")) != NULL) return; // environment variable not found, lord knows what it is ! if (pSPath == NULL) return; if ((pNameMem = new char[strlen (pSPath) + strlen (pCfgName)+2]) == NULL) return; // best guess in separating parameters ! while (sepCharList[count] != NULLC) { pEPath = endOf(pSPath); while ((*pEPath != sepCharList[count]) && (pEPath > pSPath)) pEPath--; if (*pEPath == sepCharList[count]) { sepChar = sepCharList[count]; break; // leave loop } count++; } pEPath = pSPath; do { while ((*pEPath != sepChar) && (*pEPath != NULLC)) pEPath++; backUp = *pEPath; *pEPath = NULLC; strcpy (pNameMem, pSPath); if (sepChar == SEMICOLON) pathSepChar = "\\"; // dumb dos's backwards path system ! else pathSepChar = "/"; // everyone else uses this method // try to prevent segmentation errors ! if (strlen (pNameMem) > 0) if (lastChar(pNameMem) != pathSepChar[0]) strcpy (endOf(pNameMem), pathSepChar); strcpy (endOf(pNameMem), pCfgName); *pEPath = backUp; if (*pEPath != NULLC) { pEPath++; pSPath = pEPath; } pCfgFile = fopen(pNameMem, "r"); } while ((*pEPath != NULLC) && (pCfgFile == NULL)); delete[] pNameMem; } // ---------------------------------------------------------------------------- // Front-end to the program, it reads in the configuration file, checks if there // were any errors, and starts processing of the files. // // Parameters: // argc : command line parameter count // argv[] : array of pointers to command line parameters // // Return Values: // int : A non zero value indicates processing problem. // static int LoadnRun (int argc, char* argv[]) { const char* pNoFile = "Couldn't Open, or Create File"; bool renamed = False; char* pConfig = NULL; char* pInFile = NULL; char* pOutFile = NULL; FILE* pInputFile = NULL; FILE* pOutputFile = NULL; FILE* pConfigFile = NULL; int errorNum = 0; int errorCode = 0; Config settings = {2, // numOfLineFunc 4, // tabSpaceSize False, // useTabs 50, // posOfCommentsWC 0, // posOfCommentsNC False, // leaveCommentsNC False, // quoteChars 3, // deleteHighChars True, // topBraceLoc True, // braceLoc True, // output 10, // queueBuffer False, // backUp False, // indentPreP False, // indent_sql False, // braceIndent False}; // braceIndent2 /* ************************************************************************************ // set defaults settings.numOfLineFunc = 2; // number of lines between functions settings.tabSpaceSize = 4; // number of spaces a tab takes up settings.useTabs = False;// use tabs to indents rather than spaces settings.posOfCommentsWC = 50; // position of comments on line with code settings.posOfCommentsNC = 0; // position of comments on line settings.leaveCommentsNC = False;// True = don't change the indentation of comments with code. settings.quoteChars = False;// use tabs to indents rather than spaces settings.deleteHighChars = 3; // 0 = no check , 1 = delete high chars, // 3 = delete high chars, but not graphics settings.topBraceLoc = True; // Start top-level open braces on new line settings.braceLoc = True; // Start open braces on new line settings.output = True; // Set this true for normal program output settings.queueBuffer = 10; // Set the number if lines to store in memory at a time ! settings.backUp = False;// backup the original file, have output file become input file name ! ************************************************************************************ */ // Function processes command line parameters // FIRST read of the command line will search for the -fnc option to // read the configuration file, default is bcpp.cfg at current directory if (ProcessCommandLine (argc, argv, settings, pInFile, pOutFile, pConfig) != 0) return -1; // problems // ********************************************************************* // Find default path and default configuration file name if (pConfig == NULL) FindConfigFile ("bcpp.cfg", pConfigFile); else pConfigFile = fopen(pConfig, "r"); if (pConfigFile == NULL) { warning ("\nCouldn't Open Config File: %s\n", pConfig); warning ("Read Docs For Configuration Settings\n"); } else { // LOAD CONFIG FILE ! errorNum = SetConfig (pConfigFile, settings); // If output is via stdout, then turn out program output if it's // set within config file ! if (pOutputFile == stdout) settings.output = False; if (settings.output != False) warning ("\n%d Error(s) In Config File.\n\n", errorNum); } // ********************************************************************* // SECOND read of the command line will overwrite settings that may have // been changed by the previous command. Lots of processing to overcome // this process, but hey it's a easy solution ! pInFile = pOutFile = NULL; // reset these so they can re-assigned again ! if (ProcessCommandLine (argc, argv, settings, pInFile, pOutFile, pConfig) != 0) return -1; // problems // ********************************************************************* // backup original filename! if ( ((settings.backUp != False) && (pInFile != NULL)) && (pOutFile == NULL)) // Test if user wants an output file ! { if (BackupFile (pInFile, pOutFile) != 0) return -1; renamed = True; } // ************************************************************** // assign I/O streams if (pInFile == NULL) pInputFile = stdin; else pInputFile = fopen(pInFile, "r"); if (pOutFile == NULL) { pOutputFile = stdout; settings.output = False; // if using standard out, don't corrupt output } else pOutputFile = fopen(pOutFile, "wb"); // Check user defined I/O streams if (pInputFile == NULL) { warning ("%s %s\n", pNoFile, pInFile); errorCode = -1; } if (pOutputFile == NULL) { warning ("%s %s\n", pNoFile, pOutFile); errorCode = -1; } if ((settings.output != False) && (errorCode == 0)) errorNum = ShowConfig(settings); if (pConfigFile != NULL) fclose (pConfigFile); // #### Lets do some code crunching ! if ((errorNum == 0) && (errorCode == 0)) errorCode = ProcessFile (pInputFile, pOutputFile, settings); if (settings.output != False) verbose ("\nCleaning Up Dinner ... "); if (pInputFile != NULL) fclose (pInputFile); if (pOutputFile != NULL) fclose (pOutputFile); if (renamed) { RestoreIfUnchanged(pInFile, pOutFile); delete[] pInFile; } if (settings.output != False) verbose ("Done !\n"); return errorCode; } // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ int main (int argc, char* argv[]) { return LoadnRun (argc, argv); } // The End :-). bcpp-20050725/config.guess0000755000175100001440000012647110257323415015220 0ustar tomusers00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-05-27' # 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., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, 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. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # 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, 2002, 2003, 2004, 2005 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 ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # 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 trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; 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. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) 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 # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # 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 ;; amd64:OpenBSD:*:*) echo x86_64-unknown-openbsd${UNAME_RELEASE} exit ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit ;; luna88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit ;; sgi:OpenBSD:*:*) echo mips64-unknown-openbsd${UNAME_RELEASE} exit ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # 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. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; 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 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; 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 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; 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 ;; 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 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /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 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # 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 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build 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 $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; 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 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????: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 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; 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 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi 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 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | 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 ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 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]) 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" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build 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 (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build 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 $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; 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 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; 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 ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; x86:Interix*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 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 i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; 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 ;; 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 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; 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. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C 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 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # 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 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; 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 ;; 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 ;; 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 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; 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 ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. 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 ;; 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|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; 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 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; 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 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*: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; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *: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 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; 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 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in *86) UNAME_PROCESSOR=i686 ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *: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 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build 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\n"); 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 $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # 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 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; 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: bcpp-20050725/config.sub0000755000175100001440000007562510257323434014670 0ustar tomusers00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-06-02' # 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., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, 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 . Submit a context # diff and a properly formatted ChangeLog entry. # # 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, 2002, 2003, 2004, 2005 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 ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # 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 ;; * ) 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* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) 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 | -knuth | -cray) 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] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | ms1 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m32c) 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]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | ms1-* \ | msp430-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; m32c-*) ;; # 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 ;; abacus) basic_machine=abacus-unknown ;; 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 ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; 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 ;; c90) basic_machine=c90-cray os=-unicos ;; 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 | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; 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 ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; 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 ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; os400) basic_machine=powerpc-ibm os=-os400 ;; 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 | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`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 ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-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=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; 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 ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; 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 ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; 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 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv8 | 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 ;; *-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* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -ekkobsd* | -kfreebsd* | -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* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* | -skyos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|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-dietlibc) os=-linux-dietlibc ;; -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 ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -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 ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -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 ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. 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 ;; or32-*) os=-coff ;; *-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 ;; *-knuth) os=-mmixware ;; *-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 ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) 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 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: bcpp-20050725/config_h.in0000644000175100001440000000037105576717302015004 0ustar tomusers00000000000000/* * $Id: config_h.in,v 1.1 1994/06/12 23:48:18 tom Exp $ * config_h.in is a template file used by configure to produce config.h. * config_h is then transformed (by config.status) into the header file * config.h -- Kevin Buettner. */ @DEFS@ bcpp-20050725/configure0000755000175100001440000033265410271255770014615 0ustar tomusers00000000000000#! /bin/sh # From configure.in Revision: 1.7 . # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52.20030208. # # 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="code/bcpp.cpp" # 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_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_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_CXXCPP_set=${CXXCPP+set} ac_env_CXXCPP_value=$CXXCPP ac_cv_env_CXXCPP_set=${CXXCPP+set} ac_cv_env_CXXCPP_value=$CXXCPP 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_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 CXXCPP C++ preprocessor CC C compiler command CFLAGS C compiler flags 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:845: 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:856: 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:864: 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:880: 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:884: 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:890: 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:892: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:894: 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:913: 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:915: 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:935: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? echo "$as_me:938: \$? = $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_config_headers="$ac_config_headers code/autoconf.h:config_h.in" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break 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:966: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&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. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:976: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:980: 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:989: 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:993: 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:998: 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/'` if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then echo "$as_me:1006: 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:1015: 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:1020: 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/'` system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && cat >>confdefs.h <&6 else cf_cv_system_name="$system_name" fi test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && echo "$as_me:1045: result: Configuring for $cf_cv_system_name" >&5 echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 if test ".$system_name" != ".$cf_cv_system_name" ; then echo "$as_me:1049: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 { { echo "$as_me:1051: error: \"Please remove config.cache and try again.\"" >&5 echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} { (exit 1); exit 1; }; } 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 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:1066: 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:1081: found $ac_dir/$ac_word" >&5 break done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:1089: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:1092: 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:1105: 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:1120: 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:1128: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:1131: 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:1143:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:1146: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:1149: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1151: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:1154: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1156: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:1159: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line 1163 "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:1179: 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:1182: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:1185: \$? = $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:1208: 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:1214: 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:1219: 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:1225: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1228: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:1235: 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:1243: 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:1250: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:1252: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:1255: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 if { (eval echo "$as_me:1257: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:1260: \$? = $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:1276: 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:1282: 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:1288: 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 1294 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:1306: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1309: \$? = $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:1321: 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:1328: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:1332: 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 1338 "configure" #include "confdefs.h" int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1353: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1356: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1359: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1362: \$? = $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:1374: 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:1380: 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 1386 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1398: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1401: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1404: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1407: \$? = $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:1417: 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 1444 "configure" #include "confdefs.h" #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1457: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1460: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1463: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1466: \$? = $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 1476 "configure" #include "confdefs.h" $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1488: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1491: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1494: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1497: \$? = $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 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:1524: 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 1541 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:1546: \"$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:1552: \$? = $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 1575 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:1579: \"$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:1585: \$? = $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:1622: 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 1632 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:1637: \"$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:1643: \$? = $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 1666 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:1670: \"$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:1676: \$? = $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:1704: 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 # 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:1727: 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:1776: 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' 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:1793: checking if you want to see long compiling messages" >&5 echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 # Check whether --enable-echo or --disable-echo was given. if test "${enable_echo+set}" = set; then enableval="$enable_echo" test "$enableval" != no && enableval=yes if test "$enableval" != "yes" ; then ECHO_LT='--silent' ECHO_LD='@echo linking $@;' RULE_CC=' @echo compiling $<' SHOW_CC=' @echo compiling $@' ECHO_CC='@' else ECHO_LT='' ECHO_LD='' RULE_CC='# compiling' SHOW_CC='# compiling' ECHO_CC='' fi else enableval=yes ECHO_LT='' ECHO_LD='' RULE_CC='# compiling' SHOW_CC='# compiling' ECHO_CC='' fi; echo "$as_me:1827: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&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 -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:1838: 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:1853: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1861: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1864: 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:1873: 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:1888: 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:1896: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1899: 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:1912: 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:1927: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1935: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1938: 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:1947: 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:1962: 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:1970: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1973: 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:1986: 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:2006: 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:2028: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:2031: 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:2042: 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:2057: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:2065: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:2068: 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:2081: 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:2096: 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:2104: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:2107: 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:2119: 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:2124:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:2127: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:2130: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:2132: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:2135: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:2137: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:2140: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:2143: 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 2149 "configure" #include "confdefs.h" int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _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 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:2185: 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:2191: 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 2197 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2209: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2212: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2215: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2218: \$? = $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:2228: 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:2255: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2258: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2261: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2264: \$? = $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 2276 "configure" #include "confdefs.h" #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2289: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2292: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2295: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2298: \$? = $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 2308 "configure" #include "confdefs.h" $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2320: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2323: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2326: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2329: \$? = $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=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_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:2361: 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 2382 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:2387: \"$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:2393: \$? = $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 2416 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:2420: \"$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:2426: \$? = $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:2463: 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 2473 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:2478: \"$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:2484: \$? = $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 2507 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:2511: \"$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:2517: \$? = $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:2545: 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=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 GXX_VERSION=none if test "$GXX" = yes; then echo "$as_me:2558: checking version of g++" >&5 echo $ECHO_N "checking version of g++... $ECHO_C" >&6 GXX_VERSION="`${CXX-g++} --version|sed -e '2,$d' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$GXX_VERSION" && GXX_VERSION=unknown echo "$as_me:2562: result: $GXX_VERSION" >&5 echo "${ECHO_T}$GXX_VERSION" >&6 fi INTEL_CPLUSPLUS=no if test "$GCC" = yes ; then case $host_os in linux*|gnu*) echo "$as_me:2571: checking if this is really Intel compiler" >&5 echo $ECHO_N "checking if this is really Intel compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -no-gcc" cat >conftest.$ac_ext <<_ACEOF #line 2576 "configure" #include "confdefs.h" int main () { #ifdef __INTEL_COMPILER #else make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2593: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2596: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2599: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2602: \$? = $ac_status" >&5 (exit $ac_status); }; }; then INTEL_CPLUSPLUS=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CXXFLAGS="$cf_save_CFLAGS" echo "$as_me:2613: result: $INTEL_CPLUSPLUS" >&5 echo "${ECHO_T}$INTEL_CPLUSPLUS" >&6 ;; esac 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 cat > conftest.$ac_ext <&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CXXFLAGS="$CXXFLAGS" EXTRA_CXXFLAGS="-Wall" for cf_opt in \ wd1419 \ wd1682 \ wd1683 \ wd1684 \ wd193 \ wd279 \ wd593 \ wd810 \ wd869 \ wd981 do CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt" if { (eval echo "$as_me:2661: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2664: \$? = $ac_status" >&5 (exit $ac_status); }; then test -n "$verbose" && echo "$as_me:2666: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt" fi done CXXFLAGS="$cf_save_CXXFLAGS" elif test "$GXX" = yes then { echo "$as_me:2675: checking for $CXX warning options..." >&5 echo "$as_me: checking for $CXX warning options..." >&6;} cf_save_CXXFLAGS="$CXXFLAGS" EXTRA_CXXFLAGS="-W -Wall" cf_gxx_extra_warnings="" test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings" case "$GCC_VERSION" in [1-2].*) ;; *) cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++" ;; esac for cf_opt in \ Wabi \ fabi-version=0 \ Woverloaded-virtual \ Wsign-promo \ Wsynth \ Wold-style-cast \ Wcast-align \ Wcast-qual \ Wmissing-prototypes \ Wpointer-arith \ Wshadow \ Wstrict-prototypes \ Wundef $cf_gxx_extra_warnings do CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt" if { (eval echo "$as_me:2704: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2707: \$? = $ac_status" >&5 (exit $ac_status); }; then test -n "$verbose" && echo "$as_me:2709: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt" else test -n "$verbose" && echo "$as_me:2713: result: ... no -$cf_opt" >&5 echo "${ECHO_T}... no -$cf_opt" >&6 fi done CXXFLAGS="$cf_save_CXXFLAGS" fi rm -f conftest* 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:2727: 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 2733 "configure" #include "confdefs.h" #include #include #include #include _ACEOF if { (eval echo "$as_me:2741: \"$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:2747: \$? = $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 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 2769 "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 2787 "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 2808 "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:2834: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2837: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:2839: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2842: \$? = $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:2855: 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 for ac_header in \ unistd.h \ do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:2870: 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 2876 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:2880: \"$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:2886: \$? = $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 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.err conftest.$ac_ext fi echo "$as_me:2905: 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 <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:2996: 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:3172: 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:3191: 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.20030208, 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 <<\EOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;; "code/makefile" ) CONFIG_FILES="$CONFIG_FILES code/makefile" ;; "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; "code/autoconf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS code/autoconf.h:config_h.in" ;; *) { { echo "$as_me:3230: 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,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CXXCPP@,$CXXCPP,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@ECHO_LT@,$ECHO_LT,;t t s,@ECHO_LD@,$ECHO_LD,;t t s,@RULE_CC@,$RULE_CC,;t t s,@SHOW_CC@,$SHOW_CC,;t t s,@ECHO_CC@,$ECHO_CC,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@CPP@,$CPP,;t t s,@EXTRA_CXXFLAGS@,$EXTRA_CXXFLAGS,;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:3455: 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:3473: 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:3486: 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_i turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_iA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_iB='\([ ]\),\1#\2define\3' ac_iC=' ' ac_iD='\4,;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:3552: 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:3563: 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:3576: 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 a list of #define's. We won't use it as a sed # script, but as data to insert where we see @DEFS@. We expect AC_SAVE_DEFS to # be either 'cat' or 'sort'. cat confdefs.h | uniq >conftest.vals # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail echo ' rm -f conftest.frag' >> $CONFIG_STATUS while grep . conftest.vals >/dev/null do # Write chunks of a limited-size here document to conftest.frag. echo ' cat >> conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals # Run sed to substitute the contents of conftest.frag into $tmp/in at the # marker @DEFS@. echo ' cat >> conftest.edit < $tmp/out rm -f $tmp/in mv $tmp/out $tmp/in rm -f conftest.edit conftest.frag ' >> $CONFIG_STATUS 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:3634: $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 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 esac done EOF cat >>$CONFIG_STATUS <<\EOF { (exit 0); exit 0; } EOF 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 bcpp-20050725/configure.in0000644000175100001440000000073010271246515015177 0ustar tomusers00000000000000dnl Process this file with 'autoconf' to produce a 'configure' script dnl $Id: configure.in,v 1.7 2005/07/25 20:36:29 tom Exp $ AC_PREREQ(2.52.20030208) AC_REVISION($Revision: 1.7 $) AC_INIT(code/bcpp.cpp) AC_CONFIG_HEADER(code/autoconf.h:config_h.in) CF_CHECK_CACHE AC_PROG_CXX AC_PROG_CXXCPP AC_PROG_INSTALL AC_LANG_CPLUSPLUS AC_EXEEXT AC_OBJEXT CF_DISABLE_ECHO CF_GXX_WARNINGS AC_STDC_HEADERS AC_CHECK_HEADERS( \ unistd.h \ ) AC_OUTPUT(makefile code/makefile,,,cat) bcpp-20050725/indent.bat0000644000175100001440000000017706644426760014657 0ustar tomusers00000000000000@echo off if %1!==! %0 *.c *.cc *.cpp *.h *.java *.js for %%P in ( %1 %2 %3 %4 %5 %6 %7 %8 %9 ) do bcpp -fnc indent.cfg %%P bcpp-20050725/indent.cfg0000644000175100001440000001306406644240565014644 0ustar tomusers00000000000000; This file contains configuration parameters that are used ; within the bcpp program. ; There are two types of parameter types : Boolean, and Integer. ; Boolean types can have only two valid values [On, Yes, or Off, No]. ; Integer types can have a valid range of 0 - 5000. ;------------------------------------------------------------------------ ; This parameter specifies how many lines separate between two ; functions. ;------------------------------------------------------------------------ function_spacing = 2 ; Integer ;------------------------------------------------------------------------ ; Specifies whether to use tabs in indenting code. ;------------------------------------------------------------------------ use_tabs = yes ; Boolean ;------------------------------------------------------------------------ ; Specifies how many spaces to indent. This parameter is also used ; for tab indenting, as 1 tab may be worth 8 spaces if so desired. ; This parameter is used to position comments in TAB mode, and expanding ; of tabs within code! ;------------------------------------------------------------------------ indent_spacing = 4 ; Integer ;------------------------------------------------------------------------ ; Specifies whether to indent preprocessor controls to match the code ;------------------------------------------------------------------------ indent_preprocessor = yes ; Boolean ;------------------------------------------------------------------------ ; Specifies whether to indent embedded SQL statements ;------------------------------------------------------------------------ indent_exec_sql = yes ; Boolean ;------------------------------------------------------------------------ ; Defines at what start position comments that have code on the ; same line to be placed. ;------------------------------------------------------------------------ comments_with_code = 33 ; Integer ;------------------------------------------------------------------------ ; Defines at what start position comments with no code start. ;------------------------------------------------------------------------ comments_with_nocode = 0 ; Integer ;------------------------------------------------------------------------ ; Set this option to ON turns off setting indentation position of parameter ; "comments_with_nocode". Indentation is then set according to code ; position. ;------------------------------------------------------------------------ leave_comments_nocode = yes ; Boolean ;------------------------------------------------------------------------ ; Use this option is used to change non-ascii (non-printable) chars to ; octal notation if they lie within quotes. Either ; Ascii_Chars_Only, XOR Leave_Graphic_Chars parameters need to be set ; as a True value for this parameter to take effect. ;------------------------------------------------------------------------ NonAscii_Quotes_to_Octal = yes ; Boolean ;------------------------------------------------------------------------ ; Setting this parameter to yes will strip non-printable characters ; from the source files, but leave any character that are IBM ; graphics alone. Any non-printable characters that lie within ; quotes will be transformed into octal/character notation, if ; NonAscii_Quotes_To_Octal parameter is set to True. ;------------------------------------------------------------------------ ; leave_graphic_chars = no ; Boolean ;------------------------------------------------------------------------ ; Setting this parameter to yes will strip any non-printable, ; non-ascii characters from the input file. Any non-printable ; octal/character notation if NonAscii_Quotes_To_Octal is set to ; True. Comment out this parameter if you are using ; Leave_Graphic_Chars parameter, as this parameter will override ; it. ;------------------------------------------------------------------------ ascii_chars_only = yes ; Boolean ;------------------------------------------------------------------------ ; This parameter will place open braces on a new line after it's ; associated code if set on/yes. Else the brace will be place on ; next above line if possible, with it's code. ;------------------------------------------------------------------------ place_brace_on_new_line = yes ; Boolean ;------------------------------------------------------------------------ ; This parameter will stop output from the program corrupting output ; that may exit from the program via the standard output. ; If this parameter is set to off/no then no output is generated from ; the program, unless an error is encountered ;------------------------------------------------------------------------ program_output = yes ; Boolean ;------------------------------------------------------------------------ ; Specifies what the internal memory requirements will be in size of the ; line processing buffer. This essentially is used only for open brace ; relocation in kernighan/ritchie style. ;------------------------------------------------------------------------ Queue_Buffer = 1000 ; Integer ;------------------------------------------------------------------------ ; If this option is set to true then the input file will be backup into a ; another file with a ".bac" extension added to the end of the file ; name. ;------------------------------------------------------------------------ Backup_File = yes ; Boolean bcpp-20050725/install.sh0000755000175100001440000001572307762207755014721 0ustar tomusers00000000000000#! /bin/sh # # install - install a program, script, or datafile # # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # 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 "$0: no input file specified" >&2 exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d "$dst" ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog 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" ] || [ -d "$src" ] then : else echo "$0: $src does not exist" >&2 exit 1 fi if [ x"$dst" = x ] then echo "$0: no destination specified" >&2 exit 1 else : 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 : 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 : fi pathcomp=$pathcomp/ done fi if [ x"$dir_arg" != x ] then $doit $instcmd "$dst" && if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; 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 : fi # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/#inst.$$# rmtmp=$dstdir/#rm.$$# # Trap to clean up temp files at exit. trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 # Move or copy the file name to the temp name $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits # If 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 :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && # Now remove or move aside any old file at destination location. We try this # two ways since rm can't unlink itself on some systems and the destination # file might be busy for other reasons. In this case, the final cleanup # might fail but the new file should still install successfully. { if [ -f "$dstdir/$dstfile" ] then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi && # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit } bcpp-20050725/makefile.in0000644000175100001440000000446207567735374015025 0ustar tomusers00000000000000# $Id: makefile.in,v 1.3 2002/11/23 17:29:32 tom Exp $ # top-level makefile-template for 'bcpp' THIS = bcpp #### Start of system configuration section. #### srcdir = @srcdir@ VPATH = @srcdir@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = $(DESTDIR)@bindir@ mandir = $(DESTDIR)@mandir@/man1 manext = 1 #### End of system configuration section. #### SHELL = /bin/sh DISTFILES = configure $(SRC) all: cd code && $(MAKE) $@ install: all installdirs cd code && $(MAKE) $@ $(INSTALL_PROGRAM) code/$(THIS) $(bindir)/$(THIS) $(INSTALL_DATA) $(srcdir)/txtdocs/$(THIS).1 $(mandir)/$(THIS).$(manext) installdirs: $(SHELL) ${srcdir}/mkdirs.sh $(bindir) $(mandir) uninstall: rm -f $(bindir)/$(THIS) $(mandir)/$(THIS).$(manext) mostlyclean: cd code && $(MAKE) $@ rm -f *.o core *~ *.out *.BAK *.atac clean: mostlyclean cd code && $(MAKE) $@ rm -f $(THIS) distclean: clean cd code && $(MAKE) $@ rm -f makefile code/makefile code/autoconf.h rm -f config.log config.cache config.status realclean: distclean cd code && $(MAKE) $@ check: cd code && $(MAKE) $@ RELEASE = `cat $(srcdir)/VERSION` RELDIR = echo "$(THIS)-`sed -e 's/[^0-9]//g' $(srcdir)/VERSION`" # I keep my sources in RCS, and assign a symbolic release to the current patch # level. The 'manifest' script knows how to build a list of files for a given # revision. MANIFEST: $(srcdir)/VERSION manifest -r$(RELEASE) dist: MANIFEST - rm -f .fname .files $(RELDIR) >.fname cat MANIFEST | grep ' ' | egrep -v ' subdirectory$$' | sed -e 's/\ .*//' | uniq >.files rm -rf `cat .fname` TOP=`cat .fname`; mkdir $$TOP `cat .files | grep / | sed -e 's@/.*@@' | sed -e s@\^@$$TOP/@ | uniq` for file in `cat .files`; do \ ln $(srcdir)/$$file `cat .fname`/$$file \ || { echo copying $$file instead; cp $$file `cat .fname`/$$file; }; \ done tar -cf - `cat .fname` | gzip >`cat .fname`.tgz rm -rf `cat .fname` .fname .files # Some of the output will be uuencoded because the test scripts include # terminated ".bat" files for MS-DOS. dist-shar: MANIFEST - rm -f .fname .files $(RELDIR) >.fname cat MANIFEST | grep ' ' | egrep -v ' subdirectory$$' | sed -e 's/\ .*//' | uniq >.files shar -M -n`cat .fname` -opart -l50 `cat .files` - rm -f .fname .files bcpp-20050725/mkdirs.sh0000755000175100001440000000150607507401011014510 0ustar tomusers00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Last modified: 1994-03-25 # Public domain # errstatus=0 umask 022 for file in ${1+"$@"} ; do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d in ${1+"$@"} ; do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 case "$pathcomp" in [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]: ) ;; # DOSISH systems * ) mkdir "$pathcomp" || errstatus=$? ;; esac fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here bcpp-20050725/txtdocs/0000755000175100001440000000000010271257370014357 5ustar tomusers00000000000000bcpp-20050725/txtdocs/bcpp.10000644000175100001440000003541407567734122015405 0ustar tomusers00000000000000.\" $Id: bcpp.1,v 1.1 2002/11/23 17:18:10 tom Exp $ .TH "C++ Beautifier" .SH NAME \fBbcpp\fP \- make C++ beautifier .SH OVERVIEW This program enables a user to reformat certain elements of a C, or C++ source code. This helps if one person's code is a little unreadable, or has been indented to a style that you dislike. Using this program will hopefully help in re-styling the code so that it closely meets your style. However, due to the many styles of C(++) that can be coded, there are limits to how well this program will handle the source code, and resulting re-formatted source. .PP The following are a list of features implemented: .RS 5 .TP 3 - Reposition comments at certain locations. .TP - Remove non-printable characters not contained within quotes. .TP - Convert non-printable characters within quotes to octal/character notation. .TP - Re-space line spacing between functions. .TP - Trim trailing spaces from all lines, as well as leading and trailing blank lines from the file. .TP - Reposition opening braces to Kernighan/Ritchie style, or to Pascal style. .TP - Use of tabs, or spaces in indenting. .TP - Indention of single line code, according to certain C condition statements, including embedded SQL statements. .RE .SH Requirements This program will run under Microsoft DOS V3.3 and Unix platforms. .PP It uses approximately 50 - 70k (or more, dependant upon internal queue size) of memory during execution. .PP The program code has been written in such a way as to be compatible with existing C++ compilers, however the code is not ANSI standard and may require modification for your environment. The source code has been written with standard ANSI and Posix functions so that least amount of rewriting should be needed if recompiling on another computer platform. .PP The current sources have been compiled using Turbo C++ V3.0, for MS-DOS, GNU G++ 2.7.2 under Sun SPARCstation running SunOS, Solaris as well as SGI workstations running IRIX. .SH OPERATION Operation of the program is via the command line (CLI), and with help from a configuration file you can define your format requirements. Basically each command directive starts with a dash "\-" followed my the command name. If another parameter is need for the command, the parameter is added after the command, and separated with a space (i.e. bcpp -fi input.cpp). .PP N.B: Do not enter bcpp.exe on its own to find its command help, use bcpp -?, or bcpp -h. This is due to the input redirection from the O/S. Keeping to Unix CLI convention, a string that is read from the CLI and does not have a command directive is considered a input file. If there are two such occurrences on the command line, the precedence will be input file first, and output file second (i.e., bcpp infile.cpp outfile.cpp -lg), a third such occurrence will generate a error message. .PP If no output file is presented, its assumed output is via the standard output. This automatically turns off program output. Parameters entered on the command line will override parameters that have been read from the configuration file. .PP Example: .nf bcpp -fi input.cpp -f 2 -qb 5 -na -no -cc 60 > output.cpp .fi .PP Synopsis .PP -fi input.cpp Input file = input.cpp -f 2 Function spacing = 2 -qb 2 Internal Queue Buffer = 5 -na Remove non-ascii chars -no Suppress program output -cc 60 Comments that appear on same line as code will be placed in column 60. > output.cpp Output of program is redirected to "output.cpp" .PP A configuration file can be used to specify most of the non- changing elements in reformatting of code. The configuration file consists of some fairly lengthy words that are used to explain the output style of the code. However setting these parameters is very easy, they basically consist of two types, Boolean, or Integer types. Using your favorite text editor, you can change the following within the configuration file ... .PP The following parameters will be contained within the configuration file (default is bcpp.cfg). The program will attempt to read the default configuration file at the program source (i.e. which path bcpp was run). Using the -fnc option you can define a custom configuration file name, and path from the CLI. .PP Integer Type Ranges : 0 - 5000 Boolean Type Ranges : On, Yes, or Off, No .RS 5 .TP 5 Function_Spacing : Integer This parameter specifies how many lines separate two functions. e.g., function_spacing = 2 CLI -f 2 .TP Use_Tabs: Boolean Specifies whether to use tabs in indenting code. e.g., use_tabs = no CLI -t (Turn tabs on, default uses spaces) -s (Use tabs for indenting) .TP Indent_Spacing : Integer Specifies how many spaces to indent. This parameter also sets the width of tabs. Bcpp considers the width of a tab to be the same as the width of an indent. E.G. indent_spacing = 4 CLI -i 4 .TP Comments_With_Code : Integer Defines the column in which comments that appear after code on a line will be placed. e.g., comments_with_code = 50 CLI -cc 50 .TP Comments_With_Nocode : Integer Defines the column in which comments that appear in a line will be placed. e.g., comments_with_nocode = 0 CLI -nc 0 .TP Indent_Preprocessor: Boolean If true, bcpp will indent preprocessor lines to the indention of the C(++) code. If false, preprocessor lines will be in the first column. Unrecognized (i.e., nonstandard) preprocessor lines are always put into the first column. .TP Indent_Exec_Sql: Boolean If true, bcpp looks for embedded SQL statements (e.g., EXEC SQL), and formats them specially. .TP Leave_Comments_NoCode : Boolean This options overrides the "Comments_With_Nocode" option. Setting this option On will indent comments that do not occur on the same line as code to the same indention as code. e.g., leave_comments_nocode = on CLI -nlcnc (Turn off Leave_Comments_NoCode) -ylcnc (Turn on Leave_Comments_NoCode) .TP NonAscii_Quotes_To_Octal : Boolean Use this option to change non-ASCII (non-printable) chars to octal notation if they lie within quotes. This parameter does not take effect unless either the Ascii_Chars_Only or Leave_Graphic_Chars parameters have been set. e.g., NonAscii_Quotes_to_Octal = no CLI -nq (Turn off non-ascii chars in quotes to octal) -yq (Turn on non-ascii chars in quotes to octal) .TP Leave_Graphic_Chars : Boolean Setting this parameter to yes will strip non-printable characters from the source file, but leave any characters that are IBM graphics alone. Any non-printable characters that lie within quotes will be transformed into octal/character notation, if NonAscii_Quotes_To_Octal parameter is set to True. E.G. leave_graphic_chars = yes CLI -lg .TP Ascii_Chars_Only : Boolean Setting this parameter to yes will strip any non-printable, non-ASCII characters from the input file. Any non-printable characters that lie within quotes will be transformed into octal/character notation if NonAscii_Quotes_To_Octal is set to True. Comment out this parameter if you are using Leave_Graphic_Chars parameter, as this parameter will override it. e.g., ascii_chars_only = yes CLI -na (Do not remove non-ASCII characters) -ya (Yes remove non-ASCII characters) .TP Place_Brace_On_New_Line : Boolean When set to 'on' bcpp will place opening braces on new lines ("Pascal" style C coding), when set to 'off' bcpp will use "K&R" style C coding. Pascal style C coding: if (condition) { statements; } K&R style C coding: if (condition) { statements; } e.g., place_brace_on_new_line = on CLI -bnl (on ) -bcl (off) .TP Program_Output : Boolean This parameter will stop output from the program corrupting output that may exit from the program via the standard output. If this parameter is set to off/no then no output is generated from the program, unless an error is encountered. The standard error is used to display any errors encountered while processing. E.G program_output = off CLI -no (default is generate output if possible, this will force output off) -yo (turn on program output if possible) .TP Queue_Buffer : Integer Specifies what the internal memory requires will be in size of the line processing buffer. This is used for open brace relocation in Kernighan/Ritchie style. Extending this buffer to large amounts of memory will slow processing on small machines. e.g., Queue_Buffer = 2 CLI -qb 2 .TP ; : Not Applicable Placing a semicolon in front of text makes everything after the semicolon a comment. .TP Backup_File : Boolean This option will backup the input file to a file with the extension ".bac" and overwrite the input file with the reformatted version. e.g., backup_file = yes CLI -yb (yes, backup input file if possible) -nb (no, do not backup input file) .RE .SH Loading Configuration File : CLI only Bcpp implements a configuration setting to allow custom file selection from a specific path/file defined by a user. e.g., bcpp input.cpp -yb (read bcpp.cfg configuration file before processing CLI options) bcpp -fnc /bin/bcpp.cfg (load configuration file at said location) CLI -fnc (use user defined) .TP Input File Name : CLI only This option directs bcpp to read data at a given path, and file name. E.G bcpp -fi input.cpp > output.cpp CLI -fi .TP Output File Name : CLI only This defines the output file name that data is to be written to. e.g., Has to be like this, (in DOS, at least): bcpp -fo output.cpp < input.cpp ClI -fo .TP Online Help : CLI only Some online help which is brief but to the point exists within the program. The help lists all of the CLI commands available within the program. E.G bcpp -h CLI bcpp -? bcpp -h .SH Configuration File Error Messages If you enter a command/parameter incorrectly within the configuration file, upon the executable program reading it, the program will generate a error message along with its line number. The following is an explanation of error messages that may occur while reading parameters within the configuration file. .RS 5 .TP 3 Syntax Error After Key Word : Error occurs because the character/word after a parameter was incorrect, or expected another keyword (e.g =, Yes, No, On, Off) .TP Range Error : Error occurs when integer parameters have a invalid numeric setting (i.e., A number is not within 0 - 5000). .TP Expected Numeric Data : This error occurs when alpha-numeric data is in place of numeric data for integer type parameters. .TP Cannot Decipher : The parameter at said line is not valid (i.e., not recognizable). .RE .PP If any errors have occurred after reading the configuration file; the user is prompted with a [y/n] continuation prompt to either fix the configuration error(s) before processing, or continue with current set parameters. .SH Run Time Errors During Input File Processing .RS 5 .TP 3 Memory Allocation Failed : The program was unable to allocate memory to process data. This error will stop processing of data. .TP Error In Line Construction .TP Expected Some Sort Of Code ! Data Type = ? : This error is generated within the line construction process. The decoded line from the input file may be too indecipherable for this program. Find the line in the input file, and see if it can be altered so that processing can continue. .RE .SH C(++) Beautifier Limitations This section highlights certain areas within code where bcpp will fail to reconstruct the output code to the desired style (although it may still be able to compile). .RS 5 .TP 3 - All code that is fed through this program should be in a compilable state. This means that there should be closing braces that cancel out opening braces. Bcpp does no syntax checking at all upon the code, but reformats it according to open, closing braces, and a handful of key words for single line indentation. .TP - There is also a limitation on how far the movement of open braces can be processed. This is due to the current design of the program (this can fixed easily by extending the internal queue buffer size), memory requirements, processing speed. Dynamic memory allocation is used extensively throughout the program, and may exceed current limits if certain conditions arise. The example shows that the movements of the brace from the new line to the above code line will not take place as it would be out of scope for the program if the internal queue buffer is limited to 2 lines in size. Example of brace movement scope: if (a == b) // Brace will not be re-positioned { b = c; } if (a == b) // Brace will be re-positioned { b = c; } End Result if (a == b) // Brace will not be re-positioned { b = c; } if (a == b){ // Brace will be re-positioned b = c; } .TP - There is a constraint that a single line of code should only have one type of comment. If there are both C, and C++ existing on the same line then the line construction phase of the program will become confused, and generate a error message. The following line will produce a Line Construction Error message. Example of multiple comments. /* C Comment */ a = b; // C++ Comment The above line will generate an error. Remedy this by removing one type of comment, combine them, or place one on a new line. .RE .SH AUTHORS Written By Steven De Toni December 1995 .br Updated by Thomas Dickey January 1997-2002 .PP You can contact Steven De Toni via various online networks: Internet Address tge@midland.co.nz steve@alpha.ocbbs.gen.nz Net Mail Via Fido-Net (Dog Net) Steven De Toni, "The Great Escape", Hamilton, New Zealand Demi-Monde New Zealand National Mail Net Work (see Dog Net) .PP If all else fails, send snail mail to: .PP 17 Garden Heights Ave, Melville, Hamilton, New Zealand .PP Thomas Dickey can be reached at dickey@invisible-island.net .PP Special thanks goes out to Glyn Webster for proof reading my manual, and testing my program. .PP Thanks to Justin Slootsky for his input, and changes for this version. .PP All \fBgrammatical\fR errors within this document are there for your enjoyment. ;-) .SH DISCLAIMER The authors give no guarantees that this program will function to the specifications given via the configuration, or the program's reconstructed output of source code that have been processed. Any damage that might arise from the use of this program (be it software, or hardware) is the problem of user, and not the authors. Using this software binds you to this disclaimer.bcpp-20050725/txtdocs/hirachy.txt0000644000175100001440000000570605672503204016556 0ustar tomusers00000000000000 Object Hierarchy Diagram Any Object ----+---- QueueList (generic queue object) | | +---- StackList (generic stack object) | | +---- InputStruct | | +---- OutputStruct | | +---- IndentStruct Notes of class usage: IndentStruct: Even though IndentStruct is defined as a class, it is basically a record structure. I have defined it as a class to help storage of the record data easier, and to automate some of the initialisation process. However, there are no methods (apart from the constructor), that handles any of the object's data. All data is altered directly within the class (i.e don't use methods to change data). InputStruct: This is basically like the IndentStruct, except it has no defined constructor. The class is used the same was as a normal structure. A destructor isn't implemented as existing data may belong to two, or more other objects. OutputStruct: This has more OO implementation than the previous two objects (i.e constructor, destructor), but data is accessed the same as any structure. Entity RelationShip Diagram +-----------+ +-------------+ | | have /| | | QueueList |--------------| InputStruct | | | \| | +-----------+ +-------------+ | | | +--------------+ | have /| | +--------------------| OutputStruct | \| | +--------------+ +-----------+ +--------------+ | | have /| | | StackList |--------------| IndentStruct | | | \| | +-----------+ +--------------+ bcpp-20050725/txtdocs/manual.txt0000644000175100001440000003742707471511734016417 0ustar tomusers00000000000000 C(++) Beautifier V1.9 Written By Steven De Toni December 1995 Updated by Thomas Dickey January 1997 Contents Page 1 Introduction 2 Disclaimer 3 Requirements 4 How To Use The Program 11 Configuration File Error Messages 12 Run Time Errors During Input File Processing 13 C(++) Beautifier Limitations 15 Contact Addresses Page >1< Introduction This program enables a user to reformat certain elements of a C, or C++ source code. This helps if one person's code is a little unreadable, or has been indented to a style that you dislike. Using this program will hopefully help in re-styling the code so that it closely meets your style. However, due to the many styles of C(++) that can be coded, there are limits to how well this program will handle the source code, and resulting re-formatted source. The following are a list of features implemented: - Reposition comments at certain locations. - Remove non-printable characters not contained within quotes. - Convert non-printable characters within quotes to octal/character notation. - Re-space line spacing between functions. - Trim trailing spaces from all lines, as well as leading and trailing blank lines from the file. - Reposition opening braces to Kernighan/Ritchie style, or to Pascal style. - Use of tabs, or spaces in indenting. - Indention of single line code, according to certain C condition statements, including embedded SQL statements. Page >2< Disclaimer The authors give no guarantees that this program will function to the specifications given via the configuration, or the program's reconstructed output of source code that have been processed. Any damage that might arise from the use of this program (be it software, or hardware) is the problem of user, and not the authors. Using this software binds you to this disclaimer. Page >3< Requirements This program will run under Microsoft DOS V3.3 and Unix platforms. It uses approximately 50 - 70k (or more, dependant upon internal queue size) of memory during execution. The program code has been written in such a way as to be compatible with existing C++ compilers, however the code is not ANSI standard and may require modification for your environment. The source code has been written with standard ANSI and Posix functions so that least amount of rewriting should be needed if recompiling on another computer platform. The current sources have been compiled using Turbo C++ V3.0, for MS-DOS, GNU G++ 2.7.2 under Sun SPARCstation running SunOS, Solaris as well as SGI workstations running IRIX. Page >4< How To Use The Program Operation of the program is via the command line (CLI), and with help from a configuration file you can define your format requirements. Basically each command directive starts with a dash '-' followed my the command name. If another parameter is need for the command, the parameter is added after the command, and separated with a space (i.e. bcpp -fi input.cpp). N.B: Don't enter bcpp.exe on its own to find its command help, use bcpp -?, or bcpp -h. This is due to the input redirection from the O/S. Keeping to Unix CLI convention, a string that is read from the CLI and does not have a command directive is considered a input file. If there are two such occurrences on the command line, the precedence will be input file first, and output file second (i.e., bcpp infile.cpp outfile.cpp -lg), a third such occurrence will generate a error message. If no output file is presented, its assumed output is via the standard output. This automatically turns off program output. Parameters entered on the command line will override parameters that have been read from the configuration file. Example: bcpp -fi input.cpp -f 2 -qb 5 -na -no -cc 60 > output.cpp Synopsis -fi input.cpp Input file = input.cpp -f 2 Function spacing = 2 -qb 2 Internal Queue Buffer = 5 -na Remove non-ascii chars -no Suppress program output -cc 60 Comments that appear on same line as code will be placed in column 60. > output.cpp Output of program is redirected to "output.cpp" Page >5< A configuration file can be used to specify most of the non- changing elements in reformatting of code. The configuration file consists of some fairly lengthy words that are used to explain the output style of the code. However setting these parameters is very easy, they basically consist of two types, Boolean, or Integer types. Using your favorite text editor, you can change the following within the configuration file ... The following parameters will be contained within the configuration file (default is bcpp.cfg). The program will attempt to read the default configuration file at the program source (i.e. which path bcpp was run). Using the -fnc option you can define a custom configuration file name, and path from the CLI. Integer Type Ranges : 0 - 5000 Boolean Type Ranges : On, Yes, or Off, No Function_Spacing : Integer This parameter specifies how many lines separate two functions. e.g., function_spacing = 2 CLI -f 2 Use_Tabs: Boolean Specifies whether to use tabs in indenting code. e.g., use_tabs = no CLI -t (This will turn tabs on, default uses spaces) -s (Use tabs for indenting) Indent_Spacing : Integer Specifies how many spaces to indent. This parameter also sets the width of tabs. Bcpp considers the width of a tab to be the same as the width of an indent. E.G. indent_spacing = 4 CLI -i 4 Page >6< Comments_With_Code : Integer Defines the column in which comments that appear after code on a line will be placed. e.g., comments_with_code = 50 CLI -cc 50 Comments_With_Nocode : Integer Defines the column in which comments that appear in a line will be placed. e.g., comments_with_nocode = 0 CLI -nc 0 Indent_Preprocessor: Boolean If true, bcpp will indent preprocessor lines to the indention of the C(++) code. If false, preprocessor lines will be in the first column. Unrecognized (i.e., nonstandard) preprocessor lines are always put into the first column. Indent_Exec_Sql: Boolean If true, bcpp looks for embedded SQL statements (e.g., EXEC SQL), and formats them specially. Leave_Comments_NoCode : Boolean This options overrides the "Comments_With_Nocode" option. Setting this option On will indent comments that do not occur on the same line as code to the same indention as code. e.g., leave_comments_nocode = on CLI -nlcnc (Turn off Leave_Comments_NoCode) -ylcnc (Turn on Leave_Comments_NoCode) Page >7< NonAscii_Quotes_To_Octal : Boolean Use this option to change non-ASCII (non-printable) chars to octal notation if they lie within quotes. This parameter doesn't take effect unless either the Ascii_Chars_Only or Leave_Graphic_Chars parameters have been set. e.g., NonAscii_Quotes_to_Octal = no CLI -nq (Turn off non-ascii chars in quotes to octal) -yq (Turn on non-ascii chars in quotes to octal) Leave_Graphic_Chars : Boolean Setting this parameter to yes will strip non-printable characters from the source file, but leave any characters that are IBM graphics alone. Any non-printable characters that lie within quotes will be transformed into octal/character notation, if NonAscii_Quotes_To_Octal parameter is set to True. E.G. leave_graphic_chars = yes CLI -lg Ascii_Chars_Only : Boolean Setting this parameter to yes will strip any non-printable, non-ASCII characters from the input file. Any non-printable characters that lie within quotes will be transformed into octal/character notation if NonAscii_Quotes_To_Octal is set to True. Comment out this parameter if you are using Leave_Graphic_Chars parameter, as this parameter will override it. e.g., ascii_chars_only = yes CLI -na (Don't remove non-ASCII characters) -ya (Yes remove non-ASCII characters) Page >8< Place_Brace_On_New_Line : Boolean When set to 'on' bcpp will place opening braces on new lines ("Pascal" style C coding), when set to 'off' bcpp will use "K&R" style C coding. Pascal style C coding: if (condition) { statements; } K&R style C coding: if (condition) { statements; } e.g., place_brace_on_new_line = on CLI -bnl (on ) -bcl (off) Program_Output : Boolean This parameter will stop output from the program corrupting output that may exit from the program via the standard output. If this parameter is set to off/no then no output is generated from the program, unless an error is encountered. The standard error is used to display any errors encountered while processing. E.G program_output = off CLI -no (default is generate output if possible, this will force output off) -yo (turn on program output if possible) Page >9< Queue_Buffer : Integer Specifies what the internal memory requires will be in size of the line processing buffer. This is used for open brace relocation in Kernighan/Ritchie style. Extending this buffer to large amounts of memory will slow processing on small machines. e.g., Queue_Buffer = 2 CLI -qb 2 ; : Not Applicable Placing a semicolon in front of text makes everything after the semicolon a comment. Backup_File : Boolean This option will backup the input file to a file with the extension ".bac" and overwrite the input file with the reformatted version. e.g., backup_file = yes CLI -yb (yes, backup input file if possible) -nb (no, don't backup input file) Page >10< Loading Configuration File : CLI only Bcpp implements a configuration setting to allow custom file selection from a specific path/file defined by a user. e.g., bcpp input.cpp -yb (read bcpp.cfg configuration file before processing CLI options) bcpp -fnc /bin/bcpp.cfg (load configuration file at said location) CLI -fnc (use user defined) Input File Name : CLI only This option directs bcpp to read data at a given path, and file name. E.G bcpp -fi input.cpp > output.cpp CLI -fi Output File Name : CLI only This defines the output file name that data is to be written to. e.g., Has to be like this, (in DOS, at least): bcpp -fo output.cpp < input.cpp ClI -fo Online Help : CLI only Some online help which is brief but to the point exists within the program. The help lists all of the CLI commands available within the program. E.G bcpp -h CLI bcpp -? bcpp -h Page >11< Configuration File Error Messages If you enter a command/parameter incorrectly within the configuration file, upon the executable program reading it, the program will generate a error message along with its line number. The following is an explanation of error messages that may occur while reading parameters within the configuration file. - Syntax Error After Key Word : Error occurs because the character/word after a parameter was incorrect, or expected another keyword (e.g =, Yes, No, On, Off) - Range Error : Error occurs when integer parameters have a invalid numeric setting (i.e., A number is not within 0 - 5000). - Expected Numeric Data : This error occurs when alpha-numeric data is in place of numeric data for integer type parameters. - Can't Decipher : The parameter at said line is not valid (i.e., not recognizable). If any errors have occurred after reading the configuration file; the user is prompted with a [y/n] continuation prompt to either fix the configuration error(s) before processing, or continue with current set parameters. Page >12< Run Time Errors During Input File Processing - Memory Allocation Failed : The program was unable to allocate memory to process data. This error will stop processing of data. - Error In Line Construction - Expected Some Sort Of Code ! Data Type = ? : This error is generated within the line construction process. The decoded line from the input file may be too indecipherable for this program. Find the line in the input file, and see if it can be altered so that processing can continue. Page >13< C(++) Beautifier Limitations This section highlights certain areas within code where bcpp will fail to reconstruct the output code to the desired style (although it may still be able to compile). - All code that is fed through this program should be in a compilable state. This means that there should be closing braces that cancel out opening braces. Bcpp does no syntax checking at all upon the code, but reformats it according to open, closing braces, and a handful of key words for single line indentation. - There is also a limitation on how far the movement of open braces can be processed. This is due to the current design of the program (this can fixed easily by extending the internal queue buffer size), memory requirements, processing speed. Dynamic memory allocation is used extensively throughout the program, and may exceed current limits if certain conditions arise. The example shows that the movements of the brace from the new line to the above code line will not take place as it would be out of scope for the program if the internal queue buffer is limited to 2 lines in size. Page >13< Example of brace movement scope: if (a == b) // Brace will not be re-positioned { b = c; } if (a == b) // Brace will be re-positioned { b = c; } End Result if (a == b) // Brace will not be re-positioned { b = c; } if (a == b){ // Brace will be re-positioned b = c; } - There is a constraint that a single line of code should only have one type of comment. If there are both C, and C++ existing on the same line then the line construction phase of the program will become confused, and generate a error message. The following line will produce a Line Construction Error message. Example of multiple comments. /* C Comment */ a = b; // C++ Comment The above line will generate an error. Remedy this by removing one type of comment, combine them, or place one on a new line. Page >15< Contact Addresses You can contact me via various online networks: Internet Address tge@midland.co.nz steve@alpha.ocbbs.gen.nz Net Mail Via Fido-Net (Dog Net) Steven De Toni, "The Great Escape", Hamilton, New Zealand Demi-Monde New Zealand National Mail Net Work (see Dog Net) All else fails, send me snail mail at: 17 Garden Heights Ave, Melville, Hamilton, New Zealand Thomas Dickey can be reached at dickey@invisible-island.net Special thanks goes out to Glyn Webster for proof reading my manual, and testing my program. Thanks to Justin Slootsky for his input, and changes for this version. All _grammatical_ errors within this document are there for your enjoyment. ;-)bcpp-20050725/wpdocs/0000755000175100001440000000000010271257370014166 5ustar tomusers00000000000000bcpp-20050725/wpdocs/hirachy.doc0000644000175100001440000000730705650466754016330 0ustar tomusers00000000000000WPC 2BP ZCourier 10cpi3|x(/x6X@8;X@HP LaserJet Series IIHPLASEII.PRSx  @,t0dX@USUK 3'3'Standard6&A46&A4rJet Series IIE5 2 9!;X\F`5Courier 10cpiCourier 10cpi Bold?xxx,(/x6X@8;X@l?xxx,x `w;Xyz|~ X2 ?   Object Hierarchy Diagram  )a   ?   Any Object ----+---- QueueList (generic queue object) | |  ?x  +---- StackList (generic stack object) | |  ?  +---- InputStruct | |  ?(  +---- OutputStruct | |  ?  +---- IndentStruct Notes of class usage: IndentStruct: Even though IndentStruct is defined as a class, it is basically a record structure. I have defined it as a class to help storage of the record data easier, and to automate some of the initialisation process. However, there are no methods (apart from the constructor), that handles any of the object's data. All data is altered directly within the class (i.e don't use methods to change data). InputStruct: This is basically like the IndentStruct, except it has no defined constructor. The class is used the same was as a normal structure. A destructor isn't implemented as existing data may belong to two, or more other objects. OutputStruct: This has more OO implementation than the previous two objects (i.e constructor, destructor), but data is accessed the same as any structure. xp-p-p-  ?   Entity RelationShip Diagram )a  )a  +-----------+ +-------------+  ?  | | have /| |  ?  | QueueList |--------------| InputStruct | | | \| | +-----------+ +-------------+ | | | +--------------+  ?`  | have /| |  ?(  +--------------------| OutputStruct | \| | +--------------+ +-----------+ +--------------+  ?  | | have /| |  ?  | StackList |--------------| IndentStruct | | | \| | +-----------+ +--------------+ bcpp-20050725/wpdocs/manual.doc0000644000175100001440000006005006271552430016133 0ustar tomusers00000000000000WPC 2BPZCourier 10cpi2|xx  @8;X@Okidata OkiLaser 400OKOKI400.PRSx  @,h,03"X@22 ZB !2|xOkidata OkiLaser 400OKOKI400.PRSx  @,h,03"X@ACourier 10cpiCourier 10cpi Bold2XZF`USUK 3'3'Standard3'3'StandardOKOKI400.PRSx  A t2xxx,x  @8;X@?xxx,~x `w;X'&&& +++**))('&&-'&&'++++&&&)++++'& & ' + 01-19-97 09:54p 62* UKUS * *  C(++) Beautifier V1.9  Written By Steven De Toni December 1995 @ Updated by Thomas Dickey January 1997 * *  x0*0*0* *  ? &  Contents *    כ Page  ?  1   Introduction  ?"  2  Disclaimer  ?  3  Requirements  ?\  4  How To Use The Program  ? ` ` 11  Configuration File Error Messages  ? ` ` 12  Run Time Errors During Input File Processing  ?3  13  C(++) Beautifier Limitations  ? ` ` 15  Contact Addresses m0*0*0*  ?   Ch Page >1<  ? K(# $ Introduction *  This program enables a user to reformat certain elements of a C, or C++ source code. This helps if one person's code is a little unreadable, or has been indented to a style that you dislike. Using this program will hopefully help in re-styling the code so that it closely meets your style. However, due to the many styles of C(++) that can be coded, there are limits to how well this program will handle the source code, and resulting re-formatted source.  ?  The following are a list of features implemented:  ? X - Reposition comments at certain locations.   ? X - Remove non-printable characters not contained within  ? quotes.   ? X - Convert non-printable characters within quotes to  ?W octal/character notation.   ? X - Re-space line spacing between functions.   ? X - Trim trailing spaces from all lines, as well as leading  ?Y and trailing blank lines from the file.   ? X - Reposition opening braces to Kernighan/Ritchie style,  ? or to Pascal style.   ?N X -  Use of tabs, or spaces in indenting.   ? X - Indention of single line code, according to certain C condition statements, including embedded SQL  ? statements.  0*((@@  ? Ch Page >2<  ? K(# % Disclaimer *  The authors give no guarantees that this program will function to the specifications given via the configuration, or the program's reconstructed output of source code that have been processed. Any damage that might arise from the use of this program (be it software, or hardware) is the problem of user, and not the authors. Using this software binds you to this disclaimer. 0*((@@  ? Ch Page >3< Đ ? K(# $ Requirements *  This program will run under Microsoft DOS V3.3 and Unix platforms. It uses approximately 50 - 70k (or more, dependant upon internal queue size) of memory during execution. The program code has been written in such a way as to be compatible with existing C++ compilers, however the code is not ANSI standard and may require modification for your environment. The source code has been written with standard ANSI and Posix functions so that least amount of rewriting should be needed if recompiling on another computer platform. The current sources have been compiled using Turbo C++ V3.0, for  2H MS-DOS, GNU G++ 2.7.2 under Sun SPARCstation running SunOS, Solaris as well as SGI workstations running IRIX. 0*((@@  ?    ChPage >4<  ? K(# How To Use The Program  *  Operation of the program is via the command line (CLI), and with help from a configuration file you can define your format requirements. Basically each command directive starts with a dash  ? ' é ' followed my the command name. If another parameter is need for the command, the parameter is added after the command, and  ?M separated with a space (i.e. bcpp fi input.cpp ).  ? N.B: Don't enter bcpp.exe on its own to find its command help,  ? use bcpp ? , or bcpp h . This is due to the input redirection from the O/S. Keeping to Unix CLI convention, a string that is read from the CLI and does not have a command directive is considered a input file. If there are two such occurrences on the command line, the precedence will be input file first, and output  ? file second ( i.e., bcpp infile.cpp outfile.cpp lg ), a third such occurrence will generate a error message. If no output file is presented, its assumed output is via the standard output. This automatically turns off program output. Parameters entered on the command line will override parameters that have been read from the configuration file. Example:  ?  bcpp -fi input.cpp -f 2 -qb 5 -na -no -cc 60 > output.cpp Synopsis -fi input.cpp Input file = input.cpp -f 2 Function spacing = 2 -qb 2 Internal Queue Buffer = 5 -na Remove non-ascii chars -no Suppress program output -cc 60 Comments that appear on same line as code will be placed in column 60. > output.cpp Output of program is redirected to ` `   "output.cpp" 0*0*0*  ?  Ch Page >5< K(# K(# A configuration file can be used to specify most of the nonchanging elements in reformatting of code. The configuration file consists of some fairly lengthy words that are used to explain the output style of the code. However setting these parameters is very easy, they basically consist of two types, Boolean, or Integer types. Using your favorite text editor, you can change the following within the configuration file ... The following parameters will be contained within the  ? configuration file (default is bcpp.cfg ). The program will attempt to read the default configuration file at the program  ?5 source (i.e. which path bcpp was run). Using the -fnc option you can define a custom configuration file name, and path from the CLI. Integer Type Ranges : 0 - 5000 Boolean Type Ranges : On, Yes, or Off, No  ? Function_Spacing : Integer This parameter specifies how many lines separate two functions. e.g., function_spacing = 2  2w CLI` `   ?? ` `  éf 2  ?  Use_Tabs : Boolean Specifies whether to use tabs in indenting code. e.g., use_tabs = no  2 CLI ` `   ?T ` ` t  (This will turn tabs on, default uses spaces)  ?) ` `  és  (Use tabs for indenting)pp2  ?  Indent_Spacing : Integer Specifies how many spaces to indent. This parameter also sets the  ?+! width of tabs. Bcpp considers the width of a tab to be the same as the width of an indent. E.G. indent_spacing = 4  2% CLI` `   ?& ` `  éi 4  &0*0*0*  ? Ch Page >6< K(# K(#   ?  Comments_With_Code : Integer Defines the column in which comments that appear after code on a line will be placed. e.g., comments_with_code = 50  2 CLI` `   ? ` `  écc 50 K(#    ?5  Comments_With_Nocode : Integer Defines the column in which comments that appear in a line will be placed. e.g., comments_with_nocode = 0 CLI  ? ` `  énc 0  ?  Indent_Preprocessor : Boolean  ? If true, bcpp will indent preprocessor lines to the indention of the C(++) code. If false, preprocessor lines will be in the first column. Unrecognized (i.e., nonstandard) preprocessor lines are always put into the first column.  ?  Indent_Exec_Sql : Boolean  ? If true, bcpp looks for embedded SQL statements (e.g., EXEC SQL), and formats them specially.  ?  Leave_Comments_NoCode : Boolean This options overrides the "Comments_With_Nocode" option. Setting  ? this option On will indent comments that do not occur on the same line as code to the same indention as code.  e.g., ` ` leave_comments_nocode = on CLI  ?8! ` `  énlcnc (Turn off Leave_Comments_NoCode)  ? " ` `  éylcnc (Turn on Leave_Comments_NoCode)  < "0*0*0*  ? Ch Page >7< K(# K(#   ?   NonAscii_Quotes_To_Octal : Boolean Use this option to change non-ASCII (non-printable) chars to octal notation if they lie within quotes. This parameter doesn't take effect unless either the Ascii_Chars_Only or Leave_Graphic_Chars parameters have been set. e.g., NonAscii_Quotes_to_Octal = no  25 CLI` `   ? ` `  énq  (Turn off nonascii chars in quotes to octal)  ? ` `  éyq  (Turn on nonascii chars in quotes to octal) K(# K(#  ?7 K(#  Leave_Graphic_Chars : Boolean Setting this parameter to yes will strip non-printable characters from the source file, but leave any characters that are IBM graphics alone. Any non-printable characters that lie within quotes will be transformed into octal/character notation, if NonAscii_Quotes_To_Octal parameter is set to True. E.G. leave_graphic_chars = yes  2 CLI` `   ? ` `  élg K(# K(#   ?4  Ascii_Chars_Only : Boolean Setting this parameter to yes will strip any non-printable, non-ASCII characters from the input file. Any non-printable characters that lie within quotes will be transformed into octal/character notation if NonAscii_Quotes_To_Octal is set to True. Comment out this parameter if you are using Leave_Graphic_Chars parameter, as this parameter will override it. e.g., ascii_chars_only = yes  2" CLI` `   ?i# ` `  éna  (Don't remove nonASCII characters)  ?>$ ` `  éya  (Yes remove nonASCII characters) K(# % 0*0*0*  ? ChPage >8< K(# K(#   ?X  Place_Brace_On_New_Line : Boolean When set to 'on' bcpp will place opening braces on new lines ("Pascal" style C coding), when set to 'off' bcpp will use "K&R" style C coding. Pascal style C coding: if (condition) { statements; } K&R style C coding: if (condition) { statements; } e.g., place_brace_on_new_line = on  2= CLI` `   ? ` `  ébnl (on )  ? ` `  ébcl (off)   ??  Program_Output : Boolean This parameter will stop output from the program corrupting output that may exit from the program via the standard output. If this parameter is set to off/no then no output is generated from the program, unless an error is encountered. The standard error is used to display any errors encountered while processing. E.G  2  ` ` program_output = off CLI  ? ` `  éno (default is generate output if possible, this will ` `  force output off)  ? ` `  éyo (turn on program output if possible) V 0*0*0*  ? ChPage >9< K(# K(#   ?X  Queue_Buffer : Integer Specifies what the internal memory requires will be in size of the line processing buffer. This is used for open brace relocation in Kernighan/Ritchie style. Extending this buffer to large amounts of memory will slow processing on small machines. e.g.,  2  ` ` Queue_Buffer = 2  2m CLI` `   ?5 ` `  éqb 2  ?  ; : Not Applicable Placing a semicolon in front of text makes everything after the semicolon a comment.  ?  Backup_File : Boolean This option will backup the input file to a file with the extension ".bac" and overwrite the input file with the reformatted version. e.g.,  2w ` ` backup_file hh#( = yes  2 CLI` `   ? ` `  éyb  (yes, backup input file if possible)  ? ` `  énb  (no, don't backup input file) y 0*0*0*  ? B Page >10< K(#   ?  Loading Configuration File : CLI only  ?e  Bcpp implements a configuration setting to allow custom file selection from a specific path/file defined by a user. e.g.,  ? ` ` bcpp input.cpphh#yb (read bcpp.cfg configuration file ` `  hh#(before processing CLI options)  2 ` ` bcpp fnc /bin/bcpp.cfg (load configuration file at(#(#K` `  hh#( said location)  2O CLI` `   ? ` `  éfnc  (use user defined)  ?|  Input File Name : CLI only  ?Q This option directs bcpp to read data at a given path, and file name. E.G ` ` bcpp fi input.cpp > output.cpp CLI  ? ` `  éfi  ?.  Output File Name : CLI only This defines the output file name that data is to be written to. e.g., ` ` Has to be like this, (in DOS, at least): ` ` bcpp -fo output.cpp < input.cpp ClI  ?C ` `  éfo ` `   ?  Online Help : CLI only Some online help which is brief but to the point exists within the program. The help lists all of the CLI commands available within the program. E.G bcpp h CLI bcpp ?  2%  bcpp hhh# x' 0*0*0*  ? B Page >11<  ? K(# 0  Configuration File Error Messages *  If you enter a command/parameter incorrectly within the configuration file, upon the executable program reading it, the program will generate a error message along with its line number. The following is an explanation of error messages that may occur while reading parameters within the configuration file.  ? X- Syntax Error After Key Word :  XError occurs because the character/word after a parameter was incorrect, or expected another keyword (e.g =, Yes, No, On, Off)   ? X- Range Error :  XError occurs when integer parameters have a invalid numeric setting (i.e., A number is not within 0 - 5000).   ? X- Expected Numeric Data :  XThis error occurs when alpha-numeric data is in place of numeric data for integer type parameters.   ? X- Can't Decipher :  XThe parameter at said line is not valid (i.e., not recognizable).  If any errors have occurred after reading the configuration file; the user is prompted with a [y/n] continuation prompt to either fix the configuration error(s) before processing, or continue with current set parameters. 4 0*0*0*  ? B Page >12<  ? K(#   Run Time Errors During Input File Processing  *   ?  X© Memory Allocation Failed :  XThe program was unable to allocate memory to process data. This error will stop processing of data.   ?M X© Error In Line Construction   ?" X© Expected Some Sort Of Code ! Data Type = ? :  XThis error is generated within the line construction process. The decoded line from the input file may be too indecipherable for this program. Find the line in the input file, and see if it can be altered so that processing can continue.(#  0*0*0*  ?  BPage >13<  ? K(# \ C(++) Beautifier Limitations  *   ?X This section highlights certain areas within code where bcpp will fail to reconstruct the output code to the desired style (although it may still be able to compile).  2 X -All code that is fed through this program should be in a compilable state. This means that there should be  ? closing braces that cancel out opening braces. Bcpp does no syntax checking at all upon the code, but reformats it according to open, closing braces, and a handful of key words for single line indentation.   2 X There is also a limitation on how far the movement of open braces can be processed. This is due to the  ? current design of the program ( this can fixed easily by  ?o extending the internal queue buffer size ), memory requirements, processing speed. Dynamic memory allocation is used extensively throughout the program, and may exceed current limits if certain conditions arise.  XThe example shows that the movements of the brace from the new line to the above code line will not take place as it would be out of scope for the program if the internal queue buffer is limited to 2 lines in size.  L0*0*0*  ? B Page >13< K(#  XExample of brace movement scope:   ?   Xif (a == b)  X// Brace will not be re-positioned  X{  XX` ` b = c;x` X}  Xif (a == b) // Brace will be re-positioned  X{  XX` ` b = c;x`  ?( X}   ?  XEnd Result    ?H  Xif (a == b)  X// Brace will not be re-positioned  X{  XX` ` b = c;x` X}  Xif (a == b){ // Brace will be re-positioned  XX` ` b = c;x`  ? X}   2 X -There is a constraint that a single line of code should only have one type of comment. If there are both C, and C++ existing on the same line then the line construction phase of the program will become confused, and generate a error message. The following line will produce a Line Construction Error message.  XExample of multiple comments.   ?   X/* C Comment */ a = b; // C++ Comment  XThe above line will generate an error. Remedy this by removing one type of comment, combine them, or place one on a new line.   ? B Page >15<  ? K(# " Contact Addresses  *  You can contact me via various online networks: ` ` Internet Address  ? ` `   tge@midland.co.nz  ?x ` `   steve@alpha.ocbbs.gen.nz ` ` Net Mail Via FidoNet (Dog Net)  ? ` `   Steven De Toni, ` `  "The Great Escape", ` `  Hamilton,  ?( ` `  New Zealand ` ` DemiMonde New Zealand National Mail Net Work  ? ` `   (see Dog Net) All else fails, send me snail mail at:  ? ` `  17 Garden Heights Ave,  ?h ` ` Melville, ` ` Hamilton,  ? ` ` New Zealand Thomas Dickey can be reached at  ? ` `  dickey@clark.net  ? Special thanks goes out to Glyn Webster for proof reading my manual, and testing my program.  ?  Thanks to Justin Slootsky for his input, and changes for this version. All _grammatical_ errors within this document are there for your enjoyment. ;-)