예제 #1
0
void factor_vm::primitive_callback()
{
	cell return_rewind = to_cell(ctx->pop());
	tagged<word> w(ctx->pop());

	w.untag_check(this);
	ctx->push(allot_alien(callbacks->add(w.value(),return_rewind)->entry_point()));
}
예제 #2
0
파일: Editor.cpp 프로젝트: lachlanorr/gaen
void Editor::processKeyPress(const ivec4 & keys)
{
    if (keys == kKeyGraveAccent)
    {
        mIsActive = !mIsActive;
        broadcast_message(HASH::editor_activate__, kMessageFlag_Editor, mTask.id(), to_cell(mIsActive));
    }
}
예제 #3
0
/* Allocates memory (add(), allot_alien())*/
void factor_vm::primitive_callback() {
  cell return_rewind = to_cell(ctx->pop());
  tagged<word> w(ctx->pop());

  w.untag_check(this);

  cell func = callbacks->add(w.value(), return_rewind)->entry_point();
  CODE_TO_FUNCTION_POINTER_CALLBACK(this, func);
  ctx->push(allot_alien(func));
}
예제 #4
0
파일: io.cpp 프로젝트: unreal666/factor
void factor_vm::primitive_fwrite() {
  FILE* file = pop_file_handle();
  cell length = to_cell(ctx->pop());
  char* text = alien_offset(ctx->pop());

  if (length == 0)
    return;

  size_t written = safe_fwrite(text, 1, length, file);
  if (written != length)
    io_error_if_not_EINTR();
}
예제 #5
0
/* make an alien pointing at an offset of another alien */
inline void factorvm::vmprim_displaced_alien()
{
	cell alien = dpop();
	cell displacement = to_cell(dpop());

	if(alien == F && displacement == 0)
		dpush(F);
	else
	{
		switch(tagged<object>(alien).type())
		{
		case BYTE_ARRAY_TYPE:
		case ALIEN_TYPE:
		case F_TYPE:
			dpush(allot_alien(alien,displacement));
			break;
		default:
			type_error(ALIEN_TYPE,alien);
			break;
		}
	}
}
예제 #6
0
파일: strings.cpp 프로젝트: dmsh/factor
void factor_vm::primitive_string()
{
	cell initial = to_cell(ctx->pop());
	cell length = unbox_array_size();
	ctx->push(tag<string>(allot_string(length,initial)));
}
예제 #7
0
파일: level.cpp 프로젝트: pazthor/lean
static level_max_core const & to_max_core(level const & l) {
    lean_assert(is_max(l) || is_imax(l));
    return static_cast<level_max_core const &>(to_cell(l));
}
예제 #8
0
파일: level.cpp 프로젝트: pazthor/lean
level_succ const & to_level_succ(level const & l) { lean_assert(is_succ(l)); return static_cast<level_succ const &>(to_cell(l)); }
예제 #9
0
파일: level.cpp 프로젝트: pazthor/lean
static level_param_core const & to_param_core(level const & l) {
    lean_assert(is_param_core(l));
    return static_cast<level_param_core const &>(to_cell(l));
}
예제 #10
0
void sprite_stage_remove(i32 stageHash, Entity * pCaller)
{
    MessageQueueWriter msgw(HASH::sprite_stage_remove, kMessageFlag_None, pCaller->task().id(), kRendererTaskId, to_cell(stageHash), 0);
}