PureBasic OpenSource Projects

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: PureBasic OpenSource Projects

Post by StarBootics »

Fred wrote:You posts are very well done Tristano, thanks for it. You are indeed right when you said it was done only for a small group of dev (actually only 2: Fr34k and me) and we indeed agreed on coding style and such. Feel free to continue your pull requests to make it better for everyone contributing, like puting a BOM for everyone, and using a .cfg instead of storing config at the end of file etc.

TBH, I'm not that worried about future, it will take some iteration to get something usable for everyone but we will get there !

Happy hacking, glad to see than some of you successfully compiled the IDE :lol:
About coding style, I'm seriously considering going OOP style for example the Recent Files management both for plain source code and projects look like this :

Code: Select all

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; CODE GÉNÉRÉ AUTOMATIQUEMENT, NE PAS MODIFIER À
; MOINS D'AVOIR UNE RAISON TRÈS TRÈS VALABLE !!!
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Code généré par : Dev-Object - V0.9.10
; Nom du projet : Le nom du projet ici
; Nom du fichier : Nom du fichier
; Version du fichier : 0.0.0
; Programmation : À vérifier
; Programmé par : StarBootics
; Date : 03-12-2019
; Mise à jour : 03-12-2019
; Codé pour PureBasic : V5.71 LTS
; Plateforme : Windows, Linux, MacOS X
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

DeclareModule RecentFiles
  
  Interface RecentFiles
    
    GetHistoricSize.a()
    GetFileNames.s()
    SetHistoricSize(P_HistoricSize.a)
    SetFileNames(P_FileNames.s)
    LinearSearchFileNames.l(P_FileNames.s)
    AddFileNames()
    SelectFileNames.i(P_Index.l)
    FirstFileNames.i()
    LastFileNames.i()
    PreviousFileNames.i()
    NextFileNames.i()
    DeleteFileNames()
    ResetFileNames()
    ClearFileNames()
    FileNamesIndex.l()
    FileNamesSize.l()
    ReadPrefs(P_GroupName.s)
    WritePrefs(P_GroupName.s)
    InsertNewFile(P_NewFileName.s)
    Free()
    
  EndInterface
  
  Declare.i New(P_HistoricSize.a = 20)
  
EndDeclareModule

