Rev. | 171 |
---|---|
Size | 4,180 bytes |
Time | 2011-08-04 11:22:10 |
Author | shirayanagi |
Log Message | trim right |
//======================================================================
//-----------------------------------------------------------------------
/**
* @file iris_main.c
* @brief iris メインファイル
*
* @author t.sirayanagi
* @version 1.0
*
* @par copyright
* Copyright (C) 2009-2011 Takazumi Shirayanagi\n
* The new BSD License is applied to this software.
* see iris_LICENSE.txt
*/
//-----------------------------------------------------------------------
//======================================================================
#define INCG_IRIS_iris_main_C_
//======================================================================
// include
#include "iris_main.h"
#include "iris_inchead.h"
#include "iris_global.h"
#include <stdio.h>
EXTERN_C_BEGIN
//======================================================================
// linker
#if defined(_IRIS_NODEFAULTLIB)
# if defined(_WIN32) && defined(_MT)
# ifdef _DLL
# ifdef _DEBUG
# pragma comment( linker, "/NODEFAULTLIB:LIBCMTD.lib" )
# else
# pragma comment( linker, "/NODEFAULTLIB:LIBCMT.lib" )
# endif
# else
# ifdef _DEBUG
# pragma comment( linker, "/NODEFAULTLIB:MSVCRTD.lib" )
# else
# pragma comment( linker, "/NODEFAULTLIB:MSVCRT.lib" )
# endif
# endif
# endif
#endif
//======================================================================
// using
#if defined(__cplusplus)
using namespace iris;
#endif
EXTERN_C void irisInitialzie(int argc, TCHAR** argv, IrisU32 uId);
#if defined(IRIS_MSC)
IRIS_PRAGMA_MESSAGE("Microsoft Compiler.")
#endif
#if defined(IRIS_MWERKS)
IRIS_PRAGMA_MESSAGE("Metroworks Compiler.")
#endif
#if defined(IRIS_GNUC)
IRIS_PRAGMA_MESSAGE("GNU Compiler.")
#endif
#if defined(IRIS_CC_ARM)
IRIS_PRAGMA_MESSAGE("ARM Compiler.")
#endif
#if defined(IRIS_EDG)
IRIS_PRAGMA_MESSAGE("EDG Compiler.")
#endif
#if (defined(_IRIS_SUPPORT_GOOGLETEST) || defined(_IRIS_UNITTEST) || defined(_IRIS_MULTI_UNITTEST))
//! iris unit test entory point.
EXTERN_C int Iris_UnitTest_Main(void);
#endif
//======================================================================
// define
#if (!defined(_IRIS_UNITTEST) && !defined(_IRIS_MULTI_UNITTEST) )
# define IRIS_MAIN iris_main
#else
# define IRIS_MAIN Iris_UnitTest_Main
#endif
//======================================================================
// function
#if !defined(_IRIS_SUPPORT_EXT_PLATFORM)
#if defined(IRIS_WIN32) // for Windows
#if !defined(_LIB)
#include <windows.h>
#include <stdlib.h>
#include <tchar.h>
#if defined(_CONSOLE)
int _tmain( int argc, LPTSTR argv[] )
{
irisInitialzie(argc, argv, TARGET_WINDLL);
#elif defined(_USRDLL)
BOOL APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
IRIS_UNUSED_VAR(hInstance);
IRIS_UNUSED_VAR(dwReason);
IRIS_UNUSED_VAR(lpReserved);
irisInitialzie(0, nullptr, TARGET_WINDLL);
#if defined(_IRIS_SUPPORT_MFC)
// MFC を初期化して、エラーの場合は結果を印刷します。
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
return 1;
}
#endif
#else
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)
{
IRIS_UNUSED_VAR(hInstance);
IRIS_UNUSED_VAR(hPrevInstance);
IRIS_UNUSED_VAR(lpCmdLine);
IRIS_UNUSED_VAR(nShowCmd);
irisInitialzie(::__argc, ::__targv, TARGET_WINDLL);
#endif
return IRIS_MAIN();
}
#endif
#elif defined(IRIS_IPHONE)
int main(int argc, char *argv[])
{
irisInitialzie(argc, argv, TARGET_IPHONE);
return IRIS_MAIN();
}
#elif defined(IRIS_MAC)
int main(int argc, char *argv[])
{
irisInitialzie(argc, argv, TARGET_MAC);
return IRIS_MAIN();
}
#elif defined(IRIS_IAR_SYSTEM)
int main( int argc, char* argv[] )
{
irisInitialzie(argc, argv, TARGET_STM32);
return IRIS_MAIN();
}
#elif defined(IRIS_NACL)
#if !defined(__cplusplus)
// cpp only
#endif
#else
int main( int argc, char* argv[] )
{
irisInitialzie(argc, argv, TARGET_UNKNOWN);
return IRIS_MAIN();
}
#endif
#endif
EXTERN_C_END