Recent Posts

Pages: [1] 2 3 ... 10
1
Bug Reports / Re: Extended String Literal statement issue
« Last post by MrBcx on July 23, 2021, 11:46:01 AM »
Kevin,
  Thank you I think :)
I started converting some code but I have many more like this
Code: [Select]
.append(E"! SetRect lib \quser32.dll\q alias \qSetRect\q (lpRect as RECT, byVal X1 as long, byVal Y1 as long, byVal X2 as long, byVal Y2 as long) as long \r\n")
.append(E"#pragma comment(lib,\qcomctl32.lib\q)\r\n")

How long before BCX 7.7.3 ?

James


Soon ... maybe days, perhaps a week.   I have several irons in the fire beside BCX right now.

Below is a corrected StripCode that you can swap in, if you can't wait.

Code: [Select]

SUB StripCode( Arg$ )
  DIM RAW p AS PCHAR
  DIM RAW p2 = Arg AS PCHAR
  DIM RAW asmFlag = 0
  DIM RAW eStr = 0
  DIM RAW sub_$

  WHILE (*p2 >8 AND *p2 < 13) OR *p2 = 32      'Trim leading space
    INCR p2
  WEND

  IF *p2 = ASC("!") THEN asmFlag = NOT UmQt    'Handle "!" Asm lines
  p = p2
  WHILE *p
    IF *p = 9 THEN *p = 32
    IF *p = c_DblQt THEN  ' ignore anything in string literal
      IF *(p-1) = 69 THEN ' we're in an extended string: E"\qABCD\n"
        *(p-1) = 1        ' chr$(1) will be deleted
        eStr = TRUE
      END IF
      WHILE *(++p) <> c_DblQt
        IF *p = 92 AND eStr THEN ' look for a \0, \t, \n, \r, \q, \\
          *p = 2
          SELECT CASE *(p+1)
            CASE 48  ' 0
            *(p+1) = 3
            CASE 116 ' t
            *(p+1) = 4
            CASE 110 ' n
            *(p+1) = 5
            CASE 114 ' r
            *(p+1) = 6
            CASE 113 ' q
            *(p+1) = 7
            CASE 92 ' \
            *(p+1) = 8
          END SELECT
          p++
        END IF
        IF *p = 0 THEN UmQt = NOT UmQt : EXIT WHILE
      WEND
    END IF
    ' If we're in a quoted continuation line then ignore comments
    IF NOT UmQt AND NOT asmFlag THEN
      IF (*p BOR 32) = ASC("r") THEN   'Remove REM's
        IF _
          (*(p+1) BOR 32) = ASC("e") AND _
          (*(p+2) BOR 32) = ASC("m") AND _
          (*(p+3) = 32 OR *(p+3) = 0) THEN
          IF p = p2 OR *(p-1) = ASC(":") OR *(p-1) = 32 THEN
            *p = 0 : EXIT WHILE
          END IF
        END IF
      END IF
      ' check for single quote comment marker and // C++ style comments
      IF *p = ASC("'") OR (*p = ASC("/") AND *(p+1) = ASC("/")) THEN
        *p = 0 : EXIT WHILE
      END IF
    END IF
    p++
  WEND

  WHILE p2 < p
    'Trim trailing space
    WHILE (*(p-1) >8 AND *(p-1) < 13) OR *(p-1) = 32
      *(--p) = 0
    WEND
    IF UmQt OR asmFlag THEN EXIT WHILE
    'Strip dangling colons
    IF *(p-1) = ASC(":") AND *(p-2) = 32 THEN
      DECR p
    ELSE
      EXIT WHILE
    END IF
  WEND
  IF eStr THEN
    REPLACE CHR$(1) WITH "" IN p2$    ' E
    REPLACE CHR$(2) WITH "" IN p2$    ' \ first backslash
    sub_$ = ENC$ ( "+CHR$(0)+" )
    REPLACE CHR$(3) WITH sub_$ IN p2$ ' 0
    sub_$ = ENC$ ( "+CHR$(9)+" )
    REPLACE CHR$(4) WITH sub_$ IN p2$ ' t
    sub_$ = ENC$ ( "+CHR$(10)+" )
    REPLACE CHR$(5) WITH sub_$ IN p2$ ' n
    sub_$ = ENC$ ( "+CHR$(13)+" )
    REPLACE CHR$(6) WITH sub_$ IN p2$ ' r
    sub_$ = ENC$ ( "+CHR$(34)+" )
    REPLACE CHR$(7) WITH sub_$ IN p2$ ' q
    sub_$ = ENC$ ( "+CHR$(92)+" )
    REPLACE CHR$ (8) WITH sub_$ IN p2$ ' \
    REPLACE (CHR$(c_DblQt) + CHR$(c_DblQt) + CHR$(43)) WITH "" IN p2$
    REPLACE (CHR$(43) + CHR$(c_DblQt) + CHR$(c_DblQt)) WITH "" IN p2$
  END IF
  Arg$ = p2$
