Page 1 sur 1

Commutateur /REASM (Fred ?? ) [expliqué]

Publié : mar. 22/oct./2013 13:32
par Backup
j'essai de recompiler un prg Asm (precedement generé par EBP )

le fichier Asm me semble correcte ....

j'ai un probleme avec le commutateur /Reasm
en effet , je donne a manger le fichier "test_ass_x86.asm" au compilateur
Image

et en sortie j'ai un message d'erreur qui me dit :
Image

pourquoi me parle t'il de "PureBasic.asm" alors qu'il s'agit de "test_ass_x86.asm" 8O

de plus j'ai vérifié les chemins, tout est bon ... le fichier Exe n'est pas genéré suite a cette erreur ??



[reedit] c'est bien ce que je craignais , tout marche si le Prg porte le nom de "PureBasic.asm" !!
il n'y aurai pas un Bug là ??? :mrgreen:

Re: Commutateur /REASM (Fred ?? ) soupçon de Bug PB 5.20 L

Publié : mer. 23/oct./2013 0:29
par PAPIPP
Bonjour Dobro
Parce que le nom de sortie par défaut est "purebasic.asm"
Pb identique avec pureasm de ERIX14

Voici à titre d'exemple un prg pour utiliser pureasm ou notepad

Code : Tout sélectionner

Procedure.l FindTargetPIDByWindowName(Name.s,Opt.l=0)
  ;Opt option pour obtenir soit le PID soit Handle
  ;opt=O par defaut donne PID
  ;opt=1 donne le Handle
  ; Name est le nom window
  
  Define.l hWnd,Pid
  hWnd=FindWindow_(#Null,Name)
  If hWnd<>0
    GetWindowThreadProcessId_(hWnd,@Pid)
  EndIf
  If opt=0
    ProcedureReturn Pid
  Else
    ProcedureReturn hWnd
  EndIf
EndProcedure
ExamineDesktops()
HAUTEUR_W=DesktopHeight(0)
Largeur_W=DesktopWidth(0)

Nb_param=CountProgramParameters()
Dim Tparam.s{256}(Nb_param)
For param=0 To NB_PARAM
  Tparam(param)=ProgramParameter(Param)
  If Tparam(param)<>""
    If LCase(Tparam(param))="/notepad"
      EDIT.B=1
    Else
      EDIT.b=0
    EndIf
  EndIf
Next
fichier$=Trim(Tparam(0))
result$=""
If Nb_param>2
  result$="*** Il manque très certainement les quotes qui encadrent le nom du fichier ***"+#LF$+#LF$
  For param=0 To NB_PARAM
    result$+Tparam(param)+#LF$
  Next
  result$+#LF$+" exemple de paramètre : "+#LF$+Chr(34)+"Nom entier avec répertoire du proramme PB"+Chr(34)+"   [/notepad]"+#LF$
EndIf
If fichier$<>"" And FileSize(fichier$)<0
  result$+#LF$+" Le fichier :"+fichier$+" n'existe pas"
EndIf
If result$<>""
  fichier$=""
  MessageRequester("Erreur dans les paramètres passés. ",result$,#PB_MessageRequester_Ok)
EndIf
Mesg$="Fichier à convertir"

While fichier$=""
  fichier$=OpenFileRequester(Mesg$,"","*.pb;*.pbi",0)
  Mesg$+"Fichier "+Str(Len(Mesg$))
  If Len(Mesg$)>80 
    End
  EndIf  
Wend 

chemin$=GetPathPart(fichier$)
nom_fichier$=Left(GetFilePart(fichier$),Len(GetFilePart(fichier$))-1-Len(GetExtensionPart(fichier$)))
#guil=Chr(34)

;   Debug #PB_Compiler_Home+"/Compilers/pbcompiler"+_s(nom_fichier$)+_s(chemin$)
; ; /DEBUGGER: Enable the debugger
; ; /EXE "Filename": Create an executable To the given filename
; ; /DLL: Create a DLL
; ; /CONSOLE: Create a console executable
; ; /ICON "Filename": ADD an icon To the executable
; ; /RESOURCE "Filename": ADD a resource file (.rc) To the executable
; ; /QUIET: Disable all unnecessary textoutput
; ; /COMMENTED: Produce a commented asm output (PureBasic.asm)
; ; /REASM: Compile the 'PureBasic.asm' file To an executable
; ; /XP: ADD the Windows XP theme support To the executable
; ; /USER: ADD the 'User' hint To the executable (Windows Vista)
; ; /ADMINISTRATOR: ADD the 'Administrator' hint To the executable (Windows Vista)
; ; /INLINEASM: Enable the inline ASM support  ;===>>> N'EXISTE PLUS A PARTIR DE PB520
; ; /RESIDENT "Filename": Create a resident file To the given filename
; ; /IGNORERESIDENT "Filename": ignore the given resident
; ; /LINENUMBERING: Enable line numbering IN the final executable For OnError
; ; /STANDBY: WAIT For external commands (editor, scripts...)
; ; /MMX, /3DNOW, /SSE Or /SSE2: Create a processor specific executable
; ; /DYNAMICCPU: Create a executable containing all processor specific routines
; ; /THREAD: Use thread safe Runtime For strings And general routines
; ; /UNICODE: Use unicode instead ascii For strings management
; ; /PURIFIER: Enable the purifier
; ; /SUBSYSTEM "Name": Use this subsystem To replace a set of internal functions
; ; /CONSTANT Name=Value: Declare a new constant at compile time
; ; /LINKER "ResponsFile": Specify a commands file To be passed To the linker
; ; /CHECK: Check the syntax only, doesn't create/launch the executable
; ;
; ; /LANGUAGE "Language": Uses the specified language For the compiler
; ;
; ; /VERSION: Display the version of the compiler
TAILFIL1=FileSize(chemin$+"purebasic.exe")
If TAILFIL1>0
  DeleteFile(chemin$+"purebasic.exe",#PB_FileSystem_Force)
EndIf
TAILFIL2=FileSize(chemin$+nom_fichier$+".asm")
If TAILFIL2>0
  DeleteFile(chemin$+nom_fichier$+".asm",#PB_FileSystem_Force)
EndIf

Compilateur=RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler",#guil+fichier$+#guil+" /COMMENTED ",chemin$,#PB_Program_Hide | #PB_Program_Open | #PB_Program_Read )
; Compilateur=RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler",#guil+fichier$+#guil+" /COMMENTED ",chemin$,#PB_Program_Hide |  #PB_Program_Wait   )
;   ;   	Compilateur=RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler",#guil+fichier$+#guil+" /COMMENTED /INLINEASM ",chemin$,#PB_Program_Open | #PB_Program_Read)
;   ;   	Compilateur=RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler",#guil+fichier$+#guil+" /COMMENTED ",#PB_Compiler_Home,#PB_Program_Hide|#PB_Program_Open | #PB_Program_Read)
;   ;     Compilateur = RunProgram(CheminPB$ + "PBCompiler.exe", Chr(34) + File + Chr(34) + " /COMMENTED /INLINEASM " + Chr(34) + File + Chr(34) + " /EXE " + Chr(34) + " " + Chr(34),"",1|2)
;   ;     Compilateur = RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler", Chr(34) + fichier$ + Chr(34) + " /COMMENTED /INLINEASM " + Chr(34) + fichier$+ Chr(34) + " /EXE " + Chr(34) + " " + Chr(34),#PB_Program_Open | #PB_Program_Read)
;   ;   Compilateur=RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler",Chr(34)+fichier$+Chr(34)+" /COMMENTED ",#PB_Compiler_Home+"/Compilers/  /INLINEASM",#PB_Program_Open | #PB_Program_Read)
; 	Compilateur=RunProgram("L:\program files\Purebasic\Compilers\pbcompiler",#guil+fichier$+#guil+" /COMMENTED",chemin$,#PB_Program_Open | #PB_Program_Read)
;   Debug _s(fichier$)+_s(chemin$)+_s(nom_fichier$)
Sortie$=""
If Compilateur
  While ProgramRunning(Compilateur)
    If AvailableProgramOutput(Compilateur)
      Sortie$+ReadProgramString(Compilateur)+Chr(13)
    EndIf
  Wend
  exit_code= ProgramExitCode(compilateur)
  Sortie$+Chr(13)+Chr(13)
  Sortie$+"Code de retour : "+Str(ProgramExitCode(Compilateur))
  CloseProgram(Compilateur) ; Ferme la connection vers le compilateur
  If FileSize(chemin$+nom_fichier$+".exe")>0
    DeleteFile(chemin$+nom_fichier$+".exe")
  EndIf
  If RenameFile(chemin$+"purebasic.exe",chemin$+nom_fichier$+".exe")
  Else
    SORTIE$+#LFCR$+" Le fichier "+chemin$+"purebasic.exe ne peut être renommé"
  EndIf
  If FileSize(chemin$+nom_fichier$+".asm")>0
    DeleteFile(chemin$+nom_fichier$+".asm")
  EndIf
  
  If   RenameFile(chemin$+"purebasic.asm",chemin$+nom_fichier$+".asm")
  Else 
    SORTIE$+#LFCR$+" Le fichier "+chemin$+"purebasic.asm ne peut être renommé"
  EndIf
  If edit=1
    compil=RunProgram("notepad" ,chemin$+nom_fichier$+".asm"," ")
    ;********************************************************************************************************************
    ;       RUN_PRG_AL=RunProgram("notepad",GpathAL$+"file_al.txt","")
    Delay(50)
    cpt=0
    file_c$=nom_fichier$+".asm - Bloc-notes"
    While HNDL_BLOC=0 And cpt<100
      cpt+1
      HNDL_BLOC=FindTargetPIDByWindowName(file_c$,1)
;       Debug _n( HNDL_BLOC)+_s(file_c$)
      Delay(50)
    Wend
    Delay(100)
    SetWindowPos_(HNDL_BLOC,#HWND_NOTOPMOST,10,10,Largeur_w/3+50,HAUTEUR_W-50,0) ;:
    
    ;********************************************************************************************************************
  Else
    compil=RunProgram("L:\program files\PUREASM\pureasm.exe" ,chemin$+nom_fichier$+".asm"," ")
    ;   compil=RunProgram("L:\program files\PB520C\PURASM\pureasm.exe",chemin$+nom_fichier$+".asm"," ")
    
  EndIf
  If exit_code <>0
    MessageRequester("Sortie",Sortie$)
  EndIf  
EndIf

A+

Re: Commutateur /REASM (Fred ?? ) soupçon de Bug PB 5.20 L

Publié : mer. 23/oct./2013 10:46
par Fred
Le fichier doit s'appeler 'PureBasic.asm' pour que ca marche, ca en a toujours été ainsi.

Re: Commutateur /REASM (Fred ?? ) soupçon de Bug PB 5.20 L

Publié : mer. 23/oct./2013 11:22
par Backup
ben , ????

pourquoi ne pas recuperer le nom du fichier trucmuch.asm , qu'on fourni au compilateur ??

lorsqu'on compile un prg pb-> exe , le compilateur est bien capable de nommer l'exe finale avec le nom qu'on lui donne ....
meme avec le commutateur /COMMENTED ... pas besoin de passer par "Purebasic".asm ....

pourquoi avoir limité specifiquement /REASM .. ??


ça me parait étonnant, d'avoir a ecrire "Purebasic.exe" apres un /Reasm , pour ensuite le renommer, en Trucmuch.exe
c'est lourd non ?? :)



@PAPIPP : merci , mais tu te doute bien, que je sais deja utiliser le compilateur en ligne de commande ... :wink:
ma question concerne juste cette histoire de nom de fichier de sortie avec le commutateur /REASM
enfin , merci quand meme , pour ceux qui ne savent pas ... mais cela aurai peut etre mérité un topic spécifique :)

Re: Commutateur /REASM (Fred ?? ) soupçon de Bug PB 5.20 L

Publié : mer. 23/oct./2013 11:53
par Fred
Dobro a écrit :meme avec le commutateur /COMMENTED ... pas besoin de passer par "Purebasic".asm ....
Ici le fichier créé est toujours 'PureBasic.asm', indépendamment du nom de l'executable. /REASM est l'inverse de /COMMENTED, et attend donc 'PureBasic.asm'.

Re: Commutateur /REASM (Fred ?? ) soupçon de Bug PB 5.20 L

Publié : mer. 23/oct./2013 12:57
par Backup
ha oui , tu as raison :)

c'est quand meme bizarre de nous forcer a passer par "PureBasic.asm"
et de ne pas te servir du nom du fichier *.pb , que nous fournissons en parametre .... :twisted: mais bon :)