Skip to content

Commit

Permalink
include time.h when CLOCKS_PER_SEC is used
Browse files Browse the repository at this point in the history
  • Loading branch information
digama0 committed Sep 28, 2023
1 parent c2f34ba commit 98c89f5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
23 changes: 12 additions & 11 deletions src/mmcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "mmvstr.h"
#include "mmdata.h"
#include "mmcmdl.h" // For g_texFileName
Expand Down Expand Up @@ -72,7 +73,7 @@ void typeStatement(long showStmt,

// For syntax breakdown of definitions in HTML page
long zapStatement1stToken;
// Array index of the hard-coded token "wff" - static so we only
// Array index of the hard-coded token "wff" - static so we only
// have to look it up once - set to -2 if not found.
static long wffToken = -1;
subType = 0; // Assign to prevent compiler warnings - not theoretically necessary
Expand Down Expand Up @@ -103,7 +104,7 @@ void typeStatement(long showStmt,
NULL), "", " ");
} else {
if (!htmlFlag) let(&g_printString, "");
// Flag for print2 to add to g_printString.
// Flag for print2 to add to g_printString.
// Note that printTexLongMathString resets it
g_outputToString = 1;
if (!(htmlFlag && texFlag)) {
Expand Down Expand Up @@ -1175,7 +1176,7 @@ vstring htmlAllowedSubst(long showStmt)
// Look for a "wff" and "class" variable
if (g_Statement[reqHyp[i]].type == (char)e_) continue;
strptr = g_MathToken[(g_Statement[reqHyp[i]].mathString)[0]].tokenName;
// Not a wff or class variable
// Not a wff or class variable
if (strcmp("wff", strptr) && strcmp("class", strptr)) continue;
wffOrClassVar = (g_Statement[reqHyp[i]].mathString)[1];
let(&setVarDVFlag, string(setVars, 'N')); // No $d yet
Expand Down Expand Up @@ -1947,7 +1948,7 @@ void typeProof(long statemNum,
NULL), "", "\"");
// Means this is not a syntax breakdown of a
// definition which is called from typeStatement().
if (essentialFlag) {
if (essentialFlag) {

// Create list of syntax statements used
vstring_def(statementUsedFlags);
Expand All @@ -1972,12 +1973,12 @@ void typeProof(long statemNum,

// Array index of the hard-coded token "wff" - static so we only have
// to look it up once - set to -2 if not found.
static long wffToken = -1;
static long wffToken = -1;
// Look up the token "wff" (hard-coded) if we haven't found it before
if (wffToken == -1) { // First time
// In case it's not found because the user's source used a convention
// different for "wff" for wffs.
wffToken = -2;
wffToken = -2;
for (i = 0; i < g_mathTokens; i++) {
if (!strcmp("wff", g_MathToken[i].tokenName)) {
wffToken = i;
Expand Down Expand Up @@ -2892,7 +2893,7 @@ void traceProofWork(long statemNum,
statemNum // cutoffStmt
);
// Include the statement we're showing usage of
traceToFilter[stmt] = 'Y';
traceToFilter[stmt] = 'Y';
if (str1[0] == 'Y') { // There is some usage
for (j = stmt + 1; j <= g_statements; j++) {
// OR in the usage to the filter
Expand Down Expand Up @@ -3080,7 +3081,7 @@ void traceProofTreeRec(long statemNum,
for (step = 0; step < plen; step++) {
if (essentialFlag) {
// Ignore floating hypotheses
if (!essentialFlags[step]) continue;
if (!essentialFlags[step]) continue;
}
stmt = proof[step];
if (stmt < 0) {
Expand Down Expand Up @@ -4031,7 +4032,7 @@ void writeExtractedSource(
// found, so header is not needed; abort the scan.
// Ignore starting point of scan since we are looking for a later
// header to end the scope.
if (stmtj > stmt) break;
if (stmtj > stmt) break;
}
if (extractNeeded[stmtj] == 'Y') {
hdrNeeded = 1;
Expand Down Expand Up @@ -4254,7 +4255,7 @@ void writeExtractedSource(

fprintf(fp, "%s", buf);
// Text below last statement isn't (currently) used - do we need it?
if (stmt == g_statements + 1) bug(272);
if (stmt == g_statements + 1) bug(272);
if (stmt != g_statements + 1) {
extractedStmts++; // For final message
fprintf(fp, "$%c", g_Statement[stmt].type);
Expand Down Expand Up @@ -5689,7 +5690,7 @@ long getStatementNum(vstring stmtName, // Possibly with wildcards.
}

if (efOnlyForMaxStmt) {
// Don't set efOnlyForMaxStmt in case of PROVE call
// Don't set efOnlyForMaxStmt in case of PROVE call
if (maxStmt > g_statements) bug(247);
// If a $e or $f, it must be a hypothesis of the statement being proved.
if (typ == (char)e_ || typ == (char)f_){
Expand Down
17 changes: 9 additions & 8 deletions src/mminou.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#include "mmvstr.h"
#include "mmdata.h"
#include "mminou.h"
Expand All @@ -22,7 +23,7 @@
// 1. #include <conio.h> has compile errors
// 2. Two consecutive calls to vprintf after va_start causes register dump
// or corrupts 2nd arg.

// From <conio.h>:
#ifndef _CONIO_H_INCLUDED
extern int cprintf(const char *f__mt,...);
Expand Down Expand Up @@ -333,7 +334,7 @@ flag print2(const char* fmt, ...) {
// in an attempt to fix crash with some compilers (e.g. gcc 4.9.2).
va_start(ap, fmt);
// Put formatted string into buffer.
charsPrinted = vsprintf(printBuffer, fmt, ap);
charsPrinted = vsprintf(printBuffer, fmt, ap);
va_end(ap);
if (charsPrinted != bufsiz) {
// Give some info with printf in case print2 crashes during bug() call
Expand Down Expand Up @@ -829,7 +830,7 @@ vstring cmdInput(FILE *stream, const char *ask) {
// let the user scroll through it.
if ((!strcmp(g, "B") || !strcmp(g, "b")) // User typed "B"
// The back-buffer still exists and there was a previous page.
&& pntrLen(backBuffer) > 1
&& pntrLen(backBuffer) > 1
&& g_commandFileNestingLevel == 0
&& (g_scrollMode == 1 && localScrollMode == 1)
&& !g_outputToString) {
Expand Down Expand Up @@ -880,7 +881,7 @@ vstring cmdInput1(const char *ask) {
long p, i;
// In case ask is temporarily allocated (i.e in case it will
// become deallocated at next let().
let(&ask1, ask);
let(&ask1, ask);
// Look for lines too long
while ((signed)(strlen(ask1)) > g_screenWidth) {
p = g_screenWidth - 1;
Expand Down Expand Up @@ -948,14 +949,14 @@ vstring cmdInput1(const char *ask) {
print2("%s[End of command file \"%s\".]\n", ask1,
g_commandFileName[g_commandFileNestingLevel]);
// Deallocate string
free_vstring(g_commandFileName[g_commandFileNestingLevel]);
free_vstring(g_commandFileName[g_commandFileNestingLevel]);
g_commandFileNestingLevel--;
commandLn = "";
if (g_commandFileNestingLevel == 0) {
g_commandFileSilentFlag = 0;
} else {
// Revert to previous nesting level's silent flag
g_commandFileSilentFlag = g_commandFileSilent[g_commandFileNestingLevel];
g_commandFileSilentFlag = g_commandFileSilent[g_commandFileNestingLevel];
}
break; // continue;
}
Expand Down Expand Up @@ -1069,7 +1070,7 @@ void errorMessage(vstring line, long lineNum, long column, long tokenLength,

// Restore output to g_printString if it was enabled before
// 9-Jun-2016 nm Reverted

// g_outputToString = saveOutputToString;

if (severity == 3) {
Expand Down Expand Up @@ -1328,7 +1329,7 @@ vstring readFileToString(const char *fileName, char verbose, long *charCount) {
// Allocate space for the entire input file
// Add a factor for unknown text formats (just a guess)
fileBufSize = fileBufSize + 10;

fileBuf = malloc((size_t)fileBufSize);
if (!fileBuf) {
if (verbose) print2(
Expand Down

0 comments on commit 98c89f5

Please sign in to comment.