Oberon Community Platform Forum
October 17, 2017, 02:29:03 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: importing structures -> compiler error  (Read 1887 times)
fnecati
Jr. Member
**
Posts: 60


« on: October 29, 2009, 02:28:13 PM »


It seems that there are some compiling problems while importing structures and accessing to their methods.


1-
  if the imported structure have NO properties and constructor
 (for example, System.Int32 by aliasing ), compiler gives NO error with the first main module.
   ....
   import
   System.TimeZone as TimeZone,
   System.Int32 as Int32;
   
   ...
   problem:
compiler error:

 2- if  one of the imported structure HAVE constructor and properties
    ( for example, System.IntPtr, System.TimeStamp .. ) compiler
    gives error, and error points to the if statement (A), no error with statement (B).
   
    ......
    import
      System.TimeZone as TimeZone,    
       System.IntPtr as IntPtr,
       System.TimeStamp as TimeStamp;
     .... 
   
    Other statetments in (A); such as while, for, loop, gives NO error. 
   
    If the statement (A) removed from the module, compiler gives NO error.
   

Compiler:
on linux:
Zonnon Compiler, Version 1.2.3.52 of Sunday, October 04, 2009, 3:39:00 PM
(c) 2003-2009 ETH Zurich

on windows:
Zonnon Compiler, Version 1.2.2

Code:
module main;
  import
 
System.TimeZone as TimeZone, (* System namespace, CLASS with constructor and properties *)
(* System.DateTime as DateTime,*) (* System namespace, STRUCTURE, with constructor and  properties *)
System.Int32 as Int32; (* System namespace, STRUCTURE,  with NO constructor and properties *)
(*   System.IntPtr as IntPtr;*) (* System namespace, STRUCTURE, with constructor and properties *)
(* System.TimeSpan as TimeSpan;*) (* System namespace, STRUCTURE, with constructor and properties *)

var
x: integer;
    t: boolean;
begin
 x:=10;
 t:=false;

  if x=10 then x:=1 end; (* A *)
  if ~t  then t:=true end; (* B *)
 
  writeln("Hello World!");

end main.



*********************************

Other example with Mono.Simd.dll library:

System:
Mono JIT compiler version 2.4.2.3 (Debian 2.4.2.3+dfsg-2~bpo50~dhx1)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
   TLS:           __thread
   GC:            Included Boehm (with typed GC)
   SIGSEGV:       altstack
   Notifications: epoll
   Architecture:  amd64
   Disabled:      none

 commandline compile:
 mono  /usr/local/lib/eclipse/plugins/ch.ethz.zonnon_1.2.3/compiler/zc.exe /ref:bin/Mono.Simd.dll /entry:main /out:main.exe main.znn


Error:

Zonnon Compiler, Version 1.2.3.52 of Sunday, October 04, 2009, 3:39:00 PM
(c) 2003-2009 ETH Zurich
2025: /home/necati/workspace/TestSimd/main.znn(12,27): Could not find 'CompareEqual' qualified by 'Vector4f'
2024: /home/necati/workspace/TestSimd/main.znn(22,1): Procedure 'CompareEqual' is not declared in definition ''


Note: Mono.Simd.Vector4f is a structure with constructor, properties and methods,..
CompareEqual is a method of Mono.Simd.Vector4 structure.


Code:
module main;
import
Mono.Simd;

var
v1,v2,v3 : Mono.Simd.Vector4f;

begin
  v1:= new  Mono.Simd.Vector4f(0.0{32},20.0{32},0.0{32},10.0{32});
  v2:= new  Mono.Simd.Vector4f(10.0{32},10.0{32},10.0{32},0.0{32});

  v3:= Mono.Simd.Vector4f.CompareEqual(v1,v2);

  writeln(integer(Mono.Simd.SimdRuntime.AccelMode));
  writeln("Hello world");
end main.


Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!