#include "opendylan/run-time.h"

/* Generated by Open Dylan 2014.1 for x86_64-linux */

/* Typedefs for referenced classes */

typedef struct {
  dylan_value wrapper;
  dylan_value instanceQ_iep_;
  dylan_value debug_name_;
  dylan_value class_implementation_class_;
  dylan_value class_subtype_bit_;
  dylan_value class_module_;
} _KLclassGVKd;

#define  define__KLmm_wrapperGVKi(nrepeated) \
  typedef struct { \
    dylan_value wrapper; \
    dylan_value mm_wrapper_implementation_class_; \
    dylan_value mm_wrapper_subtype_mask_; \
    DWORD mm_wrapper_fixed_part_; \
    DWORD mm_wrapper_variable_part_; \
    dylan_value mm_wrapper_number_patterns_; \
    DWORD mm_wrapper_pattern_element_[nrepeated+1]; \
  } _KLmm_wrapperGVKi_##nrepeated;
define__KLmm_wrapperGVKi(1);
define__KLmm_wrapperGVKi(0);

typedef struct {
  dylan_value wrapper;
} _KLobjectGVKd;

typedef struct {
  dylan_value wrapper;
} _KLunboundGVKe;

typedef struct {
  dylan_value wrapper;
} _KLbooleanGVKd;

typedef struct {
  dylan_value wrapper;
  dylan_value xep_;
  dylan_value function_signature_;
  dylan_value Pgf_cache_;
  dylan_value debug_name_;
  dylan_value generic_function_methods_;
  dylan_value discriminator_;
  dylan_value incremental_gf_module_;
  dylan_value incremental_gf_domain_info_;
  dylan_value incremental_gf_method_libraries_;
  dylan_value incremental_gf_properties_;
} _KLincremental_generic_functionGVKe;

typedef struct {
  dylan_value wrapper;
  dylan_value instanceQ_iep_;
  dylan_value debug_name_;
  dylan_value class_implementation_class_;
  dylan_value class_subtype_bit_;
  dylan_value class_module_;
} _KLfunction_classGVKi;

#define  define__KLsimple_object_vectorGVKd(nrepeated) \
  typedef struct { \
    dylan_value wrapper; \
    dylan_value size_; \
    dylan_value vector_element_[nrepeated+1]; \
  } _KLsimple_object_vectorGVKd_##nrepeated;
define__KLsimple_object_vectorGVKd(2);
define__KLsimple_object_vectorGVKd(0);

typedef struct {
  dylan_value wrapper;
  dylan_value xep_;
  dylan_value function_signature_;
  dylan_value Pgf_cache_;
  dylan_value debug_name_;
  dylan_value generic_function_methods_;
  dylan_value discriminator_;
} _KLsealed_generic_functionGVKe;

#define  define__KLbyte_stringGVKd(nrepeated) \
  typedef struct { \
    dylan_value wrapper; \
    dylan_value size_; \
    char string_element_[nrepeated+1]; \
  } _KLbyte_stringGVKd_##nrepeated;
define__KLbyte_stringGVKd(4);

#define  define__KLsimple_closure_methodGVKi(nrepeated) \
  typedef struct { \
    dylan_value wrapper; \
    dylan_value xep_; \
    dylan_value function_signature_; \
    dylan_value mep_; \
    dylan_value environment_size_; \
    dylan_value environment_element_[nrepeated+1]; \
  } _KLsimple_closure_methodGVKi_##nrepeated;
define__KLsimple_closure_methodGVKi(0);

typedef struct {
  dylan_value wrapper;
  dylan_value signature_properties_;
  dylan_value signature_required_;
} _KLobject_signatureGVKe;

typedef struct {
  dylan_value wrapper;
  dylan_value xep_;
  dylan_value function_signature_;
  dylan_value mep_;
} _KLsimple_methodGVKe;

typedef struct {
  dylan_value wrapper;
  dylan_value signature_properties_;
  dylan_value signature_required_;
} _KLsignatureGVKe;

typedef struct {
  dylan_value wrapper;
} _KLconditionGVKd;

typedef struct {
  dylan_value wrapper;
} _KLstreamGYcommon_extensionsVcommon_dylan;


/* Typedefs for defined classes */


/* Referenced object declarations */

