Skip to content
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

Alter command line options to remove dollar signs #26

Closed
DavidGriffith opened this issue Jul 22, 2020 · 7 comments
Closed

Alter command line options to remove dollar signs #26

DavidGriffith opened this issue Jul 22, 2020 · 7 comments

Comments

@DavidGriffith
Copy link
Contributor

As I wrapped up version 6.12.4 of the Standard Library, I looked again at the list of accepted suggestions at http://inform-fiction.org/suggestions/accept.html. One of them has bothered me for a long time: The Inform6 compiler still makes use of dollar signs on the command line. To fix this, someone suggested and apparently Graham accepted the suggestion. Here it is:

  1. The use of "$..." to introduce compiler options is intensely annoying on *NIX systems that use "$" as an environment variable indicator, e.g. $PATH -- it requires the constant use of quotes to avoid unpleasant and confusing results.

Is this something that can be considered again?

@erkyrath
Copy link
Contributor

There's no suggestion there, just a complaint. :/(And I don't agree that it's "intensely annoying". It's mildly annoying. It's no worse than dealing with spaces in pathnames, which is not considered baroque these days.)

Anyhow. We can't deprecate the dollar-sign syntax without breaking old code, old build setups, and Inform 7.

We could consider adding an alternative syntax. Did you have one in mind?

@DavidGriffith
Copy link
Contributor Author

I apologize for the poor choice of words.

I'm thinking of using --size small to supplement $small. Then --path ~/foo/bar, --include ~/foobar/include, --list. Working on the memory parameters.

@erkyrath
Copy link
Contributor

I suppose --opt ALLOC_BLOCK_SIZE=8192 is the most Unixy way to do it.

@DavidGriffith
Copy link
Contributor Author

I've switched things over to using a BSD-ish licensed getopt() and modified it to check for negation. The flags that begin with one dash work as do long options: (eg --include).

Still working on:

  • Allowing for the old style of options preceded by dollar signs.
  • Allowing for the old style of options preceded by plus signs.
  • Processing a string from the Switches directive.
  • Processing from an ICL (Inform Command Language) file.

@DavidKinder
Copy link
Owner

I'm not enthusiastic about wholesale replacing of the command line processor with getopt(): that has too many possibilities for introducing unexpected changes or breaking previously functional command lines.

@DavidGriffith
Copy link
Contributor Author

I tried to modify the existing code to support --foobar style options, but kept having problems. What I've done so far is visible at https://gitlab.com/DavidGriffith/Inform6 in the flags_reform branch. This particular case match (https://gitlab.com/DavidGriffith/Inform6/-/blob/flags_reform/inform.c#L1557) is where I attempted to make the required changes. The problems I ran into were on the order of getting a hold of the entire string of --foobar. Ideas?

@erkyrath
Copy link
Contributor

erkyrath commented Aug 3, 2020

I took a quick look this weekend. I decided that the least invasive plan was to modify read_command_line() to check for --list, --size, and --opt and reformat those arguments before calling execute_icl_command().

I would not change any of the parsing in execute_icl_command(). So the new --opt format would not be legal in .icl files or !% comments -- only on the command line.

I haven't started on any of this, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants