-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistency of the command-line interface with other preprocessors #3
Comments
ly like being able to specify multiple input files with multiple -i switches or a list of files for -i, and not having to keep repeating -D when I have a lot of variables, like "prep LINUX GFORTRAN ...." instead of "fpp -D LINUX -D GFORTRAN -D ...". , but it would be very easy to change. Note prep(1), at least currently, requires a space after the -D (I have been thinking about allowing that as it seems commonly used, but newer references discourage not having a space). It would be a non-compatible change as well. It would be easy to do with an environment variable or the name of the executable as a switch between the two modes, but the environment variable would be easy to forget to set. It would also be easy to have it be a build switch to let you build one way or the other. I was making a fpp(1) compatible version not too long ago, defaulting to "#" instead of "$" for a prefix and with command line options just like you described, and treating all #DEFINE directives as strings like cpp and most fpp do instead of an expression (which I dislike, and not all fpp allow; but people seem to live with) and decided I had to reintroduce the things I do not like to be completely fpp or cpp compatible or confuse people with something so fpp/cpp-like that really was not the same so I stopped; Seems like a valuable change though, as ifort is one of the principal compilers and it is unlikely I could get them to change ifort to handle prep(1) as-is. I was thinking I could add a prep to switch like "-fpp" but that would be inconvenient to use with ifort/ifx also. What do you think about it behaving like that if the binary is renamed to something like prep_alt or prep+ or something like that? The program could look at arg0 and if it is not "prep" the behavior changes? Not ideal for a couple of reasons (fpm does not allow specifying an install name, people would have to make a copy themselves in their path if prep(1) was not installed somewhere writable by them, it kludges the code. Any other options? I could just bite the bullet and change it, but being a non-upward-compatible change I am trying to think of an alternative, and wondering who else it would effect (and of course, Otherwise I would just change it, even though I personally like how it is now. |
Fair point.
In the tools I'm familiar with (CMake, compilers) I'm used to the syntax with no space. Which newer references discourage this?
Environment variables are easy to forget. Build-time switch for two executable with a different CLI but the same name is also a bad idea. The incompatibilities between different versions of fpp or Make are two such "criminal" examples.
I think using
Based on the lukewarm response I received at the Intel Forum currently, it looks like Intel has more important jobs on their plate. Their documentation is broken, so it must mean that no "big" customer is relying on the alternative preprocessor compile switch.
Adapting to everyones needs is a pain. Providing a second "binary" (potentially just a bash script) with an alternative name seems like the best solution to me. It doesn't even need to be part of the
There is no point in changing the behavior on a single user request when your whole personal (and professional) development environment relies on the current behaviour. Personally, I would defer the decision until a day when Intel clarifies their stance, and potentially other compilers (LFortran?) show their willingness to follow suit. Given how unknown the Intel option is anyways, I guess there is little to no value to pursue this currently. Moreover, for (future) users interacting with prep via fpm, it shouldn't be a problem. |
prep now, under these conditions, uses the cpp syntax: This let me use prep as an alternate preprocessor for basic direct usage with ifort as-is; but some options like -E still caused problems, and even though it worked with basic ifort commands I got errors I have not tracked down when I tried to use it with fpm(1). It still has support / lack-of-standardization options; and their might be a collision between fpm and M_CLI2 preventing the problem; and since fpm(1) preprocessing apparently only allows cpp/fpp and fypp I had to rename prep to either cpp or fpp and other kludges; but simple prep usage by those used to cpp/fpp should be possible now, so I will leave the changes in. So you can use "prep -D A=10 -DB infile", without the -i for example. I |
Would it be possible to make the CLI of
prep
consistent with other Fortran preprocessors?Namely, if one is to use a third-party preprocessor with the Intel Fortran compiler, the alternative preprocessor should support an invocation of the form:
with output redirected to STDOUT. Currently,
prep
requires an-i
for the input file, meaning a wrapper-script would be needed.Also the
fypp
preprocessor uses a "positional" argument for the input file:$ fypp -h Usage: fypp [options] [INFILE] [OUTFILE] Preprocesses source code with Fypp directives. The input is read from INFILE (default: '-', stdin) and written to OUTFILE (default: '-', stdout).
I have not investigated the conventions of other fpp- and cpp-like Fortran preprocessors.
If not possible for whatever reasons, I'm happy to contribute a note on how to "embed" the
prep
preprocessor with other tools.The text was updated successfully, but these errors were encountered: