Debian Codegraph @

asm.h

raw symbols SCIP
1 // File: asm.hcxx . . $ `<file>/asm.h`/
2 /*
3 Pep8-1 is a virtual machine for writing machine language and assembly
4 language programs.
5
6 Copyright (C) 2009 J. Stanley Warford, Pepperdine University
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #ifndef ASM_H
23 #define ASM_Hcxx . . $ `asm.h:23:9`!
24
25 #include <QRegExp>
26 #include "enu.h"cxx . . $ `<file>/enu.h`/
27
28 class Codecxx . . $ Code#; // Forward declaration for argument of processSourceLine.
29
30 class Asmcxx . . $ Asm#
31 {
32 public:
33 // Lexical tokens
34 enum ELexicalTokencxx . . $ Asm#ELexicalToken#
35 {
36 LT_ADDRESSING_MODEcxx . . $ Asm#LT_ADDRESSING_MODE., LT_CHAR_CONSTANTcxx . . $ Asm#LT_CHAR_CONSTANT., LT_COMMENTcxx . . $ Asm#LT_COMMENT., LT_DEC_CONSTANTcxx . . $ Asm#LT_DEC_CONSTANT., LT_DOT_COMMANDcxx . . $ Asm#LT_DOT_COMMAND.,
37 LT_EMPTYcxx . . $ Asm#LT_EMPTY., LT_HEX_CONSTANTcxx . . $ Asm#LT_HEX_CONSTANT., LT_IDENTIFIERcxx . . $ Asm#LT_IDENTIFIER., LT_STRING_CONSTANTcxx . . $ Asm#LT_STRING_CONSTANT., LT_SYMBOL_DEFcxx . . $ Asm#LT_SYMBOL_DEF.
38 };
39
40 enum ParseStatecxx . . $ Asm#ParseState#
41 {
42 PS_ADDRESSING_MODEcxx . . $ Asm#PS_ADDRESSING_MODE., PS_CLOSEcxx . . $ Asm#PS_CLOSE., PS_COMMENTcxx . . $ Asm#PS_COMMENT., PS_DOT_ADDRSScxx . . $ Asm#PS_DOT_ADDRSS., PS_DOT_ASCIIcxx . . $ Asm#PS_DOT_ASCII., PS_DOT_BLOCKcxx . . $ Asm#PS_DOT_BLOCK.,
43 PS_DOT_BURNcxx . . $ Asm#PS_DOT_BURN., PS_DOT_BYTEcxx . . $ Asm#PS_DOT_BYTE., PS_DOT_ENDcxx . . $ Asm#PS_DOT_END., PS_DOT_EQUATEcxx . . $ Asm#PS_DOT_EQUATE., PS_DOT_WORDcxx . . $ Asm#PS_DOT_WORD., PS_FINISHcxx . . $ Asm#PS_FINISH.,
44 PS_INSTRUCTIONcxx . . $ Asm#PS_INSTRUCTION., PS_STARTcxx . . $ Asm#PS_START., PS_STRINGcxx . . $ Asm#PS_STRING., PS_SYMBOL_DEFcxx . . $ Asm#PS_SYMBOL_DEF.
45 };
46
47 // Regular expressions for lexical analysis
48 static QRegExpcxx . . $ QRegExp# rxAddrModecxx . . $ Asm#rxAddrMode.;
49 static QRegExpcxx . . $ QRegExp# rxCharConstcxx . . $ Asm#rxCharConst.;
50 static QRegExpcxx . . $ QRegExp# rxCommentcxx . . $ Asm#rxComment.;
51 static QRegExpcxx . . $ QRegExp# rxDecConstcxx . . $ Asm#rxDecConst.;
52 static QRegExpcxx . . $ QRegExp# rxDotCommandcxx . . $ Asm#rxDotCommand.;
53 static QRegExpcxx . . $ QRegExp# rxHexConstcxx . . $ Asm#rxHexConst.;
54 static QRegExpcxx . . $ QRegExp# rxIdentifiercxx . . $ Asm#rxIdentifier.;
55 static QRegExpcxx . . $ QRegExp# rxStringConstcxx . . $ Asm#rxStringConst.;
56
57 // Regular expressions for trace tag analysis
58 static QRegExpcxx . . $ QRegExp# rxFormatTagcxx . . $ Asm#rxFormatTag.;
59 static QRegExpcxx . . $ QRegExp# rxSymbolTagcxx . . $ Asm#rxSymbolTag.;
60 static QRegExpcxx . . $ QRegExp# rxArrayMultipliercxx . . $ Asm#rxArrayMultiplier.;
61
62 static bool getTokencxx . . $ Asm#getToken(108e64ee63107a0f).(QStringcxx . . $ QString# &sourceLine, ELexicalTokencxx . . $ Asm#ELexicalToken# &token, QStringcxx . . $ QString# &tokenString);
63 // Pre: sourceLine has one line of source code.
64 // Post: If the next token is valid, the string of characters representing the next token are deleted from the
65 // beginning of sourceLine and returned in tokenString, true is returned, and token is set to the token type.
66 // Post: If false is returned, then tokenString is set to the lexical error message.
67
68 static bool processSourceLinecxx . . $ Asm#processSourceLine(3c7c08c96e7ded6c).(QStringcxx . . $ QString# sourceLine, int lineNum, Codecxx . . $ Code# *&code, QStringcxx . . $ QString# &errorString, bool &dotEndDetected);
69 // Pre: sourceLine has one line of source code.
70 // Pre: lineNum is the line number of the source code.
71 // Post: If the source line is valid, true is returned and code is set to the source code for the line.
72 // Post: dotEndDetected is set to true if .END is processed. Otherwise it is set to false.
73 // Post: Pep::byteCount is incremented by the number of bytes generated.
74 // Post: If the source line is not valid, false is returned and errorString is set to the error message.
75
76 static QListcxx . . $ QList#<QStringcxx . . $ QString#> listOfReferencedSymbolscxx . . $ Asm#listOfReferencedSymbols.;
77 static QListcxx . . $ QList#<int> listOfReferencedSymbolLineNumscxx . . $ Asm#listOfReferencedSymbolLineNums.;
78
79 static bool startsWithHexPrefixcxx . . $ Asm#startsWithHexPrefix(7dc6c9a0b6a7270f).(QStringcxx . . $ QString# str);
80 // Post: Returns true if str starts with the characters 0x or 0X. Otherwise returns false.
81
82 static Enucxx . . $ Enu/::EAddrModecxx . . $ Enu/EAddrMode# stringToAddrModecxx . . $ Asm#stringToAddrMode(f9b7f5c0e4b95d6e).(QStringcxx . . $ QString# str);
83 // Post: Returns the addressing mode integer defined in Pep from its string representation.
84
85 static int charStringToIntcxx . . $ Asm#charStringToInt(87a9b7c6fe1ccdba).(QStringcxx . . $ QString# str);
86 // Pre: str is enclosed in single quotes.
87 // Post: Returns the ASCII integer value of the character accounting for \ quoted characters.
88
89 static int string2ArgumentToIntcxx . . $ Asm#string2ArgumentToInt(87a9b7c6fe1ccdba).(QStringcxx . . $ QString# str);
90 // Pre: str is enclosed in double quotes and contains at most two possibly quoted characters.
91 // Post: Returns the two-byte ASCII integer value for the string.
92
93 static void unquotedStringToIntcxx . . $ Asm#unquotedStringToInt(ed22d69ba8f9ce68).(QStringcxx . . $ QString# &str, int &value);
94 // Pre: str is a character or string stripped of its single or double quotes.
95 // Post: The sequence of characters representing the first possibly \ quoted character
96 // is stripped from the beginning of str.
97 // Post: value is the ASCII integer value of the first possibly \ quoted character.
98
99 static int byteStringLengthcxx . . $ Asm#byteStringLength(87a9b7c6fe1ccdba).(QStringcxx . . $ QString# str);
100 // Pre: str is a double quoted string.
101 // Post: Returns the byte length of str accounting for possibly \ quoted characters.
102
103 static Enucxx . . $ Enu/::ESymbolFormatcxx . . $ Enu/ESymbolFormat# formatTagTypecxx . . $ Asm#formatTagType(719bfaa963bc79d3).(QStringcxx . . $ QString# formatTag);
104 // Pre: formatTag is a valid format trace tag.
105 // Post: Returns the enumerated trace tag format type.
106
107 static int tagNumBytescxx . . $ Asm#tagNumBytes(10342dda07a560ad).(Enucxx . . $ Enu/::ESymbolFormatcxx . . $ Enu/ESymbolFormat# symbolFormat);
108 // Pre: symbolFormat is a valid format trace tag type.
109 // Post: Returns the corresponding integer number of bytes.
110
111 static int formatMultipliercxx . . $ Asm#formatMultiplier(87a9b7c6fe1ccdba).(QStringcxx . . $ QString# formatTag);
112 // Pre: format tag is a valid format trace tag.
113 // Post: If the format tag specifies an array, returns the array multiplier.
114 // Otherwise, returns 1.
115
116 };
117
118 #endif // ASM_H