Cross Reference update

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Cross Reference update

Post by Seb McClouth »

Hey

Guys once again I'm here to get your help.

As said, I'm working on a Cross Referencer for Novix, as a support tool for QBinux.
I also use some Novix code and here's the deal:
While breaking up a line from a file in several pieces with the FUNCTION's Crack & GetCracked something goes wrong. I'm running the code in XP due to the extended dir-functions we don't have in DosBox.

First and all, here's the source of the entire XR:

Code: Select all

DECLARE FUNCTION Crack$ (s AS STRING, seperator AS STRING, DoNotRemoveQuote AS INTEGER)
DECLARE FUNCTION GetCracked$ (s AS STRING, index AS INTEGER)
DECLARE FUNCTION trim$ (char AS STRING)
DECLARE SUB MakeFooter (filenr!)
DECLARE SUB MakeHTML ()
DECLARE SUB MakeFileExtend (filenr!, FileName AS STRING)
DECLARE SUB MakeDirExtend (filenr!, DirName AS STRING)
DECLARE SUB MakeDirBase (filenr!)
DECLARE FUNCTION MakeDirFile$ (map AS STRING, dirmap AS INTEGER, filemap AS INTEGER)
DECLARE SUB MakeHTM
DECLARE FUNCTION ten$ (var!)
DECLARE FUNCTION strim$ (strvar!)
DECLARE SUB Make (map1 AS STRING, map2 AS STRING)
DECLARE SUB MakeHeader (filenr!, title AS STRING, baseurl AS STRING)

DIM SHARED banner AS STRING
DIM SHARED DirFile AS STRING
DIM SHARED FileFile AS STRING
DIM SHARED Server AS STRING
DIM SHARED TempServer AS STRING

banner = "Novix v2.5.0.4 / Xivon v11.4"

PRINT "Cross Reference Builder ?0.1"
PRINT "Copyright (C) 2008, McClouth Software"
PRINT "Written by Sebastian McClouth"
PRINT "....................................."
INPUT "Map: ", map$

Server = map$

TempServer = "tmp\" + Server

MakeHTML

FUNCTION Crack$ (s AS STRING, seperator AS STRING, DoNotRemoveQuote AS INTEGER)
IF INSTR(s, seperator) THEN
        FOR a = 1 TO LEN(s$)
                g$ = MID$(s$, a, 1)
                IF g$ = LEFT$(seperator, 1) AND inq = 0 THEN
                        IF a < LEN(s$) THEN
                                IF LEN(seperator) = 2 THEN pp = 1 ELSE pp = 0
                                IF MID$(s$, a + pp, 1) = RIGHT$(seperator, 1) THEN
                                        fstr$ = fstr$ + CHR$(LEN(nstr$)) + nstr$
                                        nstr$ = ""
                                        tnum = tnum + 1
                                END IF
                        END IF
                ELSEIF g$ = CHR$(34) AND inq = 1 THEN
                        inq = 0
                        IF DoNotRemoveQuote <0> 255 THEN nstr$ = LEFT$(nstr$, 255)
                        END IF
                ELSEIF g$ = CHR$(34) AND inq = 0 THEN
                        inq = 1
                        IF DoNotRemoveQuote <0> 255 THEN nstr$ = LEFT$(nstr$, 255)
                        END IF
                ELSE
                        nstr$ = nstr$ + g$
                        IF LEN(nstr$) > 255 THEN nstr$ = LEFT$(nstr$, 255)
                END IF
                IF tnum >= 128 THEN EXIT FOR
        NEXT
        fstr$ = fstr$ + CHR$(LEN(nstr$)) + nstr$
        tnum = tnum + 1
        Crack$ = MKI$(tnum) + fstr$
ELSE
        Crack$ = MKI$(1) + CHR$(LEN(s)) + s
END IF
END FUNCTION

FUNCTION GetCracked$ (s AS STRING, index AS INTEGER)
IF LEN(s) < 2 THEN EXIT FUNCTION
max = CVI(LEFT$(s, 2))
IF index <1> max THEN EXIT FUNCTION
offs = 3
FOR a = 1 TO index
        m$ = MID$(s, offs + 1, ASC(MID$(s, offs, 1)))
        offs = offs + 1 + LEN(m$)
