/* Compiler: ECL 26.3.27                                                      */
/* Source: /build/ecl/src/ecl-26.3.27/src/clos/defclass.lsp                   */
#include <ecl/ecl-cmp.h>
#include "clos/defclass.eclh"
/* function definition for PARSE-DEFAULT-INITARGS                             */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L1940parse_default_initargs(cl_object v1default_initargs)
{
 cl_object T0, T1, T2, T3;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v2output_list;
  cl_object v3scan;
  cl_object v4already_supplied;
  v2output_list = ECL_NIL;
  v3scan = v1default_initargs;
  v4already_supplied = ECL_NIL;
  goto L7;
L6:;
  T0 = ecl_cdr(v3scan);
  if (!(ecl_endp(T0))){
   goto L9;
  }
  si_simple_program_error(1, VV[1]);
L9:;
  {
   cl_object v5;
   cl_object v6;
   v5 = ecl_car(v3scan);
   v6 = ecl_cadr(v3scan);
   {
    cl_object v7;
    cl_object v8;
    v7 = v5;
    v8 = v4already_supplied;
    if (Null(ecl_memql(v7,v8))){
     goto L15;
    }
   }
   si_simple_program_error(3, VV[2], v5, v1default_initargs);
   goto L14;
L15:;
   v4already_supplied = CONS(v5,v4already_supplied);
L14:;
   T0 = cl_list(2, ECL_SYM("QUOTE",682), v5);
   T1 = cl_list(2, ECL_SYM("QUOTE",682), v6);
   T2 = (cl_env_copy->function=(VV[3]->symbol.gfdef))->cfun.entry(1, v6) /*  MAKE-FUNCTION-INITFORM */;
   T3 = cl_list(4, ECL_SYM("LIST",483), T0, T1, T2);
   v2output_list = CONS(T3,v2output_list);
  }
  v3scan = ecl_cddr(v3scan);
L7:;
  if (ecl_endp(v3scan)) {
   goto L23;
  }
  goto L6;
L23:;
  T0 = cl_nreverse(v2output_list);
  value0 = CONS(ECL_SYM("LIST",483),T0);
  cl_env_copy->nvalues = 1;
  return value0;
 }
}
/* local function DEFCLASS                                                    */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC1941defclass(cl_object v1, cl_object v2)
{
 cl_object T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v3;
  cl_object v4args;
  v3 = ecl_cdr(v1);
  v4args = v3;
  {
   cl_fixnum v5;
   v5 = ecl_length(v4args);
   if ((v5)>=((cl_fixnum)(3))) {
    goto L4;
   }
  }
  si_simple_program_error(1, VV[4]);
L4:;
  {
   cl_object v5name;
   cl_object v6superclasses;
   cl_object v7slots;
   {
    cl_object v8;
    v8 = v4args;
    {
     cl_object v9;
     v9 = v8;
     {
      bool v10;
      v10 = ECL_LISTP(v9);
      if (ecl_unlikely(!(v10)))
         FEwrong_type_argument(VV[7],v9);
      value0 = ECL_NIL;
      cl_env_copy->nvalues = 0;
     }
    }
    if (Null(v8)){
     goto L11;
    }
    {
     cl_object v9;
     v9 = ECL_CONS_CDR(v8);
     v4args = v9;
     v8 = ECL_CONS_CAR(v8);
    }
L11:;
    v5name = v8;
   }
   {
    cl_object v8;
    v8 = v4args;
    {
     cl_object v9;
     v9 = v8;
     {
      bool v10;
      v10 = ECL_LISTP(v9);
      if (ecl_unlikely(!(v10)))
         FEwrong_type_argument(VV[7],v9);
      value0 = ECL_NIL;
      cl_env_copy->nvalues = 0;
     }
    }
    if (Null(v8)){
     goto L22;
    }
    {
     cl_object v9;
     v9 = ECL_CONS_CDR(v8);
     v4args = v9;
     v8 = ECL_CONS_CAR(v8);
    }
L22:;
    v6superclasses = v8;
   }
   {
    cl_object v8;
    v8 = v4args;
    {
     cl_object v9;
     v9 = v8;
     {
      bool v10;
      v10 = ECL_LISTP(v9);
      if (ecl_unlikely(!(v10)))
         FEwrong_type_argument(VV[7],v9);
      value0 = ECL_NIL;
      cl_env_copy->nvalues = 0;
     }
    }
    if (Null(v8)){
     goto L33;
    }
    {
     cl_object v9;
     v9 = ECL_CONS_CDR(v8);
     v4args = v9;
     v8 = ECL_CONS_CAR(v8);
    }
L33:;
    v7slots = v8;
   }
   if (!(ECL_LISTP(v6superclasses))){
    goto L42;
   }
   if (ECL_LISTP(v7slots)) {
    goto L39;
   }
   goto L40;
L42:;
   goto L40;
L40:;
   si_simple_program_error(1, VV[8]);
L39:;
   if (!(ECL_SYMBOLP(v5name))){
    goto L47;
   }
   T0 = (ECL_SYM("SYMBOLP",850)->symbol.gfdef);
   if (cl_every(2, T0, v6superclasses)!=ECL_NIL) {
    goto L44;
   }
   goto L45;
L47:;
   goto L45;
L45:;
   si_simple_program_error(1, VV[9]);
L44:;
   T0 = cl_list(2, ECL_SYM("QUOTE",682), v5name);
   T1 = cl_list(2, ECL_SYM("QUOTE",682), v5name);
   T2 = cl_list(4, ECL_SYM("MAKE-INSTANCE",953), VV[11], ECL_SYM("NAME",1309), T1);
   T3 = cl_list(3, ECL_SYM("PROCLAIM-CLASS",1663), T0, T2);
   T4 = cl_list(3, ECL_SYM("EVAL-WHEN",342), VV[10], T3);
   if (Null(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*REGISTER-WITH-PDE-HOOK*",1211)))){
    goto L51;
   }
   T6 = ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*REGISTER-WITH-PDE-HOOK*",1211));
   T7 = cl_copy_tree(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*SOURCE-LOCATION*",1210)));
   T8 = cl_list(2, ECL_SYM("QUOTE",682), v5name);
   T9 = cl_list(2, ECL_SYM("QUOTE",682), v6superclasses);
   T10 = L1942compress_slot_forms(v7slots);
   T11 = L1944process_class_options(v4args);
   T12 = cl_list(5, ECL_SYM("LOAD-DEFCLASS",1654), T8, T9, T10, T11);
   T5 = ecl_function_dispatch(cl_env_copy,T6)(3, T7, v1, T12);
   goto L50;
L51:;
   T6 = cl_list(2, ECL_SYM("QUOTE",682), v5name);
   T7 = cl_list(2, ECL_SYM("QUOTE",682), v6superclasses);
   T8 = L1942compress_slot_forms(v7slots);
   T9 = L1944process_class_options(v4args);
   T5 = cl_list(5, ECL_SYM("LOAD-DEFCLASS",1654), T6, T7, T8, T9);
L50:;
   value0 = cl_list(3, ECL_SYM("PROGN",674), T4, T5);
   return value0;
  }
 }
}
static cl_object LC1941defclass_va(cl_narg narg, cl_object v8, cl_object v9, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[14]);
 {
  return LC1941defclass(v8, v9);
 }
}
/* function definition for COMPRESS-SLOT-FORMS                                */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L1942compress_slot_forms(cl_object v1slot_definitions)
{
 cl_object T0, T1;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v2const;
  cl_object v3output;
  cl_object v4non_const;
  v2const = ECL_NIL;
  v3output = ECL_NIL;
  v4non_const = ECL_NIL;
  {
   cl_object v5;
   v5 = (cl_env_copy->function=(VV[15]->symbol.gfdef))->cfun.entry(1, v1slot_definitions) /*  PARSE-SLOTS */;
   goto L9;
L8:;
   {
    cl_object v6slotd;
    v6slotd = ecl_car(v5);
    {
     cl_object v7initfun;
     cl_object v8copy;
     v7initfun = cl_getf(3, v6slotd, ECL_SYM("INITFUNCTION",1001), ECL_NIL);
     v8copy = cl_copy_list(v6slotd);
     {
      cl_object v9;
      cl_object v10;                              /*  FLAG                    */
      value0 = si_rem_f(v8copy, ECL_SYM("INITFUNCTION",1001));
      {
       v9 = value0;
       v10 = cl_env_copy->values[1];
      }
      v8copy = v9;
     }
     if (!(ECL_ATOM(v7initfun))){
      goto L20;
     }
     v2const = CONS(v8copy,v2const);
     T0 = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("MAYBE-QUOTE",1764)))->cfun.entry(1, v8copy) /*  MAYBE-QUOTE */;
     v3output = CONS(T0,v3output);
     goto L13;
L20:;
     T0 = ecl_car(v7initfun);
     if (!((T0)==(ECL_SYM("CONSTANTLY",255)))){
      goto L25;
     }
     v2const = CONS(v8copy,v2const);
     T0 = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("MAYBE-QUOTE",1764)))->cfun.entry(1, v8copy) /*  MAYBE-QUOTE */;
     v3output = CONS(T0,v3output);
     goto L13;
L25:;
     T0 = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("MAYBE-QUOTE",1764)))->cfun.entry(1, v8copy) /*  MAYBE-QUOTE */;
     T1 = cl_list(4, ECL_SYM("LIST*",484), ECL_SYM("INITFUNCTION",1001), v7initfun, T0);
     v3output = CONS(T1,v3output);
     v4non_const = ECL_T;
    }
L13:;
   }
   v5 = ecl_cdr(v5);
L9:;
   if (Null(v5)){
    goto L35;
   }
   goto L8;
L35:;
  }
  if (Null(v4non_const)){
   goto L37;
  }
  T0 = cl_nreverse(v3output);
  value0 = CONS(ECL_SYM("LIST",483),T0);
  cl_env_copy->nvalues = 1;
  return value0;
L37:;
  T0 = cl_nreverse(v2const);
  value0 = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("MAYBE-QUOTE",1764)))->cfun.entry(1, T0) /*  MAYBE-QUOTE */;
  return value0;
 }
}
/* function definition for UNCOMPRESS-SLOT-FORMS                              */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L1943uncompress_slot_forms(cl_object v1slot_definitions)
{
 cl_object T0, T1, T2, T3;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v2;
  cl_object v3slotd;
  cl_object v4;
  {
   cl_object v5;
   v5 = v1slot_definitions;
   if (ecl_unlikely(!ECL_LISTP(v5))) FEtype_error_list(v5);
   value0 = ECL_NIL;
   cl_env_copy->nvalues = 0;
   v2 = v5;
  }
  v3slotd = ECL_NIL;
  v4 = v2;
  {
   cl_object v5initform;
   v5initform = ECL_NIL;
   {
    cl_object v6;
    cl_object v7;
    v6 = ecl_list1(ECL_NIL);
    v7 = v6;
L10:;
    if (!(ecl_endp(v4))){
     goto L12;
    }
    goto L11;
L12:;
    v3slotd = ECL_CONS_CAR(v4);
    {
     cl_object v8;
     v8 = ECL_CONS_CDR(v4);
     if (ecl_unlikely(!ECL_LISTP(v8))) FEtype_error_list(v8);
     value0 = ECL_NIL;
     cl_env_copy->nvalues = 0;
     v4 = v8;
    }
    v5initform = cl_getf(3, v3slotd, ECL_SYM("INITFORM",1000), v3slotd);
    {
     cl_object v8;
     v8 = v7;
     if (ecl_unlikely(ECL_ATOM(v8))) FEtype_error_cons(v8);
     value0 = ECL_NIL;
     cl_env_copy->nvalues = 0;
     T0 = v8;
    }
    if (!((v5initform)==(v3slotd))){
     goto L28;
    }
    T1 = v3slotd;
    goto L27;
L28:;
    if (Null(cl_getf(2, v3slotd, ECL_SYM("INITFUNCTION",1001)))){
     goto L30;
    }
    T1 = v3slotd;
    goto L27;
L30:;
    T2 = cl_eval(v5initform);
    T3 = cl_constantly(T2);
    T1 = cl_listX(3, ECL_SYM("INITFUNCTION",1001), T3, v3slotd);
L27:;
    v7 = ecl_list1(T1);
    (ECL_CONS_CDR(T0)=v7,T0);
    goto L10;
L11:;
    value0 = ecl_cdr(v6);
    cl_env_copy->nvalues = 1;
    return value0;
   }
  }
 }
}
static cl_object L1943uncompress_slot_forms_va(cl_narg narg, cl_object v8slot_definitions, ...)
{
 if (ecl_unlikely(narg!=1)) FEwrong_num_arguments(VV[16]);
 {
  return L1943uncompress_slot_forms(v8slot_definitions);
 }
}
/* function definition for PROCESS-CLASS-OPTIONS                              */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L1944process_class_options(cl_object v1class_args)
{
 cl_object T0;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v2options;
  cl_object v3processed_options;
  v2options = ECL_NIL;
  v3processed_options = ECL_NIL;
  {
   cl_object v4;
   v4 = v1class_args;
   goto L8;
L7:;
   {
    cl_object v5option;
    v5option = ecl_car(v4);
    {
     cl_object v6;
     cl_object v7option_name;
     cl_object v8option_value;
     v6 = ecl_car(v5option);
     v7option_name = v6;
     v8option_value = ECL_NIL;
     {
      cl_object v9;
      cl_object v10;
      v9 = v7option_name;
      v10 = v3processed_options;
      if (Null(ecl_memql(v9,v10))){
       goto L17;
      }
     }
     si_simple_program_error(2, VV[23], v7option_name);
     goto L16;
L17:;
     v3processed_options = CONS(v7option_name,v3processed_options);
L16:;
     {
      cl_object v9;
      v9 = v7option_name;
      if (!((v9)==(ECL_SYM("METACLASS",1004)))){
       goto L30;
      }
      goto L27;
L30:;
      goto L28;
L28:;
      if (!((v9)==(ECL_SYM("DOCUMENTATION",1253)))){
       goto L25;
      }
      goto L26;
L27:;
L26:;
      T0 = ecl_cadr(v5option);
      v8option_value = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("MAYBE-QUOTE",1764)))->cfun.entry(1, T0) /*  MAYBE-QUOTE */;
      goto L23;
L25:;
      if (!((v9)==(ECL_SYM("DEFAULT-INITARGS",991)))){
       goto L33;
      }
      v7option_name = ECL_SYM("DIRECT-DEFAULT-INITARGS",993);
      T0 = ecl_cdr(v5option);
      v8option_value = L1940parse_default_initargs(T0);
      goto L23;
L33:;
      T0 = ecl_cdr(v5option);
      v8option_value = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("MAYBE-QUOTE",1764)))->cfun.entry(1, T0) /*  MAYBE-QUOTE */;
     }
L23:;
     T0 = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("MAYBE-QUOTE",1764)))->cfun.entry(1, v7option_name) /*  MAYBE-QUOTE */;
     v2options = cl_listX(3, T0, v8option_value, v2options);
    }
   }
   v4 = ecl_cdr(v4);
L8:;
   if (Null(v4)){
    goto L40;
   }
   goto L7;
L40:;
  }
  if (Null(v2options)){
   goto L43;
  }
  value0 = CONS(ECL_SYM("LIST",483),v2options);
  cl_env_copy->nvalues = 1;
  return value0;
L43:;
  value0 = ECL_NIL;
  cl_env_copy->nvalues = 1;
  return value0;
 }
}
static cl_object L1944process_class_options_va(cl_narg narg, cl_object v4class_args, ...)
{
 if (ecl_unlikely(narg!=1)) FEwrong_num_arguments(VV[13]);
 {
  return L1944process_class_options(v4class_args);
 }
}
/* function definition for LOAD-DEFCLASS                                      */
/* optimize speed 1, debug 1, space 1, safety 2                               */
cl_object clos_load_defclass(cl_object v1name, cl_object v2superclasses, cl_object v3slot_definitions, cl_object v4options)
{
 cl_object T0, T1;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 T0 = (ECL_SYM("ENSURE-CLASS",1582)->symbol.gfdef);
 T1 = L1943uncompress_slot_forms(v3slot_definitions);
 value0 = cl_apply(7, T0, v1name, ECL_SYM("DIRECT-SUPERCLASSES",995), v2superclasses, ECL_SYM("DIRECT-SLOTS",994), T1, v4options);
 return value0;
}
/* function definition for ENSURE-CLASS                                       */
/* optimize speed 1, debug 1, space 1, safety 2                               */
cl_object clos_ensure_class(cl_narg narg, cl_object v1name, ...)
{
 cl_object T0;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
 if (ecl_unlikely(narg<1)) FEwrong_num_arguments(ECL_SYM("ENSURE-CLASS",1582));
 {
  cl_object v2initargs;
  ecl_va_list args; ecl_va_start(args,v1name,narg,1);
  v2initargs = cl_grab_rest_args(args);
  ecl_va_end(args);
  {
   cl_object v3old_class;
   cl_object v4new_class;
   v3old_class = ECL_NIL;
   v4new_class = ECL_NIL;
   if (Null(v1name)){
    goto L3;
   }
   v3old_class = cl_find_class(2, v1name, ECL_NIL);
   if (Null(v3old_class)){
    goto L3;
   }
   T0 = (cl_env_copy->function=(ECL_SYM("CLASS-NAME",938)->symbol.gfdef))->cfun.entry(1, v3old_class) /*  CLASS-NAME */;
   if ((T0)==(v1name)) {
    goto L3;
   }
   v3old_class = ECL_NIL;
L3:;
   T0 = (ECL_SYM("ENSURE-CLASS-USING-CLASS",1583)->symbol.gfdef);
   v4new_class = cl_apply(4, T0, v3old_class, v1name, v2initargs);
   value0 = v4new_class;
   cl_env_copy->nvalues = 1;
   return value0;
  }
 }
}
#include "clos/defclass.data"
#ifdef __cplusplus
extern "C"
#endif

ECL_DLLEXPORT void _eclJC5RLTufnqen9_iR30M881(cl_object flag)
{
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 cl_object *VVtemp;
 if (flag != OBJNULL){
 Cblock = flag;
 #ifndef ECL_DYNAMIC_VV
 flag->cblock.data = VV;
 #endif
 flag->cblock.data_size = VM;
 flag->cblock.temp_data_size = VMtemp;
 flag->cblock.data_text = compiler_data_text;
 flag->cblock.cfuns_size = compiler_cfuns_size;
 flag->cblock.cfuns = compiler_cfuns;
 flag->cblock.source = ecl_make_constant_base_string("SRC:CLOS;DEFCLASS.LSP.NEWEST",-1);
 return;}
 #ifdef ECL_DYNAMIC_VV
 VV = Cblock->cblock.data;
 #endif
 Cblock->cblock.data_text = (const cl_object *)"@EcLtAg:_eclJC5RLTufnqen9_iR30M881@";
 VVtemp = Cblock->cblock.temp_data;
 ECL_DEFINE_SETF_FUNCTIONS
/* MAKE-LOAD-FORMs                                                            */
/* TOP-LEVEL-FORMs                                                            */
  si_select_package(VVtemp[0]);
  (void)0; /* No entry created for PARSE-DEFAULT-INITARGS */
  ecl_cmp_defmacro(VV[27]);                       /*  DEFCLASS                */
  (void)0; /* No entry created for COMPRESS-SLOT-FORMS */
  ecl_cmp_defun(VV[28]);                          /*  UNCOMPRESS-SLOT-FORMS   */
  ecl_cmp_defun(VV[29]);                          /*  PROCESS-CLASS-OPTIONS   */
  (void)0; /* No entry created for LOAD-DEFCLASS */
  (void)0; /* No entry created for ENSURE-CLASS */
}
