Author Topic: I wish we had made things less messy.  (Read 360 times)

Robert

  • Hero Member
  • *****
  • Posts: 555
    • View Profile
I wish we had made things less messy.
« on: September 23, 2020, 09:45:39 PM »
This BCX code,

Code: [Select]

DIM cum#[1000]
DIM tcont, pd#
 
tcont = 1
cum#[tcont] = 17
pd# = 2
PRINT (cum#[tcont] ^ (1 / ((tcont + 1) / pd#)) - 1) * 100
 
PRINT 7 ^ (MOD(13, 7))
PRINT (SIN(13)) ^ (SIN(13))
PRINT pd ^ (pd ^ 2)
 
PRINT pd ^ pd
PRINT 7 ^ (IMOD(3,2))
 
PRINT POW(2, POW(2, POW(2, 2)))
PRINT 2 ^ (2 ^ (2 ^ (2)))
PRINT pd ^ pd - pd ^ (LOG(pd)) - (SIN(pd)) ^ 7


back in the day when things were right proper, would translate, in part, to this

Code: [Select]

printf("% .15G\n",(double)(pow(cum[tcont],(1/((tcont+1)/pd)))-1)*100);
printf("% .15G\n",(double)pow(7,(fmod(13,7))));
printf("% .15G\n",(double)pow((sin(13)),(sin(13))));
printf("% .15G\n",(double)pow(pd,(pow(pd,2))));
printf("% .15G\n",(double)pow(pd,pd));
printf("% .15G\n",(double)pow(7,(imod(3,2))));
printf("% .15G\n",(double)pow(2,pow(2,pow(2,2))));
printf("% .15G\n",(double)pow(2,(pow(2,(pow(2,(2)))))));
printf("% .15G\n",(double)pow(pd,pd)-pow(pd,(log(pd)))-pow((sin(pd)),7));


Now, since BCX 6.8.0 there is this

Code: [Select]

printf("% .15G\n",(double)( pow ( cum [ tcont ] , ( 1 / ( ( tcont + 1) / pd))) - 1)*100);
printf("% .15G\n",(double)pow( 7 , ( fmod ( 13 , 7))));
printf("% .15G\n",(double)pow( ( sin ( 13)) , ( sin ( 13))));
printf("% .15G\n",(double)pow( pd , ( pow ( pd , 2))));
printf("% .15G\n",(double)pow( pd , pd));
printf("% .15G\n",(double)pow( 7 , ( imod ( 3 , 2))));
printf("% .15G\n",(double)pow( 2 , pow ( 2 , pow ( 2 , 2))));
printf("% .15G\n",(double)pow( 2 , ( pow ( 2 , ( pow ( 2 , ( 2)))))));
printf("% .15G\n",(double)pow( pd , pd)-pow( pd , ( log ( pd)))-pow( ( sin ( pd)) , 7));





dgarner

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: I wish we had made things less messy.
« Reply #1 on: September 23, 2020, 11:09:24 PM »
I guess messy is in the eye of the beholder.  I wish the casts were separated from the thing they are casting.  I think it's much easier to see the "sin" and other function calls in the lower formatting.

There's always AStyle, if you want to change the formatting of the output code.  To my mind, the .c is an intermediate work product on the way to getting an executable file.  I would not spend too much time fretting over the formatting of it.
As long as the compilers can interpret it, I don't think it matters too much.


MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 714
    • View Profile
Re: I wish we had made things less messy.
« Reply #2 on: September 24, 2020, 12:05:45 AM »
... and the congregation says, "AMEN", Robert.

I've pored over the code many times trying to pinpoint where all the messed up formatting emanates from.  Invariably, my eyes gloss over and I give up.  My current efforts involve attacking the problem from the opposite direction with varying degrees of success.

I don't know who started messing up the formatting or why it was allowed to continue.  As you know, I was using 6.22 for most of this decade and largely ignored the newer versions, until Jeff roped me back in almost a year ago.  I do care about legibility and would prefer not needing to rely on Astyle or similar tools.

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 714
    • View Profile
Re: I wish we had made things less messy.
« Reply #3 on: September 24, 2020, 01:12:24 AM »
I FOUND IT!

Comment out this line:

IF iCnt AND Stk$ [iThisToken] <> ")" THEN CONCAT (Arg$, SPC$


I'm certain this doesn't solve all our formatting woes but it solves a BIG ONE!

Robert

  • Hero Member
  • *****
  • Posts: 555
    • View Profile
Re: I wish we had made things less messy.
« Reply #4 on: September 24, 2020, 02:00:13 PM »
... and the congregation says, "AMEN", Robert.

I've pored over the code many times trying to pinpoint where all the messed up formatting emanates from.  Invariably, my eyes gloss over and I give up.  My current efforts involve attacking the problem from the opposite direction with varying degrees of success.

I don't know who started messing up the formatting or why it was allowed to continue.  As you know, I was using 6.22 for most of this decade and largely ignored the newer versions, until Jeff roped me back in almost a year ago.  I do care about legibility and would prefer not needing to rely on Astyle or similar tools.

AStyle can't undo extra spaces. Uncrustify does a better job of cleaning it up.

Robert

  • Hero Member
  • *****
  • Posts: 555
    • View Profile
Re: I wish we had made things less messy.
« Reply #5 on: September 24, 2020, 02:05:06 PM »
I FOUND IT!

Comment out this line:

IF iCnt AND Stk$ [iThisToken] <> ")" THEN CONCAT (Arg$, SPC$


I'm certain this doesn't solve all our formatting woes but it solves a BIG ONE!

An excellent find.

Now my obsessions are LPARAM and WPARAM appended with extra space in CALLBACKS and BOR, in some circumstances, with extra spaces.

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 714
    • View Profile
Re: I wish we had made things less messy.
« Reply #6 on: September 24, 2020, 03:15:27 PM »

An excellent find.

Now my obsessions are LPARAM and WPARAM appended with extra space in CALLBACKS and BOR, in some circumstances, with extra spaces.

I found and fixed another handful of problems.

Prudence is whispering that I should release 7.5.6 soon, and save any other fixes for future versions. 

Testing underway ...