File: %40merrorhandling.nim.c

package info (click to toggle)
nim 1.6.10-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,165,312 kB
  • sloc: sh: 20,999; ansic: 1,716; makefile: 958; python: 461; sql: 298; asm: 141; xml: 13
file content (201 lines) | stat: -rw-r--r-- 8,160 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/* Generated by Nim Compiler v1.6.10 */
#define NIM_INTBITS 32

#include "nimbase.h"
#include <string.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#define nimfr_(x, y)
#define nimln_(x, y)
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw;
typedef struct tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw;
typedef struct tyObject_TType__facALICuu8zUj0hjvbTLFg tyObject_TType__facALICuu8zUj0hjvbTLFg;
typedef struct tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q;
typedef struct tyObject_TSym__nnJKJFyjDGi5mnv8jwfTGQ tyObject_TSym__nnJKJFyjDGi5mnv8jwfTGQ;
typedef struct tyObject_TIdent__1LTsGP7bSxg45u9aHcxh6OA tyObject_TIdent__1LTsGP7bSxg45u9aHcxh6OA;
typedef struct tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q {
NU16 line;
NI16 col;
NI32 fileIndex;
};
typedef NU32 tySet_tyEnum_TNodeFlag__jyh9acXHkhZANSSvPIY7ZLg;
typedef NU8 tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw;
struct tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw {
tyObject_TType__facALICuu8zUj0hjvbTLFg* typ;
tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q info;
tySet_tyEnum_TNodeFlag__jyh9acXHkhZANSSvPIY7ZLg flags;
tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw kind;
union{
struct {NI64 intVal;
} _kind_1;
struct {NF floatVal;
} _kind_2;
struct {NimStringDesc* strVal;
} _kind_3;
struct {tyObject_TSym__nnJKJFyjDGi5mnv8jwfTGQ* sym;
} _kind_4;
struct {tyObject_TIdent__1LTsGP7bSxg45u9aHcxh6OA* ident;
} _kind_5;
struct {tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ* sons;
} _kind_6;
};
};
typedef NU8 tyEnum_ErrorKind__EyDxqE6LKZuEAJ79bRHKz8A;
typedef NU16 tySet_tyEnum_TRenderFlag__wrPgUo1ExBlHvFnXN2nSHw;
typedef NU8 tyEnum_TPreferedDesc__tnd4qt9c4xddV8oKV5zyusw;
typedef NimStringDesc* tyArray__24KAM9afIUgUaqBaEBB6r9bg[3];
struct tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ {
  TGenericSeq Sup;
  tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* data[SEQ_DECL_SIZE];
};
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, renderTree__renderer_46)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n, tySet_tyEnum_TRenderFlag__wrPgUo1ExBlHvFnXN2nSHw renderFlags);
static N_INLINE(NI, len__ast_3151)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, copyMem__system_1727)(void* dest, void* source, NI size);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, typeToString__types_50)(tyObject_TType__facALICuu8zUj0hjvbTLFg* typ, tyEnum_TPreferedDesc__tnd4qt9c4xddV8oKV5zyusw prefer);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen_0);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getProcHeader__types_222)(tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw* conf, tyObject_TSym__nnJKJFyjDGi5mnv8jwfTGQ* sym, tyEnum_TPreferedDesc__tnd4qt9c4xddV8oKV5zyusw prefer, NIM_BOOL getDeclarationPath);
STRING_LITERAL(TM__NsPKjREfpp5Tqi9bANLLP9aw_2, "type mismatch", 13);
STRING_LITERAL(TM__NsPKjREfpp5Tqi9bANLLP9aw_3, "expression \'$1\' cannot be called", 32);
STRING_LITERAL(TM__NsPKjREfpp5Tqi9bANLLP9aw_4, "wrong number of arguments", 25);
STRING_LITERAL(TM__NsPKjREfpp5Tqi9bANLLP9aw_5, "(", 1);
STRING_LITERAL(TM__NsPKjREfpp5Tqi9bANLLP9aw_6, ", ", 2);
STRING_LITERAL(TM__NsPKjREfpp5Tqi9bANLLP9aw_7, ")", 1);
STRING_LITERAL(TM__NsPKjREfpp5Tqi9bANLLP9aw_8, "ambiguous call; both $1 and $2 match for: $3", 44);
static N_INLINE(NI, len__ast_3151)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n) {
	NI result;
	NI T1_;
	result = (NI)0;
	T1_ = ((*n)._kind_6.sons ? (*n)._kind_6.sons->Sup.len : 0);
	result = T1_;
	return result;
}
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest, source, ((size_t) (size)));
}
static N_INLINE(void, copyMem__system_1727)(void* dest, void* source, NI size) {
	nimCopyMem(dest, source, size);
}
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	{
		if (!!((src == ((NimStringDesc*) NIM_NIL)))) goto LA3_;
		copyMem__system_1727(((void*) ((&(*dest).data[(*dest).Sup.len]))), ((void*) ((*src).data)), ((NI) ((NI)((*src).Sup.len + ((NI) 1)))));
		(*dest).Sup.len += (*src).Sup.len;
	}
	LA3_: ;
}
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
	nimSetMem__systemZmemory_7(p, ((int) 0), size);
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, errorToString__errorhandling_107)(tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw* config, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n) {
	NimStringDesc* result;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* wrongNode;
	result = NIM_NIL;
	wrongNode = (*n)._kind_6.sons->data[((NI) 0)];
	switch (((tyEnum_ErrorKind__EyDxqE6LKZuEAJ79bRHKz8A) ((*(*n)._kind_6.sons->data[((NI) 1)])._kind_1.intVal))) {
	case ((tyEnum_ErrorKind__EyDxqE6LKZuEAJ79bRHKz8A) 0):
	{
		result = copyString(((NimStringDesc*) &TM__NsPKjREfpp5Tqi9bANLLP9aw_2));
	}
	break;
	case ((tyEnum_ErrorKind__EyDxqE6LKZuEAJ79bRHKz8A) 1):
	{
		NimStringDesc* T3_;
		T3_ = NIM_NIL;
		T3_ = renderTree__renderer_46((*wrongNode)._kind_6.sons->data[((NI) 0)], 0);
		result = nsuFormatSingleElem(((NimStringDesc*) &TM__NsPKjREfpp5Tqi9bANLLP9aw_3), T3_);
	}
	break;
	case ((tyEnum_ErrorKind__EyDxqE6LKZuEAJ79bRHKz8A) 2):
	{
		result = copyString((*(*n)._kind_6.sons->data[((NI) 2)])._kind_3.strVal);
	}
	break;
	case ((tyEnum_ErrorKind__EyDxqE6LKZuEAJ79bRHKz8A) 3):
	{
		result = copyString(((NimStringDesc*) &TM__NsPKjREfpp5Tqi9bANLLP9aw_4));
	}
	break;
	case ((tyEnum_ErrorKind__EyDxqE6LKZuEAJ79bRHKz8A) 4):
	{
		tyObject_TSym__nnJKJFyjDGi5mnv8jwfTGQ* a;
		tyObject_TSym__nnJKJFyjDGi5mnv8jwfTGQ* b;
		NimStringDesc* args;
		tyArray__24KAM9afIUgUaqBaEBB6r9bg T15_;
		a = (*(*n)._kind_6.sons->data[((NI) 2)])._kind_4.sym;
		b = (*(*n)._kind_6.sons->data[((NI) 3)])._kind_4.sym;
		args = copyString(((NimStringDesc*) &TM__NsPKjREfpp5Tqi9bANLLP9aw_5));
		{
			NI i;
			NI colontmp_;
			NI i_2;
			i = (NI)0;
			colontmp_ = (NI)0;
			colontmp_ = len__ast_3151(wrongNode);
			i_2 = ((NI) 1);
			{
				while (1) {
					NimStringDesc* T14_;
					if (!(i_2 < colontmp_)) goto LA9;
					i = i_2;
					{
						if (!(((NI) 1) < i)) goto LA12_;
						args = resizeString(args, 2);
appendString(args, ((NimStringDesc*) &TM__NsPKjREfpp5Tqi9bANLLP9aw_6));
					}
					LA12_: ;
					T14_ = NIM_NIL;
					T14_ = typeToString__types_50((*(*wrongNode)._kind_6.sons->data[i]).typ, ((tyEnum_TPreferedDesc__tnd4qt9c4xddV8oKV5zyusw) 0));
					args = resizeString(args, (T14_ ? T14_->Sup.len : 0) + 0);
appendString(args, T14_);
					i_2 += ((NI) 1);
				} LA9: ;
			}
		}
		args = resizeString(args, 1);
appendString(args, ((NimStringDesc*) &TM__NsPKjREfpp5Tqi9bANLLP9aw_7));
		nimZeroMem((void*)T15_, sizeof(tyArray__24KAM9afIUgUaqBaEBB6r9bg));
		T15_[0] = getProcHeader__types_222(config, a, ((tyEnum_TPreferedDesc__tnd4qt9c4xddV8oKV5zyusw) 0), NIM_TRUE);
		T15_[1] = getProcHeader__types_222(config, b, ((tyEnum_TPreferedDesc__tnd4qt9c4xddV8oKV5zyusw) 0), NIM_TRUE);
		T15_[2] = copyString(args);
		result = nsuFormatOpenArray(((NimStringDesc*) &TM__NsPKjREfpp5Tqi9bANLLP9aw_8), T15_, 3);
	}
	break;
	}
	return result;
}