debug

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Eval = &framework.Command{
	Name:               "eval",
	PermissionRequired: 0,
	OwnerOnly:          true,
	Help:               "",
	Exec: func(ctx *framework.Context) error {
		t := time.AfterFunc(2*time.Second, func() {
			vm.Interrupt("Timeout")
		})
		defer t.Stop()
		defer vm.ClearInterrupt()
		vm.Set("print", func(v ...interface{}) {
			ctx.Reply(fmt.Sprintf("%v", v))
		})
		vm.Set("ctx", ctx)

		transpiledJS, err := transpile(ctx.TakeRest())
		if err != nil {
			return err
		}
		fmt.Println("Running: " + transpiledJS)
		v, err := vm.RunString(transpiledJS)
		if err != nil {
			return err
		}
		if len(v.String()) > 0 {
			ctx.Reply(v.String())
		}
		return nil
	},
	Setup: setup,
}
View Source
var MsgInfo = &framework.Command{
	Name:               "msginfo",
	PermissionRequired: 0,
	Exec: func(ctx *framework.Context) error {
		msg, err := ctx.GetPreviousMessage()
		if err != nil {
			return err
		}
		ctx.Reply("Message info has been sent to the console")
		spew.Dump(msg)
		return nil
	},
}
View Source
var Uiua = &framework.Command{
	Name:               "uiua",
	PermissionRequired: 0,
	Exec: func(ctx *framework.Context) error {
		input := ctx.TakeRest()
		h := cgo.NewHandle(ctx)
		defer h.Delete()

		input_c := C.CString(input)
		defer C.free(unsafe.Pointer(input_c))

		res_c := C.run_uiua(C.uintptr_t(h), input_c)
		defer C.drop_string(res_c)

		res := C.GoString(res_c)
		_, err := ctx.Reply(fmt.Sprintf("```\n%v\n```", res))
		if err != nil {
			return err
		}

		return nil
	},
}

Functions

This section is empty.

Types

type TranspileFunc

type TranspileFunc func(string) (string, error)

Jump to

Keyboard shortcuts

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