I have just updated this old timer to PBCC50. Its a source file merge utility that must be run from the directory containing the main BAS file and using the main BAS file as its command line argument.
It assumes valid relative paths from the directory containing the main BAS file.
It excludes PB include files so that the source contains the project code, not the big includes.
Regards,
hutch at movsd dot com
It assumes valid relative paths from the directory containing the main BAS file.
It excludes PB include files so that the source contains the project code, not the big includes.
Code:
#IF 0 ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ PBmerge.bas Merges all dependencies into one large file, will remove each nested level of include files and merges the file into the main file until no more are left. =============================================== MUST be run from the directory of the main file with the main file as the command line argument =============================================== Build with PBCC50 #ENDIF ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ FUNCTION PBmain() as LONG LOCAL loopFlag as LONG loopFlag = 0 If not exist(command$) Then StdOut "Cannot find that file" Exit FUNCTION End If ' ------------------------------------- ' Copy original file to temporary file ' ------------------------------------- Open command$ for binary as #1 get$ #1, lof(1), clfile$ Close #1 Open "passfile.txt" for Output as #1 Print #1, clfile$; Close #1 ' ------------------------------------- Start_Loop: Open "passfile.txt" for Input as #1 Open "mergfile.bas" for Output As #2 Do line input #1, a$ ' ---------------------------------- ' bypass tests if INC not in string ' ---------------------------------- If instr(ucase$(a$),"INC") = 0 Then goto lbl1 ' ------------------------------- ' exclude standard INCLUDE files ' ------------------------------- sch$ = ucase$(a$) If instr(sch$,"ACCCTRL.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"ACLAPI.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"COMDLG32.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"COMMCTRL.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"CPL.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"DDT.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"DIGITALV.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"HTMLHELP.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"IME.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"IMM.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"INITCTRL.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"IPHLPAPI.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"LMACCESS.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"LMERR.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"LMWKSTA.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"MCIAVI.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"MDI32.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"NTSECAPI.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"PBFORMS.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"POWRPROF.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"PRSHT.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"RAS32.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"REASON.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"RESOURCE.H"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"RICHEDIT.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"SECEXT.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"SHLWAPI.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"SUBAUTH.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"TLHELP32.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"VBAPI32.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"VCR.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"WEBPUB.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"WFEXT.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"WIN32API.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"WINHTTP.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"WININET.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"WINIOCTL.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"WINWLX.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"WS2_32.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(sch$,"WSOCK32.INC"+chr$(34)) <> 0 Then goto lbl1 If instr(ucase$(a$),"INCLUDE ") <> 0 Then If left$(ltrim$(a$),1) <> "'" Then ' if its not commented out GetInclude a$ loopFlag = 1 ! jmp nxt1 End If End If lbl1: Print #2, a$ nxt1: Loop while not eof(1) Close #2 Close #1 If loopFlag = 1 Then loopFlag = 0 kill "passfile.txt" name "mergfile.bas" as "passfile.txt" ! jmp Start_Loop End If kill "passfile.txt" StdOut "mergfile.bas written to disk" FUNCTION = 0 END FUNCTION ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ SUB GetInclude(incld$) LOCAL lpos as LONG LOCAL ln as LONG ln = len(incld$) lpos = instr(1,incld$,chr$(34)) ln = ln - lpos TheName$ = trim$(remove$(right$(incld$,ln),chr$(34))) cp& = instr(TheName$,"'") If cp& <> 0 Then TheName$ = left$(TheName$,instr(TheName$,"'")-1) End If If exist&(TheName$) Then StdOut "Merging "+TheName$ Open TheName$ for Binary as #3 Get$ #3, lof(3), b$ Print #2, b$ Close #3 End If END SUB ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ FUNCTION exist(fname$) as LONG FUNCTION = Len( Dir$(fname$, 17) ) > 0 END FUNCTION ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
hutch at movsd dot com