E CVS: proto/eina turran

2008-08-08 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : turran
Project : e17
Module  : proto/eina

Dir : e17/proto/eina/src/include


Modified Files:
eina_error.h 


Log Message:
Allow user provided functions for printing messages
Make the stdout print mgs function exportable
Add a FILE * print msg function (useful for logging)

===
RCS file: /cvs/e/e17/proto/eina/src/include/eina_error.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- eina_error.h7 Aug 2008 13:09:09 -   1.6
+++ eina_error.h8 Aug 2008 10:39:47 -   1.7
@@ -19,6 +19,8 @@
 #ifndef EINA_ERROR_H_
 #define EINA_ERROR_H_
 
+#include 
+
 #include "eina_types.h"
 
 #define EINA_ERROR_PERR(fmt, ...) \
@@ -43,6 +45,9 @@
 } Eina_Error_Level;
 
 typedef int Eina_Error;
+typedef void (*Eina_Error_Print_Cb)(Eina_Error_Level level, const char *file,
+const char *fnc, int line, const char *fmt, void *data,
+   va_list args);
 
 EAPI extern int EINA_ERROR_OUT_OF_MEMORY;
 
@@ -54,6 +59,13 @@
 EAPI const char * eina_error_msg_get(Eina_Error error);
 EAPI void eina_error_print(Eina_Error_Level level, const char *file,
const char *function, int line, const char *fmt, ...);
+EAPI void eina_error_print_cb_stdout(Eina_Error_Level level, const char *file,
+const char *fnc, int line, const char *fmt, void *data,
+   va_list args);
+EAPI void eina_error_print_cb_file(Eina_Error_Level level, const char *file,
+const char *fnc, int line, const char *fmt, void *data,
+va_list args);
+EAPI void eina_error_print_cb_set(Eina_Error_Print_Cb cb, void *data);
 EAPI void eina_error_log_level_set(Eina_Error_Level level);
 
 #endif /*EINA_ERROR_H_*/



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: proto/eina turran

2008-08-08 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : turran
Project : e17
Module  : proto/eina

Dir : e17/proto/eina/src/lib


Modified Files:
eina_error.c 


Log Message:
Allow user provided functions for printing messages
Make the stdout print mgs function exportable
Add a FILE * print msg function (useful for logging)

===
RCS file: /cvs/e/e17/proto/eina/src/lib/eina_error.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- eina_error.c7 Aug 2008 13:09:09 -   1.6
+++ eina_error.c8 Aug 2008 10:39:47 -   1.7
@@ -33,6 +33,8 @@
 static int _init_count = 0;
 static Eina_List *_error_list;
 static Eina_Error _err;
+static Eina_Error_Print_Cb _print_cb = eina_error_print_cb_stdout;
+static void *_print_cb_data = NULL;
 
 #define RED "\033[31;1m"
 #define GREEN   "\033[32;1m"
@@ -55,17 +57,7 @@
[EINA_ERROR_LEVEL_DBG] = GREEN,
 };
 
-static void _error_print(Eina_Error_Level level, const char *file,
-   const char *fnc, int line, const char *fmt, va_list args)
-{
-   if (level <= _error_level)
-   {
-   printf("%s", _colors[level]);
-   printf("[%s:%d] %s() ", file, line, fnc);
-   printf("%s", _colors[EINA_ERROR_LEVEL_INFO]);
-   vprintf(fmt, args);
-   }
-}
+
 /**
  *   API  
* 
  
**/
@@ -141,16 +133,49 @@
return eina_list_nth(_error_list, error - 1);
 }
 /**
- * 
+ *
  */
-EAPI void eina_error_print(Eina_Error_Level level, const char *file, 
+EAPI void eina_error_print(Eina_Error_Level level, const char *file,
const char *fnc, int line, const char *fmt, ...)
 {
va_list args;
 
va_start(args, fmt);
-   _error_print(level, file, fnc, line, fmt, args);
+   if (level <= _error_level)
+   _print_cb(level, file, fnc, line, fmt, _print_cb_data, args);
va_end(args);
+}
+/**
+ *
+ */
+EAPI void eina_error_print_cb_stdout(Eina_Error_Level level, const char *file,
+   const char *fnc, int line, const char *fmt, void *data,
+   va_list args)
+{
+   printf("%s", _colors[level]);
+   printf("[%s:%d] %s() ", file, line, fnc);
+   printf("%s", _colors[EINA_ERROR_LEVEL_INFO]);
+   vprintf(fmt, args);
+}
+/**
+ *
+ */
+EAPI void eina_error_print_cb_file(Eina_Error_Level level, const char *file,
+   const char *fnc, int line, const char *fmt, void *data,
+   va_list args)
+{
+   FILE *f = data;
+
+   fprintf(f, "[%s:%d] %s() ", file, line, fnc);
+   vfprintf(f, fmt, args);
+}
+/**
+ *
+ */
+EAPI void eina_error_print_cb_set(Eina_Error_Print_Cb cb, void *data)
+{
+   _print_cb = cb;
+   _print_cb_data = data;
 }
 /**
  *



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs


E CVS: proto/eina turran

2008-08-06 Thread Enlightenment CVS
Enlightenment CVS committal

Author  : turran
Project : e17
Module  : proto/eina

Dir : e17/proto/eina


Modified Files:
COPYING 
Added Files:
OLD-COPYING.PLAIN 


Log Message:
License changes (BSD -> LGPL)


===
RCS file: /cvs/e/e17/proto/eina/COPYING,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- COPYING 30 Jul 2008 12:46:54 -  1.1
+++ COPYING 6 Aug 2008 18:12:57 -   1.2
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+  Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+   Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less