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

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

いくつかのグローバル変数をProgram/Debuggerクラスにまとめた。

File size: 2.8 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() == "debug" )
59 {
60 // デバッグ ビルド
61 compiler.SetDebugMark( true );
62 }
63 else if( cmdLine.GetCommand() == "run" )
64 {
65 // デバッグ実行
66 isDebugRun = true;
67 }
68 else if( cmdLine.GetCommand() == "attach" )
69 {
70 // アタッチ
71 isDebugRun = true;
72 isAttach = true;
73 sscanf( cmdLine.GetParameter().c_str(), "%08x", &attachProcessId );
74 }
75 else if( cmdLine.GetCommand() == "dll" )
76 {
77 // DLLとしてビルド
78 compiler.SetTargetModuleType( Compiler::Dll );
79 }
80 else if( cmdLine.GetCommand() == "static_library" )
81 {
82 // 静的リンクライブラリとしてビルド
83 compiler.SetTargetModuleType( Compiler::StaticLibrary );
84 }
85 else if( cmdLine.GetCommand() == "unicode" )
86 {
87 // Unicode
88 compiler.SetUnicodeMark( true );
89 typeOfPtrChar = MAKE_PTR_TYPE(DEF_WORD,1);
90 typeOfPtrUChar = MAKE_PTR_TYPE(DEF_WORD,1);
91 }
92 else if( cmdLine.GetCommand() == "clip_compile_view" )
93 {
94 //埋め込み型コンパイラビュー
95 isClipCompileView = true;
96 }
97 else if( cmdLine.GetCommand() == "include_dir" )
98 {
99 //インクルード ディレクトリ
100 includeDir = cmdLine.GetParameter();
101 }
102 else
103 {
104 // 不正なコマンド
105 std::string keyword = cmdLine.GetCommand();
106 if( keyword.size() == 0 )
107 {
108 keyword = cmdLine.GetParameter();
109 }
110 std::cout << keyword << " コマンドとして認識できません。" << std::endl;
111 return false;
112 }
113 }
114
115 return true;
116}
Note: See TracBrowser for help on using the repository browser.