1 #ifndef _CONFIG_HEADER
2 #define _CONFIG_HEADER
3 
4 // $Id: config.h,v 1.16 2021/01/08 23:25:01 tom Exp $
5 // Program C(++) beautifier Written By Steven De Toni ACBC 11 10/94
6 //
7 // This file contains prototypes, constants, enum declarations for the
8 // source file config?.cpp. Prototypes declared can read data from a
9 // text file a line at a time, and able to read parameters from a
10 // configuration file.
11 
12 #include <stdio.h>          // FILE Structure
13 
14 // Commonly-used characters that are awkward to represent
15 const char NULLC = '\0';
16 const char TAB = '\t';
17 const char LF = '\n';
18 const char CR = '\r';
19 const char SPACE = ' ';
20 const char SEMICOLON = ';';
21 const char POUNDC = '#';
22 const char L_CURL = '{';
23 const char R_CURL = '}';
24 const char L_PAREN = '(';
25 const char R_PAREN = ')';
26 const char DQUOTE = '"';
27 const char SQUOTE = '\'';
28 const char ESCAPE = '\\';
29 
30 // This structure is used to store the users settings that are read from a
31 // configuration file.
32 struct Config
33 {
34   int     numOfLineFunc  ;  // number of lines between functions
35   int     tabSpaceSize   ;  // number of spaces a tab takes up {4}
36   bool    useTabs        ;  // true = use tabs in indenting, false = use spaces
37   int     posOfCommentsWC;  // position of comments on line with code
38   int     posOfCommentsNC;  // position of comments on line
39   bool    keepCommentsWC ;  // true = keep comments inline with code
40   bool    leaveCommentsNC;  // true = don't change the indentation of comments with code.
41   bool    quoteChars     ;  // change non-ASCII chars in quotes to octal notation
42   int     deleteHighChars;  // 0  = no check         , 1 = delete high chars,
43                             // 2  = don't delete graphics chars
44   bool    topBraceLoc    ;  // true = place on new line, false = at end of code
45   bool    braceLoc       ;  // true = place on new line, false = at end of code
46   bool    output         ;  // Set this true for normal program output
47   int     queueBuffer    ;  // Set the number if lines to store in memory at a time !
48   bool    backUp         ;  // backup the original file, have output file become input file name !
49   bool    indentPreP     ;  // indent preprocessor controls to match code
50   bool    indent_sql     ;  // indent embedded SQL statements
51   bool    braceIndent    ;  // true = indent trailing brace, false = don't
52   bool    braceIndent2   ;  // true = indent both braces, false = don't
53 };
54 
55 
56 // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
57 // Allocates memory for line in file, and places that the data in it.
58 // pInFile = the file handle to use when reading the file !
59 // EndOfFile variable is used to test if the end of the file has been reached.
60 //           When  this is true, the variable is changed to -1
61 //
62 // A string is returned with the contents the current line in the file,
63 // memory is allocated via the ReadLine routine, and should be deleted
64 // when not needed !
65 char* ReadLine (FILE *pInFile, int& EndOfFile);
66 
67 
68 // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
69 // This function is used to load the users configuration from a file.
70 //
71 // Parameters:
72 // pConfigFile  : Pointer to a FILE structure/handle that contains the
73 //                configuration data.
74 // userSettings : Config structure that will contain the user settings.
75 //
76 // Return Values:
77 // int          : Returns the number of errors encountered when reading the
78 //                configuration file.
79 // userSettings : This variable is altered to the user settings read from the
80 //                config file.
81 //
82 extern int SetConfig (FILE* pConfigFile, Config& userSettings);
83 
84 // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
85 // This function is used to show the users configuration
86 //
87 // Parameters:
88 // userSettings : Config structure that contains the user settings.
89 //
90 // Return Values:
91 // int          : Returns the number of errors encountered when reading the
92 //                configuration file.
93 //
94 extern int ShowConfig(Config& userSettings);
95 
96 #endif
97