Module RecentFiles
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Déclaration de la Structure <<<<<

  Structure Private_Members
    
    VirtualTable.i
    HistoricSize.a
    List FileNames.s()
    
  EndStructure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Les observateurs <<<<<

  Procedure.a GetHistoricSize(*This.Private_Members)
    
    ProcedureReturn *This\HistoricSize
  EndProcedure
  
  Procedure.s GetFileNames(*This.Private_Members)
    
    ProcedureReturn *This\FileNames()
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Les mutateurs <<<<<

  Procedure SetHistoricSize(*This.Private_Members, P_HistoricSize.a)
    
    *This\HistoricSize = P_HistoricSize
    
  EndProcedure
  
  Procedure SetFileNames(*This.Private_Members, P_FileNames.s)
    
    *This\FileNames() = P_FileNames
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'opérateur(s) de fouille linéaire de liste chaînée <<<<<

  Procedure.l LinearSearchFileNames(*This.Private_Members, P_FileNames.s)
    
    IsFoundAtIndex.l = -1
    
    ForEach *This\FileNames()
      
      If P_FileNames = *This\FileNames()
        IsFoundAtIndex = ListIndex(*This\FileNames())
        Break
      EndIf
      
    Next
    
    ProcedureReturn IsFoundAtIndex
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) d'ajout à la liste chaînée <<<<<

  Procedure AddFileNames(*This.Private_Members)
    
    AddElement(*This\FileNames())
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) de Sélection dans la liste chaînée <<<<<

  Procedure.i SelectFileNames(*This.Private_Members, P_Index.l)
    
    ProcedureReturn SelectElement(*This\FileNames(), P_Index)
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) Premier élément de la liste chaînée <<<<<

  Procedure.i FirstFileNames(*This.Private_Members)
    
    ProcedureReturn FirstElement(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) Dernier élément de la liste chaînée <<<<<

  Procedure.i LastFileNames(*This.Private_Members)
    
    ProcedureReturn LastElement(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) élément Précédent de la liste chaînée <<<<<

  Procedure.i PreviousFileNames(*This.Private_Members)
    
    ProcedureReturn PreviousElement(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) élément Suivant de la liste chaînée <<<<<

  Procedure.i NextFileNames(*This.Private_Members)
    
    ProcedureReturn NextElement(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) Supprimer l'élément courant de la liste chaînée <<<<<

  Procedure DeleteFileNames(*This.Private_Members)
    
    DeleteElement(*This\FileNames())
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) Reset de la liste chaînée <<<<<

  Procedure ResetFileNames(*This.Private_Members)
    
    ResetList(*This\FileNames())
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) Clear de la liste chaînée <<<<<

  Procedure ClearFileNames(*This.Private_Members)
    
    ClearList(*This\FileNames())
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) de numéro d'index de la liste chaînée <<<<<

  Procedure.l FileNamesIndex(*This.Private_Members)
    
    ProcedureReturn ListIndex(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) de grandeur de la liste chaînée <<<<<

  Procedure.l FileNamesSize(*This.Private_Members)
    
    ProcedureReturn ListSize(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Lecture d'un groupe Préférences <<<<<

  Procedure ReadPrefs(*This.Private_Members, P_GroupName.s)
    
    PreferenceGroup(P_GroupName)
    
    *This\HistoricSize = ReadPreferenceLong("HistoricSize", *This\HistoricSize)
    
    FileNames_Max = ReadPreferenceLong("FileNames_Max", 0) - 1
    
    For FileNamesID = 0 To FileNames_Max
      AddElement(*This\FileNames())
      *This\FileNames() = ReadPreferenceString("FileNames_" + Str(FileNamesID), *This\FileNames())
    Next
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Écriture d'un groupe de Préférences <<<<<

  Procedure WritePrefs(*This.Private_Members, P_GroupName.s)
    
    PreferenceGroup(P_GroupName)
    
    WritePreferenceLong("HistoricSize", *This\HistoricSize)
    
    WritePreferenceLong("FileNames_Max", ListSize(*This\FileNames()))
    
    ForEach *This\FileNames()
      WritePreferenceString("FileNames_" + Str(ListIndex(*This\FileNames())), *This\FileNames())
    Next
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'opérateur InsertNewFile <<<<<
  
  Procedure InsertNewFile(*This.Private_Members, P_NewFileName.s)
    
    If LinearSearchFileNames(*This, P_NewFileName) = -1
      
      ResetList(*This\FileNames())
      AddElement(*This\FileNames())
      *This\FileNames() = P_NewFileName
      
    Else
      
      DeleteElement(*This\FileNames())
      ResetList(*This\FileNames())
      AddElement(*This\FileNames())
      *This\FileNames() = P_NewFileName
      
    EndIf
    
    If ListSize(*This\FileNames()) > *This\HistoricSize
      LastElement(*This\FileNames())
      DeleteElement(*This\FileNames())
    EndIf 
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Le Destructeur <<<<<

  Procedure Free(*This.Private_Members)
    
    ClearStructure(*This, Private_Members)
    FreeStructure(*This)
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Le Constructeur <<<<<

  Procedure.i New(P_HistoricSize.a = 20)
    
    *This.Private_Members = AllocateStructure(Private_Members)
    *This\VirtualTable = ?START_METHODS
    
    *This\HistoricSize = P_HistoricSize
    
    ProcedureReturn *This
  EndProcedure
  
  DataSection
    START_METHODS:
    Data.i @GetHistoricSize()
    Data.i @GetFileNames()
    Data.i @SetHistoricSize()
    Data.i @SetFileNames()
    Data.i @LinearSearchFileNames()
    Data.i @AddFileNames()
    Data.i @SelectFileNames()
    Data.i @FirstFileNames()
    Data.i @LastFileNames()
    Data.i @PreviousFileNames()
    Data.i @NextFileNames()
    Data.i @DeleteFileNames()
    Data.i @ResetFileNames()
    Data.i @ClearFileNames()
    Data.i @FileNamesIndex()
    Data.i @FileNamesSize()
    Data.i @ReadPrefs()
    Data.i @WritePrefs()
    Data.i @InsertNewFile()
    Data.i @Free()
    END_METHODS:
  EndDataSection
  
EndModule

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Code généré en : 00.001 secondes (284000.00 lignes/seconde) <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; <<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< FIN DU FICHIER <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<
But I'm not sure if everybody are willing to re-code the entire IDE that way. And it's kind of an announcement but I'm about to release the source code of "Dev-Object" even if it's far from completed. Actually I'm considering to add the XML file support to it in the near future, maybe this week.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: PureBasic OpenSource Projects

Post by Rinzwind »

Im not in favor for adding modules in a big projects where no modules are used. That plus that modules in their current state dont solve anything in a better way as has been tried to explain elsewhere by someone else (looked it up, user Mistrel who patiently tried to explain some pain points to deaf ears).

That plus that PB does not have native constructs for object state which makes OOP style a messy experience in PB (I really wish some support would be added, its time for a v2 of PB just like many modern languages evolve over the years/gain new language features and syntax).

But each to their own of course ;)

