LoginSignup
2
2

More than 5 years have passed since last update.

smallbasicでgo ide

Posted at

smallbasicでgo言語のideを作りました。
自作のエクステンション使ってます。
go.PNG

C = Text.GetCharacter(34)
R = Text.GetCharacter(13) + Text.GetCharacter(10)
code = ""
code = code + "package main" + R 
code = code + "import " + C + "fmt" + C + R
code = code + R
code = code + "func main() {"  + R
code = code + "   fmt.Printf(" + C + "Hello, world\n" + C + ") " + R
code = code + "}" + R
GraphicsWindow.BackgroundColor = "skyblue"
button = Controls.AddButton("caption", 300, 300)
Controls.SetButtonCaption(button, "go")
textbox = Controls.AddTextBox(10, 300)
Controls.SetTextBoxText(textbox, "main.go")
mtextbox = Controls.AddMultiLineTextBox(0, 0)
Controls.HideControl(mtextbox)
Controls.SetSize(mtextbox, 400, 280) 
Controls.SetTextBoxText(mtextbox, code)
Controls.Move(mtextbox, 10, 10)
Controls.ShowControl(mtextbox)
Controls.ButtonClicked = output
Sub output
  file = "c:\go\" + Controls.GetTextBoxText(textbox)
  text = Controls.GetTextBoxText(mtextbox)
  TextWindow.WriteLine("run")
  File.WriteContents(file, text)
  code = ""
  code = code + "Function setup(a)" + R 
  code = code + "Set obj = CreateObject(" + C + "WScript.Shell" + C + ")" + R
  code = code + "  obj.run " + C + "cmd /K CD C:\go & go run " + file + C + R
  code = code + "setup = "  + C + C + R
  code = code + "End Function" + R
  a = Class1.VBSrun(code)
EndSub

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2