(de Ssz ( s )
 # Return total size of Structure Descriptor List ('struct parameter) 's
 (case s
  ( I  4)
  ( W  2)
  ( ( C B ) 1 )
  ( ( S P N ) 8 )
  (T
   (if (and (lst? s)
            (atom (car s))
            (atom (cdr s))        
       )
    (* (Ssz (car s)) (cdr s))
    (let
     (tot 0)
     (when (atom s)
      (throw (pack "C~struct_sz: Unrecognized Atom: " s))
     )
     (prog
      (for m s
       (inc 'tot (Ssz m))
      )
      tot
     )
    )
   )
  )
 )
)
(de struct_sz ( s )
 (Ssz s)
)
(de carsz ( strct l )
 (if (or (not (lst? l)) (not (lst? strct)))
  NIL
  (let
   (rl  NIL
    rlt NIL
    s   NIL
    m   NIL
    eat 0
    res '(( n )
          (if (not (bool rlt))
           (setq rlt (setq rl (cons n)))
           (setq rlt (con rlt (cons n)))
          )
         )
   )
   (loop
    (prog
     (setq s (car strct))
     (setq m (car l))
     (if (and (lst? s)
          (atom (car s))
          (atom (cdr s))        
         ) 
      (let
       ( sf (car s)
         sn (cdr s)
        ssz (Ssz (car s))
       )
       (if (lst? m) 
        (if (= sn (length m))   
         (if (= s 'S)           
          (for x m 
           (res (cons (%@ "strdup" 'P x) 8))
          )
          (for x m 
           (res (cons x ssz))
          )
         )
         (throw (pack "carsz: " "Argument " (sym m) " does not match: " (sym s)))
        )
        (if (< (length l) sn)
         (throw (pack "carsz: " "Insufficient Arguments '" (sym l)  "' for: " (sym s)))
         (prog
          (setq eat sn)
          (if (= s 'S)
           (for n (head sn l)
            (res (cons (%@ "strdup" 'P n) 8))
           )
           (for n (head sn l)
            (res (cons n ssz))
           )
          )
         )
        )       
       )
      )
      (if (lst? s)
       (for rs (carsz s l)
        (res rs)
       )
       (if (lst? m)
        (throw (pack "List member " (sym m) " cannot match " (sym s)))
        (res (if (= s 'S) (cons (%@ "strdup" 'P m) 8) (cons m (Ssz s))))
       )
      )
     )
     (when (gt0 eat)
      (loop (setq l (cdr l)) (NIL l) (T (<= 0 (dec 'eat))))
     )     
    )
    (NIL 
     (and
      (setq strct (cdr strct))
      (setq l (cdr l))
     )
     rl
    )
   )
  )  
 )
)
