Simple exceptions (#6)
[fur] / templates / function_definition.c
1
2 Object user${{name}}$implementation(EnvironmentPool* environmentPool, Environment* parent, size_t argc, Stack* stack, jmp_buf parent_jump)
3 {
4   Environment* environment = EnvironmentPool_allocate(environmentPool);
5   Environment_initialize(environment, parent);
6
7   jmp_buf jump;
8   if(setjmp(jump) != 0)
9   {
10     Environment_setLive(environment, false);
11     fprintf(stderr, "\tin {{name}}\n");
12     longjmp(parent_jump, 1);
13   }
14
15   Object result = builtin$nil;
16
17   {% for argument_name in argument_name_list|reverse %}
18   Environment_set(environment, "{{ argument_name }}", Stack_pop(stack));
19   {% endfor %}
20
21   {% for statement in statement_list %}
22   {{ statement }}
23   {% endfor %}
24
25   Environment_setLive(environment, false);
26   return result;
27 }