Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
bingbingbingbing
mono
提交
d8520bf7
M
mono
项目概览
bingbingbingbing
/
mono
与 Fork 源项目一致
从无法访问的项目Fork
通知
35
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mono
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d8520bf7
编写于
1月 30, 2011
作者:
M
Miguel de Icaza
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[repl] Add support for -e EXPRESSION to the csharp command
上级
cd6a5848
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
6 deletion
+44
-6
man/csharp.1
man/csharp.1
+9
-1
mcs/mcs/driver.cs
mcs/mcs/driver.cs
+17
-1
mcs/mcs/eval.cs
mcs/mcs/eval.cs
+6
-0
mcs/tools/csharp/repl.cs
mcs/tools/csharp/repl.cs
+12
-4
未找到文件。
man/csharp.1
浏览文件 @
d8520bf7
...
...
@@ -6,7 +6,7 @@
.SH NAME
csharp, gsharp \- Interactive C# Shell
.SH SYNOPSIS
.B csharp [--attach PID] [file1 [file2]]
.B csharp [--attach PID] [
-e EXPRESSION] [
file1 [file2]]
[options]
.P
.B gsharp [file1 [file2]]
...
...
@@ -40,6 +40,11 @@ your C# source code look like this:
Console.WriteLine ("Hello, World");
.fi
.SH OPTIONS
The commands accept all of the commands that are available to the
.I mcs
command, so you can reference assemblies, specify paths, language
level and so on from the command line. In addition, the following
command line options are supported:
.TP
.I "\-\-attach"
This is an advanced option and should only be used if you have a deep
...
...
@@ -52,6 +57,9 @@ special measures to avoid crashing the target application while using
it. For example, you might have to take the proper locks before
issuing any commands that might affect the target process state, or
sending commands through a method dispatcher.
.TP
.I "\-e" EXPRESSION
This will evaluate the specified C# EXPRESSION and exit
.SH OPERATION
Once you launch the csharp command, you will be greeted with the
interactive prompt:
...
...
mcs/mcs/driver.cs
浏览文件 @
d8520bf7
...
...
@@ -42,6 +42,11 @@ namespace Mono.CSharp
static
readonly
char
[]
argument_value_separator
=
new
char
[]
{
';'
,
','
};
#if !STATIC
// The expression to evaluate if -e is passed to the REPL
public
static
string
EvalExpression
;
#endif
private
Driver
(
CompilerContext
ctx
)
{
this
.
ctx
=
ctx
;
...
...
@@ -748,6 +753,17 @@ namespace Mono.CSharp
RootContext
.
LoadDefaultReferences
=
false
;
return
true
;
#if !STATIC
case
"-e"
:
if
((
i
+
1
)
>=
args
.
Length
){
Report
.
Error
(
1900
,
"-e requires an expression"
);
Environment
.
Exit
(
1
);
}
EvalExpression
=
args
[++
i
];
return
true
;
#endif
default
:
if
(
arg
.
StartsWith
(
"--fatal"
)){
if
(
arg
.
StartsWith
(
"--fatal="
)){
...
...
@@ -1646,7 +1662,7 @@ namespace Mono.CSharp
{
CSharpParser
.
yacc_verbose_flag
=
0
;
Location
.
Reset
();
if
(!
full_flag
)
return
;
...
...
mcs/mcs/eval.cs
浏览文件 @
d8520bf7
...
...
@@ -148,6 +148,12 @@ namespace Mono.CSharp
}
}
public
static
string
StartupEvalExpression
{
get
{
return
Driver
.
EvalExpression
;
}
}
static
void
Init
()
{
Init
(
new
string
[
0
]);
...
...
mcs/tools/csharp/repl.cs
浏览文件 @
d8520bf7
...
...
@@ -173,7 +173,7 @@ namespace Mono {
Evaluate
(
"using System; using System.Linq; using System.Collections.Generic; using System.Collections;"
);
}
void
InitTerminal
()
void
InitTerminal
(
bool
show_banner
)
{
#if ON_DOTNET
is_unix
=
false
;
...
...
@@ -195,7 +195,7 @@ namespace Mono {
// Report.Stderr = Console.Out;
SetupConsole
();
if
(
isatty
)
if
(
isatty
&&
show_banner
)
Console
.
WriteLine
(
"Mono C# Shell, type \"help;\" for help\n\nEnter statements below."
);
}
...
...
@@ -265,7 +265,7 @@ namespace Mono {
public
int
ReadEvalPrintLoop
()
{
if
(
startup_files
!=
null
&&
startup_files
.
Length
==
0
)
InitTerminal
();
InitTerminal
(
startup_files
.
Length
==
0
&&
Evaluator
.
StartupEvalExpression
==
null
);
InitializeUsing
();
...
...
@@ -274,9 +274,17 @@ namespace Mono {
//
// Interactive or startup files provided?
//
string
startup_expression
=
Evaluator
.
StartupEvalExpression
;
if
(
startup_files
.
Length
!=
0
)
ExecuteSources
(
startup_files
,
false
);
else
else
if
(
Evaluator
.
StartupEvalExpression
!=
null
){
ReadEvalPrintLoopWith
(
p
=>
{
var
ret
=
startup_expression
;
startup_expression
=
null
;
return
ret
;
});
}
else
ReadEvalPrintLoopWith
(
GetLine
);
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录