Author Topic: KBMidi.o2bas does not run any more?  (Read 76 times)

0 Members and 1 Guest are viewing this topic.

Arnold

  • Hero Member
  • *****
  • Posts: 599
KBMidi.o2bas does not run any more?
« on: April 15, 2018, 10:04:58 AM »
Hi Charles,

I am not sure about examples\Sound\KBMidi.o2bas. The program runs ok with the Latest Final Alpha version, but it fails using the Beta of 29/03/18, with or without the latest modified include files. I will get the error:
   Unidentified operand s_error in Line 65.
If I comment out the block 65-69, there is a new error:

   Unidentified element type word: string in Line 105. This is defined as:
type INSTRUMENT
   string  szInst
   int     iVoice
end type

The same happens using string type within the other structures. Must this be done differently now? I only found examples\DataProcessing\DataRead.o2bas with a string in a structure and this demo runs ok.

Roland

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3584
    • Oxygen Basic
Re: KBMidi.o2bas does not run any more?
« Reply #1 on: April 16, 2018, 05:30:50 AM »
Hi Roland,

Variadic macros got er, re-engineered, causing some mayhem in your program. I seem to remember suggesting it in the first place.  :o

But macro functions provide a better solution. It is typeless and simpler:
Code: [Select]
'macro iifType(typ, ...)
'  function iif(bool testVal, typ ifTrue, ifFalse) as typ
'    if testVal then return ifTrue
'    return ifFalse
'   end function
'end macro
'iifType sys,float,double,string

macro iif int(R, A,B,C)
if A then R=B else R=C
end macro


Arnold

  • Hero Member
  • *****
  • Posts: 599
Re: KBMidi.o2bas does not run any more?
« Reply #2 on: April 16, 2018, 07:02:41 AM »
Thank you Charles. I was so fixed on the string type that I did not even look at the iif function. Sometimes it would be better to check the code several times and take a break now and then.

Roland