예제 #1
0
파일: DRI.c 프로젝트: Agnarr/xserver
static XF86ConfBuffersPtr
xf86parseBuffers (void)
{
    int token;
    parsePrologue (XF86ConfBuffersPtr, XF86ConfBuffersRec)

    if (xf86getSubToken (&(ptr->buf_comment)) != NUMBER)
	Error ("Buffers count expected", NULL);
    ptr->buf_count = val.num;

    if (xf86getSubToken (&(ptr->buf_comment)) != NUMBER)
	Error ("Buffers size expected", NULL);
    ptr->buf_size = val.num;

    if ((token = xf86getSubToken (&(ptr->buf_comment))) == STRING) {
	ptr->buf_flags = val.str;
	if ((token = xf86getToken (NULL)) == COMMENT)
	    ptr->buf_comment = xf86addComment(ptr->buf_comment, val.str);
	else
	    xf86unGetToken(token);
    }

#ifdef DEBUG
    printf ("Buffers parsed\n");
#endif

    return ptr;
}
예제 #2
0
파일: Input.c 프로젝트: timon37/xwayland
XF86ConfInputPtr
xf86parseInputSection (void)
{
	int has_ident = FALSE;
	int token;
	parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)

	while ((token = xf86getToken (InputTab)) != ENDSECTION)
	{
		switch (token)
		{
		case COMMENT:
			ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
			break;
		case IDENTIFIER:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "Identifier");
			if (has_ident == TRUE)
				Error (MULTIPLE_MSG, "Identifier");
			ptr->inp_identifier = val.str;
			has_ident = TRUE;
			break;
		case DRIVER:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "Driver");
                        if (strcmp(val.str, "keyboard") == 0) {
                            ptr->inp_driver = strdup("kbd");
                            free(val.str);
                        }
                        else
			    ptr->inp_driver = val.str;
			break;
		case OPTION:
			ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst);
			break;
		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG);
			break;
		default:
			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
			break;
		}
	}

	if (!has_ident)
		Error (NO_IDENT_MSG);

#ifdef DEBUG
	printf ("InputDevice section parsed\n");
#endif

	return ptr;
}
예제 #3
0
파일: Vendor.c 프로젝트: 4eremuxa/xserver
XF86ConfVendorPtr
xf86parseVendorSection (void)
{
	int has_ident = FALSE;
	int token;
	parsePrologue (XF86ConfVendorPtr, XF86ConfVendorRec)

	while ((token = xf86getToken (VendorTab)) != ENDSECTION)
	{
		switch (token)
		{
		case COMMENT:
			ptr->vnd_comment = xf86addComment(ptr->vnd_comment, val.str);
			break;
		case IDENTIFIER:
			if (xf86getSubToken (&(ptr->vnd_comment)) != STRING)
				Error (QUOTE_MSG, "Identifier");
			if (has_ident == TRUE)
				Error (MULTIPLE_MSG, "Identifier");
			ptr->vnd_identifier = val.str;
			has_ident = TRUE;
			break;
		case OPTION:
			ptr->vnd_option_lst = xf86parseOption(ptr->vnd_option_lst);
			break;
		case SUBSECTION:
			if (xf86getSubToken (&(ptr->vnd_comment)) != STRING)
				Error (QUOTE_MSG, "SubSection");
			{
				HANDLE_LIST (vnd_sub_lst, xf86parseVendorSubSection,
							XF86ConfVendSubPtr);
			}
			break;
		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG, NULL);
			break;
		default:
			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
			break;
		}

	}

	if (!has_ident)
		Error (NO_IDENT_MSG, NULL);

#ifdef DEBUG
	printf ("Vendor section parsed\n");
#endif

	return ptr;
}
예제 #4
0
XF86ConfModulePtr
xf86parseModuleSection (void)
{
	int token;
	parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec)

	while ((token = xf86getToken (ModuleTab)) != ENDSECTION)
	{
		switch (token)
		{
		case COMMENT:
			ptr->mod_comment = xf86addComment(ptr->mod_comment, val.str);
			break;
		case LOAD:
			if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
				Error (QUOTE_MSG, "Load");
			ptr->mod_load_lst =
				xf86addNewLoadDirective (ptr->mod_load_lst, val.str,
									 XF86_LOAD_MODULE, NULL);
			break;
		case LOAD_DRIVER:
			if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
				Error (QUOTE_MSG, "LoadDriver");
			ptr->mod_load_lst =
				xf86addNewLoadDirective (ptr->mod_load_lst, val.str,
									 XF86_LOAD_DRIVER, NULL);
			break;
		case SUBSECTION:
			if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
						Error (QUOTE_MSG, "SubSection");
			ptr->mod_load_lst =
				xf86parseModuleSubSection (ptr->mod_load_lst, val.str);
			break;
		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG, NULL);
			break;
		default:
			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
			break;
		}
	}

#ifdef DEBUG
	printf ("Module section parsed\n");
#endif

	return ptr;
}
예제 #5
0
파일: DRI.c 프로젝트: Agnarr/xserver
XF86ConfDRIPtr
xf86parseDRISection (void)
{
    int token;
    parsePrologue (XF86ConfDRIPtr, XF86ConfDRIRec);

    /* Zero is a valid value for this. */
    ptr->dri_group = -1;
    while ((token = xf86getToken (DRITab)) != ENDSECTION) {
	switch (token)
	    {
	    case GROUP:
		if ((token = xf86getSubToken (&(ptr->dri_comment))) == STRING)
		    ptr->dri_group_name = val.str;
		else if (token == NUMBER)
		    ptr->dri_group = val.num;
		else
		    Error (GROUP_MSG, NULL);
		break;
	    case MODE:
		if (xf86getSubToken (&(ptr->dri_comment)) != NUMBER)
		    Error (NUMBER_MSG, "Mode");
                if (val.numType != PARSE_OCTAL)
                    Error (MUST_BE_OCTAL_MSG, val.num);
		ptr->dri_mode = val.num;
		break;
	    case BUFFERS:
		HANDLE_LIST (dri_buffers_lst, xf86parseBuffers,
			     XF86ConfBuffersPtr);
		break;
	    case EOF_TOKEN:
		Error (UNEXPECTED_EOF_MSG, NULL);
		break;
	    case COMMENT:
		ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str);
		break;
	    default:
		Error (INVALID_KEYWORD_MSG, xf86tokenString ());
		break;
	    }
    }
    
#ifdef DEBUG
    ErrorF("DRI section parsed\n");
#endif
    
    return ptr;
}
예제 #6
0
XF86ConfModesPtr
xf86parseModesSection (void)
{
	int has_ident = FALSE;
	int token;
	parsePrologue (XF86ConfModesPtr, XF86ConfModesRec)

	while ((token = xf86getToken (ModesTab)) != ENDSECTION)
	{
		switch (token)
		{
		case COMMENT:
			ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str);
			break;
		case IDENTIFIER:
			if (xf86getSubToken (&(ptr->modes_comment)) != STRING)
				Error (QUOTE_MSG, "Identifier");
			if (has_ident == TRUE)
				Error (MULTIPLE_MSG, "Identifier");
			ptr->modes_identifier = xf86configStrdup(val.str);
			has_ident = TRUE;
			break;
		case MODE:
			HANDLE_LIST (mon_modeline_lst, xf86parseVerboseMode,
						 XF86ConfModeLinePtr);
			break;
		case MODELINE:
			HANDLE_LIST (mon_modeline_lst, xf86parseModeLine,
						 XF86ConfModeLinePtr);
			break;
		case OPTION:
			ptr->modes_option_lst = xf86parseOption(ptr->modes_option_lst);
			break;
		default:
			xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
			CLEANUP (ptr);
			return NULL;
		}
	}

	if (!has_ident)
		Error (NO_IDENT_MSG, NULL);

#ifdef DEBUG
	printf ("Modes section parsed\n");
#endif
	return ptr;
}
예제 #7
0
XF86ConfVideoPortPtr
xf86parseVideoPortSubSection (const char *name)
{
	int has_ident = FALSE;
	int token;
	parsePrologue (XF86ConfVideoPortPtr, XF86ConfVideoPortRec)

	ptr->vp_identifier = xf86configStrdup(name);

	while ((token = xf86getToken (VideoPortTab)) != ENDSUBSECTION)
	{
		switch (token)
		{
		case COMMENT:
			ptr->vp_comment = xf86addComment(ptr->vp_comment, val.str);
			break;
		case IDENTIFIER:
			if (xf86getSubToken (&(ptr->vp_comment)) != STRING)
				Error (QUOTE_MSG, "Identifier");
			if (has_ident == TRUE)
				Error (MULTIPLE_MSG, "Identifier");
			TestFree(ptr->vp_identifier);
			ptr->vp_identifier = xf86configStrdup(val.str);
			has_ident = TRUE;
			break;
		case OPTION:
			ptr->vp_option_lst = xf86parseOption(ptr->vp_option_lst);
			break;

		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG, NULL);
			break;
		default:
			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
			break;
		}
	}

#ifdef DEBUG
	printf ("VideoPort subsection parsed\n");
#endif

	return ptr;
}
예제 #8
0
static XF86ConfVendSubPtr
xf86parseVendorSubSection(void)
{
    int has_ident = FALSE;
    int token;

    parsePrologue(XF86ConfVendSubPtr, XF86ConfVendSubRec)

        while ((token = xf86getToken(VendorSubTab)) != ENDSUBSECTION) {
        switch (token) {
        case COMMENT:
            ptr->vs_comment = xf86addComment(ptr->vs_comment, xf86_lex_val.str);
            break;
        case IDENTIFIER:
            if (xf86getSubToken(&(ptr->vs_comment)))
                Error(QUOTE_MSG, "Identifier");
            if (has_ident == TRUE)
                Error(MULTIPLE_MSG, "Identifier");
            ptr->vs_identifier = xf86_lex_val.str;
            has_ident = TRUE;
            break;
        case OPTION:
            ptr->vs_option_lst = xf86parseOption(ptr->vs_option_lst);
            break;

        case EOF_TOKEN:
            Error(UNEXPECTED_EOF_MSG);
            break;
        default:
            Error(INVALID_KEYWORD_MSG, xf86tokenString());
            break;
        }
    }

#ifdef DEBUG
    printf("Vendor subsection parsed\n");
#endif

    return ptr;
}
예제 #9
0
파일: read.c 프로젝트: mmaruska/xserver
XF86ConfigPtr
xf86readConfigFile(void)
{
    int token;
    XF86ConfigPtr ptr = NULL;

    if ((ptr = calloc(1, sizeof(XF86ConfigRec))) == NULL) {
        return NULL;
    }

    while ((token = xf86getToken(TopLevelTab)) != EOF_TOKEN) {
        switch (token) {
        case COMMENT:
            ptr->conf_comment = xf86addComment(ptr->conf_comment, xf86_lex_val.str);
            break;
        case SECTION:
            if (xf86getSubToken(&(ptr->conf_comment)) != STRING) {
                xf86parseError(QUOTE_MSG, "Section");
                CLEANUP(ptr);
                return NULL;
            }
            xf86setSection(xf86_lex_val.str);
            if (xf86nameCompare(xf86_lex_val.str, "files") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_RETURN(conf_files, xf86parseFilesSection());
            }
            else if (xf86nameCompare(xf86_lex_val.str, "serverflags") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_RETURN(conf_flags, xf86parseFlagsSection());
            }
            else if (xf86nameCompare(xf86_lex_val.str, "pointer") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_LIST(conf_input_lst, xf86parsePointerSection,
                            XF86ConfInputPtr);
            }
            else if (xf86nameCompare(xf86_lex_val.str, "videoadaptor") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_LIST(conf_videoadaptor_lst, xf86parseVideoAdaptorSection,
                            XF86ConfVideoAdaptorPtr);
            }
            else if (xf86nameCompare(xf86_lex_val.str, "device") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_LIST(conf_device_lst, xf86parseDeviceSection,
                            XF86ConfDevicePtr);
            }
            else if (xf86nameCompare(xf86_lex_val.str, "monitor") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_LIST(conf_monitor_lst, xf86parseMonitorSection,
                            XF86ConfMonitorPtr);
            }
            else if (xf86nameCompare(xf86_lex_val.str, "modes") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_LIST(conf_modes_lst, xf86parseModesSection,
                            XF86ConfModesPtr);
            }
            else if (xf86nameCompare(xf86_lex_val.str, "screen") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_LIST(conf_screen_lst, xf86parseScreenSection,
                            XF86ConfScreenPtr);
            }
            else if (xf86nameCompare(xf86_lex_val.str, "inputdevice") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_LIST(conf_input_lst, xf86parseInputSection,
                            XF86ConfInputPtr);
            }
            else if (xf86nameCompare(xf86_lex_val.str, "inputclass") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_LIST(conf_inputclass_lst,
                            xf86parseInputClassSection, XF86ConfInputClassPtr);
            }
            else if (xf86nameCompare(xf86_lex_val.str, "outputclass") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_LIST(conf_outputclass_lst, xf86parseOutputClassSection,
                            XF86ConfOutputClassPtr);
            }
            else if (xf86nameCompare(xf86_lex_val.str, "module") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_RETURN(conf_modules, xf86parseModuleSection());
            }
            else if (xf86nameCompare(xf86_lex_val.str, "serverlayout") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_LIST(conf_layout_lst, xf86parseLayoutSection,
                            XF86ConfLayoutPtr);
            }
            else if (xf86nameCompare(xf86_lex_val.str, "vendor") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_LIST(conf_vendor_lst, xf86parseVendorSection,
                            XF86ConfVendorPtr);
            }
            else if (xf86nameCompare(xf86_lex_val.str, "dri") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_RETURN(conf_dri, xf86parseDRISection());
            }
            else if (xf86nameCompare(xf86_lex_val.str, "extensions") == 0) {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                HANDLE_RETURN(conf_extensions, xf86parseExtensionsSection());
            }
            else {
                free(xf86_lex_val.str);
                xf86_lex_val.str = NULL;
                Error(INVALID_SECTION_MSG, xf86tokenString());
            }
            break;
        default:
            free(xf86_lex_val.str);
            xf86_lex_val.str = NULL;
            Error(INVALID_KEYWORD_MSG, xf86tokenString());
        }
    }

    if (xf86validateConfig(ptr))
        return ptr;
    else {
        CLEANUP(ptr);
        return NULL;
    }
}
예제 #10
0
XF86ConfModeLinePtr
xf86parseVerboseMode (void)
{
	int token, token2;
	int had_dotclock = 0, had_htimings = 0, had_vtimings = 0;
	parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec)

		if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
		Error ("Mode name expected", NULL);
	ptr->ml_identifier = xf86configStrdup(val.str);
	while ((token = xf86getToken (ModeTab)) != ENDMODE)
	{
		switch (token)
		{
		case COMMENT:
			ptr->ml_comment = xf86addComment(ptr->ml_comment, val.str);
			break;
		case DOTCLOCK:
			if ((token = xf86getSubToken (&(ptr->ml_comment))) != NUMBER)
				Error (NUMBER_MSG, "DotClock");
			ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
			had_dotclock = 1;
			break;
		case HTIMINGS:
			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
				ptr->ml_hdisplay = val.num;
			else
				Error ("Horizontal display expected", NULL);

			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
				ptr->ml_hsyncstart = val.num;
			else
				Error ("Horizontal sync start expected", NULL);

			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
				ptr->ml_hsyncend = val.num;
			else
				Error ("Horizontal sync end expected", NULL);

			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
				ptr->ml_htotal = val.num;
			else
				Error ("Horizontal total expected", NULL);
			had_htimings = 1;
			break;
		case VTIMINGS:
			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
				ptr->ml_vdisplay = val.num;
			else
				Error ("Vertical display expected", NULL);

			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
				ptr->ml_vsyncstart = val.num;
			else
				Error ("Vertical sync start expected", NULL);

			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
				ptr->ml_vsyncend = val.num;
			else
				Error ("Vertical sync end expected", NULL);

			if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
				ptr->ml_vtotal = val.num;
			else
				Error ("Vertical total expected", NULL);
			had_vtimings = 1;
			break;
		case FLAGS:
			token = xf86getSubToken (&(ptr->ml_comment));
			if (token != STRING)
				Error (QUOTE_MSG, "Flags");
			while (token == STRING)
			{
				token2 = xf86getStringToken (TimingTab);
				switch (token2)
				{
				case TT_INTERLACE:
					ptr->ml_flags |= XF86CONF_INTERLACE;
					break;
				case TT_PHSYNC:
					ptr->ml_flags |= XF86CONF_PHSYNC;
					break;
				case TT_NHSYNC:
					ptr->ml_flags |= XF86CONF_NHSYNC;
					break;
				case TT_PVSYNC:
					ptr->ml_flags |= XF86CONF_PVSYNC;
					break;
				case TT_NVSYNC:
					ptr->ml_flags |= XF86CONF_NVSYNC;
					break;
				case TT_CSYNC:
					ptr->ml_flags |= XF86CONF_CSYNC;
					break;
				case TT_PCSYNC:
					ptr->ml_flags |= XF86CONF_PCSYNC;
					break;
				case TT_NCSYNC:
					ptr->ml_flags |= XF86CONF_NCSYNC;
					break;
				case TT_DBLSCAN:
					ptr->ml_flags |= XF86CONF_DBLSCAN;
					break;
				case TT_CUSTOM:
					ptr->ml_flags |= XF86CONF_CUSTOM;
					break;
				case EOF_TOKEN:
					Error (UNEXPECTED_EOF_MSG, NULL);
					break;
				default:
					Error ("Unknown flag string", NULL);
					break;
				}
				token = xf86getSubToken (&(ptr->ml_comment));
			}
			xf86unGetToken (token);
			break;
		case HSKEW:
			if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
				Error ("Horizontal skew expected", NULL);
			ptr->ml_flags |= XF86CONF_HSKEW;
			ptr->ml_hskew = val.num;
			break;
		case VSCAN:
			if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
				Error ("Vertical scan count expected", NULL);
			ptr->ml_flags |= XF86CONF_VSCAN;
			ptr->ml_vscan = val.num;
			break;
		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG, NULL);
			break;
		default:
			Error ("Unexepcted token in verbose \"Mode\" entry\n", NULL);
		}
	}
	if (!had_dotclock)
		Error ("the dotclock is missing", NULL);
	if (!had_htimings)
		Error ("the horizontal timings are missing", NULL);
	if (!had_vtimings)
		Error ("the vertical timings are missing", NULL);

#ifdef DEBUG
	printf ("Verbose Mode parsed\n");
#endif
	return (ptr);
}
예제 #11
0
XF86ConfigPtr
xf86parseConfigFile (XF86ConfigPtr ptr)
{
	int token;

	if (!ptr)
	{
		if ((ptr = xf86confcalloc (1, sizeof (XF86ConfigRec))) == NULL)
		{
			return NULL;
		}
		memset (ptr, 0, sizeof (XF86ConfigRec));
	}

	while ((token = xf86getToken (TopLevelTab)) != EOF_TOKEN)
	{
		switch (token)
		{
		case COMMENT:
			ptr->conf_comment = xf86addComment(ptr->conf_comment, val.str);
			break;
		case SECTION:
			if (xf86getSubToken (&(ptr->conf_comment)) != STRING)
			{
				xf86parseError (QUOTE_MSG, "Section");
				CLEANUP (ptr);
				return (NULL);
			}
			xf86setSection (val.str);
			if (xf86nameCompare (val.str, "files") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_files_lst, xf86parseFilesSection,
							   XF86ConfFilesPtr);
			}
			else if (xf86nameCompare (val.str, "serverflags") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_flags_lst, xf86parseFlagsSection,
							 XF86ConfFlagsPtr);
			}
			else if (xf86nameCompare (val.str, "keyboard") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_input_lst, xf86parseKeyboardSection,
							 XF86ConfInputPtr);
			}
			else if (xf86nameCompare (val.str, "pointer") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_input_lst, xf86parsePointerSection,
							 XF86ConfInputPtr);
			}
			else if (xf86nameCompare (val.str, "videoadaptor") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_videoadaptor_lst, xf86parseVideoAdaptorSection,
							 XF86ConfVideoAdaptorPtr);
			}
			else if (xf86nameCompare (val.str, "device") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_device_lst, xf86parseDeviceSection,
							 XF86ConfDevicePtr);
			}
			else if (xf86nameCompare (val.str, "monitor") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_monitor_lst, xf86parseMonitorSection,
							 XF86ConfMonitorPtr);
			}
			else if (xf86nameCompare (val.str, "modes") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_modes_lst, xf86parseModesSection,
							 XF86ConfModesPtr);
			}
			else if (xf86nameCompare (val.str, "screen") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_screen_lst, xf86parseScreenSection,
							 XF86ConfScreenPtr);
			}
			else if (xf86nameCompare(val.str, "inputdevice") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_input_lst, xf86parseInputSection,
							 XF86ConfInputPtr);
			}
			else if (xf86nameCompare (val.str, "module") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_modules_lst, xf86parseModuleSection,
							 XF86ConfModulePtr);
			}
			else if (xf86nameCompare (val.str, "serverlayout") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_layout_lst, xf86parseLayoutSection,
							 XF86ConfLayoutPtr);
			}
			else if (xf86nameCompare (val.str, "vendor") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_vendor_lst, xf86parseVendorSection,
							 XF86ConfVendorPtr);
			}
			else if (xf86nameCompare (val.str, "dri") == 0)
			{
				xf86conffree(val.str);
				val.str = NULL;
				HANDLE_LIST (conf_dri_lst, xf86parseDRISection,
							   XF86ConfDRIPtr);
			}
			else
			{
				Error (INVALID_SECTION_MSG, xf86tokenString ());
				xf86conffree(val.str);
				val.str = NULL;
			}
			break;
		default:
			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
			xf86conffree(val.str);
			val.str = NULL;
		}
	}
	return ptr;
}
예제 #12
0
XF86ConfInputPtr
xf86parsePointerSection (void)
{
	char *s, *s1, *s2;
	int l;
	int token;
	parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)

	while ((token = xf86getToken (PointerTab)) != ENDSECTION)
	{
		switch (token)
		{
		case COMMENT:
			ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
			break;
		case PROTOCOL:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "Protocol");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("Protocol"),
												val.str);
			break;
		case PDEVICE:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "Device");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("Device"),
												val.str);
			break;
		case EMULATE3:
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("Emulate3Buttons"),
												NULL);
			break;
		case EM3TIMEOUT:
			if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
				Error (POSITIVE_INT_MSG, "Emulate3Timeout");
			s = xf86uLongToString(val.num);
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("Emulate3Timeout"),
												s);
			break;
		case CHORDMIDDLE:
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("ChordMiddle"),
												NULL);
			break;
		case PBUTTONS:
			if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
				Error (POSITIVE_INT_MSG, "Buttons");
			s = xf86uLongToString(val.num);
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("Buttons"), s);
			break;
		case BAUDRATE:
			if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
				Error (POSITIVE_INT_MSG, "BaudRate");
			s = xf86uLongToString(val.num);
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("BaudRate"), s);
			break;
		case SAMPLERATE:
			if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
				Error (POSITIVE_INT_MSG, "SampleRate");
			s = xf86uLongToString(val.num);
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("SampleRate"), s);
			break;
		case PRESOLUTION:
			if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
				Error (POSITIVE_INT_MSG, "Resolution");
			s = xf86uLongToString(val.num);
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("Resolution"), s);
			break;
		case CLEARDTR:
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("ClearDTR"), NULL);
			break;
		case CLEARRTS:
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("ClearRTS"), NULL);
			break;
		case ZAXISMAPPING:
			switch (xf86getToken(ZMapTab)) {
			case NUMBER:
				if (val.num < 0)
					Error (ZAXISMAPPING_MSG, NULL);
				s1 = xf86uLongToString(val.num);
				if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
					xf86conffree(s1);
					Error (ZAXISMAPPING_MSG, NULL);
				}
				s2 = xf86uLongToString(val.num);
				l = strlen(s1) + 1 + strlen(s2) + 1;
				s = xf86confmalloc(l);
				sprintf(s, "%s %s", s1, s2);
				xf86conffree(s1);
				xf86conffree(s2);
				break;
			case XAXIS:
				s = xf86configStrdup("x");
				break;
			case YAXIS:
				s = xf86configStrdup("y");
				break;
			default:
				Error (ZAXISMAPPING_MSG, NULL);
				break;
			}
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("ZAxisMapping"),
												s);
			break;
		case ALWAYSCORE:
			break;
		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG, NULL);
			break;
		default:
			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
			break;
		}
	}

	ptr->inp_identifier = xf86configStrdup(CONF_IMPLICIT_POINTER);
	ptr->inp_driver = xf86configStrdup("mouse");
	ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
										xf86configStrdup("CorePointer"), NULL);

