From: DUVAL@elpp1.epfl.ch ((Basil Duval EPFL CRPP 1015 Lausanne))
Subject: Indent 1.6 ported to MacOS with THINK_C
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 26 Aug 1992 13:58:05 GMT

Hello there,
	I have been porting Indent to the MacOS using THINK_C. ALthough
this may seem an esoteric use of the program, I have put the effort into
making Indent work and have found a few "problems" that belong to the
source programmer, that I had to work around, and a couple of ideas. I 
thought that the versions were comming out slowly, but having seen 1.3,1.4
1.5 and now 1.6 in a very short space of time, I thought you might be
able to put some things into the code, ad save me the effort.

Here is a list, please contact me if my explications are not clear

1) You have a function called set_option which takes 3 parameters. Yet in the
args.c you call it set_option(t,0). Please put in a third argument

2) You have a function called diag which takes 4 parameters. You call it
with 2, 3 and 4 parameters. Please insert dummy commands into the other calls.

3) Your function xrealloc is defined as taking a char *ptr. YOu now have
two choices. Either you use the ANSI technique of calling it void *ptr,
or if you are worried that this will not go through, you have to do an
explicit cast every time you call this function. ie. xrealloc((char *)....

The above points are not-specific to my code. These ought to be resolved before
you think about the other points which are specific to my MAC implementation 


4) You assume that the end of line character is \n. Unfortunately on my machine
the character is \r. Now I have to change the character in all the source and
it is fine, but I would suggest that you either use a global variable or
a macro definition at every location where an end of line character is used.
This would make my life a lot easier. ie: #define EOL n and use EOL
5) You have decided that integers are the same length as addresses. Since
this is not the case on my machine, I ran into problems with long programs.
To resolve this I had to change
	in sys.h
int size ---> long size
	in indent.h
extern unsigned int in_prog_size ---> extern unsigned long in_prog_size
	in io.c
unsigned int in_prog_size ---> unsigned long in_prog_size

It is not clear to me, but using long would seem a more correct solution and
in your case would have absolutely no effect on the code

6) This brings me to another problem. Since my routines like printf require
2 byte integers, some of your printf calls are supplied with 4 byte integers
which causes the program to blow-up. TO get rid of this problem, I had to
perform an integer cast infront of every printf call which used an integer.
ie printf("asdas %dasd",MyInt) ---> printf("asdas %dasd",(int)MyInt)
In your world, these casts will have no effect, but in my world they would
really help me. If you wouldn't mind, why not put in the explicit cast
in your printf statements which use integers. There are only 8 or so that
matter and it would really help me.

7) Lastly: you use unsigned then you ought to use size_t in xrealloc. Although
you note that this is wrong, my compiler throws up. If you want to keep
you compatibility I suggest two possibilities.
You use a macro definition ie: #define ADDRESS unsigned in your header
and then I can replace it with #define ADDRESS size_t
or
you could simply add
#ifdef size_t
size_t size:
#else
unsigned size
#endif
	Again this would help me and make your like more reasonable.


	Thanks for listening. I thing your code is very useful, and I would
also like to submit it to the MAC community since it compiles to 60kbytes
and would at long last provide a good code format.
	I would really like you to resolve points 1-3 and would appreciate
some help with points 4-7. These are all suggested in the hope of improving
the code.

Basil P. DUVAL
EPFL/CRPP
1015 Bassenges
Lausanne, Switzerland
Email: DUVAL@ELPP1.EPFL.CH

ps: I would also like permission and advice on how this code should be
submitted to the net. It would be freeware, and all the sources would be
ofcourse available, but I would like an OK from somebody. (I know about
COPYLEFT, but I would still like to ask for permission )

Newsgroups: gnu.utils.bug