diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 99c39293cc..3701fed04e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,17 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ * harbour/makefile.vc + Unfortunately MinGW always link main() function if it locate + it in libraries and ignores WinMain() what effectively makes + impossible to create Windows GUI programs if we have main() in + VM library. People who are using MinGW and wants to create only + pure console programs should now include mainstd library to linked + library list. + + * harbour/source/vm/cmdarg.c + * harbour/source/vm/mainwin.c + + added two new functions: hb_winmainArgInit() and hb_winmainArgGet() + to set/retrieve WinMain() parameters. 2006-03-10 12:20 UTC+0100 Ryszard Glab diff --git a/harbour/doc/en/compiler.txt b/harbour/doc/en/compiler.txt index a59b189469..811ec23860 100644 --- a/harbour/doc/en/compiler.txt +++ b/harbour/doc/en/compiler.txt @@ -131,6 +131,16 @@ * * Currently not supported in Harbour. * + * /r= sets maximum number of preprocessor iterations + * ================= + * + * This set the maximum number of preprocessor iterations + * during processing the source code. If this switch is not + * used then the preprocessor stops after 1024 iterations. + * This value is used to stop processing of infinite loops, + * for example: + * #command ( => (,7 + * * /s syntax check only * ================= * diff --git a/harbour/doc/pragma.txt b/harbour/doc/pragma.txt index 88b4e7633c..c4ca7788ef 100644 --- a/harbour/doc/pragma.txt +++ b/harbour/doc/pragma.txt @@ -87,3 +87,106 @@ be used anyway because it is included inside the source. Dec 1, 1999 Regards, Jose Lalin + + +SPECIAL PRAGMAS +=============== + These pragmas allows to control the processing of PRG source within +the preprocessor. The special handling is done with a text enclosed +beetwen the '#pragma ' and '#pragma __endtext' + +#pragma __text +-------------- +Syntax: + #pragma __text '|' [LineOutputCode] '|' [FinallyCode] '|' [StartupCode] + + Every line of text is stringified using '[' and ']' markers and is + passed to 'LineOutputCode' using C '%s' formating code. The result + text is passed further to the syntax analyzer. The 'StartupCode' + is returned at the very beginning of procesing. The 'FinallyCode' + is returned at the end. If 'LineOutputCode' is ommited then all + lines are ignored. + + For example, this pragma is used to implement TEXT/ENDTEXT command + + #command TEXT => #pragma __text|Qout(%s)|QQout() + #command TEXT TO PRINTER => ; + #pragma __text|Qout(%s)|__TextRestore()|__TextSave("PRINTER") + #command TEXT TO FILE => ; + #pragma __text|Qout(%s)|__TextRestore()|__TextSave(<"file">) + +#pragma __stream +---------------- +Syntax: + #pragma __stream '|' [JoinLineCode] '|' [EndingCode] '|' [StartingCode] + + All lines are joined together. The result text is stringified and is + appended to 'StartingCode'. Finally the 'EndingCode' is appended. + The resulting text is returned for further syntax analysis. + + For example: + + #command TEXT TO VAR => ; + #pragma __stream|%s||:= + + TEXT TO VAR v + This is 'example' text with ''""[] embeded + ENDTEXT + + The above example is preprocessed into: + v:=[This is 'example' text with ''""[] embeded] + +#pragma __cstream +---------------- +Syntax: + #pragma __cstream '|' [JoinLineCode] '|' [EndingCode] '|' [StartingCode] + + This is simmilar to '#pragma __stream' with the additional convertion + of C esc sequences e.g \n \t \r \b + + For example: + + #command TEXT TO VAR => ; + #pragma __stream|%s||:= + + TEXT TO VAR v + This is 'example' text with ''""[] embeded and C \n + sequence + ENDTEXT + ? v + + The above example is preprocessed into: + v:=[This is 'example' text with ''""[] embeded and C \nsequence] + qout(v) + + and at runtime the following is printed: + + This is 'example' text with ''""[] embeded and C + sequence + +#pragma __endtext +----------------- +Syntax: + #pragma __endtext + + This pragma is used to finish the special processing defined with + #pragma [__text | __stream | __cstream] + + The following command is hardcoded in the preprocessor: + + #xcommand ENDTEXT => #pragma __endtext + +#pragma RECURSELEVEL +-------------------- +Syntax: + #pragma RECURSELEVEL + + This pragma sets the maximum number of preprocess iterations during + the source code translation. The dfault value is 1024. + This is the same as /r= command line switch + + For example: + + #pragma RECURSELEVEL 2048 + + \ No newline at end of file diff --git a/harbour/include/hbpp.h b/harbour/include/hbpp.h index 3bda4301ee..75d71bfa65 100644 --- a/harbour/include/hbpp.h +++ b/harbour/include/hbpp.h @@ -116,7 +116,7 @@ extern int hb_pp_LastOutLine; extern BOOL hb_pp_StreamBlock; extern BOOL hb_pp_NestedLiteralString; extern BOOL hb_pp_LiteralEscSeq; -unsigned int hb_pp_MaxTranslateCycles; +extern unsigned int hb_pp_MaxTranslateCycles; /* PPCOMP.C exported functions */ diff --git a/harbour/source/compiler/hbusage.c b/harbour/source/compiler/hbusage.c index 832793ed66..9f376c2344 100644 --- a/harbour/source/compiler/hbusage.c +++ b/harbour/source/compiler/hbusage.c @@ -84,6 +84,7 @@ void hb_compPrintUsage( char * szSelf ) "\n %cp[] generate pre-processed output (.ppo) file", "\n %cq quiet", "\n %cq0 quiet and don't display program header", + "\n %cr= set maximum number of preprocessor iterations", /* TODO: "\n %cr[] request linker to search (or none)", */ "\n %cs syntax check only", /* TODO: "\n %ct path for temp file creation", */