Search found 110 matches

by gray
Tue Apr 30, 2019 5:53 am
Forum: Astrobe for ARM Cortex-M0, M3, M4 and M7
Topic: 7.0.1 Fixes
Replies: 1
Views: 20152

7.0.1 Fixes

Type tests on expressions (e.g. array elements and individual fields of records) are handled correctly in IS expressions. Type tests using CASE statements can only be performed on (qualified) identifiers, not expressions. 1) Does this apply to all type tests, or only in leaf procedures? 2) Is deref...
by gray
Sat Apr 27, 2019 1:25 pm
Forum: Astrobe for ARM Cortex-M0, M3, M4 and M7
Topic: Assignment to Pointer-referenced Variable
Replies: 3
Views: 24905

Re: Assignment to Pointer-referenced Variable

Then again...

Code: Select all

MODULE M;
  IMPORT Main, Out;
    
  TYPE
    P = POINTER TO T;
    T = RECORD
      i: INTEGER 
    END;

  VAR
    p: P;
    t: T;

BEGIN
  t.i := 13;
  p^ := t;
  Out.Int(p.i, 0); Out.Ln;
  p.i := 4;
  Out.Int(p.i, 0); Out.Ln
END M.
... compiles and executes (prints 13 and 4).
by gray
Sat Apr 27, 2019 11:06 am
Forum: Astrobe for ARM Cortex-M0, M3, M4 and M7
Topic: Assignment to Pointer-referenced Variable
Replies: 3
Views: 24905

Assignment to Pointer-referenced Variable

Code: Select all

MODULE M;
  TYPE
    P = POINTER TO T;
    T = RECORD END;

  VAR
    p: P;
    t: T;

BEGIN
  p^ := t
END M.
Is here NEW(p) executed before the assignment?
by gray
Tue Apr 16, 2019 3:26 am
Forum: Astrobe for ARM Cortex-M0, M3, M4 and M7
Topic: Disabling Interrupts
Replies: 1
Views: 19679

Disabling Interrupts

First, let me thank you for your patience answering my barrage of questions. Highly appreciated! Here's the next... How "atomic" is SYSTEM.PUT as regards interference by interrupts? In particular: (* irqICER, irqISER, irqSCBit: the ICER, ISER and bit (a SET) corresponding to the interrupt *) PROCEDU...
by gray
Tue Apr 16, 2019 12:35 am
Forum: Astrobe for ARM Cortex-M0, M3, M4 and M7
Topic: Type Extensions Across Modules
Replies: 5
Views: 30341

Re: Type Extensions Across Modules

A programmer is able to extend any type exported from a module with or without access to the source code. Without the source code of M1 you would have no knowledge of the existence of i. If the author of M1 determines that T1.i is private then he can make any change he likes to T1 (remove i, change...
by gray
Mon Apr 15, 2019 2:47 am
Forum: Astrobe for ARM Cortex-M0, M3, M4 and M7
Topic: Overhead of Record Parameters
Replies: 1
Views: 19607

Overhead of Record Parameters

MODULE M10; TYPE P = POINTER TO R; R = RECORD END; VAR p: P; r: R; PROCEDURE P1(r: R); END P1; PROCEDURE P2(VAR r: R); END P2; PROCEDURE P3(p: P); END P3; BEGIN P1(r); P2(r); P3(p) END M10. What are the differences in the overhead when calling the procedures? I would assume they are minimal, in par...
by gray
Mon Apr 15, 2019 2:30 am
Forum: Astrobe for ARM Cortex-M0, M3, M4 and M7
Topic: Extended Type Formal VAR Parameters
Replies: 5
Views: 26507

Re: Extended Type Formal VAR Parameters

MODULE M8; TYPE T1 = RECORD i: INTEGER END; T2 = RECORD(T1) k: INTEGER END; VAR t1: T1; t2: T2; PROCEDURE P1(VAR t: T1); VAR t1: T1; BEGIN t1.i := 17; t := t1 END P1; BEGIN t2 := t1; (* illegal *) t2.i := 13; t2.k := 4; P1(t2); (* t2.i = 17, t2.k = 4 *) END M8. The t2 := t1 assignment is illegal, a...
by gray
Sun Apr 14, 2019 1:30 am
Forum: Astrobe for ARM Cortex-M0, M3, M4 and M7
Topic: Extended Type Formal VAR Parameters
Replies: 5
Views: 26507

Re: Extended Type Formal VAR Parameters

Hm, thanks, yes, the Report is clear about this. Mr W's writing is succinct and precise as usual. I was mulling over the reason why pointers to an extended type cannot be passed as VAR parameters declared as pointer to a base type thereof. Is this the (or a) use case and problem the rule prevents? M...
by gray
Sat Apr 13, 2019 4:17 am
Forum: Astrobe for ARM Cortex-M0, M3, M4 and M7
Topic: Extended Type Formal VAR Parameters
Replies: 5
Views: 26507

Extended Type Formal VAR Parameters

MODULE M; TYPE T1 = POINTER TO T1Desc; T1Desc = RECORD END; T2 = POINTER TO T2Desc; T2Desc = RECORD(T1Desc) END; VAR t1: T1; t2: T2; PROCEDURE P1(t: T1); END P1; PROCEDURE P2(VAR t: T1); END P2; BEGIN t1 := t2; P1(t2); P2(t2) (* does not compile *) END M. I am not sure why the compiler rejects the ...
by gray
Fri Apr 12, 2019 1:57 pm
Forum: Astrobe for ARM Cortex-M0, M3, M4 and M7
Topic: Type Extensions Across Modules
Replies: 5
Views: 30341

Re: Type Extensions Across Modules

Oh, that's a bit disappointing. In my book, being able to extend a base type without the need to change this base type scores high. Again, is this a limitation of the language or the compiler? Here's a loosely related follow-up issue I ran into today: MODULE M1; TYPE T1 = POINTER TO T1Desc; T1Desc =...