Documentation ¶
Index ¶
- Variables
- func PlaceCompilerCommands(configFile string) error
- type CodeCompileProvider
- type CodeCompileProviderInterface
- type CompileCommandsStruct
- type GnucCompileProvider
- func (prov *GnucCompileProvider) Compile() (result bool, errmsg string)
- func (prov *GnucCompileProvider) GetRunArgs() (args []string)
- func (prov *GnucCompileProvider) Init(code string, workDir string) error
- func (prov *GnucCompileProvider) IsCompileError(remsg string) bool
- func (prov *GnucCompileProvider) ManualCompile(source string, target string, libraryDir []string) (bool, string)
- type GnucppCompileProvider
- func (prov *GnucppCompileProvider) Compile() (result bool, errmsg string)
- func (prov *GnucppCompileProvider) GetRunArgs() (args []string)
- func (prov *GnucppCompileProvider) Init(code string, workDir string) error
- func (prov *GnucppCompileProvider) IsCompileError(remsg string) bool
- func (prov *GnucppCompileProvider) ManualCompile(source string, target string, libraryDir []string) (bool, string)
- type GolangCompileProvider
- func (prov *GolangCompileProvider) Compile() (result bool, errmsg string)
- func (prov *GolangCompileProvider) GetRunArgs() (args []string)
- func (prov *GolangCompileProvider) Init(code string, workDir string) error
- func (prov *GolangCompileProvider) IsCompileError(remsg string) bool
- func (prov *GolangCompileProvider) ManualCompile(source string, target string) (bool, string)
- type JavaCompileProvider
- type NodeJSCompileProvider
- type PHPCompileProvider
- type Py2CompileProvider
- type Py3CompileProvider
- type RubyCompileProvider
- type RustCompileProvider
Constants ¶
This section is empty.
Variables ¶
var CompileCommands = CompileCommandsStruct{
GNUC: "gcc %s -o %s -ansi -fno-asm -Wall -std=c11 -lm",
GNUCPP: "g++ %s -o %s -ansi -fno-asm -Wall -lm -std=c++11",
Java: "javac -encoding utf-8 %s -d %s",
Go: "go build -o %s %s",
NodeJS: "node -c %s",
PHP: "php -l -f %s",
Ruby: "ruby -c %s",
Python2: "python -u %s",
Python3: "python3 -u %s",
Rust: "rustc %s -o %s",
}
CompileCommands 定义默认的编译命令集
Functions ¶
func PlaceCompilerCommands ¶
PlaceCompilerCommands 替换编译命令集
Types ¶
type CodeCompileProvider ¶
type CodeCompileProvider struct { CodeCompileProviderInterface Name string // 编译器提供程序名称 // contains filtered or unexported fields }
CodeCompileProvider 代码编译提供程序公共结构定义
func (*CodeCompileProvider) GetName ¶
func (prov *CodeCompileProvider) GetName() string
GetName 获取提供程序的名称
func (*CodeCompileProvider) IsReady ¶
func (prov *CodeCompileProvider) IsReady() bool
IsReady 返回编译是否就绪
func (*CodeCompileProvider) IsRealTime ¶
func (prov *CodeCompileProvider) IsRealTime() bool
IsRealTime 返回是否是实时评测语言
type CodeCompileProviderInterface ¶
type CodeCompileProviderInterface interface { // 初始化 Init(code string, workDir string) error // 执行编译 Compile() (result bool, errmsg string) // 清理工作目录 Clean() // 获取程序的运行命令参数组 GetRunArgs() (args []string) // 判断STDERR的输出内容是否存在编译错误信息,通常用于脚本语言的判定, IsCompileError(remsg string) bool // 是否为实时编译的语言 IsRealTime() bool // 是否已经编译完毕 IsReady() bool // 获取提供程序的名称 GetName() string // contains filtered or unexported methods }
CodeCompileProviderInterface 代码编译提供程序接口定义
type CompileCommandsStruct ¶
type CompileCommandsStruct struct { GNUC string `json:"gcc"` GNUCPP string `json:"g++"` Java string `json:"java"` Go string `json:"golang"` NodeJS string `json:"nodejs"` PHP string `json:"php"` Ruby string `json:"ruby"` Python2 string `json:"python2"` Python3 string `json:"python3"` Rust string `json:"rust"` }
CompileCommandsStruct 编译命令集
type GnucCompileProvider ¶
type GnucCompileProvider struct {
CodeCompileProvider
}
GnucCompileProvider c语言编译提供程序
func NewGnucCompileProvider ¶
func NewGnucCompileProvider() *GnucCompileProvider
NewGnucCompileProvider 创建一个c语言编译提供程序
func (*GnucCompileProvider) Compile ¶
func (prov *GnucCompileProvider) Compile() (result bool, errmsg string)
Compile 编译程序
func (*GnucCompileProvider) GetRunArgs ¶
func (prov *GnucCompileProvider) GetRunArgs() (args []string)
GetRunArgs 获取运行参数
func (*GnucCompileProvider) Init ¶
func (prov *GnucCompileProvider) Init(code string, workDir string) error
Init 初始化
func (*GnucCompileProvider) IsCompileError ¶
func (prov *GnucCompileProvider) IsCompileError(remsg string) bool
IsCompileError 是否编译错误
func (*GnucCompileProvider) ManualCompile ¶
func (prov *GnucCompileProvider) ManualCompile(source string, target string, libraryDir []string) (bool, string)
ManualCompile 执行手动编译
type GnucppCompileProvider ¶
type GnucppCompileProvider struct {
CodeCompileProvider
}
GnucppCompileProvider c++语言编译提供程序
func NewGnucppCompileProvider ¶
func NewGnucppCompileProvider() *GnucppCompileProvider
NewGnucppCompileProvider 创建一个c++语言编译提供程序
func (*GnucppCompileProvider) Compile ¶
func (prov *GnucppCompileProvider) Compile() (result bool, errmsg string)
Compile 编译程序
func (*GnucppCompileProvider) GetRunArgs ¶
func (prov *GnucppCompileProvider) GetRunArgs() (args []string)
GetRunArgs 获取运行参数
func (*GnucppCompileProvider) Init ¶
func (prov *GnucppCompileProvider) Init(code string, workDir string) error
Init 初始化
func (*GnucppCompileProvider) IsCompileError ¶
func (prov *GnucppCompileProvider) IsCompileError(remsg string) bool
IsCompileError 是否编译错误
func (*GnucppCompileProvider) ManualCompile ¶
func (prov *GnucppCompileProvider) ManualCompile(source string, target string, libraryDir []string) (bool, string)
ManualCompile 执行手动编译
type GolangCompileProvider ¶
type GolangCompileProvider struct {
CodeCompileProvider
}
GolangCompileProvider go语言编译提供程序
func NewGolangCompileProvider ¶
func NewGolangCompileProvider() *GolangCompileProvider
NewGolangCompileProvider 创建一个go语言编译提供程序
func (*GolangCompileProvider) Compile ¶
func (prov *GolangCompileProvider) Compile() (result bool, errmsg string)
Compile 编译程序
func (*GolangCompileProvider) GetRunArgs ¶
func (prov *GolangCompileProvider) GetRunArgs() (args []string)
GetRunArgs 获取运行参数
func (*GolangCompileProvider) Init ¶
func (prov *GolangCompileProvider) Init(code string, workDir string) error
Init 初始化
func (*GolangCompileProvider) IsCompileError ¶
func (prov *GolangCompileProvider) IsCompileError(remsg string) bool
IsCompileError 是否编译错误
func (*GolangCompileProvider) ManualCompile ¶
func (prov *GolangCompileProvider) ManualCompile(source string, target string) (bool, string)
ManualCompile 执行手动编译
type JavaCompileProvider ¶
type JavaCompileProvider struct { CodeCompileProvider // contains filtered or unexported fields }
JavaCompileProvider java语言编译提供程序
func NewJavaCompileProvider ¶
func NewJavaCompileProvider() *JavaCompileProvider
NewJavaCompileProvider 创建一个java语言编译提供程序
func (*JavaCompileProvider) Compile ¶
func (prov *JavaCompileProvider) Compile() (result bool, errmsg string)
Compile 编译程序
func (*JavaCompileProvider) GetRunArgs ¶
func (prov *JavaCompileProvider) GetRunArgs() (args []string)
GetRunArgs 获取运行参数
func (*JavaCompileProvider) Init ¶
func (prov *JavaCompileProvider) Init(code string, workDir string) error
Init 初始化
func (*JavaCompileProvider) IsCompileError ¶
func (prov *JavaCompileProvider) IsCompileError(remsg string) bool
IsCompileError 是否编译错误
type NodeJSCompileProvider ¶
type NodeJSCompileProvider struct {
CodeCompileProvider
}
NodeJSCompileProvider nodejs语言编译提供程序
func NewNodeJSCompileProvider ¶
func NewNodeJSCompileProvider() *NodeJSCompileProvider
NewNodeJSCompileProvider 创建一个nodejs语言编译提供程序
func (*NodeJSCompileProvider) Compile ¶
func (prov *NodeJSCompileProvider) Compile() (result bool, errmsg string)
Compile 编译程序
func (*NodeJSCompileProvider) GetRunArgs ¶
func (prov *NodeJSCompileProvider) GetRunArgs() (args []string)
GetRunArgs 获取运行参数
func (*NodeJSCompileProvider) Init ¶
func (prov *NodeJSCompileProvider) Init(code string, workDir string) error
Init 初始化
func (*NodeJSCompileProvider) IsCompileError ¶
func (prov *NodeJSCompileProvider) IsCompileError(remsg string) bool
IsCompileError 是否编译错误
type PHPCompileProvider ¶
type PHPCompileProvider struct {
CodeCompileProvider
}
PHPCompileProvider php语言编译提供程序
func NewPHPCompileProvider ¶
func NewPHPCompileProvider() *PHPCompileProvider
NewPHPCompileProvider 创建一个php语言编译提供程序
func (*PHPCompileProvider) Compile ¶
func (prov *PHPCompileProvider) Compile() (result bool, errmsg string)
Compile 编译程序
func (*PHPCompileProvider) GetRunArgs ¶
func (prov *PHPCompileProvider) GetRunArgs() (args []string)
GetRunArgs 获取运行参数
func (*PHPCompileProvider) Init ¶
func (prov *PHPCompileProvider) Init(code string, workDir string) error
Init 初始化
func (*PHPCompileProvider) IsCompileError ¶
func (prov *PHPCompileProvider) IsCompileError(remsg string) bool
IsCompileError 是否编译错误
type Py2CompileProvider ¶
type Py2CompileProvider struct {
CodeCompileProvider
}
Py2CompileProvider python2语言编译提供程序
func NewPy2CompileProvider ¶
func NewPy2CompileProvider() *Py2CompileProvider
NewPy2CompileProvider 创建一个python2语言编译提供程序
func (*Py2CompileProvider) Compile ¶
func (prov *Py2CompileProvider) Compile() (result bool, errmsg string)
Compile 编译程序
func (*Py2CompileProvider) GetRunArgs ¶
func (prov *Py2CompileProvider) GetRunArgs() (args []string)
GetRunArgs 获取运行参数
func (*Py2CompileProvider) Init ¶
func (prov *Py2CompileProvider) Init(code string, workDir string) error
Init 初始化
func (*Py2CompileProvider) IsCompileError ¶
func (prov *Py2CompileProvider) IsCompileError(remsg string) bool
IsCompileError 是否编译错误
type Py3CompileProvider ¶
type Py3CompileProvider struct {
CodeCompileProvider
}
Py3CompileProvider python3语言编译提供程序
func NewPy3CompileProvider ¶
func NewPy3CompileProvider() *Py3CompileProvider
NewPy3CompileProvider 创建一个python3语言编译提供程序
func (*Py3CompileProvider) Compile ¶
func (prov *Py3CompileProvider) Compile() (result bool, errmsg string)
Compile 编译程序
func (*Py3CompileProvider) GetRunArgs ¶
func (prov *Py3CompileProvider) GetRunArgs() (args []string)
GetRunArgs 获取运行参数
func (*Py3CompileProvider) Init ¶
func (prov *Py3CompileProvider) Init(code string, workDir string) error
Init 初始化
func (*Py3CompileProvider) IsCompileError ¶
func (prov *Py3CompileProvider) IsCompileError(remsg string) bool
IsCompileError 是否编译错误
type RubyCompileProvider ¶
type RubyCompileProvider struct {
CodeCompileProvider
}
RubyCompileProvider ruby语言编译提供程序
func NewRubyCompileProvider ¶
func NewRubyCompileProvider() *RubyCompileProvider
NewRubyCompileProvider 创建一个ruby语言编译提供程序
func (*RubyCompileProvider) Compile ¶
func (prov *RubyCompileProvider) Compile() (result bool, errmsg string)
Compile 编译程序
func (*RubyCompileProvider) GetRunArgs ¶
func (prov *RubyCompileProvider) GetRunArgs() (args []string)
GetRunArgs 获取运行参数
func (*RubyCompileProvider) Init ¶
func (prov *RubyCompileProvider) Init(code string, workDir string) error
Init 初始化
func (*RubyCompileProvider) IsCompileError ¶
func (prov *RubyCompileProvider) IsCompileError(remsg string) bool
IsCompileError 是否编译错误
type RustCompileProvider ¶
type RustCompileProvider struct {
CodeCompileProvider
}
RustCompileProvider rust语言编译提供程序
func NewRustCompileProvider ¶
func NewRustCompileProvider() *RustCompileProvider
NewRustCompileProvider 创建一个rust语言编译提供程序
func (*RustCompileProvider) Compile ¶
func (prov *RustCompileProvider) Compile() (result bool, errmsg string)
Compile 编译程序
func (*RustCompileProvider) GetRunArgs ¶
func (prov *RustCompileProvider) GetRunArgs() (args []string)
GetRunArgs 获取运行参数
func (*RustCompileProvider) Init ¶
func (prov *RustCompileProvider) Init(code string, workDir string) error
Init 初始化
func (*RustCompileProvider) IsCompileError ¶
func (prov *RustCompileProvider) IsCompileError(remsg string) bool
IsCompileError 是否编译错误