geometry.h: constify global wellknown Geometry data values

This then rippled through into callers

Fixed merge conflicts in cif/CIFrdutils.c and cif/CIFread.h
This commit is contained in:
Darryl L. Miles 2024-10-12 14:01:10 +01:00 committed by Tim Edwards
parent a224c7e21a
commit aa43cc164e
7 changed files with 35 additions and 34 deletions

View File

@ -1469,9 +1469,9 @@ cifParseComment(void)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
Transform * const Transform *
CIFDirectionToTrans( CIFDirectionToTrans(
Point *point) /* Direction vector from origin. */ const Point *point) /* Direction vector from origin. */
{ {
if ((point->p_x != 0) && (point->p_y == 0)) if ((point->p_x != 0) && (point->p_y == 0))
{ {

View File

@ -176,16 +176,14 @@ 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, PaintResultType *resultTbl,
PaintUndoInfo *ui, bool isCalma); PaintUndoInfo *ui, bool isCalma);
extern Transform *CIFDirectionToTrans(Point *point); extern const Transform *CIFDirectionToTrans(const Point *point);
extern int CIFReadNameToType(char *name, bool newOK); 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); PaintResultType *ptable, PaintUndoInfo *ui);
extern void CIFMakeManhattanPath(CIFPath *pathHead, Plane *plane, PaintResultType *resultTbl, PaintUndoInfo *ui); extern void CIFMakeManhattanPath(CIFPath *pathHead, Plane *plane, 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 */

View File

@ -4828,7 +4828,8 @@ cmdDumpParseArgs(
CellDef *def, *rootDef, *editDef; CellDef *def, *rootDef, *editDef;
bool hasChild, hasRoot, hasTrans; bool hasChild, hasRoot, hasTrans;
Rect rootBox, bbox; Rect rootBox, bbox;
Transform *tx_cell, trans_cell; const Transform *tx_cell;
Transform trans_cell;
char **av; char **av;
char *cellnameptr, *fullpathname; char *cellnameptr, *fullpathname;
int ac, clen; int ac, clen;

View File

@ -1302,7 +1302,8 @@ DefReadLocation(use, f, oscale, tptr, noplace)
Transform *tptr; Transform *tptr;
bool noplace; bool noplace;
{ {
Rect *r, tr, rect; const Rect *r;
Rect tr, rect;
int keyword; int keyword;
char *token; char *token;
float x, y; float x, y;

View File

@ -722,7 +722,7 @@ LefReadLayers(f, obstruct, lreturn, rreturn)
FILE *f; FILE *f;
bool obstruct; bool obstruct;
TileType *lreturn; TileType *lreturn;
Rect **rreturn; const Rect **rreturn;
{ {
char *token; char *token;
TileType curlayer = -1; TileType curlayer = -1;
@ -810,7 +810,7 @@ LefReadLayer(f, obstruct)
FILE *f; FILE *f;
bool obstruct; bool obstruct;
{ {
return LefReadLayers(f, obstruct, (TileType *)NULL, (Rect **)NULL); return LefReadLayers(f, obstruct, (TileType *)NULL, (const Rect **)NULL);
} }
/* /*
@ -1200,7 +1200,8 @@ LefReadGeometry(lefMacro, f, oscale, do_list, is_imported)
LinkedRect *newRect, *rectList; LinkedRect *newRect, *rectList;
Point *pointList; Point *pointList;
int points; int points;
Rect *paintrect, *contact = NULL; Rect *paintrect;
const Rect *contact = NULL;
static char *geometry_keys[] = { static char *geometry_keys[] = {
"LAYER", "LAYER",

View File

@ -36,26 +36,26 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
*------------------------------------------------------------------- *-------------------------------------------------------------------
*/ */
global Transform GeoIdentityTransform = { 1, 0, 0, 0, 1, 0 }; global const Transform GeoIdentityTransform = { 1, 0, 0, 0, 1, 0 };
global Transform GeoUpsideDownTransform = { 1, 0, 0, 0, -1, 0 }; global const Transform GeoUpsideDownTransform = { 1, 0, 0, 0, -1, 0 };
global Transform GeoSidewaysTransform = { -1, 0, 0, 0, 1, 0 }; global const Transform GeoSidewaysTransform = { -1, 0, 0, 0, 1, 0 };
global Transform Geo90Transform = { 0, 1, 0, -1, 0, 0 }; global const Transform Geo90Transform = { 0, 1, 0, -1, 0, 0 };
global Transform Geo180Transform = { -1, 0, 0, 0, -1, 0 }; global const Transform Geo180Transform = { -1, 0, 0, 0, -1, 0 };
global Transform Geo270Transform = { 0, -1, 0, 1, 0, 0 }; global const Transform Geo270Transform = { 0, -1, 0, 1, 0, 0 };
/* /*
* Additional Transforms (Reflections at 45 and 135 degrees) * Additional Transforms (Reflections at 45 and 135 degrees)
*/ */
global Transform GeoRef45Transform = { 0, 1, 0, 1, 0, 0 }; global const Transform GeoRef45Transform = { 0, 1, 0, 1, 0, 0 };
global Transform GeoRef135Transform = { 0, -1, 0, -1, 0, 0 }; global const Transform GeoRef135Transform = { 0, -1, 0, -1, 0, 0 };
/* /*
*------------------------------------------------------------------- *-------------------------------------------------------------------
* Declaration of the table of opposite directions: * Declaration of the table of opposite directions:
*------------------------------------------------------------------- *-------------------------------------------------------------------
*/ */
global int GeoOppositePos[] = global const int GeoOppositePos[] =
{ {
GEO_CENTER, /* GEO_CENTER */ GEO_CENTER, /* GEO_CENTER */
GEO_SOUTH, /* GEO_NORTH */ GEO_SOUTH, /* GEO_NORTH */
@ -74,9 +74,9 @@ global int GeoOppositePos[] =
*------------------------------------------------------------------- *-------------------------------------------------------------------
*/ */
global Rect GeoNullRect = { {0, 0}, {0, 0} }; global const Rect GeoNullRect = { {0, 0}, {0, 0} };
global Rect GeoInvertedRect = { {0, 0}, {-1, -1} }; global const Rect GeoInvertedRect = { {0, 0}, {-1, -1} };
global Point GeoOrigin = { 0, 0 }; global const Point GeoOrigin = { 0, 0 };
/*------------------------------------------------------------------- /*-------------------------------------------------------------------

View File

@ -211,19 +211,19 @@ extern void GeoScaleTrans(const Transform *trans1, int m, Transform *trans2);
*------------------------------------------------------------------- *-------------------------------------------------------------------
*/ */
extern Transform GeoIdentityTransform; extern const Transform GeoIdentityTransform;
extern Transform GeoUpsideDownTransform; extern const Transform GeoUpsideDownTransform;
extern Transform GeoSidewaysTransform; extern const Transform GeoSidewaysTransform;
extern Transform Geo90Transform; extern const Transform Geo90Transform;
extern Transform Geo180Transform; extern const Transform Geo180Transform;
extern Transform Geo270Transform; extern const Transform Geo270Transform;
extern Transform GeoRef45Transform; extern const Transform GeoRef45Transform;
extern Transform GeoRef135Transform; extern const Transform GeoRef135Transform;
extern Rect GeoNullRect; extern const Rect GeoNullRect;
extern Rect GeoInvertedRect; extern const Rect GeoInvertedRect;
extern Point GeoOrigin; extern const Point GeoOrigin;
extern int GeoOppositePos[]; extern const int GeoOppositePos[];
#endif /* _GEOMETRY_H */ #endif /* _GEOMETRY_H */