⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gpeekbit.tpl

📁 在手机操作系统symbina上使用的一个脚本扩展语言的代码实现,可以参考用于自己的开发
💻 TPL
字号:
REM gPeekbit.tpl
REM EPOC OPL automatic test code for gPeekbit.
REM Copyright (c) 1991-2000 Symbian Ltd. All rights reserved.

INCLUDE "Const.oph"
INCLUDE "hUtils.oph"

PROC Standalone:
	REM Main procedure called when not running inside test harness.
	LOADM KhUtils$
	hLink:( "gPeekbit", hThreadIdFromOplDoc&:, KhUserFull%)
	REM After standalone completion, control returns here.
	dINIT "Tests complete" :DIALOG
ENDP


proc gpeekbit:
	rem hInitTestHarness:(KhInitLocalErrorHandling%, KhInitNotUsed%)
	hRunTest%:("pk")
	hRunTest%:("fillLine")
rem	hCleanUp%:("CleanUp")
endp


proc fillLine:
	local x%,y%,eX%,eY%,dx%,gap%
	gCls
	rem at 1,8
	rem print "Fill line between points set"
	x%=1 :y%=40
	gAt x%,y%
	gap%=154
	gLineBy 0,0
	gMove gap%,0
	gLineBy 0,0
	gMove -gap%,0
	dx%=scan:
	rem at 1,1 :print dx%;" points  "
	gLineBy dx%,0
	gMove -dx%,1
	rem pause pause%
	gcls
endp


proc scan:
	local i%,mask%,l%,r%,buf%(1000),perLine%,bit%,word%

	if gWidth>1000 :raise 1 :endif
	gPeekLine gIdentity,gX,gY,buf%(),gWidth-gX
rem 	printBuf:(addr(buf%()))

	perLine%=gWidth/16+1
	while i%<perLine%
		i%=i%+1
		word%=buf%(i%)
		if word%
			mask%=1
			bit%=0
			while bit%<15
				if l%=0
					if word% and mask%
						l%=i%*16+bit%
						word%=word% and (not mask%)	:rem mask out left-hand bit
						continue		:rem test rest of bits in word for right value
					endif
				else
					if word% and mask%
						r%=i%*16+bit%
						return r%-l%
					endif
					if mask%=$4000
						mask%=$8000
					else
						mask%=mask%*2
					endif
					bit%=bit%+1				
				endif				
			endwh
		endif
	endwh
endp


proc printBuf:(pS&)
	local p&,pE&

	p&=pS&
	pE&=pS&+30
	at 1,2
 	while p&<pE&
rem 		print "$";hex$(peekW(p&)),
 		p&=p&+2
 	endwh
 	rem pause pause%
endp


proc pk:
	local buf&(1000),i%, x%,y%

	rem print "gPeekLine bits below"
	x%=10 :y%=20
	gAt x%,y%
	while i%<16
		i%=i%+1
		gLineBy 1,0
		gMove 1,0
	endwh
	gPeekLine 1,x%,y%,#addr(buf&()),32
	rem print "Peeked &";hex$(buf&(1))
	if buf&(1)<>&55555555
		raise 1
		rem print "Expect &55555555" :get :raise 1
	endif
	rem pause pause%
endp

REM End of gPeekbit.tpl

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -