<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:350844392;
mso-list-type:hybrid;
mso-list-template-ids:238687698 201916431 201916441 201916443 201916431 201916441 201916443 201916431 201916441 201916443;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>I’ve been working on a lot of low-level STM32 microcontroller modules recently and have been finding the numerous references to SYSTEM are interfering with the readability. In an extreme case I have a module consisting of 45 statements which has 42 occurrences of the word SYSTEM! The next worst has 36 occurrences of SYSTEM in 47 statements. Consequently I’m investigating if there is a better way of doing this.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>The programming language Oberon SA was the immediate predecessor of Oberon-07. It was specifically designed to be suitable for targeting realtime applications and was used to write the flight control software for model helicopters. Consequently there would have been extensive use of SYSYTEM functions. It eliminated the pseudo-module SYSTEM altogether and allowed procedures like PUT, GET and BIT to be called without a qualifier in the same way as ODD, INC etc.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>I’ve seen others skirt around the problem by using S as an alias for SYSTEM. That seems like a half-baked solution / workaround to me.<o:p></o:p></p><p class=MsoListParagraph><o:p> </o:p></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Modula-2 had a number of different ways of relaxing explicit qualification of imported items. I much prefer Oberon’s simpler, consistent, mechanism for all cases - except SYSTEM.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’d still like to retain the use of the SYSTEM pseudo-module SYSTEM qualifiers so that they stand out in a module where they only appear rarely and I do not want to modify the way other IMPORTs work.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Consequently I’m thinking of implementing an extension to the Astrobe Oberon-07 compilers. This will allow low-level modules to be specified by prefixing the keyword MODULE with the keyword SYSTEM (similarly to the DEFINITION and IMPLEMENTATION module prefixes in Modula-2). Such system modules would allow / require any SYSTEM objects to be referenced unqualified. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>E.g. for the STM32 RTC functions:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'>SYSTEM MODULE Clock;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'>IMPORT MCU;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'>CONST<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> RTCBase = MCU.RTCBase;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> TR = RTCBase + 00H;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> ISR = RTCBase + 0CH;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> (* ISR bits *)<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> RSF = 5;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'>PROCEDURE* Seconds*(): INTEGER;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'>VAR<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> time: INTEGER;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'>BEGIN<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> REPEAT UNTIL BIT(ISR, RSF);<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> GET(TR, time);<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> RETURN 10 * UBF(time, 6, 4) + UBF(time, 3, 0) <o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'>END Seconds;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal>Instead of:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'>PROCEDURE* Seconds*(): INTEGER;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'>VAR<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> time: INTEGER;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'>BEGIN<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> REPEAT UNTIL SYSTEM.BIT(ISR, RSF);<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> SYSTEM.GET(TR, time);<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'> RETURN 10 * SYSTEM.UBF(time, 6, 4) + SYSTEM.UBF(time, 3, 0) <o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;font-family:Consolas'>END Seconds;<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Note: bitfield := UBF(word, msb, lsb) is an Astrobe SYSTEM function extension which replaces the UBFX, unsigned bitfield extract, function discussed here recently.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Any comments?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Any other suggestions for solving this problem?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>