Author Topic: Checking some demos?  (Read 15975 times)

0 Members and 1 Guest are viewing this topic.

Arnold

  • Guest
Checking some demos?
« on: February 23, 2015, 06:09:35 AM »
Hi Charles,

there are some demos which would work with only minor changes. Maybe you will check these?

c:\oxygenbasic\examples\DataProcessing\CommaFormat.o2bas:
   line 8 needs round(v) -- conforming to HelpFile
EvalExpr2.o2bas:
   line 95 needs case else
c:\oxygenbasic\examples\DLLs\EmbedFile32.o2bas:
   parameters for embedfile not correct, t.txt must exist
c:\oxygenbasic\examples\UseRTL32\FBO2DLLtest\dll_math_o2.o2bas:
   the first lines must be adapted to create a dll file. I did not test with Freebasic.

In c:\oxygenbasic\projectsA\InProgress\Physics there is zone.o2bas which includes wFunc.h. Can I find this file anywhere?

Is there a special reason why you keep an older verson of console.inc in \projectsA\LeanLisp? If I delete this file and adapt the include statements in some of the demos they work ok too (I think). Lispish3UseDll.o2bas gives a GPF at the end.

Roland




« Last Edit: February 23, 2015, 04:36:15 PM by Arnold »

Arnold

  • Guest
Re: Checking some demos?
« Reply #1 on: February 23, 2015, 04:42:53 PM »
Hi Charles,

it is amazing. You already fixed everything. Please do not forget to modify the example for embedfile in a future Oxygen Helpfile.

Roland

Charles Pegge

  • Guest
Re: Checking some demos?
« Reply #2 on: February 23, 2015, 09:19:58 PM »

Fixed or removed :)

I have moved most of the Language projects to ProjectsC

A minimal version of Oxygen is now available. It contains the main directory, inc files and help.

Oxygen DLL Update (200k)
http://www.oxygenbasic.org/o2zips/Oxygen.zip

OxyMin Update (900k)
http://www.oxygenbasic.org/o2zips/OxyMin.zip

OxygenBasic Full Update (4700k)
http://www.oxygenbasic.org/o2zips/OxygenBasic.zip

Arnold

  • Guest
Re: Checking some demos?
« Reply #3 on: February 27, 2015, 01:42:43 AM »
Hi Charles,

exploring the demos with asm instructions I found four programs which behave differently:

c:\oxygenbasic\examples\Asm32
---------------------------
repne.o2bas

 ; ASM ERR:    lea esi,[@a+offs]!!  Expecting  ']'
 ; AFTER:      ._main
 ; LINE:       18

c:\oxygenbasic\examples\MetaProg
---------------------------
MetaVal.o2bas

 ; ASM ERR:    mov ecx,[eax*4+@a+m*2]!!  Expecting  ']'
 ; AFTER:      ._main
 ; LINE:       30

Most of the demos use instructions like:

  lea edi,[ebp-4]  lea edx,[eax+2]  lea eax,[ph]  lea edx,stack  lea esi,pp  lea eax,cap

so I do not know if @a+offset must be resolved with some other instructions now?

c:\oxygenbasic\examples\Diagnostics
---------------------------
RegTrace.o2bas

 ; ASM ERR:    popad mov eax,1  pushad!!  Junk after instruction: popad

 ; AFTER:      ._over_
 ; LINE:       45

if I use:

  def SHOW
  #define MSG
  def FLAGS
  #define x

the demo runs as expected. Is there a difference between def and #define?

c:\oxygenbasic\src\InProgress
---------------------------
concatenate.o2bas

 ; ASM ERR:    enc edx!!  Unidentified instruction: enc
 ; AFTER:      .z1bytelen
 ; LINE:       59

Is this simply a typo and inc should be used?

Btw I find the error messages very useful. Most of the time they lead to the line with the critical problem.


Roland

Charles Pegge

  • Guest
Re: Checking some demos?
« Reply #4 on: February 27, 2015, 03:43:46 AM »
Hi Roland,

Thank you again for reporting these breakages.

