(DEFUN C:LSPCOMP () (SETQ FILE_01 (GETFILED "Open 1st comparison file" (IF FILE_01 FILE_01 ;;; (CADR (DOS_SPLITPATH FILE_01)) "L:\\Util\\Lsp\\" ) ;_ end of IF "*" 4 ) ;_ end of GETFILED ) ;_ end of SETQ (SETQ FILE_02 (GETFILED "Open 2nd comparison file" (IF FILE_02 FILE_02 ;;; (CADR (DOS_SPLITPATH FILE_02)) "L:\\Util\\Lsp\\" ) ;_ end of IF "*" 4 ) ;_ end of GETFILED ) ;_ end of SETQ (SETQ line_cnt_01 1) (SETQ line_cnt_02 1) (SETQ do_compare T) (IF (AND FILE_01 FILE_02) (PROGN (SETQ OPENED_01 (OPEN FILE_01 "r")) (SETQ OPENED_02 (OPEN FILE_02 "r")) (SETQ read_01 (READ-LINE OPENED_01)) (strip_spaces_01) (SETQ read_02 (READ-LINE OPENED_02)) (strip_spaces_02) (IF (AND OPENED_01 OPENED_02) (PROGN (WHILE do_compare (COND ((EQ read_01 read_02) (SETQ line_cnt_01 (1+ line_cnt_01)) (SETQ line_cnt_02 (1+ line_cnt_02)) (SETQ read_01 (READ-LINE OPENED_01)) (strip_spaces_01) (SETQ read_02 (READ-LINE OPENED_02)) (strip_spaces_02) (IF (AND read_01 read_02) nil (SETQ do_compare NIL))) ((NOT (EQ read_01 read_02)) (PRINC (STRCAT "\n *** Contents differ at line " (ITOA line_cnt_01) " of FILE_01. ")) (PRINC (STRCAT "\n *** Line " (ITOA line_cnt_01) " of FILE_01 is:\n")) (PRINC read_01) (PRINC " ...and\n") (PRINC read_02) (PRINC " ...is\n") (PRINC (STRCAT " *** Line " (ITOA line_cnt_02) " of FILE_02.\n")) (SETQ read_ahead (uint 1 "Both Quit" " Read ahead in file no. [1, 2, Both or Quit]" (IF (AND read_ahead (EQ (TYPE read_ahead) 'INT)) read_ahead 1 ) ;_ end of IF ) ;_ end of uint ) ;_ end of SETQ (COND ((EQ read_ahead 1) (SETQ read_01 (READ-LINE OPENED_01) line_cnt_01 (1+ line_cnt_01) ) ;_ end of SETQ (strip_spaces_01) ) ((EQ read_ahead 2) (SETQ read_02 (READ-LINE OPENED_02) line_cnt_02 (1+ line_cnt_02) ) ;_ end of SETQ (strip_spaces_02) ) ((EQ read_ahead "Both") (SETQ read_01 (READ-LINE OPENED_01) read_02 (READ-LINE OPENED_02) line_cnt_01 (1+ line_cnt_01) line_cnt_02 (1+ line_cnt_02) ) ;_ end of SETQ (strip_spaces_01) (strip_spaces_02) ) ((EQ read_ahead "Quit") (SETQ do_compare nil)) ) ;_ end of COND (IF (AND read_01 read_02) nil (SETQ do_compare NIL)) ) ) ;_ end of COND ) ;_ end of WHILE (IF do_compare nil (PRINC "\nComparison Quit by user! ") ) ;_ end of IF ) ;_ end of PROGN (PRINC "\nOne or both lisp files could not be opened for reading! ") ) ;_ end of IF ) ;_ end of PROGN (PRINC "\nOne or both lisp files were not found! ") ) ;_ end of IF (IF OPENED_01 (CLOSE OPENED_01)) (IF OPENED_02 (CLOSE OPENED_02)) (PRINC) ) ;_ end of DEFUN (defun strip_spaces_01 () (IF (AND read_01 (EQ (TYPE read_01) 'STR)) (WHILE (WCMATCH read_01 " *") (SETQ read_01 (SUBSTR read_01 2)) ) ) (IF (AND read_01 (EQ (TYPE read_01) 'STR)) (WHILE (WCMATCH read_01 "* ") (SETQ read_01 (SUBSTR read_01 1 (1-(STRLEN read_01)))) ) ) (princ) ) (defun strip_spaces_02 () (IF (AND read_02 (EQ (TYPE read_02) 'STR)) (WHILE (WCMATCH read_02 " *") (SETQ read_02 (SUBSTR read_02 2)) ) ) (IF (AND read_02 (EQ (TYPE read_02) 'STR)) (WHILE (WCMATCH read_02 "* ") (SETQ read_02 (SUBSTR read_02 1 (1-(STRLEN read_02)))) ) ) (princ) ) (princ) ;|«Visual LISP© Format Options» (120 2 15 2 T "end of " 100 9 2 0 nil nil nil T T) ;*** DO NOT add text below the comment! ***|;