Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '_sync( "BootSector" )
- #macro ForEachOperation( _act )
- ' "[!]RecipeName" , "ToolFile"||@Func , Tool/Function Parameter , Output file(s) , {Input file(s)...}
- _act( "BootSector" , "$nasm" , "%i -l %ipn.lst -o %o" , "build\boot\boot.sec" , {"src\boot\bootsec.asm"} )
- _act( "ImageFile" , GenerateDiskImage , "" , "MyCCOS.img" , {"build\boot\boot.sec"} )
- _act( "System" , "$fbc" , "%i -x %opn.exe" , "build\sys\*.bin" , {"src\sys\*.bas"} )
- #endmacro
- function GenerateDiskImage( sBootSecFile as string , sOutputImgFile as string , sUnused as string = "" ) as long
- #define _FATAL(_msg) print _msg : return 0
- var f = freefile , iResu = 0
- iResu = open( exepath+"\"+sBootSecFile for binary access read as #f)
- if iResu then _FATAL("failed to OPEN '"+sBootSecFile+"' for read")
- dim as ulongint iSz = lof(f)
- if iSz < 512 orelse iSz > 65536 then _FATAL("boot sector file, must be between 512 bytes and 64kb")
- dim as ubyte bBoot(iSz-1) = any
- iResu = get(#f,,bBoot()) : close #f
- if iResu then _FATAL("failed to READ '"+sBootSecFile+"'")
- iResu = open( exepath+"\"+sOutputImgFile for binary access write as #f)
- if iResu then _FATAL("failed to OPEN '"+sOutputImgFile+"' for write")
- iResu = (put(#f,,bBoot()) orelse put(#f,1+1440*1024-sizeof(iResu),iResu)) : close #f
- if iResu then _FATAL("failed to WRITE '"+sOutputImgFile+"'")
- return 1
- end function
- #macro _Execute( _sRecipe , _StrOrPtrTool , _vParameters , _sOutput , _sInput... )
- '#print _sRecipe
- __FB_UNIQUEID_PUSH__( InputArr )
- #define _ArrName __FB_JOIN__( sList , __FB_UNIQUEID__( InputArr ) )
- dim as string _ArrName (...) = _sInput
- #if typeof( @_StrOrPtrTool ) = typeof( zstring ptr )
- AddThreadsExecuteCommand( _sRecipe , _StrOrPtrTool , _vParameters , _sOutput , _ArrName () )
- #else
- AddThreadsCallFunction( _sRecipe , @_StrOrPtrTool , _vParameters , _sOutput , _ArrName () )
- #endif
- #undef _ArrName
- __FB_UNIQUEID_POP__( InputArr )
- #endmacro
- type CallProto as function( sInput as string , sOutput as string , sParms as string ) as long
- sub AddThreadsExecuteCommand( sRecipe as string , sExec as string , sParms as string , sOutFile as string , sInFiles() as string )
- print sRecipe , sExec , sParms
- end sub
- sub AddThreadsCallFunction( sRecipe as string , pfFunc as CallProto , sParms as string , sOutFile as string , sInFiles() as string )
- print sRecipe , sParms
- end sub
- ForEachOperation( _Execute )
- sleep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement