cif: use 'const' with readonly data (also consumer DBpaint)
This then required a cascade of function APIs to also now receive const arguments. This reduces the .data segment use of this module.
This commit is contained in:
parent
4e768d5a3d
commit
ac56dd71a9
|
|
@ -67,8 +67,8 @@ global Plane *CIFPlanes[MAXCIFLAYERS];
|
||||||
* have two entries each.
|
* have two entries each.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PaintResultType CIFPaintTable[] = {CIF_SOLIDTYPE, CIF_SOLIDTYPE};
|
const PaintResultType CIFPaintTable[] = {CIF_SOLIDTYPE, CIF_SOLIDTYPE};
|
||||||
PaintResultType CIFEraseTable[] = {TT_SPACE, TT_SPACE};
|
const PaintResultType CIFEraseTable[] = {TT_SPACE, TT_SPACE};
|
||||||
|
|
||||||
/* The following local variables are used as a convenience to pass
|
/* The following local variables are used as a convenience to pass
|
||||||
* information between CIFGen and the various search functions.
|
* information between CIFGen and the various search functions.
|
||||||
|
|
@ -549,7 +549,7 @@ cifGrowGridFunc(
|
||||||
int
|
int
|
||||||
cifGrowEuclideanFunc(
|
cifGrowEuclideanFunc(
|
||||||
Tile *tile,
|
Tile *tile,
|
||||||
PaintResultType *table) /* Table to be used for painting. */
|
const PaintResultType *table) /* Table to be used for painting. */
|
||||||
{
|
{
|
||||||
Tile *tp;
|
Tile *tp;
|
||||||
Rect area, rtmp;
|
Rect area, rtmp;
|
||||||
|
|
@ -762,7 +762,7 @@ cifGrowEuclideanFunc(
|
||||||
int
|
int
|
||||||
cifGrowFunc(
|
cifGrowFunc(
|
||||||
Tile *tile,
|
Tile *tile,
|
||||||
PaintResultType *table) /* Table to be used for painting. */
|
const PaintResultType *table) /* Table to be used for painting. */
|
||||||
{
|
{
|
||||||
Rect area;
|
Rect area;
|
||||||
TileType oldType = TiGetTypeExact(tile);
|
TileType oldType = TiGetTypeExact(tile);
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,7 @@ extern int CIFHierRects;
|
||||||
|
|
||||||
/* Tables used for painting and erasing CIF. */
|
/* Tables used for painting and erasing CIF. */
|
||||||
|
|
||||||
extern PaintResultType CIFPaintTable[], CIFEraseTable[];
|
extern const PaintResultType CIFPaintTable[], CIFEraseTable[];
|
||||||
|
|
||||||
/* Procedures and variables for reporting errors. */
|
/* Procedures and variables for reporting errors. */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ LinkedRect *
|
||||||
CIFPolyToRects(
|
CIFPolyToRects(
|
||||||
CIFPath *path, /* Path describing a polygon. */
|
CIFPath *path, /* Path describing a polygon. */
|
||||||
Plane *plane, /* Plane to draw on */
|
Plane *plane, /* Plane to draw on */
|
||||||
PaintResultType *resultTbl,
|
const PaintResultType *resultTbl,
|
||||||
PaintUndoInfo *ui,
|
PaintUndoInfo *ui,
|
||||||
bool isCalma) /* TRUE for Calma, FALSE for CIF */
|
bool isCalma) /* TRUE for Calma, FALSE for CIF */
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ CIFPaintWirePath(
|
||||||
int width,
|
int width,
|
||||||
bool endcap,
|
bool endcap,
|
||||||
Plane *plane,
|
Plane *plane,
|
||||||
PaintResultType *ptable,
|
const PaintResultType *ptable,
|
||||||
PaintUndoInfo *ui)
|
PaintUndoInfo *ui)
|
||||||
{
|
{
|
||||||
CIFPath *pathp, *previousp, *nextp, *polypath;
|
CIFPath *pathp, *previousp, *nextp, *polypath;
|
||||||
|
|
|
||||||
|
|
@ -1052,7 +1052,7 @@ void
|
||||||
CIFMakeManhattanPath(
|
CIFMakeManhattanPath(
|
||||||
CIFPath *pathHead,
|
CIFPath *pathHead,
|
||||||
Plane *plane,
|
Plane *plane,
|
||||||
PaintResultType *resultTbl,
|
const PaintResultType *resultTbl,
|
||||||
PaintUndoInfo *ui)
|
PaintUndoInfo *ui)
|
||||||
{
|
{
|
||||||
CIFPath *new, *new2, *next, *path;
|
CIFPath *new, *new2, *next, *path;
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ extern void CIFFreePath(CIFPath *path);
|
||||||
extern void CIFCleanPath(CIFPath *pathHead);
|
extern void CIFCleanPath(CIFPath *pathHead);
|
||||||
extern void CIFReadCellInit(int ptrkeys);
|
extern void CIFReadCellInit(int ptrkeys);
|
||||||
extern void CIFReadCellCleanup(int filetype);
|
extern void CIFReadCellCleanup(int filetype);
|
||||||
extern LinkedRect *CIFPolyToRects(CIFPath *path, Plane *plane, PaintResultType *resultTbl,
|
extern LinkedRect *CIFPolyToRects(CIFPath *path, Plane *plane, const PaintResultType *resultTbl,
|
||||||
PaintUndoInfo *ui, bool isCalma);
|
PaintUndoInfo *ui, bool isCalma);
|
||||||
extern const Transform *CIFDirectionToTrans(const Point *point);
|
extern const Transform *CIFDirectionToTrans(const Point *point);
|
||||||
extern int CIFReadNameToType(char *name, bool newOK);
|
extern int CIFReadNameToType(char *name, bool newOK);
|
||||||
|
|
@ -182,8 +182,9 @@ extern int CIFReadNameToType(char *name, bool newOK);
|
||||||
extern int CIFCalmaLayerToCifLayer(int layer, int datatype, CIFReadStyle *calmaStyle);
|
extern int CIFCalmaLayerToCifLayer(int layer, int datatype, CIFReadStyle *calmaStyle);
|
||||||
extern void CIFPropRecordPath(CellDef *def, CIFPath *pathheadp, bool iswire, char *propname);
|
extern void CIFPropRecordPath(CellDef *def, CIFPath *pathheadp, bool iswire, char *propname);
|
||||||
extern void CIFPaintWirePath(CIFPath *pathheadp, int width, bool endcap, Plane *plane,
|
extern void CIFPaintWirePath(CIFPath *pathheadp, int width, bool endcap, Plane *plane,
|
||||||
PaintResultType *ptable, PaintUndoInfo *ui);
|
const PaintResultType *ptable, PaintUndoInfo *ui);
|
||||||
extern void CIFMakeManhattanPath(CIFPath *pathHead, Plane *plane, PaintResultType *resultTbl, PaintUndoInfo *ui);
|
extern void CIFMakeManhattanPath(CIFPath *pathHead, Plane *plane, const PaintResultType *resultTbl, PaintUndoInfo *ui);
|
||||||
|
|
||||||
extern int CIFEdgeDirection(CIFPath *first, CIFPath *last);
|
extern int CIFEdgeDirection(CIFPath *first, CIFPath *last);
|
||||||
|
|
||||||
/* Variable argument procedures require complete prototype */
|
/* Variable argument procedures require complete prototype */
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ int
|
||||||
DBPaintPlane0(plane, area, resultTbl, undo, method)
|
DBPaintPlane0(plane, area, resultTbl, undo, method)
|
||||||
Plane *plane; /* Plane whose paint is to be modified */
|
Plane *plane; /* Plane whose paint is to be modified */
|
||||||
Rect *area; /* Area to be changed */
|
Rect *area; /* Area to be changed */
|
||||||
PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
const PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
||||||
* present in the plane, giving the type to
|
* present in the plane, giving the type to
|
||||||
* which the existing tile must change as a
|
* which the existing tile must change as a
|
||||||
* result of this paint operation.
|
* result of this paint operation.
|
||||||
|
|
@ -766,7 +766,7 @@ void
|
||||||
DBFracturePlane(plane, area, resultTbl, undo)
|
DBFracturePlane(plane, area, resultTbl, undo)
|
||||||
Plane *plane; /* Plane whose paint is to be modified */
|
Plane *plane; /* Plane whose paint is to be modified */
|
||||||
Rect *area; /* Area to be changed */
|
Rect *area; /* Area to be changed */
|
||||||
PaintResultType *resultTbl; /* Paint table, to pinpoint those tiles
|
const PaintResultType *resultTbl; /* Paint table, to pinpoint those tiles
|
||||||
* that interact with the paint type.
|
* that interact with the paint type.
|
||||||
*/
|
*/
|
||||||
PaintUndoInfo *undo; /* Record containing everything needed to
|
PaintUndoInfo *undo; /* Record containing everything needed to
|
||||||
|
|
@ -1340,7 +1340,7 @@ DBDiagonalProc(oldtype, dinfo)
|
||||||
TileType old_n, old_s, old_e, old_w;
|
TileType old_n, old_s, old_e, old_w;
|
||||||
TileType new_n, new_s, new_e, new_w;
|
TileType new_n, new_s, new_e, new_w;
|
||||||
TileType newtype;
|
TileType newtype;
|
||||||
PaintResultType *resultTbl = dinfo->resultTbl;
|
const PaintResultType *resultTbl = dinfo->resultTbl;
|
||||||
|
|
||||||
/* Disassemble old and new types into four quadrants, find the */
|
/* Disassemble old and new types into four quadrants, find the */
|
||||||
/* paint result for each quadrant, then reassemble the result. */
|
/* paint result for each quadrant, then reassemble the result. */
|
||||||
|
|
@ -1457,7 +1457,7 @@ DBNMPaintPlane0(plane, exacttype, area, resultTbl, undo, method)
|
||||||
Plane *plane; /* Plane whose paint is to be modified */
|
Plane *plane; /* Plane whose paint is to be modified */
|
||||||
TileType exacttype; /* diagonal info for tile to be changed */
|
TileType exacttype; /* diagonal info for tile to be changed */
|
||||||
Rect *area; /* Area to be changed */
|
Rect *area; /* Area to be changed */
|
||||||
PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
const PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
||||||
* present in the plane, giving the type to
|
* present in the plane, giving the type to
|
||||||
* which the existing tile must change as a
|
* which the existing tile must change as a
|
||||||
* result of this paint operation.
|
* result of this paint operation.
|
||||||
|
|
@ -2064,7 +2064,7 @@ void
|
||||||
DBPaintType(plane, area, resultTbl, client, undo, tileMask)
|
DBPaintType(plane, area, resultTbl, client, undo, tileMask)
|
||||||
Plane *plane; /* Plane whose paint is to be modified */
|
Plane *plane; /* Plane whose paint is to be modified */
|
||||||
Rect *area; /* Area to be changed */
|
Rect *area; /* Area to be changed */
|
||||||
PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
const PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
||||||
* present in the plane, giving the type to
|
* present in the plane, giving the type to
|
||||||
* which the existing tile must change as a
|
* which the existing tile must change as a
|
||||||
* result of this paint operation.
|
* result of this paint operation.
|
||||||
|
|
@ -2555,7 +2555,7 @@ int
|
||||||
DBPaintPlaneVert(plane, area, resultTbl, undo)
|
DBPaintPlaneVert(plane, area, resultTbl, undo)
|
||||||
Plane *plane; /* Plane whose paint is to be modified */
|
Plane *plane; /* Plane whose paint is to be modified */
|
||||||
Rect *area; /* Area to be changed */
|
Rect *area; /* Area to be changed */
|
||||||
PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
const PaintResultType *resultTbl; /* Table, indexed by the type of tile already
|
||||||
* present in the plane, giving the type to
|
* present in the plane, giving the type to
|
||||||
* which the existing tile must change as a
|
* which the existing tile must change as a
|
||||||
* result of this paint operation.
|
* result of this paint operation.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue