api

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: BSD-1-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolFromQuery

func BoolFromQuery(r *http.Request, key string, defaultVal bool) (bool, error)

BoolFromQuery obtains a boolean from a query entry.

func ExportedSymbolsOfPackage

func ExportedSymbolsOfPackage(pg *cxcore.CXProgram, pkgName string) http.HandlerFunc

ExportedSymbolsOfPackage returns exported symbols of a given package.

func PackagesOfProgram

func PackagesOfProgram(pg *cxcore.CXProgram) http.HandlerFunc

PackagesOfProgram returns an array of package names of a given program.

func ProgramMeta

func ProgramMeta(pg *cxcore.CXProgram) http.HandlerFunc

ProgramMeta returns the program meta data.

func ReadJSON

func ReadJSON(r *http.Request, v interface{}) error

ReadJSON reads the request body to a json object.

func WriteJSON

func WriteJSON(w http.ResponseWriter, r *http.Request, code int, v interface{})

WriteJSON writes a json object on a http.ResponseWriter with the given code, panics on marshaling error

Types

type API

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

API represents an HTTP API.

func NewAPI

func NewAPI(root string, pg *cxcore.CXProgram) *API

NewAPI returns a new API given a CX Program.

func (*API) ServeHTTP

func (a *API) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler

type ExportedSymbol

type ExportedSymbol struct {
	Name      string      `json:"name"`
	Signature interface{} `json:"signature,omitempty"`
	Type      int         `json:"type"`
	TypeName  string      `json:"type_name"`
}

ExportedSymbol represents a single exported cx symbol.

type ExportedSymbolsResp

type ExportedSymbolsResp struct {
	Functions []ExportedSymbol `json:"functions"`
	Structs   []ExportedSymbol `json:"structs"`
	Globals   []ExportedSymbol `json:"globals"`
}

ExportedSymbolsResp is the exported symbols response.

type ProgramMetaResp

type ProgramMetaResp struct {
	UsedHeapMemory int `json:"used_heap_memory"`
	FreeHeapMemory int `json:"free_heap_memory"`
	StackSize      int `json:"stack_size"`
	CallStackSize  int `json:"call_stack_size"`
}

ProgramMetaResp is a program meta data response.

Jump to

Keyboard shortcuts

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