示例#1
0
void
output(const char *lojban, const char *trans, const char *selmao)
{
  switch (ofmt) { 
    case OF_LATEX:
      printf ("\\begin{tabular}[t]{l}"
          "\\textbf{\\footnotesize %s}\\\\\n"
          "\\textrm{\\footnotesize %s}\\\\\n"
          "\\textit{\\footnotesize %s}\n"
          "\\end{tabular}\n"
          "\\rule{0in}{1.0\\baselineskip}",
          lojban, selmao, trans);
      break;
    case OF_TEXT:
      printf ("%s <%s> [%s] ", lojban, selmao, trans);
      break;
    case OF_TEXTBLK:
      do_block(lojban, selmao, trans);
      break;
#ifdef PLIST
    case OF_PLIST:      
      dictionary = PLInsertDictionaryEntry(dictionary, PLMakeString(lojban), PLMakeString(trans));
      break;
#endif //PLIST
  }
}
示例#2
0
proplist_t config_set_str(proplist_t prop, gchar *key, gchar *value)
{
    proplist_t pkey, pvalue;

    pkey = PLMakeString(key); pvalue = PLMakeString(value);
    prop = PLInsertDictionaryEntry(prop, pkey, pvalue);
    PLRelease(pkey); PLRelease(pvalue);
    return prop;
}
示例#3
0
proplist_t config_set_bool(proplist_t prop, gchar *key, gboolean value)
{
    proplist_t pkey, pvalue;

    pkey = PLMakeString(key); pvalue = PLMakeString(value ? "Yes" : "No");
    prop = PLInsertDictionaryEntry(prop, pkey, pvalue);
    PLRelease(pkey); PLRelease(pvalue);
    return prop;
}
示例#4
0
proplist_t config_set_int(proplist_t prop, gchar *key, gint value)
{
    proplist_t pkey, pvalue;
    gchar *strval;

    strval = g_strdup_printf("%d", value);
    pkey = PLMakeString(key); pvalue = PLMakeString(strval);
    prop = PLInsertDictionaryEntry(prop, pkey, pvalue);
    PLRelease(pkey); PLRelease(pvalue);
    g_free(strval);
    return prop;
}
示例#5
0
proplist_t config_make_dict(proplist_t prop, gchar *section)
{
    proplist_t psect, pkey;

    pkey = PLMakeString(section);
    psect = PLMakeDictionaryFromEntries(NULL, NULL);
    prop = PLInsertDictionaryEntry(prop, pkey, psect);
    return prop;
}
示例#6
0
proplist_t config_clean_key(proplist_t prop, gchar *key)
{
    proplist_t pkey;

    pkey = PLMakeString(key);
    PLRemoveDictionaryEntry(prop, pkey);
    PLRelease(pkey);
    return prop;
}
示例#7
0
proplist_t config_get_prop(proplist_t prop, gchar *key)
{
    proplist_t ret, pkey;

    pkey = PLMakeString(key);
    ret = PLGetDictionaryEntry(prop, pkey);
    PLRelease(pkey);

    return ret;
}
示例#8
0
gchar *config_get_str(proplist_t prop, gchar *key, gchar *def)
{
    proplist_t pkey, pvalue;

    if (prop == NULL)
	return def;

    pkey = PLMakeString(key);
    pvalue = PLGetDictionaryEntry(prop, pkey);
    PLRelease(pkey);

    return pvalue == NULL ? def : PLGetString(pvalue);
}
示例#9
0
gint config_get_int(proplist_t prop, gchar *key, gint def)
{
    proplist_t pkey, pvalue;
    gint num;

    if (prop == NULL)
	return def;

    pkey = PLMakeString(key);
    pvalue = PLGetDictionaryEntry(prop, pkey);
    PLRelease(pkey);
    if (pvalue == NULL) return def;

    return sscanf(PLGetString(pvalue), "%d", &num) != 1 ? def : num;
}
示例#10
0
gboolean config_get_bool(proplist_t prop, gchar *key, gboolean def)
{
    proplist_t pkey, pvalue;
    gchar *value;

    if (prop == NULL)
	return def;

    pkey = PLMakeString(key);
    pvalue = PLGetDictionaryEntry(prop, pkey);
    PLRelease(pkey);
    if (pvalue == NULL) return def;

    value = PLGetString(pvalue);
    return toupper(*value) == 'T' || toupper(*value) == 'Y';
}
示例#11
0
proplist_t config_list_section(proplist_t prop, gchar *section)
{
    proplist_t ret, pkey, psect;

    pkey = PLMakeString(section);
    ret = PLGetDictionaryEntry(prop, pkey);
    if (ret == NULL)
    {
	psect = PLMakeArrayFromElements(NULL);
	prop = PLInsertDictionaryEntry(prop, pkey, psect);
	ret = PLGetDictionaryEntry(prop, pkey);
    }
    PLRelease(pkey);

    return ret;
}