FreeBASIC 1.07 Release Discussion

For other topics related to the FreeBASIC project or its community.
dodicat
Posts: 6949
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FreeBASIC 1.07 Release Discussion

Postby dodicat » Apr 11, 2021 21:29

Would it be possible to fix the extremely slow gcc compile of data in data statements.
Here are some results for a test file:

Code: Select all

compiling . . .
Success ( 450.1857522999999  seconds)

FreeBASIC Compiler - Version 1.07.3 (2020-12-31), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
-gen gcc -Wc -O3

--------------------------------------------------------------------------------

compiling . . .
Success ( 435.4475182999995  seconds)

FreeBASIC Compiler - Version 1.07.2 (2020-12-25), built for win32 (32bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
-gen gcc -Wc -O3

--------------------------------------------------------------------------------

compiling . . .
Success ( 2.656405900001118  seconds)

FreeBASIC Compiler - Version 1.07.2 (2020-12-25), built for win32 (32bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
-gen gas

--------------------------------------------------------------------------------


compiling . . .
Success ( 5.384803700002522  seconds)

FreeBASIC Compiler - Version 1.07-(08).1 (2020-08-07), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
-gen gas64

--------------------------------------------------------------------------------


Here is the test code, I suggest popping it into a temp folder and running from there.
Please use the mouse wheel to adjust the magnification, probably make it 1.
The saved file is testbitmap.bas, approx 32000 lines of data, which you can test yourself with gas and gcc.
But please note you will have to wait 7 or 8 minutes to compile with -gen gcc, -gen gas is only a few seconds.

Code: Select all



'Data maker


Screen 17,32
 Dim As String nag = _
"S2C0BM197,135M+5,-27M+3,-25M+4,-21M+6,-10M+15,-10"_
&"M+5,-4M+11,-4M+8,0M+2,4M+48,1M+15,7"_
&"M+15,7M+12,10M+12,13M+19,27M+7,15M+6,13"_
&"M+7,7M+23,5M+39,-9M+37,-10M+20,-1M+24,3"_
&"M+30,5M+18,-10M+34,-23M+15,-3M+18,6M+15,11"_
&"M+12,15M+2,28M+5,39M+-5,18M+-17,38M+-7,14"_
&"M+-20,34M+-12,21M+-4,9M+-2,3M+-1,37M+4,9"_
&"M+-4,1M+-9,-7M+-7,-17M+-3,-30M+6,-38M+23,-59"_
&"M+4,-29M+-3,-21M+-13,-17M+-10,-6M+-13,-4M+-17,0"_
&"M+-6,3M+5,18M+11,28M+0,27M+-3,15M+-7,13"_
&"M+-10,16M+-12,11M+-9,11M+-9,10M+6,19M+8,13"_
&"M+5,6M+6,12M+-4,11M+-12,17M+-14,13M+-10,13"_
&"M+-8,13M+-7,10M+-4,11M+-12,6M+-8,3M+-5,11"_
&"M+0,6M+-28,-9M+3,-12M+8,-8M+13,-7M+8,-5"_
&"M+12,-10M+9,-16M+10,-15M+12,-15M+0,-10M+-3,-13"_
&"M+-2,-8M+-5,1M+-3,12M+-8,9M+-12,13M+-10,13"_
&"M+-7,16M+-8,15M+-5,8M+-8,11M+-9,9M+-13,12"_
&"M+-3,9M+273,4M+0,13M+-382,-1M+-1,-12M+71,-3"_
&"M+20,-21M+27,-20M+28,-41M+6,-14M+5,-20M+-19,-35"_
&"M+-7,-10M+-8,-7M+-9,-4M+-16,7M+-12,3M+-29,0"_
&"M+-22,1M+-14,21M+-13,27M+-13,19M+-12,30M+-7,22"_
&"M+-4,19M+-7,22M+31,3M+-1,15M+-171,-1M+-2,-13"_
&"M+95,-2M+13,-8M+15,-9M+8,-13M+8,-21M+5,-32"_
&"M+5,-22M+9,-21M+8,-22M+8,-19M+-3,-4M+-17,5"_
&"M+-9,3M+-69,0M+-4,7M+-4,12M+5,17M+9,10"_
&"M+13,14M+11,10M+10,3M+12,4M+4,11M+-2,12"_
&"M+-8,7M+-8,-4M+-20,-14M+-15,-13M+-36,-56M+-2,-19"_
&"M+7,-14M+15,-8M+48,-20M+-7,-26M+5,-11M+1,-11"_
&"M+7,-7M+6,-11M+8,-18M+3,-18M+-1,-14M+-4,-10"_
&"M+-6,-11M+-8,1M+-14,12M+-7,10M+-3,15M+-6,8"_
&"M+-12,-2M+-16,-6M+-4,-17M+1,-16"_
&"BM+191,77P4294967295,0"

dim as any ptr tmp=imagecreate(640,400,rgb(0,100,255))
for x as long=50 to 590
    for y as long=50 to 350
        pset tmp,(x,y),rgb(x,x xor y,y)
    next y
next x
draw tmp,nag
draw string tmp,(0,0),"Test bitmap"
bsave "testbitmap.bmp",tmp
imagedestroy tmp
'bload "testbitmap.bmp"
'sleep
open "testbitmap.bas" for output as #2

Type bitmap_size
    As long across,down
End Type

Dim  mybitmap As String ="testbitmap.bmp"


Redim shared As ulong pixel_colours(0,0) 'shared to increase potential size

Function size(bmp As String) As bitmap_size 'fetch bitmap width/height
    Dim As long w,h
    Open bmp For Binary As #1
    Get #1, 19, w
    Get #1, 23, h
    Close #1
    Return Type<bitmap_size>(w,h)
End Function

Sub load(bmp As String,pixels() As ulong) 'load bitmap into array of point colours
    Bload bmp
    dim count as integer
    dim as string comma=","
    dim as string dash="_"
    Dim temp As bitmap_size=size(bmp)
   
    Redim pixels(temp.across,temp.down)
   
    dim max as integer=(1+temp.across)*(1+temp.down)
    For x As Integer=0 To temp.across
        For y As Integer=0 To temp.down
            count=count+1
            pixels(x,y)=Point(x,y)
            if count=max then
                comma=""
                dash=""
            end if
            print #2,"&H"& hex(point(x,y))&comma;
            if count mod 8=0 then print #2,dash
        Next y
    Next x
   
End Sub

'Use mouse or keys to move bitmap in this run
Sub drawbitmap(mx As Integer,my As Integer,mybitmap As bitmap_size,scale as single=1)
    #macro magnify(pivotx,pivoty,px,py,scale)
    var rotx=scale*(px-pivotx)+pivotx
    var roty=scale*(py-pivoty)+pivoty
    #endmacro
    For x As Integer=mx To mx+mybitmap.across
        For y As Integer=my To my+mybitmap.down
            magnify(mx,my,x,y,scale)
            line(rotx-scale/2,roty-scale/2)-(rotx+scale/2,roty+scale/2),pixel_colours(x-mx,y-my),BF
        Next y
    Next x
   
End Sub
'____________________________
Sub framecounter(msg as single)
    Static As double frame,fps
    frame=frame+1
    Static As double t1,t2
    If frame>=fps Then
        t1 = Timer
        fps = frame/(t1-t2)
        Windowtitle "Frames per second = " + str(fps) + "   magnification= " +str( msg)
        t2=Timer
        frame=0
    End If
End Sub
'______________________________________
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Dim As bitmap_size bitmap_info=size(mybitmap) 'get height/width of bitmap
print #2,"redim shared as ulong a(";str(bitmap_info.across);",";str(bitmap_info.down);")"
print #2 ,"DATA _"
draw string(bitmap_info.across,bitmap_info.down), "PLEASE WAIT"
load mybitmap,pixel_colours() 'set bitmap into an array

'variables for the mouse and arrow keys
Dim As Integer mx,my,mw,mb,copymx,copymy
dim as string i
'Testing loop for this section.
Do
    Getmouse(mx,my,mw,mb)
    if mb=2 then exit do
    if mw<0 then mw=10
    if mw=0 then mw=1
    If mb=1 Then
        copymx=mx:copymy=my
    End If
    i=inkey
    if i= chr(255) + "K"  then copymx=copymx-5
    if i= chr(255) + "M"  then copymx=copymx+5
    if i= chr(255) + "P"  then copymy=copymy+5
    if i= chr(255) + "H"  then copymy=copymy-5
   
    Screenlock
    Cls
   
    drawbitmap(copymx,copymy,bitmap_info,mw/10) 'SCALE
    draw string(20,20),"TURN MOUSE WHEEL  --- MAGNIFICATION = "&str(mw/10),rgb(255,255,255)
    draw string(20,50),"END AT THE REQUIRED MAGNIFICATION",rgb(255,255,255)
    draw string(20,80),"LEFT CLICK TO SHIFT IMAGE",rgb(255,255,255)
    draw string(20,110),"ESC OR RIGHT CLICK TO END",rgb(255,255,255)
   
    framecounter(mw/10)
   
    Screenunlock
    Sleep 1,1
   
Loop Until i=Chr(27)
'Running code
print #2," "

print #2,"screen 17,32"
print #2,"dim as double magnification"
print #2,"magnification= ";mw/10
print #2,"Type bitmap_size"
print #2,"As Integer across,down"
print #2,"End Type"

print #2,"sub read_data(mybitmap as bitmap_size)"

print #2,"for x as integer=0 to mybitmap.across"
print #2,"for y as integer=0 to mybitmap.down"
print #2,"read a(x,y)"
print #2,"next y"
print #2,"next x"
print #2,"end sub"

print #2,"dim shared as any pointer image"
print #2,"image=imagecreate(magnification*ubound(a,1),magnification*ubound(a,2))"

print #2,"Sub drawbitmap_to_image(mybitmap As bitmap_size,scale as single=1,mx As Integer=0,my As Integer=0)"
print #2,"#macro magnify(pivotx,pivoty,px,py,scale)"
print #2,"var rotx=scale*(px-pivotx)+pivotx"
print #2,"var roty=scale*(py-pivoty)+pivoty"
print #2,"#endmacro"
print #2,"For x As Integer=mx To mx+mybitmap.across"
print #2,"For y As Integer=my To my+mybitmap.down"
print #2,"magnify(mx,my,x,y,scale)"
print #2,"line image,(rotx-scale/2,roty-scale/2)-(rotx+scale/2,roty+scale/2),a(x-mx,y-my),BF"
print #2,"Next y"
print #2,"Next x"
print #2,"End Sub"

print #2,"Dim As bitmap_size bitmap_info"
print #2,"bitmap_info.across=ubound(a)"
print #2,"bitmap_info.down=ubound(a,2)"
print #2,"read_data(bitmap_info)"
print #2,"drawbitmap_to_image(bitmap_info,magnification)"
print #2,"'BITMAP image is now in image"
print #2,"'This just displays the image"
print #2,"dim as string i"
print #2,"Do"
print #2,"i=inkey"
print #2,"Screenlock"
print #2,"Cls"
print #2,"locate 2,2"
print #2,"print ""magnification ="";";mw/10
print #2,"put(";copymx;",";copymy;"),image,pset"
print #2,"Screenunlock"
print #2,"Sleep 1,1"
print #2,"Loop Until i=Chr(27)"
print #2,"imagedestroy image"
close #2
locate 10,10
color rgb(200,200,200)
print "SAVED -- testbitmap.bas is your file"
locate 12,10
print "Press a key to end"
sleep


 
jj2007
Posts: 2144
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: FreeBASIC 1.07 Release Discussion

Postby jj2007 » Apr 12, 2021 14:03

MOST LIKELY WHAT YOU ARE LOOKING FOR...

win32: FreeBASIC-1.07.3-win32.7z - 32bit standalone version
win64: FreeBASIC-1.07.3-win64.7z - 64bit standalone version
...
Windows Binaries (default for fbc-1.07.x is gcc 5.2.0)

FreeBASIC-1.07.3-win32.exe (installer) | .zip archive | .7z archive - 32bit standalone version
FreeBASIC-1.07.3-win64.zip | .7z archive - 64bit standalone version
So which one contains the fbc.exe for Windows? And does the 64bit version also contain the compiler for 32-bit code?
deltarho[1859]
Posts: 3072
Joined: Jan 02, 2017 0:34
Location: UK

Re: FreeBASIC 1.07 Release Discussion

Postby deltarho[1859] » Apr 12, 2021 22:17

The phrase 'As clear as mud' comes to mind.

Is that a queue building for gcc 8.1?
No, it is an optical illusion. Image

Should we see the word 'experimental' used in an official distribution?
No, experimental toolchains should be in a separate thread.
dodicat
Posts: 6949
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FreeBASIC 1.07 Release Discussion

Postby dodicat » Apr 13, 2021 9:52

jj2007 wrote:
MOST LIKELY WHAT YOU ARE LOOKING FOR...

win32: FreeBASIC-1.07.3-win32.7z - 32bit standalone version
win64: FreeBASIC-1.07.3-win64.7z - 64bit standalone version
...
Windows Binaries (default for fbc-1.07.x is gcc 5.2.0)

FreeBASIC-1.07.3-win32.exe (installer) | .zip archive | .7z archive - 32bit standalone version
FreeBASIC-1.07.3-win64.zip | .7z archive - 64bit standalone version
So which one contains the fbc.exe for Windows? And does the 64bit version also contain the compiler for 32-bit code?

jj2007
You have the 64 bit compiler and the 32 bit compiler, in compressed form (.7Z or .zip).
Use one or the other to get 64 bit or 32 bit executables (or libraries).
Generally the .bas code should run on both compilers, unless any asm blocks within the code are specific to a compiler.
I assume by 32-bit code you mean code that contains 32 bit instructions in the asm blocks!
under
MOST LIKELY WHAT YOU ARE LOOKING FOR...
the 7z files:
The 32 bit compiler doesn't include gcc, it is gas only.
The 64 bit compiler uses gcc 5.2
What compiler are you using at the moment?
I have been using the latest 64 bit compiler mainly (gcc 5.2 to save any fuss)
I think confusion arises when the latest 32 bit compiler, freshly downloaded and expanded, has no gcc option.
Perhaps gcc should automatically be bundled with it, but that is up to the developer.
deltarho[1859]
Posts: 3072
Joined: Jan 02, 2017 0:34
Location: UK

Re: FreeBASIC 1.07 Release Discussion

Postby deltarho[1859] » Apr 13, 2021 14:34

I don't know why this was not done for gcc 5.2 Windows binaries.

The link below is a 32-bit and 64-bit combined archive (fbc32.exe and fbc64.exe). The 32-bit has gcc 5.2.

This is how the 8.3 and 8.4 are made. A newcomer to FB won't have a clue how to do the same for 5.2; the default for goodness’ sake!

FreeBASIC-1.07.3-gcc-5.2.zip
jj2007
Posts: 2144
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: FreeBASIC 1.07 Release Discussion

Postby jj2007 » Apr 13, 2021 18:45

dodicat wrote:What compiler are you using at the moment?
1. FreeBASIC Compiler - Version 1.07.1 (2019-09-27), built for win32 (32bit)
2. same as above (Version 1.07.1 (2019-09-27), built for win32), but with gcc version 8.1.0 (2018)
3. FreeBASIC Compiler - Version 1.07.1 (2019-09-27), built for win64 (64bit)
4. SARG's fbc64_gas64.exe

So the "Windows binaries" are not what the n00b is looking for?
Why do you recommend GCC 5.2 if 8.1 has been around since 2018?
deltarho[1859] wrote:This is how the 8.3 and 8.4 are made
What do you mean with "made"?
deltarho[1859]
Posts: 3072
Joined: Jan 02, 2017 0:34
Location: UK

Re: FreeBASIC 1.07 Release Discussion

Postby deltarho[1859] » Apr 13, 2021 19:38

jj2007 wrote:What do you mean with "made"?

'32bit and 64bit combined archive (fbc32.exe and fbc64.exe)'

With my zip above we only have one download, instead of two, and no messing about putting 32-bit gcc into the FB-win32 package. When I first came to FB I didn't know what gcc was, and it took me a while to fathom out what was going on.

As for the comment "in case you want to use -gen gcc", I find that funny now because I have no time for gas or gas64.

As for gcc 8.1 in the 1.07.3 distribution, that is a joke given that we are now offered 8.3 or 8.4. OK, 8.1 is mingw-w64 but so what.

This is what my WinFBE Cpaths is now:
Image
Unfortunately, the last two are no longer available at the forum after my anonymous German friend 'pulled the plug' on them. Of course that does not stop someone else building them. My German friend will continue to build for me so when fbc 1.08 comes out the Cpaths above will read 1.08.0.
coderJeff
Site Admin
Posts: 3507
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.07 Release Discussion

Postby coderJeff » Apr 15, 2021 4:51

Just in case anyone is joining us for the first time, the fbc compiler is a console application. It needs an editor or an IDE to make files. If fbc compiler is run on it's own by double clicking on windows explorer, it will just flash a console for a second and disappear.

The purpose of the 1.07 *branch* is to maintain binary compatibility with some previous versions and fix a few of the worst bugs.

gcc not included based on previous releases - gcc not included todo item - a added last week but was not going to hold up getting the builds done.

The 32-bit and 64-bit downloads have been separate for a long time. To combine the builds, need to use separate names for fbc if we are to keep the defaults of having a 32 bit version make 32 bit exe's and a 64 bit version make 64 bit exe's.

But fbc32 and fbc64 names don't exist anywhere in fbc 1.07 or fbc 1.08 manual. Could also use a single fbc.exe with the proper tools installed, and make either 32 or 64 bit by passing '-target win32|win64'

Only secondary was packaging a couple of the tool chains with a newer / different gcc.
coderJeff
Site Admin
Posts: 3507
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.07 Release Discussion

Postby coderJeff » Apr 15, 2021 5:00

jj2007 wrote:So the "Windows binaries" are not what the n00b is looking for?

Please don't use n00b to refer to beginners, novices, or newcomers. I think it comes across as pejorative. You're not the only, just the first one I'm saying something to.
coderJeff
Site Admin
Posts: 3507
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.07 Release Discussion

Postby coderJeff » Apr 15, 2021 5:01

deltarho[1859] wrote:As for gcc 8.1 in the 1.07.3 distribution, that is a joke given that we are now offered 8.3 or 8.4. OK, 8.1 is mingw-w64 but so what.

I'll deal with this in the 1.08.0 development thread.
coderJeff
Site Admin
Posts: 3507
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.07 Release Discussion

Postby coderJeff » Apr 15, 2021 5:08

dodicat wrote:Would it be possible to fix the extremely slow gcc compile of data in data statements.


I poked away this problem several times over the last few months. Seems obvious now, but I got stuck several times trying to find a solution.

Optimize Byref String Concatenation #299
This is merged now for fbc 1.08.0.

Thanks for reposting the test program. Your latest was easy to work with (I didn't have to copy a bitmap file).
For -gen gas, about 10 seconds
For -gen gcc, about 20 seconds
deltarho[1859]
Posts: 3072
Joined: Jan 02, 2017 0:34
Location: UK

Re: FreeBASIC 1.07 Release Discussion

Postby deltarho[1859] » Apr 15, 2021 7:13

Apologies coderJeff - my comment on gcc 8.1 could have been better written. jj2007 and I have something in common - we both failed our diplomacy exams. Image

After posting my 32bit and 64bit combined archive for gcc 5.2 it occurred to me that whilst handy for most it is surplus to requirements for those with only a 32-bit OS; very few nowadays but there are some 'out there'.
jj2007
Posts: 2144
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: FreeBASIC 1.07 Release Discussion

Postby jj2007 » Apr 15, 2021 8:52

coderJeff wrote:
jj2007 wrote:So the "Windows binaries" are not what the n00b is looking for?

Please don't use n00b to refer to beginners, novices, or newcomers. I think it comes across as pejorative. You're not the only, just the first one I'm saying something to.
I call myself a n00b for FB, and don't perceive that as pejorative, but I'll try to be a diplomat from now on ;-)
Iczer
Posts: 66
Joined: Jul 04, 2017 18:09

Re: FreeBASIC 1.07 Release Discussion

Postby Iczer » Apr 16, 2021 8:22

Iczer wrote:About manual - strptr() changes still not included

Code: Select all

[changed]
- SADD/STRPTR(wstring) returns WSTRING PTR


Code: Select all

Syntax

Declare Operator StrPtr ( ByRef lhs As String ) As ZString Ptr
Declare Operator StrPtr ( ByRef lhs As WString )[b] As ZString Ptr[/b]

Return Value

Returns a ZString Ptr to a string's character data (null value in case of empty string).

Description
...
[b]Note that when passed a WString, Operator Strptr still returns a ZString Ptr, which may not be the desired resul[/b]t.


still the same...
fxm
Moderator
Posts: 10369
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: FreeBASIC 1.07 Release Discussion

Postby fxm » Apr 16, 2021 9:09

But already done in the FBWiki:


Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 7 guests