root/src/exclib.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. exclib_with_error_handler
  2. exclib_current_exception_handler
  3. exclib_with_exception_handler
  4. exclib_raise
  5. exclib_report_error
  6. exclib_conditionP
  7. exclib_condition_has_typeP
  8. exclib_make_compound_condition
  9. Scm_Init_exclib

   1 /* Generated by genstub.  Do not edit. */
   2 #define LIBGAUCHE_BODY
   3 #include <gauche.h>
   4 #if defined(__CYGWIN__) || defined(__MINGW32__)
   5 #define SCM_CGEN_CONST /*empty*/
   6 #else
   7 #define SCM_CGEN_CONST const
   8 #endif
   9 
  10 #include <gauche/class.h>
  11 #include <gauche/exception.h>
  12 
  13 static ScmObj exclib_with_error_handler(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
  14 {
  15   ScmObj handler_scm;
  16   ScmObj handler;
  17   ScmObj thunk_scm;
  18   ScmObj thunk;
  19   SCM_ENTER_SUBR("with-error-handler");
  20   handler_scm = SCM_ARGREF(0);
  21   handler = (handler_scm);
  22   thunk_scm = SCM_ARGREF(1);
  23   thunk = (thunk_scm);
  24   {
  25 if (!SCM_PROCEDURE_TAKE_NARG_P(handler, 1)) {
  26   Scm_Error("error handler must take at least 1 argument, but got %S",
  27     handler);
  28 }
  29 if (!SCM_PROCEDURE_THUNK_P(thunk)) {
  30   Scm_Error("thunk required, but got %S", thunk);
  31 }
  32 {
  33 ScmObj SCM_RESULT;
  34 SCM_RESULT = Scm_VMWithErrorHandler(handler, thunk);
  35 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
  36 }
  37   }
  38 }
  39 
  40 static SCM_DEFINE_STRING_CONST(exclib_with_error_handler__NAME, "with-error-handler", 18, 18);
  41 static SCM_DEFINE_SUBR(exclib_with_error_handler__STUB, 2, 0, SCM_OBJ(&exclib_with_error_handler__NAME), exclib_with_error_handler, NULL, NULL);
  42 
  43 static ScmObj exclib_current_exception_handler(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
  44 {
  45   SCM_ENTER_SUBR("current-exception-handler");
  46   {
  47 {
  48 ScmObj SCM_RESULT;
  49  SCM_RESULT = (Scm_VM()->exceptionHandler);
  50 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
  51 }
  52   }
  53 }
  54 
  55 static SCM_DEFINE_STRING_CONST(exclib_current_exception_handler__NAME, "current-exception-handler", 25, 25);
  56 static SCM_DEFINE_SUBR(exclib_current_exception_handler__STUB, 0, 0, SCM_OBJ(&exclib_current_exception_handler__NAME), exclib_current_exception_handler, NULL, NULL);
  57 
  58 static ScmObj exclib_with_exception_handler(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
  59 {
  60   ScmObj handler_scm;
  61   ScmObj handler;
  62   ScmObj thunk_scm;
  63   ScmObj thunk;
  64   SCM_ENTER_SUBR("with-exception-handler");
  65   handler_scm = SCM_ARGREF(0);
  66   handler = (handler_scm);
  67   thunk_scm = SCM_ARGREF(1);
  68   thunk = (thunk_scm);
  69   {
  70 if (!SCM_PROCEDURE_TAKE_NARG_P(handler, 1)) {
  71    Scm_Error("exception handler must take at least 1 argument, but got %S",
  72      handler);
  73 }
  74 if (!SCM_PROCEDURE_THUNK_P(thunk)) {
  75   Scm_Error("thunk required, but got %S", thunk);
  76 }
  77 {
  78 ScmObj SCM_RESULT;
  79 SCM_RESULT = Scm_VMWithExceptionHandler(handler, thunk);
  80 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
  81 }
  82   }
  83 }
  84 
  85 static SCM_DEFINE_STRING_CONST(exclib_with_exception_handler__NAME, "with-exception-handler", 22, 22);
  86 static SCM_DEFINE_SUBR(exclib_with_exception_handler__STUB, 2, 0, SCM_OBJ(&exclib_with_exception_handler__NAME), exclib_with_exception_handler, NULL, NULL);
  87 
  88 static ScmObj exclib_raise(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
  89 {
  90   ScmObj exception_scm;
  91   ScmObj exception;
  92   SCM_ENTER_SUBR("raise");
  93   exception_scm = SCM_ARGREF(0);
  94   exception = (exception_scm);
  95   {
  96 {
  97 ScmObj SCM_RESULT;
  98 SCM_RESULT = Scm_Raise(exception);
  99 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
 100 }
 101   }
 102 }
 103 
 104 static SCM_DEFINE_STRING_CONST(exclib_raise__NAME, "raise", 5, 5);
 105 static SCM_DEFINE_SUBR(exclib_raise__STUB, 1, 0, SCM_OBJ(&exclib_raise__NAME), exclib_raise, NULL, NULL);
 106 
 107 static ScmObj exclib_report_error(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 108 {
 109   ScmObj exception_scm;
 110   ScmObj exception;
 111   SCM_ENTER_SUBR("report-error");
 112   exception_scm = SCM_ARGREF(0);
 113   exception = (exception_scm);
 114   {
 115 Scm_ReportError(exception);
 116 SCM_RETURN(SCM_UNDEFINED);
 117   }
 118 }
 119 
 120 static SCM_DEFINE_STRING_CONST(exclib_report_error__NAME, "report-error", 12, 12);
 121 static SCM_DEFINE_SUBR(exclib_report_error__STUB, 1, 0, SCM_OBJ(&exclib_report_error__NAME), exclib_report_error, NULL, NULL);
 122 
 123 static ScmObj exclib_conditionP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 124 {
 125   ScmObj obj_scm;
 126   ScmObj obj;
 127   SCM_ENTER_SUBR("condition?");
 128   obj_scm = SCM_ARGREF(0);
 129   obj = (obj_scm);
 130   {
 131 {
 132 int SCM_RESULT;
 133 SCM_RESULT = SCM_CONDITIONP(obj);
 134 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
 135 }
 136   }
 137 }
 138 
 139 static SCM_DEFINE_STRING_CONST(exclib_conditionP__NAME, "condition?", 10, 10);
 140 static SCM_DEFINE_SUBR(exclib_conditionP__STUB, 1, 0, SCM_OBJ(&exclib_conditionP__NAME), exclib_conditionP, NULL, NULL);
 141 
 142 static ScmObj exclib_condition_has_typeP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 143 {
 144   ScmObj c_scm;
 145   ScmObj c;
 146   ScmObj k_scm;
 147   ScmObj k;
 148   SCM_ENTER_SUBR("condition-has-type?");
 149   c_scm = SCM_ARGREF(0);
 150   c = (c_scm);
 151   k_scm = SCM_ARGREF(1);
 152   k = (k_scm);
 153   {
 154 {
 155 int SCM_RESULT;
 156 SCM_RESULT = Scm_ConditionHasType(c, k);
 157 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
 158 }
 159   }
 160 }
 161 
 162 static SCM_DEFINE_STRING_CONST(exclib_condition_has_typeP__NAME, "condition-has-type?", 19, 19);
 163 static SCM_DEFINE_SUBR(exclib_condition_has_typeP__STUB, 2, 0, SCM_OBJ(&exclib_condition_has_typeP__NAME), exclib_condition_has_typeP, NULL, NULL);
 164 
 165 static ScmObj exclib_make_compound_condition(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 166 {
 167   ScmObj conditions_scm;
 168   ScmObj conditions;
 169   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 170   SCM_ENTER_SUBR("make-compound-condition");
 171   conditions_scm = SCM_OPTARGS;
 172   conditions = (conditions_scm);
 173   {
 174 {
 175 ScmObj SCM_RESULT;
 176 SCM_RESULT = Scm_MakeCompoundCondition(conditions);
 177 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
 178 }
 179   }
 180 }
 181 
 182 static SCM_DEFINE_STRING_CONST(exclib_make_compound_condition__NAME, "make-compound-condition", 23, 23);
 183 static SCM_DEFINE_SUBR(exclib_make_compound_condition__STUB, 0, 1, SCM_OBJ(&exclib_make_compound_condition__NAME), exclib_make_compound_condition, NULL, NULL);
 184 
 185 void Scm_Init_exclib(ScmModule *module)
 186 {
 187 
 188   SCM_DEFINE(module, "make-compound-condition", SCM_OBJ(&exclib_make_compound_condition__STUB));
 189   SCM_DEFINE(module, "condition-has-type?", SCM_OBJ(&exclib_condition_has_typeP__STUB));
 190   SCM_DEFINE(module, "condition?", SCM_OBJ(&exclib_conditionP__STUB));
 191   SCM_DEFINE(module, "report-error", SCM_OBJ(&exclib_report_error__STUB));
 192   SCM_DEFINE(module, "raise", SCM_OBJ(&exclib_raise__STUB));
 193   SCM_DEFINE(module, "with-exception-handler", SCM_OBJ(&exclib_with_exception_handler__STUB));
 194   SCM_DEFINE(module, "current-exception-handler", SCM_OBJ(&exclib_current_exception_handler__STUB));
 195   SCM_DEFINE(module, "with-error-handler", SCM_OBJ(&exclib_with_error_handler__STUB));
 196 }

/* [<][>][^][v][top][bottom][index][help] */