extern _KLclassGVKd KLclassGVKd;
extern _KLmm_wrapperGVKi_0 KLclassGVKdW;
extern _KLclassGVKd KLmm_wrapperGVKi;
extern _KLmm_wrapperGVKi_1 KLmm_wrapperGVKiW;
extern _KLclassGVKd KLobjectGVKd;
extern _KLmm_wrapperGVKi_0 KLobjectGVKdW;
extern _KLunboundGVKe KPunboundVKi;
extern _KLclassGVKd KLunboundGVKe;
extern _KLmm_wrapperGVKi_0 KLunboundGVKeW;
extern _KLbooleanGVKd KPtrueVKi;
extern _KLclassGVKd KLbooleanGVKd;
extern _KLmm_wrapperGVKi_0 KLbooleanGVKdW;
extern _KLbooleanGVKd KPfalseVKi;
extern _KLincremental_generic_functionGVKe Kcondition_to_stringYcommon_extensionsVcommon_dylan;
extern _KLfunction_classGVKi KLincremental_generic_functionGVKe;
extern _KLclassGVKd KLfunction_classGVKi;
extern _KLmm_wrapperGVKi_0 KLfunction_classGVKiW;
extern _KLmm_wrapperGVKi_0 KLincremental_generic_functionGVKeW;
dylan_value Kdo_printing_objectYprintVioMM0I (dylan_value, dylan_value, dylan_value, dylan_value, dylan_value, dylan_value);
extern _KLsimple_object_vectorGVKd_0 KPempty_vectorVKi;
extern _KLclassGVKd KLsimple_object_vectorGVKd;
extern _KLmm_wrapperGVKi_0 KLsimple_object_vectorGVKdW;
extern _KLincremental_generic_functionGVKe KwriteYstreams_protocolVcommon_dylan;
extern _KLsealed_generic_functionGVKe KformatYformatVio;
extern _KLclassGVKd KLsealed_generic_functionGVKe;
extern _KLmm_wrapperGVKi_0 KLsealed_generic_functionGVKeW;
extern _KLclassGVKd KLbyte_stringGVKd;
extern _KLmm_wrapperGVKi_0 KLbyte_stringGVKdW;
extern _KLfunction_classGVKi KLsimple_closure_methodGVKi;
extern _KLmm_wrapperGVKi_0 KLsimple_closure_methodGVKiW;
extern _KLobject_signatureGVKe KDsignature_LobjectG_object_rest_value_1VKi;
extern _KLclassGVKd KLobject_signatureGVKe;
extern _KLmm_wrapperGVKi_0 KLobject_signatureGVKeW;
extern _KLfunction_classGVKi KLsimple_methodGVKe;
extern _KLmm_wrapperGVKi_0 KLsimple_methodGVKeW;
extern _KLclassGVKd KLsignatureGVKe;
extern _KLmm_wrapperGVKi_0 KLsignatureGVKeW;
extern _KLclassGVKd KLconditionGVKd;
extern _KLmm_wrapperGVKi_0 KLconditionGVKdW;
extern _KLclassGVKd KLstreamGYcommon_extensionsVcommon_dylan;
extern _KLmm_wrapperGVKi_0 KLstreamGYcommon_extensionsVcommon_dylanW;
extern dylan_value Tprint_escapeQTYprintVio;

/* Defined object declarations */

extern _KLsimple_methodGVKe Kprint_objectYprintVioMM21;
dylan_value Kprint_objectYprintVioMM21I (dylan_value, dylan_value);
static _KLsimple_closure_methodGVKi_0 Kanonymous_of_print_objectF4;
static dylan_value Kanonymous_of_print_objectF4I (dylan_value);
static _KLbyte_stringGVKd_4 K5;
static _KLsignatureGVKe K6;
static _KLsimple_object_vectorGVKd_2 K7;

/* Indirection variables */


/* Variables */


/* Objects */

_KLsimple_methodGVKe Kprint_objectYprintVioMM21 = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_2,
  &K6,
  &Kprint_objectYprintVioMM21I
};

static _KLsimple_closure_methodGVKi_0 Kanonymous_of_print_objectF4 = {
  &KLsimple_closure_methodGVKiW /* wrapper */,
  &xep_1,
  &KDsignature_LobjectG_object_rest_value_1VKi,
  &Kanonymous_of_print_objectF4I,
  (dylan_value) 1
};

static _KLbyte_stringGVKd_4 K5 = {
  &KLbyte_stringGVKdW /* wrapper */,
  (dylan_value) 17,
  ": %s"
};

static _KLsignatureGVKe K6 = {
  &KLsignatureGVKeW /* wrapper */,
  (dylan_value) 41943049,
  &K7
};

static _KLsimple_object_vectorGVKd_2 K7 = {
  &KLsimple_object_vectorGVKdW /* wrapper */,
  (dylan_value) 9,
  &KLconditionGVKd,
  &KLstreamGYcommon_extensionsVcommon_dylan
};

/* Code */

dylan_value Kprint_objectYprintVioMM21I (dylan_value c_, dylan_value s_) {
  dylan_value message_;
  dylan_value Utmp_;
  dylan_value T5;
  dylan_value T6;
  dylan_value T7;
  dylan_value T8;
  dylan_value T9;
  dylan_value T10;

  // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:9
  // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:10
  CONGRUENT_CALL_PROLOG(&Kcondition_to_stringYcommon_extensionsVcommon_dylan, 1);
  message_ = CONGRUENT_CALL1(c_);
  // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:11
  Utmp_ = primitive_read_thread_variable(Tprint_escapeQTYprintVio);
  // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:11
  if (Utmp_ != &KPfalseVKi) {
    T5 = Utmp_;
  } else {
    // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:11
    T10 = primitive_not(message_);
    T5 = T10;
  }
  // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:11
  // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:11
  if (T5 != &KPfalseVKi) {
    // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:12
    T6 = MAKE_CLOSURE_INITD(&Kanonymous_of_print_objectF4, 1, message_);
    // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:12
    T7 = Kdo_printing_objectYprintVioMM0I(c_, s_, T6, &KPempty_vectorVKi, &KPtrueVKi, &KPtrueVKi);
    T9 = T7;
  } else {
    // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:18
    CONGRUENT_CALL_PROLOG(&KwriteYstreams_protocolVcommon_dylan, 3);
    T8 = CONGRUENT_CALL3(s_, message_, &KPempty_vectorVKi);
    T9 = T8;
  }
  // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:11
  // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:9
  MV_SET_COUNT(0);
  return(T9);
}

static dylan_value Kanonymous_of_print_objectF4I (dylan_value s_) {
  dylan_value T1;
  CAPTURE_ENVIRONMENT

  // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:12
  // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:14
  T1 = CALL3(&KformatYformatVio, s_, &K5, CREF(0));
  // /home/bruce/Development/dylan/opendylan/sources/io/format-condition.dylan:12
  return(T1);
}


/* SYSTEM INIT CODE */

void _Init_io__X_format_condition_for_system () {
  extern dylan_value KPresolve_symbolVKiI(dylan_value);
  return;
}

/* USER INIT CODE */

void _Init_io__X_format_condition_for_user () {
  return;
}


/* eof */
