void scm_init_specfns() { static bool initialized = false; if (initialized) return; initialized = true; scm_make_gsubr("cdf-binomial", 3, 0, 0, RECAST(scm_cdf_binomal)); scm_make_gsubr("cdf-neg-binomial", 3, 0, 0, RECAST(scm_cdf_neg_binomal)); scm_make_gsubr("cdf-chi-square", 2, 0, 0, RECAST(scm_cdf_chi_square)); scm_make_gsubr("inv-cdf-chi-square", 2, 0, 0, RECAST(scm_inv_cdf_chi_square)); scm_make_gsubr("cdf-F", 3, 0, 0, RECAST(scm_cdf_F)); scm_make_gsubr("inv-cdf-F", 3, 0, 0, RECAST(scm_inv_cdf_F)); scm_make_gsubr("cdf-t", 2, 0, 0, RECAST(scm_cdf_t)); scm_make_gsubr("inv-t-normal", 2, 0, 0, RECAST(scm_inv_cdf_t)); scm_make_gsubr("cdf-normal", 3, 0, 0, RECAST(scm_cdf_normal)); scm_make_gsubr("inv-cdf-normal", 3, 0, 0, RECAST(scm_inv_cdf_normal)); }
int4 add_inter(int val, sm_int_ptr_t addr, sm_global_latch_ptr_t latch) { int4 cntrval, newcntrval, spins, maxspins, retries; boolean_t cswpsuccess; sm_int_ptr_t volatile cntrval_p; ++fast_lock_count; maxspins = num_additional_processors ? MAX_LOCK_SPINS(LOCK_SPINS, num_additional_processors) : 1; cntrval_p = addr; /* Need volatile context especially on Itanium */ for (retries = LOCK_TRIES - 1; 0 < retries; retries--) /* - 1 so do rel_quant 3 times first */ { /* seems like a legitinate spin which could take advantage of transactional memory */ for (spins = maxspins; 0 < spins; spins--) { cntrval = *cntrval_p; newcntrval = cntrval + val; /* This is (currently as of 08/2007) the only non-locking usage of compswap in GT.M. We are not passing compswap an actual sm_global_latch_ptr_t addr like its function would normally dictate. However, since the address of the field we want to deal with is the first int in the global_latch_t, we just pass our int address properly cast to the type that compswap is expecting. The assert below verifies that this assumption has not changed (SE 08/2007) */ assert(0 == OFFSETOF(global_latch_t, u.parts.latch_pid)); IA64_ONLY(cswpsuccess = compswap_unlock(RECAST(sm_global_latch_ptr_t)cntrval_p, cntrval, newcntrval)); NON_IA64_ONLY(cswpsuccess = compswap((sm_global_latch_ptr_t)cntrval_p, cntrval, newcntrval)); if (cswpsuccess) { --fast_lock_count; assert(0 <= fast_lock_count); return newcntrval; } } if (retries & 0x3) /* On all but every 4th pass, do a simple rel_quant */ rel_quant(); /* Release processor to holder of lock (hopefully) */ else { /* On every 4th pass, we bide for awhile */ wcs_sleep(LOCK_SLEEP); assert(0 == (LOCK_TRIES % 4)); /* assures there are 3 rel_quants prior to first wcs_sleep() */ } } --fast_lock_count; assert(FALSE); rts_error_csa(CSA_ARG(NULL) VARLSTCNT(9) ERR_DBCCERR, 2, LEN_AND_LIT("*unknown*"), ERR_ERRCALL, 3, CALLFROM); return 0; /* To keep the compiler quiet */ }
static const char* obj_close(void*obj) { return RECAST(obj)->close(); }
static const char* obj_set_backlight(void*obj,lh_device_backlight*p) { return RECAST(obj)->set_backlight(static_cast<lh_device_backlight*>(p)); }
static const char* obj_render_mono(void*obj,int w,int h,const void*p) { return RECAST(obj)->render_argb32(w,h,p); }
static const char* obj_render_qimage(void*obj,void*qi) { return RECAST(obj)->render_qimage(static_cast<QImage*>(qi)); }
static const char* obj_open(void*obj) { return RECAST(obj)->open(); }
static const char* obj_close(lh_output_device*obj) { return RECAST(obj->obj.ref)->close(); }
static const char* obj_set_backlight(lh_output_device*obj,lh_device_backlight*p) { return RECAST(obj->obj.ref)->set_backlight(static_cast<lh_device_backlight*>(p)); }
static const char* obj_render_mono(lh_output_device*obj,int w,int h,const void*p) { return RECAST(obj->obj.ref)->render_argb32(w,h,p); }
static const char* obj_render_qimage(lh_output_device*obj,void*qi) { return RECAST(obj->obj.ref)->render_qimage(static_cast<QImage*>(qi)); }
static const char* obj_open(lh_output_device*obj) { return RECAST(obj->obj.ref)->open(); }
static lh_layout_item *obj_layout_item_create( lh_layout_class *lc ) { return RECAST(lc->obj.ref)->layout_item_create(); }
static void obj_layout_item_destroy( lh_layout_class *lc, lh_layout_item *li ) { return RECAST(lc->obj.ref)->layout_item_destroy(li); }