Browse Source

Made SuperStrict.

woollybah 7 years ago
parent
commit
b38e5bb6b2
1 changed files with 24 additions and 24 deletions
  1. 24 24
      freeprocess.mod/freeprocess.bmx

+ 24 - 24
freeprocess.mod/freeprocess.bmx

@@ -20,7 +20,7 @@ ModuleInfo "History: Added SIGCHLD handling and fdReapZombies function."
 ModuleInfo "History: 1.01 Release"
 ModuleInfo "History: 1.01 Release"
 ModuleInfo "History: Inserts /Contents/MacOS/ into process path for Apple app packages"
 ModuleInfo "History: Inserts /Contents/MacOS/ into process path for Apple app packages"
 
 
-Strict
+SuperStrict
 
 
 ' createproc - to launch external executable
 ' createproc - to launch external executable
 ' TPipeStream - nonblocking readlines with fd file handles
 ' TPipeStream - nonblocking readlines with fd file handles
@@ -35,23 +35,23 @@ Import "freeprocess.c"
 'processhandle should be assumed to be invalid, and neither function should be called
 'processhandle should be assumed to be invalid, and neither function should be called
 'again.
 'again.
 Extern
 Extern
-Function fdClose(fd)
-Function fdRead:Long(fd,buffer:Byte Ptr,count:Long)
-Function fdWrite:Long(fd,buffer:Byte Ptr,count:Long)
-Function fdFlush(fd)
-Function fdAvail(fd)
-Function fdProcess(exe$,in_fd Ptr,out_fd Ptr,err_fd Ptr,flags)="fdProcess"
-Function fdProcessStatus(processhandle)
-Function fdTerminateProcess(processhandle)
+Function fdClose(fd:Int)
+Function fdRead:Long(fd:Int,buffer:Byte Ptr,count:Long)
+Function fdWrite:Long(fd:Int,buffer:Byte Ptr,count:Long)
+Function fdFlush(fd:Int)
+Function fdAvail:Int(fd:Int)
+Function fdProcess:Int(exe$,in_fd:Int Ptr,out_fd:Int Ptr,err_fd:Int Ptr,flags:Int)="fdProcess"
+Function fdProcessStatus:Int(processhandle:Int)
+Function fdTerminateProcess:Int(processhandle:Int)
 End Extern
 End Extern
 
 
-Const HIDECONSOLE=1
+Const HIDECONSOLE:Int=1
 
 
 Type TPipeStream Extends TStream
 Type TPipeStream Extends TStream
 
 
 	Field	readbuffer:Byte[4096]
 	Field	readbuffer:Byte[4096]
 	Field	bufferpos:Long
 	Field	bufferpos:Long
-	Field	readhandle,writehandle
+	Field	readhandle:Int,writehandle:Int
 
 
 	Method Close()
 	Method Close()
 		If readhandle 
 		If readhandle 
@@ -76,12 +76,12 @@ Type TPipeStream Extends TStream
 		fdFlush(writehandle)
 		fdFlush(writehandle)
 	End Method
 	End Method
 		
 		
-	Method ReadAvail()
+	Method ReadAvail:Int()
 		Return fdAvail(readhandle)
 		Return fdAvail(readhandle)
 	End Method
 	End Method
 	
 	
 	Method ReadPipe:Byte[]()
 	Method ReadPipe:Byte[]()
-		Local	bytes:Byte[],n
+		Local	bytes:Byte[],n:Int
 		n=ReadAvail()
 		n=ReadAvail()
 		If n
 		If n
 			bytes=New Byte[n]
 			bytes=New Byte[n]
@@ -91,7 +91,7 @@ Type TPipeStream Extends TStream
 	End Method
 	End Method
 	
 	
 	Method ReadLine$()	'nonblocking - returns empty string if no data available
 	Method ReadLine$()	'nonblocking - returns empty string if no data available
-		Local	n:Long,r:Long,p0,p1,line$
+		Local	n:Long,r:Long,p0:Int,p1:Int,line$
 		n=ReadAvail()
 		n=ReadAvail()
 		If n
 		If n
 			If bufferpos+n>4096 n=4096-bufferpos
 			If bufferpos+n>4096 n=4096-bufferpos
@@ -116,7 +116,7 @@ Type TPipeStream Extends TStream
 		Next			
 		Next			
 	End Method
 	End Method
 
 
-	Function Create:TPipeStream( in,out )
+	Function Create:TPipeStream( in:Int,out:Int )
 		Local stream:TPipeStream=New TPipeStream
 		Local stream:TPipeStream=New TPipeStream
 		stream.readhandle=in
 		stream.readhandle=in
 		stream.writehandle=out
 		stream.writehandle=out
@@ -128,21 +128,21 @@ End Type
 Type TProcess
 Type TProcess
 	Global ProcessList:TList 
 	Global ProcessList:TList 
 	Field	name$
 	Field	name$
-	Field	handle
+	Field	handle:Int
 	Field	pipe:TPipeStream
 	Field	pipe:TPipeStream
 	Field	err:TPipeStream
 	Field	err:TPipeStream
 	Field   detached:Int
 	Field   detached:Int
 
 
-	Method Detach()
+	Method Detach:Int()
 		detached = True
 		detached = True
 		Return 1
 		Return 1
 	End Method
 	End Method
 	
 	
-	Method Attach()
+	Method Attach:Int()
 		detached = False
 		detached = False
 		Return 1
 		Return 1
 	End Method
 	End Method
-	Method Status()
+	Method Status:Int()
 		If handle 
 		If handle 
 			If fdProcessStatus(handle) Return 1
 			If fdProcessStatus(handle) Return 1
 			handle=0
 			handle=0
@@ -155,8 +155,8 @@ Type TProcess
 		If err err.Close;err=Null
 		If err err.Close;err=Null
 	End Method
 	End Method
 	
 	
-	Method Terminate()
-		Local res
+	Method Terminate:Int()
+		Local res:Int
 		If handle
 		If handle
 			res=fdTerminateProcess( handle )
 			res=fdTerminateProcess( handle )
 			handle=0
 			handle=0
@@ -164,9 +164,9 @@ Type TProcess
 		Return res
 		Return res
 	End Method
 	End Method
 
 
-	Function Create:TProcess(name$,flags)
+	Function Create:TProcess(name$,flags:Int)
 		Local	p:TProcess
 		Local	p:TProcess
-		Local	infd,outfd,errfd	
+		Local	infd:Int,outfd:Int,errfd:Int	
 ?MacOS
 ?MacOS
 		If FileType(name)=2
 		If FileType(name)=2
 			Local a$=StripExt(StripDir(name))
 			Local a$=StripExt(StripDir(name))
@@ -211,7 +211,7 @@ Rem
 bbdoc: Creates a process
 bbdoc: Creates a process
 returns: TProcess object that is linked to the process you have started
 returns: TProcess object that is linked to the process you have started
 End Rem
 End Rem
-Function CreateProcess:TProcess(cmd$,flags=0)
+Function CreateProcess:TProcess(cmd$,flags:Int=0)
 	Return TProcess.Create(cmd,flags)
 	Return TProcess.Create(cmd,flags)
 End Function
 End Function