Code archives/Miscellaneous/fmc.IOStream

This code has been declared by its author to be Public Domain code.

Download source code

fmc.IOStream by Fabian.2006
Since 2006-11-06 my modules stored in the code archives are out of synchronization. To have the latest version you need to use the bmk/syncmods utility or the MaxIDE.

You need to add "webspace100.we.funpic.de/root/mod" as a new line to "cfg/modservers.cfg" in your BlitzMax installation directory.

You can't synchronize with the default BlitzMax 1.22 IDE. If you don't have another IDE, you need to download a tweaked MaxIDE. You need to specify "fmc" as additional module scope.

Alternative you can synchronize with the bmk tool: bmk syncmods fmc

For a better description see my thread in the programming forum introducing these modules.
Strict
Module fmc.IOStream

ModuleInfo "Version: 0.04"
ModuleInfo "Modserver: Fabian"

Import brl.stream
Import brl.event

Const EVENT_READAVAIL = $80001
Const STREAMTYPE_FILE = 1
Const STREAMTYPE_COMM = 2
Const STREAMTYPE_AVAIL = 3
Const STREAMTYPE_EVENT = 4

Function StreamType ( stream:TStream )
  Select stream.Seek ( -1 )
    Case 0
      Return STREAMTYPE_FILE
    Case -1
      Return STREAMTYPE_COMM
    Case -2
      Return STREAMTYPE_AVAIL
    Case -3
      Return STREAMTYPE_EVENT
  EndSelect
EndFunction

Function IOStreamPos:Long ( stream:TStream )
  Local IO:TIOStream = TIOStream ( stream )
  If IO
    Return IO.IOPos ( )
  Else
    Return stream.Pos ( )
  EndIf
EndFunction

Function IOStreamSize:Long ( stream:TStream )
  Local IO:TIOStream = TIOStream ( stream )
  If IO
    Return IO.IOSize ( )
  Else
    Return stream.Size ( )
  EndIf
EndFunction

Function IOSeekStream:Long ( stream:TStream , pos:Long )
  Local IO:TIOStream = TIOStream ( stream )
  If IO
    Return IO.IOSeek ( pos )
  Else
    Return stream.Seek ( pos )
  EndIf
EndFunction

Type TIOStream Extends TStream
  Method Pos ( )
    Return IOPos ( )
  EndMethod

  Method Size ( )
    Return IOSize ( )
  EndMethod

  Method Seek ( pos )
    Return IOSeek ( pos )
  EndMethod

  Method IOPos:Long ( )
    Return -1
  EndMethod

  Method IOSize:Long ( )
  EndMethod

  Method IOSeek:Long ( pos:Long )
    Return -1
  EndMethod
EndType

Comments

None.

Code Archives Forum