<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>load and store should take TypeUID parameters<br><br><br><br>There are multiple reasons for this.<br><br><br><br>Given:<br>TYPE Color = {Red,Blue};<br>PROCEDURE P1() = VAR v1 := Color.Red; BEGIN END P1;<br><br><br><br>I would like to generate:<br><br><br>preamble in all files:<br>typedef unsigned char UINT8;<br>typedef unsigned short UINT16;<br>typedef unsigned int UINT32;<br>typedef unsigned long long UINT64;<br><br><br>(This is not quite right.)<br><br><br>#if __GNUC__ /* >= ? */<br>#define M3_ENUM_SIZE<br>#define M3_ENUM_MODE8 __attribute__((__mode__(__QI__)))<br>#define M3_ENUM_MODE16 __attribute__((__mode__(__HI__)))<br>#define M3_ENUM_MODE32 __attribute__((__mode__(__SI__)))<br>#define M3_ENUM_MODE64 __attribute__((__mode__(__DI__)))<br>#else<br>#define M3_ENUM_MODE8 /* nothing */<br>#define M3_ENUM_MODE16 /* nothing */<br>#define M3_ENUM_MODE32 /* nothing */<br>#define M3_ENUM_MODE64 /* nothing */<br>#endif<br>#if _MSC_VER >= 1400 && defined(__cplusplus)<br>#define M3_ENUM_SIZE<br>#define M3_ENUM_BASE8 : UINT8<br>#define M3_ENUM_BASE16 : UINT16<br>#define M3_ENUM_BASE32 : UINT32<br>#define M3_ENUM_BASE64 : UINT64<br>#else<br>#define M3_ENUM_BASE8 /* nothing */<br>#define M3_ENUM_BASE16 /* nothing */<br>#define M3_ENUM_BASE32 /* nothing */<br>#define M3_ENUM_BASE64 /* nothing */<br>#endif<br><br><br>and then:<br><br><br>given TypeUID = 123<br><br><br>// declare enum<br>#if M3_ENUM_SIZE<br>M3_ENUM_MODE8 enum M123 M3_ENUM_MODE8 { M123_Red, M123_Blue, M123_Green };<br>#else<br>typedef UINT8 M123;<br>#define M123_Red ((M123)0)<br>#define M123_Blue ((M123)1)<br>#define M123_Green ((M123)2)<br>#endif<br><br><br>// declare typename<br>typedef M123 Color;<br><br><br>// smart compiler recognizes left and right are enums perhaps and therefore:<br>#define Color_Red M123_Red<br>#define Color_Blue M123_Blue<br>#define Color_Green M123_Green<br><br><br><br>Color v1 = M123_Red;<br>or perhaps:<br>Color v1 = Color_Red;<br><br><br>or perhaps merely:<br>Color v1 = (Color)0;<br><br><br>and really, ideally NOT<br>Color v1;<br>*(UINT8*)&v1 = (UINT8)0;<br><br><br><br>The readability of the right hand side isn't the most critical.<br>What is more critical is the readability of v1 in a debugger.<br><br><br><br>The last form is what we are stuck with.<br><br><br><br>Similarly, given:<br><br><br>PROCEDURE P2(VAR a: INTEGER);<br>PROCEDURE P3(VAR a: INTEGER) = BEGIN P2(b); END P3;<br><br><br><br>I want:<br> void P2(INTEGER* a); <br> void P3(INTEGER* a) { P2(a); } <br><br><br><br>no casts.<br><br><br><br>Today, I make all pointers "ADDRESS" which<br>is void* or char*. I don't remember all the reasons why.<br><br><br>I guess I should just get over the cast happiness and ugly C implied by using C as a backend.<br>But I do want things to look right in a debugger. I'll iterate more..later...<br><br><br> - Jay<br> </div></body>
</html>