diff options
author | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-12-05 13:23:07 +0000 |
---|---|---|
committer | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-12-05 13:23:07 +0000 |
commit | 288490094a7fe9167747dc78d416940759a31197 (patch) | |
tree | 53dc4f5c2375f4b688b53ca8841630ddec5e1f88 /src/plugins/gui.c | |
parent | 8ec1c47aed09c90343949d57c92760ba84738a46 (diff) | |
download | hercules-288490094a7fe9167747dc78d416940759a31197.tar.gz hercules-288490094a7fe9167747dc78d416940759a31197.tar.bz2 hercules-288490094a7fe9167747dc78d416940759a31197.tar.xz hercules-288490094a7fe9167747dc78d416940759a31197.zip |
- Massive EOL normalization & 'svn:eol-style native' flag setting for all txt/conf/h/c files.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9410 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/plugins/gui.c')
-rw-r--r-- | src/plugins/gui.c | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/src/plugins/gui.c b/src/plugins/gui.c index 6c9a8d85c..e8c097d21 100644 --- a/src/plugins/gui.c +++ b/src/plugins/gui.c @@ -1,101 +1,101 @@ -
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "../common/plugin.h"
-//Needed for strcmpi
-#include "../common/mmo.h"
-
-// "I'm Alive" and "Flush stdout" Originally by Mugendai
-// Ported to plugin by Celest
-
-PLUGIN_INFO = {
- "AthenaGUI",
- PLUGIN_CORE,
- "1.0",
- PLUGIN_VERSION,
- "Core plugin for Athena GUI functions"
-};
-
-PLUGIN_EVENTS_TABLE = {
- { "gui_init", "Plugin_Init" },
- { NULL, NULL }
-};
-
-unsigned int (*gettick)();
-int (*add_timer_func_list)(int (*)(int,unsigned int,int,int),char*);
-int (*add_timer_interval)(unsigned int,int (*)(int,unsigned int,int,int),int,int,int);
-
-//-----------------------------------------------------
-//I'm Alive Alert
-//Used to output 'I'm Alive' every few seconds
-//Intended to let frontends know if the app froze
-//-----------------------------------------------------
-int imalive_timer(int tid, unsigned int tick, int id, int data){
- printf("I'm Alive\n");
- return 0;
-}
-
-//-----------------------------------------------------
-//Flush stdout
-//stdout buffer needs flushed to be seen in GUI
-//-----------------------------------------------------
-int flush_timer(int tid, unsigned int tick, int id, int data){
- fflush(stdout);
- return 0;
-}
-
-void gui_init ()
-{
- char line[1024], w1[1024], w2[1024];
- int flush_on = 0;
- int flush_time = 100;
- int imalive_on = 0;
- int imalive_time = 30;
- char **argv;
- int *argc;
- FILE *fp;
- int i;
-
- IMPORT_SYMBOL(argc, 2);
- IMPORT_SYMBOL(argv, 3);
- IMPORT_SYMBOL(gettick, 5);
- IMPORT_SYMBOL(add_timer_interval, 8);
- IMPORT_SYMBOL(add_timer_func_list, 9);
-
- do {
- fp = fopen("plugins/gui.conf","r");
- if (fp == NULL)
- break;
-
- while(fgets(line, sizeof(line) -1, fp)) {
- if (line[0] == '/' && line[1] == '/')
- continue;
- if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2) {
- if(strcmpi(w1,"imalive_on")==0){
- imalive_on = atoi(w2);
- } else if(strcmpi(w1,"imalive_time")==0){
- imalive_time = atoi(w2);
- } else if(strcmpi(w1,"flush_on")==0){
- flush_on = atoi(w2);
- } else if(strcmpi(w1,"flush_time")==0){
- flush_time = atoi(w2);
- }
- }
- }
- fclose(fp);
- } while (0);
-
- for (i = 1; i < *argc ; i++)
- if (strcmp(argv[i], "--gui") == 0)
- flush_on = imalive_on = 1;
-
- if (flush_on) {
- add_timer_func_list(flush_timer, "flush_timer");
- add_timer_interval(gettick()+1000,flush_timer,0,0,flush_time);
- }
- if (imalive_on) {
- add_timer_func_list(imalive_timer, "imalive_timer");
- add_timer_interval(gettick()+10, imalive_timer,0,0,imalive_time*1000);
- }
-}
+ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "../common/plugin.h" +//Needed for strcmpi +#include "../common/mmo.h" + +// "I'm Alive" and "Flush stdout" Originally by Mugendai +// Ported to plugin by Celest + +PLUGIN_INFO = { + "AthenaGUI", + PLUGIN_CORE, + "1.0", + PLUGIN_VERSION, + "Core plugin for Athena GUI functions" +}; + +PLUGIN_EVENTS_TABLE = { + { "gui_init", "Plugin_Init" }, + { NULL, NULL } +}; + +unsigned int (*gettick)(); +int (*add_timer_func_list)(int (*)(int,unsigned int,int,int),char*); +int (*add_timer_interval)(unsigned int,int (*)(int,unsigned int,int,int),int,int,int); + +//----------------------------------------------------- +//I'm Alive Alert +//Used to output 'I'm Alive' every few seconds +//Intended to let frontends know if the app froze +//----------------------------------------------------- +int imalive_timer(int tid, unsigned int tick, int id, int data){ + printf("I'm Alive\n"); + return 0; +} + +//----------------------------------------------------- +//Flush stdout +//stdout buffer needs flushed to be seen in GUI +//----------------------------------------------------- +int flush_timer(int tid, unsigned int tick, int id, int data){ + fflush(stdout); + return 0; +} + +void gui_init () +{ + char line[1024], w1[1024], w2[1024]; + int flush_on = 0; + int flush_time = 100; + int imalive_on = 0; + int imalive_time = 30; + char **argv; + int *argc; + FILE *fp; + int i; + + IMPORT_SYMBOL(argc, 2); + IMPORT_SYMBOL(argv, 3); + IMPORT_SYMBOL(gettick, 5); + IMPORT_SYMBOL(add_timer_interval, 8); + IMPORT_SYMBOL(add_timer_func_list, 9); + + do { + fp = fopen("plugins/gui.conf","r"); + if (fp == NULL) + break; + + while(fgets(line, sizeof(line) -1, fp)) { + if (line[0] == '/' && line[1] == '/') + continue; + if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2) { + if(strcmpi(w1,"imalive_on")==0){ + imalive_on = atoi(w2); + } else if(strcmpi(w1,"imalive_time")==0){ + imalive_time = atoi(w2); + } else if(strcmpi(w1,"flush_on")==0){ + flush_on = atoi(w2); + } else if(strcmpi(w1,"flush_time")==0){ + flush_time = atoi(w2); + } + } + } + fclose(fp); + } while (0); + + for (i = 1; i < *argc ; i++) + if (strcmp(argv[i], "--gui") == 0) + flush_on = imalive_on = 1; + + if (flush_on) { + add_timer_func_list(flush_timer, "flush_timer"); + add_timer_interval(gettick()+1000,flush_timer,0,0,flush_time); + } + if (imalive_on) { + add_timer_func_list(imalive_timer, "imalive_timer"); + add_timer_interval(gettick()+10, imalive_timer,0,0,imalive_time*1000); + } +} |