2 * AnjutaPluginDescription - Plugin meta data
3 * anjuta-plugin-description.c Copyright (C) 2002 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 * SECTION:anjuta-plugin-description
23 * @title: AnjutaPluginDescription
24 * @short_description: Plugin description from .plugin file
25 * @see_also: #AnjutaPlugin, #AnjutaPluginHandle
26 * @stability: Unstable
27 * @include: libanjuta/anjuta-plugin-description.h
35 #include <libanjuta/anjuta-plugin-description.h>
37 typedef struct _AnjutaPluginDescriptionSection AnjutaPluginDescriptionSection
;
38 typedef struct _AnjutaPluginDescriptionLine AnjutaPluginDescriptionLine
;
39 typedef struct _AnjutaPluginDescriptionParser AnjutaPluginDescriptionParser
;
41 struct _AnjutaPluginDescriptionSection
{
42 GQuark section_name
; /* 0 means just a comment block (before any section) */
44 AnjutaPluginDescriptionLine
*lines
;
47 struct _AnjutaPluginDescriptionLine
{
48 GQuark key
; /* 0 means comment or blank line in value */
53 struct _AnjutaPluginDescription
{
55 AnjutaPluginDescriptionSection
*sections
;
56 char *current_locale
[2];
59 struct _AnjutaPluginDescriptionParser
{
60 AnjutaPluginDescription
*df
;
62 gint n_allocated_lines
;
63 gint n_allocated_sections
;
68 #define VALID_KEY_CHAR 1
69 #define VALID_LOCALE_CHAR 2
71 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
72 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
73 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x3 , 0x2 , 0x0 ,
74 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
75 0x0 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 ,
76 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x0 , 0x0 , 0x0 , 0x0 , 0x2 ,
77 0x0 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 ,
78 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x3 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
79 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
80 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
81 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
82 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
83 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
84 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
85 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
86 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
89 static void report_error (AnjutaPluginDescriptionParser
*parser
,
91 AnjutaPluginDescriptionParseError error_code
,
94 static AnjutaPluginDescriptionSection
*lookup_section (AnjutaPluginDescription
*df
,
97 static AnjutaPluginDescriptionLine
*lookup_line (AnjutaPluginDescription
*df
,
98 AnjutaPluginDescriptionSection
*section
,
103 anjuta_plugin_description_parse_error_quark (void)
107 quark
= g_quark_from_static_string ("g_desktop_parse_error");
113 parser_free (AnjutaPluginDescriptionParser
*parser
)
115 anjuta_plugin_description_free (parser
->df
);
119 anjuta_plugin_description_line_free (AnjutaPluginDescriptionLine
*line
)
121 g_free (line
->locale
);
122 g_free (line
->value
);
126 anjuta_plugin_description_section_free (AnjutaPluginDescriptionSection
*section
)
130 for (i
= 0; i
< section
->n_lines
; i
++)
131 anjuta_plugin_description_line_free (§ion
->lines
[i
]);
133 g_free (section
->lines
);
137 * anjuta_plugin_description_free:
138 * @df: an #AnjutaPluginDescription object
140 * Frees the #AnjutaPluginDescription instance.
143 anjuta_plugin_description_free (AnjutaPluginDescription
*df
)
147 for (i
= 0; i
< df
->n_sections
; i
++)
148 anjuta_plugin_description_section_free (&df
->sections
[i
]);
149 g_free (df
->sections
);
150 g_free (df
->current_locale
[0]);
151 g_free (df
->current_locale
[1]);
157 grow_lines (AnjutaPluginDescriptionParser
*parser
)
160 AnjutaPluginDescriptionSection
*section
;
162 if (parser
->n_allocated_lines
== 0)
165 new_n_lines
= parser
->n_allocated_lines
*2;
167 section
= &parser
->df
->sections
[parser
->current_section
];
169 section
->lines
= g_realloc (section
->lines
,
170 sizeof (AnjutaPluginDescriptionLine
) * new_n_lines
);
171 parser
->n_allocated_lines
= new_n_lines
;
175 grow_sections (AnjutaPluginDescriptionParser
*parser
)
179 if (parser
->n_allocated_sections
== 0)
182 new_n_sections
= parser
->n_allocated_sections
*2;
184 parser
->df
->sections
= g_realloc (parser
->df
->sections
,
185 sizeof (AnjutaPluginDescriptionSection
) * new_n_sections
);
186 parser
->n_allocated_sections
= new_n_sections
;
190 unescape_string (gchar
*str
, gint len
)
196 /* len + 1 is enough, because unescaping never makes the
198 res
= g_new (gchar
, len
+ 1);
207 /* Found an embedded null */
216 /* Escape at end of string */
239 /* Invalid escape code */
254 escape_string (const gchar
*str
, gboolean escape_first_space
)
260 /* len + 1 is enough, because unescaping never makes the
262 res
= g_new (gchar
, strlen (str
)*2 + 1);
271 if (escape_first_space
&& p
== str
)
310 open_section (AnjutaPluginDescriptionParser
*parser
,
315 if (parser
->n_allocated_sections
== parser
->df
->n_sections
)
316 grow_sections (parser
);
318 if (parser
->current_section
== 0 &&
319 parser
->df
->sections
[0].section_name
== 0 &&
320 parser
->df
->sections
[0].n_lines
== 0)
323 g_warning ("non-initial NULL section\n");
325 /* The initial section was empty. Piggyback on it. */
326 parser
->df
->sections
[0].section_name
= g_quark_from_string (name
);
331 n
= parser
->df
->n_sections
++;
334 parser
->df
->sections
[n
].section_name
= g_quark_from_string (name
);
336 parser
->df
->sections
[n
].section_name
= 0;
337 parser
->df
->sections
[n
].n_lines
= 0;
338 parser
->df
->sections
[n
].lines
= NULL
;
340 parser
->current_section
= n
;
341 parser
->n_allocated_lines
= 0;
345 static AnjutaPluginDescriptionLine
*
346 new_line (AnjutaPluginDescriptionParser
*parser
)
348 AnjutaPluginDescriptionSection
*section
;
349 AnjutaPluginDescriptionLine
*line
;
351 section
= &parser
->df
->sections
[parser
->current_section
];
353 if (parser
->n_allocated_lines
== section
->n_lines
)
356 line
= §ion
->lines
[section
->n_lines
++];
358 memset (line
, 0, sizeof (AnjutaPluginDescriptionLine
));
364 is_blank_line (AnjutaPluginDescriptionParser
*parser
)
370 while (*p
&& *p
!= '\n')
372 if (!g_ascii_isspace (*p
))
381 parse_comment_or_blank (AnjutaPluginDescriptionParser
*parser
)
383 AnjutaPluginDescriptionLine
*line
;
386 line_end
= strchr (parser
->line
, '\n');
387 if (line_end
== NULL
)
388 line_end
= parser
->line
+ strlen (parser
->line
);
390 line
= new_line (parser
);
392 line
->value
= g_strndup (parser
->line
, line_end
- parser
->line
);
394 parser
->line
= (line_end
) ? line_end
+ 1 : NULL
;
399 parse_section_start (AnjutaPluginDescriptionParser
*parser
, GError
**error
)
404 line_end
= strchr (parser
->line
, '\n');
405 if (line_end
== NULL
)
406 line_end
= parser
->line
+ strlen (parser
->line
);
408 if (line_end
- parser
->line
<= 2 ||
411 report_error (parser
, "Invalid syntax for section header", ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_SYNTAX
, error
);
412 parser_free (parser
);
416 section_name
= unescape_string (parser
->line
+ 1, line_end
- parser
->line
- 2);
418 if (section_name
== NULL
)
420 report_error (parser
, "Invalid escaping in section name", ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_ESCAPES
, error
);
421 parser_free (parser
);
425 open_section (parser
, section_name
);
427 parser
->line
= (line_end
) ? line_end
+ 1 : NULL
;
430 g_free (section_name
);
436 parse_key_value (AnjutaPluginDescriptionParser
*parser
, GError
**error
)
438 AnjutaPluginDescriptionLine
*line
;
443 gchar
*locale_start
= NULL
;
444 gchar
*locale_end
= NULL
;
449 line_end
= strchr (parser
->line
, '\n');
450 if (line_end
== NULL
)
451 line_end
= parser
->line
+ strlen (parser
->line
);
455 while (p
< line_end
&&
456 (valid
[(guchar
)*p
] & VALID_KEY_CHAR
))
460 if (key_start
== key_end
)
462 report_error (parser
, "Empty key name", ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_SYNTAX
, error
);
463 parser_free (parser
);
467 if (p
< line_end
&& *p
== '[')
471 while (p
< line_end
&& *p
!= ']')
477 report_error (parser
, "Unterminated locale specification in key", ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_SYNTAX
, error
);
478 parser_free (parser
);
485 /* Skip space before '=' */
486 while (p
< line_end
&& *p
== ' ')
489 if (p
< line_end
&& *p
!= '=')
491 report_error (parser
, "Invalid characters in key name", ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_CHARS
, error
);
492 parser_free (parser
);
498 report_error (parser
, "No '=' in key/value pair", ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_SYNTAX
, error
);
499 parser_free (parser
);
506 /* Skip space after '=' */
507 while (p
< line_end
&& *p
== ' ')
512 value
= unescape_string (value_start
, line_end
- value_start
);
515 report_error (parser
, "Invalid escaping in value", ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_ESCAPES
, error
);
516 parser_free (parser
);
520 line
= new_line (parser
);
521 key
= g_strndup (key_start
, key_end
- key_start
);
522 line
->key
= g_quark_from_string (key
);
525 line
->locale
= g_strndup (locale_start
, locale_end
- locale_start
);
528 parser
->line
= (*line_end
) ? line_end
+ 1 : NULL
;
536 report_error (AnjutaPluginDescriptionParser
*parser
,
538 AnjutaPluginDescriptionParseError error_code
,
541 AnjutaPluginDescriptionSection
*section
;
542 const gchar
*section_name
= NULL
;
544 section
= &parser
->df
->sections
[parser
->current_section
];
546 if (section
->section_name
)
547 section_name
= g_quark_to_string (section
->section_name
);
552 *error
= g_error_new (ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR
,
554 "Error in section %s at line %d: %s", section_name
, parser
->line_nr
, message
);
556 *error
= g_error_new (ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR
,
558 "Error at line %d: %s", parser
->line_nr
, message
);
562 AnjutaPluginDescription
*
563 anjuta_plugin_description_copy (AnjutaPluginDescription
*df
)
565 return anjuta_plugin_description_new_from_string (anjuta_plugin_description_to_string (df
),
570 anjuta_plugin_description_get_type (void)
572 static GType type_id
= 0;
575 type_id
= g_boxed_type_register_static ("AnjutaPluginDescription",
576 (GBoxedCopyFunc
) anjuta_plugin_description_copy
,
577 (GBoxedFreeFunc
) anjuta_plugin_description_free
);
584 * anjuta_plugin_description_new_from_string:
585 * @data: The data to parse. The format of the data is .ini style.
587 * Parses the given plugin description data (usally read from the plugin
588 * description file and creates an instance of #AnjutaPluginDescription.
589 * The format of the content string is similar to .ini format.
591 * Return value: a new #AnjutaPluginDescription object
593 AnjutaPluginDescription
*
594 anjuta_plugin_description_new_from_string (char *data
, GError
**error
)
596 AnjutaPluginDescriptionParser parser
;
598 parser
.df
= g_new0 (AnjutaPluginDescription
, 1);
599 parser
.current_section
= -1;
601 parser
.n_allocated_lines
= 0;
602 parser
.n_allocated_sections
= 0;
607 /* Put any initial comments in a NULL segment */
608 open_section (&parser
, NULL
);
609 while (parser
.line
!= NULL
&& strlen(parser
.line
))
611 if (*parser
.line
== '[') {
612 if (!parse_section_start (&parser
, error
))
614 } else if (is_blank_line (&parser
) ||
616 parse_comment_or_blank (&parser
);
619 if (!parse_key_value (&parser
, error
))
628 * anjuta_plugin_description_to_string:
629 * @df: an #AnjutaPluginDescription object.
631 * Converts the description detains into string format, usually for
632 * saving it in a file.
634 * Return value: The string representation of the description. The
635 * returned values must be freed after use.
638 anjuta_plugin_description_to_string (AnjutaPluginDescription
*df
)
640 AnjutaPluginDescriptionSection
*section
;
641 AnjutaPluginDescriptionLine
*line
;
646 str
= g_string_sized_new (800);
648 for (i
= 0; i
< df
->n_sections
; i
++)
650 section
= &df
->sections
[i
];
652 if (section
->section_name
)
654 g_string_append_c (str
, '[');
655 s
= escape_string (g_quark_to_string (section
->section_name
), FALSE
);
656 g_string_append (str
, s
);
658 g_string_append (str
, "]\n");
661 for (j
= 0; j
< section
->n_lines
; j
++)
663 line
= §ion
->lines
[j
];
667 g_string_append (str
, line
->value
);
668 g_string_append_c (str
, '\n');
672 g_string_append (str
, g_quark_to_string (line
->key
));
675 g_string_append_c (str
, '[');
676 g_string_append (str
, line
->locale
);
677 g_string_append_c (str
, ']');
679 g_string_append_c (str
, '=');
680 s
= escape_string (line
->value
, TRUE
);
681 g_string_append (str
, s
);
683 g_string_append_c (str
, '\n');
688 return g_string_free (str
, FALSE
);
691 static AnjutaPluginDescriptionSection
*
692 lookup_section (AnjutaPluginDescription
*df
,
693 const char *section_name
)
695 AnjutaPluginDescriptionSection
*section
;
696 GQuark section_quark
;
699 section_quark
= g_quark_try_string (section_name
);
700 if (section_quark
== 0)
703 for (i
= 0; i
< df
->n_sections
; i
++)
705 section
= &df
->sections
[i
];
707 if (section
->section_name
== section_quark
)
713 static AnjutaPluginDescriptionLine
*
714 lookup_line (AnjutaPluginDescription
*df
,
715 AnjutaPluginDescriptionSection
*section
,
719 AnjutaPluginDescriptionLine
*line
;
723 key_quark
= g_quark_try_string (keyname
);
727 for (i
= 0; i
< section
->n_lines
; i
++)
729 line
= §ion
->lines
[i
];
731 if (line
->key
== key_quark
&&
732 ((locale
== NULL
&& line
->locale
== NULL
) ||
733 (locale
!= NULL
&& line
->locale
!= NULL
&& strcmp (locale
, line
->locale
) == 0)))
741 * anjuta_plugin_description_get_raw:
742 * @df: an #AnjutaPluginDescription object.
743 * @section_name: Name of the section.
744 * @keyname: Name of the key.
745 * @locale: The locale for which the value is to be retrieved.
746 * @val: Pointer to the variable to store the string value.
748 * Retrieves the value of a key (in the given section) for the given locale.
749 * The value returned in @val must be freed after use.
751 * Return value: TRUE if sucessful, otherwise FALSE.
754 anjuta_plugin_description_get_raw (AnjutaPluginDescription
*df
,
755 const char *section_name
,
760 AnjutaPluginDescriptionSection
*section
;
761 AnjutaPluginDescriptionLine
*line
;
765 section
= lookup_section (df
, section_name
);
769 line
= lookup_line (df
,
777 *val
= g_strdup (line
->value
);
783 * anjuta_plugin_description_foreach_section:
784 * @df: an #AnjutaPluginDescription object.
785 * @func: Callback function.
786 * @user_data: User data to pass to @func.
788 * Calls @func for each of the sections in the description.
791 anjuta_plugin_description_foreach_section (AnjutaPluginDescription
*df
,
792 AnjutaPluginDescriptionSectionFunc func
,
795 AnjutaPluginDescriptionSection
*section
;
798 for (i
= 0; i
< df
->n_sections
; i
++)
800 section
= &df
->sections
[i
];
802 (*func
) (df
, g_quark_to_string (section
->section_name
), user_data
);
808 * anjuta_plugin_description_foreach_key:
809 * @df: an #AnjutaPluginDescription object.
810 * @section_name: Name of the section.
811 * @include_localized: Whether each localized key should be called separately.
812 * @func: The callback function.
813 * @user_data: User data to pass to @func.
815 * Calls @func for each of the keys in the given section. @include_localized,
816 * if set to TRUE will make it call @func for the localized keys also, otherwise
817 * only one call is made for the key in current locale.
820 anjuta_plugin_description_foreach_key (AnjutaPluginDescription
*df
,
821 const char *section_name
,
822 gboolean include_localized
,
823 AnjutaPluginDescriptionLineFunc func
,
826 AnjutaPluginDescriptionSection
*section
;
827 AnjutaPluginDescriptionLine
*line
;
830 section
= lookup_section (df
, section_name
);
834 for (i
= 0; i
< section
->n_lines
; i
++)
836 line
= §ion
->lines
[i
];
838 (*func
) (df
, g_quark_to_string (line
->key
), line
->locale
, line
->value
, user_data
);
846 calculate_locale (AnjutaPluginDescription
*df
)
850 lang
= g_strdup (setlocale (LC_MESSAGES
, NULL
));
854 p
= strchr (lang
, '.');
857 p
= strchr (lang
, '@');
862 lang
= g_strdup ("C");
864 p
= strchr (lang
, '_');
867 df
->current_locale
[0] = g_strdup (lang
);
869 df
->current_locale
[1] = lang
;
873 df
->current_locale
[0] = lang
;
874 df
->current_locale
[1] = NULL
;
879 * anjuta_plugin_description_get_locale_string:
880 * @df: an #AnjutaPluginDescription object.
881 * @section: Section name.
882 * @keyname: Key name.
883 * @val: Pointer to value to store retured value.
885 * Returns the value of key in the given section in current locale.
887 * Return value: TRUE if sucessful, otherwise FALSE.
890 anjuta_plugin_description_get_locale_string (AnjutaPluginDescription
*df
,
897 if (df
->current_locale
[0] == NULL
)
898 calculate_locale (df
);
900 if (df
->current_locale
[0] != NULL
)
902 res
= anjuta_plugin_description_get_raw (df
,section
, keyname
,
903 df
->current_locale
[0], val
);
908 if (df
->current_locale
[1] != NULL
)
910 res
= anjuta_plugin_description_get_raw (df
,section
, keyname
,
911 df
->current_locale
[1], val
);
916 return anjuta_plugin_description_get_raw (df
, section
, keyname
, NULL
, val
);
920 * anjuta_plugin_description_get_string:
921 * @df: an #AnjutaPluginDescription object.
922 * @section: Section name.
923 * @keyname: Key name.
924 * @val: Pointer to value to store retured value.
926 * Returns the value of key in the given section.
928 * Return value: TRUE if sucessful, otherwise FALSE.
931 anjuta_plugin_description_get_string (AnjutaPluginDescription
*df
,
936 return anjuta_plugin_description_get_raw (df
, section
, keyname
, NULL
, val
);
940 * anjuta_plugin_description_get_integer:
941 * @df: an #AnjutaPluginDescription object.
942 * @section: Section name.
943 * @keyname: Key name.
944 * @val: Pointer to value to store retured value.
946 * Returns the value of key as integer in the given section.
948 * Return value: TRUE if sucessful, otherwise FALSE.
951 anjuta_plugin_description_get_integer (AnjutaPluginDescription
*df
,
961 res
= anjuta_plugin_description_get_raw (df
, section
, keyname
, NULL
, &str
);
974 * anjuta_plugin_description_get_boolean:
975 * @df: an #AnjutaPluginDescription object.
976 * @section: Section name.
977 * @keyname: Key name.
978 * @val: Pointer to value to store retured value.
980 * Returns the value of key as boolean in the given section.
982 * Return value: TRUE if sucessful, otherwise FALSE.
985 anjuta_plugin_description_get_boolean (AnjutaPluginDescription
*df
,
995 res
= anjuta_plugin_description_get_raw (df
, section
, keyname
, NULL
, &str
);
999 if ((g_ascii_strcasecmp (str
, "yes") == 0) ||
1000 (g_ascii_strcasecmp (str
, "true") == 0))
1004 else if ((g_ascii_strcasecmp (str
, "no") == 0) ||
1005 (g_ascii_strcasecmp (str
, "false") == 0))