                               SQCBW
                                 


                   C/C++ Source Code Beautifier

                          for MS-Windows



                      Version 2.31 June 1996

             Copyright 1990-1996 Software-Quelle GmbH















                 Software-Quelle Datentechnik GmbH

                        Erfurter Strasse 15

                          D-85386 Eching

                              Germany



                     Telefax: +49 89 327133 36

                      Compuserve: 100034,2365

               Internet: 100034.2365@compuserve.com

1   Introduction

SQCBW  for MS-Windows indents the source code lines of your  C/C++
programs  according to the program's structure. The use  of  SQCBW
will  spare you a lot of trouble and time, if you used  to  indent
your  source code by hand until now. The example in chapter  shows
the standard result.

To install SQCBW, execute SETUP.EXE and select the directory where
SQCBW shall reside.

If you execute SQCBW without source-file(s) parameters (see
chapter 3.2), SQCBW will show its "Main Window" (see chapter 2.1),
which enables you to select source-files and start the beautifying
process.

If you execute SQCBW with source-file(s) parameters, SQCBW will
beautify the corresponding files and will not show its "Main
Window", unless acknowledge is requested or an error occurred
while processing the source files.

If you wish to change the behavior of SQCBW, select the "Options"
menu item; SQCBW will open the "Options Window" (see chapter 2.2),
which enables you to enter the options you prefer.

.

2   Description of the windows

2.1 Main Window

Use the Main Window to select the file(s) you want to beautify:

Edit Field / ButtonMeaning

Source File(s)     one or more path(s) to the source file(s),
                   separated by SPACE or TAB characters; the
                   path(s) may be partially qualified, that is the
                   directory as well as the filename part may
                   contain the wildcard characters * and ? . SQCBW
                   will update all files corresponding to Source
                   File(s).

                   Example: c:project\*\source\*.c

Select ...         click the Select button to open a file
                   selection box:

                   *  within the file selection box, select the
                       path (drive, directory and filename) to the
                       file to be beautified

                   *  close the file selection box, so the
                       selected path will be copied to the edit
                       field named Source File(s)

Search Subdirectories   when this box is checked, SQCBW will
                   search n Levels of subdirectories to find
                   source files corresponding to Source File(s)

Beautify           click the Beautify button to beautify the files
                   corresponding to Source File(s)

Exit               click the Exit button to terminate SQCBW

Info Messages      SQCBW prints a list of information and error
                   messages like the following while beautifying
                   the source files:

Message                        Meaning

source.C                       name of the currently beautified
                               source file

access error on file: ...      the file cannot be opened / read /
                               written / deleted

file ... not updated           the source file has not been
                               updated

