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

Add '#cmdline "args..."' directive #341

Merged
merged 17 commits into from Sep 5, 2021
Merged

Add '#cmdline "args..."' directive #341

merged 17 commits into from Sep 5, 2021

Commits on Sep 4, 2021

  1. fbc: #cmdline "args..." directive to specify command line arguments w…

    …ithin source files
    
    - refactor parseArgsFromFile() and add parseArgsFromString()
    - #cmdline "args..." will invoke parseArgsFromString( "args..." )
    jayrm committed Sep 4, 2021
    Copy the full SHA
    f359e3b View commit details
    Browse the repository at this point in the history
  2. fbc: sanitize whitespace for compiler source files changed in last co…

    …mmit
    
    - fbc.bas, pp-cond.bas, pp.bas, pp.bi
    jayrm committed Sep 4, 2021
    Copy the full SHA
    d0213fa View commit details
    Browse the repository at this point in the history
  3. fbc: internal change - replace fbc.bas:option_takes_argument() array …

    …with cmdlineOptionTB()
    
    - cmdlineOptionTB() has type of FB_CMDLINE_OPTION
    
    type FBC_CMDLINE_OPTION
    	takes_argument as boolean          '' true = option requires argument
    	allowed_in_source as boolean       '' true = can be used with #cmdline directive
    	restart_required as boolean        '' true = restart of parser is required when used with #cmdline directive
    end type
    
    - WIP: initially set 'allowed_in_source' to FALSE for all options
    - WIP: initially set 'restart_required' to FALSE for all options
    jayrm committed Sep 4, 2021
    Copy the full SHA
    ce124fd View commit details
    Browse the repository at this point in the history
  4. fbc: internal change #cmdline handling

    - rename parseArgsFromString() to fbcParseArgsFromString(), it's a public re-entry point in to fbc main module
    - add is_source and is_file parameters to handleArg()
    - add is_source and is_file parameters to fbcParseArgsFromString()
    - add is_source parameter parseArgsFromFile()
    jayrm committed Sep 4, 2021
    Copy the full SHA
    8b554ee View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    4ef0b37 View commit details
    Browse the repository at this point in the history
  6. fbc: add '-z nocmdline' command line option to ignore #cmdline direct…

    …ives - allows overriding source directives with real fbc command line
    jayrm committed Sep 4, 2021
    Copy the full SHA
    df365d5 View commit details
    Browse the repository at this point in the history
  7. Copy the full SHA
    3652369 View commit details
    Browse the repository at this point in the history
  8. fbc: #cmdline - restart the parser for some command line options

    - track the module count and only process #cmdline directives in the first module
    - modules other than the first will ignore #cmdline directives with a warning
    - add #cmdline "-end" to trigger a restart of the parser - fbc doesn't know how to detect the end of all #cmdline directives to automatically trigger a restart
    jayrm committed Sep 4, 2021
    Copy the full SHA
    ba04e7d View commit details
    Browse the repository at this point in the history
  9. Copy the full SHA
    52a9ec6 View commit details
    Browse the repository at this point in the history
  10. fbc: #cmdline - clean-up cmdlineOptionTB()

    - #cmdline "-end" will trigger a restart of the parser
    - remaining !!!TODO!!!'s should only be for special cases and major restarts
    - error if #cmdline is used anywhere but module level
    jayrm committed Sep 4, 2021
    Copy the full SHA
    2d90ea6 View commit details
    Browse the repository at this point in the history
  11. fbc: #cmdline - refactor 'restarts' to used restart flags instead of …

    …restart count
    
    - add 'enum FB_RESTART_FLAGS' to track restart requests and restart history
    - FB_RESTART_FLAGS tracks if the restart is due to #cmdline or #lang
    - fbInit() expects a FB_RESTART_FLAGS argument instead of restart counts
    - in cmdlineOptionTB() add a member to indicate if fbc needs to be restarted for each option
      which would be the case for some options that need to be initialized even before the parser
      (currently not used)
    jayrm committed Sep 4, 2021
    Copy the full SHA
    dfc58d2 View commit details
    Browse the repository at this point in the history
  12. fbc: #cmdline - fix restart after missing #cmdline "-end"

    - if #cmdline "-end" was never given, then detect that a restart is required at the end of parsing the source
    - change the warning level for ignored #cmdline's - by default not shown but will show with '-w all'
    jayrm committed Sep 4, 2021
    Copy the full SHA
    ac95dc3 View commit details
    Browse the repository at this point in the history
  13. Copy the full SHA
    db2576f View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2021

  1. fbc: #cmdline - internal naming changes

    - rename the 'restart' procedures
    - declare sub fbRestartBeginRequest( byval flags as FB_RESTART_FLAGS )
    - declare sub fbRestartAcceptRequest( byval flags as FB_RESTART_FLAGS )
    - declare sub fbRestartCloseRequest( byval flags as FB_RESTART_FLAGS )
    
    This should provide a readable sequence for restarting the parser or fbc:
    - Begin / Accept / Close
    - the underlying state for request/action/status to be updated through this interface
    jayrm committed Sep 5, 2021
    Copy the full SHA
    5338281 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    ce373b2 View commit details
    Browse the repository at this point in the history
  3. fbc: #cmdline - remove the remaining limitations on options

    - all command line options are allowed with #cmdline except '-help' and '-print'
    - not all options have been tested with #cmdline in a real test
    - added #cmdline "-restart" just in case #cmdline "-end" gives troubles
    - #cmdline "-end" will restart the parser or fbc if needed
    - #cmdline "-restart" will always restart fbc with the new command line options
    jayrm committed Sep 5, 2021
    Copy the full SHA
    6fd100e View commit details
    Browse the repository at this point in the history
  4. fbc: #cmdline

    - github freebasic#341: fbc: #cmdline "args..." directive to specify command line arguments within source files, restarting the parser from some options
    - github freebasic#341: fbc: #cmdline "-end" will trigger a parser or fbc restart if needed.  fbc can't detect the end of reading all the #cmdlines to do this automatically
    - github freebasic#341: fbc: #cmdline "-restart" will always trigger an fbc restart
    - github freebasic#341: fbc: only process #cmdline in the first source module (which must be specified on the real command line)
    - github freebasic#341: fbc: add '-z nocmdline' command line option to ignore #cmdline directives - allows overriding source directives with real fbc command line
    jayrm committed Sep 5, 2021
    Copy the full SHA
    7486f13 View commit details
    Browse the repository at this point in the history