Handling "AT" declarations


PL/M source code

oo : do;

/* This is a demo of translating variables with the "at" attribute
to unions in the C language.
*/

declare a byte;
/* variable "at_a" is declared to share the same memory space
with "a" */
declare at_a word at (@a);

declare aa structure ( a byte , bb word , xy dword);
/* variable "b" is declared to
share the same memory space with "aa.xy" */
declare b word at (@aa.xy);
declare c dword at (@b);

aa.xy = a;
at_a = b;

end;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Translated C source code

#include "..\C\builtin.h"

typedef struct {
BYTE a;
WORD bb;
DWORD xy;
} StrucT1;

union {
/* This is a demo of translating variables with the "at" attribute to unions in the C language.
*/
BYTE a;
/* variable "at_a" is declared to share the same memory space with "a" */
WORD at_a;
} Un1;

union {
StrucT1 aa;
/* variable "b" is declared to share the same
memory space with "aa.xy" */

struct {
BYTE Offset1;
WORD Offset2;
WORD b;
} St1;

struct {
BYTE Offset1;
WORD Offset2;
DWORD c;
} St2;
} Un2;

 

main()
{
Un2.aa.xy = Un1.a;
Un1.at_a = Un2.St1.b;
}

 

 

About Company

Alternative Solutions provides a cost effective and reliable translator that is designed to provide good reability of generated C code by transforming simple definitions in PL/M to more precise and readable structures in C. The resultant C source code embodies the functionality of the original PL/M source code while adhering to modern C coding style.

About PL/M

The PL/M programming language is a high-level language developed by Gary Kildall in 1972 for Intel for its microprocessors. Today PL/M is no longer supported by INTEL and its successor is the C language which is widely used in embedded systems development.

Demo version

You can download a demo version of PLM2C which retains the full functionality of the product except that the source PL/M file length is limited to 100 lines and the number of INCLUDE files is limited to one. It can be activated to a fully functional version when you purchase a license.

Get in Touch

  • Email: