[Oberon] Development tools.

Chris Glur easlab at absamail.co.za
Thu Nov 29 12:40:09 MET 2007


IMO EditKeys.Tool which apparently dates back to 1993 is
inappropriately ignored.  Perhaps because it's mostly not
understood.

Finally this seems to be a tool which is practical for entering 
source code by picking-structures instead of chars. 
I think it can insert the structures already pretty-printed too.

The default file containing the defined key-macros is:
     EditKeys.Text

One of the behaviour which I don't understand, and hopefully
we can collaboratively understand is that when I select my
chosen filename & activate EditKeys.Definitions ^ , the viewer:
EditKeys.Definitions is loaded, instead of <my chosen filename>
as expected.  Never mind, <my chosen filename> also becomes      
'active for macros' indeed so do all other 'text gadgets'.

Let's immediately see if/how to create the nested structure:--
while
if B then Repeat Stmt Until
   else if B2 then B2ifStmt
           else B2elseStm
end-while

The existing macro definition for 'WHILE' is near the bottom of
EditKeys.Text . Type 'WHILE'<Insert>. That's the 'insert-key'
immedidte after the string "WHILE".

I don't like the result, so I've made an extra macro called 'w' :-
w("WHILE " write caret " DO" write cr
  tab cr
"END;" write)
As described this can be tested manually, but initially just
include the new definition[s] in EditKeys.Text  and do
EditKeys.Read EditKeys.Text ~ to reload the extended macro
set.

Now test it with: w<Insert> 
Wow, it even copies the colours/font of the macro definition.
But it doesn't indent properly eg. if the initial token "WHILE"
is not at the line extreme left.

Let's see if we can add an IF-THEN-ELSE macro which DOES
indent appropriately ?
if("IF " write "Condt" caret " THEN Stmt" write " END" write cr
indent "END;" write)

This tests OK [in blue for me ;-]. But let's see how/if it indents
inside of:
-While
<3spaces.if
-endWhile  ??

-While
   IF Condt THEN Stmt END
   ELSE Stmt
   END;
-endWhile
Yes! it indents OK.
So now building towards our final structure, let's try:
while
  if B then Stmts end 
    else if B2 then B2ifStmt
           else B2elseStm end
end-while

These things need colours to help manage?
So far the 'w' and 'if' macros give me:-
WHILE bwhile DO
   manually entered stmt1;
   IF Condt THEN Stmt END
   ELSE IF Condt THEN Stmt END
   ELSE Stmt
   END;
   END;
END;

Ok, the 2nd nested If-Then-Else indents only to the
previous ELSE. 
Perhaps if the macro's 'ELSE line' started with 'tab' ?

Offiicially C has at least 2 recommended indentation
styles for If-Then-Else.  Perhaps someone can juggle 
this to get good auto-pretty-printing ?

The macros can be tested maually, without resaving the
EditKeys.Text file by cycling thru:
1. clear the previous version:  EditKeys.Reset
2. relaod the default macros: EditKeys.Read EditKeys.Text ~
3. write the new macro at the end of a Document-frame
4. select it
5. read & enable the new macro for testing: EditKeys.Read  @
6. test the new macro

Q - what is the meaning in EditKeys.Tool , of;
"Text stretches are pushed on a parameter stack when 
processed." ?
'processed' by what ?

Q - if "^0"  inside a macro definition means; pop the parameter
 & insert the corresponding text at the macro's current writing
 position, then how is the parameter initially 'pushed' ?

Thanks for any feedback,

== Chris Glur.

PS. I'm trying to put this to:
http://www.edgar-schwarz.de/mm/ProblemsPendingSolutions
 if/when I can rediscover how to drive the wiki.
 
 It mentions login -> userName, ID ..?
 That's why we need more menu-driven systems instead of having
 to remember ?
 


More information about the Oberon mailing list