#include "stdafx.h" #include #include #include Jenga::Common::Logger Program::logger( Jenga::Common::Environment::GetAppDir() + "\\logger.log", true ); Program program; bool Program::AnalysisCommandLines() { // コマンドラインを解析 const Jenga::Common::CmdLines cmdLines( PathGetArgs( GetCommandLine() ) ); int cmdLineIndex = 0; if( cmdLines.size() == 0 ) { // 何も指定されていないとき return true; } if( cmdLines[cmdLineIndex].IsNamelessCommand() ) { // 先頭に無名コマンドがきた場合、ソースファイル名として認識する Program::SetSourceFilePath( cmdLines[cmdLineIndex].GetParameter() ); cmdLineIndex ++; if( cmdLines.size() == 1 ) { // ソースファイル名のみの指定だったとき return true; } // 出力ファイル名を取得 if( cmdLines[cmdLineIndex].IsNamelessCommand() ) { // 二番目にも無名コマンドがきた場合、ソースファイル名として認識する SetOutputFilePath( cmdLines[cmdLineIndex].GetParameter() ); cmdLineIndex ++; } } for( ; cmdLineIndex < static_cast(cmdLines.size()); cmdLineIndex++ ) { const Jenga::Common::CmdLine &cmdLine = cmdLines[cmdLineIndex]; if( cmdLine.GetCommand() == "wnd" ) { // 親エディタのウィンドウ ハンドル isKickedFromEditor = true; sscanf( cmdLine.GetParameter().c_str(), "%08x", &hOwnerEditor ); } else if( cmdLine.GetCommand() == "debug" ) { // デバッグ ビルド compiler.SetDebugMark( true ); } else if( cmdLine.GetCommand() == "run" ) { // デバッグ実行 isDebugRun = true; } else if( cmdLine.GetCommand() == "attach" ) { // アタッチ isDebugRun = true; isAttach = true; sscanf( cmdLine.GetParameter().c_str(), "%08x", &attachProcessId ); } else if( cmdLine.GetCommand() == "dll" ) { // DLLとしてビルド compiler.SetTargetModuleType( Compiler::Dll ); } else if( cmdLine.GetCommand() == "static_library" ) { // 静的リンクライブラリとしてビルド compiler.SetTargetModuleType( Compiler::StaticLibrary ); } else if( cmdLine.GetCommand() == "unicode" ) { // Unicode compiler.SetUnicodeMark( true ); typeOfPtrChar = MAKE_PTR_TYPE(DEF_WORD,1); typeOfPtrUChar = MAKE_PTR_TYPE(DEF_WORD,1); } else if( cmdLine.GetCommand() == "clip_compile_view" ) { //埋め込み型コンパイラビュー isClipCompileView = true; } else if( cmdLine.GetCommand() == "include_dir" ) { //インクルード ディレクトリ includeDir = cmdLine.GetParameter(); } else { // 不正なコマンド std::string keyword = cmdLine.GetCommand(); if( keyword.size() == 0 ) { keyword = cmdLine.GetParameter(); } std::cout << keyword << " コマンドとして認識できません。" << std::endl; return false; } } return true; }