238 lines
10 KiB
Diff
238 lines
10 KiB
Diff
From c64563088b224a778a236c1e1495f0a4edd2c9df Mon Sep 17 00:00:00 2001
|
|
From: Jerry James <loganjerry@gmail.com>
|
|
Date: Wed, 26 Nov 2025 11:02:23 -0700
|
|
Subject: [PATCH] Do not discard const qualifiers
|
|
|
|
---
|
|
src/util/output.c | 2 +-
|
|
src/util/output.h | 2 +-
|
|
src/util/print.c | 40 ++++++++++++++++++++++------------------
|
|
src/util/print.h | 36 ++++++++++++++++++++----------------
|
|
4 files changed, 44 insertions(+), 36 deletions(-)
|
|
|
|
diff --git a/src/util/output.c b/src/util/output.c
|
|
index 8623d01..a0f4f62 100644
|
|
--- a/src/util/output.c
|
|
+++ b/src/util/output.c
|
|
@@ -37,7 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
#include "banner.h"
|
|
|
|
/* ----------------------------------------------------------------- */
|
|
-listVector* readListVector(int *numOfVars, char *fileName) {
|
|
+listVector* readListVector(int *numOfVars, const char *fileName) {
|
|
int numOfVectors;
|
|
listVector *basis, *endBasis;
|
|
vector b;
|
|
diff --git a/src/util/output.h b/src/util/output.h
|
|
index 93bece5..bbcff84 100644
|
|
--- a/src/util/output.h
|
|
+++ b/src/util/output.h
|
|
@@ -1,3 +1,3 @@
|
|
int output_main(int, char**);
|
|
-listVector* readListVector(int*, char*);
|
|
+listVector* readListVector(int*, const char*);
|
|
listVector* extractNonDominatedVectors(listVector*, listVector*, int);
|
|
diff --git a/src/util/print.c b/src/util/print.c
|
|
index 157200a..eca5b82 100644
|
|
--- a/src/util/print.c
|
|
+++ b/src/util/print.c
|
|
@@ -82,7 +82,8 @@ void printVectorToFile(FILE *out, vector v, int numOfVars) {
|
|
return ;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printListVectorToFile(char* fileName, listVector* basis, int numOfVars) {
|
|
+void printListVectorToFile(const char* fileName, listVector* basis,
|
|
+ int numOfVars) {
|
|
int len;
|
|
FILE* out;
|
|
|
|
@@ -106,8 +107,8 @@ void printListVectorToFile(char* fileName, listVector* basis, int numOfVars) {
|
|
fclose(out);
|
|
return ;
|
|
}
|
|
-/* ----------------------------------------------------------------- */
|
|
-void printSubsetOfListVectorToFile(char* fileName, listVector* basis,
|
|
+/* ------------------------------------------------------------------------ */
|
|
+void printSubsetOfListVectorToFile(const char* fileName, listVector* basis,
|
|
vector ind, int numOfVars) {
|
|
int len,len2,j;
|
|
FILE* out;
|
|
@@ -147,7 +148,8 @@ void printVectorWithoutColumnToFile(FILE *out, vector v, int ind,
|
|
return ;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printListVectorWithoutColumnToFile(char* fileName, listVector* basis,
|
|
+void printListVectorWithoutColumnToFile(const char* fileName,
|
|
+ listVector* basis,
|
|
int ind, int numOfVars) {
|
|
int len;
|
|
FILE* out;
|
|
@@ -185,7 +187,7 @@ void printVectorWithAddtionalColumnToFile(FILE *out, vector v, int ind,
|
|
return ;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printListVectorWithAdditionalColumnToFile(char* fileName,
|
|
+void printListVectorWithAdditionalColumnToFile(const char* fileName,
|
|
listVector* basis,
|
|
int ind, int val,
|
|
int numOfVars) {
|
|
@@ -214,7 +216,7 @@ void printListVectorWithAdditionalColumnToFile(char* fileName,
|
|
return ;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printTransposedListVectorToFile(char* fileName, listVector* basis,
|
|
+void printTransposedListVectorToFile(const char* fileName, listVector* basis,
|
|
int numOfVars) {
|
|
int i,len;
|
|
listVector *tmp;
|
|
@@ -318,7 +320,7 @@ void printBinomialToFile(FILE *out, vector v, int numOfVars, char** labels) {
|
|
return ;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printListBinomialsToFile(char* fileName, listVector* basis,
|
|
+void printListBinomialsToFile(const char* fileName, listVector* basis,
|
|
int numOfVars, char** labels) {
|
|
FILE* out;
|
|
|
|
@@ -377,7 +379,8 @@ void printMonomialToFile(FILE *out, vector v, int numOfVars, char** labels) {
|
|
return ;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printListMonomialsAndBinomialsToFile(char* fileName, listVector* basis,
|
|
+void printListMonomialsAndBinomialsToFile(const char* fileName,
|
|
+ listVector* basis,
|
|
int numOfVars, char** labels) {
|
|
FILE* out;
|
|
|
|
@@ -455,7 +458,8 @@ void printVectorToFileMacaulay2(FILE *out, vector v, int numOfVars) {
|
|
return ;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printListVectorMaple(char* fileName, listVector* basis, int numOfVars) {
|
|
+void printListVectorMaple(const char* fileName, listVector* basis,
|
|
+ int numOfVars) {
|
|
FILE* out;
|
|
|
|
if (!(out = fopen(fileName,"w"))) {
|
|
@@ -480,7 +484,7 @@ void printListVectorMaple(char* fileName, listVector* basis, int numOfVars) {
|
|
return ;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printListVectorMacaulay2(char* fileName, listVector* basis,
|
|
+void printListVectorMacaulay2(const char* fileName, listVector* basis,
|
|
int numOfVars) {
|
|
FILE* out;
|
|
|
|
@@ -506,8 +510,8 @@ void printListVectorMacaulay2(char* fileName, listVector* basis,
|
|
return ;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void print3wayTables(char* fileName, listVector* basis, int x, int y,
|
|
- int z, int numOfVars) {
|
|
+void print3wayTables(const char* fileName, listVector* basis, int x,
|
|
+ int y, int z, int numOfVars) {
|
|
int i,j,k;
|
|
vector v;
|
|
FILE* out;
|
|
@@ -583,7 +587,7 @@ void printL1NormOfListVector(listVector *basis, int numOfVars) {
|
|
return;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printListVectorWithGivenDegreesToFile(char *outFileName,
|
|
+void printListVectorWithGivenDegreesToFile(const char *outFileName,
|
|
listVector *basis, int numOfVars,
|
|
int lowdegree, int highdegree){
|
|
int i,s,len;
|
|
@@ -647,7 +651,7 @@ void printSupportsOfListVector(listVector *basis, int numOfVars) {
|
|
return;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printListVectorWithGivenSupportsToFile(char *outFileName,
|
|
+void printListVectorWithGivenSupportsToFile(const char *outFileName,
|
|
listVector *basis, int numOfVars,
|
|
int lowdegree, int highdegree){
|
|
int i,s,len;
|
|
@@ -724,7 +728,7 @@ void printTypesOfListVector(listVector *basis, int sizeOfLayer,
|
|
return;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printListVectorWithGivenNonzeroEntryToFile(char *outFileName,
|
|
+void printListVectorWithGivenNonzeroEntryToFile(const char *outFileName,
|
|
listVector *basis,
|
|
int numOfVars,
|
|
int coord){
|
|
@@ -760,8 +764,8 @@ void printListVectorWithGivenNonzeroEntryToFile(char *outFileName,
|
|
return;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void writeResult(listVector *basis, int numOfVars, char *fileName,
|
|
- char *basisType, int infoLevel) {
|
|
+void writeResult(listVector *basis, int numOfVars, const char *fileName,
|
|
+ const char *basisType, int infoLevel) {
|
|
const char *infoMessage="undefined";
|
|
const char *outExtension="";
|
|
char *outFileName=NULL;
|
|
@@ -803,7 +807,7 @@ void writeResult(listVector *basis, int numOfVars, char *fileName,
|
|
return;
|
|
}
|
|
/* ----------------------------------------------------------------- */
|
|
-void printListRepresentativesToFile(char* fileName, listOrbit* basis,
|
|
+void printListRepresentativesToFile(const char* fileName, listOrbit* basis,
|
|
int numOfVars) {
|
|
int len;
|
|
FILE* out;
|
|
diff --git a/src/util/print.h b/src/util/print.h
|
|
index 3789562..2d07334 100644
|
|
--- a/src/util/print.h
|
|
+++ b/src/util/print.h
|
|
@@ -24,30 +24,34 @@ void printVersionInfo();
|
|
void printVector(vector, int);
|
|
void printListVector(listVector*, int);
|
|
void printVectorToFile(FILE*, vector, int);
|
|
-void printListVectorToFile(char*, listVector*, int);
|
|
-void printSubsetOfListVectorToFile(char*, listVector*, vector, int);
|
|
-void printListVectorWithoutColumnToFile(char*, listVector*, int, int);
|
|
-void printListVectorWithAdditionalColumnToFile(char*, listVector*, int, int,
|
|
- int);
|
|
-void printTransposedListVectorToFile(char*, listVector*, int);
|
|
+void printListVectorToFile(const char*, listVector*, int);
|
|
+void printSubsetOfListVectorToFile(const char*, listVector*, vector, int);
|
|
+void printListVectorWithoutColumnToFile(const char*, listVector*, int, int);
|
|
+void printListVectorWithAdditionalColumnToFile(const char*, listVector*, int,
|
|
+ int, int);
|
|
+void printTransposedListVectorToFile(const char*, listVector*, int);
|
|
void printVectorToFileWithBrackets(FILE*, vector, int);
|
|
void printBinomialToFile(FILE*, vector, int, char**);
|
|
-void printListBinomialsToFile(char*, listVector*, int, char**);
|
|
+void printListBinomialsToFile(const char*, listVector*, int, char**);
|
|
void printMonomialToFile(FILE*, vector, int, char**);
|
|
-void printListMonomialsAndBinomialsToFile(char*, listVector*, int, char**);
|
|
+void printListMonomialsAndBinomialsToFile(const char*, listVector*, int,
|
|
+ char**);
|
|
void printMatrix(vector, int, int);
|
|
void printVectorToFileMaple(FILE*, vector, int);
|
|
-void printListVectorMaple(char*, listVector*, int);
|
|
-void printListVectorMacaulay2(char*, listVector*, int);
|
|
-void print3wayTables(char*, listVector*, int, int, int, int);
|
|
+void printListVectorMaple(const char*, listVector*, int);
|
|
+void printListVectorMacaulay2(const char*, listVector*, int);
|
|
+void print3wayTables(const char*, listVector*, int, int, int, int);
|
|
void printL1NormOfListVector(listVector*, int);
|
|
-void printListVectorWithGivenDegreesToFile(char*, listVector*, int, int, int);
|
|
+void printListVectorWithGivenDegreesToFile(const char*, listVector*, int,
|
|
+ int, int);
|
|
void printSupportsOfListVector(listVector*, int);
|
|
void printTypesOfListVector(listVector*, int, int);
|
|
-void printListVectorWithGivenSupportsToFile(char*, listVector*, int, int, int);
|
|
-void printListVectorWithGivenNonzeroEntryToFile(char*, listVector*, int, int);
|
|
-void writeResult(listVector*, int, char*, char*, int);
|
|
-void printListRepresentativesToFile(char*, listOrbit*, int);
|
|
+void printListVectorWithGivenSupportsToFile(const char*, listVector*, int,
|
|
+ int, int);
|
|
+void printListVectorWithGivenNonzeroEntryToFile(const char*, listVector*, int,
|
|
+ int);
|
|
+void writeResult(listVector*, int, const char*, const char*, int);
|
|
+void printListRepresentativesToFile(const char*, listOrbit*, int);
|
|
void printRationalVector(rationalVector*, int);
|
|
void printRationalVectorToFileWithoutBrackets(FILE*, rationalVector*, int);
|
|
|