Author Topic: Lots of Errors and warnings  (Read 759 times)

Robert

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Lots of Errors and warnings
« Reply #15 on: June 01, 2020, 05:58:16 PM »
I've removed the -x command line switch. A lot more of the programs have compiled succesfully (including S00.bas). However there are still quite a few with errors (see attached output file) and a few missing .c and .exe files. I'll have a go at tracking down the errors if I can later. Maybe the -x is needed on a few of the files? Thanks.

Hi David:

Don't spend too much time fixing the broken ones for the sake of fixing the broken ones. If you want to do it to learn, then go ahead.

Many if not all of the broken ones have already been fixed but have not been updated in the Installer. If I had a penny for the number of times MrBCX said he was going to update them, I would have more than 1 penny.

I am checking the console samples in the BCX Help file against your output list of problem files and if I find them to be broken like the ones in MrBCX's Installer, I will, I promise, fix them if I can.

Robert

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Lots of Errors and warnings
« Reply #16 on: June 01, 2020, 06:22:53 PM »
I've removed the -x command line switch. A lot more of the programs have compiled succesfully (including S00.bas). However there are still quite a few with errors (see attached output file) and a few missing .c and .exe files. I'll have a go at tracking down the errors if I can later. Maybe the -x is needed on a few of the files? Thanks.

Hi David:

Don't spend too much time fixing the broken ones for the sake of fixing the broken ones. If you want to do it to learn, then go ahead.

Many if not all of the broken ones have already been fixed but have not been updated in the Installer. If I had a penny for the number of times MrBCX said he was going to update them, I would have more than 1 penny.

I am checking the console samples in the BCX Help file against your output list of problem files and if I find them to be broken like the ones in MrBCX's Installer, I will, I promise, fix them if I can.

As a token of my good faith, here is a functional s152.bas

Code: [Select]
CONST MaxFlights = 100

TYPE FL
  Depart[20] AS CHAR
  Arrival[20] AS CHAR
  Distance AS INTEGER
  Skip AS INTEGER
END TYPE

TYPE STACK
  Depart[20] AS CHAR
  Arrival[20] AS CHAR
  Distance AS INTEGER
END TYPE

GLOBAL Flight[MaxFlights] AS FL
GLOBAL Bt_Stack[MaxFlights] AS STACK
GLOBAL Solution[MaxFlights] AS STACK
GLOBAL F_pos AS INTEGER
GLOBAL Find_pos AS INTEGER
GLOBAL tos AS INTEGER
GLOBAL stos AS INTEGER
GLOBAL start$
GLOBAL end$
GLOBAL gdist AS INTEGER
GLOBAL c1$
GLOBAL c2$
GLOBAL c3$
GLOBAL Use_Method
GLOBAL RouteTest
GLOBAL dd
GLOBAL tt
CONST Depth   = 0
CONST Width   = 1
CONST Path    = 2
CONST Node    = 3
CONST Optimal = 4

PRINT "From ";
INPUT start$
PRINT "to ";
INPUT end$
'start$ = "New York"
'end$ = "Los Angeles"
'start$ = "Calgary"
'end$ = "Houston"

CALL Setup
dd = Find(start$, end$)

IF dd THEN
  PRINT "Direct Route, Distance is "; dd
  getchar()
  END = 0
END IF

CALL Setup
PRINT
PRINT "Search by Depth"
Use_Method = Depth
IsFlight(start$, end$)

CALL Setup
PRINT
PRINT "Search by Width"
Use_Method = Width
IsFlight(start$, end$)

CALL Setup
PRINT
PRINT "Search by Path Removal"
Use_Method = Path
DO
  RouteTest = IsFlight(start$, end$)
  tos = 0
LOOP WHILE RouteTest > 0

CALL Setup
PRINT
PRINT "Search by Node Removal"
Use_Method = Node
DO
  RouteTest = IsFlight(start$, end$)
  CALL ClearMarkers
  IF tos > 0 THEN
    CALL Pop(c2$, c3$, &gdist)
    CALL Pop(c1$, c3$, &gdist)
    CALL Retract(c1$, c2$)
    tos = 0
  END IF
LOOP WHILE RouteTest > 0

CALL Setup
Use_Method = Optimal
PRINT
PRINT "Optimal Search"
RouteTest = IsFlight(start$, end$)
tt = 0
dd = 0
WHILE tt < stos
  PRINT $Solution[tt].Depart$; " to ";
  dd += Solution[tt].Distance
  tt++
WEND
PRINT end$
PRINT "Distance is "; dd

getchar();
END = 0

