aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Hansen2022-06-02 16:33:16 -0400
committerLars Ingebrigtsen2022-06-10 11:53:32 +0200
commit0afaf53c6ed2c2e915dbe87f062ce851b3f48dce (patch)
tree007c1833c76f2820e7399e839bdbc60ca8056fd1
parentc7037219b025ea7a53fc57528eaf5e41511f1e92 (diff)
downloademacs-0afaf53c6ed2c2e915dbe87f062ce851b3f48dce.tar.gz
emacs-0afaf53c6ed2c2e915dbe87f062ce851b3f48dce.zip
; bindat (bindat--length-group): Fix indentation
-rw-r--r--lisp/emacs-lisp/bindat.el132
1 files changed, 66 insertions, 66 deletions
diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el
index 760c86feb41..5f3c772983a 100644
--- a/lisp/emacs-lisp/bindat.el
+++ b/lisp/emacs-lisp/bindat.el
@@ -320,72 +320,72 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..."
320(defun bindat--length-group (struct spec) 320(defun bindat--length-group (struct spec)
321 (if (cl-typep spec 'bindat--type) 321 (if (cl-typep spec 'bindat--type)
322 (funcall (bindat--type-le spec) struct) 322 (funcall (bindat--type-le spec) struct)
323 (with-suppressed-warnings ((lexical struct last)) 323 (with-suppressed-warnings ((lexical struct last))
324 (defvar struct) (defvar last)) 324 (defvar struct) (defvar last))
325 (let ((struct struct) last) 325 (let ((struct struct) last)
326 (dolist (item spec) 326 (dolist (item spec)
327 (let* ((field (car item)) 327 (let* ((field (car item))
328 (type (nth 1 item)) 328 (type (nth 1 item))
329 (len (nth 2 item)) 329 (len (nth 2 item))
330 (vectype (and (eq type 'vec) (nth 3 item))) 330 (vectype (and (eq type 'vec) (nth 3 item)))
331 (tail 3)) 331 (tail 3))
332 (if (and type (consp type) (eq (car type) 'eval)) 332 (if (and type (consp type) (eq (car type) 'eval))
333 (setq type (eval (car (cdr type)) t))) 333 (setq type (eval (car (cdr type)) t)))
334 (if (and len (consp len) (eq (car len) 'eval)) 334 (if (and len (consp len) (eq (car len) 'eval))
335 (setq len (eval (car (cdr len)) t))) 335 (setq len (eval (car (cdr len)) t)))
336 (if (memq field '(eval fill align struct union)) 336 (if (memq field '(eval fill align struct union))
337 (setq tail 2 337 (setq tail 2
338 len type 338 len type
339 type field 339 type field
340 field nil)) 340 field nil))
341 (if (and (consp field) (eq (car field) 'eval)) 341 (if (and (consp field) (eq (car field) 'eval))
342 (setq field (eval (car (cdr field)) t))) 342 (setq field (eval (car (cdr field)) t)))
343 (if (and (consp len) (not (eq type 'eval))) 343 (if (and (consp len) (not (eq type 'eval)))
344 (setq len (apply #'bindat-get-field struct len))) 344 (setq len (apply #'bindat-get-field struct len)))
345 (if (not len) 345 (if (not len)
346 (setq len 1)) 346 (setq len 1))
347 (while (eq type 'vec) 347 (while (eq type 'vec)
348 (if (consp vectype) 348 (if (consp vectype)
349 (setq len (* len (nth 1 vectype)) 349 (setq len (* len (nth 1 vectype))
350 type (nth 2 vectype)) 350 type (nth 2 vectype))
351 (setq type (or vectype 'u8) 351 (setq type (or vectype 'u8)
352 vectype nil))) 352 vectype nil)))
353 (pcase type 353 (pcase type
354 ('eval 354 ('eval
355 (if field 355 (if field
356 (setq struct (cons (cons field (eval len t)) struct)) 356 (setq struct (cons (cons field (eval len t)) struct))
357 (eval len t))) 357 (eval len t)))
358 ('fill 358 ('fill
359 (setq bindat-idx (+ bindat-idx len))) 359 (setq bindat-idx (+ bindat-idx len)))
360 ('align 360 ('align
361 (setq bindat-idx (bindat--align bindat-idx len))) 361 (setq bindat-idx (bindat--align bindat-idx len)))
362 ('struct 362 ('struct
363 (bindat--length-group 363 (bindat--length-group
364 (if field (bindat-get-field struct field) struct) (eval len t))) 364 (if field (bindat-get-field struct field) struct) (eval len t)))
365 ('repeat 365 ('repeat
366 (dotimes (index len) 366 (dotimes (index len)
367 (bindat--length-group 367 (bindat--length-group
368 (nth index (bindat-get-field struct field)) 368 (nth index (bindat-get-field struct field))
369 (nthcdr tail item)))) 369 (nthcdr tail item))))
370 ('union 370 ('union
371 (with-suppressed-warnings ((lexical tag)) 371 (with-suppressed-warnings ((lexical tag))
372 (defvar tag)) 372 (defvar tag))
373 (let ((tag len) (cases (nthcdr tail item)) case cc) 373 (let ((tag len) (cases (nthcdr tail item)) case cc)
374 (while cases 374 (while cases
375 (setq case (car cases) 375 (setq case (car cases)
376 cases (cdr cases) 376 cases (cdr cases)
377 cc (car case)) 377 cc (car case))
378 (if (or (equal cc tag) (equal cc t) 378 (if (or (equal cc tag) (equal cc t)
379 (and (consp cc) (eval cc t))) 379 (and (consp cc) (eval cc t)))
380 (progn 380 (progn
381 (bindat--length-group struct (cdr case)) 381 (bindat--length-group struct (cdr case))
382 (setq cases nil)))))) 382 (setq cases nil))))))
383 (_ 383 (_
384 (if (setq type (assq type bindat--fixed-length-alist)) 384 (if (setq type (assq type bindat--fixed-length-alist))
385 (setq len (* len (cdr type)))) 385 (setq len (* len (cdr type))))
386 (if field 386 (if field
387 (setq last (bindat-get-field struct field))) 387 (setq last (bindat-get-field struct field)))
388 (setq bindat-idx (+ bindat-idx len))))))))) 388 (setq bindat-idx (+ bindat-idx len)))))))))
389 389
390(defun bindat-length (spec struct) 390(defun bindat-length (spec struct)
391 "Calculate `bindat-raw' length for STRUCT according to bindat SPEC." 391 "Calculate `bindat-raw' length for STRUCT according to bindat SPEC."