;;; -*-scheme-*- ;;; Mes --- Maxwell Equations of Software ;;; Copyright © 2016,2017 Jan Nieuwenhuizen ;;; ;;; This file is part of Mes. ;;; ;;; Mes is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; Mes is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with Mes. If not, see . ;;; Commentary: ;;; info.mes defines a record-interface to simplistic list data ;;; structures. ;;; Code: (cond-expand (guile-2) (guile) (mes (mes-use-module (mes optargs)) (mes-use-module (mes pmatch)))) (define ') (define ') (define ') (define ') (define ') (define ') (define ') (define ') (define ') (define ') (define (.types o) (pmatch o (( . ,alist) (assq-ref alist )))) (define (.constants o) (pmatch o (( . ,alist) (assq-ref alist )))) (define (.functions o) (pmatch o (( . ,alist) (assq-ref alist )))) (define (.globals o) (pmatch o (( . ,alist) (assq-ref alist )))) (define (.locals o) (pmatch o (( . ,alist) (assq-ref alist )))) (define (.function o) (pmatch o (( . ,alist) (assq-ref alist )))) (define (.text o) (pmatch o (( . ,alist) (assq-ref alist )))) (define (.break o) (pmatch o (( . ,alist) (assq-ref alist )))) (define (.continue o) (pmatch o (( . ,alist) (assq-ref alist )))) (define (info? o) (and (pair? o) (eq? (car o) ))) (define* (make o #:key (types '()) (constants '()) (functions '()) (globals '()) (locals '()) (function #f) (text '()) (break '()) (continue '())) (pmatch o ( (list (cons types) (cons constants) (cons functions) (cons globals) (cons locals) (cons function) (cons text) (cons break) (cons continue))))) (define (make-type type size pointer description) (list 'type* type size pointer description)) (define (type? o) (and (pair? o) (eq? (car o) 'type*))) (define type:type cadr) (define type:size caddr) (define type:pointer cadddr) (define caddddr (compose cadddr cdr)) (define type:description caddddr) (define (make-global type pointer value) (list 'global* type pointer value)) (define (global? o) (and (pair? o) (eq? (car o) 'global*))) (define global:type cadr) (define global:pointer caddr) (define global:value cadddr) (define (make-local type pointer id) (list 'local* type pointer id)) (define (local? o) (and (pair? o) (eq? (car o) 'local*))) (define local:type cadr) (define local:pointer caddr) (define local:id cadddr)