--m.stone September 26, 1980 5:47 PM
-- Last Edited by: Stone, March 15, 1983 3:27 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: KnotSequence, splineType: SplineType] RETURNS [CoeffsSequence] =

BEGIN
allCoeffs: CoeffsSequence;
numknots: INTEGER ← knots.length;
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.