make_pattern.cc

00001 /* 
00002    EyeDB Object Database Management System
00003    Copyright (C) 1994-2008 SYSRA
00004    
00005    EyeDB is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009    
00010    EyeDB is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014    
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
00018 */
00019 
00020 /*
00021    Author: Eric Viara <viara@sysra.com>
00022 */
00023 
00024 
00025 static const char old_make_pattern[] =
00026 "#\n"
00027 "# Makefile.%s\n"
00028 "# \n"
00029 "# %s package\n"
00030 "#\n"
00031 "# %s %s"
00032 "#\n"
00033 "\n"
00034 "include $(EYEDBROOT)/share/eyedb/Makefile.eyedb\n"
00035 "\n"
00036 "all: %smthfe$(SO) %smthbe$(SO)\n"
00037 "\n"
00038 "%smthfe$(SO): %smthfe.o $(STUBSDIR)%sstubsfe.o $(STUBSDIR)%s.o $(EXTRALIBS)\n"
00039 "\t$(CXX) $(SO_FLAGS) -o $@ $+"
00040 "\n"
00041 "\n"
00042 "%smthbe$(SO): %smthbe.o $(STUBSDIR)%sstubsbe.o $(STUBSDIR)%s.o $(EXTRALIBS)\n"
00043 "\t$(CXX) $(SO_FLAGS) -o $@ $+"
00044 "\n"
00045 "\n"
00046 "install: all\n"
00047 "\tcp -f %smthfe$(SO) %smthbe$(SO) %s"
00048 "\n";
00049 
00050 static const char make_pattern[] =
00051 "#\n"
00052 "# Makefile.%s\n"
00053 "# \n"
00054 "# %s package\n"
00055 "#\n"
00056 "# Example of template Makefile that can help you to compile\n"
00057 "# the generated C++ file and the template program\n"
00058 "# %s %s"
00059 "#\n"
00060 "\n"
00061 "include %s/Makefile.eyedb\n"
00062 "\n"
00063 "CXXFLAGS += $(EYEDB_CXXFLAGS) $(EYEDB_CPPFLAGS)\n"
00064 "LDFLAGS  += ${EYEDB_LDFLAGS}\n"
00065 "LDLIBS   += ${EYEDB_LDLIBS}\n"
00066 "\n"
00067 "# if you use gcc\n"
00068 "GCC_FLAGS = -Wl,-R$(EYEDB_LIBDIR)\n"
00069 "\n"
00070 "# Example for compiling a client program:\n"
00071 "\n"
00072 "client_program = template_%s\n"
00073 "\n"
00074 "$(client_program): %s.o $(client_program).o\n"
00075 "       $(CXX) $(LDFLAGS) $(GCC_FLAGS) -o $@ $^ $(LDLIBS)\n"
00076 "\n";
00077 
00078 static const char template_pattern[] =
00079 "\n"
00080 "/*\n"
00081 " * Template program for %s package to be compiled with Makefile.%s\n"
00082 " *\n"
00083 " * %s %s"
00084 " */\n"
00085 "\n"
00086 "#include <iostream>\n"
00087 "#include \"%s.h\"\n"
00088 "\n"
00089 "static int usage(const char *prog) {\n"
00090 "  std::cerr << \"usage: \" << prog << \" <dbname>\" << std::endl;\n"
00091 "  return 1;\n"
00092 "}\n"
00093 "\n"
00094 "int main(int argc, char *argv[])\n"
00095 "{\n"
00096 "  %s initializer(argc, argv);\n"
00097 //"  eyedb::init(argc, argv);\n"
00098 //"  %s::init();\n"
00099 "\n"
00100 "  if (argc < 2) {\n"
00101 "    return usage(argv[0]);\n"
00102 "  }\n"
00103 "\n"
00104 "  eyedb::Exception::setMode(eyedb::Exception::ExceptionMode);\n"
00105 "\n"
00106 "  try {\n"
00107 "    eyedb::Connection conn(true);\n"
00108 "\n"
00109 "    %sDatabase db(&conn, argv[1], eyedb::Database::DBRW);\n"
00110 "\n"
00111 "    db.transactionBegin();\n"
00112 "\n"
00113 "    // ----------------------------\n"
00114 "    // perform your operations here\n"
00115 "    // ----------------------------\n"
00116 "\n"
00117 "    db.transactionCommit();\n"
00118 "\n"
00119 "    db.close();\n"
00120 "  }\n"
00121 "  catch(eyedb::Exception &e) {\n"
00122 "    std::cerr << e << std::endl;\n"
00123 "    return 1;\n"
00124 "  }\n"
00125 "\n"
00126 //"  %s::release();\n"
00127 //"  eyedb::release();\n"
00128 "\n"
00129 "  return 0;\n"
00130 "}\n";

Generated on Mon Dec 22 18:15:58 2008 for eyedb by  doxygen 1.5.3