The @ offset syntax is obsolete, so I have altered repne.o2bas, and dumped metavel.o2bas

Example:

lea esi,[@a+40]

should be replaced by

addr esi,a
add esi,40




#define follows C lexing rules, but macro is very similar in functionality.

%,  def,  #def behave like DOS macros, with optional %1 %2 %3 ... parameters




RegTrace with block format def:
Code: OxygenBasic
  1. '
  2. '-----------------------------------
  3. 'TRACING EXECUTION OF ASSEMBLY CODE
  4. 'INSPECT REGISTERS AFTER INSTRUCTION
  5. '===================================
  6.  
  7.  
  8.    
  9.   '----------------
  10.  'DIAGNOSTIC MACROS
  11.  '================
  12.    
  13.   def SHOW
  14.     pushad : mov a,%1 : print "%1: " hex a : popad
  15.   end def
  16.   '
  17.  def MSG
  18.     pushad : print %1 : popad
  19.   end def
  20.   '
  21.  def FLAGS
  22.     pushad : pushf : pushf : pop eax : mov a,eax : print "Flag Register: " hex a : popf : popad
  23.   end def
  24.   '
  25.  def x
  26.     : pushad : pushf : call showregs : popf : popad :
  27.   end def
  28.  
  29.  
  30.   dim a
  31.  
  32.   sub showregs()
  33.     dim as long v(9) at [ebp+8]
  34.     dim as string tab=chr 9
  35.     print "
  36.     Registers:
  37.    
  38.     EAX:   " tab hex (v(9)) "
  39.     ECX:   " tab hex (v(8)) "
  40.     EDX:   " tab hex (v(7)) "
  41.     EBX:   " tab hex (v(6)) "
  42.     ESP:   " tab hex (v(5)) "
  43.     EBP:   " tab hex (v(4)) "
  44.     ESI:   " tab hex (v(3)) "
  45.     EDI:   " tab hex (v(2)) "
  46.     EFLAGS:  " hex (v(1)) "
  47.     "
  48.   end sub
  49.  
  50.   '--------  
  51.  'ASM TEST
  52.  '========
  53.  
  54.   'PLACE "x" AT ANY INSTRUCTION TO SEE THE REGISTER CONTENTS
  55.  
  56.   mov ecx,0
  57.   X mov eax,1 X
  58.   cmp eax,0 X
  59.   'FLAGS
  60.  jz nif
  61.     'MSG "condition Not met"
  62.    mov ecx,1
  63.   nif:
  64.   'SHOW ecx
  65.  
  66.  


enc inc edx :)



« Last Edit: February 27, 2015, 04:02:55 AM by Charles Pegge »

Arnold

  • Guest
Re: Checking some demos?
« Reply #5 on: February 27, 2015, 08:04:07 AM »
Hi Charles,

thank you for the explanation. I assume in RegTrace I can use these combinations:

  SHOW Reg
  MSG Reg
  FLAGS

and it should be possible to use console.inc to print the results in a console window?

Roland


Charles Pegge

  • Guest
Re: Checking some demos?
« Reply #6 on: February 27, 2015, 08:40:21 AM »
Sure,

Improved layout, and console output:

Code: Text
  1. '
  2. '-----------------------------------
  3. 'TRACING EXECUTION OF ASSEMBLY CODE
  4. 'INSPECT REGISTERS AFTER INSTRUCTION
  5. '===================================
  6.  
  7.   includepath "$\inc\"
  8.   include     "console.inc"
  9.    
  10.   '----------------
  11.   'DIAGNOSTIC MACROS
  12.   '================
  13.    
  14.   def SHOW
  15.     pushad : mov a,%1 : printl "%1: " hex a : popad
  16.   end def
  17.   '
  18.   def MSG
  19.     pushad : printl %1 : popad
  20.   end def
  21.   '
  22.   def FLAGS
  23.     pushad : pushf : pushf : pop eax : mov a,eax : printl "Flag Register: " hex a : popf : popad
  24.   end def
  25.   '
  26.   def x
  27.     : pushad : pushf : call showregs : popf : popad :
  28.   end def
  29.  
  30.  
  31.   dim a
  32.  
  33.   sub showregs()
  34.     dim as long v(9) at [ebp+8]
  35.     dim as string tab=chr 9
  36.     printl "
  37.     Registers:
  38.    
  39.     EAX:   " tab hex (v(9),8) "
  40.     ECX:   " tab hex (v(8),8) "
  41.     EDX:   " tab hex (v(7),8) "
  42.     EBX:   " tab hex (v(6),8) "
  43.     ESP:   " tab hex (v(5),8) "
  44.     EBP:   " tab hex (v(4),8) "
  45.     ESI:   " tab hex (v(3),8) "
  46.     EDI:   " tab hex (v(2),8) "
  47.     EFLAGS:" tab hex (v(1),4) "
  48.     "
  49.   end sub
  50.  
  51.   '--------  
  52.   'ASM TEST
  53.   '========
  54.  
  55.   'PLACE "x" AT ANY INSTRUCTION TO SEE THE REGISTER CONTENTS
  56.  
  57.   mov ecx,0
  58.   X mov eax,1 X
  59.   cmp eax,0 X
  60.   'FLAGS
  61.   jz nif
  62.     'MSG "condition Not met"
  63.     mov ecx,1
  64.   nif:
  65.   'SHOW ecx
  66.  
  67. waitkey
  68.  

Arnold

  • Guest
Re: Checking some demos?
« Reply #7 on: March 03, 2015, 07:26:18 AM »
Hi Charles,

learning about OxygenBasic and exploring the demos in projectsB\RosettaCode I found some programs which did not work as expected. I tried with Vista 32bit and Win7 64bit using Oxygenbasic Version: A40 19:30 25/02/2015
 
1) CompileTime.o2bas

ERROR:   Unidentified operand
WORD:    pling10
LINE:    
PASS:    1

if I delete quote and replace ===Source=== with " then the demo works.

2) ConstrainedGenericity.o2bas

Linker found unidentified names:
food:   level 0
food:   level 0

in line 6 there is: enum food foodlist
in the TEST section you use:
Hamper.put food.pudding,large,several
Hamper.put food.pie,huge,few
but I have no idea what should happen?
 
3) Evolution.o2bas

ERROR:   Syntax:[ebx+0x1004]
WORD:    le
LINE:    6
PASS:    1

le is given in line 5 and line 6

4) LibraryFunctions.o2bas

ERROR:   parameters mismatch for procedure string:
params given :

OPTIONS:
string(sys,sys) returns string
string(sys,zstring) returns string
string(sys,string) returns string

WORD:    string
LINE:    5
PASS:    1

If I comment out the first declaration then the demo works.

5) RunTimeLoadLib.o2bas

Error:
ERROR:   Must refer to a proc pointer: messagebox
WORD:    messagebox
LINE:    9
PASS:    2

I do not know why this does not work.

Some demos do not work at all.

6) Accumfactory.o2bas:
7) ActiveObject.o2bas:
8  RetVals.o2bas
gxo2.exe / co2.exe crashes . Win7 64bit shows gxo2.exe in the TaskManager for some time, which then disappears.

9)  MatrixClass.o2bas:
10) PolymorphicCopy.o2bas:
These demos print the first result, but after 'OK' gxo2.exe crashes. Win7 64bit shows gxo2.exe for some time.

This demo shows a different result:

11) ConcatArrays.o2bas:
result should be 70, but shows 0

I wonder if in some of these cases a different syntax must be used?

The website of rosettacode.org lists 66 pages of resolved tasks, but I can only find 46 files in the RosettaCode directory? There seems to be no easy way to load the tasks of a language all at once from the website. Searching for a single file and copy / paste is a bit tedious.


Roland

Arnold

  • Guest
Re: Checking some demos?
« Reply #8 on: March 03, 2015, 05:06:52 PM »
Hi Charles,

using your latest build with Oxygen version A40 22:42 03/03/2015 the RosettaCode demos worked ok. I compared them to see what has changed. There are only minor modifications but sometimes they are not easy to find. I think I have to create a checklist for using @, *,  _ and new.

