"Fossies" - the Fresh Open Source Software Archive

Member "klavaro-3.13/src/top10.h" (18 Apr 2021, 2943 Bytes) of package /linux/privat/klavaro-3.13.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "top10.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 3.12_vs_3.13.

    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];
   51 } Statistics;
   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 
   79 void top10_show_stat (Statistics * stats);
   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