Skip to content

Commit

Permalink
Merge pull request #77 from SacBase/inlineformat
Browse files Browse the repository at this point in the history
Workaround for sac2c Issue #2333
  • Loading branch information
sbscholz committed Jul 7, 2023
2 parents aa9940f + 158fe98 commit 1821f28
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/structures/ArrayFormat.xsac
Original file line number Diff line number Diff line change
Expand Up @@ -414,26 +414,34 @@ char[+] format(float[+] y, int[2] w)
*
********************************************************************************/

#define DOINL inline
// This is a crude workaround for sac2c Issue #2333,
// which Bodo suggests requires major redesign of modules.

DOINL
char[.] format(double y)
{ /* Default format on double scalar */
precision = 15;
return(format(y, precision));
}

DOINL
char[+] format(double[+] y)
{ /* Default format on double non-scalar */
/* Refer to UTThorn.dws <threal> for APL model of this */
precision = 15;
return(format(y, precision));
}

DOINL
char[.] format(double y, int precision)
{ /* Formatting for a double scalar */
z = ScalarFormatter(y, precision);
z = PadWithBlanks([precision + 7], z);
return(z);
}

DOINL
char[+] format(double[+] y, int precision)
{ /* precision-significant digit format on double non-scalar */
/* Refer to UTThorn.dws <threal> for APL model of this */
Expand Down Expand Up @@ -474,6 +482,7 @@ char[+] format(double[+] y, int precision)
return(z);
}

DOINL
char[.] format(double y, int[2] w)
{ /* Formatting for a double scalar */
/* This is temporary, pending use of the Burger/Dybvig algorithm
Expand All @@ -486,6 +495,7 @@ char[.] format(double y, int[2] w)
return(z);
}

DOINL
char[+] format(double[+] y, int[2] w)
{ /* Defined-width format on double non-scalar
* w[0] is maximum legal result width. If result is wider than this,
Expand Down

0 comments on commit 1821f28

Please sign in to comment.