ReactOS 0.4.16-dev-822-gbcedb53
corecrt_internal_state_isolation.h
Go to the documentation of this file.
1//
2// corecrt_internal_state_isolation.h
3//
4// Copyright (c) 2024 Timo Kreuzer
5//
6// Header for CRT state management.
7//
8// SPDX-License-Identifier: MIT
9//
10
11#pragma once
12
13#ifdef __cplusplus
14extern "C++"
15{
16 namespace __crt_state_management
17 {
18#ifdef _CRT_GLOBAL_STATE_ISOLATION
19#error FIXME: Global state isolation is not implemented yet
20 constexpr size_t state_index_count = 2;
21#else
22 constexpr size_t state_index_count = 1;
23#endif
24
25 struct scoped_global_state_reset
26 {
27 scoped_global_state_reset() throw() { }
28 ~scoped_global_state_reset() throw() { }
29 };
30
31 template <typename T>
32 class dual_state_global
33 {
34 T _value[state_index_count];
35
36 public:
37
38 // Implemented in corecrt_internal_ptd_propagation.h
39 T& value(__crt_cached_ptd_host& ptd) throw();
40 T const& value(__crt_cached_ptd_host& ptd) const throw();
41
42 T& value(void) throw()
43 {
44 return _value[0];
45 }
46
47 T value_explicit(size_t index) throw()
48 {
49 return _value[index];
50 }
51
52 T* dangerous_get_state_array() throw()
53 {
54 return _value;
55 }
56
57 void initialize(T x) throw()
58 {
59 _value[0] = x;
60 }
61
62 template<typename T2>
63 void uninitialize(T2 Lambda) throw()
64 {
65 Lambda(_value[0]);
66 }
67
68 template<typename T2>
69 void initialize_from_array(T2 (&values)[state_index_count]) throw()
70 {
71 for (size_t i = 0; i < state_index_count; i++)
72 {
73 _value[i] = values[i];
74 }
75 }
76 };
77
78 inline size_t get_current_state_index(__crt_scoped_get_last_error_reset const &last_error_reset)
79 {
80 return 0;
81 }
82
83 inline size_t get_current_state_index(void)
84 {
85 return 0;
86 }
87 }
88}
89#endif // __cplusplus
90
91#define __acrt_select_exit_lock() __acrt_exit_lock
#define index(s, c)
Definition: various.h:29
result_buffer_count char *const _In_ int const _In_ bool const _In_ unsigned const _In_ STRFLT const _In_ bool const _Inout_ __crt_cached_ptd_host &ptd throw()
Definition: cvt.cpp:119
_In_ size_t const _In_ int _In_ bool const _In_ unsigned const _In_ __acrt_rounding_mode const _Inout_ __crt_cached_ptd_host & ptd
Definition: cvt.cpp:355
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint index
Definition: glext.h:6031
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define T
Definition: mbstring.h:31
static HRESULT initialize(void)
Definition: pdh_main.c:94