bomgard@iuvax.cs.indiana.edu (Tim Bomgardner) (11/22/90)
I recently inherited a large multi-file c program with little or no visual structure (indenting, whitespace, etc.). I ran it all thru indent. A couple days later I discovered indent had made some unauthorized changes. In particular, all statements that were originally in the form var=-1; or ptr=&var; were changed to var -= 1; or ptr &= var; What a disaster. Just thought you all might like to know.
mcdonald@aries.scs.uiuc.edu (Doug McDonald) (11/22/90)
In article <73542@iuvax.cs.indiana.edu> bomgard@iuvax.cs.indiana.edu (Tim Bomgardner) writes: >I recently inherited a large multi-file c program with little or no >visual structure (indenting, whitespace, etc.). I ran it all thru >indent. A couple days later I discovered indent had made some >unauthorized changes. In particular, all statements that were >originally in the form > > var=-1; >or > ptr=&var; > >were changed to > > var -= 1; >or > ptr &= var; > >What a disaster. Just thought you all might like to know. > and var=.5; changed to var .= 5; /*!!!*/ Yes indeed. However, you have a very old version. The version to circulate recently in the source groups has this thoroughly fixed. Doug McDonald
thorinn@rimfaxe.diku.dk (Lars Henrik Mathiesen) (11/24/90)
mcdonald@aries.scs.uiuc.edu (Doug McDonald) writes: >In article <73542@iuvax.cs.indiana.edu> bomgard@iuvax.cs.indiana.edu (Tim Bomgardner) writes: >>A couple days later I discovered indent had made some >>unauthorized changes. >Yes indeed. However, you have a very old version. The version to >circulate recently in the source groups has this thoroughly fixed. >Doug McDonald If you have sources for a 4.3-derived indent, and you don't feel like searching the source groups for a new and possibly much incompatible (``improved'') version, here are the fixes we made about three incarnations of this discussion ago. Even fixes the manual! -- Lars Mathiesen, DIKU, U of Copenhagen, Denmark [uunet!]mcsun!diku!thorinn Institute of Datalogy -- we're scientists, not engineers. thorinn@diku.dk RCS file: RCS/args.c,v retrieving revision 1.1 diff -c -r1.1 args.c *** /tmp/,RCSt1003415 Sat Nov 24 15:22:16 1990 --- args.c Wed Jan 17 14:57:27 1990 *************** *** 97,102 **** --- 97,104 ---- "nbbb", PRO_BOOL, false, OFF, &blanklines_before_blockcomments, "ps", PRO_BOOL, false, ON, &pointer_as_binop, "nps", PRO_BOOL, false, OFF, &pointer_as_binop, + "osa", PRO_BOOL, false, ON, &convert_old_assignment, + "nosa", PRO_BOOL, false, OFF, &convert_old_assignment, "troff", PRO_BOOL, false, ON, &troff, "T", PRO_SPECIAL, 0, KEY, 0, /* whew! */ RCS file: RCS/indent.1,v retrieving revision 1.1 diff -c -r1.1 indent.1 *** /tmp/,RCSt1003420 Sat Nov 24 15:22:17 1990 --- indent.1 Wed Jan 17 14:57:30 1990 *************** *** 33,38 **** --- 33,39 ---- [\ \fB\-l\fIn\fR\ ] [\ \fB\-lc\fIn\fR\ ] [\ \fB\-lp\fR\ |\ \fB\-nlp\fR\ ] + [\ \fB\-osa\fR\ |\ \fB\-nosa\fR\ ] [\ \fB\-npro\fR\ ] [\ \fB\-pcs\fR\ |\ \fB\-npcs\fR\ ] [\ \fB\-ps\fR\ |\ \fB\-nps\fR\ ] *************** *** 265,270 **** --- 266,277 ---- p5)); .ft R .fi + .TP 15 + .BR \-osa , \-nosa + If true (\fB\-osa\fR) old style assignment operators (`=-', `=*', and so on) + are considered to be tokens, and are converted to the newer form (`-=', `*='). + The default is + .BR \-nosa . .TP 15 .B \-npro Causes the profile files, `./.indent.pro' and `~/.indent.pro', to be ignored. RCS file: RCS/indent_globs.h,v retrieving revision 1.1 diff -c -r1.1 indent_globs.h *** /tmp/,RCSt1003425 Sat Nov 24 15:22:19 1990 --- indent_globs.h Wed Jan 17 14:57:33 1990 *************** *** 121,126 **** --- 121,128 ---- int lineup_to_parens; /* if true, continued code within parens will be lined up to the open paren */ int block_comment_max_col; + int convert_old_assignment; /* if true, old style assignment operators (=+) + are accepted and converted to new style */ struct parser_state { RCS file: RCS/lexi.c,v retrieving revision 1.1 diff -c -r1.1 lexi.c *** /tmp/,RCSt1003430 Sat Nov 24 15:22:20 1990 --- lexi.c Wed Jan 17 14:57:36 1990 *************** *** 461,468 **** case '=': if (ps.in_or_st) ps.block_init = 1; ! if (chartype[*buf_ptr] == opchar) { /* we have two char * assignment */ tok[-1] = *buf_ptr++; if ((tok[-1] == '<' || tok[-1] == '>') && tok[-1] == *buf_ptr) *tok++ = *buf_ptr++; --- 461,470 ---- case '=': if (ps.in_or_st) ps.block_init = 1; ! if (convert_old_assignment && ! chartype[*buf_ptr & 0177] == opchar) { /* we have two char * assignment */ + printf("%d: Old style assignment converted\n", line_no); tok[-1] = *buf_ptr++; if ((tok[-1] == '<' || tok[-1] == '>') && tok[-1] == *buf_ptr) *tok++ = *buf_ptr++;
bmarsh@cod.NOSC.MIL (William C. Marsh) (11/27/90)
In article <73542@iuvax.cs.indiana.edu> bomgard@iuvax.cs.indiana.edu (Tim Bomgardner) writes: >I recently inherited a large multi-file c program with little or no >visual structure (indenting, whitespace, etc.). I ran it all thru >indent. A couple days later I discovered indent had made some >unauthorized changes. In particular, all statements that were >originally in the form Funny, I had just been given a task to find this problem. It seems that the latest version of indent (I got it from uunet) has this fixed. I guess one of the original purposes was to convert older C code. Bill -- Bill Marsh, Naval Ocean Systems Center, San Diego, CA {arpa,mil}net: bmarsh@cod.nosc.mil uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!nosc!bmarsh "If you are not part of the solution, you're part of the problem..."