Docs GODI Archive
Projects Blog Link DB

Search GODI:


More options
File lib/felix/rtl/flx_rtl.cpp GODI Package apps-felix
 
   flx_rtl.cpp  
#line 581 "lpsrc/flx_rtl.ipk"
#include "flx_rtl.hpp"
#include <cstdio>

namespace flx { namespace rtl {
con_t::con_t() : pc(0), p_svc(0), _caller(0) {
#ifdef FLX_DEBUG_CONT
 printf("Constructing %p\n",this);
#endif
}
con_t::~con_t(){
#ifdef FLX_DEBUG_CONT
  printf("Destroying %p\n",this);
#endif
}

// fthread
fthread_t::fthread_t() : cc(0) {}
fthread_t::fthread_t(con_t *a) : cc(a) {}
fthread_t::~fthread_t(){cc=0;}
_uctor_ *fthread_t::get_svc()const { return cc?cc->p_svc:0; }

_uctor_ *fthread_t::run() {
restep:
  cc->p_svc = 0;
step:
  try { cc = cc->resume(); }
  catch (con_t *x) { cc = x; }

  if(!cc) return 0; // died

  if(cc->p_svc)
  {
    switch(cc->p_svc->variant)
    {
      case svc_get_fthread:
        **(fthread_t***)(cc->p_svc->data) = this;

      case svc_yield:
        goto restep;

      // we don't know what to do with the request,
      // so pass the buck to the driver
      default:
        return cc->p_svc;
    }
  }
  goto step;
}
//OFFSETS for fthread_t
static std::size_t _fthread_offsets[1]={
    offsetof(fthread_t,cc)
};

static void _fthread_finaliser (flx::gc::generic::collector_t *, void *p)
{
  ((fthread_t*)p)->~fthread_t();
}

flx::gc::generic::gc_shape_t _fthread_ptr_map(
  "fthread_t",
  1,sizeof(fthread_t),
  _fthread_finaliser,
  1,
  _fthread_offsets
);


void _ref_::operator = (_ref_ const& r)
{
  if (data != r.data)
  {
    if (frame != r.frame)
    {
      frame = r.frame;
    }
    data = r.data;
  }
}

//OFFSETS for _ref_
static std::size_t _ref_offsets[1]={
    offsetof(_ref_,frame)
};

static void _ref_finaliser (flx::gc::generic::collector_t *, void *p)
{
  ((_ref_*)p)->~_ref_();
}

flx::gc::generic::gc_shape_t _ref_ptr_map(
  "_ref_",
  1,sizeof(_ref_),
  _ref_finaliser,
  1,
  _ref_offsets
);

//OFFSETS for _uctor_
static std::size_t _uctor_offsets[1]= {
  offsetof(_uctor_,data)
};

flx::gc::generic::gc_shape_t _uctor_ptr_map (
  "_uctor_",
  1,
  sizeof(_uctor_),
  0,
  1,
  _uctor_offsets
);

flx::gc::generic::gc_shape_t _int_ptr_map (
  "int",
  1,
  sizeof(int),
  0,
  0,
  0
);

flx::gc::generic::gc_shape_t unit_ptr_map (
  "unit",
  1,
  sizeof(unit),
  0,
  0,
  0
);

flx_exec_failure_t::flx_exec_failure_t(std::string f, std::string o, std::string w) :
  filename(f),
  operation(o),
  what(w)
{}

flx_exec_failure_t::~flx_exec_failure_t(){}

flx_range_srcref_t::flx_range_srcref_t(char *f,int sl, int sc, int el, int ec) :
    filename(f),startline(sl),startcol(sc),endline(el),endcol(ec){}
flx_match_failure_t::flx_match_failure_t(flx_range_srcref_t ff, char *cf, int cl) :
   flx_loc(ff), cxx_srcfile(cf), cxx_srcline(cl) {}
flx_match_failure_t::~flx_match_failure_t(){}
flx_assert_failure_t::flx_assert_failure_t(flx_range_srcref_t ff, char *cf, int cl) :
   flx_loc(ff), cxx_srcfile(cf), cxx_srcline(cl) {}
flx_assert_failure_t::~flx_assert_failure_t(){}
flx_switch_failure_t::~flx_switch_failure_t(){}

}}


This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml