BBC BASIC for Windows
« Increase the ERR internal value from 8 bits to 32 »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:52pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Increase the ERR internal value from 8 bits to 32  (Read 823 times)
Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Increase the ERR internal value from 8 bits to 32
« Thread started on: Nov 18th, 2010, 05:56am »

?418
Current value of ERR

If this could be increased to a 32 bit number it would enable the setting of an error code compatible with windows error codes.

For instance, being able to pass windows or DirectX error codes to the error handler.

eg
Code:
      SYS D3DXCreateSprite%, pDevice%, ^ISprite% TO R%
      IF R% THEN ERROR 100,"Can't Create Sprite Object"
 


would become

Code:
      SYS D3DXCreateSprite%, pDevice%, ^ISprite% TO R%
      IF R% THEN ERROR R%,"Can't Create Sprite Object"
 


and the error code could query the ERR value for the error generate.

Michael
« Last Edit: Nov 18th, 2010, 05:57am by Michael Hutton » User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: Increase the ERR internal value from 8 bits to
« Reply #1 on: Nov 18th, 2010, 06:10am »

..but then I suppose a simple

Code:
IF R% PROC_ERROR(R%,"Error stirng")
 


Is just as good.

Ignore this one.

Michael
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Increase the ERR internal value from 8 bits to
« Reply #2 on: Nov 18th, 2010, 08:25am »

on Nov 18th, 2010, 05:56am, Michael Hutton wrote:
If ERR could be increased to a 32 bit number it would enable the setting of an error code compatible with windows error codes.

Look here and you'll see why this isn't possible:

http://bb4w.wikispaces.com/Interpreter+internal+variables

The addresses of the interpreter's 'internal variables' must remain fixed 'for ever' because many programs access them directly. ERR is ?418 and is immediately followed by the float/lowercase/opt setting at ?419 so there's no room to increase its size.

You could simply store the Windows error code in a global variable and access that in your ON ERROR handler:
Code:

      ON ERROR PROCerror(WinErr%, ERR, REPORT$) QUIT
...
      SYS D3DXCreateSprite%, pDevice%, ^ISprite% TO WinErr%
      IF WinErr% THEN ERROR 100,"Can't Create Sprite Object" 

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls