Qbasicnews.com

General => General/Misc => Topic started by: marzecTM on December 02, 2004, 12:18:27 AM



Title: Bug Reports
Post by: marzecTM on December 02, 2004, 12:18:27 AM
guess it's time for this thread...

and vonGodric just found a neat one...

try to compile the fmodtest.bas and check the asm source. on line 519-520 it tries to push ~ on the stack, dunno bout you but i don't know that register.

have fun

edit: one more

D:\FREEBA~1>fbc examples\optargs.bas
examples\optargs.o(.text+0x1d):fake: undefined reference to `FOO@12'
examples\optargs.o(.text+0x26):fake: undefined reference to `BAR@8'

uh oh..., ok it might be just a show off, but a n00b or that helium guy will complain...


Title: Bug Reports
Post by: VonGodric on December 02, 2004, 02:06:58 AM
this code is erronous.

Code:

defint a-z
option explicit
type struct
   Xpos as integer
   ypos as integer
   x1pos as integer
   y1pos as integer
   Name  as string * 15
   Cmdd as sub()        'doesn't seem to allow passing amty parameter list
end type


Title: Bug Reports
Post by: v3cz0r on December 02, 2004, 02:41:20 AM
Alright, all fixed, thanks mates..


Version 0.02b uploaded, will start to release just patches soon ;)


Title: Bug Reports
Post by: SJ Zero on December 02, 2004, 03:32:25 AM
The right$ function isn't supposed to reverse the string. It's just supposed to return the characters starting X from the right, to the end.

The current code doesn't run correctly in FB:
Code:

a$ = "Hell is a place on earth"
a$ = LEFT$(a$, 3)
a$ = a$ + LCASE$(LEFT$("Low man's Lyric is a favourite song of mine.", 2))
b$ = "Now we see the truth."
a$ = a$ + " " + UCASE$(MID$(b$, 3, 1)) + MID$(b$, 2, 1)
b$ = "Girls are yucky"
a$ = a$ + LCASE$(LEFT$(RIGHT$(b$, LEN(b$) - INSTR(b$, "i")), INSTR(b$, "r") - 1)) + "d"

PRINT a$


SLEEP


I'll be checking more of the text functions sooner or later. For now I need to sleep. (edited because instr works, so I updated the program to show that)


Title: Bug Reports
Post by: v3cz0r on December 02, 2004, 04:11:44 AM
Fixed.. man, that was a stupid bug, i never used right$ for anything but getting the last character, no wonder it worked.


Btw, runtime library was barelly tested, new surprises can appear.. that why i released a beta version ;)


Title: Bug Reports
Post by: Z!re on December 02, 2004, 06:01:57 AM
PRINT SPACE$(100)

Or anything longer then the console widht...

Makes it crash in windows 98


Title: Bug Reports
Post by: Z!re on December 02, 2004, 06:13:58 AM
Code:
dim a as long

print len(a)


4?, same as integer...?


Title: Bug Reports
Post by: v3cz0r on December 02, 2004, 09:21:39 AM
No clue, that space$(100) test works fine on XP, i can't believe Win 9x can't print more than 80 chars p/ time, didn't see that limitation at the SDK docs, ow.


Yeah, an integer is 32-bit in FB, LONG is just an alias. If you really want a 16-bit integer, you have to declare them as "short" or "ushort" for unsigned ints. Using 16-bit integers would generate pretty bad code on new CPU's, size prefixes all the time.


Title: Bug Reports
Post by: Z!re on December 02, 2004, 12:32:31 PM
I meant that a long is supposed to be a long integer, thus, in freebasic it would mean 8bytes, or 64bit


Title: Bug Reports
Post by: Z!re on December 02, 2004, 12:36:06 PM
Is there a way to make PRINT Astring$

Work the same way as QB?, that is with wrap around etc?


Title: Bug Reports
Post by: v3cz0r on December 02, 2004, 01:05:09 PM
No, they are not, 64-bit numbers would need a math lib for themselves, operations would be so slow as they are in QB when working with 32-bit ones.

I thought the text wrap around was okay, i never paid attention to it anyway.. maybe another win 9x quirk.


Title: Bug Reports
Post by: Z!re on December 02, 2004, 01:05:57 PM
Code:
do
loop while inkey$ = ""
end


Freezes, on win98 and XP


FBC commandline: fbc test.bas -s gui


Title: Bug Reports
Post by: v3cz0r on December 02, 2004, 01:09:41 PM
Er, you can't create a gui app and check for console input, it won't work.

Gui apps must set up their own WinProc's and process any keyboard input, check that WinHello example.


Title: Bug Reports
Post by: Z!re on December 02, 2004, 01:13:21 PM
:oops: hehe...


Title: Bug Reports
Post by: Jofers on December 02, 2004, 01:15:29 PM
64-bit integer operations are available on 64-bit chips, and on a 64-bit cpu "long" is 64 bits.  But for 32-bit cpus, it's universally an alias for int.

And yes, event-based programming, while not the devil, demonstrates many devilish qualities.  I just had to finish a videogame in java for an assignment.  Must annoying, tiring programming there is.


Title: Bug Reports
Post by: adosorken on December 02, 2004, 02:48:18 PM
When I moved from QB to VB, I found that making a game based on events is a hella challenge when coming from a procedural environment. But now coming back to a procedural environment is like "oh yeah, this stuff rules". :D Anyways...I have some headers that I'm going to write later today for this thing, I hope they'll serve someone well and that they turn out bug-free. :D


Title: Bug Reports
Post by: v3cz0r on December 02, 2004, 03:44:46 PM
All this should be listed on FAQ's or such, it is and will be a common mistake - PowerBasic doesn't even have an inkey$, iir, no wonder.


Title: Bug Reports
Post by: barok on December 02, 2004, 10:06:51 PM
something small.  when doing for loops, you can't have:

next y,x

it won't allow it.


Title: Bug Reports
Post by: Jofers on December 02, 2004, 11:31:51 PM
heh.  I never knew you could do that with qb.

It doesn't seem necessary.. have lots of fors and one next is confusing and obsfucated.


Title: Bug Reports
Post by: barok on December 02, 2004, 11:39:49 PM
i guess.  but it's nice for limited line compo's. :)

Also found something else when trying to compile a menu program i got from qbnz:

Code:

DECLARE SUB menu (numberofchoices, title$, menuchoices$(), choice)

CLS

title$ = "title"

numofchoices = 3 'number of choices in your menu (1 to numofchoices)

DIM menuchoices(numofchoices) AS STRING
'your menu choices as text:

menuchoices(1) = "first choice"
menuchoices(2) = "choice..."
menuchoices(3) = "exit"

 CALL menu(numbofchoices, title$, menuchoices$(), choice)
ERASE menuchoices 'makes the array inexistant

'  choice   is the selection now you can use : select case or other code

SELECT CASE choice
CASE 1
PRINT "1.first choice"
CASE 2
PRINT "2..."
CASE 3
PRINT "bye"
END SELECT

SUB menu (numofchoices, title$, menuchoices$(), choice)
CLS
choice = 1          'initialize the choice

'menu format:
distancefromtoptomenu = INT((27 - numofchoices) / 3)


'menu title

LOCATE 2, (41 - LEN(title$) / 2): PRINT title$


DO

RESTORE                    '38 - LEN(MENUCHOICES(numofchoices)) / 2

FOR n = 1 TO numofchoices
LOCATE n + distancefromtoptomenu, 34: PRINT n; ") "; menuchoices$(n)
IF n = choice THEN LOCATE n + distancefromtoptomenu, 33: PRINT ">"
IF n = pchoice AND pchoice <> choice THEN LOCATE n + distancefromtoptomenu, 33: PRINT " "


NEXT

    k$ = ""

   DO
       
    k$ = INKEY$
    vakey = VAL(k$)
    k$ = UCASE$(k$)
   

   LOOP UNTIL k$ <> ""

     pchoice = choice ' save the past choice

    IF k$ = (CHR$(0) + "P") AND numofchoices >= choice THEN choice = choice + 1
    IF k$ = (CHR$(0) + "H") AND 1 <= choice THEN choice = choice - 1
    IF k$ = (CHR$(0) + "P") AND numofchoices < choice THEN choice = 1
    IF k$ = (CHR$(0) + "H") AND 1 > choice THEN choice = numofchoices

    IF VAL(k$) = vakey AND vakey <= numofchoices AND vakey >= 1 THEN pchoice = choice: choice = VAL(k$)
    IF k$ = CHR$(13) THEN EXIT DO
    IF k$ = CHR$(27) THEN choice = 0: k$ = "": EXIT DO
   
LOOP

END SUB



I got this error:

free.bas(9) : error 11: Expected constant, found: ')'

to me the syntax looks legal.


Title: Bug Reports
Post by: Jofers on December 02, 2004, 11:51:41 PM
Use REDIM or '$DYNAMIC.  Plain ol' static DIM requires a constant, it's in the keyword file.


Title: Bug Reports
Post by: ShadowWolf on December 03, 2004, 12:10:36 AM
i noted somthing strange while final finshing up my little pixl ploting fucation for sdl .

Pset screen ,X,Y,23+X,43+Y,X,255

everything works nice and good untill i add an extra verablie into the fucation like

Pset screen ,X,Y,23+X,43+Y,X + Y  ,255
once i do this the compiler spits out stuff about

test2.asm: Assembler messages:
test2.asm:196: Error: Unrecognized token '(null)'
test2.asm:200: Error: Unrecognized token '(null)'
test2.asm:201: Error: Unrecognized token '(null)'
test2.asm:202: Error: Unrecognized token '(null)'
test2.asm:206: Error: Unrecognized token '(null)'


Title: Bug Reports
Post by: marzecTM on December 03, 2004, 12:14:51 AM
ow, v1c i told you don't throw that bag of bugs onto ppl. post the entire source or put it on a server, otherwise v1c can't reproduce the error


Title: Bug Reports
Post by: Z!re on December 03, 2004, 12:20:25 AM
Windows 98

If you have a graphical window focused, or are in fullscreen, inkey$ doesent work.. at all...

You have to select the console window to be able to press keys...


Annoying.. lots..


Title: Bug Reports
Post by: marzecTM on December 03, 2004, 12:22:55 AM
ehm how do you generate the window? sdl?


Title: Bug Reports
Post by: ShadowWolf on December 03, 2004, 12:26:06 AM
defint a-z
option explicit

'$include: "sdl\sdl.bi"
'$include: "gl\gl.bi"
'$include: "gl\glu.bi

declare sub PSET (screen as SDL_Surface ptr , x as integer , y as integer, R as UBYTE , G as UBYTE, B as UBYTE, A as UBYTE)

dim screen as SDL_Surface ptr
dim a as string
Dim X as integer
Dim Y as integer
Dim T as UBYTE
screen = SDL_SetVideoMode( 640, 480, 32, SDL_HWSURFACE or SDL_DOUBLEBUF)
   if screen = 0 then
      SDL_Quit
      end 1
   end if



do
 a = inkey$
 if a = chr$(27) then exit do
 SDL_LockSurface (screen)
 
  For X = 1 to 100
   for Y = 1 to 100
    Pset screen ,X,Y,23+X,43+Y,X,255  ' <-- add +X +Y anywhere in
   next                                                 '  the parmitor list or even
  next                                                  ' a +10 or somthing
 
 SDL_unlocksurface (screen)
 SDL_Flip screen
loop

SDL_Quit
end


sub PSET (screen as SDL_Surface ptr , x as integer , y as integer, R as UBYTE , G as UBYTE, B as UBYTE, A as UBYTE)
 dim cl as uinteger ptr  
 dim colkey as uinteger
 dim Colptr as UBYTE ptr
 
 colptr = @colkey : *colptr = R
 colptr = @colkey + 1 : *colptr = G
 colptr = @colkey + 2 : *colptr = B
 colptr = @colkey + 3 : *colptr = A
 cl = screen->pixels + y * screen->pitch + x * len( integer )
 *cl = colkey
end sub


Title: Bug Reports
Post by: Z!re on December 03, 2004, 12:33:41 AM
Quote from: "marzecTM"
ehm how do you generate the window? sdl?


Yes


Title: Bug Reports
Post by: marzecTM on December 03, 2004, 12:38:36 AM
@zire well then inkey won't work, as it won't work if you do a win32 api window. cause as you create a window you also have to handle a message loop. i did a hack around that in my qbgfx legacy lib, sterling did so too in his lib, so you could still use inkey$ if you have a graphical window (would be like invoking SCREEN), but it won't work with pure sdl. that's not a bug, nor do you have to blame fb. that's windows programming


Title: Bug Reports
Post by: ShadowWolf on December 03, 2004, 12:41:18 AM
doesn't SDL have input handleing ?


Title: Bug Reports
Post by: marzecTM on December 03, 2004, 12:45:02 AM
yeah and? whats the point? the thing is inkey$ is a runtime library function. it must be overwritten when you use sdl, or win32 api or whatever other graphical api that comes to your mind, that starts a message queue


Title: Bug Reports
Post by: relsoft on December 03, 2004, 12:48:56 AM
Quote from: "ShadowWolf"
doesn't SDL have input handleing ?

Yeah, SDL_GetKeys

Like: I don't know if this would work.

Code:
Dim K as ubyte Ptr

k = SDL_GetKeys(0)

if Peek(K+ SDLK_UP) then
    doup
end if


Title: Bug Reports
Post by: ShadowWolf on December 03, 2004, 01:14:37 AM
Quote from: "marzecTM"
yeah and? whats the point? the thing is inkey$ is a runtime library function. it must be overwritten when you use sdl, or win32 api or whatever other graphical api that comes to your mind, that starts a message queue


my point was if your going to be working with in a lib then you have to accepted that some of your runtime stuff won't work. and will have to use what the lib it self gives you. it not the job of the run time to handle every possible situation where it's fucation might get steped on.


Title: Bug Reports
Post by: marzecTM on December 03, 2004, 01:20:03 AM
jupp :) sorry if i tend to have an aggressive tone, it's not my intention


Title: Bug Reports
Post by: barok on December 03, 2004, 02:26:50 AM
hmm... this program (same program as last time, the menu's one) doesn't show any bugs in the external text file, yet there must be a few bugs, as it isn't compiled.  Does the compiler output ALL the error messages?

::EDIT::

Nevermind, i just ran it through command prompt, and i got this.

free.asm:539: Error: Suffix or operand invalid  for 'cmp'

of course, in all my ignorance i have no idea what that means.


Title: Bug Reports
Post by: relsoft on December 03, 2004, 04:50:54 AM
cmp = compare

can you post the line of that the error occurec. Free.asm


Title: Bug Reports
Post by: v3cz0r on December 03, 2004, 08:19:05 AM
Shadow Wolf: you are using the old version, download the 0.02, that's the same bug as von/marzec reported.

barok: i will fix that bug when i get back, already saw what is happening - btw, "NEXT a, b, c" is not supported, that's not a bug - see docs/keywords.txt for the differences.

Z!re: inkey$ doesn't work in anything but console windows, try PB or C and you won't have even an inkey$ to play with.

marzec: i released it as BETA if you didn't notice, exactly for this.


Title: Bug Reports
Post by: marzecTM on December 03, 2004, 09:49:03 AM
dude i was joking....


Title: Bug Reports
Post by: barok on December 03, 2004, 11:36:53 AM
I didn't think it was a bug, but i just posted it just in case it's something you overlooked.

   cmp   esi, st(0)


Title: Bug Reports
Post by: v3cz0r on December 03, 2004, 12:27:57 PM
Fixed, download the lastest version: http://prdownloads.sourceforge.net/fbc/fbc.exe-v0.03b-win32.zip?download (that's just fbc.exe)

Btw, that menu code is buggy, there's nothing to RESTORE, and the var "numbofchoices" doesn't exist (it's "numofchoices").

Also, you gotta change those chr$(0) to chr$(255), null's can't be part of strings, so inkey$ returns 255 instead of 0 with extended key codes - that's shown in the docs\keywords.txt and will be included in the docs/faq.


It's rather hard to know when you are joking, marzec, you should add more smiles or something.. you know, loads of different cultures mixed, a "thumbs up!" can mean "hey, it looks good" in some countries or "hey babe, lets f*ck".


Title: Bug Reports
Post by: Jofers on December 03, 2004, 12:57:03 PM
*thumbs up*


Title: Bug Reports
Post by: KiZ on December 03, 2004, 01:10:50 PM
Is it normal that ^2 is really slow?

..

because it is quite slow.


Title: Bug Reports
Post by: v3cz0r on December 03, 2004, 01:45:09 PM
Power of, yeah, unless the left operand is a constant, that will be evaluated at compile-time.

You could just use "expression shl 1" if the left operand is an integer. FB doesn't do the "^ powerof2constant" to "shl" optimization yet.


Title: Bug Reports
Post by: KiZ on December 03, 2004, 02:07:47 PM
Quote from: "v3cz0r"
"expression shl 1"


Thanks, but what doesnt appear to work....

Code:
4 shl 1

yields 8...


Title: Bug Reports
Post by: v3cz0r on December 03, 2004, 02:21:09 PM
Er, nm me.. value ^ 2 is equal to value * value, not value * 2 (same as shl 1).


Title: Bug Reports
Post by: KiZ on December 03, 2004, 02:40:29 PM
O_o

So.... There isnt an asm type optimisation for "^"?


Title: Bug Reports
Post by: v3cz0r on December 03, 2004, 03:17:31 PM
No, it must be implemented as a library, but expr ^ 2 could be optimized to expr * expr by the compiler, i will see what i can do.


Title: Bug Reports
Post by: marzecTM on December 03, 2004, 03:22:02 PM
Quote from: "v3cz0r"
you know, loads of different cultures mixed, a "thumbs up!" can mean "hey, it looks good" in some countries or "hey babe, lets f*ck".


i hope for your health that this was not an invitation to have intercourse or something :) ;) :(  whatever...


Title: Bug Reports
Post by: v3cz0r on December 03, 2004, 03:24:15 PM
Hey, 3 smiles, you must be kidding now, right??

Heh..


Title: Bug Reports
Post by: na_th_an on December 05, 2004, 04:33:35 PM
I'm trying to compile some old code, a bit spaghetti'ish, to really proof-test the compiler.

I've found that the compiler does not understand some QB stuff:

---

The compiler complains with, stopping at the comma:

Code:
NEXT x, y


Also with this line, stopping at the ":" (error: expected ","):

---

Code:
LINE INPUT sn$: sn$ = LCASE$(sn$)


I had to change it for:

Code:
LINE INPUT ">"; sn$: sn$ = LCASE$(sn$)


to make it work. Plus LINE INPUT throws a "?" on screen, when it shouldn't. Not a single LINE INPUT variable$ worked in the code, it needs a string literal and a ";" before the variable to work.

---

QB accepted:

Code:
CLOSE


Which closed every open file. FB doesn't, it complains about "expression expected".

---

I also got something you should document (I dunno if you have done it already): If your BAS filename has a "-" the assembler fails with

Code:
junk at the end of line, first unrecognized character is `-'


My BAS file was called OPA-OPA.BAS.

The ASM lines that are not working are those:

Code:
.globl fb_opa-opa_entry
.globl FB_OPA-OPA_ENTRY
fb_opa-opa_entry:
FB_OPA-OPA_ENTRY:


Error messages:

Code:
opa-opa.asm: Assembler messages:
opa-opa.asm:10: Error: junk at end of line, first unrecognized character is `-'
opa-opa.asm:11: Error: junk at end of line, first unrecognized character is `-'
opa-opa.asm:12: Error: invalid character '_' in mnemonic
opa-opa.asm:13: Error: invalid character '_' in mnemonic


I renamed the file to OPAOPA.BAS and it compiled without problems.

Awesome work! Those are just minor issues :) and the code was like 120 Kb and written 6 years ago... Really UGLY code.


Title: Bug Reports
Post by: Jofers on December 05, 2004, 04:49:11 PM
Dark prevail... try SAL and SAR insead, if rel's not trying to mislead me *GLARE*


Title: Bug Reports
Post by: v3cz0r on December 05, 2004, 05:20:18 PM
Code:
NEXT x, y


Yeah, only single identifiers are accepted (as shown at docs/keywords.txt, will have to be documented).

Code:
LINE INPUT sn$: sn$ = LCASE$(sn$)


I'm checking just for newline, forgot about colon, will add that.

Code:
LINE INPUT ">"; sn$: sn$ = LCASE$(sn$)


Didn't know you could use console input w/o a msg, will correct that too.

Code:
CLOSE


That neither, heh.. i should read QB online docs better next time.. there's RESET, will just remap that CLOSE to that instead.


Code:
junk at the end of line, first unrecognized character is `-'


Yeah, it was corrected on the last version, 0.04b. "-" is a valid character on file names but isn't on symbols, and as every QB module can be a main module, i can't use a default name for the entry point or a name clash would happen, it's "guessed" from source's name.

Thx for reporting, will fix asap.


Title: Bug Reports
Post by: Z!re on December 05, 2004, 05:28:42 PM
Funny thing:

Code:

dim a as integer
a = 533

print "test" a


Output:
test
533


Look carefully at the print, it should crash.


Title: Bug Reports
Post by: Jofers on December 05, 2004, 05:47:30 PM
That's not a bug, it's a feature!

...

...

*looks shifty-eyed*


Title: Bug Reports
Post by: Z!re on December 05, 2004, 05:48:41 PM
Code:
'$include: "includefile.bi"
'$include: "includefile.bi


Both valid entries, soo... uhm.. whats up? :D


Should I add this to the feuture list or what :)


