]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2004-06-01 06:04:25 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Tue, 1 Jun 2004 06:04:25 +0000 (06:04 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Tue, 1 Jun 2004 06:04:25 +0000 (06:04 +0000)
made README.Plugins and plugin_sample up to date.

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@455 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

README.Plugins
plugin_sample.c

index 57e460e9000b75830c3a8ac02602ef0b86559569..88ca467841d8add79a7f894229fad2b1f528ec57 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $Id: README.Plugins,v 1.1 2004/01/06 17:33:45 reinelt Exp $
+# $Id: README.Plugins,v 1.2 2004/06/01 06:04:25 reinelt Exp $
 #
 
 
@@ -7,15 +7,10 @@ This file contains instructions for writing plugins to lcd4linux.
 
 - use the file 'plugin_sample.c' as a template
 - copy the file to 'plugin_yourname.c' and edit
-- replace the "$Id..." in the first line with "$Id: README.Plugins,v 1.1 2004/01/06 17:33:45 reinelt Exp $"
+- replace the "$Id..." in the first line with "$Id\$" (without backslash)
 - add a short description what this plugin is for
 - add your copyright notice (important: your name and email)
-- replace the "$Log..." with "$Log: README.Plugins,v $
-- replace the "$Log..." with "Revision 1.1  2004/01/06 17:33:45  reinelt
-- replace the "$Log..." with "
-- replace the "$Log..." with "Evaluator: functions with variable argument lists
-- replace the "$Log..." with "Evaluator: plugin_sample.c and README.Plugins added
-- replace the "$Log..." with ""
+- replace the "$Log..." with "$Log\$" (without backslash)
 - remove all Log lines until "*/"
 - do some documentation (I know that real programmers write programs, not documentation)
 - use one or more of the example functions as templates for your own functions
index c570a792779f7d4c7462ce520f3707c43c71fca8..773d270806df693083ff305914c35e709fe818b9 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: plugin_sample.c,v 1.5 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: plugin_sample.c,v 1.6 2004/06/01 06:04:25 reinelt Exp $
  *
  * plugin template
  *
  *
  *
  * $Log: plugin_sample.c,v $
+ * Revision 1.6  2004/06/01 06:04:25  reinelt
+ *
+ * made README.Plugins and plugin_sample up to date.
+ *
  * Revision 1.5  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
@@ -86,10 +90,10 @@ static void my_mul2 (RESULT *result, RESULT *arg1)
 
   // Get Parameter
   // R2N stands for 'Result to Number'
-  param=R2N(arg1);
+  param = R2N(arg1);
   
   // calculate value
-  value=param*2.0;
+  value = param*2.0;
   
   // store result
   // when called with R_NUMBER, it assumes the
@@ -106,7 +110,7 @@ static void my_mul2 (RESULT *result, RESULT *arg1)
 static void my_mul3 (RESULT *result, RESULT *arg1)
 {
   // do it all in one line
-  double value=R2N(arg1)*3.0;
+  double value = R2N(arg1) * 3.0;
 
   // store result
   SetResult(&result, R_NUMBER, &value); 
@@ -120,10 +124,10 @@ static void my_mul3 (RESULT *result, RESULT *arg1)
 static void my_diff (RESULT *result, RESULT *arg1, RESULT *arg2)
 {
   // do it all in one line
-  double value=R2N(arg1)-R2N(arg2);
+  double value = R2N(arg1) - R2N(arg2);
   
   // some more calculations...
-  if (value<0) value=-value;
+  if (value < 0) value = -value;
   
   // store result
   SetResult(&result, R_NUMBER, &value); 
@@ -138,7 +142,7 @@ static void my_answer (RESULT *result)
 {
   // we have to declare a variable because
   // SetResult needs a pointer 
-  double value=42;
+  double value = 42;
   
   // store result
   SetResult(&result, R_NUMBER, &value); 
@@ -153,7 +157,7 @@ static void my_length (RESULT *result, RESULT *arg1)
 {
   // Note #1: value *must* be double! 
   // Note #2: R2S stands for 'Result to String'
-  double value=strlen(R2S(arg1));
+  double value = strlen(R2S(arg1));
   
   // store result
   SetResult(&result, R_NUMBER, &value); 
@@ -171,11 +175,11 @@ static void my_upcase (RESULT *result, RESULT *arg1)
   
   // create a local copy of the argument
   // Do *NOT* try to modify the original string!
-  value=strdup(R2S(arg1));
+  value = strdup(R2S(arg1));
   
   // process the string
-  for (p=value; *p!='\0'; p++)
-    *p=toupper(*p);
+  for (p = value; *p != '\0'; p++)
+    *p = toupper(*p);
 
   // store result
   // when called with R_STRING, it assumes the
@@ -199,13 +203,13 @@ static void my_concat (RESULT *result, int argc, RESULT *argv[])
   char *value, *part;
   
   // start with a empty string
-  value=strdup("");
+  value = strdup("");
   
   // process all arguments
-  for (i=0; i<argc; i++) {
-    part=R2S(argv[i]);
-    len=strlen(value)+strlen(part);
-    value=realloc(value, len+1);
+  for (i = 0; i < argc; i++) {
+    part = R2S(argv[i]);
+    len = strlen(value)+strlen(part);
+    value = realloc(value, len+1);
     strcat(value, part);
   }
 
@@ -238,5 +242,6 @@ int plugin_init_sample (void)
 
 void plugin_exit_sample(void) 
 {
-
+  // free any allocated memory
+  // close filedescriptors
 }