OSDN Git Service

Embedded Ruby: problems with encoding is being fixed (not complete yet?)
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Thu, 27 Mar 2014 01:10:17 +0000 (01:10 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Thu, 27 Mar 2014 01:10:17 +0000 (01:10 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@513 a2be9bc6-48de-4e38-9406-05402d4bc13c

12 files changed:
Documents/src/doc_source.html
Makefile
MolLib/Ruby_bind/Molby_extern.h
MolLib/Ruby_bind/ruby_bind.c
Scripts/crystal.rb
Scripts/gamess.rb
Scripts/startup.rb
Scripts/view.rb
how_to_build
wxSources/ConsoleFrame.cpp
wxSources/MyApp.cpp
xcode-build/Molby.xcodeproj/project.pbxproj

index 858db63..60be9e8 100644 (file)
@@ -935,9 +935,6 @@ The parameter table shows the molecular mechanics parameters in one table.
 </p>
 <p><img src="../etc/table_12.png" /></p>
 <p>
-When you build a molecule from scratch, and open the parameter table before doing any MM/MD operations, this table is likely to be empty. This is because the MM parameters are looked up only when "Molecular Dynamics..." or "Minimize..." menu command is invoked, or you use MM/MD tools like Antechamber (see Step 4 for details). After doing some of these operations, you will see a set of parameters shown in this table.
-</p>
-<p>
 The parameters are grouped in several classes, namely "VDWs", "Bonds", "Angles", "Dihedrals", "Impropers", and "VDW Pairs".
 </p>
 <p>
@@ -1028,9 +1025,6 @@ Bond, angle, dihedral, improper テーブルは、それぞれ結合・結合角
 </p>
 <p><img src="../etc/table_12.png" /></p>
 <p>
-分子を新しく作成して、MM/MD に関連する操作を何もせずにパラメータテーブルを開くと、テーブルはおそらく空のままでしょう。分子力学パラメータは、"Molecular Dynamics..." または "Minimize..." メニューコマンドを実行したときか、Antechamber のような分子力学用ツール(第四段階参照)を使った時に初めて作成されます。これらの操作をした後には、パラメータがこのテーブルに表示されます。
-</p>
-<p>
 パラメータはいくつかの種類にグループ分けされています。"VDWs", "Bonds", "Angles", "Dihedrals", "Impropers", そして "VDW Pairs" です。
 </p>
 <p>
@@ -1099,7 +1093,7 @@ Open the "MM/MD" menu, and select "Guess MM/MD Parameters..." command.
 </p>
 <p><img src="../etc/minimize_02.png" /></p>
 <p>
-A dialog like below shows up. This is for execution of Antechamber on the current molecule. Turn off the "partial charge" checkbox. The "log" directory is used by AmberTools for storing intermediate files; the default value would be acceptable, but you can change it here.
+A dialog like below shows up. This is for execution of Antechamber on the current molecule. Turn off the "Calculate partial charges" checkbox, and turn on the "Guess atom types" checkbox. The "log" directory is used by AmberTools for storing intermediate files; the default value would be acceptable, but you can change it here.
 </p>
 <p><img src="../etc/minimize_03.png" /></p>
 <p>
@@ -1188,7 +1182,7 @@ Molby の分子力学計算は、基本的な分子力場(結合の伸縮、
 </p>
 <p><img src="../etc/minimize_02.png" /></p>
 <p>
-下のようなダイアログが現れます。これは現在の分子に対して Antechamber を実行するためのものです。一番上のチェックボックス (partial charge) をオフにしてください。"Log" ディレクトリは、AmberTools のプログラムが中間ファイルを保存するのに使います。デフォルトの位置で問題はないでしょうが、変更してもかまいません。
+下のようなダイアログが現れます。これは現在の分子に対して Antechamber を実行するためのものです。一番上のチェックボックス "Calculate partial charge" をオフ、その下の "Guess Atom Types" をオンにしてください。"Log" ディレクトリは、AmberTools のプログラムが中間ファイルを保存するのに使います。デフォルトの位置で問題はないでしょうが、変更してもかまいません。
 </p>
 <p><img src="../etc/minimize_03.png" /></p>
 <p>
index 5c97066..c03b956 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ ifeq ($(TARGET_PLATFORM),MAC)
  LD_EXTRA_FLAGS = -framework Accelerate -framework GLUT -L$(PWD)/../../fftw-3.3.2/osx-build/lib -lfftw3
  RUBY_DIR = $(PWD)/../../ruby-1.8.7-p160
  RUBY_CFLAGS = -isystem $(RUBY_DIR)/osx-build/include
- RUBY_LDFLAGS = -L$(RUBY_DIR)/osx-build/lib -lruby-static
+ RUBY_LDFLAGS = -L$(RUBY_DIR)/osx-build/lib -lruby-static -lenc
  EXECUTABLE = Molby
  EXE_SUFFIX =
 endif
@@ -23,7 +23,7 @@ ifeq ($(TARGET_PLATFORM),MSW)
  LD_EXTRA_FLAGS = -L$(PWD)/../../CLAPACK-3.1.1.1-mingw/lib -L$(PWD)/../../fftw-3.3.2/msw-build/lib -llapackMinGW -lblasMinGW -lf2c_nomain -lfftw3
  RUBY_DIR = $(PWD)/../../ruby-2.0.0-p353
  RUBY_CFLAGS = -isystem $(RUBY_DIR)/msw-build/include/ruby-2.0.0 -I$(RUBY_DIR) -I$(RUBY_DIR)/msw-build/include/ruby-2.0.0/i386-mingw32
- RUBY_LDFLAGS = -L$(RUBY_DIR)/msw-build/lib -lmsvcrt-ruby200-static -lmsvcrt-ruby200 -lws2_32 -lshlwapi -limagehlp
+ RUBY_LDFLAGS = -L$(RUBY_DIR)/msw-build/lib -lmsvcrt-ruby200-static -lmsvcrt-ruby200 -lws2_32 -lshlwapi -limagehlp -lenc
  EXECUTABLE = _Molby.exe_
  FINAL_EXECUTABLE = Molby.exe
  EXE_SUFFIX = .exe
index 958df00..a63191a 100755 (executable)
@@ -37,7 +37,7 @@ extern void Molby_showError(int status);
 extern RubyValue Molby_evalRubyScriptOnMolecule(const char *script, Molecule *mol, const char *fname, int *status);
 /* extern RubyValue Molby_evalRubyScript(const char *script, int *status);
 extern RubyValue Molby_evalRubyScriptOnActiveMoleculeWithInterrupt(const char *script, int *status); */
-extern void Molby_showRubyValue(RubyValue value, char **outValueString);
+extern int Molby_showRubyValue(RubyValue value, char **outValueString);
 extern int Ruby_UpdateUI(int index, Molecule *mol, int *outChecked, char **outTitle);
 /*extern int Ruby_methodType(const char *className, const char *methodName);*/
 extern void Molby_buildARGV(int argc, const char **argv);
index c50ebf8..5221f69 100644 (file)
@@ -11065,7 +11065,11 @@ s_evalRubyScriptOnMoleculeSub(VALUE val)
        if (ptr[2] == NULL) {
                char *scr;
                /*  String literal: we need to specify string encoding  */
+#if defined(__WXMSW__)
+               asprintf(&scr, "#coding:shift_jis\n%s", (char *)ptr[0]);
+#else
                asprintf(&scr, "#coding:utf-8\n%s", (char *)ptr[0]);
+#endif
                sval = rb_str_new2(scr);
                free(scr);
                fnval = rb_str_new2("(eval)");
@@ -11124,13 +11128,13 @@ Molby_evalRubyScriptOnMolecule(const char *script, Molecule *mol, const char *fn
        return retval;
 }
 
-void
+int
 Molby_showRubyValue(RubyValue value, char **outValueString)
 {
        VALUE val = (VALUE)value;
        if (gMolbyIsCheckingInterrupt) {
                MolActionAlertRubyIsRunning();
-               return;
+               return 0;
        }
        if (val != Qnil) {
                int status;
@@ -11138,11 +11142,17 @@ Molby_showRubyValue(RubyValue value, char **outValueString)
                gMolbyRunLevel++;
                val = rb_protect(rb_inspect, val, &status);
                gMolbyRunLevel--;
+               if (status != 0)
+                       return status;
                str = StringValuePtr(val);
                if (outValueString != NULL)
                        *outValueString = strdup(str);
                MyAppCallback_showScriptMessage("%s", str);
+       } else {
+               if (outValueString != NULL)
+                       *outValueString = NULL;
        }
+       return 0;
 }
 
 void
@@ -11301,6 +11311,11 @@ Molby_startup(const char *script, const char *dir)
        }
 #endif
        ruby_init();
+
+       {
+               extern void Init_shift_jis(void);
+               Init_shift_jis();
+       }
        
        /*  Initialize loadpath; the specified directory, "lib" subdirectory, and "."  */
        ruby_incpush(".");
index eea5d80..5b68054 100755 (executable)
@@ -1,4 +1,5 @@
-#
+# coding: utf-8
+# 
 #  crystal.rb
 #
 #  Created by Toshi Nagata.
@@ -1807,7 +1808,8 @@ end
        new_box = nil
     hash = Dialog.run("Unit Cell") {
          @mol = mol
-         @box = @mol.box.dup
+         @box = @mol.box
+         @box = (@box ? @box.dup : nil)
          @box_save = nil
          
          def set_cell_value(item1)
index 7dd33eb..05338f7 100755 (executable)
@@ -195,7 +195,12 @@ class Molecule
     fpout.print freebytes
 
     #  Copy the input file
-    scrprefix = scrdir + sep + inpbody
+       scrprefix = scrdir + sep + inpbody
+       if $platform == "win"
+         scrbody = inpbody
+       else
+      scrbody = scrprefix
+       end
     filecopy(inpname, scrprefix + ".F05")
 
     #  Prepare environmental variables
@@ -205,140 +210,140 @@ class Molecule
     ENV["BASPATH"] = "#{auxdir}#{sep}BASES"
     ENV["QUANPOL"] = "#{auxdir}#{sep}QUANPOL"
     ENV["EXTBAS"] = "/dev/null"
-    ENV["IRCDATA"] = "#{scrprefix}.irc"
-    ENV["PUNCH"] = "#{scrprefix}.dat"
-    ENV["INPUT"] = "#{scrprefix}.F05"
-    ENV["AOINTS"] = "#{scrprefix}.F08"
-    ENV["MOINTS"] = "#{scrprefix}.F09"
-    ENV["DICTNRY"] = "#{scrprefix}.F10"
-    ENV["DRTFILE"] = "#{scrprefix}.F11"
-    ENV["CIVECTR"] = "#{scrprefix}.F12"
-    ENV["CASINTS"] = "#{scrprefix}.F13"
-    ENV["CIINTS"] = "#{scrprefix}.F14"
-    ENV["WORK15"] = "#{scrprefix}.F15"
-    ENV["WORK16"] = "#{scrprefix}.F16"
-    ENV["CSFSAVE"] = "#{scrprefix}.F17"
-    ENV["FOCKDER"] = "#{scrprefix}.F18"
-    ENV["WORK19"] = "#{scrprefix}.F19"
-    ENV["DASORT"] = "#{scrprefix}.F20"
-    ENV["DFTINTS"] = "#{scrprefix}.F21"
-    ENV["DFTGRID"] = "#{scrprefix}.F22"
-    ENV["JKFILE"] = "#{scrprefix}.F23"
-    ENV["ORDINT"] = "#{scrprefix}.F24"
-    ENV["EFPIND"] = "#{scrprefix}.F25"
-    ENV["PCMDATA"] = "#{scrprefix}.F26"
-    ENV["PCMINTS"] = "#{scrprefix}.F27"
-    ENV["MLTPL"] = "#{scrprefix}.F28"
-    ENV["MLTPLT"] = "#{scrprefix}.F29"
-    ENV["DAFL30"] = "#{scrprefix}.F30"
-    ENV["SOINTX"] = "#{scrprefix}.F31"
-    ENV["SOINTY"] = "#{scrprefix}.F32"
-    ENV["SOINTZ"] = "#{scrprefix}.F33"
-    ENV["SORESC"] = "#{scrprefix}.F34"
-    ENV["SIMEN"] = "#{scrprefix}.simen"
-    ENV["SIMCOR"] = "#{scrprefix}.simcor"
-    ENV["GCILIST"] = "#{scrprefix}.F37"
-    ENV["HESSIAN"] = "#{scrprefix}.F38"
-    ENV["SOCCDAT"] = "#{scrprefix}.F40"
-    ENV["AABB41"] = "#{scrprefix}.F41"
-    ENV["BBAA42"] = "#{scrprefix}.F42"
-    ENV["BBBB43"] = "#{scrprefix}.F43"
-    ENV["MCQD50"] = "#{scrprefix}.F50"
-    ENV["MCQD51"] = "#{scrprefix}.F51"
-    ENV["MCQD52"] = "#{scrprefix}.F52"
-    ENV["MCQD53"] = "#{scrprefix}.F53"
-    ENV["MCQD54"] = "#{scrprefix}.F54"
-    ENV["MCQD55"] = "#{scrprefix}.F55"
-    ENV["MCQD56"] = "#{scrprefix}.F56"
-    ENV["MCQD57"] = "#{scrprefix}.F57"
-    ENV["MCQD58"] = "#{scrprefix}.F58"
-    ENV["MCQD59"] = "#{scrprefix}.F59"
-    ENV["MCQD60"] = "#{scrprefix}.F60"
-    ENV["MCQD61"] = "#{scrprefix}.F61"
-    ENV["MCQD62"] = "#{scrprefix}.F62"
-    ENV["MCQD63"] = "#{scrprefix}.F63"
-    ENV["MCQD64"] = "#{scrprefix}.F64"
-    ENV["NMRINT1"] = "#{scrprefix}.F61"
-    ENV["NMRINT2"] = "#{scrprefix}.F62"
-    ENV["NMRINT3"] = "#{scrprefix}.F63"
-    ENV["NMRINT4"] = "#{scrprefix}.F64"
-    ENV["NMRINT5"] = "#{scrprefix}.F65"
-    ENV["NMRINT6"] = "#{scrprefix}.F66"
-    ENV["DCPHFH2"] = "#{scrprefix}.F67"
-    ENV["DCPHF21"] = "#{scrprefix}.F68"
-    ENV["GVVPT"] = "#{scrprefix}.F69"
+    ENV["IRCDATA"] = "#{scrbody}.irc"
+    ENV["PUNCH"] = "#{scrbody}.dat"
+    ENV["INPUT"] = "#{scrbody}.F05"
+    ENV["AOINTS"] = "#{scrbody}.F08"
+    ENV["MOINTS"] = "#{scrbody}.F09"
+    ENV["DICTNRY"] = "#{scrbody}.F10"
+    ENV["DRTFILE"] = "#{scrbody}.F11"
+    ENV["CIVECTR"] = "#{scrbody}.F12"
+    ENV["CASINTS"] = "#{scrbody}.F13"
+    ENV["CIINTS"] = "#{scrbody}.F14"
+    ENV["WORK15"] = "#{scrbody}.F15"
+    ENV["WORK16"] = "#{scrbody}.F16"
+    ENV["CSFSAVE"] = "#{scrbody}.F17"
+    ENV["FOCKDER"] = "#{scrbody}.F18"
+    ENV["WORK19"] = "#{scrbody}.F19"
+    ENV["DASORT"] = "#{scrbody}.F20"
+    ENV["DFTINTS"] = "#{scrbody}.F21"
+    ENV["DFTGRID"] = "#{scrbody}.F22"
+    ENV["JKFILE"] = "#{scrbody}.F23"
+    ENV["ORDINT"] = "#{scrbody}.F24"
+    ENV["EFPIND"] = "#{scrbody}.F25"
+    ENV["PCMDATA"] = "#{scrbody}.F26"
+    ENV["PCMINTS"] = "#{scrbody}.F27"
+    ENV["MLTPL"] = "#{scrbody}.F28"
+    ENV["MLTPLT"] = "#{scrbody}.F29"
+    ENV["DAFL30"] = "#{scrbody}.F30"
+    ENV["SOINTX"] = "#{scrbody}.F31"
+    ENV["SOINTY"] = "#{scrbody}.F32"
+    ENV["SOINTZ"] = "#{scrbody}.F33"
+    ENV["SORESC"] = "#{scrbody}.F34"
+    ENV["SIMEN"] = "#{scrbody}.simen"
+    ENV["SIMCOR"] = "#{scrbody}.simcor"
+    ENV["GCILIST"] = "#{scrbody}.F37"
+    ENV["HESSIAN"] = "#{scrbody}.F38"
+    ENV["SOCCDAT"] = "#{scrbody}.F40"
+    ENV["AABB41"] = "#{scrbody}.F41"
+    ENV["BBAA42"] = "#{scrbody}.F42"
+    ENV["BBBB43"] = "#{scrbody}.F43"
+    ENV["MCQD50"] = "#{scrbody}.F50"
+    ENV["MCQD51"] = "#{scrbody}.F51"
+    ENV["MCQD52"] = "#{scrbody}.F52"
+    ENV["MCQD53"] = "#{scrbody}.F53"
+    ENV["MCQD54"] = "#{scrbody}.F54"
+    ENV["MCQD55"] = "#{scrbody}.F55"
+    ENV["MCQD56"] = "#{scrbody}.F56"
+    ENV["MCQD57"] = "#{scrbody}.F57"
+    ENV["MCQD58"] = "#{scrbody}.F58"
+    ENV["MCQD59"] = "#{scrbody}.F59"
+    ENV["MCQD60"] = "#{scrbody}.F60"
+    ENV["MCQD61"] = "#{scrbody}.F61"
+    ENV["MCQD62"] = "#{scrbody}.F62"
+    ENV["MCQD63"] = "#{scrbody}.F63"
+    ENV["MCQD64"] = "#{scrbody}.F64"
+    ENV["NMRINT1"] = "#{scrbody}.F61"
+    ENV["NMRINT2"] = "#{scrbody}.F62"
+    ENV["NMRINT3"] = "#{scrbody}.F63"
+    ENV["NMRINT4"] = "#{scrbody}.F64"
+    ENV["NMRINT5"] = "#{scrbody}.F65"
+    ENV["NMRINT6"] = "#{scrbody}.F66"
+    ENV["DCPHFH2"] = "#{scrbody}.F67"
+    ENV["DCPHF21"] = "#{scrbody}.F68"
+    ENV["GVVPT"] = "#{scrbody}.F69"
 
     #    next files are used only during coupled cluster runs, so let's
     #    display the numerous definitions only if they are to be used.
-    ENV["CCREST"] = "#{scrprefix}.F70"
-    ENV["CCDIIS"] = "#{scrprefix}.F71"
-    ENV["CCINTS"] = "#{scrprefix}.F72"
-    ENV["CCT1AMP"] = "#{scrprefix}.F73"
-    ENV["CCT2AMP"] = "#{scrprefix}.F74"
-    ENV["CCT3AMP"] = "#{scrprefix}.F75"
-    ENV["CCVM"] = "#{scrprefix}.F76"
-    ENV["CCVE"] = "#{scrprefix}.F77"
-    ENV["EOMSTAR"] = "#{scrprefix}.F80"
-    ENV["EOMVEC1"] = "#{scrprefix}.F81"
-    ENV["EOMVEC2"] = "#{scrprefix}.F82"
-    ENV["EOMHC1"] = "#{scrprefix}.F83"
-    ENV["EOMHC2"] = "#{scrprefix}.F84"
-    ENV["EOMHHHH"] = "#{scrprefix}.F85"
-    ENV["EOMPPPP"] = "#{scrprefix}.F86"
-    ENV["EOMRAMP"] = "#{scrprefix}.F87"
-    ENV["EOMRTMP"] = "#{scrprefix}.F88"
-    ENV["EOMDG12"] = "#{scrprefix}.F89"
-    ENV["MMPP"] = "#{scrprefix}.F90"
-    ENV["MMHPP"] = "#{scrprefix}.F91"
-    ENV["MMCIVEC"] = "#{scrprefix}.F92"
-    ENV["MMCIVC1"] = "#{scrprefix}.F93"
-    ENV["MMCIITR"] = "#{scrprefix}.F94"
-    ENV["MMNEXM"] = "#{scrprefix}.F95"
-    ENV["MMNEXE"] = "#{scrprefix}.F96"
-    ENV["MMNREXM"] = "#{scrprefix}.F97"
-    ENV["MMNREXE"] = "#{scrprefix}.F98 "
+    ENV["CCREST"] = "#{scrbody}.F70"
+    ENV["CCDIIS"] = "#{scrbody}.F71"
+    ENV["CCINTS"] = "#{scrbody}.F72"
+    ENV["CCT1AMP"] = "#{scrbody}.F73"
+    ENV["CCT2AMP"] = "#{scrbody}.F74"
+    ENV["CCT3AMP"] = "#{scrbody}.F75"
+    ENV["CCVM"] = "#{scrbody}.F76"
+    ENV["CCVE"] = "#{scrbody}.F77"
+    ENV["EOMSTAR"] = "#{scrbody}.F80"
+    ENV["EOMVEC1"] = "#{scrbody}.F81"
+    ENV["EOMVEC2"] = "#{scrbody}.F82"
+    ENV["EOMHC1"] = "#{scrbody}.F83"
+    ENV["EOMHC2"] = "#{scrbody}.F84"
+    ENV["EOMHHHH"] = "#{scrbody}.F85"
+    ENV["EOMPPPP"] = "#{scrbody}.F86"
+    ENV["EOMRAMP"] = "#{scrbody}.F87"
+    ENV["EOMRTMP"] = "#{scrbody}.F88"
+    ENV["EOMDG12"] = "#{scrbody}.F89"
+    ENV["MMPP"] = "#{scrbody}.F90"
+    ENV["MMHPP"] = "#{scrbody}.F91"
+    ENV["MMCIVEC"] = "#{scrbody}.F92"
+    ENV["MMCIVC1"] = "#{scrbody}.F93"
+    ENV["MMCIITR"] = "#{scrbody}.F94"
+    ENV["MMNEXM"] = "#{scrbody}.F95"
+    ENV["MMNEXE"] = "#{scrbody}.F96"
+    ENV["MMNREXM"] = "#{scrbody}.F97"
+    ENV["MMNREXE"] = "#{scrbody}.F98 "
     #
     #     next are for TDHFX code, not used by current GAMESS
     #
-    ENV["OLI201"] = "#{scrprefix}.F201"
-    ENV["OLI202"] = "#{scrprefix}.F202"
-    ENV["OLI203"] = "#{scrprefix}.F203"
-    ENV["OLI204"] = "#{scrprefix}.F204"
-    ENV["OLI205"] = "#{scrprefix}.F205"
-    ENV["OLI206"] = "#{scrprefix}.F206"
-    ENV["OLI207"] = "#{scrprefix}.F207"
-    ENV["OLI208"] = "#{scrprefix}.F208"
-    ENV["OLI209"] = "#{scrprefix}.F209"
-    ENV["OLI210"] = "#{scrprefix}.F210"
-    ENV["OLI211"] = "#{scrprefix}.F211"
-    ENV["OLI212"] = "#{scrprefix}.F212"
-    ENV["OLI213"] = "#{scrprefix}.F213"
-    ENV["OLI214"] = "#{scrprefix}.F214"
-    ENV["OLI215"] = "#{scrprefix}.F215"
-    ENV["OLI216"] = "#{scrprefix}.F216"
-    ENV["OLI217"] = "#{scrprefix}.F217"
-    ENV["OLI218"] = "#{scrprefix}.F218"
-    ENV["OLI219"] = "#{scrprefix}.F219"
-    ENV["OLI220"] = "#{scrprefix}.F220"
-    ENV["OLI221"] = "#{scrprefix}.F221"
-    ENV["OLI222"] = "#{scrprefix}.F222"
-    ENV["OLI223"] = "#{scrprefix}.F223"
-    ENV["OLI224"] = "#{scrprefix}.F224"
-    ENV["OLI225"] = "#{scrprefix}.F225"
-    ENV["OLI226"] = "#{scrprefix}.F226"
-    ENV["OLI227"] = "#{scrprefix}.F227"
-    ENV["OLI228"] = "#{scrprefix}.F228"
-    ENV["OLI229"] = "#{scrprefix}.F229"
-    ENV["OLI230"] = "#{scrprefix}.F230"
-    ENV["OLI231"] = "#{scrprefix}.F231"
-    ENV["OLI232"] = "#{scrprefix}.F232"
-    ENV["OLI233"] = "#{scrprefix}.F233"
-    ENV["OLI234"] = "#{scrprefix}.F234"
-    ENV["OLI235"] = "#{scrprefix}.F235"
-    ENV["OLI236"] = "#{scrprefix}.F236"
-    ENV["OLI237"] = "#{scrprefix}.F237"
-    ENV["OLI238"] = "#{scrprefix}.F238"
-    ENV["OLI239"] = "#{scrprefix}.F239"
+    ENV["OLI201"] = "#{scrbody}.F201"
+    ENV["OLI202"] = "#{scrbody}.F202"
+    ENV["OLI203"] = "#{scrbody}.F203"
+    ENV["OLI204"] = "#{scrbody}.F204"
+    ENV["OLI205"] = "#{scrbody}.F205"
+    ENV["OLI206"] = "#{scrbody}.F206"
+    ENV["OLI207"] = "#{scrbody}.F207"
+    ENV["OLI208"] = "#{scrbody}.F208"
+    ENV["OLI209"] = "#{scrbody}.F209"
+    ENV["OLI210"] = "#{scrbody}.F210"
+    ENV["OLI211"] = "#{scrbody}.F211"
+    ENV["OLI212"] = "#{scrbody}.F212"
+    ENV["OLI213"] = "#{scrbody}.F213"
+    ENV["OLI214"] = "#{scrbody}.F214"
+    ENV["OLI215"] = "#{scrbody}.F215"
+    ENV["OLI216"] = "#{scrbody}.F216"
+    ENV["OLI217"] = "#{scrbody}.F217"
+    ENV["OLI218"] = "#{scrbody}.F218"
+    ENV["OLI219"] = "#{scrbody}.F219"
+    ENV["OLI220"] = "#{scrbody}.F220"
+    ENV["OLI221"] = "#{scrbody}.F221"
+    ENV["OLI222"] = "#{scrbody}.F222"
+    ENV["OLI223"] = "#{scrbody}.F223"
+    ENV["OLI224"] = "#{scrbody}.F224"
+    ENV["OLI225"] = "#{scrbody}.F225"
+    ENV["OLI226"] = "#{scrbody}.F226"
+    ENV["OLI227"] = "#{scrbody}.F227"
+    ENV["OLI228"] = "#{scrbody}.F228"
+    ENV["OLI229"] = "#{scrbody}.F229"
+    ENV["OLI230"] = "#{scrbody}.F230"
+    ENV["OLI231"] = "#{scrbody}.F231"
+    ENV["OLI232"] = "#{scrbody}.F232"
+    ENV["OLI233"] = "#{scrbody}.F233"
+    ENV["OLI234"] = "#{scrbody}.F234"
+    ENV["OLI235"] = "#{scrbody}.F235"
+    ENV["OLI236"] = "#{scrbody}.F236"
+    ENV["OLI237"] = "#{scrbody}.F237"
+    ENV["OLI238"] = "#{scrbody}.F238"
+    ENV["OLI239"] = "#{scrbody}.F239"
 
     if $platform == "win"
          if ncpus < 2
@@ -355,7 +360,7 @@ class Molecule
       #  File containing arguments to mpiexec
       procfil = "#{scrprefix}.processes.mpd"
       fp = File.open(procfil, "w")
-      fp.print "-env ENVFIL #{envfil} -n #{ncpus} #{gmsdir}#{sep}gamess.#{gmsvers}.exe\n"
+      fp.print "-env ENVFIL #{envfil} -wdir #{scrdir} -n #{ncpus} #{gmsdir}#{sep}gamess.#{gmsvers}.exe\n"
       fp.close
     end
     
index 81101db..0a55a35 100755 (executable)
@@ -23,14 +23,15 @@ $startup_dir = Dir.pwd
 case RUBY_PLATFORM
   when /mswin|mingw|cygwin|bccwin/
     $platform = "win"
-#      $KCODE="SJIS"
+       Encoding.default_external = "shift_jis"
        $home_directory = ENV['USERPROFILE'].gsub(/\\/, "/")
   when /darwin/
     $platform = "mac"
-#      $KCODE="UTF8"
+       Encoding.default_external = "utf-8"
        $home_directory = ENV['HOME']
   else
     $platform = "other"
+       Encoding.default_external = "locale"
        $home_directory = ENV['HOME']
 end
 
index 63cc920..a7858c7 100755 (executable)
@@ -123,24 +123,24 @@ end
 
 register_menu("View\t-", nil)
 register_menu("View\t^Show Unit Cell", :cmd_show_unit_cell,
-  lambda { |m| [m != nil, m.show_unitcell] } )
+  lambda { |m| [m != nil, m && m.show_unitcell] } )
 register_menu("View\t^Show Hydrogen Atoms", :cmd_show_hydrogens,
-  lambda { |m| [m != nil, m.show_hydrogens] } )
+  lambda { |m| [m != nil, m && m.show_hydrogens] } )
 register_menu("View\t^Show Dummy Atoms", :cmd_show_dummy_atoms,
-  lambda { |m| [m != nil, m.show_dummy_atoms] } )
+  lambda { |m| [m != nil, m && m.show_dummy_atoms] } )
 register_menu("View\t^Show Expanded Atoms", :cmd_show_expanded,
-  lambda { |m| [m != nil, m.show_expanded] } )
+  lambda { |m| [m != nil, m && m.show_expanded] } )
 register_menu("View\t^Show Ellipsoids", :cmd_show_ellipsoids,
-  lambda { |m| [m != nil, m.show_ellipsoids] } )
+  lambda { |m| [m != nil, m && m.show_ellipsoids] } )
 register_menu("View\t^Show Rotation Center", :cmd_show_rotation_center,
-  lambda { |m| [m != nil, m.show_rotation_center] } )
+  lambda { |m| [m != nil, m && m.show_rotation_center] } )
 register_menu("View\t-", nil)
 register_menu("View\t^Show Graphite...", :cmd_show_graphite,
-  lambda { |m| [m != nil, m.show_graphite?] } )
+  lambda { |m| [m != nil, m && m.show_graphite?] } )
 register_menu("View\t-", nil)
 register_menu("View\tAppearance\t^Line", :cmd_line_mode,
-  lambda { |m| [m != nil, m.line_mode] } )
+  lambda { |m| [m != nil, m && m.line_mode] } )
 register_menu("View\tAppearance\t^Ball and Stick", :cmd_ball_and_stick_mode,
-  lambda { |m| [m != nil, !m.line_mode && m.atom_radius < 0.5] } )
+  lambda { |m| [m != nil, m && !m.line_mode && m.atom_radius < 0.5] } )
 register_menu("View\tAppearance\t^Space Filling", :cmd_space_filling_mode,
-  lambda { |m| [m != nil, !m.line_mode && m.atom_radius >= 0.5] } )
+  lambda { |m| [m != nil, m && !m.line_mode && m.atom_radius >= 0.5] } )
index cbafaf4..ca82ef8 100644 (file)
@@ -44,6 +44,7 @@ Get ruby-2.0.0-p353.tar.gz, unpack it, and move the resulting directory ruby-2.0
 $ cd $MOLBY/../ruby-2.0.0-p353
 $ CFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -O2' ./configure --prefix=$PWD/osx-build --with-arch=i386,ppc --disable-shared --with-ext=date --disable-install-rdoc
 $ make && make install
