瀏覽代碼

Updated modules to SuperStrict.

woollybah 9 年之前
父節點
當前提交
1ea6720e02
共有 6 個文件被更改,包括 187 次插入175 次删除
  1. 73 71
      event.mod/event.bmx
  2. 19 17
      eventqueue.mod/eventqueue.bmx
  3. 43 41
      filesystem.mod/filesystem.bmx
  4. 15 13
      font.mod/font.bmx
  5. 25 23
      freetypefont.mod/freetypefont.bmx
  6. 12 10
      random.mod/random.bmx

+ 73 - 71
event.mod/event.bmx

@@ -1,17 +1,19 @@
 
 
-Strict
+SuperStrict
 
 
 Rem
 Rem
 bbdoc: Events/Events
 bbdoc: Events/Events
 End Rem
 End Rem
 Module BRL.Event
 Module BRL.Event
 
 
-ModuleInfo "Version: 1.05"
+ModuleInfo "Version: 1.06"
 ModuleInfo "Author: Mark Sibly, Bruce A Henderson"
 ModuleInfo "Author: Mark Sibly, Bruce A Henderson"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 ModuleInfo "Modserver: BRL"
 
 
+ModuleInfo "History: 1.06"
+ModuleInfo "History: Module is now SuperStrict"
 ModuleInfo "History: 1.05"
 ModuleInfo "History: 1.05"
 ModuleInfo "History: Added EVENT_MULTIGESTURE."
 ModuleInfo "History: Added EVENT_MULTIGESTURE."
 ModuleInfo "History: 1.04"
 ModuleInfo "History: 1.04"
@@ -47,7 +49,7 @@ The #EmitEventHook global variable contains a hook id for use with #AddHook.
 Each time #EmitEvent is called, the event is passed to all #EmitEventHook 
 Each time #EmitEvent is called, the event is passed to all #EmitEventHook 
 hook functions by means of the hook function @data parameter.
 hook functions by means of the hook function @data parameter.
 End Rem
 End Rem
-Global EmitEventHook=AllocHookId()
+Global EmitEventHook:Int=AllocHookId()
 
 
 Rem
 Rem
 bbdoc: Event object type
 bbdoc: Event object type
@@ -57,7 +59,7 @@ Type TEvent
 	Rem
 	Rem
 	bbdoc: Event identifier
 	bbdoc: Event identifier
 	End Rem
 	End Rem
-	Field id
+	Field id:Int
 	
 	
 	Rem
 	Rem
 	bbdoc: Event source object
 	bbdoc: Event source object
@@ -67,22 +69,22 @@ Type TEvent
 	Rem
 	Rem
 	bbdoc: Event specific data
 	bbdoc: Event specific data
 	End Rem
 	End Rem
-	Field data
+	Field data:Int
 	
 	
 	Rem
 	Rem
 	bbdoc: Event specific modifiers
 	bbdoc: Event specific modifiers
 	End Rem
 	End Rem
-	Field mods
+	Field mods:Int
 	
 	
 	Rem
 	Rem
 	bbdoc: Event specific position data
 	bbdoc: Event specific position data
 	End Rem
 	End Rem
-	Field x
+	Field x:Int
 	
 	
 	Rem
 	Rem
 	bbdoc: Event specific position data
 	bbdoc: Event specific position data
 	End Rem
 	End Rem
-	Field y
+	Field y:Int
 	
 	
 	Rem
 	Rem
 	bbdoc: Event specific extra information
 	bbdoc: Event specific extra information
@@ -131,7 +133,7 @@ Type TEvent
 	bbdoc: Create an event object
 	bbdoc: Create an event object
 	returns: A new event object
 	returns: A new event object
 	End Rem
 	End Rem
-	Function Create:TEvent( id,source:Object=Null,data=0,mods=0,x=0,y=0,extra:Object=Null,usePool:Int = True )
+	Function Create:TEvent( id:Int,source:Object=Null,data:Int=0,mods:Int=0,x:Int=0,y:Int=0,extra:Object=Null,usePool:Int = True )
 		Local t:TEvent
 		Local t:TEvent
 ?threaded
 ?threaded
 		_eventLock.Lock()
 		_eventLock.Lock()
@@ -159,23 +161,23 @@ Type TEvent
 	bbdoc: Allocate a user event id
 	bbdoc: Allocate a user event id
 	returns: A new user event id
 	returns: A new user event id
 	End Rem
 	End Rem
-	Function AllocUserId()
-		Global _id=EVENT_USEREVENTMASK
+	Function AllocUserId:Int()
+		Global _id:Int=EVENT_USEREVENTMASK
 		_id:+1
 		_id:+1
 		Return _id
 		Return _id
 	End Function
 	End Function
 	
 	
-	Function RegisterId( id,description$ )
+	Function RegisterId( id:Int,description$ )
 		_regids:+String(id)+"{"+description+"}"
 		_regids:+String(id)+"{"+description+"}"
 	End Function
 	End Function
 	
 	
-	Function DescriptionForId$( id )
+	Function DescriptionForId$( id:Int )
 		Local t$="}"+String(id)+"{"
 		Local t$="}"+String(id)+"{"
-		Local i=_regids.Find( t )
-		If i=-1 Return
+		Local i:Int=_regids.Find( t )
+		If i=-1 Return Null
 		i:+t.length
 		i:+t.length
-		Local i2=_regids.Find( "}",i )
-		If i2=-1 Return
+		Local i2:Int=_regids.Find( "}",i )
+		If i2=-1 Return Null
 		Return _regids[i..i2]
 		Return _regids[i..i2]
 	End Function
 	End Function
 
 
@@ -183,57 +185,57 @@ Type TEvent
 	
 	
 End Type
 End Type
 
 
-Const EVENT_APPMASK=$100
-Const EVENT_APPSUSPEND=$101
-Const EVENT_APPRESUME=$102
-Const EVENT_APPTERMINATE=$103
-Const EVENT_APPOPENFILE=$104
-Const EVENT_APPIDLE=$105		'Reserved by Mark!
-Const EVENT_KEYMASK=$200
-Const EVENT_KEYDOWN=$201
-Const EVENT_KEYUP=$202
-Const EVENT_KEYCHAR=$203
-Const EVENT_KEYREPEAT=$204
-Const EVENT_MOUSEMASK=$400
-Const EVENT_MOUSEDOWN=$401
-Const EVENT_MOUSEUP=$402
-Const EVENT_MOUSEMOVE=$403
-Const EVENT_MOUSEWHEEL=$404
-Const EVENT_MOUSEENTER=$405
-Const EVENT_MOUSELEAVE=$406
-Const EVENT_TIMERMASK=$800
-Const EVENT_TIMERTICK=$801
-Const EVENT_HOTKEYMASK=$1000
-Const EVENT_HOTKEYHIT=$1001
-Const EVENT_GADGETMASK=$2000
-Const EVENT_GADGETACTION=$2001
-Const EVENT_GADGETPAINT=$2002
-Const EVENT_GADGETSELECT=$2003
-Const EVENT_GADGETMENU=$2004
-Const EVENT_GADGETOPEN=$2005
-Const EVENT_GADGETCLOSE=$2006
-Const EVENT_GADGETDONE=$2007
-Const EVENT_GADGETLOSTFOCUS=$2008
-Const EVENT_GADGETSHAPE=$2009	'reserved by Mark!
-Const EVENT_WINDOWMASK=$4000
-Const EVENT_WINDOWMOVE=$4001
-Const EVENT_WINDOWSIZE=$4002
-Const EVENT_WINDOWCLOSE=$4003
-Const EVENT_WINDOWACTIVATE=$4004
-Const EVENT_WINDOWACCEPT=$4005
-Const EVENT_MENUMASK=$8000
-Const EVENT_MENUACTION=$8001
-Const EVENT_STREAMMASK=$10000
-Const EVENT_STREAMEOF=$10001
-Const EVENT_STREAMAVAIL=$10002
-Const EVENT_PROCESSMASK=$20000
-Const EVENT_PROCESSEXIT=$20001
-Const EVENT_TOUCHMASK=$40000
-Const EVENT_TOUCHDOWN=$40001
-Const EVENT_TOUCHUP=$40002
-Const EVENT_TOUCHMOVE=$40003
-Const EVENT_MULTIGESTURE=$80000
-Const EVENT_USEREVENTMASK=$80000000
+Const EVENT_APPMASK:Int=$100
+Const EVENT_APPSUSPEND:Int=$101
+Const EVENT_APPRESUME:Int=$102
+Const EVENT_APPTERMINATE:Int=$103
+Const EVENT_APPOPENFILE:Int=$104
+Const EVENT_APPIDLE:Int=$105		'Reserved by Mark!
+Const EVENT_KEYMASK:Int=$200
+Const EVENT_KEYDOWN:Int=$201
+Const EVENT_KEYUP:Int=$202
+Const EVENT_KEYCHAR:Int=$203
+Const EVENT_KEYREPEAT:Int=$204
+Const EVENT_MOUSEMASK:Int=$400
+Const EVENT_MOUSEDOWN:Int=$401
+Const EVENT_MOUSEUP:Int=$402
+Const EVENT_MOUSEMOVE:Int=$403
+Const EVENT_MOUSEWHEEL:Int=$404
+Const EVENT_MOUSEENTER:Int=$405
+Const EVENT_MOUSELEAVE:Int=$406
+Const EVENT_TIMERMASK:Int=$800
+Const EVENT_TIMERTICK:Int=$801
+Const EVENT_HOTKEYMASK:Int=$1000
+Const EVENT_HOTKEYHIT:Int=$1001
+Const EVENT_GADGETMASK:Int=$2000
+Const EVENT_GADGETACTION:Int=$2001
+Const EVENT_GADGETPAINT:Int=$2002
+Const EVENT_GADGETSELECT:Int=$2003
+Const EVENT_GADGETMENU:Int=$2004
+Const EVENT_GADGETOPEN:Int=$2005
+Const EVENT_GADGETCLOSE:Int=$2006
+Const EVENT_GADGETDONE:Int=$2007
+Const EVENT_GADGETLOSTFOCUS:Int=$2008
+Const EVENT_GADGETSHAPE:Int=$2009	'reserved by Mark!
+Const EVENT_WINDOWMASK:Int=$4000
+Const EVENT_WINDOWMOVE:Int=$4001
+Const EVENT_WINDOWSIZE:Int=$4002
+Const EVENT_WINDOWCLOSE:Int=$4003
+Const EVENT_WINDOWACTIVATE:Int=$4004
+Const EVENT_WINDOWACCEPT:Int=$4005
+Const EVENT_MENUMASK:Int=$8000
+Const EVENT_MENUACTION:Int=$8001
+Const EVENT_STREAMMASK:Int=$10000
+Const EVENT_STREAMEOF:Int=$10001
+Const EVENT_STREAMAVAIL:Int=$10002
+Const EVENT_PROCESSMASK:Int=$20000
+Const EVENT_PROCESSEXIT:Int=$20001
+Const EVENT_TOUCHMASK:Int=$40000
+Const EVENT_TOUCHDOWN:Int=$40001
+Const EVENT_TOUCHUP:Int=$40002
+Const EVENT_TOUCHMOVE:Int=$40003
+Const EVENT_MULTIGESTURE:Int=$80000
+Const EVENT_USEREVENTMASK:Int=$80000000
 
 
 TEvent.RegisterId EVENT_APPSUSPEND,"AppSuspend"
 TEvent.RegisterId EVENT_APPSUSPEND,"AppSuspend"
 TEvent.RegisterId EVENT_APPRESUME,"AppResume"
 TEvent.RegisterId EVENT_APPRESUME,"AppResume"
@@ -288,7 +290,7 @@ Rem
 bbdoc: Create an event object
 bbdoc: Create an event object
 returns: A new event object
 returns: A new event object
 End Rem
 End Rem
-Function CreateEvent:TEvent( id,source:Object=Null,data=0,mods=0,x=0,y=0,extra:Object=Null,usePool:Int = True )
+Function CreateEvent:TEvent( id:Int,source:Object=Null,data:Int=0,mods:Int=0,x:Int=0,y:Int=0,extra:Object=Null,usePool:Int = True )
 	Return TEvent.Create( id,source,data,mods,x,y,extra,usePool )
 	Return TEvent.Create( id,source,data,mods,x,y,extra,usePool )
 End Function
 End Function
 
 
@@ -296,8 +298,8 @@ Rem
 bbdoc: Allocate a user event id
 bbdoc: Allocate a user event id
 returns: A new user event id
 returns: A new user event id
 End Rem
 End Rem
-Function AllocUserEventId( description$="" )
-	Local id=TEvent.AllocUserId()
+Function AllocUserEventId:Int( description$="" )
+	Local id:Int=TEvent.AllocUserId()
 	If description TEvent.RegisterId id,description
 	If description TEvent.RegisterId id,description
 	Return id
 	Return id
 End Function
 End Function

+ 19 - 17
eventqueue.mod/eventqueue.bmx

@@ -1,17 +1,19 @@
 
 
-Strict
+SuperStrict
 
 
 Rem
 Rem
 bbdoc: Events/Event queue
 bbdoc: Events/Event queue
 End Rem
 End Rem
 Module BRL.EventQueue
 Module BRL.EventQueue
 
 
-ModuleInfo "Version: 1.02"
+ModuleInfo "Version: 1.03"
 ModuleInfo "Author: Mark Sibly, Bruce A Henderson"
 ModuleInfo "Author: Mark Sibly, Bruce A Henderson"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 ModuleInfo "Modserver: BRL"
 
 
+ModuleInfo "History: 1.03"
+ModuleInfo "History: Module is now SuperStrict"
 ModuleInfo "History: 1.02"
 ModuleInfo "History: 1.02"
 ModuleInfo "History: Reuse TEvent objects."
 ModuleInfo "History: Reuse TEvent objects."
 ModuleInfo "History: 1.01 Release"
 ModuleInfo "History: 1.01 Release"
@@ -24,13 +26,13 @@ Import BRL.System
 
 
 Private
 Private
 
 
-Const QUEUESIZE=256
-Const QUEUEMASK=QUEUESIZE-1
-Global queue:TEvent[QUEUESIZE],queue_put,queue_get
+Const QUEUESIZE:Int=256
+Const QUEUEMASK:Int=QUEUESIZE-1
+Global queue:TEvent[QUEUESIZE],queue_put:Int,queue_get:Int
 
 
-Function Hook:Object( id,data:Object,context:Object )
+Function Hook:Object( id:Int,data:Object,context:Object )
 	Local ev:TEvent=TEvent( data )
 	Local ev:TEvent=TEvent( data )
-	If Not ev Return
+	If Not ev Return Null
 	
 	
 	Select ev.id
 	Select ev.id
 	Case EVENT_WINDOWMOVE,EVENT_WINDOWSIZE,EVENT_TIMERTICK,EVENT_GADGETACTION
 	Case EVENT_WINDOWMOVE,EVENT_WINDOWSIZE,EVENT_TIMERTICK,EVENT_GADGETACTION
@@ -80,7 +82,7 @@ global variable.
 
 
 If there are no events in the event queue, #PollEvent returns 0.
 If there are no events in the event queue, #PollEvent returns 0.
 End Rem
 End Rem
-Function PollEvent()
+Function PollEvent:Int()
 	If queue_get=queue_put
 	If queue_get=queue_put
 		PollSystem
 		PollSystem
 		If queue_get=queue_put
 		If queue_get=queue_put
@@ -103,7 +105,7 @@ global variable.
 If there are no events in the event queue, #WaitEvent halts program execution until
 If there are no events in the event queue, #WaitEvent halts program execution until
 an event is available.
 an event is available.
 End Rem
 End Rem
-Function WaitEvent()
+Function WaitEvent:Int()
 	While queue_get=queue_put
 	While queue_get=queue_put
 		WaitSystem
 		WaitSystem
 	Wend
 	Wend
@@ -122,9 +124,9 @@ queue, the existing event will be updated instead of @event
 being added to the event queue. This can be useful to prevent high frequency
 being added to the event queue. This can be useful to prevent high frequency
 events such as timer events from flooding the event queue.
 events such as timer events from flooding the event queue.
 End Rem
 End Rem
-Function PostEvent( event:TEvent,update=False )
+Function PostEvent( event:TEvent,update:Int=False )
 	If update
 	If update
-		Local i=queue_get
+		Local i:Int=queue_get
 		While i<>queue_put
 		While i<>queue_put
 			Local t:TEvent=queue[i & QUEUEMASK ]
 			Local t:TEvent=queue[i & QUEUEMASK ]
 			If t.id=event.id And t.source=event.source
 			If t.id=event.id And t.source=event.source
@@ -158,7 +160,7 @@ Rem
 bbdoc: Get current event id
 bbdoc: Get current event id
 returns: The @id field of the #CurrentEvent global variable
 returns: The @id field of the #CurrentEvent global variable
 EndRem
 EndRem
-Function EventID()
+Function EventID:Int()
 	Return CurrentEvent.id
 	Return CurrentEvent.id
 End Function
 End Function
 
 
@@ -166,7 +168,7 @@ Rem
 bbdoc: Get current event data
 bbdoc: Get current event data
 returns: The @data field of the #CurrentEvent global variable
 returns: The @data field of the #CurrentEvent global variable
 EndRem
 EndRem
-Function EventData()
+Function EventData:Int()
 	Return CurrentEvent.data
 	Return CurrentEvent.data
 End Function
 End Function
 
 
@@ -174,7 +176,7 @@ Rem
 bbdoc: Get current event modifiers
 bbdoc: Get current event modifiers
 returns: The @mods field of the #CurrentEvent global variable
 returns: The @mods field of the #CurrentEvent global variable
 EndRem
 EndRem
-Function EventMods()
+Function EventMods:Int()
 	Return CurrentEvent.mods
 	Return CurrentEvent.mods
 End Function
 End Function
 
 
@@ -182,7 +184,7 @@ Rem
 bbdoc: Get current event x value
 bbdoc: Get current event x value
 returns: The @x field of the #CurrentEvent global variable
 returns: The @x field of the #CurrentEvent global variable
 EndRem
 EndRem
-Function EventX()
+Function EventX:Int()
 	Return CurrentEvent.x
 	Return CurrentEvent.x
 End Function
 End Function
 
 
@@ -190,7 +192,7 @@ Rem
 bbdoc: Get current event y value
 bbdoc: Get current event y value
 returns: The @y field of the #CurrentEvent global variable
 returns: The @y field of the #CurrentEvent global variable
 EndRem
 EndRem
-Function EventY()
+Function EventY:Int()
 	Return CurrentEvent.y
 	Return CurrentEvent.y
 End Function
 End Function
 
 
@@ -222,6 +224,6 @@ Rem
 bbdoc: Get current event source object handle
 bbdoc: Get current event source object handle
 returns: The @source field of the #CurrentEvent global variable converted to an integer handle
 returns: The @source field of the #CurrentEvent global variable converted to an integer handle
 EndRem
 EndRem
-Function EventSourceHandle()
+Function EventSourceHandle:Size_T()
 	Return HandleFromObject( CurrentEvent.source )
 	Return HandleFromObject( CurrentEvent.source )
 End Function
 End Function

+ 43 - 41
filesystem.mod/filesystem.bmx

@@ -1,17 +1,19 @@
 
 
-Strict
+SuperStrict
 
 
 Rem
 Rem
 bbdoc: System/File system
 bbdoc: System/File system
 End Rem
 End Rem
 Module BRL.FileSystem
 Module BRL.FileSystem
 
 
-ModuleInfo "Version: 1.09"
+ModuleInfo "Version: 1.10"
 ModuleInfo "Author: Mark Sibly"
 ModuleInfo "Author: Mark Sibly"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 ModuleInfo "Modserver: BRL"
 
 
+ModuleInfo "History: 1.10"
+ModuleInfo "History: Module is now SuperStrict"
 ModuleInfo "History: 1.09 Release"
 ModuleInfo "History: 1.09 Release"
 ModuleInfo "History: Fixed RealPath breaking win32 //server paths"
 ModuleInfo "History: Fixed RealPath breaking win32 //server paths"
 ModuleInfo "History: 1.08 Release"
 ModuleInfo "History: 1.08 Release"
@@ -28,7 +30,7 @@ ModuleInfo "History: Added optional resurse parameter to CreateDir"
 Import Pub.StdC
 Import Pub.StdC
 Import BRL.BankStream
 Import BRL.BankStream
 
 
-Const FILETYPE_NONE=0,FILETYPE_FILE=1,FILETYPE_DIR=2
+Const FILETYPE_NONE:Int=0,FILETYPE_FILE:Int=1,FILETYPE_DIR:Int=2
 
 
 Private
 Private
 
 
@@ -37,39 +39,39 @@ Function _RootPath$( path$ )
 	If path.StartsWith( "//" )
 	If path.StartsWith( "//" )
 		Return path[ ..path.Find( "/",2 )+1 ]
 		Return path[ ..path.Find( "/",2 )+1 ]
 	EndIf
 	EndIf
-	Local i=path.Find( ":" )
+	Local i:Int=path.Find( ":" )
 	If i<>-1 And path.Find( "/" )=i+1 Return path[..i+2]
 	If i<>-1 And path.Find( "/" )=i+1 Return path[..i+2]
 ?
 ?
 	If path.StartsWith( "/" ) Return "/"
 	If path.StartsWith( "/" ) Return "/"
 End Function
 End Function
 
 
-Function _IsRootPath( path$ )
+Function _IsRootPath:Int( path$ )
 	Return path And _RootPath( path )=path
 	Return path And _RootPath( path )=path
 End Function
 End Function
 
 
-Function _IsRealPath( path$ )
+Function _IsRealPath:Int( path$ )
 	Return _RootPath( path )<>""
 	Return _RootPath( path )<>""
 End Function
 End Function
 
 
 ?Win32
 ?Win32
 Function _CurrentDrive$()
 Function _CurrentDrive$()
 	Local cd$=getcwd_()
 	Local cd$=getcwd_()
-	Local i=cd.Find( ":" )
+	Local i:Int=cd.Find( ":" )
 	If i<>-1 Return cd[..i]
 	If i<>-1 Return cd[..i]
 End Function
 End Function
 ?
 ?
 
 
 Public
 Public
 
 
