MT DateList : Source

Name:MT DateList
Event Class:XUVJ
Event ID:dtlt
Resource:AEVTXUVJdtlt

Source

--- This source is written in HyperTalk for CompileIt!

global theAEEvent:R,theReply:R, handerRefCon:LongInt
global myTime:LongInt

codeResource "osax"

pascal function DateList:I theAEEvent:R, theReply:R, handerRefCon:L

  put NewPtr(24) into myWorkPtr

  put myWorkPtr into myDescPtr
  put myWorkPtr + 8 into myTimePtr
  put myWorkPtr + 22 into myStrPtr

  put AEGetParamDesc(theAEEvent@,"asst",typeBoolean,myDescPtr@) into err

  if myDescPtr@.descriptorType = typeNull then
    put false into myStrFlg
  else
    put myDescPtr@.dataHandle@@.booleanType into myStrFlg
  end if

  put AEDisposeDesc(myDescPtr@) into xErr

  put Time into myTime
  Secs2Date myTime, myTimePtr@

  put AEcreateList(nil,0,false,myDescPtr@) into err
  if err <> 0 then
    DisposPtr myWorkPtr
    return err
  end if

  repeat with bx=0 to 6
    put (myTimePtr + (bx*2)) into aPtr

    if myStrFlg then

      put aPtr@.integerType into dx
      put (dx mod 10) into zx
      put NumToChar(zx+48) into myStrPtr@.charType[1]
      put dx div 10 into dx
      put (dx mod 10) into zx
      put NumToChar(zx+48) into myStrPtr@.charType[0]

      put AEPutPtr(myDescPtr@,(bx+1),"TEXT",myStrPtr,2) into err

    else

      put AEPutPtr(myDescPtr@,(bx+1),"shor",aPtr,2) into err

    end if

    if err <> 0 then
      put AEDisposeDesc(myDescPtr@) into xerr
      DisposPtr myWorkPtr
      return err
    end if
  end repeat

  if theReply@.descriptorType <> typeNull then
    put AEPutParamDesc(theReply@, keyDirectObject,myDescPtr@) into err
  end if

  put AEDisposeDesc(myDescPtr@) into xerr
  DisposPtr myWorkPtr

  return 0
end DateList


Tanaka's osax : Source
Tanaka's osax