[gnu.utils.bug] Indent 1.1 for System V

toy@ecse.rpi.edu (Ray Toy) (10/06/89)

I tried building GNUindent 1.1 on a System V machine, and
there were a few errors.  One was no "strings.h" file.
The other problem was multiply defined globals that the
machine doesn't like.  The fixes are:

	o Added USG for USG machines
	o Added HAVE_MEMCPY if you have it already
	o Removed multiply defined globals

Keep up the good work!

Ray ----->		toy@ecse.rpi.edu
Toy


*** ../dist-indent/globs.c	Thu Aug 31 20:40:37 1989
--- globs.c	Thu Oct  5 11:52:34 1989
***************
*** 48,53 ****
--- 48,54 ----
    return val;
  }
  
+ #ifndef	HAVE_MEMCPY
  /* Some systems lack memcpy so this does the same thing.
     If your system-supplied memcpy is more efficient, you might want
     to put "#define mymemcpy memcpy" in indent_globs.h.
***************
*** 64,66 ****
--- 65,68 ----
      *destaddr++ = *srcaddr++;
    return destaddr;
  }
+ #endif
*** ../dist-indent/indent.c	Tue Sep  5 21:10:57 1989
--- indent.c	Thu Oct  5 12:31:20 1989
***************
*** 30,35 ****
--- 30,37 ----
  static char sccsid[] = "@(#)indent.c	5.11 (Berkeley) 9/15/88";
  #endif /* not lint */
  
+ #define	INDENT_MAIN
+ 
  #include "indent_globs.h"
  #include <ctype.h>
  
