外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
javaでスケールを取得する(hs)
:javaでスケールを取得する(hs)
@echo off
if not exist %~dp0Hs.class (
for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
more +%%n %0 > %~dpn0.java
javac -encoding shift_jis %~dpn0.java
)
)
copy jwc_temp.txt myfiles > nul
java -Dfile.encoding=shift_jis -classpath %~dp0 Hs > jwc_temp.txt
goto:eof
REM #jww
REM #e
#!この次の行からプログラムを書いてください
import java.io.*;
import java.util.regex.Pattern;
class Hs {
public static void main(String args) {
try {
BufferedReader f = new BufferedReader(new FileReader("myfiles"));
String line;
double hs = new double[16];
String lg, plg;
lg = plg = "";
int i = 0;
while ( (line = f.readLine()) != null) {
if (Pattern.compile("^hs").matcher(line).find()) {
String str = line.split(" ", 2);
String p = str[1].trim().split(" ");
for (i = 0; i < p.length; i++) {
hs[i] = Double.parseDouble(p[i]);
}
continue;
}
if (Pattern.compile("^lg[0-9a-f]").matcher(line).find()) {
plg = line.substring(2, 3).trim();
if (lg.equals("")) { lg = plg; }
continue;
}
}
f.close();
System.out.printf("h#S=1/%.0f\n", hs[to_lg(lg)]);
} catch (IOException e) {
System.out.println(e);
}
}
private static int to_lg(String lg){
if (lg.equals("a")) { return 10; }
if (lg.equals("b")) { return 11; }
if (lg.equals("c")) { return 12; }
if (lg.equals("d")) { return 13; }
if (lg.equals("e")) { return 14; }
if (lg.equals("f")) { return 15; }
return Integer.parseInt(lg);
}
}