Yet more fun with errors
This was SVN commit r771.
This commit is contained in:
parent
bd884f9de6
commit
56e41b3003
@ -3,7 +3,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my (%groups, %types);
|
||||
my (%topgroups, %groups, %types);
|
||||
|
||||
my @files = cpp_files('.');
|
||||
for (@files) {
|
||||
@ -11,6 +11,8 @@ for (@files) {
|
||||
while (<$f>) {
|
||||
if (/^ERROR_/) {
|
||||
if (/^ERROR_GROUP\((.+?)\)/) {
|
||||
$topgroups{$1} = 1;
|
||||
} elsif (/^ERROR_SUBGROUP\((.+?)\)/) {
|
||||
$groups{join '~', split /,\s*/, $1} = 1;
|
||||
} elsif (/^ERROR_TYPE\((.+?)\)/) {
|
||||
$types{join '~', split /,\s*/, $1} = 1;
|
||||
@ -22,39 +24,129 @@ for (@files) {
|
||||
open my $out, '>', 'ps/Errors.cpp' or die "Error opening ps/Errors.cpp ($!)";
|
||||
|
||||
print $out <<'.';
|
||||
// Auto-generated by errorlist.pl - do not edit
|
||||
// Auto-generated by errorlist.pl - do not edit.
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "Errors.h"
|
||||
|
||||
// Slightly hacky section to redeclare things that are declared
|
||||
// elsewhere - trust the compiler to handle them identically
|
||||
.
|
||||
|
||||
for (sort keys %topgroups) {
|
||||
print $out "class PSERROR_$_ : public PSERROR {};\n";
|
||||
}
|
||||
|
||||
print $out "\n";
|
||||
|
||||
for (sort { $a->[1] cmp $b->[1] } map [$_, do{(my $c=$_)=~s/~/_/;$c} ], keys %groups) {
|
||||
my ($base, $name) = split /~/, $_->[0];
|
||||
print $out "class ${base}_$name : public $base {};\n";
|
||||
print $out "class PSERROR_${base}_$name : public PSERROR_$base {};\n";
|
||||
}
|
||||
|
||||
print $out "\n";
|
||||
|
||||
for (sort { $a->[1] cmp $b->[1] } map [$_, do{(my $c=$_)=~s/~/_/;$c} ], keys %types) {
|
||||
my ($base, $name) = split /~/, $_->[0];
|
||||
print $out "class ${base}_$name : public $base { public: ${base}_$name(); };\n";
|
||||
print $out "class PSERROR_${base}_$name : public PSERROR_$base { public: PSERROR_${base}_$name(); };\n";
|
||||
}
|
||||
|
||||
print $out "\n// The relevant bits of this file:\n";
|
||||
print $out "\n";
|
||||
|
||||
@types{sort keys %types} = 0 .. keys(%types)-1;
|
||||
# The difficult bit:
|
||||
|
||||
=pod
|
||||
|
||||
mask
|
||||
**** PSERROR
|
||||
0001 PSERROR_ Err1
|
||||
1*** PSERROR_Sec1
|
||||
1001 PSERROR_Sec1_ Err1
|
||||
1002 PSERROR_Sec1_ Err2
|
||||
1003 PSERROR_Sec1_ Err3
|
||||
11** PSERROR_Sec1_Sec1
|
||||
1101 PSERROR_Sec1_Sec1_Err1
|
||||
1102 PSERROR_Sec1_Sec1_Err2
|
||||
2*** PSERROR_Sec2
|
||||
2001 PSERROR_Sec2_ Err1
|
||||
|
||||
...so split into three sections (0 if null) plus final code...
|
||||
|
||||
=cut
|
||||
|
||||
my @sec_codes;
|
||||
$sec_codes[$_]{''} = 1 for 0..2;
|
||||
|
||||
for (keys %types) {
|
||||
my (@secs) = split /[~_]/;
|
||||
my $err = pop @secs;
|
||||
$sec_codes[$_]{$secs[$_] || ''} = 1 for 0..2;
|
||||
}
|
||||
|
||||
for my $n (0..2) {
|
||||
@{$sec_codes[$n]}{sort keys %{$sec_codes[$n]}} = 0 .. keys(%{$sec_codes[$n]})-1;
|
||||
}
|
||||
|
||||
my ($last_sec, $last_err) = ('', 0);
|
||||
for (sort keys %types) {
|
||||
my (@secs) = split /[~_]/;
|
||||
my $err = pop @secs;
|
||||
my $id = join '', map chr $sec_codes[$_]{$secs[$_] || ''}, 0..2;
|
||||
if ($id eq $last_sec) {
|
||||
$id .= chr(++$last_err);
|
||||
} else {
|
||||
$last_sec = $id;
|
||||
$id .= chr($last_err=1);
|
||||
}
|
||||
$types{$_} = $id;
|
||||
}
|
||||
|
||||
for (sort keys %types) {
|
||||
my ($base, $name) = split /~/;
|
||||
print $out "${base}_${name}::${base}_${name}() { magic=0x45725221; code=$types{$_}; }\n";
|
||||
print $out "extern const PSRETURN PSRETURN_${base}_${name} = 0x".unpack('H*', $types{$_}).";\n";
|
||||
}
|
||||
|
||||
print $out "\n";
|
||||
|
||||
for (sort keys %topgroups) {
|
||||
my (@secs) = $_;
|
||||
my $id = join '', map chr $sec_codes[$_]{$secs[$_] || ''}, 0..2;
|
||||
my $code = unpack 'H*', $id;
|
||||
(my $mask = $code) =~ s/(\d\d)/$1+0 ? 'ff' : '00'/ge;
|
||||
print $out "extern const PSRETURN MASK__PSRETURN_".join('_', @secs)." = 0x${mask}00;\n";
|
||||
print $out "extern const PSRETURN CODE__PSRETURN_".join('_', @secs)." = 0x${code}00;\n";
|
||||
}
|
||||
|
||||
for (sort keys %groups) {
|
||||
my (@secs) = split /[_~]/;
|
||||
my $id = join '', map chr $sec_codes[$_]{$secs[$_] || ''}, 0..2;
|
||||
my $code = unpack 'H*', $id;
|
||||
(my $mask = $code) =~ s/(\d\d)/$1+0 ? 'ff' : '00'/ge;
|
||||
print $out "extern const PSRETURN MASK__PSRETURN_".join('_', @secs)." = 0x${mask}00;\n";
|
||||
print $out "extern const PSRETURN CODE__PSRETURN_".join('_', @secs)." = 0x${code}00;\n";
|
||||
}
|
||||
|
||||
print $out "\n";
|
||||
|
||||
for (sort keys %types) {
|
||||
my $code = unpack 'H*', $types{$_};
|
||||
s/~/_/;
|
||||
print $out "extern const PSRETURN MASK__PSRETURN_$_ = 0xffffffff;\n";
|
||||
print $out "extern const PSRETURN CODE__PSRETURN_$_ = 0x$code;\n";
|
||||
}
|
||||
|
||||
# End of difficult bit.
|
||||
|
||||
print $out "\n";
|
||||
|
||||
|
||||
for (sort keys %types) {
|
||||
my ($base, $name) = split /~/;
|
||||
print $out qq~PSERROR_${base}_${name}::PSERROR_${base}_${name}() { magic=0x45725221; code=0x~.unpack('H*',$types{$_}).qq~; }\n~;
|
||||
}
|
||||
|
||||
print $out <<".";
|
||||
|
||||
const wchar_t* GetErrorString(int code)
|
||||
const wchar_t* GetErrorString(PSRETURN code)
|
||||
{
|
||||
\tswitch (code)
|
||||
\t{
|
||||
@ -62,8 +154,8 @@ const wchar_t* GetErrorString(int code)
|
||||
|
||||
for (sort keys %types) {
|
||||
(my $name = $_) =~ s/~/_/;
|
||||
$name =~ s/.*?_//;
|
||||
print $out qq{\tcase $types{$_}: return L"$name"; break;\n};
|
||||
# $name =~ s/.*?_//;
|
||||
print $out qq{\tcase 0x}.unpack('H*',$types{$_}).qq{: return L"$name"; break;\n};
|
||||
}
|
||||
|
||||
print $out <<".";
|
||||
|
@ -17,9 +17,9 @@ gee@pyro.nu
|
||||
#ifndef CGUI_H
|
||||
#define CGUI_H
|
||||
|
||||
ERROR_GROUP(PSERROR, GUI);
|
||||
ERROR_TYPE(PSERROR_GUI, JSOpenFailed);
|
||||
ERROR_TYPE(PSERROR_GUI, TextureLoadFailed);
|
||||
ERROR_GROUP(GUI);
|
||||
ERROR_TYPE(GUI, JSOpenFailed);
|
||||
ERROR_TYPE(GUI, TextureLoadFailed);
|
||||
|
||||
//--------------------------------------------------------
|
||||
// Includes / Compiler directives
|
||||
|
@ -1,15 +1,21 @@
|
||||
// Auto-generated by errorlist.pl - do not edit
|
||||
// Auto-generated by errorlist.pl - do not edit.
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "Errors.h"
|
||||
|
||||
// Slightly hacky section to redeclare things that are declared
|
||||
// elsewhere - trust the compiler to handle them identically
|
||||
class PSERROR_GUI : public PSERROR {};
|
||||
class PSERROR_Scripting : public PSERROR {};
|
||||
class PSERROR_Test1 : public PSERROR {};
|
||||
class PSERROR_Test2 : public PSERROR {};
|
||||
class PSERROR_Xeromyces : public PSERROR {};
|
||||
|
||||
class PSERROR_Scripting_DefineType : public PSERROR_Scripting {};
|
||||
class PSERROR_Scripting_LoadFile : public PSERROR_Scripting {};
|
||||
class PSERROR_Xeromyces : public PSERROR {};
|
||||
class PSERROR_Test1_Grp1 : public PSERROR_Test1 {};
|
||||
class PSERROR_Test1_Grp2 : public PSERROR_Test1 {};
|
||||
class PSERROR_Test2_Grp1 : public PSERROR_Test2 {};
|
||||
class PSERROR_Test2_Grp2 : public PSERROR_Test2 {};
|
||||
|
||||
class PSERROR_GUI_JSOpenFailed : public PSERROR_GUI { public: PSERROR_GUI_JSOpenFailed(); };
|
||||
class PSERROR_GUI_TextureLoadFailed : public PSERROR_GUI { public: PSERROR_GUI_TextureLoadFailed(); };
|
||||
@ -28,53 +34,206 @@ class PSERROR_Scripting_RegisterFunctionFailed : public PSERROR_Scripting { publ
|
||||
class PSERROR_Scripting_RuntimeCreationFailed : public PSERROR_Scripting { public: PSERROR_Scripting_RuntimeCreationFailed(); };
|
||||
class PSERROR_Scripting_StandardClassSetupFailed : public PSERROR_Scripting { public: PSERROR_Scripting_StandardClassSetupFailed(); };
|
||||
class PSERROR_Scripting_TypeDoesNotExist : public PSERROR_Scripting { public: PSERROR_Scripting_TypeDoesNotExist(); };
|
||||
class PSERROR_Test1_Err1 : public PSERROR_Test1 { public: PSERROR_Test1_Err1(); };
|
||||
class PSERROR_Test1_Err2 : public PSERROR_Test1 { public: PSERROR_Test1_Err2(); };
|
||||
class PSERROR_Test1_Grp1_Err1 : public PSERROR_Test1_Grp1 { public: PSERROR_Test1_Grp1_Err1(); };
|
||||
class PSERROR_Test1_Grp1_Err2 : public PSERROR_Test1_Grp1 { public: PSERROR_Test1_Grp1_Err2(); };
|
||||
class PSERROR_Test1_Grp2_Err1 : public PSERROR_Test1_Grp2 { public: PSERROR_Test1_Grp2_Err1(); };
|
||||
class PSERROR_Test1_Grp2_Err2 : public PSERROR_Test1_Grp2 { public: PSERROR_Test1_Grp2_Err2(); };
|
||||
class PSERROR_Test2_Err1 : public PSERROR_Test2 { public: PSERROR_Test2_Err1(); };
|
||||
class PSERROR_Test2_Err2 : public PSERROR_Test2 { public: PSERROR_Test2_Err2(); };
|
||||
class PSERROR_Test2_Grp1_Err1 : public PSERROR_Test2_Grp1 { public: PSERROR_Test2_Grp1_Err1(); };
|
||||
class PSERROR_Test2_Grp1_Err2 : public PSERROR_Test2_Grp1 { public: PSERROR_Test2_Grp1_Err2(); };
|
||||
class PSERROR_Test2_Grp2_Err1 : public PSERROR_Test2_Grp2 { public: PSERROR_Test2_Grp2_Err1(); };
|
||||
class PSERROR_Test2_Grp2_Err2 : public PSERROR_Test2_Grp2 { public: PSERROR_Test2_Grp2_Err2(); };
|
||||
class PSERROR_Xeromyces_XMLOpenFailed : public PSERROR_Xeromyces { public: PSERROR_Xeromyces_XMLOpenFailed(); };
|
||||
class PSERROR_Xeromyces_XMLParseError : public PSERROR_Xeromyces { public: PSERROR_Xeromyces_XMLParseError(); };
|
||||
|
||||
// The relevant bits of this file:
|
||||
PSERROR_GUI_JSOpenFailed::PSERROR_GUI_JSOpenFailed() { magic=0x45725221; code=0; }
|
||||
PSERROR_GUI_TextureLoadFailed::PSERROR_GUI_TextureLoadFailed() { magic=0x45725221; code=1; }
|
||||
PSERROR_Scripting_DefineType_AlreadyExists::PSERROR_Scripting_DefineType_AlreadyExists() { magic=0x45725221; code=2; }
|
||||
PSERROR_Scripting_DefineType_CreationFailed::PSERROR_Scripting_DefineType_CreationFailed() { magic=0x45725221; code=3; }
|
||||
PSERROR_Scripting_LoadFile_EvalErrors::PSERROR_Scripting_LoadFile_EvalErrors() { magic=0x45725221; code=4; }
|
||||
PSERROR_Scripting_LoadFile_OpenFailed::PSERROR_Scripting_LoadFile_OpenFailed() { magic=0x45725221; code=5; }
|
||||
PSERROR_Scripting_CallFunctionFailed::PSERROR_Scripting_CallFunctionFailed() { magic=0x45725221; code=6; }
|
||||
PSERROR_Scripting_ContextCreationFailed::PSERROR_Scripting_ContextCreationFailed() { magic=0x45725221; code=7; }
|
||||
PSERROR_Scripting_ConversionFailed::PSERROR_Scripting_ConversionFailed() { magic=0x45725221; code=8; }
|
||||
PSERROR_Scripting_CreateObjectFailed::PSERROR_Scripting_CreateObjectFailed() { magic=0x45725221; code=9; }
|
||||
PSERROR_Scripting_DefineConstantFailed::PSERROR_Scripting_DefineConstantFailed() { magic=0x45725221; code=10; }
|
||||
PSERROR_Scripting_GlobalObjectCreationFailed::PSERROR_Scripting_GlobalObjectCreationFailed() { magic=0x45725221; code=11; }
|
||||
PSERROR_Scripting_NativeFunctionSetupFailed::PSERROR_Scripting_NativeFunctionSetupFailed() { magic=0x45725221; code=12; }
|
||||
PSERROR_Scripting_RegisterFunctionFailed::PSERROR_Scripting_RegisterFunctionFailed() { magic=0x45725221; code=13; }
|
||||
PSERROR_Scripting_RuntimeCreationFailed::PSERROR_Scripting_RuntimeCreationFailed() { magic=0x45725221; code=14; }
|
||||
PSERROR_Scripting_StandardClassSetupFailed::PSERROR_Scripting_StandardClassSetupFailed() { magic=0x45725221; code=15; }
|
||||
PSERROR_Scripting_TypeDoesNotExist::PSERROR_Scripting_TypeDoesNotExist() { magic=0x45725221; code=16; }
|
||||
PSERROR_Xeromyces_XMLOpenFailed::PSERROR_Xeromyces_XMLOpenFailed() { magic=0x45725221; code=17; }
|
||||
PSERROR_Xeromyces_XMLParseError::PSERROR_Xeromyces_XMLParseError() { magic=0x45725221; code=18; }
|
||||
extern const PSRETURN PSRETURN_GUI_JSOpenFailed = 0x01000001;
|
||||
extern const PSRETURN PSRETURN_GUI_TextureLoadFailed = 0x01000002;
|
||||
extern const PSRETURN PSRETURN_Scripting_DefineType_AlreadyExists = 0x02010001;
|
||||
extern const PSRETURN PSRETURN_Scripting_DefineType_CreationFailed = 0x02010002;
|
||||
extern const PSRETURN PSRETURN_Scripting_LoadFile_EvalErrors = 0x02040001;
|
||||
extern const PSRETURN PSRETURN_Scripting_LoadFile_OpenFailed = 0x02040002;
|
||||
extern const PSRETURN PSRETURN_Scripting_CallFunctionFailed = 0x02000001;
|
||||
extern const PSRETURN PSRETURN_Scripting_ContextCreationFailed = 0x02000002;
|
||||
extern const PSRETURN PSRETURN_Scripting_ConversionFailed = 0x02000003;
|
||||
extern const PSRETURN PSRETURN_Scripting_CreateObjectFailed = 0x02000004;
|
||||
extern const PSRETURN PSRETURN_Scripting_DefineConstantFailed = 0x02000005;
|
||||
extern const PSRETURN PSRETURN_Scripting_GlobalObjectCreationFailed = 0x02000006;
|
||||
extern const PSRETURN PSRETURN_Scripting_NativeFunctionSetupFailed = 0x02000007;
|
||||
extern const PSRETURN PSRETURN_Scripting_RegisterFunctionFailed = 0x02000008;
|
||||
extern const PSRETURN PSRETURN_Scripting_RuntimeCreationFailed = 0x02000009;
|
||||
extern const PSRETURN PSRETURN_Scripting_StandardClassSetupFailed = 0x0200000a;
|
||||
extern const PSRETURN PSRETURN_Scripting_TypeDoesNotExist = 0x0200000b;
|
||||
extern const PSRETURN PSRETURN_Test1_Grp1_Err1 = 0x03020001;
|
||||
extern const PSRETURN PSRETURN_Test1_Grp1_Err2 = 0x03020002;
|
||||
extern const PSRETURN PSRETURN_Test1_Grp2_Err1 = 0x03030001;
|
||||
extern const PSRETURN PSRETURN_Test1_Grp2_Err2 = 0x03030002;
|
||||
extern const PSRETURN PSRETURN_Test1_Err1 = 0x03000001;
|
||||
extern const PSRETURN PSRETURN_Test1_Err2 = 0x03000002;
|
||||
extern const PSRETURN PSRETURN_Test2_Grp1_Err1 = 0x04020001;
|
||||
extern const PSRETURN PSRETURN_Test2_Grp1_Err2 = 0x04020002;
|
||||
extern const PSRETURN PSRETURN_Test2_Grp2_Err1 = 0x04030001;
|
||||
extern const PSRETURN PSRETURN_Test2_Grp2_Err2 = 0x04030002;
|
||||
extern const PSRETURN PSRETURN_Test2_Err1 = 0x04000001;
|
||||
extern const PSRETURN PSRETURN_Test2_Err2 = 0x04000002;
|
||||
extern const PSRETURN PSRETURN_Xeromyces_XMLOpenFailed = 0x05000001;
|
||||
extern const PSRETURN PSRETURN_Xeromyces_XMLParseError = 0x05000002;
|
||||
|
||||
const wchar_t* GetErrorString(int code)
|
||||
extern const PSRETURN MASK__PSRETURN_GUI = 0xff000000;
|
||||
extern const PSRETURN CODE__PSRETURN_GUI = 0x01000000;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting = 0xff000000;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting = 0x02000000;
|
||||
extern const PSRETURN MASK__PSRETURN_Test1 = 0xff000000;
|
||||
extern const PSRETURN CODE__PSRETURN_Test1 = 0x03000000;
|
||||
extern const PSRETURN MASK__PSRETURN_Test2 = 0xff000000;
|
||||
extern const PSRETURN CODE__PSRETURN_Test2 = 0x04000000;
|
||||
extern const PSRETURN MASK__PSRETURN_Xeromyces = 0xff000000;
|
||||
extern const PSRETURN CODE__PSRETURN_Xeromyces = 0x05000000;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_DefineType = 0xffff0000;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_DefineType = 0x02010000;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_LoadFile = 0xffff0000;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_LoadFile = 0x02040000;
|
||||
extern const PSRETURN MASK__PSRETURN_Test1_Grp1 = 0xffff0000;
|
||||
extern const PSRETURN CODE__PSRETURN_Test1_Grp1 = 0x03020000;
|
||||
extern const PSRETURN MASK__PSRETURN_Test1_Grp2 = 0xffff0000;
|
||||
extern const PSRETURN CODE__PSRETURN_Test1_Grp2 = 0x03030000;
|
||||
extern const PSRETURN MASK__PSRETURN_Test2_Grp1 = 0xffff0000;
|
||||
extern const PSRETURN CODE__PSRETURN_Test2_Grp1 = 0x04020000;
|
||||
extern const PSRETURN MASK__PSRETURN_Test2_Grp2 = 0xffff0000;
|
||||
extern const PSRETURN CODE__PSRETURN_Test2_Grp2 = 0x04030000;
|
||||
|
||||
extern const PSRETURN MASK__PSRETURN_GUI_JSOpenFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_GUI_JSOpenFailed = 0x01000001;
|
||||
extern const PSRETURN MASK__PSRETURN_GUI_TextureLoadFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_GUI_TextureLoadFailed = 0x01000002;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_DefineType_AlreadyExists = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_DefineType_AlreadyExists = 0x02010001;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_DefineType_CreationFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_DefineType_CreationFailed = 0x02010002;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_LoadFile_EvalErrors = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_LoadFile_EvalErrors = 0x02040001;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_LoadFile_OpenFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_LoadFile_OpenFailed = 0x02040002;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_CallFunctionFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_CallFunctionFailed = 0x02000001;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_ContextCreationFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_ContextCreationFailed = 0x02000002;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_ConversionFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_ConversionFailed = 0x02000003;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_CreateObjectFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_CreateObjectFailed = 0x02000004;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_DefineConstantFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_DefineConstantFailed = 0x02000005;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_GlobalObjectCreationFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_GlobalObjectCreationFailed = 0x02000006;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_NativeFunctionSetupFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_NativeFunctionSetupFailed = 0x02000007;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_RegisterFunctionFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_RegisterFunctionFailed = 0x02000008;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_RuntimeCreationFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_RuntimeCreationFailed = 0x02000009;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_StandardClassSetupFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_StandardClassSetupFailed = 0x0200000a;
|
||||
extern const PSRETURN MASK__PSRETURN_Scripting_TypeDoesNotExist = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Scripting_TypeDoesNotExist = 0x0200000b;
|
||||
extern const PSRETURN MASK__PSRETURN_Test1_Grp1_Err1 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test1_Grp1_Err1 = 0x03020001;
|
||||
extern const PSRETURN MASK__PSRETURN_Test1_Grp1_Err2 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test1_Grp1_Err2 = 0x03020002;
|
||||
extern const PSRETURN MASK__PSRETURN_Test1_Grp2_Err1 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test1_Grp2_Err1 = 0x03030001;
|
||||
extern const PSRETURN MASK__PSRETURN_Test1_Grp2_Err2 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test1_Grp2_Err2 = 0x03030002;
|
||||
extern const PSRETURN MASK__PSRETURN_Test1_Err1 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test1_Err1 = 0x03000001;
|
||||
extern const PSRETURN MASK__PSRETURN_Test1_Err2 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test1_Err2 = 0x03000002;
|
||||
extern const PSRETURN MASK__PSRETURN_Test2_Grp1_Err1 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test2_Grp1_Err1 = 0x04020001;
|
||||
extern const PSRETURN MASK__PSRETURN_Test2_Grp1_Err2 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test2_Grp1_Err2 = 0x04020002;
|
||||
extern const PSRETURN MASK__PSRETURN_Test2_Grp2_Err1 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test2_Grp2_Err1 = 0x04030001;
|
||||
extern const PSRETURN MASK__PSRETURN_Test2_Grp2_Err2 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test2_Grp2_Err2 = 0x04030002;
|
||||
extern const PSRETURN MASK__PSRETURN_Test2_Err1 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test2_Err1 = 0x04000001;
|
||||
extern const PSRETURN MASK__PSRETURN_Test2_Err2 = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Test2_Err2 = 0x04000002;
|
||||
extern const PSRETURN MASK__PSRETURN_Xeromyces_XMLOpenFailed = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Xeromyces_XMLOpenFailed = 0x05000001;
|
||||
extern const PSRETURN MASK__PSRETURN_Xeromyces_XMLParseError = 0xffffffff;
|
||||
extern const PSRETURN CODE__PSRETURN_Xeromyces_XMLParseError = 0x05000002;
|
||||
|
||||
PSERROR_GUI_JSOpenFailed::PSERROR_GUI_JSOpenFailed() { magic=0x45725221; code=0x01000001; }
|
||||
PSERROR_GUI_TextureLoadFailed::PSERROR_GUI_TextureLoadFailed() { magic=0x45725221; code=0x01000002; }
|
||||
PSERROR_Scripting_DefineType_AlreadyExists::PSERROR_Scripting_DefineType_AlreadyExists() { magic=0x45725221; code=0x02010001; }
|
||||
PSERROR_Scripting_DefineType_CreationFailed::PSERROR_Scripting_DefineType_CreationFailed() { magic=0x45725221; code=0x02010002; }
|
||||
PSERROR_Scripting_LoadFile_EvalErrors::PSERROR_Scripting_LoadFile_EvalErrors() { magic=0x45725221; code=0x02040001; }
|
||||
PSERROR_Scripting_LoadFile_OpenFailed::PSERROR_Scripting_LoadFile_OpenFailed() { magic=0x45725221; code=0x02040002; }
|
||||
PSERROR_Scripting_CallFunctionFailed::PSERROR_Scripting_CallFunctionFailed() { magic=0x45725221; code=0x02000001; }
|
||||
PSERROR_Scripting_ContextCreationFailed::PSERROR_Scripting_ContextCreationFailed() { magic=0x45725221; code=0x02000002; }
|
||||
PSERROR_Scripting_ConversionFailed::PSERROR_Scripting_ConversionFailed() { magic=0x45725221; code=0x02000003; }
|
||||
PSERROR_Scripting_CreateObjectFailed::PSERROR_Scripting_CreateObjectFailed() { magic=0x45725221; code=0x02000004; }
|
||||
PSERROR_Scripting_DefineConstantFailed::PSERROR_Scripting_DefineConstantFailed() { magic=0x45725221; code=0x02000005; }
|
||||
PSERROR_Scripting_GlobalObjectCreationFailed::PSERROR_Scripting_GlobalObjectCreationFailed() { magic=0x45725221; code=0x02000006; }
|
||||
PSERROR_Scripting_NativeFunctionSetupFailed::PSERROR_Scripting_NativeFunctionSetupFailed() { magic=0x45725221; code=0x02000007; }
|
||||
PSERROR_Scripting_RegisterFunctionFailed::PSERROR_Scripting_RegisterFunctionFailed() { magic=0x45725221; code=0x02000008; }
|
||||
PSERROR_Scripting_RuntimeCreationFailed::PSERROR_Scripting_RuntimeCreationFailed() { magic=0x45725221; code=0x02000009; }
|
||||
PSERROR_Scripting_StandardClassSetupFailed::PSERROR_Scripting_StandardClassSetupFailed() { magic=0x45725221; code=0x0200000a; }
|
||||
PSERROR_Scripting_TypeDoesNotExist::PSERROR_Scripting_TypeDoesNotExist() { magic=0x45725221; code=0x0200000b; }
|
||||
PSERROR_Test1_Grp1_Err1::PSERROR_Test1_Grp1_Err1() { magic=0x45725221; code=0x03020001; }
|
||||
PSERROR_Test1_Grp1_Err2::PSERROR_Test1_Grp1_Err2() { magic=0x45725221; code=0x03020002; }
|
||||
PSERROR_Test1_Grp2_Err1::PSERROR_Test1_Grp2_Err1() { magic=0x45725221; code=0x03030001; }
|
||||
PSERROR_Test1_Grp2_Err2::PSERROR_Test1_Grp2_Err2() { magic=0x45725221; code=0x03030002; }
|
||||
PSERROR_Test1_Err1::PSERROR_Test1_Err1() { magic=0x45725221; code=0x03000001; }
|
||||
PSERROR_Test1_Err2::PSERROR_Test1_Err2() { magic=0x45725221; code=0x03000002; }
|
||||
PSERROR_Test2_Grp1_Err1::PSERROR_Test2_Grp1_Err1() { magic=0x45725221; code=0x04020001; }
|
||||
PSERROR_Test2_Grp1_Err2::PSERROR_Test2_Grp1_Err2() { magic=0x45725221; code=0x04020002; }
|
||||
PSERROR_Test2_Grp2_Err1::PSERROR_Test2_Grp2_Err1() { magic=0x45725221; code=0x04030001; }
|
||||
PSERROR_Test2_Grp2_Err2::PSERROR_Test2_Grp2_Err2() { magic=0x45725221; code=0x04030002; }
|
||||
PSERROR_Test2_Err1::PSERROR_Test2_Err1() { magic=0x45725221; code=0x04000001; }
|
||||
PSERROR_Test2_Err2::PSERROR_Test2_Err2() { magic=0x45725221; code=0x04000002; }
|
||||
PSERROR_Xeromyces_XMLOpenFailed::PSERROR_Xeromyces_XMLOpenFailed() { magic=0x45725221; code=0x05000001; }
|
||||
PSERROR_Xeromyces_XMLParseError::PSERROR_Xeromyces_XMLParseError() { magic=0x45725221; code=0x05000002; }
|
||||
|
||||
const wchar_t* GetErrorString(PSRETURN code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case 0: return L"GUI_JSOpenFailed"; break;
|
||||
case 1: return L"GUI_TextureLoadFailed"; break;
|
||||
case 2: return L"Scripting_DefineType_AlreadyExists"; break;
|
||||
case 3: return L"Scripting_DefineType_CreationFailed"; break;
|
||||
case 4: return L"Scripting_LoadFile_EvalErrors"; break;
|
||||
case 5: return L"Scripting_LoadFile_OpenFailed"; break;
|
||||
case 6: return L"Scripting_CallFunctionFailed"; break;
|
||||
case 7: return L"Scripting_ContextCreationFailed"; break;
|
||||
case 8: return L"Scripting_ConversionFailed"; break;
|
||||
case 9: return L"Scripting_CreateObjectFailed"; break;
|
||||
case 10: return L"Scripting_DefineConstantFailed"; break;
|
||||
case 11: return L"Scripting_GlobalObjectCreationFailed"; break;
|
||||
case 12: return L"Scripting_NativeFunctionSetupFailed"; break;
|
||||
case 13: return L"Scripting_RegisterFunctionFailed"; break;
|
||||
case 14: return L"Scripting_RuntimeCreationFailed"; break;
|
||||
case 15: return L"Scripting_StandardClassSetupFailed"; break;
|
||||
case 16: return L"Scripting_TypeDoesNotExist"; break;
|
||||
case 17: return L"Xeromyces_XMLOpenFailed"; break;
|
||||
case 18: return L"Xeromyces_XMLParseError"; break;
|
||||
case 0x01000001: return L"GUI_JSOpenFailed"; break;
|
||||
case 0x01000002: return L"GUI_TextureLoadFailed"; break;
|
||||
case 0x02010001: return L"Scripting_DefineType_AlreadyExists"; break;
|
||||
case 0x02010002: return L"Scripting_DefineType_CreationFailed"; break;
|
||||
case 0x02040001: return L"Scripting_LoadFile_EvalErrors"; break;
|
||||
case 0x02040002: return L"Scripting_LoadFile_OpenFailed"; break;
|
||||
case 0x02000001: return L"Scripting_CallFunctionFailed"; break;
|
||||
case 0x02000002: return L"Scripting_ContextCreationFailed"; break;
|
||||
case 0x02000003: return L"Scripting_ConversionFailed"; break;
|
||||
case 0x02000004: return L"Scripting_CreateObjectFailed"; break;
|
||||
case 0x02000005: return L"Scripting_DefineConstantFailed"; break;
|
||||
case 0x02000006: return L"Scripting_GlobalObjectCreationFailed"; break;
|
||||
case 0x02000007: return L"Scripting_NativeFunctionSetupFailed"; break;
|
||||
case 0x02000008: return L"Scripting_RegisterFunctionFailed"; break;
|
||||
case 0x02000009: return L"Scripting_RuntimeCreationFailed"; break;
|
||||
case 0x0200000a: return L"Scripting_StandardClassSetupFailed"; break;
|
||||
case 0x0200000b: return L"Scripting_TypeDoesNotExist"; break;
|
||||
case 0x03020001: return L"Test1_Grp1_Err1"; break;
|
||||
case 0x03020002: return L"Test1_Grp1_Err2"; break;
|
||||
case 0x03030001: return L"Test1_Grp2_Err1"; break;
|
||||
case 0x03030002: return L"Test1_Grp2_Err2"; break;
|
||||
case 0x03000001: return L"Test1_Err1"; break;
|
||||
case 0x03000002: return L"Test1_Err2"; break;
|
||||
case 0x04020001: return L"Test2_Grp1_Err1"; break;
|
||||
case 0x04020002: return L"Test2_Grp1_Err2"; break;
|
||||
case 0x04030001: return L"Test2_Grp2_Err1"; break;
|
||||
case 0x04030002: return L"Test2_Grp2_Err2"; break;
|
||||
case 0x04000001: return L"Test2_Err1"; break;
|
||||
case 0x04000002: return L"Test2_Err2"; break;
|
||||
case 0x05000001: return L"Xeromyces_XMLOpenFailed"; break;
|
||||
case 0x05000002: return L"Xeromyces_XMLParseError"; break;
|
||||
}
|
||||
return L"Unrecognised error";
|
||||
}
|
||||
|
@ -3,17 +3,36 @@
|
||||
|
||||
#include <stdlib.h> // for wchar_t
|
||||
|
||||
typedef unsigned long PSRETURN;
|
||||
|
||||
class PSERROR
|
||||
{
|
||||
public:
|
||||
int magic; // = 0x45725221, so the exception handler can recognise
|
||||
// that it's a PSERROR and not some other random object.
|
||||
int code; // unique (but arbitrary) code, for translation tables etc
|
||||
PSRETURN code; // unique (but arbitrary) code, for translation tables etc
|
||||
};
|
||||
|
||||
#define ERROR_GROUP(a,b) class a##_##b : public a {}
|
||||
#define ERROR_TYPE(a,b) class a##_##b : public a { public: a##_##b(); }
|
||||
#define ERROR_GROUP(a) class PSERROR_##a : public PSERROR {}; \
|
||||
extern const PSRETURN MASK__PSRETURN_##a; \
|
||||
extern const PSRETURN CODE__PSRETURN_##a
|
||||
|
||||
const wchar_t* GetErrorString(int code);
|
||||
#define ERROR_SUBGROUP(a,b) class PSERROR_##a##_##b : public PSERROR_##a {}; \
|
||||
extern const PSRETURN MASK__PSRETURN_##a##_##b; \
|
||||
extern const PSRETURN CODE__PSRETURN_##a##_##b
|
||||
|
||||
|
||||
#define ERROR_TYPE(a,b) class PSERROR_##a##_##b : public PSERROR_##a { public: PSERROR_##a##_##b(); }; \
|
||||
extern const PSRETURN MASK__PSRETURN_##a##_##b; \
|
||||
extern const PSRETURN CODE__PSRETURN_##a##_##b; \
|
||||
extern const PSRETURN PSRETURN_##a##_##b
|
||||
|
||||
#define ERROR_IS(a, b) ( ((a) & MASK__PSRETURN_##b) == CODE__PSRETURN_##b )
|
||||
|
||||
const PSRETURN PSRETURN_OK = 0;
|
||||
const PSRETURN MASK__PSRETURN_OK = 0xffffffff;
|
||||
const PSRETURN CODE__PSRETURN_OK = 0;
|
||||
|
||||
const wchar_t* GetErrorString(PSRETURN code);
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: Xeromyces.h,v 1.4 2004/07/17 17:06:21 philip Exp $
|
||||
/* $Id: Xeromyces.h,v 1.5 2004/07/18 11:50:34 philip Exp $
|
||||
|
||||
Xeromyces file-loading interface.
|
||||
Automatically creates and caches relatively
|
||||
@ -11,9 +11,9 @@
|
||||
#ifndef _XEROMYCES_H_
|
||||
#define _XEROMYCES_H_
|
||||
|
||||
ERROR_GROUP(PSERROR, Xeromyces);
|
||||
ERROR_TYPE(PSERROR_Xeromyces, XMLOpenFailed);
|
||||
ERROR_TYPE(PSERROR_Xeromyces, XMLParseError);
|
||||
ERROR_GROUP(Xeromyces);
|
||||
ERROR_TYPE(Xeromyces, XMLOpenFailed);
|
||||
ERROR_TYPE(Xeromyces, XMLParseError);
|
||||
|
||||
#include "ps/XeroXMB.h"
|
||||
#include "lib/res/h_mgr.h"
|
||||
|
@ -12,27 +12,27 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
ERROR_GROUP(PSERROR, Scripting);
|
||||
ERROR_TYPE(PSERROR_Scripting, RuntimeCreationFailed);
|
||||
ERROR_TYPE(PSERROR_Scripting, ContextCreationFailed);
|
||||
ERROR_TYPE(PSERROR_Scripting, GlobalObjectCreationFailed);
|
||||
ERROR_TYPE(PSERROR_Scripting, StandardClassSetupFailed);
|
||||
ERROR_TYPE(PSERROR_Scripting, NativeFunctionSetupFailed);
|
||||
ERROR_GROUP(Scripting);
|
||||
ERROR_TYPE(Scripting, RuntimeCreationFailed);
|
||||
ERROR_TYPE(Scripting, ContextCreationFailed);
|
||||
ERROR_TYPE(Scripting, GlobalObjectCreationFailed);
|
||||
ERROR_TYPE(Scripting, StandardClassSetupFailed);
|
||||
ERROR_TYPE(Scripting, NativeFunctionSetupFailed);
|
||||
|
||||
ERROR_GROUP(PSERROR_Scripting, LoadFile);
|
||||
ERROR_TYPE(PSERROR_Scripting_LoadFile, OpenFailed);
|
||||
ERROR_TYPE(PSERROR_Scripting_LoadFile, EvalErrors);
|
||||
ERROR_SUBGROUP(Scripting, LoadFile);
|
||||
ERROR_TYPE(Scripting_LoadFile, OpenFailed);
|
||||
ERROR_TYPE(Scripting_LoadFile, EvalErrors);
|
||||
|
||||
ERROR_TYPE(PSERROR_Scripting, ConversionFailed);
|
||||
ERROR_TYPE(PSERROR_Scripting, CallFunctionFailed);
|
||||
ERROR_TYPE(PSERROR_Scripting, RegisterFunctionFailed);
|
||||
ERROR_TYPE(PSERROR_Scripting, DefineConstantFailed);
|
||||
ERROR_TYPE(PSERROR_Scripting, CreateObjectFailed);
|
||||
ERROR_TYPE(PSERROR_Scripting, TypeDoesNotExist);
|
||||
ERROR_TYPE(Scripting, ConversionFailed);
|
||||
ERROR_TYPE(Scripting, CallFunctionFailed);
|
||||
ERROR_TYPE(Scripting, RegisterFunctionFailed);
|
||||
ERROR_TYPE(Scripting, DefineConstantFailed);
|
||||
ERROR_TYPE(Scripting, CreateObjectFailed);
|
||||
ERROR_TYPE(Scripting, TypeDoesNotExist);
|
||||
|
||||
ERROR_GROUP(PSERROR_Scripting, DefineType);
|
||||
ERROR_TYPE(PSERROR_Scripting_DefineType, AlreadyExists);
|
||||
ERROR_TYPE(PSERROR_Scripting_DefineType, CreationFailed);
|
||||
ERROR_SUBGROUP(Scripting, DefineType);
|
||||
ERROR_TYPE(Scripting_DefineType, AlreadyExists);
|
||||
ERROR_TYPE(Scripting_DefineType, CreationFailed);
|
||||
|
||||
#include <jsapi.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user