pcg@aber-cs.UUCP (Piercarlo Grandi) (01/06/90)
These patches to GNU indent 5.9/5.11 are very minor. It is assumed that the header file "indent_globs.h" is renamed to "globs.h", and that the manual "indent.texinfo" is renamed to "indent.txi", as these names are too long for System V plus RCS. A major future change will be to modify pr_comment's behaviour on option -nsc; currently the body of the comment is indented by three spaces fixed, while it should be indented instead by comment indent or by the general indent. This is a summary of the main changes: args.c Two new options are available, -el<N> to set how many levels of label exdentation should be done (it was previosuly fixed at 2), and -neu to disable exdentation of unary operators in declarations. The option -T now also optionally accepts before the new keyword name a single digit for its type. The default, by the way, was wrong. Look at the beginning of lexi.c for the codes. The new option -pg defines my own indentation style, which is (of course) very nice. It is somewhat similar to the default one. globs.h Added the new two options -el and -eu. Added redefinition of certain common library functions if running under USG. indent.c Disabled the facility by which if indent is called with two parameters the second receives the indented text of the first. I have stupidly done 'indent a.[ch]' too many times... Support for option -eu has been added, and the default extension of the backup is now ~ and not .BAK, which is too long. For consistency, now option -npcs also removes the blank after commas. lexi.c A nasty bug in addkey() has been corrected. Now adding new keywords is safe :->. Joking of course... =================================================================== RCS file: args.c,v retrieving revision 5.9 diff -c -r5.9 args.c *** /tmp/,RCSt1a03000 Thu Dec 28 13:17:47 1989 --- args.c Thu Dec 28 12:36:35 1989 *************** *** 27,33 **** * here as well. */ ! #include "indent_globs.h" #include <ctype.h> #include "version.h" --- 27,33 ---- * here as well. */ ! #include "globs.h" #include <ctype.h> #include "version.h" *************** *** 78,83 **** --- 78,85 ---- static int exp_d = 0; static int exp_eei = 0; static int exp_ei = 0; + static int exp_el = 0; + static int exp_eu = 0; static int exp_fbc = 0; static int exp_fbx = 0; static int exp_fb = 0; *************** *** 93,98 **** --- 95,101 ---- static int exp_lp = 0; static int exp_l = 0; static int exp_pcs = 0; + static int exp_pg = 0; static int exp_psl = 0; static int exp_pro = 0; static int exp_ps = 0; *************** *** 182,187 **** --- 185,192 ---- {"d", PRO_INT, 0, ONOFF_NA, &unindent_displace, &exp_d}, {"eei", PRO_BOOL, false, ON, &extra_expression_indent, &exp_eei}, {"ei", PRO_BOOL, true, ON, &else_if, &exp_ei}, + {"el", PRO_INT, 2, ONOFF_NA, &label_offset, &exp_el}, + {"eu", PRO_BOOL, true, ON, &exdent_unary, &exp_eu}, {"fbc", PRO_FONT, 0, ONOFF_NA, (int *) &blkcomf, &exp_fbc}, {"fbx", PRO_FONT, 0, ONOFF_NA, (int *) &boxcomf, &exp_fbx}, {"fb", PRO_FONT, 0, ONOFF_NA, (int *) &bodyf, &exp_fb}, *************** *** 218,223 **** --- 223,229 ---- {"ndj", PRO_BOOL, false, OFF, &ljust_decl, &exp_dj}, {"neei", PRO_BOOL, false, OFF, &extra_expression_indent, &exp_eei}, {"nei", PRO_BOOL, true, OFF, &else_if, &exp_ei}, + {"neu", PRO_BOOL, true, OFF, &exdent_unary, &exp_eu}, {"nfc1", PRO_BOOL, true, OFF, &format_col1_comments, &exp_fc1}, {"nfca", PRO_BOOL, true, OFF, &format_comments, &exp_fca}, {"nlp", PRO_BOOL, true, OFF, &lineup_to_parens, &exp_lp}, *************** *** 230,235 **** --- 236,244 ---- {"nss", PRO_BOOL, false, OFF, &space_sp_semicolon, &exp_ss}, {"nv", PRO_BOOL, false, OFF, &verbose, &exp_v}, {"pcs", PRO_BOOL, false, ON, &proc_calls_space, &exp_pcs}, + {"pg", PRO_SETTINGS, 0, ONOFF_NA, + (int *)"-bacc\0-bacc\0-bad\0-bap\0-bbb\0-nbc\0-bl\0-bs\0-nce\0-cp1\0\ + -di24\0-el4\0-neu\0-nlp\0-npsl\0-nsc\0-nv\0", &exp_pg}, {"psl", PRO_BOOL, true, ON, &procnames_start_line, &exp_psl}, {"ps", PRO_BOOL, false, ON, &pointer_as_binop, &exp_ps}, {"sc", PRO_BOOL, true, ON, &star_comment_cont, &exp_sc}, *************** *** 371,383 **** break; case PRO_KEY: ! if (*param_start == 0) ! goto need_param; ! { ! register char *str = (char *) xmalloc(strlen(param_start) + 1); ! strcpy(str, param_start); ! addkey(str, 4); ! } break; case PRO_BOOL: --- 380,399 ---- break; case PRO_KEY: ! { ! short unsigned type = 5; ! char *key; ! ! if (*param_start >= '0' && *param_start <= '8') ! type = *param_start++ - '0'; ! ! if (*param_start == 0) ! goto need_param; ! ! key = xmalloc(strlen(param_start)+2); ! strcpy(key,param_start); ! addkey(key, type); ! } break; case PRO_BOOL: =================================================================== RCS file: globs.c,v retrieving revision 5.9 diff -c -r5.9 globs.c *** /tmp/,RCSt1a03000 Thu Dec 28 13:17:48 1989 --- globs.c Tue Dec 26 19:26:20 1989 *************** *** 15,27 **** * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ ! #include "indent_globs.h" /* Like malloc but get error if no storage available. */ char * xmalloc (size) ! long size; { register char *val = (char *) malloc (size); if (!val) --- 15,27 ---- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ ! #include "globs.h" /* Like malloc but get error if no storage available. */ char * xmalloc (size) ! unsigned size; { register char *val = (char *) malloc (size); if (!val) *************** *** 37,43 **** char * xrealloc (ptr, size) char *ptr; ! long size; { register char *val = (char *) realloc (ptr, size); if (!val) --- 37,43 ---- char * xrealloc (ptr, size) char *ptr; ! unsigned size; { register char *val = (char *) realloc (ptr, size); if (!val) =================================================================== RCS file: globs.h,v retrieving revision 5.9 diff -c -r5.9 globs.h *** /tmp/,RCSt1a03000 Thu Dec 28 13:17:49 1989 --- globs.h Mon Dec 25 16:25:28 1989 *************** *** 38,45 **** char *mymemcpy (); #define BACKSLASH '\\' ! #define label_offset 2 /* number of levels a label is placed to left ! * of code */ /* Initial size of internal buffers (they are extended as necessary). */ #define bufsize 1000 --- 38,44 ---- char *mymemcpy (); #define BACKSLASH '\\' ! /* Initial size of internal buffers (they are extended as necessary). */ #define bufsize 1000 *************** *** 172,178 **** --- 171,185 ---- * from save_com */ char *be_save; /* similarly saved value of buf_end */ + #ifdef USG + #define index strchr + #define rindex strrchr + #define bcopy(a,b,n) memcpy((b),(a),(n)) + #define bzero(a,n) memset((a),'\0',(n)) + #endif + int exdent_unary; + int label_offset; int pointer_as_binop; int blanklines_after_declarations; int blanklines_before_blockcomments; =================================================================== RCS file: indent.c,v retrieving revision 5.9 diff -c -r5.9 indent.c *** /tmp/,RCSt1a03000 Thu Dec 28 13:17:51 1989 --- indent.c Thu Dec 28 13:16:30 1989 *************** *** 30,36 **** static char sccsid[] = "@(#)indent.c 5.11 (Berkeley) 9/15/88"; #endif /* not lint */ ! #include "indent_globs.h" #include <ctype.h> char *in_name = 0; /* will always point to name of input --- 30,36 ---- static char sccsid[] = "@(#)indent.c 5.11 (Berkeley) 9/15/88"; #endif /* not lint */ ! #include "globs.h" #include <ctype.h> char *in_name = 0; /* will always point to name of input *************** *** 168,193 **** read_file(in_name); continue; } else if (out_name == 0) { /* we have the output file */ out_name = argv[i]; /* remember name of output file */ continue; } ! fprintf(stderr, "indent: unknown parameter: %s\n", argv[i]); exit(1); } else set_option(argv[i],1); ! } /* end of for */ if (in_name == 0) { if (use_stdinout) { read_stdin (); in_name = "Standard input"; } else { ! fprintf(stderr, ! "indent: usage: indent file [ outfile ] [ options ]\n"); exit(1); } } if (out_name) { if (strcmp(in_name, out_name) == 0) { /* attempt to overwrite --- 168,196 ---- read_file(in_name); continue; } + #ifdef undef else if (out_name == 0) { /* we have the output file */ out_name = argv[i]; /* remember name of output file */ continue; } ! #endif ! fprintf(stderr, "indent: excess parameter: %s\n", argv[i]); exit(1); } else set_option(argv[i],1); ! } ! /* end of for */ if (in_name == 0) { if (use_stdinout) { read_stdin (); in_name = "Standard input"; } else { ! fputs("usage: indent [options] [file]\n",stderr); exit(1); } } + #ifdef undef if (out_name) { if (strcmp(in_name, out_name) == 0) { /* attempt to overwrite *************** *** 201,206 **** --- 204,210 ---- exit(1); } } + #endif if (output == 0) { if (use_stdinout || troff) *************** *** 657,663 **** * in a declaration, we * should indent this * token */ ! while ((e_code - s_code) < (dec_ind - (token_end-token))) { check_code_size; *e_code++ = ' '; /* pad it */ } --- 661,667 ---- * in a declaration, we * should indent this * token */ ! while ((e_code - s_code) < (dec_ind - exdent_unary)) { check_code_size; *e_code++ = ' '; /* pad it */ } *************** *** 793,799 **** parser_state_tos->just_saw_decl--; if (parser_state_tos->in_decl && s_code == e_code && !parser_state_tos->block_init) ! while ((e_code - s_code) < (dec_ind - 1)) { check_code_size; *e_code++ = ' '; } --- 797,803 ---- parser_state_tos->just_saw_decl--; if (parser_state_tos->in_decl && s_code == e_code && !parser_state_tos->block_init) ! while ((e_code - s_code) < (dec_ind - exdent_unary)) { check_code_size; *e_code++ = ' '; } *************** *** 998,1004 **** parser_state_tos->in_parameter_declaration = 1; if (s_code != e_code) { dump_line(); ! parser_state_tos->want_blank = 0; } } if (parser_state_tos->in_parameter_declaration && indent_parameters && parser_state_tos->dec_nest == 0) { --- 1002,1008 ---- parser_state_tos->in_parameter_declaration = 1; if (s_code != e_code) { dump_line(); ! parser_state_tos->want_blank = false; } } if (parser_state_tos->in_parameter_declaration && indent_parameters && parser_state_tos->dec_nest == 0) { *************** *** 1106,1111 **** --- 1110,1116 ---- } parser_state_tos->want_blank = true; + #ifdef undef /* If the token is va_dcl, it appears without a semicolon, so we need to pretend that one was there. */ if ((token_end - token) == 6 *************** *** 1117,1122 **** --- 1122,1128 ---- parse(semicolon); force_nl = true; } + #endif break; case period: /* treat a period kind of like a binary *************** *** 1126,1136 **** break; case comma: ! parser_state_tos->want_blank = (s_code != e_code); /* only put blank after comma ! * if comma does not start the ! * line */ if (parser_state_tos->in_decl && is_procname == 0 && !parser_state_tos->block_init) ! while ((e_code - s_code) < (dec_ind - 1)) { check_code_size; *e_code++ = ' '; } --- 1132,1142 ---- break; case comma: ! /* only put blank after comma if comma does not start the line */ ! parser_state_tos->want_blank = ! proc_calls_space && (s_code != e_code); if (parser_state_tos->in_decl && is_procname == 0 && !parser_state_tos->block_init) ! while ((e_code - s_code) < (dec_ind - exdent_unary)) { check_code_size; *e_code++ = ' '; } *************** *** 1400,1406 **** /* * copy input file to backup file if in_name is /blah/blah/blah/file, then ! * backup file will be "file.BAK" then make the backup file the input and * original input file the output */ bakcopy() --- 1406,1412 ---- /* * copy input file to backup file if in_name is /blah/blah/blah/file, then ! * backup file will be "file~" then make the backup file the input and * original input file the output */ bakcopy() *************** *** 1423,1429 **** if (*p == '/') p++; bakfile = xmalloc(40 + strlen(p)); ! sprintf(bakfile, "%s.BAK", p); errbuf = xmalloc(80 + strlen(p)); sprintf(errbuf,"indent: %s",bakfile); --- 1429,1435 ---- if (*p == '/') p++; bakfile = xmalloc(40 + strlen(p)); ! sprintf(bakfile, "%s~", p); errbuf = xmalloc(80 + strlen(p)); sprintf(errbuf,"indent: %s",bakfile); =================================================================== RCS file: indent.txi,v retrieving revision 5.9 diff -c -r5.9 indent.txi *** /tmp/,RCSt1a03000 Thu Dec 28 13:17:56 1989 --- indent.txi Thu Dec 28 12:33:35 1989 *************** *** 49,55 **** The format of the @code{indent} command is: @example ! indent [@var{input-file} [@var{output-file}]] [@var{options}] @end example Options begin with @samp{-}, and can appear anywhere in the command. --- 49,56 ---- The format of the @code{indent} command is: @example ! indent [@var{options}] [@var{input-file}] ! indent -st [@var{options}] @end example Options begin with @samp{-}, and can appear anywhere in the command. *************** *** 60,96 **** C program to @file{munch.out}, you would use the command @example ! indent munch.c munch.out @end example ! If an input file is specified but no output file is specified, the formatted file is written back into the input file, and a backup copy of the input file is written in the current directory. The name of the ! backup copy is formed by adding @samp{.BAK} to the end of the name of the input file. For example: @example ! indent -br test/munch.c -l85 @end example This will indent the program @file{test/munch.c} using the @samp{-br} and @samp{-l85} options, write the output back to @file{test/munch.c}, and copy the original contents of @file{test/munch.c} to ! @file{munch.c.BAK} in the current directory. ! Note that it does not work to type @code{indent *.c} to indent all the ! programs in a directory. The shell expands this command into a command ! such as @code{indent foo.c bar.c baz.c}. If there are more than 2 files ! in the current directory ending in @samp{.c}, you will get an error ! message; if there are exactly 2 such files you will overwrite the second ! one with the indented version of the first. The exact command to indent ! all the C programs in the current directory depends on what shell you ! are using; for @samp{bash} or similar shells you would use the following: ! ! @example ! for file in *.c; do ! indent $file ! done @end example To cause @code{indent} to read from standard input and write to standard --- 61,94 ---- C program to @file{munch.out}, you would use the command @example ! indent -st <munch.c >munch.out @end example ! If an input file is specified, the formatted file is written back into the input file, and a backup copy of the input file is written in the current directory. The name of the ! backup copy is formed by adding @samp{~} to the end of the name of the input file. For example: @example ! indent -br -l85 test/munch.c @end example This will indent the program @file{test/munch.c} using the @samp{-br} and @samp{-l85} options, write the output back to @file{test/munch.c}, and copy the original contents of @file{test/munch.c} to ! @file{munch.c~} in the current directory. ! Note that it does not work to type @code{indent *.c} to indent all ! the programs in a directory. The shell expands this command into a ! command such as @code{indent foo.c bar.c baz.c}. If there is more ! than one file in the current directory ending in @samp{.c}, you will ! get an error message. The exact command to indent all the C programs ! in the current directory depends on what shell you are using; for ! @samp{bash} or similar shells you would use the following: ! ! @example ! for file in *.c; do indent $file; done @end example To cause @code{indent} to read from standard input and write to standard *************** *** 124,131 **** University of California at Berkeley, which originally wrote @code{indent}. The indent defaults are: @example ! -nbap -nbad -nbbb -bc -br -c33 -cd33 -cdb -ce -ci4 -cli0 -d4 -di16 ! -fc1 -i4 -ip4 -l75 -lp -npcs -psl -sc -nsob -fca -cp33 -nss @end example The Kernighan & Ritchie style is the one used in their influential book --- 122,129 ---- University of California at Berkeley, which originally wrote @code{indent}. The indent defaults are: @example ! -nbap -nbad -nbbb -bc -br -c33 -cd33 -cdb -ce -ci -cli0 -cp33 ! -d4 -di16 -fc1 -i4 -ip4 -l75 -lp -npcs -psl -sc -nsob -fca -nss @end example The Kernighan & Ritchie style is the one used in their influential book *************** *** 134,140 **** of options: @example -nbad -bap -nbbb -nbc -br -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 ! -nfc1 -i4 -ip0 -l75 -lp -npcs -npsl -nsc -nsob -nfca -cp33 -nss @end example Kernighan & Ritchie do not put comments to the right of code in the same column at all times (nor do they use only one space to the right of the --- 132,138 ---- of options: @example -nbad -bap -nbbb -nbc -br -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 ! -el2 -eu -nfc1 -i4 -ip0 -l75 -lp -npcs -npsl -nsc -nsob -nfca -cp33 -nss @end example Kernighan & Ritchie do not put comments to the right of code in the same column at all times (nor do they use only one space to the right of the *************** *** 148,157 **** coding standards, specify the @samp{-gnu} option, which has the same effect as the following options: @example ! -nbad -bap -nbbb -nbc -bl -c33 -cd33 -ncdb -nce -di0 -nfc1 -i2 -ip5 -lp -pcs -psl -nsc -nsob -bli2 -ss -cp1 -nfca -cli0 @end example @node Blank lines, Comments, Common styles, Top @comment node-name, next, previous, up @section Blank lines --- 146,167 ---- coding standards, specify the @samp{-gnu} option, which has the same effect as the following options: @example ! -nbad -bap -nbbb -nbc -bl -c33 -cd33 -ncdb -nce -di0 -el2 -eu -nfc1 -i2 -ip5 -lp -pcs -psl -nsc -nsob -bli2 -ss -cp1 -nfca -cli0 @end example + The PG coding style is designed for maximum readability and ease of + modification, at least in the eye of one beholder. It invoked by + specifying @samp{-pg}, and is like the default + style with the following changes: + @example + -bacc -bad -bbb -nbc -bl -bs -nce -cp1 + -di24 -el4 -neu -nlp -npsl -nsc -nv + @end example + + @noindent + If you see a few undocumented options above, don't worry... + @node Blank lines, Comments, Common styles, Top @comment node-name, next, previous, up @section Blank lines *************** *** 414,419 **** --- 424,432 ---- should be indented to the right of the containing @samp{switch} statement. + The @samp{-el} option specifies the number of spaces by which goto labels + should be exdented to the left of the current prevailing indentation level. + If a semicolon is on the same line as a @code{for} or @code{while} statement, the @samp{-ss} option will cause a space to be placed before the semicolon. This emphasizes the semicolon, making it clear that the *************** *** 464,469 **** --- 477,500 ---- int a, b, c; @end example + The @samp{-neu} option is used to specify that unary operators used + in declarations should not be exdented when using @samp{-di}, that + is they should not hang to the left of the declared item's column. If + you don't specify it, declarations will look like: + + @example + int foo; + char **bar; + @end example + + @noindent + whereas if you specify it declarations will look like: + + @example + int foo; + char **bar; + @end example + The @samp{-psl} option causes the type of a procedure being defined to be placed on the line before the name of the procedure. This style is required for the @code{etags} program to work correctly. *************** *** 481,487 **** @end example @noindent ! you would use the options @samp{-T CODE_ADDR -T COLOR}. @node Indentation, Miscellaneous options, Declarations, Top @comment node-name, next, previous, up --- 512,537 ---- @end example @noindent ! you would use the options @samp{-TCODE_ADDR -T COLOR}. ! ! If the first character of a type word is a digit, it is understood to be ! a type of keyword, and will cause the same formatting as that keyword. ! Current classes are @samp{0} for no specific rules, @samp{1} for @code{break} ! equivalents, @samp{2} for @code{switch}, @samp{3} for @code{case}, ! @samp{4} for @code{struct}, @samp{5} for type names, and is the default, ! @samp{6} for @code{while}, @samp{7} for @code{else}, and @samp{8} for ! @code{sizeof}. Be careful about this mechanism, because you can really ! screw up formatting if you use it improperly. ! ! Supposing your program contains (and this is @emph{not} encouraged) ! something like ! ! @example ! #define forever for (;;) ! #define countof(array) (sizeof (array)/sizeof *(array)) ! @end example ! ! your formatting will be nicer if you specify @samp{-T6forever -T8countof}. @node Indentation, Miscellaneous options, Declarations, Top @comment node-name, next, previous, up *************** *** 512,518 **** @end example @noindent ! With @samp{-lp} in effect the code looks somewhat clearer: @example p1 = first_procedure (second_procedure (p2, p3), --- 562,568 ---- @end example @noindent ! With @samp{-lp} in effect the code looks somewhat different: @example p1 = first_procedure (second_procedure (p2, p3), *************** *** 631,636 **** --- 681,693 ---- @item -di@var{n} Put variables in column @var{n}. @xref{Declarations}. + @item -el@var{n} + Exdent got labels by @var{n} columns to the left of the current prevailing + indent. @xref{Statements}. + + @item -eu + Exdent unary operators in columned declarations. @xref{Declarations}. + @item -fc1 Format comments in the first column. @xref{Comments}. *************** *** 659,664 **** --- 716,725 ---- @item -pcs Put a space after the function in function calls. @xref{Statements}. + @item -pg + Adopt the PG indentation style, which is most readable and maintainable + accoding to one individual. + @item -nbad Do not force blank lines after declarations. @xref{Blank lines}. *************** *** 680,685 **** --- 741,749 ---- @item -ncs Do not put a space after cast operators. + + @item -neu + Do not exdent unary operators in columned declarations. @xref{Declarations}. @item -nfc1 Do not format comments in the first column as normal. @xref{Comments}. =================================================================== RCS file: io.c,v retrieving revision 5.9 diff -c -r5.9 io.c *** /tmp/,RCSt1a03000 Thu Dec 28 13:17:58 1989 --- io.c Mon Dec 25 16:15:19 1989 *************** *** 22,28 **** static char sccsid[] = "@(#)io.c 5.10 (Berkeley) 9/15/88"; #endif /* not lint */ ! #include "indent_globs.h" #include <ctype.h> /* POSIX says that fcntl.h should exist. Linking either sys/fcntl.h or sys/file.h to fcntl.h should work fine if you don't have fcntl.h */ --- 22,28 ---- static char sccsid[] = "@(#)io.c 5.10 (Berkeley) 9/15/88"; #endif /* not lint */ ! #include "globs.h" #include <ctype.h> /* POSIX says that fcntl.h should exist. Linking either sys/fcntl.h or sys/file.h to fcntl.h should work fine if you don't have fcntl.h */ =================================================================== RCS file: lexi.c,v retrieving revision 5.9 diff -c -r5.9 lexi.c *** /tmp/,RCSt1a03000 Thu Dec 28 13:17:59 1989 --- lexi.c Thu Dec 28 12:50:04 1989 *************** *** 28,34 **** * of token scanned. */ ! #include "indent_globs.h" #include <ctype.h> #define alphanum 1 --- 28,34 ---- * of token scanned. */ ! #include "globs.h" #include <ctype.h> #define alphanum 1 *************** *** 582,590 **** /* * Add the given keyword to the keyword table, using val as the keyword type */ addkey(key, val) char *key; ! enum rwcodes val; { register struct templ *p; --- 582,593 ---- /* * Add the given keyword to the keyword table, using val as the keyword type */ + + #define KLIK 10 + addkey(key, val) char *key; ! enum rwcodes val; { register struct templ *p; *************** *** 594,613 **** if (user_specials == 0) { ! user_specials = (struct templ *) xmalloc (5 * sizeof (struct templ)); if (user_specials == 0) { fputs ("indent: out of memory\n", stderr); exit (1); } ! user_specials_max = 5; user_specials_idx = 0; } else if (user_specials_idx == user_specials_max) { ! user_specials_max += 5; ! user_specials = (struct templ *) xrealloc ((char *) user_specials, ! user_specials_max * sizeof (struct templ)); } p = &user_specials[user_specials_idx++]; --- 597,616 ---- if (user_specials == 0) { ! user_specials = (struct templ *) xmalloc ((KLIK+1) * sizeof (struct templ)); if (user_specials == 0) { fputs ("indent: out of memory\n", stderr); exit (1); } ! user_specials_max = KLIK; user_specials_idx = 0; } else if (user_specials_idx == user_specials_max) { ! user_specials_max += KLIK; ! user_specials = (struct templ *) ! xrealloc ((char *) user_specials,(user_specials_max+1) * sizeof (struct templ)); } p = &user_specials[user_specials_idx++]; =================================================================== RCS file: parse.c,v retrieving revision 5.9 diff -c -r5.9 parse.c *** /tmp/,RCSt1a03000 Thu Dec 28 13:18:00 1989 --- parse.c Mon Dec 25 16:15:30 1989 *************** *** 22,28 **** static char sccsid[] = "@(#)parse.c 5.8 (Berkeley) 9/15/88"; #endif /* not lint */ ! #include "indent_globs.h" struct parser_state *parser_state_tos; --- 22,28 ---- static char sccsid[] = "@(#)parse.c 5.8 (Berkeley) 9/15/88"; #endif /* not lint */ ! #include "globs.h" struct parser_state *parser_state_tos; =================================================================== RCS file: pr_comment.c,v retrieving revision 5.9 diff -c -r5.9 pr_comment.c *** /tmp/,RCSt1a03000 Thu Dec 28 13:18:01 1989 --- pr_comment.c Mon Dec 25 16:15:33 1989 *************** *** 54,60 **** */ ! #include "indent_globs.h" pr_comment() --- 54,60 ---- */ ! #include "globs.h" pr_comment() -- Piercarlo "Peter" Grandi | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk Dept of CS, UCW Aberystwyth | UUCP: ...!mcvax!ukc!aber-cs!pcg Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk