Hi,
Currently there's only one way to use the Import command concerning modules:
Import modulescope.modulename
So if you want to import all modules in a scope you've to write one Import statement for each module in the scope. For example if you want to import all modules in brl scope you've to write: (If you're using the default BMX modules)
Another nice feature would be if you could import all modules in a scope excluding some modules you can specify; it could be implemented like this:
The first parameter is a list of Import statement as I described, the second is the BlitzMax installation path. It returns a list of all Import statements you have to write without this feature.
You'll see that you can save much typing time with these extended Import statements.
Currently there's only one way to use the Import command concerning modules:
Import modulescope.modulename
So if you want to import all modules in a scope you've to write one Import statement for each module in the scope. For example if you want to import all modules in brl scope you've to write: (If you're using the default BMX modules)
Import brl.appstub Import brl.audio Import brl.audiosample Import brl.bank Import brl.bankstream Import brl.basic Import brl.blitz Import brl.bmploader Import brl.d3d7max2d Import brl.data Import brl.dxgraphics Import brl.endianstream Import brl.event Import brl.eventqueue Import brl.filesystem Import brl.font Import brl.freeaudioaudio Import brl.freetypefont Import brl.glgraphics Import brl.glmax2d Import brl.gnet Import brl.graphics Import brl.hook Import brl.httpstream Import brl.jpgloader Import brl.keycodes Import brl.linkedlist Import brl.map Import brl.math Import brl.max2d Import brl.maxutil Import brl.oggloader Import brl.pixmap Import brl.pngloader Import brl.polledinput Import brl.ramstream Import brl.random Import brl.retro Import brl.socket Import brl.socketstream Import brl.standardio Import brl.stream Import brl.system Import brl.textstream Import brl.tgaloader Import brl.timer Import brl.wavloaderI request that you simply can write
Import brl.*instead of that big list of Import statements I posted above.
Another nice feature would be if you could import all modules in a scope excluding some modules you can specify; it could be implemented like this:
Import + brl.* 'Import all brl modules, Import - brl.max2d 'but exclude brl.max2d Import - brl.glmax2d 'and brl.glmax2d Import - brl.d3d7max2d 'and brl.d3d7max2d.Or if you could do more accurate imports like this:
Import + *.* 'Import all modules in all scopes, Import - pub.* 'but exclude the pub scope, Import + pub.freeprocess 'however import pub.freeprocess Import + pub.freejoy 'and pub.freejoy.I wrote a simple function just to illustrate how this could be compiled:
Strict Local arr$ [] [] = [.. 'This array represents the tokenized collection of Import statements [ "Import" , "+" , "*.*" ] ,.. 'Import + *.* [ "Import" , "-" , "pub.*" ] ,.. 'Import - pub.* [ "Import" , "+" , "pub.freeprocess" ] ,.. 'Import + pub.freeprocess [ "Import" , "+" , "pub.freejoy" ] ] 'Import + pub.freejoy Print CompileImport ( arr , "C:\Programs" ) Function CompileImport$ ( TokenizedImportStatements$ [] [] , BlitzMaxDirectory$ ) Local Array$ [] Local Path$ = BlitzMaxDirectory + "/mod" For Local Line$ [] = EachIn TokenizedImportStatements If Len Line = 3 And Line [ 0 ].ToLower ( ) = "import" And ( Line [ 1 ] = "+" Or Line [ 1 ] = "-" ) And Line [ 2 ].Contains ( "." ) Local Scope$ = Line [ 2 ] [.. Line [ 2 ].Find ( "." ) ] Local Name$ = Line [ 2 ] [ Line [ 2 ].Find ( "." ) + 1 ..] If Scope = "*" For Local Sub$ = EachIn LoadDir ( Path ) Local Scope$ = Sub [.. Len Sub - 4 ] If Name = "*" For Local Sub$ = EachIn LoadDir ( Path + "/" + Scope + ".mod" ) Local Name$ = StripAll ( CasedFileName ( Path + "/" + Scope + ".mod" + "/" + Sub + "/" + Sub [.. Len Sub - 3 ] + "bmx" ) ) Local Text$ = "Import " + Scope + "." + Name If Line [ 1 ] = "+" Local I = Len Array Array = Array [.. I + 1 ] Array [ I ] = Text Else For Local I = 0 Until Len Array If Array [ I ].ToLower ( ) = Text.ToLower ( ) Array [ I ] = "" EndIf Next EndIf Next Else Local Text$ = "Import " + Scope + "." + Name If Line [ 1 ] = "+" Local I = Len Array Array = Array [.. I + 1 ] Array [ I ] = Text Else For Local I = 0 Until Len Array If Array [ I ].ToLower ( ) = Text.ToLower ( ) Array [ I ] = "" EndIf Next EndIf EndIf Next Else If Name = "*" For Local Sub$ = EachIn LoadDir ( Path + "/" + Scope + ".mod" ) Local Name$ = StripAll ( CasedFileName ( Path + "/" + Scope + ".mod" + "/" + Sub + "/" + Sub [.. Len Sub - 3 ] + "bmx" ) ) Local Text$ = "Import " + Scope + "." + Name If Line [ 1 ] = "+" Local I = Len Array Array = Array [.. I + 1 ] Array [ I ] = Text Else For Local I = 0 Until Len Array If Array [ I ].ToLower ( ) = Text.ToLower ( ) Array [ I ] = "" EndIf Next EndIf Next Else Local Text$ = "Import " + Scope + "." + Name If Line [ 1 ] = "+" Local I = Len Array Array = Array [.. I + 1 ] Array [ I ] = Text Else For Local I = 0 Until Len Array If Array [ I ].ToLower ( ) = Text.ToLower ( ) Array [ I ] = "" EndIf Next EndIf EndIf EndIf EndIf Next Local Text$ For Local I = 0 Until Len Array If Array [ I ] If I Text :+ "~n" EndIf Text :+ Array [ I ] EndIf Next Return Text EndFunction
The first parameter is a list of Import statement as I described, the second is the BlitzMax installation path. It returns a list of all Import statements you have to write without this feature.
You'll see that you can save much typing time with these extended Import statements.