Extend Purebasic to be more "pro"

Everything else that doesn't fall into one of the other PB categories.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Extend Purebasic to be more "pro"

Post by Lunasole »

Hi. I want to suggest some idea about Purebasic expansion (or should call it something like this).

Purebasic itself, has a good set of integrated functions and libraries.
It covers a lot of tasks and gives a good start for anyone.

However, many libraries are quite limited, because of size requirements or lot of efforts required to fully integrate them.
That's for what PB is often criticized by many coders.

So it might be a good idea for PB owners to create a set of actual libraries (which are widely used professionally) separated from basic distributive, bind them to Purebasic, support/update bindings, and offer it all (with or without binaries) as a separate option (like paid subscription).
This should make Purebasic more interesting for professional coders and also will bring some $ to support it.

Can't say anything more, just seen this idea from my own experience of connection different libraries to PB.
// sorry for my english also, it probably downgraded after a long time being not used extensively (not saying it always was for some % "downgraded"^^)
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Extend Purebasic to be more "pro"

Post by IdeasVacuum »

That has been done before, but then the developers of the libs have fallen away and left us with libs that are quickly out of date and a lot of unusable legacy code.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
BarryG
Addict
Addict
Posts: 3296
Joined: Thu Apr 18, 2019 8:17 am

Re: Extend Purebasic to be more "pro"

Post by BarryG »

IdeasVacuum is right. I only ever use third-party libraries where the library has the full source code provided, so I can keep using/maintaining it if the author disappears.
marc_256
Enthusiast
Enthusiast
Posts: 743
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: Extend Purebasic to be more "pro"

Post by marc_256 »

Hi,

Since i started with PB in May 2010,
I bought all kind of stuff what was on sale on this PB site.
From 3D stuff, drawing stuff, GUI stuff and other stuff.
They all are be payed a lot of money, and they are all gone.
Except now a little late (years) but there was an update for ProGUI by PrincieD...

So that is the reason I do not use and by any stuff without source code anymore.

Also, you can see that there is no more energy behind PB,
there was a time that this forum was exploding every day with wonderful stuff and ideas,
I do not see any good working WOW program on this site today ??
Also the debugging is on very low and slow action / reaction ...

For me, PB was (and still is) the best basic compiler there was for my professional use, but there is no more energy behind this idea.

I worked very hard for entering a specific company, to sell my 3D software,
but with the first test I had a virus detection problem, and even later I never could clean it up, so they stopped contacting me.

Today I'm study C++, and see my first steps/results on the screen ...

If there is someone who is interested in updating the 3D OGRE / BULLET physics stuff,
Contact me please, I will help where I can.

Marc,
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
BarryG
Addict
Addict
Posts: 3296
Joined: Thu Apr 18, 2019 8:17 am

Re: Extend Purebasic to be more "pro"

Post by BarryG »

marc_256 wrote:but with the first test I had a virus detection problem, and even later I never could clean it up, so they stopped contacting me.
Today I'm study C++, and see my first steps/results on the screen
I wonder how hard it would be for someone to make a PureBasic to C++ converter (source code I mean)? I'd be interested in that, to remove the anti-virus false-positives, and also to teach me how C++ is used to write a Windows exe.
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Extend Purebasic to be more "pro"

Post by StarBootics »

BarryG wrote:I wonder how hard it would be for someone to make a PureBasic to C++ converter (source code I mean)? I'd be interested in that, to remove the anti-virus false-positives, and also to teach me how C++ is used to write a Windows exe.
It will be complicated simply because PureBasic is Procedural (Like C) and C++ is OOP. When you work with C++ or any OOP language you need to think differently while writing your code. For example, a simple Chronometer class in C++ look like that :

Code: Select all

#include <string>
#include <time.h>

#ifndef CHRONOMETER_H
#define CHRONOMETER_H

class Chronometer
{
    public:
        Chronometer();
        void Reset();
        void Start();
        void Stop();
        bool IsRunning();
        __int64_t Consult();
        std::string Format(std::string);
        ~Chronometer();

    private:
    __int64_t StartTime;
    __int64_t TotalTime;
    bool Running;
};

#endif // CHRONOMETER_H

Code: Select all

#include "Chronometer.h"

Chronometer::Chronometer():StartTime(0), TotalTime(0), Running(false)
{

}

