provider

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

GCC Compiler Provider * (C) 2019 LanceLRQ * * This code is licenced under the GPLv3.

Golang Compiler Provider * (C) 2019 LanceLRQ * * This code is licenced under the GPLv3.

Java Compiler Provider * (C) 2019 LanceLRQ * * This code is licenced under the GPLv3.

Compiler Provider Base * (C) 2019 LanceLRQ * * This code is licenced under the GPLv3.

NodeJS Compiler Provider * (C) 2019 LanceLRQ * * This code is licenced under the GPLv3.

PHP Compiler Provider * (C) 2019 LanceLRQ * * This code is licenced under the GPLv3.

Python Compiler Provider * (C) 2019 LanceLRQ * * This code is licenced under the GPLv3.

Ruby Compiler Provider * (C) 2019 LanceLRQ * * This code is licenced under the GPLv3.

Index

Constants

This section is empty.

Variables

View Source
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",
}

Functions

func PlaceCompilerCommands

func PlaceCompilerCommands(configFile string) error

Types

type CodeCompileProvider

type CodeCompileProvider struct {
	CodeCompileProviderInterface
	Name string // 编译器提供程序名称
	// contains filtered or unexported fields
}

func (*CodeCompileProvider) Clean

func (prov *CodeCompileProvider) Clean()

func (*CodeCompileProvider) GetName

func (prov *CodeCompileProvider) GetName() string

func (*CodeCompileProvider) IsReady

func (prov *CodeCompileProvider) IsReady() bool

func (*CodeCompileProvider) IsRealTime

func (prov *CodeCompileProvider) IsRealTime() bool

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
}

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"`
}

type GnucCompileProvider

type GnucCompileProvider struct {
	CodeCompileProvider
}

func NewGnucCompileProvider

func NewGnucCompileProvider() *GnucCompileProvider

func (*GnucCompileProvider) Compile

func (prov *GnucCompileProvider) Compile() (result bool, errmsg string)

func (*GnucCompileProvider) GetRunArgs

func (prov *GnucCompileProvider) GetRunArgs() (args []string)

func (*GnucCompileProvider) Init

func (prov *GnucCompileProvider) Init(code string, workDir string) error

func (*GnucCompileProvider) IsCompileError

func (prov *GnucCompileProvider) IsCompileError(remsg string) bool

func (*GnucCompileProvider) ManualCompile

func (prov *GnucCompileProvider) ManualCompile(source string, target string, libraryDir []string) (bool, string)

手动编译

type GnucppCompileProvider

type GnucppCompileProvider struct {
	CodeCompileProvider
}

func NewGnucppCompileProvider

func NewGnucppCompileProvider() *GnucppCompileProvider

func (*GnucppCompileProvider) Compile

func (prov *GnucppCompileProvider) Compile() (result bool, errmsg string)

func (*GnucppCompileProvider) GetRunArgs

func (prov *GnucppCompileProvider) GetRunArgs() (args []string)

func (*GnucppCompileProvider) Init

func (prov *GnucppCompileProvider) Init(code string, workDir string) error

func (*GnucppCompileProvider) IsCompileError

func (prov *GnucppCompileProvider) IsCompileError(remsg string) bool

func (*GnucppCompileProvider) ManualCompile

func (prov *GnucppCompileProvider) ManualCompile(source string, target string, libraryDir []string) (bool, string)

手动编译

type GolangCompileProvider

type GolangCompileProvider struct {
	CodeCompileProvider
}

func NewGolangCompileProvider

func NewGolangCompileProvider() *GolangCompileProvider

func (*GolangCompileProvider) Compile

func (prov *GolangCompileProvider) Compile() (result bool, errmsg string)

func (*GolangCompileProvider) GetRunArgs

func (prov *GolangCompileProvider) GetRunArgs() (args []string)

func (*GolangCompileProvider) Init

func (prov *GolangCompileProvider) Init(code string, workDir string) error

func (*GolangCompileProvider) IsCompileError

func (prov *GolangCompileProvider) IsCompileError(remsg string) bool

func (*GolangCompileProvider) ManualCompile

func (prov *GolangCompileProvider) ManualCompile(source string, target string) (bool, string)

手动编译

type JavaCompileProvider

type JavaCompileProvider struct {
	CodeCompileProvider
	// contains filtered or unexported fields
}

func NewJavaCompileProvider

func NewJavaCompileProvider() *JavaCompileProvider

func (*JavaCompileProvider) Compile

func (prov *JavaCompileProvider) Compile() (result bool, errmsg string)

func (*JavaCompileProvider) GetRunArgs

