2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
11 #include <gclib/gclib.h>
28 pair_t
* d_attachment
= NULL
;
31 #define TN(ch) do { t_new[ii] = ch; ++ii; } while (0)
33 inline void t_attach ()
36 d_attachment
[t_op_no
].pair_op
= t_op_no
;
37 d_attachment
[t_op_no
].pair_line
= nlines
;
38 d_attachment
[t_op_no
].offset
= i
;
41 inline void tt_skip ()
43 while (T
!= '\n' && i
< t_size
)
53 ptrn
= (char *) "'''";
55 ptrn
= (char *) "\"\"\"";
61 for (; i
< t_size
; ++i
) {
65 if (! strncmp (&t_map
[i
], ptrn
, 3))
72 int py_tt (char * d_input
, int size
, char * d_output
)
76 bool b_newline
= true;
87 for (i
= 0; i
< t_size
; ++i
) {
91 if (! strncmp (&t_map
[i
], "\"\"\"", 3) ||
92 ! strncmp (&t_map
[i
], "'''", 3)) {
97 if (T
== '\"' || T
== '\'') {
99 S
= sstrend (&t_map
[i
]);
100 assert (S
== NULL
, "\n\nSibadi 2006\n\n");
101 nlines
+= Dsyms (&t_map
[i
], S
, '\n');
113 if (T
== ' ' || T
== '\t') {
146 char * py_tt_file (struct tt_state_t
* tt
)
151 if (access (tt
->fileName
, R_OK
) != F_OK
) {
152 fprintf (stderr
, "No such file %s\n", tt
->fileName
);
158 tt
->result
= CNEW (char, 1024*1024);
160 d_attachment
= (pair_t
*) CNEW (char, 1024*1024);
162 tt
->attachment
= d_attachment
;
163 tt
->resultSize
= py_tt (tt
->fileData
, tt
->fileDataSize
, tt
->result
);
167 char t_op (char ** d_in
, char ** d_prev
)
176 if (*d_ptr
== '\n' || *d_ptr
== ':') {
189 } // namespace PYTHON