/ Plug initialization routine. */ Language points on initial language name and eventual path. */ Return value is the pointer to the Global structure. */ /
| 144 | /* Return value is the pointer to the Global structure. */ |
| 145 | /***********************************************************************/ |
| 146 | PGLOBAL PlugInit(LPCSTR Language, size_t worksize) |
| 147 | { |
| 148 | PGLOBAL g; |
| 149 | |
| 150 | if (trace(2)) |
| 151 | htrc("PlugInit: Language='%-.256s'\n", |
| 152 | ((!Language) ? "Null" : (char*)Language)); |
| 153 | |
| 154 | try { |
| 155 | g = new GLOBAL; |
| 156 | } catch (...) { |
| 157 | fprintf(stderr, MSG(GLOBAL_ERROR), (int)sizeof(GLOBAL)); |
| 158 | return NULL; |
| 159 | } // end try/catch |
| 160 | |
| 161 | g->Sarea = NULL; |
| 162 | g->Createas = false; |
| 163 | g->Alchecked = 0; |
| 164 | g->Mrr = 0; |
| 165 | g->Activityp = NULL; |
| 166 | g->Xchk = NULL; |
| 167 | g->N = 0; |
| 168 | g->More = 0; |
| 169 | g->Saved_Size = 0; |
| 170 | strcpy(g->Message, ""); |
| 171 | |
| 172 | /*******************************************************************/ |
| 173 | /* Allocate the main work segment. */ |
| 174 | /*******************************************************************/ |
| 175 | if (worksize && AllocSarea(g, worksize)) { |
| 176 | char errmsg[MAX_STR]; |
| 177 | snprintf(errmsg, sizeof(errmsg) - 1, MSG(WORK_AREA), g->Message); |
| 178 | strcpy(g->Message, errmsg); |
| 179 | } // endif Sarea |
| 180 | |
| 181 | g->jump_level = -1; /* New setting to allow recursive call of Plug */ |
| 182 | return(g); |
| 183 | } /* end of PlugInit */ |
| 184 | |
| 185 | /***********************************************************************/ |
| 186 | /* PlugExit: Terminate Plug operations. */ |
no test coverage detected