Home » Archimedes archive » Acorn User » AU 1998-09.adf » Features » DesktopPD/ExtraBar/!ExLibrary/Utils/!Caret_/Caret_
DesktopPD/ExtraBar/!ExLibrary/Utils/!Caret_/Caret_
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Acorn User » AU 1998-09.adf » Features |
Filename: | DesktopPD/ExtraBar/!ExLibrary/Utils/!Caret_/Caret_ |
Read OK: | ✔ |
File size: | 06B2 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
1ON ERROR REPORT:PRINT ERL:END 2 3SYS "Wimp_ReadSysInfo",3 TO desk% 4IF desk% = 0 THEN ERROR EXT 0,"All insert commands can only be used in the desktop." 5 6DIM result% 512 7 8SYS "OS_GetEnv" TO command$ 9I%=INSTR(command$," -quit "):tail$="" 10IF I% THEN tail$=MID$(command$,INSTR(command$," ",I%+LEN" -quit ")+1) 11SYS "XOS_ReadArgs","key/A,count/A",tail$,result%,512 12 13IF result%!0 = 0 THEN ERROR EXT 0,"No key code has been given to Caret_ command handler" 14IF result%!4 = 0 THEN ERROR EXT 0,"No key repeat count has been given to Caret_ command handler" 15 16key% = FNeval(FNget_string(result%!0,255)) 17 18a$ = FNget_string(result%!4,255) 19IF LEFT$(a$,1) = CHR$(34) THEN a$ = MID$(a$,2) 20IF RIGHT$(a$) = CHR$(34) THEN a$ = LEFT$(a$) 21count% = FNeval(a$) 22 23IF key% = 0 THEN ERROR EXT 0,"Key code is not valid" 24IF count% = 0 THEN ERROR EXT 0,"Key repeat must be greater than 0" 25PROCcheck_wimp 26SYS "Wimp_GetCaretPosition",,result% 27IF (result%!0 = -1) THEN ERROR EXT 0,"No application has claimed the input focus, so insert command has failed." 28IF key% = 10 THEN key% = &D 29 30FOR lp% = 1 TO count% 31 SYS "Wimp_ProcessKey",key% 32 SYS "Wimp_Poll",,result%+24 TO r% 33 IF r% <> 0 THEN:IF (r% > 16) AND (!(result%+24+16)) = 0 THEN END 34 SYS "Wimp_GetCaretPosition",,result%+24 35 IF result%!0 <> result%!24 THEN END 36NEXT 37END 38 39DEF PROCcheck_wimp 40DIM temp% 40 41SYS "XWimp_GetCaretPosition",,temp% TO ;flags% 42IF (flags%AND1) THEN SYS "Wimp_Initialise",200,&4B534154,"Insert" TO ,task% 43ENDPROC 44 45DEF FNget_string(pointer%,length%) 46LOCAL temp$ 47IF length%=0 THEN length%=255 48FOR pointer%=pointer% TO pointer%+length%-1 49IF ?pointer%<32 THEN 50 pointer%=pointer%+length%+pointer% 51ELSE 52 temp$+=CHR$(?pointer%) 53ENDIF 54NEXT 55=temp$ 56 57DEF FNeval(text$) 58SYS "OS_EvaluateExpression",text$,result%,0 TO ,val%,ret% 59= ret%
� � �:� �:� #ș "Wimp_ReadSysInfo",3 � desk% N� desk% = 0 � � � 0,"All insert commands can only be used in the desktop." � result% 512 ș "OS_GetEnv" � command$ $I%=�command$," -quit "):tail$="" :� I% � tail$=�command$,�command$," ",I%+�" -quit ")+1) 7ș "XOS_ReadArgs","key/A,count/A",tail$,result%,512 S� result%!0 = 0 � � � 0,"No key code has been given to Caret_ command handler" [� result%!4 = 0 � � � 0,"No key repeat count has been given to Caret_ command handler" .key% = �eval(�get_string(result%!0,255)) #a$ = �get_string(result%!4,255) "� �a$,1) = �(34) � a$ = �a$,2) � �a$) = �(34) � a$ = �a$) count% = �eval(a$) 0� key% = 0 � � � 0,"Key code is not valid" <� count% = 0 � � � 0,"Key repeat must be greater than 0" �check_wimp 'ș "Wimp_GetCaretPosition",,result% j� (result%!0 = -1) � � � 0,"No application has claimed the input focus, so insert command has failed." � key% = 10 � key% = &D � lp% = 1 � count% ș "Wimp_ProcessKey",key% % ș "Wimp_Poll",,result%+24 � r% !: � r% <> 0 �:� (r% > 16) � (!(result%+24+16)) = 0 � � ", ș "Wimp_GetCaretPosition",,result%+24 ## � result%!0 <> result%!24 � � $� %� & '� �check_wimp (� temp% 40 )0ș "XWimp_GetCaretPosition",,temp% � ;flags% *G� (flags%�1) � ș "Wimp_Initialise",200,&4B534154,"Insert" � ,task% +� , -#� �get_string(pointer%,length%) .� temp$ /� length%=0 � length%=255 0,� pointer%=pointer% � pointer%+length%-1 1� ?pointer%<32 � 2( pointer%=pointer%+length%+pointer% 3� 4 temp$+=�(?pointer%) 5� 6� 7 =temp$ 8 9� �eval(text$) :;ș "OS_EvaluateExpression",text$,result%,0 � ,val%,ret% ; = ret% �
00000000 0d 00 01 0f ee 20 85 20 f6 3a f1 20 9e 3a e0 0d |..... . .:. .:..| 00000010 00 02 05 20 0d 00 03 23 c8 99 20 22 57 69 6d 70 |... ...#.. "Wimp| 00000020 5f 52 65 61 64 53 79 73 49 6e 66 6f 22 2c 33 20 |_ReadSysInfo",3 | 00000030 b8 20 64 65 73 6b 25 0d 00 04 4e e7 20 64 65 73 |. desk%...N. des| 00000040 6b 25 20 3d 20 30 20 8c 20 85 20 a2 20 30 2c 22 |k% = 0 . . . 0,"| 00000050 41 6c 6c 20 69 6e 73 65 72 74 20 63 6f 6d 6d 61 |All insert comma| 00000060 6e 64 73 20 63 61 6e 20 6f 6e 6c 79 20 62 65 20 |nds can only be | 00000070 75 73 65 64 20 69 6e 20 74 68 65 20 64 65 73 6b |used in the desk| 00000080 74 6f 70 2e 22 0d 00 05 04 0d 00 06 11 de 20 72 |top."......... r| 00000090 65 73 75 6c 74 25 20 35 31 32 0d 00 07 04 0d 00 |esult% 512......| 000000a0 08 1d c8 99 20 22 4f 53 5f 47 65 74 45 6e 76 22 |.... "OS_GetEnv"| 000000b0 20 b8 20 63 6f 6d 6d 61 6e 64 24 0d 00 09 24 49 | . command$...$I| 000000c0 25 3d a7 63 6f 6d 6d 61 6e 64 24 2c 22 20 2d 71 |%=.command$," -q| 000000d0 75 69 74 20 22 29 3a 74 61 69 6c 24 3d 22 22 0d |uit "):tail$="".| 000000e0 00 0a 3a e7 20 49 25 20 8c 20 74 61 69 6c 24 3d |..:. I% . tail$=| 000000f0 c1 63 6f 6d 6d 61 6e 64 24 2c a7 63 6f 6d 6d 61 |.command$,.comma| 00000100 6e 64 24 2c 22 20 22 2c 49 25 2b a9 22 20 2d 71 |nd$," ",I%+." -q| 00000110 75 69 74 20 22 29 2b 31 29 0d 00 0b 37 c8 99 20 |uit ")+1)...7.. | 00000120 22 58 4f 53 5f 52 65 61 64 41 72 67 73 22 2c 22 |"XOS_ReadArgs","| 00000130 6b 65 79 2f 41 2c 63 6f 75 6e 74 2f 41 22 2c 74 |key/A,count/A",t| 00000140 61 69 6c 24 2c 72 65 73 75 6c 74 25 2c 35 31 32 |ail$,result%,512| 00000150 0d 00 0c 04 0d 00 0d 53 e7 20 72 65 73 75 6c 74 |.......S. result| 00000160 25 21 30 20 3d 20 30 20 8c 20 85 20 a2 20 30 2c |%!0 = 0 . . . 0,| 00000170 22 4e 6f 20 6b 65 79 20 63 6f 64 65 20 68 61 73 |"No key code has| 00000180 20 62 65 65 6e 20 67 69 76 65 6e 20 74 6f 20 43 | been given to C| 00000190 61 72 65 74 5f 20 63 6f 6d 6d 61 6e 64 20 68 61 |aret_ command ha| 000001a0 6e 64 6c 65 72 22 20 0d 00 0e 5b e7 20 72 65 73 |ndler" ...[. res| 000001b0 75 6c 74 25 21 34 20 3d 20 30 20 8c 20 85 20 a2 |ult%!4 = 0 . . .| 000001c0 20 30 2c 22 4e 6f 20 6b 65 79 20 72 65 70 65 61 | 0,"No key repea| 000001d0 74 20 63 6f 75 6e 74 20 68 61 73 20 62 65 65 6e |t count has been| 000001e0 20 67 69 76 65 6e 20 74 6f 20 43 61 72 65 74 5f | given to Caret_| 000001f0 20 63 6f 6d 6d 61 6e 64 20 68 61 6e 64 6c 65 72 | command handler| 00000200 22 20 0d 00 0f 04 0d 00 10 2e 6b 65 79 25 20 20 |" ........key% | 00000210 20 3d 20 a4 65 76 61 6c 28 a4 67 65 74 5f 73 74 | = .eval(.get_st| 00000220 72 69 6e 67 28 72 65 73 75 6c 74 25 21 30 2c 32 |ring(result%!0,2| 00000230 35 35 29 29 0d 00 11 04 0d 00 12 23 61 24 20 3d |55)).......#a$ =| 00000240 20 a4 67 65 74 5f 73 74 72 69 6e 67 28 72 65 73 | .get_string(res| 00000250 75 6c 74 25 21 34 2c 32 35 35 29 0d 00 13 22 e7 |ult%!4,255)...".| 00000260 20 c0 61 24 2c 31 29 20 3d 20 bd 28 33 34 29 20 | .a$,1) = .(34) | 00000270 8c 20 61 24 20 3d 20 c1 61 24 2c 32 29 0d 00 14 |. a$ = .a$,2)...| 00000280 1e e7 20 c2 61 24 29 20 3d 20 bd 28 33 34 29 20 |.. .a$) = .(34) | 00000290 8c 20 61 24 20 3d 20 c0 61 24 29 0d 00 15 16 63 |. a$ = .a$)....c| 000002a0 6f 75 6e 74 25 20 3d 20 a4 65 76 61 6c 28 61 24 |ount% = .eval(a$| 000002b0 29 0d 00 16 04 0d 00 17 30 e7 20 6b 65 79 25 20 |).......0. key% | 000002c0 3d 20 30 20 20 20 8c 20 85 20 a2 20 30 2c 22 4b |= 0 . . . 0,"K| 000002d0 65 79 20 63 6f 64 65 20 69 73 20 6e 6f 74 20 76 |ey code is not v| 000002e0 61 6c 69 64 22 0d 00 18 3c e7 20 63 6f 75 6e 74 |alid"...<. count| 000002f0 25 20 3d 20 30 20 8c 20 85 20 a2 20 30 2c 22 4b |% = 0 . . . 0,"K| 00000300 65 79 20 72 65 70 65 61 74 20 6d 75 73 74 20 62 |ey repeat must b| 00000310 65 20 67 72 65 61 74 65 72 20 74 68 61 6e 20 30 |e greater than 0| 00000320 22 0d 00 19 0f f2 63 68 65 63 6b 5f 77 69 6d 70 |".....check_wimp| 00000330 0d 00 1a 27 c8 99 20 22 57 69 6d 70 5f 47 65 74 |...'.. "Wimp_Get| 00000340 43 61 72 65 74 50 6f 73 69 74 69 6f 6e 22 2c 2c |CaretPosition",,| 00000350 72 65 73 75 6c 74 25 0d 00 1b 6a e7 20 28 72 65 |result%...j. (re| 00000360 73 75 6c 74 25 21 30 20 3d 20 2d 31 29 20 8c 20 |sult%!0 = -1) . | 00000370 85 20 a2 20 30 2c 22 4e 6f 20 61 70 70 6c 69 63 |. . 0,"No applic| 00000380 61 74 69 6f 6e 20 68 61 73 20 63 6c 61 69 6d 65 |ation has claime| 00000390 64 20 74 68 65 20 69 6e 70 75 74 20 66 6f 63 75 |d the input focu| 000003a0 73 2c 20 73 6f 20 69 6e 73 65 72 74 20 63 6f 6d |s, so insert com| 000003b0 6d 61 6e 64 20 68 61 73 20 66 61 69 6c 65 64 2e |mand has failed.| 000003c0 22 0d 00 1c 1b e7 20 6b 65 79 25 20 3d 20 31 30 |"..... key% = 10| 000003d0 20 8c 20 6b 65 79 25 20 3d 20 26 44 0d 00 1d 04 | . key% = &D....| 000003e0 0d 00 1e 16 e3 20 6c 70 25 20 3d 20 31 20 b8 20 |..... lp% = 1 . | 000003f0 63 6f 75 6e 74 25 0d 00 1f 1f 20 20 c8 99 20 22 |count%.... .. "| 00000400 57 69 6d 70 5f 50 72 6f 63 65 73 73 4b 65 79 22 |Wimp_ProcessKey"| 00000410 2c 6b 65 79 25 0d 00 20 25 20 20 c8 99 20 22 57 |,key%.. % .. "W| 00000420 69 6d 70 5f 50 6f 6c 6c 22 2c 2c 72 65 73 75 6c |imp_Poll",,resul| 00000430 74 25 2b 32 34 20 b8 20 72 25 0d 00 21 3a 20 20 |t%+24 . r%..!: | 00000440 e7 20 72 25 20 3c 3e 20 30 20 8c 3a e7 20 28 72 |. r% <> 0 .:. (r| 00000450 25 20 3e 20 31 36 29 20 80 20 28 21 28 72 65 73 |% > 16) . (!(res| 00000460 75 6c 74 25 2b 32 34 2b 31 36 29 29 20 3d 20 30 |ult%+24+16)) = 0| 00000470 20 8c 20 e0 0d 00 22 2c 20 20 c8 99 20 22 57 69 | . ...", .. "Wi| 00000480 6d 70 5f 47 65 74 43 61 72 65 74 50 6f 73 69 74 |mp_GetCaretPosit| 00000490 69 6f 6e 22 2c 2c 72 65 73 75 6c 74 25 2b 32 34 |ion",,result%+24| 000004a0 0d 00 23 23 20 20 e7 20 72 65 73 75 6c 74 25 21 |..## . result%!| 000004b0 30 20 3c 3e 20 72 65 73 75 6c 74 25 21 32 34 20 |0 <> result%!24 | 000004c0 8c 20 e0 0d 00 24 05 ed 0d 00 25 05 e0 0d 00 26 |. ...$....%....&| 000004d0 04 0d 00 27 11 dd 20 f2 63 68 65 63 6b 5f 77 69 |...'.. .check_wi| 000004e0 6d 70 0d 00 28 0e de 20 74 65 6d 70 25 20 34 30 |mp..(.. temp% 40| 000004f0 0d 00 29 30 c8 99 20 22 58 57 69 6d 70 5f 47 65 |..)0.. "XWimp_Ge| 00000500 74 43 61 72 65 74 50 6f 73 69 74 69 6f 6e 22 2c |tCaretPosition",| 00000510 2c 74 65 6d 70 25 20 b8 20 3b 66 6c 61 67 73 25 |,temp% . ;flags%| 00000520 0d 00 2a 47 e7 20 28 66 6c 61 67 73 25 80 31 29 |..*G. (flags%.1)| 00000530 20 8c 20 c8 99 20 22 57 69 6d 70 5f 49 6e 69 74 | . .. "Wimp_Init| 00000540 69 61 6c 69 73 65 22 2c 32 30 30 2c 26 34 42 35 |ialise",200,&4B5| 00000550 33 34 31 35 34 2c 22 49 6e 73 65 72 74 22 20 b8 |34154,"Insert" .| 00000560 20 2c 74 61 73 6b 25 0d 00 2b 05 e1 0d 00 2c 04 | ,task%..+....,.| 00000570 0d 00 2d 23 dd 20 a4 67 65 74 5f 73 74 72 69 6e |..-#. .get_strin| 00000580 67 28 70 6f 69 6e 74 65 72 25 2c 6c 65 6e 67 74 |g(pointer%,lengt| 00000590 68 25 29 0d 00 2e 0b ea 20 74 65 6d 70 24 0d 00 |h%)..... temp$..| 000005a0 2f 1d e7 20 6c 65 6e 67 74 68 25 3d 30 20 8c 20 |/.. length%=0 . | 000005b0 6c 65 6e 67 74 68 25 3d 32 35 35 0d 00 30 2c e3 |length%=255..0,.| 000005c0 20 70 6f 69 6e 74 65 72 25 3d 70 6f 69 6e 74 65 | pointer%=pointe| 000005d0 72 25 20 b8 20 70 6f 69 6e 74 65 72 25 2b 6c 65 |r% . pointer%+le| 000005e0 6e 67 74 68 25 2d 31 0d 00 31 14 e7 20 3f 70 6f |ngth%-1..1.. ?po| 000005f0 69 6e 74 65 72 25 3c 33 32 20 8c 0d 00 32 28 20 |inter%<32 ...2( | 00000600 20 70 6f 69 6e 74 65 72 25 3d 70 6f 69 6e 74 65 | pointer%=pointe| 00000610 72 25 2b 6c 65 6e 67 74 68 25 2b 70 6f 69 6e 74 |r%+length%+point| 00000620 65 72 25 0d 00 33 05 cc 0d 00 34 19 20 20 74 65 |er%..3....4. te| 00000630 6d 70 24 2b 3d bd 28 3f 70 6f 69 6e 74 65 72 25 |mp$+=.(?pointer%| 00000640 29 0d 00 35 05 cd 0d 00 36 05 ed 0d 00 37 0a 3d |)..5....6....7.=| 00000650 74 65 6d 70 24 0d 00 38 04 0d 00 39 12 dd 20 a4 |temp$..8...9.. .| 00000660 65 76 61 6c 28 74 65 78 74 24 29 0d 00 3a 3b c8 |eval(text$)..:;.| 00000670 99 20 22 4f 53 5f 45 76 61 6c 75 61 74 65 45 78 |. "OS_EvaluateEx| 00000680 70 72 65 73 73 69 6f 6e 22 2c 74 65 78 74 24 2c |pression",text$,| 00000690 72 65 73 75 6c 74 25 2c 30 20 b8 20 2c 76 61 6c |result%,0 . ,val| 000006a0 25 2c 72 65 74 25 0d 00 3b 0a 3d 20 72 65 74 25 |%,ret%..;.= ret%| 000006b0 0d ff |..| 000006b2