Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cl/_testspx/multiworks/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (this *Game) MainEntry() {
this.Server("protos")
}
func (this *Game) Main() {
mcp.Gopt_Game_Main(this, []mcp.ToolProto{new(hello)}, []mcp.PromptProto{new(foo)})
mcp.Gopt_Game_Main(this, nil, []mcp.ToolProto{new(hello)}, []mcp.PromptProto{new(foo)})
}
func (this *foo) Main(_gop_arg0 *mcp.Tool) string {
this.Prompt.Main(_gop_arg0)
Expand Down
12 changes: 8 additions & 4 deletions cl/classfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,15 @@ func gmxProjMain(pkg *gogen.Package, parent *pkgCtx, proj *gmxProject) {
tslice := sigParams.At(i).Type()
tn := tslice.(*types.Slice).Elem().(*types.Named)
sp := spriteByProto(sprites, tn.Obj().Name())
for _, spt := range sp.types {
spto := pkg.Ref(spt)
cb.Val(new).Val(spto).Call(1)
if n := len(sp.types); n > 0 {
for _, spt := range sp.types {
spto := pkg.Ref(spt)
cb.Val(new).Val(spto).Call(1)
}
cb.SliceLitEx(tslice, n, false)
} else {
cb.Val(nil)
}
cb.SliceLitEx(tslice, len(sp.types), false)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions cl/cltest/cltest.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func LookupClass(ext string) (c *modfile.Project, ok bool) {
Works: []*modfile.Class{
{Ext: "_tool.gox", Class: "Tool", Proto: "ToolProto"},
{Ext: "_prompt.gox", Class: "Prompt", Proto: "PromptProto"},
{Ext: "_res.gox", Class: "Resource", Proto: "ResourceProto"},
},
PkgPaths: []string{"github.com/goplus/gop/cl/internal/mcp"}}, true
}
Expand Down
12 changes: 11 additions & 1 deletion cl/internal/mcp/classfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ func (p *Prompt) Main(*Tool) string {
return ""
}

type Resource struct {
}

func (p *Resource) Main() {
}

type ToolProto interface {
Main(name string) int
}
Expand All @@ -53,5 +59,9 @@ type PromptProto interface {
Main(*Tool) string
}

func Gopt_Game_Main(game interface{ initGame() }, tools []ToolProto, prompts []PromptProto) {
type ResourceProto interface {
Main()
}

func Gopt_Game_Main(game interface{ initGame() }, resources []ResourceProto, tools []ToolProto, prompts []PromptProto) {
}