mirror of
https://github.com/zeldaret/mm.git
synced 2026-09-01 17:29:56 -04:00
7743e5a2c4
* wip * fix * add disassembler * Disasm builds OK * Variable addends * More wip * Rodata migration implemented * Cleanup old tools * Try fix submodule -> subrepo merge * git subrepo pull --force --remote=https://github.com/zeldaret/ZAPD.git tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "602e609" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "602e609" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Builds again but assets are totally broken * git subrepo pull --force tools/asm-processor subrepo: subdir: "tools/asm-processor" merged: "1ffdb08a" upstream: origin: "https://github.com/simonlindholm/asm-processor.git" branch: "master" commit: "1ffdb08a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * More cleanup, move functions.txt and variables.txt to tools/disasm and rm tables * rm z64compress in preparation for subrepo * git subrepo clone (merge) https://github.com/z64me/z64compress.git tools/z64compress subrepo: subdir: "tools/z64compress" merged: "eb11085c" upstream: origin: "https://github.com/z64me/z64compress.git" branch: "main" commit: "eb11085c" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Fix asset extraction * Fix diff-init make rule * Split code bss * Split assumed linker bug padding from assembly files * add filelists for mm.us.rev1 * Maybe working, but I'm not sure * add overlays to spec * Add rodata to actos * Everything compiles * Make a lot of C files for code * Add almost every file in code to spec * whoops * 3 code files left * add scenes to spec * More progress on progress.py * Fix skelanime in spec * audio files! * Fix merge issues * Fix some C files in code * Fix remaining code files * Use existing O1 C files in spec * reorder boot order in spec * update spec * fault.c * Convert relocs on completed actors, fixbaserom uses current rom name * more boot files * Add VT macros and script * finish already existing boot files * most of libultra * fix 64bits libultra files * Use C files for libultra, wrap some functions in NON_MATCHING * Remove duplicate of OS_CLOCK_RATE from fault.c * C files for fbdemos * delete dumb files * bootstrap C files, still need to add them to the spec * update fixbaserom * boot OK? * I forgot to commit the spec * C for gamestates * C for kaleido * Change all includes to "" * copy actor sizes script from oot * I forgot to delete those files * Basic C files for effects * Add effects initvars names * Remove mislabelled boot functions from header/txt * Begin porting bootstrap_fx, some sizes * Fix <> * Fix enum * Fix diff.py * fix libultra stuff * update regconvert * update setup warnings * add some missing ; * Fix some makefile stuff and other fixes on some non_matching functions * add executable flag in extract_baserom and fixbaserom * fix relative path * copy assist from oot * fix map path * another assist path fix * Delete C files for handwritten files * add code_801A51F0 to spec * add gfxbuffers to spec * Move rodata to top of each file when possible * UNK_TYPEs for func_801A51F0 * Remove kaleido rodata from spec * Update spec and undefined_syms for recent merge * GCC warnings and fix errors in nonmatchings, * round percentage numbers * progress script: format changes * progress: error on non-existing files * fix warning in z_scene_table * Match 2 nonmatchings in z_actor * Warnings in lightswitch and invadepoh * Fix warning in z_actor_dlftbls * I though I fixed this one * whoops * Comment out CC_CHECK * Removed redundant ultra64.h includes * Update asm_processor, sorted boot_O1 into other folders, completed the fbdemo bootstrap, cleaned up undefined_syms * Completed gamestates bootstrap * Split kaleido_scope * Remove section.h and segment.h, move keep object externs to a common location in variables.h * Completed effects bootstrap * Segmented address externs for effects, fbdemos, gamestates and kaleido * Move actor data externs out of the if 0 * Segmented address externs for actors * Prepare actionfunc detection * fix script, how did it even work before * Fix actionfunc script again, re-introduce some more intermediate prints to the disassembler * Automated actionFunc detection in actors * Segmented addresses from player .text * rm old segment addrs script and fix build * Move sizes folder to tools * Make build.py executable * New Jenkinsfile Prayge * Remove numpy dependencies * Add warnings_disasm_current.txt * my bad * Update spec and undefined_syms * Add z_eff_ss_hahen to pametfrog * git subrepo pull (merge) --force tools/z64compress subrepo: subdir: "tools/z64compress" merged: "163ca2af" upstream: origin: "https://github.com/z64me/z64compress.git" branch: "main" commit: "163ca2af" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Make z64compress print to stdout * sneeky commit to update warnings tooling * test * Another test * Mark fixing overlay reloc generating as a TODO * Update warnings stuff * Communicate the return code from running z64compress back to the Makefile through the wrapper * Run formatter, remove extra commented copy of function * Re-fix some includes * Convert atan to hex to conform to decided style * Some tidying up, remove c for fp and the other two handwritten code files * BSS in z_collision_check & z_scene_proc * add static back in * Fix timerintr bss, add file to spec, some cleanup * Remove externs * Newline * Readd enums * Typo * Colours * Comments for hitmark enum values Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * Improvements and suggestions * Organize and remove unused imports and use env for python3 scripts, delete unused overlay.py Co-authored-by: angie <angheloalf95@gmail.com> Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com> Co-authored-by: engineer124 <engineer124engineer124@gmail.com> Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>
320 lines
12 KiB
Python
320 lines
12 KiB
Python
#-----------------------------------------------------------------
|
|
# pycparser: c_ast.py
|
|
#
|
|
# AST Node classes.
|
|
#
|
|
# Eli Bendersky [https://eli.thegreenplace.net/]
|
|
# License: BSD
|
|
#-----------------------------------------------------------------
|
|
|
|
|
|
from typing import TextIO, Iterable, List, Any, Optional, Union as Union_
|
|
from .plyparser import Coord
|
|
import sys
|
|
|
|
class Node(object):
|
|
coord: Optional[Coord]
|
|
|
|
def __repr__(self) -> str: ...
|
|
def __iter__(self) -> Iterable[Node]: ...
|
|
def children(self) -> Iterable[Node]: ...
|
|
def show(self, buf: TextIO=sys.stdout, offset: int=0, attrnames: bool=False, nodenames: bool=False, showcoord: bool=False) -> None: ...
|
|
|
|
Expression = Union_['ArrayRef', 'Assignment', 'BinaryOp', 'Cast',
|
|
'CompoundLiteral', 'Constant', 'ExprList', 'FuncCall', 'ID',
|
|
'TernaryOp', 'UnaryOp']
|
|
Statement = Union_[Expression, 'Break', 'Case', 'Compound', 'Continue',
|
|
'Decl', 'Default', 'DoWhile', 'EmptyStatement', 'For', 'Goto', 'If',
|
|
'Label', 'Return', 'Switch', 'Typedef', 'While', 'Pragma']
|
|
Type = Union_['PtrDecl', 'ArrayDecl', 'FuncDecl', 'TypeDecl']
|
|
InnerType = Union_['IdentifierType', 'Struct', 'Union', 'Enum']
|
|
ExternalDeclaration = Union_['FuncDef', 'Decl', 'Typedef', 'Pragma']
|
|
AnyNode = Union_[Statement, Type, InnerType, 'FuncDef', 'EllipsisParam',
|
|
'Enumerator', 'EnumeratorList', 'FileAST', 'InitList',
|
|
'NamedInitializer', 'ParamList', 'Typename']
|
|
|
|
class NodeVisitor:
|
|
def visit(self, node: Node) -> None: ...
|
|
def generic_visit(self, node: Node) -> None: ...
|
|
def visit_ArrayDecl(self, node: ArrayDecl) -> None: ...
|
|
def visit_ArrayRef(self, node: ArrayRef) -> None: ...
|
|
def visit_Assignment(self, node: Assignment) -> None: ...
|
|
def visit_BinaryOp(self, node: BinaryOp) -> None: ...
|
|
def visit_Break(self, node: Break) -> None: ...
|
|
def visit_Case(self, node: Case) -> None: ...
|
|
def visit_Cast(self, node: Cast) -> None: ...
|
|
def visit_Compound(self, node: Compound) -> None: ...
|
|
def visit_CompoundLiteral(self, node: CompoundLiteral) -> None: ...
|
|
def visit_Constant(self, node: Constant) -> None: ...
|
|
def visit_Continue(self, node: Continue) -> None: ...
|
|
def visit_Decl(self, node: Decl) -> None: ...
|
|
def visit_DeclList(self, node: DeclList) -> None: ...
|
|
def visit_Default(self, node: Default) -> None: ...
|
|
def visit_DoWhile(self, node: DoWhile) -> None: ...
|
|
def visit_EllipsisParam(self, node: EllipsisParam) -> None: ...
|
|
def visit_EmptyStatement(self, node: EmptyStatement) -> None: ...
|
|
def visit_Enum(self, node: Enum) -> None: ...
|
|
def visit_Enumerator(self, node: Enumerator) -> None: ...
|
|
def visit_EnumeratorList(self, node: EnumeratorList) -> None: ...
|
|
def visit_ExprList(self, node: ExprList) -> None: ...
|
|
def visit_FileAST(self, node: FileAST) -> None: ...
|
|
def visit_For(self, node: For) -> None: ...
|
|
def visit_FuncCall(self, node: FuncCall) -> None: ...
|
|
def visit_FuncDecl(self, node: FuncDecl) -> None: ...
|
|
def visit_FuncDef(self, node: FuncDef) -> None: ...
|
|
def visit_Goto(self, node: Goto) -> None: ...
|
|
def visit_ID(self, node: ID) -> None: ...
|
|
def visit_IdentifierType(self, node: IdentifierType) -> None: ...
|
|
def visit_If(self, node: If) -> None: ...
|
|
def visit_InitList(self, node: InitList) -> None: ...
|
|
def visit_Label(self, node: Label) -> None: ...
|
|
def visit_NamedInitializer(self, node: NamedInitializer) -> None: ...
|
|
def visit_ParamList(self, node: ParamList) -> None: ...
|
|
def visit_PtrDecl(self, node: PtrDecl) -> None: ...
|
|
def visit_Return(self, node: Return) -> None: ...
|
|
def visit_Struct(self, node: Struct) -> None: ...
|
|
def visit_StructRef(self, node: StructRef) -> None: ...
|
|
def visit_Switch(self, node: Switch) -> None: ...
|
|
def visit_TernaryOp(self, node: TernaryOp) -> None: ...
|
|
def visit_TypeDecl(self, node: TypeDecl) -> None: ...
|
|
def visit_Typedef(self, node: Typedef) -> None: ...
|
|
def visit_Typename(self, node: Typename) -> None: ...
|
|
def visit_UnaryOp(self, node: UnaryOp) -> None: ...
|
|
def visit_Union(self, node: Union) -> None: ...
|
|
def visit_While(self, node: While) -> None: ...
|
|
def visit_Pragma(self, node: Pragma) -> None: ...
|
|
|
|
class ArrayDecl(Node):
|
|
type: Type
|
|
dim: Optional[Expression]
|
|
dim_quals: List[str]
|
|
def __init__(self, type: Type, dim: Optional[Node], dim_quals: List[str], coord: Optional[Coord]=None): ...
|
|
|
|
class ArrayRef(Node):
|
|
name: Expression
|
|
subscript: Expression
|
|
def __init__(self, name: Node, subscript: Node, coord: Optional[Coord]=None): ...
|
|
|
|
class Assignment(Node):
|
|
op: str
|
|
lvalue: Expression
|
|
rvalue: Expression
|
|
def __init__(self, op: str, lvalue: Expression, rvalue: Expression, coord: Optional[Coord]=None): ...
|
|
|
|
class BinaryOp(Node):
|
|
op: str
|
|
left: Expression
|
|
right: Expression
|
|
def __init__(self, op: str, left: Node, right: Node, coord: Optional[Coord]=None): ...
|
|
|
|
class Break(Node):
|
|
def __init__(self, coord: Optional[Coord]=None): ...
|
|
|
|
class Case(Node):
|
|
expr: Expression
|
|
stmts: List[Statement]
|
|
def __init__(self, expr: Expression, stmts: List[Statement], coord: Optional[Coord]=None): ...
|
|
|
|
class Cast(Node):
|
|
to_type: 'Typename'
|
|
expr: Expression
|
|
def __init__(self, to_type: 'Typename', expr: Expression, coord: Optional[Coord]=None): ...
|
|
|
|
class Compound(Node):
|
|
block_items: Optional[List[Statement]]
|
|
def __init__(self, block_items: Optional[List[Statement]], coord: Optional[Coord]=None): ...
|
|
|
|
class CompoundLiteral(Node):
|
|
type: 'Typename'
|
|
init: 'InitList'
|
|
def __init__(self, type: 'Typename', init: 'InitList', coord: Optional[Coord]=None): ...
|
|
|
|
class Constant(Node):
|
|
type: str
|
|
value: str
|
|
def __init__(self, type: str, value: str, coord: Optional[Coord]=None): ...
|
|
|
|
class Continue(Node):
|
|
def __init__(self, coord: Optional[Coord]=None): ...
|
|
|
|
class Decl(Node):
|
|
name: Optional[str]
|
|
quals: List[str] # e.g. const
|
|
storage: List[str] # e.g. register
|
|
funcspec: List[str] # e.g. inline
|
|
type: Type
|
|
init: Optional[Union_[Expression, 'InitList']]
|
|
bitsize: Optional[Expression]
|
|
|
|
def __init__(self, name: Optional[str], quals: List[str], storage: List[str], funcspec: List[str], type: Type, init: Optional[Expression], bitsize: Optional[Expression], coord: Optional[Coord]=None): ...
|
|
|
|
class DeclList(Node):
|
|
decls: List[Decl]
|
|
def __init__(self, decls: List[Decl], coord: Optional[Coord]=None): ...
|
|
|
|
class Default(Node):
|
|
stmts: List[Statement]
|
|
def __init__(self, stmts: List[Statement], coord: Optional[Coord]=None): ...
|
|
|
|
class DoWhile(Node):
|
|
cond: Expression
|
|
stmt: Statement
|
|
def __init__(self, cond: Expression, stmt: Statement, coord: Optional[Coord]=None): ...
|
|
|
|
class EllipsisParam(Node):
|
|
def __init__(self, coord: Optional[Coord]=None): ...
|
|
|
|
class EmptyStatement(Node):
|
|
def __init__(self, coord: Optional[Coord]=None): ...
|
|
|
|
class Enum(Node):
|
|
name: Optional[str]
|
|
values: 'EnumeratorList'
|
|
def __init__(self, name: Optional[str], values: 'EnumeratorList', coord: Optional[Coord]=None): ...
|
|
|
|
class Enumerator(Node):
|
|
name: str
|
|
value: Optional[Expression]
|
|
def __init__(self, name: str, value: Optional[Expression], coord: Optional[Coord]=None): ...
|
|
|
|
class EnumeratorList(Node):
|
|
enumerators: List[Enumerator]
|
|
def __init__(self, enumerators: List[Enumerator], coord: Optional[Coord]=None): ...
|
|
|
|
class ExprList(Node):
|
|
exprs: List[Union_[Expression, Typename]] # typename only for offsetof
|
|
def __init__(self, exprs: List[Union_[Expression, Typename]], coord: Optional[Coord]=None): ...
|
|
|
|
class FileAST(Node):
|
|
ext: List[ExternalDeclaration]
|
|
def __init__(self, ext: List[ExternalDeclaration], coord: Optional[Coord]=None): ...
|
|
|
|
class For(Node):
|
|
init: Union_[None, Expression, DeclList]
|
|
cond: Optional[Expression]
|
|
next: Optional[Expression]
|
|
stmt: Statement
|
|
def __init__(self, init: Union_[None, Expression, DeclList], cond: Optional[Expression], next: Optional[Expression], stmt: Statement, coord: Optional[Coord]=None): ...
|
|
|
|
class FuncCall(Node):
|
|
name: Expression
|
|
args: Optional[ExprList]
|
|
def __init__(self, name: Expression, args: Optional[ExprList], coord: Optional[Coord]=None): ...
|
|
|
|
class FuncDecl(Node):
|
|
args: Optional[ParamList]
|
|
type: Type # return type
|
|
def __init__(self, args: Optional[ParamList], type: Type, coord: Optional[Coord]=None): ...
|
|
|
|
class FuncDef(Node):
|
|
decl: Decl
|
|
param_decls: Optional[List[Decl]]
|
|
body: Compound
|
|
def __init__(self, decl: Decl, param_decls: Optional[List[Decl]], body: Compound, coord: Optional[Coord]=None): ...
|
|
|
|
class Goto(Node):
|
|
name: str
|
|
def __init__(self, name: str, coord: Optional[Coord]=None): ...
|
|
|
|
class ID(Node):
|
|
name: str
|
|
def __init__(self, name: str, coord: Optional[Coord]=None): ...
|
|
|
|
class IdentifierType(Node):
|
|
names: List[str] # e.g. ['long', 'int']
|
|
def __init__(self, names: List[str], coord: Optional[Coord]=None): ...
|
|
|
|
class If(Node):
|
|
cond: Expression
|
|
iftrue: Statement
|
|
iffalse: Optional[Statement]
|
|
def __init__(self, cond: Expression, iftrue: Statement, iffalse: Optional[Statement], coord: Optional[Coord]=None): ...
|
|
|
|
class InitList(Node):
|
|
exprs: List[Union_[Expression, 'NamedInitializer']]
|
|
def __init__(self, exprs: List[Union_[Expression, 'NamedInitializer']], coord: Optional[Coord]=None): ...
|
|
|
|
class Label(Node):
|
|
name: str
|
|
stmt: Statement
|
|
def __init__(self, name: str, stmt: Statement, coord: Optional[Coord]=None): ...
|
|
|
|
class NamedInitializer(Node):
|
|
name: List[Expression] # [ID(x), Constant(4)] for {.x[4] = ...}
|
|
expr: Expression
|
|
def __init__(self, name: List[Expression], expr: Expression, coord: Optional[Coord]=None): ...
|
|
|
|
class ParamList(Node):
|
|
params: List[Union_[Decl, ID, Typename, EllipsisParam]]
|
|
def __init__(self, params: List[Union_[Decl, ID, Typename, EllipsisParam]], coord: Optional[Coord]=None): ...
|
|
|
|
class PtrDecl(Node):
|
|
quals: List[str]
|
|
type: Type
|
|
def __init__(self, quals: List[str], type: Type, coord: Optional[Coord]=None): ...
|
|
|
|
class Return(Node):
|
|
expr: Optional[Expression]
|
|
def __init__(self, expr: Optional[Expression], coord: Optional[Coord]=None): ...
|
|
|
|
class Struct(Node):
|
|
name: Optional[str]
|
|
decls: Optional[List[Union_[Decl, Pragma]]]
|
|
def __init__(self, name: Optional[str], decls: Optional[List[Union_[Decl, Pragma]]], coord: Optional[Coord]=None): ...
|
|
|
|
class StructRef(Node):
|
|
name: Expression
|
|
type: str
|
|
field: ID
|
|
def __init__(self, name: Expression, type: str, field: ID, coord: Optional[Coord]=None): ...
|
|
|
|
class Switch(Node):
|
|
cond: Expression
|
|
stmt: Statement
|
|
def __init__(self, cond: Expression, stmt: Statement, coord: Optional[Coord]=None): ...
|
|
|
|
class TernaryOp(Node):
|
|
cond: Expression
|
|
iftrue: Expression
|
|
iffalse: Expression
|
|
def __init__(self, cond: Expression, iftrue: Expression, iffalse: Expression, coord: Optional[Coord]=None): ...
|
|
|
|
class TypeDecl(Node):
|
|
declname: Optional[str]
|
|
quals: List[str]
|
|
type: InnerType
|
|
def __init__(self, declname: Optional[str], quals: List[str], type: InnerType, coord: Optional[Coord]=None): ...
|
|
|
|
class Typedef(Node):
|
|
name: str
|
|
quals: List[str]
|
|
storage: List[str]
|
|
type: Type
|
|
def __init__(self, name: str, quals: List[str], storage: List[str], type: Type, coord: Optional[Coord]=None): ...
|
|
|
|
class Typename(Node):
|
|
name: None
|
|
quals: List[str]
|
|
type: Type
|
|
def __init__(self, name: None, quals: List[str], type: Type, coord: Optional[Coord]=None): ...
|
|
|
|
class UnaryOp(Node):
|
|
op: str
|
|
expr: Union_[Expression, Typename]
|
|
def __init__(self, op: str, expr: Union_[Expression, Typename], coord: Optional[Coord]=None): ...
|
|
|
|
class Union(Node):
|
|
name: Optional[str]
|
|
decls: Optional[List[Union_[Decl, Pragma]]]
|
|
def __init__(self, name: Optional[str], decls: Optional[List[Union_[Decl, Pragma]]], coord: Optional[Coord]=None): ...
|
|
|
|
class While(Node):
|
|
cond: Expression
|
|
stmt: Statement
|
|
def __init__(self, cond: Expression, stmt: Statement, coord: Optional[Coord]=None): ...
|
|
|
|
class Pragma(Node):
|
|
string: str
|
|
def __init__(self, string: str, coord: Optional[Coord]=None): ...
|
|
|