File: ui_type_engine.c

package info (click to toggle)
mlterm 3.9.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,340 kB
  • sloc: ansic: 154,713; sh: 5,302; cpp: 2,953; objc: 2,776; java: 2,472; makefile: 2,445; perl: 1,674; xml: 44
file content (37 lines) | stat: -rw-r--r-- 873 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */

#include "ui_type_engine.h"

#include <string.h>        /* strcmp */
#include <pobl/bl_types.h> /* u_int */

/* --- static variables --- */

/* Order of this table must be same as ui_type_engine_t. */
static char *type_engine_name_table[] = {
    "xcore", "xft", "cairo",
};

/* --- global functions --- */

ui_type_engine_t ui_get_type_engine_by_name(const char *name) {
  if (strcmp("xcore", name) == 0) {
    return TYPE_XCORE;
  } else if (strcmp("xft", name) == 0) {
    return TYPE_XFT;
  } else if (strcmp("cairo", name) == 0) {
    return TYPE_CAIRO;
  }

  /* default value */
  return TYPE_XCORE;
}

char *ui_get_type_engine_name(ui_type_engine_t engine) {
  if ((u_int)engine >= TYPE_ENGINE_MAX) {
    /* default value */
    engine = TYPE_XCORE;
  }

  return type_engine_name_table[engine];
}