-Function FixPath( path$ Var,dirPath=False )
+Function FixPath( path$ Var,dirPath:Int=False )
 	path=path.Replace("\","/")
 	path=path.Replace("\","/")
 ?Win32
 ?Win32
 	If path.StartsWith( "//" )
 	If path.StartsWith( "//" )
 		If path.Find( "/",2 )=-1 path:+"/"
 		If path.Find( "/",2 )=-1 path:+"/"
 	Else
 	Else
-		Local i=path.Find( ":" )
+		Local i:Int=path.Find( ":" )
 		If i<>-1 And ( i=path.length-1 Or path[i+1]<>Asc(":") )
 		If i<>-1 And ( i=path.length-1 Or path[i+1]<>Asc(":") )
-			Local i2=path.Find( "/" )
+			Local i2:Int=path.Find( "/" )
 			If i2=-1 Or i2>i+1 path=path[..i+1]+"/"+path[i+1..]
 			If i2=-1 Or i2>i+1 path=path[..i+1]+"/"+path[i+1..]
 		EndIf
 		EndIf
 	EndIf
 	EndIf
@@ -85,7 +87,7 @@ bbdoc: Strip directory from a file path
 End Rem
 End Rem
 Function StripDir$( path$ )
 Function StripDir$( path$ )
 	FixPath path
 	FixPath path
-	Local i=path.FindLast( "/" )
+	Local i:Int=path.FindLast( "/" )
 	If i<>-1 Return path[i+1..]
 	If i<>-1 Return path[i+1..]
 	Return path
 	Return path
 End Function
 End Function
@@ -95,7 +97,7 @@ bbdoc: Strip extension from a file path
 End Rem
 End Rem
 Function StripExt$( path$ )
 Function StripExt$( path$ )
 	FixPath path
 	FixPath path
-	Local i=path.FindLast( "." )
+	Local i:Int=path.FindLast( "." )
 	If i<>-1 And path.Find( "/",i+1 )=-1 Return path[..i]
 	If i<>-1 And path.Find( "/",i+1 )=-1 Return path[..i]
 	Return path
 	Return path
 End Function
 End Function
@@ -126,7 +128,7 @@ Function ExtractDir$( path$ )
 	FixPath path
 	FixPath path
 	If path="." Or path=".." Or _IsRootPath( path ) Return path
 	If path="." Or path=".." Or _IsRootPath( path ) Return path
 
 
-	Local i=path.FindLast( "/" )
+	Local i:Int=path.FindLast( "/" )
 	If i=-1 Return ""
 	If i=-1 Return ""
 	
 	
 	If _IsRootPath( path[..i+1] ) i:+1
 	If _IsRootPath( path[..i+1] ) i:+1
@@ -138,7 +140,7 @@ bbdoc: Extract extension from a file path
 End Rem
 End Rem
 Function ExtractExt$( path$ )
 Function ExtractExt$( path$ )
 	FixPath path
 	FixPath path
-	Local i=path.FindLast( "." )
+	Local i:Int=path.FindLast( "." )
 	If i<>-1 And path.Find( "/",i+1 )=-1 Return path[i+1..]
 	If i<>-1 And path.Find( "/",i+1 )=-1 Return path[i+1..]
 End Function
 End Function
 
 
@@ -172,7 +174,7 @@ Function RealPath$( path$ )
 	
 	
 	path:+"/"
 	path:+"/"
 	While path
 	While path
-		Local i=path.Find( "/" )
+		Local i:Int=path.Find( "/" )
 		Local t$=path[..i]
 		Local t$=path[..i]
 		path=path[i+1..]
 		path=path[i+1..]
 		Select t
 		Select t
@@ -193,9 +195,9 @@ Rem
 bbdoc: Get file type
 bbdoc: Get file type
 returns: 0 if file at @path doesn't exist, FILETYPE_FILE (1) if the file is a plain file or FILETYPE_DIR (2) if the file is a directory
 returns: 0 if file at @path doesn't exist, FILETYPE_FILE (1) if the file is a plain file or FILETYPE_DIR (2) if the file is a directory
 End Rem
 End Rem
-Function FileType( path$ )
+Function FileType:Int( path$ )
 	FixPath path
 	FixPath path
-	Local Mode,size:Long,mtime,ctime
+	Local Mode:Int,size:Long,mtime:Int,ctime:Int
 	If stat_( path,Mode,size,mtime,ctime ) Return 0
 	If stat_( path,Mode,size,mtime,ctime ) Return 0
 	Select Mode & S_IFMT_
 	Select Mode & S_IFMT_
 	Case S_IFREG_ Return FILETYPE_FILE
 	Case S_IFREG_ Return FILETYPE_FILE
@@ -208,9 +210,9 @@ Rem
 bbdoc: Get file time
 bbdoc: Get file time
 returns: The time the file at @path was last modified 
 returns: The time the file at @path was last modified 
 End Rem
 End Rem
-Function FileTime( path$ )
+Function FileTime:Int( path$ )
 	FixPath path
 	FixPath path
-	Local Mode,size:Long,mtime,ctime
+	Local Mode:Int,size:Long,mtime:Int,ctime:Int
 	If stat_( path,Mode,size,mtime,ctime ) Return 0
 	If stat_( path,Mode,size,mtime,ctime ) Return 0
 	Return mtime
 	Return mtime
 End Function
 End Function
@@ -221,7 +223,7 @@ returns: Size, in bytes, of the file at @path, or -1 if the file does not exist
 end rem
 end rem
 Function FileSize:Long( path$ )
 Function FileSize:Long( path$ )
 	FixPath path
 	FixPath path
-	Local Mode,size:Long,mtime,ctime
+	Local Mode:Int,size:Long,mtime:Int,ctime:Int
 	If stat_( path,Mode,size,mtime,ctime ) Return -1
 	If stat_( path,Mode,size,mtime,ctime ) Return -1
 	Return size
 	Return size
 End Function
 End Function
@@ -230,9 +232,9 @@ Rem
 bbdoc: Get file mode
 bbdoc: Get file mode
 returns: file mode flags
 returns: file mode flags
 end rem
 end rem
-Function FileMode( path$ )
+Function FileMode:Int( path$ )
 	FixPath path
 	FixPath path
-	Local Mode,size:Long,mtime,ctime
+	Local Mode:Int,size:Long,mtime:Int,ctime:Int
 	If stat_( path,Mode,size,mtime,ctime ) Return -1
 	If stat_( path,Mode,size,mtime,ctime ) Return -1
 	Return Mode & 511
 	Return Mode & 511
 End Function
 End Function
@@ -240,7 +242,7 @@ End Function
 Rem
 Rem
 bbdoc: Set file mode
 bbdoc: Set file mode
 end rem
 end rem
-Function SetFileMode( path$,Mode )
+Function SetFileMode( path$,Mode:Int )
 	FixPath path
 	FixPath path
 	chmod_ path,Mode
 	chmod_ path,Mode
 End Function
 End Function
@@ -249,7 +251,7 @@ Rem
 bbdoc: Create a file
 bbdoc: Create a file
 returns: True if successful
 returns: True if successful
 End Rem
 End Rem
-Function CreateFile( path$ )
+Function CreateFile:Int( path$ )
 	FixPath path
 	FixPath path
 	remove_ path
 	remove_ path
 	Local t:Byte Ptr=fopen_( path,"wb" )
 	Local t:Byte Ptr=fopen_( path,"wb" )
@@ -263,7 +265,7 @@ returns: True if successful
 about:
 about:
 If @recurse is true, any required subdirectories are also created.
 If @recurse is true, any required subdirectories are also created.
 End Rem
 End Rem
-Function CreateDir( path$,recurse=False )
+Function CreateDir:Int( path$,recurse:Int=False )
 	FixPath path,True
 	FixPath path,True
 	If Not recurse
 	If Not recurse
 		mkdir_ path,1023
 		mkdir_ path,1023
@@ -272,7 +274,7 @@ Function CreateDir( path$,recurse=False )
 	Local t$
 	Local t$
 	path=RealPath(path)+"/"
 	path=RealPath(path)+"/"
 	While path
 	While path
-		Local i=path.find("/")+1
+		Local i:Int=path.find("/")+1
 		t:+path[..i]
 		t:+path[..i]
 		path=path[i..]
 		path=path[i..]
 		Select FileType(t)
 		Select FileType(t)
@@ -292,7 +294,7 @@ Rem
 bbdoc: Delete a file
 bbdoc: Delete a file
 returns: True if successful
 returns: True if successful
 End Rem
 End Rem
-Function DeleteFile( path$ )
+Function DeleteFile:Int( path$ )
 	FixPath path
 	FixPath path
 	remove_ path
 	remove_ path
 	Return FileType(path)=FILETYPE_NONE
 	Return FileType(path)=FILETYPE_NONE
@@ -302,7 +304,7 @@ Rem
 bbdoc: Renames a file
 bbdoc: Renames a file
 returns: True if successful
 returns: True if successful
 End Rem
 End Rem
-Function RenameFile( oldpath$,newpath$ )
+Function RenameFile:Int( oldpath$,newpath$ )
 	FixPath oldpath
 	FixPath oldpath
 	FixPath newpath
 	FixPath newpath
 	Return rename_( oldpath,newpath)=0
 	Return rename_( oldpath,newpath)=0
@@ -312,8 +314,8 @@ Rem
 bbdoc: Copy a file
 bbdoc: Copy a file
 returns: True if successful
 returns: True if successful
 End Rem
 End Rem
-Function CopyFile( src$,dst$ )
-	Local in:TStream=ReadStream( src ),ok
+Function CopyFile:Int( src$,dst$ )
+	Local in:TStream=ReadStream( src ),ok:Int
 	If in
 	If in
 		Local out:TStream=WriteStream( dst )
 		Local out:TStream=WriteStream( dst )
 		If out
 		If out
@@ -333,9 +335,9 @@ Rem
 bbdoc: Copy a directory
 bbdoc: Copy a directory
 returns: True if successful
 returns: True if successful
 End Rem
 End Rem
-Function CopyDir( src$,dst$ )
+Function CopyDir:Int( src$,dst$ )
 
 
-	Function CopyDir_( src$,dst$ )
+	Function CopyDir_:Int( src$,dst$ )
 		If FileType( dst )=FILETYPE_NONE CreateDir dst
 		If FileType( dst )=FILETYPE_NONE CreateDir dst
 		If FileType( dst )<>FILETYPE_DIR Return False
 		If FileType( dst )<>FILETYPE_DIR Return False
 		For Local file$=EachIn LoadDir( src )
 		For Local file$=EachIn LoadDir( src )
@@ -364,11 +366,11 @@ returns: True if successful
 about: Set @recurse to true to delete all subdirectories and files recursively - 
 about: Set @recurse to true to delete all subdirectories and files recursively - 
 but be careful!
 but be careful!
 End Rem
 End Rem
-Function DeleteDir( path$,recurse=False )
+Function DeleteDir:Int( path$,recurse:Int=False )
 	FixPath path,True
 	FixPath path,True
 	If recurse
 	If recurse
 		Local dir:Byte Ptr=ReadDir( path )
 		Local dir:Byte Ptr=ReadDir( path )
-		If Not dir Return
+		If Not dir Return False
 		Repeat
 		Repeat
 			Local t$=NextFile( dir )
 			Local t$=NextFile( dir )
 			If t="" Exit
 			If t="" Exit
@@ -389,7 +391,7 @@ Rem
 bbdoc: Change current directory
 bbdoc: Change current directory
 returns: True if successful
 returns: True if successful
 End Rem
 End Rem
-Function ChangeDir( path$ )
+Function ChangeDir:Int( path$ )
 	FixPath path,True
 	FixPath path,True
 	If chdir_( path )=0 Return True
 	If chdir_( path )=0 Return True
 End Function
 End Function
@@ -424,11 +426,11 @@ returns: A string array containing contents of @dir
 about: The @skip_dots parameter, if true, removes the '.' (current) and '..'
 about: The @skip_dots parameter, if true, removes the '.' (current) and '..'
 (parent) directories from the returned array.
 (parent) directories from the returned array.
 end rem
 end rem
-Function LoadDir$[]( dir$,skip_dots=True )
+Function LoadDir$[]( dir$,skip_dots:Int=True )
 	FixPath dir,True
 	FixPath dir,True
 	Local d:Byte Ptr=ReadDir( dir )
 	Local d:Byte Ptr=ReadDir( dir )
-	If Not d Return
-	Local i$[100],n
+	If Not d Return Null
+	Local i$[100],n:Int
 	Repeat
 	Repeat
 		Local f$=NextFile( d )
 		Local f$=NextFile( d )
 		If Not f Exit
 		If Not f Exit
@@ -449,15 +451,15 @@ to cache the contents of the file to ensure serial streams such as
 http: based url's are seekable. Use the #CloseStream command when
 http: based url's are seekable. Use the #CloseStream command when
 finished reading and or writing to a Stream returned by #OpenFile.
 finished reading and or writing to a Stream returned by #OpenFile.
 End Rem
 End Rem
-Function OpenFile:TStream( url:Object,readable=True,writeable=True )
+Function OpenFile:TStream( url:Object,readable:Int=True,writeable:Int=True )
 	Local stream:TStream=OpenStream( url,readable,writeable )
 	Local stream:TStream=OpenStream( url,readable,writeable )
-	If Not stream Return
+	If Not stream Return Null
 	If stream.Pos()=-1 Return TBankStream.Create( TBank.Load(stream) )
 	If stream.Pos()=-1 Return TBankStream.Create( TBank.Load(stream) )
 	Return stream
 	Return stream
 End Function
 End Function
 
 
 Rem
 Rem
-bbdoc: Open a file for input.
+bbdoc: Open a file For Input.
 about:
 about:
 This command is similar to the #ReadStream command but will attempt
 This command is similar to the #ReadStream command but will attempt
 to cache the contents of the file to ensure serial streams such as 
 to cache the contents of the file to ensure serial streams such as 

+ 15 - 13
font.mod/font.bmx

@@ -1,44 +1,46 @@
 
 
-Strict
+SuperStrict
 
 
 Module BRL.Font
 Module BRL.Font
 
 
-ModuleInfo "Version: 1.05"
+ModuleInfo "Version: 1.06"
 ModuleInfo "Author: Mark Sibly"
 ModuleInfo "Author: Mark Sibly"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 ModuleInfo "Modserver: BRL"
 
 
+ModuleInfo "History: 1.06"
+ModuleInfo "History: Module is now SuperStrict"
 ModuleInfo "History: 1.05 Release"
 ModuleInfo "History: 1.05 Release"
 ModuleInfo "History: Modified interface for improved unicode support"
 ModuleInfo "History: Modified interface for improved unicode support"
 
 
-Const BOLDFONT=1
-Const ITALICFONT=2
-Const SMOOTHFONT=4
+Const BOLDFONT:Int=1
+Const ITALICFONT:Int=2
+Const SMOOTHFONT:Int=4
 
 
 Type TGlyph
 Type TGlyph
 	
 	
 	Method Pixels:Object() Abstract
 	Method Pixels:Object() Abstract
 
 
 	Method Advance#() Abstract
 	Method Advance#() Abstract
-	Method GetRect( x Var,y Var,width Var,height Var ) Abstract
+	Method GetRect( x:Int Var,y:Int Var,width:Int Var,height:Int Var ) Abstract
 
 
 End Type
 End Type
 
 
 Type TFont
 Type TFont
 
 
-	Method Style() Abstract
-	Method Height() Abstract
-	Method CountGlyphs() Abstract
-	Method CharToGlyph( char ) Abstract
-	Method LoadGlyph:TGlyph( index ) Abstract
+	Method Style:Int() Abstract
+	Method Height:Int() Abstract
+	Method CountGlyphs:Int() Abstract
+	Method CharToGlyph:Int( char:Int ) Abstract
+	Method LoadGlyph:TGlyph( index:Int ) Abstract
 
 
 End Type
 End Type
 
 
 Type TFontLoader
 Type TFontLoader
 	Field _succ:TFontLoader
 	Field _succ:TFontLoader
 
 
-	Method LoadFont:TFont( url:Object,size,style ) Abstract
+	Method LoadFont:TFont( url:Object,size:Int,style:Int ) Abstract
 
 
 End Type
 End Type
 
 
@@ -54,7 +56,7 @@ Function AddFontLoader( loader:TFontLoader )
 	_loaders=loader
 	_loaders=loader
 End Function
 End Function
 
 
-Function LoadFont:TFont( url:Object,size,style=SMOOTHFONT )
+Function LoadFont:TFont( url:Object,size:Int,style:Int=SMOOTHFONT )
 
 
 	Local loader:TFontLoader=_loaders
 	Local loader:TFontLoader=_loaders
 	
 	

+ 25 - 23
freetypefont.mod/freetypefont.bmx

@@ -1,14 +1,16 @@
 
 
-Strict
+SuperStrict
 
 
 Module BRL.FreeTypeFont
 Module BRL.FreeTypeFont
 
 
-ModuleInfo "Version: 1.09"
+ModuleInfo "Version: 1.10"
 ModuleInfo "Author: Simon Armstrong, Mark Sibly"
 ModuleInfo "Author: Simon Armstrong, Mark Sibly"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 ModuleInfo "Modserver: BRL"
 
 
+ModuleInfo "History: 1.10"
+ModuleInfo "History: Module is now SuperStrict"
 ModuleInfo "History: 1.09 Release"
 ModuleInfo "History: 1.09 Release"
 ModuleInfo "History: Offset glyph rect to allow for smooth font border"
 ModuleInfo "History: Offset glyph rect to allow for smooth font border"
 ModuleInfo "History: 1.08 Release"
 ModuleInfo "History: 1.08 Release"
@@ -41,7 +43,7 @@ Public
 Type TFreeTypeGlyph Extends TGlyph
 Type TFreeTypeGlyph Extends TGlyph
 
 
 	Field _pixmap:TPixmap
 	Field _pixmap:TPixmap
-	Field _advance#,_x,_y,_w,_h
+	Field _advance#,_x:Int,_y:Int,_w:Int,_h:Int
 	
 	
 	Method Pixels:TPixmap()
 	Method Pixels:TPixmap()
 		If _pixmap Return _pixmap
 		If _pixmap Return _pixmap
@@ -53,7 +55,7 @@ Type TFreeTypeGlyph Extends TGlyph
 		Return _advance
 		Return _advance
 	End Method
 	End Method
 	
 	
-	Method GetRect( x Var,y Var,w Var,h Var )
+	Method GetRect( x:Int Var,y:Int Var,w:Int Var,h:Int Var )
 		x=_x
 		x=_x
 		y=_y
 		y=_y
 		w=_w
 		w=_w
@@ -66,33 +68,33 @@ Type TFreeTypeFont Extends BRL.Font.TFont
 
 
 	'Field _face:FTFace
 	'Field _face:FTFace
 	Field _ft_face:Byte Ptr
 	Field _ft_face:Byte Ptr
-	Field _style,_height
-	Field _ascend,_descend
+	Field _style:Int,_height:Int
+	Field _ascend:Int,_descend:Int
 	Field _glyphs:TFreeTypeGlyph[]
 	Field _glyphs:TFreeTypeGlyph[]
-	Field _buf:Byte Ptr,_buf_size
+	Field _buf:Byte Ptr,_buf_size:Int
 	
 	
 	Method Delete()
 	Method Delete()
 		FT_Done_Face _ft_face
 		FT_Done_Face _ft_face
 		MemFree _buf
 		MemFree _buf
 	End Method
 	End Method
 
 
-	Method Style()
+	Method Style:Int()
 		Return _style
 		Return _style
 	End Method
 	End Method
 
 
-	Method Height()
+	Method Height:Int()
 		Return _height
 		Return _height
 	End Method
 	End Method
 	
 	
-	Method CountGlyphs()
+	Method CountGlyphs:Int()
 		Return _glyphs.length
 		Return _glyphs.length
 	End Method
 	End Method
 	
 	
-	Method CharToGlyph( char )
+	Method CharToGlyph:Int( char:Int )
 		Return FT_Get_Char_Index( _ft_face,char )-1
 		Return FT_Get_Char_Index( _ft_face,char )-1
 	End Method
 	End Method
 	
 	
-	Method LoadGlyph:TFreeTypeGlyph( index )
+	Method LoadGlyph:TFreeTypeGlyph( index:Int )
 	
 	
 		Local glyph:TFreeTypeGlyph=_glyphs[index]
 		Local glyph:TFreeTypeGlyph=_glyphs[index]
 		If glyph Return glyph
 		If glyph Return glyph
@@ -126,11 +128,11 @@ Type TFreeTypeFont Extends BRL.Font.TFont
 			pixmap=TPixmap.CreateStatic( buffer,width,rows,pitch,PF_A8 ).Copy()
 			pixmap=TPixmap.CreateStatic( buffer,width,rows,pitch,PF_A8 ).Copy()
 		Else
 		Else
 			pixmap=CreatePixmap( width,rows,PF_A8 )
 			pixmap=CreatePixmap( width,rows,PF_A8 )
-			Local b
-			For Local y=0 Until rows
+			Local b:Int
+			For Local y:Int=0 Until rows
 				Local dst:Byte Ptr=pixmap.PixelPtr(0,y)
 				Local dst:Byte Ptr=pixmap.PixelPtr(0,y)
 				Local src:Byte Ptr=buffer+y*pitch
 				Local src:Byte Ptr=buffer+y*pitch
-				For Local x=0 Until width
+				For Local x:Int=0 Until width
 					If (x&7)=0 b=src[x/8]
 					If (x&7)=0 b=src[x/8]
 					If b & $80 dst[x]=$ff Else dst[x]=0
 					If b & $80 dst[x]=$ff Else dst[x]=0
 					b:+b
 					b:+b
@@ -152,30 +154,30 @@ Type TFreeTypeFont Extends BRL.Font.TFont
 
 
 	End Method
 	End Method
 	
 	
-	Function Load:TFreeTypeFont( src$,size,style )
+	Function Load:TFreeTypeFont( src$,size:Int,style:Int )
 
 
 		Global ft_lib:Byte Ptr
 		Global ft_lib:Byte Ptr
 		
 		
 		If Not ft_lib
 		If Not ft_lib
-			If FT_Init_FreeType( Varptr ft_lib ) Return
+			If FT_Init_FreeType( Varptr ft_lib ) Return Null
 		EndIf
 		EndIf
 
 
-		Local buf:Byte Ptr,buf_size
+		Local buf:Byte Ptr,buf_size:Int
 				
 				
 		Local ft_face:Byte Ptr
 		Local ft_face:Byte Ptr
 
 
 		If src.Find( "::" )>0
 		If src.Find( "::" )>0
 			Local tmp:Byte[]=LoadByteArray( src )
 			Local tmp:Byte[]=LoadByteArray( src )
 			buf_size=tmp.length
 			buf_size=tmp.length
-			If Not buf_size Return
+			If Not buf_size Return Null
 			buf=MemAlloc( buf_size )
 			buf=MemAlloc( buf_size )
 			MemCopy buf,tmp,buf_size
 			MemCopy buf,tmp,buf_size
 			If FT_New_Memory_Face( ft_lib,buf,buf_size,0,Varptr ft_face )
 			If FT_New_Memory_Face( ft_lib,buf,buf_size,0,Varptr ft_face )
 				MemFree buf
 				MemFree buf
-				Return
+				Return Null
 			EndIf
 			EndIf
 		Else
 		Else
-			If FT_New_Face( ft_lib,src$,0,Varptr ft_face ) Return
+			If FT_New_Face( ft_lib,src$,0,Varptr ft_face ) Return Null
 		EndIf
 		EndIf
 		
 		
 		While size
 		While size
@@ -184,7 +186,7 @@ Type TFreeTypeFont Extends BRL.Font.TFont
 		Wend
 		Wend
 		If Not size 
 		If Not size 
 			FT_Done_Face ft_face
 			FT_Done_Face ft_face
-			Return
+			Return Null
 		EndIf
 		EndIf
 		
 		
 		'Local face:FTFace=New FTFace
 		'Local face:FTFace=New FTFace
@@ -213,7 +215,7 @@ End Type
 
 
 Type TFreeTypeFontLoader Extends TFontLoader
 Type TFreeTypeFontLoader Extends TFontLoader
 
 
-	Method LoadFont:TFreeTypeFont( url:Object,size,style )
+	Method LoadFont:TFreeTypeFont( url:Object,size:Int,style:Int )
 	
 	
 		Local src$=String( url )
 		Local src$=String( url )
 		
 		

+ 12 - 10
random.mod/random.bmx

@@ -1,23 +1,25 @@
 
 
-Strict
+SuperStrict
 
 
 Rem
 Rem
 bbdoc: Math/Random numbers
 bbdoc: Math/Random numbers
 End Rem
 End Rem
 Module BRL.Random
 Module BRL.Random
 
 
-ModuleInfo "Version: 1.05"
+ModuleInfo "Version: 1.06"
 ModuleInfo "Author: Mark Sibly, Floyd"
 ModuleInfo "Author: Mark Sibly, Floyd"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 ModuleInfo "Modserver: BRL"
 
 
+ModuleInfo "History: 1.06"
+ModuleInfo "History: Module is now SuperStrict"
 ModuleInfo "History: 1.05 Release"
 ModuleInfo "History: 1.05 Release"
 ModuleInfo "History: Fixed Rand() with negative min value bug"
 ModuleInfo "History: Fixed Rand() with negative min value bug"
 
 
 Private
 Private
-Global	rnd_state=$1234
-Const	RND_A=48271,RND_M=2147483647,RND_Q=44488,RND_R=3399
+Global	rnd_state:Int=$1234
+Const	RND_A:Int=48271,RND_M:Int=2147483647,RND_Q:Int=44488,RND_R:Int=3399
 Public
 Public
 
 
 Rem
 Rem
@@ -77,16 +79,16 @@ The optional parameter allows you to use #Rand in 2 ways:
 * &Rand(x,y) | Random integer in the range x to y (inclusive)
 * &Rand(x,y) | Random integer in the range x to y (inclusive)
 ]
 ]
 End Rem
 End Rem
-Function Rand( min_value,max_value=1 )
-	Local range=max_value-min_value
-	If range>0 Return Int( RndDouble()*(1+range) )+min_value
-	Return Int( RndDouble()*(1-range) )+max_value
+Function Rand:Int( min_value:Int,max_value:Int=1 )
+	Local Range:Int=max_value-min_value
+	If Range>0 Return Int( RndDouble()*(1+Range) )+min_value
+	Return Int( RndDouble()*(1-Range) )+max_value
 End Function
 End Function
 
 
 Rem
 Rem
 bbdoc: Set random number generator seed
 bbdoc: Set random number generator seed
 End Rem
 End Rem
-Function SeedRnd( seed )
+Function SeedRnd( seed:Int )
 	rnd_state=seed & $7fffffff             				'enforces rnd_state >= 0
 	rnd_state=seed & $7fffffff             				'enforces rnd_state >= 0
 	If rnd_state=0 Or rnd_state=RND_M rnd_state=$1234	'disallow 0 and M
 	If rnd_state=0 Or rnd_state=RND_M rnd_state=$1234	'disallow 0 and M
 End Function
 End Function
@@ -97,6 +99,6 @@ returns: The current random number generator seed
 about: Use in conjunction with SeedRnd, RndSeed allows you to reproduce sequences of random
 about: Use in conjunction with SeedRnd, RndSeed allows you to reproduce sequences of random
 numbers.
 numbers.
 End Rem
 End Rem
-Function RndSeed()
+Function RndSeed:Int()
 	Return rnd_state
 	Return rnd_state
 End Function
 End Function