ERR.lsp — Dialog Input Validation & Error Display¶
Module: err.lsp
Version: v3.60
Category: Core Application
Complexity: Low
Size: 1.0 KB (15 lines)
Note
Dual-Purpose Module
Despite its name, err.lsp serves two functions:
Input Validation - Real-time validation of dialog input fields with auto-correction
Error Display - Formatted error message presentation to users
This module is called by dialog validation routines and is NOT the main error handler (that’s a separate error trap system).
Overview¶
Purpose¶
The err function validates user input in dialog fields and displays formatted error/validation messages. It automatically corrects dimension values, highlights invalid fields, and presents user-friendly error messages.
Role in CSV 3.60 Architecture¶
Position in Call Chain:
User enters data in dialog field
?
Field validation routine
?
(err) ? THIS MODULE
?
Field highlighted (red border)
Value auto-corrected (if applicable)
Error message displayed (if needed)
Used By:
rangchck.lsp- Range validationchrchk.lsp- Character validationAll
*_dlg.lspfiles - Dialog input validation
Function Documentation¶
(err)¶
Signature:
(defun err ()
; Uses global variables: ke, k, v, v2, ks, msg, msg1, msg2
; Returns: nil (princ)
)
Purpose: Validates input field, auto-corrects dimensions, highlights errors, and displays messages.
Algorithm:
Field Highlighting:
Set field
keto mode 3 (red border/error state)Display corrected value
v2in field
Dimension Auto-Correction:
Mix Profile special case: If field starts with “mpm”, multiply by 4
Standard case: If secondary field
ksexists, multiply by 8Updates secondary dimension field automatically
Error Message Display:
If not a secondary field (doesn’t end with “s”):
Center the value
vin a 42-character widthFormat message:
[[ value ]]centeredDisplay alert with formatted message
Source Code¶
File Location: src/x86/v3_60/v3.60/err.lsp
Full Source (15 lines):
(defun err ()
(mode_tile ke 3)
(set_tile ke v2)
(if (= (substr k 1 3) "mpm")
(set_tile ks (rtos (* 4 (distof (substr v2 1 (1- (strlen v2))))) 5 2))
(if (and ks (get_tile ks))
(set_tile ks (rtos (* 8 (distof v2)) 5 2))))
(if (/= (substr k (strlen k)) "s")
(progn (set 'fil " ")
(set 'len (/ (- 42 (strlen v)) 2))
(while (> len 0) (set 'len (1- len)) (set 'fil (strcat fil " ")))
(set 'msg (strcat msg "\n\n" fil "[ " v " ]" fil "\n\n" msg1 msg2))
(alert msg)))
(princ))
Global Variables Used¶
Input (Read-Only)¶
k- Current field key/name being validatedke- Error field key (field to highlight)v- Original invalid value entered by userv2- Corrected value to displayks- Secondary/related field key (for dimension pairs)msg- Primary error message textmsg1- Secondary message line 1msg2- Secondary message line 2
Modified¶
fil- Temporary: padding/fill string for centeringlen- Temporary: calculated padding length
Dimension Scaling Rules¶
Mix Profile (mpm prefix)¶
Rule: Multiply by 4
Purpose: Likely converts between measurement units or scales
Input: 6 ? Output: 24
Possibly: inches to quarter-inches?
Or: single unit to distributed spacing?
Standard Fields¶
Rule: Multiply by 8
Purpose: Likely imperial fraction conversion
Input: 0.5 ? Output: 4.00
Possibly: inches to 1/8” increments?
Or: engineering units to fabrication units?
Document Metadata¶
Status: Comprehensive analysis from source code
Last Updated: 2026-01-20
Analysis Method: Source code review + validation pattern analysis
Completeness: 90% (scaling factor purpose inferred)
End of Document