NEXT
GetCracked$ = m$
END FUNCTION

SUB MakeDirBase (filenr)
PRINT #filenr, "<table>"
PRINT #filenr, "  <tr>"
PRINT #filenr, "    <td>"
PRINT #filenr, "    <td><b>Name</b>"
PRINT #filenr, "    <td><b>Size</b>"
PRINT #filenr, "    <td><b>Last modified (GMT)</b>"
PRINT #filenr, "    <td><b>Description</b>"
END SUB

SUB MakeDirExtend (filenr, DirName AS STRING)
PRINT #filenr, "  <tr>"
PRINT #filenr, "    <td>"
PRINT #filenr, "    <td><a href=" + CHR$(34) + Server + ">" + DirName + "</a>"
PRINT #filenr, "    <td>"
PRINT #filenr, "    <td>"
PRINT #filenr, "    <td>"
END SUB

FUNCTION MakeDirFile$ (map AS STRING, dirmap AS INTEGER, filemap AS INTEGER)
IF dirmap > 0 THEN
        mapdir$ = LEFT$(map, 8) + ".dir"
        SHELL "dir /b /ad " + map + " >" + mapdir$
ELSEIF filemap > 0 THEN
        mapdir$ = LEFT$(map, 8) + ".fil"
        SHELL "dir /b /a-d " + map + " >" + mapdir$
END IF
MakeDirFile = mapdir$
END FUNCTION

SUB MakeFileExtend (filenr, FileName AS STRING)
PRINT #filenr, "  <tr>"
PRINT #filenr, "    <td>"
PRINT #filenr, "    <td><a href=" + CHR$(34) + Server + ">" + FileName + "</a>"
PRINT #filenr, "    <td>"
PRINT #filenr, "    <td>"
PRINT #filenr, "    <td>"
END SUB

SUB MakeFooter (filenr2)
PRINT #filenr2, "<hr>"
PRINT #filenr2, "<center>"
PRINT #filenr2, "<i>The original LXR software by the <a href=" + CHR$(34) + ">LXR Community</a>, this experimental version by <a href=" + CHR$(34) + ">McClouth software</a> for Novix (by Z!re).<br>"
PRINT #filenr2, "McClouth Software and NXR kindly hosted by <a href=" + CHR$(34) + ">ZoasterTech</a>."
PRINT #filenr2, ""
PRINT #filenr2, "</body>"
PRINT #filenr2, "</html>"
END SUB

SUB MakeHeader (filenr, title AS STRING, baseurl AS STRING)
PRINT #filenr, "<doctype>"
PRINT #filenr, "<html>"
PRINT #filenr, "<head>"
PRINT #filenr, "<title>" + title + "</title>"
PRINT #filenr, "<base>"
PRINT #filenr, ""
PRINT #filenr, "<body>"
PRINT #filenr, ""
PRINT #filenr, "<h1>"
PRINT #filenr, "  <a href=" + CHR$(34) + ">"
PRINT #filenr, "    McClouth Software</a>"
PRINT #filenr, "  <a href=" + CHR$(34) + ">"
PRINT #filenr, "    Novix Cross Reference</a><br>"
PRINT #filenr, banner
PRINT #filenr, "</h1>"
PRINT #filenr, ""
PRINT #filenr, "<hr>"

END SUB

SUB MakeHTML
DirFile = MakeDirFile(Server, 1, 0)
FileFile = MakeDirFile(Server, 0, 1)
PRINT "Processing " + Server + "..."
REM SHELL "MD " + tempServer
ff = FREEFILE
OPEN DirFile FOR INPUT AS #ff
        ff2 = FREEFILE
        OPEN TempServer + "\index.htm" FOR OUTPUT AS #ff2
                MakeHeader ff2, "NXR - " + Server, "http://mcclouth.zoastertech.com/nxr/index.htm"
                MakeDirBase ff2
        DO WHILE NOT EOF(ff)
                LINE INPUT #ff, temp$
                MakeDirExtend ff2, temp$
        LOOP
        ff3 = FREEFILE
        OPEN FileFile FOR INPUT AS #ff3
                DO WHILE NOT EOF(ff3)
                        LINE INPUT #ff3, temp$
                        IF temp$ = "INDEX.HTM" THEN
                        ELSE
                          MakeFileExtend ff2, temp$
                          ff4 = FREEFILE
                          PRINT temp$
                          OPEN Server + "\" + temp$ FOR INPUT AS #ff4
                                ff5 = FREEFILE
                                OPEN TempServer + "\" + temp$ FOR OUTPUT AS #ff5
                                        MakeHeader ff5, "NXR - " + Server + "\" + temp$, "http://mcclouth.zoastertech.com/nxr/index.htm"
                                        DO WHILE NOT EOF(ff4)
                                                LINE INPUT #ff4, Temp2$
                                                IF LEFT$(Temp2$, 2) = "bc" THEN
                                                        Temp2$ = trim(Temp2$)
                                                        Temp2$ = Crack(Temp2$, " ", 0)
                                                        Last% = CVI(LEFT$(Temp2$, 2))
                                                        IF RIGHT$(GetCracked(Temp2$, Last%), 1) = ";" THEN
                                                          PRINT #ff5, LEFT$(Temp2$, LEN(Temp2$) - LEN(GetCracked(Temp2$, Last%))) + "<a href=" + CHR$(34) + LEFT$(Temp2$, LEN(Temp2$) - 1) + CHR$(34) + ">" + LEFT$(Temp2$, LEN(Temp2$) - 1) + "</a>" +  _
RIGHT$(Temp2$, 1)
                                                        ELSE
                                                          PRINT #ff5, Temp2$
                                                       END IF
                                                END IF
                                                PRINT #ff5, Temp2$ + "<br>"
                                        LOOP
                                        MakeFooter ff5
                                CLOSE #ff5
                          CLOSE #ff4
                        END IF
                LOOP
        CLOSE #ff3
        PRINT #ff2, "</table>"
        MakeFooter ff2
        CLOSE #ff2
CLOSE ff
END SUB

FUNCTION strim$ (strvar)
strim$ = trim$(STR$(strvar))
END FUNCTION

FUNCTION ten$ (var)
tempten$ = strim$(var)
END FUNCTION

FUNCTION trim$ (char AS STRING)
trim$ = LTRIM$(RTRIM$(char))
END FUNCTION
This is the file I'm converting to HTML:

Code: Select all

@echo off

bin\numinc.exe

del *.obj
del Novix.exe
bc /o /Ot /Fs /G2 /Fpi /E /X bin\nvx25.ns5;
bc /o /Ot /Fs /G2 /Fpi /E /X bin\compiler.ns5;
bc /o /Ot /Fs /G2 /Fpi /E /X bin\execute.ns5;
bc /o /Ot /Fs /G2 /Fpi /E /X bin\nvxcode.ns5;
bc /o /Ot /Fs /G2 /Fpi /E /X bin\wrapper.ns5;
bc /o /Ot /Fs /G2 /Fpi /E /X bin\gui.ns5;
bc /o /Ot /Fs /G2 /Fpi /E /X bin\NVXFS.ns5;
pause
bc /o /Ot /Fs /G2 /Fpi /E /X bin\INCFILES.ns5;

ren nvx25.obj a.obj
ren compiler.obj b.obj
ren execute.obj c.obj
ren nvxcode.obj d.obj
ren wrapper.obj e.obj
ren gui.obj f.obj
ren NVXFS.obj g.obj
ren incfiles.obj h.obj

link a+b+c+d+e+f+(g)+(h),,nul,lib\novix.lib+c:\bc7\lib\bcl71efr.lib;

ren a.exe Novix.exe
del *.obj
And for some odd reason, this is the outcome:

Code: Select all

<doctype>
<html>
<head>
<title>NXR - novix25\COMPILE.BAT</title>
<base>

<body>

<h1>
  <a href="http://mcclouth.zoastertech.com">
    McClouth Software</a>
  <a href="http://mcclouth.zoastertech.com/nxr/index.htm">
    Novix Cross Reference</a><br>
