コード例 #1
0
ファイル: nhp.cpp プロジェクト: magik6k/nativehttp
void page_mapper::load_nhp(page &tmp, const char *f, string dir)
{
	FILE *nhpf = NULL;
	FILE *tmf = NULL;

	if (nhp_prepare_env(f, nhpf, tmf))
	{
		load_so(tmp, nhp_compile(f, nhpf, tmf).c_str(), dir, f);
	}
}
コード例 #2
0
TI_Initialize(ABI_PROPERTIES_ABI tabi, ISA_SUBSET tisa, PROCESSOR tproc, char *tpath)
#endif
{
  static BOOL initialized;

  if ( !initialized ) {
    INT                i;
    const char        *targ_name     = PROCESSOR_Name(tproc);
#ifdef TARG_IA64
    INT                targ_name_len = strlen(targ_name) + strlen(version);
#else
    INT                targ_name_len = strlen(targ_name);
#endif
    char              *targ_so_name  = alloca(targ_name_len + strlen(".so") + 1);

    for (i = 0; i < targ_name_len; i++) {
      targ_so_name[i] = tolower(targ_name[i]);
    }
#ifdef TARG_IA64
    if (strlen(version) > 0)  strcat(targ_so_name, version);
#endif
    strcpy(targ_so_name + targ_name_len, ".so");

    load_so(targ_so_name, tpath, FALSE /*verbose*/);

    ISA_SUBSET_Value = tisa;
    PROCESSOR_Value = tproc;
    ABI_PROPERTIES_ABI_Value = tabi;

    ABI_PROPERTIES_Initialize();
    ISA_HAZARD_Initialize();
    ISA_REGISTER_Initialize();

    initialized = TRUE;
  }
}
コード例 #3
0
PluginParam * parse_cfg (char * filename)
{
	FILE * cfg_file = fopen(filename, "r");

	if (cfg_file == NULL)
	{
		perror("fopen");
		return NULL;
	}
	else
	{
		char buf[80];

		PluginParam * first_param = NULL;
		PluginParam * current_param = (PluginParam *) malloc(sizeof(PluginParam));

		while (fgets(buf, sizeof(buf), cfg_file) != NULL)
		{
			*strchr(buf, '\n') = 0;

			if (!strncmp(buf, "depend=", 7))
			{
				char * start = buf + 7;
				char * end;

				while ((end = strchr(start, ',')) != NULL)
				{
					*end = 0;
					load_so(start);
					start = end + 1;
				}

				load_so(start);
			}
			else if (!strcmp(buf, "needfb=1"))
			{
				current_param->next = (PluginParam *) malloc(sizeof(PluginParam));
				fd_to_param(FB_DEVICE, O_RDWR, P_ID_FBUFFER, TYPE_FB, current_param->next);
			}
			else if (!strcmp(buf, "needrc=1"))
			{
				current_param->next = (PluginParam *) malloc(sizeof(PluginParam));
				fd_to_param(RC_DEVICE, O_RDONLY, P_ID_RCINPUT, TYPE_RC, current_param->next);
			}
			else if (!strcmp(buf, "needlcd=1"))
			{
				current_param->next = (PluginParam *) malloc(sizeof(PluginParam));
				fd_to_param(LCD_DEVICE, O_RDWR, P_ID_LCD, TYPE_LCD, current_param->next);
			}
			else
			{
				printf("unhandled line: %s\n", buf);
			}

			if (current_param->next != NULL)
			{
				if (first_param == NULL)
				{
					first_param = current_param->next;
					free(current_param);
					current_param = first_param;
				}
				else
				{
					current_param = current_param->next;
				}
			}
		}

		if (first_param == NULL)
			free(current_param);

		fclose(cfg_file);
		return first_param;
	}
}