📄 datetime.hhf
字号:
procedure _dayOfWeek( dr:daterec ); @returns( "eax" ); @external( "DATE_DAYOFWEEK" ); #macro dayOfWeek( _m_, _dy_[] ); #if( @elements( _dy_ ) = 0 ) // y had better be a daterec object // if we had only one parameter. #if( @global:date._isDateRec_( _m_ ) ) @global:date._dayOfWeek( _m_ ) #else #error ( "dayOfWeek expected a daterec type as the parameter" ) #endif #elseif( @elements( _dy_ ) = 2 ) #if( @global:date._isMDY_( _m_, @text( _dy_[0] ), @text( _dy_[1])) ) @global:date._dayOfWeek ( #{ pushw( @text(_dy_[1]) ); push( ax ); push( eax ); mov( @text(_dy_[0]), al ); mov( _m_, ah ); mov( ax, [esp+4] ); pop( eax ); }# ) #else #error( "Syntax error in dayOfWeek parameter list" ); #endif #else #error ( "Error in dayOfWeek parameter list" nl "Usage: dayOfWeek( dr:daterec ) or " nl " dayOfWeek( m:word; d:word; y:word )" ) #endif #endmacro procedure _dayNumber( dr:daterec ); @returns( "eax" ); @external( "DATE_DAYNUMBER" ); #macro dayNumber( _m_, _dy_[] ); #if( @elements( _dy_ ) = 0 ) // y had better be a daterec object // if we had only one parameter. #if( @global:date._isDateRec_( _m_ ) ) @global:date._dayNumber( _m_ ) #else #error( "dayNumber expected a daterec type as the parameter" ) #endif #elseif( @elements( _dy_ ) = 2 ) #if( @global:date._isMDY_( _m_, @text( _dy_[0] ), @text( _dy_[1])) ) @global:date._dayNumber ( #{ pushw( @text(_dy_[1]) ); push( ax ); push( eax ); mov( @text(_dy_[0]), al ); mov( _m_, ah ); mov( ax, [esp+4] ); pop( eax ); }# ) #else #error( "Syntax error in dayNumber parameter list" ); #endif #else #error ( "Error in dayNumber parameter list" nl "Usage: dayNumber( dr:daterec ) or " nl " dayNumber( m:word; d:word; y:word )" ) #endif #endmacro procedure _daysLeft( dr:daterec ); @returns( "eax" ); @external( "DATE_DAYSLEFT" ); #macro daysLeft( _m_, _dy_[] ); #if( @elements( _dy_ ) = 0 ) // y had better be a daterec object // if we had only one parameter. #if( @global:date._isDateRec_( _m_ ) ) @global:date._daysLeft( _m_ ) #else #error( "daysLeft expected a daterec type as the parameter" ) #endif #elseif( @elements( _dy_ ) = 2 ) #if( @global:date._isMDY_( _m_, @text( _dy_[0] ), @text( _dy_[1])) ) @global:date._daysLeft ( #{ pushw( @text(_dy_[1]) ); push( ax ); push( eax ); mov( @text(_dy_[0]), al ); mov( _m_, ah ); mov( ax, [esp+4] ); pop( eax ); }# ) #else #error( "Syntax error in daysLeft parameter list" ); #endif #else #error ( "Error in daysLeft parameter list" nl "Usage: daysLeft( dr:daterec ) or " nl " daysLeft( m:word; d:word; y:word )" ) #endif #endmacro procedure _daysBetween( first:daterec; last:daterec ); @returns( "eax" ); @external( "DATE_DAYSBETWEEN" ); #macro daysBetween( _m_, _dy_[] ); #if( @elements( _dy_ ) = 1 ) // _m_ and _dy_[0] had better be daterec objects // if we had only one parameter. #if ( @global:date._isDateRec_( _m_ ) & @global:date._isDateRec_( @text(_dy_[0] )) ) @global:date._daysBetween( _m_, @text(_dy_[0])) #else #error ( "daysBetween expected a daterec type " "as the parameter" ) #endif #elseif( @elements( _dy_ ) = 3 ) #if ( @global:date._isMDY_( _m_, @text( _dy_[0] ), @text( _dy_[1])) & @global:date._isDateRec_( @text( _dy_[2] )) ) @global:date._daysBetween ( #{ pushw( @text(_dy_[1]) ); push( ax ); push( eax ); mov( @text(_dy_[0]), al ); mov( _m_, ah ); mov( ax, [esp+4] ); pop( eax ); }#, @text( _dy_[2] ) ) #elseif ( @global:date._isDateRec_( _m_ ) & @global:date._isMDY_ ( @text( _dy_[0] ), @text( _dy_[1]), @text( _dy[2] ) ) ) @global:date._daysBetween ( _m_, #{ pushw( @text(_dy_[2]) ); push( ax ); push( eax ); mov( @text(_dy_[1]), al ); mov( @text(_dy_[0]), ah ); mov( ax, [esp+4] ); pop( eax ); }# ) #endif #elseif( @elements( _dy_ ) = 5 ) #if ( @global:date._isMDY_( _m_, @text( _dy_[0] ), @text( _dy_[1])) & @global:date._isMDY_ ( @text( _dy_[2] ), @text( _dy_[3]), @text( _dy_[4] ) ) ) @global:date._daysBetween ( #{ pushw( @text(_dy_[1]) ); push( ax ); push( eax ); mov( @text(_dy_[0]), al ); mov( _m_, ah ); mov( ax, [esp+4] ); pop( eax ); }#, #{ pushw( @text(_dy_[4]) ); push( ax ); push( eax ); mov( @text(_dy_[3]), al ); mov( @text(_dy_[2]), ah ); mov( ax, [esp+4] ); pop( eax ); }# ) #else #error( "Syntax error in daysBetween parameter list" ); #endif #else #error ( "Error in daysBetween parameter list" ) #endif #endmacro procedure _toString( dr:daterec; s:string ); @external( "DATE_TOSTRING" ); #macro toString( _m_, _dys_[] ); #if( @elements( _dys_ ) = 1 ) // y had better be a daterec object // if we had only one parameter. #if( @global:date._isDateRec_( _m_ ) ) @global:date._toString( _m_, @text( _dys_[0] ) ) #else #error( "toString expected a daterec type as the parameter" ) #endif #elseif( @elements( _dys_ ) = 3 ) #if( @global:date._isMDY_( _m_, @text( _dy_[0] ), @text( _dy_[1])) ) @global:date._toString ( #{ pushw( @text(_dys_[1]) ); push( ax ); push( eax ); mov( @text(_dys_[0]), al ); mov( _m_, ah ); mov( ax, [esp+4] ); pop( eax ); }#, @text( _dys_[2] ) ) #else #error( "Syntax error in toString parameter list" ); #endif #else #error ( "Error in toString parameter list" nl "Usage: toString( dr:daterec; s:string ) or " nl " toString( m:word; d:word; y:word; s:string )" ) #endif #endmacro procedure _a_toString( dr:daterec ); @external( "DATE_A_TOSTRING" ); #macro a_toString( _m_, _dy_[] ); #if( @elements( _dy_ ) = 0 ) // y had better be a daterec object // if we had only one parameter. #if( @global:date._isDateRec_( _m_ ) ) @global:date._a_toString( _m_ ) #else #error ( "a_toString expected a daterec type " "as the parameter" ) #endif #elseif( @elements( _dy_ ) = 2 ) #if( @global:date._isMDY_( _m_, @text( _dy_[0] ), @text( _dy_[1])) ) @global:date._toString ( #{ pushw( @text(_dy_[1]) ); push( ax ); push( eax ); mov( @text(_dy_[0]), al ); mov( _m_, ah ); mov( ax, [esp+4] ); pop( eax ); }# ) #else #error( "Syntax error in a_toString parameter list" ); #endif #else #error ( "Error in a_toString parameter list" nl "Usage: a_toString( dr:daterec ) or " nl " a_toString( m:word; d:word; y:word )" ) #endif #endmacro procedure _print( dr:daterec ); @external( "DATE_PRINT" ); #macro print( _m_, _dy_[] ); #if( @elements( _dy_ ) = 0 ) // y had better be a daterec object // if we had only one parameter. #if( @global:date._isDateRec_( _m_ ) ) @global:date._print( _m_ ) #else #error ( "print expected a daterec type " "as the parameter" ) #endif #elseif( @elements( _dy_ ) = 2 ) #if( @global:date._isMDY_( _m_, @text( _dy_[0] ), @text( _dy_[1])) ) @global:date._print ( #{ pushw( @text(_dy_[1]) ); push( ax ); push( eax ); mov( @text(_dy_[0]), al ); mov( _m_, ah ); mov( ax, [esp+4] ); pop( eax ); }# ) #else #error( "Syntax error in print parameter list" ); #endif #else #error ( "Error in print parameter list" nl "Usage: print( dr:daterec ) or " nl " print( m:word; d:word; y:word )" ) #endif #endmacroend date;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////namespace time; @fast; type OutputFormat: enum { hhmmssAMPM, hhmmssAP, hhmmss12, hhmmss24, hhmmAMPM, hhmmAP, hhmm12,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -