annotate src/impl/kernel_error.cbc @ 168:04a5e0aa7f01

add kernel_error.cbc
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Thu, 16 Jan 2020 16:10:00 +0900
parents
children ba8687746ff6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
168
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "../context.h"
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #interface "ErrorGear.h"
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 // ----
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 // typedef struct KernelError <Type, Isa> impl ErrorGear {
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 // } KernelError;
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 // ----
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 ErrorGear* createKernelError(struct Context* cbc_context) {
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 struct ErrorGear* error_gear = new ErrorGear();
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 struct KernelError* kernel_error = new KernelError();
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 error_gear->error_gear = (union Data*)kernel_error;
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 error_gear->err_code = 0;
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 error_gear->msg = NULL;
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 error_gear->error = C_errorKernelError;
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 error_gear->panic = C_panicKernelError;
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 return error_gear;
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 }
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 __code errorKernelError(int err_code,...) {
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 }
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 __code panicKernelError(char* msg) {
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 }
04a5e0aa7f01 add kernel_error.cbc
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26