func (prov *JavaCompileProvider) GetRunArgs() (args []string)

func (*JavaCompileProvider) Init

func (prov *JavaCompileProvider) Init(code string, workDir string) error

func (*JavaCompileProvider) IsCompileError

func (prov *JavaCompileProvider) IsCompileError(remsg string) bool

type NodeJSCompileProvider

type NodeJSCompileProvider struct {
	CodeCompileProvider
}

func NewNodeJSCompileProvider

func NewNodeJSCompileProvider() *NodeJSCompileProvider

func (*NodeJSCompileProvider) Compile

func (prov *NodeJSCompileProvider) Compile() (result bool, errmsg string)

func (*NodeJSCompileProvider) GetRunArgs

func (prov *NodeJSCompileProvider) GetRunArgs() (args []string)

func (*NodeJSCompileProvider) Init

func (prov *NodeJSCompileProvider) Init(code string, workDir string) error

func (*NodeJSCompileProvider) IsCompileError

func (prov *NodeJSCompileProvider) IsCompileError(remsg string) bool

type PHPCompileProvider

type PHPCompileProvider struct {
	CodeCompileProvider
}

func NewPHPCompileProvider

func NewPHPCompileProvider() *PHPCompileProvider

func (*PHPCompileProvider) Compile

func (prov *PHPCompileProvider) Compile() (result bool, errmsg string)

func (*PHPCompileProvider) GetRunArgs

func (prov *PHPCompileProvider) GetRunArgs() (args []string)

func (*PHPCompileProvider) Init

func (prov *PHPCompileProvider) Init(code string, workDir string) error

func (*PHPCompileProvider) IsCompileError

func (prov *PHPCompileProvider) IsCompileError(remsg string) bool

type Py2CompileProvider

type Py2CompileProvider struct {
	CodeCompileProvider
}

func NewPy2CompileProvider

func NewPy2CompileProvider() *Py2CompileProvider

func (*Py2CompileProvider) Compile

func (prov *Py2CompileProvider) Compile() (result bool, errmsg string)

func (*Py2CompileProvider) GetRunArgs

func (prov *Py2CompileProvider) GetRunArgs() (args []string)

func (*Py2CompileProvider) Init

func (prov *Py2CompileProvider) Init(code string, workDir string) error

func (*Py2CompileProvider) IsCompileError

func (prov *Py2CompileProvider) IsCompileError(remsg string) bool

type Py3CompileProvider

type Py3CompileProvider struct {
	CodeCompileProvider
}

func NewPy3CompileProvider

func NewPy3CompileProvider() *Py3CompileProvider

func (*Py3CompileProvider) Compile

func (prov *Py3CompileProvider) Compile() (result bool, errmsg string)

func (*Py3CompileProvider) GetRunArgs

func (prov *Py3CompileProvider) GetRunArgs() (args []string)

func (*Py3CompileProvider) Init

func (prov *Py3CompileProvider) Init(code string, workDir string) error

func (*Py3CompileProvider) IsCompileError

func (prov *Py3CompileProvider) IsCompileError(remsg string) bool

type RubyCompileProvider

type RubyCompileProvider struct {
	CodeCompileProvider
}

func NewRubyCompileProvider

func NewRubyCompileProvider() *RubyCompileProvider

func (*RubyCompileProvider) Compile

func (prov *RubyCompileProvider) Compile() (result bool, errmsg string)

func (*RubyCompileProvider) GetRunArgs

func (prov *RubyCompileProvider) GetRunArgs() (args []string)

func (*RubyCompileProvider) Init

func (prov *RubyCompileProvider) Init(code string, workDir string) error

func (*RubyCompileProvider) IsCompileError

func (prov *RubyCompileProvider) IsCompileError(remsg string) bool

type RustCompileProvider added in v0.0.8

type RustCompileProvider struct {
	CodeCompileProvider
}

func NewRustCompileProvider added in v0.0.8

func NewRustCompileProvider() *RustCompileProvider

func (*RustCompileProvider) Compile added in v0.0.8

func (prov *RustCompileProvider) Compile() (result bool, errmsg string)

func (*RustCompileProvider) GetRunArgs added in v0.0.8

func (prov *RustCompileProvider) GetRunArgs() (args []string)

func (*RustCompileProvider) Init added in v0.0.8

func (prov *RustCompileProvider) Init(code string, workDir string) error

func (*RustCompileProvider) IsCompileError added in v0.0.8

func (prov *RustCompileProvider) IsCompileError(remsg string) bool

Jump to

Keyboard shortcuts

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