home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 4 / AUCD4.iso / education / _cogsys / _getres (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1997-10-20  |  5KB  |  235 lines

  1.  >!RunImage
  2.  GetRes
  3.  S.H.Curry III
  4.     __                 _          
  5.    (_ _|_ ._ _ ._  _  /_\ ._ ._ _ 
  6.    __) |_ | (_)| |(_|/   \|  | | |
  7.                    _|             
  8.  Last Modified 19 October, 1997
  9. prog$="!GetRes"
  10. version$="0.1"
  11. debug%=
  12. throwback%=
  13. initialised%=
  14. quit%=
  15. error(
  16.  debug% 
  17. #file%,"Page = &"+
  18. #file%,"HIMEM = &"+
  19. #file%,"LOMEM = &"+
  20. #file%,"Dim = &"+
  21. ~(used%)
  22. #file%,"WimpSlot = "+
  23. )+used%)/1024)
  24. initialised%=
  25. error(
  26. +pollmask%=
  27. _Create_Poll_Mask("0,17,18")
  28.  "Wimp_Poll",pollmask%,q% 
  29.  reason%
  30. respond(reason%)
  31.  quit%
  32. _Create_Poll_Mask(valid_list$)
  33.  more%,reason_code%,comma%
  34. mask%=%11111111111111111111
  35. more%=
  36.  more%
  37. reason_code%=
  38. (valid_list$)
  39. (!mask%=mask% 
  40.  1<<reason_code%
  41. comma%=
  42. valid_list$,",")
  43.  comma%=0 
  44. more%=
  45. -&valid_list$=
  46. valid_list$,comma%+1)
  47. =mask%
  48. respond(reason%)
  49.  reason%
  50. background
  51. 17,18:
  52. umess1
  53. background
  54. speak%=
  55. there(speakmod$)
  56.  speak%<>0 
  57. set_spkflag(
  58. set_spkflag(
  59. quit%=
  60. error(err%,err$,erl%,finish%)
  61.  i%,e%,t$,T$
  62. normpoint
  63. error(
  64.  throwback% 
  65. ("Set Basic$File <CogSys$Path>.!GetRes")
  66.  "Edit:Throwback"
  67. !q%=err%
  68. err$+=" ("+
  69. $(q%+4)=err$
  70. "Wimp_ReportError",q%,5,prog$
  71.  finish% 
  72.  q% &1000, workbuf% 256
  73. used%+=&1000
  74. used%+=256
  75.  spkflag% 7
  76. used%+=7
  77. $spkflag%="CogSpk$"
  78.  flag% 25
  79. used%+=25
  80.  no% 3
  81. used%+=3
  82. $no%="NO"+
  83.  ok% 3
  84. used%+=3
  85. $ok%="OK"+
  86. used%=0
  87. date$=
  88. $,15)
  89. mon$=
  90. $,8,3)
  91. year$=
  92. $,12,4)
  93. i$res_mod$="<CogSys$Path>.Modules"
  94. speakmod$="LoadSpeak"
  95. lAv%=
  96. initwimp:
  97.  v%<300:
  98. 99,"Must be version 3.0 WIMP or later"
  99.  debug% 
  100. initdebug
  101. read_mods
  102. set_spkflag(cond%)
  103.  On entry
  104.  R0 - pointer to variable name
  105.  R1 - pointer to variable value
  106.  R2 - len of value or negative to delete the variable
  107.  R3 - context pointer or 0 for 1st call
  108.  R4 - variable type
  109.  On Exit
  110.  R0,R1,R2 - preserved
  111.  R3 - new context pointer
  112.  R4 - variable type created if expression evaluated
  113.  cond% 
  114.  "XOS_SetVarVal",spkflag%,ok%,2,0,0
  115.  "XOS_SetVarVal",spkflag%,no%,2,0,0
  116. check_spkflag
  117.  On entry
  118.  R0 - pointer to variable name
  119.  R1 - pointer to buffer to hold variable value
  120.  R2 - max len of buffer or bit 31 set to existence/lenght of variable
  121.  R3 - context pointer or 0 for 1st call
  122.  R4 - 3 if expanded string is to be converted on return
  123.  On Exit
  124.  R0,R1 - preserved
  125.  R2 - number of bytes read
  126.  R3 - new context pointer
  127.  R4 - variable type
  128.  a%,b%,num%,c%,type%,temp$
  129. temp$=""
  130.  "XOS_ReadVarVal",spkflag%,flag%,-1,0,0 
  131.  a%,b%,num%,c%,type%
  132.  num%=0 
  133.  variable does not exist
  134.   Z%=
  135.  "XOS_ReadVarVal",spkflag%,flag%,25,0,0 
  136.  a%,b%,num%,c%,type%
  137.  type%=0  
  138.     temp$=
  139. gets(flag%,num%)
  140.     Z%=
  141.  temp$<>"OK" 
  142. bip(voice%,pitch%,dur%)
  143.  voice%,-15,pitch%,dur%
  144. gets(t%,l%)
  145.  i%,t$
  146.     t$=""
  147.  l%=0 =t$
  148.  i%=1 
  149.   t$+=
  150.  t%?(i%-1)
  151. prequit
  152. ackrec
  153. quit%=
  154. umess1
  155. ref%=q%!8
  156. task%=q%!4
  157.  task%<>taskhandle% 
  158.   mess%=q%!16
  159.  mess%
  160.  0:quit%=
  161. prequit
  162.  &502:
  163. ackrec:q%!12=ref%:
  164.  "Wimp_SendMessage",19,q%,task%
  165. initwimp
  166. $q%="TASK"
  167.  "Wimp_Initialise",310,!q%,prog$ 
  168.  !q%,taskhandle%
  169. $q%="TASK"
  170.  "Wimp_CloseDown",taskhandle%,!q%
  171. initdebug
  172.  "Pipe:$.DebugFile"
  173. file%=
  174. #file%,"Traced output from "+prog$
  175. #file%,""
  176. path$="<CogSys$Path>.DeBug"
  177.  name$=
  178. 34+"Debug Output"+
  179. +com$=
  180. 34+"Obey "+path$+".!RunDebug"+
  181. ("Wimptask TaskWindow "+com$+" -name "+name$+" -display -quit")
  182. read_mods
  183.  temp%
  184. 0num_modules%=
  185. read_number_of_files(res_mod$)
  186.  module$(num_modules%)
  187. used%+=255*num_modules%
  188. )temp%=
  189. read_files(module$(),res_mod$)
  190. read_number_of_files(DataDir$)
  191. next%=0
  192. files%=0
  193.  "OS_GBPB",10,DataDir$,workbuf%,1,next%,32,"*" 
  194.  ,,,read%,next%
  195.  (workbuf%!16=1) 
  196.  read%=1 
  197.  files%+=1
  198.  next%<0
  199. =files%
  200. read_files(array$(),DataDir$)
  201.  next%,temp$
  202. next%=0
  203. files%=0
  204.  "OS_GBPB",10,DataDir$,workbuf%,1,next%,32,"*" 
  205.  ,,,read%,next%
  206.  (workbuf%!16=1) 
  207.  read%=1 
  208.    files%+=1
  209. 4   array$(files%)=DataDir$+"."+
  210. zts(workbuf%+20)
  211.  next%<0
  212. =files%
  213. zts(T%)
  214. ?T%<>0
  215.   T$+=
  216.   T%+=1
  217. there(in$)
  218.  found%
  219. found%=0
  220.  loop%=1 
  221.  num_modules%
  222.  in$=
  223. _Leaf(module$(loop%)) 
  224.  found%=loop%
  225. =found%
  226. _Leaf(process_string$)
  227.  string$,loop%
  228. loop%=
  229. (process_string$)
  230. process_string$,loop%,1)<>"."
  231. -string$=
  232. process_string$,loop%,1)+string$
  233. loop%-=1
  234. =string$
  235.