Author Topic: STR$ change  (Read 141 times)

jcfuller

  • Sr. Member
  • ****
  • Posts: 276
    • View Profile
STR$ change
« on: January 28, 2021, 07:30:21 AM »
Kevin,
  Request modification of BCX STR$.
Current:
Code: [Select]
char *str(double d_, int nospc)
{
  char *strtmp = BCX_TmpStr(24);
  if (nospc)
     sprintf(strtmp, "%.15G", d_);
  else
     sprintf(strtmp, "% .15G", d_);
  return strtmp;
}
Request:
Code: [Select]
char *str(double d_, int nospc)
{
  char *strtmp = BCX_TmpStr(24);
  if (nospc)
     snprintf(strtmp,23, "%.15G", d_);
  else
     snprintf(strtmp,23, "% .15G", d_);
  return strtmp;
}
Reason:
  The Unicode version ,swprintf, requires the buffer size.

You use a MAGIC number so there sould be no issues??

Thank you for your consideration.

James

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 749
    • View Profile
Re: STR$ change
« Reply #1 on: January 28, 2021, 08:22:40 AM »
JC -- Thanks .. it will appear in 7.6.4

iancasey

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: STR$ change
« Reply #2 on: January 28, 2021, 12:20:59 PM »
Great change!!
I had always needed to use Wayne's Format function, using Str$ again will be a lot easier.

iancasey

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: STR$ change
« Reply #3 on: February 14, 2021, 07:53:57 PM »
Okay,
I finally got around to updating everything and tried Str$ it gave me some errors,  using UnicodeLexer v3.3 the line in TCharlexer.txt

_stprintf,swprintf,snprintf,MODIFY2

needs to be changed to :
_stprintf,swprintf,snprintf

be sure to leave _stprintf,swprintf,sprintf,MODIFY2 as is.

The MODIFY2 add the string size automatically - sizeof(strtmp) * sizeof(TCHAR)

Now all seems well in BCX World.



MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 749
    • View Profile
Re: STR$ change
« Reply #4 on: February 15, 2021, 08:29:45 AM »
Ian and James,

Not being a UnicodeLexer user, I will defer to the subject-matter experts but I think it might
be helpful to past, present, and future UnicodeLexer users if a sticky thread on the BCX forum
under BCX ACCESSORIES were created where updated versions of UnicodeLexer and
support could be centralized.


jcfuller

  • Sr. Member
  • ****
  • Posts: 276
    • View Profile
Re: STR$ change
« Reply #5 on: February 15, 2021, 10:24:13 AM »
Kevin,

  Ian and my unicode lexers are  quite different but do basically the same thing.
Mine is based on his but it is command line driven while his is a GUI pick and choose.
I had been hacking and adding stuff for MANY years for use with bc9 and now BCX.
Not sure how we could approach a sticky.
James

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 749
    • View Profile
Re: STR$ change
« Reply #6 on: February 15, 2021, 02:13:32 PM »
Kevin,

  Ian and my unicode lexers are  quite different but do basically the same thing.
Mine is based on his but it is command line driven while his is a GUI pick and choose.
I had been hacking and adding stuff for MANY years for use with bc9 and now BCX.
Not sure how we could approach a sticky.
James

Always possible to create two threads and make them both sticky:  For example

[Unicode_Lexer_Console]

[Unicode_Lexer_GUI]

iancasey

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: STR$ change
« Reply #7 on: February 15, 2021, 04:29:49 PM »
I like the ideas of sticky threads

Ian


« Last Edit: February 15, 2021, 05:03:13 PM by iancasey »