Reassemble modified code from IDE

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
ker2x
User
User
Posts: 38
Joined: Sat May 10, 2008 7:52 am
Location: SecondLife

Reassemble modified code from IDE

Post by ker2x »

Friendly greetings \o/

When i work on a project a create 2 additionnal executable : produce-asm.exe and reassemble.exe.
They are just calling the pb compiler with the right option :
- to produce a .asm file
- to compile the asm code i just modified in a .exe

It can totally easily be done from shell but.... windows :|

I'd love to have 2 buttons :
- create .asm
- raessemble

Here is the header of my code :

Code: Select all

;RunProgram(#PB_Compiler_Home+"\Compilers\pbcompiler.exe",  Chr(34)+ "E:\purebasic\buddhabrot3\main.pb" + Chr(34) + " /COMMENTED /SSE2 /EXE " + Chr(34)+ "E:\purebasic\buddhabrot3\buddha3.exe" +Chr(34) , "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Hide)
;RunProgram(#PB_Compiler_Home+"\Compilers\pbcompiler.exe",  Chr(34)+ "E:\purebasic\buddhabrot3\main.pb" + Chr(34) + " /REASM /SSE2 /EXE " + Chr(34)+ "E:\purebasic\buddhabrot3\buddha3.exe" +Chr(34) , "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Hide)
;Return
I uncomment the 1st and 3rd line then compile to "create-asm.exe"
I do the same thing for 2nd and 3rd then compile to "reassemble.exe"
After than i keep all 3 line commented and i write my application code :)

The feature would save me this, no big deal if it's not implemented :mrgreen:
Amilcar Matos
User
User
Posts: 43
Joined: Thu Nov 27, 2014 3:10 pm
Location: San Juan, Puerto Rico

Re: Reassemble modified code from IDE

Post by Amilcar Matos »

Hello Ker2x:
Your two buttons request is a good idea and motivated me to think on a possible alternative. The code below is one option.

Compile this code to an executable and install that executable as a tool to your IDE. Then instruct the IDE to run this tool when the source code is closed; and voila! You have two buttons to ease your task – no more uncommenting required.

The code below is just a skeleton for this idea, hope it helps.

Code: Select all

;{- Program header
;==Code Header Comment==============================
;        Name/title: TwoButtons.pb
;   Executable name: TwoButtons.exe
;           Version: 0.1
;            Author: Amílcar Matos Pérez
;     Collaborators: 
;    Translation by: 
;       Create date: 01/Dec/2015
; Previous releases: 
;Most recent update: 
; Release date/hour: 
;  Operating system: Windows  [X]GUI
;  Compiler version: PureBasic 5.31 (x86)
;         Copyright: (c)2015 AMP
;           License: Free to use and improve.
;         Libraries: 
;             Forum: http://www.purebasic.fr/english/viewtopic.php?f=3&t=64149
;  Tested platforms: Windows
;       Explanation: To ease the task of running compiler options.
; ==================================================
;.......10........20........30........40........50........60........70........80
;}

; Both buttons
;RunProgram(#PB_Compiler_Home+"\Compilers\pbcompiler.exe", Chr(34) + "E:\purebasic\buddhabrot3\main.pb" + Chr(34) + " /COMMENTED /SSE2 /EXE " + Chr(34) + "E:\purebasic\buddhabrot3\buddha3.exe" + Chr(34), "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Hide)
;RunProgram(#PB_Compiler_Home+"\Compilers\pbcompiler.exe", Chr(34) + "E:\purebasic\buddhabrot3\main.pb" + Chr(34) + " /REASM /SSE2 /EXE "     + Chr(34) + "E:\purebasic\buddhabrot3\buddha3.exe" + Chr(34), "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Hide)
;Return

;{ Form Designer for Purebasic - 5.31
; Warning: this file uses a strict syntax, if you edit it, make sure to respect the Form Designer limitation or it won't be opened again.

; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.

Global Window_0
Global Button_0, Button_1, Button_2, Text_0, Text_1, String_0, String_1, Button_3, Button_4, Text_2, String_2

Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
  
     Flags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered
  Window_0 = OpenWindow(#PB_Any, x, y, width, height, "TwoButtons", Flags)
     
    Text_0 = TextGadget(#PB_Any, 30, 40 , 110, 15, "Compiler location")  
    Text_1 = TextGadget(#PB_Any, 30, 120, 100, 15, "Code location"    )  
    Text_2 = TextGadget(#PB_Any, 30, 200, 100, 15, "Code destination" )  
  String_0 = StringGadget(#PB_Any, 30, 60 , 480, 30, #NULL$)  
  String_1 = StringGadget(#PB_Any, 30, 140, 480, 30, #NULL$)  
  String_2 = StringGadget(#PB_Any, 30, 220, 480, 30, #NULL$)  
  
  Button_0 = ButtonGadget(#PB_Any, 330, 340, 100, 25, "Create ASM")  
  Button_1 = ButtonGadget(#PB_Any, 210, 340, 100, 25, "Reassemble")  
  Button_2 = ButtonGadget(#PB_Any, 460, 340, 100, 25, "Cancel"    )  
  Button_3 = ButtonGadget(#PB_Any, 520, 60 , 50 , 30, "Browse"    )  
  Button_4 = ButtonGadget(#PB_Any, 520, 140, 50 , 30, "Browse"    )  
EndProcedure

Procedure Window_0_Events(Event)
  Select Event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure
;}

;{ Program execution starts here.
OpenWindow_0()

;{ fill the string gadgets with default content.
Txt$ = #PB_Compiler_Home + "\Compilers\pbcompiler.exe"
SetGadgetText(String_0, Txt$)
Txt$ = "E:\purebasic\buddhabrot3\main.pb"
SetGadgetText(String_1, Txt$)
Txt$ = "E:\purebasic\buddhabrot3\buddha3.exe"
SetGadgetText(String_2, Txt$)
;}

;{ show time!!!
Quit = #True
While Quit <> #False
  Event = WaitWindowEvent()
   Quit = Window_0_Events(Event)
Wend
;}

End
;} Program execution stops here.
Post Reply