Page suivantePage précédenteTable des matières

20. Annexe G debug.cpp

Vous pouvez récupérer tous les programmes en un seul tar.gz sur Telecharger String . Pour obtenir ce fichier, dans un butineur web, sauvez ce fichier en type 'texte'.


//*****************************************************************
// La licence de distribution est la GNU/GPL et vous devez inclure
// le nom et le mel de l'auteur dans toutes les copies
// Auteur : Al Dev    Mel : alavoor@yahoo.com
//*****************************************************************
/****************************************************************
Programme pour déboguer des programmes C++/C
*****************************************************************/
#ifdef DEBUG  // fonctions nécessaires SEULEMENT si DEBUG est défini
#include "debug.h"
//#include "log.h"
// La variable value[] peut être de type char, string, int, unsigned long, float, etc.
void local_dbg(char name[], char value[], char fname[], int lineno, bool logfile) {
 if (value == NULL)
 return;
 if (logfile == true)
 print_log("\nDebug %s : Line: %d %s is = %s\n", fname, lineno, name, value);
 else
 cout << "\nDebug " << fname << ": Line: " << lineno << " " << name << " is = " << value << endl; }
void local_dbg(char name[], string value, char fname[], int lineno, bool logfile) {
 if (logfile == true)
 print_log("\nDebug %s : Line: %d %s is = %s\n", fname, lineno, name, value.c_str());
 else
 cout << "\nDebug " << fname << ": Line: " << lineno << " " << name << " is = " << value.c_str() << endl; }
void local_dbg(char name[], int value, char fname[], int lineno, bool logfile) {
 if (logfile == true)
 print_log("\nDebug %s : Line: %d %s is = %d\n", fname, lineno, name, value);
 else
 cout << "\nDebug " << fname << ": Line: " << lineno << " " << name << " is = " << value << endl; }
void local_dbg(char name[], unsigned int value, char fname[], int lineno, bool logfile) {
 if (logfile == true)
 print_log("\nDebug %s : Line: %d %s is = %u\n", fname, lineno, name, value);
 else
 cout << "\nDebug " << fname << ": Line: " << lineno << " " << name << " is = " << value << endl; }
void local_dbg(char name[], long value, char fname[], int lineno, bool logfile) {
 if (logfile == true)
 print_log("\nDebug %s : Line: %d %s is = %d\n", fname, lineno, name, value);
 else
 cout << "\nDebug " << fname << ": Line: " << lineno << " " << name << " is = " << value << endl; }
void local_dbg(char name[], unsigned long value, char fname[], int lineno, bool logfile) {
 if (logfile == true)
 print_log("\nDebug %s : Line: %d %s is = %u\n", fname, lineno, name, value);
 else
 cout << "\nDebug " << fname << ": Line: " << lineno << " " << name << " is = " << value << endl; }
void local_dbg(char name[], short value, char fname[], int lineno, bool logfile) {
 if (logfile == true)
 print_log("\nDebug %s : Line: %d %s is = %d\n", fname, lineno, name, value);
 else
 cout << "\nDebug " << fname << ": Line: " << lineno << " " << name << " is = " << value << endl; }
void local_dbg(char name[], unsigned short value, char fname[], int lineno, bool logfile) {
 if (logfile == true)
 print_log("\nDebug %s : Line: %d %s is = %u\n", fname, lineno, name, value);
 else
 cout << "\nDebug " << fname << ": Line: " << lineno << " " << name << " is = " << value << endl; }
void local_dbg(char name[], float value, char fname[], int lineno, bool logfile) {
 if (logfile == true)
 print_log("\nDebug %s : Line: %d %s is = %f\n", fname, lineno, name, value);
 else
 cout << "\nDebug " << fname << ": Line: " << lineno << " " << name << " is = " << value << endl; }
void local_dbg(char name[], double value, char fname[], int lineno, bool logfile) {
 if (logfile == true)
 print_log("\nDebug %s : Line: %d %s is = %f\n", fname, lineno, name, value);
 else
 cout << "\nDebug " << fname << ": Line: " << lineno << " " << name << " is = " << value << endl; }
// Vous pouvez en ajouter plus ici - 'value' peut être une classe, une énumération, un champ date/heure, etc.
#endif // DEBUG


Page suivantePage précédenteTable des matières