コード例 #1
0
ファイル: 2.c プロジェクト: 4a4ik/AVR
int main(void)
{
	
	initialize( 1, 1 );
	enable_display( 1, 0, 0 );
	clear_display();
	return_cursor();
	set_mode( 0, 1 );
	
	
	write_symbol(' ');
	write_symbol(' ');
	write_symbol(' ');
	write_symbol(' ');
	write_symbol(' ');
	
	write_symbol('4');
	write_symbol('a');
	write_symbol('4');
	write_symbol('i');
	write_symbol('k');
	

    while(1);
}
コード例 #2
0
/* Writes the SymbolTable TABLE to OUTPUT. You should use write_symbol() to
   perform the write. Do not print any additional whitespace or characters.
 */
void write_table(SymbolTable* table, FILE* output) {
    int i;
    Symbol* t = (*table).tbl;
    for (i = 0; i < (*table).len; i++) {
      write_symbol(output, t[i].addr, t[i].name);
    }
}
コード例 #3
0
ファイル: symbol.c プロジェクト: zevlg/eukleides
void add_symbol(char *symbol, int type)
{
    char *s;

    s = gettext(symbol);
    write_symbol(s, type, hash(s));
}
コード例 #4
0
void toggle_type(GtkTreeView* tree_view, GtkTreePath* path,
                 GtkTreeViewColumn* column, gpointer user_data)
{
    /* Check for correct column */
    int vars = gtk_spin_button_get_value_as_int(variables);
    int size = vars + 2;
    GtkTreeViewColumn* dst =
        gtk_tree_view_get_column(restrictions_view, vars * 2 - 1);
    if(column != dst) {
        return;
    }

    /* Get reference */
    GtkTreeModel* model = gtk_tree_view_get_model(restrictions_view);
    GtkTreeIter iter;
    gtk_tree_model_get_iter(model, &iter, path);

    /* Get previous value */
    GValue gval = G_VALUE_INIT;
    gtk_tree_model_get_value(model, &iter, size - 2, &gval);
    int old = g_value_get_int(&gval);
    g_value_unset(&gval);

    int symbol = LE;
    if(old == LE) {
        symbol = EQ;
    } else if(old == EQ) {
        symbol = GE;
    }
    write_symbol(model, &iter, symbol, size);
}
コード例 #5
0
void write(port *out, pointer object)
{
        if (object == NULL) {
                printf("()");
                return;
        }
        switch (type(object)) {
        case T_STRING:
                write_string(out, object);
                break;
        case T_NUMBER:
                write_number(out, object);
                break;
        case T_SYMBOL:
                write_symbol(out, object);
                break;
        case T_PAIR:
                write_pair(out, object);
                break;
        case T_BUILT_IN_REGULAR_PROC:
        case T_BUILT_IN_SPECIAL_PROC:
        case T_EXTEND_PROC:
                write_proc(out, object);
                break;
        case T_MACRO:
                write_macro(out, object);
                break;
        default:
                wirte_unknown(out, object);
                break;
        }
}
コード例 #6
0
ファイル: tables.c プロジェクト: rstallman/sdust
/* Writes the SymbolTable TABLE to OUTPUT. You should use write_symbol() to
   perform the write. Do not print any additional whitespace or characters.
*/
void write_table(SymbolTable* table, FILE* output) {
     /* YOUR CODE HERE */
    
     if(table == NULL || table->tbl == NULL) return;

     for(int i = 0; i < table->len; i++) {
	  write_symbol(output, table->tbl[i].addr, table->tbl[i].name);
     }
}
コード例 #7
0
ファイル: stacktrace.cpp プロジェクト: ChunHungLiu/GtkRadiant
BOOL CALLBACK
EnumerateSymbolsCallback(
    PSYMBOL_INFO  pSymInfo,
    ULONG         SymbolSize,
    PVOID         UserContext )
{
  write_symbol( pSymInfo, ((EnumerateSymbolsContext*)UserContext)->sf, ((EnumerateSymbolsContext*)UserContext)->outputStream, ((EnumerateSymbolsContext*)UserContext)->count);


  return TRUE;
}
コード例 #8
0
ファイル: symbol.c プロジェクト: zevlg/eukleides
_symbol *update_table (char *symbol)
{
    unsigned int index;
    _symbol *entry;

    index = hash(symbol);
    entry = look_up_symbol(symbol, index);
    if (entry == NULL) {
	entry = write_symbol(symbol, SYMBOL, index);
	push_symbol(entry);
    }
    return entry;
}
コード例 #9
0
void load(FILE* file)
{
    /* Load number of variables */
    int vars = 0;
    fscanf(file, "%i%*c", &vars);
    bool success = change_vars(vars);
    if(!success) {
        return;
    }
    gtk_spin_button_set_value(variables, (gdouble)vars);

    /* Reference new models */
    GtkTreeModel* function = gtk_tree_view_get_model(function_view);
    GtkTreeModel* restrictions = gtk_tree_view_get_model(restrictions_view);

    /* Load if objetive function is to maximize */
    int is_max = 0;
    fscanf(file, "%i%*c", &is_max);
    if(is_max) {
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(function_max), true);
    } else {
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(function_min), true);
    }

    /* Load coefficients of the objetive function */
    int coeff = 0;
    char buff[15];
    for(int i = 0; i < vars; i++) {
        fscanf(file, "%i", &coeff);
        sprintf(buff, "%d", coeff);
        writeback(function, "0", vars, true, (gchar*)&buff, GINT_TO_POINTER(i));
    }
    fscanf(file, "%*c");

    /* Load number of restrictions */
    int num_restrictions = 0;
    fscanf(file, "%i%*c", &num_restrictions);
    for(int i = 0; i < num_restrictions; i++) {
        add_row(NULL, NULL);
    }

    /* Load coefficients of each restriction */
    int size = vars + 2;
    char buff2[15];
    GtkTreeIter iter;
    bool iter_set = gtk_tree_model_get_iter_first(restrictions, &iter);
    for(int i = 0; iter_set && (i < num_restrictions); i++) {
        for(int j = 0; j < size; j++) {
            /* Coefficient or num */
            if(j != (size - 2)) {
                fscanf(file, "%i", &coeff);
                sprintf(buff,  "%d", coeff); /* new_text */
                sprintf(buff2, "%d", i);     /* path */
                writeback(restrictions,
                    (gchar*)&buff2,
                    size, j < (size - 1),
                    (gchar*)&buff,
                    GINT_TO_POINTER(j));
            /* Equation type */
            } else {
                fscanf(file, "%i", &coeff);
                DEBUG("Found type to be %i at (%i, %i).\n", coeff, i, j);
                write_symbol(restrictions, &iter, coeff, size);
            }
        }
        fscanf(file, "%*c");

        iter_set = gtk_tree_model_iter_next(restrictions, &iter);
    }
}
コード例 #10
0
int generate_makefile(vita_imports_t **imports, int imports_count)
{
	int h, i, j, k;
	int is_special;

	if ((fp = fopen("Makefile", "w")) == NULL) {
		return 0;
	}

	g_special_size = 1024;
	g_special_written = 0;
	g_kernel_objs = malloc(g_special_size);
	g_kernel_objs[0] = '\0';

	fputs(
		"ARCH ?= arm-vita-eabi\n"
		"AS = $(ARCH)-as\n"
		"AR = $(ARCH)-ar\n"
		"RANLIB = $(ARCH)-ranlib\n\n"
		"TARGETS =", fp);

	for (h = 0; h < imports_count; h++) {
		vita_imports_t *imp = imports[h];
		for (i = 0; i < imp->n_libs; i++) {
			fprintf(fp, " lib%s_stub.a", imp->libs[i]->name);
		}
	}

	fprintf(fp, "\n\n");

	for (h = 0; h < imports_count; h++) {
		vita_imports_t *imp = imports[h];
		for (i = 0; i < imp->n_libs; i++) {
			vita_imports_lib_t *library = imp->libs[i];
			is_special = (strcmp(KERNEL_LIBS_STUB, library->name) == 0);

			if (!is_special) {
				fprintf(fp, "%s_OBJS =", library->name);
			}

			for (j = 0; j < library->n_modules; j++) {
				vita_imports_module_t *module = library->modules[j];
				char buf[4096];
				for (k = 0; k < module->n_functions; k++) {
					vita_imports_stub_t *function = module->functions[k];
					snprintf(buf, sizeof(buf), " %s_%s_%s.o", library->name, module->name, function->name);
					write_symbol(buf, is_special || module->is_kernel);
				}
				for (k = 0; k < module->n_variables; k++) {
					vita_imports_stub_t *variable = module->variables[k];
					snprintf(buf, sizeof(buf), " %s_%s_%s.o", library->name, module->name, variable->name);
					write_symbol(buf, is_special || module->is_kernel);
				}
			}

			if (!is_special) {
				fprintf(fp, "\n");
			}
		}
	}

	// write kernel lib stub
	fprintf(fp, "%s_OBJS =%s\n", KERNEL_LIBS_STUB, g_kernel_objs);

	fputs(
		"ALL_OBJS=\n\n"
		"all: $(TARGETS)\n\n"
		"define LIBRARY_template\n"
		" $(1): $$($(1:lib%_stub.a=%)_OBJS)\n"
		" ALL_OBJS += $$($(1:lib%_stub.a=%)_OBJS)\n"
		"endef\n\n"
		"$(foreach library,$(TARGETS),$(eval $(call LIBRARY_template,$(library))))\n\n"
		"all: $(TARGETS)\n\n"
		"clean:\n\n"
		"\trm -f $(TARGETS) $(ALL_OBJS)\n\n"
		"$(TARGETS):\n"
		"\t$(AR) cru $@ $?\n"
		"\t$(RANLIB) $@\n\n"
		"%.o: %.S\n"
		"\t$(AS) $< -o $@\n"
		, fp);

	fclose(fp);
	free(g_kernel_objs);

	return 1;
}