コード例 #1
0
ファイル: pdb-load.c プロジェクト: jszigetvari/syslog-ng
static void
_process_tag_element(PDBLoader *state,
                     const gchar **attribute_names, const gchar **attribute_values,
                     GError **error)
{
  _push_state(state, PDBL_TAG);
}
コード例 #2
0
ファイル: pdb-load.c プロジェクト: jszigetvari/syslog-ng
static void
_process_value_element(PDBLoader *state,
                       const gchar **attribute_names, const gchar **attribute_values,
                       GError **error)
{
  if (attribute_names[0] && g_str_equal(attribute_names[0], "name"))
    state->value_name = g_strdup(attribute_values[0]);
  else
    {
      pdb_loader_set_error(state, error, "<value> misses name attribute in rule %s", state->current_rule->rule_id);
      return;
    }
  _push_state(state, PDBL_VALUE);
}
コード例 #3
0
ファイル: pdb-load.c プロジェクト: jszigetvari/syslog-ng
static void
_process_message_element(PDBLoader *state,
                         const gchar **attribute_names, const gchar **attribute_values,
                         SyntheticMessage *target,
                         GError **error)
{
  gint i;

  for (i = 0; attribute_names[i]; i++)
    {
      if (strcmp(attribute_names[i], "inherit-properties") == 0)
        synthetic_message_set_inherit_properties_string(target, attribute_values[i], error);
      else if (strcmp(attribute_names[i], "inherit-mode") == 0)
        synthetic_message_set_inherit_mode_string(target, attribute_values[i], error);
    }
  state->current_message = target;
  _push_state(state, PDBL_MESSAGE);
}
コード例 #4
0
ファイル: game.c プロジェクト: fprates/ilusia
void ils_start(struct ils_obj *game, struct ils_obj *cen,
        struct ils_config config)
{
    struct ils_key_press key_press;
    struct ils_key *key;
    struct fac_iterador *it;
    struct ils_obj *obj_;
    struct ils_timer *timer;
    struct ils_evento evento;

    if (game == NULL) {
        printf("e: objeto de jogo não inicializado.\n");
        return;
    }

    if (cen == NULL) {
        printf("e: cenário não inicializado.\n");
        return;
    }

    if (_ini_devices(&config) < 0) {
        printf("e: erro na inicialização dos dispositivos.\n");
        return;
    }

    _def_img();
    _def_fonts();
    it = _ret_complex_objs(cen);
    printf("i: aguardando eventos...\n");

    system_.ret = 0;
    while (!system_.ret) {
        key_press = _ret_key_pressed();

        _frame_start();
        _push_state();
        _call_output_proc(cen, cen);
        _pop_state();

        fac_rst_iterador(it);
        while (fac_existe_prox(it)) {
            obj_ = _ret_obj_from_complex(fac_proximo(it));

            if (!ils_is_obj_enabled(obj_, cen))
                continue;

            switch (ils_ret_event_source(obj_)) {
            case ILS_KEY:
                key = _ret_key_event(obj_, &key_press);
                break;

            case ILS_BOT:
                key = _ret_bot_event(cen, obj_);
                break;
            }

            _push_state();
            _call_output_proc(cen, obj_);
            _pop_state();

            if (config.global_proc != NULL)
                config.global_proc(cen, obj_);

            if (key == NULL)
                continue;

            evento.evcode = ils_ret_event_code(key);
            evento.obj = obj_;
            evento.cen = cen;
            evento.key_code = key_press.code;

            timer = ils_ret_key_timer(key);
            if (timer != NULL) {
                if (ils_is_timer_stopped(timer)) {
                    ils_start_timer(timer);
                    continue;
                }

                if (!ils_ret_timer_mrk(timer))
                    continue;

                ils_reset_timer_cnt(timer);
            }

            ils_send_event(obj_, &evento);
        }

        _output_commit();
    }

    fac_rm_iterador(it);
    _term_devices();
}