#cmdline "args..." directive

Forum for discussion about the documentation project.
fxm
Moderator
Posts: 10529
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: #cmdline "args..." directive

Postby fxm » Sep 12, 2021 6:22

What should this do ?
#cmdline "-version"
I still can't see anything displayed (even with the last daily build) !
and even with a final:
#cmdline "-restart"
SARG
Posts: 1280
Joined: May 27, 2005 7:15
Location: FRANCE

Re: #cmdline "args..." directive

Postby SARG » Sep 12, 2021 7:24

Text of the change :

Code: Select all

fbc: #cmdline - don't allow #cmdline "-version" option

and the changed line of code

Code: Select all

( FALSE, TRUE , FALSE, TRUE  ), _ '' OPT_VERSION      must restart fbc to get the version message
coderJeff
Site Admin
Posts: 3593
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: #cmdline "args..." directive

Postby coderJeff » Sep 12, 2021 9:50

fxm wrote:What should this do ?
#cmdline "-version"

The line that prints the version is commented out. At the moment '-version' is allowed, but doesn't do anything other than trigger a restart.
Sorry fellas, I have made conflicting messages in the source / changelog.txt.

I am open to suggestions, here's some notes on my thoughts while developing:
I had started off with '-version' to be disallowed like '-print' and '-help'. Because in these 3 cases when used from shell command line, fbc shows information and then stops. So it doesn't make much sense to allow them in source code.

But, then I had this idea that when a user asks for help on the forum, it would be nice to be able to ask the user to add '#cmdline "-version -v"' ... or something like it to the top of their source and report the output. They could be running from from shell or any number of IDE's and this would be a common way to ask for extra information to help them.

The side effect is that various combinations of '-version' and '-v' on the shell command line and in source '#cmdline' cause duplicate and sometimes confusing information to be shown.

I will make one more change: '#cmdline "-version" will show the fbc version, but not stop compilation process.
Then will get some more feedback from users.

----

For debugging the build process the goal/idea started out something like the following if the shell command line had '-v' option:

$ fbc restart.bas -v

Code: Select all

#cmdline "-gen llvm -r"
#print "compiling source..."

OUTPUT:
FreeBASIC Compiler - Version 1.09.0 (2021-09-12), built for win32 (32bit)
Copyright (C) 2004-2021 The FreeBASIC development team.
standalone
target: win32, 486, 32bit
backend: gas
compiling: restart.bas -o restart.asm (main module)
compiling source...
Restarting fbc ...
target: win32, 486, 32bit
backend: llvm
compiling: restart.bas -o restart.ll
compiling source...
coderJeff
Site Admin
Posts: 3593
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: #cmdline "args..." directive

Postby coderJeff » Sep 12, 2021 14:47

coderJeff wrote:
fxm wrote:What should this do ?
#cmdline "-version"

...
I will make one more change: '#cmdline "-version" will show the fbc version, but not stop compilation process.
Then will get some more feedback from users.


I pushed changed to 1.09.0 as follows:
* fbc: #cmdline print version information with #cmdline "-version"

- #cmdline "-version" will immediately print the fbc version information if it was not already printed.
- To get verbose version information '-v' option must appear before '-version'.
- fbc command line option '-v' option behaviour overrides #cmdline "-v"


Here are all the combinations:

Code: Select all

$ fbc                 
   - show help
   - and stop

$ fbc -help
   - show help
   - and stop           

$ fbc -v
   - show verbose help
   - and stop 

$ fbc -help -v
   - show verbose help
   - and stop 

$ fbc [source.bas] -version
   - show version
   - and stop

$ fbc [source.bas] -v -version
   - show verbose version
   - and stop

$ fbc source.bas
   - normal compile (i.e. show warnings / errors)

$ fbc source.bas -v
   - show version
   - show all build steps

$ fbc source.bas
#cmdline "-v"
   - show build steps, first module steps only shown on second pass

$ fbc source.bas
#cmdline "-version"
   - show version (once only)

$ fbc source.bas
#cmdline "-v -version"
   - show verbose version
   - show build steps, first module steps only shown on second pass

$ fbc source.bas -v
#cmdline "-v"
   - show version
   - show all build steps

$ fbc source.bas -v
#cmdline "-version"
   - show version
   - show all build steps

$ fbc source.bas -v
#cmdline "-v -version"
   - show version
   - show all build steps

Return to “Documentation”

Who is online

Users browsing this forum: No registered users and 2 guests