END SUB
2
Bug Reports / Re: Extended String Literal statement issue
« Last post by jcfuller on July 23, 2021, 11:14:51 AM »
Kevin,
  Thank you I think :)
I started converting some code but I have many more like this
Code: [Select]
.append(E"! SetRect lib \quser32.dll\q alias \qSetRect\q (lpRect as RECT, byVal X1 as long, byVal Y1 as long, byVal X2 as long, byVal Y2 as long) as long \r\n")
.append(E"#pragma comment(lib,\qcomctl32.lib\q)\r\n")

How long before BCX 7.7.3 ?

James
3
Bug Reports / Re: Extended String Literal statement issue
« Last post by MrBcx on July 23, 2021, 10:14:37 AM »
BCX Version 7.3.2 translates to:

strcpy(RetStr, join(5,"Hello, ",chr(34),"BCX",chr(34)," World"));

I will investigate but it could be a while before I have a fix.


A workaround is to substitute the E-string to something more BASIC-ish:

RetStr$ = "Hello, " + ENC$("BCX") + " World"

Found it ... E-strings will work again in 7.7.3

Reverted to earlier version of internal function StripCode.
4
Bug Reports / Re: Extended String Literal statement issue
« Last post by MrBcx on July 23, 2021, 09:18:44 AM »
BCX Version 7.3.2 translates to:

strcpy(RetStr, join(5,"Hello, ",chr(34),"BCX",chr(34)," World"));

I will investigate but it could be a while before I have a fix.


A workaround is to substitute the E-string to something more BASIC-ish:

RetStr$ = "Hello, " + ENC$("BCX") + " World"
5
Off-Topic Discussions / Re: SSD not the answer
« Last post by MrBcx on July 23, 2021, 08:59:28 AM »

Could you post or send me your LCCWin32 batch files? The last time I tried the Bldbat batch versions, they didn't work. It would be easier for me to fix it rather than remove it. Or else I can leave it as is, broken.

Posted below --

I only have 32-bit batch files, as I was never comfortable with the quality/stability of the 64-bit version.

Hi MrBCX:

Thanks for these.

However, I can't compile BCX with LCCWin32. It errors out   

with

Code: [Select]
Compiling Bc with LccWin32
Error bc.c: 4181  operands of = have illegal types 'pointer to void' and 'int'
1 error, 0 warnings
cannot open bc.obj

line 4181 is

Code: [Select]
hCon=GetConsoleWindow();
so I change it to

Code: [Select]
      hCon=(HWND)GetConsoleWindow();
and it errors as

Code: [Select]
Compiling Bc with LccWin32
bc.obj .text: undefined reference to '_GetConsoleWindow'

It's in LccWin32's wincon.h but I can't see where that is linked in the existing setup.

If I try and add wincon.h manually then many errors occur.

Hi Robert --

Because Jacob Navia no longer maintains it, on occasion I have had to tweak Win.h

The attached was last touched in June 2021.  The original win.h in his final release
was dated 2013.  It works for me, it -should- work for you but this is Windows
development that we're discussing which implies a mix of science, art,  magic
and luck.
6
Bug Reports / Extended String Literal statement issue
« Last post by jcfuller on July 23, 2021, 07:01:12 AM »
From the Extended String Literal statement example2

Code: [Select]
$ONEXIT "PEL.BAT $FILE$ -m64 con"
DIM RetStr$
RetStr$ = E"Hello, \qBCX\q World"
PRINT RetStr$

