Posts: 489
Threads: 34
Joined: Jan 2005
umm the threading example no longer compiles, it tells me it can't find -lfbmt... and threadcreate in general seems to like being annoying (my calls to it are coming up with random errors even though it worked fine with lillo's build)
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Posts: 489
Threads: 34
Joined: Jan 2005
and this is starting to scare me...
Code: for i=0 to ubound(FB_StyledText)-1
print i,FB_StyledText(i)
next
redim preserve FB_StyledText(ubound(FB_StyledText)-1)
for i=0 to ubound(FB_StyledText)
print i,FB_StyledText(i)
next
output:
Code: 0 9495056
1 6
0 0
1 0
:???:
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Posts: 922
Threads: 15
Joined: Jun 2003
There are 2 versions now of the rtlib, one for single-threaded apps with no mutexes and no bloat or slowdown that most would complain about, and another version that is thread-safe, the mt one, to build the mt lib, set a env-var called MULTITHREADED to any value, do a make clean and make.
Posts: 489
Threads: 34
Joined: Jan 2005
hrm, ok now the sample works, but my code no longer works...
Code: fbiide.bas(1005) : error 40: Expected 'END SUB' or 'END FUNCTION', found: 'threa
dcreate'
threadcreate( @Runn, maxthread )
^
:???: do you want to see the code?
[edit]
um here's the sub it was in:
Code: sub OnCompileRun(byval event as long)
maxthread+=1
threadcreate( @Runn, maxthread )
end sub
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Posts: 922
Threads: 15
Joined: Jun 2003
Fixed.. threadcreate became a "special" function to change automagically the rtlib to the mt version when it's used, and it was not been allowed to be called as a SUB, changes are in CVS..
You can do res = threadcreate( ... ) by now while SF doesn't update the anonymous access..
Posts: 489
Threads: 34
Joined: Jan 2005
ok thanks, now my code semi-works again
except for the redim preserve strangeness
also (this is probably my problem) FB__WIN32 is no longer defined.
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Posts: 922
Threads: 15
Joined: Jun 2003
Yeah, that's in the changelog:
Quote:- FB__* built-in #defines are now named __FB_*__, please update your code if you used them! (lillo)
- New built-in dynamic #defines: __FILE__, __FUNCTION__, __LINE__, __DATE__ and __TIME__ (lillo)
Dunno about redim preserve, it wasn't changed but to add multi-threading support, i'll take a look asap..
Posts: 489
Threads: 34
Joined: Jan 2005
v1c, here's a minimal-ish example of the buggy code:
Code: '$include: "libwx-c.bi"
option escape
declare sub inittoolbar()
declare sub initmenus()
declare sub inittext()
declare sub OnCloseTab(byval event as long,byval listener as long)
declare sub addtab()
dim shared wx_app,wx_frame,wx_tab
redim preserve shared FB_StyledText(1) as integer,filename(1) as string',id() as integer
enum FBids
FBMainFrameID = wxID_HIGHEST
FileMenu_Close
end enum
sub inittext()
FB_StyledText(wxNotebook_GetSelection(wx_tab)+1) = wxStyledTextCtrl_ctor (wx_tab,FBMainTextField,wxsize_ctor(-1,-1),wxsize_ctor(-1,-1),wxSUNKEN_BORDER or wxVSCROLL,0)
wxNotebook_AddPage(wx_tab,FB_StyledText(wxNotebook_GetSelection(wx_tab)+1),FileName(wxNotebook_GetSelection(wx_tab)),TRUE,-1)
wxStyledTextCtrl_CreateDocument(FB_StyledText(wxNotebook_GetSelection(wx_tab)))
end sub
sub App_OnInit ()
wx_Frame = wxFrame_ctor ()
wxFrame_Create (wx_Frame, 0, FBMainFrameID, "FBIde", wxSize_ctor ( -1, -1), wxSize_ctor ( -1, -1), wxDEFAULT_FRAME_STYLE or wxCLOSE_BOX, "frame" )
redim preserve FB_StyledText(1) as integer
inittoolbar
wx_tab=wxNotebook_ctor()
wxNotebook_Create(wx_tab,wx_frame,-1,wxSize_ctor(-1,-1),wxSize_ctor(-1,-1),0,0)
filename(wxNotebook_GetSelection(wx_tab))="noname"
inittext
initmenus
addtab
wxWindow_Show ( wx_frame, 1)
wxApp_OnInit(wx_app)
end sub
sub App_OnExit()
wxApp_OnExit(wx_app)
end sub
sub inittoolbar()
tooba=wxFrame_CreateToolBar(wx_frame,style,toolbar,0)
wxToolBar_AddTool1 (tooba,FileMenu_Close,0,wxbitmap_ctor(),wxbitmap_ctor(),0,"Close file (Ctrl+F4)",0,0)
wxToolBar_Realize(tooba)
end sub
sub initmenus()
wxEvtHandler_proxy( wx_frame, @OnCloseTab )
wxEvtHandler_connect(wx_frame,wxEvent_EVT_COMMAND_MENU_SELECTED(),FileMenu_Close,-1,0)
end sub
sub OnCloseTab(byval event as long,byval listener as long)
if (wxNotebook_GetPageCount(wx_tab)=1) then
wxStyledTextCtrl_SetText(FB_StyledText(wxNotebook_GetSelection(wx_tab)),0)
else
oldtab=wxNotebook_GetSelection(wx_tab)
wxNotebook_DeletePage(wx_tab,oldtab)
for i=oldtab to ubound(FB_StyledText)-1
FB_StyledText(i)=FB_StyledText(i+1)
next
for i=0 to ubound(FB_StyledText)-1
print i,FB_StyledText(i)
next
redim preserve FB_StyledText(ubound(FB_StyledText)-1)
for i=0 to ubound(FB_StyledText)
print i,FB_StyledText(i)
next
end if
end sub
sub addtab()
redim preserve FB_StyledText(wxNotebook_GetPageCount(wx_tab)+1) as integer,filename(wxNotebook_GetPageCount(wx_tab)+1) as string
FB_StyledText(wxNotebook_GetPageCount(wx_tab)) = wxStyledTextCtrl_ctor (wx_tab,HelpMenu_About+wxNotebook_GetPageCount(wx_tab)+1,wxsize_ctor(-1,-1),wxsize_ctor(-1,-1),wxSUNKEN_BORDER or wxVSCROLL,0)
FileName(wxNotebook_GetPageCount(wx_tab))="noname"
wxNotebook_AddPage(wx_tab,FB_StyledText(wxNotebook_GetPageCount(wx_tab)),FileName(wxNotebook_GetSelection(wx_tab)),TRUE,-1)
wxStyledTextCtrl_CreateDocument(FB_StyledText(wxnotebook_getselection(wx_tab)))
wxNotebook_SetPageText(wx_tab,wxNotebook_GetSelection(wx_tab),FileName(wxNotebook_GetSelection(wx_tab)))
end sub
wx_app = wxApp_ctor()
wxApp_RegisterVirtual ( wx_app, @App_OnInit, @App_OnExit)
wxApp_Run(0,0)
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Posts: 922
Threads: 15
Joined: Jun 2003
wxNotebook_GetSelection is returning -1 when nothing is selected in two cases, and in one you are assigning a string to it (filename(...)="noname"), causing the heap to get trashed -- compile with -e and you will see a run-time error.
Posts: 489
Threads: 34
Joined: Jan 2005
thanks
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
|