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
14 extern "C++"
15 {
16     namespace __crt_state_management
17     {
18         constexpr size_t state_index_count = 2;
19         struct scoped_global_state_reset
20         {
throwscoped_global_state_reset21             scoped_global_state_reset() throw() { }
throwscoped_global_state_reset22             ~scoped_global_state_reset() throw() { }
23         }; // FIXME: Implement this
24         template <typename T>
25         class dual_state_global
26         {
27             T _value[2];
28         public:
29             T& value(__crt_cached_ptd_host& ptd) throw();
30             T const& value(__crt_cached_ptd_host& ptd) const throw();
value(void)31             T& value(void) throw() { return _value[0]; }
value_explicit(size_t index)32             T value_explicit(size_t index) throw() { return _value[index]; }
dangerous_get_state_array()33             T* dangerous_get_state_array() throw() { return _value; }
initialize(T)34             void initialize(T) throw() { }
uninitialize(T2)35             template<typename T2> void uninitialize(T2) throw() { }
initialize_from_array(T2 const (& values)[N])36             template<typename T2, size_t N> void initialize_from_array(T2 const (&values)[N]) throw() { }
37         };
38 
get_current_state_index(__crt_scoped_get_last_error_reset const & last_error_reset)39         inline int get_current_state_index(__crt_scoped_get_last_error_reset const &last_error_reset)
40         {
41             return 0;
42         }
43 
get_current_state_index(void)44         inline int get_current_state_index(void)
45         {
46             return 0;
47         }
48     }
49 }
50 #endif // __cplusplus
51 
52 #define __acrt_select_exit_lock() __acrt_exit_lock
53