Title: Bug Reports
Post by: Z!re on December 05, 2004, 06:48:07 PM
Code:
Open "universe:\space\tada\woho::" for append as #1
close #1


Code:
open "c:\windows\windows\windows\blarg\does not exist\really, it doesent\i swear\for reall, just give it up\a file.txt" for append as #1
close #1


 :D


Shouldnt open return an error?, or something?..


Title: Bug Reports
Post by: Jofers on December 05, 2004, 06:51:43 PM
The second one's a perfectly valid filename.

first one isn't, but aren't these all matters for the runtime?


Title: Bug Reports
Post by: v3cz0r on December 05, 2004, 06:54:36 PM
Compile with the -e option (-e: add error checking).

All quirks fixed, including the NEXT with multiple identifiers (that i hate, btw). Will upload the new version tonight, but modifications are on CVS already, if anyone want to recompile the compiler: http://cvs.sourceforge.net/viewcvs.py/fbc (CVS when browsed by web takes some minutes to be updated).

Changelog:

Code:
[added] NEXT with multiple identifiers (NEXT a, b, ...), as many old sources seem to have that (v1ctor)
[fixed] PRINT and WRITE stmts were accepting expressions separated by white-spaces (BC also allows that) (v1c)
[fixed] quirks with LINE INPUT and INPUT for console, message is optional (try parsing that using a LR..) (v1c)
[fixed] and another one with CLOSE, file number is also optional and that way it works as RESET (v1c)


Title: Bug Reports
Post by: Z!re on December 05, 2004, 06:54:53 PM
My point is jofers.. that folder doesent exist, nor will it be created by open.


Title: Bug Reports
Post by: na_th_an on December 05, 2004, 09:28:13 PM
I've noticed that CSRLIN is not working. This code:

Code:

CLS
FOR i% = 1 TO 10
   PRINT CSRLIN
NEXT i%


Returns always 0, when it should return the current line where the cursor is. That is: from 1 to 10.

FB 0.04b.


Title: Bug Reports
Post by: na_th_an on December 05, 2004, 10:00:32 PM
And LINE INPUT should not display a "?", I almost forgot :)


Title: Bug Reports
Post by: v3cz0r on December 05, 2004, 10:42:18 PM
Ops, a typo at rtl.bas: data "csrline", "fb_ConsoleGetY", FB.SYMBTYPE.INTEGER,FB.FUNCMODE.STDCALL, 0

"csrline" instead of "csrlin", fixed.


Title: Bug Reports
Post by: na_th_an on December 05, 2004, 10:44:13 PM
Great news :) You're fast man.


Title: Bug Reports
Post by: Sterling Christensen on December 06, 2004, 12:28:16 AM
This code:
Code:
dim i as integer
dim palBuf(0 to 255, 0 to 2) as ubyte

palBuf(i, 0) = 0

Give this error with 0.04b:
Code:
bug1.asm: Assembler messages:
bug1.asm:31: Error: expecting scale factor of 1, 2, 4, or 8: got `3'


Title: Bug Reports
Post by: v3cz0r on December 06, 2004, 12:33:25 AM
Thought GAS was smart enough to convert ESI*3 to ESI*2+ESI, my bad.. got too used to MASM/TASM.. will fix asap..


Title: Bug Reports
Post by: na_th_an on December 06, 2004, 01:20:31 AM
I found what looks like some nasty corruption of string variables. I'm working on translating an old text adventure I wrote into English but first I wanted to make it run in FB.

Almost no changes, and it got compiled. Everything looked fine, but when I played a few turns it began to act strange.

There is a SUB that is passed a string with the room ID (i.e. "TOWN"). It opens the locations file, and looks for the ID inside. The first time I run the game it works fine, i.e. it finds the line and reads upon it.

The code is as simple as:

Code:
DO
   LINE INPUT #f%, nLine$
   IF nLine$ = ":" + roomID$ THEN
      found% = -1
   END IF
LOOP WHILE NOT EOF(#f%) AND NOT found%


When I exit that room and enter again, the line is not found. It only happens with some rooms, not with every one.

I changed the code. Coded a simple comparator:

Code:
Function compare%(in1$, in2$)
in1$ = ucase$(ltrim$(rtrim$(in1$)))
in2$ = ucase$(ltrim$(rtrim$(in2$)))

if len(in1$)<>len(in2$) then
compare% = 0
exit Function
end if

for it% = 1 to Len(in1$)
md1$ = mid$(in1$, it%, 1)
md2$ = mid$(in2$, it%, 1)
if md1$ <> md2$ then
compare% = 0
exit Function
end if
next it%

compare% = -1
End Function


Still fails. I added prints to see what's happenning (great way of debugging, isn't it? ;) ) and the first time it works great. It receives "TOWN" and "TOWN" and returns -1 (true). The second time it is called with "TOWN" and "TOWN" it reports that the first string is 25 characters long instead of 4, so it fails and returns 0. Extremely odd, taking in acount that I used RTRIM$ and LTRIM$ inside the function and before calling it.

This line:

Code:
PRINT in1$;"|";LEN(in1$)


Outputs:

Code:
TOWN| 25


I can't be more helpful. I could post the code, but it's a big project and in Spainsh... a pain to check. But if you like...


Title: Bug Reports
Post by: adosorken on December 06, 2004, 01:32:42 AM
Code:
Type BITMAPHEADER
  bfType As Short
  bfSize As Integer
  bfReserved As Integer
  bfOffBits As Integer
  biSize As Integer
  biWidth As Integer
  biHeight As Integer
  biPlanes As Short
  biBitCount As Short
  biCompression As Integer
  biSizeImage As Integer
  biXPelsPerMeter As Integer
  biYPelsPerMeter As Integer
  biClrUsed As Integer
  biClrImportant As Integer
End Type

This is clearly 54 bytes long. Yet it's being returned as 56 bytes long, and the function I've written fails because something in there is getting messed up. I even tried substituting the header for a fixed length 54 byte string and then just reading the file manually and I still get no results. :( Is there a problem with certain kinds of variables? I'm using Ubytes to read data from the file, and of course, this header to read the header data all at once. I'm reading in a 24 bpp BMP image, so there's no palette to be worried with. Basically...the code I'm using is a direct port of the same function I used in VC.

Btw, I'm using the very latest version, the one you just released. :D


Title: Bug Reports
Post by: SJ Zero on December 06, 2004, 01:39:49 AM
This is nit-picking(but then, it's programming, so I suppose...), but the STR$ function should have a space before the number.

FB: "0"+str$(1)+"0" = "010"
QB: "0" + str$(1) + "0" = "0 10"


Title: Bug Reports
Post by: na_th_an on December 06, 2004, 01:43:19 AM
Hmmm

Found something.

I'm using a fixed length string to see what's happenning:

Code:
Function compare%(in1$, in2$)

Dim FixLength as string * 40

FixLength = in2$

for i%=1 to len(fixlength)
print mid$(fixlength,i%,1);"->";asc(mid$(fixlength,i%,1));"|";
next i%

... etc


The first time the function is called, it shows it good. T, O, W, N, and then 36 null chars.

The next time it is called for "TOWN", I am getting T, O, W, N, a null char, and then other chars, that are exactly ' ', 'S', 'U', 'R', ' ', 'D', 'E', 'L', ' ', 'C', 'A', 'M', 'I', 'N', 'O', ' ', 'S', 'E', 'C', 'O'... Filling until precisely char #25, then null chars again.

The variable that's passed to the function was given "TOWN", it worked, then it was given "PARTE SUR DEL CAMINO SECO", it worked, and then it was given "TOWN" again, and I got what I showed.

See what I mean? (# is the null char)

Code:

TOWN#
PARTE SUR DEL CAMINO SECO#
TOWN# SUR DEL CAMINO SECO#


All are variable-length strings.

I've patched my program to have it working. This does the trick:

Code:
DIM fixBug AS STRING * 80

fixBug = varLengthStringThatFail$
varLengthStringThatFail$ = fixBug


Title: Bug Reports
Post by: adosorken on December 06, 2004, 02:07:28 AM
Okay...I found a way around the error I was getting. It appears to be an error in the Type (the first entry seems to believe it's an Integer rather than a Short for some reason!). If an Integer is first in a Type, it looks like it works fine, but a Short as first in a Type and it looks like it throws a tantrum. :D Then again, as I'm off to bed now, I'm unable to test this theory. Can anyone confirm this potential bug?


Title: Bug Reports
Post by: v3cz0r on December 06, 2004, 02:15:49 AM
Nek: all UDT elements are aligned and the UDT size is rounded to multiple of len( integer ) - all 32-bit C compilers do the same by default.

To turn that off, use:

Type BITMAPHEADER Field=1
...
End Type

No alignament or padding will be done then.


Zero: Yeah, i know it, it's on purpose, i always hated to use ltrim$( str$( value ) ), but then its just me..


Nathan: I will check it tomorrow, i think it's not the string comparator, i tested it using some old sorting algos made for qb and results were the same, it could be the data read from file, i could have missed some detail from LINE INPUT or something - that test with fixed len is okay, LEN used on a fixed-len will return it's full size, as in QB, but FB does not pad the fixlen string with spaces, but puts a null-term on it (RTRIM$ checks for the null too, besides the spaces).


Title: Bug Reports
Post by: Sterling Christensen on December 06, 2004, 04:04:45 AM
Probably not a bug, but at least a difference that really should be documented: QB's RND ranges from zero to almost, but never quite one. FB's RND actually returns 1 sometimes.

I was passing int(rnd*256) for an 8 bit color value to a function that doesn't check for >255.

Btw, I like FB's STR$ the way it is :)


Title: Bug Reports
Post by: Dr_Davenstein on December 06, 2004, 04:13:44 AM
Quote from: "Sterling Christensen"

Btw, I like FB's STR$ the way it is :)


Me too! ;)


Title: Bug Reports
Post by: relsoft on December 06, 2004, 04:40:14 AM
Quote from: "Jofers"
Dark prevail... try SAL and SAR insead, if rel's not trying to mislead me *GLARE*


No. You should use SHL/SHR in FB. It's the compiler which would convert it to SAL/SAR.  Sorry if you misunderstood me. :*)


Title: Bug Reports
Post by: adosorken on December 06, 2004, 10:07:09 AM
Ran into another interesting problem. I made a Type of Ubytes to read palette information. Four Ubytes in a row. Should have worked fine. :D Well, using the Type made the program hard-crash. So, I said "okay, screw it, I'll use four arrays instead". Same result. When I simply used an Integer to read the values (the four bytes of a palette index in a BMP file), no problems...got the routine to work. The problem is...is there something wrong with Ubyte? It seems to work fine by itself, but arrays of Ubytes seem to cause trouble.

Oh...and something I discovered last night in my tinkering...
Code:
Do: Loop Until Inkey$ <> ""

causes the application to "lock up". Not really a bug or anything, just an interesting little quirk. :D


Title: Bug Reports
Post by: v3cz0r on December 06, 2004, 11:19:44 AM
Quote
Do: Loop Until Inkey$ <> ""


What OS? Worked fine for me in XP, for console apps, course, windowed will not receive any input from stdin.


Quote
Ran into another interesting problem. I made a Type of Ubytes to read palette information. Four Ubytes in a row. Should have worked fine.  Well, using the Type made the program hard-crash


W/o seem the code to try reproducing the error.. or else those bugs will be "unknown" until someone else runs in the same problem ;) If you had fpoint operations on expressions and byte var storing the result, see below.

Quote
pix2 = palByte And 15
        pix1 = (palByte - pix2) / 16


Are pix2 and pix1 both byte vars too? That's something i didn't document - nor the error is shown as it happens at EMIT, you can't store a fpoint expression into a byte result, that's a x86 limitation and i was too slack to add a work-around for that, will do as it will (probably) used a lot ( / will do fpoint division, try \ instead).


Quote
QB's RND ranges from zero to almost, but never quite one


Didn't know that, i always used res = cint(rnd * maxres-1), that's why.. simple to fix tho. QB help says "between 0 and 1", it returns 0's, but never 1's, that's nice..


Title: Bug Reports
Post by: adosorken on December 06, 2004, 01:10:11 PM
When compiled for the GUI, I've found that at least on my system, a TinyPTC app will work with inkey$. Weird. :D

Anyways...ran into another problem. Still in porting my TinyPTC extension library, I ran into this issue with arrays...I pass a non-zero index of an array to a function, and fbc crashes. Flat-out. Here's an example:
Code:
Sub PTC_Get(startX As Integer, startY As Integer, destX As Integer, destY As Integer, buffer() As Integer)
'this is the declaration for the routine I'm calling
... code ...

'now here's where I call it:
PTC_Get whereX, whereY, whereX + 7, whereY + 7, fontbuffer(charCounter * FONT_OFFSET)

This makes the compiler hard-crash. I've made FONT_OFFSET as both a const (this is what it was originally) and a variable. Is it a problem in the function argument, or is it a bug? :D

The full source can be found here:
http://www.lostsocksoftware.com/ptcstuff.bas


Title: Bug Reports
Post by: Blitz on December 06, 2004, 01:22:59 PM
The problem is here PTC_TPut whereX, whereY,fontbuffer(newOffset), transcol

It's declared as Sub PTC_TPut (x As Integer, y As Integer, buffer() As Integer, transcolor As Integer)

This seems to be a general problem, if you don't pass an array descriptor where it expects it crashes. Symbol table problem?


Title: Bug Reports
Post by: Z!re on December 06, 2004, 02:32:12 PM
0 < RND < 1

Tested it.. in QB that is..


Title: Bug Reports
Post by: Z!re on December 06, 2004, 02:49:30 PM
DATE$ insists that it's 2001...


Also, is MM-DD-YY the locked way of having it?, So we don't have to worry about someone having DD-MM-YY etc...


Title: Bug Reports
Post by: v3cz0r on December 06, 2004, 03:16:56 PM
Fixed, it now prints 12-06-2004 here (year was - 1900, damn libc localtime() function).


RND is fixed too, no more 1's, they are baaad.


Nek: inkey$ works with TPTC coz i hacked it, WM_KEYDOWN is being remapped to console input, so inkey$ won't lock - TPTC out-of-box will close the window when ESC is pressed too.

About the prototype, you should pass the descriptor to the array, not the element itself, i will add a check for that.. try that code with QB and it will complain with "parameter type mismatch" at the array, it has to be fontbuffer() only, with no indexes.


Title: Bug Reports
Post by: adosorken on December 06, 2004, 04:59:19 PM
Hrm...with QB, I always used VARSEG with the element I believe. My TinyPTC extension library is directly ported from C, so there's probably a few more places where it's gonna be a lil weird in the conversion.


Title: Bug Reports
Post by: na_th_an on December 06, 2004, 05:30:27 PM
In a big program (which compiles fine) I changed this line:

Code:
IF o$ = "open closet @ keys" OR o$ = "use keys @ closet" OR o$ = "open @ keys closet" THEN


For this other:

Code:
IF (instr(o$,"open") or instr(o$,"use")) and instr(o$,"closet") and instr(o$,"key") then


Now, when compiling, it gives a "missing END SUB" in the first "SUB" line after the current sub's "END SUB". There's something wrong with expressions.

If I undo the changes, it compiles just fine.


Title: Bug Reports
Post by: v3cz0r on December 06, 2004, 07:15:15 PM
I couldn't reproduce that, tried with:

Code:
sub foo

IF (instr(o$,"open") or instr(o$,"use")) and instr(o$,"closet") and instr(o$,"key") then

end if

IF (instr(o$,"open") or instr(o$,"use")) and instr(o$,"closet") and instr(o$,"key") then

end if

IF (instr(o$,"open") or instr(o$,"use")) and instr(o$,"closet") and instr(o$,"key") then

end if

end sub

sub bar

end sub


Could you send the full sources that are causing that error and the line input one? By email it would be okay.. spanish is no problem to me either ;) Thx.


Title: New bug?
Post by: red_Marvin on December 06, 2004, 07:46:36 PM
New bug?:

My code:

[syntax="qbasic"]DIM cmdline AS STRING
DIM yn AS STRING
1 INPUT ">", cmdline
SHELL cmdline
INPUT "again? (y|n) >", yn
IF LCASE$(yn) = "yes" OR LCASE$(yn) = "y" THEN GOTO 1
END[/syntax]

Quote
C:\Documents and Settings\leo\SKRIVB~1\freeBASIC>fbc cmdline.bas
Assembler messages:
Can't open and for reading: No such file or directory
and:0: Can't open Settings\leo\SKRIVB~1\freeBASIC\bin\as.exe for reading: No suc
h file or directory
C:\Documents: cannot open linker script file C:\Documents: No such file or direc
tory

C:\Documents and Settings\leo\SKRIVB~1\freeBASIC>


"C:\Documents: cannot open linker script file C:\Documents"
Fixed path?

EDIT:: FreeBASIC v0.05b


Title: Bug Reports
Post by: Z!re on December 06, 2004, 08:01:37 PM
FB doesent like spaces in the path it seems


Title: Bug Reports
Post by: red_Marvin on December 06, 2004, 08:05:39 PM
w00t Z!re!
I moved the thing to be directly under c:\freebasic
and then it worked... I thought I tested for that hmm...
Whatever. It worked from the above folders in some
previous verision anyway. v3cz0r?


Title: Bug Reports
Post by: Blitz on December 06, 2004, 08:22:52 PM
it's more windows the FB.
Paths with spaces and unicode unicode chars need to be passed inside qoutes which i guess fb doesn't


Title: Bug Reports
Post by: na_th_an on December 06, 2004, 08:51:58 PM
Quote from: "v3cz0r"
Could you send the full sources that are causing that error and the line input one? By email it would be okay.. spanish is no problem to me either ;) Thx.


I will do later... I've been trying to reproduce the error and I couldn't :D Anyhow, the sources are really ugly. Maybe it was just a side effect. I'll send them anyways.


Title: Bug Reports
Post by: v3cz0r on December 06, 2004, 11:53:13 PM
Alright..


About the paths with spaces on them, that's not FB, LD and AS can't run fine when the path used to execute them has white spaces on it.. *nix stuff.

Anyway, i found a work-around for that, RUN, CHAIN and EXEC now check if paths have spaces on them and then make a short path (old 8.3 format), if needed.. worked fine.


Title: Bug Reports
Post by: SJ Zero on December 07, 2004, 03:48:51 AM
If you pass an integer to a sub which calls for UBYTES, the effect is the same as byref.

This was a bastard to hunt down. :)


Title: Bug Reports
Post by: na_th_an on December 07, 2004, 01:26:46 PM
v1ctor, I'm sending you my code tonight. The odd stuff with strings keep happenning.

I've pictured what happens, more or less:

1.- Affected are variable length strings.
2.- LEN and comparisons don't work with "damaged" strings.
3.- Damaged strings can be "repaired" using fixed length strings:

Code:
FixLength = VarLength: VarLength = FixLength


so I guess that assignation works fine.

With "damaged strings" I mean what I posted before:

Code:
Assignation             Contents      Len function   Comparison
---------------------------------------------------------------------------------
w$ = "TOWN"         ->  TOWN#         LEN(w$) = 4  ; IF w$ = "TOWN" -> true
w$ = "ANOTHER VAL"  ->  ANOTHER VAL#  LEN(w$) = 11 ; IF w$ = "TOWN" -> false
w$ = "TOWN"         ->  TOWN#ER VAL#  LEN(w$) = 11 ; IF w$ = "TOWN" -> false !!!


Title: Bug Reports
Post by: Z!re on December 07, 2004, 06:33:57 PM
Code:
dim dbgFile as string

print DATE$

dbgFile = DATE$+"."+TIME$
print dbgFile

sleep

end


Output:
Quote
12-07-2004
12-07-20.22:33:16


Title: Bug Reports
Post by: v3cz0r on December 07, 2004, 06:47:05 PM
date$ was allocating 2 chars less than needed, never copy&paste code.. i wrote time$ first and then used most of code to write date$ in 3 minutes.. fixed


Title: DIM SHARED
Post by: Badjas on December 07, 2004, 08:22:54 PM
DIM SHARED PlayerSprites()  AS INTEGER

says error. expected expression, found )

I think it expects array dimensions. Well I ain't giving any! :-p .. does work if I use COMMON

but I tried figuring out why

FOR P = 1 TO NumPlayers

gives me an error 'expecting scalars'

hmm wait I DIMmed P to integer and now the error is gone X-) .. defint gone somewhere? .. hmm.. I guess it's me. But now I did find something else..

I said
COMMON SHARED Ground() AS INTEGER
and
REDIM Ground(Size1616, 13)  AS INTEGER

and I used the expression
Ground(0, 9) in like:
SVGAPut Bomb(P, b).X, Bomb(P, b).Y, VARPTR(Ground(0, 9)), VARSEG(Ground(0, 9))

gives me error wrong number of dimensions. The reason I use COMMON SHARED is actually just an arctifact from using modules. Should be valid code though.

(I know I need to throw out SVGAPut and those varptr's are gone too then. porting isn't that simple as it sounds :-p)

Greetings,
Badjas


Title: and..
Post by: Badjas on December 07, 2004, 08:27:13 PM
DIM Temp(420), Temp2(420)

...

REDIM Temp(672)

...

gives me duplicated definition error on the redim statement


Title: Bug Reports
Post by: v3cz0r on December 07, 2004, 09:08:02 PM
VARSEG() does not exist, FB thinks it's an array - due the ambiguity with undeclared variables - but was not dimensioned.

I never used "dim array() as anytype", didn't know QB allowed that.. living and learning - writing a compiler w/o an specification isn't simple.

DIM bleh(constant expression)

then

REDIM bleh(expression)

won't work if $dynamic wasn't used (all that is shown at docs/keywords.txt, nobody reads it).

bleh() will never be dynamic - QB allocates ALL arrays inside procs as dynamic, FB doesn't do that, there's enough stack to use and its way faster than calling the OS to do the allocation.


Title: ooops
Post by: Badjas on December 07, 2004, 09:17:47 PM
:oops:  mea maxima culpa

thanks for explaining I should get back to work

wait.. '$DYNAMIC is there.. or .. now that I put '$DYNAMIC in the sub the error goes away.. I see. okay :-)


Title: hard crash
Post by: Badjas on December 07, 2004, 09:38:34 PM
declare sub resetscreen ()

dim a as string
dim level as integer
dim loadlevel as integer
dim p as integer

IF a <> "" THEN
    SELECT CASE ASC(Right$(a, 1))
   CASE 13:
      LoadLevel = Level
      EXIT SUB
   CASE 27: ReSetScreen: END
   CASE 72: Level = Level - 1: IF Level = 0 THEN Level = 15
   CASE 80: Level = Level + 1: IF Level = 16 THEN Level = 1
   CASE ELSE: P = 0
   END SELECT
end if
   
print p
END

sub resetscreen ()
end sub

----------

that crashes for me anyway. using v0.06 (and btw with version numbering, I'd regard version 0.10 as the successor to 0.9. Just treating the decimal part like it was a number. now you have a 99 versions limitation)

ehm.. I made that program by copying some code from a bigger program to narrow down the error I got on the CASE ELSE line but that error is now hidden by the crash. the error on the CASE ELSE line is 'invalid data type' and 'expected end if' (but perhaps I'm just really rusty at basic)


Title: Bug Reports
Post by: v3cz0r on December 07, 2004, 10:08:42 PM
EXIT SUB outside a proc, will have to add a check for that.. it's trying to jump to an label that doesn't exist, then the access violation..


Title: Bug Reports
Post by: adosorken on December 07, 2004, 10:26:27 PM
What's wrong with having a 0.100 version? :D


Title: Bug Reports
Post by: Jofers on December 07, 2004, 11:25:40 PM
Hmm.. you can make two variables of the same name in QB.  Just make them different types.  You can even have an integer, and an integer array with the same name and it doesn't care.  That's not really a bug, and it might have been mentioned or addressed.  Either way, it's worth mentioning.  Twice if it's already mentioned, I'm a lazy bastard and don't look this up.

Is there something like bugzilla to manage all this or is it kind of pointless with one developer?  Seriously dude, I wish I could help develop if I didn't suck :)  I've said that before with making a normal compiler :D


Title: Bug Reports
Post by: v3cz0r on December 07, 2004, 11:39:56 PM
Code:
a$ = "123"
 a% = 123
 a! = 123.0
 a# = 123.0
 
 dim b%(10), b!(10)
 
 b%(1) = 123
 b!(2) = 123
 b$ = "123"


All allowed.

Accessing undeclared arrays isn't tho - that's one of the first causes of bugs.. foo baa(a)  "hmm, why isn't working, wait, it's "bar", QB just allocated a dummy array for me.." etc

Bugs can be reported at sourceforge: http://sourceforge.net/tracker/?group_id=122342&atid=693196 , would make things easier.


Title: Bug Reports
Post by: Jofers on December 08, 2004, 01:10:13 AM
What about:
dim a(4) as integer
dim a as integer

I get
my.bas(2) : error 4: Duplicated definition

QB doesn't give a rat's behind.
version .04b though.


Title: Bug Reports
Post by: Z!re on December 08, 2004, 01:48:08 AM
Why doesent FB allow:

Code:
dim a as integer

a% = 100



And wouldnt a%, a!, a# aso, mean that:
Code:

dim a as integer
dim a as single
dim a as [...]

Isnt that just silly?

And since I cant do:
Code:

dim a as single

a! = 100


How would I make the single type var a = 100, and the integer type var  = some other value?

a% ?

What about option explicit?

problems problems..


Title: Bug Reports
Post by: adosorken on December 08, 2004, 01:48:41 AM
I personally find it bad coding practice to use the same variable name for different types, but that's just me.


Title: Bug Reports
Post by: Jofers on December 08, 2004, 02:13:26 AM
Oh yeah, me too.  But I was playing around with "Dark woods 2" for a few minutes today, and it seemed like something worth pointing out.

I probably won't spend too much time porting it.  I'm pretty sure it will go down as the most LINE()-() filled text game ever programmed.


Title: Bug Reports
Post by: CGI Joe on December 08, 2004, 09:44:15 AM
Quote from: "Z!re"
Why doesent FB allow:
And wouldnt a%, a!, a# aso, mean that:
Code:

dim a as integer
dim a as single
dim a as [...]

Isnt that just silly?


You can't do that in QB.


Title: Bug Reports
Post by: Z!re on December 08, 2004, 11:01:43 AM
I know, thats my point.

So why allow:
a%
a!
a$
a&
[...]



And you cant remove the middle of my post and change the meaning of it.
Read my entire post.

The first code statement was a question, the next ones were facts.


Title: Bug Reports
Post by: CGI Joe on December 08, 2004, 01:21:44 PM
I read your entire post and it didn't make any sense.


Title: Bug Reports
Post by: Z!re on December 08, 2004, 01:54:58 PM
Having different variables, named the same but of different types

Makes no sense, as FB doesent allow, for example:

Code:
dim a as single

a! = 10.324982  'single, the one dimmed
a = 219832  'integer


Having multiple variables with the same name/diff type is the same as doing:

Code:
dim a as integer
dim a as single
dim a as string

It makes no sense.



And why doesent FB allow:
Code:
dim a as integer
a% = 100

But fail on the %?


Hope its more clear now.


Title: Bug Reports
Post by: aetherfox on December 08, 2004, 03:04:13 PM
I don't see what the fuss is really.  I mean forget the bad coding practice of using same variable names, it's also just plain stoopid.

Vic, whats the status on those string bugs nath pointed out? We want to finish the game :P


Title: Bug Reports
Post by: v3cz0r on December 08, 2004, 08:18:09 PM
Fixed, i wasn't padding the fix-len string with null's when assigning them with smaller strings.

I'm trying to get that stupid DIM array(somenonconstant) to work, if i finish it today, i will upload the new version..


Z!re: dim bleh as integer: bleh% = expression is fixed, it should be working before, i had to correct just one line in the middle of the ~730 needed JUST to handle variables and arrays.

Now multiple arrays with same name and different types? No thanks, enough of backward compatible crap.


Changelog:

Quote
[fixed] RTRIM$ would fail with fixed-len strings as str_assign was not padding them nulls (v1ctor)
[fixed] DATE$ was allocating 2 chars less than needed (v1c)
[fixed] EXIT were not checking if was inside a compound stmt or a proc, an access violation would happen (v1c)
[fixed] vars explicity declared with full type weren't be found when used with a prefix of same type (v1c)
[fixed] emit was pushing words to stack and cleaning 4 bytes when converting to/from fpoint vars to/from short vars (v1c)
[fixed] ERASE was accepting any kind of vars, including scalars and non-dynamic arrays (v1c)


Title: Bug Reports
Post by: na_th_an on December 08, 2004, 10:03:44 PM
We should pay v1ctor for his work :D Good job, man.


Title: Bug Reports
Post by: adosorken on December 09, 2004, 12:59:55 AM
I'm sure that whoever takes a product commercial using FreeBASIC will have the balls to pay some royalties. I know I will, and I may just have a use for FreeBASIC commercially very soon. :D


Title: Bug Reports
Post by: Badjas on December 10, 2004, 08:41:34 PM
check out what the thing does (v0.07) on this file:
http://badjas.killerz-web.com/BOMBER29.BAS


Title: Bug Reports
Post by: Jofers on December 10, 2004, 10:32:28 PM
I'd put a donation-box on the main page.  And I'd be willing to hunt for a publisher when the documentation is complete.


Title: Bug Reports
Post by: marzecTM on December 10, 2004, 10:39:30 PM
Quote from: "Badjas"
check out what the thing does (v0.07) on this file:
http://badjas.killerz-web.com/BOMBER29.BAS


i suggest to call freebasic from now on THE THING.


Title: Bug Reports
Post by: VonGodric on December 10, 2004, 10:58:03 PM
[syntax="QBASIC"]
'Testing...
option explicit
randomize timer
dim number as integer
dim answer as string
number=int(rnd*100)
print number
dosad
    line input "Enter the number: "; answer$
    select case val(answer$)
    case is > number
        print "The number is smaller!"
    case is < number
        print "The number is bigger!"
    case else
        print "You are th winner!"
        sleep
        end
    end select
loop[/syntax]
Always says number is bigger -second choice. fbc ver 0.7


Title: Bug Reports
Post by: v3cz0r on December 11, 2004, 01:48:20 AM
Fixed.. another bug caused by optimizations..

What you mean badjas? It generated a 512k asm file and the obj couldn't be linked into an exe coz there are functions missing - btw, w/o the fix for that bug listed by VonGodric, many "fpoint relational-operator integer" won't work right.

Are you really going to try to get that to work? I wasn't talking seriously at qb45's board, mind you.. heh


Title: Bug Reports
Post by: Badjas on December 11, 2004, 02:35:55 PM
Oh... how silly of me.. ehm. I guess that's something that godric's IDE should catch better then. Cuz this occured to me in the IDE (running via that) as a crash.

And ehm... I'm just gonna go on with trying yes, cuz it would be interesting to me to see how much power (speed) freebasic gives (so I could put in like.. 200 bombs exploding simultaneously :-D ). And I don't need to work around memory limitations anymore in case that I could still improve it (but let's forget that particular idea X-) )


Title: Bug Reports
Post by: VonGodric on December 12, 2004, 01:15:35 AM
sdl sdlvideo.bi file has a bug in sdl_Rect structure:
change it to:

Code:
type SDL_Rect
x as short      'integer
y as short      'integer
w as ushort   'uinteger
h as ushort    'uinteger
end type


Title: Bug Reports
Post by: na_th_an on December 29, 2004, 01:27:26 PM
Found another one. fbc doesn't complain on this snippet but the assembler does:

Code:
Declare Sub DoFoo()

dim Shared WhichOne as short

WhichOne = 0

Sub DoFoo()
   WhichOne = 1 - WhichOne
End Sub


Error messages returned:

Code:
test.asm: Assembler messages:
test.asm:48: Warning: using `%ax' instead of `%eax' due to `w' suffix
test.asm:49: Error: suffix or operands invalid for `mov'


