1. NQAR2 Attention MIC
Mic:
MakeLib.ex had another problem the first character
of each entry was clipped off.
Change in the while read_line(fn) do ....
From:
symbols = append(symbols,{currLine[2..i1-1],s[2]})
To:
symbols = append(symbols,{currLine[1..i1-1],s[2]})
--=======================================================
If you go to the following mingw32 web site :
Note this is one long URL.
http://programming.ccp14.ac.uk/ftp-mirror/programming
/mingw32/home/janjaap/mingw32/platform-SDK/def/
You will find a complete list of all the definition files
for win32.
The following program code will convert any of these definition
files into your library files. The files have some bad entries
in them but the program will skip them and notify you of the bad
entries. Then you can edit def file and rerun the program.
Note that the entries in these def files are already sorted.
I hacked your code to make the following program. I used
the command_line so it can be used in a batch mode. After you
download the definition files do a DIR with redirection
to create a list for a batch file then you can do them all in one swoop.
--===== CODE FOR DEF2LIB.EX FOLLOWS ============================--
sequence LIBRARY, cmdline
object line
cmdline = command_line()
if length(cmdline) = 3 then
LIBRARY = cmdline[3]
else
puts(1, "\n Enter the name of the def file to parse: ")
LIBRARY = gets(0)
LIBRARY = LIBRARY[1..length(LIBRARY)-1]
puts(1,"\n")
end if
for i = length(LIBRARY) to 1 by -1 do
if equal(LIBRARY[i],'.') then
LIBRARY = LIBRARY[1..i-1]
exit
end if
end for
constant
fd = open(LIBRARY&".def","r"),
ft = open(LIBRARY&".@@@","wb")
while 1 do
line = gets(fd)
if atom(line) then
close(fd)
close(ft)
exit
end if
if find(';',line) or match("EXPORT",line) then
-- skip
elsif match("LIBRARY ",line) then
puts(ft,line[9..length(line)-2]&".DLL"A)
else
puts(ft,"_"&line[1..length(line)])
end if
end while
include file.e
include machine.e
include get.e
include misc.e
integer fn,i1,i2,i3,of
sequence currLine,s,symbols
function read_line(integer infile)
integer read,ch
currLine = {}
read = 0
while 1 do
ch = getc(infile)
if ch = -1 then
exit
elsif ch = #0A then
ch = getc(infile)
exit
elsif ch != #0D then
currLine &= ch
read += 1
end if
end while
return read
end function
fn = open(LIBRARY&".@@@","rb")
of = open(LIBRARY&".lib","wb")
if read_line(fn) then end if
puts(of,currLine&0)
i1 = where(fn)
if and_bits(i1,7) then
i2 = 8-and_bits(i1,7)
for i=0 to i2 do
puts(of,0)
end for
end if
symbols = {}
while read_line(fn) do
i1 = find('@',currLine)
s = value(currLine[i1+1..length(currLine)])
if s[1] or not i1 then
puts(1,"\n Ignoring this bad entry : \""&currLine&"\" in "&
LIBRARY&".def file\n ")
else
symbols = append(symbols,{currLine[1..i1-1],s[2]})
end if
end while
close(fn)
puts(of,int_to_bytes(length(symbols)))
puts(of,int_to_bytes(1))
i2 = where(of)
i3 = 0
for i=1 to length(symbols) do
puts(of,int_to_bytes(i2+(length(symbols)*7)+i3))
i3 += length(symbols[i][1])+1
end for
for i=1 to length(symbols) do
puts(of,{0,0})
end for
for i=1 to length(symbols) do
puts(of,symbols[i][2])
end for
for i=1 to length(symbols) do
puts(of,symbols[i][1]&0)
end for
i1 = where(of)
if and_bits(i1,15) then
i2 = 16-and_bits(i1,15)
for i=1 to i2 do
puts(of,0)
end for
end if
close(of)
system("del " &LIBRARY&".@@@",2)
--===== CODE FOR DEF2LIB.EX ENDS ===============================--
Bernie
2. Re: NQAR2 Attention MIC
>MakeLib.ex had another problem the first character
>of each entry was clipped off.
>Change in the while read_line(fn) do ....
>
>From:
>symbols = append(symbols,{currLine[2..i1-1],s[2]})
>
>To:
> symbols = append(symbols,{currLine[1..i1-1],s[2]})
If you're talking about the underscores, it's supposed to remove them.
3. Re: NQAR2 Attention MIC
>MakeLib.ex had another problem the first character
>of each entry was clipped off.
>Change in the while read_line(fn) do ....
>From:
>symbols = append(symbols,{currLine[2..i1-1],s[2]})
>To:
>symbols = append(symbols,{currLine[1..i1-1],s[2]})
>If you're talking about the underscores, it's supposed to remove them.
MIC:
No it was removing the first 2 characters in the currLine.
The underscore and the first character; instead of just
the underscore.
Bernie