1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
#ifndef __APPLE__
#include <stdio.h>
#include "compilerinfo.h"
void (*setInfo)(compilerInfo *);
double progress1Max, progress2Max;
compilerInfo * emptyCompilerInfo()
{
compilerInfo *info = new compilerInfo;
info->progress1 = -1.;
info->progress2 = -1.;
info->task[0] = 0;
info->file[0] = 0;
info->item[0] = 0;
info->funcs = -1;
info->objs = -1;
info->globs = -1;
info->strings = -1;
info->resources = -1;
info->newComments = false;
info->finished = false;
info->success = false;
return info;
}
void setInfoReceiver(void (*infoReceiver)(compilerInfo *))
{
setInfo = infoReceiver;
}
void clearRect(int i, int whichBox)
{
if (whichBox == P_TOP) {
progress1Max = (double)i;
} else {
progress2Max = (double)i;
}
percRect(0, whichBox);
}
void percRect(unsigned int i, int whichBox)
{
if (!setInfo) return;
compilerInfo *info = emptyCompilerInfo();
if (whichBox == P_TOP) {
info->progress1 = ((double)i/progress1Max <= 1.) ? (double)i/progress1Max : 1.;
} else {
info->progress2 = ((double)i/progress2Max <= 1.) ? (double)i/progress2Max : 1.;
}
(*setInfo)(info);
}
void setCompilerText (const compilerStatusText where, const char * theText)
{
if (!setInfo) return;
if (!theText) return;
compilerInfo *info = emptyCompilerInfo();
switch (where) {
case COMPILER_TXT_ACTION:
sprintf(info->task, "%s", theText);
break;
case COMPILER_TXT_FILENAME:
sprintf(info->file, "%s", theText);
break;
case COMPILER_TXT_ITEM:
sprintf(info->item, "%s", theText);
break;
}
(*setInfo)(info);
}
void setCompilerStats(int funcs, int objTypes, int resources, int globals, int strings)
{
if (!setInfo) return;
compilerInfo *info = emptyCompilerInfo();
info->funcs = funcs;
info->objs = objTypes;
info->globs = globals;
info->strings = strings;
info->resources = resources;
(*setInfo)(info);
}
void compilerCommentsUpdated()
{
if (!setInfo) return;
compilerInfo *info = emptyCompilerInfo();
info->newComments = true;
(*setInfo)(info);
}
void setFinished(bool success)
{
if (!setInfo) return;
compilerInfo *info = emptyCompilerInfo();
info->success = success;
info->finished = true;
(*setInfo)(info);
}
#endif
|