Page 31 of 40

Posted: Sun Nov 12, 2006 1:43 pm
by Falko
@Droopy, can you try this?

Code: Select all

;/ PureBasic 4.0 / Droopy 06/11/06

;/ Oublié que ProcedureDLL.l --> Le .l foutait la merde
;/ Pas pensé que passage d'un pointeur foutait la merde (*toto)
;/ Gestion des paramètres optionnels si précédés de paramètres non optionnels

;{/ Enumerations

Enumeration ;/ Zone Fichier
  #Read
  #Write
  #DebutZone
  #DansZone
  #FinZone
  #HorsZone
EndEnumeration

Enumeration ;/ Zone de Procédure
  #Inconnu
  #Variable
  #Valeur
  #Commentaires
EndEnumeration

;}

Structure DetailProcedure
  Optionnel.l
  NomVariable.s
  Valeur.s
EndStructure

Global NewList Proc.DetailProcedure(), ContenuProcedure.s


Procedure InsertionTBProcedure(Ligne.s)
 
  ClearList(Proc())
 
  ;/ Mise en forme de la ligne
  Ligne=LTrim(RTrim(Ligne))
 
  ;/ Extraction du Nom de la procedure
  NomProcedure.s=StringField(Ligne,2," ")
  NomProcedure=LTrim(RTrim(StringField(NomProcedure,1,"(")))
 
  ;/ Regarde si .? est indiqué après ProcedureDLL et si oui le mémorise dans une variable temporaire
  If Mid(Ligne,13,1)="."
    Type.s=Mid(Ligne,13,2)
  Else
    Type=""
  EndIf
 
  ;/ Garde juste les paramètres
  Ligne.s=Right(Ligne,Len(Ligne)-14-Len(NomProcedure)-Len(Type))
  Ligne.s=LTrim(RTrim(Ligne))
 
  Zone=#Inconnu
  For n=1 To Len(Ligne)
   
    c.s=Mid(Ligne,n,1)
    a=Asc(c)
   
    Select Zone
     
      Case #Inconnu
        If (a>64 And a<91) Or (a>96 And a<123) Or a=42 ;/ C'est un nom de variable ou *
          AddElement(Proc())
          Proc()\NomVariable+c
          Zone=#Variable
        ElseIf c=")"
          Zone=#Commentaires
        EndIf
       
      Case #Variable
        Select c
          Case ")"
            Zone=#Commentaires
          Case ","
            Zone=#Inconnu
          Case " "
           
          Case "="
            NbParaOptionnels+1
            Proc()\Optionnel=1
            Zone=#Valeur
           
          Default
            Proc()\NomVariable+c
        EndSelect
       
       
      Case #Valeur
       
        If a=34 ;/ Détermine si je rentre ou sort d'une zone de guillemet
          If ZoneGuillemet=1
            ZoneGuillemet=0
          Else
            ZoneGuillemet=1
          EndIf
        EndIf
       
        If ZoneGuillemet=1
          Proc()\Valeur+c
        Else
          Select c 
            Case ","
              Zone=#Inconnu
             
            Case ")"
              Zone=#Commentaires
             
            Default
              Proc()\Valeur+c
             
          EndSelect
        EndIf
       
      Case #Commentaires
        Commentaires.s+c
       
    EndSelect
  Next
 
 
  Commentaires=LTrim(RTrim(Commentaires))
  Commentaires=LTrim(Right(Commentaires,Len(Commentaires)-1))
 
  If NbParaOptionnels
    ;- Il y a des paramètres optionnels
   
    ; Ecriture de la déclaration
    Temp.s="Declare"+ Type+" "+NomProcedure+Str(NbParaOptionnels+1)+"("
    ForEach Proc()
      Temp+Proc()\NomVariable
     
      If ListIndex(Proc())<CountList(Proc())-1
        Temp+"," ; Ajoute une virgule uniquement si necessaire entre chaque variable
      EndIf
    Next
    Temp+")"
    WriteStringN(#Write,Temp)
   
    For n= 0 To NbParaOptionnels
     
      ; Ecrit le nom de la procédure
      Temp.s=#CRLF$+"ProcedureDLL"+Type+" "+NomProcedure
     
      ; Ecriture du N° de la procédure
      If n
        Temp+Str(n+1)
      EndIf
      Temp+ "("
     
      ; Ecrit juste les paramètres necessaires de la procédure
      For i= 0 To CountList(Proc())-NbParaOptionnels+n-1
       
        SelectElement(Proc(),i)
        Temp+Proc()\NomVariable
       
        If i<CountList(Proc())-NbParaOptionnels+n-1
          Temp+"," ; Ajoute une virgule uniquement si necessaire entre chaque variable
        EndIf
       
      Next
     
      ; Finalise la ligne de ProcedureDLL en y ajoutant les commentaires
      Temp+")"
      If Commentaires<>""
        Temp+" ; "+Commentaires
      EndIf
     
      WriteStringN(#Write,Temp)
      If n=NbParaOptionnels
        ; Ecriture du contenu de la procédure
        WriteStringN(#Write,ContenuProcedure)
      Else
        ; Ecriture de l'appel à la procédure principale
        Temp2.s="  "+NomProcedure+Str(NbParaOptionnels+1)+"("
       
        ForEach Proc()
         
          If ListIndex(Proc())> n+CountList(Proc())-NbParaOptionnels-1
            Temp2+Proc()\Valeur
          Else
            Temp2+Proc()\NomVariable
          EndIf
         
          If ListIndex(Proc())<CountList(Proc())-1
            Temp2+"," ; Ajoute une virgule uniquement si necessaire entre chaque variable
          EndIf
        Next
        Temp2+")"
         
        WriteStringN(#Write,Temp2)
        WriteStringN(#Write,"EndProcedure")
      EndIf
     
    Next
   
   
  Else
    ;- Aucun paramètre optionnels
   
    Temp.s="ProcedureDLL"+Type+" "+NomProcedure+"("
    ForEach Proc()

      Temp+Proc()\NomVariable
      If ListIndex(Proc())<CountList(Proc())-1
        Temp+"," ; Ajoute une virgule uniquement si necessaire entre chaque variable
      EndIf
    Next
   
    Temp+")"
    If Commentaires<>""
      Temp+" ; "+Commentaires
    EndIf
   
    WriteStringN(#Write,Temp)
    WriteStringN(#Write,ContenuProcedure)
   
  EndIf
 
EndProcedure

ProcedureDLL RunTBOP(FileIn.s,FileOut.s,TailbitePath.s,Compile)

  ;{/ Boucle de lecture du fichier en entrée / Génération du fichier de sortie
  
  CreateFile(#Write,FileOut)
  If ReadFile(#Read,FileIn)=0
    End
  EndIf
 
  ZoneFichier=#HorsZone
 
  While Eof(#Read)=0
   
    Ligne.s=ReadString(#Read)
    Temp.s=UCase(LTrim(Ligne))
    If Left(Temp,11)="PROCEDUREDLL"
      ZoneFichier=#DebutZone
      LigneProcedure.s=Ligne
    ElseIf Left(Temp,11)="ENDPROCEDURE" And (ZoneFichier=#DebutZone Or ZoneFichier=#DansZone)
      ZoneFichier=#FinZone
    EndIf
   
    Select ZoneFichier
      Case #HorsZone
        WriteStringN(#Write,Ligne)
      Case #DebutZone
        ZoneFichier=#DansZone
        ContenuProcedure.s=""
      
      Case #DansZone
        If ContenuProcedure=""
          ContenuProcedure.s+Ligne
        Else
          ContenuProcedure.s+#CRLF$+Ligne
        EndIf
       
      Case #FinZone
        ZoneFichier=#HorsZone
       ContenuProcedure+#CRLF$+Ligne
        InsertionTBProcedure(LigneProcedure)
       
    EndSelect
   
  Wend
  ;}
 
  CloseFile(#Read)
  CloseFile(#Write)
 
  If Compile
    RunProgram("TailBite.exe",FileOut,TailbitePath)
  EndIf
EndProcedure

; RunTBOP("c:\Printer_Lib.pb","c:\afficheTBOP.txt","c:\Program Files\PureBasic4\TailBite",#True)
; RunProgram("c:\afficheTBOP.txt","","c:\") 

Posted: Sun Nov 12, 2006 7:56 pm
by Droopy
@ Falko: your code don't work

Posted: Sun Nov 12, 2006 8:31 pm
by Falko
@Droopy,

sorry, error from me :cry:
If Compiles
RunProgram("TailBite.exe",FileOut,TailbitePath)
EndIf
Just the Source on buttom is edit to 'Compile'.

I've send you PM with my compiled TailBite.

My Test with your Source make all, what i've edit.

Regards Falko

Posted: Sun Nov 12, 2006 10:03 pm
by Droopy
I'm sorry Falko but i don't understand what your code / Tailbite version do ?

Posted: Sun Nov 12, 2006 10:36 pm
by Falko
I misunderstand you?
It should be make TailBite your source to lib.

This is following link to the created lib.
www.falko-pure.de/Tests/TailBitBeta/Droopy_Test

Just i run the entcomented source with my edit sourcelib 'MytestDLL.pb'

Code: Select all

RunTBOP("c:\MytestDLL.pb","c:\affiche_TBOP.txt","F:\PureBasic_4\TailBite",#True)
RunProgram("c:\afficheTBOP.txt","","c:\")
This will be compiled with TailBite.

Sorry, if is'nt what you will do. :roll:

Posted: Mon Nov 13, 2006 8:57 am
by gnozal
ts-soft wrote:
ABBKlaus wrote:@ts-soft : do you mean this post http://www.purebasic.fr/english/viewtop ... &start=390

can you supply these changes :?:
yes, this is required by some libs for unicode and threadsafe libs.
I use the changed version by gnozal, but i can't found the right link here.
Here is the link : http://people.freenet.de/gnozal/TailBite.zip
I have uploaded a new version : my modifications + ABBKlaus modifications.

Posted: Mon Nov 13, 2006 10:19 pm
by Falko
@Droopy

If your OS Windows 98 or Me?

Posted: Tue Nov 14, 2006 9:16 am
by Droopy
[quote="If your OS Windows 98 or Me?[/quote]

I don't understand

Posted: Tue Nov 14, 2006 10:59 am
by GeoTrail
He want's to know if you're running Windows 98 or Windows Milennium.

Posted: Tue Nov 14, 2006 3:52 pm
by Droopy
I use XP

Posted: Thu Nov 30, 2006 10:40 pm
by ABBKlaus
New Version of TailBite is available :arrow: <TailBite V1.81>
Previous users of V1.8c can click the Button : Check for updates :mrgreen:

- Div64 bugfix
- TailBite Installer Build.pb is now more PB4 compatible

Regards Klaus

Posted: Thu Nov 30, 2006 11:31 pm
by srod
Hi,

sorry I've not had time to follow this thread properly.

Does this version of Tailbite work okay with Pb 4.01? I ask because I'm still using PB 4.00 because I could not get Tailbite to create threadsafe libs with PB 4.01.

In short does it create threadsafe and/or unicode libs with PB 4.01?

Thanks.

Posted: Fri Dec 01, 2006 12:32 am
by ABBKlaus
Hi srod,

i really don´t know if it works with your sourcecode ?
For my current project it now works fine (PurePDF with Fontembedding)

Why not giving it a try :wink:

Regards Klaus

Posted: Fri Dec 01, 2006 12:39 am
by srod
Aye I'll have to reinstall PB 4.01 and then give it a crack. As I say I can produce threadsafe libs with PB 4, but I had the old missing ::system lib when I tried with PB 4.01.

:)

Posted: Fri Dec 01, 2006 12:48 am
by netmaestro
Where is the new version coming from? Who is writing it? Did you start from El_Choni's May 29 version or has he supplied later work? It seems to work well, btw. Thanks ever so much to whoever is making this available.