## test data for entab/detab tester; see driver program's comments for details # # Remember that the characters --> "!.$" <-- are metacharacters, and cannot # be used randomly for punctuation; I got away with it that time by placing # them carefully # first try with default parameters (9,17,25,33,etc) x x x x x x x x !.......x !....... x !....... x !....... x !....... x !....... x !....... x !....... x !.......!.......x x!......!.......x x!.....!.......x x!....!.......x x!...!.......x x!..!.......x x!.!.......x x!!.......x # tab replaces one char as part of longer run x!.......x !.......x!......x !....... x!.....x !....... x!....x !....... x!...x !....... x!..x !....... x!.x !....... x x # tab does not replace one-char run !....... xx !.......!.......x abcde!..x abcdef!.x abcdefg x abcdefg x abcdefg x abcdefg x abcdefg x abcdefg x abcdefg x abcdefg x abcdefg!!.......x # test some lines with trailing spaces $ $ $ $ $ $ $ $ !.......$ !....... $ !....... $ !....... $ !....... $ !....... $ !....... $ !....... $ !.......!.......$ !.......!....... $ !.......!....... $ !.......!.......!.......!.......!.......!.......!.......!....... wxyz !.......!.......!.......!.......!.......!.......!.......!.......!.......xyz !.......!.......!.......!.......!.......!.......!.......!.......!....... yz !.......!.......!.......!.......!.......!.......!.......!.......!....... z !.......ENTRY!..SUUO !.......ENTRY!..NUUO !.......CAI!....1,[BYTE (9)"s","u","u","o","/","n","u","u","o",0] SUUO:!..TRZA!...T1,1!...!.......; flag suuo call NUUO:!..TRO!....T1,1!...!.......; flag nuuo call !.......MOVE!...T0,1-OFF(P)!....; get UUO code !.......MOVEM!..T0,UUO!.!.......; save uuo !.......MOVE!...T0,2-OFF(P)!....; load register value !.......XCT!....UUO!....!.......; issue UUO !....... TRZE!..T1,1!...!.......; skip unless non-skip from nuuo call !....... TRZE!..T1,1!...!.......; skip unless skip-return from nuuo call !....... HRREI!.T0,ERR!.!.......; indicate UUO failure !.......MOVE!...T1,T0!..!.......; return result in r1 !.......POPJ!...P,!.....!.......; return # now try tabs every 4 columns = entab(s,5) x xx xx x x x x x x x x x x !...x!..x !...x!.. x !... x!. x !... x!. x !... x!!...x !... x!!... x !...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...xyz xxxx xxx x xxx x xxx x xxx x xxx!!...x xxx!!... x xxx$ xxx $ xxx $ xxx $ xxx $ xxx!!...$ xxx!!... $ smatch(s1,s2) char *s1, *s2; { !...while (~((*s1 ^ *s2) & 0137)) !...!...if (~*s1) !...!...!...return 0; !...!...else !...!...!...s1++, s2++; !...return ((*s1 & 0137) - (*s2 & 0137)); } # try col 8, then every 4 = entab(s,8,12) !......01!.student-record !......!...03!.name pic x(25) !......!...03!.home-address !......!...!...05!.city pic x(15) !......!...!...05!.state pic xx !......!...!...05!.big-zip !......!...!...!...07!.zip pic 9(5) !......!...!...!...07!.plus-4 pic 9(4) !......!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...!...xyz # try irregular columns = entab(11,18,30,36) !.........entry!.sys= sys2!....xj sys3!....sa1!...a6 !.........lx1!...59-40 !.........mi x1,sys3!......wait until done if RCL bit set sys=!....subr!..=!..........entry / exit sys1!....sa1!...1 !.........nz x1,sys1!......wait ra+1 clear !.........sa6!...1!..........store request !.........eq sys2 !.........!.......!..........!.....!.....!.....!.....!.....!.....!..... xyz # and now for something completely different = entab(s,11,60) # (11,60,61) would need less scratch space on detab but few will know/use this loop:!....line = input!....................................:f(end) !.........output = line!...................................:(loop) # end cases = entab(s,2) x x !!x !!!x !!!!x !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!xyz = entab(s,2,4) x x x !!.x !!. x !!.!.x !!.!.!.!.!.!.!.!.!.!.xyz !!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.xyz = entab(s,3) x x !.x !. x !.!.x !.!.!.!.!.!.!.!.!.!.xyz !.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.!.xyz = entab(s,3,4) x x !.x !.!x !.!!x !.!!!x !.!!!!x !.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!xyz # now go back to an interval of 4 and test special characters in input = entab(s,5) # first, just tabs in the input \t$ \t $ \t $ \t $ \t!...$ \t!...$ \t!...$ \t!...$ !...\t!...$ \tx \t x \t x \t x \t!...x \t!...x \t!...x \t!...x !...\t!...x abc\tdef\tghi\tjkl smatch(s1,s2) char *s1, *s2; { \twhile (~((*s1 ^ *s2) & 0137)) \t\tif (~*s1) !...!...!...return 0; \t\telse !...!...!...s1++, s2++; \treturn ((*s1 & 0137) - (*s2 & 0137)); } # now some backspaces abc\b!.de\b!..fghij\b!...k # use irregular stops for testing wierder situations = entab(5,7,10) !...!.!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!..!.. !...!.!..\b\b\b\b\b\b\b\b\b!...!.!..!.. !...!.!..\n!...!.!..\r!...!.!..\n\r!...!.!..\r\n!...!.!.. !...\a!.\a!..\a!.. !...\b\b\b\b!...\b\a\b\a!.!.!..\n\n\n \t!.!..\n