Changeset 4537 for trunk/compiler

Show
Ignore:
Timestamp:
10/25/08 08:56:44 (3 months ago)
Author:
pmoura
Message:

Updated the Logtalk compiler to prefix all informative messages with the line comment character, "%", to make it easier to use interactive section transcripts as scripts.

Corrected some typos in the reference manual.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/compiler/logtalk.pl

    r4535 r4537  
    15981598        (   '$lgt_compiler_flag'(report, on) -> 
    15991599            (   CCounter + LCounter =:= 0 ->                            % no warnings 
    1600                 write('(0 warnings)'), nl 
     1600                write('(0 warnings)'), nl 
    16011601            ;   CCounter =:= 0 ->                                       % no compilation warnings  
    1602                 write('('), write(LCounter), write(' loading '), 
     1602                write('('), write(LCounter), write(' loading '), 
    16031603                '$lgt_write_warnings_word'(LCounter), write(')'), nl 
    16041604            ;   LCounter =:= 0 ->                                       % no loading warnings 
    1605                 write('('), write(CCounter), write(' compilation '), 
     1605                write('('), write(CCounter), write(' compilation '), 
    16061606                '$lgt_write_warnings_word'(CCounter), write(')'), nl 
    1607             ;   write('('), write(CCounter), write(' compilation '),    % both compilation and loading warnings 
     1607            ;   write('('), write(CCounter), write(' compilation '), % both compilation and loading warnings 
    16081608                '$lgt_write_warnings_word'(CCounter), write(' and '), 
    16091609                write(LCounter), write(' loading '), 
     
    42824282    (   '$lgt_compiler_flag'(report, on) -> 
    42834283        '$lgt_inc_load_warnings_counter', 
    4284         write('    WARNING!  Redefining '), write(Type), write(' '),  
     4284        write('    WARNING!  Redefining '), write(Type), write(' '),  
    42854285        current_output(Output), '$lgt_pretty_print_vars_quoted'(Output, Entity), nl, 
    42864286        (   File == nil -> 
     
    42884288        ;   % we've conflicting entities coming from different source files: 
    42894289            File = Base-Path, 
    4290             write('              loaded from file '), write(Base), write(' ('), write(Path), write(')'), nl 
     4290            write('              loaded from file '), write(Base), write(' ('), write(Path), write(')'), nl 
    42914291        ) 
    42924292    ;   true 
     
    43264326    retractall('$lgt_pp_entity_warnings_flag_'), 
    43274327    (   '$lgt_compiler_flag'(report, on) -> 
    4328         write('    compiling '), write(Type),   write(' '), 
     4328        write('    compiling '), write(Type),    write(' '), 
    43294329        current_output(Output), '$lgt_pretty_print_vars_quoted'(Output, Entity), 
    43304330        (   '$lgt_compiler_flag'(debug, on) -> 
     
    43444344    (   '$lgt_compiler_flag'(report, on) -> 
    43454345        (   '$lgt_pp_entity_warnings_flag_' -> 
    4346             nl, write('    compiled'), nl 
     4346            nl, write('    compiled'), nl 
    43474347        ;   write('compiled'), nl 
    43484348        ) 
     
    43584358'$lgt_report_working_directory'(Directory) :- 
    43594359    (   '$lgt_compiler_flag'(report, on) -> 
    4360         nl, write('+++ working on directory '), write(Directory), nl 
     4360        nl, write('%  +++ working in directory '), write(Directory), nl 
    43614361    ;   true 
    43624362    ). 
     
    43704370'$lgt_report_compiling_file'(File) :- 
    43714371    (   '$lgt_compiler_flag'(report, on) -> 
    4372         write('>>> compiling source file '), writeq(File), 
     4372        write('>>> compiling source file '), writeq(File), 
    43734373        (   '$lgt_compiler_flag'(debug, on) -> 
    43744374            write(' in debug mode...') 
     
    43874387'$lgt_report_up_to_date_file'(File) :- 
    43884388    (   '$lgt_compiler_flag'(report, on) -> 
    4389         write('>>> compiling source file '), writeq(File), write('... up-to-date'), nl 
     4389        write('>>> compiling source file '), writeq(File), write('... up-to-date'), nl 
    43904390    ;   true 
    43914391    ). 
     
    43994399'$lgt_report_compiled_file'(File) :- 
    44004400    (   '$lgt_compiler_flag'(report, on) -> 
    4401         write('>>> '), writeq(File), write(' source file compiled'), nl 
     4401        write('>>> '), writeq(File), write(' source file compiled'), nl 
    44024402    ;   true 
    44034403    ). 
     
    44114411'$lgt_report_loading_file'(File) :- 
    44124412    (   '$lgt_compiler_flag'(report, on) -> 
    4413         write('<<< loading source file '), writeq(File), write('... '), nl 
     4413        write('<<< loading source file '), writeq(File), write('... '), nl 
    44144414    ;   true 
    44154415    ). 
     
    44224422'$lgt_report_reloading_file'(File) :- 
    44234423    (   '$lgt_compiler_flag'(report, on) -> 
    4424         write('<<< reloading source file '), writeq(File), write('... '), nl 
     4424        write('<<< reloading source file '), writeq(File), write('... '), nl 
    44254425    ;   true 
    44264426    ). 
     
    44334433'$lgt_report_skipping_file'(File) :- 
    44344434    (   '$lgt_compiler_flag'(report, on) -> 
    4435         write('<<< skipping loading of source file '), writeq(File), write(' (already loaded) '), nl 
     4435        write('<<< skipping loading of source file '), writeq(File), write(' (already loaded) '), nl 
    44364436    ;   true 
    44374437    ). 
     
    44444444'$lgt_report_loaded_file'(File) :- 
    44454445    (   '$lgt_compiler_flag'(report, on) -> 
    4446         write('<<< '), writeq(File), write(' source file loaded'), nl 
     4446        write('<<< '), writeq(File), write(' source file loaded'), nl 
    44474447    ;   true 
    44484448    ). 
     
    44554455'$lgt_report_reloaded_file'(File) :- 
    44564456    (   '$lgt_compiler_flag'(report, on) -> 
    4457         write('<<< '), writeq(File), write(' source file reloaded'), nl 
     4457        write('<<< '), writeq(File), write(' source file reloaded'), nl 
    44584458    ;   true 
    44594459    ). 
     
    47524752    ), 
    47534753    (   Names == [] -> 
    4754         write('        WARNING!  Singleton variable ') 
    4755     ;   write('        WARNING!  Singleton variables ') 
     4754        write('        WARNING!  Singleton variable ') 
     4755    ;   write('        WARNING!  Singleton variables ') 
    47564756    ), 
    47574757    'lgt_report_singletons_term'(Term), 
     
    48664866'$lgt_compiler_error_handler'(Error) :- 
    48674867    ('$lgt_pp_entity'(_, _, _, _, _) -> nl; true), 
    4868     write('        ERROR!    '), writeq(Error), nl, 
     4868    write('        ERROR!    '), writeq(Error), nl, 
    48694869    '$lgt_restore_global_op_table', 
    48704870    '$lgt_clean_pp_clauses', 
     
    48814881    '$lgt_report_compiler_error_message'(Error), 
    48824882    (   catch('$lgt_stream_current_line_number'(Stream, Line), _, fail) -> 
    4883         write('                  above line: '), write(Line) 
     4883        write('%                    above line: '), write(Line), nl 
    48844884    ;   true 
    4885     ), 
    4886     nl. 
     4885    ). 
    48874886 
    48884887 
     
    48904889    !, 
    48914890    ('$lgt_pp_entity'(_, _, _, _, _) -> nl; true), 
    4892     write('        ERROR!    '), writeq(Error), nl, 
    4893     write('                  in '), write(Type), write(': '), writeq(Entity), nl. 
     4891    write('        ERROR!    '), writeq(Error), nl, 
     4892    write('                  in '), write(Type), write(': '), writeq(Entity), nl. 
    48944893 
    48954894'$lgt_report_compiler_error_message'(error(Error, directive(Directive))) :- 
    48964895    !, 
    48974896    ('$lgt_pp_entity'(_, _, _, _, _) -> nl; true), 
    4898     write('        ERROR!    '), writeq(Error), nl, 
    4899     write('                  in directive: '), writeq((:- Directive)), nl. 
     4897    write('        ERROR!    '), writeq(Error), nl, 
     4898    write('                  in directive: '), writeq((:- Directive)), nl. 
    49004899 
    49014900'$lgt_report_compiler_error_message'(error(Error, clause(Clause))) :- 
    49024901    !, 
    49034902    ('$lgt_pp_entity'(_, _, _, _, _) -> nl; true), 
    4904     write('        ERROR!    '), writeq(Error), nl, 
    4905     write('                  in clause: '), writeq(Clause), nl. 
     4903    write('        ERROR!    '), writeq(Error), nl, 
     4904    write('                  in clause: '), writeq(Clause), nl. 
    49064905 
    49074906'$lgt_report_compiler_error_message'(error(Error, dcgrule(Rule))) :- 
    49084907    !, 
    49094908    ('$lgt_pp_entity'(_, _, _, _, _) -> nl; true), 
    4910     write('        ERROR!    '), writeq(Error), nl, 
    4911     write('                  in grammar rule: '), writeq((Rule)), nl. 
     4909    write('        ERROR!    '), writeq(Error), nl, 
     4910    write('                  in grammar rule: '), writeq((Rule)), nl. 
    49124911 
    49134912'$lgt_report_compiler_error_message'(error(Error, Term)) :- 
    49144913    !, 
    49154914    ('$lgt_pp_entity'(_, _, _, _, _) -> nl; true), 
    4916     write('        ERROR!    '), writeq(Error), nl, 
    4917     write('                  in: '), writeq(Term), nl. 
     4915    write('        ERROR!    '), writeq(Error), nl, 
     4916    write('                  in: '), writeq(Term), nl. 
    49184917 
    49194918'$lgt_report_compiler_error_message'(Error) :- 
    49204919    ('$lgt_pp_entity'(_, _, _, _, _) -> nl; true), 
    4921     write('        ERROR!    '), writeq(Error), nl. 
     4920    write('        ERROR!    '), writeq(Error), nl. 
    49224921 
    49234922 
     
    49254924    (   Line =:= -1 -> 
    49264925        (   catch('$lgt_stream_current_line_number'(Stream, Next), _, fail) -> 
    4927             write('                  above line: '), write(Next) 
     4926            write('                  above line: '), write(Next) 
    49284927        ;   true 
    49294928        ) 
    4930     ;   write('                  at line: '), write(Line) 
     4929    ;   write('                  at line: '), write(Line) 
    49314930    ). 
    49324931 
     
    53045303    !, 
    53055304    (   '$lgt_compiler_flag'(portability, warning) -> 
    5306         nl, write('        WARNING!  Ignoring Prolog directive: '), writeq(Dir), 
     5305        nl, write('        WARNING!  Ignoring Prolog directive: '), writeq(Dir), 
    53075306        nl, '$lgt_report_compiler_error_line_number'(Line, Input) 
    53085307    ;   true 
     
    53145313    !, 
    53155314    (   '$lgt_compiler_flag'(portability, warning) -> 
    5316         nl, write('        WARNING!  Rewriting Prolog directive:         '), writeq(Dir), 
    5317         nl, write('                  Copying resulting Prolog directive: '), writeq(RWDir), 
     5315        nl, write('        WARNING!  Rewriting Prolog directive:         '), writeq(Dir), 
     5316        nl, write('                  Copying resulting Prolog directive: '), writeq(RWDir), 
    53185317        nl, '$lgt_report_compiler_error_line_number'(Line, Input) 
    53195318    ;   true 
     
    53245323    !, 
    53255324    (   '$lgt_compiler_flag'(portability, warning) -> 
    5326         nl, write('        WARNING!  Rewriting Prolog directive:             '), writeq(Dir), 
    5327         nl, write('                  Recompiling resulting Prolog directive: '), writeq(RWDir), 
     5325        nl, write('        WARNING!  Rewriting Prolog directive:             '), writeq(Dir), 
     5326        nl, write('                  Recompiling resulting Prolog directive: '), writeq(RWDir), 
    53285327        nl, '$lgt_report_compiler_error_line_number'(Line, Input) 
    53295328    ;   true 
     
    56615660            '$lgt_pp_entity'(Type, _, _, _, _), 
    56625661            '$lgt_inc_compile_warnings_counter', 
    5663             nl, write('        WARNING!  Ignoring synchronized predicate directive: '), 
     5662            nl, write('        WARNING!  Ignoring synchronized predicate directive: '), 
    56645663            write(Type), write(' already declared as synchronized!'), 
    56655664            nl, '$lgt_report_compiler_error_line_number'(Line, Input) 
     
    67016700    functor(Head, Functor, Arity), 
    67026701    '$lgt_inc_compile_warnings_counter', 
    6703     nl, write('        WARNING!  Redefining a Logtalk built-in predicate: '), 
     6702    nl, write('        WARNING!  Redefining a Logtalk built-in predicate: '), 
    67046703    writeq(Functor/Arity), 
    67056704    nl, '$lgt_report_compiler_error_line_number'(Line, Input), 
     
    67166715    functor(Head, Functor, Arity), 
    67176716    '$lgt_inc_compile_warnings_counter', 
    6718     nl, write('        WARNING!  Redefining a Prolog built-in predicate: '), 
     6717    nl, write('        WARNING!  Redefining a Prolog built-in predicate: '), 
    67196718    writeq(Functor/Arity), 
    67206719    nl, '$lgt_report_compiler_error_line_number'(Line, Input), 
     
    67306729    '$lgt_compiler_flag'(report, on), 
    67316730    '$lgt_inc_compile_warnings_counter', 
    6732     nl, write('        WARNING!  Missing reference to the "monitoring" built-in protocol: '), 
     6731    nl, write('        WARNING!  Missing reference to the "monitoring" built-in protocol: '), 
    67336732    writeq(Functor/3), 
    67346733    nl, '$lgt_report_compiler_error_line_number'(Line, Input), 
     
    67446743    '$lgt_compiler_flag'(report, on), 
    67456744    '$lgt_inc_compile_warnings_counter', 
    6746     nl, write('        WARNING!  Missing reference to the "expanding" built-in protocol: '), 
     6745    nl, write('        WARNING!  Missing reference to the "expanding" built-in protocol: '), 
    67476746    writeq(Functor/3), 
    67486747    nl, '$lgt_report_compiler_error_line_number'(Line, Input), 
     
    91759174        nl, 
    91769175        (   Objs = [_] -> 
    9177             write('        WARNING!  Reference to unknown object:      ') 
    9178         ;   write('        WARNING!  References to unknown objects:    ') 
     9176            write('        WARNING!  Reference to unknown object:      ') 
     9177        ;   write('        WARNING!  References to unknown objects:    ') 
    91799178        ), 
    91809179        '$lgt_writeq_list'(Objs) 
     
    92029201        nl, 
    92039202        (   Ptcs = [_] -> 
    9204             write('        WARNING!  Reference to unknown protocol:    ') 
    9205         ;   write('        WARNING!  References to unknown protocols:  ') 
     9203            write('        WARNING!  Reference to unknown protocol:    ') 
     9204        ;   write('        WARNING!  References to unknown protocols:  ') 
    92069205        ), 
    92079206        '$lgt_writeq_list'(Ptcs) 
     
    92289227        nl, 
    92299228        (   Ctgs = [_] -> 
    9230             write('        WARNING!  Reference to unknown category:    ') 
    9231         ;   write('        WARNING!  References to unknown categories: ') 
     9229            write('        WARNING!  Reference to unknown category:    ') 
     9230        ;   write('        WARNING!  References to unknown categories: ') 
    92329231        ), 
    92339232        '$lgt_writeq_list'(Ctgs) 
     
    1059410593    nl, 
    1059510594    (   Preds = [_] -> 
    10596         write('        WARNING!  This declared static predicate is called but never defined: ') 
    10597     ;   write('        WARNING!  These declared static predicates are called but never defined: ') 
     10595        write('        WARNING!  This declared static predicate is called but never defined: ') 
     10596    ;   write('        WARNING!  These declared static predicates are called but never defined: ') 
    1059810597    ), 
    1059910598    '$lgt_writeq_list'(Preds), 
     
    1064410643        nl, 
    1064510644        (   Preds = [_] -> 
    10646             write('        WARNING!  This predicate is called but never defined: ') 
    10647         ;   write('        WARNING!  These predicates are called but never defined: ') 
     10645            write('        WARNING!  This predicate is called but never defined: ') 
     10646        ;   write('        WARNING!  These predicates are called but never defined: ') 
    1064810647        ), 
    1064910648        '$lgt_writeq_list'(Preds) 
     
    1068210681    nl, 
    1068310682    (   Preds = [_] -> 
    10684         write('        WARNING!  Call to non-standard Prolog built-in predicate: ') 
    10685     ;   write('        WARNING!  Calls to non-standard Prolog built-in predicates: ') 
     10683        write('        WARNING!  Call to non-standard Prolog built-in predicate: ') 
     10684    ;   write('        WARNING!  Calls to non-standard Prolog built-in predicates: ') 
    1068610685    ), 
    1068710686    '$lgt_writeq_list'(Preds), 
     
    1071110710    nl, 
    1071210711    (   Functions = [_] -> 
    10713         write('        WARNING!  Call to non-standard Prolog built-in arithmetic function: ') 
    10714     ;   write('        WARNING!  Calls to non-standard Prolog built-in arithmetic functions: ') 
     10712        write('        WARNING!  Call to non-standard Prolog built-in arithmetic function: ') 
     10713    ;   write('        WARNING!  Calls to non-standard Prolog built-in arithmetic functions: ') 
    1071510714    ), 
    1071610715    '$lgt_writeq_list'(Functions),