⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config.c

📁 我搜集到的一个java常用类库的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
        {            /* // starts a comment */            while (c == '/')                NextProperty();            i = 0;            while (c != ':' && c != EOF && i < 60)            {                name[i++] = (char)c;                AdvanceChar();            }            name[i] = '\0';            entry = lookup(name);            if (c == ':' && entry)            {                AdvanceChar();                entry->parser(entry->location, name);            }            else                NextProperty();        }        fclose(fp);    }}/* returns false if unknown or doesn't use parameter */Bool ParseConfig(char *option, char *parameter){    PList *entry;    FILE *ffp;    if (option && parameter)    {        ffp = fp;            fp = null;            c = *parameter;        parameter++;            entry = lookup(option);            if (!entry)        {            fp = ffp;            ReportUnknownOption(option);            return no;        }        config_text = parameter;        entry->parser(entry->location, option);            fp = ffp;    }    return yes;}/* ensure that config is self consistent */void AdjustConfig(void){ /* avoid the need to set IndentContent when SmartIndent is set */    if (SmartIndent)        IndentContent = yes; /* disable wrapping */    if (wraplen == 0)        wraplen = 0x7FFFFFFF; /* Word 2000 needs o:p to be declared as inline */    if (Word2000)    {        DefineInlineTag("o:p");    } /* XHTML is written in lower case */    if (xHTML)    {        XmlOut = yes;        UpperCaseTags = no;        UpperCaseAttrs = no;    } /* if XML in, then XML out */    if (XmlTags)    {        XmlOut = yes;        XmlPIs = yes;    } /* XML requires end tags */    if (XmlOut)    {        QuoteAmpersand = yes;        HideEndTags = no;    }}/* unsigned integers */void ParseInt(Location location, char *option){    int number = 0;    Bool digits = no;    SkipWhite();    while(IsDigit(c))    {        number = c - '0' + (10 * number);        digits = yes;        AdvanceChar();    }    if (!digits)        ReportBadArgument(option);        *location.number = number;    NextProperty();}/* true/false or yes/no only looks at 1st char */void ParseBool(Location location, char *option){    Bool flag = no;    SkipWhite();    if (c == 't' || c == 'T' || c == 'y' || c == 'Y')        flag = yes;    else if (c == 'f' || c == 'F' || c == 'n' || c == 'N')        flag = no;    else        ReportBadArgument(option);    *location.logical = flag;    NextProperty();}void ParseInvBool(Location location, char *option){    Bool flag = no;    SkipWhite();    if (c == 't' || c == 'T' || c == 'y' || c == 'Y')        flag = yes;    else if (c == 'f' || c == 'F' || c == 'n' || c == 'N')        flag = no;    else        ReportBadArgument(option);    *location.logical = (Bool)(!flag);    NextProperty();}/* a string excluding whitespace */void ParseName(Location location, char *option){    char buf[256];    int i = 0;    SkipWhite();    while (i < 254 && c != EOF && !IsWhite(c))    {        buf[i++] = c;        AdvanceChar();    }    buf[i] = '\0';    if (i == 0)        ReportBadArgument(option);    *location.string = wstrdup(buf);    NextProperty();}/* a space or comma separated list of tag names */void ParseTagNames(Location location, char *option){    char buf[1024];    int i = 0;    do    {        if (c == ' ' || c == '\t' || c == ',')        {            AdvanceChar();            continue;        }        if (c == '\r')        {            AdvanceChar();            if (c == '\n')                AdvanceChar();            if (!(IsWhite((uint) c)))                break;        }        if (c == '\n')        {            AdvanceChar();            if (!(IsWhite((uint) c)))                break;        }        while (i < 1022 && c != EOF && !IsWhite(c) && c != ',')        {            buf[i++] = ToLower(c);            AdvanceChar();        }        buf[i] = '\0';        /* add tag to dictionary */        if(location.string == &inline_tags)            DefineInlineTag(buf);        else if (location.string == &block_tags)            DefineBlockTag(buf);        else if (location.string == &empty_tags)            DefineEmptyTag(buf);        else if (location.string == &pre_tags)            DefinePreTag(buf);        i = 0;    }    while (c != EOF);}/* a string including whitespace *//* munges whitespace sequences */void ParseString(Location location, char *option){    char buf[8192];    int i = 0;    Bool waswhite = no;    SkipWhite();    while (i < 8190 && c != EOF)    {        /* treat  \r\n   \r  or  \n as line ends */        if (c == '\r')        {            AdvanceChar();            if (c != '\n' && !IsWhite(c))                break;        }        if (c == '\n')        {            AdvanceChar();            if (!IsWhite(c))                break;        }        if (IsWhite(c))        {            if (waswhite)            {                AdvanceChar();                continue;            }            c = ' ';        }        else            waswhite = no;        buf[i++] = c;        AdvanceChar();    }    buf[i] = '\0';    if (*location.string)        MemFree(*location.string);    if (i == 0)        ReportBadArgument(option);    *location.string = wstrdup(buf);    NextProperty();}void ParseCharEncoding(Location location, char *option){    char buf[64];    int i = 0;    SkipWhite();    while (i < 62 && c != EOF && !IsWhite(c))    {        buf[i++] = c;        AdvanceChar();    }    buf[i] = '\0';    if (wstrcasecmp(buf, "ascii") == 0)        *location.number = ASCII;    else if (wstrcasecmp(buf, "latin1") == 0)        *location.number = LATIN1;    else if (wstrcasecmp(buf, "raw") == 0)        *location.number = RAW;    else if (wstrcasecmp(buf, "utf8") == 0)        *location.number = UTF8;    else if (wstrcasecmp(buf, "iso2022") == 0)        *location.number = ISO2022;    else if (wstrcasecmp(buf, "mac") == 0)        *location.number = MACROMAN;    else        ReportBadArgument(option);    NextProperty();}/* slight hack to avoid changes to pprint.c */void ParseIndent(Location location, char *option){    char buf[64];    int i = 0;    SkipWhite();    while (i < 62 && c != EOF && !IsWhite(c))    {        buf[i++] = c;        AdvanceChar();    }    buf[i] = '\0';    if (wstrcasecmp(buf, "yes") == 0)    {        IndentContent = yes;        SmartIndent = no;    }    else if (wstrcasecmp(buf, "true") == 0)    {        IndentContent = yes;        SmartIndent = no;    }    else if (wstrcasecmp(buf, "no") == 0)    {        IndentContent = no;        SmartIndent = no;    }    else if (wstrcasecmp(buf, "false") == 0)    {        IndentContent = no;        SmartIndent = no;    }    else if (wstrcasecmp(buf, "auto") == 0)    {        IndentContent = yes;        SmartIndent = yes;    }    else        ReportBadArgument(option);    NextProperty();}/*   doctype: omit | auto | strict | loose | <fpi>   where the fpi is a string similar to      "-//ACME//DTD HTML 3.14159//EN"*/void ParseDocType(Location location, char *option){    char buf[64];    int i = 0;    SkipWhite();    /* "-//ACME//DTD HTML 3.14159//EN" or similar */    if (c == '"')    {        ParseString(location, option);        doctype_mode = doctype_user;        return;    }    /* read first word */    while (i < 62 && c != EOF && !IsWhite(c))    {        buf[i++] = c;        AdvanceChar();    }    buf[i] = '\0';    doctype_mode = doctype_auto;    if (wstrcasecmp(buf, "omit") == 0)        doctype_mode = doctype_omit;    else if (wstrcasecmp(buf, "strict") == 0)        doctype_mode = doctype_strict;    else if (wstrcasecmp(buf, "loose") == 0 ||             wstrcasecmp(buf, "transitional") == 0)        doctype_mode = doctype_loose;    else if (i == 0)        ReportBadArgument(option);    NextProperty();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -