klavaro  3.13
About: Klavaro is a touch typing tutor program.
  Fossies Dox: klavaro-3.13.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

top10.h
Go to the documentation of this file.
1 /**************************************************************************/
2 /* Klavaro - a flexible touch typing tutor */
3 /* Copyright (C) 2005-2021 Felipe Emmanuel Ferreira de Castro */
4 /* */
5 /* This file is part of Klavaro, which is a free software: you can */
6 /* redistribute it and/or modify it under the terms of the GNU General */
7 /* Public License as published by the Free Software Foundation, either */
8 /* version 3 of the License, or (at your option) any later version. */
9 /* */
10 /* Klavaro is distributed in the hope that it will be useful, */
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
13 /* GNU General Public License for more details (in the file COPYING). */
14 /* You should have received a copy of the GNU General Public License */
15 /* along with Klavaro. If not, see <https://www.gnu.org/licenses/> */
16 /**************************************************************************/
17 
18 /**************************************************
19  * Contest for fluidness performance
20  */
21 #define DOWNHOST "klavaro.sourceforge.io/top10"
22 #define CGI_SERVER "klavaro.sourceforge.io/cgi-bin/klavaro_rangilo"
23 #define MIN_CHARS_TO_LOG 500
24 
25 #define TIMEOUT 10
26 #define LOW_SPEED_LIMIT 160
27 #define LOW_SPEED_TIME 5
28 
29 /**************************************************
30  * Structures
31  */
32 typedef struct USERS
33 {
34  gchar *id;
35  gchar *name;
36 } User;
37 
38 #define MAX_NAME_LEN 255
39 typedef struct STATISTICS
40 {
41  gchar lang[2]; // Language code
42  gchar genv; // Graphical environment: 'x' = X; 'w' = Windows
43  time_t when; // Epoch of stats logging
44  gint32 nchars; // Number of chars typed in the test
45  gfloat accur;
46  gfloat velo;
47  gfloat fluid;
48  gfloat score; // s = f (accur, velo, fluid)
49  gint32 name_len;
50  gchar name[MAX_NAME_LEN + 1];
52 
53 void top10_init (void);
54 
55 void top10_message (gchar * msg);
56 
57 void top10_init_stats (gboolean locally);
58 
59 void top10_clean_stat (gint i, gboolean locally);
60 
61 void top10_insert_stat (Statistics * stat, gint i, gboolean locally);
62 
63 gboolean top10_compare_insert_stat (Statistics * stat, gboolean locally);
64 
65 void top10_delete_stat (gint i, gboolean locally);
66 
67 gfloat top10_calc_score (Statistics * stat);
68 
69 gboolean top10_validate_stat (Statistics * stat);
70 
71 gchar *top10_get_score_file (gboolean locally, gint lang);
72 
73 gboolean top10_read_stats_from_file (gboolean locally, gchar * file);
74 
75 void top10_read_stats (gboolean locally, gint lang);
76 
77 void top10_write_stats (gboolean locally, gint lang);
78 
80 
81 void top10_show_stats (gboolean locally);
82 
83 gboolean top10_global_update (gpointer data);
84 
85 gboolean top10_global_publish (gpointer data);
86 
guint i
Definition: keyboard.c:55
gchar * stats
Definition: main.c:52
gchar * data
Definition: main.c:53
gfloat velo
Definition: top10.h:46
gfloat score
Definition: top10.h:48
gint32 nchars
Definition: top10.h:44
gfloat fluid
Definition: top10.h:47
time_t when
Definition: top10.h:43
gfloat accur
Definition: top10.h:45
gint32 name_len
Definition: top10.h:49
gchar genv
Definition: top10.h:42
gchar name[255+1]
Definition: top10.h:50
gchar lang[2]
Definition: top10.h:41
Definition: top10.h:33
gchar * name
Definition: top10.h:35
gchar * id
Definition: top10.h:34
gboolean top10_read_stats_from_file(gboolean locally, gchar *file)
Definition: top10.c:435
gchar * top10_get_score_file(gboolean locally, gint lang)
Definition: top10.c:301
void top10_init(void)
Definition: top10.c:51
struct STATISTICS Statistics
void top10_show_stat(Statistics *stats)
Definition: top10.c:675
struct USERS User
void top10_message(gchar *msg)
Definition: top10.c:134
void top10_init_stats(gboolean locally)
Definition: top10.c:173
gboolean top10_global_update(gpointer data)
Definition: top10.c:798
gfloat top10_calc_score(Statistics *stat)
Definition: top10.c:261
void top10_read_stats(gboolean locally, gint lang)
Definition: top10.c:551
gboolean top10_compare_insert_stat(Statistics *stat, gboolean locally)
Definition: top10.c:199
void top10_delete_stat(gint i, gboolean locally)
Definition: top10.c:244
gboolean top10_validate_stat(Statistics *stat)
Definition: top10.c:270
void top10_insert_stat(Statistics *stat, gint i, gboolean locally)
Definition: top10.c:182
void top10_clean_stat(gint i, gboolean locally)
Definition: top10.c:150
gboolean top10_global_publish(gpointer data)
Definition: top10.c:884
void top10_show_stats(gboolean locally)
Definition: top10.c:690
void top10_write_stats(gboolean locally, gint lang)
Definition: top10.c:623
#define MAX_NAME_LEN
Definition: top10.h:38
static Lang_Name_Code * lang
Definition: translation.c:39