+$ cd enc; ar -r libenc.a *.o; cp libenc.a ../osx-build/lib  #  We need shift_jis.o etc. for encoding support
 
 The osx-build directory contains lib (which contains libruby-static.a) and include (which contains include files). (There are also bin and share directories, but these are not used for building Molby.)
 $ make clean  #  Remove configure files and intermediates; the osx-build directory remains intact
@@ -118,6 +119,7 @@ If you use gcc 4.6 or later, comment out the following line in cygwin/GNUmakefil
 
 $ ./configure --prefix=$PWD/msw-build --disable-shared --with-ext=date --disable-install-rdoc --with-static-linked-ext
 $ make && make install
+$ cp enc/libenc.a msw-build/lib  #  We need this for encoding support
 
 The msw-build directory contains lib (which contains libmsvcrt-ruby200-static.a and libmsvcrt-rubuy200.a) and include (which contains include files). (There are also bin and share directories, but these are not used for building Molby.)
 $ make clean  #  Remove configure files and intermediates; the msw-build directory remains intact
index 1f9a476..213ec07 100755 (executable)
@@ -364,10 +364,14 @@ ConsoleFrame::OnEnterPressed()
                                Molby_showError(status);
                        } else {
                                textCtrl->AppendText(wxT("-->"));
-                               Molby_showRubyValue(val, &valueString);
-                               AssignArray(&valueHistory, &nValueHistory, sizeof(char *), nValueHistory, &valueString);
-                               if (nValueHistory >= MAX_HISTORY_LINES)
-                                       DeleteArray(&valueHistory, &nValueHistory, sizeof(char *), 0, 1, NULL);
+                               status = Molby_showRubyValue(val, &valueString);
+                               if (status != 0) {
+                                       Molby_showError(status);
+                               } else {
+                                       AssignArray(&valueHistory, &nValueHistory, sizeof(char *), nValueHistory, &valueString);
+                                       if (nValueHistory >= MAX_HISTORY_LINES)
+                                               DeleteArray(&valueHistory, &nValueHistory, sizeof(char *), 0, 1, NULL);
+                               }
                        }
                        MyAppCallback_setConsoleColor(0);
                        textCtrl->AppendText(wxT("\n"));
index 37800c5..9c45b40 100755 (executable)
@@ -43,6 +43,7 @@
 #include "wx/process.h"
 #include "wx/utils.h"
 #include "wx/sound.h"
+#include "wx/time.h"
 
 #include "MyApp.h"
 #include "MyDocument.h"
@@ -1238,6 +1239,7 @@ MyApp::CallSubProcess(const char *cmdline, const char *procname, int (*callback)
        char buf[256];
        size_t len, len_total;
        wxString cmdstr(cmdline, WX_DEFAULT_CONV);
+       wxLongLong startTime;
        
        if (m_process != NULL)
                return -1;  //  Another process is already running (CallSubProcess() allows only one subprocess)
@@ -1251,6 +1253,7 @@ MyApp::CallSubProcess(const char *cmdline, const char *procname, int (*callback)
                ShowProgressPanel(buf);
                progress_panel = true;
        }
+       startTime = wxGetUTCTimeMillis();
        
        //  Create log file in the document home directory
 #if LOG_SUBPROCESS
@@ -1342,8 +1345,9 @@ MyApp::CallSubProcess(const char *cmdline, const char *procname, int (*callback)
                                }
                        }
                }
-               if (++count == 100) {
-                       if (progress_panel == false) {
+               if (progress_panel == false) {
+                       ::wxSafeYield(NULL);  //  This seems necessary to get OnEndProcess called
+                       if (++count == 40) {
                                ShowProgressPanel("Running subprocess...");
                                progress_panel = true;
                        }
@@ -1431,7 +1435,7 @@ MyApp::CallSubProcess(const char *cmdline, const char *procname, int (*callback)
                        nn = 0;
                }
 #endif
-               ::wxMilliSleep(10);
+               ::wxMilliSleep(25);
                if (wxGetApp().IsInterrupted() || (callback != NULL && callback != DUMMY_CALLBACK && (callback_result = (*callback)(callback_data)) != 0)) {
                        /*  User interrupt  */
                        int kflag = wxKILL_CHILDREN;
@@ -1894,7 +1898,7 @@ MyAppCallback_executeScriptFromFile(const char *cpath, int *status)
        }
        
        /*  Check the encoding specification, and if present convert it to default encoding  */
-       {
+       if (0) {
                char *lp = script, *eolp;
                int n = 0;
                while (n < 2) {  /*  Check the first two lines  */
index 3e34876..8cf725f 100644 (file)
                                        "-liconv",
                                        "-lfftw3",
                                        "-lruby-static",
+                                       "-lenc",
                                );
                                PRODUCT_NAME = Molby;
                                SDKROOT = macosx10.5;
                                        "-liconv",
                                        "-lfftw3",
                                        "-lruby-static",
+                                       "-lenc",
                                );
                                PRODUCT_NAME = Molby;
                                SDKROOT = macosx10.5;
                                OTHER_LDFLAGS = (
                                        "-lfftw3",
                                        "-lruby-static",
+                                       "-lenc",
                                );
                                PREBINDING = NO;
                                PRODUCT_NAME = Molby_command;
                                OTHER_LDFLAGS = (
                                        "-lfftw3",
                                        "-lruby-static",
+                                       "-lenc",
                                );
                                PREBINDING = NO;
                                PRODUCT_NAME = Molby_command;