void Chronometer::Reset()
{
    StartTime = TotalTime = 0;
    Running = false;
}

void Chronometer::Start()
{
    timespec CurrentTime;

    if (Running == false)
    {
        Running = true;
        clock_gettime(CLOCK_MONOTONIC, &CurrentTime);
        StartTime = (CurrentTime.tv_sec * 1000 + CurrentTime.tv_nsec / 1000000L);
    }
}

void Chronometer::Stop()
{

    timespec CurrentTime;

    if (Running == true)
    {
        Running = false;
        clock_gettime(CLOCK_MONOTONIC, &CurrentTime);
        TotalTime = TotalTime + (CurrentTime.tv_sec * 1000 + CurrentTime.tv_nsec / 1000000L) - StartTime;
    }
}

bool Chronometer::IsRunning()
{
    return Running;
}

__int64_t Chronometer::Consult()
{
    timespec CurrentTime;

    if (Running == true)
    {
        clock_gettime(CLOCK_MONOTONIC, &CurrentTime);
        return TotalTime + (CurrentTime.tv_sec * 1000 + CurrentTime.tv_nsec / 1000000L) - StartTime;
    }

    else
        return TotalTime;

}

std::string Chronometer::Format(std::string TimeMask)
{
    __int64_t MilliSeconds = Consult();
    std::string Sign, Temp;

    if (MilliSeconds < 0)
    {
        MilliSeconds = MilliSeconds * -1;
        Sign = "-";
    }

    int Days = MilliSeconds / 86400000;
    MilliSeconds = MilliSeconds % 86400000;

    int Hours = MilliSeconds / 3600000;
    MilliSeconds = MilliSeconds % 3600000;

    int Minutes = MilliSeconds / 60000;
    MilliSeconds = MilliSeconds % 60000;

    int Seconds = MilliSeconds / 1000;
    MilliSeconds = MilliSeconds % 1000;

    if (TimeMask.find("%dd") != std::string::npos)
    {
        Temp = (Days < 10) ? "0" + std::to_string(Days) : std::to_string(Days);
        TimeMask = TimeMask.replace(TimeMask.find("%dd"), 3, Temp);
    }

    if (TimeMask.find("%hh") != std::string::npos)
    {
        Temp = (Hours < 10) ? "0" + std::to_string(Hours) : std::to_string(Hours);
        TimeMask = TimeMask.replace(TimeMask.find("%hh"),3, Temp);
    }

    if (TimeMask.find("%mm") != std::string::npos)
    {
        Temp = (Minutes < 10) ? "0" + std::to_string(Minutes) : std::to_string(Minutes);
        TimeMask = TimeMask.replace(TimeMask.find("%mm"),3, Temp);
    }

    if (TimeMask.find("%ss") != std::string::npos)
    {
        Temp = (Seconds < 10) ? "0" + std::to_string(Seconds) : std::to_string(Seconds);
        TimeMask = TimeMask.replace(TimeMask.find("%ss"),3, Temp);
    }

    if (TimeMask.find("%mss") != std::string::npos)
    {
        if (MilliSeconds < 10)
            Temp = "00" + std::to_string(MilliSeconds);
        else if (MilliSeconds >= 10 && MilliSeconds < 100)
            Temp = "0" + std::to_string(MilliSeconds);
        else
            Temp = std::to_string(MilliSeconds);

        TimeMask = TimeMask.replace(TimeMask.find("%mss"),4, Temp);
    }

    return Sign + TimeMask;
}

Chronometer::~Chronometer()
{
    StartTime = TotalTime = 0;
    Running = false;
}
While a similar thing in PureBasic OOP style look like that :

Code: Select all

DeclareModule Chrono
  
  Interface Chrono
    
    IsRunning()
    Reset()
    Start()
    Stop()
    Consult.q()
    Format.s(TimeMask.s)
    Free()
    
  EndInterface
  
  Declare.i New()
  
EndDeclareModule

Module Chrono
  
  Structure Private_Members
    
    VirtualTable.i
    StartTime.q
    TotalTime.q
    IsRunning.b
    
  EndStructure
  
  Procedure IsRunning(*This.Private_Members)
  
    ProcedureReturn *This\IsRunning
  EndProcedure
  
  Procedure Reset(*This.Private_Members)
    
    *This\StartTime = 0
    *This\TotalTime = 0
    *This\IsRunning = #False
    
  EndProcedure
  
  Procedure Start(*This.Private_Members)
    
    If *This\IsRunning = #False
      *This\StartTime = ElapsedMilliseconds()
      *This\IsRunning = #True
    EndIf
    
  EndProcedure
  
  Procedure Stop(*This.Private_Members)
    
    If *This\IsRunning = #True
      *This\TotalTime = *This\TotalTime + ElapsedMilliseconds() - *This\StartTime
      *This\IsRunning = #False
    EndIf
    
  EndProcedure
  
  Procedure.q Consult(*This.Private_Members)
    
    If *This\IsRunning = #True
      TotalTime.q = *This\TotalTime + ElapsedMilliseconds() - *This\StartTime
    Else
      TotalTime = *This\TotalTime
    EndIf
    
    ProcedureReturn TotalTime
  EndProcedure
  
  Procedure.s Format(*This.Private_Members, TimeMask.s)
    
    MilliSeconds = Consult(*This)
    
    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ; <<<<< On fait l'extraction des jours, Heures, minutes, secondes et des MS <<<<<
    
    If MilliSeconds < 0 
      MilliSeconds = MilliSeconds * -1
      Sign.s = "-"
    Else
      Sign = ""
    EndIf 
    
    Days = MilliSeconds / 86400000 
    MilliSeconds % 86400000
    
    Hours = MilliSeconds / 3600000
    MilliSeconds % 3600000
    
    Minutes = MilliSeconds / 60000
    MilliSeconds % 60000
    
    Seconds = MilliSeconds / 1000
    MilliSeconds % 1000
    
    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ; <<<<< On s'occupe du filtre de sortie <<<<<
    
    If FindString(TimeMask, "%dd", 1)
      TimeMask = ReplaceString(TimeMask,"%dd", RSet(Str(Days), 2, "0"))
    EndIf 
    
    If FindString(TimeMask, "%hh", 1)
      TimeMask = ReplaceString(TimeMask,"%hh", RSet(Str(Hours), 2, "0"))
    EndIf 
    
    If FindString(TimeMask, "%mm", 1)
      TimeMask = ReplaceString(TimeMask,"%mm", RSet(Str(Minutes), 2, "0"))
    EndIf 
    
    If FindString(TimeMask, "%ss", 1)
      TimeMask = ReplaceString(TimeMask,"%ss", RSet(Str(Seconds), 2, "0"))
    EndIf 
    
    If FindString(TimeMask, "%mss", 1)
      TimeMask = ReplaceString(TimeMask,"%mss", RSet(Str(MilliSeconds), 3, "0"))
    EndIf
    
    ProcedureReturn Sign + TimeMask
  EndProcedure
  
  Procedure Free(*This.Private_Members)
    
    ClearStructure(*This, Private_Members)
    FreeStructure(*This)
    
  EndProcedure
  
  Procedure.i New()
    
    *This.Private_Members = AllocateStructure(Private_Members)
    *This\VirtualTable = ?START_METHODS
    *This\StartTime = 0
    *This\TotalTime = 0
    *This\IsRunning = #False
    
    ProcedureReturn *This
  EndProcedure
  
  DataSection
    START_METHODS:
    Data.i @IsRunning()
    Data.i @Reset()
    Data.i @Start()
    Data.i @Stop()
    Data.i @Consult()
    Data.i @Format()
    Data.i @Free()
    END_METHODS:
  EndDataSection
  
EndModule
As you can see PB OOP Style to C++ OOP will take a great deal of work to make a converter. It will probably much faster to simply write the code manually than trying to create a converter.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Tenaja
Addict
Addict
Posts: 1948
Joined: Tue Nov 09, 2010 10:15 pm

Re: Extend Purebasic to be more "pro"

Post by Tenaja »

BarryG wrote:IdeasVacuum is right. I only ever use third-party libraries where the library has the full source code provided, so I can keep using/maintaining it if the author disappears.
Ditto.
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: Extend Purebasic to be more "pro"

Post by Mijikai »

I think PB will get a huge popularity boost if it supports ARM.

However i think it would be smart for PB to:
- fix the showcase area on the website its still totally broken (half of the links are dead).
- update the forum it looks way too outdated.
- clean up the bug report section its a mess.
- let us compile static libraries.
- expand the audio library it could do much more.
- drop the current 3d engine in favor of just include files (as source) for actually used, widely popular libs.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Extend Purebasic to be more "pro"

Post by Lunasole »

marc_256 wrote:Hi,
I worked very hard for entering a specific company, to sell my 3D software,
but with the first test I had a virus detection problem, and even later I never could clean it up, so they stopped contacting me.
I guess that problem with false alerts (from some shitty antiviruses) is rather caused because your code was not signed. Did you tried to sign executables?
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
BarryG
Addict
Addict
Posts: 3296
Joined: Thu Apr 18, 2019 8:17 am

Re: Extend Purebasic to be more "pro"

Post by BarryG »

Lunasole wrote:I guess that problem with false alerts (from some shitty antiviruses) is rather caused because your code was not signed.
Not true. There are lots of developers posting on StackOverflow that their exes are signed but they still get false-positives. And the PureLocker malware was signed, too. Signing doesn't stop false-positives at all.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Extend Purebasic to be more "pro"

Post by Rinzwind »

Changing language doesnt stop false positives. Its just simplistic so called “advanced” virus scanners looking for win32 api calls and triggering on any that do system-tool like behavior.

So yup, using c++ wont be a fix. Anyway, would look at FreePascal/Lazarus if you want to try something else. It gives too a whole package to play around with and has good cross platform desktop gui stuff. It does have some luggage from the past, but thats ok. Just change the default ide layout to show code structure etc.

Anyway, PB certainly can use some long overdue syntax enhancements. Inline array and structure declaration and initialization (can also be passed as a procedure argument), a little object support in structures (add procedures support to structures and a *this construct). The gui library can certainly use more complete controls, especially the list and table controls. A grid control is not included. Buildin column rearrange and sort, edit, stuff like that. That gets ugly fast when using Windows message parsing. A bit of object support can help with structuring that too. Or take a look at how gtk does things procedurally. Some specific platform support libs would be nice. Things like registry on Windows. ByRef parameters would be good too.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Extend Purebasic to be more "pro"

Post by IdeasVacuum »

There needs to be an organisation for Indie Developers. Individually we have no means to take on the Anti-Virus giants, but if we were all together as one, we could demand change - indeed we could sue the Anti-Virus companies for defamation of reputation.

We could also have our own labs. I have long suspected that some of the viruses apparently found are simply fictitious - who would benefit? The Anti-Virus companies.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
BarryG
Addict
Addict
Posts: 3296
Joined: Thu Apr 18, 2019 8:17 am

Re: Extend Purebasic to be more "pro"

Post by BarryG »

IdeasVacuum wrote:we could sue the Anti-Virus companies for defamation of reputation
I've thought about that in the past (how it would work, I mean; I don't have the money to do it). But I think that legally you need to send a cease-and-desist demand first, which is basically the request to white-list your app. So they just white-list and therefore your legal complaint is done and dusted; with no lawsuit needing to go ahead. I am not a lawyer, but I think I'm 100% spot-on with this, and may explain why nobody's ever sued yet. (The AV vendor just needs to show that they white-listed when made aware of the issue, and so they're in the clear. The bastards).
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: Extend Purebasic to be more "pro"

Post by Mistrel »

The issue isn't the libraries but language features. PureBasic has tremendous potential but there hasn't been much progress to improve on it since modules. I want to see more improvements to the language between releases and less focus on adding more libraries.

I've highlighted a number of improvements through feature requests over the years that have a lot of thought put into them. Please feel free to look them up and comment if they're not already familiar.
Last edited by Mistrel on Tue Jul 07, 2020 1:57 pm, edited 1 time in total.
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: Extend Purebasic to be more "pro"

Post by Olli »

Mistrel wrote:The issue isn't the libraries but language features. PureBasic has tremendous potential but there hasn't been much progress to improve on it since modules. I want to more improvements to the language between releases and less focus on adding more libraries.

I've highlighted a number of improvements through feature requests over the years that have a lot of thought put into them. Please feel free to look them up and comment if they're not already familiar.
I am agree with you about the modules. But the modules do not prevent us to code exactly as before they have been invented. It is just a similar feature of namespaces.

For the links you want to be read, could you give some links ? Or a links resume ?

What we do not forget is the speed of a compiling source code. It stays very very quick.
Post Reply