OSDN Git Service

Experimental command-line tool for Mac platform.
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Thu, 22 Apr 2010 14:50:27 +0000 (14:50 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Thu, 22 Apr 2010 14:50:27 +0000 (14:50 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@29 a2be9bc6-48de-4e38-9406-05402d4bc13c

MolLib/MainView.h
MolLib/Ruby_bind/ruby_bind.c
MolLib/Types.c
MolLib/Types.h
MolLib/cmdtool_stubs.c [new file with mode: 0644]
xcode-build/Molby.xcodeproj/project.pbxproj

index a2d32d6..7ebd38c 100755 (executable)
@@ -20,7 +20,7 @@
 #include "MolLib.h"
 
 /*  The OpenGL header location may be different for different platform  */
-#ifdef __WXMAC__
+#if defined(__WXMAC__) || defined(__CMDMAC__)
 #include <OpenGL/gl.h>
 #include <OpenGL/glu.h>
 #include <GLUT/vvector.h>
index 469d31e..50dcd1d 100644 (file)
@@ -27,7 +27,7 @@
 #include <version.h>  /*  for Ruby version  */
 #include <node.h>     /*  for rb_add_event_hook()  */
 
-#if __WXMAC__
+#if defined(__WXMAC__) || defined(__CMDMAC__)
 #include <signal.h>   /*  for sigaction()  */
 #endif
 
index 1cc7b3c..9e2d920 100755 (executable)
@@ -191,7 +191,7 @@ MatrixGeneralRotation(Mat33 dst, const Vector *v1, const Vector *v2, const Vecto
 
 
 /*  Get the eigenvalue/eigenvector for a real symmetric matrix (3x3)  */
-#ifndef __WXMAC__
+#if !defined(__WXMAC__) && !defined(__CMDMAC__)
 typedef integer        __CLPK_integer;
 typedef logical        __CLPK_logical;
 typedef real           __CLPK_real;
index 8e2de7e..1990396 100755 (executable)
@@ -21,7 +21,7 @@
 #include <stdio.h>
 #include <math.h>
 
-#ifdef __WXMAC__
+#if defined(__WXMAC__) || defined(__CMDMAC__)
 /*  On Mac OS X, CLAPACK is in Accelerate.framework  */
 #include <vecLib/clapack.h>
 #else
diff --git a/MolLib/cmdtool_stubs.c b/MolLib/cmdtool_stubs.c
new file mode 100644 (file)
index 0000000..f5583a4
--- /dev/null
@@ -0,0 +1,259 @@
+/*
+ *  cmdtool_stubs.c
+ *  Molby
+ *
+ *  Created by Toshi Nagata on 10/04/22.
+ *  Copyright 2010 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+/*  Empty stub functions for command-line tool  */
+
+#include "MolLib.h"
+#include "Molby_extern.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <fcntl.h>
+
+Molecule *
+MoleculeCallback_moleculeAtOrderedIndex(int idx)
+{
+       return NULL;
+}
+
+void
+MainViewCallback_setNeedsDisplay(MainView *mview, int flag)
+{
+}
+
+void
+MyAppCallback_beginUndoGrouping(void)
+{
+}
+
+Molecule *
+MoleculeCallback_currentMolecule(void)
+{
+       return NULL;
+}
+
+void
+MoleculeCallback_lockMutex(void *mutex)
+{
+}
+
+void
+MoleculeCallback_unlockMutex(void *mutex)
+{
+}
+
+void
+MyAppCallback_setGlobalSettings(const char *key, const char *value)
+{
+}
+
+void
+MyAppCallback_hideProgressPanel(void)
+{
+}
+
+int
+MyAppCallback_showScriptMessage(const char *fmt, ...)
+{
+       va_list ap;
+       va_start(ap, fmt);
+       return vprintf(fmt, ap);
+}
+
+char *
+MyAppCallback_getDocumentHomeDir(void)
+{
+       char *s;
+       s = getenv("HOME");
+       return (s == NULL ? NULL : strdup(s));
+}
+
+RubyValue
+MyAppCallback_executeScriptFromFile(const char *path, int *status)
+{
+       return 0;
+}
+
+void
+MyAppCallback_setProgressMessage(const char *msg)
+{
+}
+
+int
+MainView_isAtomHidden(MainView *mview, int index)
+{
+       return 0;
+}
+
+int
+MolActionCallback_isUndoRegistrationEnabled(Molecule *mol)
+{
+       return 0;
+}
+
+int
+MyAppCallback_messageBox(const char *message, const char *title, int flags, int icon)
+{
+       return printf("%s\n%s\n", title, message);
+}
+
+void
+MainViewCallback_drawInfoText(MainView *mview, const char *label)
+{
+}
+
+int
+MyAppCallback_checkInterrupt(void)
+{
+       return 0;
+}
+
+char *
+MyAppCallback_getGlobalSettings(const char *key)
+{
+       return NULL;
+}
+
+void
+MyAppCallback_setProgressValue(double dval)
+{
+}
+
+void
+MyAppCallback_showProgressPanel(const char *msg)
+{
+}
+
+int
+MyAppCallback_getTextWithPrompt(const char *prompt, char *buf, int bufsize)
+{
+       buf[0] = 0;
+       return 0;
+}
+
+void
+MainViewCallback_display(MainView *mview)
+{
+}
+
+int
+MolActionCallback_setUndoRegistrationEnabled(Molecule *mol, int flag)
+{
+       return 0;
+}
+
+void
+MoleculeCallback_notifyModification(Molecule *mp, int now_flag)
+{
+}
+
+void
+MyAppCallback_setConsoleColor(int color)
+{
+}
+
+void
+MyAppCallback_errorMessageBox(const char *fmt, ...)
+{
+       va_list ap;
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+}
+
+void
+MyAppCallback_registerScriptMenu(const char *cmd, const char *title)
+{
+}
+
+void
+MyAppCallback_endUndoGrouping(void)
+{
+}
+
+Molecule *
+MoleculeCallback_openNewMolecule(const char *fname)
+{
+       return NULL;
+}
+
+void
+MainView_getCamera(MainView *mview, Vector *outCamera, Vector *outLookAt, Vector *outUp)
+{
+}
+
+void
+RubyDialogInitClass(void)
+{
+}
+
+Molecule *
+MoleculeCallback_moleculeAtIndex(int idx)
+{
+       return NULL;
+}
+
+void
+MoleculeCallback_displayName(Molecule *mol, char *buf, int bufsize)
+{
+       buf[0] = 0;
+}
+
+void
+MoleculeCallback_pathName(Molecule *mol, char *buf, int bufsize)
+{
+       buf[0] = 0;
+}
+
+IntGroup *
+MainView_selectedMO(MainView *mview)
+{
+       return NULL;
+}
+
+void
+MolActionCallback_registerUndo(Molecule *mol, MolAction *action)
+{
+}
+
+int
+main(int argc, const char **argv)
+{
+       int fd;
+       char *wbuf;
+       static const char fname[] = "startup.rb";
+       char *molbydir = getenv("MOLBYDIR");
+       if (molbydir == NULL) {
+               fprintf(stderr, "Please define the environmental variable MOLBYDIR to specify the location of the parameter files and the startup scripts.\n");
+               exit(1);
+       }
+       fd = open(".", O_RDONLY);
+       chdir(molbydir);
+       
+       /*  Read atom display parameters  */
+       if (ElementParameterInitialize("element.par", &wbuf) != 0) {
+               fprintf(stderr, "%s\n", wbuf);
+               free(wbuf);
+       }
+       
+       /*  Read default parameters  */
+       ParameterReadFromFile(gBuiltinParameters, "default.par", &wbuf, NULL);
+       if (wbuf != NULL) {
+               fprintf(stderr, "%s\n", wbuf);
+               free(wbuf);
+       }
+       
+       Molby_startup(fname, molbydir);
+       fchdir(fd);
+       close(fd);
+       
+       ruby_options(argc, argv);
+       ruby_run();
+       return 0;
+}
index 0d591c8..3ec5bd2 100755 (executable)
                E4C0C4960F25734B00161EC2 /* Dcd.c in Sources */ = {isa = PBXBuildFile; fileRef = E4C0C4950F25734B00161EC2 /* Dcd.c */; };
                E4C8CBDF10B83060006C4692 /* MyDocManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C8CBDE10B83060006C4692 /* MyDocManager.cpp */; };
                E4CFBB3B111096CF0081C481 /* amber11 in Resources */ = {isa = PBXBuildFile; fileRef = E4CFBB16111096CF0081C481 /* amber11 */; };
+               E4D5AD6A1180868A00B1D8A4 /* MyVersion.c in Sources */ = {isa = PBXBuildFile; fileRef = E472B7C41087F63200F931F3 /* MyVersion.c */; };
+               E4D5AD6B1180869500B1D8A4 /* MDGraphite.c in Sources */ = {isa = PBXBuildFile; fileRef = E42D8AEF1030193F00C20247 /* MDGraphite.c */; };
+               E4D5AD72118086A100B1D8A4 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E43CCDD10EB20F0F00108D2D /* Accelerate.framework */; };
+               E4D5AD73118086A200B1D8A4 /* AGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E43CCDD20EB20F0F00108D2D /* AGL.framework */; };
+               E4D5AD74118086BF00B1D8A4 /* IntGroup.c in Sources */ = {isa = PBXBuildFile; fileRef = E433CE7C0EC709BD00675985 /* IntGroup.c */; };
+               E4D5AD76118086D500B1D8A4 /* MDCore.c in Sources */ = {isa = PBXBuildFile; fileRef = E42D8AF11030193F00C20247 /* MDCore.c */; };
+               E4D5AD77118086D600B1D8A4 /* MDForce.c in Sources */ = {isa = PBXBuildFile; fileRef = E42D8AF31030193F00C20247 /* MDForce.c */; };
+               E4D5AD78118086D800B1D8A4 /* MDPressure.c in Sources */ = {isa = PBXBuildFile; fileRef = E42D8AF61030193F00C20247 /* MDPressure.c */; };
+               E4D5AD79118086DB00B1D8A4 /* MDSurface.c in Sources */ = {isa = PBXBuildFile; fileRef = E49D17F1107753DF00C4841E /* MDSurface.c */; };
+               E4D5AD7A118086DC00B1D8A4 /* Missing.c in Sources */ = {isa = PBXBuildFile; fileRef = E433CE800EC709BD00675985 /* Missing.c */; };
+               E4D5AD7B118086DE00B1D8A4 /* MolAction.c in Sources */ = {isa = PBXBuildFile; fileRef = E433CE820EC709BD00675985 /* MolAction.c */; };
+               E4D5AD7C118086E300B1D8A4 /* Molecule.c in Sources */ = {isa = PBXBuildFile; fileRef = E433CE840EC709BD00675985 /* Molecule.c */; };
+               E4D5AD7D118086ED00B1D8A4 /* Object.c in Sources */ = {isa = PBXBuildFile; fileRef = E433CE870EC709BD00675985 /* Object.c */; };
+               E4D5AD7E118086EF00B1D8A4 /* Parameter.c in Sources */ = {isa = PBXBuildFile; fileRef = E433CE890EC709BD00675985 /* Parameter.c */; };
+               E4D5AD7F118086F500B1D8A4 /* ruby_bind.c in Sources */ = {isa = PBXBuildFile; fileRef = E433CE760EC7099B00675985 /* ruby_bind.c */; };
+               E4D5AD80118086FA00B1D8A4 /* ruby_md.c in Sources */ = {isa = PBXBuildFile; fileRef = E42D8BB21031BB2900C20247 /* ruby_md.c */; };
+               E4D5AD81118086FB00B1D8A4 /* ruby_types.c in Sources */ = {isa = PBXBuildFile; fileRef = E4299DA60F2A191600780B44 /* ruby_types.c */; };
+               E4D5AD841180870900B1D8A4 /* Types.c in Sources */ = {isa = PBXBuildFile; fileRef = E433CE8D0EC709BD00675985 /* Types.c */; };
+               E4D5AD9C1180890A00B1D8A4 /* Dcd.c in Sources */ = {isa = PBXBuildFile; fileRef = E4C0C4950F25734B00161EC2 /* Dcd.c */; };
+               E4D5ADA611808A2C00B1D8A4 /* cmdtool_stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = E4D5ADA511808A2C00B1D8A4 /* cmdtool_stubs.c */; };
                E4E2D5C510A249820007644A /* GlobalParameterFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4E2D5C410A249820007644A /* GlobalParameterFrame.cpp */; };
                E4E470C910AE6F8600F72B68 /* GlobalParameterFilesFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4E470C810AE6F8600F72B68 /* GlobalParameterFilesFrame.cpp */; };
                E4FFA9050EE960650045EDF9 /* RubyDialogFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4FFA9040EE960650045EDF9 /* RubyDialogFrame.cpp */; };
                E4CBF39510A91ED500C7C74A /* style.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = style.css; path = ../Documents/etc/style.css; sourceTree = SOURCE_ROOT; };
                E4CBF39710A91EDA00C7C74A /* makedoc.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; name = makedoc.rb; path = ../Documents/makedoc.rb; sourceTree = SOURCE_ROOT; };
                E4CFBB16111096CF0081C481 /* amber11 */ = {isa = PBXFileReference; lastKnownFileType = folder; name = amber11; path = build/amber11; sourceTree = "<group>"; };
+               E4D5AD651180852F00B1D8A4 /* Molby_command */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Molby_command; sourceTree = BUILT_PRODUCTS_DIR; };
+               E4D5ADA511808A2C00B1D8A4 /* cmdtool_stubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cmdtool_stubs.c; sourceTree = "<group>"; };
                E4E2D5C310A249820007644A /* GlobalParameterFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GlobalParameterFrame.h; path = ../wxSources/GlobalParameterFrame.h; sourceTree = SOURCE_ROOT; };
                E4E2D5C410A249820007644A /* GlobalParameterFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GlobalParameterFrame.cpp; path = ../wxSources/GlobalParameterFrame.cpp; sourceTree = SOURCE_ROOT; };
                E4E470C710AE6F8600F72B68 /* GlobalParameterFilesFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GlobalParameterFilesFrame.h; path = ../wxSources/GlobalParameterFilesFrame.h; sourceTree = SOURCE_ROOT; };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               E4D5AD631180852F00B1D8A4 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               E4D5AD72118086A100B1D8A4 /* Accelerate.framework in Frameworks */,
+                               E4D5AD73118086A200B1D8A4 /* AGL.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
                        isa = PBXGroup;
                        children = (
                                8D1107320486CEB800E47090 /* Molby.app */,
+                               E4D5AD651180852F00B1D8A4 /* Molby_command */,
                        );
                        name = Products;
                        sourceTree = "<group>";
                                E433CE8B0EC709BD00675985 /* Trackball.c */,
                                E433CE8E0EC709BD00675985 /* Types.h */,
                                E433CE8D0EC709BD00675985 /* Types.c */,
