00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 extern "C" {
00013 #ifndef UNDER_CE
00014 #include <stdio.h>
00015 #endif
00016 #include <stdlib.h>
00017 #include <string.h>
00018 }
00019
00020 #include "emc.hh"
00021 #include "inifile.h"
00022 #include "initool.hh"
00023 #include "emcglb.h"
00024
00025
00026 static INIFILE *toolInifile = 0;
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 static int loadTool()
00041 {
00042 int retval = 0;
00043 const char *inistring;
00044
00045 if (NULL != (inistring = toolInifile->find("TOOL_TABLE", "EMCIO")))
00046 {
00047 if (0 != emcToolSetToolTableFile(inistring))
00048 {
00049 rcs_print("bad return value from emcToolSetToolTableFile\n");
00050 retval = -1;
00051 }
00052 }
00053
00054
00055 return retval;
00056 }
00057
00058
00059
00060
00061
00062
00063 int iniTool(const char *filename)
00064 {
00065 int retval = 0;
00066
00067 toolInifile = new INIFILE;
00068
00069 if (-1 == toolInifile->open(filename))
00070 {
00071 return -1;
00072 }
00073
00074
00075 if (0 != loadTool())
00076 {
00077 retval = -1;
00078 }
00079
00080
00081 toolInifile->close();
00082 delete toolInifile;
00083
00084 return retval;
00085 }
00086
00087
00088
00089 int emcToolSetToolTableFile(const char *filename)
00090 {
00091 strcpy(TOOL_TABLE_FILE, filename);
00092
00093 return 0;
00094 }