📄 fileclass.hhf
字号:
#if( ! @defined( fileclass_hhf ))?fileclass_hhf := true;#includeOnce( "hla.hhf" )#includeOnce( "fileio.hhf" )/****************************************************//* *//* The FILE class: *//* *//****************************************************/namespace _hla; // make_listClass - // // This macro is used to create a base list class. // The first parameter is the name of the class to create. // The second parameter is a string listing the 'function' // names that you want converted to a class method (if not // present, it will be a class procedure). #macro make_fileClass( className, methods ); className: class var fileHandle:dword; procedure create; @external( @uppercase( @string( className ), 0 ) + "_CREATE" ); _hla.function( handle ); @returns( "eax" ); @external( "FILECLASS_HANDLE" ); _hla.function( open ) ( FileName :string; Access :@global:fileio.accessMode ); @external( "FILECLASS_OPEN" ); _hla.function( openNew )( FileName: string ); @external( "FILECLASS_OPENNEW" ); _hla.function( write )( var buffer:var; count:dword ); @external( "FILECLASS_WRITE" ); _hla.function( read )( var buffer:var; count:dword ); @external( "FILECLASS_READ" ); _hla.function( close ); @external( "FILECLASS_CLOSE" ); _hla.function( eof ); @returns( "al" ); @external( "FILECLASS_EOF" ); _hla.function( readLn ); @external( "FILECLASS_READLN" ); _hla.function( eoln ); @returns( "al" ); @external( "FILECLASS_EOLN" ); _hla.function( getc ); @returns( "AL" ); @external( "FILECLASS_GETC" ); _hla.function( gets )( s:string ); @external( "FILECLASS_GETS" ); _hla.function( a_gets ); @returns( "eax" ); @external( "FILECLASS_A_GETS" ); _hla.function( geti8 ); @returns( "al" ); @external( "FILECLASS_GETI8" ); _hla.function( geti16 ); @returns( "ax" ); @external( "FILECLASS_GETI16" ); _hla.function( geti32 ); @returns( "eax" ); @external( "FILECLASS_GETI32" ); _hla.function( geti64 ); @returns( "edx:eax" ); @external( "FILECLASS_GETI64" ); _hla.function( geti128 )( var l:lword ); @external( "FILECLASS_GETI128" ); _hla.function( getu8 ); @returns( "al" ); @external( "FILECLASS_GETU8" ); _hla.function( getu16 ); @returns( "ax" ); @external( "FILECLASS_GETU16" ); _hla.function( getu32 ); @returns( "eax" ); @external( "FILECLASS_GETU32" ); _hla.function( getu64 ); @returns( "edx:eax" ); @external( "FILECLASS_GETU64" ); _hla.function( getu128 )( var l:lword ); @external( "FILECLASS_GETU128" ); _hla.function( geth8 ); @returns( "al" ); @external( "FILECLASS_GETH8" ); _hla.function( geth16 ); @returns( "ax" ); @external( "FILECLASS_GETH16" ); _hla.function( geth32 ); @returns( "eax" ); @external( "FILECLASS_GETH32" ); _hla.function( geth64 ); @returns( "edx:eax" ); @external( "FILECLASS_GETH64" ); _hla.function( geth128 )( var l:lword ); @external( "FILECLASS_GETH128" ); _hla.function( getf ); @returns( "st0" ); @external( "FILECLASS_GETF" ); _hla.function( putbool )( b:boolean ); @external( "FILECLASS_PUTBOOL" ); _hla.function( putcset )( cs:cset ); @external( "FILECLASS_PUTCSET" ); _hla.function( putc )( c:char ); @external( "FILECLASS_PUTC" ); _hla.function( putcSize )( c:char; width:int32; fill:char ); @external( "FILECLASS_PUTCSIZE" ); _hla.function( newln ); @external( "FILECLASS_NEWLN" ); _hla.function( puts )( s:string ); @external( "FILECLASS_PUTS" ); _hla.function( putsSize ) ( s:string; width:int32; fill:char ); @external( "FILECLASS_PUTSSIZE" ); _hla.function( putb )( h:byte ); @external( "FILECLASS_PUTB" ); _hla.function( putw )( w:word ); @external( "FILECLASS_PUTW" ); _hla.function( putd )( dw:dword ); @external( "FILECLASS_PUTD" ); _hla.function( putq )( qw:qword ); @external( "FILECLASS_PUTQ" ); _hla.function( puttb )( tb:tbyte ); @external( "FILECLASS_PUTTB" ); _hla.function( putl )( l:lword ); @external( "FILECLASS_PUTL" ); _hla.function( puth8 )( h:byte ); @external( "FILECLASS_PUTH8" ); _hla.function( puth16 )( w:word ); @external( "FILECLASS_PUTH16" ); _hla.function( puth32 )( dw:dword ); @external( "FILECLASS_PUTH32" ); _hla.function( puth64 )( qw:qword ); @external( "FILECLASS_PUTH64" ); _hla.function( puth80 )( tb:tbyte ); @external( "FILECLASS_PUTH80" ); _hla.function( puth128 )( l:lword ); @external( "FILECLASS_PUTH128" ); _hla.function( puti8 ) ( b:byte ); @external( "FILECLASS_PUTI8" ); _hla.function( puti16 )( w:word ); @external( "FILECLASS_PUTI16" ); _hla.function( puti32 )( d:dword ); @external( "FILECLASS_PUTI32" ); _hla.function( puti64 )( q:qword ); @external( "FILECLASS_PUTI64" ); _hla.function( puti128 )( l:lword ); @external( "FILECLASS_PUTI128" ); _hla.function( puth8Size ) ( b:byte; width:int32; fill:char ); @external( "FILECLASS_PUTH8SIZE" ); _hla.function( puth16Size ) ( w:word; width:int32; fill:char ); @external( "FILECLASS_PUTH16SIZE" ); _hla.function( puth32Size ) ( d:dword; width:int32; fill:char ); @external( "FILECLASS_PUTH32SIZE" ); _hla.function( puth64Size ) ( q:qword; width:int32; fill:char ); @external( "FILECLASS_PUTH64SIZE" ); _hla.function( puth80Size ) ( tb:tbyte; width:int32; fill:char ); @external( "FILECLASS_PUTH80SIZE" ); _hla.function( puth128Size ) ( l:lword; width:int32; fill:char ); @external( "FILECLASS_PUTH128SIZE" ); _hla.function( puti8Size ) ( b:byte; width:int32; fill:char ); @external( "FILECLASS_PUTI8SIZE" ); _hla.function( puti16Size ) ( w:word; width:int32; fill:char ); @external( "FILECLASS_PUTI16SIZE" ); _hla.function( puti32Size ) ( d:dword; width:int32; fill:char ); @external( "FILECLASS_PUTI32SIZE" ); _hla.function( puti64Size ) ( q:qword; width:int32; fill:char ); @external( "FILECLASS_PUTI64SIZE" ); _hla.function( puti128Size ) ( l:lword; width:int32; fill:char ); @external( "FILECLASS_PUTI128SIZE" ); _hla.function( putu8 ) ( b:byte ); @external( "FILECLASS_PUTU8" ); _hla.function( putu16 )( w:word ); @external( "FILECLASS_PUTU16" ); _hla.function( putu32 )( d:dword ); @external( "FILECLASS_PUTU32" ); _hla.function( putu64 )( q:qword ); @external( "FILECLASS_PUTU64" ); _hla.function( putu128 )( l:lword ); @external( "FILECLASS_PUTU128" ); _hla.function( putu8Size ) ( b:byte; width:int32; fill:char ); @external( "FILECLASS_PUTU8SIZE" ); _hla.function( putu16Size ) ( w:word; width:int32; fill:char ); @external( "FILECLASS_PUTU16SIZE" ); _hla.function( putu32Size ) ( d:dword; width:int32; fill:char ); @external( "FILECLASS_PUTU32SIZE" ); _hla.function( putu64Size ) ( q:qword; width:int32; fill:char ); @external( "FILECLASS_PUTU64SIZE" ); _hla.function( putu128Size ) ( l:lword; width:int32; fill:char ); @external( "FILECLASS_PUTU128SIZE" ); _hla.function( putr32 ) ( r:real32; width:uns32; decpts:uns32; fill :char ); @external( "FILECLASS_PUTR32" ); _hla.function( putr64 ) ( r:real64; width:uns32; decpts:uns32; fill :char ); @external( "FILECLASS_PUTR64" ); _hla.function( putr80 ) ( r :real80; width :uns32; decpts :uns32; fill :char ); @external( "FILECLASS_PUTR80" ); _hla.function( pute32 ) ( r:real32; width:uns32 ); @external( "FILECLASS_PUTE32" ); _hla.function( pute64 ) ( r:real64; width:uns32 ); @external( "FILECLASS_PUTE64" ); _hla.function( pute80 ) ( r:real80; width:uns32 ); @external( "FILECLASS_PUTE80" ); // _put_ is used by the put macro to emit the correct // call depending upon the presence of width and decpts // parameters in addition to the value to output. #macro _put_( _obj_, _routine_, _typename_ ): _invoke_, _func_, _parms_, _realsize_, _typ_; ?_func_:string := @string:_routine_; ?_parms_:string := ""; ?_typ_:string := @string:_typename_; // Real values allow two size parameters // (width & decpts). #if( @substr( _typ_, 0, 4 ) = "real" ) #if( _width_ <> "-1" ) ?_realsize_:string := @substr( _typ_, 4, 2 ); // If decpts is <> -1, print in dec notation, // else print in sci notation. #if( _decpts_ <> "-1" ) ?_parms_:string := "," + _width_ + "," + _decpts_; #else ?_func_:string := "pute" + _realsize_; ?_parms_:string := "," + _width_; #endif #else // If the user did not specify a format size, // then use the puteXX routines with default // sizes of: real32=15, real64=22, real80=28. ?_func_:string := "pute" + _realsize_; #if( _realsize_ = "32" ) ?_parms_:string := ",15"; #elseif( _realsize_ = "64" ) ?_parms_:string := ",22"; #else ?_parms_:string := ",28"; #endif #endif #else //It's not a real type. #if( _decpts_ <> "-1" ) #error ( "Fractional width specification " "is not supported here" ) #elseif( _width_ <> "-1" ) // Width specifications are only supported for // certain types. Check for that here. #if ( _typ_ <> "uns8" & _typ_ <> "uns16" & _typ_ <> "uns32" & _typ_ <> "int8" & _typ_ <> "int16" & _typ_ <> "int32" & _typ_ <> "char" & _typ_ <> "string" & _typ_ <> "byte" & _typ_ <> "word" & _typ_ <> "dword" & _typ_ <> "qword" ) #error ( "Type " + _typ_ + " does not support width format " "option" ) #else ?_func_:string := _func_ + "Size"; ?_parms_:string := "," + _width_ + ", ' '"; #endif #endif #endif #if( @isconst( @text( _arg_ )) & _typ_ = "string" & _arg_ = "#13 #10" ) _obj_.newln();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -