BASIC(modified B++ complier) + wxWidgets

General discussion for topics related to the FreeBASIC project or its community.
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: BASIC(modified B++ complier) + wxWidgets

Post by dodicat »

nm.exe can open the wxwidget static libs OK.
The mention of C++ puts a terrible fear into freebasic lib people.
but if nm.exe can show the list of functions in each .a file, perhaps these functions could be called via freebasic.
I'll experiment tomorrow with some simple ones.
oyster
Posts: 274
Joined: Oct 11, 2005 10:46

Re: BASIC(modified B++ complier) + wxWidgets

Post by oyster »

to be frank, the modified B++ compiler seems to have the ability to use any wxWdigest's control in a very simple way - just write a little in Cpp include file - which is attractive.
paul doe
Moderator
Posts: 1733
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: BASIC(modified B++ complier) + wxWidgets

Post by paul doe »

oyster wrote:...
As for this modified B+ BASIC project, I think it is about BASIC language, so it has some relation to freebasic.
...
Oh so according to you, every language that has the stupid BASIC moniker in its name, is automagically related to FreeBasic? Do you see QB64 code here? Or PowerBasic? Or Vb.Net?
oyster wrote: ...
There has already been topics here which are actually have nothing to do freebasic, why nobody claims to delete them before? Let me guess the reason

- you have never met the author before

or

- you are afraid that this modified B+ BASIC can get more focus then freebasic does. Come on, this modified B+ BASIC is far from mature and I doubt whether it can cover a full BASIC syntax for realy applications in years. Just relax or make freebasic can support up-to-date wxWidgets to defeat this modified B+ BASIC.
And this is an example of flawed logic at its best. The topic shouldn't be deleted for the (admittedly weak) reasons you cite, but because it's in the wrong forum. As simple as that. If you can't wrap your head around that concept, then you may try wrapping wxWidgets instead, so it can be used through a C-like interface. That way you could stop beetching about the things that FreeBasic can't do, and instead focus on what can be achieved with it right now, for a healthy change.
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Re: BASIC(modified B++ complier) + wxWidgets

Post by aurelVZAB »

personally i don't care but man have a right!
Oh so according to you, every language that has the stupid BASIC moniker in its name, is automagically related to FreeBasic
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: BASIC(modified B++ complier) + wxWidgets

Post by dodicat »

The file libwxzlib.a (32 bits tested) from wxwidgets " . . .wxWidgets-3.1.3.StaticLibs\lib\gcc_lib32" works OK with FreeBASIC.(With a few name changes)
This file was written in C++ as far as I know.
code:

Code: Select all


#inclib "wxzlib"
Extern "C"
    Declare Function wx_zlib_compressBound(Byval sourceLen As Ulong) As Ulong
    Declare Function wx_zlib_uncompress(Byval dest As Ubyte Ptr, Byval destLen As Uinteger Ptr, Byval source As  Ubyte Ptr, Byval sourceLen As Ulong) As Long
    Declare Function wx_zlib_compress(Byval dest As Ubyte Ptr, Byval destLen As Uinteger Ptr, Byval source As  Ubyte Ptr, Byval sourceLen As Ulong) As Long
End Extern

Function getpassedinfo(text As String,Byref passed_length As Integer) As String
    Dim As String var1,var2
    Dim As Integer pst
    #macro splice(stri,char,var1,var2)
    pst=Instr(stri,char)
    var1="":var2=""
    If pst<>0 Then
        var1=Mid(stri,1,pst-1)
        var2=Mid(stri,pst+1)
    Else
        var1=stri
    End If
    #endmacro
    splice(text,"|",var1,var2)
    text=var2
    passed_length=Valint(var1)
    Return text
End Function


'=================   UNPACK ===============
Function unpack(file As String) As String
    Dim As Integer passed_length
    Dim As String text=getpassedinfo(file,passed_length)
    Dim As Integer stringlength,destinationlength
    stringlength=Len(text)
    destinationlength =passed_length
    Dim As Ubyte Ptr source
    Dim As Ubyte Ptr  destination =Callocate(destinationlength,1)
    source=@text[0]
    Var mistake=wx_zlib_uncompress(destination,@destinationlength, source, stringlength)
    If mistake<>0 Then Print "There was an error":Sleep:End
    Dim As String uncompressed
    uncompressed=String(destinationlength,0)
    For i As Integer = 0 To destinationlength- 1
        uncompressed[i]=(destination[i])
    Next
    Deallocate destination
    Return uncompressed
End Function

'===================  PACK ============
Function pack(file As String) As String
    Dim As String text=file
    Dim As Integer stringlength,destinationlength
    stringlength=Len(text)
    destinationlength = wx_zlib_compressBound(stringlength)
    Dim As Ubyte Ptr source
    Dim As Ubyte Ptr destination =Callocate(destinationlength,1)
    source=@text[0]
    Var mistake=wx_zlib_compress(destination, @destinationlength, source, stringlength)
    If mistake <>0 Then Print "There was an error"
    Dim As String compressed
    compressed=String(destinationlength,0)
    For n As Integer=0 To destinationlength-1
        compressed[n]=destination[n]
    Next n
    compressed=stringlength &"|"+compressed
    Deallocate destination
    Return compressed
End Function

#include "crt.bi"

dim as string s="ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"
s+=s
puts s
puts !"\n"

var c=pack(s)
puts c
var u= unpack(c)
puts !"\n"
puts u
sleep


 
 
result:

Code: Select all

ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789


70|xostrvqus÷ðôòöñõó
?^O2426153·°t$¬


ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789

 
I haven't tested any others yet.
kankouhin7937
Posts: 31
Joined: Aug 16, 2018 2:00

Re: BASIC(modified B++ complier) + wxWidgets

Post by kankouhin7937 »

I am a BASIC lover.
I hope BASIC can popular like before, and alive on every platform.
I am not a software architect, I just want to do something for BASIC world, and not waiting for BASIC going to die.

I hope a team or a group can do anything for me for us. i just happping to write code only.
But...

I am a normal salaryman, i need to work, and after working i need to play with my daughter(Kaya),
i have no enough time to do all of the dreams. I just do what i can do.

Sorry FreeBASIC team, sorry FreeBASIC fans.
you can delete this thread.(i don't known how to delete topic)
oyster
Posts: 274
Joined: Oct 11, 2005 10:46

Re: BASIC(modified B++ complier) + wxWidgets

Post by oyster »

dodicat wrote:The file libwxzlib.a (32 bits tested) from wxwidgets " . . .wxWidgets-3.1.3.StaticLibs\lib\gcc_lib32" works OK with FreeBASIC.(With a few name changes)
This file was written in C++ as far as I know.

#inclib "wxzlib"
I haven't tested any others yet.
thank you for the test.

But CPP compiler will use name mangling to give a unique name for functions, and what is more worse, different compilers take different manners during renaming.

Why we can find this kind of man-readable name in wxzlib? Maybe `extern "C" ` is used in the CPP code just like what you have done in the freebasic code.

If you check other files, especially for the GUI part, in wxWidgets, for example, libwxmsw31u_core.a, you can find something like following which make it hard to be used via loading DLL directly.

Code: Select all

	0016A86E  	_ZThn656_N14wxFileListCtrlD1Ev
	0016AAEA  	_ZThn656_N14wxFileListCtrlD0Ev
	0016AD66  	_ZThn656_N14wxDataViewCtrlD1Ev
	0016AFE2  	_ZThn656_N14wxDataViewCtrlD0Ev
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: BASIC(modified B++ complier) + wxWidgets

Post by marcov »

kankouhin7937 wrote:I am a BASIC lover.
I hope BASIC can popular like before, and alive on every platform.
I am not a software architect, I just want to do something for BASIC world, and not waiting for BASIC going to die.
And you thought fracturing the existing community rather than joining an existing team was then a good idea?
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: BASIC(modified B++ complier) + wxWidgets

Post by Imortis »

kankouhin7937 wrote:I am a BASIC lover.
I hope BASIC can popular like before, and alive on every platform.
I am not a software architect, I just want to do something for BASIC world, and not waiting for BASIC going to die.

I hope a team or a group can do anything for me for us. i just happping to write code only.
But...

I am a normal salaryman, i need to work, and after working i need to play with my daughter(Kaya),
i have no enough time to do all of the dreams. I just do what i can do.

Sorry FreeBASIC team, sorry FreeBASIC fans.
you can delete this thread.(i don't known how to delete topic)
In light of this, I think we can lock this thread. If you wish to continue with the wxWidgets discussion, you can make a new thread in the Libraries section.
Locked