non matching brackets/braces at line ..  SQCBW found a } / ) / ]
                               with no matching { / ( / [

missing brackets/braces at end of file

non matching #else / #endif at line ...  SQCBW found a #else /
                               #endif
                               with no matching #ifdef / #if

missing #endif at end of file

2.2 Options Window

Use the Options Window to specify the behavior of SQCBW;
this window will be shown if you select "Options" from the menu
bar:

Group / Edit Field / Button  Meaning

Indentation group  defines the indentation of statements and
                   comments
                   (see chapter 4)

       Statements, Comments    the additional indentation of all
                           lines between curly braces { } or a
                           single statement after if, else, for,
                           do.

                          Note: Compiler directives (starting
                           with a # sign) will always be left
                           aligned.

       Block Delimiters   the additional indentation of curly
                           braces { }.

       Case Labels        the additional indentation of the case
                           labels within switch statements.

Tab Settings group  defines the use of TAB characters

       Tab Stops          number of columns represented by a TAB
                           character; every n leading spaces of a
                           line will be replaced by a single TAB
                           character

       Use Tabs           when checked, leading spaces will be
                           replaced by TAB characters, if possible

       Use Spaces         when checked, only space characters
                           will be used to indent the lines

Comments group defines the indentation of comments

       Indent Comments    when checked, comments will be indented
                           like statements; otherwise, comments
                           will keep its place.

       Additional Indentation For
       Continuation Lines all continuation lines of a comment,
                           that spreads over multiple lines, will
                           be indented by n columns relative to
                           the start column of that comment.

Source Files group  defines the handling of source files

       Save Before Update when checked, each source file will be
                           saved before update

       Filename Extension defines the filename extension for the
                           backup file

       Prompt Before Update    when checked, you will be prompted
                           before updates are written to the
                           source file

Ok                 click this button to close the options window

Store              click this button to store the changed options
                   to the file SQCBW.INI (see chapter 3.1) and
                   close the options window

Restore            click this button to restore the options from
                   the file SQCBW.INI

Cancel             click this button to close the options window
                   and ignore any modifications

3   Options

3.1 Initialization file

The initialization file SQCBW.INI contains the default values that
specify the behavior
of SQCBW; SQCBW.INI is read at startup time.

You may change the content of this file using a text editor while
SQCBW is not running,
or from the "Options Window" (see chapter 2.2) by clicking the
Store button.

SQCBW.INI contains the following sections and items:

Section / Item     Meaning

[Options]

IndentStep=n       n stands for the additional indentation of
                   all lines between curly braces { }
                   or
                   a single statement after if, else, for, etc.

                   Note: Compiler directives (starting with a #
                   sign) will always be left aligned.

IndentBlockDelim=n n stands for the additional indentation of
                   curly braces { }.

IndentCase=n       n stands for the additional indentation of the
                   case labels within switch statements.

TabStep=n          n stands for the number of columns represented
                   by a tab character; every n leading spaces in
                   the line will be replaced by a single tab
                   character, if UseTabs=1 (see below)

UseTabs=1          1 = tab characters will be used to indent the
                   lines;
                   0 = spaces will be used to indent the lines

Ack=1              1 = you will be prompted before updates are
                   written to a source file;
                   0 = updates will be written to a source file
                   without prompting

CommentIndent=1    1 = comments will be indented like statements;
                   0 = comments keep its place.

CommentContIndent=nall continuation lines of a comment, that
                   spreads over multiple lines, will be indented
                   by n columns relative to the start column of
                   that comment (only if CommentIndent=1).

Backup=1           1 = a source file will be saved to a file with
                   the filename extension BackupExt before update;
                   0 = a source file will not be saved before
                   update.

BackupExt=bak      filename extension for backup files (if
                   Backup=1).

SearchDir=0        0 = subdirectories will not be searched for
                   source files;
                   1 = subdirectories will be searched up to
                   SearchDirMax levels

SearchDirMax=n     n stands for the number of levels if
                   SearchDir=1


[Window]           Position of the "Main Window"

Top=n

Left=n

Bottom=n

Right=n



[Installation]

Version=2.31       the version number

3.2 Command-Line Options

If you execute SQCBW with command-line parameters, use the syntax
described below. SQCBW will process all source files according to
the source-file(s) parameters and will not show the "Main Window"
(see chapter 2.1) unless acknowledge is requested or an error
occurs. The command-line options will override the options read
from the initialization file SQCBW.INI

Command-Line Syntax:

CBW [ /a ][ /bn | /b:ext ][ /cn | /ci:n ][ /i:n ][ /ib:n ][ /ic:n
][ /s:n ][ /tn | /t:n ][ source-file(s) ... ]

The square brackets [] enclose optional parameters; the vertical
bar | separates alternatives.

Parameter          Meaning

source-file(s)     one or more path(s) to the source file(s),
                   separated by SPACE or TAB characters; the
                   path(s) may be partially qualified, that means
                   the directory part as well as the filename part
                   may contain wildcard characters * and ? . SQCBW
                   will update all files corresponding to source-
                   file(s).

                   Example: c:project\*\source\*.c

/a                 you will be prompted before updates are written
                   to a source file

/bn                a source file will not be saved before update

/b:ext             filename extension for backup files

/cn                comments keep its place

/ci:n              all continuation lines of a comment, that
                   spreads over multiple lines, will be indented
                   by n columns relative to the start column of
                   that comment.

/i:n               n stands for the additional indentation of all
                   lines between curly braces { } or a single
                   statement after if, else, for, etc.

                   Note: Compiler directives (starting with a #
                   sign) will always be left aligned.

/ib:n              n stands for the additional indentation of
                   curly braces { }.

/ic:n              n stands for the additional indentation of the
                   case labels within switch statements.

/s:n               SQCBW searches subdirectories up to a level of
                   n to find source files corresponding to the
                   source-file(s) parameter. This parameter must
                   precede the corresponding source-file(s)
                   parameter. If this parameter is omitted,
                   subdirectories are not searched
                   Example:
                   /s:2 c:\msvc\samples\memo*.c /s:0
                   c:\msvc\samples\*help*\*.c
                   The files memo*.c will be searched through 2
                   levels of subdirectories; within the
                   directories like *help* no subdirectories will
                   be searched.

/t:n               n stands for the number of columns represented
                   by a tab character; every n leading spaces in
                   the line will be replaced by a single tab
                   character

/tn                leading spaces in a source code line will not
                   be replaced by TAB characters.

3.3 Beautify a source file from your C development system

If you want to beautify a single source file from Microsoft Visual
C ++, perform the following actions:

1)     choose "Tools..." from the "Options" menu and add a tool
       like the following:

       Command Line:      C:\SQCBW\CBW.EXE

       Menu Text:         SQC&BW

       Arguments:         $File

2)     choose "SQCBW" from the "Tools" menu while the source
       window is active, so the source file will be beautified.

4   Example

The sample shows a source file that has been beautified using the
following options:

IndentStep=4
TabStep=8
UseTabs=1
CommentIndent=1
CommentContIndent=3


int proc (int par_1,
	  char * par_2)
{
    if (   (a == b)
	|| (c == d))
    {
	switch (a)
	{
	case 1:
	    c = up1 (a,
		     b,
		     up2 (c,
			  d));
	    break;
	case 2:
	    /* this is a
	       multi line comment */
	    break;
	default:
	    {
		int n;		/* loop counter */
		for (n = 10;
		     n > 0;
		     n--)
		{
		    array [n
			   -1] = 0;
		}
	    }
	}
#ifdef WINDOWS
	wsprintf (szMessage, szFormat, iParam);
	if (MessageBox (hWnd, szMessage, ...))
	{
#else
	printf (szMessage, szFormat, iParam);
	if (fgets (user_input, ...))
	{
#endif
	    /* continuation after user response */
	    ...
	}  
    }
}



5   Contents of the SQCBW Software Package

The SQCBW Software Package consists of a self-extracting
executable file:

SQCBW.EXE      contains the executable files, the samples, and the
               documentation (ASCII TXT file and DOC file for "MS
               Word for Windows")

5.1 Basic information, documentation

Execute SQCBW.EXE within an empty directory to get the following
files and subdirectories:



Filename         Description

README.1ST       Introduction to the use of SQCBW

FILE_ID.DIZ      Short description

SQCBW.DOC        Documentation File (DOC file for "MS Word for
                 Windows")

SQCBW.TXT        Documentation File (ASCII TXT file)

LICENSE.TXT      License Conditions for the use of SQCBW (ASCII
                 TXT file)

REG.FRM          Registration Form for purchasing a license for
                 the use of SQCBW (ASCII TXT file)

SITE.FRM         Registration Form for purchasing a multi-user
                 license for the use of SQCBW (ASCII TXT file)

SETUP.EXE        MS-Windows based executable file;
                 use to install SQCBW on the hard disk



5.2 Text files in German language

The directory GERMAN contains some of the above files in German
language:



Filename         Description

REG_GER.FRM      Registration Form (ASCII TXT file) for
                 purchasing a license for the use of SQCBW

MREG_GER.FRM     Registration Form (ASCII TXT file) for
                 purchasing a multi-user license for the use of
                 SQCBW



5.3 Executable File and Initialization File

The directory BIN contains the files:



Filename         Description

CBW.EXE          MS-Windows based executable file for SQCBW

SQCBW.INI        Initialization File for SQCBW

SQCBW.HLP        Help File for SQCBW



5.4 Samples

The directory SAMPLES contains the file:



Filename         Description

SAMPLE.C         sample file



_______________________________
.3rd party rights:

This document makes reference to a number of third-party products.
All copyrights, trademarks and reserved rights held in these
products are acknowledged.

