Feature requests

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

do .. loop is common in a number of dialects, true, often combined with exit (if)

Code: Select all

do
  whatever
  if a!=true
    exit
  endif
loop

hey, psycho, you wanna' turn purebasic into an even more non-basic basic? :-)

an alternative syntax for do .. loop i've seen is repeat .. forever :-)

re aliases... gfabasic (16) just implemented each and every flavour of each command, including some very weird ones... type casting: L: W: B:... alternative peeks {WORD} {CARD} etc. although they sometimes went a little overboard...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Wayne Diamond
User
User
Posts: 38
Joined: Tue Dec 30, 2003 1:37 pm
Location: Australia

Post by Wayne Diamond »

Here's a Purebasic version of what i meant with the Hex function. It's not as efficient as i'd like but it'll do for now.

Code: Select all

Procedure.s HexEx(inValue.l, inLength.l)
 outHex.s = Hex(inValue): minLen.l = Len(outHex): outHex = Space(inLength) + outHex
 outHex = ReplaceString(outHex, " ", "0", 1, 1): If minLen < inLength: minLen = inLength: EndIf
 outHex = Right(outHex, minLen): ProcedureReturn outHex
EndProcedure
 
MessageRequester("HexEx Test", HexEx(1212, 8), 0)  ;// returns 000004BC
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

Wayne Diamond wrote:Thanks, but Right/Left pads it out with spaces, not the "0" numeric char which is needed for such a Hex function, but it'll be easy to knock up in asm - looks like that'll be on tonights menu ... :)
Doh. I thought Hex() always produced an 8 character string with leading zeros. If that's not the case then you can use RSet(Hex(20), 6, "0") for a 6 character hex string padded with leading zeros.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Wayne Diamond
User
User
Posts: 38
Joined: Tue Dec 30, 2003 1:37 pm
Location: Australia

Post by Wayne Diamond »

then you can use RSet(Hex(20), 6, "0")
Yep that works well, nice one :)
Post Reply