SUB Setup
  F_pos = 0
  tos = 0
  stos = 0
  Find_pos = 0
  Assert_Flight("New York", "Chicago", 1000)
  Assert_Flight("Chicago", "New York", 1000)
  Assert_Flight("New York", "Urbana", 1200)
  Assert_Flight("Urbana", "New York", 1200)
  Assert_Flight("Chicago", "Denver", 1000)
  Assert_Flight("Denver", "Chicago", 1000)
  Assert_Flight("Chicago", "Urbana", 400)
  Assert_Flight("Urbana", "Chicago", 400)
  Assert_Flight("Urbana", "Houston", 900)
  Assert_Flight("Houston", "Urbana", 900)
  Assert_Flight("New York", "Toronto", 800)
  Assert_Flight("Toronto", "New York", 800)
  Assert_Flight("New York", "Denver", 1900)
  Assert_Flight("Denver", "New York", 1900)
  Assert_Flight("Toronto", "Calgary", 1500)
  Assert_Flight("Calgary", "Toronto", 1500)
  Assert_Flight("Toronto", "Los Angeles", 1800)
  Assert_Flight("Los Angeles", "Toronto", 1800)
  Assert_Flight("Toronto", "Chicago", 500)
  Assert_Flight("Chicago", "Toronto", 500)
  Assert_Flight("Denver", "Urbana", 1000)
  Assert_Flight("Urbana", "Denver", 1000)
  Assert_Flight("Denver", "Houston", 1500)
  Assert_Flight("Houston", "Denver", 1500)
  Assert_Flight("Houston", "Los Angeles", 1500)
  Assert_Flight("Los Angeles", "Houston", 1500)
  Assert_Flight("Denver", "Los Angeles", 1000)
  Assert_Flight("Los Angeles", "Denver", 1000)
END SUB

SUB Assert_Flight(frm$, dst$, dist AS INTEGER)
  IF F_pos < MaxFlights THEN
    Flight[F_pos].Depart$ = frm$
    Flight[F_pos].Arrival$ = dst$
    Flight[F_pos].Distance = dist
    Flight[F_pos].Skip = 0
    F_pos++
  ELSE
    PRINT "Flight database full"
  END IF
END SUB

FUNCTION Match(frm$, dst$)
  DIM RAW t

  t = 0
  WHILE t < F_pos
    IF Flight[t].Depart$ = frm$ AND Flight[t].Arrival$ = dst$ THEN
      FUNCTION = Flight[t].Distance
    END IF
    t++
  WEND
  FUNCTION = 0
END FUNCTION

FUNCTION BeenTo(where$)
  DIM RAW t
  t = 0
  WHILE t < tos
    IF Bt_Stack[t].Depart$ = where$ THEN
      FUNCTION = 1
    END IF
    t++
  WEND
  FUNCTION = 0
END FUNCTION

FUNCTION Find(frm$, anywhere$)
  Find_pos = 0
  WHILE Find_pos < F_pos
    IF Flight[Find_pos].Depart$ = frm$ AND Flight[Find_pos].Skip = 0 THEN
      IF BeenTo(Flight[Find_pos].Arrival$) = 0 THEN
        anywhere$ = Flight[Find_pos].Arrival$
        Flight[Find_pos].Skip = 1 + tos
        FUNCTION = Flight[Find_pos].Distance
      END IF
    END IF
    Find_pos++
  WEND
  FUNCTION = 0
END FUNCTION

SUB Push(frm$, dst$, dist AS INTEGER)
  IF tos < MaxFlights THEN
    Bt_Stack[tos].Depart$ = frm$
    Bt_Stack[tos].Arrival$ = dst$
    Bt_Stack[tos].Distance = dist
    tos++
  ELSE
    PRINT "Stack full"
  END IF
END SUB

SUB Pop(frm$, dst$, dist AS INTEGER PTR)
  IF tos > 0 THEN
    tos--
    frm$ = Bt_Stack[tos].Depart$
    dst$ = Bt_Stack[tos].Arrival$
    *dist = Bt_Stack[tos].Distance
  ELSE
    PRINT "Stack underflow"
  END IF
END SUB

SUB Spush(frm$, dst$, dist AS INTEGER)
  IF stos < MaxFlights THEN
    Solution[stos].Depart$ = frm$
    Solution[stos].Arrival$ = dst$
    Solution[stos].Distance = dist
    stos++
  ELSE
    PRINT "Solution Stack full"
  END IF
END SUB

