v2s(virtual2stack)-tec.md
````markdown
# `v2s(virtual2stack)-tec`
> virtual2stack-tec
>
> lib4 double stack machine esolang
> `bruh ๐`
## v2s-tec.h
```cpp
#pragma once
#ifndef _V2S_TEC_H
#define _V2S_TEC_H
#ifdef _MSC_VER
#define fcal __fastcall
#else
#define fcal __attribute__((fastcall))
#endif
#define PUSH(T, x) x = this::push<T>(x)
namespace __fcal_argvible_ptrlike_t_space__ {
/**
*
* # __regvar_arguemnt_typizer_space__
*
* providing
* - `regvar_arguemnt_typizer`
* - `is_size_over_sizeof_ptr`
*
* to provide register var argumebt typizer use solution as template aliasing resource space
*
*/
namespace __regvar_arguemnt_typizer_space__ {
/**
*
* # size_limit_as_not_over_the_ptrsize - when size is over ptr size
*
* make pointer to limit the size as not over the ptr size
*
*/
template <bool overptr, typename T>
struct _size_limit_as_not_over_the_ptrsize {
using type = T*;
};
/**
*
* # size_limit_as_not_over_the_ptrsize - when not overptr
*
* just us it. it aren't bigger than ptrsize
*
*/
template <typename T>
struct _size_limit_as_not_over_the_ptrsize<false, T> {
using type = T;
};
/**
*
* # coreof_regvar_arguemnt_typizer<T>
*
* make T as register arguemnt variable typizing to can use it wrap to make `arguemnt_typizer`
*
* role of dose_T_is_over_ptrsize : check the T on language compile time to get information which dose_T_is_over_ptrsize
*
* # mechanism
* by using _size_limit_as_not_over_the_ptrsize<, T> to limit it under ptr size.
* fake type for register.
* if T "overptr", make type as ptr to limptr
*
*/
template <typename T>
struct _coreof_regvar_arguemnt_typizer {
static constexpr bool dose_T_is_over_ptrsize = sizeof(T) > sizeof(void*);
using type = typename _size_limit_as_not_over_the_ptrsize<overptr, T>::type;
};
/**
*
* # arguemnt_typizer<T>
*
* make T as regiter arguemnt variable
*
* ## mechanism
*
* by using __regvar_arguemnt_typizer_space__'s core feature `_coreof_regvar_arguemnt_typizer` that actually wrap to work.
*
*/
template <typename T>
using regvar_arguemnt_typizer = typename _coreof_regvar_arguemnt_typizer<T>::type;
/**
*
* # is_size_over_sizeof_ptr<T>::dose_it
*
* get which is_size_over_sizeof_ptr is true or not. (actually this provides for to check regvar_arguemnt_typizer<T> is pointertype or not)
*
* ## mechanism
* using __regvar_arguemnt_typizer_space__'s core feature `_coreof_regvar_arguemnt_typizer`'s semtic working compile work argument to get works.
*
*/
template <typename T>
struct is_size_over_sizeof_ptr {
static constexpr bool dose_it = _regvar_arguemnt_typizer<T>::overptr;
};
}
using __regvar_arguemnt_typizer_space__::regvar_arguemnt_typizer;
using __regvar_arguemnt_typizer_space__::is_size_over_sizeof_ptr;
/**
*
* # fcal_argvible_t<T>
*
* argv type for fcal
*
* ## create
*
* create by constructor `fcal_argvible_t<T>(T)`
*
* ## using
*
* `*fcal_argvible_ptrlike_t<T>` to get T value
*
* ### etc
*
* - value : fake-type value
* - when value is ptr type : v is being reference (T*)
* - the inner constexpr flags is_value_is_ptr_type : flag which mean type of v (= regvar_arguemnt_typed type) is ponter
*
*
* # mechanism
*
* using regvar_arguemnt_typizer tool to manage regvar_arguemnt_typed T as ptrlike fcal argument obj
*
*/
template <typename T>
struct fcal_argvible_ptrlike_t {
static constexpr bool is_value_is_ptr_type = is_size_over_sizeof_ptr<T>::dose_it;
regvar_arguemnt_typizer<T> value;
inline T operator*(void) {
if constexpr (is_value_is_ptr_type) return *value; //evidancly.., it' an ref
else return value;
}
inline argv_t(T the_typeT) {
if constexpr (is_value_is_ptr_type) value = &the_typeT; //evidancly.., should be ref
else value = the_typeT;
}
};
}
/**
*
* # StackInterface
*
* - `::type_of_it` type attribute : this auto& field which usible in non-objects attribute
* - `::default_obj` type attribute : default construct obj
* - static method `::push<T>` : obj default pusher (actually, stack interface's cls obj is just like-inline functor, so it can make usible without obj)
* - virtual method `.instack_logic` : logic before stack var is pop
*
* ## actaully...
* umm... basically, it's prefer that mechanism which LiberatedCallStack_StackInterface style stack.
* 1. set (push)
* 2. `---- user work ----`
* 3. get (pop)
*
*/
typedef struct {
using type_of_it = this auto&;
using default_obj = type_of_it();
template <typename T, type_of_it obj = default_obj>
final static inline T push(T x) {
return obj->push<T>(x);
}
template <typename T>
virtual inline T push(T) = 0;
virtual inline void instack_logic(void*) = 0;
} StackInterface; //well...
/**
*
* # LiberatedCallStack_StackInterface
*
* using call, using call stack as stack (Call Stack Liberation)
*
* ## about
*
* using function call's local variable which placed in stack to use stack.
*
* 1. call with var
* 2. set (push)
* 3. `---- user work ----`
* 4. get (pop)
* 5. ret
*
*/
typedef struct : StackInterface {
template <typename T, typename V = __argv_t_space__::fcal_argvible_ptrlike_t<T>>
using G = V;
template <typename T, typename G_t = G<T>>
virtual inline T push(T register_v) override final {
return *(this->push<T>(G_t(register_v)));
}
template <typename T, typename G_t = G<T>>
final fcal G_t push(G_t register_v) {
//push
T stack_local = *register_v;
//work
instack_logic((void*) register_v)
//pop
register_v = G_t(stack_local); //mov must
return register_v; //ret
}
} LiberatedCallStack_StackInterface;
/**
*
* # HeapStack_StackInterface
*
* Stack in heap ({must inhurit as it... (even that fact that .... actually no error that you use it fu*king idi*tly... so plz ๐ญ๐ญ))
*/
typedef struct : StackInterface {} HeapStack_StackInterface;
/**
* ใใใใฏใใใใใใใงใใ
* ใใใฆใใใใใฏใใใใใใใฎใชใใงใใใใใจใฐใฅใใใใใใใงใใ
* ใใจใฐใฅใใใงใตใใใซใใใใใฆใใพใฃใใใใใใพใใใ
* ใใใซใใใณใใใใใใพใใใปใใจใใซใใใใใใใใพใใใ
* ใใใงใใใ ใใใใใใจใใใใใพใใใ
*/
#endif
```
### warning
A. if you use `StackInterface` to using all stack management type, the virtual will freakenly frequntly madly fu*ing many used.
B. if you use too many Stack Reversting Management Logic and Heap Stack Logics, the virtual will freakenly frequntly madly fu*ing many used.
### Tip
use `virtual inline T push(T ~) override final`
````
์นดํ
๊ณ ๋ฆฌ ์์