Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

l_log.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "qbsp.h"

Include dependency graph for l_log.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  logfile_s

Defines

#define MAX_LOGFILENAMESIZE   1024

Typedefs

typedef logfile_s logfile_t

Functions

void Log_Close (void)
FILELog_FileStruct (void)
void Log_Flush (void)
void Log_Open (char *filename)
void Log_Print (char *fmt,...)
void Log_Shutdown (void)
void Log_UnifyEndOfLine (char *buf)
void Log_Write (char *fmt,...)
void Log_WriteTimeStamped (char *fmt,...)

Variables

logfile_t logfile


Define Documentation

#define MAX_LOGFILENAMESIZE   1024
 

Definition at line 29 of file l_log.c.


Typedef Documentation

typedef struct logfile_s logfile_t
 


Function Documentation

void Log_Close void   ) 
 

Definition at line 73 of file l_log.c.

References botimport, fclose(), logfile_s::filename, logfile_s::fp, logfile, printf(), PRT_ERROR, and PRT_MESSAGE.

00074 {
00075     if (!logfile.fp)
00076     {
00077         printf("no log file to close\n");
00078         return;
00079     } //end if
00080     if (fclose(logfile.fp))
00081     {
00082         printf("can't close log file %s\n", logfile.filename);
00083         return;
00084     } //end if
00085     logfile.fp = NULL;
00086     printf("Closed log %s\n", logfile.filename);
00087 } //end of the function Log_Close

Here is the call graph for this function:

FILE* Log_FileStruct void   ) 
 

Definition at line 201 of file l_log.c.

References logfile_s::fp, and logfile.

00202 {
00203     return logfile.fp;
00204 } //end of the function Log_FileStruct

void Log_Flush void   ) 
 

Definition at line 211 of file l_log.c.

References fflush(), logfile_s::fp, and logfile.

00212 {
00213     if (logfile.fp) fflush(logfile.fp);
00214 } //end of the function Log_Flush

Here is the call graph for this function:

void Log_Open char *  filename  ) 
 

Definition at line 46 of file l_log.c.

References botimport, logfile_s::filename, fopen(), logfile_s::fp, LibVarValue(), logfile, MAX_LOGFILENAMESIZE, printf(), PRT_ERROR, PRT_MESSAGE, strlen(), and strncpy().

Referenced by Export_BotLibSetup(), and main().

00047 {
00048     if (!filename || !strlen(filename))
00049     {
00050         printf("openlog <filename>\n");
00051         return;
00052     } //end if
00053     if (logfile.fp)
00054     {
00055         printf("log file %s is already opened\n", logfile.filename);
00056         return;
00057     } //end if
00058     logfile.fp = fopen(filename, "wb");
00059     if (!logfile.fp)
00060     {
00061         printf("can't open the log file %s\n", filename);
00062         return;
00063     } //end if
00064     strncpy(logfile.filename, filename, MAX_LOGFILENAMESIZE);
00065     printf("Opened log %s\n", logfile.filename);
00066 } //end of the function Log_Create

Here is the call graph for this function:

void Log_Print char *  fmt,
  ...
 

Definition at line 127 of file l_log.c.

References fflush(), logfile_s::fp, fprintf(), Log_UnifyEndOfLine(), logfile, printf(), va_end, va_list, va_start, and vsprintf().

