Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Common - Base - API - Platform.cpp
    »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
    »Version«   4.51 / »GUID« A9981407-3EC9-42AF-8B6F-8BE6DD919615                                                                                                        */
/*   -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*  Copyright: © 2002-2017, Andrew Aye.  All Rights Reserved.
    This software is free for non-commercial use.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
      following conditions are met:
        Redistribution of source code must retain this copyright notice, this list of conditions and the following disclaimers.
        Redistribution in binary form must reproduce this copyright notice, this list of conditions and the following disclaimers in the documentation and other materials
          provided with the distribution.
    The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
    The intellectual property rights of the algorithms used reside with Andrew Aye.
    You may not use this software, in whole or in part, in support of any commercial product without the express written consent of the author.
    There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
#if TgCOMPILE_BASE_API_PLATFORM

MSVC_PRAGMA(warning( push, 3 ))
//#include <chrono>
//#include <thread>
MSVC_PRAGMA(warning( pop ))


/* == Common ============================================================================================================================================================ */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Functions                                                                                                                                                      */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

///* ---- Time Functions -------------------------------------------------------------------------------------------------------------------------------------------------- */
//
//static TgSINT64                     s_iInit_Start;
//static TgSINT64                     s_iStart[ETgTIME_CHANNEL__COUNT - 1];
//static TgFLOAT32                    s_fLast[ETgTIME_CHANNEL__COUNT - 1];
//static TgFLOAT32                    s_fElapsed[ETgTIME_CHANNEL__COUNT - 1];
//static TgFLOAT32                    s_fStop[ETgTIME_CHANNEL__COUNT - 1];
//
//
///* ---- timespec_get_ns ------------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//static TgSINT64 timespec_get_ns( TgVOID )
//{
//    timespec                            ts;
//
//    if (0 == TgGETTIME( &ts ))
//        return ts.tv_sec * 1000LL * 1000LL * 1000LL + ts.tv_nsec;
//    return (0);
//}
//
//
///* ---- tgTM_Init ------------------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgVOID tgTM_Init( TgVOID )
//{
//    s_iInit_Start = timespec_get_ns();
//}
//
//
///* ---- tgTM_Query_Counter_Tick ----------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgSINT64 tgTM_Query_Counter_Tick( TgVOID )
//{
//    TgSINT64                            iTime;
//
//    iTime = timespec_get_ns();
//    return (iTime - s_iInit_Start);
//}
//
//
///* ---- tgTM_Counter_To_MSec -------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgFLOAT32 tgTM_Counter_Tick_To_MSec( C_TgSINT64 iTime )
//{
//    return ((TgFLOAT32)((TgFLOAT64)(iTime) / 1000.0 / 1000.0));
//}
//
//
///* ---- tgTM_Query_Time ------------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgFLOAT32 tgTM_Query_Time( TgVOID )
//{
//    return (tgTM_Counter_Tick_To_MSec( tgTM_Query_Counter_Tick()  ));
//}
//
//
///* ---- tgTM_Channel_Query_Time ----------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgFLOAT32 tgTM_Channel_Query_Time( C_ETgTIMER_CHANNEL enChannel )
//{
//    TgPARAM_CHECK(enChannel < ETgTIME_CHANNEL__WALL);
//    return (tgPM_FSEL_F32( -s_fStop[enChannel], tgTM_Query_Time(), s_fStop[enChannel] ));
//}
//
//
///* ---- tgTM_Channel_Elapsed_Time --------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgFLOAT32 tgTM_Channel_Elapsed_Time( C_ETgTIMER_CHANNEL enChannel )
//{
//    TgPARAM_CHECK(enChannel < ETgTIME_CHANNEL__WALL);
//    return (s_fElapsed[enChannel]);
//}
//
//
///* ---- tgTM_Channel_Reset ---------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgVOID tgTM_Channel_Reset( C_ETgTIMER_CHANNEL enChannel )
//{
//    TgPARAM_CHECK(enChannel < ETgTIME_CHANNEL__WALL);
//    s_iStart[enChannel] = timespec_get_ns();
//    s_fLast[enChannel] = tgTM_Query_Time();
//    s_fElapsed[enChannel] = 0.0F;
//    s_fStop[enChannel] = 0.0F;
//}
//
//
///* ---- tgTM_Channel_Start ---------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgVOID tgTM_Channel_Start( C_ETgTIMER_CHANNEL enChannel )
//{
//    TgPARAM_CHECK(enChannel < ETgTIME_CHANNEL__WALL);
//    if (!(s_fStop[enChannel] <= 0.0F))
//    {
//        s_fLast[enChannel] = tgTM_Query_Time();
//        s_fStop[enChannel] = 0.0F;
//    };
//}
//
//
///* ---- tgTM_Channel_Stop ----------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgVOID tgTM_Channel_Stop( C_ETgTIMER_CHANNEL enChannel )
//{
//    TgPARAM_CHECK(enChannel < ETgTIME_CHANNEL__WALL);
//    if (!(s_fStop[enChannel] > 0.0F))
//    {
//        s_fStop[enChannel] = s_fLast[enChannel];
//    };
//}
//
//
///* ---- tgTM_Channel_Update --------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgVOID tgTM_Channel_Update( C_ETgTIMER_CHANNEL enChannel )
//{
//    TgPARAM_CHECK(enChannel < ETgTIME_CHANNEL__WALL);
//    if (!(s_fStop[enChannel] > 0.0F))
//    {
//        C_TgFLOAT32 fTime = tgTM_Query_Time();
//        s_fElapsed[enChannel] = tgCM_MAX_F32( KTgEPS_F32, fTime - s_fLast[enChannel] );
//        s_fLast[enChannel] = fTime;
//        s_fStop[enChannel] = 0.0F;
//    };
//}
//
//
///* ---- tgTM_Channel_Step ----------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgVOID tgTM_Channel_Step( C_ETgTIMER_CHANNEL enChannel, C_TgFLOAT32 fTimeAdvance )
//{
//    TgPARAM_CHECK(enChannel < ETgTIME_CHANNEL__WALL);
//    if (!(s_fStop[enChannel] <= 0.0F))
//    {
//        s_fElapsed[enChannel] = fTimeAdvance;
//        s_fStop[enChannel] += fTimeAdvance;
//    };
//}
//
//
//
//
///* ---- Memory PM ------------------------------------------------------------------------------------------------------------------------------------------------------- */
//CLANG_WARN_DISABLE_PUSH(missing-prototypes)
//
///* ---- tgMM_PM_Init_Scratch -------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//P_TgUINT08 tgMM_PM_Init_Scratch( C_TgSIZE uiSize )
//{
//    return ((P_TgUINT08)malloc( uiSize ));
//}
//
//
///* ---- tgMM_PM_Free_Scratch -------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgVOID tgMM_PM_Free_Scratch( PC_TgUINT08 pScratchMemory )
//{
//    free( pScratchMemory );
//}
//
//
///* ---- tgMM_PM_Page_Size ----------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgSINT32 tgMM_PM_Page_Size( TgVOID )
//{
//    return (4096);
//}
//
//
///* ---- tgMM_PM_Virtual_Reserve ----------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//P_TgVOID tgMM_PM_Virtual_Reserve( C_TgSIZE iSize, C_TgBOOL UNUSED_PARAM bTemp )
//{
//    P_TgVOID                            pMem;
//    TgSCALAR_P_ALIAS_UNION              sUnion;
//
//    pMem = malloc( iSize + 2*(TgSIZE)tgMM_PM_Page_Size() - 1 );
//    TgCRITICAL( nullptr != pMem );
//    
//    sUnion.m_p = pMem;
//    sUnion.m_pui08 += (TgUINTPTR)tgMM_PM_Page_Size() - (sUnion.m_uiPTR % (TgUINTPTR)tgMM_PM_Page_Size());
//    *sUnion.m_puiPTR = (TgUINTPTR)pMem;
//    sUnion.m_pui08 += tgMM_PM_Page_Size();
//    TgCRITICAL( 0 == (sUnion.m_uiPTR % (TgUINTPTR)tgMM_PM_Page_Size()) );
//
//    return (sUnion.m_pui08);
//}
//
//
///* ---- tgMM_PM_Virtual_Commit ------------------------------------------------------------------------------------------------------------------------------------------ */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//P_TgVOID tgMM_PM_Virtual_Commit( PC_TgVOID pMem, C_TgSIZE iSize )
//{
//    return (nullptr == pMem ? tgMM_PM_Virtual_Reserve( iSize, TgFALSE ) : pMem);
//}
//
//
///* ---- tgMM_PM_Virtual_Free -------------------------------------------------------------------------------------------------------------------------------------------- */
///* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
//TgVOID tgMM_PM_Virtual_Free( PC_TgVOID pMem )
//{
//    TgSCALAR_P_ALIAS_UNION              sUnion;
//
//    sUnion.m_p = pMem;
//    sUnion.m_pui08 -= tgMM_PM_Page_Size();
//  
//    free( (P_TgVOID)(*sUnion.m_puiPTR)  );
//}


//CLANG_WARN_DISABLE_POP(missing-prototypes)


/*# TgCOMPILE_BASE_API_PLATFORM */
#endif

/* 2183: Empty Translation Unit */
CLANG_WARN_SUPPRESS(missing-prototypes)
TgVOID Prevent2183_Common_Base_API_Platform( TgVOID )
{
}