#include "opendylan/run-time.h"

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

/* Typedefs for referenced classes */

#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(8);
define__KLsimple_object_vectorGVKd(0);
define__KLsimple_object_vectorGVKd(6);

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;
  dylan_value symbol_name_;
} _KLsymbolGVKd;

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;

typedef struct {
  dylan_value wrapper;
  dylan_value outer_stream_;
  dylan_value private_stream_element_type_value_;
  dylan_value private_stream_direction_value_;
  dylan_value private_stream_lock_value_;
  dylan_value actual_stream_input_buffer_;
  dylan_value actual_stream_output_buffer_;
  dylan_value stream_shared_buffer_;
  dylan_value initial_position_;
  dylan_value current_position_;
  dylan_value final_position_;
  dylan_value stream_locator_;
  dylan_value accessor_;
} _KLfile_streamGYstreams_internalsVio;

typedef struct {
  dylan_value wrapper;
  D handle1_;
  dylan_value synchronization_name_;
} _KLrecursive_lock_iGYthreads_internalVdylan;

typedef struct {
  dylan_value wrapper;
} _KLbooleanGVKd;

typedef struct {
  dylan_value wrapper;
} _KLobjectGVKd;

typedef struct {
  dylan_value wrapper;
} _KLunboundGVKe;

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


/* Typedefs for defined classes */


/* Referenced object declarations */

extern _KLclassGVKd KLsimple_object_vectorGVKd;
extern _KLclassGVKd KLclassGVKd;
extern _KLmm_wrapperGVKi_0 KLclassGVKdW;
extern _KLclassGVKd KLmm_wrapperGVKi;
extern _KLmm_wrapperGVKi_1 KLmm_wrapperGVKiW;
extern _KLmm_wrapperGVKi_0 KLsimple_object_vectorGVKdW;
extern _KLsymbolGVKd KJlocator_;
extern _KLclassGVKd KLsymbolGVKd;
extern _KLmm_wrapperGVKi_0 KLsymbolGVKdW;
extern _KLsymbolGVKd KJdirection_;
extern _KLsymbolGVKd KJinput_;
extern _KLincremental_generic_functionGVKe KmakeVKd;
extern _KLfunction_classGVKi KLincremental_generic_functionGVKe;
extern _KLclassGVKd KLfunction_classGVKi;
extern _KLmm_wrapperGVKi_0 KLfunction_classGVKiW;
extern _KLmm_wrapperGVKi_0 KLincremental_generic_functionGVKeW;
extern _KLclassGVKd KLfile_streamGYstreams_internalsVio;
extern _KLmm_wrapperGVKi_0 KLfile_streamGYstreams_internalsVioW;
dylan_value KLrecursive_lock_iGZ32ZconstructorYthreads_internalVdylanMM0I (dylan_value, dylan_value, dylan_value);
extern _KLclassGVKd KLrecursive_lock_iGYthreads_internalVdylan;
extern _KLmm_wrapperGVKi_1 KLrecursive_lock_iGYthreads_internalVdylanW;
extern _KLsimple_object_vectorGVKd_0 KPempty_vectorVKi;
extern _KLbooleanGVKd KPfalseVKi;
extern _KLclassGVKd KLbooleanGVKd;
extern _KLmm_wrapperGVKi_0 KLbooleanGVKdW;
extern _KLsymbolGVKd KJoutput_;
extern _KLclassGVKd KLobjectGVKd;
extern _KLmm_wrapperGVKi_0 KLobjectGVKdW;
extern _KLunboundGVKe KPunboundVKi;
extern _KLclassGVKd KLunboundGVKe;
extern _KLmm_wrapperGVKi_0 KLunboundGVKeW;
extern _KLbooleanGVKd KPtrueVKi;
extern _KLclassGVKd KLbyte_stringGVKd;
extern _KLmm_wrapperGVKi_0 KLbyte_stringGVKdW;

/* Defined object declarations */

static _KLsymbolGVKd KJfile_descriptor_;
static _KLsymbolGVKd KJstream_lock_;
static _KLbyte_stringGVKd_11 K5;
static _KLbyte_stringGVKd_15 K6;

/* Indirection variables */

static dylan_value IKJfile_descriptor_ = &KJfile_descriptor_;
static dylan_value IKJstream_lock_ = &KJstream_lock_;

/* Variables */

dylan_value Tstandard_inputTYstandard_ioVio = &KPunboundVKi;
dylan_value Tstandard_outputTYstandard_ioVio = &KPunboundVKi;
dylan_value Tstandard_errorTYstandard_ioVio = &KPunboundVKi;

/* Objects */

static _KLsymbolGVKd KJfile_descriptor_ = {
  &KLsymbolGVKdW /* wrapper */,
  &K6
};