Title: Bug Reports
Post by: v3cz0r on December 30, 2004, 12:22:58 AM
Fixed, will be on next rls, thanks.

Code:
[fixed] "imm op short var" was allocating the wrong register type, due an integer imm optimization at AST (v1c)


Title: Bug Reports
Post by: na_th_an on December 31, 2004, 12:19:07 AM
Thanks :)

I found another one. The compiler (or the assembler) seems to have trouble with long strings in long lines:

Code:
Declare Sub Pres (t$)

' Isolate error

CLS
PRINT "Test 1 :: Long string"

st$ = "FATHER: 'I won't listen to you if you don't convince me that I can be proud of you! Just like before you told me you didn't want to be a lumberjack!'@'Besides that... I can't find a decent log today!'"
PRINT "OUTSIDE THE SUB, THIS IS THE STRING :: "; st$
Pres st$

PRINT
PRINT "Test 2 :: Split String (this works)"

st$ = "FATHER: 'I won't listen to you if you don't convince me that "
st$ = st$ + "I can be proud of you! Just like before you told me you "
st$ = st$ + "didn't want to be a lumberjack!'@'Besides that... I can't "
st$ = st$ + "find a decent log today!'"
PRINT "OUTSIDE THE SUB, THIS IS THE STRING :: "; st$
Pres st$


SUB Pres (t$)
   PRINT "INSIDE THE SUB, I GOT THIS STRING :: ";t$
END SUB


The string "st$" resulting is trimmed in the first test whether by the compiler or the assembler.

I had to manually split like 200 lines with text in my text adventure :D


Title: Bug Reports
Post by: Ryan on December 31, 2004, 01:46:52 AM
heh  That's tedious.  It does work fine when the string is grabbed with line input, though, as I'm just storing all the text in external files.


Title: Bug Reports
Post by: v3cz0r on December 31, 2004, 04:44:09 AM
Literal strings max length is now 1024 chars, enough? ;)

Download the new version, btw.. it's out.


Title: Bug Reports
Post by: Sterling Christensen on December 31, 2004, 05:15:13 AM
Minor difference in INT function behavior. It seems like QB's INT returns a LONG, while FB's INT returns floating point:
Code:
PRINT INT(1000000000)

QB shows 1000000000, FB 1e+009

I think this would cause expressions involving INT to use more floating point math than necessary. Example:
Code:
PRINT int% + INT(float!)

But I guess that's not much of an issue on modern processors. I'm still freaked out that floating point division is faster than integer division - maybe FB's INT is better the way it is.


Title: This bug took me quite some time to figure out...
Post by: subxero on December 31, 2004, 07:10:58 AM
Alright, I was writing a program to automatically generate DECLARE statements for any SUBs/FUNCTIONs in a file/in a group of files and I needed to use three Windows API functions: FindFirstFile, FindNextFile and FindClose, as follows:

Code:

Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Integer
Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Integer, lpFindFileData As WIN32_FIND_DATA) As Integer
Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Integer) As Integer


These functions take a parameter of type WIN32_FIND_DATA (who requires FILETIME as well):

Code:

Type FILETIME
    dwLowDateTime   As uinteger  
    dwHighDateTime  As uinteger  
End Type

Type WIN32_FIND_DATA
    dwFileAttributes    As uinteger  
    ftCreationTime      As FILETIME  
    ftLastAccessTime    As FILETIME  
    ftLastWriteTime     As FILETIME  
    nFileSizeHigh       As uinteger  
    nFileSizeLow        As uinteger  
    dwReserved0         As uinteger  
    dwReserved1         As uinteger  
    cFileName           As String * 260 - 1
    cAlternate          As String * 14 - 1
End Type


Now, I've got my functions and their UDTs. So let's give them a call:

Code:

Dim FindHandle As Integer
Dim FindData As WIN32_FIND_DATA

FindHandle = FindFirstFile("*.*", FindData)
If FindHandle <> -1 Then
   Do
      ' I need to print the file name:
      Print FindData.cFileName
   Loop While FindNextFile(FileHandle, FindData)
End If


However, that code does not work... the filenames printed are not the whole filenames - they are missing their first four characters. I suspect this is because the strings in FB are stored as (size, data), where size is a four-byte long integer. Since Windows copies strings directly to their address, it copies the first four characters into this unaccessible area of the string. So I had to work around this by doing the following:

Code:

' MAX_PATH is usually 260
Dim A As String * MAX_PATH Pointer

' Point to the actual string Windows stored, not the cut version:
A = VarPtr(FindData.cFileName) - Len(Long)
Print *A


This worked just fine. This took me quite some time to figure out, though, and could be a serious pain in Windows programming with FB. It's just a suggestion, but might it be possible to have a CSTRING data type, that stores its strings as NULL-terminated values? It'd be a little weird, but it would work.


Title: Bug Reports
Post by: VonGodric on December 31, 2004, 11:42:33 AM
okay, I found new bug:
Code:
sub test(text as string * 1)
   print text
end sub

dim a as string
DO
   a=INKEY$
   IF a>"" AND a<>chr$(13) THEN test(a)
LOOP UNTIL a=CHR$(13)
Gives some wierd result


Title: Bug Reports
Post by: adosorken on December 31, 2004, 11:51:31 AM
How can a string exceed the value of another string? I think your code is what's broken. :D


Title: Bug Reports
Post by: VonGodric on December 31, 2004, 11:55:48 AM
no it isn't
Code:
sub test(text as string * 1)
   print text
end sub
test("h")
test("i")
test("j")
sleep
gives same effect


Title: Bug Reports
Post by: adosorken on December 31, 2004, 11:58:54 AM
Code:
IF a>"" [...]

umm...what part were you talking about again? That looks pretty incorrect to me, but I could be wrong...


Title: Bug Reports
Post by: na_th_an on December 31, 2004, 12:03:31 PM
It's correct. It is always true except when a is the empty string.


Title: Bug Reports
Post by: v3cz0r on December 31, 2004, 01:06:18 PM
You shouldn't be allowed to declare fixed-len strings on function arguments and function results.. fixed - Von seems to read my mind, i knew that was possible and didn't fix it coz well, i thought nobody would find it out so early :P

