Author Topic: New Dll Error  (Read 8753 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
New Dll Error
« on: December 01, 2012, 06:55:33 AM »
Deleted
« Last Edit: May 07, 2015, 11:07:03 AM by Peter »

Charles Pegge

  • Guest
Re: New Dll Error
« Reply #1 on: December 01, 2012, 11:14:29 AM »

Ugh! I am a hostage to fortune

Is this better Peter?



X

JRS

  • Guest
Re: New Dll Error
« Reply #2 on: December 01, 2012, 11:33:03 AM »
Quote
Ugh! I am a hostage to fortune

@Charles - Remember O2 is open source. Rephrased: I am a hostage to perfection

Charles Pegge

  • Guest
Re: New Dll Error
« Reply #3 on: December 01, 2012, 11:45:51 AM »
Weeds in my garden:


JRS

  • Guest
Re: New Dll Error
« Reply #4 on: December 01, 2012, 11:58:35 AM »
Quote
Weeds in my garden

The people of Washington State just legalized pot. (use and sale) Puts a whole new spin on weeds in the garden.  :o

Charles Pegge

  • Guest
Re: New Dll Error
« Reply #5 on: December 01, 2012, 07:16:37 PM »
That is an amazing turnaround! Until recently, You might have expected 10 years of incarceration for such an evil crime!

JRS

  • Guest
Re: New Dll Error
« Reply #6 on: December 02, 2012, 07:14:44 AM »
Colorado has also legalized pot in the last elections. So far the federal government (still a crime) hasn't made any moves to override the states authority. Interesting times.

more ...
« Last Edit: December 02, 2012, 10:15:44 AM by JRS »

jumpandrun

  • Guest
Re: New Dll Error
« Reply #7 on: December 28, 2012, 10:25:43 AM »
A few things that appear to me like bugs:

this prints zero:

Code: [Select]
function myf() int
    return 1
end function
print myf()

and this prints no function result:

Code: [Select]
function myf() int
    return 1
end function
print myf() "zzz..."

this crashes:

Code: [Select]
function myf() int
    int i
    return 1
end function
print myf() "zzz..."

and some more:
these two fragments to my limited understanding should do exactly the same, but they do not (not always). #1 OB, and #2 FreeBasic, with FB doing correct. [sorry for the formatting - the board destroys the original formatting..]

Code: [Select]
#case sensitive
#indexbase 0
type Node
int nextnode[25]
int id
end type

string keys[2] <= {"", "CONTINUE", "FOR"}
Node tree[999]

sub Populate
int c, i, node, nodes = 1
byte* p

for c = 1 to 2
@p = strptr keys[c]
        node = 0
while p != 0
i = p - 65
if tree[node].nextnode[i] == 0 then
tree[node].nextnode[i] = nodes
                nodes++
end if
node = tree[node].nextnode[i]
@p++
wend
tree[node].id = c
next
end sub

function Scan(string s) as int
int i, node = 0
byte* p
   
    @p = strptr s
    while p != 0
i = p - 65
        if tree[node].nextnode[i] == 0 then exit while
node = tree[node].nextnode[i]
@p++
wend
if tree[node].id != 0 and p == 0 then return tree[node].id
    return 0
end function

'''main'''
Populate
print Scan("FR")
Code: [Select]

type TNode
as integer nextnode(25)
as integer id
end type

static shared as zstring * 12 keys(2) => {"", "CONTINUE", "FOR"}
dim shared as TNode tree(999)

sub Populate
dim as integer c, i, node, nodes = 1
dim as zstring ptr p

for c = 1 to 2
p = @keys(c)
        node = 0
while *p <> 0
i = *p - 65
if tree(node).nextnode(i) = 0 then
tree(node).nextnode(i) = nodes
                nodes += 1
end if
node = tree(node).nextnode(i)
p += 1
wend
tree(node).id = c
next
end sub

function Scan(s as zstring ptr) as integer
dim as integer i, node = 0
dim as zstring ptr p
    
    p = s
    while *p <> 0
i = *p - 65
        if tree(node).nextnode(i) = 0 then exit while
node = tree(node).nextnode(i)
p += 1
wend
if tree(node).id <> 0 and *p = 0 then return tree(node).id
    return 0
end function

'''main'''
Populate
print Scan("FR")
sleep
« Last Edit: December 28, 2012, 11:26:51 AM by jumpnrun »

Charles Pegge

  • Guest
Re: New Dll Error
« Reply #8 on: December 28, 2012, 10:51:54 AM »
Hi Jumpandrun,

function myf() as int

Code: [Select]
function myf() as int
    return 1
end function
print myf()


jumpandrun

  • Guest
Re: New Dll Error
« Reply #9 on: December 28, 2012, 10:57:20 AM »
ok, but OB does not complain about the missing "as"..

and what is the difference in the two codes OB/FB?

Charles Pegge

  • Guest
Re: New Dll Error
« Reply #10 on: December 28, 2012, 11:06:10 AM »
Yes, it should be possible to make the return typer as optional without disrupting other keys. I will investigate.

PS:

string keys[2]={"CONTINUE", "FOR"}

jumpandrun

  • Guest
Re: New Dll Error
« Reply #11 on: December 28, 2012, 11:19:09 AM »
string keys[2]={"CONTINUE", "FOR"}
unfortunately does not change the outcome..

so, is there no automatic counting of elements by the compiler?


Charles Pegge

  • Guest
Re: New Dll Error
« Reply #12 on: December 28, 2012, 02:22:00 PM »
I've checked prototype parsing and we definitely need the as key to avoid other syntax conflicts.

Array elements are not automatically counted at present.

But the same syntax can be used to fill elements of compound types and arrays of compound types. Unlike C, multiassignments can be done any time and from any offset.

example:

Code: [Select]
type location string name, single x,y,z

location loclist[8]

loclist[2]<=
"A", 1,1,1,
"B", 1,1,2,
"C", 2,1,3,
"D", 2,1,4

print loclist[3].name + loclist[3].z ' B2






Aurel

  • Guest
Re: New Dll Error
« Reply #13 on: March 18, 2013, 07:03:37 AM »
Charles ...
I download latest oxygen.dll and replace with old wihich i currently use
BUT now compiler complain that there is error:

cc = Tally(temp$,",")

he say that error is with comma inside quote  ???
Is this bug ?

/ So i must use again old oxygen.dll (409kB) - which work with oxyMapy / >:(
« Last Edit: March 18, 2013, 07:11:59 AM by Aurel »

Charles Pegge

  • Guest
Re: New Dll Error
« Reply #14 on: March 26, 2013, 02:13:51 AM »
Should be okay, Aurel. Can it locate Tally?

I checked a version of tally with #lookahead

#lookahead

string temp$=" ,,, , , , ,"

cc = Tally(temp$,",")
print cc '7

end

function tally(string s,k) as sys
sys a,c
a=1
do
  a=instr a,s,k
  if a
    c++
    a+=len k
  else
    exit do
  end if
end do
return c
end function