freedreno/rnn: add relaxed boolean type
In the schema, boolean means strictly "true" or "false". But rnn parsing code was looking for "yes"/"1"/"no"/"0". So split the difference, and add a relaxed boolean type, and update rnn to also accept "true" or "false". Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6107>
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
<group ref="rng:regarrayGroup" />
|
||||
</choice>
|
||||
<attribute name="name" type="NMTOKEN" use="required" />
|
||||
<attribute name="bare" type="boolean" use="optional" />
|
||||
<attribute name="bare" type="rng:Boolean" use="optional" />
|
||||
<attribute name="prefix" type="NMTOKENS" use="optional" />
|
||||
<attribute name="width" type="rng:DomainWidth" use="optional" />
|
||||
<attribute name="size" type="rng:Hexadecimal" use="optional" />
|
||||
@@ -166,8 +166,8 @@
|
||||
<group ref="rng:topGroup" />
|
||||
</choice>
|
||||
<attribute name="name" type="NMTOKEN" use="required" />
|
||||
<attribute name="inline" type="boolean" use="optional" />
|
||||
<attribute name="bare" type="boolean" use="optional" />
|
||||
<attribute name="inline" type="rng:Boolean" use="optional" />
|
||||
<attribute name="bare" type="rng:Boolean" use="optional" />
|
||||
<attribute name="prefix" type="NMTOKENS" use="optional" />
|
||||
</complexType>
|
||||
|
||||
@@ -200,8 +200,8 @@
|
||||
<group ref="rng:topGroup" />
|
||||
</choice>
|
||||
<attribute name="name" type="NMTOKEN" use="required" />
|
||||
<attribute name="inline" type="boolean" use="optional" />
|
||||
<attribute name="bare" type="boolean" use="optional" />
|
||||
<attribute name="inline" type="rng:Boolean" use="optional" />
|
||||
<attribute name="bare" type="rng:Boolean" use="optional" />
|
||||
<attribute name="prefix" type="NMTOKENS" use="optional" />
|
||||
</complexType>
|
||||
|
||||
@@ -315,6 +315,17 @@
|
||||
<union memberTypes="rng:Hexadecimal nonNegativeInteger" />
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="Boolean">
|
||||
<restriction base="string">
|
||||
<enumeration value="true" />
|
||||
<enumeration value="1" />
|
||||
<enumeration value="yes" />
|
||||
<enumeration value="false" />
|
||||
<enumeration value="0" />
|
||||
<enumeration value="no" />
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="Access">
|
||||
<annotation>
|
||||
<documentation>Access</documentation>
|
||||
|
@@ -124,9 +124,9 @@ static char *getattrib (struct rnndb *db, char *file, int line, xmlAttr *attr) {
|
||||
|
||||
static int getboolattrib (struct rnndb *db, char *file, int line, xmlAttr *attr) {
|
||||
char *c = getattrib(db, file, line, attr);
|
||||
if (!strcmp(c, "yes") || !strcmp(c, "1"))
|
||||
if (!strcmp(c, "yes") || !strcmp(c, "1") || !strcmp(c, "true"))
|
||||
return 1;
|
||||
if (!strcmp(c, "no") || !strcmp(c, "0"))
|
||||
if (!strcmp(c, "no") || !strcmp(c, "0") || !strcmp(c, "false"))
|
||||
return 0;
|
||||
rnn_err(db, "%s:%d: invalid boolean value \"%s\" in attribute \"%s\"\n", file, line, c, attr->name);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user