From c1c11bb955fc2ab80bb8356aa917ab1bda843ce7 Mon Sep 17 00:00:00 2001 From: reinelt Date: Fri, 19 Dec 2003 05:35:14 +0000 Subject: [lcd4linux @ 2003-12-19 05:35:13 by reinelt] renamed 'client' to 'plugin' git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@279 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- Makefile.am | 2 +- Makefile.in | 16 +++--- MatrixOrbital.c | 29 ++++++----- cfg.c | 13 +++-- client.c | 156 ------------------------------------------------------ client.h | 45 ---------------- lcd4linux.c | 9 ++-- plugin.c | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugin.h | 48 +++++++++++++++++ 9 files changed, 246 insertions(+), 231 deletions(-) delete mode 100644 client.c delete mode 100644 client.h create mode 100644 plugin.c create mode 100644 plugin.h diff --git a/Makefile.am b/Makefile.am index 8743c2b..733f526 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,7 +18,7 @@ pid.c pid.h \ parser.c parser.h \ processor.c processor.h \ evaluator.c evaluator.h \ -client.c client.h \ +plugin.c plugin.h \ system.c system.h \ isdn.c isdn.h \ wifi.c wifi.h \ diff --git a/Makefile.in b/Makefile.in index cd33079..265e687 100644 --- a/Makefile.in +++ b/Makefile.in @@ -101,7 +101,7 @@ AM_CFLAGS = $(X_CFLAGS) -D_GNU_SOURCE -Wall lcd4linux_LDFLAGS = $(X_LIBS) lcd4linux_LDADD = liblcd4linux.la @DRVLIBS@ -lcd4linux_SOURCES = lcd4linux.c pid.c pid.h parser.c parser.h processor.c processor.h evaluator.c evaluator.h client.c client.h system.c system.h isdn.c isdn.h wifi.c wifi.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h widget.c widget.h exec.c exec.h mail2.c socket.c socket.h imon.c imon.h +lcd4linux_SOURCES = lcd4linux.c pid.c pid.h parser.c parser.h processor.c processor.h evaluator.c evaluator.h plugin.c plugin.h system.c system.h isdn.c isdn.h wifi.c wifi.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h widget.c widget.h exec.c exec.h mail2.c socket.c socket.h imon.c imon.h liblcd4linux_la_DEPENDENCIES = @DRIVERS@ @@ -137,7 +137,7 @@ bin_PROGRAMS = lcd4linux$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) lcd4linux_OBJECTS = lcd4linux.$(OBJEXT) pid.$(OBJEXT) parser.$(OBJEXT) \ -processor.$(OBJEXT) evaluator.$(OBJEXT) client.$(OBJEXT) \ +processor.$(OBJEXT) evaluator.$(OBJEXT) plugin.$(OBJEXT) \ system.$(OBJEXT) isdn.$(OBJEXT) wifi.$(OBJEXT) mail.$(OBJEXT) \ seti.$(OBJEXT) battery.$(OBJEXT) dvb.$(OBJEXT) filter.$(OBJEXT) \ widget.$(OBJEXT) exec.$(OBJEXT) mail2.$(OBJEXT) socket.$(OBJEXT) \ @@ -162,13 +162,13 @@ DEP_FILES = .deps/BeckmannEgle.P .deps/Crystalfontz.P .deps/Cwlinux.P \ .deps/HD44780.P .deps/M50530.P .deps/MatrixOrbital.P \ .deps/MilfordInstruments.P .deps/PalmPilot.P .deps/Raster.P .deps/SIN.P \ .deps/Skeleton.P .deps/T6963.P .deps/Text.P .deps/USBLCD.P \ -.deps/XWindow.P .deps/bar.P .deps/battery.P .deps/cfg.P .deps/client.P \ -.deps/debug.P .deps/display.P .deps/dvb.P .deps/evaluator.P \ -.deps/exec.P .deps/filter.P .deps/fontmap.P .deps/icon.P .deps/imon.P \ -.deps/isdn.P .deps/lcd4linux.P .deps/lock.P .deps/mail.P .deps/mail2.P \ +.deps/XWindow.P .deps/bar.P .deps/battery.P .deps/cfg.P .deps/debug.P \ +.deps/display.P .deps/dvb.P .deps/evaluator.P .deps/exec.P \ +.deps/filter.P .deps/fontmap.P .deps/icon.P .deps/imon.P .deps/isdn.P \ +.deps/lcd4linux.P .deps/lock.P .deps/mail.P .deps/mail2.P \ .deps/parport.P .deps/parser.P .deps/pid.P .deps/pixmap.P \ -.deps/processor.P .deps/seti.P .deps/socket.P .deps/system.P \ -.deps/udelay.P .deps/widget.P .deps/wifi.P +.deps/plugin.P .deps/processor.P .deps/seti.P .deps/socket.P \ +.deps/system.P .deps/udelay.P .deps/widget.P .deps/wifi.P SOURCES = $(liblcd4linux_la_SOURCES) $(lcd4linux_SOURCES) $(EXTRA_lcd4linux_SOURCES) OBJECTS = $(liblcd4linux_la_OBJECTS) $(lcd4linux_OBJECTS) diff --git a/MatrixOrbital.c b/MatrixOrbital.c index d2524c1..78e6c8c 100644 --- a/MatrixOrbital.c +++ b/MatrixOrbital.c @@ -1,4 +1,4 @@ -/* $Id: MatrixOrbital.c,v 1.48 2003/11/16 09:45:49 reinelt Exp $ +/* $Id: MatrixOrbital.c,v 1.49 2003/12/19 05:35:14 reinelt Exp $ * * driver for Matrix Orbital serial display modules * @@ -22,6 +22,9 @@ * * * $Log: MatrixOrbital.c,v $ + * Revision 1.49 2003/12/19 05:35:14 reinelt + * renamed 'client' to 'plugin' + * * Revision 1.48 2003/11/16 09:45:49 reinelt * Crystalfontz changes, small glitch in getopt() fixed * @@ -227,7 +230,7 @@ #include "debug.h" #include "cfg.h" -#include "client.h" +#include "plugin.h" #include "lock.h" #include "display.h" #include "bar.h" @@ -429,7 +432,7 @@ int MO_clear2 (int full) } -static void client_contrast (RESULT *result, RESULT *arg1) +static void plugin_contrast (RESULT *result, RESULT *arg1) { char buffer[4]; double contrast; @@ -444,7 +447,7 @@ static void client_contrast (RESULT *result, RESULT *arg1) } -static void client_backlight (RESULT *result, RESULT *arg1) +static void plugin_backlight (RESULT *result, RESULT *arg1) { char buffer[4]; double backlight; @@ -465,7 +468,7 @@ static void client_backlight (RESULT *result, RESULT *arg1) } -static void client_gpo (RESULT *result, RESULT *arg1, RESULT *arg2) +static void plugin_gpo (RESULT *result, RESULT *arg1, RESULT *arg2) { int num; double val; @@ -514,7 +517,7 @@ static void client_gpo (RESULT *result, RESULT *arg1, RESULT *arg2) } -static void client_pwm (RESULT *result, RESULT *arg1, RESULT *arg2) +static void plugin_pwm (RESULT *result, RESULT *arg1, RESULT *arg2) { int num; double val; @@ -536,7 +539,7 @@ static void client_pwm (RESULT *result, RESULT *arg1, RESULT *arg2) } -static void client_rpm (RESULT *result, RESULT *arg1) +static void plugin_rpm (RESULT *result, RESULT *arg1) { int num; double val; @@ -659,12 +662,12 @@ static int MO_init (LCD *Self, int protocol) MO_write ("\376D", 2); // line wrapping off MO_write ("\376R", 2); // auto scroll off - // register as a client - AddFunction ("contrast", 1, client_contrast); - AddFunction ("backlight", 1, client_backlight); - AddFunction ("gpo", 2, client_gpo); - AddFunction ("pwm", 2, client_pwm); - AddFunction ("rpm", 1, client_rpm); + // register as a plugin + AddFunction ("contrast", 1, plugin_contrast); + AddFunction ("backlight", 1, plugin_backlight); + AddFunction ("gpo", 2, plugin_gpo); + AddFunction ("pwm", 2, plugin_pwm); + AddFunction ("rpm", 1, plugin_rpm); return 0; } diff --git a/cfg.c b/cfg.c index ad7c52a..1fc5830 100644 --- a/cfg.c +++ b/cfg.c @@ -1,4 +1,4 @@ -/* $Id: cfg.c,v 1.18 2003/10/11 06:01:52 reinelt Exp $^ +/* $Id: cfg.c,v 1.19 2003/12/19 05:35:14 reinelt Exp $^ * * config file stuff * @@ -22,6 +22,9 @@ * * * $Log: cfg.c,v $ + * Revision 1.19 2003/12/19 05:35:14 reinelt + * renamed 'client' to 'plugin' + * * Revision 1.18 2003/10/11 06:01:52 reinelt * * renamed expression.{c,h} to client.{c,h} @@ -142,7 +145,7 @@ #include "debug.h" #include "cfg.h" -#include "client.h" +#include "plugin.h" typedef struct { char *key; @@ -315,7 +318,7 @@ static int check_cfg_source(char *file) } -static void cfg_client (RESULT *result, RESULT *arg1) +static void cfg_plugin (RESULT *result, RESULT *arg1) { char *value=cfg_get(R2S(arg1), ""); SetResult(&result, R_STRING, value); @@ -365,8 +368,8 @@ int l4l_cfg_init (char *file) } fclose (stream); - // register as a client - AddFunction ("cfg", 1, cfg_client); + // register as a plugin + AddFunction ("cfg", 1, cfg_plugin); return 0; } diff --git a/client.c b/client.c deleted file mode 100644 index bdfcbcb..0000000 --- a/client.c +++ /dev/null @@ -1,156 +0,0 @@ -/* $Id: client.c,v 1.1 2003/10/11 06:01:52 reinelt Exp $ - * - * client function handling - * - * Copyright 2003 Michael Reinelt - * - * This file is part of LCD4Linux. - * - * LCD4Linux is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * LCD4Linux is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * $Log: client.c,v $ - * Revision 1.1 2003/10/11 06:01:52 reinelt - * - * renamed expression.{c,h} to client.{c,h} - * added config file client - * new functions 'AddNumericVariable()' and 'AddStringVariable()' - * new parameter '-i' for interactive mode - * - * Revision 1.3 2003/10/06 05:51:15 reinelt - * functions: min(), max() - * - * Revision 1.2 2003/10/06 05:47:27 reinelt - * operators: ==, \!=, <=, >= - * - * Revision 1.1 2003/10/06 04:34:06 reinelt - * expression evaluator added - * - */ - -/* - * exported functions: - * - * int Client_init (void) - * initializes the expression evaluator - * adds some handy constants and functions - * - */ - - -#include -#include -#include -#include - -#include "debug.h" -#include "client.h" - - - -static void my_sqrt (RESULT *result, RESULT *arg1) -{ - double value=sqrt(R2N(arg1)); - SetResult(&result, R_NUMBER, &value); -} - -static void my_exp (RESULT *result, RESULT *arg1) -{ - double value=exp(R2N(arg1)); - SetResult(&result, R_NUMBER, &value); -} - -static void my_ln (RESULT *result, RESULT *arg1) -{ - double value=log(R2N(arg1)); - SetResult(&result, R_NUMBER, &value); -} - -static void my_log (RESULT *result, RESULT *arg1) -{ - double value=log10(R2N(arg1)); - SetResult(&result, R_NUMBER, &value); -} - -static void my_sin (RESULT *result, RESULT *arg1) -{ - double value=sin(R2N(arg1)); - SetResult(&result, R_NUMBER, &value); -} - -static void my_cos (RESULT *result, RESULT *arg1) -{ - double value=cos(R2N(arg1)); - SetResult(&result, R_NUMBER, &value); -} - -static void my_tan (RESULT *result, RESULT *arg1) -{ - double value=tan(R2N(arg1)); - SetResult(&result, R_NUMBER, &value); -} - - -static void my_min (RESULT *result, RESULT *arg1, RESULT *arg2) -{ - double a1=R2N(arg1); - double a2=R2N(arg2); - double value=a1a2?a1:a2; - SetResult(&result, R_NUMBER, &value); -} - - -static void my_strlen (RESULT *result, RESULT *arg1) -{ - double value=strlen(R2S(arg1)); - SetResult(&result, R_NUMBER, &value); -} - - -int client_init (void) -{ - // set some handy constants - AddNumericVariable ("Pi", M_PI); - AddNumericVariable ("e", M_E); - - // register some basic math functions - AddFunction ("sqrt", 1, my_sqrt); - AddFunction ("exp", 1, my_exp); - AddFunction ("ln", 1, my_ln); - AddFunction ("log", 1, my_log); - AddFunction ("sin", 1, my_sin); - AddFunction ("cos", 1, my_cos); - AddFunction ("tan", 1, my_tan); - - // min, max - AddFunction ("min", 2, my_min); - AddFunction ("max", 2, my_max); - - // register some basic string functions - AddFunction ("strlen", 1, my_strlen); - - - return 0; -} - - diff --git a/client.h b/client.h deleted file mode 100644 index 6956227..0000000 --- a/client.h +++ /dev/null @@ -1,45 +0,0 @@ -/* $Id: client.h,v 1.1 2003/10/11 06:01:52 reinelt Exp $ - * - * client function handling - * - * Copyright 2003 Michael Reinelt - * - * This file is part of LCD4Linux. - * - * LCD4Linux is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * LCD4Linux is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * $Log: client.h,v $ - * Revision 1.1 2003/10/11 06:01:52 reinelt - * - * renamed expression.{c,h} to client.{c,h} - * added config file client - * new functions 'AddNumericVariable()' and 'AddStringVariable()' - * new parameter '-i' for interactive mode - * - * Revision 1.1 2003/10/06 04:34:06 reinelt - * expression evaluator added - * - */ - - -#include "evaluator.h" - -#ifndef _CLIENT_H_ -#define _CLIENT_H_ - -int client_init (void); - -#endif diff --git a/lcd4linux.c b/lcd4linux.c index a0dde0c..ddddca0 100644 --- a/lcd4linux.c +++ b/lcd4linux.c @@ -1,4 +1,4 @@ -/* $Id: lcd4linux.c,v 1.52 2003/12/01 07:08:50 reinelt Exp $ +/* $Id: lcd4linux.c,v 1.53 2003/12/19 05:35:14 reinelt Exp $ * * LCD4Linux * @@ -22,6 +22,9 @@ * * * $Log: lcd4linux.c,v $ + * Revision 1.53 2003/12/19 05:35:14 reinelt + * renamed 'client' to 'plugin' + * * Revision 1.52 2003/12/01 07:08:50 reinelt * * Patches from Xavier: @@ -267,7 +270,7 @@ #include "udelay.h" #include "display.h" #include "processor.h" -#include "client.h" +#include "plugin.h" #define PIDFILE "/var/run/lcd4linux.pid" @@ -435,7 +438,7 @@ int main (int argc, char *argv[]) info ("invoked without full path; restart may not work!"); } - if (client_init()==-1) + if (plugin_init()==-1) exit (1); if (cfg_init(cfg)==-1) diff --git a/plugin.c b/plugin.c new file mode 100644 index 0000000..d34d1cb --- /dev/null +++ b/plugin.c @@ -0,0 +1,159 @@ +/* $Id: plugin.c,v 1.1 2003/12/19 05:35:14 reinelt Exp $ + * + * plugin handler for the Evaluator + * + * Copyright 2003 Michael Reinelt + * + * This file is part of LCD4Linux. + * + * LCD4Linux is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * LCD4Linux is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * $Log: plugin.c,v $ + * Revision 1.1 2003/12/19 05:35:14 reinelt + * renamed 'client' to 'plugin' + * + * Revision 1.1 2003/10/11 06:01:52 reinelt + * + * renamed expression.{c,h} to client.{c,h} + * added config file client + * new functions 'AddNumericVariable()' and 'AddStringVariable()' + * new parameter '-i' for interactive mode + * + * Revision 1.3 2003/10/06 05:51:15 reinelt + * functions: min(), max() + * + * Revision 1.2 2003/10/06 05:47:27 reinelt + * operators: ==, \!=, <=, >= + * + * Revision 1.1 2003/10/06 04:34:06 reinelt + * expression evaluator added + * + */ + +/* + * exported functions: + * + * int plugin_init (void) + * initializes the expression evaluator + * adds some handy constants and functions + * + */ + + +#include +#include +#include +#include + +#include "debug.h" +#include "plugin.h" + + + +static void my_sqrt (RESULT *result, RESULT *arg1) +{ + double value=sqrt(R2N(arg1)); + SetResult(&result, R_NUMBER, &value); +} + +static void my_exp (RESULT *result, RESULT *arg1) +{ + double value=exp(R2N(arg1)); + SetResult(&result, R_NUMBER, &value); +} + +static void my_ln (RESULT *result, RESULT *arg1) +{ + double value=log(R2N(arg1)); + SetResult(&result, R_NUMBER, &value); +} + +static void my_log (RESULT *result, RESULT *arg1) +{ + double value=log10(R2N(arg1)); + SetResult(&result, R_NUMBER, &value); +} + +static void my_sin (RESULT *result, RESULT *arg1) +{ + double value=sin(R2N(arg1)); + SetResult(&result, R_NUMBER, &value); +} + +static void my_cos (RESULT *result, RESULT *arg1) +{ + double value=cos(R2N(arg1)); + SetResult(&result, R_NUMBER, &value); +} + +static void my_tan (RESULT *result, RESULT *arg1) +{ + double value=tan(R2N(arg1)); + SetResult(&result, R_NUMBER, &value); +} + + +static void my_min (RESULT *result, RESULT *arg1, RESULT *arg2) +{ + double a1=R2N(arg1); + double a2=R2N(arg2); + double value=a1a2?a1:a2; + SetResult(&result, R_NUMBER, &value); +} + + +static void my_strlen (RESULT *result, RESULT *arg1) +{ + double value=strlen(R2S(arg1)); + SetResult(&result, R_NUMBER, &value); +} + + +int plugin_init (void) +{ + // set some handy constants + AddNumericVariable ("Pi", M_PI); + AddNumericVariable ("e", M_E); + + // register some basic math functions + AddFunction ("sqrt", 1, my_sqrt); + AddFunction ("exp", 1, my_exp); + AddFunction ("ln", 1, my_ln); + AddFunction ("log", 1, my_log); + AddFunction ("sin", 1, my_sin); + AddFunction ("cos", 1, my_cos); + AddFunction ("tan", 1, my_tan); + + // min, max + AddFunction ("min", 2, my_min); + AddFunction ("max", 2, my_max); + + // register some basic string functions + AddFunction ("strlen", 1, my_strlen); + + + return 0; +} + + diff --git a/plugin.h b/plugin.h new file mode 100644 index 0000000..d860c31 --- /dev/null +++ b/plugin.h @@ -0,0 +1,48 @@ +/* $Id: plugin.h,v 1.1 2003/12/19 05:35:14 reinelt Exp $ + * + * plugin handler for the Evaluator + * + * Copyright 2003 Michael Reinelt + * + * This file is part of LCD4Linux. + * + * LCD4Linux is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * LCD4Linux is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * $Log: plugin.h,v $ + * Revision 1.1 2003/12/19 05:35:14 reinelt + * renamed 'client' to 'plugin' + * + * Revision 1.1 2003/10/11 06:01:52 reinelt + * + * renamed expression.{c,h} to client.{c,h} + * added config file client + * new functions 'AddNumericVariable()' and 'AddStringVariable()' + * new parameter '-i' for interactive mode + * + * Revision 1.1 2003/10/06 04:34:06 reinelt + * expression evaluator added + * + */ + + +#include "evaluator.h" + +#ifndef _PLUGIN_H_ +#define _PLUGIN_H_ + +int plugin_init (void); + +#endif -- cgit v1.2.3