Change-Log for BCPP
-- $Id: CHANGES,v 1.51 2021/01/08 23:25:50 tom Exp $

        + eliminate archaic "Boolean" enum
        + updated configure script macros
        + update config.guess, config.sub

        + remove obsolete makefile-rules
        + updated configure script macros
        + update config.guess, config.sub

        + updated configure script macros
        + update config.guess, config.sub

        + fix an off-by-one in limit-checking for command-line option values
          (patch by Miriam Ruiz).
        + updated configure script macros
        + update config.guess, config.sub

        + updated configure script macros
        + update config.guess, config.sub

        + add rpm script.
        + fixes for DESTDIR in makefiles
        + add cb++ script to install-rules
        + integrate patch from Debian package, to search for bcpp.cfg in
          user's home-directory and optionally a compile-time specific
        + add dpkg script from Debian package, for testing.
        + updated configure script macros
        + drop, using "mkdir -p"
        + update config.guess, config.sub

        + updated configure scripts
        + improve exec-sql parser, detecting inline comments beginning with
        + fix a case where multi-line indent was set during a #define, and
          not reset on completion of the #define, causing the following code
          to be indented.
        + check for braces or preprocessor-level before indenting comments
          which are on a line without code.
        + improve config-file parser, which used strstr...
        + add keep_code_with_comment option, to merge inline-comments with
          the code immediately following, rather than merging (for example)
          with trailing "}" (request by Daniel Lin).

        + 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.

        + fixes to build with g++ 2.95.3
        + add .SUFFIXES rule to build with Solaris make.

        + 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).

        + 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).
        + updated configure script, fixes a check that added some gcc warning
          options which are not recognized by g++.

        + 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

        + 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

        + 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).

        + 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.

        + 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.

        + 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 <string.h> 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

        + 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

        + 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

        + add txtdocs/manual.txt to distribution, updated wpdocs/manual.doc

        + 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

        + 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

        + rewrote ReadLine so it doesn't use fseek/ftell (which is a porting

        + 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.

        + 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.

        + 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

        + updated 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.

        + execsql.cpp:  refined hanging-indents to account for statements other
          than the two block-styles we use

        + make SqlStruct a class

        + 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

        + 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

        + 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

        + remove IndentStruct.firstPass logic, since hanging.cpp does it better

        + add pBFlag to OutputStruct to use in hanging.cpp

        + 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

        + 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

        + 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).

        + propagate parse-state via InputStruct to OutputStruct.

        + correct potential indention of continued-string fragments.

        + 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

        + 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

        + 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

        + 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.,

        + changed allocation scheme of lineState

        + drop CComments param of DecodeLine, since pLineState contains proper

        + 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

        + 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!).

        + 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,

        + better logic in resetSingleIndent(), to reset all pending

        + 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.