OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-binutils/] [binutils-2.19.1/] [cgen/] [enum.scm] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 jlechner
; Enums.
2
; Copyright (C) 2000, 2009 Red Hat, Inc.
3
; This file is part of CGEN.
4
; See file COPYING.CGEN for details.
5
 
6
; the enum class' name.
7
; Member PREFIX is always prepended to the symbol names.
8
;
9
; Enum values are looked up with `enum-lookup-val'.  The value to search for
10
; has PREFIX prepended.
11
;
12
; Enums always have mode INT.
13
; FIXME: this make! method is required by <insn-enum> for some reason.
14
 
15
; PREFIX is prepended to each name.
16
; Elements are any of: symbol, (symbol), (symbol value)
17
; (symbol - attrs), (symbol value attrs), (symbol - attrs comment),
18
; (symbol value attrs comment).
19
; The - or #f means "use the next value".
20
; SYMBOL may be - which means "skip this value".
21
 
22
; and each symbol is prepended with `prefix'.
23
 
24
; Each element's value is 1+ the previous, unless there's an explicit value.
25
; Compute the numeric value the next entry will have.
26
""; Accessors for the various elements of an enum val.
27
; Convert the names in the result of parse-enum-vals to uppercase.
28
; Parse an enum definition.
29
; Utility of -enum-parse to parse the prefix.
30
"prefix is not a string"; Prefix must not contain lowercase chars (enforced style rule, sue me).
31
"prefix must be uppercase"; This is the main routine for building an enum object from a
32
; description in the .cpu file.
33
; All arguments are in raw (non-evaluated) form.
34
 
35
"enum"; Read an enum description
36
 
37
; CONTEXT is a <context> object for error messages.
38
 
39
; -enum-parse is invoked to create the `enum' object.
40
""""; Loop over each element in ARG-LIST, recording what's found.
41
"invalid enum arg"; Now that we've identified the elements, build the object.
42
; Define an enum object, name/value pair list version.
43
"define-enum"; Define an enum object, all arguments specified.
44
"define-full-enum"; Lookup SYM in all recorded enums.
45
; The result is (value . enum-obj) or #f if not found.
46
;(display e) (newline)
47
; sanity check, ensure the enum has a value
48
 
49
; Return #t if VALS is a sequential list of enum values.
50
; VALS is a list of enums.  e.g. ((sym1) (sym2 3) (sym3 - attr1 (attr2 4)))
51
; FIXME: Doesn't handle gaps in specified values.
52
; e.g. (sym1 val1) sym2 (sym3 val3)
53
; Return C code to declare enum SYM with values VALS.
54
; COMMENT is inserted in "/* Enum declaration for <...>.  */".
55
; PREFIX is added to each element of VALS.
56
; All enum symbols are uppercase.
57
; If the list of vals is sequential beginning at 0, don't output them.
58
; This simplifies the output and is necessary for sanitized values where
59
; some values may be cut out.
60
; VALS may have '- for the value, signifying use the next value as in C.
61
"Generating enum decl for "" ...\n"; Build result up as a list and then flatten it into a string.
62
; We could just return a string-list but that seems like too much to ask
63
; of callers.
64
"/* Enum declaration for "".  */\n""typedef enum "" {"; `n' is used to track the number of entries per line only
65
""; reset to beginning of line (but != 0)
66
"\n"; split string to avoid removal
67
"/* start-""sanitize-"" */\n"""" """"\n """" "", """" = "; split string to avoid removal
68
"\n/* end-""sanitize-"" */""""\n} "";\n\n"; Return a list of enum value definitions for gen-enum-decl.
69
; OBJ-LIST is a list of objects that support obj:name, obj-atlist.
70
; Return C code that declares[/defines] an enum.
71
"_"""; Return the C symbol of an enum value named VAL.
72
; Instruction code enums.
73
; These associate an enum with an instruction field so that the enum values
74
; can be used in instruction field lists.
75
; Same as enum-lookup-val except returned enum must be an insn-enum.
76
; Define an insn enum, all arguments specified.
77
"define-full-insn-enum""insn-enum""unknown insn field"; Create enum object and add it to the list of enums.
78
"\
79
Define an enum, name/value pair list version.
80
""\
81
Define an enum, all arguments specified.
82
""\
83
Define an instruction opcode enum, all arguments specified.
84
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.