Projekat

Općenito

Profil

Harbour interna struktura - pcode

pcode model

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 VirtualMachine() that will process those pcode bytes.

Let's review the Test.prg pcode structure in more detail:

0000 (2A) LINE 0                    2A 00 00
0003 (2A) LINE 3                    2A 03 00
0006 (13)   SYMF [QOUT]             13 02 00
0009 (01)   PUSHC "Hello world!"    01 ...
0018 (27)   DO(1)                   27 01 00
001B (2A) LINE 5                    2A 05 00

Reference

  • bazirano na harbour/doc/pcode.txt (harbour source repository)