Novix v2.5.0.4 / Xivon v11.4
</h1>

<hr>
@echo off<br>
<br>
bin\numinc.exe<br>
<br>
del *.obj<br>
del Novix.exe<br>
	 bc/o/Ot/Fs/G2/Fpi/E/X<a href="	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\nvx25.ns5">	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\nvx25.ns5</a>;
	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\nvx25.ns5;<br>
	 bc/o/Ot/Fs/G2/Fpi/E/X<a href="	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\compiler.ns5">	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\compiler.ns5</a>;
	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\compiler.ns5;<br>
	 bc/o/Ot/Fs/G2/Fpi/E/X<a href="	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\execute.ns5">	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\execute.ns5</a>;
	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\execute.ns5;<br>
	 bc/o/Ot/Fs/G2/Fpi/E/X<a href="	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\nvxcode.ns5">	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\nvxcode.ns5</a>;
	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\nvxcode.ns5;<br>
	 bc/o/Ot/Fs/G2/Fpi/E/X<a href="	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\wrapper.ns5">	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\wrapper.ns5</a>;
	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\wrapper.ns5;<br>
	 bc/o/Ot/Fs/G2/Fpi/E/X<a href="	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\gui.ns5">	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\gui.ns5</a>;
	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\gui.ns5;<br>
	 bc/o/Ot/Fs/G2/Fpi/E/X<a href="	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\NVXFS.ns5">	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\NVXFS.ns5</a>;
	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\NVXFS.ns5;<br>
pause<br>
	 bc/o/Ot/Fs/G2/Fpi/E/X<a href="	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\INCFILES.ns5">	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\INCFILES.ns5</a>;
	 bc/o/Ot/Fs/G2/Fpi/E/Xbin\INCFILES.ns5;<br>
<br>
ren nvx25.obj a.obj<br>
ren compiler.obj b.obj<br>
ren execute.obj c.obj<br>
ren nvxcode.obj d.obj<br>
ren wrapper.obj e.obj<br>
ren gui.obj f.obj<br>
ren NVXFS.obj g.obj<br>
ren incfiles.obj h.obj<br>
<br>
link a+b+c+d+e+f+(g)+(h),,nul,lib\novix.lib+c:\bc7\lib\bcl71efr.lib;<br>
<br>
ren a.exe Novix.exe<br>
del *.obj<br>
<hr>
<center>
<i>The original LXR software by the <a href="http://sourceforge.net/projects/lxr">LXR Community</a>, this experimental version by <a href="mailto:mcclouth.software@gmail.com">McClouth software</a> for Novix (by Z!re).<br>
McClouth Software and NXR kindly hosted by <a href="http://zoastertech.com">ZoasterTech</a>.

</body>
</html>
I was trying to get the file-part of the line with bc, so I could create a link to it, but due to characters in between, it doesn't work... Can someone help me out here?

THx
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows »

IT seems that one of two things is happening here.

That weird character i'm not sure what it is, but it seems that perhaps in that file the space was replaced with maybe an CHR$(240). You'd just need to replace them back I think
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

I've the code before and it worked... even on XP... when running Novix it doesn't have the problem...

From what I know, you use Crack to crack it up and use GetCracked to get the parts... so GetCracked should take care of it... but somehow doesn't...

But thx for baring with me on this!

grtz
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

I think I know why I get the problem. I did some rechecking on what you said Mystik and I forgot an important thing.
The characters inbetween are indeed removed by GetCracked and there for

Code: Select all

IF LEFT$(Temp2$, 2) = "bc" THEN
                                                        Temp2$ = trim(Temp2$)
                                                        Temp2$ = Crack(Temp2$, " ", 0)
                                                        Last% = CVI(LEFT$(Temp2$, 2))
                                                        IF RIGHT$(GetCracked(Temp2$, Last%), 1) = ";" THEN
                                                          PRINT #ff5, LEFT$(Temp2$, LEN(Temp2$) - LEN(GetCracked(Temp2$, Last%))) + "<a href=" + CHR$(34) + LEFT$(Temp2$, LEN(Temp2$) - 1) + CHR$(34) + ">" + LEFT$(Temp2$, LEN(Temp2$) - 1) + "</a>" +  _