subxero: actually, you found another bug that i-know-it-could-be-wrong-but-never-tested-it, qword fields (8 bytes long), were being aligned to qword boundary (i thought double's were aligned that way..), they should be aligned to dword boundary, so that WIN32_FIND_DATA will be wrong, 'cause the FILETIME fileds (all 8-byte longs). Fixed, will be on the next release - or already on CVS if you want to compile yourself. Btw, you could do "Type WIN32_FIND_DATA Field=1" by now to "fix" it.

Sterling: there's no floor() function on libc but for doubles (only C++ has overlapped ones), so INT() maps to double no matter the source kind, float or double.


Btw, happy new year, cyaz..


Title: Bug Reports
Post by: Jotz on December 31, 2004, 09:17:30 PM
I think this may or may not be a bug.  If your screen width is say, 60, and you print something like:

PRINT STRING(60, "-")

It starts another line in the next row  with only 1 character.


Title: Bug Reports
Post by: VonGodric on December 31, 2004, 10:09:00 PM
i think numbers go from 0 to 59 not from 1 to 60 :wink:  I may be wrong :D


Title: Bug Reports
Post by: Jotz on January 01, 2005, 01:23:57 AM
Nope, I'm pretty sure it starts at 1.  If I make a line that is 59 characters across it's fine, but theres one blank space in the end.  Then putting a character in the last space will shift the row.  Is there any alternate waa to making a line all the way across the screen?


Title: Bug Reports
Post by: v3cz0r on January 01, 2005, 01:30:25 AM
PRINT STRING(60, "-");

Printing the same number of chars as the console's width + a newline (PRINT w/o the ending semi-colon), will make it skip one line more.


Title: Bug Reports
Post by: VonGodric on January 01, 2005, 12:20:13 PM
Okay, is it a bug, or is it just wrong?
Code:
TYPE Test
   ENUM
      x = 0
      y
      z
   END ENUM
END TYPE

Also, what should this code do?
Code:
ENUM MyEnum
   a = 100
   b
   c
END ENUM
TYPE Test
   i AS MyEnum
END TYPE

DIM k AS Test
PRINT k.i   'gives 0, but can be used as integer datatype, and can assign any value
PRINT k.i%  'no error here either
'PRINT K.i.a, K.a are both wrong
SLEEP
And would it be possible to have so, if no name after enum then names would be used that are in enum, if name is set(aka enum myenum) then it'be needed to dim it or smth before use?


Title: Bug Reports
Post by: v3cz0r on January 01, 2005, 12:45:17 PM
You can't have any other blocks inside TYPEs but nameless UNION's.

Enums are Integers, you can declare arguments and variables as enums and such, but they are not checked if you are really assigning/passing a constant that was part of the enum block -- so you are allowed to do like: myenum = X or Y


Title: Bug Reports
Post by: VonGodric on January 01, 2005, 12:54:42 PM
Then could you make it possible to use nameless enums too? and seperate enum var's with , from eatch other? like:
Code:
enum i
   i, g, h, s
end enum

?


Title: Bug Reports
Post by: theuserbl on January 02, 2005, 11:48:31 AM
I don't know, if it in 0.09 is so, but in 0.08 was a bug in inkey$.

For example:
If you type "k" it says that you hafe typed "k". (all ok).

But then there existing keys, which creates two bytes in key$.
For example the cursor keys or F1-F12.

On QBasic they ctreate CHR$(0)+AnOtherByte.

On FreeBasic it is CHR$(255)+AnOtherByte.

Don't know, if it is fixed in 0.09.


-----

And second bug seems to be ptc in 0.09.
In 0.08 all ptc demos runs perfect in a window. And it is still so (I have now 0.08 and 0.08 on my computer).
But with 0.09 it goes in Win98 in fullscreenmode and then it do nothing.

------

A third bug (is it´one) is with qbgfx.
I have tried to run qbgfx. But I can´t compile it. :-(

Code:

C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_main.o)(.text+0x2ce0):QB_gfx_m
ain.c: undefined reference to `SDL_FreeSurface'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_main.o)(.text+0x2d09):QB_gfx_m
ain.c: undefined reference to `SDL_SetColors'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_main.o)(.text+0x2f07):QB_gfx_m
ain.c: undefined reference to `SDL_CreateRGBSurfaceFrom'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_main.o)(.text+0x2f34):QB_gfx_m
ain.c: undefined reference to `SDL_MapRGB'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_main.o)(.text+0x2f43):QB_gfx_m
ain.c: undefined reference to `SDL_SetColorKey'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_main.o)(.text+0x2f52):QB_gfx_m
ain.c: undefined reference to `SDL_UpperBlit'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_main.o)(.text+0x2f5d):QB_gfx_m
ain.c: undefined reference to `SDL_FreeSurface'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_main.o)(.text+0x2f8e):QB_gfx_m
ain.c: undefined reference to `SDL_SetColors'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_main.o)(.text+0x32a3):QB_gfx_m
ain.c: undefined reference to `SDL_MapRGB'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_main.o)(.text+0x3331):QB_gfx_m
ain.c: undefined reference to `SDL_UpdateRect'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_main.o)(.text+0x353e):QB_gfx_m
ain.c: undefined reference to `SDL_Quit'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_pal.o)(.text+0x41d):QB_gfx_pal
.c: undefined reference to `SDL_SetPalette'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_pal.o)(.text+0x550):QB_gfx_pal
.c: undefined reference to `SDL_SetPalette'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_pal.o)(.text+0x6bd):QB_gfx_pal
.c: undefined reference to `SDL_SetPalette'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_text.o)(.text+0x1a85):QB_gfx_t
ext.c: undefined reference to `SDL_UpperBlit'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_text.o)(.text+0x1ad0):QB_gfx_t
ext.c: undefined reference to `SDL_FillRect'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_text.o)(.text+0x1af2):QB_gfx_t
ext.c: undefined reference to `SDL_MapRGB'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_text.o)(.text+0x1b91):QB_gfx_t
ext.c: undefined reference to `SDL_CreateRGBSurfaceFrom'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_text.o)(.text+0x1c2d):QB_gfx_t
ext.c: undefined reference to `SDL_SetColors'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_text.o)(.text+0x1cf6):QB_gfx_t
ext.c: undefined reference to `SDL_UpperBlit'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_text.o)(.text+0x1fe4):QB_gfx_t
ext.c: undefined reference to `SDL_FreeSurface'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_text.o)(.text+0x2036):QB_gfx_t
ext.c: undefined reference to `SDL_SetClipRect'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_text.o)(.text+0x2078):QB_gfx_t
ext.c: undefined reference to `SDL_SetColorKey'
C:\BASIC\FREEB009\FREEBASIC\lib/libfbgfx.a(QB_gfx_text.o)(.text+0x20e0):QB_gfx_t
ext.c: undefined reference to `SDL_SetClipRect'

C:\Basic\freeb009\freeBASIC\examples\gfx>



What have I do wrong?


Title: Bug Reports
Post by: Z!re on January 02, 2005, 03:50:50 PM
inkey$ works correctly.

It is supposed to return chr255+chrScanCode for two byte keys, such as F1, F2 etc. chr0 is the null terminator for strings, so it couldnt be used.


Looks like you're either missing SDL.bi, or you havent included it.


Title: Bug Reports
Post by: VonGodric on January 02, 2005, 04:28:55 PM
to run qb'ish graphics use '$include: 'sdl\sdl.bi'


Title: Bug Reports
Post by: lkd85 on January 02, 2005, 06:06:01 PM
When compiling the mydll the compiler gives me the following:

Cannot export fb_MYDLL_entry: symbol not found
Cannot export fb_mydll_entry: symbol not found

The def file looks like this:

Code:

EXPORTS
    ADDNUMBERS@8 @1 DATA
    fb_MYDLL_entry DATA
    fb_mydll_entry DATA


Title: Bug Reports
Post by: v3cz0r on January 02, 2005, 08:26:00 PM
INKEY$ as shown at docs/keywords.txt will return CHR$(255) with extended keycodes, as CHR$(0) can't be part of strings with FB.

TinyPTC will run in fullscreen by default now, unless you pass the -d PTC_WIN command-line option.

Any app using qb gfx functions/statements needs a -l sdl option on command-line, i may change that later, but the gfx lib isn't working quite right for me atm - palette problems.



lkd85: i could not reproduce the error, it works just fine for me, what command-line options did you use?


Title: Bug Reports
Post by: lkd85 on January 03, 2005, 02:21:12 AM
I'm using fbc -i c:\freebasic\inc -dll mydll.bas and I tried fbc -dll mydll.bas


Title: Bug Reports
Post by: barok on January 03, 2005, 03:47:52 AM
I tried compiling using .09b, a program that uses sterling's graphical library.  I ended up with this error:

Code:

gfxmain.bi(87): error 4: Duplicated definition On Line: 87


This is what line 87 is on qbgfxmain.bi:

declare function screen stdcall alias "fb_GfxScreen" (ScreenNum as integer) as integer

Oddly, this does not happen with any other version of fb... yet my program will crash inexplicibly no matter what i do.  This is what i have so far in my program.

Code:

declare sub loadmap2 (filename$)

'$dynamic
' $include: "qbgfx4fb.bi"


screen 13

'----------------

'----------------**Tiles & sprites**-----------------------
redim shared npcsprite(1,1) as integer 'holds the npc sprites.
redim shared tiles(1) as integer 'holds the tiles.
redim shared objectsprites(1,1) as integer 'holds the object sprites.
redim shared npcfiles(1) as string 'holds the names of all the npc filenames.
DIM SHARED tileset(4) AS STRING 'holds the tile filenames: up to four tilesets.

'----------------**Map Layers**----------------------------
redim shared maplayer(1,1) as integer 'this holds the base layer.
redim shared mapoverlayer(1,1) as integer 'holds the roof/high wall layer.
redim shared mapobjectlayer(1,1) as integer 'holds map object layer.
redim shared mapcollayer(1,1) as integer 'this holds the map collision layer.
redim shared mapname as string 'holds the map filename.

'-----------------**Palette stuff**---------------------------
redim shared pal(1) as integer 'this holds the palette.
redim shared palname as string 'this holds the palette name.
dim shared palput as string 'this also holds the palette name... change later.

'------------------**Map Variables**---------------------------
redim shared mapx, mapy as single 'map height, width.
redim shared screen_height, screen_width as integer 'max screen height and width
TYPE maptype Field=1
wid AS INTEGER 'width of map
height AS INTEGER 'height of map
pwid AS INTEGER 'width of map in pixels
pheight AS INTEGER 'height of map in pixels
pal AS STRING * 1 'palette name of map
tileset AS STRING * 1 'tilesets names of map
script AS STRING * 1 'name of map script
mapname AS STRING * 1 'name of map itself.
END TYPE
DIM SHARED layerset(3) AS INTEGER
DIM SHARED numsets(4) AS INTEGER
dim shared map as maptype

loadmap2 "map3.map"

SUB loadmap2 (filename$)

FOR y = 1 TO 4
numsets(y) = 0
NEXT

REDIM tiletile(1) AS INTEGER
REDIM tiletileindex(1) AS INTEGER
REDIM tiletile2(1) AS INTEGER
REDIM tiletile3(1) AS INTEGER
REDIM tiletile2index(1) AS INTEGER
REDIM tiletile3index(1) AS INTEGER
REDIM tiletile4(1) AS INTEGER
REDIM tiletile4index(1) AS INTEGER


filenum = FREEFILE

OPEN filename$ FOR BINARY AS #filenum

GET #filenum, , map.wid
GET #filenum, , map.height

GET #filenum, , templength

palput = SPACE$(templength)
GET #filenum, , palput

GET #filenum, , activetilesets

FOR y = 1 TO activetilesets
GET #filenum, , til
GET #filenum, , templength
tileset(til) = SPACE$(templength)
GET #filenum, , tileset(til)
numsets(til) = 1
NEXT


REDIM maplayer(map.wid, map.height) AS INTEGER
REDIM mapoverlayer(map.wid, map.height) AS INTEGER
REDIM mapobjectlayer(map.wid, map.height) AS INTEGER
REDIM mapcollayer(map.wid, map.height) AS INTEGER

GET #filenum, , layerset(1)
GET #filenum, , layerset(2)
GET #filenum, , layerset(3)

FOR y = 0 TO map.height
FOR x = 0 TO map.wid
GET #filenum, , maplayer(x, y)

NEXT x, y

FOR y = 0 TO map.height
FOR x = 0 TO map.wid
GET #filenum, , mapoverlayer(x, y)
NEXT x, y

FOR y = 0 TO map.height
FOR x = 0 TO map.wid
GET #filenum, , mapcollayer(x, y)
NEXT x, y

FOR y = 0 TO map.height
FOR x = 0 TO map.wid
GET #filenum, , mapobjectlayer(x, y)

NEXT x, y

CLOSE #filenum




END SUB


There could most definately be something wrong with the code, considering i copied and pasted it the subroutine from another program, which could mean invalid variables.  However, i think i may of weeded them all out...


Title: Bug Reports
Post by: Sterling Christensen on January 03, 2005, 04:47:04 AM
Quote from: "barok"
I tried compiling using .09b, a program that uses sterling's graphical library.  I ended up with this error:

Code:

gfxmain.bi(87): error 4: Duplicated definition On Line: 87

0.09b has my library built in, so there's no need to '$include: "qbgfx4fb.bi" anymore.


Title: Bug Reports
Post by: barok on January 03, 2005, 01:06:03 PM
now it won't compile...  says it's an unknown error, and something about maybe a header or object isn't linked.  This is after i got rid of the qbgfx including.


Title: Bug Reports
Post by: DrV on January 03, 2005, 09:17:32 PM
you still need to link with SDL (-l sdl) as everyone has already said 20 times...


Title: Bug Reports
Post by: barok on January 03, 2005, 10:20:42 PM
okay, okay...  done...


now when i compile it i get an application error...

Quote

the instruction at "0x74fad613" referenced memory at "0x00000000".  The memory could not be "written".


Title: Bug Reports
Post by: retsyo on January 04, 2005, 11:14:05 AM
in fact, it is not a serious bug other than a serious feature request
Code:
print "a"
print "a"*5

can be compiled, but only "a" is printed
I hope fbc could treat "a"*5 as "aaaaa", which is common in PYTHON and other script languages, and is a nice code too.


Title: Bug Reports
Post by: adosorken on January 04, 2005, 11:26:50 AM
Ugh...that's messy as all hell. The last thing we want is for FB to look like slopscript like Python. :barf:


Title: Bug Reports
Post by: zydon on January 04, 2005, 11:34:25 AM
in basic, they usually do:

Code:

print STRING$(5,"a")  ' output > "aaaaa"


Title: thx
Post by: theuserbl on January 04, 2005, 12:12:10 PM
Thx for all the answers.


Quote from: "v3cz0r"
Any app using qb gfx functions/statements needs a -l sdl option on command-line, i may change that later, but the gfx lib isn't working quite right for me atm - palette problems.


I have tested it and you are right, now it works.
I am surprised how QBasic-compatible it is.

But there existing a little problem, that a PRINT creates two Carriage Return.



Quote from: "v3cz0r"
TinyPTC will run in fullscreen by default now, unless you pass the -d PTC_WIN command-line option.


I have tested it now. And you are right.
So, in 0.09 the ptc examples are the only examples, which don't run correct on my computer.
If I then use the option, you have mentiond, than it runs correct in Window-mode. But in fullscreen mode it don't show anything.

That surprised me, because all other fullscreen examples (ddraw-example, sdltest.bas, ...) running correct in fullscreen.
But ptc not. Whats the reason?


Title: Bug Reports
Post by: retsyo on January 04, 2005, 12:24:06 PM
Yes, qb is not python, but fb is not qb now since it has added many new features. I know that STRING$ is good, but I think "a"*5 is more intuitionistic and need less letters, why not have both of them in fbc for different user choices? I also think other methods in PYTHON/RUBY can be imported into fbc for convenient while keeping the old qb syntax-compatible.


Title: Bug Reports
Post by: theuserbl on January 04, 2005, 01:15:33 PM
Quote from: "retsyo"
Yes, qb is not python, but fb is not qb now since it has added many new features. I know that STRING$ is good, but I think "a"*5 is more intuitionistic and need less letters, why not have both of them in fbc for different user choices? I also think other methods in PYTHON/RUBY can be imported into fbc for convenient while keeping the old qb syntax-compatible.


I think the most reason is, that "a"*5 is not QBish.

And it is not intuitionistic, like you say.
It is intuitionistic for python-people.
But C developer for example see in

print 'a' *5

as result
485

Because they see 'a' as char. And char=int.
And the char 'a' is 97 as value.
And 97*5=485.

The most extensions in FB are additional functions and so.
But to write
print "a"*5
is not a new function. It is basically different from the normal QBasic way to handle numbers and strings.



And additional point is, that FB-people love QB.
And if you want to make bigger changes to the language, it is in any time a complete different language and no longer like QBasic.


So, I think that v1ctor and the other FB people never supports something like you want in FB.

But FB is OpenSource. If you want, you can implement it in a FB-fork yourself if you can.

But I think, that it will never integrated in the official FB.


Greatings
theuserbl


Title: Bug Reports
Post by: VonGodric on January 04, 2005, 02:44:08 PM
Don't know if that has been reported yet, but:

in qb'ish gfx mode, "sleep" doesn't wait till the key is pressed.

And also, sometimes FLIP is needed and sometimes is not, Would it be possible so that all the time, no matter what I do, flip would be needed to refresh screen? less confusing.

Also, in gfx mode, print is transparent -is it possible to have nontransparent? like 3rd optonal arg to color or smth?

Since it's based on sdl, how can I get pointer to surface used? So I could modify directly with sdl? Is bload and bsave supported? if no, the would it be possible to make them load BMP files instead? a Lot easier.

Well just thoughts


Title: Bug Reports
Post by: adosorken on January 04, 2005, 04:04:10 PM
I personally can't stand Python, and I'd hate to see FB corrupted in such a foul way. No offence intended to you retsyo, but...ugh...Python? :barf:


Title: Bug Reports
Post by: Sterling Christensen on January 04, 2005, 05:50:32 PM
Quote from: "VonGodric"
in qb'ish gfx mode, "sleep" doesn't wait till the key is pressed.

And also, sometimes FLIP is needed and sometimes is not, Would it be possible so that all the time, no matter what I do, flip would be needed to refresh screen? less confusing.

Also, in gfx mode, print is transparent -is it possible to have nontransparent? like 3rd optonal arg to color or smth?

Sleep will probably be easy to fix. I don't know why sometimes drawing shows before Flip.

I made it so that print was transparent only if you set a custom resolution, otherwise solid text (for screen12/13) but somebody changed that... it can still do solid text, I just don't know if there's a command to turn that on.

Quote from: "VonGodric"
Since it's based on sdl, how can I get pointer to surface used? So I could modify directly with sdl?

Code:
'$include: "sdl.bi"

screen 123, 456, 32, 0

dim surface as SDL_Surface ptr
surface = SDL_GetVideoSurface

Quote from: "VonGodric"
Is bload and bsave supported? if no, the would it be possible to make them load BMP files instead? a Lot easier.

Nope, but loading a bitmap is pretty simple - example (http://forum.qbasicnews.com/viewtopic.php?t=7700&highlight=sdlloadbmp).


Title: Bug Reports
Post by: Sterling Christensen on January 04, 2005, 05:52:21 PM
Bug?
Code:
type blah
   array(0 to 123) as integer
end type

dim myBlah as blah
dim p as blah ptr
dim i as integer

p = varptr(blah)

' error 14: Expected identifier
i = p->array(2)


Title: Bug Reports
Post by: VonGodric on January 04, 2005, 06:30:37 PM
Tnx Sterl, I want to be able to swtch on/off that text backgrund, and most logical way is: either pass 3rd optional arg to colo(0 transparent, -1 nontransparent or smth) or if bg color is <0 then transparent.


Title: Bug Reports
Post by: v3cz0r on January 04, 2005, 09:22:58 PM
[code]i = p->array(2)[\code]

Yeah, old known bug, listed on src/compiler/docs/TODO.txt, fixed - not on CVS yet.


I changed the bg on fonts to transparent by default, do you guys really prefer the other way? I remember that it was what i most hated in QB when making GUI's using only QB GFX routines, the fonts had that ugly black bg behind.


[code]print 'a' *5[/code]

That's actually another known bug i didn't fix before, invalid operations were simply been ignored w/o any report.. fixed.


I don't know what is wrong with TinyPTC in fullscreen on Windows 98, other ppl complained too, probably some DX setting not supported? Could be the hardware accel blitting, i guess.


Title: Bug Reports
Post by: zydon on January 04, 2005, 10:15:07 PM
AFAIK, in TinyPTC distribution readme.txt or in it's source code has mentioned about the fullscreen bugs.

BTW, I've never got ddraw example working in my computer (W95/DX7). It always re-arrange all desktop icons into top-left in a 320x240 space size.

I guess proper DDraw example is required which is in exclusive mode without messing up desktop screen.


Title: Bug Reports
Post by: DrV on January 04, 2005, 10:17:36 PM
hrm... I just tried the ddraw example and it hung... seems to be a problem with having my gfx card set to 'clone' to the analog TV output...  (Geforce4 mx440)


Title: Bug Reports
Post by: Z!re on January 05, 2005, 01:59:07 AM
Why does this work:
Code:
ParticleC(a) = SDL_MapRGB (buffer->format, 255, 0, 127)

But not this:
Code:
ParticleC(a) = SDL_MapRGB (buffer->format, 255, 255*rnd, 127)

Quote from: "FBC"
MOoRPG.bas(63) : error 1: Argument count mismatch, found: '127'

?


Title: Bug Reports
Post by: v3cz0r on January 05, 2005, 02:18:28 AM
RND crazyness, optional args.. parser was reading the "," as if it were part of the RND invocation.. fixed, will be on next release.

You can use RND() for now.


Title: Bug Reports
Post by: retsyo on January 05, 2005, 02:22:09 AM
in qb45
Code:
FOR i = 1 TO 2 STEP .5
       PRINT i
NEXT i

prints
Code:
1
 1.5
 2

but fbc is trapped in a infinite loop to print
Code:
1
 ...
 1

Do I always need to add
Code:
DIM i AS DOUBLE

if I want fbc to behave like qb?

BTW: any hints if I want to tailor fbc myself( for example, to add "hello"*2="hellohello")? I have not program a big, real qb projects till now  :oops:


Title: Bug Reports
Post by: Z!re on January 05, 2005, 02:42:47 AM
FBC's default type is 32 integer, thus, no decimal values, and 0.5 gets truncated to 0

So yes, you always have to add the dim, or DEFSNG A-Z to the top of your program, which is the default QB variable type.


And no, FBC will not and should not have "hello"*2 = "hellohello"
You can do:
t$ = "hello"
t$ = t$ + t$

Works just fine, this is BASIC, not Python.


But you could always get the FBC source yourself, and change it to your needs, adding string*numberical



EDIT:
Quote
RND crazyness, optional args.. parser was reading the "," as if it were part of the RND invocation.. fixed, will be on next release.

You can use RND() for now.

Does this mean that myfunc, without any passed variables would react it the same way?
Crappy example, untested:
Code:
aSub myfunc, 100, value

Would I have to do:
Code:
aSub myfunc(), 100, value

(I've never used functions that don't require an input so.. just curious )


Title: Bug Reports
Post by: Z!re on January 05, 2005, 03:18:09 AM
Just a suggestion, but it would be nice to be able to use both >=, => and <=, => it means the same.

And is it just me, or does:
Code:
If a => b and a <= c then

Look better than
Code:
If a >= b and a <= c then

First one is waaay sexier =)


Title: Bug Reports
Post by: steven_basic on January 05, 2005, 11:30:43 AM
Quote from: "Z!re"
Just a suggestion, but it would be nice to be able to use both >=, => and <=, => it means the same.

And is it just me, or does:
Code:
If a => b and a <= c then

Look better than
Code:
If a >= b and a <= c then

First one is waaay sexier =)


