コード例 #1
0
ファイル: ext_output.cpp プロジェクト: F4m3uS/hiphop-php
Variant f_hphp_output_global_state(bool serialize /* = true */) {
  Array r(get_global_state());
  if (serialize) {
    return f_serialize(r);
  } else {
    return r;
  }
}
コード例 #2
0
ファイル: gamestate.c プロジェクト: kongo2002/gskat
/**
 * save_global_state:
 * @output:  output file stream
 *
 * Write global states into file buffer
 *
 * Returns: %TRUE on success, otherwise %FALSE
 */
gboolean save_global_state(FILE *output)
{
    global_state *state;

    /* try to determine global states */
    if (!(state = get_global_state()))
    {
        gskat_msg(MT_ERROR, _("Could not determine current game state.\n"));
        return FALSE;
    }

    /* write global state into file buffer */
    if (fwrite(state, sizeof(global_state), 1, output) != 1)
    {
        gskat_msg(MT_ERROR, _("Error on writing game state.\n"));

        g_free(state);
        return FALSE;
    }

    g_free(state);
    return TRUE;
}