[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

loadtime conditionalization.

Here's a hack:

Try putting in your file:

(when 1i-dont-want-the-rest-of-this-file-loaded-p
0  (throw 'si:bin-load-done t))

It uses an undocumented catch tag so you can't depend on it to work in future

    Date: Fri, 10 Jun 88 19:23 PDT
    From: Jerry@marlowe.inference.dialnet.symbolics.com (Jerry Bakin)

    I am working on a system which will be supported on several
    machines, in several different environments.

    I have stubs and such to load on the different environments to make them
    behave the same.

    I would like to create one system and have one compiled version; this
    will cause slightly fatter than needed bins, but reduce the overhead in
    maintaining separate systems.

    So, I have a few problems which I would like suggestions or comments.

    A)  Can I conditionalize the loading of files within a defsystem on
	user picked predicates?

    B)  At load time, what is the recommended method to conditionalize
	the evaluation of a defun, defflavor, etc., within a file?

    For instance, I have a file known as tcp-stubs which contains
    the support I need when tcp has not been loaded on the system.

    I would like to let defsystem determine when to load tcp-stubs or not.

    Failing that, I would like to add code such as the following within
    tcp-stubs and always load it:

    (when (fboundp 'tcp::add-tcp-port-for-protocol)
      (tcp::add-tcp-port-for-protocol :sna-simulation 2050))

    (unless (find 'tcp-error sys:*all-flavor-names*)
      (defflavor tcp-error () ()))

    The problem is that upon compiling, I get many warnings similar to the

    Warning (not associated with any definition):
      A DEFFLAVOR should only occur at top level

    Well it is only a warning, but still; I'd rather not see it.

    Does anyone have any suggestions?


    Jerry Bakin.