Referenced by AAS_AllocMaxAAS(), AAS_CalcReachAndClusters(), AAS_CheckArea(), AAS_Create(), AAS_CreateAreaSettings(), AAS_CreateCurveBrushes(), AAS_FindBestAreaSplitPlane(), AAS_FixMapBrush(), AAS_FlipAreaFaces(), AAS_FreeMaxAAS(), AAS_HashVec(), AAS_MakeBrushWindings(), AAS_PruneNodes(), AAS_ShowNumReachabilities(), AAS_ShowTotals(), AAS_SplitArea(), AAS_StoreAreaSettings(), AAS_TestSplitPlane(), AAS_WriteAASFile(), AAS_WriteAASLump(), BrushBSP(), BuildTree(), CheckBSPBrush(), ChopBrushes(), Com_Printf(), CountTriangles(), CreateAASFilesForAllBSPFiles(), FillOutside(), FindBrushInTree(), FindPortalSide(), FloodAreas(), FloodAreas_r(), FloodEntities(), FloodPortals_r(), GetAreaPortalBrush(), HL_AllocMaxBSP(), HL_CreateBrushes_r(), HL_CreateBrushesFromBSP(), HL_FixContentsTextures(), HL_FreeMaxBSP(), HL_LoadMapFromBSP(), HL_SplitBrush(), HL_SplitBrushWithFace(), LoadCfgFile(), main(), MakeBrushWindings(), MakeTreePortals(), MakeTreePortals_r(), MarkVisibleSides(), MergeWindings(), PrintMapInfo(), PrintMemorySize(), Q1_AllocMaxBSP(), Q1_CreateBrushes_r(), Q1_CreateBrushesFromBSP(), Q1_FixContentsTextures(), Q1_FreeMaxBSP(), Q1_LoadMapFromBSP(), Q1_SplitBrush(), Q1_SplitBrushWithFace(), Q2_AllocMaxBSP(), Q2_BrushContents(), Q2_BSPBrushToMapBrush(), Q2_FreeMaxBSP(), Q2_LoadMapFile(), Q2_LoadMapFromBSP(), Q2_ParseBrush(), Q3_BrushContents(), Q3_BSPBrushToMapBrush(), Q3_CreatePlanarSurfacePlanes(), Q3_FindVisibleBrushSides(), Q3_LoadMapFromBSP(), Q3_PrintBSPFileSizes(), Q3_SurfacePlane(), RunThreadsOn(), ScriptError(), ScriptWarning(), SetAreaPortalAreas_r(), Sin_AllocMaxBSP(), Sin_BSPBrushToMapBrush(), Sin_FreeMaxBSP(), Sin_LoadMapFromBSP(), Sin_PrintBSPFileSizes(), SourceError(), SourceWarning(), TestExpandBrushes(), TH_AASToTetrahedrons(), TH_TetrahedralDecomposition(), ThreadSetupLock(), Tree_Free(), Tree_PruneNodes(), TryMergeBrushes(), and WriteMapFile().

00128 {
00129     va_list ap;
00130     char buf[2048];
00131 
00132     va_start(ap, fmt);
00133     vsprintf(buf, fmt, ap);
00134     va_end(ap);
00135 
00136     if (verbose)
00137     {
00138 #ifdef WINBSPC
00139         WinBSPCPrint(buf);
00140 #else
00141         printf("%s", buf);
00142 #endif //WINBSPS
00143     } //end if
00144 
00145     if (logfile.fp)
00146     {
00147         Log_UnifyEndOfLine(buf);
00148         fprintf(logfile.fp, "%s", buf);
00149         fflush(logfile.fp);
00150     } //end if
00151 } //end of the function Log_Print

Here is the call graph for this function:

void Log_Shutdown void   ) 
 

Definition at line 94 of file l_log.c.

References logfile_s::fp, Log_Close(), and logfile.

00095 {
00096     if (logfile.fp) Log_Close();
00097 } //end of the function Log_Shutdown

Here is the call graph for this function:

void Log_UnifyEndOfLine char *  buf  ) 
 

Definition at line 104 of file l_log.c.

References i, memmove(), and strlen().

Referenced by Log_Print(), and Log_Write().

00105 {
00106     int i;
00107 
00108     for (i = 0; buf[i]; i++)
00109     {
00110         if (buf[i] == '\n')
00111         {
00112             if (i <= 0 || buf[i-1] != '\r')
00113             {
00114                 memmove(&buf[i+1], &buf[i], strlen(&buf[i])+1);
00115                 buf[i] = '\r';
00116                 i++;
00117             } //end if
00118         } //end if
00119     } //end for
00120 } //end of the function Log_UnifyEndOfLine

Here is the call graph for this function:

void Log_Write char *  fmt,
  ...
 

Definition at line 158 of file l_log.c.

References fflush(), logfile_s::fp, fprintf(), Log_UnifyEndOfLine(), logfile, QDECL, va_end, va_list, va_start, vfprintf(), and vsprintf().

Referenced by AAS_AlternativeRouteGoals(), AAS_BestReachableArea(), AAS_CheckArea(), AAS_CheckAreaForPossiblePortals(), AAS_CheckAreaSharedFaces(), AAS_CheckAreaWindingPlanes(), AAS_CheckFaceWindingPlane(), AAS_CountForcedClusterPortals(), AAS_CreateAreas(), AAS_CreateAreaSettings(), AAS_FindBestAreaSplitPlane(), AAS_FlipAreaFaces(), AAS_FlipSharedFaces(), AAS_GetFace(), AAS_GravitationalSubdivision(), AAS_InitClustering(), AAS_LadderSubdivision(), AAS_MeltAreaFaceWindings(), AAS_MergeAreaFaces(), AAS_MergeAreaPlaneFaces(), AAS_MergeAreas(), AAS_PruneNodes(), AAS_RandomGoalArea(), AAS_Reachability_Elevator(), AAS_Reachability_FuncBobbing(), AAS_Reachability_Grapple(), AAS_Reachability_Jump(), AAS_Reachability_Ladder(), AAS_Reachability_WeaponJump(), AAS_RemoveTinyFaces(), AAS_SplitFace(), AAS_StoreFile(), AAS_TestPortals(), AAS_TryMergeFaces(), AAS_UpdatePortal(), BotCheckChatMessageIntegrety(), BotDumpAvoidGoals(), BotDumpCharacter(), BotDumpGoalStack(), BotDumpInitialChat(), BotImport_Print(), BotInitLevelItems(), BotUpdateEntityItems(), BrushBSP(), ChopBrushes(), Com_DPrintf(), Error(), FindPlaneSeperatingWindings(), HL_TextureBrushes(), ItemWeightIndex(), MakeTreePortals(), MarkBrushBevels(), PC_DollarEvaluate(), PC_Evaluate(), PC_EvaluateTokens(), PC_ExpandDefine(), PC_PrintDefineHashTable(), PrintContents(), Q1_TextureBrushes(), Q3_BrushContents(), SplitBrush(), Warning(), and WriteMapBrush().

00159 {
00160     va_list ap;
00161     char buf[2048];
00162 
00163     if (!logfile.fp) return;
00164     va_start(ap, fmt);
00165     vsprintf(buf, fmt, ap);
00166     va_end(ap);
00167     Log_UnifyEndOfLine(buf);
00168     fprintf(logfile.fp, "%s", buf);
00169     fflush(logfile.fp);
00170 } //end of the function Log_Write

Here is the call graph for this function:

void Log_WriteTimeStamped char *  fmt,
  ...
 

Definition at line 177 of file l_log.c.

References botlibglobals, fflush(), logfile_s::fp, fprintf(), logfile, logfile_s::numwrites, QDECL, botlib_globals_s::time, va_end, va_list, va_start, and vfprintf().

00178 {
00179     va_list ap;
00180 
00181     if (!logfile.fp) return;
00182 /*  fprintf(logfile.fp, "%d   %02d:%02d:%02d:%02d   ",
00183                     logfile.numwrites,
00184                     (int) (botlibglobals.time / 60 / 60),
00185                     (int) (botlibglobals.time / 60),
00186                     (int) (botlibglobals.time),
00187                     (int) ((int) (botlibglobals.time * 100)) -
00188                             ((int) botlibglobals.time) * 100);*/
00189     va_start(ap, fmt);
00190     vfprintf(logfile.fp, fmt, ap);
00191     va_end(ap);
00192     logfile.numwrites++;
00193     fflush(logfile.fp);
00194 } //end of the function Log_Write

Here is the call graph for this function:


Variable Documentation

logfile_t logfile
 

Definition at line 38 of file l_log.c.

Referenced by Com_Printf(), Com_Shutdown(), Hunk_Log(), Hunk_SmallLog(), Log_Close(), Log_FileStruct(), Log_Flush(), Log_Open(), Log_Print(), Log_Shutdown(), Log_Write(), Log_WriteTimeStamped(), and Z_LogZoneHeap().


Generated on Thu Aug 25 12:42:53 2005 for Quake III Arena by  doxygen 1.3.9.1