home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / autocad / magic20.arj / ED.TXT < prev    next >
Text File  |  1991-10-02  |  6KB  |  170 lines

  1. ;;;**************************************************************************
  2. ;;;   ED.TXT
  3. ;;;   (C) 1991 by Walt Craig
  4. ;;;
  5. ;;;   A part of the 
  6. ;;;           MAGIC LISP -- AutoLISP ADS Function Library
  7. ;;; 
  8. ;;;   Conceived and implemented by:
  9. ;;;           Walt Craig 
  10. ;;;           May/June 1991
  11. ;;;
  12. ;;;**************************************************************************
  13. ;;;   Permission to use, copy, modify, and distribute this software and its    
  14. ;;;   documentation for the purpose of creating applications for AutoCAD, is   
  15. ;;;   hereby granted in accordance with the terms of the stated during
  16. ;;;   installation.
  17. ;;;                                                                            
  18. ;;;**************************************************************************
  19. ;;;                                                                            
  20. ;;;   WALT CRAIG PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. WALT CRAIG    
  21. ;;;   SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR       
  22. ;;;   FITNESS FOR A PARTICULAR USE.  WALT CRAIG DOES NOT WARRANT THAT       
  23. ;;;   THE OPERATION OF THE PROGRAM WILL BE UNNINTERRUPTED OR ERROR FREE.     
  24. ;;;                                                                           
  25. ;;;**************************************************************************
  26. ;;;                                                                           
  27. ;;;                        RESTRICTED RIGHTS LEGEND                          
  28. ;;;                                                                           
  29. ;;;   Use, duplication, or disclosure by the U.S. Government is subject        
  30. ;;;   to restrictions set forth in FAR 52.227-19 (Commerical Computer          
  31. ;;;   Software - Restricted Rights) and DFAR 252.227-7013 (c) (1) (ii)         
  32. ;;;   (Rights in Technical Data and Computer Software), as applicable.         
  33. ;;;                                                                           
  34. ;;;**************************************************************************
  35. ;;;   
  36. ;;; DESCRIPTION
  37. ;;;
  38. ;;;   ED.TXT is a sample program which illustrates the use of
  39. ;;;   various MAGIC functions. 
  40. ;;;   
  41. ;;;   This program will prompt the user for a lisp file to edit. If the
  42. ;;;   file is found, an editor is called upon passing the lisp file
  43. ;;;   (no extension) to it.
  44. ;;;   
  45. ;;;   Important: This is currently set up for the 'BREIF'editor. You will
  46. ;;;   have to modify the call to your specific editor with the name
  47. ;;;   specified in your ACAD.PGP file.
  48. ;;;   
  49. ;;;   (load "ed")
  50. ;;;   ed
  51. ;;;
  52. ;;;*************************************************************************
  53. ;;;* A simple edit loader for lisp ...  modify it as you see fit.          *
  54. ;;;*****************************    Variables    ***************************
  55. (defun c:ed(/ file lst temp ret dbtest flag strings)
  56. (if WC_
  57.   (progn
  58.      (setq dbtest (strcat "WC" "_"))
  59.      (if(eval(read dbtest)) ;Is this the _debug_ version?
  60.         (c:clear);This helps if your doing a lot of KIT programming
  61.      )
  62.      (if(/= (WC_ ".VERSION") "I V1.5")
  63.         (progn
  64.            (princ "\nIncompatible SPEED-KIT's");
  65.            (grread)
  66.            (quit)
  67.         )
  68.      )
  69.      (setvar "cmdecho" 0)
  70.      (textscr)
  71.      (if (/= (cadr (WC_ ".GETMODE")) 7)
  72.      (WC_ ".SETCOLORS"
  73.           (list
  74.                 _WHITE                  ;forward text color
  75.                 _BLUE ;<<--- FOR CLS    ;background color
  76.                 _RED                    ;border background color
  77.                 _GREEN                  ;border text color
  78.                 _BLACK                  ;hilited text color
  79.                 _CYAN                   ;hilited background color
  80.           )
  81.      ))
  82.      (setq 
  83.         _F1            15104
  84.         _F10           17408
  85.         _ESCKEY        283
  86.         _ENTER         7181
  87.         _CANCEL        11779
  88.         _SPACE         14624
  89.      )
  90.      (WC_ ".CLS")
  91.      (WC_ ".SETNUMERIC" 0)
  92.      (WC_ ".SETSPEED" 50)
  93.      (WC_ ".WINDOW" 10 12 65 14 1 1)
  94.      (WC_ ".RELATIVE" 1)
  95.      (WC_ ".DISPLAY" 1 1 "Enter file name: ")
  96.      (WC_ ".TITLE" 0 " Lisp Editor Loader ");
  97.      (WC_ ".TITLE" 1 " ENTER or SPACE ");
  98.      (WC_ ".SETUPBOX" 28 13 63 13)
  99.      (WC_ ".SETDENYS" (list _ENTER _ESCKEY _CANCEL _SPACE))
  100.      (WC_ ".CLEANUP"); Forces the editor to exept box not window..!
  101.      (setq strings '("") flag 't)
  102.      (if #edfil 
  103.         (setq lst (list #edfil));Existing file
  104.         (setq lst (list ""))    ;New file 
  105.      )
  106.      (while flag
  107.         (setq ret(WC_ ".EDIT" lst)
  108.            strings(cdr ret)
  109.            ret (car ret) 
  110.         )
  111.         (if (or(= ret _ESCKEY)(= ret _CANCEL))
  112.            (setq flag nil)
  113.         )
  114.         (if (/= (nth 0 strings) "")
  115.            (setq flag nil)
  116.         )
  117.      )
  118.      (WC_ ".CLS")
  119.      (if (or(= ret _ENTER)(= ret _SPACE))
  120.         (progn
  121.            (setq temp (nth 0 strings))
  122.            (if(= temp #edfil)
  123.               (command "B" ""); This is because brief remembers!
  124. ;                       ^
  125. ;                       |_________________ YOU'ELL NEED TO MODIFY
  126. ;                                          THIS SECTION TO FIT YOUR
  127. ;                                          NEEDS.
  128.               (progn
  129.                  (setq #edfil temp)
  130.                  (command "B" (strcat #edfil ".lsp"));
  131.               )
  132.            )
  133.            (if (not (findfile (strcat #edfil ".lsp")))
  134.               (progn
  135.                  (WC_ ".MESSAGE" (strcat "File: " #edfil ".lsp not found!") 1)
  136.               )
  137.               (progn
  138.                  (command(load #edfil))
  139.                  (WC_ ".MESSAGE" (strcat "The file "#edfil" has been reloaded.") 1)
  140.               )
  141.            )
  142.         )
  143.         (WC_ ".CLS")
  144.      )
  145.   )
  146.   (progn
  147.      (princ "\nNo SPEED-KIT FOUND!");
  148.   )
  149. )
  150. (prin1)
  151. )
  152.  
  153. (if (not WC_)
  154.   (progn
  155.      (xload "_DEBUG_")
  156.      (if (/= (setq str(WC_ ".VERSION")) "I V1.5")
  157.         (progn
  158.            (princ "\nIncompatable SPEED-KIT version!");
  159.            (xunload "_DEBUG_");
  160.         )
  161.         (eval(read(WC_ ".WCINIT")))
  162.      )
  163.   )
  164.   (progn
  165.      (WC_ ".message" " Type 'ED' to start " 0)
  166.      (eval(read(WC_ ".WCINIT")))
  167.   )
  168. )
  169. (prin1)
  170.