Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

kerprint.c

Go to the documentation of this file.
00001 /************************************************************************* 00002 * $Id: kerprint.c,v 1.1 2005/09/09 08:22:51 bellet Exp $ 00003 ************************************************************************** 00004 This software is governed by the CeCILL license under French law and 00005 abiding by the rules of distribution of free software. You can use, 00006 modify and/ or redistribute the software under the terms of the CeCILL 00007 license as circulated by CEA, CNRS and INRIA at the following URL 00008 "http://www.cecill.info". 00009 00010 As a counterpart to the access to the source code and rights to copy, 00011 modify and redistribute granted by the license, users are provided only 00012 with a limited warranty and the software's author, the holder of the 00013 economic rights, and the successive licensors have only limited 00014 liability. 00015 00016 In this respect, the user's attention is drawn to the risks associated 00017 with loading, using, modifying and/or developing or reproducing the 00018 software by the user in light of its specific status of free software, 00019 that may mean that it is complicated to manipulate, and that also 00020 therefore means that it is reserved for developers and experienced 00021 professionals having in-depth computer knowledge. Users are therefore 00022 encouraged to load and test the software's suitability as regards their 00023 requirements in conditions enabling the security of their systems and/or 00024 data to be ensured and, more generally, to use and operate it in the 00025 same conditions as regards security. 00026 00027 The fact that you are presently reading this means that you have had 00028 knowledge of the CeCILL license and that you accept its terms. 00029 00030 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 00031 l'Image). All rights reserved. See License.txt for details. 00032 00033 Version 1.0 05/09/2005 00034 *************************************************************************/ 00035 00036 #include <stdarg.h> 00037 #include <stdio.h> 00038 #include <string.h> // For strlen 00039 #include "idprint.h" 00040 00041 /* FUNCTION DESCRIPTION ************************************************** 00042 * 00043 * IdPrintf (fonction) 00044 * 00045 * RESUME: affiche un message 00046 * 00047 * DESCRIPTION: Fonction printf de LIBIDO, permettant, en fonction de 00048 * l'environnement de l'utilisateur d'orienter le flux de sortie 00049 * sur le fichier adapte. 00050 * 00051 * 00052 * SYNTAXE: int nbArgImprimes = IdPrintf ( char *formatImpression, ... ); 00053 * 00054 * RETOUR: type : int 00055 * role : Nombre d'arguments reellement imprimes 00056 * 00057 * PARAMETRES: 00058 * nom : formatImpression 00059 * type : char * 00060 * role : chaine de format (comme pour printf) 00061 * 00062 * EXEMPLE: IdPrintf("\nexemple: %d, %c, %s->fin", 1,'a',"fin exemple"); 00063 * 00064 ******************************************************** END DESCRIPTION */ 00065 00066 00067 #ifdef _IWWIN95_ 00068 #define _CONSOLE_ 0 00069 #define _UNIX_ 0 00070 #else 00071 #define _CONSOLE_ 1 00072 #define _UNIX_ 0 00073 #endif 00074 00075 00076 #if defined(_UNIX_) || defined(_CONSOLE_) 00077 00078 #define IdStdOut stdout 00079 #define IdStdErr stderr 00080 00081 int 00082 IdPrintf (char *format, ...) 00083 { 00084 int nb; 00085 va_list ap; 00086 00087 va_start(ap,format); 00088 nb = vfprintf ( IdStdOut, format, ap ); 00089 00090 va_end(ap); 00091 return nb; 00092 } 00093 00094 /* FUNCTION DESCRIPTION ************************************************** 00095 00096 IdErrPrintf (fonction) 00097 00098 RESUME: affiche un message d'erreur 00099 00100 DESCRIPTION: Fonction printf de LIBIDO, permettant, en fonction de 00101 l'environnement de l'utilisateur, et d'orienter le flux d'erreur 00102 sur le fichier adapte. 00103 00104 00105 SYNTAXE: int nbArgImprimes = IdErrPrintf (char * format, ... ); 00106 00107 RETOUR: type : int 00108 role : Nombre d'arguments reellement imprimes 00109 00110 PARAMETRES: 00111 nom : format 00112 type : char * 00113 role : chaine de format (comme pour printf) 00114 00115 EXEMPLE: IdErrPrintf ( "\nerr en ligne", __LINE__ ); 00116 00117 ******************************************************** END DESCRIPTION */ 00118 00119 00120 int 00121 IdErrPrintf (char *format, ...) 00122 { 00123 int nb; 00124 va_list ap; 00125 00126 va_start(ap,format); 00127 printf ("\n ERREUR LIBIDO :"); 00128 nb = vfprintf (IdStdErr,format,ap); 00129 va_end(ap); 00130 return nb; 00131 } 00132 00133 #else 00134 00135 /* sur PC, ca se gate : */ 00136 /* en IWWIN95 on fabrique une fonction */ 00137 00138 #ifdef _IWWIN95_ 00139 00140 #include <windows.h> 00141 00142 static long int __tt__; 00143 static char msgbuf[10000]; 00144 00145 int IdPrintf (char * format, ... ) 00146 { 00147 va_list ap; 00148 00149 va_start(ap,format); /* C'est APRES cet element que va_arg */ 00150 /* va commencer a depiler les parametres */ 00151 (void) vsprintf(msgbuf,format,ap); 00152 WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), msgbuf, strlen(msgbuf), 00153 &__tt__, NULL); 00154 va_end(ap); 00155 return 1; 00156 } 00157 00158 00159 int IdErrPrintf (char * format, ... ) 00160 { 00161 va_list ap; 00162 00163 va_start(ap,format); /* C'est APRES cet element que va_arg */ 00164 /* va commencer a depiler les parametres */ 00165 (void) vsprintf(msgbuf,format,ap); 00166 WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), msgbuf, strlen(msgbuf), 00167 &__tt__, NULL); 00168 va_end(ap); 00169 return 1; 00170 } 00171 00172 #endif 00173 #endif

Generated on Wed Oct 19 09:28:34 2005 for SIMRI3D by doxygen 1.3.7