- -( dyne // software :: culture :: events :: planet :: discussion :: museum \\ freaknet )- -
 
Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members

jutils.h

Go to the documentation of this file.
00001 /* MuSE - Multiple Streaming Engine
00002  * Copyright (C) 2000-2002 Denis Roio aka jaromil <jaromil@dyne.org>
00003  *
00004  * This source code is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Public License as published 
00006  * by the Free Software Foundation; either version 2 of the License,
00007  * or (at your option) any later version.
00008  *
00009  * This source code is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00012  * Please refer to the GNU Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Public License along with
00015  * this source code; if not, write to:
00016  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  */
00018 
00019 #ifndef __UTILS_H__
00020 #define __UTILS_H__
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 #include <stdio.h>
00027 #include <string.h>
00028 #include <libintl.h>
00029 
00034 #define MAX_DEBUG 2
00035 
00036 #define FUNC 2 /* se il debug level e' questo
00037                   ci sono le funzioni chiamate */
00038 #define WARN 1 /* ... blkbblbl */
00039 
00040 // for native language support
00041 #define _(x)    x
00042 //gettext(x)
00043 
00044 
00048 #define CHAR_SET(func,var) \
00049 char var[MAX_VALUE_SIZE]; \
00050 void func(char *in) { \
00051 if(strncmp(var,in,MAX_VALUE_SIZE)==0) return; \
00052 else strncpy(var,in,MAX_VALUE_SIZE); \
00053 } \
00054 char *func() { return var; };
00055 
00056 #define INT_SET(func,var) \
00057 int var; \
00058 void func(int in) { \
00059 if(var==in) return; \
00060 else var=in; \
00061 } \
00062 int func() { return var; };
00063 
00064 #define FLOAT_SET(func,var) \
00065 float var; \
00066 void func(float in) { \
00067 if(var==in) return; \
00068 else var=in; \
00069 } \
00070 float func() { return var; };
00071 
00072 #ifdef __cplusplus
00073   class GUI;
00074 
00075   void set_guimsg(GUI *g);
00076 #endif
00077   void MuseSetDebug(int lev);
00078   int MuseGetDebug();
00079   void MuseSetLog(char *file);
00080   void MuseCloseLog();
00081   void notice(const char *format, ...);
00082   void func(const char *format, ...);
00083   void error(const char *format, ...);
00084   void act(const char *format, ...);
00085   void warning(const char *format, ...);
00086   double dtime();
00087   void jsleep(int sec, long nsec);
00088   int set_rtpriority(int max);
00089   void chomp(char *str);
00090   int resolve(char *host, char *ip);
00091 
00092 #ifdef __cplusplus
00093 }
00094 #endif
00095 
00096 #endif