home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p024 / 6.img / BONUS1.LIB / ALIAS.LSP < prev    next >
Encoding:
Text File  |  1993-02-09  |  5.4 KB  |  188 lines

  1. ;;;   ALIAS.lsp
  2. ;;;   ¬⌐┼v (C) 1988-1992  Autodesk ñ╜Ñq
  3. ;;;
  4. ;;;   Ñ╗╡{ªíñwÑ╤ Autodesk ñ╜Ñq╡∙ÑU¬⌐┼v, ╢╚⌐≤ñU¡z▒í¬pñUÑi▒┬╗P▒zíu│\ÑiívíC
  5. ;;;   ╗╒ñUñú▒oÑHÑ⌠ª≤º╬ªí╡oªµ⌐╬ÑX¬⌐ª╣╡{ªí¬║íu¡∞⌐l╜Xív; ª²ñ╣│\▒zªb»S⌐w¡lÑ═
  6. ;;;   ¬║ñuº@ñW╡▓ªXª╣╡{ªí¬║íuÑ╪¬║╜Xív¿╧Ñ╬íCª│├÷│o├■¡lÑ═ñuº@¬║▒°Ñ≤ªpñU:
  7. ;;;
  8. ;;;   ( i)  │]¡pñW╗Pñuº@ñW¼╥»┬║Θ░w╣∩ Autodesk ñ╜Ñq¬║▓ú½~íC
  9. ;;;   (ii)  ╕ⁿª│íu¬⌐┼v  (C) 1988-1992  Autodesk ñ╜Ñqív¬║¬⌐┼v│qºiíC
  10. ;;;
  11. ;;;
  12. ;;;
  13. ;;;   AUTODESKñ╜Ñq┤ú¿╤ª╣╡{ªí╢╚¿╤º@íu├■ªⁿív¬║░╤ª╥, ª╙ÑBñú▒╞░úª│Ñ⌠ª≤┐∙╗~¬║
  14. ;;;   Ñi»αíCAUTODESKñ╜Ñq»Sª╣º_╗{Ñ⌠ª≤»S⌐wÑ╬│~ñº╛A║┘⌐╩, ÑHñ╬░╙╖~╛P░Γ⌐╥┴⌠ºt
  15. ;;;   ÑX¿π¬║½O├╥íCAUTODESKñ╜ÑqªP«╔ÑτñúÑX¿πª╣╡{ªí░⌡ªµ«╔ñ@⌐wñú╖|íuññ┬_ív⌐╬
  16. ;;;   íuº╣Ñ■╡L╗~ív¬║½O├╥íC
  17. ;;;
  18. ;;;
  19. ;;;   by Jan S. Yoder
  20. ;;;   29 January 1990
  21.  
  22. ;;;-------------------------------------------------------------------------;
  23. ;;; DESCRIPTION
  24. ;;;
  25. ;;; List all of the aliases found in the file "acad.pgp" if it can be found
  26. ;;; in AutoCAD's search path, which means that they are available in AutoCAD.
  27. ;;; This routine lists them in a two column format, pausing after every 20
  28. ;;; lines.
  29. ;;;
  30. ;;;-------------------------------------------------------------------------;
  31.  
  32. ;;;
  33. ;;; Look for an external definition file in AutoCAD's search path
  34. ;;; al_lfx == Alias_Look_For_Xfile
  35. ;;;
  36. (defun al_lfx (f_name r_or_w /)
  37.   ;; Look for f_name in AutoCAD's search paths.
  38.   (if (= r_or_w "w")
  39.     (if (setq temp (open f_name r_or_w))
  40.       temp                            ; Return file descriptor
  41.       (progn
  42.         (princ (strcat "\n\t╡L¬k╢}▒╥íu" f_name "ívÑH¿╤╝gñJíC "))
  43.         (exit)
  44.       )
  45.     )
  46.     (if (setq lfile (findfile f_name))
  47.       (if (setq temp (open lfile r_or_w))
  48.         temp                          ; Return file descriptor
  49.         (progn
  50.           (princ (strcat "\n\t╡L¬k╢}▒╥íu" f_name "ívÑH¿╤┼¬¿·íC "))
  51.           (exit)
  52.         )
  53.       )
  54.       nil                             ; or nil
  55.     )
  56.   )
  57. )
  58. ;;;
  59. ;;; Print the alias in a two column format, pausing after twenty lines.
  60. ;;;
  61. (defun al_pr1 (/ j al_str c_str tmpstr )
  62.   (setq j      0
  63.         al_str ""
  64.         c_str  ""
  65.   )
  66.   (while (/= (setq tmpstr (substr line (setq j (1+ j)) 1)) ",")
  67.     (if (/= tmpstr " ")
  68.       (setq al_str (strcat al_str tmpstr))
  69.     )
  70.   )
  71.   (while (and (/= (setq tmpstr (substr line (setq j (1+ j)) 1)) "")
  72.               (/= tmpstr ";")
  73.               (/= tmpstr ",")
  74.               (/= tmpstr "\n")
  75.          )
  76.     (if (and (/= tmpstr " ") (/= tmpstr "*") (/= tmpstr "\t"))
  77.       (setq c_str (strcat c_str tmpstr))
  78.     )
  79.   )
  80.   (if (= (strlen c_str) 0) (setq c_str "<Null>"))
  81.   (if (< (strlen al_str) 12)
  82.     (progn
  83.       (repeat (- 12 (strlen al_str)) (setq al_str (strcat al_str  " ")))
  84.     )
  85.   )
  86.   (if (< (strlen c_str) 10)
  87.     (repeat (- 10 (strlen c_str)) (setq c_str (strcat c_str  " ")))
  88.     (setq first T)
  89.   )
  90.   (if first
  91.     (princ (strcat "\n    " al_str "= " c_str ))
  92.     (princ (strcat "\t\t    " al_str "= " c_str ))
  93.   )
  94.   (if (and first (< (strlen c_str) 11))
  95.     (setq lineno (1+ lineno)
  96.            first nil)
  97.     (setq first T)
  98.   )
  99.   (if (and (= lineno 20) first)
  100.     (progn
  101.       (princ "\n\n\t<▒╡ñU¡╢> ")
  102.       (grread)
  103.       (terpri)
  104.       (setq lineno 0)
  105.     )
  106.   )
  107. )
  108. ;;;
  109. ;;; Main function
  110. ;;;
  111. (defun c:alias (/ al_err al_oe s al_oce aliasi lineno first line lfile)
  112.  
  113.   (setq al_ver "1.00a")               ; Reset this local if you make a change.
  114.   ;;
  115.   ;; Internal error handler defined locally
  116.   ;;
  117.   (defun al_err (s)                   ; If an error (such as CTRL-C) occurs
  118.                                       ; while this command is active...
  119.     (if (/= s "Function cancelled")
  120.       (princ (strcat "\n┐∙╗~: " s))
  121.     )
  122.     (if al_oe                         ; If an old error routine exists
  123.       (setq *error* al_oe)            ; then, reset it
  124.     )
  125.     (setq aliasi (close aliasi))
  126.     (setvar "cmdecho" al_oce)         ; Reset command echoing on error
  127.     (princ)
  128.   )
  129.   ;;
  130.   ;; Body of alias function
  131.   ;;
  132.   (if *error*                         ; Set our new error handler
  133.     (setq al_oe *error* *error* al_err)
  134.     (setq *error* al_err)
  135.   )
  136.  
  137.   ;;
  138.   ;; Set command echoing off.
  139.   ;;
  140.   (setq al_oce (getvar "cmdecho"))
  141.   (setvar "cmdecho" 0)
  142.   ;;
  143.   ;; The default file name is "acad.pgp".
  144.   ;; Look for it in AutoCAD's search paths.
  145.   ;;
  146.  
  147.   (setq aliasi (al_lfx "acad.pgp" "r"))
  148.  
  149.   (if aliasi
  150.     (progn
  151.       (setq lineno 0
  152.             first T
  153.       )
  154.       (if textpage (textpage) (textscr))    ; For Release 10
  155.       (princ (strcat
  156.         "\n    ALIAS ¬⌐Ñ╗ " al_ver ", (c) 1990  Autodesk ñ╜Ñq "))
  157.       (princ (strcat
  158.         "\n    ÑHñUªCÑ▄ñºíuºOªWív╗PíuÑ~│í½ⁿÑOív½Y⌐w╕q⌐≤"
  159.         "\n    íu"
  160.                      lfile "ívíC \n"))
  161.       (while (setq line (read-line aliasi))
  162.         ;; Check each line for leading semi-colon
  163.         (if (and (/= (substr line 1 1) ";")     ; Leading semi-colon?
  164.                  (/= (substr line 1 1) "")      ; Blank line?
  165.                  (/= (substr line 1 1) "\n"))   ; Carriage return?
  166.  
  167.           (al_pr1)
  168.         )
  169.       )
  170.       (princ "\n")
  171.       (princ "\n½÷íuÑ⌠╖N┴ΣívÑH¬≡ª^╣╧º╬╡e¡▒íC")
  172.       (grread)
  173.       (princ "\r                                          ")
  174.       (graphscr)
  175.     )
  176.     ;; else
  177.     (progn
  178.       (princ "\nºΣñú¿∞⌐╬╡L¬k┼¬¿·íuacad.pgpív└╔íC ")
  179.     )
  180.   )
  181.   (setq aliasi (close aliasi))
  182.   (if al_oce (setvar "cmdecho" al_oce))
  183.   (princ)
  184. )
  185.  
  186. (princ "\n\tíuC:ALIASívñw╕ⁿñJ; ╜╨ÑH ALIAS ▒╥░╩½ⁿÑOíC")
  187. (princ)
  188.