Skip to content

Commit 627da35

Browse files
author
Alan W. Irwin
committed
plplot library: Introduce some additional useful typedefs
These plplot.h header changes include defining the following new typedefs: // Pointers to mutable scalars: typedef PLINT * PLINT_NC_SCALAR; typedef PLBOOL * PLBOOL_NC_SCALAR; typedef PLUNICODE * PLUNICODE_NC_SCALAR; typedef char * PLCHAR_NC_SCALAR; typedef PLFLT * PLFLT_NC_SCALAR; // Pointers to mutable vectors: typedef char * PLCHAR_NC_VECTOR; typedef PLFLT * PLFLT_NC_VECTOR; // Pointers to mutable 2-dimensional matrices: typedef char ** PLCHAR_NC_MATRIX; typedef PLFLT ** PLFLT_NC_MATRIX; These typedefs are used throughout plplot.h to self-document arguments which previously had an ambiguous type (e.g., char *) that could be interpreted either as an array or returned value. Currently, these new types are not used anywhere else within PLplot but I plan to use them for DocBook documentation purposes for this release and post-release I plan to propagate them to other parts of the PLplot code. We drop the use of PL_GENERIC_POINTER outside of plplot.h (which involved changing two lines of code in fonts/stndfont.c), and we temporarily drop the const attribute from that typedef. That allows us to replace PLPointer where appropriate with PL_GENERIC_POINTER within include.h as a self-documenting argument type indicating that generic pointer argument _should have_ a const attribute without actually making that backwards-incompatible change, yet. In sum, although these changes are intrusive code changes for plplot.h, they are meant to be equivalent to no actual code changes, i.e., they are designed for self-documentation purposes for now within plplot.h, but the plan is to propagate the use of these typedefs throughout PLplot after the release to spread that self documentation. Since these changes were intrusive, they were heavily tested. See two commits after this one for the details.
1 parent 7756f60 commit 627da35

2 files changed

Lines changed: 175 additions & 141 deletions

File tree

fonts/stndfont.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ extern short int *findex[];
77
extern short int *buffer[];
88

99
int
10-
compare( PL_GENERIC_POINTER si1, PL_GENERIC_POINTER si2 );
10+
compare( const void *si1, const void *si2 );
1111
int
12-
compare( PL_GENERIC_POINTER si1, PL_GENERIC_POINTER si2 )
12+
compare( const void *si1, const void *si2 )
1313
{
1414
const short *a = (const short *) si1;
1515
const short *b = (const short *) si2;

0 commit comments

Comments
 (0)