BASIC Developer & Support Resources > Compilers

OxygenBasic

(1/4) > >>

John:


Introducing Oxygen Basic

Oxygen Basic (O2H) is a Just-In-Time compiler assembler, deployed in a single DLL that takes source code strings and returns executable binary. It is an extension of the O2 assembler. This implementation can be embedded in any application to provide high performance programmability. The compiler can also generate conventional executables and dynamic link libraries (DLL).

Oxygen supports Object Oriented Programming with multiple inheritance and also single inheritance modes, more suited to COM. In addition to this O2H supports User-defined operators and operator sets for use with complex numbers, matrices, vectors, sets and other specialised forms. It can also compile & execute strings of source code at run time with its built in compile() function, opening new possibilities for functional programming.

The built in function set is small. but contains the necessary tools to build class / function libraries to any scale.

In addition to understanding Basic in the QBasic genre, Oxygen can read sufficient C syntax to deal with most C headers directly, eliminating the need to translate them into Basic.

oxygenbasic.org

Mike Lobanovsky:
John,

What you should really ask Peter about is what the Step value in fact is in his "For i=v to 1" statement. In all "normal" BASIC's, Step defaults to 1 unless specified explicitly. It seems like it is not so in OxygenBasic. It also seems that Charles is overlooking this obvious peculiarity when adding his twopence to the discussion.

John:

--- Quote ---A fair substitute:
For i=v to .999999


c is an RGB composite: 1..0x00FFFFFF

Time: 21 secs

--- End quote ---

I think Charles responded appropriately and corrected Peter's answer.

Any clues to the Draw_Line() mystery?

Resolved. (uninitialized variables)  :o

Mike Lobanovsky:
John,

I'm telling you again, Gharles' answer has no relation to your problem. In any BASIC, evidently except OxygenBasic, "For i=v to .999999" will loop only once because the value of i step is not specified, and if so, then it will default to 1. Having looped once, For/Next will stop because the next value of iterator i will be 1 which is the upper limit for either <1, or =1, or =0.999999, whatever.

For any other BASIC, presumably including your SB, the statement should be something like "For i = v To 0.999999 Step 0.01" or whatever else similar to that, because i = v must be set only at loop start as per BASIC Standard. Later on, regardless of whether  v changes, i incrementation according to the Step value shouldn't change unless i is changed explicitly within the loop. Which it is not.

Try and change your outer For/Next as I suggest and I'm sure you'll see your script working.

Alternatively, not all BASIC's support fractional Steps. For example, FBSL doesn't. In this case, you should change your outer loop to
--- Code: ---i = v
While i < 0.999999
    ...(do something)...
    i = i + 0.01 ' for example
WEnd
--- End code ---

Hope this helps.

Mike Lobanovsky:
My code:

--- Code: ---#Option Strict

Dim q = 1., q1 = .9997, v = .01, i = v, vv = .0004, xs = 750, ys = 730
Dim xm = 650, ym = 180, br = -.7393, bi = .117, c, ar, ai, tr, ti
Dim x, y, d

GetDC(ME)

FbslSetFormColor(ME, 0)
Resize(ME, 0, 0, 700, 500)
Center(ME)
Show(ME)

Dim gtc = GetTickCount()
While i < 1
For d = 1 To 15000
tr = ar * ar - ai * ai + br
ti = 2 * ar * ai + bi
x = tr * xs + xm
y = ti * ys + ym
v = v + vv
q = q * q1
c = d ^ 2.1
Line(GetDC, x, y, x + Cos(i) * 50 * q, y + Sin(i) * 50 * q, c)
ar = tr
ai = ti
Next
i = i + v
WEnd

MsgBox(, GetTickCount() - gtc, d - 1 & " lines drawn",)
ReleaseDC(ME, GetDC)
--- End code ---

My results:

Navigation

[0] Message Index

[#] Next page

Go to full version