Result:
Quote
=======================================
int main(int argc, char *argv[])
{
  strcpy(RetStr,"Hello, """BCX""" World");
  printf("%s\n",RetStr);
 
  return EXIT_SUCCESS;   // End of main program
}
========================================
Setting 64-bit environment for Pelles C...
Compiling "TestE2.c" to a  "Windows 64 bit Console App"
TestE2.c(189): error #2001: Syntax error: expected ')' but found 'BCX'.
TestE2.c(189): error #2001: Syntax error: expected ';' but found 'BCX'.
TestE2.c(189): error #2048: Undeclared identifier 'BCX' (did you mean: ?).
TestE2.c(189): error #2001: Syntax error: expected ';' but found 'string constant'.
TestE2.c(189): error #2001: Syntax error: expected ';' but found ')'.
TestE2.c(189): error #2061: Invalid statement termination.
POLINK: fatal error: File not found: 'TestE2.obj'.
Finished!

James
7
Off-Topic Discussions / Re: SSD not the answer
« Last post by Robert on July 23, 2021, 01:36:26 AM »

Could you post or send me your LCCWin32 batch files? The last time I tried the Bldbat batch versions, they didn't work. It would be easier for me to fix it rather than remove it. Or else I can leave it as is, broken.

Posted below --

I only have 32-bit batch files, as I was never comfortable with the quality/stability of the 64-bit version.

Hi MrBCX:

Thanks for these.

However, I can't compile BCX with LCCWin32. It errors out   

with

Code: [Select]
Compiling Bc with LccWin32
Error bc.c: 4181  operands of = have illegal types 'pointer to void' and 'int'
1 error, 0 warnings
cannot open bc.obj

line 4181 is

Code: [Select]
hCon=GetConsoleWindow();
so I change it to

Code: [Select]
      hCon=(HWND)GetConsoleWindow();
and it errors as

Code: [Select]
Compiling Bc with LccWin32
bc.obj .text: undefined reference to '_GetConsoleWindow'

It's in LccWin32's wincon.h but I can't see where that is linked in the existing setup.

If I try and add wincon.h manually then many errors occur.




8
Off-Topic Discussions / Re: SSD not the answer
« Last post by Robert on July 23, 2021, 01:02:27 AM »
I initially thought Embarcadero CE could be a possible replacement for what I use LccWin32 for.

On my SSD, Lcc-Win32 completes 3 translates + 3 compiles in 10 seconds.

Using my Borland bat, minus the -ofast flag, takes about 20 seconds for the 3 + 3.

Of course, the final versions that I upload are built with MSVC + Clang.

For me, Embarcadero CE is just one more tool in the toolbox.  It is not a tool that I love.
And I tool that is not loved is a tool that is not used.

There's no love lost.

And there's know love lost.

I understand why you treasure your LCCWin32.

I was just working with Jeff Glatt's BCXed cwebpage and ran into errors.

W.T.F. I'm positive this used to compile.

Had a look then found some BCX AUTO datatypes.

Yes MSVC used to do this AUTO but not no more.

You know where this is going ...
9
Off-Topic Discussions / Re: SSD not the answer
« Last post by MrBcx on July 22, 2021, 11:32:04 PM »
I initially thought Embarcadero CE could be a possible replacement for what I use LccWin32 for.

On my SSD, Lcc-Win32 completes 3 translates + 3 compiles in 10 seconds.

Using my Borland bat, minus the -ofast flag, takes about 20 seconds for the 3 + 3.

Of course, the final versions that I upload are built with MSVC + Clang.

For me, Embarcadero CE is just one more tool in the toolbox.  It is not a tool that I love.
And a tool that is not loved is a tool that is not used.




10
Off-Topic Discussions / Re: SSD not the answer
« Last post by Robert on July 22, 2021, 10:32:05 PM »
Neither 32-bit batch works for me.   The 2nd generation of BCX becomes corrupt and hangs.

I'll use the 64-bit batch for routine testing but I'll pass on the 32-bit version -- I don't need it.

The classic 32 bit bcc32.exe is 6 times faster than the 64 bit.

Clean out the folder except for bc.bas, a working bc.exe and the batch file.
I just checked it again several times and no problems.
If you don't need it ... whatever.

However, bcc32c.exe is not too simple. Don't use the bcc32c.exe CLang enhanced compiler. The linker setup is still haywire.

Pages: [1] 2 3 ... 10