--m.stone September 26, 1980 5:47 PM
DIRECTORY
SplineDefs: FROM "SplineDefs";

Splines: PROGRAM IMPORTS RegularAL: SplineDefs,RegularUM: SplineDefs,LocalSpline: SplineDefs EXPORTS SplineDefs =
BEGIN OPEN SplineDefs;

TooFewKnots: PUBLIC SIGNAL[numknots: INTEGER] = CODE;
UnknownSpline: PUBLIC SIGNAL[splineType: SplineType] = CODE;

MakeSpline: PUBLIC PROCEDURE
[knots: DESCRIPTOR FOR ARRAY OF FPCoords, splineType: SplineType]
RETURNS [DESCRIPTOR FOR ARRAY OF Coeffs] =

BEGIN
allCoeffs: DESCRIPTOR FOR ARRAY OF Coeffs;
numknots: INTEGER ← LENGTH[knots];
SELECT splineType FROM

IN [naturalUM..cyclicUM] =>
allCoeffs ← RegularUM.MakeSpline[knots,splineType !
RegularUM.TooFewKnots =>
BEGIN SIGNAL TooFewKnots[numknots]; CONTINUE; END;
RegularUM.UnknownSpline =>
BEGIN SIGNAL UnknownSpline[splineType]; CONTINUE; END
];

IN [naturalAL..cyclicAL] =>
allCoeffs ← RegularAL.MakeSpline[knots,splineType !
RegularAL.TooFewKnots =>
BEGIN SIGNAL TooFewKnots[numknots]; CONTINUE; END;
RegularAL.UnknownSpline =>
BEGIN SIGNAL UnknownSpline[splineType]; CONTINUE; END
];

IN [bezier..crspline] =>
allCoeffs ← LocalSpline.MakeSpline[knots,splineType !
LocalSpline.TooFewKnots =>
BEGIN SIGNAL TooFewKnots[numknots]; CONTINUE; END;
LocalSpline.UnknownSpline =>
BEGIN SIGNAL UnknownSpline[splineType]; CONTINUE; END
];

ENDCASE => SIGNAL UnknownSpline[splineType];

RETURN[allCoeffs];
END;

END.