static _KLsymbolGVKd KJstream_lock_ = {
  &KLsymbolGVKdW /* wrapper */,
  &K5
};

static _KLbyte_stringGVKd_11 K5 = {
  &KLbyte_stringGVKdW /* wrapper */,
  (dylan_value) 45,
  "stream-lock"
};

static _KLbyte_stringGVKd_15 K6 = {
  &KLbyte_stringGVKdW /* wrapper */,
  (dylan_value) 61,
  "file-descriptor"
};

/* Code */


/* SYSTEM INIT CODE */

void _Init_io__X_unix_standard_io_for_system () {
  extern dylan_value KPresolve_symbolVKiI(dylan_value);
  {
    dylan_value T0;

    T0 = KPresolve_symbolVKiI(&KJfile_descriptor_);
    if (T0 != &KJfile_descriptor_) {
      IKJfile_descriptor_ = T0;
    }
  }
  {
    dylan_value T0;

    T0 = KPresolve_symbolVKiI(&KJstream_lock_);
    if (T0 != &KJstream_lock_) {
      IKJstream_lock_ = T0;
    }
  }
  return;
}

/* USER INIT CODE */

void _Init_io__X_unix_standard_io_for_user () {
{
  dylan_value T0;
  dylan_value T1;
  _KLsimple_object_vectorGVKd_6 T2 = {&KLsimple_object_vectorGVKdW, (dylan_value) 25};

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:10
  T2.vector_element_[0] = &KJlocator_;
  T2.vector_element_[1] = (dylan_value) 1;
  T2.vector_element_[2] = IKJfile_descriptor_;
  T2.vector_element_[3] = (dylan_value) 1;
  T2.vector_element_[4] = &KJdirection_;
  T2.vector_element_[5] = &KJinput_;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:10
  CONGRUENT_CALL_PROLOG(&KmakeVKd, 2);
  T0 = CONGRUENT_CALL2(&KLfile_streamGYstreams_internalsVio, &T2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:9
  Tstandard_inputTYstandard_ioVio = T0;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:9
  T1 = &KPfalseVKi;
  goto I0;
}
I0:

{
  dylan_value T0;
  dylan_value T1;
  dylan_value T2;
  dylan_value T3_0;
  _KLsimple_object_vectorGVKd_8 T4 = {&KLsimple_object_vectorGVKdW, (dylan_value) 33};

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:15
  T3_0 = KLrecursive_lock_iGZ32ZconstructorYthreads_internalVdylanMM0I(&KLrecursive_lock_iGYthreads_internalVdylan, &KPempty_vectorVKi, &KPfalseVKi);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:15
  T2 = T3_0;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:13
  T4.vector_element_[0] = &KJlocator_;
  T4.vector_element_[1] = (dylan_value) 5;
  T4.vector_element_[2] = IKJfile_descriptor_;
  T4.vector_element_[3] = (dylan_value) 5;
  T4.vector_element_[4] = &KJdirection_;
  T4.vector_element_[5] = &KJoutput_;
  T4.vector_element_[6] = IKJstream_lock_;
  T4.vector_element_[7] = T2;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:13
  CONGRUENT_CALL_PROLOG(&KmakeVKd, 2);
  T0 = CONGRUENT_CALL2(&KLfile_streamGYstreams_internalsVio, &T4);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:12
  Tstandard_outputTYstandard_ioVio = T0;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:12
  T1 = &KPfalseVKi;
  goto I2;
}
I2:

{
  dylan_value T0;
  dylan_value T1;
  dylan_value T2;
  dylan_value T3_0;
  _KLsimple_object_vectorGVKd_8 T4 = {&KLsimple_object_vectorGVKdW, (dylan_value) 33};

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:20
  T3_0 = KLrecursive_lock_iGZ32ZconstructorYthreads_internalVdylanMM0I(&KLrecursive_lock_iGYthreads_internalVdylan, &KPempty_vectorVKi, &KPfalseVKi);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:20
  T2 = T3_0;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:18
  T4.vector_element_[0] = &KJlocator_;
  T4.vector_element_[1] = (dylan_value) 9;
  T4.vector_element_[2] = IKJfile_descriptor_;
  T4.vector_element_[3] = (dylan_value) 9;
  T4.vector_element_[4] = &KJdirection_;
  T4.vector_element_[5] = &KJoutput_;
  T4.vector_element_[6] = IKJstream_lock_;
  T4.vector_element_[7] = T2;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:18
  CONGRUENT_CALL_PROLOG(&KmakeVKd, 2);
  T0 = CONGRUENT_CALL2(&KLfile_streamGYstreams_internalsVio, &T4);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:17
  Tstandard_errorTYstandard_ioVio = T0;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-standard-io.dylan:17
  T1 = &KPfalseVKi;
  goto I4;
}
I4:

  return;
}


/* eof */
