PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4 5 6

Author Topic: Are you guys sticking with PowerBASIC?  (Read 16768 times)

Knuth Konrad

  • FireFly3 Registered User
  • Junior FireFly Member
  • *
  • Posts: 64
Re: Are you guys sticking with PowerBASIC?
« Reply #30 on: August 25, 2015, 11:19:53 AM »

Another operator +=

Please, please, please never use "+" for string concatenation ...  I know that's what was used in the early (stone-age) BASICs, but "&" has been around for as long as I use BASIC ...

And given BASICs (and VARIANT data type's) intrinsic implicit type conversion, "+" for string concat can lead to hard to debug results ...
Logged

José Roca

  • FireFly3 Registered User
  • Master FireFly Member
  • *
  • Posts: 2785
    • José Roca Software
Re: Are you guys sticking with PowerBASIC?
« Reply #31 on: August 25, 2015, 11:29:21 AM »

I'm not using += for string concatenation, but for adding and assign. The & operator is a different animal.

José Roca

  • FireFly3 Registered User
  • Master FireFly Member
  • *
  • Posts: 2785
    • José Roca Software
Re: Are you guys sticking with PowerBASIC?
« Reply #32 on: August 25, 2015, 11:41:10 AM »

The CBStr class procedure that does the real work is:

Code: [Select]
' ========================================================================================
' Appends a string to the BSTR. The string can be a literal or a FB STRING or WSTRING variable.
' To append another BSTR:
' DIM bs AS CBStr = "1st string"
' DIM b2 AS CBStr = "2nd string"
' bs.Append *b2.Handle
' ========================================================================================
SUB CBStr.Append (BYREF wszStr AS CONST WSTRING)
   DIM n1 AS UINT = SysStringLen(m_bstr)
   DIM nLen AS UINT = .LEN(wszStr)
   IF nLen = 0 THEN EXIT SUB
   DIM b AS BSTR = SysAllocStringLen(NULL, n1+nLen)
   IF b = NULL THEN EXIT SUB
   memcpy(b, m_bstr, n1 * SIZEOF(WSTRING))
   memcpy(b+n1, @wszStr, nLen * SIZEOF(WSTRING))
   SysFreeString(m_bstr)
   m_bstr = b
END SUB
' ========================================================================================

To use it, you must do:

Code: [Select]
DIM bs AS CBStr = "1st string"
DIM b2 AS CBStr = "2nd string"
bs.Append *b2.Handle

Overloading the += operator

Code: [Select]
' ========================================================================================
' Appends a string to the BSTR. The string can be a literal or a FB STRING or WSTRING variable.
' ========================================================================================
OPERATOR CBStr.+= (BYREF wszStr AS CONST WSTRING)
   this.Append(wszStr)
END OPERATOR
' ========================================================================================

' ========================================================================================
' Appends a BSTR to the BSTR.
' ========================================================================================
OPERATOR CBStr.+= (BYREF pBStr AS CBStr)
   this.Append(*pBStr.Handle)
END OPERATOR
' ========================================================================================

Now, we can use:

Code: [Select]
DIM bs AS CBStr = "1st string"
DIM b2 AS CBStr = "2nd string"
bs += b2

José Roca

  • FireFly3 Registered User
  • Master FireFly Member
  • *
  • Posts: 2785
    • José Roca Software
Re: Are you guys sticking with PowerBASIC?
« Reply #33 on: August 25, 2015, 11:55:46 AM »

Added the &= operator. It does he same that +=.

I thought that FreeBasic had not the &= operator because I couldn't find it in the index of the help file, where it appears as ?.

Code: [Select]
' ========================================================================================
' Appends a string to the BSTR. The string can be a literal or a FB STRING or WSTRING variable.
' ========================================================================================
OPERATOR CBStr.&= (BYREF wszStr AS CONST WSTRING)
   this.Append(wszStr)
END OPERATOR
' ========================================================================================

' ========================================================================================
' Appends a BSTR to the BSTR.
' ========================================================================================
OPERATOR CBStr.&= (BYREF pBStr AS CBStr)
   this.Append(*pBStr.Handle)
END OPERATOR
' ========================================================================================

Pedro Marquez

  • FireFly3 Registered User
  • Junior FireFly Member
  • *
  • Posts: 90
  • FF3 User
Re: Are you guys sticking with PowerBASIC?
« Reply #34 on: August 25, 2015, 04:44:56 PM »

It will be good an open forum
Logged

John Montenigro

  • FireFly3 Registered User
  • Senior FireFly Member
  • *
  • Posts: 310
Re: Are you guys sticking with PowerBASIC?
« Reply #35 on: September 02, 2015, 04:58:25 PM »

Paul,
I just found out about the updated FF about an hour ago, and I have many questions. But the first order of business is to answer your question from the top of this thread:

Although at one point (20+ years ago!!!), I programmed professionally, it was DOS-based, and I came along to Windows programming with great difficulty. So I'm not the best person to ask about what tools "should" be, but I may be able to answer what works for me.

I'm primarily a Business Analyst, currently engaged in a major business "turnaround", and a small part of my work is to write programs to help eliminate repetitive manual tasks. I'm all over the place, from email to LAN connections, to automating QuickBooks, creating documents via XPRINT and PDF Creator...wherever people get bogged down, I either train them in a better process, or build a tool to overcome an obstacle. My programs are mostly hacks of the disposable kind - they will be replaced at some point in the future, not upgraded. They just have to work for now...

So I have to be able to respond to a problem and produce a working program quickly. PB and FF have always made that possible - and easy - for me. I've used PB since around 1993(?) and FF since about 2004(?), and I am not happy about having to learn another language or toolset. I will go to the ground with PB and FF. When they stop working for me, I won't care about programming anymore.

That said, it intrigues me to hear that you've transitioned to FreeBasic, and I feel compelled to investigate it. I have no idea where to start, what tools I'd need, or how to transition from PB to FB. But I'm willing to explore, experiment, and give it a fair try.

So, my questions:
- Where do I get FB? What's in it? (You don't have to tell me, just point me to good reading materials!)
- What do I do with my current version of FF? Is the new version only for FreeBasic, or both FB AND PB? Is there a cost to get the new FF for FB?
- (For this I probably DO need someone to tell me) What are the differences in capabilities between all my PB code, and what FreeBasic wants to see? What's the "effort index" for converting my PB code to FB? (on a scale of 1 to 10...)

