source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/src/Program.cpp@ 471

Last change on this file since 471 was 471, checked in by dai_9181, 16 years ago

show_dlgコマンドライン引数を実装。

File size: 2.9 KB
Line 
1#include "stdafx.h"
2
3#include <shlwapi.h>
4
5#include <jenga/include/common/Environment.h>
6
7#include <Program.h>
8
9Jenga::Common::Logger Program::logger( Jenga::Common::Environment::GetAppDir() + "\\logger.log", true );
10
11Program program;
12
13bool Program::AnalysisCommandLines()
14{
15 // コマンドラインを解析
16 const Jenga::Common::CmdLines cmdLines( PathGetArgs( GetCommandLine() ) );
17 int cmdLineIndex = 0;
18
19 if( cmdLines.size() == 0 )
20 {
21 // 何も指定されていないとき
22 return true;
23 }
24
25 if( cmdLines[cmdLineIndex].IsNamelessCommand() )
26 {
27 // 先頭に無名コマンドがきた場合、ソースファイル名として認識する
28 Program::SetSourceFilePath( cmdLines[cmdLineIndex].GetParameter() );
29
30 cmdLineIndex ++;
31
32 if( cmdLines.size() == 1 )
33 {
34 // ソースファイル名のみの指定だったとき
35 return true;
36 }
37
38 // 出力ファイル名を取得
39 if( cmdLines[cmdLineIndex].IsNamelessCommand() )
40 {
41 // 二番目にも無名コマンドがきた場合、ソースファイル名として認識する
42 SetOutputFilePath( cmdLines[cmdLineIndex].GetParameter() );
43
44 cmdLineIndex ++;
45 }
46 }
47
48 for( ; cmdLineIndex < static_cast<int>(cmdLines.size()); cmdLineIndex++ )
49 {
50 const Jenga::Common::CmdLine &cmdLine = cmdLines[cmdLineIndex];
51
52 if( cmdLine.GetCommand() == "wnd" )
53 {
54 // 親エディタのウィンドウ ハンドル
55 isKickedFromEditor = true;
56 sscanf( cmdLine.GetParameter().c_str(), "%08x", &hOwnerEditor );
57 }
58 else if( cmdLine.GetCommand() == "show_dlg" )
59 {
60 isShowDlg = true;
61 }
62 else if( cmdLine.GetCommand() == "debug" )
63 {
64 // デバッグ ビルド
65 compiler.SetDebugMark( true );
66 }
67 else if( cmdLine.GetCommand() == "run" )
68 {
69 // デバッグ実行
70 isDebugRun = true;
71 }
72 else if( cmdLine.GetCommand() == "attach" )
73 {
74 // アタッチ
75 isDebugRun = true;
76 isAttach = true;
77 sscanf( cmdLine.GetParameter().c_str(), "%08x", &attachProcessId );
78 }
79 else if( cmdLine.GetCommand() == "dll" )
80 {
81 // DLLとしてビルド
82 compiler.SetTargetModuleType( Compiler::Dll );
83 }
84 else if( cmdLine.GetCommand() == "static_library" )
85 {
86 // 静的リンクライブラリとしてビルド
87 compiler.SetTargetModuleType( Compiler::StaticLibrary );
88 }
89 else if( cmdLine.GetCommand() == "unicode" )
90 {
91 // Unicode
92 compiler.SetUnicodeMark( true );
93 typeOfPtrChar = MAKE_PTR_TYPE(DEF_WORD,1);
94 typeOfPtrUChar = MAKE_PTR_TYPE(DEF_WORD,1);
95 }
96 else if( cmdLine.GetCommand() == "clip_compile_view" )
97 {
98 //埋め込み型コンパイラビュー
99 isClipCompileView = true;
100 }
101 else if( cmdLine.GetCommand() == "include_dir" )
102 {
103 //インクルード ディレクトリ
104 includeDir = cmdLine.GetParameter();
105 }
106 else
107 {
108 // 不正なコマンド
109 std::string keyword = cmdLine.GetCommand();
110 if( keyword.size() == 0 )
111 {
112 keyword = cmdLine.GetParameter();
113 }
114 std::cout << keyword << " コマンドとして認識できません。" << std::endl;
115 return false;
116 }
117 }
118
119 return true;
120}
Note: See TracBrowser for help on using the repository browser.