Professional Documents
Culture Documents
==========================================================
Let's consider the following Clipper sample test.prg:
FUNCTION Main()
? "Hello world!"
RETURN NIL
Once it gets compiled into a OBJ, what is there inside it?
In fact, what we get is the equivalent to the following C language
application:
SYMBOL symbols[] = { ... };
void MAIN( void )
{
BYTE pcode[] = { ... };
VirtualMachine( pcode, symbols );
}
Basically, test.prg source code has been converted into a sequence
of pcode bytes contained in the array pcode[] = { ... }. All our MAIN()
function does is invoke, at run-time, a Clipper VirtualMachine() that will
process those pcode bytes.
Let's review the test.prg pcode structure in more detail:
0000
0003
0006
0009
0018
001B
001E
001F
0020
0023
(2A)
(2A)
(13)
(01)
(27)
(2A)
(7B)
(79)
(1E)
(60)
LINE 0
LINE 3
SYMF [QOUT]
PUSHC "Hello world!"
DO(1)
LINE 5
UNDEF
SAVE_RET
JMP 0023
ENDPROC
2A
2A
13
01
27
2A
7B
79
1E
60
00 00
03 00
02 00
...
01 00
05 00
00 00
LINE
SYMF
PUSHC
DO
UNDEF
0x2A
0x13
0x01
0x27
0x7B
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>