tsystem.tpl
来自「在手机操作系统symbina上使用的一个脚本扩展语言的代码实现,可以参考用于自己」· TPL 代码 · 共 1,165 行 · 第 1/2 页
TPL
1,165 行
raise 332
endif
endif
errVolumeUniqueId::
d%=d%+1
endwh
ENDP
PROC tMediaType:
local d%
local t&
while d%<=25
t&=SyMediaType&:(d%)
if d%=2
if t&<>5
raise 340
endif
elseif d%=3
if t&<>3
raise 340
endif
elseif d%=25
if t&<>7
raise 341
endif
else
if t&<>0
raise 342
endif
endif
d%=d%+1
endwh
ENDP
PROC tDisplayTaskList:
print "To Do: test Tasklist in interactive test"
ENDP
PROC tSetComputeMode:
print "To Do: test SetComputeMode in interactive test"
SySetComputeMode:(0)
SySetComputeMode:(2)
onerr err380::
SySetComputeMode:(-1)
raise 380
err380::
onerr off
onerr err381::
SySetComputeMode:(3)
raise 381
err381::
onerr off
SySetComputeMode:(1)
ENDP
PROC tRunApp:
external GRunAppRq&
local thread&
local next&
thread&=SyRunApp&:("OPL","","Rc:\opl\tsystem2.opo",2)
pause 20
if thread&<>SyThreadIdFromOpenDoc&:("c:\opl\tsystem2.opo",next&)
raise 390
endif
SyLogonToThread:(thread&,GRunAppRq&)
if GRunAppRq&<>KStatusPending32&
print "Status",GRunAppRq&
raise 391
endif
SyKillTask&:(thread&,0)
if GRunAppRq&<>KStatusPending32&
print "Status",GRunAppRq&
raise 392
endif
ENDP
PROC tRunExe:
print "To Do: find an EXE to test RunEXE with"
ENDP
PROC tLogonToThread:
rem Tested by tRunApp and tTerminateCurrentProcess
ENDP
PROC tTerminateCurrentProcess:
external GTermCurrProcRq&
local thread&
local next&
thread&=SyRunApp&:("OPL","","Rc:\opl\tsystem3.opo",2)
pause 20
SySetForeground:
SyLogonToThread:(thread&,GTermCurrProcRq&)
if GTermCurrProcRq&<>KStatusPending32&
print "Status",GTermCurrProcRq&
raise 420
endif
pause 40
print "TO DO: investigate why LogonToThread does not give the correct return result here."
rem if rq&<>-1234
rem print "Status",GTermCurrProcRq&
rem raise 421
rem endif
ENDP
PROC tTerminateProcess:
print "To Do: find EXE to test Terminate Process"
ENDP
PROC tKillCurrentProcess:
external GKillCurrProcRq&
local thread&
local next&
thread&=SyRunApp&:("OPL","","Rc:\opl\tsystem3.opo",2)
pause 20
SySetForeground:
SyLogonToThread:(thread&,GKillCurrProcRq&)
if GKillCurrProcRq&<>KStatusPending32&
print "Status",GKillCurrProcRq&
raise 440
endif
pause 40
print "TO DO: investigate why LogonToThread does not give the correct return result here."
rem if rq&<>-1234
rem print "Status",GKillCurrProcRq&
rem raise 421
rem endif
ENDP
PROC tKillProcess:
print "To Do: find EXE to test Kill Process"
ENDP
PROC tMod:
if SyMod&:(3,1) <> 0
raise 460
endif
if SyMod&:(3,2) <> 1
raise 461
endif
ENDP
PROC tXOR:
if SyXor&:(1,1) <> 0
raise 470
endif
if SyXor&:(1,3) <> 2
raise 471
endif
ENDP
PROC tLoadRsc:
local r&
r&=SyLoadRsc&:("Z:\System\Data\OPLR.RSC")
SyUnloadRsc:(r&)
onerr err480::
SyLoadRsc&:("DoesNotExist")
raise 480
err480::
onerr off
ENDP
PROC tUnLoadRsc:
rem Partially tested in tLoadRsc
print "To Do: make sure an unknown resouce leaves rather than panics (CONE 13)"
rem SyUnloadRsc:(1234)
rem raise 490
err480::
onerr off
ENDP
PROC tReadRsc:
local r&
local res$(KMaxStringLen%)
r&=SyLoadRsc&:("Z:\System\Data\OPLR.RSC")
res$=SyReadRsc$:(&4b03300c)
if res$<>"In use"
print res$
raise 500
endif
SyUnloadRsc:(r&)
ENDP
PROC tReadRscLong:
print "To Do: find a long int resource"
ENDP
PROC tCheckUid:
local u$(16)
u$=SyUidCheckSum$:(2364981,12089734,189275)
print "To Do: Make sure checkuid$ returns a reasonable value for unicode."
if u$<>""
rem print u$
rem raise 520
endif
ENDP
PROC tSetPointerGrabOn:
print "To Do: Test pointer grab with interactive test"
ENDP
PROC tMachineName:
LOCAL id
rem SyMachineUniqueId:(BYREF high&,BYREF low&)
rem if SyMachineName$:<>"WINS Pc"
rem print SyMachineName$:
rem raise 540
rem endif
ENDP
PROC tEndTask:
print "To Do: SyEndTask responds to shutdown events - write a lemming opo to test"
ENDP
PROC tKillTask:
print "To Do: SyKillTask - write a lemming opo to test"
ENDP
PROC tGetThreadIdFromOpenDoc:
rem Tested in tRunApp
ENDP
PROC tGetThreadIdFromAppUid:
print "To Do: test GetThreadIdFromAppUid"
ENDP
PROC tSetForeground:
print "To Do: test SetForeground in interactive tests"
ENDP
PROC tSetBackground:
print "To Do: test SetBackground in interactive tests"
ENDP
PROC tSetForegroundByThread:
print "To Do: test SetForegroundByThread in interactive test"
ENDP
PROC tSetBackgroundByThread:
print "To Do: test SetBackgroundByThread in interactive test"
ENDP
PROC tGetNextWindowGroupName:
print "To Do: test GetNextWindowGroupName: in interactive test"
ENDP
PROC tGetNextWindowId:
print "To Do: test GetNextWindowId in interactive test"
ENDP
PROC tSendKeyEventToApp:
print "To Do: write reciever for SendKeyEvenToApp"
ENDP
PROC tIrDAConnectToSend:
print "To Do: test IrDaConnectToSend in interactive test"
ENDP
PROC tIrDAConnectToReceive:
print "To Do: test IrDAConnectToRecieve in interactive test"
ENDP
PROC tIrDAWrite:
print "To Do: test IrDAWrite in interactive test"
ENDP
PROC tIrDARead$:
print "To Do: test IrDARead in interactive test"
ENDP
PROC tIrDAReadA:
print "To Do: test IrDAReadA in interactive test"
ENDP
PROC tIrDAWaitForDisconnect:
print "To Do: test IrDAWaintForDisconnect in interactive test"
ENDP
PROC tIrDADisconnect:
print "To Do: test IrDADisconnect"
ENDP
PROC tMainBatteryStatus:
print "To Do: test MainBatteryStatus in interactive test"
rem if SyMainBatteryStatus&:<>KBatteryGood&
rem print SyMainBatteryStatus&:
rem raise 740
rem endif
ENDP
PROC tBackupBatteryStatus:
print "To Do: test BackupBatteryStatus in interactive test"
rem if SyBackupBatteryStatus&:<>KBatteryGood&
rem print SyBackupBatteryStatus&:
rem raise 740
rem endif
ENDP
PROC tCaptureKey:
print "To do: test tCaptureKey in interactive test"
ENDP
PROC tCancelCaptureKey:
print "To do: test tCancelCaptureKey in interactive test"
ENDP
PROC tSetPointerCapture:
print "To do: test tSetPointerCapture in interactive test"
ENDP
PROC tClaimPointerGrab:
print "To do: test tClaimPointerGrab in interactive test"
ENDP
PROC tOpenFileDialog:
print "To do: test tOpenFileDialog in interactive test"
ENDP
PROC tCreateFileDialog:
print "To do: test tCreateFileDialog in interactive test"
ENDP
PROC tSaveAsFileDialog:
print "To do: test tSaveAsFileDialog in interactive test"
ENDP
PROC tIsExternalPowerPresent:
local p&
print "To do: test tIsExternalPowerPresent in interactive test"
rem p&=SyIsExternalPowerPresent&:
rem if p&<-1 or p&>0
rem raise 820
rem endif
ENDP
proc tGetThreadIdFromCaption:
local id&
local prev&
id&=SyThreadIdFromCaption&:("System",prev&)
print "Shell ThreadId is:",id&
if id&<=0
raise 850
endif
endp
proc tOsVersionMajor:
local romver&
romver&=SyROMVersionMajor&:
print "OS major version: ",romver&
if romver&<>1
raise 890
endif
endp
proc tOsVersionMinor:
local romver&
romver&=SyROMVersionMinor&:
print "OS minor version: ",romver&
if romver&<0 or romver&>5
raise 900
endif
endp
proc tRomVersionMajor:
local romver&
romver&=SyROMVersionMajor&:
print "Rom major version: ",romver&
if romver&<>1
raise 910
endif
endp
proc tRomVersionMinor:
local romver&
romver&=SyROMVersionMinor&:
print "Rom minor version: ",romver&
if romver&<0 or romver&>5
raise 920
endif
endp
proc tRomVersionBuild:
local romver&
romver&=SyROMVersionBuild&:
print "Rom build version: ",romver&
if romver&<>1 and (romver&<145 or romver&>500)
raise 930
endif
endp
proc tGetFileSize:
local size&
size&=SyFileSize&:("z:\system\opl\const.oph")
if size&<15000 or size&>20000
raise 940
endif
endp
proc TUniqueFilename:
local h%
local a$(KMaxStringLen%)
local expectedFilename$(KMaxStringLen%)
local dot&
dot&=loc(KTestFile$,".")
print dot&
expectedFilename$=left$(KTestFile$,dot&-1)+"(01)"+mid$(KTestFile$,dot&,255)
ioopen(h%,KTestFile$,2)
ioclose(h%)
a$=SyUniqueFilename$:(KTestFile$)
delete KTestFile$
if a$<>expectedFilename$
print "*** Unique Filename test failed: Unique Filename:",a$
raise 1030
else
print "Unique Filename:",a$
endif
endp
proc TIsPathVisible:
print "Path Visible:";
print SyIsPathVisible&:("c:\Documents\Test")
endp
proc TMemory:
local TotalRamInBytes&
local TotalRomInBytes&
local MaxFreeRamInBytes&
local FreeRam&
local InternalDiskRamInBytes&
rem SyMemory:(TotalRamInBytes&,TotalRomInBytes&,MaxFreeRamInBytes&,FreeRam&,InternalDiskRamInBytes&)
print "Total Ram:",TotalRamInBytes&
print "Total Rom:",TotalRomInBytes&
print "Max Free Ram:",MaxFreeRamInBytes&
print "Free Ram:",FreeRam&
print "Internal Ram:",InternalDiskRamInBytes&
endp
proc TKeyClickLoud:
REM print "Key Click Loud:",SyKeyClickLoud%:
endp
proc TKeyClickOverridden:
REM print "Key Click Overridden:",SyKeyClickOverridden%:
endp
proc TSoundDriverEnabled:
REM print "Sound driver enabled:",SySoundDriverEnabled%:
endp
proc TDisplaySize:
local displayWidthInPixels&
local displayHeightInPixels&
local xYInputWidthInPixels&
local xYInputHeightInPixels&
local physicalScreenWidth&
local physicalScreenHeight&
REM SyDisplaySize:(displayWidthInPixels&, displayHeightInPixels&, xYInputWidthInPixels&, xYInputHeightInPixels&, physicalScreenWidth&, physicalScreenHeight&)
print "Display Width In Pixels:", displayWidthInPixels&
print "Display Height In Pixels:", displayHeightInPixels&
print "XY Input Width In Pixels:", xYInputWidthInPixels&
print "XY Input Height In Pixels:", xYInputHeightInPixels&
print "Physical Screen Width:", physicalScreenWidth&
print "Physical Screen Height:", physicalScreenHeight&
endp
CONST KJVMPath$="Z:\System\Programs\Java.exe"
CONST KJVMCmdLine$=""
PROC tRunExeCmd:
PRINT "Running an exe with command line tail - thread:",SyRunExeWithCmd&:(KJVMPath$,KJVMCmdLine$)
ENDP
PROC tRunDoc:
LOCAL File$(255),Dia%,SwitchToIfRunning%
SwitchToIfRunning%=KFalse%
DO
dINIT "Select document to run"
dFILE File$,"Name,Folder,Disk",$100+$200
dCHECKBOX SwitchToIfRunning%,"Switch to if running"
dBUTTONS "Cancel",-(KKeyEsc% OR KDButtonNoLabel%),"OK",KKeyEnter% OR KDButtonNoLabel%
LOCK ON
Dia%=DIALOG
LOCK OFF
IF Dia%<>KKeyEnter%
BREAK
ENDIF
PRINT "ThreadID =",SyRunDocument&:(File$,SwitchToIfRunning%)
UNTIL 0
ENDP
PROC tOPXVersion:
ONERR Skipped::
PRINT "Version of Z:\System\OPX\SendAs.opx =",HEX$(SyGetOPXVersion&:("Z:\System\OPX\SendAs.opx"))
PRINT "Version of Z:\System\OPX\AppFrame.opx =",HEX$(SyGetOPXVersion&:("Z:\System\OPX\AppFrame.opx"))
PRINT "Version of Z:\System\OPX\Alarm.opx =",HEX$(SyGetOPXVersion&:("Z:\System\OPX\Alarm.opx"))
GOTO Skipped2::
Skipped::
PRINT "Error (";ERR;") No Version() EXPORT?"
Skipped2::
ONERR OFF
ONERR ZSysram1::
PRINT "Version of Z:\System\OPX\System.opx =",HEX$(SyGetOPXVersion&:("Z:\System\OPX\System.opx"))
GOTO ZSysram1_OK::
ZSysram1::
PRINT "Error (";ERR;")"
ZSysram1_OK::
ONERR OFF
ONERR CSysram1::
PRINT "Version of C:\System\OPX\System.opx =",HEX$(SyGetOPXVersion&:("C:\System\OPX\System.opx"))
GOTO CSysram1_OK::
CSysram1::
PRINT "Error (";ERR;")"
CSysram1_OK::
ONERR OFF
PRINT "Trying to get OPX version of non OPX file..."
ONERR NonOPX::
PRINT "Version of Z:\System\Apps\OPL\OPL.app =",HEX$(SyGetOPXVersion&:("Z:\System\Apps\OPL\OPL.app"))
GOTO NonOPX_OK::
NonOPX::
PRINT "Error (";ERR;")"
NonOPX_OK::
ONERR OFF
ENDP
proc TLinkEnableWithOptions&:
local err%
err%=_ShowLinkConfig:
TryCable::
ONERR CableErr::
PRINT "Enabling remote link to Cable/115200...."
SyRemoteLinkEnableWithOptions:(KLinkTypeCable%,KLinkBps115200%)
err%=_ShowLinkConfig:
PRINT "....please check it from System and then press any key back here. "
GET
SyRemoteLinkDisable:
GOTO TryIr::
CableErr::
PRINT "*FAILED*"
err%=-1
ONERR OFF
TryIr::
ONERR IrErr::
PRINT "Enabling remote link to IrDA/57600...."
SyRemoteLinkEnableWithOptions:(KLinkTypeIrDA%,KLinkBps57600%)
err%=_ShowLinkConfig:
PRINT "....please check it from System and then press any key back here. "
GET
SyRemoteLinkDisable:
GOTO End::
IrErr::
PRINT "*FAILED*"
err%=-1
End::
RETURN err%
endp
proc _ShowLinkConfig:
local baud%,type%
ONERR LinkNotOn::
PRINT "Getting current link config (SyRemoteLinkConfig):"
SyRemoteLinkConfig:(type%,baud%)
PRINT "Type id =",type%,", Baud id =",baud%
PRINT "type%=0 for unknown, type%=1 for cable, type%=2 for IrDA"
PRINT "baud%=0 for unknown, baud%=1 for 9600, baud%=2 for 19200"
PRINT "baud%=3 for 38400, baud%=4 for 57600, baud%=5 for 115200"
GOTO End::
LinkNotOn::
PRINT "*FAILED* -",ERR$(ERR)
return -1
End::
return 0
endp
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?