/[movitz]/ia-x86/symtab.lisp
ViewVC logotype

Contents of /ia-x86/symtab.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Tue Feb 10 00:04:19 2004 UTC (10 years, 2 months ago) by ffjeld
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +4 -4 lines
Designate the ia-x86 package with #:ia-x86 rather than "IA-X86".
Also, a few very minor edits.
1 ;;;;------------------------------------------------------------------
2 ;;;;
3 ;;;; Copyright (C) 2000, 2004,
4 ;;;; Department of Computer Science, University of Tromso, Norway
5 ;;;;
6 ;;;; Filename: symtab.lisp
7 ;;;; Description: Assembly symbolic lookups.
8 ;;;; Author: Frode Vatvedt Fjeld <frodef@acm.org>
9 ;;;; Created at: Tue Aug 22 10:01:38 2000
10 ;;;; Distribution: See the accompanying file COPYING.
11 ;;;;
12 ;;;; $Id: symtab.lisp,v 1.3 2004/02/10 00:04:19 ffjeld Exp $
13 ;;;;
14 ;;;;------------------------------------------------------------------
15
16 (in-package #:ia-x86)
17
18 ;;; A symtab is a stack-organized list of "frames", where each frame
19 ;;; is a hash-table.
20
21 (define-condition unresolved-labels ()
22 ((labels :initarg labels
23 :reader unresolved-labels-labels))
24 (:report (lambda (condition stream)
25 (format stream "Unable to resolve labels ~A."
26 (unresolved-labels-labels condition)))))
27
28 (defun make-symtab ()
29 nil)
30
31 (defun symtab-add-frame (symtab)
32 symtab)
33
34 (defun symtab-lookup-label (symtab label)
35 (or (symtab-try-lookup-label symtab label)
36 (error 'unresolved-labels 'labels (list label))))
37
38 (defun symtab-try-lookup-label (symtab label)
39 (declare (special *symtab-lookup*))
40 (or (cdr (assoc label symtab))
41 (if (and (boundp '*symtab-lookup*)
42 *symtab-lookup*)
43 (funcall *symtab-lookup* label)
44 nil)))
45
46 (defun symtab-def-label (symtab label value)
47 (when (symtab-try-lookup-label symtab label)
48 (error "Label ~A multiply defined." label))
49 (acons label value symtab))
50
51 (defun symtab-collapse-frames (symtab)
52 symtab)

  ViewVC Help
Powered by ViewVC 1.1.5