ps. I am surprised by the non-use (except for 1 file) of EnableExplicit. The absence which is the source of many, many typo related bugs (imh experience).
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic OpenSource Projects

Post by Fred »

StarBootics wrote:
Fred wrote:You posts are very well done Tristano, thanks for it. You are indeed right when you said it was done only for a small group of dev (actually only 2: Fr34k and me) and we indeed agreed on coding style and such. Feel free to continue your pull requests to make it better for everyone contributing, like puting a BOM for everyone, and using a .cfg instead of storing config at the end of file etc.

TBH, I'm not that worried about future, it will take some iteration to get something usable for everyone but we will get there !

Happy hacking, glad to see than some of you successfully compiled the IDE :lol:
About coding style, I'm seriously considering going OOP style for example the Recent Files management both for plain source code and projects look like this :

Code: Select all

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; CODE GÉNÉRÉ AUTOMATIQUEMENT, NE PAS MODIFIER À
; MOINS D'AVOIR UNE RAISON TRÈS TRÈS VALABLE !!!
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Code généré par : Dev-Object - V0.9.10
; Nom du projet : Le nom du projet ici
; Nom du fichier : Nom du fichier
; Version du fichier : 0.0.0
; Programmation : À vérifier
; Programmé par : StarBootics
; Date : 03-12-2019
; Mise à jour : 03-12-2019
; Codé pour PureBasic : V5.71 LTS
; Plateforme : Windows, Linux, MacOS X
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

DeclareModule RecentFiles
  
  Interface RecentFiles
    
    GetHistoricSize.a()
    GetFileNames.s()
    SetHistoricSize(P_HistoricSize.a)
    SetFileNames(P_FileNames.s)
    LinearSearchFileNames.l(P_FileNames.s)
    AddFileNames()
    SelectFileNames.i(P_Index.l)
    FirstFileNames.i()
    LastFileNames.i()
    PreviousFileNames.i()
    NextFileNames.i()
    DeleteFileNames()
    ResetFileNames()
    ClearFileNames()
    FileNamesIndex.l()
    FileNamesSize.l()
    ReadPrefs(P_GroupName.s)
    WritePrefs(P_GroupName.s)
    InsertNewFile(P_NewFileName.s)
    Free()
    
  EndInterface
  
  Declare.i New(P_HistoricSize.a = 20)
  
EndDeclareModule

