⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileclass.hhf

📁 High Level assembly language(HLA)软件
💻 HHF
📖 第 1 页 / 共 2 页
字号:
					#elseif( @isconst( @text( _arg_ )))						?_invoke_:text := @string( _obj_ ) + "." +_func_;						_invoke_( @text( _arg_ ) @text( _parms_ ));					#else						?_invoke_:text := @string( _obj_ ) + "." + _func_;						_invoke_						( 							(type _typename_ @text( _arg_ )) @text( _parms_ )						);					#endif				#endmacro				#macro put( _parms_[] ): 					_curparm_, _pType_, _arg_, _width_, _decpts_, 					_fVar_, _parmArray_, _id_, _fieldCnt_;					// Preserved ESI and EDI across all the					// calls in this macro.					push( esi );					push( edi );					?_fVar_:text := @LastObject;					?_curparm_:uns32 := 0;					#while( _curparm_ < @elements( _parms_ ))						// The following stmt frees up any storage						// currently in use by parmArray.						?_parmArray_:uns32 := 0;						// Get the current parameter into parmArray.						?_parmArray_ :=	@tokenize										(											_parms_[ _curparm_ ],											0,											{':'},											{												'"',												'''',												'[',												']',												'(',												')',												'{',												'}'											}										);						?_arg_ := @trim( _parmArray_[ 0 ], 0 );						#if( char( _arg_ ) in stdio._idchars_ )							?_id_ := stdio._GetID_( _arg_ );							#if							(									@class( _id_ ) = hla.cConstant								|	@class( _id_ ) = hla.cValue							)								?_id_ := _arg_;							#endif						#else							?_id_ := _arg_;						#endif						?_fieldCnt_ := @elements( _parmArray_ );						#if( _fieldCnt_ > 1 )							?_width_ := @trim( _parmArray_[ 1 ], 0 );						#else							?_width_ := "-1";						#endif						#if( _fieldCnt_ > 2 )							?_decpts_ := @trim( _parmArray_[ 2 ], 0 );						#else							?_decpts_ := "-1";						#endif						#if( _fieldCnt_ > 3 )							#error							(								"<<" + _parms_[ _curparm_ ] + ">>" +								" has too many width fields"							)						#endif												?_pType_ := @pType(  @text( _id_ ));						#if( _pType_ = hla.ptArray )							?_pType_ := 								@pType( @text( @typename( @text( _id_))));						#endif						#if( _pType_ = hla.ptBoolean )						 							file._put_( _fVar_, putbool, boolean )						#elseif( _pType_ = hla.ptUns8 )						 							file._put_( _fVar_, putu8, uns8 )						#elseif( _pType_ = hla.ptUns16 ) 													file._put_( _fVar_, putu16, uns16 )						#elseif( _pType_ = hla.ptUns32 ) 													file._put_( _fVar_, putu32, uns32 )						#elseif( _pType_ = hla.ptByte ) 													file._put_( _fVar_, putb, byte )						#elseif( _pType_ = hla.ptWord ) 													file._put_( _fVar_, putw, word )						#elseif( _pType_ = hla.ptDWord ) 													file._put_( _fVar_, putd, dword )						#elseif( _pType_ = hla.ptInt8 ) 													file._put_( _fVar_, puti8, int8 )						#elseif( _pType_ = hla.ptInt16 ) 													file._put_( _fVar_, puti16, int16 )						#elseif( _pType_ = hla.ptInt32 ) 													file._put_( _fVar_, puti32, int32 )						#elseif( _pType_ = hla.ptChar ) 													file._put_( _fVar_, putc, char )						#elseif( _pType_ = hla.ptCset ) 													file._put_( _fVar_, putcset, cset )						#elseif( _pType_ = hla.ptReal32 ) 													file._put_( _fVar_, putr32, real32 )						#elseif( _pType_ = hla.ptReal64 ) 													file._put_( _fVar_, putr64, real64 )						#elseif( _pType_ = hla.ptReal80 ) 													file._put_( _fVar_, putr80, real80 )						#elseif( _pType_ = hla.ptString )							file._put_( _fVar_, puts, string )						#elseif( @isclass( @text( _parms_[ _curparm_ ] )))							#if							( 								@defined								( 									@text									(										 _parms_[ _curparm_ ] + 										".toString" 									)								)							)								push( eax );								push( esi );								push( edi );								@text								( 									_parms_[ _curparm_ ] + 									".toString()"								);								_fVar_.puts( eax );								strfree( eax );								pop( edi );								pop( esi );								pop( eax );							#else								#error								(									"file.put: Class does not provide a "									"toString method or procedure"								);							#endif						#else							#error							( 								"file.put: Unknown data type (" +								_parms_[ _curparm_ ] +								":" +								@typename( @text( _parms_[_curparm_] )) +								")"							);						#endif						?_curparm_ := _curparm_ + 1;					#endwhile					pop( edi );					pop( esi );				#endmacro				#macro get( _parms_[] ): 					_curparm_, _pType_, _arg_, _id_, _fVar_;					?_curparm_:uns32 := 0;					?_fVar_:text := @LastObject;										// Save important registers that the "GET" macro uses.					push( eax );					push( esi );					push( edi );					// The following loop repeats once for each GET parameter					// we process.					#while( _curparm_ < @elements( _parms_ ))						// If this parameter begins with an identifier,						// there are some problems to deal with.						// The symbol table functions (e.g., @ptype) don't						// allow address expression components after the						// symbol name.  Named constants, however, do allow						// such entities.  The following code determines						// (1) is this a symbol?  (2) if it is a symbol, is						// it a constant?						//						//	For non-constant symbols, we need to strip any						// trailing non-symbol characters from the string						// (e.g., "[0]" ).						?_arg_ := @trim( _parms_[ _curparm_ ], 0 );						#if( char( _arg_ ) in stdio._idchars_ )							// If this parameter begins with an id character,							// then strip away any non-ID symbols from the							// end of the string.  Then determine if we've							// got a constant or some other class (e.g.,							// variable or procedure).  If not a constant,							// keep only the name.  If a constant, we need							// to keep all trailing characters as well.							?_id_ := stdio._GetID_( _arg_ );							#if							( 									@class( _id_ ) = hla.cConstant 								|	@class( _id_ ) = hla.cValue 							)								?_id_ := _arg_;							#endif						#else							// If it's not an ID, we need to keep everything.							?_id_ := _arg_;						#endif						// Determine the type of this parameter so we can						// call the appropriate routine to input it.						?_pType_ := @pType( @text( _id_ ));						#if( _pType_ = hla.ptArray )							?_pType_ := 								@pType( @text( @typename( @text( _id_ ))));						#endif						// Based on the type, call the appropriate library						// routine to print this value.						#if( _pType_ = hla.ptBoolean )							#error( "Boolean input is not supported" );						#elseif( _pType_ = hla.ptUns8 ) 														_fVar_.getu8();							mov( al, @text( _arg_ ));						#elseif( _pType_ = hla.ptUns16 ) 														_fVar_.getu16();							mov( ax, @text( _arg_ ));						#elseif( _pType_ = hla.ptUns32 ) 														_fVar_.getu32();							mov( eax, @text( _arg_ ));						#elseif( _pType_ = hla.ptByte ) 														_fVar_.getb();							mov( al, @text( _arg_ ));						#elseif( _pType_ = hla.ptWord ) 														_fVar_.getw();							mov( ax, @text( _arg_ ));						#elseif( _pType_ = hla.ptDWord ) 														_fVar_.getd();							mov( eax, @text( _arg_ ));						#elseif( _pType_ = hla.ptInt8 ) 														_fVar_.geti8();							mov( al, @text( _arg_ ));						#elseif( _pType_ = hla.ptInt16 ) 														_fVar_.geti16();							mov( ax, @text( _arg_ ));						#elseif( _pType_ = hla.ptInt32 ) 														_fVar_.geti32();							mov( eax, @text( _arg_ ));						#elseif( _pType_ = hla.ptChar ) 														_fVar_.getc();							mov( al, @text( _arg_ ));						#elseif( _pType_ = hla.ptCset ) 							#error( "Cset input is not supported" );						#elseif						( 								_pType_ = hla.ptReal32 							|	_pType_ = hla.ptReal64 							|	_pType_ = hla.ptReal80 						) 														_fVar_.getf();							fstp( @text( _arg_ ));						#elseif( _pType_ = hla.ptString ) 							_fVar_.gets( @text( _arg_ ));						#else							#error							( 								"stdin.get: Unknown data type (" +								_parms_[ _curparm_ ] +								":" +								@typename( @text( _id_ )) +								")"							);						#endif						?_curparm_ := _curparm_ + 1;					#endwhile					// Restore the registers pushed earlier for this 					// call to the GET macro.					pop( edi );					pop( esi );					pop( eax );				#endmacro			endclass;									#endmacro	end _hla;const	file		:text := "file_t";			// "file" is deprecated.	virtualFile	:text := "virtualFile_t";	// "virtualFile" is deprecated.	type	// Create the standard file class with all	// functions being procedures:	_hla.make_fileClass( file_t, " " );	// Create a fileClass with all the functions	// being methods:	_hla.make_fileClass	( 		virtualFile_t,		"handle "		"open "		"openNew "		"write "		"read "		"close "		"eof "		"readln "		"eoln "		"getc "		"gets "		"a_gets "		"geti8 "		"geti16 "		"geti32 "		"geti64 "		"geti128 "		"getu8 "		"getu16 "		"getu32 "		"getu64 "		"getu128 "		"geth8 "		"geth16 "		"geth32 "		"geth64 "		"geth80 "		"geth128 "		"getf "		"putbool "		"putcset "		"putc "		"putcSize "		"newln "		"puts "		"putsSize "		"putb "		"putw "		"putd "		"putq "		"puttb "		"putl "		"puth8 "		"puth16 "		"puth32 "		"puth64 "		"puth80 "		"puth128 "		"puti8 "		"puti16 "		"puti32 "		"puti64 "		"puti128 "		"puth8Size "		"puth16Size "		"puth32Size "		"puth64Size "		"puth80Size "		"puth128Size "		"puti8Size "		"puti16Size "		"puti32Size "		"puti64Size "		"puti128Size "		"putu8 "		"putu16 "		"putu32 "		"putu64 "		"putu128 "		"putu8Size "		"putu16Size "		"putu32Size "		"putu64Size "		"putu128Size "		"putr32 "		"putr64 "		"putr80 "		"pute32 "		"pute64 "		"pute80"			);	#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -