Trying to sum up the points of this discussion and adding some of my opinions:
- Both formatting ways have their place. Though programmers are used to one of them, I guess in most programs, you'll find places where one way will be easier to use, and others where the other way will be preferable.
- In gpc, the switches --standard-pascal/--extended-pascal or --borland-pascal should choose the according defaults.
- Additionally, switches like --[no-]clip-strings, --default-width=..., --[no-]real-blank change the defaults in these regards.
- There should also be compiler options like {$CLIP+/-}, {$DEFWIDTH 12}, {$REALBLANK+/-} (?). This will be necessary if BP-ish and SP-ish programmers work together on a project, and want to build their program with --automake. And it can be convenient for a single programmer to change it for different procedures (see above).
- The default behaviour without any switches or options can be like standard Pascal in this regard. (I'm saying this although I'm coming from BP.) Sven, those BP programmers who want to change smoothly to gpc will use --borland-pascal anyway, so there should be no problems with this one.
- A way to read in configuration files (like "gpc @gpc.cfg") seems good (in addition to environment variables and command line options). Even if gpc doesn't read in a config file by default, it should be no problem to set an alias accordingly (BTW, even modern DOSes support something like alias in the form of DosKey...)
- Putting those flags in a makefile is also an option, but only if one is to use makefiles at all. Personally, I don't like makefiles, and I think Pascal programs don't need makefiles, since all the dependencies between modules are there in the code (unlike C). Therefore, I'd like to be able to compile any Pascal program with simply "gpc --automake progname.pas". Any compiler options should be in the source (at least there should be a way to do so).
BTW (not quite to this topic): Is there any reason why the default output file is called "a.out" (or "a.exe" with DOS) - other than historical reasons? Wouldn't it make more sense to default to the base filename of the main program, in order to save programmers from typing "gpc -o x x.pas"?
- Naming the program gpc, spc, epc and bpc seems like a sensible way for Un*x, but on systems that don't support either hard or symbolic links (aka DOS), it would mean 4 separate binaries - probably not a good solution there (although those DOS users who want to do only Borland style could rename gpc.exe to bpc.exe). So this could be one, but not the only, way to choose the defaults.
Note: there would be a difference between gpc (GNU Pascal with all the extensions) and spc (standard Pascal only), perhaps not in the question of output formatting, but in other regards.
On Fri, 4 Apr 1997, Frank Heckenbach wrote:
- A way to read in configuration files (like "gpc @gpc.cfg") seems good (in addition to environment variables and command line options). Even if gpc doesn't read in a config file by default, it should be no problem to set an alias accordingly (BTW, even modern DOSes support something like alias in the form of DosKey...)
Let me remind you that:
1) A config file already exists and it is called `specs' (`specs.gpc' if you're using the djgpp version). It is shared among all members of the GNU compiler family. Introducing a second, gpc specific config file doesn't make sence IMHO.
2) GPC doesn't have to be modified to implement the @file trick. This is a DOS "feature" to overcome DOS commandline-length limitations.
If you want a certain behaviour than:
------------- begin bpc.cfg --------------
--automake --borland-pascal --my-wild-language-switch
--------------- end bpc.cfg --------------
and:
------------- begin bpc.bat --------------
@echo off gpc @c:\djgpp\bin\bpc.cfg %1 %2 %3 %4 %5 %6 %7 %8 %9
--------------- end bpc.bat --------------
This will do just what you want. Usually you would put the long-name options which select the dialect in the CFG file (you want these always on/off) and set optimization (-On) and debugging (-gn) from the command line.
3) If you are a delphi/tp user and want point-and-click userfriendlyness, I suggest you install RHIDE. Will look very familiar. Can even write one of those dreaded makefiles for you ;-)
- Putting those flags in a makefile is also an option, but only if one is to use makefiles at all. Personally, I don't like makefiles, and I think Pascal programs don't need makefiles, since all the dependencies between modules are there in the code (unlike C). Therefore, I'd like to be able to compile any Pascal program with simply "gpc --automake progname.pas". Any compiler options should be in the source (at least there should be a way to do so).
Answered above (I hope)
BTW (not quite to this topic): Is there any reason why the default output file is called "a.out" (or "a.exe" with DOS) - other than historical reasons? Wouldn't it make more sense to default to the base filename of the main program, in order to save programmers from typing "gpc -o x x.pas"?
Besides hisotorical reasons, it is ofen used in automated testsuites (in a unix environment) where the compiler is run on a large set of source files.
- Naming the program gpc, spc, epc and bpc seems like a sensible way for Un*x, but on systems that don't support either hard or symbolic links (aka DOS), it would mean 4 separate binaries - probably not a good solution there (although those DOS users who want to do only Borland style could rename gpc.exe to bpc.exe). So this could be one, but not the only, way to choose the defaults.
I'm currently experimenting with a seperate compiler pre-driver (like g++ and f77) which can set the language switches when invoked as `bpc' or `gpc' etc. It's about 15K which is small compared to the 1.5M of gpc1, even if you install it 4 times because your OS lacks symlinks.
just my HFL 0.02,
JanJaap --- Thus spake the master programmer: "After three days without programming, life becomes meaningless." [The Tao Of Programming]
- Naming the program gpc, spc, epc and bpc seems like a sensible way for Un*x, but on systems that don't support either hard or symbolic links (aka DOS), it would mean 4 separate binaries - probably not a good solution there (although those DOS users who want to do only Borland style could rename gpc.exe to bpc.exe). So this could be one, but not the only, way to choose the defaults.
Isn't there a way by making *.BAT-Files in dos? That is something like a shell-script, isn't it?
Bye, Nils