MT Digit String : Source
| Name: | MT Digit String
|
| Event Class: | XUVJ
|
| Event ID: | ntds
|
| Resource: | AEVTXUVJntds
|
Source
--- This source is written in HyperTalk for CompileIt!
global myType:OStype, mySize:longInt, myactSize:longInt
global theAEEvent:R,theReply:R, handerRefCon:LongInt
codeResource "osax"
pascal function NumToDigitStr:I theAEEvent:R, theReply:R, handerRefCon:L
put NewPtrClear(4) into paramPtr
put AEGetParamPtr(theAEEvent@,"digi","shor",typeCode,paramPtr,2,myactSize) into err
if err <> 0 then
DisposPtr paramPtr
return err
end if
put paramPtr@.integerType into tgDig
if tgDig < 1 then
put 0 into tgDig
end if
put AEGetParamPtr(theAEEvent@,keyDirectObject,"long",typeCode,paramPtr,4,myactSize) into err
if err <> 0 then
DisposPtr paramPtr
return err
end if
put paramPtr@.longIntType into xInt
if xInt < 0 and tgDig <> 0 then
add 1 to tgDig
put true into negFlg
put abs(xInt) into xInt
else
put false into negFlg
end if
put NewPtr(tgDig) into myStrPtr
if tgDig > 1 then
put 0 into baseOff
if negFlg then
put "-" into myStrPtr@.charType[0]
add 1 to baseOff
end if
repeat with y= (tgDig-1) down to baseOff
put NumToChar((xInt mod 10)+48) into myStrPtr@.charType[y]
put (xInt div 10) into xInt
end repeat
end if
if theReply@.descriptorType <> typeNull then
put AEPutParamPtr(theReply@, keyDirectObject, typeChar,myStrPtr,tgDig) into err
end if
DisposPtr myStrPtr
DisposPtr paramPtr
return 0
end NumToDigitStr
Tanaka's osax : Source
Tanaka's osax