June 1st. 1999 00:30 Ron Pinkas

Harbour.y -> modified pcode generation to move the push of the counter variable to         the NEXT rather than the FOR
        so loop code may manipulate the counter vaiable.

        TEST/WORKING/TestFor.prg -> added this file
This commit is contained in:
Ron Pinkas
1999-06-01 08:40:05 +00:00
parent 1ea510929f
commit ca31045bcf
4 changed files with 29 additions and 10 deletions

View File

@@ -1546,11 +1546,11 @@ May 31, 1999 Ron Pinkas
Added "Sysntax error :" message for the macro operator (&)
when followed by a string delimiter.
June 1st. 1999 00:30 Ron Pinkas
Harbour.y -> modified pcode generation to move the push of the counter variable to the NEXT rather than the FOR
so loop code may manipulate the counter vaiable.
TEST/WORKING/TestFor.prg -> added this file
* source/pp/pragma.c
* contrib/dot/pp_harb.ch
* tests/inline_c.prg

View File

@@ -842,7 +842,7 @@ EndCase : ENDCASE { --_wCaseCounter; }
| END { --_wCaseCounter; }
;
DoCaseBegin : DOCASE { ++_wCaseCounter; } Crlf
DoCaseBegin : DOCASE { ++_wCaseCounter; } Crlf
;
Cases : CASE Expression Crlf { $<iNumber>$ = JumpFalse( 0 ); Line(); } CaseStmts { $$ = GenElseIf( 0, Jump( 0 ) ); JumpHere( $<iNumber>4 ); Line(); }
@@ -878,8 +878,8 @@ EndWhile : END
ForNext : FOR IDENTIFIER ForAssign Expression { PopId( $2 ); $<iNumber>$ = functions.pLast->lPCodePos; ++_wForCounter; }
TO Expression { PushId( $2 ); }
StepExpr Crlf { GenPCode1( _FORTEST ); $<iNumber>$ = JumpTrue( 0 ); PushId( $2 ); }
ForStatements { GenPCode1( _PLUS ); PopId( $2 ); Jump( $<iNumber>5 - functions.pLast->lPCodePos ); JumpHere( $<iNumber>11 ); }
StepExpr Crlf { GenPCode1( _FORTEST ); $<iNumber>$ = JumpTrue( 0 ); /*PushId( $2 )*/; }
ForStatements { PushId( $2 ); GenPCode1( _PLUS ); PopId( $2 ); Jump( $<iNumber>5 - functions.pLast->lPCodePos ); JumpHere( $<iNumber>11 ); }
;
ForAssign : '='

View File

@@ -181,7 +181,7 @@ static procedure Commit()
fwrite(hFile, ::Contents[i][2][j][1] + '=' +;
::Contents[i][2][j][2] + Chr(13) + Chr(10))
endif
next j
next //j
fwrite(hFile, Chr(13) + Chr(10))
elseif ValType(::Contents[i][2]) == 'C'
@@ -189,8 +189,8 @@ static procedure Commit()
Chr(10))
endif
next i
next //i
fclose(hFile)
return

View File

@@ -0,0 +1,19 @@
FUNCTION MAIN
LOCAL i
FOR i := 1 TO 10
qout( i )
IF i = 4
__Accept("")
qout(i)
i := 9
qout(i)
__Accept("")
ENDIF
NEXT
RETURN( NIL )