|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #ifndef __CHAR__
- #define __CHAR__
-
- #module \
- Char
-
- #const CHAR_WIDTH 32
- #const UNKNOWN 52
-
- #defcfunc local \
- New \
- int p_posX,\
- int p_posY,\
- str p_text
- If insNum <= 0 {
- SDim charDict, 384
- SDim text, 1024
-
- BLoad "dict.dat", charDict
- }
-
- text.insNum = p_text
-
- posX.insNum = p_posX
- posY.insNum = p_posY
- size.insNum = CHAR_WIDTH
-
- exists.insNum = True
-
- insNum++
-
- Return insNum - 1
-
- #deffunc local \
- Destroy \
- int p_insId
- exists.p_insId = False
-
- Return
-
- #deffunc local \
- Draw \
- local l_cnt,\
- local l_found
- Repeat insNum
- If exists.cnt {
- l_cnt = cnt
-
- Repeat StrLen (text.l_cnt) / 3
- l_found = MyInStr (charDict, 0, StrMid (text.l_cnt, cnt * 3, 3)) / 3
-
- If darw_found < 0 {
- l_found = UNKNOWN
- }
-
- Pos posX.l_cnt + cnt * size.l_cnt, posY.l_cnt
- l_zoom = Double (size.l_cnt) / CHAR_WIDTH
- CelPut BUFFER_CHAR, l_found, l_zoom, l_zoom
- Loop
- }
- Loop
-
- Return
-
- #defcfunc local \
- MyInStr \
- str p_haystack,\
- int p_offset,\
- str p_needle
- myInStr_haystack = p_haystack
-
- myInStr_flag = True
-
- Repeat StrLen (myInStr_haystack) / 3
- SDim myInStr_work, 3
- myInStr_cnt = cnt
- Repeat 3
- Poke myInStr_work, cnt, Peek (myInStr_haystack, myInStr_cnt * 3 + cnt)
- Loop
-
- If myInStr_work = p_needle {
- myInStr_flag = False
-
- Break
- }
- Loop
-
- If myInStr_flag {
- Return -1
- }
-
- Return myInStr_cnt * 3
-
- #defcfunc local \
- MyStrMid \
- str p_string,\
- int p_offset,\
- int p_length,\
- int p_test
- myStrMid_string = p_string
-
- SDim myStrMid_return, p_length
-
- Return myStrMid_return
-
- #global
-
- #endif ; not __CHAR__
-
|