home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / programs / programming / msgutils / MsgEncode (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1997-12-26  |  2KB  |  75 lines

  1.   __   _
  2.   |_) /|  Copyright Richard Atterer
  3.   | \/
  4. |  written on 23-07-1997 - Freeware
  5.  ArcWeb Message file: Replace text with references to dictionary entries
  6.  in all 'dict' tags and tags following them
  7.  NB 'dict' tags in get$ must not contain references to other dict. entries
  8. get$="RAM:MsgExpand"
  9. put$="RAM:Messages"
  10. dic$="dict"
  11. $+" ("+
  12. +")":
  13. maxfile%=9999:maxdic%=199
  14. m$(maxfile%),dic$(maxdic%),dicline%(maxdic%),dicorder%(maxdic%)
  15. get$:lines%=0:dic%=0:firstdicline%=0
  16.   a$=
  17. #g%:m$(lines%)=a$
  18. dic$)=dic$ n%=
  19. dic$+1)):dic$(n%)=
  20. a$,":")+1):dicline%(n%)=lines%:lastdicline%=lines%:
  21. firstdicline%=0 firstdicline%=lines%
  22.   lines%+=1
  23. dicentries%=0
  24. maxdic%:dicorder%(i%)=i%:
  25. dic$(i%)<>"" dicentries%=i%
  26. dicentries%-2
  27. j%=i%+1
  28. dicentries%-1:
  29. dic$(dicorder%(i%))<
  30. dic$(dicorder%(j%)) 
  31. dicorder%(i%),dicorder%(j%)
  32.  $p%=
  33. put$:
  34. "SetType "+put$+" FFF"
  35. firstdicline%-1
  36. #p%,m$(i%)
  37. $    a$=""
  38. i%=firstdicline%
  39. lastdicline%
  40.   n%=
  41. m$(i%),
  42. dic$+1))
  43. a$,dic$(n%):
  44. #p%,dic$+
  45. n%+":"+
  46. encode(a$):
  47. a$,dic$(n%)
  48. i%=lastdicline%+1
  49. lines%-1
  50.   n%=
  51. m$(i%),":")
  52. m$(i%),1)<>"#" 
  53. ,[    
  54. m$(i%)-n%>235  
  55. "Warning: Value of '"
  56. m$(i%),n%-1)"' is ";
  57. m$(i%)-n%" chars long"
  58. -/    
  59. m$(i%),n%)+
  60. encode(
  61. m$(i%),n%+1))
  62. .        
  63. #p%,m$(i%)
  64. encode(a$)
  65. i%,n%
  66. dicentries%-1
  67. :;  j%=dicorder%(i%):
  68. dic$(j%)<>"" n%=
  69. a$,dic$(j%)) 
  70. n% a$=
  71. a$,n%-1)+"%"+
  72. a$,n%+
  73. dic$(j%)):n%=-
  74. a$,dic$(j%),n%)*(dic$(j%)<>""):
  75.