RIGHT$(Temp2$, 1) 
is not correct.

At this moment I'm working on the repair of this 'bug'.
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

and finally I figured it out.

Code: Select all

IF LEFT$(Temp2$, 2) = "bc" THEN
                                                        Temp2$ = trim(Temp2$)
                                                        Temp2$ = Crack(Temp2$, " ", 0)
                                                        IF GetCracked(Temp2$, 1) = "bc" THEN
                                                                Last% = CVI(LEFT$(Temp2$, 2))
                                                                IF RIGHT$(GetCracked(Temp2$, Last%), 1) = ";" THEN
                                                                        sourcelinkname$ = LEFT$(GetCracked(Temp2$, Last%), LEN(GetCracked(Temp2$, Last%)) - 1)
                                                                        FOR retri% = 1 TO Last% - 1
                                                                        IF retri% = 1 THEN
                                                                                LeftLine2Right$ = GetCracked(Temp2$, 1)
                                                                        ELSE
                                                                                LeftLine2Right$ = LeftLine2Right$ + " " + GetCracked(Temp2$, retri%)
                                                                        END IF
                                                                        NEXT
                                                                END IF
                                                                PRINT #ff5, LeftLine2Right$ + " <a href=" + CHR$(34) + sourcelinkname$ + ">" + sourcelinkname$ + "</a>" + RIGHT$(GetCracked(Temp2$, Last%), 1) + "<br>"
                                                        ELSE
                                                          PRINT #ff5, Temp2$
                                                       END IF
                                                ELSE
                                                        PRINT #ff5, Temp2$ + "<br>"
                                                END IF
is doing the trick.

Thx Mystic for pointing me to this after all.
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows »

You're very welcome Seb. Just a hunch I had, I'm glad it helped you figure it out. :)
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

A second opinion never hurts! And glad ppl are willing to help...

Thx again.
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

You guys have seen the code, and I need some more help.

I need the program to 'automatically'... Lemme explain

say we have the following:

Code: Select all

-root
 |-submap 1
 |-submap 2
 | |-submap 2.1
 | | |-submap 2.1.1
 | |-submap 2.2
 | | |-submap 2.2.1
 |-submap 3
My code can generate the a dirfile with root, containing submap 1,2 and 3... Now I want my program to automatically process the maps, starting with the first, reading it's dir & files (if any) and make a html of then, etc, etc.

Any idea's?
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

Another update...

I'm almost there... Now I've got the problem that when QB has to open a file with filenumber 16 (when there's 15 open) it can't... And ofcourse I get the "Too Many Files" error.

Maybe someone can shine his/her light over the code. Just remember I still have to implent the routines for the file-sections.

Code: Select all

DECLARE FUNCTION MakeLink$ (filename$, Path$, typ!)
DECLARE SUB MakeFooter (filenr2!)
DECLARE SUB MakeDirHeader (filenr!)
DECLARE SUB MakeHeader (filenr!, title AS STRING, baseurl AS STRING)
DECLARE FUNCTION Crack$ (s AS STRING, seperator AS STRING, DoNotRemoveQuote AS INTEGER)
DECLARE FUNCTION GetCracked$ (s AS STRING, index AS INTEGER)
DECLARE FUNCTION Replace$ (charc AS STRING, strg1 AS STRING, strg2 AS STRING)
DECLARE FUNCTION strim$ (strvar!)
DECLARE FUNCTION trim$ (char AS STRING)
DECLARE FUNCTION CreateDirList$ (filename AS STRING)
DIM SHARED banner AS STRING
DIM SHARED maplist AS STRING
DIM SHARED MapName AS STRING
DIM SHARED MapName2 AS STRING
DIM SHARED MapName3 AS STRING
DIM SHARED MapName4 AS STRING
DIM SHARED Server AS STRING
DIM SHARED SourceMap AS STRING
DIM SHARED TempServer AS STRING

banner = "Novix v2.5.0.4 / Xivon v11.4"

PRINT

PRINT "Cross Reference Builder ?0.1.4"
PRINT "Copyright (C) 2008, McClouth Software"
PRINT "Written by Sebastian McClouth"
PRINT "....................................."
INPUT "Source map: ", SourceMap

Server = SourceMap

TempServer = "tmp\" + Server

PRINT "Processing " + UCASE$(SourceMap) + "..."

PRINT "Building TREE:"
PRINT "\" + UCASE$(SourceMap)

maplist = CreateDirList(SourceMap)

ff = FREEFILE
OPEN maplist FOR INPUT AS #ff
ff2 = FREEFILE
OPEN TempServer + "\index.htm" FOR OUTPUT AS #ff2
MakeHeader ff2, "NXR " + SourceMap + "/", "http://mcclouth.zoastertech.com/nxr"
MakeDirHeader ff2
DO WHILE NOT EOF(ff)
        LINE INPUT #ff, MapName
        PRINT #ff2, "  <tr>"
        PRINT #ff2, "    <td>" + MakeLink$(MapName, SourceMap, 0)
        PRINT #ff2, "  </tr>"
        PRINT "?--- " + UCASE$(MapName)

        maplist = CreateDirList(SourceMap + "\" + MapName)
        
        ff3 = FREEFILE
        OPEN maplist FOR INPUT AS #ff3
        ff4 = FREEFILE
        OPEN TempServer + "\" + MapName + "\index.htm" FOR OUTPUT AS #ff4
        MakeHeader ff4, "NXR " + SourceMap + "/" + MapName + "/", "http://mcclouth.zoastertech.com/nxr"
        MakeDirHeader ff4
        DO WHILE NOT EOF(ff3)
                LINE INPUT #ff3, MapName2
                PRINT #ff4, "  <tr>"
                PRINT #ff4, "    <td>" + MakeLink$(MapName2, SourceMap + "/" + MapName, 0)
                PRINT #ff4, "  </tr>"
                PRINT "?     ?--- " + UCASE$(MapName2)

                maplist = CreateDirList(SourceMap + "\" + MapName + "\" + MapName2)

                ff5 = FREEFILE
                OPEN maplist FOR INPUT AS #ff5
                ff6 = FREEFILE
                OPEN TempServer + "\" + MapName + "\" + MapName2 + "\index.htm" FOR OUTPUT AS #ff6
                MakeHeader ff6, "NXR " + SourceMap + "/" + MapName + "/" + MapName2 + "/", "http://mcclouth.zoastertech.com/nxr"
                MakeDirHeader ff6
                DO WHILE NOT EOF(ff5)
                        LINE INPUT #ff5, MapName3
                        PRINT #ff6, "  <tr>"
                        PRINT #ff6, "    <td>" + MakeLink$(MapName3, SourceMap + "/" + MapName + "/" + MapName2, 0)
                        PRINT #ff6, "  </tr>"
                        PRINT "?     ?     ?--- " + UCASE$(MapName3)

                        maplist = CreateDirList(SourceMap + "\" + MapName + "\" + MapName2 + "\" + MapName3)

                        ff7 = FREEFILE
                        OPEN maplist FOR INPUT AS #ff7
                        ff8 = FREEFILE
                        OPEN TempServer + "\" + MapName + "\" + MapName2 + "\" + MapName3 + "\index.htm" FOR OUTPUT AS #ff8
                        MakeHeader ff8, "NXR " + SourceMap + "/" + MapName + "/" + MapName2 + "/" + MapName3 + "/", "http://mcclouth.zoastertech.com/nxr"
                        MakeDirHeader ff8
                        DO WHILE NOT EOF(ff7)
                                LINE INPUT #ff7, MapName4
                                PRINT #ff8, "  <tr>"
                                PRINT #ff8, "    <td>" + MakeLink$(MapName4, SourceMap + "/" + MapName + "/" + MapName2 + "/" + MapName3 + "/" + MapName4, 0)
                                PRINT #ff8, "  </tr>"
                                PRINT "?     ?     ?      ?--- " + UCASE$(MapName4)
                        LOOP
                        PRINT #ff8, "</tr>"
                        PRINT #ff8, "</table>"
                        MakeFooter ff8
                        CLOSE #ff7

                LOOP
                PRINT #ff6, "</tr>"
                PRINT #ff6, "</table>"
                MakeFooter ff6
                CLOSE #ff6
                CLOSE #ff5

        LOOP
        PRINT #ff4, "</tr>"
        PRINT #ff4, "</table>"
        MakeFooter ff4
        CLOSE #ff4
        CLOSE #ff3

LOOP
PRINT #ff2, "</tr>"
PRINT #ff2, "</table>"
MakeFooter ff2
CLOSE #ff2
CLOSE #ff

FUNCTION Crack$ (s AS STRING, seperator AS STRING, DoNotRemoveQuote AS INTEGER)
IF INSTR(s, seperator) THEN
        FOR a = 1 TO LEN(s$)
                g$ = MID$(s$, a, 1)
                IF g$ = LEFT$(seperator, 1) AND inq = 0 THEN
                        IF a < LEN(s$) THEN
                                IF LEN(seperator) = 2 THEN pp = 1 ELSE pp = 0
                                IF MID$(s$, a + pp, 1) = RIGHT$(seperator, 1) THEN
                                        fstr$ = fstr$ + CHR$(LEN(nstr$)) + nstr$
                                        nstr$ = ""
                                        tnum = tnum + 1
                                END IF
                        END IF
                ELSEIF g$ = CHR$(34) AND inq = 1 THEN
                        inq = 0
                        IF DoNotRemoveQuote <0> 255 THEN nstr$ = LEFT$(nstr$, 255)
                        END IF
                ELSEIF g$ = CHR$(34) AND inq = 0 THEN
                        inq = 1
                        IF DoNotRemoveQuote <0> 255 THEN nstr$ = LEFT$(nstr$, 255)
                        END IF
                ELSE
                        nstr$ = nstr$ + g$
                        IF LEN(nstr$) > 255 THEN nstr$ = LEFT$(nstr$, 255)
                END IF
                IF tnum >= 128 THEN EXIT FOR
        NEXT
        fstr$ = fstr$ + CHR$(LEN(nstr$)) + nstr$
        tnum = tnum + 1
        Crack$ = MKI$(tnum) + fstr$
ELSE
        Crack$ = MKI$(1) + CHR$(LEN(s)) + s
END IF
END FUNCTION

FUNCTION CreateDirList$ (filename AS STRING)
filename2$ = filename
IF INSTR(filename, "\") THEN
        slashcount = 0
        FOR cdl = 1 TO LEN(filename)
                IF MID$(filename, cdl, 1) = "\" THEN
                        slashcount = slashcount + 1
                        slashlast = cdl
                END IF
        NEXT
        filename2$ = RIGHT$(filename, LEN(filename) - slashlast)
END IF
filename3$ = LEFT$(filename2$, 8) + ".dir"
CreateDirList = filename3$

SHELL "dir /ad /on /b " + filename + " > " + filename3$
END FUNCTION

FUNCTION GetCracked$ (s AS STRING, index AS INTEGER)
IF LEN(s) < 2 THEN EXIT FUNCTION
max = CVI(LEFT$(s, 2))
IF index <1> max THEN EXIT FUNCTION
offs = 3
FOR a = 1 TO index
        m$ = MID$(s, offs + 1, ASC(MID$(s, offs, 1)))
        offs = offs + 1 + LEN(m$)
NEXT
GetCracked$ = m$
END FUNCTION

SUB MakeDirHeader (filenr)
PRINT #filenr, "<table>"
PRINT #filenr, "  <tr>"
PRINT #filenr, "    <td><b>Name</b>"
PRINT #filenr, "    <td><b>Size</b>"
PRINT #filenr, "    <td><b>Last modified (GMT)</b>"
PRINT #filenr, "    <td><b>Description</br>"
PRINT #filenr, "  </tr>"
END SUB

SUB MakeFooter (filenr2)
PRINT #filenr2, "<hr>"
PRINT #filenr2, "<center>"
PRINT #filenr2, "<i>The original LXR software by the <a href=" + CHR$(34) + ">LXR Community</a>, this experimental version by <a href=" + CHR$(34) + ">McClouth software</a> for Novix (by Z!re).<br>"
PRINT #filenr2, "McClouth Software and NXR kindly hosted by <a href=" + CHR$(34) + ">ZoasterTech</a>."
PRINT #filenr2, ""
PRINT #filenr2, "</body>"
PRINT #filenr2, "</html>"
END SUB

SUB MakeHeader (filenr, title AS STRING, baseurl AS STRING)
PRINT #filenr, "<doctype>"
PRINT #filenr, "<html>"
PRINT #filenr, "<head>"
PRINT #filenr, "<title>" + title + "</title>"
PRINT #filenr, "<base>"
PRINT #filenr, ""
PRINT #filenr, "<body>"
PRINT #filenr, ""
PRINT #filenr, "<h1>"
PRINT #filenr, "  <a href=" + CHR$(34) + ">"
PRINT #filenr, "    McClouth Software</a>"
PRINT #filenr, "  <a href=" + CHR$(34) + ">"
PRINT #filenr, "    Novix Cross Reference</a><br>"
PRINT #filenr, banner
PRINT #filenr, "</h1>"
PRINT #filenr, ""
PRINT #filenr, "<hr>"

END SUB

FUNCTION MakeLink$ (filename$, Path$, typ!)
IF typ! = 0 THEN
  MakeLink$ = "<a href=" + CHR$(34) + Path$ + ">" + filename$ + "</a>"
END IF
END FUNCTION

FUNCTION Replace$ (charc AS STRING, strg1 AS STRING, strg2 AS STRING)
replacetemp$ = charc

IF INSTR(charc, strg1) THEN
        FOR replacecount = 1 TO LEN(replacetemp$)
                IF MID$(replacetemp$, replacecount, 1) = strg1 THEN
                        MID$(replacetemp$, replacecount, 1) = strg2
                END IF
        NEXT
END IF
Replace$ = replacetemp$
END FUNCTION

FUNCTION strim$ (strvar)
strim$ = trim$(STR$(strvar))
END FUNCTION

FUNCTION trim$ (char AS STRING)
trim$ = LTRIM$(RTRIM$(char))
END FUNCTION
The ? is supposed to be a ? but appearantly it doesn't copy from DOS to XP that while.

Thx in advance!!
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
Ralph
Veteran
Posts: 148
Joined: Fri Feb 09, 2007 3:10 pm
Location: Katy, Texas

Post by Ralph »

If you simply MUST have "more than 15" files OPEN at the same time, my first thought would be to combine two or more files into one, so as not to exceed the allowable limit,then separate the two or more parts withing the probram, as required. Would this work for you?
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish
User avatar
w1nt0p
Coder
Posts: 24
Joined: Sat Aug 23, 2008 9:28 am
Location: Katy, TX and New Orleans, LA
Contact:

Post by w1nt0p »

If you can supply me with some sample data to use for testing, I would be more than happy to help you figure it out.

A few things that I see are that it may be easier to use less files.
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

I'm not at home so can't provide ya the data.

The thing is that is just has to be able to get maps and files and make html-pages of those. So if you have an easier way to index this, it's always welcome!!

When I get back home, I'll back working on it.

grtz
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
User avatar
w1nt0p
Coder
Posts: 24
Joined: Sat Aug 23, 2008 9:28 am
Location: Katy, TX and New Orleans, LA
Contact:

Post by w1nt0p »

Seb McClouth wrote:I'm not at home so can't provide ya the data.

The thing is that is just has to be able to get maps and files and make html-pages of those. So if you have an easier way to index this, it's always welcome!!

When I get back home, I'll back working on it.

grtz
I am uncertain what you mean about "get maps and files"

can you give me an example of what the input file looks like?

I can try to speculate what it looks like by figuring your code line for line, but I'd rather not have to do that since you know what it is.

When ever you are back home and can get at the input data, send it to me and I'll gladly help you out.
If you don't want it to be public, then use a PM or email me at ccpsceo@gmail.com
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

Basically, it should be able to read any map/directory and its files and convert them to html, so in the end you have the whole deal in html.
The input doesn't matter, it could be any map/directory and files.

grtz
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
Post Reply