SUB ClearFar()
  DIM RAW ts

  ts = tos + 1
  Find_pos = 0
  WHILE Find_pos < F_pos
    IF Flight[Find_pos].Skip > ts THEN
      Flight[Find_pos].Skip = 0
    END IF
    Find_pos++
  WEND
END SUB

SUB ClearWidth(frm$, anywhere$)
  DIM RAW ts

  ts = 0
  Find_pos = 0
  WHILE Find_pos < F_pos
    IF Flight[Find_pos].Depart$ = frm$ AND (Flight[Find_pos].Arrival$ = anywhere$ OR ts = 1)THEN
      ts = 1
      Flight[Find_pos].Skip = 0
    END IF
    Find_pos++
  WEND
END SUB

FUNCTION IsFlight(frm$, dst$) AS INTEGER
  DIM RAW d
  DIM RAW dist
  DIM RAW anywhere$
  DIM RAW fany$
  DIM RAW r

  r = 0
  IF Use_Method = Width THEN
    dist = Find(frm$, anywhere$)
    fany$ = anywhere$
    WHILE dist
      d = Match(anywhere$, dst$)
      IF d THEN
        Push(frm$, dst$, dist)
        Push(anywhere$, dst$, d)
        r = Route(dst$)
        FUNCTION = r
      END IF
      dist = Find(frm$, anywhere$)
    WEND
    CALL ClearWidth(frm$, fany$)
  END IF

  IF Use_Method <> Width THEN
    d = Match(frm$, dst$)
    IF d THEN
      Push(frm$, dst$, d)
      r = Route(dst$)
      IF Use_Method = Optimal AND r > 0 THEN
        Pop(frm$, dst$, &dist)
        CALL ClearFar
        r = IsFlight(frm$, dst$)
      END IF
      FUNCTION = r
    END IF
  END IF

  dist = Find(frm$, anywhere$)
  IF dist THEN
    Push(frm$, dst$, dist)
    r = IsFlight(anywhere$, dst$)
  ELSE
    IF tos > 0 THEN
      Pop(frm$, dst$, &dist)
      CALL ClearFar
      r = IsFlight(frm$, dst$)
    END IF
  END IF
  FUNCTION = r
END FUNCTION

FUNCTION Route(dst$) AS INTEGER
  DIM RAW dist
  DIM RAW t
  STATIC old_dist = 32000

  IF Use_Method = Optimal AND tos = 0 THEN
    FUNCTION = 0
  END IF
  dist = 0
  t = 0
  WHILE t < tos
    IF Use_Method <> Optimal THEN PRINT $Bt_Stack[t].Depart$; " to ";
    dist += Bt_Stack[t].Distance
    t++
  WEND
  IF Use_Method <> Optimal THEN
    PRINT dst$
    PRINT "Distance is "; dist
  END IF
  IF Use_Method = Optimal THEN
    IF dist < old_dist AND dist > 0 THEN
      t = 0
      old_dist = dist
      stos = 0
      WHILE t < tos
        CALL Spush(Bt_Stack[t].Depart$, Bt_Stack[t].Arrival$, Bt_Stack[t].Distance)
        t++
      WEND
    END IF
  END IF
  FUNCTION = dist
END FUNCTION

SUB ClearMarkers
  DIM RAW t

  FOR t = 0 TO F_pos
    Flight[t].Skip = 0
  NEXT
END SUB

SUB Retract(frm$, dst$)
  DIM RAW t

  FOR t = 0 TO F_pos
    IF Flight[t].Depart$ = frm$ AND Flight[t].Arrival$ = dst$ THEN
      Flight[t].Depart$ = ""
      EXIT SUB
    END IF
  NEXT
END SUB


MrBcx

  • Administrator
  • Sr. Member
  • *****
  • Posts: 434
    • View Profile
Re: Lots of Errors and warnings
« Reply #17 on: June 02, 2020, 12:05:14 PM »
Quote from: Robert
If I had a penny for the number of times MrBCX said he was going to update them, I would have more than 1 penny.

Please consider my debt paid-in-full.

Robert

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Lots of Errors and warnings
« Reply #18 on: June 02, 2020, 01:07:45 PM »
Quote from: Robert
If I had a penny for the number of times MrBCX said he was going to update them, I would have more than 1 penny.

Please consider my debt paid-in-full.

I really appreciate this update. Debt paid in FULL!

I must confess this has been a bit of a sore point for me.

Sixteen years ago Andreas Guenther, Garvan O'Keefe and myself did a complete comprehensive overhaul of the demos including testing on all the available compilers with each demo having a test report, like so

Code: [Select]
Compiler results
borland        ok
mingw          ok
lcc32          ok
pellesc        ok
digital mars   ok
mcvc++ toolkit ok
openwatcom     ok

At that time I never saw any acknowledgment of our effort and the updates were not incorporated into the BCX distro. I never did understand that and for a time felt resentful and like Why the F**k bother? but I did get over it, sort of ... but those feelings would rear their ugly head whenever a post such as David Briscoe's recent one would be made.

Now it is all good.

I don't know if you recall any of this, October/November 2004, but, if you like, I do have the updated (for 2004) GUI and DLL demos and could pass them on to you for your consideration.

Thank you again for this.


MrBcx

  • Administrator
  • Sr. Member
  • *****
  • Posts: 434
    • View Profile
Re: Lots of Errors and warnings
« Reply #19 on: June 02, 2020, 01:55:11 PM »
Robert,

I do remember.

2004 was a tough year for me (a death in the family, chaos at work, etc) all of which contributed to my
decision to release  BCX under GPL and to step away from the spotlight.

I never enjoyed maintaining that Inno setup for BCX which explains why things are the way they are.

Your updated demos were available on Yahoo for anyone who wanted them, so I felt un-compelled.
They are also backed up on this server in your Yahoo folder and there are updated GUI demos
( from 2004-5 ) in Andreas' EZ-IDE folder.

It's been a couple of months but I think I have a complete working set of GUI and DLL demos that
compile with modern compilers and the newest BCX translators. 

Guess I'll need to get some more pennies ready ...


djsb

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Lots of Errors and warnings
« Reply #20 on: June 02, 2020, 02:12:45 PM »
Does this mean ALL the examples (console, gui etc) now work OK? If so, thanks for the effort in doing this. Where can I download the files? Thanks.

David.




P.S S70.exe, S76.exe, S79.exe, S92.exe, S128.exe, S131.exe, S152.exe S154.exe S76.c and S154.c were missing from the directory where I ran the batch file.
I tried a few of the GUI programs but a few failed maybe due to something to do with resource files. I have very little experience with Windows C. This is why I'm using BCX, so I can learn a bit. Also, if there is anything I can do to help in testing these demo files please ask.

Robert

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Lots of Errors and warnings
« Reply #21 on: June 02, 2020, 02:14:44 PM »
Robert,

I do remember.

2004 was a tough year for me (a death in the family, chaos at work, etc) all of which contributed to my
decision to release  BCX under GPL and to step away from the spotlight.

I never enjoyed maintaining that Inno setup for BCX which explains why things are the way they are.

Your updated demos were available on Yahoo for anyone who wanted them, so I felt un-compelled.
They are also backed up on this server in your Yahoo folder and there are updated GUI demos
( from 2004-5 ) in Andreas' EZ-IDE folder.

It's been a couple of months but I think I have a complete working set of GUI and DLL demos that
compile with modern compilers and the newest BCX translators. 

Guess I'll need to get some more pennies ready ...

We are human.

We are humans, we build tools.

Robert

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Lots of Errors and warnings
« Reply #22 on: June 02, 2020, 02:20:32 PM »
Does this mean ALL the examples (console, gui etc) now work OK? If so, thanks for the effort in doing this. Where can I download the files? Thanks.

David.




P.S S70.exe, S76.exe, S79.exe, S92.exe, S128.exe, S131.exe, S152.exe S154.exe S76.c and S154.c were missing from the directory where I ran the batch file.
I tried a few of the GUI programs but a few failed maybe due to something to do with resource files. I have very little experience with Windows C. This is why I'm using BCX, so I can learn a bit. Also, if there is anything I can do to help in testing these demo files please ask.

Con_demos at

https://bcxbasiccoders.com/smf/index.php?topic=179.msg762#msg762

MrBcx

  • Administrator
  • Sr. Member
  • *****
  • Posts: 434
    • View Profile
Re: Lots of Errors and warnings
« Reply #23 on: June 02, 2020, 04:21:18 PM »
I won't swear to it but I suspect these updated demos were improved by Andreas, Robert, and Garvan 15 years ago.

https://bcxbasiccoders.com/archives/YahooGroups/EX_IDE_NEW/BCX_GUI_DEMO_UPDATES/

Much has changed with BCX, the various C compilers and their libraries, Windows and its API, so I
would not expect too much out of this, if I were you.

I promise, at some point in the not too distant future, I'll upload these GUI and DLL projects
with the latest (minor) revisions made to them.  I need to reacquaint myself to where I left off.

Peace ... Out

djsb

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Lots of Errors and warnings
« Reply #24 on: June 03, 2020, 01:07:17 AM »
Thank you everyone.