diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fff6fd899b..b3a2a5f090 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +2001-02-24 13:20 UTC-0800 Ron Pinkas + * contrib/dot/pp.prg + * Minor optimization. + + + contrib/dot/pp.txt + 2001-02-25 20:25 UTC+0300 Alex Shashkov * harbour/source/rdd/dbfcdx2.h * harbour/source/rdd/dbfcdx1.c @@ -9,6 +15,7 @@ *utils/hbdoc/genpdf1.prg utils/hbdoc/rtf.prg *Small enhacements + 2001-02-24 19:45 UTC-0800 Ron Pinkas * contrib/dot/pp.prg + Added CompileNestedBlocks() #ifdef __CLIPPER__, because Clipper's Macro Compiler can *not* compile nested blocks. @@ -18,7 +25,7 @@ Now PP will pre-compile such nested blocks. This makes PP fully functional when compiled with Clipper too :-) */ * harbour/source/rdd/dbfcdx1.c - ! Moved few declarations above the HB_TRACE() lien, to fix compilation errors. + ! Moved few declarations above the HB_TRACE() line, to fix compilation errors. 2001-02-24 18:10 UTC+0300 Alex Shashkov * harbour/source/rtl/console.c diff --git a/harbour/contrib/dot/pp.prg b/harbour/contrib/dot/pp.prg index d1b69a6a46..d0593e7dd3 100644 --- a/harbour/contrib/dot/pp.prg +++ b/harbour/contrib/dot/pp.prg @@ -319,14 +319,18 @@ PROCEDURE ExecuteLine( sPPed ) ENDIF ENDDO - sSymbol := Upper( Left( sBlock, 14 ) ) // Len( "__SetOtherwise" ) + IF sBlock = "__" + sSymbol := Upper( SubStr( sBlock, 3, 12 ) ) // Len( "SetOtherwise" ) + ELSE + sSymbol := "" + ENDIF IF nIf == 0 .OR. ; - sSymbol = "__SETIF" .OR. sSymbol = "__SETELSE" .OR. sSymbol = "__SETELSEIF" .OR. sSymbol = "__SETEND" .OR. ; - sSymbol = "__SETDOCASE" .OR. sSymbol = "__SETCASE" .OR. sSymbol = "__SETOTHERWISE" .OR. sSymbol = "__SETENDCASE" .OR. ; + sSymbol = "SETIF" .OR. sSymbol = "SETELSE" .OR. sSymbol = "SETELSEIF" .OR. sSymbol = "SETEND" .OR. ; + sSymbol = "SETDOCASE" .OR. sSymbol = "SETCASE" .OR. sSymbol = "SETOTHERWISE" .OR. sSymbol = "SETENDCASE" .OR. ; abIf[ nIf ] #ifdef __CLIPPER__ - /* Clipper Macro Compiler can't ompile nested blocks! */ + /* Clipper Macro Compiler can't compile nested blocks! */ CompileNestedBlocks( sBlock, @sBlock ) #endif @@ -379,14 +383,18 @@ PROCEDURE ExecuteLine( sPPed ) ENDIF ENDDO - sSymbol := Upper( Left( sBlock, 11 ) ) // Len( "__SetElseIf" ) + IF sBlock = "__" + sSymbol := Upper( SubStr( sBlock, 3, 12 ) ) // Len( "SetOtherwise" ) + ELSE + sSymbol := "" + ENDIF IF nIf == 0 .OR. ; - sSymbol = "__SETIF" .OR. sSymbol = "__SETELSE" .OR. sSymbol = "__SETELSEIF" .OR. sSymbol = "__SETEND" .OR. ; - sSymbol = "__SETDOCASE" .OR. sSymbol = "__SETCASE" .OR. sSymbol = "__SETOTHERWISE" .OR. sSymbol = "__SETENDCASE" .OR. ; + sSymbol = "SETIF" .OR. sSymbol = "SETELSE" .OR. sSymbol = "SETELSEIF" .OR. sSymbol = "SETEND" .OR. ; + sSymbol = "SETDOCASE" .OR. sSymbol = "SETCASE" .OR. sSymbol = "SETOTHERWISE" .OR. sSymbol = "SETENDCASE" .OR. ; abIf[ nIf ] #ifdef __CLIPPER__ - /* Clipper Macro Compiler can't ompile nested blocks! */ + /* Clipper Macro Compiler can't compile nested blocks! */ CompileNestedBlocks( sBlock, @sBlock ) #endif diff --git a/harbour/contrib/dot/pp.txt b/harbour/contrib/dot/pp.txt new file mode 100644 index 0000000000..d7ede9b211 --- /dev/null +++ b/harbour/contrib/dot/pp.txt @@ -0,0 +1,49 @@ +PP has 3 personalities which are tied tightly together. + +1. What is supposed to be 100% Clipper compatible Pre-Processor. Executing + PP followed by a source file name will create which is + the equivalent of the Clipper file. In this mode there + are few optional switches. + + PP filename[.ext] [-U][-DM][-DE][-DP][-CCH] + + -U = Don't load standard rules. + -DM = Show tracing information into the Match Engine. + -DE = Show tracing information into the Expression Scanner. + -DP = Show tracing information into the Output Generator. + -CCH = Generate a .cch file (compiled command header). + + At this point all switches must *not* be separated by any spaces! + +2. DOT prompt, which suppose to allow most of Harbour syntax, with few + exceptions: + + It does *not* support LOCAL/STATIC/PRIVATE/PUBLIC, but any refference + to a variable will create it as PRIVATE. + + It does not (yet) support creation of FUNCTIONs/PROCEDUREs but will + execute any built-in, or linked, prodecure/function. + + It does not (yet) support WHILE and FOR loops. + + Executing PP with no source filename will start the DOT prompt mode. In + this mode you can execute a single line at a time, by typing the line + and pressing the [Enter] key. + + Additionally you may type: + + DO filename.prg [Enter] + + So that DOT will "run" the specified source file. + +3. Finally, PP is a limited Harbour Interpreter. Subject to those same few + limitations it can execute most of Harbour syntax. Executing PP followed + by a source file name and the -R switch, will "RUN" that source (it will + also create the .pp$ file). + + This final syntax is: + + PP filename[.ext] -R + +I intend to add support for UDFs, LOOPs, and Variable scoping, so that the +Interpreter will be as complete as possible.