Structorizer.Desktop icon indicating copy to clipboard operation
Structorizer.Desktop copied to clipboard

Enhancement proposal: Progress display for code import on command line

Open GitMensch opened this issue 6 years ago • 3 comments

This is a follow-up to #553 to discuss / handle the progress on command line.

My suggestion is to

  • get max number:
    • get line number for the file to be processed (steps pre-processing, parsing, possibly also for building diagrams)
    • for post-processing diagrams: use the amount of diagrams created
  • calculate 5%
  • check in all phases if the current state has processed to a new 5% frame
  • if yes output the number of "new" 5% slots
  • in any case: output the name of each finished nsd result (if there are any statistics like number of [nested] statements, about variables, ... I'd output it next to it)

The output would be something like

D:\VMShare\Structorizer\Structorizer.bat -p -e UTF-8 -o batch\proc5.nsd proc5.c

$ Structorizer.sh -p COBOL -e ISO-88591 -o out Worldcities0.cob

Import COBOL code, Worldcities0.cob
Pre-processing file      ********************
Parsing code             ********************
Building diagrams        ********************
Post-processing diagrams ********************
Created diagrams         3

Worldcities0.nsd
ImportDefinitions.nsd
FileStatus.nsd

$ Structorizer.sh -p -e UTF-8 -o out File1.c

Import ANSI C code, File1.c
Pre-processing file      ********************
Parsing code             ********************
Building diagrams        ******

output one asterisk to stdout for each 5 %, maybe add a new option -tui to not conflict with a possibly wanted stdout redirection.

@codemanyak previously said:

O well, I understand. For the first three phases, an actual forecast is very difficult (if not impossible). So the progress bars are just oscillating left-to-right and vice versa during their phase is running and then show 100 % on completion. The first phase would require e.g. a line counting in advance - this would be feasible, of course. But then it's parser-dependent and rather inefficient. I decided for a default mechanism chiefly based on the CodeParser base class to make it simple. The only phase with a clear load forecast is the last one (where we know the number of diagrams to process). So the loop would give us a chance. Unfortunately, this is supposed to be the fastest phase, so it did hardly make sense to provide percentages exactly here. But nevertheless your idea isn't so bad. Asterisks might be produced on a regular base in verbose mode.

The requested progress information in batch mode still hasn't been implemented with version 3.28-05. It stands somewhat in conflict with #179 (comment) (option to redirect the output to stdout), I think. So I wanted to have more time to consider the consequences and possible solutions.

GitMensch avatar Sep 25 '18 12:09 GitMensch

  1. This will certainly require at least one additional pass through the source file in order to count the lines.
  2. Then it will be up to the different parsers to produce sensible progress events.

Well, I will have a look at it. Yet I don't promise anything soon.

codemanyak avatar Sep 25 '18 19:09 codemanyak

Just a question: @GitMensch wrote:

maybe add a new option -tui to not conflict with a possibly wanted stdout redirection.

Is there some deciphering for "tui"? Perhaps "time(d) user interaction", "time use information" or something the like? Just asking.

codemanyak avatar Sep 27 '18 14:09 codemanyak

TUI => textual user interface --show-progress would be much better ;-)

GitMensch avatar Sep 27 '18 15:09 GitMensch