Skip to content

Commit

Permalink
print->打印
Browse files Browse the repository at this point in the history
  • Loading branch information
testacount1 committed Mar 17, 2019
1 parent 8a524cd commit 165d99e
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 13 deletions.
11 changes: 7 additions & 4 deletions src/chap14/带类型原生类.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package chap14;
import chap11.环境优化器类.环境扩展类2;
import chap6.环境类;
import chap8.原生类;
import chap11.环境优化器类.环境扩展类2;

public class 带类型原生类 extends 原生类 {
private static final String 方法名_当前时刻 = "当前时刻";
private static final String 方法名_打印 = "打印";
protected 类型环境类 typeEnv;
public 带类型原生类(类型环境类 te) { typeEnv = te; }
protected void append(环境类 env, String name, Class<?> clazz,
Expand All @@ -13,8 +15,9 @@ protected void append(环境类 env, String name, Class<?> clazz,
int index = ((环境扩展类2)env).所有符号().find(name);
typeEnv.put(0, index, type);
}
@Override
protected void appendNatives(环境类 env) {
append(env, "print", chap14.java.print.class, "m",
append(env, 方法名_打印, chap14.java.print.class, "m",
类型信息类.function(类型信息类.INT, 类型信息类.ANY),
Object.class);
append(env, "read", chap14.java.read.class, "m",
Expand All @@ -25,7 +28,7 @@ protected void appendNatives(环境类 env) {
append(env, "toInt", chap14.java.toInt.class, "m",
类型信息类.function(类型信息类.INT, 类型信息类.ANY),
Object.class);
append(env, "currentTime", chap14.java.currentTime.class, "m",
类型信息类.function(类型信息类.INT));
append(env, 方法名_当前时刻, chap14.java.currentTime.class, "m",
类型信息类.function(类型信息类.INT));
}
}
3 changes: 2 additions & 1 deletion src/chap8/原生类.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

public class 原生类 {
private static final String 方法名_当前时刻 = "当前时刻";
private static final String 方法名_打印 = "打印";
public 环境类 环境(环境类 env) {
appendNatives(env);
return env;
}
protected void appendNatives(环境类 env) {
append(env, "print", 原生类.class, "print", Object.class);
append(env, 方法名_打印, 原生类.class, "print", Object.class);
append(env, "read", 原生类.class, "read");
append(env, "length", 原生类.class, "length", String.class);
append(env, "toInt", 原生类.class, "toInt", Object.class);
Expand Down
2 changes: 1 addition & 1 deletion test/chap11/环境优化解释器Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class 环境优化解释器Test extends 环境优化解释器类 {

private static final String 换行 = "\n";
private static final String 打印 = "print 耗时 + \" 毫秒 环境优化\"";
private static final String 打印 = "打印 耗时 + \" 毫秒 环境优化\"";
private static String 斐波那契计时 = "";
static {
try {
Expand Down
2 changes: 1 addition & 1 deletion test/chap12/内联缓存解释器Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class 内联缓存解释器Test extends 对象优化解释器类 {

private static final String 换行 = "\n";
private static final String 打印 = "print 耗时 + \" 毫秒\"";
private static final String 打印 = "打印 耗时 + \" 毫秒\"";
private static String 斐波那契计时_this = "";
private static String 斐波那契计时_this = "";
static {
Expand Down
2 changes: 1 addition & 1 deletion test/chap12/对象优化器类Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class 对象优化器类Test extends 对象优化解释器类 {

private static final String 换行 = "\n";
private static final String 打印 = "print 耗时 + \" 毫秒\"";
private static final String 打印 = "打印 耗时 + \" 毫秒\"";
private static String 斐波那契计时_this = "";
private static String 斐波那契计时_this = "";
static {
Expand Down
2 changes: 1 addition & 1 deletion test/chap13/虚拟机解释器Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class 虚拟机解释器Test extends 虚拟机解释器类 {

private static final String 换行 = "\n";
private static final String 打印 = "print 耗时 + \" 毫秒 静态类型\"";
private static final String 打印 = "打印 耗时 + \" 毫秒 静态类型\"";
private static final String 计时 = "时刻 = 当前时刻()";
private static final String 求值 = "斐波那契(20)";
private static final String 计时结束 = "耗时 = 当前时刻() - 时刻";
Expand Down
6 changes: 3 additions & 3 deletions test/chap14/带类型解释器Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
public class 带类型解释器Test extends 带类型解释器类 {

private static final String 换行 = "\n";
private static final String 打印 = "print 耗时 + \" 毫秒 静态类型\"";
private static final String 计时 = "时刻 = currentTime()";
private static final String 打印 = "打印 耗时 + \" 毫秒 静态类型\"";
private static final String 计时 = "时刻 = 当前时刻()";
private static final String 求值 = "斐波那契(20)";
private static final String 计时结束 = "耗时 = currentTime() - 时刻";
private static final String 计时结束 = "耗时 = 当前时刻() - 时刻";
private static String 斐波那契 = "";
static {
try {
Expand Down
2 changes: 1 addition & 1 deletion test/chap8/原生解释器Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class 原生解释器Test extends 原生解释器类 {

private static final String 换行 = "\n";
private static final String 打印 = "print 时刻 + \" 毫秒 支持原生\"";
private static final String 打印 = "打印 时刻 + \" 毫秒 支持原生\"";
private static String 斐波那契计时 = "";
static {
try {
Expand Down

0 comments on commit 165d99e

Please sign in to comment.