#ifdef DEBUG
	printf ("Pointer section parsed\n");
#endif

	return ptr;
}
예제 #13
0
파일: Flags.c 프로젝트: 4eremuxa/xserver
XF86ConfFlagsPtr
xf86parseFlagsSection (void)
{
	int token;
	parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec)

	while ((token = xf86getToken (ServerFlagsTab)) != ENDSECTION)
	{
		int hasvalue = FALSE;
		int strvalue = FALSE;
		int tokentype;
		switch (token)
		{
		case COMMENT:
			ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str);
			break;
			/* 
			 * these old keywords are turned into standard generic options.
			 * we fall through here on purpose
			 */
		case DEFAULTLAYOUT:
			strvalue = TRUE;
		case BLANKTIME:
		case STANDBYTIME:
		case SUSPENDTIME:
		case OFFTIME:
			hasvalue = TRUE;
		case NOTRAPSIGNALS:
		case DONTZAP:
		case DONTZOOM:
		case DISABLEVIDMODE:
		case ALLOWNONLOCAL:
		case DISABLEMODINDEV:
		case MODINDEVALLOWNONLOCAL:
		case ALLOWMOUSEOPENFAIL:
			{
				int i = 0;
				while (ServerFlagsTab[i].token != -1)
				{
					char *tmp;

					if (ServerFlagsTab[i].token == token)
					{
						char *valstr = NULL;
						tmp = strdup (ServerFlagsTab[i].name);
						if (hasvalue)
						{
							tokentype = xf86getSubToken(&(ptr->flg_comment));
							if (strvalue) {
								if (tokentype != STRING)
									Error (QUOTE_MSG, tmp);
								valstr = val.str;
							} else {
								if (tokentype != NUMBER)
									Error (NUMBER_MSG, tmp);
								if (asprintf(&valstr, "%d", val.num) == -1)
									valstr = NULL;
							}
						}
						ptr->flg_option_lst = xf86addNewOption
							(ptr->flg_option_lst, tmp, valstr);
					}
					i++;
				}
			}
			break;
		case OPTION:
			ptr->flg_option_lst = xf86parseOption(ptr->flg_option_lst);
			break;

		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG, NULL);
			break;
		default:
			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
			break;
		}
	}

#ifdef DEBUG
	printf ("Flags section parsed\n");
#endif

	return ptr;
}
예제 #14
0
XF86ConfMonitorPtr
xf86parseMonitorSection (void)
{
	int has_ident = FALSE;
	int token;
	parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)

		while ((token = xf86getToken (MonitorTab)) != ENDSECTION)
	{
		switch (token)
		{
		case COMMENT:
			ptr->mon_comment = xf86addComment(ptr->mon_comment, val.str);
			break;
		case IDENTIFIER:
			if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
				Error (QUOTE_MSG, "Identifier");
			if (has_ident == TRUE)
				Error (MULTIPLE_MSG, "Identifier");
			ptr->mon_identifier = xf86configStrdup(val.str);
			has_ident = TRUE;
			break;
		case VENDOR:
			if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
				Error (QUOTE_MSG, "Vendor");
			ptr->mon_vendor = xf86configStrdup(val.str);
			break;
		case MODEL:
			if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
				Error (QUOTE_MSG, "ModelName");
			ptr->mon_modelname = xf86configStrdup(val.str);
			break;
		case MODE:
			HANDLE_LIST (mon_modeline_lst, xf86parseVerboseMode,
						 XF86ConfModeLinePtr);
			break;
		case MODELINE:
			HANDLE_LIST (mon_modeline_lst, xf86parseModeLine,
						 XF86ConfModeLinePtr);
			break;
		case DISPLAYSIZE:
			if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
				Error (DISPLAYSIZE_MSG, NULL);
			ptr->mon_width = val.realnum;
			if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
				Error (DISPLAYSIZE_MSG, NULL);
			ptr->mon_height = val.realnum;
			break;

		case HORIZSYNC:
			if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
				Error (HORIZSYNC_MSG, NULL);
			do {
				ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum;
				switch (token = xf86getSubToken (&(ptr->mon_comment)))
				{
					case COMMA:
						ptr->mon_hsync[ptr->mon_n_hsync].hi =
						ptr->mon_hsync[ptr->mon_n_hsync].lo;
						break;
					case DASH:
						if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
						    (float)val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo)
							Error (HORIZSYNC_MSG, NULL);
						ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum;
						if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
							break;
						ptr->mon_n_hsync++;
						goto HorizDone;
					default:
						/* We cannot currently know if a '\n' was found,
						 * or this is a real error
						 */
						ptr->mon_hsync[ptr->mon_n_hsync].hi =
						ptr->mon_hsync[ptr->mon_n_hsync].lo;
						ptr->mon_n_hsync++;
						goto HorizDone;
				}
				if (ptr->mon_n_hsync >= CONF_MAX_HSYNC)
					Error ("Sorry. Too many horizontal sync intervals.", NULL);
				ptr->mon_n_hsync++;
			} while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
HorizDone:
			xf86unGetToken (token);
			break;

		case VERTREFRESH:
			if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
				Error (VERTREFRESH_MSG, NULL);
			do {
				ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum;
				switch (token = xf86getSubToken (&(ptr->mon_comment)))
				{
					case COMMA:
						ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
						ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
						break;
					case DASH:
						if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
						    (float)val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
							Error (VERTREFRESH_MSG, NULL);
						ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum;
						if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
							break;
						ptr->mon_n_vrefresh++;
						goto VertDone;
					default:
						/* We cannot currently know if a '\n' was found,
						 * or this is a real error
						 */
						ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
						ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
						ptr->mon_n_vrefresh++;
						goto VertDone;
				}
				if (ptr->mon_n_vrefresh >= CONF_MAX_VREFRESH)
					Error ("Sorry. Too many vertical refresh intervals.", NULL);
				ptr->mon_n_vrefresh++;
			} while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
VertDone:
			xf86unGetToken (token);
			break;

		case GAMMA:
			if( xf86getSubToken (&(ptr->mon_comment)) != NUMBER )
			{
				Error (INVALID_GAMMA_MSG, NULL);
			}
			else
			{
				ptr->mon_gamma_red = ptr->mon_gamma_green =
					ptr->mon_gamma_blue = val.realnum;
				if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER )
				{
					ptr->mon_gamma_green = val.realnum;
					if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER )
					{
						ptr->mon_gamma_blue = val.realnum;
					}
					else
					{
						Error (INVALID_GAMMA_MSG, NULL);
					}
				}
				else
					xf86unGetToken (token);
			}
			break;
		case OPTION:
			ptr->mon_option_lst = xf86parseOption(ptr->mon_option_lst);
			break;
		case USEMODES:
		        {
				XF86ConfModesLinkPtr mptr;

				if ((token = xf86getSubToken (&(ptr->mon_comment))) != STRING)
					Error (QUOTE_MSG, "UseModes");

				/* add to the end of the list of modes sections 
				   referenced here */
				mptr = xf86confcalloc (1, sizeof (XF86ConfModesLinkRec));
				mptr->list.next = NULL;
				mptr->ml_modes_str = xf86configStrdup(val.str);
				mptr->ml_modes = NULL;
				ptr->mon_modes_sect_lst = (XF86ConfModesLinkPtr)
					xf86addListItem((GenericListPtr)ptr->mon_modes_sect_lst,
						    (GenericListPtr)mptr);
			}
			break;
		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG, NULL);
			break;
		default:
			xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
			CLEANUP (ptr);
			return NULL;
		}
	}

	if (!has_ident)
		Error (NO_IDENT_MSG, NULL);

#ifdef DEBUG
	printf ("Monitor section parsed\n");
#endif
	return ptr;
}
예제 #15
0
파일: Layout.c 프로젝트: Agnesa/xserver
XF86ConfLayoutPtr
xf86parseLayoutSection(void)
{
    int has_ident = FALSE;
    int token;

    parsePrologue(XF86ConfLayoutPtr, XF86ConfLayoutRec)

        while ((token = xf86getToken(LayoutTab)) != ENDSECTION) {
        switch (token) {
        case COMMENT:
            ptr->lay_comment = xf86addComment(ptr->lay_comment, val.str);
            break;
        case IDENTIFIER:
            if (xf86getSubToken(&(ptr->lay_comment)) != STRING)
                Error(QUOTE_MSG, "Identifier");
            if (has_ident == TRUE)
                Error(MULTIPLE_MSG, "Identifier");
            ptr->lay_identifier = val.str;
            has_ident = TRUE;
            break;
        case INACTIVE:
        {
            XF86ConfInactivePtr iptr;

            iptr = calloc(1, sizeof(XF86ConfInactiveRec));
            iptr->list.next = NULL;
            if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
                free(iptr);
                Error(INACTIVE_MSG);
            }
            iptr->inactive_device_str = val.str;
            ptr->lay_inactive_lst = (XF86ConfInactivePtr)
                xf86addListItem((glp) ptr->lay_inactive_lst, (glp) iptr);
        }
            break;
        case SCREEN:
        {
            XF86ConfAdjacencyPtr aptr;
            int absKeyword = 0;

            aptr = calloc(1, sizeof(XF86ConfAdjacencyRec));
            aptr->list.next = NULL;
            aptr->adj_scrnum = -1;
            aptr->adj_where = CONF_ADJ_OBSOLETE;
            aptr->adj_x = 0;
            aptr->adj_y = 0;
            aptr->adj_refscreen = NULL;
            if ((token = xf86getSubToken(&(ptr->lay_comment))) == NUMBER)
                aptr->adj_scrnum = val.num;
            else
                xf86unGetToken(token);
            token = xf86getSubToken(&(ptr->lay_comment));
            if (token != STRING) {
                free(aptr);
                Error(SCREEN_MSG);
            }
            aptr->adj_screen_str = val.str;

            token = xf86getSubTokenWithTab(&(ptr->lay_comment), AdjTab);
            switch (token) {
            case RIGHTOF:
                aptr->adj_where = CONF_ADJ_RIGHTOF;
                break;
            case LEFTOF:
                aptr->adj_where = CONF_ADJ_LEFTOF;
                break;
            case ABOVE:
                aptr->adj_where = CONF_ADJ_ABOVE;
                break;
            case BELOW:
                aptr->adj_where = CONF_ADJ_BELOW;
                break;
            case RELATIVE:
                aptr->adj_where = CONF_ADJ_RELATIVE;
                break;
            case ABSOLUTE:
                aptr->adj_where = CONF_ADJ_ABSOLUTE;
                absKeyword = 1;
                break;
            case EOF_TOKEN:
                free(aptr);
                Error(UNEXPECTED_EOF_MSG);
                break;
            default:
                xf86unGetToken(token);
                token = xf86getSubToken(&(ptr->lay_comment));
                if (token == STRING)
                    aptr->adj_where = CONF_ADJ_OBSOLETE;
                else
                    aptr->adj_where = CONF_ADJ_ABSOLUTE;
            }
            switch (aptr->adj_where) {
            case CONF_ADJ_ABSOLUTE:
                if (absKeyword)
                    token = xf86getSubToken(&(ptr->lay_comment));
                if (token == NUMBER) {
                    aptr->adj_x = val.num;
                    token = xf86getSubToken(&(ptr->lay_comment));
                    if (token != NUMBER) {
                        free(aptr);
                        Error(INVALID_SCR_MSG);
                    }
                    aptr->adj_y = val.num;
                }
                else {
                    if (absKeyword) {
                        free(aptr);
                        Error(INVALID_SCR_MSG);
                    }
                    else
                        xf86unGetToken(token);
                }
                break;
            case CONF_ADJ_RIGHTOF:
            case CONF_ADJ_LEFTOF:
            case CONF_ADJ_ABOVE:
            case CONF_ADJ_BELOW:
            case CONF_ADJ_RELATIVE:
                token = xf86getSubToken(&(ptr->lay_comment));
                if (token != STRING) {
                    free(aptr);
                    Error(INVALID_SCR_MSG);
                }
                aptr->adj_refscreen = val.str;
                if (aptr->adj_where == CONF_ADJ_RELATIVE) {
                    token = xf86getSubToken(&(ptr->lay_comment));
                    if (token != NUMBER) {
                        free(aptr);
                        Error(INVALID_SCR_MSG);
                    }
                    aptr->adj_x = val.num;
                    token = xf86getSubToken(&(ptr->lay_comment));
                    if (token != NUMBER) {
                        free(aptr);
                        Error(INVALID_SCR_MSG);
                    }
                    aptr->adj_y = val.num;
                }
                break;
            case CONF_ADJ_OBSOLETE:
                /* top */
                aptr->adj_top_str = val.str;

                /* bottom */
                if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
                    free(aptr);
                    Error(SCREEN_MSG);
                }
                aptr->adj_bottom_str = val.str;

                /* left */
                if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
                    free(aptr);
                    Error(SCREEN_MSG);
                }
                aptr->adj_left_str = val.str;

                /* right */
                if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
                    free(aptr);
                    Error(SCREEN_MSG);
                }
                aptr->adj_right_str = val.str;

            }
            ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
                xf86addListItem((glp) ptr->lay_adjacency_lst, (glp) aptr);
        }
            break;
        case INPUTDEVICE:
        {
            XF86ConfInputrefPtr iptr;

            iptr = calloc(1, sizeof(XF86ConfInputrefRec));
            iptr->list.next = NULL;
            iptr->iref_option_lst = NULL;
            if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
                free(iptr);
                Error(INPUTDEV_MSG);
            }
            iptr->iref_inputdev_str = val.str;
            while ((token = xf86getSubToken(&(ptr->lay_comment))) == STRING) {
                iptr->iref_option_lst =
                    xf86addNewOption(iptr->iref_option_lst, val.str, NULL);
            }
            xf86unGetToken(token);
            ptr->lay_input_lst = (XF86ConfInputrefPtr)
                xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr);
        }
            break;
        case OPTION:
            ptr->lay_option_lst = xf86parseOption(ptr->lay_option_lst);
            break;
        case EOF_TOKEN:
            Error(UNEXPECTED_EOF_MSG);
            break;
        default:
            Error(INVALID_KEYWORD_MSG, xf86tokenString());
            break;
        }
    }

    if (!has_ident)
        Error(NO_IDENT_MSG);

#ifdef DEBUG
    printf("Layout section parsed\n");
#endif

    return ptr;
}
예제 #16
0
XF86ConfFilesPtr
xf86parseFilesSection (void)
{
	int i, j;
	int k, l;
	char *str;
	int token;
	parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec)

	while ((token = xf86getToken (FilesTab)) != ENDSECTION)
	{
		switch (token)
		{
		case COMMENT:
			ptr->file_comment = xf86addComment(ptr->file_comment, val.str);
			break;
		case FONTPATH:
			if (xf86getSubToken (&(ptr->file_comment)) != STRING)
				Error (QUOTE_MSG, "FontPath");
			j = FALSE;
			str = prependRoot (val.str);
			if (ptr->file_fontpath == NULL)
			{
				ptr->file_fontpath = xf86confmalloc (1);
				ptr->file_fontpath[0] = '\0';
				i = strlen (str) + 1;
			}
			else
			{
				i = strlen (ptr->file_fontpath) + strlen (str) + 1;
				if (ptr->file_fontpath[strlen (ptr->file_fontpath) - 1] != ',')
				{
					i++;
					j = TRUE;
				}
			}
			ptr->file_fontpath =
				xf86confrealloc (ptr->file_fontpath, i);
			if (j)
				strcat (ptr->file_fontpath, ",");

			strcat (ptr->file_fontpath, str);
			xf86conffree (val.str);
			break;
		case RGBPATH:
			if (xf86getSubToken (&(ptr->file_comment)) != STRING)
				Error (QUOTE_MSG, "RGBPath");
			ptr->file_rgbpath = val.str;
			break;
		case MODULEPATH:
			if (xf86getSubToken (&(ptr->file_comment)) != STRING)
				Error (QUOTE_MSG, "ModulePath");
			l = FALSE;
			str = prependRoot (val.str);
			if (ptr->file_modulepath == NULL)
			{
				ptr->file_modulepath = xf86confmalloc (1);
				ptr->file_modulepath[0] = '\0';
				k = strlen (str) + 1;
			}
			else
			{
				k = strlen (ptr->file_modulepath) + strlen (str) + 1;
				if (ptr->file_modulepath[strlen (ptr->file_modulepath) - 1] != ',')
				{
					k++;
					l = TRUE;
				}
			}
			ptr->file_modulepath = xf86confrealloc (ptr->file_modulepath, k);
			if (l)
				strcat (ptr->file_modulepath, ",");

			strcat (ptr->file_modulepath, str);
			xf86conffree (val.str);
			break;
		case INPUTDEVICES:
			if (xf86getSubToken (&(ptr->file_comment)) != STRING)
				Error (QUOTE_MSG, "InputDevices");
			l = FALSE;
			str = prependRoot (val.str);
			if (ptr->file_inputdevs == NULL)
			{
				ptr->file_inputdevs = xf86confmalloc (1);
				ptr->file_inputdevs[0] = '\0';
				k = strlen (str) + 1;
			}
			else
			{
				k = strlen (ptr->file_inputdevs) + strlen (str) + 1;
				if (ptr->file_inputdevs[strlen (ptr->file_inputdevs) - 1] != ',')
				{
					k++;
					l = TRUE;
				}
			}
			ptr->file_inputdevs = xf86confrealloc (ptr->file_inputdevs, k);
			if (l)
				strcat (ptr->file_inputdevs, ",");

			strcat (ptr->file_inputdevs, str);
			xf86conffree (val.str);
			break;
		case LOGFILEPATH:
			if (xf86getSubToken (&(ptr->file_comment)) != STRING)
				Error (QUOTE_MSG, "LogFile");
			ptr->file_logfile = val.str;
			break;
		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG, NULL);
			break;
		default:
			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
			break;
		}
	}

#ifdef DEBUG
	printf ("File section parsed\n");
#endif

	return ptr;
}
예제 #17
0
파일: Keyboard.c 프로젝트: aosm/X11
XF86ConfInputPtr
xf86parseKeyboardSection (void)
{
	char *s, *s1, *s2;
	int l;
	int token, ntoken;
	parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)

	while ((token = xf86getToken (KeyboardTab)) != ENDSECTION)
	{
		switch (token)
		{
		case COMMENT:
			ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
			break;
		case KPROTOCOL:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "Protocol");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
							       xf86configStrdup("Protocol"),
							       val.str);
			break;
		case AUTOREPEAT:
			if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER)
				Error (AUTOREPEAT_MSG, NULL);
			s1 = xf86uLongToString(val.num);
			if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER)
				Error (AUTOREPEAT_MSG, NULL);
			s2 = xf86uLongToString(val.num);
			l = strlen(s1) + 1 + strlen(s2) + 1;
			s = xf86confmalloc(l);
			sprintf(s, "%s %s", s1, s2);
			xf86conffree(s1);
			xf86conffree(s2);
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
							       xf86configStrdup("AutoRepeat"), s);
			break;
		case XLEDS:
			if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER)
				Error (XLEDS_MSG, NULL);
			s = xf86uLongToString(val.num);
			l = strlen(s) + 1;
			while ((token = xf86getSubToken (&(ptr->inp_comment))) == NUMBER)
			{
				s1 = xf86uLongToString(val.num);
				l += (1 + strlen(s1));
				s = xf86confrealloc(s, l);
				strcat(s, " ");
				strcat(s, s1);
				xf86conffree(s1);
			}
			xf86unGetToken (token);
			break;
		case SERVERNUM:
			xf86parseWarning(OBSOLETE_MSG, xf86tokenString());
			break;
		case LEFTALT:
		case RIGHTALT:
		case SCROLLLOCK_TOK:
		case RIGHTCTL:
			xf86parseWarning(OBSOLETE_MSG, xf86tokenString());
				break;
			ntoken = xf86getToken (KeyMapTab);
			switch (ntoken)
			{
			case EOF_TOKEN:
				xf86parseError (UNEXPECTED_EOF_MSG);
				CLEANUP (ptr);
				return (NULL);
				break;

			default:
				Error (INVALID_KEYWORD_MSG, xf86tokenString ());
				break;
			}
			break;
		case VTINIT:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "VTInit");
			xf86parseWarning(MOVED_TO_FLAGS_MSG, "VTInit");
			break;
		case VTSYSREQ:
			xf86parseWarning(MOVED_TO_FLAGS_MSG, "VTSysReq");
			break;
		case XKBDISABLE:
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbDisable"),
												NULL);
			break;
		case XKBKEYMAP:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "XKBKeymap");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbKeymap"),
												val.str);
			break;
		case XKBCOMPAT:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "XKBCompat");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbCompat"),
												val.str);
			break;
		case XKBTYPES:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "XKBTypes");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbTypes"),
												val.str);
			break;
		case XKBKEYCODES:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "XKBKeycodes");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbKeycodes"),
												val.str);
			break;
		case XKBGEOMETRY:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "XKBGeometry");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbGeometry"),
												val.str);
			break;
		case XKBSYMBOLS:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "XKBSymbols");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbSymbols"),
												val.str);
			break;
		case XKBRULES:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "XKBRules");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbRules"),
												val.str);
			break;
		case XKBMODEL:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "XKBModel");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbModel"),
												val.str);
			break;
		case XKBLAYOUT:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "XKBLayout");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbLayout"),
												val.str);
			break;
		case XKBVARIANT:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "XKBVariant");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbVariant"),
												val.str);
			break;
		case XKBOPTIONS:
			if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
				Error (QUOTE_MSG, "XKBOptions");
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("XkbOptions"),
												val.str);
			break;
		case PANIX106:
			ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
												xf86configStrdup("Panix106"), NULL);
			break;
		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG, NULL);
			break;
		default:
			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
			break;
		}
	}

	ptr->inp_identifier = xf86configStrdup(CONF_IMPLICIT_KEYBOARD);
	ptr->inp_driver = xf86configStrdup("keyboard");
	ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
										xf86configStrdup("CoreKeyboard"), NULL);

#ifdef DEBUG
	printf ("Keyboard section parsed\n");
#endif

	return ptr;
}
예제 #18
0
XF86ConfVideoAdaptorPtr
xf86parseVideoAdaptorSection (void)
{
	int has_ident = FALSE;
	int token;

	parsePrologue (XF86ConfVideoAdaptorPtr, XF86ConfVideoAdaptorRec)

	while ((token = xf86getToken (VideoAdaptorTab)) != ENDSECTION)
	{
		switch (token)
		{
		case COMMENT:
			ptr->va_comment = xf86addComment(ptr->va_comment, val.str);
			break;
		case IDENTIFIER:
			if (xf86getSubToken (&(ptr->va_comment)) != STRING)
				Error (QUOTE_MSG, "Identifier");
			ptr->va_identifier = xf86configStrdup(val.str);
			if (has_ident == TRUE)
				Error (MULTIPLE_MSG, "Identifier");
			has_ident = TRUE;
			break;
		case VENDOR:
			if (xf86getSubToken (&(ptr->va_comment)) != STRING)
				Error (QUOTE_MSG, "Vendor");
			ptr->va_vendor = xf86configStrdup(val.str);
			break;
		case BOARD:
			if (xf86getSubToken (&(ptr->va_comment)) != STRING)
				Error (QUOTE_MSG, "Board");
			ptr->va_board = xf86configStrdup(val.str);
			break;
		case BUSID:
			if (xf86getSubToken (&(ptr->va_comment)) != STRING)
				Error (QUOTE_MSG, "BusID");
			ptr->va_busid = xf86configStrdup(val.str);
			break;
		case DRIVER:
			if (xf86getSubToken (&(ptr->va_comment)) != STRING)
				Error (QUOTE_MSG, "Driver");
			ptr->va_driver = xf86configStrdup(val.str);
			break;
		case OPTION:
			ptr->va_option_lst = xf86parseOption(ptr->va_option_lst);
			break;
		case SUBSECTION:
			if (xf86getSubToken (&(ptr->va_comment)) != STRING)
				Error (QUOTE_MSG, "SubSection");
			{
				{
					XF86ConfVideoPortPtr p =
						xf86parseVideoPortSubSection(val.str);
					if (!p) {
						CLEANUP(ptr);
						return NULL;
					} else {
						ptr->va_port_lst =
							(XF86ConfVideoPortPtr)xf86addListItem((glp)ptr->va_port_lst, (glp)p);
					}
				}
			}
			break;

		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG, NULL);
			break;
		default:
			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
			break;
		}
	}

	if (!has_ident)
		Error (NO_IDENT_MSG, NULL);

#ifdef DEBUG
	printf ("VideoAdaptor section parsed\n");
#endif

	return ptr;
}
예제 #19
0
XF86ConfModeLinePtr
xf86parseModeLine (void)
{
	int token;
	parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec)

	/* Identifier */
	if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
		Error ("ModeLine identifier expected", NULL);
	ptr->ml_identifier = xf86configStrdup(val.str);

	/* DotClock */
	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
		Error ("ModeLine dotclock expected", NULL);
	ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);

	/* HDisplay */
	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
		Error ("ModeLine Hdisplay expected", NULL);
	ptr->ml_hdisplay = val.num;

	/* HSyncStart */
	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
		Error ("ModeLine HSyncStart expected", NULL);
	ptr->ml_hsyncstart = val.num;

	/* HSyncEnd */
	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
		Error ("ModeLine HSyncEnd expected", NULL);
	ptr->ml_hsyncend = val.num;

	/* HTotal */
	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
		Error ("ModeLine HTotal expected", NULL);
	ptr->ml_htotal = val.num;

	/* VDisplay */
	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
		Error ("ModeLine Vdisplay expected", NULL);
	ptr->ml_vdisplay = val.num;

	/* VSyncStart */
	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
		Error ("ModeLine VSyncStart expected", NULL);
	ptr->ml_vsyncstart = val.num;

	/* VSyncEnd */
	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
		Error ("ModeLine VSyncEnd expected", NULL);
	ptr->ml_vsyncend = val.num;

	/* VTotal */
	if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
		Error ("ModeLine VTotal expected", NULL);
	ptr->ml_vtotal = val.num;

	token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab);
	while ((token == TT_INTERLACE) || (token == TT_PHSYNC) ||
		   (token == TT_NHSYNC) || (token == TT_PVSYNC) ||
		   (token == TT_NVSYNC) || (token == TT_CSYNC) ||
		   (token == TT_PCSYNC) || (token == TT_NCSYNC) ||
		   (token == TT_DBLSCAN) || (token == TT_HSKEW) ||
		   (token == TT_VSCAN) || (token == TT_BCAST))
	{
		switch (token)
		{

		case TT_INTERLACE:
			ptr->ml_flags |= XF86CONF_INTERLACE;
			break;
		case TT_PHSYNC:
			ptr->ml_flags |= XF86CONF_PHSYNC;
			break;
		case TT_NHSYNC:
			ptr->ml_flags |= XF86CONF_NHSYNC;
			break;
		case TT_PVSYNC:
			ptr->ml_flags |= XF86CONF_PVSYNC;
			break;
		case TT_NVSYNC:
			ptr->ml_flags |= XF86CONF_NVSYNC;
			break;
		case TT_CSYNC:
			ptr->ml_flags |= XF86CONF_CSYNC;
			break;
		case TT_PCSYNC:
			ptr->ml_flags |= XF86CONF_PCSYNC;
			break;
		case TT_NCSYNC:
			ptr->ml_flags |= XF86CONF_NCSYNC;
			break;
		case TT_DBLSCAN:
			ptr->ml_flags |= XF86CONF_DBLSCAN;
			break;
		case TT_HSKEW:
			if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
				Error (NUMBER_MSG, "Hskew");
			ptr->ml_hskew = val.num;
			ptr->ml_flags |= XF86CONF_HSKEW;
			break;
		case TT_BCAST:
			ptr->ml_flags |= XF86CONF_BCAST;
			break;
		case TT_VSCAN:
			if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
				Error (NUMBER_MSG, "Vscan");
			ptr->ml_vscan = val.num;
			ptr->ml_flags |= XF86CONF_VSCAN;
			break;
		case TT_CUSTOM:
			ptr->ml_flags |= XF86CONF_CUSTOM;
			break;
		case EOF_TOKEN:
			Error (UNEXPECTED_EOF_MSG, NULL);
			break;
		default:
			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
			break;
		}
		token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab);
	}
	xf86unGetToken (token);

#ifdef DEBUG
	printf ("ModeLine parsed\n");
#endif
	return (ptr);
}
예제 #20
0
파일: Device.c 프로젝트: mirror/xserver
XF86ConfDevicePtr
xf86parseDeviceSection(void)
{
    int i;
    int has_ident = FALSE;
    int token;

    parsePrologue(XF86ConfDevicePtr, XF86ConfDeviceRec)

        /* Zero is a valid value for these */
        ptr->dev_chipid = -1;
    ptr->dev_chiprev = -1;
    ptr->dev_irq = -1;
    while ((token = xf86getToken(DeviceTab)) != ENDSECTION) {
        switch (token) {
        case COMMENT:
            ptr->dev_comment = xf86addComment(ptr->dev_comment, xf86_lex_val.str);
            break;
        case IDENTIFIER:
            if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                Error(QUOTE_MSG, "Identifier");
            if (has_ident == TRUE)
                Error(MULTIPLE_MSG, "Identifier");
            ptr->dev_identifier = xf86_lex_val.str;
            has_ident = TRUE;
            break;
        case VENDOR:
            if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                Error(QUOTE_MSG, "Vendor");
            ptr->dev_vendor = xf86_lex_val.str;
            break;
        case BOARD:
            if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                Error(QUOTE_MSG, "Board");
            ptr->dev_board = xf86_lex_val.str;
            break;
        case CHIPSET:
            if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                Error(QUOTE_MSG, "Chipset");
            ptr->dev_chipset = xf86_lex_val.str;
            break;
        case CARD:
            if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                Error(QUOTE_MSG, "Card");
            ptr->dev_card = xf86_lex_val.str;
            break;
        case DRIVER:
            if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                Error(QUOTE_MSG, "Driver");
            ptr->dev_driver = xf86_lex_val.str;
            break;
        case RAMDAC:
            if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                Error(QUOTE_MSG, "Ramdac");
            ptr->dev_ramdac = xf86_lex_val.str;
            break;
        case DACSPEED:
            for (i = 0; i < CONF_MAXDACSPEEDS; i++)
                ptr->dev_dacSpeeds[i] = 0;
            if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) {
                Error(DACSPEED_MSG, CONF_MAXDACSPEEDS);
            }
            else {
                ptr->dev_dacSpeeds[0] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5);
                for (i = 1; i < CONF_MAXDACSPEEDS; i++) {
                    if (xf86getSubToken(&(ptr->dev_comment)) == NUMBER)
                        ptr->dev_dacSpeeds[i] = (int)
                            (xf86_lex_val.realnum * 1000.0 + 0.5);
                    else {
                        xf86unGetToken(token);
                        break;
                    }
                }
            }
            break;
        case VIDEORAM:
            if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                Error(NUMBER_MSG, "VideoRam");
            ptr->dev_videoram = xf86_lex_val.num;
            break;
        case BIOSBASE:
            if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                Error(NUMBER_MSG, "BIOSBase");
            /* ignored */
            break;
        case MEMBASE:
            if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                Error(NUMBER_MSG, "MemBase");
            ptr->dev_mem_base = xf86_lex_val.num;
            break;
        case IOBASE:
            if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                Error(NUMBER_MSG, "IOBase");
            ptr->dev_io_base = xf86_lex_val.num;
            break;
        case CLOCKCHIP:
            if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                Error(QUOTE_MSG, "ClockChip");
            ptr->dev_clockchip = xf86_lex_val.str;
            break;
        case CHIPID:
            if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                Error(NUMBER_MSG, "ChipID");
            ptr->dev_chipid = xf86_lex_val.num;
            break;
        case CHIPREV:
            if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                Error(NUMBER_MSG, "ChipRev");
            ptr->dev_chiprev = xf86_lex_val.num;
            break;

        case CLOCKS:
            token = xf86getSubToken(&(ptr->dev_comment));
            for (i = ptr->dev_clocks;
                 token == NUMBER && i < CONF_MAXCLOCKS; i++) {
                ptr->dev_clock[i] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5);
                token = xf86getSubToken(&(ptr->dev_comment));
            }
            ptr->dev_clocks = i;
            xf86unGetToken(token);
            break;
        case MATCHSEAT:
            if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                Error(QUOTE_MSG, "MatchSeat");
            ptr->match_seat = xf86_lex_val.str;
            break;
        case OPTION:
            ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst);
            break;
        case BUSID:
            if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                Error(QUOTE_MSG, "BusID");
            ptr->dev_busid = xf86_lex_val.str;
            break;
        case IRQ:
            if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                Error(QUOTE_MSG, "IRQ");
            ptr->dev_irq = xf86_lex_val.num;
            break;
        case SCREEN:
            if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                Error(NUMBER_MSG, "Screen");
            ptr->dev_screen = xf86_lex_val.num;
            break;
        case EOF_TOKEN:
            Error(UNEXPECTED_EOF_MSG);
            break;
        default:
            Error(INVALID_KEYWORD_MSG, xf86tokenString());
            break;
        }
    }

    if (!has_ident)
        Error(NO_IDENT_MSG);

#ifdef DEBUG
    printf("Device section parsed\n");
#endif

    return ptr;
}
예제 #21
0
static XF86ConfDisplayPtr
xf86parseDisplaySubSection(void)
{
    int token;

    parsePrologue(XF86ConfDisplayPtr, XF86ConfDisplayRec)

        ptr->disp_black.red = ptr->disp_black.green = ptr->disp_black.blue = -1;
    ptr->disp_white.red = ptr->disp_white.green = ptr->disp_white.blue = -1;
    ptr->disp_frameX0 = ptr->disp_frameY0 = -1;
    while ((token = xf86getToken(DisplayTab)) != ENDSUBSECTION) {
        switch (token) {
        case COMMENT:
            ptr->disp_comment = xf86addComment(ptr->disp_comment, xf86_lex_val.str);
            break;
        case VIEWPORT:
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(VIEWPORT_MSG);
            ptr->disp_frameX0 = xf86_lex_val.num;
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(VIEWPORT_MSG);
            ptr->disp_frameY0 = xf86_lex_val.num;
            break;
        case VIRTUAL:
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(VIRTUAL_MSG);
            ptr->disp_virtualX = xf86_lex_val.num;
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(VIRTUAL_MSG);
            ptr->disp_virtualY = xf86_lex_val.num;
            break;
        case DEPTH:
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(NUMBER_MSG, "Display");
            ptr->disp_depth = xf86_lex_val.num;
            break;
        case BPP:
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(NUMBER_MSG, "Display");
            ptr->disp_bpp = xf86_lex_val.num;
            break;
        case VISUAL:
            if (xf86getSubToken(&(ptr->disp_comment)) != STRING)
                Error(QUOTE_MSG, "Display");
            ptr->disp_visual = xf86_lex_val.str;
            break;
        case WEIGHT:
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(WEIGHT_MSG);
            ptr->disp_weight.red = xf86_lex_val.num;
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(WEIGHT_MSG);
            ptr->disp_weight.green = xf86_lex_val.num;
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(WEIGHT_MSG);
            ptr->disp_weight.blue = xf86_lex_val.num;
            break;
        case BLACK_TOK:
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(BLACK_MSG);
            ptr->disp_black.red = xf86_lex_val.num;
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(BLACK_MSG);
            ptr->disp_black.green = xf86_lex_val.num;
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(BLACK_MSG);
            ptr->disp_black.blue = xf86_lex_val.num;
            break;
        case WHITE_TOK:
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(WHITE_MSG);
            ptr->disp_white.red = xf86_lex_val.num;
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(WHITE_MSG);
            ptr->disp_white.green = xf86_lex_val.num;
            if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                Error(WHITE_MSG);
            ptr->disp_white.blue = xf86_lex_val.num;
            break;
        case MODES:
        {
            XF86ModePtr mptr;

            while ((token =
                    xf86getSubTokenWithTab(&(ptr->disp_comment),
                                           DisplayTab)) == STRING) {
                mptr = calloc(1, sizeof(XF86ModeRec));
                mptr->mode_name = xf86_lex_val.str;
                mptr->list.next = NULL;
                ptr->disp_mode_lst = (XF86ModePtr)
                    xf86addListItem((glp) ptr->disp_mode_lst, (glp) mptr);
            }
            xf86unGetToken(token);
        }
            break;
        case OPTION:
            ptr->disp_option_lst = xf86parseOption(ptr->disp_option_lst);
            break;

        case EOF_TOKEN:
            Error(UNEXPECTED_EOF_MSG);
            break;
        default:
            Error(INVALID_KEYWORD_MSG, xf86tokenString());
            break;
        }
    }

#ifdef DEBUG
    printf("Display subsection parsed\n");
#endif

    return ptr;
}
예제 #22
0
XF86ConfScreenPtr
xf86parseScreenSection(void)
{
    int has_ident = FALSE;
    int has_driver = FALSE;
    int token;

    parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec)

        while ((token = xf86getToken(ScreenTab)) != ENDSECTION) {
        switch (token) {
        case COMMENT:
            ptr->scrn_comment = xf86addComment(ptr->scrn_comment, xf86_lex_val.str);
            break;
        case IDENTIFIER:
            if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                Error(QUOTE_MSG, "Identifier");
            ptr->scrn_identifier = xf86_lex_val.str;
            if (has_ident || has_driver)
                Error(ONLY_ONE_MSG, "Identifier or Driver");
            has_ident = TRUE;
            break;
        case MATCHSEAT:
            if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                Error(QUOTE_MSG, "MatchSeat");
            ptr->match_seat = xf86_lex_val.str;
            break;
        case OBSDRIVER:
            if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                Error(QUOTE_MSG, "Driver");
            ptr->scrn_obso_driver = xf86_lex_val.str;
            if (has_ident || has_driver)
                Error(ONLY_ONE_MSG, "Identifier or Driver");
            has_driver = TRUE;
            break;
        case DEFAULTDEPTH:
            if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
                Error(NUMBER_MSG, "DefaultDepth");
            ptr->scrn_defaultdepth = xf86_lex_val.num;
            break;
        case DEFAULTBPP:
            if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
                Error(NUMBER_MSG, "DefaultBPP");
            ptr->scrn_defaultbpp = xf86_lex_val.num;
            break;
        case DEFAULTFBBPP:
            if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
                Error(NUMBER_MSG, "DefaultFbBPP");
            ptr->scrn_defaultfbbpp = xf86_lex_val.num;
            break;
        case MDEVICE:
            if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                Error(QUOTE_MSG, "Device");
            ptr->scrn_device_str = xf86_lex_val.str;
            break;
        case MONITOR:
            if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                Error(QUOTE_MSG, "Monitor");
            ptr->scrn_monitor_str = xf86_lex_val.str;
            break;
        case VIDEOADAPTOR:
        {
            XF86ConfAdaptorLinkPtr aptr;

            if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                Error(QUOTE_MSG, "VideoAdaptor");

            /* Don't allow duplicates */
            for (aptr = ptr->scrn_adaptor_lst; aptr;
                 aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next)
                if (xf86nameCompare(xf86_lex_val.str, aptr->al_adaptor_str) == 0)
                    break;

            if (aptr == NULL) {
                aptr = calloc(1, sizeof(XF86ConfAdaptorLinkRec));
                aptr->list.next = NULL;
                aptr->al_adaptor_str = xf86_lex_val.str;
                ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr)
                    xf86addListItem((glp) ptr->scrn_adaptor_lst, (glp) aptr);
            }
        }
            break;
        case VIRTUAL:
            if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
                Error(VIRTUAL_MSG);
            ptr->scrn_virtualX = xf86_lex_val.num;
            if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
                Error(VIRTUAL_MSG);
            ptr->scrn_virtualY = xf86_lex_val.num;
            break;
        case OPTION:
            ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst);
            break;
        case SUBSECTION:
            if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                Error(QUOTE_MSG, "SubSection");
            {
                free(xf86_lex_val.str);
                HANDLE_LIST(scrn_display_lst, xf86parseDisplaySubSection,
                            XF86ConfDisplayPtr);
            }
            break;
        case EOF_TOKEN:
            Error(UNEXPECTED_EOF_MSG);
            break;
        default:
            Error(INVALID_KEYWORD_MSG, xf86tokenString());
            break;
        }
    }

    if (!has_ident && !has_driver)
        Error(NO_IDENT_MSG);

#ifdef DEBUG
    printf("Screen section parsed\n");
#endif

    return ptr;
}