home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / icon / dos / src / tests / endetab.dat < prev    next >
Text File  |  1992-02-09  |  6KB  |  259 lines

  1. ##  test data for entab/detab tester; see driver program's comments for details
  2. #
  3. #   Remember that the characters --> "!.$" <-- are metacharacters, and cannot
  4. #   be used randomly for punctuation;  I got away with it that time by placing
  5. #   them carefully <stop>
  6.  
  7. # first try with default parameters (9,17,25,33,etc)
  8.  
  9. x
  10.  x
  11.   x
  12.    x
  13.     x
  14.      x
  15.       x
  16.        x
  17. !.......x
  18. !....... x
  19. !.......  x
  20. !.......   x
  21. !.......    x
  22. !.......     x
  23. !.......      x
  24. !.......       x
  25. !.......!.......x
  26. x!......!.......x
  27.  x!.....!.......x
  28.   x!....!.......x
  29.    x!...!.......x
  30.     x!..!.......x
  31.      x!.!.......x
  32.       x!!.......x    # tab replaces one char as part of longer run
  33.        x!.......x
  34. !.......x!......x
  35. !....... x!.....x
  36. !.......  x!....x
  37. !.......   x!...x
  38. !.......    x!..x
  39. !.......     x!.x
  40. !.......      x x    # tab does not replace one-char run
  41. !.......       xx
  42. !.......!.......x
  43. abcde!..x
  44. abcdef!.x
  45. abcdefg x
  46. abcdefg  x
  47. abcdefg   x
  48. abcdefg    x
  49. abcdefg     x
  50. abcdefg      x
  51. abcdefg       x
  52. abcdefg        x
  53. abcdefg!!.......x
  54.  
  55. # test some lines with trailing spaces
  56. $
  57.  $
  58.   $
  59.    $
  60.     $
  61.      $
  62.       $
  63.        $
  64. !.......$
  65. !....... $
  66. !.......  $
  67. !.......   $
  68. !.......    $
  69. !.......     $
  70. !.......      $
  71. !.......       $
  72. !.......!.......$
  73. !.......!....... $
  74. !.......!.......  $
  75.  
  76. !.......!.......!.......!.......!.......!.......!.......!.......       wxyz
  77. !.......!.......!.......!.......!.......!.......!.......!.......!.......xyz
  78. !.......!.......!.......!.......!.......!.......!.......!.......!....... yz
  79. !.......!.......!.......!.......!.......!.......!.......!.......!.......  z
  80.  
  81. !.......ENTRY!..SUUO
  82. !.......ENTRY!..NUUO
  83. !.......CAI!....1,[BYTE (9)"s","u","u","o","/","n","u","u","o",0]
  84. SUUO:!..TRZA!...T1,1!...!.......; flag suuo call
  85. NUUO:!..TRO!....T1,1!...!.......; flag nuuo call
  86. !.......MOVE!...T0,1-OFF(P)!....; get UUO code
  87. !.......MOVEM!..T0,UUO!.!.......; save uuo
  88. !.......MOVE!...T0,2-OFF(P)!....; load register value
  89. !.......XCT!....UUO!....!.......; issue UUO
  90. !....... TRZE!..T1,1!...!.......; skip unless non-skip from nuuo call
  91. !....... TRZE!..T1,1!...!.......; skip unless skip-return from nuuo call
  92. !....... HRREI!.T0,ERR!.!.......; indicate UUO failure
  93. !.......MOVE!...T1,T0!..!.......; return result in r1
  94. !.......POPJ!...P,!.....!.......; return
  95.  
  96. # now try tabs every 4 columns
  97. = entab(s,5)
  98.  
  99. x
  100. xx
  101.  xx
  102.  x x
  103.   x x
  104.   x  x
  105.    x  x
  106.    x   x
  107. !...x!..x
  108. !...x!.. x
  109. !... x!.  x
  110. !... x!.   x
  111. !...  x!!...x
  112. !...  x!!... x
  113. !...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...xyz
  114.  
  115. xxxx
  116. xxx x
  117. xxx  x
  118. xxx   x
  119. xxx    x
  120. xxx!!...x
  121. xxx!!... x
  122.  
  123. xxx$
  124. xxx $
  125. xxx  $
  126. xxx   $
  127. xxx    $
  128. xxx!!...$
  129. xxx!!... $
  130.  
  131. smatch(s1,s2)
  132. char *s1, *s2;
  133. {
  134. !...while (~((*s1 ^ *s2) & 0137))
  135. !...!...if (~*s1)
  136. !...!...!...return 0;
  137. !...!...else
  138. !...!...!...s1++, s2++;
  139. !...return ((*s1 & 0137) - (*s2 & 0137));
  140. }
  141.  
  142. # try col 8, then every 4
  143. = entab(s,8,12)
  144. !......01!.student-record
  145. !......!...03!.name pic x(25)
  146. !......!...03!.home-address
  147. !......!...!...05!.city pic x(15)
  148. !......!...!...05!.state pic xx
  149. !......!...!...05!.big-zip
  150. !......!...!...!...07!.zip pic 9(5)
  151. !......!...!...!...07!.plus-4 pic 9(4)
  152. !......!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...xyz
  153.  
  154. # try irregular columns
  155. = entab(11,18,30,36)
  156. !.........entry!.sys=
  157.  sys2!....xj
  158.  sys3!....sa1!...a6
  159. !.........lx1!...59-40
  160. !.........mi   x1,sys3!......wait until done if RCL bit set
  161.  sys=!....subr!..=!..........entry / exit
  162.  sys1!....sa1!...1
  163. !.........nz   x1,sys1!......wait ra+1 clear
  164. !.........sa6!...1!..........store request
  165. !.........eq   sys2
  166. !.........!.......!..........!.....!.....!.....!.....!.....!.....!.....   xyz
  167.  
  168. # and now for something completely different
  169. = entab(s,11,60) 
  170. # (11,60,61) would need less scratch space on detab but few will know/use this
  171.  
  172. loop:!....line = input!....................................:f(end)
  173. !.........output = line!...................................:(loop)
  174.  
  175. # end cases
  176. = entab(s,2)
  177. x
  178.  x
  179. !!x
  180. !!!x
  181. !!!!x
  182. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!xyz
  183.  
  184. = entab(s,2,4)
  185. x
  186.  x
  187.   x
  188. !!.x
  189. !!. x
  190. !!.!.x
  191. !!.!.!.!.!.!.!.!.!.!.xyz
  192. !!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.xyz
  193.  
  194. = entab(s,3)
  195. x
  196.  x
  197. !.x
  198. !. x
  199. !.!.x
  200. !.!.!.!.!.!.!.!.!.!.xyz
  201. !.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.xyz
  202.  
  203. = entab(s,3,4)
  204. x
  205.  x
  206. !.x
  207. !.!x
  208. !.!!x
  209. !.!!!x
  210. !.!!!!x
  211. !.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!xyz
  212.  
  213. # now go back to an interval of 4 and test special characters in input
  214. = entab(s,5)
  215.  
  216. # first, just tabs in the input
  217. \t$
  218. \t $
  219. \t  $
  220. \t   $
  221. \t!...$
  222.  \t!...$
  223.   \t!...$
  224.    \t!...$
  225. !...\t!...$
  226. \tx
  227. \t x
  228. \t  x
  229. \t   x
  230. \t!...x
  231.  \t!...x
  232.   \t!...x
  233.    \t!...x
  234. !...\t!...x
  235. abc\tdef\tghi\tjkl
  236.  
  237.  
  238. smatch(s1,s2)
  239. char *s1, *s2;
  240. {
  241. \twhile (~((*s1 ^ *s2) & 0137))
  242. \t\tif (~*s1)
  243. !...!...!...return 0;
  244.    \t\telse
  245. !...!...!...s1++, s2++;
  246.   \treturn ((*s1 & 0137) - (*s2 & 0137));
  247. }
  248.  
  249. # now some backspaces
  250. abc\b!.de\b!..fghij\b!...k
  251.  
  252. # use irregular stops for testing wierder situations
  253. = entab(5,7,10)
  254. !...!.!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..
  255. !...!.!..\b\b\b\b\b\b\b\b\b!...!.!..!..
  256. !...!.!..\n!...!.!..\r!...!.!..\n\r!...!.!..\r\n!...!.!..
  257. !...\a!.\a!..\a!..
  258. !...\b\b\b\b!...\b\a\b\a!.!.!..\n\n\n  \t!.!..\n
  259.