Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Examples  

sourcegenerator.h

Go to the documentation of this file.
00001 
00002 //
00003 // YASA source generator
00004 //
00005 // Project: Yasa 2
00006 // Author : Jan Blumenthal
00007 // Start  : 2002/02/28
00008 // $Header: /sources/yasa/yasagui/sourcegenerator.h,v 1.6 2003/01/30 09:08:08 bj Exp $
00009 //
00011 //
00012 // This program is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU General Public License as published by
00014 // the Free Software Foundation; either version 2 of the License, or
00015 // (at your option) any later version.
00016 //
00017 // This program is distributed in the hope that it will be useful,
00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 // GNU General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU General Public License
00023 // along with this program (See the included file COPYING);
00024 // if not, write to the Free Software Foundation, Inc.,
00025 // 675 Mass Ave, Cambridge, MA 02139, USA.
00026 //
00028 #ifndef YASAGUI_SOURCE_GENERATOR_INCLUDE
00029 #define YASAGUI_SOURCE_GENERATOR_INCLUDE
00030 
00031 #include <sys/stat.h>
00032 #include <qdatetime.h>
00033 
00035 class YProject;
00036 class YOutput;
00037 
00038 
00041 #define SOURCE_PROJECTCONFIG_NAME           "yasa_projectconfig.h"
00042 #define SOURCE_EXECUTIVE_NAME               "yasa_projectexecutive.h"
00043 #define SOURCE_SCHEDULERS_NAME              "yasa_projectschedulers.h"
00044 #define SOURCE_TASKSET_HEADER_NAME          "yasa_projecttaskset.h"
00045 #define SOURCE_TASKSET_SOURCE_NAME          "yasa_projecttaskset.c"
00046 #define SOURCE_FILES                        "files"
00047 #define SOURCE_MAKEFILE_NAME                "Makefile"
00048 #define SOURCE_MAKEFILE_PROJECT_NAME        "Makefile.project"
00049 #define SOURCE_MAKEFILE_SCHEDULERS_NAME     "Makefile.schedulers"
00050 #define SOURCE_RUNIT_NAME                   "runit"
00051 #define SOURCE_CLEANUP_NAME                 "cleanup"
00052 #define SOURCE_UNINSTALL_NAME               "uninstall"
00053 #define SOURCE_RUNPROJECT_NAME              "runproject"
00054 #define SOURCE_CVSIGNORE_NAME               "cvsignore"
00055 #define SOURCE_CVSIGNORE_FINAL_NAME         ".cvsignore"
00056 
00057 
00058 
00061 #define SG_COMMENT_LINE                     "
00062 #define SG_SCRIPT_STARTUP                   "#!/bin/sh"
00063 #define SG_SCRIPT_RUNPROJECT                "./runproject"
00064 #define SG_SCRIPT_SHOW_LOGFILE              "cat \"%1\" && echo \"Press Ctrl+d to exit\" && cat"
00065 #define SG_MAKE_COMMAND_SIMULATE            "simulate"
00066 #define SG_MAKE_COMMAND_CLEANUP             "clean"
00067 #define SG_MAKE_COMMAND_UNINSTALL           "uninstall"
00068 #define SG_COMMENT_START                    "// "
00069 #define SG_IMPORTANT_COMMENT                "/* %1 */"
00070 #define SG_BRACE_OPENED                     "{"
00071 #define SG_BRACE_CLOSED                     "}"
00072 #define SG_TAB                              "\t"
00073 #define SG_SEMICOLON                        ";"
00074 #define SG_OBJECT_EXTENSION                 "o"                     // "hello.o"
00075 #define SG_LOGGING_SIZE                     100000
00076 #define SG_DEFAULT_ENVIRONMENTATTR_NAME     "environmentattr"
00077 #define SG_DEFAULT_SCHEDULERATTR_NAME       "schedulerattr"
00078 #define SG_DEFAULT_THREADATTR_NAME          "threadattr"
00079 #define SG_DEFAULT_RESOURCEACTION_NAME      "resourceactions"
00080 #define SG_DEFAULT_RESUMETIME_NAME          "resumetimes"
00081 #define SG_DEFAULT_MUTEXATTR_NAME           "mutexattr"
00082 #define SG_DEFAULT_MUTEXID_NAME             "MUTEXID"
00083 #define SG_FUNCTION_INIT                    "extern void* %1(void* param, void **userdata);"
00084 #define SG_FUNCTION_EXECUTE                 "extern void* %1(void **userdata);"
00085 #define SG_FUNCTION_CLEANUP                 "extern void  %1(void **userdata);"
00086 
00087 #define SG_SHELLVAR_YASA                    "export YASA=\"%1\""
00088 #define SG_SHELLVAR_PROJECTDIR              "export YASA_PROJECTDIR=\"%1\""
00089 #define SG_SHELLVAR_PROJECTFILENAME         "export YASA_PROJECTFILENAME=\"%1\""
00090 #define SG_SHELLVAR_WORKDIR                 "export YASA_WORKDIR=\"%1\""
00091 #define SG_SHELLVAR_EXECUTIVE               "export YASA_EXECUTIVE=\"%1\""
00092 #define SG_SHELLVAR_EXECUTIVEDIR            "export YASA_EXECUTIVEDIR=\"%1\""   // $1/executives/$4
00093 #define SG_SHELLVAR_SCHEDULERS              "export YASA_SCHEDULERS="
00094 #define SG_SHELLVAR_LOGFILE                 "export YASA_LOGFILE=\"%1\""
00095 #define SG_SHELLVAR_CFLAGS                  "export YASA_CFLAGS=\"-D__YASA__ %1\""
00096 #define SG_SHELLVAR_CFILES                  "export YASA_CFILES="
00097 #define SG_SHELLVAR_OFILES                  "export YASA_OFILES="
00098 
00099 
00100 
00101 
00103 class YSourceGenerator
00104 {
00105     YEnvironment    *environment;
00106     YOutput         *output;
00107 public:             YSourceGenerator(YEnvironment *e, YOutput *o) :
00108                     environment(e),
00109                     output(o)
00110                     {
00111                         if (!o)
00112                             qWarning("YSourceGenerator::YSourceGenerator() called with illegal arguments!");
00113                     }
00114     int             PrepareWorkProject();
00115     int             WriteHeader(YSourceFile &file, const QString &description);
00116     int             WriteProjectConfig(YSourceFile &file);
00117     int             WriteExecutive(YSourceFile &file);
00118     int             WriteSchedulers(YSourceFile &file);
00119     int             WriteTaskSetHeader(YSourceFile &file);
00120     int             WriteTaskSetSource(YSourceFile &file);
00121     int             CreateProjectSources();
00122     void            GetMutexProtocolInfo(int protocol, QString &name, QString &comment);
00123     void            GetResourceActionInfo(int action, QString &param);
00124     QString&        ConvertToValidLabelName(QString &name);
00125     QString         ConvertToValidYasaName(const QString &name);
00126     QString         GetTaskTypeInfo(YTask *task);
00127     QString         GetDeadlineBehaviour(YTask *task);
00128     int             CreateScriptFile(const QString &projectdir, const QString &workdir, const QString &command, const QString &filename);
00129     int             CopyProjectFile(const QString &filename);
00130 };
00131 
00132 
00134 #endif                                                          // ifndef YASAGUI_SOURCE_GENERATOR_INCLUDE

Generated on Thu Feb 13 23:43:55 2003 for Yasa by doxygen1.3-rc3