Debian Codegraph @

texk/dvipsk/vms/texc_scr.com

raw
1 $!----------------------------------------------------------------------
2 $!
3 $! TEXC_SCR.COM
4 $!
5 $! Convert TEX.LPRO to TEXC.LPRO
6 $! This command file replaces the TexC.script file, intended for Unix OS,
7 $! with its TPU equivalent.
8 $!
9 $! Tony McGrath 5-OCT-1990
10 $! Dept. of Physics, Monash University, Victoria, Australia 3168
11 $!
12 $!----------------------------------------------------------------------
13 $!
14 $ Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output=TEXC.LPRO TEX.LPRO
15 !
16 PROCEDURE texc$script
17
18 LOCAL string_1, string_2, string_3, a_range, a_line, two_chars;
19
20 !-----------------------------------------------------------------------
21 ! Won't bother with CREATE_ARRAY, try to keep the TPU as basic as possible
22 ! so it works on older versions of VMS.
23 !-----------------------------------------------------------------------
24 string_1 := "% begin code for uncompressed fonts only";
25 string_2 := "% end code for uncompressed fonts only";
26 string_3 := "% end of code for unpacking compressed fonts";
27 !-----------------------------------------------------------------------
28 ! Search for the first of the 3 special strings.
29 ! Exit if we can't find it.
30 !-----------------------------------------------------------------------
31 a_range := search( string_1, forward);
32 if( a_range = 0)
33 then
34 message( "TEXC-F-NoString, Couldn't locate first string, Aborting");
35 return(0);
36 endif;
37 !-----------------------------------------------------------------------
38 ! Go to the start of the first string.
39 !-----------------------------------------------------------------------
40 position( beginning_of( a_range));
41 !-----------------------------------------------------------------------
42 ! Search for the second of the 3 special strings.
43 ! Exit if we can't find it.
44 !-----------------------------------------------------------------------
45 a_range := search( string_2, forward);
46 if( a_range = 0)
47 then
48 message( "TEXC-F-NoString, Couldn't locate second string, Aborting");
49 return(0);
50 endif;
51 !-----------------------------------------------------------------------
52 ! Then start deleting lines until the second special string is found.
53 !-----------------------------------------------------------------------
54 loop
55 a_line := erase_line;
56 exitif a_line = string_2;
57 endloop;
58 !-----------------------------------------------------------------------
59 ! Search for the third of the 3 special strings.
60 ! Exit if we can't find it.
61 !-----------------------------------------------------------------------
62 a_range := search( string_3, forward);
63 if( a_range = 0)
64 then
65 message( "TEXC-F-NoString, Couldn't locate third string, Aborting");
66 return(0);
67 endif;
68 !-----------------------------------------------------------------------
69 ! Again start looping, deleting the first 2 characters from each line
70 ! until the 3rd special string is found, making sure that the first two
71 ! characters are "% "
72 !-----------------------------------------------------------------------
73 loop
74 two_chars := erase_character(2);
75 if two_chars <> "% "
76 then
77 message( "TEXC-F-NoComment, First 2 chars not correct, Aborting");
78 return(0);
79 endif;
80 exitif current_line = string_3;
81 move_vertical(1);
82 endloop;
83 !-----------------------------------------------------------------------
84 ! Assume all is well, return TRUE.
85 !-----------------------------------------------------------------------
86 return(1);
87
88 ENDPROCEDURE
89 !-----------------------------------------------------------------------
90 ! Initialize the main buffer.
91 !-----------------------------------------------------------------------
92 f:=Get_Info(Command_Line,"File_Name");
93 b:=Create_Buffer("",f);
94 o:=Get_Info(Command_Line,"Output_File");
95 Set (Output_File,b,o);
96 Position (Beginning_of(b));
97 !
98 if texc$script
99 then
100 Exit;
101 else
102 message( "TEXC-W-NoSave, current buffer not saved, errors were encountered");
103 Quit;
104 endif;