home *** CD-ROM | disk | FTP | other *** search
- Begin[ "System`"]
-
- SystemStub (* export the symbol *)
-
- $AutoLoad::usage = "$AutoLoad = True enables the autoloading of system
- packages. Small memory systems may wish to set $AutoLoad = False."
-
- Begin[ "System`Private`"]
-
- Unprotect[ SystemStub, AutoLoad]
-
- `t (* pattern name *)
-
- SystemStub[{fn__Symbol}, file_] := (
- Unprotect[fn];
- (t:Literal[#[___]] := AutoLoad[t, {fn}, file])& /@ {fn};
- SetAttributes[{fn}, ReadProtected];
- Protect[fn];
- )
-
- SystemStub[fn_Symbol, file_] := SystemStub[{fn}, file]
-
- SetAttributes[ AutoLoad, HoldFirst ]
-
- AutoLoad[t_, {fn__}, file_]:=
- Module[{protected},
- protected = Unprotect[fn] ;
- Clear[fn]; (* get rid of AutoLoad definition itself *)
- Protect[Evaluate[protected]];
- If[ $AutoLoad === False,
- Message[ General::autoload, Head[t], file],
- AbortProtect[Get[file]]];
- t
- ]
-
- If[ $AutoLoad =!= False, $AutoLoad = True]
-
- General::autoload = "While evaluating `1` the autoloading of package `2` was
- disabled by the previous setting of $AutoLoad to False.
- The package can be loaded with Get and the evaluation repeated."
-
-
- Protect[ SystemStub, AutoLoad ]
-
- End[] (* System`Private` *)
-
- End[] (* System` *)
-
-
-
-