1. Windows Lib ---> Linux Lib, what does it take?
- Posted by Al Getz <Xaxo at aol.com>
Feb 03, 2006
-
Last edited Feb 04, 2006
Hello there,
Anyone have any ideas about what it would take to convert a Windows
library such as WinLib or WinClass to a Linux library? Assume the
Windows libs use many dll's that come with Windows.
What kind of dll's (or similar libs) come with Linux?
Take care,
Al
And, good luck with your Euphoria programming!
My bumper sticker: "I brake for LED's"
2. Re: Windows Lib ---> Linux Lib, what does it take?
- Posted by cklester <cklester at yahoo.com>
Feb 03, 2006
-
Last edited Feb 04, 2006
Al Getz wrote:
>
> Anyone have any ideas about what it would take to convert a Windows
> library such as WinLib or WinClass to a Linux library? Assume the
> Windows libs use many dll's that come with Windows.
> What kind of dll's (or similar libs) come with Linux?
Why wouldn't you just use a library that already works on Windows and Linux?
Try using wxEuphoria first. I think you'll be plenty happy. You'll be able to
start programming applications instead of making a windowing library.
-=ck
"Programming in a state of Euphoria."
http://www.cklester.com/euphoria/
3. Re: Windows Lib ---> Linux Lib, what does it take?
Tested and works try win32lib demos. creates a new file called
wxWhateverFileYouSelewcted.
Run it and test the new file it won't do anything but it should create windows
and buttons.
code-------------------------------------
function find_ctl_name(sequence var) --note '=' is allways going to be last
sequence newvar newvar={}
var=var[1..length(var)-1]--remover last'='
var=w32trim(var)--remove blanks
for x= length(var) to 1 by -1 do
if match(" ",var[x..x]) then
exit
end if
newvar&=var[x..x]
end for
return reverse_word(newvar)
end function
procedure WinMain_found()
data=append(data,"\nwxMain ("&win_name&")")
end procedure
function parse_createEx(sequence line)
integer c,d
sequence var,title,owner,left,top,width,height,a,ctl_type
c=match("=",line)
d=match("(",line)
var=line[1..c]
a=match_all(",",line)
title=line[a[1]+1..a[2]-1]
owner=line[a[2]+1..a[3]-1]
left=line[a[3]+1..a[4]-1]
top=line[a[4]+1..a[5]-1]
width=line[a[5]+1..a[6]-1]
height=line[a[6]+1..a[7]-1]
ctl_type=w32trim(line[d+1..a[1]-1])
a=match_all(" ",var)
ctl_name=find_ctl_name(var)
return {ctl_type,ctl_name,var, owner,title,left,top,width,height}
end function
procedure check_include(sequence inc)
if find(inc,includes) then
return
else
includes=append(includes,inc)
puts(1,"include "&inc&"\n")
puts(fn2,"include\n "&inc&"\n")
end if
end procedure
------------------------------main-----------------------------------
fName = getOpenFileName( 0, "",{"Euphoria Program", "*.EX;*.EXW;*.E;*.EW"} )
fn=open(fName,"r")
a=match_all("\\",fName)
newfile=fName[1..a[$]]&"wx"&fName[a[$]+1..length(fName)]
fn2=open(fName[1..a[$]]&"wx"&fName[a[$]+1..length(fName)],"w")
while 1 do
line=gets(fn)
if atom(line) then
exit
end if
if match("createEx",line) then
e= parse_createEx(line)
if match("Window",e[1]) then
win_name=e[2]
ctype="wxFrame"
check_include("wxEuporia.e")
elsif match("PushButton",e[1]) then--add more controls here
ctype="wxButton"
check_include("wxButton.e")
end if
data =append(data, e[3] & "create(" & ctype & ",{" &
e[4] & ",-1," & e[5] & "," & e[6] & "," & e[7] & "," & e[8] & "," &
e[9] &"})\n")
end if
if match("WinMain",line) then
WinMain_found()
end if
end while
--------------------------second pass------------------------
puts(1,"\n")
puts(fn2,"\n")
for x=1 to length(data)do
printf(1,"%d %s\n",{x,data[x]})
end for
close(fn)
close(fn2)
puts(1,newfile)
puts(1,"\n saved sucessfully")
pause()
Maybe some could add more to it.
Don Cole
A Bug is an un-documented feature.
A Feature is a documented Bug.
4. Re: Windows Lib ---> Linux Lib, what does it take?
Sorry some if it got left out on tha last post.
include win32lib.ew
include get.e
include file.e
sequence fName,ctl_name,newfile,e,win_name,a,ctype,data,includes
integer fn,fn2
object line
data={}
includes={}
win_name={}
function match_all(sequence element,sequence source)
sequence a a={}
for x=1 to length(source) do
if match(element,source[x..x]) then
a= append(a,x)
end if
end for
return a
end function
global procedure pause()
object ii
puts(1,"\n\t[ANY KEY] = Continue [F1] = Force Error [Esc] =
Exit \n")
ii=wait_key()
if ii=27 then
abort(0)
elsif ii=315 then
?9/0
end if
end procedure
function reverse_word(sequence word)
sequence newword newword={}
for x=length(word) to 1 by -1 do
-- printf(1,"%d %s\n",{x,word[x]})
newword &=word[x..x]
end for
return newword
end function
function find_ctl_name(sequence var) --note '=' is allways going to be last
sequence newvar newvar={}
var=var[1..length(var)-1]--remover last'='
var=w32trim(var)--remove blanks
for x= length(var) to 1 by -1 do
if match(" ",var[x..x]) then
exit
end if
newvar&=var[x..x]
end for
return reverse_word(newvar)
end function
procedure WinMain_found()
data=append(data,"\nwxMain ("&win_name&")")
end procedure
function parse_createEx(sequence line)
integer c,d
sequence var,title,owner,left,top,width,height,a,ctl_type
c=match("=",line)
d=match("(",line)
var=line[1..c]
a=match_all(",",line)
title=line[a[1]+1..a[2]-1]
owner=line[a[2]+1..a[3]-1]
left=line[a[3]+1..a[4]-1]
top=line[a[4]+1..a[5]-1]
width=line[a[5]+1..a[6]-1]
height=line[a[6]+1..a[7]-1]
ctl_type=w32trim(line[d+1..a[1]-1])
a=match_all(" ",var)
ctl_name=find_ctl_name(var)
return {ctl_type,ctl_name,var, owner,title,left,top,width,height}
end function
procedure check_include(sequence inc)
if find(inc,includes) then
return
else
includes=append(includes,inc)
puts(1,"include "&inc&"\n")
puts(fn2,"include\n "&inc&"\n")
end if
end procedure
------------------------------main-----------------------------------
fName = getOpenFileName( 0, "",{"Euphoria Program", "*.EX;*.EXW;*.E;*.EW"} )
fn=open(fName,"r")
a=match_all("\\",fName)
newfile=fName[1..a[$]]&"wx"&fName[a[$]+1..length(fName)]
fn2=open(fName[1..a[$]]&"wx"&fName[a[$]+1..length(fName)],"w")
while 1 do
line=gets(fn)
if atom(line) then
exit
end if
if match("createEx",line) then
e= parse_createEx(line)
if match("Window",e[1]) then
win_name=e[2]
ctype="wxFrame"
check_include("wxEuporia.e")
elsif match("PushButton",e[1]) then--add more controls here
ctype="wxButton"
check_include("wxButton.e")
end if
data =append(data, e[3] & "create(" & ctype & ",{" &
e[4] & ",-1," & e[5] & "," & e[6] & "," & e[7] & "," & e[8] & "," &
e[9] &"})\n")
end if
if match("WinMain",line) then
WinMain_found()
end if
end while
--------------------------second pass------------------------
puts(1,"\n")
puts(fn2,"\n")
for x=1 to length(data)do
printf(1,"%d %s\n",{x,data[x]})
end for
close(fn)
close(fn2)
puts(1,newfile)
puts(1,"\n saved sucessfully")
pause()
Don Cole
A Bug is an un-documented feature.
A Feature is a documented Bug.
5. Re: Windows Lib ---> Linux Lib, what does it take?
cklester wrote:
>
> Al Getz wrote:
> >
> > Anyone have any ideas about what it would take to convert a Windows
> > library such as WinLib or WinClass to a Linux library? Assume the
> > Windows libs use many dll's that come with Windows.
> > What kind of dll's (or similar libs) come with Linux?
>
> Why wouldn't you just use a library that already works on Windows and Linux?
>
> Try using wxEuphoria first. I think you'll be plenty happy. You'll be able to
> start programming applications instead of making a windowing library.
>
> -=ck
> "Programming in a state of Euphoria."
> <a
> href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a>
Hello there,
If i had Linux installed i guess i would try wxE first, but then again
because WinClass is my own creation it's made according to my own
philosophies for how programming should be done. There are many ideas
that come into play here, and when i program with my own Lib i feel that
i am programming in the best way that i can. Of course one question i
can ask is how extensible is wxE, because if i want to add a 'class'
(in the same way that i can with WinClass) can i do whatever i want
or is there some limitation/ideal that will prevent that...
If there are no such limits then perhaps i could do that too.
I like my own lib a lot however, so it would take a lot of convincing
to get me to switch
I could use both though perhaps.
Take care,
Al
And, good luck with your Euphoria programming!
My bumper sticker: "I brake for LED's"