;;;October 19, 2004 added function chkkwds (see description at end of file) ;* UPOINT User interface point function ;* BIT (1 for no null, 0 for none) and KWD key word ("" for none) are same as ;* for INITGET. MSG is the prompt string, to which a default point variable ;* is added as (nil for none), and a : is added. BPT is base point ;* (nil for none). ;* (defun upoint (bit kwd msg def bpt / inp) (if def (if (eq (type def) 'STR) (setq msg (strcat "\n" msg " <" def ">:") bit (* 2 (fix (/ bit 2))) ) (progn (setq pts (strcat (rtos (car def)) "," (rtos (cadr def)) (if (and (caddr def) (= 0 (getvar "FLATLAND"))) (strcat "," (rtos (caddr def))) "" ) );if&strcat msg (strcat "\n" msg " <" pts ">: ") bit (* 2 (fix (/ bit 2))) ) ) ) (setq msg (strcat "\n" msg ": ")) );if a default was supplied (initget bit kwd) (setq inp (if bpt (getpoint msg bpt) (getpoint msg) ) );setq&if (if inp inp def) );defun ;* (princ) ;* ;;;This function alerts the user when keywords containing invalid characters are used and it will ;;;identify and disable the offending keywords leaving the remaining keywords enabled. (DEFUN chkkwds (kwd /) (SETQ invalidcharlst (LIST "_" "!" "@" "$" "%" "^" "&" "`" "(" ")" "*" "+" "=" "<" ">")) (IF (OR (WCMATCH kwd "*_*") (WCMATCH kwd "*`!*") (WCMATCH kwd "*`@*") (WCMATCH kwd "*`$*") (WCMATCH kwd "*`%*") (WCMATCH kwd "*`^*") (WCMATCH kwd "*`&*") (WCMATCH kwd "*`**") (WCMATCH kwd "*(*") (WCMATCH kwd "*)*") (WCMATCH kwd "*+*") (WCMATCH kwd "*=*") (WCMATCH kwd "*<*") (WCMATCH kwd "*>*") ) ;_ end of OR (PROGN (PRINC "\nInvalid characters in keyword specification!") (PRINC "\nAttempting to disable invalid keywords.") (PRINC) (SETQ stripkwd kwd kwdcnt 1 charposlst NIL ) ;_ end of setq (WHILE (AND stripkwd (<= kwdcnt (STRLEN kwd))) (IF (MEMBER (SUBSTR stripkwd kwdcnt 1) invalidcharlst) (IF charposlst (SETQ charposlst (APPEND charposlst (LIST kwdcnt))) (SETQ charposlst (LIST kwdcnt)) ) ;_ end of if ) ;_ end of if (SETQ kwdcnt (1+ kwdcnt)) ) ;_ end of while (FOREACH n charposlst (COND ((OR (WCMATCH (SUBSTR kwd 1 n) "* *") (WCMATCH (SUBSTR kwd n) "* *")) (SETQ inicnt n) (WHILE (/= (SUBSTR kwd (1- inicnt) 1) " ") (SETQ inicnt (1- inicnt))) (SETQ endcnt inicnt) (WHILE (AND (/= endcnt (1- (STRLEN kwd))) (/= (SUBSTR kwd (1+ endcnt) 1) " ")) (SETQ endcnt (1+ endcnt)) ) ;_ end of WHILE (SETQ remcnt inicnt remend endcnt ) ;_ end of SETQ (WHILE (<= inicnt endcnt) (SETQ kwd (STRCAT (SUBSTR kwd 1 (1- inicnt)) " " (SUBSTR kwd (1+ inicnt)))) (SETQ inicnt (1+ inicnt)) ) ;_ end of WHILE (PRINC (STRCAT "\nKeyword " (SUBSTR stripkwd remcnt (- endcnt remcnt -1)) " is disabled! ")) (PRINC) ) ) ;_ end of COND ) ;_ end of FOREACH (PRINC "\nOmit invalid keyword characters at source to enable these keywords. ") (PRINC) ) ;_ end of PROGN ) ;_ end of IF ) ;_ end of DEFUN