Memory layout of a data structure: Difference between revisions

Content added Content deleted
m (-Java)
Line 62: Line 62:
end record;</lang>
end record;</lang>
=={{header|ALGOL 68}}==
=={{header|ALGOL 68}}==
{{works with|ALGOL 68|Standard - no extensions to language used}}
{{works with|ALGOL 68|Revision 1 - no extensions to language used}}
{{works with|ALGOL 68G|Any - tested with release mk15-0.8b.fc9.i386}}
{{wont work with|ALGOL 68G|Any - tested with release [https://sourceforge.net/projects/algol68/files/algol68g/algol68g-1.15-0.8b/algol68g-mk15-0.8b.fc9.i386.rpm/download algol68g-1.15-0.8b] - bug is order of BITS}}
<!-- {{not works with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release 1.8.8d.fc9.i386}} -->
{{works with|ALGOL 68G|Any - tested with release [http://sourceforge.net/projects/algol68/files/algol68g/algol68g-1.18.0/algol68g-1.18.0-9h.tiny.el5.centos.fc11.i386.rpm/download 1.18.0-9h.tiny]}}

<!-- n.b. there is a discrepancy between ALGOL 68G and ELLA ALGOL 68,
{{works with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release [http://sourceforge.net/projects/algol68/files/algol68toc/algol68toc-1.8.8d/algol68toc-1.8-8d.fc9.i386.rpm/download 1.8-8d]}}
I am checking the RR to see which is the correct output -->
<lang algol68>MODE RSTWOTHREETWO = BITS;
<lang algol68><lang algol68>MODE RSTWOTHREETWO = BITS;
INT ofs = bits width - 9;
INT
INT
lwb rs232 = 1,
lwb rs232 = ofs + 1,
carrier detect = 1,
carrier detect = ofs + 1,
received data = 2,
received data = ofs + 2,
transmitted data = 3,
transmitted data = ofs + 3,
data terminal ready = 4,
data terminal ready = ofs + 4,
signal ground = 5,
signal ground = ofs + 5,
data set ready = 6,
data set ready = ofs + 6,
request to send = 7,
request to send = ofs + 7,
clear to send = 8,
clear to send = ofs + 8,
ring indicator = 9,
ring indicator = ofs + 9,
upb rs232 = 9;
upb rs232 = ofs + 9;
RSTWOTHREETWO rs232 bits := 2r01000000000000000000000000000000; # up to bits width, OR #
RSTWOTHREETWO rs232 bits := 2r10000000; # up to bits width, OR #
print(("received data: ",received data ELEM rs232bits, new line));
rs232 bits := bits pack((FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE));


rs232 bits := bits pack((FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE));
print(("received data: ",received data ELEM rs232bits))</lang>
print(("received data: ",received data ELEM rs232bits, new line))</lang>
Output:
Output:
<pre>
<lang algol68>received data: T</lang>
received data: T
received data: T
</pre>


=={{header|C}}/{{header|C++}}==
=={{header|C}}/{{header|C++}}==