.enum
TGI_ERR_OK ; No error
TGI_ERR_NO_DRIVER ; No driver available
- TGI_ERR_LOAD_ERROR ; Error loading driver
+ TGI_ERR_CANNOT_LOAD ; Error loading driver or font
TGI_ERR_INV_DRIVER ; Invalid driver
TGI_ERR_INV_MODE ; Mode not supported by driver
TGI_ERR_INV_ARG ; Invalid function argument
TGI_ERR_INV_FUNC ; Function not supported
TGI_ERR_INV_FONT ; Font file is invalid
-
- ; Atari specific error codes
-
- TGI_ERR_NO_IOCB ; No free IOCB to open the screen device
TGI_ERR_NO_MEM ; Not enough memory
TGI_ERR_UNKNOWN ; Unknown error
#define TGI_ERR_INV_ARG 5 /* Invalid function argument */
#define TGI_ERR_INV_FUNC 6 /* Function not supported */
#define TGI_ERR_INV_FONT 7 /* Font file is invalid */
+#define TGI_ERR_NO_MEM 8 /* Out of memory */
-;
+;
; Ullrich von Bassewitz, 2004-06-15
;
; const char* __fastcall__ tgi_geterrormsg (unsigned char code);
.byte <(msg6-msgtab)
.byte <(msg7-msgtab)
.byte <(msg8-msgtab)
+ .byte <(msg9-msgtab)
msgtab:
msg0: .asciiz "No error"
msg5: .asciiz "Invalid function argument"
msg6: .asciiz "Function not supported"
msg7: .asciiz "Invalid font file"
-msg8: .asciiz "Unknown error"
+msg8: .asciiz "Out of memory"
+msg9: .asciiz "Unknown error"
unsigned char I;
+ /* Assume we have an error loading the font */
+ tgi_error = TGI_ERR_CANNOT_LOAD;
+
/* Open the file */
F = open (name, O_RDONLY);
if (F < 0) {
Font = malloc (H.size);
if (Font == 0) {
/* Out of memory */
+ tgi_error = TGI_ERR_NO_MEM;
goto LoadError;
}
Font->chars[I] += V;
}
+ /* Clear the error */
+ tgi_error = TGI_ERR_OK;
+
/* Return the vector font loaded */
return Font;
if (F >= 0) {
close (F);
}
- tgi_error = TGI_ERR_CANNOT_LOAD;
return 0;
}