[monkey-bubble: 47/753] I need automake help: I can not get the signames.h file in programs/gtop/proc to be generated (this
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 47/753] I need automake help: I can not get the signames.h file in programs/gtop/proc to be generated (this
- Date: Wed, 14 Jul 2010 21:59:38 +0000 (UTC)
commit 611895c0da32cfab866638c0e7ebd4a63eaadc40
Author: Arturo Espinosa <unammx src gnome org>
Date: Mon Jan 19 17:42:00 1998 +0000
I need automake help: I can not get the signames.h file in
programs/gtop/proc to be generated (this depends on /usr/signal
contents, and a simple script in the Makefile should create it).
Tom, could you help me?
libgnome/score-helper: fixes as posted from Horacio
libgnomeui: Add gnome-scores from Horacio
programs/gnomine: fixes from horacio + score support
programs/same-gnome: most of the todo implemented
programs/gtop: Add AUTHORS file
Miguel.
libgnome/gnome-score.c | 40 ++++++++++++++++++++++++----------------
libgnome/gnome-score.h | 8 ++++++--
2 files changed, 30 insertions(+), 18 deletions(-)
---
diff --git a/libgnome/gnome-score.c b/libgnome/gnome-score.c
index ea20af7..47a578a 100644
--- a/libgnome/gnome-score.c
+++ b/libgnome/gnome-score.c
@@ -12,24 +12,26 @@
#undef GNOME_SCORE_C
gboolean /* Returns TRUE if it was a notable (top ten) score */
-gnome_score_log(gfloat score)
+gnome_score_log(gfloat score, gchar *level, int ordering)
{
int exitstatus;
char buf[64];
+ char buf2[64];
pid_t childpid = fork();
if(childpid == 0)
{
/* We are the child */
snprintf(buf, sizeof(buf), "%f", score);
+ snprintf(buf2, sizeof(buf2), "%d", ordering);
execlp("gnome-score-helper", "gnome-score-helper",
- buf, NULL);
+ buf, level, buf2, NULL);
exit(99);
}
waitpid(childpid, &exitstatus, 0);
- if(WIFEXITED(exitstatus))
- return (WEXITSTATUS(exitstatus)==0)?TRUE:FALSE;
+ if(WIFEXITED(exitstatus) && (WEXITSTATUS(exitstatus) != -1) )
+ return (WEXITSTATUS(exitstatus));
else
{
g_warning("Scorekeeping failed\n");
@@ -39,11 +41,12 @@ gnome_score_log(gfloat score)
gint
gnome_score_get_notable(gchar *gamename,
+ gchar *level,
gchar ***names,
gfloat **scores,
time_t **scoretimes)
{
- gchar *realname, buf[512];
+ gchar *realname, buf[512], *buf2;
FILE *infile;
gint retval;
@@ -55,22 +58,26 @@ gnome_score_get_notable(gchar *gamename,
else
realname = g_strdup(gamename);
if(!realname)
- return 0;
+ return -1;
- snprintf(buf, sizeof(buf), "%s/%s.scores", SCORE_PATH, realname);
+ snprintf(buf, sizeof(buf), "%s/%s.%s.scores", SCORE_PATH, realname, level);
infile = fopen(buf, "r");
if(infile)
{
- for(retval = 0, *names = NULL, *scores = NULL;
- fgets(buf, sizeof(buf), infile); retval++) {
- *names = g_realloc(*names, retval * sizeof(gchar *));
- *scores = g_realloc(*scores, retval * sizeof(gfloat));
- *scoretimes = g_realloc(*scores, retval * sizeof(time_t));
- sscanf(buf, "%f %d %a",
- &((*scores)[retval]),
- &((*scoretimes)[retval]),
- &((*names)[retval]));
+ *names = g_malloc(NSCORES*sizeof(gchar*));
+ *scores = g_malloc(NSCORES*sizeof(gfloat));
+ *scoretimes = g_malloc(NSCORES*sizeof(time_t));
+
+ for(retval = 0; fgets(buf, sizeof(buf), infile) && retval < NSCORES;
+ retval++) {
+ buf[strlen(buf)-1]=0;
+ buf2 = strtok(buf, " ");
+ (*scores)[retval] = atof(buf2);
+ buf2 = strtok(NULL, " ");
+ (*scoretimes)[retval] = atoi(buf2);
+ buf2 = strtok(NULL, "\n");
+ (*names)[retval] = strdup(buf2);
}
fclose(infile);
}
@@ -82,5 +89,6 @@ gnome_score_get_notable(gchar *gamename,
}
g_free(realname);
+
return retval;
}
diff --git a/libgnome/gnome-score.h b/libgnome/gnome-score.h
index 9f271f8..89697ab 100644
--- a/libgnome/gnome-score.h
+++ b/libgnome/gnome-score.h
@@ -4,11 +4,15 @@
#include <time.h>
BEGIN_GNOME_DECLS
-gboolean /* Returns TRUE if it was a notable (top ten) score */
-gnome_score_log(gfloat score);
+gint /* Returns the position in the top-ten starting from 1, or 0 if it isn't
+ in the table */
+gnome_score_log(gfloat score,
+ gchar *level,
+ int ordering);
gint /* Returns number of items in the arrays */
gnome_score_get_notable(gchar *gamename, /* Will be auto-determined if NULL */
+ gchar *level,
gchar ***names,
gfloat **scores,
time_t **scoretimes);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]