2006-03-10 12:20 UTC+0100 Ryszard Glab <rglab//imid.med.pl>

* include/hbpp.h
    + added 'extern' declaration

  * source/compiler/hbusage.c
    + added short usage info abour /r= switch

  * doc/pragma.txt
  * doc/en/compiler.txt
    + added documentation about new pragmas and new /r= switch
This commit is contained in:
Ryszard Glab
2006-03-10 11:16:12 +00:00
parent 9ddcccdef6
commit 23c07b16d9
5 changed files with 126 additions and 1 deletions

View File

@@ -8,6 +8,17 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
* 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 <rglab//imid.med.pl>

View File

@@ -131,6 +131,16 @@
*
* Currently not supported in Harbour.
*
* /r=<max> sets maximum number of preprocessor iterations </par>
* ================= </par>
*
* 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 </par>
* ================= </par>
*

View File

@@ -87,3 +87,106 @@ be used anyway because it is included inside the source.
Dec 1, 1999
Regards,
Jose Lalin <dezac@corevia.com>
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 <type>' 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 <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 <var> => ;
#pragma __stream|%s||<var>:=
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 <var> => ;
#pragma __stream|%s||<var>:=
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 <nNumberOfIterations>
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

View File

@@ -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 */

View File

@@ -84,6 +84,7 @@ void hb_compPrintUsage( char * szSelf )
"\n %cp[<path>] generate pre-processed output (.ppo) file",
"\n %cq quiet",
"\n %cq0 quiet and don't display program header",
"\n %cr=<max> set maximum number of preprocessor iterations",
/* TODO: "\n %cr[<lib>] request linker to search <lib> (or none)", */
"\n %cs syntax check only",
/* TODO: "\n %ct<path> path for temp file creation", */