smallbasic에서 go ide

1710 단어 5smallbasicIDE
smallbasic에서 go 언어의 ide를 만들었습니다.
자작의 익스텐션 사용하고 있습니다.

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

좋은 웹페이지 즐겨찾기