+                               E4D5ADA511808A2C00B1D8A4 /* cmdtool_stubs.c */,
                                E43CCE0F0EB210DD00108D2D /* Ruby_bind */,
                        );
                        name = MolLib;
                        productReference = 8D1107320486CEB800E47090 /* Molby.app */;
                        productType = "com.apple.product-type.application";
                };
+               E4D5AD641180852F00B1D8A4 /* Molby_command */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = E4D5AD691180854D00B1D8A4 /* Build configuration list for PBXNativeTarget "Molby_command" */;
+                       buildPhases = (
+                               E4D5AD621180852F00B1D8A4 /* Sources */,
+                               E4D5AD631180852F00B1D8A4 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Molby_command;
+                       productName = Molby_command;
+                       productReference = E4D5AD651180852F00B1D8A4 /* Molby_command */;
+                       productType = "com.apple.product-type.tool";
+               };
 /* End PBXNativeTarget section */
 
 /* Begin PBXProject section */
                        projectRoot = "";
                        targets = (
                                8D1107260486CEB800E47090 /* Molby */,
+                               E4D5AD641180852F00B1D8A4 /* Molby_command */,
                        );
                };
 /* End PBXProject section */
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               E4D5AD621180852F00B1D8A4 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               E4D5AD6A1180868A00B1D8A4 /* MyVersion.c in Sources */,
+                               E4D5AD6B1180869500B1D8A4 /* MDGraphite.c in Sources */,
+                               E4D5AD74118086BF00B1D8A4 /* IntGroup.c in Sources */,
+                               E4D5AD76118086D500B1D8A4 /* MDCore.c in Sources */,
+                               E4D5AD77118086D600B1D8A4 /* MDForce.c in Sources */,
+                               E4D5AD78118086D800B1D8A4 /* MDPressure.c in Sources */,
+                               E4D5AD79118086DB00B1D8A4 /* MDSurface.c in Sources */,
+                               E4D5AD7A118086DC00B1D8A4 /* Missing.c in Sources */,
+                               E4D5AD7B118086DE00B1D8A4 /* MolAction.c in Sources */,
+                               E4D5AD7C118086E300B1D8A4 /* Molecule.c in Sources */,
+                               E4D5AD7D118086ED00B1D8A4 /* Object.c in Sources */,
+                               E4D5AD7E118086EF00B1D8A4 /* Parameter.c in Sources */,
+                               E4D5AD7F118086F500B1D8A4 /* ruby_bind.c in Sources */,
+                               E4D5AD80118086FA00B1D8A4 /* ruby_md.c in Sources */,
+                               E4D5AD81118086FB00B1D8A4 /* ruby_types.c in Sources */,
+                               E4D5AD841180870900B1D8A4 /* Types.c in Sources */,
+                               E4D5AD9C1180890A00B1D8A4 /* Dcd.c in Sources */,
+                               E4D5ADA611808A2C00B1D8A4 /* cmdtool_stubs.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
 /* End PBXSourcesBuildPhase section */
 
 /* Begin PBXVariantGroup section */
                        };
                        name = Release;
                };
+               E4D5AD671180852F00B1D8A4 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ALWAYS_SEARCH_USER_PATHS = NO;
+                               COPY_PHASE_STRIP = NO;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               HEADER_SEARCH_PATHS = "$(HOME)/Development/ruby-1.8.7-static";
+                               INSTALL_PATH = /usr/local/bin;
+                               LIBRARY_SEARCH_PATHS = "$(HOME)/Development/ruby-1.8.7-static";
+                               OTHER_CFLAGS = "-D__CMDMAC__=1";
+                               OTHER_LDFLAGS = "-lruby-static";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = Molby_command;
+                       };
+                       name = Debug;
+               };
+               E4D5AD681180852F00B1D8A4 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ALWAYS_SEARCH_USER_PATHS = NO;
+                               COPY_PHASE_STRIP = YES;
+                               DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               GCC_MODEL_TUNING = G5;
+                               HEADER_SEARCH_PATHS = "$(HOME)/Development/ruby-1.8.7-static";
+                               INSTALL_PATH = /usr/local/bin;
+                               LIBRARY_SEARCH_PATHS = "$(HOME)/Development/ruby-1.8.7-static";
+                               OTHER_CFLAGS = "-D__CMDMAC__=1";
+                               OTHER_LDFLAGS = "-lruby-static";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = Molby_command;
+                               ZERO_LINK = NO;
+                       };
+                       name = Release;
+               };
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
                        defaultConfigurationIsVisible = 0;
                        defaultConfigurationName = Release;
                };
+               E4D5AD691180854D00B1D8A4 /* Build configuration list for PBXNativeTarget "Molby_command" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               E4D5AD671180852F00B1D8A4 /* Debug */,
+                               E4D5AD681180852F00B1D8A4 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
 /* End XCConfigurationList section */
        };
        rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;