Subversion Repositories Kolibri OS

Rev

Rev 9398 | Rev 9400 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9398 Rev 9399
Line 177... Line 177...
177
	"dq", "rq",
177
	"dq", "rq",
178
	"dt", "rt",
178
	"dt", "rt",
179
	"du",
179
	"du",
180
]
180
]
Line 181... Line -...
181
 
-
 
182
# Dict where an identifier is assicoated with a string
-
 
183
# The string contains characters specifying flags
-
 
184
# Available flags:
-
 
185
#  k - Keyword
-
 
186
#  m - Macro name
-
 
187
#  t - fasm data Type name (db, rq, etc.)
-
 
188
#  s - Struct type name
-
 
189
#  e - equated constant (name equ value)
-
 
190
#  = - set constants (name = value)
-
 
191
ID_KIND_KEYWORD = 'k'
-
 
192
ID_KIND_MACRO_NAME = 'm'
-
 
193
ID_KIND_FASM_TYPE = 't'
-
 
194
ID_KIND_STRUCT_NAME = 's'
-
 
195
ID_KIND_EQUATED_CONSTANT = 'e'
-
 
196
ID_KIND_SET_CONSTANT = '='
-
 
197
id2kind = {}
-
 
198
 
181
 
199
# Add kind flag to identifier in id2kind
182
# Add kind flag to identifier in id2kind
200
def id_add_kind(identifier, kind):
183
def id_add_kind(identifier, kind):
201
	if identifier not in id2kind:
184
	if identifier not in id2kind:
202
		id2kind[identifier] = ''
185
		id2kind[identifier] = ''
Line 213... Line 196...
213
	if identifier in id2kind:
196
	if identifier in id2kind:
214
		return id2kind[identifier]
197
		return id2kind[identifier]
215
	else:
198
	else:
216
		return ''
199
		return ''
Line 217... Line -...
217
 
-
 
218
for keyword in keywords:
-
 
219
	id_add_kind(keyword, ID_KIND_KEYWORD)
-
 
220
 
-
 
221
for fasm_type in fasm_types:
-
 
222
	id_add_kind(fasm_type, ID_KIND_FASM_TYPE)
-
 
223
 
-
 
224
# Warning list
-
 
225
warnings = ""
-
 
226
 
-
 
227
# Parse arguments
-
 
228
parser = argparse.ArgumentParser()
-
 
229
parser.add_argument("-o", help="Doxygen output folder")
-
 
230
parser.add_argument("--clean", help="Remove generated files", action="store_true")
-
 
231
parser.add_argument("--dump", help="Dump all defined symbols", action="store_true")
-
 
232
parser.add_argument("--stats", help="Print symbol stats", action="store_true")
-
 
233
parser.add_argument("--nowarn", help="Do not write warnings file", action="store_true")
-
 
234
parser.add_argument("--noemit", help="Do not emit doxygen files (for testing)", action="store_true")
-
 
235
args = parser.parse_args()
-
 
236
doxygen_src_path = args.o if args.o else 'docs/doxygen'
-
 
237
clean_generated_stuff = args.clean
-
 
238
dump_symbols = args.dump
-
 
239
print_stats = args.stats
-
 
240
enable_warnings = not args.nowarn
-
 
241
noemit = args.noemit
-
 
242
 
-
 
243
# Variables, functions, labels, macros, structure types
-
 
244
elements = []
-
 
245
 
200
 
246
class LegacyAsmReader:
201
class LegacyAsmReader:
247
	def __init__(self, file):
202
	def __init__(self, file):
248
		self.file = file
203
		self.file = file
249
		self.lines = open(file, "r", encoding="utf-8").readlines()
204
		self.lines = open(file, "r", encoding="utf-8").readlines()
Line 380... Line 335...
380
 
335
 
381
class AsmReader(AsmReaderFetchingIdentifiers):
336
class AsmReader(AsmReaderFetchingIdentifiers):
382
	def __init__(self, file):
337
	def __init__(self, file):
Line 383... Line -...
383
		super().__init__(file)
-
 
384
 
-
 
385
created_files = []
338
		super().__init__(file)
386
 
339
 
387
class AsmElement:
340
class AsmElement:
Line 388... Line 341...
388
	def __init__(self, location, name, comment):
341
	def __init__(self, location, name, comment):
Line 1020... Line 973...
1020
		handle_file(handled_files, full_path, new_subdir)
973
		handle_file(handled_files, full_path, new_subdir)
1021
	# Only collect declarations from the file if it wasn't parsed before
974
	# Only collect declarations from the file if it wasn't parsed before
1022
	if should_get_declarations and not clean_generated_stuff:
975
	if should_get_declarations and not clean_generated_stuff:
1023
		get_declarations(asm_file_contents, asm_file_name)
976
		get_declarations(asm_file_contents, asm_file_name)
Line -... Line 977...
-
 
977
 
-
 
978
# Dict where an identifier is assicoated with a string
-
 
979
# The string contains characters specifying flags
-
 
980
# Available flags:
-
 
981
#  k - Keyword
-
 
982
#  m - Macro name
-
 
983
#  t - fasm data Type name (db, rq, etc.)
-
 
984
#  s - Struct type name
-
 
985
#  e - equated constant (name equ value)
-
 
986
#  = - set constants (name = value)
-
 
987
ID_KIND_KEYWORD = 'k'
-
 
988
ID_KIND_MACRO_NAME = 'm'
-
 
989
ID_KIND_FASM_TYPE = 't'
-
 
990
ID_KIND_STRUCT_NAME = 's'
-
 
991
ID_KIND_EQUATED_CONSTANT = 'e'
-
 
992
ID_KIND_SET_CONSTANT = '='
-
 
993
id2kind = {}
-
 
994
 
-
 
995
for keyword in keywords:
-
 
996
	id_add_kind(keyword, ID_KIND_KEYWORD)
-
 
997
 
-
 
998
for fasm_type in fasm_types:
-
 
999
	id_add_kind(fasm_type, ID_KIND_FASM_TYPE)
-
 
1000
 
-
 
1001
# Warning list
-
 
1002
warnings = ""
-
 
1003
 
-
 
1004
# Parse arguments
-
 
1005
parser = argparse.ArgumentParser()
-
 
1006
parser.add_argument("-o", help="Doxygen output folder")
-
 
1007
parser.add_argument("--clean", help="Remove generated files", action="store_true")
-
 
1008
parser.add_argument("--dump", help="Dump all defined symbols", action="store_true")
-
 
1009
parser.add_argument("--stats", help="Print symbol stats", action="store_true")
-
 
1010
parser.add_argument("--nowarn", help="Do not write warnings file", action="store_true")
-
 
1011
parser.add_argument("--noemit", help="Do not emit doxygen files (for testing)", action="store_true")
-
 
1012
args = parser.parse_args()
-
 
1013
doxygen_src_path = args.o if args.o else 'docs/doxygen'
-
 
1014
clean_generated_stuff = args.clean
-
 
1015
dump_symbols = args.dump
-
 
1016
print_stats = args.stats
-
 
1017
enable_warnings = not args.nowarn
-
 
1018
noemit = args.noemit
-
 
1019
 
-
 
1020
# Variables, functions, labels, macros, structure types
-
 
1021
elements = []
-
 
1022
 
-
 
1023
created_files = []
1024
 
1024
 
Line 1025... Line 1025...
1025
kernel_files = []
1025
kernel_files = []
1026
 
1026
 
1027
# Load remembered list of symbols
1027
# Load remembered list of symbols