Roland
 

Charles Pegge

  • Guest
Re: Checking some demos?
« Reply #9 on: March 03, 2015, 10:05:04 PM »
Hi Roland,

Yes, there was a change in syntax, since the Rosetta examples were coded.

When returning any pointered variable in a procedure, the address must be returned explicitly. (using @ or &)

I pulled ActiveObject.o2bas. I hope to produce a simpler cleaner version.

Many thanks.

Arnold

  • Guest
Re: Checking some demos?
« Reply #10 on: March 09, 2015, 03:29:34 AM »
Hi Charles,

in examples\OOP\Interfaces a found the demo Interface1.o2bas which uses:

class
   has ...
    /\
end class

which did not work. In OxyLog.txt I saw that you introduced /\ already in 2011. Is this syntax deprecated now? Interface5.o2bas seems to do the same work and still some more.

There are two other examples with the /\ syntax:

examples\OOP\Features:

ClassBasic.o2bas
ClassFormat2.o2bas

and in oxygenbasic\projectsA\Controls I found Controls.inc which is used by DlgCtrl.o2bas, DlgCtrlSliders.o2bas and Noise.o2bas.

Roland

Charles Pegge

  • Guest
Re: Checking some demos?
« Reply #11 on: March 09, 2015, 11:34:17 AM »
Hi Roland,

That is the lower level class syntax.

class classname
inherited classes,types,macros
static variables...
method protoypes...
/\
variables...
end class

methods of classname
full definition of methods
end methods


Fixed the ptoblem for all examples using this sytax

Many thanks! :)

Arnold

  • Guest
Re: Checking some demos?
« Reply #12 on: March 10, 2015, 01:34:36 AM »
Hi Charles,

the demos now work and the controls in \projectsA\Controls look really impressive. Yet I am far away from understanding the internal activities. I found a tutorial in Wikibooks which seems to introduce OOP in a more general way, maybe this helps.

Unfortunately there are three demos now which show a new error:

examples\OOP\Features
MultiInherit.o2bas

ERROR:   Class must be EXTERNAL/COM
WORD:    p.greet
LINE:    41
PASS:    1

examples\OOP\Interfaces
Interface5.o2bas

ERROR:   Class must be EXTERNAL/COM
WORD:    "zaphod"
LINE:    74
PASS:    1

projectsB\RosettaCode
InheritMulti.o2bas

ERROR:   Class must be EXTERNAL/COM
WORD:    cp.viewphoto
LINE:    25
PASS:    1

These demos ran without problem using OxygenBasic version before, although InheritMulti.o2bas does not show a result. I assume it's purpose is to serve as a template for own projects?

Roland

Charles Pegge

  • Guest
Re: Checking some demos?
« Reply #13 on: March 10, 2015, 01:39:25 PM »

Arnold

  • Guest
Re: Checking some demos?
« Reply #14 on: March 11, 2015, 01:42:18 AM »
Hi Charles,

apparently you can treat OOP as versatile as all the styles of statements in OxygenBasic. It is formidable to see how you can manage all this variety.
Using the last build of Oxygen and compiling all the demos, there is a message which has not been before:

ProjectsC\PowerBasic

ObjectsPB3.o2bas

ERROR:   not a class/type: class
WORD:    methods
LINE:    152
PASS:    1

 ---------------------------
ObjectsPB6.o2bas

ERROR:   not a class/type: class
WORD:    methods
LINE:    198
PASS:    1

 ---------------------------
ObjectsPB7.o2bas

ERROR:   not a class/type: class
WORD:    methods
LINE:    212
PASS:    1

the message refers to 'from'. The helpfile of Oxygenbasic states:
 
'of', 'has' and 'from' currently means 'inherits. They
indicate derivation from a single parental class.

There must be a small difference with the use of these keywords. (Some day I will find out which one). The only additional demo which I found with 'from' is projectsB\RosettaCode\InheritSingle.o2bas, but it's use is slightly different.

Roland