*** ../dist-indent/indent_globs.h	Sun Sep  3 13:56:48 1989
--- indent_globs.h	Thu Oct  5 11:52:04 1989
***************
*** 20,31 ****
   *	@(#)indent_globs.h	5.7 (Berkeley) 9/15/88
   */
  
  #include <stdio.h>
! #include <strings.h>
  
  /* Standard memory allocation routines.  */
  char *malloc ();
  char *realloc ();
  /* Do the same thing, but abort with an error if out of memory
     (see globs.c).  */
  char *xmalloc ();
--- 20,47 ----
   *	@(#)indent_globs.h	5.7 (Berkeley) 9/15/88
   */
  
+ #ifdef	INDENT_MAIN
+ #define	EXTERN
+ #else
+ #define	EXTERN	extern
+ #endif
+ 
  #include <stdio.h>
! 
! #ifdef	USG
! # include <string.h>
! # include <malloc.h>
! # include <memory.h>
! # ifndef	HAVE_MEMCPY
! #  define	HAVE_MEMCPY
! # endif
! #else
! # include <strings.h>
  
  /* Standard memory allocation routines.  */
  char *malloc ();
  char *realloc ();
+ #endif
  /* Do the same thing, but abort with an error if out of memory
     (see globs.c).  */
  char *xmalloc ();
***************
*** 35,41 ****
--- 51,59 ----
     mymemcpy.  If you system memcpy is more efficient, you might
     want to use it by uncommenting the following line.  */
  /* #define mymemcpy memcpy */
+ #ifndef	HAVE_MEMCPY
  char *mymemcpy ();
+ #endif
  
  #define BACKSLASH '\\'
  #define label_offset 2		/* number of levels a label is placed to left
***************
*** 68,86 ****
  /* Name of input file.  */
  extern char *in_name;
  
! char *in_prog; /* pointer to the null-terminated input program */
  
  /* Point to the position in the input program which we are currently
     looking at.  */
! char *in_prog_pos;
  
  /* Point to the start of the current line.  */
! char *cur_line;
  
  /* Size of the input program, not including the ' \n\0' we add at the end */
! int in_prog_size;
  
! FILE       *output;		/* the output file */
  
  #define check_code_size \
  	if (e_code >= l_code) { \
--- 86,104 ----
  /* Name of input file.  */
  extern char *in_name;
  
! EXTERN char *in_prog; /* pointer to the null-terminated input program */
  
  /* Point to the position in the input program which we are currently
     looking at.  */
! EXTERN char *in_prog_pos;
  
  /* Point to the start of the current line.  */
! EXTERN char *cur_line;
  
  /* Size of the input program, not including the ' \n\0' we add at the end */
! EXTERN int in_prog_size;
  
! EXTERN FILE       *output;		/* the output file */
  
  #define check_code_size \
  	if (e_code >= l_code) { \
***************
*** 109,139 ****
  	    s_lab = labbuf + 1; \
  	}
  
! char       *labbuf;		/* buffer for label */
! char       *s_lab;		/* start ... */
! char       *e_lab;		/* .. and end of stored label */
! char       *l_lab;		/* limit of label buffer */
  
! char       *codebuf;		/* buffer for code section */
! char       *s_code;		/* start ... */
! char       *e_code;		/* .. and end of stored code */
! char       *l_code;		/* limit of code section */
! 
! char       *combuf;		/* buffer for comments */
! char       *s_com;		/* start ... */
! char       *e_com;		/* ... and end of stored comments */
! char       *l_com;		/* limit of comment buffer */
  
! char       *buf_ptr;		/* ptr to next character to be taken from
  				 * in_buffer */
! char       *buf_end;		/* ptr to first after last char in in_buffer */
  
  /* pointer to the token that lexi() has just found */
! char *token;
  /* points to the first char after the end of token */
! char *token_end;
  /* Functions from lexi.c */
! enum codes lexi ();
  
  /* Used to keep track of buffers.  */
  struct buf {
--- 127,157 ----
  	    s_lab = labbuf + 1; \
  	}
  
! EXTERN char       *labbuf;		/* buffer for label */
! EXTERN char       *s_lab;		/* start ... */
! EXTERN char       *e_lab;		/* .. and end of stored label */
! EXTERN char       *l_lab;		/* limit of label buffer */
  
! EXTERN char       *codebuf;		/* buffer for code section */
! EXTERN char       *s_code;		/* start ... */
! EXTERN char       *e_code;		/* .. and end of stored code */
! EXTERN char       *l_code;		/* limit of code section */
! 
! EXTERN char       *combuf;		/* buffer for comments */
! EXTERN char       *s_com;		/* start ... */
! EXTERN char       *e_com;		/* ... and end of stored comments */
! EXTERN char       *l_com;		/* limit of comment buffer */
  
! EXTERN char       *buf_ptr;		/* ptr to next character to be taken from
  				 * in_buffer */
! EXTERN char       *buf_end;		/* ptr to first after last char in in_buffer */
  
  /* pointer to the token that lexi() has just found */
! EXTERN char *token;
  /* points to the first char after the end of token */
! EXTERN char *token_end;
  /* Functions from lexi.c */
! EXTERN enum codes lexi ();
  
  /* Used to keep track of buffers.  */
  struct buf {
***************
*** 166,238 ****
     need_chars) and the using of the buffer (where buf_ptr points into
     it) occur at different times, we can get away with it (it would not
     be trivial to fix).  */
! struct buf save_com;
  
! char       *bp_save;		/* saved value of buf_ptr when taking input
  				 * from save_com */
! char       *be_save;		/* similarly saved value of buf_end */
  
  
! int         pointer_as_binop;
! int         blanklines_after_declarations;
! int         blanklines_before_blockcomments;
  extern int blanklines_after_procs;
! int         blanklines_around_conditional_compilation;
! int         swallow_optional_blanklines;
! int         n_real_blanklines;
! int         prefix_blankline_requested;
! int         postfix_blankline_requested;
! int         break_comma;	/* when true and not in parens, break after a
  				 * comma */
  
  /* number of spaces to indent braces from the suround if, while, etc.
     in -bl (bype_2 == 0) code */
! int brace_indent;
  
! int         btype_2;		/* when true, brace should be on same line as
  				 * if, while, etc */
  /* If true, a space is inserted between if, while, or for, and a semicolon
     for example
     while (*p++ == ' ') ;
     */
! int space_sp_semicolon;
  
  /* True if a #else or #endif has been encountered.  */
  extern int else_or_endif;
  
! int         case_ind;		/* indentation level to be used for a "case
  				 * n:" in spaces */
! int         code_lines;		/* count of lines with code */
! int         had_eof;		/* set to true when input is exhausted */
! int         line_no;		/* the current line number. */
! int         max_col;		/* the maximum allowable line length */
! int         verbose;		/* when true, non-essential error messages are
  				 * printed */
! int         cuddle_else;	/* true if else should cuddle up to '}' */
! int         star_comment_cont;	/* true iff comment continuation lines should
  				 * have stars at the beginning of each line. */
! int         comment_delimiter_on_blankline;
! int         troff;		/* true iff were generating troff input */
! int         procnames_start_line;	/* if true, the names of procedures
  					 * being defined get placed in column
  					 * 1 (ie. a newline is placed between
  					 * the type of the procedure and its
  					 * name) */
! int         proc_calls_space;	/* If true, procedure calls look like:
  				 * foo (bar) rather than foo(bar) */
! int	    cast_space;		/* If true, casts look like:
  				 * (char *) bar rather than (char *)bar */
  
  /* If comments which start in column 1 are to be magically reformatted */
! int         format_col1_comments;
  /* If any comments are to be reformatted */
! int format_comments;
  
  extern int  suppress_blanklines;/* set iff following blanklines should be
  				 * suppressed */
! int         continuation_indent;/* set to the indentation between the edge of
  				 * code and continuation lines in spaces */
! int         lineup_to_parens;	/* if true, continued code within parens will
  				 * be lined up to the open paren */
  
  /* The position that we will line the current line up with when it
--- 184,256 ----
     need_chars) and the using of the buffer (where buf_ptr points into
     it) occur at different times, we can get away with it (it would not
     be trivial to fix).  */
! EXTERN struct buf save_com;
  
! EXTERN char       *bp_save;		/* saved value of buf_ptr when taking input
  				 * from save_com */
! EXTERN char       *be_save;		/* similarly saved value of buf_end */
  
  
! EXTERN int         pointer_as_binop;
! EXTERN int         blanklines_after_declarations;
! EXTERN int         blanklines_before_blockcomments;
  extern int blanklines_after_procs;
! EXTERN int         blanklines_around_conditional_compilation;
! EXTERN int         swallow_optional_blanklines;
! EXTERN int         n_real_blanklines;
! EXTERN int         prefix_blankline_requested;
! EXTERN int         postfix_blankline_requested;
! EXTERN int         break_comma;	/* when true and not in parens, break after a
  				 * comma */
  
  /* number of spaces to indent braces from the suround if, while, etc.
     in -bl (bype_2 == 0) code */
! EXTERN int brace_indent;
  
! EXTERN int         btype_2;		/* when true, brace should be on same line as
  				 * if, while, etc */
  /* If true, a space is inserted between if, while, or for, and a semicolon
     for example
     while (*p++ == ' ') ;
     */
! EXTERN int space_sp_semicolon;
  
  /* True if a #else or #endif has been encountered.  */
  extern int else_or_endif;
  
! EXTERN int         case_ind;		/* indentation level to be used for a "case
  				 * n:" in spaces */
! EXTERN int         code_lines;		/* count of lines with code */
! EXTERN int         had_eof;		/* set to true when input is exhausted */
! EXTERN int         line_no;		/* the current line number. */
! EXTERN int         max_col;		/* the maximum allowable line length */
! EXTERN int         verbose;		/* when true, non-essential error messages are
  				 * printed */
! EXTERN int         cuddle_else;	/* true if else should cuddle up to '}' */
! EXTERN int         star_comment_cont;	/* true iff comment continuation lines should
  				 * have stars at the beginning of each line. */
! EXTERN int         comment_delimiter_on_blankline;
! EXTERN int         troff;		/* true iff were generating troff input */
! EXTERN int         procnames_start_line;	/* if true, the names of procedures
  					 * being defined get placed in column
  					 * 1 (ie. a newline is placed between
  					 * the type of the procedure and its
  					 * name) */
! EXTERN int         proc_calls_space;	/* If true, procedure calls look like:
  				 * foo (bar) rather than foo(bar) */
! EXTERN int	    cast_space;		/* If true, casts look like:
  				 * (char *) bar rather than (char *)bar */
  
  /* If comments which start in column 1 are to be magically reformatted */
! EXTERN int         format_col1_comments;
  /* If any comments are to be reformatted */
! EXTERN int format_comments;
  
  extern int  suppress_blanklines;/* set iff following blanklines should be
  				 * suppressed */
! EXTERN int         continuation_indent;/* set to the indentation between the edge of
  				 * code and continuation lines in spaces */
! EXTERN int         lineup_to_parens;	/* if true, continued code within parens will
  				 * be lined up to the open paren */
  
  /* The position that we will line the current line up with when it
***************
*** 239,247 ****
     comes time to print it (if we are lining up to parentheses).  */
  extern int paren_target;
  
! int         Bill_Shannon;	/* true iff a blank should always be inserted
  				 * after sizeof */
! int         blanklines_after_declarations_at_proctop;	/* This is vaguely
  							 * similar to
  							 * blanklines_after_decla
  							 * rations except that
--- 257,265 ----
     comes time to print it (if we are lining up to parentheses).  */
  extern int paren_target;
  
! EXTERN int         Bill_Shannon;	/* true iff a blank should always be inserted
  				 * after sizeof */
! EXTERN int         blanklines_after_declarations_at_proctop;	/* This is vaguely
  							 * similar to
  							 * blanklines_after_decla
  							 * rations except that
***************
*** 254,261 ****
  							 * to be generated even
  							 * if there are no
  							 * declarations */
! int         block_comment_max_col;
! int         extra_expression_indent;	/* True if continuation lines from the
  					 * expression part of "if(e)",
  					 * "while(e)", "for(e;e;e)" should be
  					 * indented an extra tab stop so that
--- 272,279 ----
  							 * to be generated even
  							 * if there are no
  							 * declarations */
! EXTERN int         block_comment_max_col;
! EXTERN int         extra_expression_indent;	/* True if continuation lines from the
  					 * expression part of "if(e)",
  					 * "while(e)", "for(e;e;e)" should be
  					 * indented an extra tab stop so that
***************
*** 298,304 ****
  };
  char       *chfont();
  
! struct fstate
              keywordf,		/* keyword font */
              stringf,		/* string font */
              boxcomf,		/* Box comment font */
--- 316,322 ----
  };
  char       *chfont();
  
! EXTERN struct fstate
              keywordf,		/* keyword font */
              stringf,		/* string font */
              boxcomf,		/* Box comment font */