From 47e02ec9033997a6e8811ad97a29226d03591b40 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 6 Feb 2023 20:52:35 -0500 Subject: Even more renaming. --- chickadee/graphics/seagull.scm | 80 +++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/chickadee/graphics/seagull.scm b/chickadee/graphics/seagull.scm index d5515be..8e3c613 100644 --- a/chickadee/graphics/seagull.scm +++ b/chickadee/graphics/seagull.scm @@ -290,13 +290,13 @@ (define (expand:values exps stage env) `(values ,@(expand:list exps stage env))) -(define (expand:-> exp members stage env) +(define (expand:-> exp fields stage env) (define exp* (expand exp stage env)) - (match members - ((member . rest) - (let loop ((members rest) - (prev `(struct-ref ,exp* ,member))) - (match members + (match fields + ((field . rest) + (let loop ((fields rest) + (prev `(struct-ref ,exp* ,field))) + (match fields (() prev) ((next . rest) (loop `(struct-ref ,prev ,next) @@ -538,8 +538,8 @@ (propagate-constants arg env)) args))) -(define (propagate:struct-ref exp member env) - `(struct-ref ,(propagate-constants exp env) ,member)) +(define (propagate:struct-ref exp field env) + `(struct-ref ,(propagate-constants exp env) ,field)) ;; The division of two integers can result in a rational, non-integer, ;; such as 1/2. This isn't how integer division works in GLSL, so we @@ -591,8 +591,8 @@ (propagate:primcall operator args env)) (('call operator args ...) (propagate:call operator args env)) - (('struct-ref exp member) - (propagate:struct-ref exp member env)) + (('struct-ref exp field) + (propagate:struct-ref exp field env)) (('outputs (names exps) ...) (propagate:outputs names exps env)) (('top-level inputs body) @@ -654,7 +654,7 @@ ((or ('primcall _ args ...) ('call args ...)) (check-free-variables-in-list args bound-vars top-level-vars)) - (('struct-ref exp member) + (('struct-ref exp _) (check-free-variables exp bound-vars top-level-vars)) (('outputs (names exps) ...) (check-free-variables-in-list exps bound-vars top-level-vars)) @@ -729,9 +729,9 @@ (define-values (args* args-env) (hoist:list args)) (values `(call ,@args*) args-env)) -(define (hoist:struct-ref exp member) +(define (hoist:struct-ref exp field) (define-values (exp* exp-env) (hoist-functions exp)) - (values `(struct-ref ,exp* ,member) exp-env)) + (values `(struct-ref ,exp* ,field) exp-env)) (define (hoist:top-level inputs body) (define-values (body* body-env) @@ -824,8 +824,8 @@ (eq? obj type:outputs)) ;; Struct type: -(define (struct-type name members) - `(struct ,name ,members)) +(define (struct-type name fields) + `(struct ,name ,fields)) (define (struct-type? obj) (match obj @@ -836,12 +836,12 @@ (match type (('struct name _) name))) -(define (struct-type-members type) +(define (struct-type-fields type) (match type - (('struct _ members) members))) + (('struct _ fields) fields))) -(define (struct-type-ref type member) - (assq-ref (struct-type-members type) member)) +(define (struct-type-ref type field) + (assq-ref (struct-type-fields type) field)) (define-syntax-rule (define-struct-type (var-name name) (types names) ...) (define var-name (struct-type 'name (list (cons 'names types) ...)))) @@ -1109,8 +1109,8 @@ (predicate:substitute from to))) subs))) -(define (predicate:struct-has? struct member var) - `(struct-has? ,struct ,member ,var)) +(define (predicate:struct-has? struct field var) + `(struct-has? ,struct ,field ,var)) (define (compose-predicates a b) (cond @@ -1151,9 +1151,9 @@ (('substitute a b) `(substitute ,(apply-substitution-to-type a from to) ,(apply-substitution-to-type b from to))) - (('struct-has? struct member var) + (('struct-has? struct field var) `(struct-has? ,(apply-substitution-to-type struct from to) - ,member + ,field ,var)))) (define (apply-substitutions-to-predicate pred subs) @@ -1316,11 +1316,11 @@ ;; carried forward in the inference process. (('substitute a b) (values #t (list (cons a b)))) - ;; Substitute the member var when struct has been resolved to a + ;; Substitute the field var when struct has been resolved to a ;; struct type. - (('struct-has? struct member member-var) + (('struct-has? struct field field-var) (if (struct-type? struct) - (values #t (list (cons member-var (struct-type-ref struct member)))) + (values #t (list (cons field-var (struct-type-ref struct field)))) (values pred '()))))) (define (eval-predicate* pred subs) @@ -1402,7 +1402,7 @@ (('substitute a b) (append (free-variables-in-type a) (free-variables-in-type b))) - (('struct-has? struct member var) + (('struct-has? struct field var) (append (free-variables-in-type struct) (free-variables-in-type var))))) @@ -1673,16 +1673,16 @@ combined-subs pred)) -(define (infer:struct-ref exp member env) +(define (infer:struct-ref exp field env) (define-values (exp* exp-subs exp-pred) (infer-exp exp env)) (define exp-type (single-type exp*)) (define tvar (fresh-variable-type)) (values (texp (list tvar) - `(struct-ref ,exp* ,member)) + `(struct-ref ,exp* ,field)) exp-subs (compose-predicates exp-pred - (predicate:struct-has? exp-type member tvar)))) + (predicate:struct-has? exp-type field tvar)))) (define (infer:let names exps body env) (define-values (exps* exp-subs exp-pred) @@ -1806,8 +1806,8 @@ (infer:primitive-call operator args env)) (('call operator args ...) (infer:call operator args env)) - (('struct-ref exp member) - (infer:struct-ref exp member env)) + (('struct-ref exp field) + (infer:struct-ref exp field env)) (('outputs (names exps) ...) (infer:outputs names exps env)) (('top-level bindings body) @@ -2037,12 +2037,12 @@ (list (list (cons from to)))) (('= a b) (list (list (cons a b)))) - (('struct-has? struct-var member member-var) + (('struct-has? struct-var field field-var) (filter-map (lambda (struct) - (let ((member-type (struct-type-ref struct member))) - (and member-type + (let ((field-type (struct-type-ref struct field))) + (and field-type (list (cons struct-var struct) - (cons member-var member-type))))) + (cons field-var field-type))))) structs)) (('or preds ...) (concatenate (map (lambda (pred) @@ -2287,7 +2287,7 @@ ", ")) output-temps) -(define (emit:struct-ref type exp member version port level) +(define (emit:struct-ref type exp field version port level) (define input-temp (match (emit-glsl exp version port level) ((temp) temp))) @@ -2297,7 +2297,7 @@ (type-name type) output-temp input-temp - member) + field) (list output-temp)) (define %type-name-map @@ -2358,8 +2358,8 @@ (emit:primcall type op args version port level)) (('t types ('call operator args ...)) (emit:call types operator args version port level)) - (('t (type) ('struct-ref exp member)) - (emit:struct-ref type exp member version port level)) + (('t (type) ('struct-ref exp field)) + (emit:struct-ref type exp field version port level)) (('t _ ('outputs (names exps) ...)) (emit:outputs names exps version port level)) (('t _ ('top-level (bindings ...) body)) -- cgit v1.2.3