Don't know about others, but => looks a little confusing if coming from alternate compilers where pointers are used (well even freebasic has -> for pointer usage).

Anyway, the standard is "greater or equal" (>=) and "less or equal" (<=) which is symbolized the way it is said.


Title: Bug Reports
Post by: v3cz0r on January 05, 2005, 11:31:41 AM
LessOrEqual and GreatOrEqual, only QB to support the other way (btw, the IDE will convert => to >= automagically), => looks too much as ->, you can do a=>b and it will look messy.

No, only if myfunc has optional arguments at end and you didn't use () to invoke it -- the bug is fixed anyway.

Yeah, FB's default type is Integer, not Single as in QB, you have to do for i! = 1 to 2 step .5 to it work right or add a defsng a-z at top.

STRING$( ) wil only replicate(?) the first char of a string, there's no intrinsic function on QB to do string*value.


Title: Bug Reports
Post by: Jofers on January 05, 2005, 11:59:11 AM
"+" works as string concatenation.  It wouldn't make sense to have other operators.  I mean, what is "/" supposed to do?

Now, what would be fantastic are some runtime string tokenizing functions, or regex functions that could speed up fbc.exe 's work.


Title: Bug Reports
Post by: steven_basic on January 05, 2005, 05:45:42 PM
Quote from: "zydon"
BTW, I've never got ddraw example working in my computer (W95/DX7). It always re-arrange all desktop icons into top-left in a 320x240 space size.
I guess proper DDraw example is required which is in exclusive mode without messing up desktop screen.


I don't think its as much a "proper" example as it is the drivers for your video card.  I have had the exact same program react differently on two different PCs (one like stated and the other with no problem at all).
DirectX tries to give the programmer a standard API to use that works no matter what hardware exists.  Usually a problem like above is from a driver that is not quite up to curent standards.
I have had great success in finding the manufacturer's website and download the latest drivers for the installed video card to correct "odd" problems with DirectX intensive apps (mostly games :) )


Title: "UUID.LIB" warning?
Post by: steven_basic on January 05, 2005, 05:54:54 PM
The following warning is popping up, but not stopping anything from compiling and/or running...

>C:\STEVEN\freebasic\fbc.exe" -s gui "mandbrot.bas"
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
> Execution finished.


Title: Bug Reports
Post by: subxero on January 05, 2005, 07:30:01 PM
Forgive me if this has been asked/mentioned previously, but why can't CLOSE accept multiple arguments, like QB's version could? (e.g., CLOSE #F, #F2, #F3 instead of three separate CLOSEs.)

Also, it'd be really cool if you could implement a pre-scan of the source, so that I don't have to mess with writing tons of DECLARE statements every time I want to test the program. I'm writing a tool to help with that, but it'd be a cool inclusion.


Title: Re: "UUID.LIB" warning?
Post by: Z!re on January 05, 2005, 08:47:35 PM
Quote from: "steven_basic"
The following warning is popping up, but not stopping anything from compiling and/or running...

>C:\STEVEN\freebasic\fbc.exe" -s gui "mandbrot.bas"
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
> Execution finished.
It's a TinyTPC thing.. just ignore it, works anyways...


Title: Bug Reports
Post by: v3cz0r on January 05, 2005, 08:48:52 PM
Warnings appear coz i built TinyPTC using VC++ and it adds garbage to the lib generated, what GNU linkers can't parse, just annoying, makes no difference.

Okay, didn't know CLOSE could have multiple arguments, fixed.

About adding DECLAREs, nor BC (QB's cmm-line compiler) does that for you, forward references can only be resolved by n-passes compilers, what FB (and BC) aren't, sorry. BASIC has loads of ambiguities, there's no way to know for example in "bar = foo( a, b, c )" if "foo" is an array or a function.


Title: possible command$ bug
Post by: Antoni Gual on January 05, 2005, 09:23:21 PM
V1ctor:
In my pc  if a fb exe is run from a directoy having a space in it , command$ returns a part of the the exe path (from the first space on)
Code:

'NAME: commandtest.exe
print ">";command$;"<"
a$=input$(1)


if run from c:\freebasic  it prints correctly a null string  

if run from c:\program files it prints
Code:

files\commandtest.exe"

with the trailing quote mark but not the leading one

W2000  and  FB v0.09 installed.

(I was trying to steal the parseCmd routine in the FB source when i found it...  :D )


Title: Bug Reports
Post by: v3cz0r on January 05, 2005, 11:07:07 PM
True, fixed, thanks -- at least XP/2k seems to quote the path when it contains spaces, i'm guessing 9x does the same..


Title: Bug Reports
Post by: Antoni Gual on January 05, 2005, 11:37:52 PM
Can't check it. My W98  notebook doesn't want to start.  **Going for the big hammer**...


Title: Bug Reports
Post by: adosorken on January 05, 2005, 11:51:46 PM
9x doesn't quote paths. It really makes for messy implementations. :(


Title: Bug Reports
Post by: undertow on January 06, 2005, 01:14:30 PM
Some of the new data type don't mix well and can cause a program to crash, for example in the following code

Code:

declare function addone(a)

type mytypeT
   a  as byte
end type

dim mytype(1 to 100) as mytypeT

for i = 1 to 10
   m =  addone(mytype(i).a)
next i

sleep 1000

function addone(a)
addone = a+1
end function


The program crashes when the call is made to the function addone.
This only occurs with arrays. If mytype was just a normal variable, it does not crash. (ie dim mytype as mytypeT)


Title: Bug Reports
Post by: adosorken on January 06, 2005, 01:26:50 PM
You could try adding "Field = 1" to the Type definition.


Title: Bug Reports
Post by: v3cz0r on January 06, 2005, 02:17:40 PM
Yeah, arguments were not checked if they were passed by reference, FB was converting anything to temp vars, new version won't allow that, (a) is a byref integer arg, while you are passing a byte var, new version will report:

test.bas(10) : error 59: Type mismatch, at parameter: 1

So or you redeclare it as (byval a as integer) or (a as byte).

New version does loads of parameter checkings that weren't done before, i was checking stuff at the Intermediate Representation module, what is a bad place to do that.. all checks done at the AST now.

New release will be done soon..


Title: Bug Reports
Post by: 1000101 on January 06, 2005, 07:12:40 PM
Two problems:

1)  I keep getting the error
Code:
E:\freeBASIC\bin\ld.exe: cannot find -lzlib1.dll


I stuck this file (zlib1.dll) in c:/winnt/system32, in /freebasic/bin/, in the /freebasic/, in the friggen source dir and it still happens.

2)  More fake problems.  It seems the fb doesn't like declaring arrays using variables containing the upper (and/or lower?) bounds.

This line fails:
Code:
redim orgbuffer(0 to orglen) as byte

With the following error:
Code:
examples\zlibtest.o(.text+0xcc):fake: undefined reference to `ORGBUFFER'


This happens whether orgbuffer is predeclared (dim orgbuffer() as byte) or not.


Title: Bug Reports
Post by: v3cz0r on January 06, 2005, 07:39:23 PM
1) it can't be a dll, must be an import library (.lib), and you pass just the "zlib1" name, w/o the "lib" at beginning and any extension (GNU linker stuff). Creating an import library by hand isn't simple, you have to create the .def file using pexports.exe (not included, part of Mingw32) and the dlltool.exe -- if the lib has a .lib import, rename it to .a.dll and copy to fb's lib dir

2) i guess you are calling the proc as "proc orgbuffer", w/o indexes, new version won't allow that.. with .09 you can do for example orgbuffer = orgbuffer + 1, what will fail if orgbuffer is a dynamic array (will fail with that fake message)


Title: Bug Reports
Post by: 1000101 on January 06, 2005, 07:55:30 PM
1)  It comes with the .def and .exp files, where do I stick'em?  /freebasic/libs/ ?

2)  hrm, that is a bit of a pain.  Is there no way to load an entire buffer at one intrisinctly, like VB?  Or am I going to have to use a cruddy for-next loop like qb?

My code currently looks like this:
Code:
  get #1, , orgbuffer

I'd hate do to this:
Code:
for i = 0 to orglen
get #1, , orgbuffer(i)
next i


Title: Bug Reports
Post by: 1000101 on January 06, 2005, 10:00:13 PM
1)  Ok, I've gotten the import library created, now instead of not finding the import library, I get another, different set of errors:
Code:
examples\zlibtest.o(.text+0x111):fake: undefined reference to `compress@16'
examples\zlibtest.o(.text+0x22e):fake: undefined reference to `uncompress@16'


1)  I guess I'll have to use an API work around *frown*


Title: Bug Reports
Post by: adosorken on January 06, 2005, 11:46:45 PM
That's easily fixed by using CDECL to declare the functions. :D
Code:
Declare Function ThisIsMyFunction CDECL Alias "ThisIsMyFunction" Lib "thisIsMyLib.dll" () As Bungholio


Title: Bug Reports
Post by: Dr_Davenstein on January 07, 2005, 05:32:42 AM
Quote from: "v3cz0r"
Yeah, arguments were not checked if they were passed by reference, FB was converting anything to temp vars, new version won't allow that, (a) is a byref integer arg, while you are passing a byte var, new version will report:

test.bas(10) : error 59: Type mismatch, at parameter: 1

So or you redeclare it as (byval a as integer) or (a as byte).

New version does loads of parameter checkings that weren't done before, i was checking stuff at the Intermediate Representation module, what is a bad place to do that.. all checks done at the AST now.

New release will be done soon..


I'm kinda confused... Will we be bale to pass args like this?


Code:
DEFINT A-Z
declare Sub addone(NewA() as Integer)

type mytypeT
   a(0 to 3) as Integer
end type

dim mytype(1 to 100) as mytypeT

for i = 1 to 5
   addone mytype(i).a()
next i


For i = 1 to 5
   For id=0 to 3
      Print MyType(i).a(id)
   Next
Next


sleep

SUB addone(NewA() as Integer)  
   For id = 0 to 3
      NewA(id)= 1 + Int(rnd*10)
   next
end SUB


Title: Bug Reports
Post by: 1000101 on January 07, 2005, 02:22:36 PM
Quote from: "adosorken"
That's easily fixed by using CDECL to declare the functions. :D
Code:
Declare Function ThisIsMyFunction CDECL Alias "ThisIsMyFunction" Lib "thisIsMyLib.dll" () As Bungholio


hrm, tried that, still failed with the same error. :\


Title: Bug Reports
Post by: v3cz0r on January 08, 2005, 01:44:51 AM
zlib seems to use STDCALL on Windows, but the symbols on the DLL end up with CDECL names (no @), i dunno.

New version got the put/get #f, , array(), will store/load the full array, as in VB -- you can't use just "array" tho.


Dr_Davenstein: you can't pass array fields by descriptor currently, it's on TODO list.. since the 1st release, heh.. that needs temp descriptors.. argh


Title: Bug Reports
Post by: retsyo on January 08, 2005, 04:33:24 AM
2 bugs:
1.fbc compiles
Code:

IF 1 = 1 THEN PRINT 1 ELSE PRINT 2

but exits on
Code:

IF 1 = 1 THEN END ELSE PRINT 2

with "error 3: Expected End-of-Line, found: 'END'". The later is accepted by qb.

2.fbc thinks "def seg" is wrong, but qb says
Quote

DEF SEG [=address]
  If all arguments are omitted, the BASIC data segment is used.

which is the "BASIC data segment" in fbc if I have to apply it? But I think it would be good to let fbc behave like qb

BTW: http://www.fomalhautsoft.narod.ru/download/power.zip is a good puzzle game in qb, but it will not be compiled in fbc due to bug 2


Title: Bug Reports
Post by: Z!re on January 08, 2005, 04:43:28 AM
FB has no segments, just remove the line and use varptr.

Also, you can't peek/poke directly to the videosegment, or use any other DOS specific hack.



EDIT: Haha, noone can beat The Z!re!, In your face Dr. D, in your face! :D


Title: Bug Reports
Post by: Dr_Davenstein on January 08, 2005, 04:44:59 AM
The second one isn't really a bug...

Code:
*****************************************************************************
* Unsupported (won't be implemented unless someone else does that...)       *
*****************************************************************************
  DEF SEG Statement     (reason: segments are not needed in 32-bit flat mode)


ARGHHH!!! Beaten by The Z!re!!!


Title: Bug Reports
Post by: adosorken on January 08, 2005, 09:21:50 AM
I wonder when people are going to start reading the documentation before asking redundant questions that are already answered in it... :D


Title: Bug Reports
Post by: na_th_an on January 08, 2005, 12:25:38 PM
Never. That's why the RTFM expression is so popular.


Title: Bug Reports
Post by: retsyo on January 09, 2005, 12:36:07 AM
Which manual do you refer to?  I never find a useful manual within the latest fbc release, not to say an up-to-date manual. Do you all surf the internet for document while programming? I suggest to put documents on http://fbc.sourceforge.net/about.php into the zippd file- even if they are lack of update.


Another topic. Here is a code segment
Code:
a$ = "hello" + CHR$(0) + "world"
PRINT "a$="; a$, "len(a$)="; LEN(a$)

b$ = LEFT$(a$, 5) + RIGHT$(a$, 5)
PRINT "b$="; b$, "len(b$)="; LEN(b$)

PRINT LEN("hello")

TYPE u
        q AS INTEGER
        w AS STRING * 5
END TYPE
DIM r AS u
PRINT "len of type u="; LEN(u)
PRINT "len of r="; LEN(r)

qb gives
Quote
a$=hello world              len(a$)= 11
b$=helloworld len(b$)= 10
 5
len of type u= 4            <- why is it 4 other than 7?
len of r= 7

so guess what does fbc say?

I find
Quote
FB: Real length is the given len plus one (null-char), even on TYPE fields
      Strings are filled with nulls (char 0), so strings can't contain chr$(0) chars

on http://fbc.sourceforge.net/about.php?section=diffs. so is the answer
Quote

a$=hello      len(a$)= 6    <- given len+1=6, well perhaps your answer is 5
b$=hellohello len(b$)= 10
 5
len of type u= ??           <- I can not think it out.
len of r= 10


?
No! The real answer is
Quote
a$=hello         len(a$)= 11
b$=helloworld    len(b$)= 10
 5
len of type u= 12
len of r= 10                <- 4+5+len of padding 0?

the "hello" on 1st line meets "strings can't contain chr$(0) chars", but len(a$) and the 2nd line say that it is wrong.

First, is there anyone can explain what does LEN(UDT) mean in QB and fbc, and why is LEN(UDT) not equal to LEN(UDT var), (in C, sizeof(UDT)==sizeof(UDT var), right?) ?

No, please do not misunderstand me and do not fix the LEN function. I do not like the way that C treates string( chr$(0) is only used to end a string), so can you let fbc be more Qb-ish by fixing PRINT, and fix LEN on UDT and UDT-var for the Qb-ish reason and consistant reason( len(integer)=4 in fbc)?

thank you.


Title: Bug Reports
Post by: v3cz0r on January 09, 2005, 01:17:00 AM
You can't do len(UDT) in QB, you are actually doing len(single) there, "u" is being magically declared by QB as a Single var (the default type).

FB returning different values is actually a bug, i added a proc to calculate the real-len of UDT (w/o padding) to speed up SWAP and user type assignament s(so the padding is not swapped/copied), and LEN() was calling the same code.. fixed.

Yeah i lied, you actually can have chr$(0) on var-len strings, they are never scanned for the null-char as fixed-len are. But calling any API function passing that string will mostly fail, as PRINT does -- i can't do anything, you got byte arrays in FB, i dunno why someone would put a null-char inside a string -- if FB strings were not null-terminated, EVERY function call with string arguments to ANY lib would need this: "stringparam + chr$( 0 )", what wouldn't be quite fun to do all the time -- hey, they are living with that "restriction" in C for decades, nobody complained..

And yeah, FB integers are 4 bytes long, you know, it's a 32-bit compiler, it makes sense -- and yet, you can do defshort a-z or declare all vars as "v as short" if you really need 16-bit integers.


Title: Bug Reports
Post by: 1000101 on January 09, 2005, 01:21:16 AM
Quote from: "v3cz0r"
zlib seems to use STDCALL on Windows, but the symbols on the DLL end up with CDECL names (no @), i dunno.

New version got the put/get #f, , array(), will store/load the full array, as in VB -- you can't use just "array" tho.


I found thesolution to the zLib problem.  It turns out the answer was in FreeImage.  You need sed.exe to extract the info for pextract.exe to work.

Also, if you want them, I have zLib and FreeImage working examples.

This is a bit of a request, but it would be handy to be able to have constants have pre-computed function results for come functions.  ie:
Code:
Const myCRLF = Chr$(13) + Chr(10)


Title: Bug Reports
Post by: v3cz0r on January 09, 2005, 02:16:31 AM
Just added literal strings with escape chars, as Antoni suggested, you will be able to do:

Code:
const crlf = "~n"


On next release.. and ~t, ~13 ~0 (don't do this! ;) etc.. parsing is enabled by OPTION ESCAPE.


Title: Bug Reports
Post by: Z!re on January 09, 2005, 02:59:21 AM
Quote
error 59: Type mismatch, at parameter: 2


The sub expects an integer, I passed:
a_constant*a_float

Same result if i do:
a_constant*RND

QB would auto-convert, you could pass floats to subs where they expected integers, integers to floats aso...


Title: Bug Reports
Post by: relsoft on January 09, 2005, 03:03:06 AM
Wouldn't that slow things down?

You could cast it like so:

mufunk(int(floatvalue))

oh, wait! CINT would be faster. :*)


Title: Bug Reports
Post by: Z!re on January 09, 2005, 03:06:41 AM
Putting INT() or CINT() around it doesen work, i still get the same error.

If i do:
tempvar = a_constant*RND '(or float)
mysub tempvar

It works...


Title: Bug Reports
Post by: adosorken on January 09, 2005, 03:49:23 AM
Looks like type abstraction is b0rk3n dude...PTCXL is suddenly generating "Type mismatch" errors when passing Ubytes to a function which expects Integers. This never happened in previous versions of fbc, and the PTCXL code that causes the new errors has been untouched since its release back on December 7th. :D Granted I've rewritten the two portions of code that cause the problem, but uhh...isn't FBC supposed to recast these? :???:


Title: Bug Reports
Post by: Z!re on January 09, 2005, 03:55:52 AM
Ya, my code worked in v0.09b, no changes whatsoever.


Title: Bug Reports
Post by: undertow on January 09, 2005, 11:01:47 AM
There seems to be something wrong when you pass a string from a type into a sub/function.
The following code works in QBasic but not in FB.
Code:
declare sub F(c$, u%)
type LT
   u  as integer
   p  as string * 10
end type


dim shared L(1 to 2) as LT
L(1).p = "Hello": L(1).u = 1
L(2).p = "Hi": L(2).u = 2

print L(1).p, L(1).u
print L(2).p, L(2).u
print
F(L(1).p,L(1).u)
F(L(2).p,L(2).u)
print
print L(1).p, L(1).u
print L(2).p, L(2).u

sleep

sub F(c$, u%)
print c$,u%
end sub

The output is

Code:
Hello          1
Hi             2

Hello          1
Hello          2

Hello          1
Hello          2

whereas it should be

Code:
Hello          1
Hi             2

Hello          1
Hi             2

Hello          1
Hi             2


This bug caused me many headaches.


Title: Bug Reports
Post by: v3cz0r on January 09, 2005, 12:03:05 PM
FB won't allow different types passed by reference anymore (unless they are constants), so if you have:

Code:
declare sub foo( a as single )
declare sub bar( a as integer )


You have to do:

Code:
foo csng(a%*rnd)

bar cint(a!)


Or much faster, declare all args as byval using: option byval, done..


About the string, yeah, it's on the readme.txt, it's a known bug, may be fixed later, sorry.[/quote]


Title: Bug Reports
Post by: zydon on January 09, 2005, 12:04:01 PM
Quote from: "v3cz0r"
Just added literal strings with escape chars, as Antoni suggested, you will be able to do:

Code:
const crlf = "~n"


On next release.. and ~t, ~13 ~0 (don't do this! ;) etc.. parsing is enabled by OPTION ESCAPE.


I hope you will not use ~ as an ESC characters re-presentations in FB. I rather willing to accept \n, \t \x00 as usually written in C/C++ in their printf and using #ESCAPECHARS ON/OFF as a token.

Code:

#ESCAPECHARS ON
PRINT "This is first line \nThis is second line"
#ESCAPECHARS OFF

'PRINT-OUT:
'-----------------------
'This is first line
'This is second line
'-----------------------


If you want simpler, you could use ESCAPE ON/OFF token. Using ~ will make things even more confusing for basic users.


Title: Bug Reports
Post by: Sterling Christensen on January 09, 2005, 12:08:53 PM
Quote from: "v3cz0r"
FB won't allow different types passed by reference anymore (unless they are constants)

Ack! Is that the way it's going to be from now on?


Title: Bug Reports
Post by: v3cz0r on January 09, 2005, 12:16:29 PM
Do you prefer:

Code:
declare sub foo( a as short )

foo a%

if( a% = 1 ) then end


a% won't be ever changed that way.

Code:
declare sub bar( a as integer )

bar a!


I get a "^ Parameter type mismatch" with QB4.5, now a!*rnd is accepted.. call that a fucked language, it is.


Title: Bug Reports
Post by: subxero on January 09, 2005, 12:25:18 PM
The error reporting in FB is going to hell :-P
Well, probably not, but I think there's not much to gain from upgrading to .10. Version .09 compiled everything I had very well, and .10's FBC.exe keeps returning "128" without telling me anything else. So I tracked it down to being an undeclared variable (I'm using OPTION EXPLICIT) - I wish FBC would've told me that. Took a good 15 minutes to notice. :-P
Also, when I forgot to add a DECLARE for a SUB, FBC returned "128" as well without telling me anything more. And the line numbers, when reported, are insanely wrong (line 5323? I've only got 300-some lines.)
You should fix the simple casts too (e.g., passing a SINGLE/DOUBLE to an INTEGER parameter would auto-cast, and vice-versa. We are striving for compatibility, aren't we?)

Please don't turn FB into C. I hate C. C raped my best friend. :lol:

Anyways, not to bitch. FB rules, but it seems .10 breaks more things than it fixes. Sorry for the bad news.


Title: Bug Reports
Post by: v3cz0r on January 09, 2005, 12:32:29 PM
It would help me a lot if you cold show me the code that generated that error, as i never saw it happening, thanks -- if i can't reproduce the error, hey, i'm not magic.

As QB does that crap, arg as byref type and expression as anything else but strings/udts are accepted again..


Title: Bug Reports
Post by: Sterling Christensen on January 09, 2005, 12:48:14 PM
Quote from: "v3cz0r"
I get a "^ Parameter type mismatch" with QB4.5, now a!*rnd is accepted.. call that a @£$£ language, it is.

OIC... it's cool then.


Title: Bug Reports
Post by: v3cz0r on January 09, 2005, 01:19:19 PM
Having to do "\\" is confusing to basic users -- even C coders forget about that, i do -- ~ is seldom used, ^  is valid in USING.. escape will be ~, if you turned it on then you know what you are doing, right?

OPTION ESCAPE is already bad, if you forget it your app will fail, OPTION ESCAPE ON|OFF is even worse, as any OPTION and DEF### is, they make the language context-dependent, where bugs appear for no "apparent" reason, but it's QB-like.. nothing else to do.


Title: Bug Reports
Post by: zydon on January 09, 2005, 01:39:53 PM
In that case, just drop the idea of having $OPTION ESCAPE and add CR, LF, CRLF, TAB and QUOTE keywords would be more peaceful to coder minds.

Example1:
Code:

PRINT "Value a:";TAB;a;CRLF;"Value b:";TAB;b

'-- or --

PRINT "Value a:"+TAB+str$(a)+CRLF+"Value b:"+TAB+str$(b)

'PRINT-OUT:
'--------------------------------------
Value a:        1234
Value b:        5678
'--------------------------------------



Example2:
Code:

PRINT QUOTE+"This word"+QUOTE

'PRINT-OUT:
'--------------------------------------
"This word"
'--------------------------------------


Then, it would be readable source code for that purposes.

Btw, here is the most needed constants for the above needs:
Code:

#DEFINE CR      &H0D
#DEFINE LF      &H0A
#DEFINE CRLF    &H0A0D
#DEFINE QUOTE   &H22
#DEFINE TAB     &H09
#DEFINE ESC     &H1B
#DEFINE BELL    &H07


Title: Bug Reports
Post by: v3cz0r on January 09, 2005, 01:58:25 PM
TAB is already a keyword, CRLF is used a lot as var names, would break old sources, as any simple named pre-defined constant will. They would have to be called like "fbNEWLINE", what looks not that great - ppl forget the "fb" or type "fp" and BASIC with its auto-vars will accept that as valid.

So what makes \n more readable than ~n, while people want the pre-processor directives inside the comments '$? Forget the readability..


Title: Bug Reports
Post by: na_th_an on January 09, 2005, 03:19:32 PM
~n is fine to me. I don't really care. I can't see why a simple symbol is such an issue for those people :P


Title: Bug Reports
Post by: relsoft on January 10, 2005, 03:35:57 AM
How about this declaration?

declare sub funky(byval type as integer ptr, byval data as single ptr)

The bold words are reserved words but some C headers used those as param names. Would that delare work?


Title: Bug Reports
Post by: zydon on January 10, 2005, 04:27:57 AM
Quote from: "v3cz0r"
So what makes \n more readable than ~n, while people want the pre-processor directives inside the comments '$? Forget the readability..


in FAT based OS (Win9x), ~ is part of the real 8.3 long file name. When we use directx 3D file converted using some tools, some long file name or long directory name will be substituted to 8.3 dos name. this would mess up some file or text based file processing.

using "\" doesn't make FB become C/C++ for someone might worried about that. Basic compiler like Rapid-Q use that eficiently. below is the table used in Rapid-Q:

Code:

Escape  Sequence Details
------------------------------------------
\a      Alarm bell
\b      Backspace
\f      Form feed
\n      New line
\r      Carriage return
\t      Horizontal Tab
\v      Vertical Tab
\\      Backslash
\"      Double quote
\###    ### is any number 0..255
\xHH    HH is a hexidecimal value 00..FF


This also helps if some C/C++ header that containing GUID string which is not require change at all. You'll found them in OLE/COM header.

if "\" will conflict with path separator in text string, it will be easily subsituted with "\\". But if "~" conflict with short file name "ABCDEF~1.EXT" in a text content, how do you deal with that?

"\" usage I think not bound byt C/C++ compiler. I've seen them in other language including Web scripting, if I'm not mistaken. It seem like widely used standard escape sequence.

using ON/OFF block is giving you better handling for the source code conversion. so within the block, conversion can be made replacing those escape sequence to hex or whatever character symbol you set within the string. similar like BEGIN ASM...END ASM block. Only particular area will effected by the usage.


Title: Bug Reports
Post by: subxero on January 10, 2005, 09:27:06 AM
Quote from: "relsoft"
How about this declaration?

declare sub funky(byval type as integer ptr, byval data as single ptr)

The bold words are reserved words but some C headers used those as param names. Would that delare work?


That declare should work just fine. FB/C doesn't utilize the parameter names, but it does utilize the size of the parameters to determine where passed values are placed in memory/on the stack. At least I think.

e.g., in C:
Code:

// Prototype (C equivalent of declare):
// Notice arg names are omitted.
int myfunction(int, float, char *, long);

int myfunction(int a, float b, char * thingy, long x) {
  // Code goes here
}


I think FB works the same way.


Title: Bug Reports
Post by: Jofers on January 10, 2005, 11:16:37 AM
\n, \this, \that is sort of a cross-language standard.  I mean, It's not just C, but most every language out there, including regular expression.

I wouldn't make up a character like "~" for a metacharacter just to be different.


Title: Bug Reports
Post by: v3cz0r on January 10, 2005, 12:23:09 PM
Version .10 accepts reserved words on function prototypes, old versions didn't -- all versions accept reserved words like "len" as types fields, for example (QB won't).


So will the escape char be "\" or "~"? You guys decide.. i thought people would have some trouble with "\" 'cause the paths.. "~" doesn't work well with IDE's, MED couldn't handle it -- and yeah, i tried to reconfigure it.[/code]


Title: Bug Reports
Post by: Sterling Christensen on January 10, 2005, 02:25:43 PM
Quote from: "v3cz0r"
So will the escape char be "\" or "~"? You guys decide.. i thought people would have some trouble with "\" 'cause the paths.. "~" doesn't work well with IDE's, MED couldn't handle it -- and yeah, i tried to reconfigure it.

I vote for "\".

If there were no OPTION ESCAPE, I would have voted for "~" instead.


Title: Bug Reports
Post by: 1000101 on January 10, 2005, 02:33:43 PM
It doesn't matter really, other then paths problem, but \\ would take care of any problems with paths.  Typically I use / in paths anyway.


Title: Bug Reports
Post by: Jofers on January 10, 2005, 09:35:32 PM
I vote "\" as well.

Perhaps you could make some sort of a literal string for doing paths.  Like using apostrophes for quotes in perl or a LITERAL keyword (x$ = LITERAL "hi").  Or something like that.


Title: Bug Reports
Post by: ShadowWolf on January 10, 2005, 11:16:50 PM
'New little bug....
'Len seems broken now with type's with array's

Option Explicit

'
' ---------------------------------------------------------------------------------
' File...........: mWinsock2.bas
' Author.........: Will Barden
' Created........: 02/05/03
' Modified.......: 09/05/03
' Version........: 1.0
' Website........: http://www.WinsockVB.com
' Contact........: admin@winsockvb.com
'
' Port of necessary Winsock2 declares, consts, types etc.. Will handle straight
' blocking I/O, WSAAsyncSelect and WSAEventSelect under both TCP/IP and UDP/IP.
' Will also handle sending ICMP echos (a ping) to check if a host is alive. Has
' some helper functions at the bottom, prefixed with "vb".
' ------------------------------------------------------------------------------
'
' ------------------------------------------------------------------------------
' Constants.
' ------------------------------------------------------------------------------
'
' Winsock version constants
Const WINSOCK_V1_1  As INTEGER = &H101
Const WINSOCK_V2_2  As INTEGER = &H202
' Length of fields within the WSADATA structure.
Const WSADESCRIPTION_LEN  As INTEGER = 256
Const WSASYS_STATUS_LEN   As INTEGER = 128
' For socket handle errors, and bas returns from APIs.
Const ERROR_SUCCESS    As INTEGER = 0
Const SOCKET_ERROR     As INTEGER = -1
Const INVALID_SOCKET   As INTEGER = SOCKET_ERROR
' Internet addresses.
Const INADDR_ANY          As INTEGER = &H0
Const INADDR_LOOPBACK     As INTEGER = &H7F000001
Const INADDR_BROADCAST    As INTEGER = &HFFFFFFFF
Const INADDR_NONE         As INTEGER = &HFFFFFFFF
' Maximum backlog when calling listen().
Const SOMAXCONN  As INTEGER = 5
' Messages send with WSAAsyncSelect().
Const FD_READ       As INTEGER = &H1
Const FD_WRITE      As INTEGER = &H2
Const FD_OOB        As INTEGER = &H4
Const FD_ACCEPT     As INTEGER = &H8
Const FD_CONNECT    As INTEGER = &H10
Const FD_CLOSE      As INTEGER = &H20
' Used with shutdown().
Const SD_RECEIVE    As INTEGER = &H0
Const SD_SEND       As INTEGER = &H1
Const SD_BOTH       As INTEGER = &H2

' Winsock error constants.
Const WSABASEERR          As INTEGER = 10000
Const WSAEINTR            As INTEGER = WSABASEERR + 4
Const WSAEBADF            As INTEGER = WSABASEERR + 9
Const WSAEACCES           As INTEGER = WSABASEERR + 13
Const WSAEFAULT           As INTEGER = WSABASEERR + 14
Const WSAEINVAL           As INTEGER = WSABASEERR + 22
Const WSAEMFILE           As INTEGER = WSABASEERR + 24
Const WSAEWOULDBLOCK      As INTEGER = WSABASEERR + 35
Const WSAEINPROGRESS      As INTEGER = WSABASEERR + 36
Const WSAEALREADY         As INTEGER = WSABASEERR + 37
Const WSAENOTSOCK         As INTEGER = WSABASEERR + 38
Const WSAEDESTADDRREQ     As INTEGER = WSABASEERR + 39
Const WSAEMSGSIZE         As INTEGER = WSABASEERR + 40
Const WSAEPROTOTYPE       As INTEGER = WSABASEERR + 41
Const WSAENOPROTOOPT      As INTEGER = WSABASEERR + 42
Const WSAEPROTONOSUPPORT  As INTEGER = WSABASEERR + 43
Const WSAESOCKTNOSUPPORT  As INTEGER = WSABASEERR + 44
Const WSAEOPNOTSUPP       As INTEGER = WSABASEERR + 45
Const WSAEPFNOSUPPORT     As INTEGER = WSABASEERR + 46
Const WSAEAFNOSUPPORT     As INTEGER = WSABASEERR + 47
Const WSAEADDRINUSE       As INTEGER = WSABASEERR + 48
Const WSAEADDRNOTAVAIL    As INTEGER = WSABASEERR + 49
Const WSAENETDOWN         As INTEGER = WSABASEERR + 50
Const WSAENETUNREACH      As INTEGER = WSABASEERR + 51
Const WSAENETRESET        As INTEGER = WSABASEERR + 52
Const WSAECONNABORTED     As INTEGER = WSABASEERR + 53
Const WSAECONNRESET       As INTEGER = WSABASEERR + 54
Const WSAENOBUFS          As INTEGER = WSABASEERR + 55
Const WSAEISCONN          As INTEGER = WSABASEERR + 56
Const WSAENOTCONN         As INTEGER = WSABASEERR + 57
Const WSAESHUTDOWN        As INTEGER = WSABASEERR + 58
Const WSAETOOMANYREFS     As INTEGER = WSABASEERR + 59
Const WSAETIMEDOUT        As INTEGER = WSABASEERR + 60
Const WSAECONNREFUSED     As INTEGER = WSABASEERR + 61
Const WSAELOOP            As INTEGER = WSABASEERR + 62
Const WSAENAMETOOLONG     As INTEGER = WSABASEERR + 63
Const WSAEHOSTDOWN        As INTEGER = WSABASEERR + 64
Const WSAEHOSTUNREACH     As INTEGER = WSABASEERR + 65
Const WSAENOTEMPTY        As INTEGER = WSABASEERR + 66
Const WSAEPROCLIM         As INTEGER = WSABASEERR + 67
Const WSAEUSERS           As INTEGER = WSABASEERR + 68
Const WSAEDQUOT           As INTEGER = WSABASEERR + 69
Const WSAESTALE           As INTEGER = WSABASEERR + 70
Const WSAEREMOTE          As INTEGER = WSABASEERR + 71
Const WSASYSNOTREADY      As INTEGER = WSABASEERR + 91
Const WSAVERNOTSUPPORTED  As INTEGER = WSABASEERR + 92
Const WSANOTINITIALISED   As INTEGER = WSABASEERR + 93
Const WSAHOST_NOT_FOUND   As INTEGER = WSABASEERR + 1001

'/* WinSock2 specific error codes */
CONST WSAENOMORE as INTEGER = WSABASEERR + 102
CONST WSAECANCELLED AS INTEGER = WSABASEERR + 103
CONST WSAEINVALIDPROCTABLE AS INTEGER = WSABASEERR + 104
CONST WSAEINVALIDPROVIDER AS INTEGER = WSABASEERR + 105
CONST WSAEPROVIDERFAILEDINIT AS INTEGER = WSABASEERR + 106
CONST WSASYSCALLFAILURE   AS INTEGER = WSABASEERR + 107
CONST WSASERVICE_NOT_FOUND AS INTEGER = WSABASEERR + 108
CONST WSATYPE_NOT_FOUND   AS INTEGER = WSABASEERR + 109
CONST WSA_E_NO_MORE   AS INTEGER = WSABASEERR + 110
CONST WSA_E_CANCELLED AS INTEGER = WSABASEERR + 111
CONST WSAEREFUSED AS INTEGER = WSABASEERR + 112

'/* WS QualityofService errors */
CONST WSA_QOS_RECEIVERS AS INTEGER = WSABASEERR + 1005
CONST WSA_QOS_SENDERS AS INTEGER = WSABASEERR + 1006
CONST WSA_QOS_NO_SENDERS AS INTEGER = WSABASEERR + 1007
CONST WSA_QOS_NO_RECEIVERS AS INTEGER = WSABASEERR + 1008
CONST WSA_QOS_REQUEST_CONFIRMED AS INTEGER = WSABASEERR + 1009
CONST WSA_QOS_ADMISSION_FAILURE AS INTEGER = WSABASEERR + 1010
CONST WSA_QOS_POLICY_FAILURE AS INTEGER = WSABASEERR + 1011
CONST WSA_QOS_BAD_STYLE AS INTEGER = WSABASEERR + 1012
CONST WSA_QOS_BAD_OBJECT AS INTEGER = WSABASEERR + 1013
CONST WSA_QOS_TRAFFIC_CTRL_ERROR AS INTEGER = WSABASEERR + 1014
CONST WSA_QOS_GENERIC_ERROR AS INTEGER = WSABASEERR + 1015
CONST WSA_QOS_ESERVICETYPE AS INTEGER = WSABASEERR + 1016
CONST WSA_QOS_EFLOWSPEC AS INTEGER = WSABASEERR + 1017
CONST WSA_QOS_EPROVSPECBUF AS INTEGER = WSABASEERR + 1018
CONST WSA_QOS_EFILTERSTYLE AS INTEGER = WSABASEERR + 1019
CONST WSA_QOS_EFILTERTYPE AS INTEGER = WSABASEERR + 1020
CONST WSA_QOS_EFILTERCOUNT AS INTEGER = WSABASEERR + 1021
CONST WSA_QOS_EOBJLENGTH AS INTEGER = WSABASEERR + 1022
CONST WSA_QOS_EFLOWCOUNT AS INTEGER = WSABASEERR + 1023
CONST WSA_QOS_EUNKOWNPSOBJ AS INTEGER = WSABASEERR + 1024
CONST WSA_QOS_EPOLICYOBJ AS INTEGER = WSABASEERR + 1025
CONST WSA_QOS_EFLOWDESC AS INTEGER = WSABASEERR + 1026
CONST WSA_QOS_EPSFLOWSPEC AS INTEGER = WSABASEERR + 1027
CONST WSA_QOS_EPSFILTERSPEC AS INTEGER = WSABASEERR + 1028
CONST WSA_QOS_ESDMODEOBJ AS INTEGER = WSABASEERR + 1029
CONST WSA_QOS_ESHAPERATEOBJ AS INTEGER = WSABASEERR + 1030
CONST WSA_QOS_RESERVED_PETYPE AS INTEGER = WSABASEERR + 1031
' Winsock 2 extensions.
Const WSA_IO_PENDING         As INTEGER = 997
Const WSA_IO_INCOMPLETE      As INTEGER = 996
Const WSA_INVALID_HANDLE     As INTEGER = 6
Const WSA_INVALID_PARAMETER  As INTEGER = 87
Const WSA_NOT_ENOUGH_MEMORY  As INTEGER = 8
Const WSA_OPERATION_ABORTED  As INTEGER = 995

Const WSA_WAIT_FAILED           As INTEGER = -1
Const WSA_WAIT_EVENT_0          As INTEGER = 0
Const WSA_WAIT_IO_COMPLETION    As INTEGER = &HC0
Const WSA_WAIT_TIMEOUT          As INTEGER = &H102
Const WSA_INFINITE              As INTEGER = -1

' Max size of event handle array when calling WSAWaitForMultipleEvents().
Const WSA_MAXIMUM_WAIT_EVENTS   As INTEGER = 64
'
' Size of WSANETWORKEVENTS.iErrorCode[] array.
Const FD_MAX_EVENTS    As INTEGER = 10
'
' Used to refer to particular elements of the WSANETWORKEVENTS.iErrorCodes[].
Const FD_READ_BIT                     As INTEGER = 0
Const FD_WRITE_BIT                    As INTEGER = 1
Const FD_OOB_BIT                      As INTEGER = 2
Const FD_ACCEPT_BIT                   As INTEGER = 3
Const FD_CONNECT_BIT                  As INTEGER = 4
Const FD_CLOSE_BIT                    As INTEGER = 5
Const FD_QOS_BIT                      As INTEGER = 6
Const FD_GROUP_QOS_BIT                As INTEGER = 7
Const FD_ROUTING_INTERFACE_CHANGE_BIT As INTEGER = 8
Const FD_ADDRESS_LIST_CHANGE_BIT      As INTEGER = 9
'
' ------------------------------------------------------------------------------
' Enumerations.
' ------------------------------------------------------------------------------
'
' Used with socket().
Enum Protocols
   IPPROTO_IP = 0
   IPPROTO_ICMP = 1
   IPPROTO_GGP = 2
   IPPROTO_TCP = 6
   IPPROTO_PUP = 12
   IPPROTO_UDP = 17
   IPPROTO_IDP = 22
   IPPROTO_ND = 77
   IPPROTO_RAW = 255
   IPPROTO_MAX = 256
end Enum
'
' Used with socket().
Enum SocketTypes
   SOCK_STREAM = 1
   SOCK_DGRAM = 2
   SOCK_RAW = 3
   SOCK_RDM = 4
   SOCK_SEQPACKET = 5
end Enum
'
' Used with socket().
Enum AddressFamilies
   AF_UNSPEC = 0
   AF_UNIX = 1
   AF_INET = 2
   AF_IMPLINK = 3
   AF_PUP = 4
   AF_CHAOS = 5
   AF_NS = 6
   AF_IPX = 6
   AF_ISO = 7
   AF_OSI = 7
   AF_ECMA = 8
   AF_DATAKIT = 9
   AF_CCITT = 10
   AF_SNA = 11
   AF_DECNET = 12
   AF_DLI = 13
   AF_LAT = 14
   AF_HYLINK = 15
   AF_APPLETALK = 16
   AF_NETBIOS = 17
   AF_MAX = 18
end Enum
'
' ------------------------------------------------------------------------------
' Types.
' ------------------------------------------------------------------------------
'
' To initialize Winsock.
Type WSADATA Field = 1
   wVersion                               As SHORT
   wHighVersion                           As SHORT
   szDescription(WSADESCRIPTION_LEN + 1)  As Byte
   szSystemstatus(WSASYS_STATUS_LEN + 1)  As Byte
   iMaxSockets                            As SHORT
   iMaxUpdDg                              As SHORT
   lpVendorInfo                           As INTEGER
End Type
'
' Basic IPv4 addressing structures.
Type in_addr field = 1
   s_addr   As INTEGER
End Type
'
Type sockaddr_in field = 1
   sin_family        As SHORT
   sin_port          As SHORT
   sin_addr          As in_addr
   sin_zero(0 to 7)  As Byte
End Type
'
' Used with name resolution functions.
Type hostent Field = 1
   h_name         As INTEGER
   h_aliases      As INTEGER
   h_addrtype     As SHORT
   h_length       As SHORT
   h_addr_list    As INTEGER
End Type
'
'
' Used with WSAEnumNetworkEvents().
Type WSANETWORKEVENTS Field = 1
    lNetworkEvents               As INTEGER
    iErrorCode(FD_MAX_EVENTS)    As SHORT
End Type
'
' Used when sending ICMP echos (pings).
Type IP_OPTION_INFORMATION Field = 1
    TTL           As Byte
    Tos           As Byte
    Flags         As Byte
    OptionsSize   As INTEGER
    OptionsData   As String * 128
End Type
'
'
Type IP_ECHO_REPLY Field = 1
    Address(0 To 3)  As Byte
    Status           As INTEGER
    RoundTripTime    As INTEGER
    DataSize         As SHORT
    Reserved         As SHORT
    data             As INTEGER
    Options          As IP_OPTION_INFORMATION
End Type
'
' ------------------------------------------------------------------------------
' APIs.
' ------------------------------------------------------------------------------
'
' DLL handling functions.
Declare Function WSAStartup Lib "ws2_32" (ByVal wVersionRequested As SHORT, ByRef lpWSAData As WSADATA) As INTEGER
Declare Function WSACleanup Lib "ws2_32" () As INTEGER
Declare Function WSAGetLastError Lib "ws2_32" () As INTEGER
Declare Function WSASetLastError Lib "ws2_32" (ByVal err_fb As INTEGER) As INTEGER
'
' Resolution functions.
Declare Function getpeername Lib "ws2_32" (ByVal s As INTEGER, ByRef name As sockaddr_in, ByRef namelen As INTEGER) As INTEGER
Declare Function getsockname Lib "ws2_32" (ByVal s As INTEGER, ByRef name As sockaddr_in, ByRef namelen As INTEGER) As INTEGER
Declare Function gethostbyname Lib "ws2_32" (ByVal host_name As String) As INTEGER
Declare Function gethostbyaddr Lib "ws2_32" (haddr As INTEGER, ByVal hnlen As INTEGER, ByVal addrtype As INTEGER) As INTEGER
 
'
' Conversion functions.
Declare Function inet_addr Lib "ws2_32" (ByVal cp As String) As INTEGER
Declare Function inet_ntoa Lib "ws2_32" (ByVal laddr As INTEGER) As INTEGER
Declare Function htonl Lib "ws2_32" (ByVal hostlong As INTEGER) As INTEGER
Declare Function ntohl Lib "ws2_32" (ByVal netlong As INTEGER) As INTEGER
Declare Function htons Lib "ws2_32" (ByVal hostshort As INTEGER) As SHORT
Declare Function ntohs Lib "ws2_32" (ByVal netshort As SHORT) As SHORT
'
' Socket functions.
Declare Function socket Lib "ws2_32" (ByVal af As AddressFamilies, ByVal stype As SocketTypes, ByVal protocol As Protocols) As INTEGER
'
Declare Function bind Lib "ws2_32" (ByVal s As INTEGER, ByRef name As sockaddr_in, ByVal namelen As INTEGER) As INTEGER
Declare Function listen Lib "ws2_32" (ByVal s As INTEGER, ByVal backlog As INTEGER) As INTEGER
Declare Function accept Lib "ws2_32" (ByVal s As INTEGER, ByRef addr As sockaddr_in, ByRef addrlen As INTEGER) As INTEGER
Declare Function connect Lib "ws2_32" (ByVal s As INTEGER, ByRef name As sockaddr_in, ByVal namelen As INTEGER) As INTEGER

'
Declare Function send Lib "ws2_32" (ByVal s As INTEGER, ByRef buf As Byte, ByVal datalen As INTEGER, ByVal Flags As INTEGER) As INTEGER
Declare Function sendto Lib "ws2_32" (ByVal s As INTEGER, ByRef buf As Byte, ByVal datalen As INTEGER, ByVal Flags As INTEGER, ByRef toaddr As sockaddr_in, ByVal tolen As INTEGER) As INTEGER
Declare Function recv Lib "ws2_32" (ByVal s As INTEGER, ByRef buf As Byte, ByVal datalen As INTEGER, ByVal Flags As INTEGER) As INTEGER
Declare Function recvfrom Lib "ws2_32" (ByVal s As INTEGER, ByRef buf As Byte, ByVal datalen As INTEGER, ByVal Flags As INTEGER, ByRef fromaddr As sockaddr_in, ByRef fromlen As INTEGER) As INTEGER
'
Declare Function shutdown Lib "ws2_32" (ByVal s As INTEGER, ByVal how As INTEGER) As INTEGER
Declare Function closesocket Lib "ws2_32" (ByVal s As INTEGER) As INTEGER
'
' I/O model functions.
Declare Function WSAAsyncSelect Lib "ws2_32" (ByVal s As INTEGER, ByVal hwnd As INTEGER, ByVal wMsg As SHORT, ByVal lEvent As INTEGER) As INTEGER
'
Declare Function WSACreateEvent Lib "ws2_32" () As INTEGER
Declare Function WSAEventSelect Lib "ws2_32" (ByVal s As INTEGER, ByVal hEventObject As INTEGER, ByVal lNetworkEvents As INTEGER) As INTEGER
Declare Function WSAResetEvent Lib "ws2_32" (ByVal hEvent As INTEGER) As INTEGER
Declare Function WSASetEvent Lib "ws2_32" (ByVal hEvent As INTEGER) As INTEGER
Declare Function WSACloseEvent Lib "ws2_32" (ByVal hEvent As INTEGER) As INTEGER
Declare Function WSAWaitForMultipleEvents Lib "ws2_32" (ByVal cEvents As INTEGER, ByRef lphEvents As INTEGER, ByVal fWaitAll As SHORT, ByVal dwTimeout As INTEGER, ByVal fAlertable As SHORT) As INTEGER
Declare Function WSAEnumNetworkEvents Lib "ws2_32" (ByVal s As INTEGER, ByVal hEvent As INTEGER, ByRef lpNetworkEvents As WSANETWORKEVENTS) As INTEGER
'
' ICMP functions.
'Declare Function IcmpCreateFile Lib "icmp.dll" () As INTEGER
'Declare Function IcmpCloseHandle Lib "icmp.dll" (ByVal HANDLE As INTEGER) As SHORT
'Declare Function IcmpSendEcho Lib "ICMP" (ByVal IcmpHandle As INTEGER, ByVal DestAddress As INTEGER, ByVal RequestData As String, ByVal RequestSize As SHORT, RequestOptns As IP_OPTION_INFORMATION, ReplyBuffer As IP_ECHO_REPLY, ByVal ReplySize As INTEGER, ByVal TimeOut As INTEGER) As SHORT
'
' NEW STUFF THAT I ADDED (ShadowWolf)
Declare Function ioctlsocket Lib "ws2_32" (Byval s as integer , Byval cmd as integer, Byref cmpP) as INTEGER
Declare Function getsockopt Lib "ws2_32" (Byval s as INTEGER , Byval Level as integer ,Byval optname as INTEGER,ByRef Optval as string,Byref optlen as integer) as integer
Declare Function setsockopt Lib "ws2_32" (Byval s as integer, Byval level as integer ,Byval optname as integer,ByRef Optval as string,Byval optlen as integer ) as INTEGER


' Other general Win32 APIs.
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As INTEGER)


Dim hSocket  As integer
Dim udtAddr  As sockaddr_in
Dim udtData As WSADATA
Dim lngRet  As integer

lngRet = WSAStartup(WINSOCK_V2_2, udtData)
   
   hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
   If (hSocket <> INVALID_SOCKET) Then
   
     udtAddr.sin_family = AF_INET
     udtAddr.sin_addr.s_addr = inet_addr("64.233.167.99")
     udtAddr.sin_port = htons(80)
   
     print connect(hSocket, udtAddr, Len(udtAddr))
     print len(udtaddr)
     
     print "socket() failed with error: " + str$(WSAGetLastError())
End If
sleep
lngRet = WSACleanup()

'  anyways len reporting back 9 when it should be 16byte's
'  works fine if i go and pass the corrected amount of byte's
'    Oh ya Nexinarus worked out the problem i spent 2 hours          
'    wondering why it worked on .9 and not .10 :)


Title: Bug Reports
Post by: v3cz0r on January 10, 2005, 11:44:12 PM
Yeah, it was reported on some posts below:

http://forum.qbasicnews.com/viewtopic.php?p=89263#89263
http://forum.qbasicnews.com/viewtopic.php?p=89275#89275

Quote
FB returning different values is actually a bug, i added a proc to calculate the real-len of UDT (w/o padding) to speed up SWAP and user type assignament s(so the padding is not swapped/copied), and LEN() was calling the same code.. fixed.



Sorry... optimizations kill..


Title: Bug Reports
Post by: ShadowWolf on January 10, 2005, 11:56:49 PM
ah man wish i saw the earlyer post would have saved me so much time Ah oh well live and learn.


Title: Bug Reports
Post by: adosorken on January 11, 2005, 03:07:23 AM
I would personally have no problems with escape sequences as long as they were only effective for specific routines, kinda like in C how they work with printf but have no specific effects as normal char arrays. :D


Title: Bug Reports
Post by: SJ Zero on January 11, 2005, 06:49:40 AM
Why go with ~ rather than \ though? It seems like being different from C for the sake of being different than C, rather than for a legitimate reason, like going with ! or !@#! for pointers instead of *.

Personally, I'd like the new functionallity, but I'd also like it to be hidden unless a person wants to use it. A ParseEscapeChars (string) as string would probably be the best way to do the feature; that way it would be hidden from newbs who don't need to worry about it, but it would be immediately accessable for anyone who wanted to use the feature.


Title: Bug Reports
Post by: Blitz on January 11, 2005, 09:22:11 AM
Becuase using \ as escape char would cause problems with existing programs for qbasic. It would interpret the \m in "mydir\myfile.fil"  as an escape char. Everything in C isn't so great. This is one of them.


Title: Bug Reports
Post by: SJ Zero on January 11, 2005, 01:01:46 PM
But if there was a parseEscapeChars command as I suggested, there would be no problems with anything, plus we could use standard escape codes. :)


Title: Bug Reports
Post by: v3cz0r on January 11, 2005, 01:44:37 PM
Ok, escape char is "\" now, compiler itself is using that in many parts so.. no way back ;)

"\" is easier to setup on some IDE's, "~"" would screw high-lighting so much that it would give ya brain damage after some seconds staring at it.

Be warned, if you use OPTION ESCAPE and than a bunch of '$include "" (using quotes "...", not apostrophes? '...'), don't forget to \\ the inc file path.. always use ' '  (apost..) inside include files, as you don't know if the user will put OPTION before or after the $include.. more ambiguity? That's BASIC..


Title: Bug Reports
Post by: fsw on January 11, 2005, 02:10:55 PM
Quote from: "v3cz0r"

Be warned, if you use OPTION ESCAPE and than a bunch of '$include "" (using quotes "...", not apostrophes? '...'), don't forget to \\ the inc file path.. always use ' '  (apost..) inside include files, as you don't know if the user will put OPTION before or after the $include.. more ambiguity? That's BASIC..

Nope, that's inconsistency  :o

If " are allowed it should work either way, in a bas or inc/bi files.

Sorry Victor, but please stick with one solution/way you choose and make it work everywhere in the code - also in include files.

BTW: I don't mind ditching " and use ' everywhere... :)


Title: Bug Reports
Post by: v3cz0r on January 11, 2005, 02:32:35 PM
That's the problem, i can't process escape chars by default and the inc files that include other inc files (the Win API ones for example) have no idea if escapes are on or off, i dunno if slashes '/' can be used on paths with old Windows versions (98? 95?).

Or i kill quotes used with $include or i won't add any other hack -- processing escapes also inside '...' is no sollution, see above.

Wtf did M$ use '...' with $include? Weird stuff..


Title: Bug Reports
Post by: zydon on January 11, 2005, 02:37:45 PM
I'm suggesting a block methods for ESCAPE sequences because it sometimes only a single line from the whole source code need this support. Using OPTION will effecting the whole files. block switch such as:

Code:

#ESCAPE ON
print "He replied, \"Did I say something?\""
#ESCAPE OFF
print "Then he move the mouse pointer to c:\windows\system folder."
' print another paragraph ...
'...
' print another paragraph ...
#ESCAPE ON
print "He talk to himself again, \"Hmmm... I thought the DLL was there...\""
#ESCAPE OFF


this will give better control for the compiler start to replacing the escape chars and stop when #ESCAPE OFF found. List of supported escape characters also need to be decided on what is allow in FB.


Title: Bug Reports
Post by: v3cz0r on January 11, 2005, 02:44:34 PM
Worst.. you must know if it's on/off, switching on or off is like DEF### when the QB IDE used to turn it DEFSGN before procs when you later inserted a DEFINT at top having the procs already declared..

Instead of
Code:
#ESCAPE ON
print "He replied, \"Did I say something?\""
#ESCAPE OFF


It would simpler to just
Code:
print "He replied, " + QUOTE + "Did I say something?" + QUOTE


Don't you think? ;) I know, it was just an example..


Title: Bug Reports
Post by: zydon on January 11, 2005, 02:55:24 PM
If it only single line, it's what you got to take. But if it has a few more lines, the "\" will win the heart of the coders. :D

Since you mentioned DEF###, I never understand how they use that in QB. I was use RQ before it was much more better example to follow for DEFxxx:

[syntax="qbasic"]
DEFINT i,j,k,num=100    ' equ in C: int i,j,k, num=100
DEFSNG X-Axis = 0.346757
DEFBYTE somearray(10) = {0,1,2,3,4,5,6,7,8,9}
DEFSTR sex$(1 to 2) = {"Male","Female"}
[/syntax]

this is save some coding time and speed-up variables declarations. it run like magic if this can be implement in FB.


Title: Bug Reports
Post by: Jofers on January 11, 2005, 03:04:09 PM
Well, it isn't really.  Doing "asdf" + quot$ + "asdf" is really annoying and it impedes readability

I'm for an escape keyword or function:

' replace "escape" with "literal" for reverse
mystring$ = ESCAPE "hi \n bye"
mystring$ = LITERAL "hi \n bye"

or a character like suggested:

mystring$ = e"hi \n bye"
mystring$ = l"hi \n bye"

and then add a metacommand to turn it on by default.

'$defesc on
mystring$ = "hi \n bye"


Title: Bug Reports
Post by: adosorken on January 11, 2005, 03:26:53 PM
Ugh this is getting very messy. :(


Title: Bug Reports
Post by: v3cz0r on January 11, 2005, 03:34:53 PM
How about: mystring$ = ESCAPE "hi \"" + user$ + ESCAPE "\""

Or: mypath$ = LITERAL "c:\" + filepath$ + LITERAL "\" + filename$

Readable? Don't think so. ESCAPE|LITERAL couldn't "live" for each expression operand, it would have to be added before every literal string..

'$'s are bad, remember, surround it with real comments and it will take ages to be found.. OPTION ESCAPE is more clear.. as OPTION DYNAMIC | STATIC would, instead of that ugly '$dynamic|static thing.

How about this, leave quotes on '$include but don't process any escape chars inside it, as happens with aposts.. more consistence and i doubt anyone would use escape chars to define an include file..


Title: Bug Reports
Post by: fsw on January 11, 2005, 04:46:53 PM
Victor,
are you changing this:

'$include

to that:

#include

?

Because somehow it doesn't make sense to me having:

#DEFINE
#IFNDEF
#ENDIF

but

'$include

All are compiler directives/switches or not?
If so they should use the same prefix :wink:


Title: Bug Reports
Post by: Jofers on January 11, 2005, 05:31:16 PM
Okay, that makes sense.

Hrm...  Maybe just a function then:
escape("asdjfkl")
literal("asdfjkl;")

and have the metacommand for setting defaults?  I guess you could do option escape, but "$" makes more sense as something you're telling the compiler to do, and not the program..  You can hide anything in bad code.

fsw:  I'm probably wrong, but I think "#" is a preprocessor command and "$" is a metacommand, from qb.


Title: Bug Reports
Post by: Z!re on January 11, 2005, 05:51:02 PM
# imo is preprocessor, C like thingy
'$ is QB like, and tells the compiler what to do, stuff like: '$Dynamic

#Dynamic

Not QB...

but meh
just make sure to make a standard soon, so we don't have to change our FB sourcecode for each new release of FBC...


Title: Bug Reports
Post by: fsw on January 11, 2005, 06:15:51 PM
The last time I worked with QB was 1989.
Never worked with VB :barf:
Only with other Basic dialects and C.

The preprocessor is build in the compiler, is it not?
If you look at the compiler like a black box, it's unimportant how many preprocessors are build in the compiler, or if it's a 1 pass or 2 pass compiler.

Also I don't care how much I have to adapt to a certain programming language syntax.
Once I got the syntax digested I like to keep it simple, consitent, resonable and reliable.
For me consitency is the key.

So yes, a standard would be nice.


Title: Bug Reports
Post by: Badjas on January 11, 2005, 06:18:10 PM
I kinda like the idea of having a function to process escape characters. And without that function, all text in a string is just what it is. (the escape character is on my list of why-I-hate-C)


Title: Bug Reports
Post by: Jofers on January 11, 2005, 08:06:48 PM
As a perl affectionado, I love the escape character.  Actually, I would be in support of some kind of regex parsing, but that would take some insane work, I imagine, you might as well throw in DRAW while you're there.

As far as preprocessing goes, That doesn't matter so much.  Just make some kind of clear functional definition between preprocessing and compiler options.  I can sort of see the difference between conditional compiling and say, $dynamic, but I can't really put it to words.

I still support a metacommand for escape characters over OPTION.  I'd get rid of OPTION altogether if I could, or metacharacters.  They can't work together, they're bitter enemies of nonunity.


Title: Bug Reports
Post by: retsyo on January 12, 2005, 12:18:00 AM
0.I think the "#ESCAPE" define is nice. If I have to use "\\" instead of "\" in all the way, I would be crazy.
1.PYTHON use escape chars from C, but it uses r"\n" to mean "\\n" in C. The "r" makes PYTHON source add the supporting for unicode chars some easily: u"some string" is a unicode string.
2.in PYTHON, both single quotation mark and double quotation mark can be used. for example:
Code:
print 'hello "world"'     ---->hello "world"
print "hello 'world'"     ---->hello 'world'

and 3 double quotation marks  can be used in a block of string:
Code:
print """
2nd line         <----yes, the 1st line is blank here
'something'
"""                #this ends the block

gives
Code:

2nd line         <----yes, the 1st line is blank here
'something'


Just my suggestions, how about mix #ESCAPE define, PYTHON styled strings together? I do think the 2nd PYTHON feature makes programmer less type( why do we use double quotation mark so much? a double quotation mark=a single quotation mark + SHIFT key)


Title: Bug Reports
Post by: adosorken on January 12, 2005, 02:31:43 AM
retsyo, you're bound and determined to get Python into FB. :D

What I think many people are forgetting here is that in virtually all languages, the way a string is represented depends on the function that's using that string...


Title: Bug Reports
Post by: retsyo on January 12, 2005, 04:06:42 AM
Haha, sorry guys ;)


Title: Bug Reports
Post by: Sterling Christensen on January 13, 2005, 10:27:09 AM
SDL_PixelFormat in inc\sdl\sdlvideo.bi is wrong.

Change this, in inc\sdl\sdlvideo.bi:
Code:
type SDL_PixelFormat
BitsPerPixel as ubyte
BytesPerPixel as ubyte

To this:
Code:
type SDL_PixelFormat
pal as SDL_Palette ptr
BitsPerPixel as ubyte
BytesPerPixel as ubyte

So that it matches this (SDL_video.h):
Code:
typedef struct SDL_PixelFormat {
SDL_Palette *palette;
Uint8  BitsPerPixel;
Uint8  BytesPerPixel;


Title: Bug Reports
Post by: v3cz0r on January 13, 2005, 12:03:13 PM
Nm.. i got all SDL headers translated by Edmond Leung, they will be used on the next release..

Code:
type SDL_PixelFormat
    palette as SDL_Palette ptr
    BitsPerPixel as Uint8
    BytesPerPixel as Uint8
...


That's from his SDL_video..


Title: Bug Reports
Post by: adosorken on January 13, 2005, 04:42:53 PM
Quote from: "v3cz0r"
i got all SDL headers translated by Edmond Leung

That name sounds vaguely familiar...


Title: Bug Reports
Post by: Sterling Christensen on January 13, 2005, 07:51:08 PM
I tried googling "Edmond Leung", and apparently he's a celebrity/actor? Or maybe just happens to have the same name?


Title: Bug Reports
Post by: adosorken on January 13, 2005, 08:30:09 PM
Okay wait a second...I knew his name sounded familiar...I've been looking for this guy for YEARS now since he disappeared. It's Dae Breaker! He was the founder of Bizzare Creations (the Kalderan project) and was a member of LSS when it was in its first incarnation. But then he just sorta disappeared...


Title: Bug Reports
Post by: relsoft on January 14, 2005, 02:15:33 AM
Wow!!! This is definitely renaissance!!!


Title: Bug Reports
Post by: Z!re on January 16, 2005, 01:50:26 PM
Code:
fbc emptyfile.bas
fbc -dll otheremptyfile.bas


Fun fun, how about a check?

Files exist, but are empty, 0 bytes.


Title: Bug Reports
Post by: na_th_an on January 16, 2005, 02:06:15 PM
Quote from: "relsoft"
Wow!!! This is definitely renaissance!!!


Sure. Noticed how many QB legends are making appearance? Angelo, Jonge... :P


Title: Bug Reports
Post by: aetherfox on January 16, 2005, 02:44:58 PM
I don't think that fB should start adding features from other languages...like Python...

It's a BASIC derivative, and the idea is to have a 32-bit BASIC language that most closely represents good old Quick Basic.  There shouldn't (now) be the tendency to say "Hey, C/C++/ObjPascal/(why)Python does this, we should too."


Title: Bug Reports
Post by: Z!re on January 16, 2005, 10:44:15 PM
This code crash:
Code:
Sub LUT_Init (SINPrecission As uinteger = 2, COSPrecission As uinteger = 2, SQRRange as uinteger = 262144, SQRPrecission as uinteger = 1)
If Initialized = 1 Then exit Sub
Initialized = 1
SINp = 10 ^ SINPrecission
COSp = 10 ^ COSPrecission
SQRp = 10 ^ SQRPrecission
SQRr = SQRRange

dim shared SIN_LUT(360*SINp) As LUT_Type
dim shared COS_LUT(360*COSp) As LUT_Type
dim shared SQR_LUT(SQRr*SQRp) As LUT_Type
SQRr = SQRRange*SQRp   '# <- This row crash
End Sub


This code works:
Code:
Sub LUT_Init (SINPrecission As uinteger = 2, COSPrecission As uinteger = 2, SQRRange as uinteger = 262144, SQRPrecission as uinteger = 1)
If Initialized = 1 Then exit Sub
Initialized = 1
SINp = 10 ^ SINPrecission
COSp = 10 ^ COSPrecission
SQRp = 10 ^ SQRPrecission
SQRr = SQRRange

dim shared SIN_LUT(360*SINp) As LUT_Type
dim shared COS_LUT(360*COSp) As LUT_Type
dim shared SQR_LUT(SQRr*SQRp) As LUT_Type
SQRr = SQRr * SQRp
End Sub


Any ideas?


Title: Bug Reports
Post by: v3cz0r on January 17, 2005, 01:29:51 AM
What you mean by crash, that happens at runtime or the compiler crashes?

I couldn't reproduce the error, but you shouldn't be allowed to use DIM|REDIM and then SHARED inside procs, patch will be next release..


Title: Bug Reports
Post by: relsoft on January 17, 2005, 04:44:37 AM
How about static asn in.

Static dim array(1000) as integer


We may need those in glvertex arrays. :*)


Title: Bug Reports
Post by: Z!re on January 17, 2005, 06:55:54 AM
Quote from: "v3cz0r"
What you mean by crash, that happens at runtime or the compiler crashes?

I couldn't reproduce the error, but you shouldn't be allowed to use DIM|REDIM and then SHARED inside procs, patch will be next release..


Crash at runtime, and I think it's good that you can dim shared, as this enables you to dim inside DLLs.

The dims should be redims, but i changed it for debug purpose.

And having the ability to redim a shared array inside a function is a good thing, imo.


Anyways, the problem is when I use:
blah as type = value

And then try to use blah in math. Compiles fine, but crash on runtime.
And this is a DLL.


Title: Bug Reports
Post by: v3cz0r on January 17, 2005, 11:26:25 AM
Rel: you can use STATIC with arrays too, they are allowed with FB,
Code:
static array(1000) as integer
will work.

Z!re: the "right" way would be:

Code:
dim shared myarray() as mytype
at module level.

and
Code:
redim myarray(...) as mytype
at proc level.

That's how it's done in QB.. a DIM SHARED inside a function will open it to memory leaks as that array is "impossible" to erase implicitly or explicitly in other routines later. When you create a dynamic *local* array inside a proc the compiler will erase them automagically when the proc finish - if you are DIM'ing a shared array that won't be done, it's up the the user to call ERASE at a shutdown() proc or such.


Title: Bug Reports
Post by: relsoft on January 18, 2005, 04:55:47 AM
How about "WITH" for us lazy bastards.  VB has it so why not FB?

Code:
With StructureType

     .x= 1
     .y=2
     .x =300
     .id = "Blah"

End With


Title: Bug Reports
Post by: na_th_an on January 18, 2005, 06:03:59 AM
Quote from: "relsoft"
How about "WITH" for us lazy bastards.  VB has it so why not FB?

Code:
With StructureType

     .x= 1
     .y=2
     .x =300
     .id = "Blah"

End With


Count my vote for this :P Another niceness from VB. You added BYREF and OPTION EXPLICIT, so why not? ;)


Title: Bug Reports
Post by: v3cz0r on January 18, 2005, 12:00:52 PM
Look at the CVS ;)

Quote
2 days  v1ctor  WITH added


No multiple var's WITH, as they are bad pratic, imo..


Title: Bug Reports
Post by: Jotz on January 25, 2005, 12:49:19 AM
I think something is wrong with the default ASCII set:

(http://img186.exs.cx/img186/9215/fbcharset2lq.png)

I don't know if using a graphics library affected it in any way.


Title: Bug Reports
Post by: Dr_Davenstein on January 25, 2005, 01:29:00 AM
Must be ignorant... What's the CVS? Hell, what is a CVS? :???:

I do have another question though, since I'm already here. ;)


Will we be able to pass full static arrays  as subroutine parameters, or do I need to learn something else that I'm totally clueless about?


Title: Bug Reports
Post by: relsoft on January 25, 2005, 03:24:27 AM
I believe Byref does that.
Code:

Static array(10000) as glFloat

sub rotate(byref array() as glFloat)

glbegin glPOINT
      glVertexf array(0), array(1)
glend


Title: Bug Reports
Post by: Dr_Davenstein on January 25, 2005, 03:46:22 AM
Quote from: "relsoft"
I believe Byref does that.
Code:

Static array(10000) as glFloat

sub rotate(byref array() as glFloat)

glbegin glPOINT
      glVertexf array(0), array(1)
glend



Hmmm... I could've sworn I tried that. I'll try again. ;)


Well, I modified this code a couple of times, and I'm extremely tired right now... but it still doesn't work. :(

I just want to know if it will be possible to do this later... or if it is possible now, how can I do it.

Thanx!  :P


Code:
DEFINT A-Z
declare Sub addone(BYREF NewA() as Integer)

type mytypeT
   a(0 to 3) as Integer
end type

STATIC mytype(1 to 100) as mytypeT

for i = 1 to 5
   addone mytype(i).a()
next i


For i = 1 to 5
   For id=0 to 3
      Print MyType(i).a(id)
   Next
Next


sleep

SUB addone(BYREF NewA() as Integer)  
   For id = 0 to 3
      NewA(i)= 1 + Int(rnd*10)
   next
end SUB


Title: Bug Reports
Post by: lillo on January 25, 2005, 05:57:55 AM
jotz: the ascii set used by gfxlib is the same used by QB: I dumped it from there...


Title: Bug Reports
Post by: v3cz0r on January 25, 2005, 12:00:08 PM
Only in the next release:

Quote
[chged] fixed-len strings on arrays can now be passed as parameter to functions (v1c)
[chged] array fields can now be passed by descriptor, as in "array(idx).arrayfield()" (v1c)


Title: Bug Reports
Post by: Zap on January 26, 2005, 01:08:26 PM
In console mode, the colors number 7 and 8 show up as exactly the same color, light grey. I don't wanna be without dark grey for ascii-gfx games :P


Title: Bug Reports
Post by: subxero on January 27, 2005, 12:36:55 AM
I think that's Windows' fault. Its console doesn't have "rich color support" unfortunately.


Title: Bug Reports
Post by: Zap on January 27, 2005, 02:22:03 PM
well, all the other colors from 0->15 works and looks correct (almost), except number 8.


Title: Bug Reports
Post by: Z!re on January 27, 2005, 05:26:45 PM
And "rich color" = screen 0 colors :P


Title: Bug Reports
Post by: v3cz0r on January 27, 2005, 05:29:47 PM
Yeah, color 8 was really wrong, fixed, thanks.. patch will be on next release -- that may be done only next week, sorry.


Title: Bug Reports
Post by: Aquarius on January 27, 2005, 06:31:40 PM
well, maybe it should be here...

http://forum.qbasicnews.com/viewtopic.php?t=8100


Title: Bug Reports
Post by: nathan on January 29, 2005, 07:02:36 AM
Just discovered fb - great project 8)  I have started compiling some of my code.  I notice that

Code:
PRINT STR$(42)+STR$(42)
prints
Quote
" 42 42"
in qb and
Quote
"4242"
in fb (without the spaces)

reading other posts I get the impression that spaces are left-trimmed if the string length isn't defined?

Regards


Title: Bug Reports
Post by: relsoft on January 29, 2005, 07:12:02 AM
That's not a bug.  Why would yo need space in between?


Title: Bug Reports
Post by: whitetiger0990 on January 29, 2005, 12:21:39 PM
meh soemtimes that space can be a good thing.... but i found it annoying.  if you REALLY want it then just put this in


Code:
declare function str2(a) as string

function str2(a)
if a >= 0 then str2 = " " + str(a) else str2 = str(a)
end function


just use str2 instead then. =P

edit:
(z!re noticed that it put a space in front of negitive numbers =P)


Title: Bug Reports
Post by: Dr_Davenstein on January 30, 2005, 01:45:59 AM
I don't know why, but all my icons show up as the My Computer icon after I run FB... It might be the IDE though, I'm using Von Godric's. I'll have to restart and see if I can find out exactly when it happens...


Title: Bug Reports
Post by: v3cz0r on January 30, 2005, 03:51:22 AM
You can be sure the compiler won't mess up with your icons, it doesn't have one itself ;)

No Windows-specific routines are called, there's no way it could do anything like that.


Title: Bug Reports
Post by: ShadowWolf on January 30, 2005, 04:06:54 AM
that sounds like a problem i had on 9x the icon's would screw up if resource's were running low or the system was becoming more unstable.


Title: Bug Reports
Post by: Dr_Davenstein on January 30, 2005, 04:43:21 AM
Quote from: "ShadowWolf"
that sounds like a problem i had on 9x the icon's would screw up if resource's were running low or the system was becoming more unstable.



Yup... Sorry 'bout that. :oops: It just started doing that when I use anything that runs in full screen!  :???:


Title: Bug Reports
Post by: na_th_an on February 02, 2005, 04:41:30 PM
CVI is not working properly.

In QB, CVI(CHR$(0) + CHR$(64)) gives 16384 (first the lsb, then the msb, they're put together and converted to integer).

If fB you get 0.


Title: Bug Reports
Post by: v3cz0r on February 02, 2005, 05:05:25 PM
CHR$(0) can't be part of strings, CVI converts an integer, that's 32-bit in FB.


Title: Bug Reports
Post by: na_th_an on February 02, 2005, 05:18:26 PM
Then, CVI is different? Oh, I see. It was very useful for bitmasks for LINE. Time to find an alternative.


Title: Bug Reports
Post by: Z!re on February 02, 2005, 05:58:11 PM
How would one go about converting a short then?


Title: Bug Reports
Post by: v3cz0r on February 02, 2005, 06:09:42 PM
Code:
option escape

declare function str2short ( s as string ) as short

print str2short( "\1\64" ), 64 * 256 + 1

function str2short ( s as string ) as short
     dim p as byte ptr
     p = strptr( s )
     str2short = p[0] or (p[1] shl 8)
end function


Still, "\0" won't work.[/code]


Title: Bug Reports
Post by: na_th_an on February 02, 2005, 06:12:27 PM
Anything would fit. You know, I was using this to render 8x8 bitmap fonts in QB, so the msb was discarded.

Thanks for the tip.


Title: Bug Reports
Post by: theuserbl on February 03, 2005, 09:30:52 AM
I know know, if it is a bug or only diferent to the real QB.

But if you have a file with empty lines and load it with "INPUT #1" (not LINE INPUT #1, only INPUT #1), line for line, than QB shows the empty lines too. But FB didn't do it.


-----

An second point is, that FB creates an error-text which not reaaly helps, when have written the following wrong code:

Code:

sub first
 '...
end sub

sub second
 dim a as integer
 a=5
 if a=5 then goto forth:
end sub

sub third
 '...
end sub

sub forth
 '...
end sub

sub sixed
 '...
end sub


-----

And at the third point I want to say, that it would be nice, if in the gfxlib the MULTIKEY differs between the key "Alt" and "Alt Gr".
At the moment both have the same code. And so MULTIKEY don't see any different between this two.


Greatings
theuserbl


Title: Bug Reports
Post by: lillo on February 03, 2005, 09:54:02 AM
Quote
And at the third point I want to say, that it would be nice, if in the gfxlib the MULTIKEY differs between the key "Alt" and "Alt Gr".
At the moment both have the same code. And so MULTIKEY don't see any different between this two.

This was made to be compatible with DOS scancodes: in DOS you can't distinguish between the two ALT keys...