Example #1
0
void ComboBox::update()
{
    combo_box->SetHidden(!get_visible());
    combo_box->SetPos(x - frame->off_x, y - frame->off_y);
    combo_box->SetWidth(width);
    int new_index = get_current_line_number();
    if (old_index != new_index) {
        selection_changed = 2;
    }
    old_index = new_index;
    selection_changed = std::max(0, selection_changed - 1);
}
Example #2
0
Constant *
Asm_alloc_constant(ConstantType type)
{
	Constant *ret;

	ret = ASM_malloc(sizeof(Constant));
	ASM_fill(ret->u, NULL_VALUE);
	ret->type = type;
	ret->next = NULL;
	ret->line_number = get_current_line_number();

	return ret;
}
Example #3
0
Bytecode *
Asm_create_bytecode(char *identifier, Loopr_Byte code, Loopr_Boolean has_fixed)
{
	Bytecode *ret;

	ret = ASM_malloc(sizeof(Bytecode));

	ret->name = identifier;
	ret->has_fixed = has_fixed;
	ret->code = code;
	ret->next = NULL;
	ret->line_number = get_current_line_number();

	return ret;
}
Example #4
0
Statement *
Asm_create_statement(char *label, Bytecode *code, Constant *const_opt)
{
	NameSpace *name_space;
	Statement *ret;

	name_space = &Asm_get_current_compiler()->name_space[Asm_get_current_compiler()->current_name_space_index];
	ret = ASM_malloc(sizeof(Statement));
	ret->label = label;
	ret->bytecode = code;
	ret->constant = const_opt;
	ret->line_number = get_current_line_number();

	if (code && code->name == NULL && code->next
		&& !strcmp(code->next->name, Loopr_CR_Info[LCR_FUNCTION].assembly_name)) {
		if (name_space->function_definition) {
			name_space->function_definition = MEM_realloc(name_space->function_definition,
														sizeof(FunctionDefinition) * (name_space->function_count + 1));
		} else {
			name_space->function_definition = MEM_malloc(sizeof(FunctionDefinition) * (name_space->function_count + 1));
		}

		name_space->function_definition[name_space->function_count].is_void = LPR_False;
		while (const_opt && const_opt->type == CONST_KEYWORD) {
			switch (const_opt->u.keyword_value) {
				case ASM_VOID:
					name_space->function_definition[name_space->function_count].is_void = LPR_True;
					const_opt = const_opt->next;
					break;
				default:
					DBG_panic(("line %d: Unknown keyword %d\n", const_opt->line_number, const_opt->u.keyword_value));
					break;
			}
		}
		name_space->function_definition[name_space->function_count].name = MEM_strdup(const_opt->u.string_value);
		name_space->function_count++;
	}

	return ret;
}