Module RecentFiles
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Déclaration de la Structure <<<<<

  Structure Private_Members
    
    VirtualTable.i
    HistoricSize.a
    List FileNames.s()
    
  EndStructure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Les observateurs <<<<<

  Procedure.a GetHistoricSize(*This.Private_Members)
    
    ProcedureReturn *This\HistoricSize
  EndProcedure
  
  Procedure.s GetFileNames(*This.Private_Members)
    
    ProcedureReturn *This\FileNames()
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Les mutateurs <<<<<

  Procedure SetHistoricSize(*This.Private_Members, P_HistoricSize.a)
    
    *This\HistoricSize = P_HistoricSize
    
  EndProcedure
  
  Procedure SetFileNames(*This.Private_Members, P_FileNames.s)
    
    *This\FileNames() = P_FileNames
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'opérateur(s) de fouille linéaire de liste chaînée <<<<<

  Procedure.l LinearSearchFileNames(*This.Private_Members, P_FileNames.s)
    
    IsFoundAtIndex.l = -1
    
    ForEach *This\FileNames()
      
      If P_FileNames = *This\FileNames()
        IsFoundAtIndex = ListIndex(*This\FileNames())
        Break
      EndIf
      
    Next
    
    ProcedureReturn IsFoundAtIndex
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) d'ajout à la liste chaînée <<<<<

  Procedure AddFileNames(*This.Private_Members)
    
    AddElement(*This\FileNames())
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) de Sélection dans la liste chaînée <<<<<

  Procedure.i SelectFileNames(*This.Private_Members, P_Index.l)
    
    ProcedureReturn SelectElement(*This\FileNames(), P_Index)
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) Premier élément de la liste chaînée <<<<<

  Procedure.i FirstFileNames(*This.Private_Members)
    
    ProcedureReturn FirstElement(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) Dernier élément de la liste chaînée <<<<<

  Procedure.i LastFileNames(*This.Private_Members)
    
    ProcedureReturn LastElement(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) élément Précédent de la liste chaînée <<<<<

  Procedure.i PreviousFileNames(*This.Private_Members)
    
    ProcedureReturn PreviousElement(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) élément Suivant de la liste chaînée <<<<<

  Procedure.i NextFileNames(*This.Private_Members)
    
    ProcedureReturn NextElement(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) Supprimer l'élément courant de la liste chaînée <<<<<

  Procedure DeleteFileNames(*This.Private_Members)
    
    DeleteElement(*This\FileNames())
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) Reset de la liste chaînée <<<<<

  Procedure ResetFileNames(*This.Private_Members)
    
    ResetList(*This\FileNames())
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) Clear de la liste chaînée <<<<<

  Procedure ClearFileNames(*This.Private_Members)
    
    ClearList(*This\FileNames())
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) de numéro d'index de la liste chaînée <<<<<

  Procedure.l FileNamesIndex(*This.Private_Members)
    
    ProcedureReturn ListIndex(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'operateur(s) de grandeur de la liste chaînée <<<<<

  Procedure.l FileNamesSize(*This.Private_Members)
    
    ProcedureReturn ListSize(*This\FileNames())
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Lecture d'un groupe Préférences <<<<<

  Procedure ReadPrefs(*This.Private_Members, P_GroupName.s)
    
    PreferenceGroup(P_GroupName)
    
    *This\HistoricSize = ReadPreferenceLong("HistoricSize", *This\HistoricSize)
    
    FileNames_Max = ReadPreferenceLong("FileNames_Max", 0) - 1
    
    For FileNamesID = 0 To FileNames_Max
      AddElement(*This\FileNames())
      *This\FileNames() = ReadPreferenceString("FileNames_" + Str(FileNamesID), *This\FileNames())
    Next
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Écriture d'un groupe de Préférences <<<<<

  Procedure WritePrefs(*This.Private_Members, P_GroupName.s)
    
    PreferenceGroup(P_GroupName)
    
    WritePreferenceLong("HistoricSize", *This\HistoricSize)
    
    WritePreferenceLong("FileNames_Max", ListSize(*This\FileNames()))
    
    ForEach *This\FileNames()
      WritePreferenceString("FileNames_" + Str(ListIndex(*This\FileNames())), *This\FileNames())
    Next
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< L'opérateur InsertNewFile <<<<<
  
  Procedure InsertNewFile(*This.Private_Members, P_NewFileName.s)
    
    If LinearSearchFileNames(*This, P_NewFileName) = -1
      
      ResetList(*This\FileNames())
      AddElement(*This\FileNames())
      *This\FileNames() = P_NewFileName
      
    Else
      
      DeleteElement(*This\FileNames())
      ResetList(*This\FileNames())
      AddElement(*This\FileNames())
      *This\FileNames() = P_NewFileName
      
    EndIf
    
    If ListSize(*This\FileNames()) > *This\HistoricSize
      LastElement(*This\FileNames())
      DeleteElement(*This\FileNames())
    EndIf 
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Le Destructeur <<<<<

  Procedure Free(*This.Private_Members)
    
    ClearStructure(*This, Private_Members)
    FreeStructure(*This)
    
  EndProcedure
  
  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
  ; <<<<< Le Constructeur <<<<<

  Procedure.i New(P_HistoricSize.a = 20)
    
    *This.Private_Members = AllocateStructure(Private_Members)
    *This\VirtualTable = ?START_METHODS
    
    *This\HistoricSize = P_HistoricSize
    
    ProcedureReturn *This
  EndProcedure
  
  DataSection
    START_METHODS:
    Data.i @GetHistoricSize()
    Data.i @GetFileNames()
    Data.i @SetHistoricSize()
    Data.i @SetFileNames()
    Data.i @LinearSearchFileNames()
    Data.i @AddFileNames()
    Data.i @SelectFileNames()
    Data.i @FirstFileNames()
    Data.i @LastFileNames()
    Data.i @PreviousFileNames()
    Data.i @NextFileNames()
    Data.i @DeleteFileNames()
    Data.i @ResetFileNames()
    Data.i @ClearFileNames()
    Data.i @FileNamesIndex()
    Data.i @FileNamesSize()
    Data.i @ReadPrefs()
    Data.i @WritePrefs()
    Data.i @InsertNewFile()
    Data.i @Free()
    END_METHODS:
  EndDataSection
  
EndModule

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Code généré en : 00.001 secondes (284000.00 lignes/seconde) <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; <<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< FIN DU FICHIER <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<
But I'm not sure if everybody are willing to re-code the entire IDE that way. And it's kind of an announcement but I'm about to release the source code of "Dev-Object" even if it's far from completed. Actually I'm considering to add the XML file support to it in the near future, maybe this week.

Best regards
StarBootics
No, the IDE is a big project and the idea is to contribute by complying to the actual coding style and rule. We won't accept patchs which refactor files only to do it another way. BTW, PB is not an OOP language, it makes no sense to want to write a fully OOP app with it. It can be useful for some cases (like we did for the tool to be able to have a common way to load/use them) but it's not the rule.
Denis
Enthusiast
Enthusiast
Posts: 704
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: PureBasic OpenSource Projects

Post by Denis »

Fred wrote: No, the IDE is a big project and the idea is to contribute by complying to the actual coding style and rule.
Fred, it would be nice to list the must-have (unavoidable) rules for future contributions.
A+
Denis
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: PureBasic OpenSource Projects

Post by kenmo »

IceSoft wrote:
kenmo wrote:Has anyone successfully got the IDE to build yet?
Yes.
viewtopic.php?f=5&t=74155
That thread looks like it's about one error, which is already marked Solved. I wonder if we need a big common thread for all build issues? Or should I add other issues to your thread?



Tristano, I've been following your suggestions and commits so far and thank you for diving right in, and handling a lot of prep work, so that ongoing collaboration will go smoothly!
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: PureBasic OpenSource Projects

Post by StarBootics »

Denis wrote:
Fred wrote: No, the IDE is a big project and the idea is to contribute by complying to the actual coding style and rule.
Fred, it would be nice to list the must-have (unavoidable) rules for future contributions.
+1

@Fred : I think you didn't read my previous post, I'm going to write a new IDE from scratch like jaPBe back in the days. Simply because the coding style the IDE is way too far off my programming style. But I have to confess I have a twisted mind. :wink:

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
Denis
Enthusiast
Enthusiast
Posts: 704
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: PureBasic OpenSource Projects

Post by Denis »

Fred,
i've compiled the ide.

I've change constants like this
#BUILD_DIRECTORY=D:\PureBasic_Ide\purebasic-master\Build\x64\ide\
#PureBasicPath=G:\PureBasic\PureBasic_5_71_x64\
PureBasic IDE.pbp is loaded with succes.
When trying to compile the project with debugger on, i get an error line 278 file PureBasic.pb (not critic) :

Code: Select all

Procedure CloseSplashScreen()
  Static IsClosed = 0
  
  If IsClosed = 0 And NoSplashScreen = 0
    IsClosed = 1
    CloseWindow(#WINDOW_Startup)      <--- ici 
    FreeImage(#IMAGE_Startup)
  EndIf
EndProcedure
[10 :52 :39] Attente du démarrage du programme...
[10 :52 :39] Type d'exécutable: Windows - x64 (64bit, Unicode, Thread)
[10 :52 :39] Exécutable démarré.
[10 :52 :40] [ERREUR] PureBasic.pb (Ligne: 278)
[10 :52 :40] [ERREUR] Le #Window spécifié n'est pas initialisé.
I set debugger off and try to compile again but now i get this error
cannot initialise scintilla engine!
Make sure the "scintilla.dll" is placed in the compiler subdirectory of your Purebasic setup
Any idea ?
A+
Denis
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic OpenSource Projects

Post by Fred »

You need to define PureBasicPath$ to a purebasic installation in WindowsMisc.pb line 100
User avatar
marcoagpinto
Addict
Addict
Posts: 940
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: PureBasic OpenSource Projects

Post by marcoagpinto »

Thank you, Fred!

8)
Denis
Enthusiast
Enthusiast
Posts: 704
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: PureBasic OpenSource Projects

Post by Denis »

Fred wrote:You need to define PureBasicPath$ to a purebasic installation in WindowsMisc.pb line 100
Ok, Thanks
A+
Denis
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: PureBasic OpenSource Projects

Post by ChrisR »

Glad to see this courageous and great evolution
I'm sure the community will make good use of it for the best of PB
Thanks to all the team :D

#
Should be another topic, placed maybe in a New PureBasic Opensource Section
No worries for UnxUtils unzipped in "Program Files (x86)"
Same for the installation of en_visual_studio_community_2013_with_update_5_x86_6816332.exe
But when installing Windows 7 SDK, I get the message :
Some components cannot be installed - Some Windows SDK compopnents require the RTM .Net Framework 4. Setup detect a pre-release version... these components will not be installed...
And if I try to install .NET Framework 4 or 4.8 Runtime, it tells me that it is already part of this operating system.
I am on Windows 10 x64 1909 and latest Windows 10 SDK 18362 is already installed.
Any idea what my problem was?
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: PureBasic OpenSource Projects

Post by Shardik »

For a long time I already had the desire to change the indentation (when selecting a block and pressing <Strg> + <I>) to use spaces instead of indent to the next keyword which is the default setting:
Image

Because of the PureBasic IDE going open source and being put on GitHub, I was able to change the indentation setting by my own, recompile the IDE and enjoy the result:
Image

Unfortunately I am not familiar with GitHub pull requests. But perhaps someone with more knowledge than me might create a pull request for this and even define a checkbox in the editor pane of the preferences so that everybody is able to switch the indentation behaviour to his liking. These are the steps I have undertaken:
- Download the PureBasic IDE from GitHub as a zip file and unpack it
- Open PureBasicIDE/ScintillaHilightning.pb in your PB IDE
- Jump to procedure GetIndentContinuationPrefix()
- Comment out the 2nd line in the procedure (my preferred indentation was already in place but commented and unfortunately not chosable in the preferences):

Code: Select all

  Procedure.s GetIndentContinuationPrefix(Previous$)
    ; Use this for a simple "block mode" indentation
    ;ProcedureReturn GetIndentPrefix(Previous$) + "    "
or better change it to

Code: Select all

  Procedure.s GetIndentContinuationPrefix(Previous$)
    ; Use this for a simple "block mode" indentation
    ProcedureReturn GetIndentPrefix(Previous$) + Space(TabLength)
TabLength is defined in PureBasicIDE/Common.pb as Global and contains the number of spaces used when pressing the <Tab> key. So the indentation with spaces will be correct independant of your chosen setting for your preferred tab key spaces. The commented default above will always indent with 4 spaces.
- Recompile the IDE and enjoy the new indentation behaviour... :wink:
Denis
Enthusiast
Enthusiast
Posts: 704
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: PureBasic OpenSource Projects

Post by Denis »

ChrisR wrote:Should be another topic, placed maybe in a New PureBasic Opensource Section
No worries for UnxUtils unzipped in "Program Files (x86)"
Same for the installation of en_visual_studio_community_2013_with_update_5_x86_6816332.exe
But when installing Windows 7 SDK, I get the message :
Some components cannot be installed - Some Windows SDK compopnents require the RTM .Net Framework 4. Setup detect a pre-release version... these components will not be installed...
And if I try to install .NET Framework 4 or 4.8 Runtime, it tells me that it is already part of this operating system.
I am on Windows 10 x64 1909 and latest Windows 10 SDK 18362 is already installed.
Any idea what my problem was?
You have a most recent version installed of Windows SDK.

Fred indicates that 'We use an old SDK version (7.0) but a newer version might also work.' (file build.md)
So, if you've got a more recent one, use it and tell us if it is Ok.
A+
Denis
User avatar
ChrisR
Addict
Addict
Posts: 1127
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: PureBasic OpenSource Projects

Post by ChrisR »

I tried it with Windows 10 SDK and changing
set PB_PLATEFORM_SDK=C:\Program Files (x86)\Windows Kits\10
But without success
DebuggerInternal.h(26) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
(winsock2.h is in "C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um" folder)


I didn't go any further and I installed Windows 7 SDK despite the message require the RTM .Net Framework 4.
After changing the paths in Window-x64.cmd, Make was successfully completed
but then, I had the same problem as you then on scintilla.dll
I followed Fred's instructions (define PureBasicPath$ to a purebasic installation in WindowsMisc.pb line 100)
and now it's all good, I can start playing with it :D
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: PureBasic OpenSource Projects

Post by kenmo »

Hi ChrisR, I'm having the same issue that you just solved, could you describe your fix here?
viewtopic.php?f=18&t=74184

I would like to see all these technical details and tips in a common place, rather than buried in this announcement thread, if that's OK with everyone else.
Post Reply