Modules Examples

in ACAD.LSP:

;; define the internal search path

(setq *MODULE-PATH* '("c:\\lisp\\stdlib" "c:\\lisp"))

in the module GEOMETRY.LSP:

;;; We need other modules to load properly:

(std-require 'STDLIB) ; needing some functions from STDLIB.LSP

;;; Code for the geometry module goes here:

(defun geom-ccw ()
  ...

;; sample of some safety checker inside the code

  (if (not (std-require-version 'MATRIX 0.5))

;; hmm, older version, so we need a matrix workaround

    (progn
      (setq ccw ...)
    )

;; matrix code is new enough, use it.

    (matrix-stuff ...)
  )
  ...
)
...

;;; Define the new module at the end of the file. It must match the filename.

(std-provide 'GEOMETRY)

;;; We need other modules to run properly:

(std-require 'INPUT) ; need my-getstring from INPUT.LSP

(std-require "Algebra") ; loads Algebra.LSP