I guess that's it for now. I'm interested, concerned that I won't be able to adapt, and fearful that I'll write worse code than ever!

I want to echo what's been said - how appreciative I am for what you gave us in FF, and how much that has helped me to create solutions for people, to make THEIR lives better; a good thing that has ripple effects far beyond what you can imagine!  So a great big THANK YOU from me (even if you ARE a Dolphins fan!)  ;D

Well, I've rambled on... I hope there's something useful to you in what I've written.

Looking forward to the "next phase"!

-John
Logged

José Roca

  • FireFly3 Registered User
  • Master FireFly Member
  • *
  • Posts: 2785
    • José Roca Software
Re: Are you guys sticking with PowerBASIC?
« Reply #36 on: September 03, 2015, 12:05:27 AM »

If you are happy with what you have, my advice is that you should continue using it.

If you really have some interest or curiosity about FreeBasic, just type FreeBasic in Google and you will get all the links that you need: download, documentation, forum, etc. Try it.

John Montenigro

  • FireFly3 Registered User
  • Senior FireFly Member
  • *
  • Posts: 310
Re: Are you guys sticking with PowerBASIC?
« Reply #37 on: September 03, 2015, 10:58:11 AM »

Hi Jose!

After I wrote that message, my curiosity got the best of me and I did just that - googled FB and started reading...

So...I've downloaded the compiler and tons of manuals/documentation, and will be reading and starting to tinker over the weekend.

Who knows? This might be the start of my programming career - again!

BTW, thank you for all the work you've done with the header files! I have yet to use them to their fullest, but the times I have used them, they have been a fabulous help!

-John
Logged

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8104
  • Windows 10
    • PlanetSquires Software
Re: Are you guys sticking with PowerBASIC?
« Reply #38 on: September 03, 2015, 01:05:17 PM »

Getting started with FreeBASIC is very easy. As time goes by I hope to create a tutorial of some sorts to help guide former PowerBasic users over to FreeBasic. When the PowerBasic site goes dark forever then you will be thankful that you have an alternative programming language that is pretty familiar to PB.

Download the 32 bit and 64 bit Windows binaries: (don't forget to download the chm Help file also)
http://freebasic.net/get

Download JellyFB Code Editor (I am working on a new open source version of the editor):
http://www.planetsquires.com/jellyfishpro_freebasic.htm

Download FireFly for FreeBASIC (this product is free):
http://www.planetsquires.com/firefly_freebasic.html

FBDebugger (if you want to use a standalone debugger):
http://www.freebasic.net/forum/viewtopic.php?f=8&t=13935

Sign up and browse the FB support forum:
http://www.freebasic.net/forum/index.php

I may at some point open these private forums to the public as well so ex-PBers can at least ask questions to some familiar faces here without feeling intimidated by a new community.

When programming in FB you need to be aware that it is much more strongly typed than PB. It is closer to C/C++ in this regard, mainly because the Windows include headers are translated directly from the C based MinGW headers. Therefore, you need to use types such as HWND, LPARAM, HANDLE, etc rather than simply a DWORD or LONG. If you don't do this then you will simply get a lot of compiler warnings.

I love the fact that the console window exists along side the traditional GUI windows. You simply need to specifiy a compiler command to turn it off. It is great for debugging because you can issue PRINT or ? statements and the text will display in the console window.

Jose is working on some awesome code to make integerating Unicode and COM easier with FB. When he finishes that code then the gap between FB and PB will be negligible.

I am very impressed with FB and every new project that I create is now done using FreeBASIC. FB gets better and better every single day.

:)




Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

David Kenny

  • FireFly3 Registered User
  • Senior FireFly Member
  • *
  • Posts: 435
  • Windows 7
Re: Are you guys sticking with PowerBASIC?
« Reply #39 on: September 03, 2015, 03:44:21 PM »

I love the fact that the console window exists along side the traditional GUI windows. You simply need to specifiy a compiler command to turn it off. It is great for debugging because you can issue PRINT or ? statements and the text will display in the console window.

Most BASIC's I've ever used have this feature...  I never could understand why PB didn't.  The only reason it didn't drive me crazy enough to give up on PB was the fact that PB compiles soooo fast.  I can test things out with minimal delay (although no delay would have been preferable).
Logged

Eddy Van Esch

  • FireFly3 Registered User
  • Senior FireFly Member
  • *
  • Posts: 239
  • FF3 User
    • DevOTechS
Re: Are you guys sticking with PowerBASIC?
« Reply #40 on: September 03, 2015, 04:04:08 PM »

Some months ago, when Paul went for C++, I had my mind set on PureBasic as my future replacement for PB. I played around some with PuBa but never actually started to program in it.
Seeing the recent rising enthusiasm of Paul and José about FB, and seeing that Paul really goes for 'FF for FB', I will follow along!

Since I have an ongoing private project written in PB that I continue to improve on, I will keep PB as my main programming language for now, but I will start learning FB too, now I still have a chance to do it at a slow pace.
When the lights really go out at PB, I should be able to switch entirely to FB for new projects.

My main reason to decide this is Paul developing FF for FB. I wrote this months ago, that this would be my motivation to go for FB, so here I am ...  :)

Thanks Paul and José for leading the way !!

Kind regards
Logged
Eddy

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8104
  • Windows 10
    • PlanetSquires Software
Re: Are you guys sticking with PowerBASIC?
« Reply #41 on: September 03, 2015, 06:01:25 PM »

Most BASIC's I've ever used have this feature...  I never could understand why PB didn't. 

Because selling PB Console compiler as a separate product made PB lots more money $$$$. I always felt that having two separate PB products was nothing more than a money grab. It could easily have been one product. Much like selling PB Forms as a separate product. It should have been part of PBWIN.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8104
  • Windows 10
    • PlanetSquires Software
Re: Are you guys sticking with PowerBASIC?
« Reply #42 on: September 03, 2015, 06:03:25 PM »

My main reason to decide this is Paul developing FF for FB. I wrote this months ago, that this would be my motivation to go for FB, so here I am ...  :)

Thanks Paul and José for leading the way !!

Awesome! Welcome aboard Eddy  :)
With a small investment in learning, I am sure that we all can be just as productive in FB as we were in PB.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Patrice Terrier

  • FireFly3 Registered User
  • Junior FireFly Member
  • *
  • Posts: 91
Re: Are you guys sticking with PowerBASIC?
« Reply #43 on: September 03, 2015, 06:15:03 PM »

Don't do twice the same mistake, selecting a compiler that is not widely used, and relying heavily on the work of just a few.

I know a real alternative to PB, but it is not Free ;)

Good luck anyway!
Logged

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8104
  • Windows 10
    • PlanetSquires Software
Re: Are you guys sticking with PowerBASIC?
« Reply #44 on: September 03, 2015, 06:23:27 PM »

Don't do twice the same mistake, selecting a compiler that is not widely used, and relying heavily on the work of just a few.

I know a real alternative to PB, but it is not Free ;)

Good luck anyway!


:)  :)  :)

Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor
Pages: 1 2 [3] 4 5 6