Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
104 lines (85 loc) · 3.63 KB

File metadata and controls

104 lines (85 loc) · 3.63 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#include "ParserPch.h"
#include "rterror.h"
// PUBLIC ERROR codes
// verify HR is as-expected for the Legacy (private) error JSERR_CantExecute
C_ASSERT(JSCRIPT_E_CANTEXECUTE != JSERR_CantExecute);
// verify the HR value (as MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0x1393))
C_ASSERT(JSERR_CantExecute == 0x800A1393);
// verify HR matches between public SDK and private (.h) files
C_ASSERT(JSCRIPT_E_CANTEXECUTE == JSPUBLICERR_CantExecute);
// verify the HR value (as MAKE_HRESULT(SEVERITY_ERROR, FACILITY_JSCRIPT, 0x0001))
C_ASSERT(JSPUBLICERR_CantExecute == _HRESULT_TYPEDEF_(0x89020001L));
// /PUBLIC ERROR codes
// boundary check - all errNum should be capped to 10,000 (RTERROR_STRINGFORMAT_OFFSET) - except for VBSERR_CantDisplayDate==32812
#define VERIFY_BOUNDARY_ERRNUM(name,errnum) C_ASSERT(name == VBSERR_CantDisplayDate || errnum < RTERROR_STRINGFORMAT_OFFSET);
#define RT_ERROR_MSG(name, errnum, str1, str2, jst, errorNumSource) VERIFY_BOUNDARY_ERRNUM(name, errnum)
#define RT_PUBLICERROR_MSG(name, errnum, str1, str2, jst, errorNumSource) VERIFY_BOUNDARY_ERRNUM(name, errnum)
#include "rterrors.h"
#undef RT_PUBLICERROR_MSG
#undef RT_ERROR_MSG
//------------------------------------------------------------------------------
// xplat: simulate resource strings
#ifndef _WIN32
#include <rterrors_limits.h>
struct _ResourceStr
{
UINT id;
const char16* str;
};
static _ResourceStr s_resourceStrs[] =
{
//
// Copy from jserr.gen
//
#define RT_ERROR_MSG(name, errnum, str1, str2, jst, errorNumSource) \
{ errnum, _u(str2) },
#define RT_PUBLICERROR_MSG(name, errnum, str1, str2, jst, errorNumSource) \
{ errnum + RTERROR_PUBLIC_RESOURCEOFFSET, _u(str2) },
#include <rterrors.h>
#undef RT_PUBLICERROR_MSG
#undef RT_ERROR_MSG
#define RT_ERROR_MSG(name, errnum, str1, str2, jst, errorNumSource) \
{ errnum + RTERROR_STRINGFORMAT_OFFSET, _u(str1) },
#define RT_PUBLICERROR_MSG(name, errnum, str1, str2, jst, errorNumSource) \
{ errnum + RTERROR_STRINGFORMAT_OFFSET + RTERROR_PUBLIC_RESOURCEOFFSET, \
_u(str1) },
#include <rterrors.h>
#undef RT_PUBLICERROR_MSG
#undef RT_ERROR_MSG
#define LSC_ERROR_MSG(errnum, name, str) \
{ errnum, _u(str) },
#include <perrors.h>
#undef LSC_ERROR_MSG
{ IDS_COMPILATION_ERROR_SOURCE, _u("JavaScript compilation error") },
{ IDS_RUNTIME_ERROR_SOURCE, _u("JavaScript runtime error") },
{ IDS_UNKNOWN_RUNTIME_ERROR, _u("Unknown runtime error") },
{ IDS_INFINITY, _u("Infinity") },
{ IDS_MINUSINFINITY, _u("-Infinity") }
};
static int compare_ResourceStr(const void* a, const void* b)
{
UINT id1 = reinterpret_cast<const _ResourceStr*>(a)->id;
UINT id2 = reinterpret_cast<const _ResourceStr*>(b)->id;
return id1 - id2;
}
static bool s_resourceStrsSorted = false;
const char16* LoadResourceStr(UINT id)
{
if (!s_resourceStrsSorted)
{
qsort(s_resourceStrs,
_countof(s_resourceStrs), sizeof(s_resourceStrs[0]),
compare_ResourceStr);
s_resourceStrsSorted = true;
}
_ResourceStr key = { id, nullptr };
const void* p = bsearch(&key,
s_resourceStrs, _countof(s_resourceStrs), sizeof(s_resourceStrs[0]),
compare_ResourceStr);
return p ? reinterpret_cast<const _ResourceStr*>(p)->str : nullptr;
}
#endif
Morty Proxy This is a proxified and sanitized view of the page, visit original site.