lang

package
v0.0.0-...-7f806dd Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2016 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The directory to store the source and compiled binary files.
	// Any produced files by the program are also placed under it.
	DataStore = "store"

	// Timeout seconds for running compiled programs.
	RunTimeout = 3

	// Max length of feedback
	MaxLength = 256
)

Variables

This section is empty.

Functions

func InitContainer

func InitContainer() error

Types

type Bash

type Bash struct {
	// contains filtered or unexported fields
}

func (*Bash) Compile

func (sh *Bash) Compile(code string) *Result

func (*Bash) Init

func (sh *Bash) Init() error

func (*Bash) Name

func (sh *Bash) Name() string

func (*Bash) Version

func (sh *Bash) Version() string

type C11

type C11 struct {
	CBase
}

Compile as C11

func (*C11) Compile

func (c *C11) Compile(code string) *Result

func (*C11) Init

func (c *C11) Init() error

func (*C11) Name

func (c *C11) Name() string

type C89

type C89 struct {
	CBase
}

Compile C code as C89

func (*C89) Compile

func (c *C89) Compile(code string) *Result

func (*C89) Init

func (c *C89) Init() error

func (*C89) Name

func (c *C89) Name() string

type C99

type C99 struct {
	CBase
}

Compile C code as C99

func (*C99) Compile

func (c *C99) Compile(code string) *Result

func (*C99) Init

func (c *C99) Init() error

func (*C99) Name

func (c *C99) Name() string

type CBase

type CBase struct {
	// contains filtered or unexported fields
}

The base compiler for C language

func (*CBase) Init

func (c *CBase) Init() error

func (*CBase) Name

func (c *CBase) Name() string

func (*CBase) Version

func (c *CBase) Version() string

type Compiler

type Compiler interface {
	// Returns the name of this compiler
	Name() string

	// Returns the version of this compiler
	Version() string

	// Do initialization work, for example, check whether files
	// required are present or not.
	// Returns an error if the compiler cannot function.
	// The compiler server will ignore this compiler if Init() failed.
	Init() error

	// Compile the code given as a string
	Compile(string) *Result
}

Compiler is the interface that represents a compiler. Each compiler implements this interface, and registers itself to the compiler server to serve client's request.

type Go

type Go struct {
	// contains filtered or unexported fields
}

func (*Go) Compile

func (g *Go) Compile(code string) *Result

func (*Go) Init

func (g *Go) Init() error

func (*Go) Name

func (g *Go) Name() string

func (*Go) Version

func (g *Go) Version() string

type Result

type Result struct {
	// Unique compiling ID
	Id string
	// The command line used to compile this piece of code
	Cmd string
	// Whether the code has main function and can be executed
	Error string
	// Compiler's standard output
	C_Output string
	// Compiler's standard error
	C_Error string
	// The program's standard error, if compiled successfully and run
	P_Output string
	// The program's standard output, if compiled successfully and run
	P_Error string
}

Struct hold the compiling result

Jump to

Keyboard shortcuts

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