— The Name in Software
Engineering Automation
The following example used the standard set of XTRAN rules for parsing PL/M and translating it to C. The input and output are untouched.
NOTE that the translation shown below was done with default conditions. XTRAN provides many options for controlling the way it translates.
proc1: PROCEDURE (arg1, arg2) EXTERNAL; /*proc1: PROCEDURE (arg1, arg2) EXTERNAL;*/
DECLARE (arg1, arg2) WORD; /*DECLARE (arg1, arg2) WORD;*/
END proc1;
proc2: PROCEDURE; /*proc2: PROCEDURE;*/
CALL proc1(1, 2); /*CALL proc1(1, 2);*/
RETURN; /*RETURN;*/
END proc2;
proc3: PROCEDURE; /*proc3: PROCEDURE;*/
DECLARE (i, j) WORD; /*DECLARE (i, j) WORD;*/
DECLARE prcnam POINTER; /*DECLARE prcnam POINTER;*/
CALL proc1(i, j); /*CALL proc1(i, j);*/
prcnam = @proc2; /*prcnam = @proc2;*/
CALL prcnam; /*CALL prcnam;*/
END proc3;
extern void proc1(unsigned short arg1,
unsigned short arg2); /*proc1: PROCEDURE (arg1, arg2) EXTERNAL;*/
/*DECLARE (arg1, arg2) WORD;*/
static void proc2(void) /*proc2: PROCEDURE;*/
{
proc1(1, 2); /*CALL proc1(1, 2);*/
return; /*return;*/
}
static void proc3(void) /*proc3: PROCEDURE;*/
{
static unsigned short i, j; /*DECLARE (i, j) WORD;*/
static void (*prcnam)(void); /*DECLARE prcnam POINTER;*/
proc1(i, j); /*CALL proc1(i, j);*/
prcnam = proc2; /*prcnam = @proc2;*/
(*prcnam)(); /*CALL prcnam;*/
}
COPYRIGHT 2012; reproduction prohibited without permission. Revised 2009-09-11
XTRAN is a trademark of Pennington Systems Incorporated.
|
Pennington Systems Incorporated 2820 N. Pinal Avenue, Suite 12 Casa Grande, Arizona 85122-7927 USA |
Phone: +1(480)626-5503 Fax: +1(480)626-7618 Email: Info@Pennington.com Web: http://WWW.Pennington.com |