(*********************************************************************

Copyright 1989 by Roman E. Maeder

Adapted from
Roman E. Maeder: Programming in Mathematica, Addison-Wesley, 1989.

Permission is hereby granted to make copies of this file for
any purpose other than direct profit, or as part of a
commercial product, provided this copyright notice is left
intact. Sale, other than for the cost of media, is prohibited.

Permission is hereby granted to reproduce part or all of
this file, provided that the source is acknowledged.

*********************************************************************)

(* Skeleton.m -- a skeletal package *)

(* set up the package context, included any imports *)

BeginPackage["RMPackages`Skeleton`", "RMPackages`Package1`", "RMPackages`Package2`"]

Needs["RMPackages`Package3`"] (* read in any hidden imports *)

(* usage messages for the exported functions and the context itself *)

Skeleton::usage = "Skeleton.m is a package that does nothing."

Function1::usage = "Function1[n] does nothing."

Function2::usage = "Function2[n, (m:17)] does even more nothing."

Begin["`Private`"] (* begin the private context *)

(* unprotect any system functions for which rules will be defined *)

protected = Unprotect[ Sin, Cos ]

(* definition of auxiliary functions and local (static) variables *)

Aux[f_] := Do[something]

staticvar = 0

(* error messages for the exported objects *)

Skeleton::badarg = "You twit, you called `1` with argument `2`!"

(* definition of the exported functions *)

Function1[n_] := n

Function2[n_, m_:17] := n m /; n < 5 || Message[Skeleton::badarg, Function2, n]

(* rules for system functions *)

Sin/: Sin[x_]^2 := 1 - Cos[x]^2

Protect[ Release[protected] ] (* restore protection of system symbols *)

End[] (* end the private context *)

Protect[ Function1, Function2 ] (* protect exported symbols *)

EndPackage[] (* end the package context *)