home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / internet / readnews / BuildActiv (.txt) < prev   
RISC OS BBC BASIC V Source  |  1994-04-12  |  3KB  |  123 lines

  1.  >BuildActiv
  2.  Builds the active file by scanning the newsbase for articles
  3.  and deleting any ~seq files found.
  4. $+" (Code "+
  5. _assemble(64)
  6. dbsize%=256
  7.  dirbuf% dbsize%,tmpblk% 512
  8. "active$=
  9. sysvar("News$Active")
  10. )newsbase$=
  11. sysvar("ReadNews$NewsDir")
  12. out%=
  13.  active$
  14. scan("")
  15. #out%
  16.  "OS_File",18,active$,&FFF
  17. scan(base$)
  18.  file%,max%,file$,found%
  19. file%=0:max%=0:found%=
  20. ,  file$=
  21. read_dir(newsbase$+base$,file%)
  22.  file$>"" 
  23. 8    
  24.  "OS_File",5,newsbase$+base$+"."+file$ 
  25.  type%
  26.  type% 
  27.       
  28.  file$="~seq" 
  29. 4        
  30.  "OS_File",6,newsbase$+base$+"."+file$
  31.         file%-=1
  32.       
  33.         found%=
  34. #"        max%=
  35. max(max%,
  36. file$)
  37.       
  38. %$    
  39.  2,3:
  40. scan(base$+"."+file$)
  41. &        
  42.   file%+=1
  43.  file$=""
  44.  file$="" 
  45.  file%=1 found%=
  46.  found% 
  47. ,)  base$=
  48. groupname(
  49. lower(
  50. base$,2)))
  51. base$
  52. 40)max%
  53. #out%,base$+" "+
  54. "0000000"+
  55. (max%+1),8)+" 00000000 y"
  56. groupname(path$)
  57.  pos%
  58.   pos%=
  59. path$,"~.")
  60.  pos%>0 path$=
  61. path$,pos%-1)+
  62. path$,pos%+2)
  63.  pos%=0
  64. path$,5)="email" 
  65. path$,1)="E"
  66. =path$  
  67. lower(str$)
  68.  A%,B%,C%
  69. $tmpblk%=str$
  70. >!A%=tmpblk%:B%=A%+256:C%=
  71.  _tolowercase%
  72. max(a%,b%)
  73.  a%>b% 
  74. string0(a%)
  75.  ?a%>31 
  76. s$<255
  77.   s$+=
  78.   a%+=1
  79. read_dir(dir$,f%)
  80.  files%,file$
  81.  "OS_GBPB",9,dir$,dirbuf%,1,f%,dbsize%,"*" 
  82.  ,,,files%
  83.  files%=0 file$="" 
  84.  file$=
  85. string0(dirbuf%)
  86. =file$
  87. sysvar(var$)
  88.  len%,result$
  89.  "XOS_ReadVarVal",var$,tmpblk%,255,0,3 
  90.  ,,len%
  91.  len%>0 
  92.   tmpblk%?len%=13
  93.   result$=$tmpblk%
  94.   result$=""
  95. =result$
  96. _assemble(codelen%)
  97.  code%,pass,notcaps
  98.  code% codelen%
  99.  pass=8 
  100. P%=code%:L%=code%+codelen%
  101. [OPT pass
  102. ;tolowercase
  103. e3;Converts a string from multicase to lower case
  104. ;Entry- R0 -> Source string
  105. g$;       R1 -> Destination buffer
  106. h!;       R2 = length of string
  107. ._tolowercase%
  108. jD        cmp     r2,#0           ; Reached the end of the string?
  109.         movle   r3,#13
  110. lA        strleb  r3,[r1]         ; if so, terminate the string
  111. m1        movle   pc,r14          ;   and exit.
  112. n4        ldrb    r3,[r0],#1      ; r3 = character
  113. o8        cmp     r3,#
  114. "A"      ; is it less than "A"?
  115. pB        blt     notcaps         ; if so then don't convert it.
  116. q;        cmp     r3,#
  117. "Z"      ; is it greater than "Z"?
  118. rC        addle   r3,r3,#32       ; if not, convert to lower case
  119. .notcaps
  120. t9        strb    r3,[r1],#1      ; store the character
  121. u7        sub     r2,r2,#1        ; decrement counter
  122. v3        b       _tolowercase%   ; and loop back
  123.