The world's most popular open source database
00001 /* Copyright (C) 2003 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00016 00017 #ifndef NDBMAIN_H 00018 #define NDBMAIN_H 00019 00020 #if defined NDB_SOFTOSE || defined NDB_OSE 00021 #include <ose.h> 00022 #include <shell.h> 00023 00024 /* Define an OSE_PROCESS that can be started from osemain.con */ 00025 #define NDB_MAIN(name) \ 00026 int main_ ## name(int argc, const char** argv); \ 00027 OS_PROCESS(name){ \ 00028 main_ ## name(0, 0); \ 00029 stop(current_process()); \ 00030 exit(0); \ 00031 } \ 00032 int main_ ## name(int argc, const char** argv) 00033 00034 /* Define an function that can be started from the command line */ 00035 #define NDB_COMMAND(name, str_name, syntax, description, stacksize) \ 00036 int main_ ## name(int argc, const char** argv); \ 00037 \ 00038 static int run_ ## name(int argc, char *argv[]){ \ 00039 return main_ ## name (argc, argv); \ 00040 } \ 00041 \ 00042 OS_PROCESS(init_ ## name){ \ 00043 shell_add_cmd_attrs(str_name, syntax, description, \ 00044 run_ ## name, OS_PRI_PROC, 25, stacksize); \ 00045 stop(current_process()); \ 00046 return; \ 00047 } \ 00048 \ 00049 int main_ ## name(int argc, const char** argv) 00050 00051 00052 00053 00054 #else 00055 00056 #define NDB_MAIN(name) \ 00057 int main(int argc, const char** argv) 00058 00059 #define NDB_COMMAND(name, str_name, syntax, description, stacksize) \ 00060 int main(int argc, const char** argv) 00061 00062 00063 #endif 00064 00065 00066 #endif
1.4.7

