1 /* Generated by Nim Compiler v1.6.2 */
2 #define NIM_INTBITS 32
3 
4 #include "nimbase.h"
5 #include <string.h>
6 #undef LANGUAGE_C
7 #undef MIPSEB
8 #undef MIPSEL
9 #undef PPC
10 #undef R3000
11 #undef R4000
12 #undef i386
13 #undef linux
14 #undef mips
15 #undef near
16 #undef far
17 #undef powerpc
18 #undef unix
19 #define nimfr_(x, y)
20 #define nimln_(x, y)
21 typedef struct NimStringDesc NimStringDesc;
22 typedef struct TGenericSeq TGenericSeq;
23 struct TGenericSeq {
24 NI len;
25 NI reserved;
26 };
27 struct NimStringDesc {
28   TGenericSeq Sup;
29 NIM_CHAR data[SEQ_DECL_SIZE];
30 };
31 N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
32 N_LIB_PRIVATE N_NIMCALL(void, addEscaped__pureZxmltree_461)(NimStringDesc** result, NimStringDesc* s);
33 static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
34 static N_INLINE(void, copyMem__system_1727)(void* dest, void* source, NI size);
35 static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
36 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
37 N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
38 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
39 STRING_LITERAL(TM__qYyKc6OpDWHHaBXL9bX9aQ2A_2, "&lt;", 4);
40 STRING_LITERAL(TM__qYyKc6OpDWHHaBXL9bX9aQ2A_3, "&gt;", 4);
41 STRING_LITERAL(TM__qYyKc6OpDWHHaBXL9bX9aQ2A_4, "&amp;", 5);
42 STRING_LITERAL(TM__qYyKc6OpDWHHaBXL9bX9aQ2A_5, "&quot;", 6);
43 STRING_LITERAL(TM__qYyKc6OpDWHHaBXL9bX9aQ2A_6, "&apos;", 6);
N_INLINE(void,nimCopyMem)44 static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
45 	void* T1_;
46 	T1_ = (void*)0;
47 	T1_ = memcpy(dest, source, ((size_t) (size)));
48 }
N_INLINE(void,copyMem__system_1727)49 static N_INLINE(void, copyMem__system_1727)(void* dest, void* source, NI size) {
50 	nimCopyMem(dest, source, size);
51 }
N_INLINE(void,appendString)52 static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
53 	{
54 		if (!!((src == ((NimStringDesc*) NIM_NIL)))) goto LA3_;
55 		copyMem__system_1727(((void*) ((&(*dest).data[(*dest).Sup.len]))), ((void*) ((*src).data)), ((NI) ((NI)((*src).Sup.len + ((NI) 1)))));
56 		(*dest).Sup.len += (*src).Sup.len;
57 	}
58 	LA3_: ;
59 }
N_NIMCALL(void,addEscaped__pureZxmltree_461)60 N_LIB_PRIVATE N_NIMCALL(void, addEscaped__pureZxmltree_461)(NimStringDesc** result, NimStringDesc* s) {
61 	{
62 		NIM_CHAR c;
63 		NI i;
64 		NI L;
65 		c = (NIM_CHAR)0;
66 		i = ((NI) 0);
67 		L = (s ? s->Sup.len : 0);
68 		{
69 			while (1) {
70 				if (!(i < L)) goto LA3;
71 				c = s->data[i];
72 				switch (((NU8)(c))) {
73 				case 60:
74 				{
75 					unsureAsgnRef((void**) (&(*result)), resizeString((*result), 4));
76 appendString((*result), ((NimStringDesc*) &TM__qYyKc6OpDWHHaBXL9bX9aQ2A_2));
77 				}
78 				break;
79 				case 62:
80 				{
81 					unsureAsgnRef((void**) (&(*result)), resizeString((*result), 4));
82 appendString((*result), ((NimStringDesc*) &TM__qYyKc6OpDWHHaBXL9bX9aQ2A_3));
83 				}
84 				break;
85 				case 38:
86 				{
87 					unsureAsgnRef((void**) (&(*result)), resizeString((*result), 5));
88 appendString((*result), ((NimStringDesc*) &TM__qYyKc6OpDWHHaBXL9bX9aQ2A_4));
89 				}
90 				break;
91 				case 34:
92 				{
93 					unsureAsgnRef((void**) (&(*result)), resizeString((*result), 6));
94 appendString((*result), ((NimStringDesc*) &TM__qYyKc6OpDWHHaBXL9bX9aQ2A_5));
95 				}
96 				break;
97 				case 39:
98 				{
99 					unsureAsgnRef((void**) (&(*result)), resizeString((*result), 6));
100 appendString((*result), ((NimStringDesc*) &TM__qYyKc6OpDWHHaBXL9bX9aQ2A_6));
101 				}
102 				break;
103 				default:
104 				{
105 					unsureAsgnRef((void**) (&(*result)), addChar((*result), c));
106 				}
107 				break;
108 				}
109 				i += ((NI) 1);
110 			} LA3: ;
111 		}
112 	}
113 }
N_NIMCALL(NimStringDesc *,escape__pureZxmltree_465)114 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, escape__pureZxmltree_465)(NimStringDesc* s) {
115 	NimStringDesc* result;
116 	result = NIM_NIL;
117 	result = rawNewString(((NI) ((s ? s->Sup.len : 0))));
118 	addEscaped__pureZxmltree_461((&result), s);
119 	return result;
120 }
121