예제 #1
0
IdentConfig  *
ParseIdentOptions (const char *filename, char *myname)
{
	ConfigData    cd ;
	ConfigDef    *IdentConfigReader ; 
	IdentConfig  *config = CreateIdentConfig ();
	FreeStorageElem *Storage = NULL;

	cd.filename = filename ;
	IdentConfigReader = InitConfigReader (myname, &IdentSyntax, CDT_Filename, cd, NULL);
	if (!IdentConfigReader)
		return config;

	PrintConfigReader (IdentConfigReader);
	ParseConfig (IdentConfigReader, &Storage);

	/* getting rid of all the crap first */
	StorageCleanUp (&Storage, &(config->more_stuff), CF_DISABLED_OPTION);

	config->style_defs = free_storage2MyStyleDefinitionsList (Storage);

	DestroyConfig (IdentConfigReader);
	DestroyFreeStorage (&Storage);
	return config;

}
예제 #2
0
파일: ASetRoot.c 프로젝트: Remmy/afterstep
ASetRootConfig *ParseASetRootOptions (const char *filename, char *myname)
{
	ConfigData cd;
	ConfigDef *ConfigReader;
	ASetRootConfig *config = CreateASetRootConfig ();
	MyBackgroundConfig **backs_tail = &(config->my_backs);
	DeskBackConfig **desks_tail = &(config->my_desks);
	FreeStorageElem *Storage = NULL, *pCurr;
	ConfigItem item;

	cd.filename = filename;
	ConfigReader =
			InitConfigReader (myname, &ASetRootSyntax, CDT_Filename, cd, NULL);

	if (!ConfigReader)
		return config;

	item.memory = NULL;
	PrintConfigReader (ConfigReader);
	ParseConfig (ConfigReader, &Storage);

	/* getting rid of all the crap first */
	StorageCleanUp (&Storage, &(config->more_stuff), CF_DISABLED_OPTION);

	config->style_defs = free_storage2MyStyleDefinitionsList (Storage);

	for (pCurr = Storage; pCurr; pCurr = pCurr->next) {
		if (pCurr->term == NULL)
			continue;

		if (pCurr->term->id == BGR_MYBACKGROUND) {
			if ((*backs_tail =
					 ParseMyBackgroundOptions (pCurr->sub, myname)) != NULL)
				backs_tail = &((*backs_tail)->next);
			continue;
		}

		if (!ReadConfigItem (&item, pCurr))
			continue;
		switch (pCurr->term->id) {
		case BGR_DESK_BACK:
			if ((*desks_tail = ParseDeskBackOptions (&item, myname)) != NULL)
				desks_tail = &((*desks_tail)->next);
			break;
		default:
			item.ok_to_free = 1;
		}
	}
	ReadConfigItem (&item, NULL);
	FixDeskBacks (config);

	DestroyConfig (ConfigReader);
	DestroyFreeStorage (&Storage);
	return config;
}
예제 #3
0
파일: Wharf.c 프로젝트: Remmy/afterstep
WharfConfig *ParseWharfOptions (const char *filename, char *myname)
{
	ConfigData cd;
	ConfigDef *ConfigReader;
	WharfConfig *config = CreateWharfConfig ();
	FreeStorageElem *Storage = NULL, *pCurr;
	ConfigItem item;
	TermDef *folder_term = func2fterm (F_Folder, False);

	cd.filename = filename;
	ConfigReader =
			InitConfigReader (myname, &WharfSyntax, CDT_Filename, cd,
												NULL /*WharfSpecialFunc */ );
	if (!ConfigReader)
		return config;

	folder_term->sub_syntax = &WharfSyntax;

	item.memory = NULL;
	PrintConfigReader (ConfigReader);
	ParseConfig (ConfigReader, &Storage);

	/* getting rid of all the crap first */
	StorageCleanUp (&Storage, &(config->more_stuff), CF_DISABLED_OPTION);
	config->balloon_conf =
			Process_balloonOptions (Storage, NULL, BALLOON_ID_START);
	config->style_defs = free_storage2MyStyleDefinitionsList (Storage);

	for (pCurr = Storage; pCurr; pCurr = pCurr->next) {
		if (pCurr->term == NULL)
			continue;
		if (ReadFlagItem
				(&(config->set_flags), &(config->flags), pCurr, WharfFlags)) {
			continue;
		}
		if (!ReadConfigItem (&item, pCurr))
			continue;
		switch (pCurr->term->id) {
		case WHARF_Wharf_ID:
			item.ok_to_free = 1;
			ParseWharfFolder (&pCurr, &(config->root_folder));
			break;
		case WHARF_Geometry_ID:
			set_flags (config->set_flags, WHARF_GEOMETRY);
			config->geometry = item.data.geometry;
			break;
		case WHARF_Rows_ID:
			set_flags (config->set_flags, WHARF_ROWS);
			config->rows = item.data.integer;
			break;
		case WHARF_Columns_ID:
			set_flags (config->set_flags, WHARF_COLUMNS);
			clear_flags (config->set_flags, WHARF_ROWS);
			config->columns = item.data.integer;
			break;
		case WHARF_WithdrawStyle_ID:
			set_flags (config->set_flags, WHARF_WITHDRAW_STYLE);
			config->withdraw_style = item.data.integer;
			break;
		case WHARF_ForceSize_ID:
			set_flags (config->set_flags, WHARF_FORCE_SIZE);
			config->force_size = item.data.geometry;
			/* errorneous value check */
			if (!(config->force_size.flags & WidthValue))
				config->force_size.width = 64;
			if (!(config->force_size.flags & HeightValue))
				config->force_size.height = 64;
			config->force_size.flags = WidthValue | HeightValue;
			break;
		case WHARF_TextureType_ID:
			set_flags (config->set_flags, WHARF_TEXTURE_TYPE);
			config->texture_type = item.data.integer;
			break;
		case WHARF_BgColor_ID:
			set_string_value (&(config->bg_color), item.data.string,
												&(config->set_flags), WHARF_BG_COLOR);
			break;
		case WHARF_TextureColor_ID:
			set_string_value (&(config->texture_color), item.data.string,
												&(config->set_flags), WHARF_TEXTURE_COLOR);
			break;
		case WHARF_Pixmap_ID:
			set_string_value (&(config->pixmap), item.data.string,
												&(config->set_flags), WHARF_PIXMAP);
			break;
		case WHARF_AnimateStepsMain_ID:
			set_flags (config->set_flags, WHARF_ANIMATE_STEPS_MAIN);
			config->animate_steps_main = item.data.integer;
			break;
		case WHARF_AnimateSteps_ID:
			set_flags (config->set_flags, WHARF_ANIMATE_STEPS);
			config->animate_steps = item.data.integer;
			break;
		case WHARF_AnimateDelay_ID:
			set_flags (config->set_flags, WHARF_ANIMATE_DELAY);
			config->animate_delay = item.data.integer;
			break;
		case WHARF_Sound_ID:
			if (pCurr->sub == NULL) {
				if (pCurr->argc > 0) {
					register char *sound = mystrdup (pCurr->argv[pCurr->argc - 1]);

					set_string_value (&(config->sounds[WHEV_PUSH]), sound,
														&(config->set_flags), WHARF_SOUND);
				}
			} else if (pCurr->sub->argc > 0) {
				register char *sound = mystrdup (pCurr->sub->argv[0]);

				set_string_value (&
													(config->
													 sounds[WHEV_Id2Code (pCurr->sub->term->id)]),
													sound, &(config->set_flags), WHARF_SOUND);
			}
			item.ok_to_free = 1;
			break;
			ASCF_HANDLE_INTEGER_KEYWORD_CASE (WHARF, config, item,
																				LabelLocation);
			ASCF_HANDLE_ALIGN_KEYWORD_CASE (WHARF, config, pCurr, AlignContents);
			ASCF_HANDLE_BEVEL_KEYWORD_CASE (WHARF, config, pCurr, Bevel);
			ASCF_HANDLE_SUBSYNTAX_KEYWORD_CASE (WHARF, config, pCurr, ShowHints,
																					BalloonContents);
			ASCF_HANDLE_INTEGER_KEYWORD_CASE (WHARF, config, item,
																				CompositionMethod);
			ASCF_HANDLE_INTEGER_KEYWORD_CASE (WHARF, config, item, FolderOffset);
			ASCF_HANDLE_INTEGER_KEYWORD_CASE (WHARF, config, item,
																				OrthogonalFolderOffset);
		default:
			if (pCurr->term->type != TT_FLAG)
				item.ok_to_free = 1;
		}
	}
	if (get_flags (config->set_flags, WHARF_Bevel))
		clear_flags (config->flags, WHARF_NO_BORDER);


	ReadConfigItem (&item, NULL);
	SHOW_CHECKPOINT;
	DestroyConfig (ConfigReader);
	SHOW_CHECKPOINT;
	DestroyFreeStorage (&Storage);
	SHOW_CHECKPOINT;
	return config;
}