2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
11 #include <gclib/gclib.h>
15 #include "../the_tt.h"
29 pair_t
* d_attachment
= NULL
;
32 #define TN(ch) do { t_new[ii] = ch; ++ii; } while (0)
34 inline void t_attach ()
37 d_attachment
[t_op_no
].pair_op
= t_op_no
;
38 d_attachment
[t_op_no
].pair_line
= nlines
;
39 d_attachment
[t_op_no
].offset
= i
;
42 inline void tt_skip ()
44 while (T
!= '\n' && i
< t_size
)
62 for (; i
< t_size
; ++i
) {
66 if (! strncmp (&t_map
[i
], ptrn
, 3))
73 int py_tt (char * d_input
, int size
, char * d_output
)
77 bool b_newline
= true;
88 for (i
= 0; i
< t_size
; ++i
) {
92 if (! strncmp (&t_map
[i
], "\"\"\"", 3) ||
93 ! strncmp (&t_map
[i
], "'''", 3)) {
98 if (T
== '\"' || T
== '\'') {
100 S
= sstrend (&t_map
[i
]);
101 assert (S
== NULL
, "\n\nSibadi 2006\n\n");
102 nlines
+= Dsyms (&t_map
[i
], S
, '\n');
114 if (T
== ' ' || T
== '\t') {
147 char * py_tt_file (struct tt_state_t
* tt
)
152 if (access (tt
->d_file_name
, R_OK
) != F_OK
) {
153 fprintf (stderr
, "No such file %s\n", tt
->d_file_name
);
159 tt
->d_output
= CNEW (char, 1024*1024);
161 d_attachment
= (pair_t
*) CNEW (char, 1024*1024);
163 tt
->d_attachment
= d_attachment
;
164 tt
->d_output_size
= py_tt (tt
->d_file_in
, tt
->d_filein_size
, tt
->d_output
);
168 char t_op (char ** d_in
, char ** d_prev
)
177 if (*d_ptr
== '\n' || *d_ptr
== ':') {
190 } // namespace PYTHON