Code: Select all
n = 1234567890123456789012345
; n = -1234567890123456789012345
; n = 9423456789012345678
; n = 9123372036854775807
maxnum := 2**63 - 1 ; 9223372036854775807
if n is not integer
a := Error(4,"001E", n " is not an integer.")
if (n < 0)
a := Error(4,"002E","Invalid number:" n ". value is negative.")
if (n = 0)
a := Error(4,"003E","Invalid number:" n ". value is 0.")
if (n > maxnum)
a := Error(4,"004E","Unallowable integer " n ". Value exceeds 2**63 - 1 ("maxnum ")")
a := Error(0,"000I", "Acceptable positive integer < 2**63")
error(errorrc=0,errnum="666E",errtext="",log=1,msgbox=1)
{
; if log
; Write_log(A_scriptname,errnum,errtext)
if msgbox
Msgbox,,%A_ScriptName%, %errorrc% %errnum% %errtext%
exitapp, %errorrc%
}
Code: Select all
n = 1234567890123456789012345
;n = -1234567890123456789012345
;n = 9423456789012345678
;n = 9123372036854775807
maxnum := 2**63 - 1 ; 9223372036854775807
if n is not integer
a := Error(4,"001E", n " is not an integer.")
if (n < 0)
a := Error(4,"002E","Invalid number:" n ". value is negative.")
if (n = 0)
a := Error(4,"003E","Invalid number:" n ". value is 0.")
if (strlen(n) > 19)
a := Error(4,"004E","Unallowable integer " n ". Value exceeds 2**63 - 1 ("maxnum ")")
if (strlen(n) = 19 and substr(n,1,1) = 9 and substr(n,2) > substr(maxnum,2))
a := Error(4,"005E","Unallowable integer " n ". Value exceeds 2**63 - 1 ("maxnum ")")
a := Error(0,"000I", "Acceptable positive integer < 2**63")
exitapp
error(errorrc=0,errnum="666E",errtext="",log=1,msgbox=1)
{
; if log
; Write_log(A_scriptname,errnum,errtext)
if msgbox
Msgbox,,%A_ScriptName%, %errorrc% %errnum% %errtext%
exitapp, %errorrc%
}