spicy

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2018 License: MIT Imports: 12 Imported by: 0

README

spicy

An open-source version of Nintendo64 sdk's mild.exe. Assembles segments into an n64-compatible rom. This binary should eventually be a drop in, multiplatform replacement for mild.exe.

Usage

Get the binary:

go get github.com/trhodeos/spicy

TODO: figure out what it takes to distribute a go binary..

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinarizeObject

func BinarizeObject(obj_path string, objcopy_command string) (*os.File, error)

func CreateEntryBinary

func CreateEntryBinary(w *Wave, as_command string) (*os.File, error)

func LinkSpec

func LinkSpec(w *Wave, ld_command string) (string, error)

func PreprocessSpec added in v0.2.0

func PreprocessSpec(file io.Reader, gcc_command string) (io.Reader, error)

func RunCmd

func RunCmd(command string, args ...string) error

func RunCmdReturnStdout added in v0.2.0

func RunCmdReturnStdout(command string, stdin io.Reader, args ...string) (io.Reader, error)

Types

type Constant

type Constant struct {
	Symbol string `  @Ident`
	Int    int    `| @Int`
}

type FlagAst

type FlagAst struct {
	Boot   bool `  @"BOOT"`
	Object bool `| @"OBJECT"`
	Raw    bool `| @"RAW"`
}

type Flags

type Flags struct {
	Object bool
	Boot   bool
	Raw    bool
}

type MaxSegment

type MaxSegment struct {
	First  string `"max[" @String ","`
	Second string `    @String "]"`
}

type MinSegment

type MinSegment struct {
	First  string `"min[" @String ","`
	Second string `       @String "]"`
}

type Positioning

type Positioning struct {
	AfterSegment    string
	AfterMinSegment [2]string
	AfterMaxSegment [2]string
	Address         int
}

type Segment

type Segment struct {
	Name        string
	Includes    []string
	StackInfo   *StackInfo
	Positioning Positioning
	Entry       *string
	MaxSize     int
	Align       int
	Flags       Flags
}

type SegmentAst

type SegmentAst struct {
	Statements []*StatementAst `"beginseg" { @@ } "endseg"`
}

type Spec

type Spec struct {
	Waves []*Wave
}

func ParseSpec

func ParseSpec(r io.Reader) (*Spec, error)

type SpecAst

type SpecAst struct {
	Segments []*SegmentAst `{ @@ }`
	Waves    []*WaveAst    `{ @@ }`
}

type StackInfo

type StackInfo struct {
	Start  string
	Offset int
}

type StatementAst

type StatementAst struct {
	/*
	   :name <segmentName>
	   |address <constant>
	   |after <segmentName>
	   |after max[<segmentName>,<segmentName>]
	   |after min[<segmentName>,<segmentName>]
	   |include <filename>
	   |maxsize <constant>
	   |align <constant>
	   |flags <flagList>
	   |number <constant>
	   |entry <symbol>
	   |stack <stackValue>
	*/
	// I tried using @Ident here, but the parser was greedily taking 'endseg' as name.
	// By explicitly listing all known names here, we limit the search space.
	Name  string `@("name" | "address" | "after" | "include" | "maxsize" | "align" | "flags" | "number" | "entry" | "stack")`
	Value Value  `@@`
}

type Summand

type Summand struct {
	Lhs *Constant ` @@`
	Op  string    `[ @("+" | "-")`
	Rhs *Constant ` @@ ]`
}

type Value

type Value struct {
	String        string      `  @String`
	Int           int         `| @Int`
	Flags         []*FlagAst  `| @@ { @@ }`
	ConstantValue *Summand    `| @@`
	MaxSegment    *MaxSegment `| @@`
	MinSegment    *MinSegment `| @@`
}

Only one of these values will be set.

type Wave

type Wave struct {
	Name           string
	ObjectSegments []*Segment
	RawSegments    []*Segment
}

func (*Wave) GetBootSegment

func (w *Wave) GetBootSegment() *Segment

type WaveAst

type WaveAst struct {
	Statements []*StatementAst `"beginwave" { @@ } "endwave"`
}

Directories

Path Synopsis
cmd
print_elf command
spicy command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL