| 1 |
// ---------------------------------------------------------------------------- |
| 2 |
// Copyright (C) 2014 |
| 3 |
// David Freese, W1HKJ |
| 4 |
// |
| 5 |
// This file is part of flmsg |
| 6 |
// |
| 7 |
// flrig is free software; you can redistribute it and/or modify |
| 8 |
// it under the terms of the GNU General Public License as published by |
| 9 |
// the Free Software Foundation; either version 3 of the License, or |
| 10 |
// (at your option) any later version. |
| 11 |
// |
| 12 |
// flrig is distributed in the hope that it will be useful, |
| 13 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
// GNU General Public License for more details. |
| 16 |
// |
| 17 |
// You should have received a copy of the GNU General Public License |
| 18 |
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
// ---------------------------------------------------------------------------- |
| 20 |
|
| 21 |
#include <stdlib.h> |
| 22 |
#include <iostream> |
| 23 |
#include <fstream> |
| 24 |
#include <cstring> |
| 25 |
#include <ctime> |
| 26 |
#include <sys/types.h> |
| 27 |
#include <sys/stat.h> |
| 28 |
#include <stdio.h> |
| 29 |
#include <errno.h> |
| 30 |
|
| 31 |
#include <FL/Fl.H> |
| 32 |
#include <FL/Enumerations.H> |
| 33 |
#include <FL/Fl_Window.H> |
| 34 |
#include <FL/Fl_Button.H> |
| 35 |
#include <FL/Fl_Group.H> |
| 36 |
#include <FL/Fl_Sys_Menu_Bar.H> |
| 37 |
#include <FL/x.H> |
| 38 |
#include <FL/Fl_Help_Dialog.H> |
| 39 |
#include <FL/Fl_Menu_Item.H> |
| 40 |
#include <FL/Fl_File_Icon.H> |
| 41 |
|
| 42 |
#include "config.h" |
| 43 |
#include "flmsg_config.h" |
| 44 |
|
| 45 |
#include "flmsg.h" |
| 46 |
#include "templates.h" |
| 47 |
#include "debug.h" |
| 48 |
#include "util.h" |
| 49 |
#include "gettext.h" |
| 50 |
#include "flmsg_dialog.h" |
| 51 |
#include "flinput2.h" |
| 52 |
#include "date.h" |
| 53 |
#include "calendar.h" |
| 54 |
#include "icons.h" |
| 55 |
#include "fileselect.h" |
| 56 |
#include "wrap.h" |
| 57 |
#include "status.h" |
| 58 |
#include "parse_xml.h" |
| 59 |
|
| 60 |
#ifdef WIN32 |
| 61 |
# include "flmsgrc.h" |
| 62 |
# include "compat.h" |
| 63 |
# define dirent fl_dirent_no_thanks |
| 64 |
#endif |
| 65 |
|
| 66 |
#include <FL/filename.H> |
| 67 |
#include "dirent-check.h" |
| 68 |
|
| 69 |
#include <FL/x.H> |
| 70 |
#include <FL/Fl_Pixmap.H> |
| 71 |
#include <FL/Fl_Image.H> |
| 72 |
|
| 73 |
using namespace std; |
| 74 |
|
| 75 |
const char mars_ineei_precedent[] = "RPIFM"; |
| 76 |
|
| 77 |
std::string ineei_buff; |
| 78 |
std::string def_mars_ineei_filename = ""; |
| 79 |
std::string base_mars_ineei_filename = ""; |
| 80 |
std::string def_mars_ineei_TemplateName = ""; |
| 81 |
bool using_mars_ineei_template = false; |
| 82 |
|
| 83 |
// mars_ineei fields |
| 84 |
|
| 85 |
std::string mars_ineei_DE = ":de:"; |
| 86 |
std::string mars_ineei_NBR = ":nbr:"; |
| 87 |
std::string mars_ineei_PREC = ":prec:"; |
| 88 |
std::string mars_ineei_DTG = ":dtg:"; |
| 89 |
std::string mars_ineei_FMNAME = ":fmname:"; |
| 90 |
std::string mars_ineei_FMCALL = ":fmcall:"; |
| 91 |
std::string mars_ineei_FMSTATE = ":fmstate:"; |
| 92 |
std::string mars_ineei_TOPOS = ":topos:"; |
| 93 |
std::string mars_ineei_TOCALL = ":tocall:"; |
| 94 |
std::string mars_ineei_TOSTATE = ":tostate:"; |
| 95 |
std::string mars_ineei_INFO1POS = ":info1pos:"; |
| 96 |
std::string mars_ineei_INFO1CALL = ":info1call:"; |
| 97 |
std::string mars_ineei_INFO1STATE = ":info1state:"; |
| 98 |
std::string mars_ineei_INFO2POS = ":info2pos:"; |
| 99 |
std::string mars_ineei_INFO2CALL = ":info2call:"; |
| 100 |
std::string mars_ineei_INFO2STATE = ":info2state:"; |
| 101 |
std::string mars_ineei_INFO3POS = ":info3pos:"; |
| 102 |
std::string mars_ineei_INFO3CALL = ":info3call:"; |
| 103 |
std::string mars_ineei_INFO3STATE = ":info3state:"; |
| 104 |
std::string mars_ineei_INFO4POS = ":info4pos:"; |
| 105 |
std::string mars_ineei_INFO4CALL = ":info4call:"; |
| 106 |
std::string mars_ineei_INFO4STATE = ":info4state:"; |
| 107 |
std::string mars_ineei_INFO5POS = ":info5pos:"; |
| 108 |
std::string mars_ineei_INFO5CALL = ":info5call:"; |
| 109 |
std::string mars_ineei_INFO5STATE = ":info5state:"; |
| 110 |
std::string mars_ineei_INFO6POS = ":info6pos:"; |
| 111 |
std::string mars_ineei_INFO6CALL = ":info6call:"; |
| 112 |
std::string mars_ineei_INFO6STATE = ":info6state:"; |
| 113 |
std::string mars_ineei_INFO7POS = ":info7pos:"; |
| 114 |
std::string mars_ineei_INFO7CALL = ":info7call:"; |
| 115 |
std::string mars_ineei_INFO7STATE = ":info7state:"; |
| 116 |
std::string mars_ineei_INFO8POS = ":info8pos:"; |
| 117 |
std::string mars_ineei_INFO8CALL = ":info8call:"; |
| 118 |
std::string mars_ineei_INFO8STATE = ":info8state:"; |
| 119 |
std::string mars_ineei_INFO9POS = ":info9pos:"; |
| 120 |
std::string mars_ineei_INFO9CALL = ":info9call:"; |
| 121 |
std::string mars_ineei_INFO9STATE = ":info9state:"; |
| 122 |
std::string mars_ineei_INFO10POS = ":info10pos:"; |
| 123 |
std::string mars_ineei_INFO10CALL = ":info10call:"; |
| 124 |
std::string mars_ineei_INFO10STATE = ":info10state:"; |
| 125 |
std::string mars_ineei_INCIDENT = ":incident:"; |
| 126 |
std::string mars_ineei_REF = ":ref:"; |
| 127 |
std::string mars_ineei_STATE = ":state:"; |
| 128 |
std::string mars_ineei_1A_INCIDENT = ":1a_incident:"; |
| 129 |
std::string mars_ineei_1A_LOCATION = ":1a_location:"; |
| 130 |
std::string mars_ineei_1A_TIME = ":1a_time:"; |
| 131 |
std::string mars_ineei_1B_MEDFACSTS = ":1b_medfacsts:"; |
| 132 |
std::string mars_ineei_1C_TRNPSTS = ":1c_trnpsts:"; |
| 133 |
std::string mars_ineei_1D_DAMAGE = ":1d_damage:"; |
| 134 |
std::string mars_ineei_1E_UTILSTS = ":1e_utilsts:"; |
| 135 |
std::string mars_ineei_1F_COMMSTS = ":1f_commsts:"; |
| 136 |
std::string mars_ineei_1G_INFOSRC = ":1g_infosrc:"; |
| 137 |
std::string mars_ineei_1G_INFOTIME = ":1g_infotime:"; |
| 138 |
std::string mars_ineei_1H_REMARKS = ":1h_remarks:"; |
| 139 |
|
| 140 |
std::string s_mars_ineei_DE; |
| 141 |
std::string s_mars_ineei_NBR; |
| 142 |
std::string s_mars_ineei_PREC = "R"; |
| 143 |
std::string s_mars_ineei_DTG; |
| 144 |
std::string s_mars_ineei_FMNAME; |
| 145 |
std::string s_mars_ineei_FMCALL; |
| 146 |
std::string s_mars_ineei_FMSTATE; |
| 147 |
std::string s_mars_ineei_TOPOS; |
| 148 |
std::string s_mars_ineei_TOCALL; |
| 149 |
std::string s_mars_ineei_TOSTATE; |
| 150 |
std::string s_mars_ineei_INFO1POS; |
| 151 |
std::string s_mars_ineei_INFO1CALL; |
| 152 |
std::string s_mars_ineei_INFO1STATE; |
| 153 |
std::string s_mars_ineei_INFO2POS; |
| 154 |
std::string s_mars_ineei_INFO2CALL; |
| 155 |
std::string s_mars_ineei_INFO2STATE; |
| 156 |
std::string s_mars_ineei_INFO3POS; |
| 157 |
std::string s_mars_ineei_INFO3CALL; |
| 158 |
std::string s_mars_ineei_INFO3STATE; |
| 159 |
std::string s_mars_ineei_INFO4POS; |
| 160 |
std::string s_mars_ineei_INFO4CALL; |
| 161 |
std::string s_mars_ineei_INFO4STATE; |
| 162 |
std::string s_mars_ineei_INFO5POS; |
| 163 |
std::string s_mars_ineei_INFO5CALL; |
| 164 |
std::string s_mars_ineei_INFO5STATE; |
| 165 |
std::string s_mars_ineei_INFO6POS; |
| 166 |
std::string s_mars_ineei_INFO6CALL; |
| 167 |
std::string s_mars_ineei_INFO6STATE; |
| 168 |
std::string s_mars_ineei_INFO7POS; |
| 169 |
std::string s_mars_ineei_INFO7CALL; |
| 170 |
std::string s_mars_ineei_INFO7STATE; |
| 171 |
std::string s_mars_ineei_INFO8POS; |
| 172 |
std::string s_mars_ineei_INFO8CALL; |
| 173 |
std::string s_mars_ineei_INFO8STATE; |
| 174 |
std::string s_mars_ineei_INFO9POS; |
| 175 |
std::string s_mars_ineei_INFO9CALL; |
| 176 |
std::string s_mars_ineei_INFO9STATE; |
| 177 |
std::string s_mars_ineei_INFO10POS; |
| 178 |
std::string s_mars_ineei_INFO10CALL; |
| 179 |
std::string s_mars_ineei_INFO10STATE; |
| 180 |
std::string s_mars_ineei_INCIDENT; |
| 181 |
std::string s_mars_ineei_REF; |
| 182 |
std::string s_mars_ineei_STATE; |
| 183 |
std::string s_mars_ineei_1A_INCIDENT; |
| 184 |
std::string s_mars_ineei_1A_LOCATION; |
| 185 |
std::string s_mars_ineei_1A_TIME; |
| 186 |
std::string s_mars_ineei_1B_MEDFACSTS; |
| 187 |
std::string s_mars_ineei_1C_TRNPSTS; |
| 188 |
std::string s_mars_ineei_1D_DAMAGE; |
| 189 |
std::string s_mars_ineei_1E_UTILSTS; |
| 190 |
std::string s_mars_ineei_1F_COMMSTS; |
| 191 |
std::string s_mars_ineei_1G_INFOSRC; |
| 192 |
std::string s_mars_ineei_1G_INFOTIME; |
| 193 |
std::string s_mars_ineei_1H_REMARKS; |
| 194 |
|
| 195 |
void cb_mars_ineei_SetDTG() |
| 196 |
{ |
| 197 |
txt_mars_ineei_DTG->value(szDateTime()); |
| 198 |
} |
| 199 |
|
| 200 |
void clear_mars_ineei_fields() |
| 201 |
{ |
| 202 |
s_mars_ineei_DE.clear(); |
| 203 |
s_mars_ineei_NBR.clear(); |
| 204 |
s_mars_ineei_PREC = "M"; |
| 205 |
s_mars_ineei_DTG.clear(); |
| 206 |
s_mars_ineei_FMNAME.clear(); |
| 207 |
s_mars_ineei_FMCALL.clear(); |
| 208 |
s_mars_ineei_FMSTATE.clear(); |
| 209 |
s_mars_ineei_TOPOS.clear(); |
| 210 |
s_mars_ineei_TOCALL.clear(); |
| 211 |
s_mars_ineei_TOSTATE.clear(); |
| 212 |
s_mars_ineei_INFO1POS.clear(); |
| 213 |
s_mars_ineei_INFO1CALL.clear(); |
| 214 |
s_mars_ineei_INFO1STATE.clear(); |
| 215 |
s_mars_ineei_INFO2POS.clear(); |
| 216 |
s_mars_ineei_INFO2CALL.clear(); |
| 217 |
s_mars_ineei_INFO2STATE.clear(); |
| 218 |
s_mars_ineei_INFO3POS.clear(); |
| 219 |
s_mars_ineei_INFO3CALL.clear(); |
| 220 |
s_mars_ineei_INFO3STATE.clear(); |
| 221 |
s_mars_ineei_INFO4POS.clear(); |
| 222 |
s_mars_ineei_INFO4CALL.clear(); |
| 223 |
s_mars_ineei_INFO4STATE.clear(); |
| 224 |
s_mars_ineei_INFO5POS.clear(); |
| 225 |
s_mars_ineei_INFO5CALL.clear(); |
| 226 |
s_mars_ineei_INFO5STATE.clear(); |
| 227 |
s_mars_ineei_INFO6POS.clear(); |
| 228 |
s_mars_ineei_INFO6CALL.clear(); |
| 229 |
s_mars_ineei_INFO6STATE.clear(); |
| 230 |
s_mars_ineei_INFO7POS.clear(); |
| 231 |
s_mars_ineei_INFO7CALL.clear(); |
| 232 |
s_mars_ineei_INFO7STATE.clear(); |
| 233 |
s_mars_ineei_INFO8POS.clear(); |
| 234 |
s_mars_ineei_INFO8CALL.clear(); |
| 235 |
s_mars_ineei_INFO8STATE.clear(); |
| 236 |
s_mars_ineei_INFO9POS.clear(); |
| 237 |
s_mars_ineei_INFO9CALL.clear(); |
| 238 |
s_mars_ineei_INFO9STATE.clear(); |
| 239 |
s_mars_ineei_INFO10POS.clear(); |
| 240 |
s_mars_ineei_INFO10CALL.clear(); |
| 241 |
s_mars_ineei_INFO10STATE.clear(); |
| 242 |
s_mars_ineei_INCIDENT.clear(); |
| 243 |
s_mars_ineei_REF.clear(); |
| 244 |
s_mars_ineei_STATE.clear(); |
| 245 |
s_mars_ineei_1A_INCIDENT.clear(); |
| 246 |
s_mars_ineei_1A_LOCATION.clear(); |
| 247 |
s_mars_ineei_1A_TIME.clear(); |
| 248 |
s_mars_ineei_1B_MEDFACSTS.clear(); |
| 249 |
s_mars_ineei_1C_TRNPSTS.clear(); |
| 250 |
s_mars_ineei_1D_DAMAGE.clear(); |
| 251 |
s_mars_ineei_1E_UTILSTS.clear(); |
| 252 |
s_mars_ineei_1F_COMMSTS.clear(); |
| 253 |
s_mars_ineei_1G_INFOSRC.clear(); |
| 254 |
s_mars_ineei_1G_INFOTIME.clear(); |
| 255 |
s_mars_ineei_1H_REMARKS.clear(); |
| 256 |
} |
| 257 |
|
| 258 |
bool check_mars_ineei_fields() |
| 259 |
{ |
| 260 |
std::string temp; |
| 261 |
if (s_mars_ineei_DE != txt_mars_ineei_DE->value()) return true; |
| 262 |
if (s_mars_ineei_NBR != txt_mars_ineei_NBR->value()) return true; |
| 263 |
temp = mars_ineei_precedent[sel_mars_ineei_PREC->index()]; |
| 264 |
if (s_mars_ineei_PREC != temp) return true; |
| 265 |
if (s_mars_ineei_DTG != txt_mars_ineei_DTG->value()) return true; |
| 266 |
if (s_mars_ineei_FMNAME != txt_mars_ineei_FMNAME->value()) return true; |
| 267 |
if (s_mars_ineei_FMCALL != txt_mars_ineei_FMCALL->value()) return true; |
| 268 |
if (s_mars_ineei_FMSTATE != txt_mars_ineei_FMSTATE->value()) return true; |
| 269 |
if (s_mars_ineei_TOPOS != txt_mars_ineei_TOPOS->value()) return true; |
| 270 |
if (s_mars_ineei_TOCALL != txt_mars_ineei_TOCALL->value()) return true; |
| 271 |
if (s_mars_ineei_TOSTATE != txt_mars_ineei_TOSTATE->value()) return true; |
| 272 |
if (s_mars_ineei_INFO1POS != txt_mars_ineei_INFO1POS->value()) return true; |
| 273 |
if (s_mars_ineei_INFO1CALL != txt_mars_ineei_INFO1CALL->value()) return true; |
| 274 |
if (s_mars_ineei_INFO1STATE != txt_mars_ineei_INFO1STATE->value()) return true; |
| 275 |
if (s_mars_ineei_INFO2POS != txt_mars_ineei_INFO2POS->value()) return true; |
| 276 |
if (s_mars_ineei_INFO2CALL != txt_mars_ineei_INFO2CALL->value()) return true; |
| 277 |
if (s_mars_ineei_INFO2STATE != txt_mars_ineei_INFO2STATE->value()) return true; |
| 278 |
if (s_mars_ineei_INFO3POS != txt_mars_ineei_INFO3POS->value()) return true; |
| 279 |
if (s_mars_ineei_INFO3CALL != txt_mars_ineei_INFO3CALL->value()) return true; |
| 280 |
if (s_mars_ineei_INFO3STATE != txt_mars_ineei_INFO3STATE->value()) return true; |
| 281 |
if (s_mars_ineei_INFO4POS != txt_mars_ineei_INFO4POS->value()) return true; |
| 282 |
if (s_mars_ineei_INFO4CALL != txt_mars_ineei_INFO4CALL->value()) return true; |
| 283 |
if (s_mars_ineei_INFO4STATE != txt_mars_ineei_INFO4STATE->value()) return true; |
| 284 |
if (s_mars_ineei_INFO5POS != txt_mars_ineei_INFO5POS->value()) return true; |
| 285 |
if (s_mars_ineei_INFO5CALL != txt_mars_ineei_INFO5CALL->value()) return true; |
| 286 |
if (s_mars_ineei_INFO5STATE != txt_mars_ineei_INFO5STATE->value()) return true; |
| 287 |
if (s_mars_ineei_INFO6POS != txt_mars_ineei_INFO6POS->value()) return true; |
| 288 |
if (s_mars_ineei_INFO6CALL != txt_mars_ineei_INFO6CALL->value()) return true; |
| 289 |
if (s_mars_ineei_INFO6STATE != txt_mars_ineei_INFO6STATE->value()) return true; |
| 290 |
if (s_mars_ineei_INFO7POS != txt_mars_ineei_INFO7POS->value()) return true; |
| 291 |
if (s_mars_ineei_INFO7CALL != txt_mars_ineei_INFO7CALL->value()) return true; |
| 292 |
if (s_mars_ineei_INFO7STATE != txt_mars_ineei_INFO7STATE->value()) return true; |
| 293 |
if (s_mars_ineei_INFO8POS != txt_mars_ineei_INFO8POS->value()) return true; |
| 294 |
if (s_mars_ineei_INFO8CALL != txt_mars_ineei_INFO8CALL->value()) return true; |
| 295 |
if (s_mars_ineei_INFO8STATE != txt_mars_ineei_INFO8STATE->value()) return true; |
| 296 |
if (s_mars_ineei_INFO9POS != txt_mars_ineei_INFO9POS->value()) return true; |
| 297 |
if (s_mars_ineei_INFO9CALL != txt_mars_ineei_INFO9CALL->value()) return true; |
| 298 |
if (s_mars_ineei_INFO9STATE != txt_mars_ineei_INFO9STATE->value()) return true; |
| 299 |
if (s_mars_ineei_INFO10POS != txt_mars_ineei_INFO10POS->value()) return true; |
| 300 |
if (s_mars_ineei_INFO10CALL != txt_mars_ineei_INFO10CALL->value()) return true; |
| 301 |
if (s_mars_ineei_INFO10STATE != txt_mars_ineei_INFO10STATE->value()) return true; |
| 302 |
if (s_mars_ineei_INCIDENT != txt_mars_ineei_INCIDENT->value()) return true; |
| 303 |
if (s_mars_ineei_REF != txt_mars_ineei_REF->value()) return true; |
| 304 |
if (s_mars_ineei_STATE != txt_mars_ineei_STATE->value()) return true; |
| 305 |
if (s_mars_ineei_1A_INCIDENT != txt_mars_ineei_1A_INCIDENT->value()) return true; |
| 306 |
if (s_mars_ineei_1A_LOCATION != txt_mars_ineei_1A_LOCATION->value()) return true; |
| 307 |
if (s_mars_ineei_1A_TIME != txt_mars_ineei_1A_TIME->value()) return true; |
| 308 |
if (s_mars_ineei_1B_MEDFACSTS != txt_mars_ineei_1B_MEDFACSTS->value()) return true; |
| 309 |
if (s_mars_ineei_1C_TRNPSTS != txt_mars_ineei_1C_TRNPSTS->value()) return true; |
| 310 |
if (s_mars_ineei_1D_DAMAGE != txt_mars_ineei_1D_DAMAGE->value()) return true; |
| 311 |
if (s_mars_ineei_1E_UTILSTS != txt_mars_ineei_1E_UTILSTS->value()) return true; |
| 312 |
if (s_mars_ineei_1F_COMMSTS != txt_mars_ineei_1F_COMMSTS->value()) return true; |
| 313 |
if (s_mars_ineei_1G_INFOSRC != txt_mars_ineei_1G_INFOSRC->value()) return true; |
| 314 |
if (s_mars_ineei_1G_INFOTIME != txt_mars_ineei_1G_INFOTIME->value()) return true; |
| 315 |
if (s_mars_ineei_1H_REMARKS != txt_mars_ineei_1H_REMARKS->value()) return true; |
| 316 |
return false; |
| 317 |
} |
| 318 |
|
| 319 |
void update_mars_ineei_fields() |
| 320 |
{ |
| 321 |
s_mars_ineei_DE = txt_mars_ineei_DE->value(); |
| 322 |
s_mars_ineei_NBR = txt_mars_ineei_NBR->value(); |
| 323 |
s_mars_ineei_PREC.clear(); |
| 324 |
s_mars_ineei_PREC = mars_ineei_precedent[sel_mars_ineei_PREC->index()]; |
| 325 |
s_mars_ineei_DTG = txt_mars_ineei_DTG->value(); |
| 326 |
s_mars_ineei_FMNAME = txt_mars_ineei_FMNAME->value(); |
| 327 |
s_mars_ineei_FMCALL = txt_mars_ineei_FMCALL->value(); |
| 328 |
s_mars_ineei_FMSTATE = txt_mars_ineei_FMSTATE->value(); |
| 329 |
s_mars_ineei_TOPOS = txt_mars_ineei_TOPOS->value(); |
| 330 |
s_mars_ineei_TOCALL = txt_mars_ineei_TOCALL->value(); |
| 331 |
s_mars_ineei_TOSTATE = txt_mars_ineei_TOSTATE->value(); |
| 332 |
s_mars_ineei_INFO1POS = txt_mars_ineei_INFO1POS->value(); |
| 333 |
s_mars_ineei_INFO1CALL = txt_mars_ineei_INFO1CALL->value(); |
| 334 |
s_mars_ineei_INFO1STATE = txt_mars_ineei_INFO1STATE->value(); |
| 335 |
s_mars_ineei_INFO2POS = txt_mars_ineei_INFO2POS->value(); |
| 336 |
s_mars_ineei_INFO2CALL = txt_mars_ineei_INFO2CALL->value(); |
| 337 |
s_mars_ineei_INFO2STATE = txt_mars_ineei_INFO2STATE->value(); |
| 338 |
s_mars_ineei_INFO3POS = txt_mars_ineei_INFO3POS->value(); |
| 339 |
s_mars_ineei_INFO3CALL = txt_mars_ineei_INFO3CALL->value(); |
| 340 |
s_mars_ineei_INFO3STATE = txt_mars_ineei_INFO3STATE->value(); |
| 341 |
s_mars_ineei_INFO4POS = txt_mars_ineei_INFO4POS->value(); |
| 342 |
s_mars_ineei_INFO4CALL = txt_mars_ineei_INFO4CALL->value(); |
| 343 |
s_mars_ineei_INFO4STATE = txt_mars_ineei_INFO4STATE->value(); |
| 344 |
s_mars_ineei_INFO5POS = txt_mars_ineei_INFO5POS->value(); |
| 345 |
s_mars_ineei_INFO5CALL = txt_mars_ineei_INFO5CALL->value(); |
| 346 |
s_mars_ineei_INFO5STATE = txt_mars_ineei_INFO5STATE->value(); |
| 347 |
s_mars_ineei_INFO6POS = txt_mars_ineei_INFO6POS->value(); |
| 348 |
s_mars_ineei_INFO6CALL = txt_mars_ineei_INFO6CALL->value(); |
| 349 |
s_mars_ineei_INFO6STATE = txt_mars_ineei_INFO6STATE->value(); |
| 350 |
s_mars_ineei_INFO7POS = txt_mars_ineei_INFO7POS->value(); |
| 351 |
s_mars_ineei_INFO7CALL = txt_mars_ineei_INFO7CALL->value(); |
| 352 |
s_mars_ineei_INFO7STATE = txt_mars_ineei_INFO7STATE->value(); |
| 353 |
s_mars_ineei_INFO8POS = txt_mars_ineei_INFO8POS->value(); |
| 354 |
s_mars_ineei_INFO8CALL = txt_mars_ineei_INFO8CALL->value(); |
| 355 |
s_mars_ineei_INFO8STATE = txt_mars_ineei_INFO8STATE->value(); |
| 356 |
s_mars_ineei_INFO9POS = txt_mars_ineei_INFO9POS->value(); |
| 357 |
s_mars_ineei_INFO9CALL = txt_mars_ineei_INFO9CALL->value(); |
| 358 |
s_mars_ineei_INFO9STATE = txt_mars_ineei_INFO9STATE->value(); |
| 359 |
s_mars_ineei_INFO10POS = txt_mars_ineei_INFO10POS->value(); |
| 360 |
s_mars_ineei_INFO10CALL = txt_mars_ineei_INFO10CALL->value(); |
| 361 |
s_mars_ineei_INFO10STATE = txt_mars_ineei_INFO10STATE->value(); |
| 362 |
s_mars_ineei_INCIDENT = txt_mars_ineei_INCIDENT->value(); |
| 363 |
s_mars_ineei_REF = txt_mars_ineei_REF->value(); |
| 364 |
s_mars_ineei_STATE = txt_mars_ineei_STATE->value(); |
| 365 |
s_mars_ineei_1A_INCIDENT = txt_mars_ineei_1A_INCIDENT->value(); |
| 366 |
s_mars_ineei_1A_LOCATION = txt_mars_ineei_1A_LOCATION->value(); |
| 367 |
s_mars_ineei_1A_TIME = txt_mars_ineei_1A_TIME->value(); |
| 368 |
s_mars_ineei_1B_MEDFACSTS = txt_mars_ineei_1B_MEDFACSTS->value(); |
| 369 |
s_mars_ineei_1C_TRNPSTS = txt_mars_ineei_1C_TRNPSTS->value(); |
| 370 |
s_mars_ineei_1D_DAMAGE = txt_mars_ineei_1D_DAMAGE->value(); |
| 371 |
s_mars_ineei_1E_UTILSTS = txt_mars_ineei_1E_UTILSTS->value(); |
| 372 |
s_mars_ineei_1F_COMMSTS = txt_mars_ineei_1F_COMMSTS->value(); |
| 373 |
s_mars_ineei_1G_INFOSRC = txt_mars_ineei_1G_INFOSRC->value(); |
| 374 |
s_mars_ineei_1G_INFOTIME = txt_mars_ineei_1G_INFOTIME->value(); |
| 375 |
s_mars_ineei_1H_REMARKS = txt_mars_ineei_1H_REMARKS->value(); |
| 376 |
} |
| 377 |
|
| 378 |
void update_mars_ineeiform() |
| 379 |
{ |
| 380 |
txt_mars_ineei_DE->value(s_mars_ineei_DE.c_str()); |
| 381 |
txt_mars_ineei_NBR->value(s_mars_ineei_NBR.c_str()); |
| 382 |
|
| 383 |
size_t n = strchr(mars_ineei_precedent, s_mars_ineei_PREC[0]) - mars_ineei_precedent; |
| 384 |
if (n < 0) n = 0; |
| 385 |
if (n > 4) n = 4; |
| 386 |
sel_mars_ineei_PREC->index(n); |
| 387 |
|
| 388 |
txt_mars_ineei_DTG->value(s_mars_ineei_DTG.c_str()); |
| 389 |
txt_mars_ineei_FMNAME->value(s_mars_ineei_FMNAME.c_str()); |
| 390 |
txt_mars_ineei_FMCALL->value(s_mars_ineei_FMCALL.c_str()); |
| 391 |
txt_mars_ineei_FMSTATE->value(s_mars_ineei_FMSTATE.c_str()); |
| 392 |
txt_mars_ineei_TOPOS->value(s_mars_ineei_TOPOS.c_str()); |
| 393 |
txt_mars_ineei_TOCALL->value(s_mars_ineei_TOCALL.c_str()); |
| 394 |
txt_mars_ineei_TOSTATE->value(s_mars_ineei_TOSTATE.c_str()); |
| 395 |
txt_mars_ineei_INFO1POS->value(s_mars_ineei_INFO1POS.c_str()); |
| 396 |
txt_mars_ineei_INFO1CALL->value(s_mars_ineei_INFO1CALL.c_str()); |
| 397 |
txt_mars_ineei_INFO1STATE->value(s_mars_ineei_INFO1STATE.c_str()); |
| 398 |
txt_mars_ineei_INFO2POS->value(s_mars_ineei_INFO2POS.c_str()); |
| 399 |
txt_mars_ineei_INFO2CALL->value(s_mars_ineei_INFO2CALL.c_str()); |
| 400 |
txt_mars_ineei_INFO2STATE->value(s_mars_ineei_INFO2STATE.c_str()); |
| 401 |
txt_mars_ineei_INFO3POS->value(s_mars_ineei_INFO3POS.c_str()); |
| 402 |
txt_mars_ineei_INFO3CALL->value(s_mars_ineei_INFO3CALL.c_str()); |
| 403 |
txt_mars_ineei_INFO3STATE->value(s_mars_ineei_INFO3STATE.c_str()); |
| 404 |
txt_mars_ineei_INFO4POS->value(s_mars_ineei_INFO4POS.c_str()); |
| 405 |
txt_mars_ineei_INFO4CALL->value(s_mars_ineei_INFO4CALL.c_str()); |
| 406 |
txt_mars_ineei_INFO4STATE->value(s_mars_ineei_INFO4STATE.c_str()); |
| 407 |
txt_mars_ineei_INFO5POS->value(s_mars_ineei_INFO5POS.c_str()); |
| 408 |
txt_mars_ineei_INFO5CALL->value(s_mars_ineei_INFO5CALL.c_str()); |
| 409 |
txt_mars_ineei_INFO5STATE->value(s_mars_ineei_INFO5STATE.c_str()); |
| 410 |
txt_mars_ineei_INFO6POS->value(s_mars_ineei_INFO6POS.c_str()); |
| 411 |
txt_mars_ineei_INFO6CALL->value(s_mars_ineei_INFO6CALL.c_str()); |
| 412 |
txt_mars_ineei_INFO6STATE->value(s_mars_ineei_INFO6STATE.c_str()); |
| 413 |
txt_mars_ineei_INFO7POS->value(s_mars_ineei_INFO7POS.c_str()); |
| 414 |
txt_mars_ineei_INFO7CALL->value(s_mars_ineei_INFO7CALL.c_str()); |
| 415 |
txt_mars_ineei_INFO7STATE->value(s_mars_ineei_INFO7STATE.c_str()); |
| 416 |
txt_mars_ineei_INFO8POS->value(s_mars_ineei_INFO8POS.c_str()); |
| 417 |
txt_mars_ineei_INFO8CALL->value(s_mars_ineei_INFO8CALL.c_str()); |
| 418 |
txt_mars_ineei_INFO8STATE->value(s_mars_ineei_INFO8STATE.c_str()); |
| 419 |
txt_mars_ineei_INFO9POS->value(s_mars_ineei_INFO9POS.c_str()); |
| 420 |
txt_mars_ineei_INFO9CALL->value(s_mars_ineei_INFO9CALL.c_str()); |
| 421 |
txt_mars_ineei_INFO9STATE->value(s_mars_ineei_INFO9STATE.c_str()); |
| 422 |
txt_mars_ineei_INFO10POS->value(s_mars_ineei_INFO10POS.c_str()); |
| 423 |
txt_mars_ineei_INFO10CALL->value(s_mars_ineei_INFO10CALL.c_str()); |
| 424 |
txt_mars_ineei_INFO10STATE->value(s_mars_ineei_INFO10STATE.c_str()); |
| 425 |
txt_mars_ineei_INCIDENT->value(s_mars_ineei_INCIDENT.c_str()); |
| 426 |
txt_mars_ineei_REF->value(s_mars_ineei_REF.c_str()); |
| 427 |
txt_mars_ineei_STATE->value(s_mars_ineei_STATE.c_str()); |
| 428 |
txt_mars_ineei_1A_INCIDENT->value(s_mars_ineei_1A_INCIDENT.c_str()); |
| 429 |
txt_mars_ineei_1A_LOCATION->value(s_mars_ineei_1A_LOCATION.c_str()); |
| 430 |
txt_mars_ineei_1A_TIME->value(s_mars_ineei_1A_TIME.c_str()); |
| 431 |
txt_mars_ineei_1B_MEDFACSTS->value(s_mars_ineei_1B_MEDFACSTS.c_str()); |
| 432 |
txt_mars_ineei_1C_TRNPSTS->value(s_mars_ineei_1C_TRNPSTS.c_str()); |
| 433 |
txt_mars_ineei_1D_DAMAGE->value(s_mars_ineei_1D_DAMAGE.c_str()); |
| 434 |
txt_mars_ineei_1E_UTILSTS->value(s_mars_ineei_1E_UTILSTS.c_str()); |
| 435 |
txt_mars_ineei_1F_COMMSTS->value(s_mars_ineei_1F_COMMSTS.c_str()); |
| 436 |
txt_mars_ineei_1G_INFOSRC->value(s_mars_ineei_1G_INFOSRC.c_str()); |
| 437 |
txt_mars_ineei_1G_INFOTIME->value(s_mars_ineei_1G_INFOTIME.c_str()); |
| 438 |
txt_mars_ineei_1H_REMARKS->value(s_mars_ineei_1H_REMARKS.c_str()); |
| 439 |
} |
| 440 |
|
| 441 |
void clear_mars_ineei_form() |
| 442 |
{ |
| 443 |
clear_mars_ineei_fields(); |
| 444 |
txt_mars_ineei_DE->value(""); |
| 445 |
txt_mars_ineei_NBR->value(""); |
| 446 |
sel_mars_ineei_PREC->index(4); |
| 447 |
txt_mars_ineei_DTG->value(""); |
| 448 |
txt_mars_ineei_FMNAME->value(""); |
| 449 |
txt_mars_ineei_FMCALL->value(""); |
| 450 |
txt_mars_ineei_FMSTATE->value(""); |
| 451 |
txt_mars_ineei_TOPOS->value(""); |
| 452 |
txt_mars_ineei_TOCALL->value(""); |
| 453 |
txt_mars_ineei_TOSTATE->value(""); |
| 454 |
txt_mars_ineei_INFO1POS->value(""); |
| 455 |
txt_mars_ineei_INFO1CALL->value(""); |
| 456 |
txt_mars_ineei_INFO1STATE->value(""); |
| 457 |
txt_mars_ineei_INFO2POS->value(""); |
| 458 |
txt_mars_ineei_INFO2CALL->value(""); |
| 459 |
txt_mars_ineei_INFO2STATE->value(""); |
| 460 |
txt_mars_ineei_INFO3POS->value(""); |
| 461 |
txt_mars_ineei_INFO3CALL->value(""); |
| 462 |
txt_mars_ineei_INFO3STATE->value(""); |
| 463 |
txt_mars_ineei_INFO4POS->value(""); |
| 464 |
txt_mars_ineei_INFO4CALL->value(""); |
| 465 |
txt_mars_ineei_INFO4STATE->value(""); |
| 466 |
txt_mars_ineei_INFO5POS->value(""); |
| 467 |
txt_mars_ineei_INFO5CALL->value(""); |
| 468 |
txt_mars_ineei_INFO5STATE->value(""); |
| 469 |
txt_mars_ineei_INFO6POS->value(""); |
| 470 |
txt_mars_ineei_INFO6CALL->value(""); |
| 471 |
txt_mars_ineei_INFO6STATE->value(""); |
| 472 |
txt_mars_ineei_INFO7POS->value(""); |
| 473 |
txt_mars_ineei_INFO7CALL->value(""); |
| 474 |
txt_mars_ineei_INFO7STATE->value(""); |
| 475 |
txt_mars_ineei_INFO8POS->value(""); |
| 476 |
txt_mars_ineei_INFO8CALL->value(""); |
| 477 |
txt_mars_ineei_INFO8STATE->value(""); |
| 478 |
txt_mars_ineei_INFO9POS->value(""); |
| 479 |
txt_mars_ineei_INFO9CALL->value(""); |
| 480 |
txt_mars_ineei_INFO9STATE->value(""); |
| 481 |
txt_mars_ineei_INFO10POS->value(""); |
| 482 |
txt_mars_ineei_INFO10CALL->value(""); |
| 483 |
txt_mars_ineei_INFO10STATE->value(""); |
| 484 |
txt_mars_ineei_INCIDENT->value(""); |
| 485 |
txt_mars_ineei_REF->value(""); |
| 486 |
txt_mars_ineei_STATE->value(""); |
| 487 |
txt_mars_ineei_1A_INCIDENT->value(""); |
| 488 |
txt_mars_ineei_1A_LOCATION->value(""); |
| 489 |
txt_mars_ineei_1A_TIME->value(""); |
| 490 |
txt_mars_ineei_1B_MEDFACSTS->value(""); |
| 491 |
txt_mars_ineei_1C_TRNPSTS->value(""); |
| 492 |
txt_mars_ineei_1D_DAMAGE->value(""); |
| 493 |
txt_mars_ineei_1E_UTILSTS->value(""); |
| 494 |
txt_mars_ineei_1F_COMMSTS->value(""); |
| 495 |
txt_mars_ineei_1G_INFOSRC->value(""); |
| 496 |
txt_mars_ineei_1G_INFOTIME->value(""); |
| 497 |
txt_mars_ineei_1H_REMARKS->value(""); |
| 498 |
} |
| 499 |
|
| 500 |
void make_mars_ineei_buff(bool compress = false) |
| 501 |
{ |
| 502 |
std::string mbuff; |
| 503 |
mbuff.clear(); |
| 504 |
mbuff.append( lineout( mars_ineei_DE, s_mars_ineei_DE ) ); |
| 505 |
mbuff.append( lineout( mars_ineei_NBR, s_mars_ineei_NBR ) ); |
| 506 |
mbuff.append( lineout( mars_ineei_PREC, s_mars_ineei_PREC ) ); |
| 507 |
mbuff.append( lineout( mars_ineei_DTG, s_mars_ineei_DTG ) ); |
| 508 |
mbuff.append( lineout( mars_ineei_FMNAME, s_mars_ineei_FMNAME ) ); |
| 509 |
mbuff.append( lineout( mars_ineei_FMCALL, s_mars_ineei_FMCALL ) ); |
| 510 |
mbuff.append( lineout( mars_ineei_FMSTATE, s_mars_ineei_FMSTATE ) ); |
| 511 |
mbuff.append( lineout( mars_ineei_TOPOS, s_mars_ineei_TOPOS ) ); |
| 512 |
mbuff.append( lineout( mars_ineei_TOCALL, s_mars_ineei_TOCALL ) ); |
| 513 |
mbuff.append( lineout( mars_ineei_TOSTATE, s_mars_ineei_TOSTATE ) ); |
| 514 |
mbuff.append( lineout( mars_ineei_INFO1POS, s_mars_ineei_INFO1POS ) ); |
| 515 |
mbuff.append( lineout( mars_ineei_INFO1CALL, s_mars_ineei_INFO1CALL ) ); |
| 516 |
mbuff.append( lineout( mars_ineei_INFO1STATE, s_mars_ineei_INFO1STATE ) ); |
| 517 |
mbuff.append( lineout( mars_ineei_INFO2POS, s_mars_ineei_INFO2POS ) ); |
| 518 |
mbuff.append( lineout( mars_ineei_INFO2CALL, s_mars_ineei_INFO2CALL ) ); |
| 519 |
mbuff.append( lineout( mars_ineei_INFO2STATE, s_mars_ineei_INFO2STATE ) ); |
| 520 |
mbuff.append( lineout( mars_ineei_INFO3POS, s_mars_ineei_INFO3POS ) ); |
| 521 |
mbuff.append( lineout( mars_ineei_INFO3CALL, s_mars_ineei_INFO3CALL ) ); |
| 522 |
mbuff.append( lineout( mars_ineei_INFO3STATE, s_mars_ineei_INFO3STATE ) ); |
| 523 |
mbuff.append( lineout( mars_ineei_INFO4POS, s_mars_ineei_INFO4POS ) ); |
| 524 |
mbuff.append( lineout( mars_ineei_INFO4CALL, s_mars_ineei_INFO4CALL ) ); |
| 525 |
mbuff.append( lineout( mars_ineei_INFO4STATE, s_mars_ineei_INFO4STATE ) ); |
| 526 |
mbuff.append( lineout( mars_ineei_INFO5POS, s_mars_ineei_INFO5POS ) ); |
| 527 |
mbuff.append( lineout( mars_ineei_INFO5CALL, s_mars_ineei_INFO5CALL ) ); |
| 528 |
mbuff.append( lineout( mars_ineei_INFO5STATE, s_mars_ineei_INFO5STATE ) ); |
| 529 |
mbuff.append( lineout( mars_ineei_INFO6POS, s_mars_ineei_INFO6POS ) ); |
| 530 |
mbuff.append( lineout( mars_ineei_INFO6CALL, s_mars_ineei_INFO6CALL ) ); |
| 531 |
mbuff.append( lineout( mars_ineei_INFO6STATE, s_mars_ineei_INFO6STATE ) ); |
| 532 |
mbuff.append( lineout( mars_ineei_INFO7POS, s_mars_ineei_INFO7POS ) ); |
| 533 |
mbuff.append( lineout( mars_ineei_INFO7CALL, s_mars_ineei_INFO7CALL ) ); |
| 534 |
mbuff.append( lineout( mars_ineei_INFO7STATE, s_mars_ineei_INFO7STATE ) ); |
| 535 |
mbuff.append( lineout( mars_ineei_INFO8POS, s_mars_ineei_INFO8POS ) ); |
| 536 |
mbuff.append( lineout( mars_ineei_INFO8CALL, s_mars_ineei_INFO8CALL ) ); |
| 537 |
mbuff.append( lineout( mars_ineei_INFO8STATE, s_mars_ineei_INFO8STATE ) ); |
| 538 |
mbuff.append( lineout( mars_ineei_INFO9POS, s_mars_ineei_INFO9POS ) ); |
| 539 |
mbuff.append( lineout( mars_ineei_INFO9CALL, s_mars_ineei_INFO9CALL ) ); |
| 540 |
mbuff.append( lineout( mars_ineei_INFO9STATE, s_mars_ineei_INFO9STATE ) ); |
| 541 |
mbuff.append( lineout( mars_ineei_INFO10POS, s_mars_ineei_INFO10POS ) ); |
| 542 |
mbuff.append( lineout( mars_ineei_INFO10CALL, s_mars_ineei_INFO10CALL ) ); |
| 543 |
mbuff.append( lineout( mars_ineei_INFO10STATE, s_mars_ineei_INFO10STATE ) ); |
| 544 |
mbuff.append( lineout( mars_ineei_INCIDENT, s_mars_ineei_INCIDENT ) ); |
| 545 |
mbuff.append( lineout( mars_ineei_REF, s_mars_ineei_REF)); |
| 546 |
mbuff.append( lineout( mars_ineei_STATE, s_mars_ineei_STATE)); |
| 547 |
mbuff.append( lineout( mars_ineei_1A_INCIDENT, s_mars_ineei_1A_INCIDENT)); |
| 548 |
mbuff.append( lineout( mars_ineei_1A_LOCATION, s_mars_ineei_1A_LOCATION)); |
| 549 |
mbuff.append( lineout( mars_ineei_1A_TIME, s_mars_ineei_1A_TIME)); |
| 550 |
mbuff.append( lineout( mars_ineei_1B_MEDFACSTS, s_mars_ineei_1B_MEDFACSTS)); |
| 551 |
mbuff.append( lineout( mars_ineei_1C_TRNPSTS, s_mars_ineei_1C_TRNPSTS)); |
| 552 |
mbuff.append( lineout( mars_ineei_1D_DAMAGE, s_mars_ineei_1D_DAMAGE)); |
| 553 |
mbuff.append( lineout( mars_ineei_1E_UTILSTS, s_mars_ineei_1E_UTILSTS)); |
| 554 |
mbuff.append( lineout( mars_ineei_1F_COMMSTS, s_mars_ineei_1F_COMMSTS)); |
| 555 |
mbuff.append( lineout( mars_ineei_1G_INFOSRC, s_mars_ineei_1G_INFOSRC)); |
| 556 |
mbuff.append( lineout( mars_ineei_1G_INFOTIME, s_mars_ineei_1G_INFOTIME)); |
| 557 |
mbuff.append( lineout( mars_ineei_1H_REMARKS, s_mars_ineei_1H_REMARKS ) ); |
| 558 |
|
| 559 |
if (compress) compress_maybe(mbuff); |
| 560 |
ineei_buff.append(mbuff); |
| 561 |
} |
| 562 |
|
| 563 |
void read_mars_ineei_buffer(std::string data) |
| 564 |
{ |
| 565 |
clear_mars_ineei_fields(); |
| 566 |
// search the file buffer for each of the mars_ineei fields |
| 567 |
|
| 568 |
s_mars_ineei_DE = findstr(data, mars_ineei_DE); |
| 569 |
s_mars_ineei_NBR = findstr(data, mars_ineei_NBR); |
| 570 |
s_mars_ineei_PREC = findstr(data, mars_ineei_PREC); |
| 571 |
s_mars_ineei_DTG = findstr(data, mars_ineei_DTG); |
| 572 |
s_mars_ineei_FMNAME = findstr(data, mars_ineei_FMNAME); |
| 573 |
s_mars_ineei_FMCALL = findstr(data, mars_ineei_FMCALL); |
| 574 |
s_mars_ineei_FMSTATE = findstr(data, mars_ineei_FMSTATE); |
| 575 |
s_mars_ineei_TOPOS = findstr(data, mars_ineei_TOPOS); |
| 576 |
s_mars_ineei_TOCALL = findstr(data, mars_ineei_TOCALL); |
| 577 |
s_mars_ineei_TOSTATE = findstr(data, mars_ineei_TOSTATE); |
| 578 |
s_mars_ineei_INFO1POS = findstr(data, mars_ineei_INFO1POS); |
| 579 |
s_mars_ineei_INFO1CALL = findstr(data, mars_ineei_INFO1CALL); |
| 580 |
s_mars_ineei_INFO1STATE = findstr(data, mars_ineei_INFO1STATE); |
| 581 |
s_mars_ineei_INFO2POS = findstr(data, mars_ineei_INFO2POS); |
| 582 |
s_mars_ineei_INFO2CALL = findstr(data, mars_ineei_INFO2CALL); |
| 583 |
s_mars_ineei_INFO2STATE = findstr(data, mars_ineei_INFO2STATE); |
| 584 |
s_mars_ineei_INFO3POS = findstr(data, mars_ineei_INFO3POS); |
| 585 |
s_mars_ineei_INFO3CALL = findstr(data, mars_ineei_INFO3CALL); |
| 586 |
s_mars_ineei_INFO3STATE = findstr(data, mars_ineei_INFO3STATE); |
| 587 |
s_mars_ineei_INFO4POS = findstr(data, mars_ineei_INFO4POS); |
| 588 |
s_mars_ineei_INFO4CALL = findstr(data, mars_ineei_INFO4CALL); |
| 589 |
s_mars_ineei_INFO4STATE = findstr(data, mars_ineei_INFO4STATE); |
| 590 |
s_mars_ineei_INFO5POS = findstr(data, mars_ineei_INFO5POS); |
| 591 |
s_mars_ineei_INFO5CALL = findstr(data, mars_ineei_INFO5CALL); |
| 592 |
s_mars_ineei_INFO5STATE = findstr(data, mars_ineei_INFO5STATE); |
| 593 |
s_mars_ineei_INFO6POS = findstr(data, mars_ineei_INFO6POS); |
| 594 |
s_mars_ineei_INFO6CALL = findstr(data, mars_ineei_INFO6CALL); |
| 595 |
s_mars_ineei_INFO6STATE = findstr(data, mars_ineei_INFO6STATE); |
| 596 |
s_mars_ineei_INFO7POS = findstr(data, mars_ineei_INFO7POS); |
| 597 |
s_mars_ineei_INFO7CALL = findstr(data, mars_ineei_INFO7CALL); |
| 598 |
s_mars_ineei_INFO7STATE = findstr(data, mars_ineei_INFO7STATE); |
| 599 |
s_mars_ineei_INFO8POS = findstr(data, mars_ineei_INFO8POS); |
| 600 |
s_mars_ineei_INFO8CALL = findstr(data, mars_ineei_INFO8CALL); |
| 601 |
s_mars_ineei_INFO8STATE = findstr(data, mars_ineei_INFO8STATE); |
| 602 |
s_mars_ineei_INFO9POS = findstr(data, mars_ineei_INFO9POS); |
| 603 |
s_mars_ineei_INFO9CALL = findstr(data, mars_ineei_INFO9CALL); |
| 604 |
s_mars_ineei_INFO9STATE = findstr(data, mars_ineei_INFO9STATE); |
| 605 |
s_mars_ineei_INFO10POS = findstr(data, mars_ineei_INFO10POS); |
| 606 |
s_mars_ineei_INFO10CALL = findstr(data, mars_ineei_INFO10CALL); |
| 607 |
s_mars_ineei_INFO10STATE = findstr(data, mars_ineei_INFO10STATE); |
| 608 |
s_mars_ineei_INCIDENT = findstr(data, mars_ineei_INCIDENT); |
| 609 |
s_mars_ineei_REF = findstr(data, mars_ineei_REF); |
| 610 |
s_mars_ineei_STATE = findstr(data, mars_ineei_STATE); |
| 611 |
s_mars_ineei_1A_INCIDENT = findstr(data, mars_ineei_1A_INCIDENT); |
| 612 |
s_mars_ineei_1A_LOCATION = findstr(data, mars_ineei_1A_LOCATION); |
| 613 |
s_mars_ineei_1A_TIME = findstr(data, mars_ineei_1A_TIME); |
| 614 |
s_mars_ineei_1B_MEDFACSTS = findstr(data, mars_ineei_1B_MEDFACSTS); |
| 615 |
s_mars_ineei_1C_TRNPSTS = findstr(data, mars_ineei_1C_TRNPSTS); |
| 616 |
s_mars_ineei_1D_DAMAGE = findstr(data, mars_ineei_1D_DAMAGE); |
| 617 |
s_mars_ineei_1E_UTILSTS = findstr(data, mars_ineei_1E_UTILSTS); |
| 618 |
s_mars_ineei_1F_COMMSTS = findstr(data, mars_ineei_1F_COMMSTS); |
| 619 |
s_mars_ineei_1G_INFOSRC = findstr(data, mars_ineei_1G_INFOSRC); |
| 620 |
s_mars_ineei_1G_INFOTIME = findstr(data, mars_ineei_1G_INFOTIME); |
| 621 |
s_mars_ineei_1H_REMARKS = findstr(data, mars_ineei_1H_REMARKS); |
| 622 |
|
| 623 |
update_mars_ineeiform(); |
| 624 |
} |
| 625 |
|
| 626 |
void cb_mars_ineei_new() |
| 627 |
{ |
| 628 |
if (check_mars_ineei_fields()) { |
| 629 |
if (fl_choice2("Form modified, save?", "No", "Yes", NULL) == 1) { |
| 630 |
update_header(CHANGED); |
| 631 |
cb_mars_ineei_save(); |
| 632 |
} |
| 633 |
} |
| 634 |
clear_mars_ineei_form(); |
| 635 |
def_mars_ineei_filename = ICS_msg_dir; |
| 636 |
def_mars_ineei_filename.append("new").append(FMARSINEEI_EXT); |
| 637 |
show_filename(def_mars_ineei_filename); |
| 638 |
using_mars_ineei_template = false; |
| 639 |
} |
| 640 |
|
| 641 |
void cb_mars_ineei_import() |
| 642 |
{ |
| 643 |
fl_alert2("Not implemented"); |
| 644 |
} |
| 645 |
|
| 646 |
void cb_mars_ineei_export() |
| 647 |
{ |
| 648 |
fl_alert2("Not implemented"); |
| 649 |
} |
| 650 |
|
| 651 |
void cb_mars_ineei_wrap_import(std::string wrapfilename, std::string inpbuffer) |
| 652 |
{ |
| 653 |
clear_mars_ineei_form(); |
| 654 |
read_mars_ineei_buffer(inpbuffer); |
| 655 |
def_mars_ineei_filename = ICS_msg_dir; |
| 656 |
def_mars_ineei_filename.append(wrapfilename); |
| 657 |
show_filename(def_mars_ineei_filename); |
| 658 |
using_mars_ineei_template = false; |
| 659 |
} |
| 660 |
|
| 661 |
int eval_mars_ineei_fsize() |
| 662 |
{ |
| 663 |
Ccrc16 chksum; |
| 664 |
evalstr.assign("[WRAP:beg][WRAP:lf][WRAP:fn "); |
| 665 |
evalstr.append(base_mars_ineei_filename).append("]"); |
| 666 |
update_mars_ineei_fields(); |
| 667 |
update_header(FROM); |
| 668 |
evalstr.append(header("<mars_ineei>")); |
| 669 |
ineei_buff.clear(); |
| 670 |
make_mars_ineei_buff(true); |
| 671 |
if (ineei_buff.empty()) return 0; |
| 672 |
compress_maybe( ineei_buff ); |
| 673 |
evalstr.append( ineei_buff ); |
| 674 |
evalstr.append("[WRAP:chksum ").append(chksum.scrc16(evalstr)).append("][WRAP:end]"); |
| 675 |
return evalstr.length(); |
| 676 |
} |
| 677 |
|
| 678 |
void cb_mars_ineei_wrap_export() |
| 679 |
{ |
| 680 |
if (check_mars_ineei_fields()) { |
| 681 |
if (fl_choice2("Form modified, save?", "No", "Yes", NULL) == 0) |
| 682 |
return; |
| 683 |
update_header(CHANGED); |
| 684 |
} |
| 685 |
update_mars_ineei_fields(); |
| 686 |
|
| 687 |
if (base_mars_ineei_filename == std::string("new").append(FMARSINEEI_EXT) || |
| 688 |
base_mars_ineei_filename == std::string("default").append(FMARSINEEI_EXT) ) |
| 689 |
if (!cb_mars_ineei_save_as()) return; |
| 690 |
|
| 691 |
std::string wrapfilename = WRAP_send_dir; |
| 692 |
wrapfilename.append(base_mars_ineei_filename); |
| 693 |
wrapfilename.append(".wrap"); |
| 694 |
const char *p = FSEL::saveas( |
| 695 |
"Save as wrap file", |
| 696 |
"Wrap file\t*.{wrap,WRAP}", |
| 697 |
wrapfilename.c_str()); |
| 698 |
if (p) { |
| 699 |
std::string pext = fl_filename_ext(p); |
| 700 |
wrapfilename = p; |
| 701 |
|
| 702 |
update_header(FROM); |
| 703 |
ineei_buff.assign(header("<mars_ineei>")); |
| 704 |
make_mars_ineei_buff(true); |
| 705 |
export_wrapfile(base_mars_ineei_filename, wrapfilename, ineei_buff, pext != ".wrap"); |
| 706 |
|
| 707 |
ineei_buff.assign(header("<mars_ineei>")); |
| 708 |
make_mars_ineei_buff(false); |
| 709 |
write_mars_ineei(def_mars_ineei_filename); |
| 710 |
} |
| 711 |
} |
| 712 |
|
| 713 |
void cb_mars_ineei_wrap_autosend() |
| 714 |
{ |
| 715 |
if (check_mars_ineei_fields()) { |
| 716 |
if (fl_choice2("Form modified, save?", "No", "Yes", NULL) == 0) |
| 717 |
return; |
| 718 |
update_header(CHANGED); |
| 719 |
} |
| 720 |
update_mars_ineei_fields(); |
| 721 |
|
| 722 |
if (base_mars_ineei_filename == std::string("new").append(FMARSINEEI_EXT) || |
| 723 |
base_mars_ineei_filename == std::string("default").append(FMARSINEEI_EXT) ) |
| 724 |
if (!cb_mars_ineei_save_as()) return; |
| 725 |
|
| 726 |
update_header(FROM); |
| 727 |
ineei_buff.assign(header("<mars_ineei>")); |
| 728 |
make_mars_ineei_buff(true); |
| 729 |
xfr_via_socket(base_mars_ineei_filename, ineei_buff); |
| 730 |
|
| 731 |
ineei_buff.assign(header("<mars_ineei>")); |
| 732 |
make_mars_ineei_buff(false); |
| 733 |
write_mars_ineei(def_mars_ineei_filename); |
| 734 |
} |
| 735 |
|
| 736 |
void cb_mars_ineei_load_template() |
| 737 |
{ |
| 738 |
std::string def_mars_ineei_filename = def_mars_ineei_TemplateName; |
| 739 |
const char *p = FSEL::select( |
| 740 |
"Open template file", |
| 741 |
std::string("Template file\t*").append(TMARSINEEI_EXT).c_str(), |
| 742 |
def_mars_ineei_filename.c_str()); |
| 743 |
if (p) { |
| 744 |
clear_mars_ineei_form(); |
| 745 |
read_data_file(p); |
| 746 |
def_mars_ineei_TemplateName = p; |
| 747 |
show_filename(def_mars_ineei_TemplateName); |
| 748 |
using_mars_ineei_template = true; |
| 749 |
} |
| 750 |
} |
| 751 |
|
| 752 |
void cb_mars_ineei_save_template() |
| 753 |
{ |
| 754 |
if (!using_mars_ineei_template) { |
| 755 |
cb_mars_ineei_save_as_template(); |
| 756 |
return; |
| 757 |
} |
| 758 |
std::string def_mars_ineei_filename = def_mars_ineei_TemplateName; |
| 759 |
const char *p = FSEL::saveas( |
| 760 |
"Save template file", |
| 761 |
std::string("Template file\t*").append(TMARSINEEI_EXT).c_str(), |
| 762 |
def_mars_ineei_filename.c_str()); |
| 763 |
if (p) { |
| 764 |
update_header(CHANGED); |
| 765 |
update_mars_ineei_fields(); |
| 766 |
ineei_buff.assign(header("<mars_ineei>")); |
| 767 |
make_mars_ineei_buff(); |
| 768 |
write_mars_ineei(p); |
| 769 |
} |
| 770 |
} |
| 771 |
|
| 772 |
void cb_mars_ineei_save_as_template() |
| 773 |
{ |
| 774 |
std::string def_mars_ineei_filename = def_mars_ineei_TemplateName; |
| 775 |
const char *p = FSEL::saveas( |
| 776 |
"Save as template file", |
| 777 |
std::string("Template file\t*").append(TMARSINEEI_EXT).c_str(), |
| 778 |
def_mars_ineei_filename.c_str()); |
| 779 |
if (p) { |
| 780 |
const char *pext = fl_filename_ext(p); |
| 781 |
def_mars_ineei_TemplateName = p; |
| 782 |
if (strlen(pext) == 0) def_mars_ineei_TemplateName.append(TMARSINEEI_EXT); |
| 783 |
remove_spaces_from_filename(def_mars_ineei_TemplateName); |
| 784 |
|
| 785 |
clear_header(); |
| 786 |
update_header(CHANGED); |
| 787 |
update_mars_ineei_fields(); |
| 788 |
ineei_buff.assign(header("<mars_ineei>")); |
| 789 |
make_mars_ineei_buff(); |
| 790 |
write_mars_ineei(def_mars_ineei_TemplateName); |
| 791 |
|
| 792 |
show_filename(def_mars_ineei_TemplateName); |
| 793 |
using_mars_ineei_template = true; |
| 794 |
} |
| 795 |
} |
| 796 |
|
| 797 |
void cb_mars_ineei_open() |
| 798 |
{ |
| 799 |
const char *p = FSEL::select( |
| 800 |
_("Open data file"), |
| 801 |
std::string("ICS-net\t*").append(FMARSINEEI_EXT).c_str(), |
| 802 |
def_mars_ineei_filename.c_str()); |
| 803 |
if (!p) return; |
| 804 |
if (strlen(p) == 0) return; |
| 805 |
clear_mars_ineei_form(); |
| 806 |
read_data_file(p); |
| 807 |
using_mars_ineei_template = false; |
| 808 |
def_mars_ineei_filename = p; |
| 809 |
show_filename(def_mars_ineei_filename); |
| 810 |
} |
| 811 |
|
| 812 |
void write_mars_ineei(std::string s) |
| 813 |
{ |
| 814 |
FILE *filenet = fopen(s.c_str(), "w"); |
| 815 |
if (!filenet) return; |
| 816 |
make_mars_ineei_buff(); |
| 817 |
fwrite(ineei_buff.c_str(), ineei_buff.length(), 1, filenet); |
| 818 |
fclose(filenet); |
| 819 |
} |
| 820 |
|
| 821 |
bool cb_mars_ineei_save_as() |
| 822 |
{ |
| 823 |
const char *p; |
| 824 |
std::string newfilename; |
| 825 |
|
| 826 |
std::string name = named_file(); |
| 827 |
if (!name.empty()) { |
| 828 |
name.append(FMARSINEEI_EXT); |
| 829 |
newfilename = ICS_msg_dir; |
| 830 |
newfilename.append(name); |
| 831 |
} else |
| 832 |
newfilename = def_mars_ineei_filename; |
| 833 |
|
| 834 |
p = FSEL::saveas( |
| 835 |
_("Save data file"), |
| 836 |
std::string("ICS-net\t*").append(FMARSINEEI_EXT).c_str(), |
| 837 |
newfilename.c_str()); |
| 838 |
|
| 839 |
if (!p) return false; |
| 840 |
if (strlen(p) == 0) return false; |
| 841 |
|
| 842 |
if (progStatus.sernbr_fname) update_sernbr(); |
| 843 |
|
| 844 |
const char *pext = fl_filename_ext(p); |
| 845 |
def_mars_ineei_filename = p; |
| 846 |
if (strlen(pext) == 0) def_mars_ineei_filename.append(FMARSINEEI_EXT); |
| 847 |
|
| 848 |
remove_spaces_from_filename(def_mars_ineei_filename); |
| 849 |
|
| 850 |
update_header(NEW); |
| 851 |
update_mars_ineei_fields(); |
| 852 |
ineei_buff.assign(header("<mars_ineei>")); |
| 853 |
make_mars_ineei_buff(); |
| 854 |
write_mars_ineei(def_mars_ineei_filename); |
| 855 |
|
| 856 |
using_mars_ineei_template = false; |
| 857 |
show_filename(def_mars_ineei_filename); |
| 858 |
return true; |
| 859 |
} |
| 860 |
|
| 861 |
void cb_mars_ineei_save() |
| 862 |
{ |
| 863 |
if (base_mars_ineei_filename == std::string("new").append(FMARSINEEI_EXT) || |
| 864 |
base_mars_ineei_filename == std::string("default").append(FMARSINEEI_EXT) || |
| 865 |
using_mars_ineei_template == true) { |
| 866 |
cb_mars_ineei_save_as(); |
| 867 |
return; |
| 868 |
} |
| 869 |
if (check_mars_ineei_fields()) update_header(CHANGED); |
| 870 |
update_mars_ineei_fields(); |
| 871 |
ineei_buff.assign(header("<mars_ineei>")); |
| 872 |
make_mars_ineei_buff(); |
| 873 |
write_mars_ineei(def_mars_ineei_filename); |
| 874 |
|
| 875 |
using_mars_ineei_template = false; |
| 876 |
} |
| 877 |
|
| 878 |
std::string justify_remarks(std::string instr, int start_count) |
| 879 |
{ |
| 880 |
// strip new lines |
| 881 |
std::string tmp = instr; |
| 882 |
size_t nl = 0; |
| 883 |
while ((nl = tmp.find("\n")) != std::string::npos) |
| 884 |
if (nl == tmp.length() -1) |
| 885 |
tmp.erase(nl,1); |
| 886 |
else |
| 887 |
tmp[nl] = ' '; |
| 888 |
size_t dsp = 0; |
| 889 |
while ((dsp = tmp.find(" ")) != std::string::npos) |
| 890 |
tmp.erase(dsp, 1); |
| 891 |
while ((dsp = tmp.find(" .")) != std::string::npos) |
| 892 |
tmp.erase(dsp, 1); |
| 893 |
|
| 894 |
// limit line lengths |
| 895 |
int cc = start_count; |
| 896 |
size_t sp = 0; |
| 897 |
while (sp < tmp.length()) { |
| 898 |
if (tmp[sp] == ' ' && cc == progStatus.charcount) { |
| 899 |
tmp[sp] = '\n'; |
| 900 |
cc = 0; |
| 901 |
} else if (cc > progStatus.charcount) { // back up to previous space |
| 902 |
int n = 0; |
| 903 |
while (sp && cc && tmp[sp] != '\n') { |
| 904 |
sp--; cc--; |
| 905 |
if (++n > 20) { // oops |
| 906 |
tmp.insert(sp, 1, '\n'); |
| 907 |
cc = 0; |
| 908 |
} else if (tmp[sp] == ' ') { |
| 909 |
tmp[sp] = '\n'; |
| 910 |
cc = 0; |
| 911 |
} |
| 912 |
} |
| 913 |
} |
| 914 |
sp++; cc++; |
| 915 |
} |
| 916 |
return tmp; |
| 917 |
} |
| 918 |
|
| 919 |
std::string formated_output( std::string target ) |
| 920 |
{ |
| 921 |
std::string formnet = target; |
| 922 |
std::string temp; |
| 923 |
std::string field_str; |
| 924 |
std::string to_str = ":to:"; |
| 925 |
std::string fm_str = ":fm:"; |
| 926 |
std::string info_str = ":info:"; |
| 927 |
std::string ref_str = ":1ref:"; |
| 928 |
std::string onea_str = ":1a:"; |
| 929 |
std::string oneg_str = ":1g:"; |
| 930 |
|
| 931 |
replacestr(formnet, mars_ineei_DE, s_mars_ineei_DE); |
| 932 |
replacestr(formnet, mars_ineei_NBR, s_mars_ineei_NBR); |
| 933 |
replacestr(formnet, mars_ineei_PREC, s_mars_ineei_PREC); |
| 934 |
replacestr(formnet, mars_ineei_DTG, s_mars_ineei_DTG); |
| 935 |
|
| 936 |
field_str.clear(); |
| 937 |
if (!s_mars_ineei_FMNAME.empty()) field_str.append(s_mars_ineei_FMNAME).append(" / "); |
| 938 |
if (!s_mars_ineei_FMCALL.empty()) field_str.append(s_mars_ineei_FMCALL).append(" / "); |
| 939 |
if (!s_mars_ineei_FMSTATE.empty()) field_str.append(s_mars_ineei_FMSTATE); |
| 940 |
replacestr(formnet, fm_str, field_str); |
| 941 |
|
| 942 |
field_str.clear(); |
| 943 |
if (!s_mars_ineei_TOPOS.empty()) field_str.append(s_mars_ineei_TOPOS).append(" / "); |
| 944 |
if (!s_mars_ineei_TOCALL.empty()) field_str.append(s_mars_ineei_TOCALL).append(" / "); |
| 945 |
if (!s_mars_ineei_TOSTATE.empty()) field_str.append(s_mars_ineei_TOSTATE); |
| 946 |
replacestr(formnet, to_str, field_str); |
| 947 |
|
| 948 |
field_str.clear(); |
| 949 |
if (!s_mars_ineei_INFO1CALL.empty() || !s_mars_ineei_INFO1POS.empty()) { |
| 950 |
field_str.append("\nINFO: "); |
| 951 |
if (!s_mars_ineei_INFO1POS.empty()) field_str.append(s_mars_ineei_INFO1POS).append(" / "); |
| 952 |
field_str.append(s_mars_ineei_INFO1CALL); |
| 953 |
if (!s_mars_ineei_INFO1STATE.empty()) field_str.append(" / ").append(s_mars_ineei_INFO1STATE); |
| 954 |
} |
| 955 |
if (!s_mars_ineei_INFO2CALL.empty() || !s_mars_ineei_INFO2POS.empty()) { |
| 956 |
if (field_str.empty()) field_str.append("\nINFO: "); |
| 957 |
else field_str.append("\n "); |
| 958 |
if (!s_mars_ineei_INFO2POS.empty()) field_str.append(s_mars_ineei_INFO2POS).append(" / "); |
| 959 |
field_str.append(s_mars_ineei_INFO2CALL); |
| 960 |
if (!s_mars_ineei_INFO2STATE.empty()) field_str.append(" / ").append(s_mars_ineei_INFO2STATE); |
| 961 |
} |
| 962 |
if (!s_mars_ineei_INFO3CALL.empty() || !s_mars_ineei_INFO3POS.empty()) { |
| 963 |
if (field_str.empty()) field_str.append("\nINFO: "); |
| 964 |
else field_str.append("\n "); |
| 965 |
if (!s_mars_ineei_INFO3POS.empty()) field_str.append(s_mars_ineei_INFO3POS).append(" / "); |
| 966 |
field_str.append(s_mars_ineei_INFO3CALL); |
| 967 |
if (!s_mars_ineei_INFO3STATE.empty()) field_str.append(" / ").append(s_mars_ineei_INFO3STATE); |
| 968 |
} |
| 969 |
if (!s_mars_ineei_INFO4CALL.empty() || !s_mars_ineei_INFO4POS.empty()) { |
| 970 |
if (field_str.empty()) field_str.append("\nINFO: "); |
| 971 |
else field_str.append("\n "); |
| 972 |
if (!s_mars_ineei_INFO4POS.empty()) field_str.append(s_mars_ineei_INFO4POS).append(" / "); |
| 973 |
field_str.append(s_mars_ineei_INFO4CALL); |
| 974 |
if (!s_mars_ineei_INFO4STATE.empty()) field_str.append(" / ").append(s_mars_ineei_INFO4STATE); |
| 975 |
} |
| 976 |
if (!s_mars_ineei_INFO5CALL.empty() || !s_mars_ineei_INFO5POS.empty()) { |
| 977 |
if (field_str.empty()) field_str.append("\nINFO: "); |
| 978 |
else field_str.append("\n "); |
| 979 |
if (!s_mars_ineei_INFO5POS.empty()) field_str.append(s_mars_ineei_INFO5POS).append(" / "); |
| 980 |
field_str.append(s_mars_ineei_INFO5CALL); |
| 981 |
if (!s_mars_ineei_INFO5STATE.empty()) field_str.append(" / ").append(s_mars_ineei_INFO5STATE); |
| 982 |
} |
| 983 |
if (!s_mars_ineei_INFO6CALL.empty() || !s_mars_ineei_INFO6POS.empty()) { |
| 984 |
if (field_str.empty()) field_str.append("\nINFO: "); |
| 985 |
else field_str.append("\n "); |
| 986 |
if (!s_mars_ineei_INFO6POS.empty()) field_str.append(s_mars_ineei_INFO6POS).append("/"); |
| 987 |
field_str.append(s_mars_ineei_INFO6CALL); |
| 988 |
if (!s_mars_ineei_INFO6STATE.empty()) field_str.append(" / ").append(s_mars_ineei_INFO6STATE); |
| 989 |
} |
| 990 |
if (!s_mars_ineei_INFO7CALL.empty() || !s_mars_ineei_INFO7POS.empty()) { |
| 991 |
if (field_str.empty()) field_str.append("\nINFO: "); |
| 992 |
else field_str.append("\n "); |
| 993 |
if (!s_mars_ineei_INFO7POS.empty()) field_str.append(s_mars_ineei_INFO7POS).append("/"); |
| 994 |
field_str.append(s_mars_ineei_INFO7CALL); |
| 995 |
if (!s_mars_ineei_INFO7STATE.empty()) field_str.append(" / ").append(s_mars_ineei_INFO7STATE); |
| 996 |
} |
| 997 |
if (!s_mars_ineei_INFO8CALL.empty() || !s_mars_ineei_INFO8POS.empty()) { |
| 998 |
if (field_str.empty()) field_str.append("\nINFO: "); |
| 999 |
else field_str.append("\n "); |
| 1000 |
if (!s_mars_ineei_INFO8POS.empty()) field_str.append(s_mars_ineei_INFO8POS).append("/"); |
| 1001 |
field_str.append(s_mars_ineei_INFO8CALL); |
| 1002 |
if (!s_mars_ineei_INFO8STATE.empty()) field_str.append(" / ").append(s_mars_ineei_INFO8STATE); |
| 1003 |
} |
| 1004 |
if (!s_mars_ineei_INFO9CALL.empty() || !s_mars_ineei_INFO9POS.empty()) { |
| 1005 |
if (field_str.empty()) field_str.append("\nINFO: "); |
| 1006 |
else field_str.append("\n "); |
| 1007 |
if (!s_mars_ineei_INFO9POS.empty()) field_str.append(s_mars_ineei_INFO9POS).append("/"); |
| 1008 |
field_str.append(s_mars_ineei_INFO9CALL); |
| 1009 |
if (!s_mars_ineei_INFO9STATE.empty()) field_str.append(" / ").append(s_mars_ineei_INFO9STATE); |
| 1010 |
} |
| 1011 |
if (!s_mars_ineei_INFO10CALL.empty() || !s_mars_ineei_INFO10POS.empty()) { |
| 1012 |
if (field_str.empty()) field_str.append("\nINFO: "); |
| 1013 |
else field_str.append("\n "); |
| 1014 |
if (!s_mars_ineei_INFO10POS.empty()) field_str.append(s_mars_ineei_INFO10POS).append("/"); |
| 1015 |
field_str.append(s_mars_ineei_INFO10CALL); |
| 1016 |
if (!s_mars_ineei_INFO10STATE.empty()) field_str.append(" / ").append(s_mars_ineei_INFO10STATE); |
| 1017 |
} |
| 1018 |
replacestr(formnet, info_str, field_str); |
| 1019 |
|
| 1020 |
replacestr(formnet, mars_ineei_INCIDENT, s_mars_ineei_INCIDENT); |
| 1021 |
replacestr(formnet, mars_ineei_INCIDENT, s_mars_ineei_INCIDENT); // 2 in form |
| 1022 |
|
| 1023 |
field_str.clear(); |
| 1024 |
if (!s_mars_ineei_REF.empty()) field_str.append(s_mars_ineei_REF); |
| 1025 |
if (!s_mars_ineei_STATE.empty()) field_str.append(" ").append(s_mars_ineei_STATE); |
| 1026 |
temp = justify_remarks(field_str, strlen("1. REF EVENT IDENTIFIER: ")); |
| 1027 |
replacestr(formnet, ref_str, temp); |
| 1028 |
|
| 1029 |
field_str.clear(); |
| 1030 |
if (!s_mars_ineei_1A_INCIDENT.empty()) field_str.append(s_mars_ineei_1A_INCIDENT); |
| 1031 |
if (!s_mars_ineei_1A_LOCATION.empty()) field_str.append(s_mars_ineei_1A_LOCATION); |
| 1032 |
if (!s_mars_ineei_1A_TIME.empty()) field_str.append(s_mars_ineei_1A_TIME); |
| 1033 |
temp = justify_remarks(field_str, strlen("A. INCIDENT LOCATION TIME: ")); |
| 1034 |
replacestr(formnet, onea_str, temp); |
| 1035 |
|
| 1036 |
temp = justify_remarks(s_mars_ineei_1B_MEDFACSTS, strlen("B. EMERGENCY MEDICAL: ")); |
| 1037 |
replacestr(formnet, mars_ineei_1B_MEDFACSTS, temp); |
| 1038 |
temp = justify_remarks(s_mars_ineei_1C_TRNPSTS, strlen("C. LOCAL TRANSPORTATION: ")); |
| 1039 |
replacestr(formnet, mars_ineei_1C_TRNPSTS, temp); |
| 1040 |
temp = justify_remarks(s_mars_ineei_1D_DAMAGE, strlen("D. GENERAL DAMAGE DESCRIPTION: ")); |
| 1041 |
replacestr(formnet, mars_ineei_1D_DAMAGE, temp); |
| 1042 |
temp = justify_remarks(s_mars_ineei_1E_UTILSTS, strlen("E. UTILITY STATUS: ")); |
| 1043 |
replacestr(formnet, mars_ineei_1E_UTILSTS, temp); |
| 1044 |
temp = justify_remarks(s_mars_ineei_1F_COMMSTS, strlen("F. COMMUNICATIONS STATUS: ")); |
| 1045 |
replacestr(formnet, mars_ineei_1F_COMMSTS, temp); |
| 1046 |
|
| 1047 |
field_str.clear(); |
| 1048 |
if (!s_mars_ineei_1G_INFOSRC.empty()) field_str.append(s_mars_ineei_1G_INFOSRC); |
| 1049 |
if (!s_mars_ineei_1G_INFOTIME.empty()) field_str.append(" ").append(s_mars_ineei_1G_INFOTIME); |
| 1050 |
temp = justify_remarks(field_str, strlen("G. SOURCE OF INFO: ")); |
| 1051 |
replacestr(formnet, oneg_str, temp); |
| 1052 |
|
| 1053 |
temp = justify_remarks(s_mars_ineei_1H_REMARKS, strlen("H. REMARKS: ")); |
| 1054 |
replacestr(formnet, mars_ineei_1H_REMARKS, temp); |
| 1055 |
return formnet; |
| 1056 |
} |
| 1057 |
|
| 1058 |
void cb_mars_ineei_html() |
| 1059 |
{ |
| 1060 |
std::string fname_name = fl_filename_name(def_mars_ineei_filename.c_str()); |
| 1061 |
size_t p = fname_name.rfind('.'); |
| 1062 |
if (p != std::string::npos) fname_name.erase(p); |
| 1063 |
|
| 1064 |
update_mars_ineei_fields(); |
| 1065 |
|
| 1066 |
std::string mars_ineei_fname = ICS_dir; |
| 1067 |
mars_ineei_fname.append(fname_name); |
| 1068 |
mars_ineei_fname.append(".html"); |
| 1069 |
|
| 1070 |
std::string textout = formated_output( mars_ineei_html_template ); |
| 1071 |
|
| 1072 |
FILE *filenet = fopen(mars_ineei_fname.c_str(), "w"); |
| 1073 |
fprintf(filenet,"%s", textout.c_str()); |
| 1074 |
fclose(filenet); |
| 1075 |
|
| 1076 |
open_url(mars_ineei_fname.c_str()); |
| 1077 |
} |
| 1078 |
|
| 1079 |
void cb_mars_ineei_textout() |
| 1080 |
{ |
| 1081 |
std::string mars_ineei_fname = ICS_dir; |
| 1082 |
mars_ineei_fname.append("mars_ineei.txt"); |
| 1083 |
|
| 1084 |
update_mars_ineei_fields(); |
| 1085 |
|
| 1086 |
std::string textout = formated_output( mars_ineei_text_template ); |
| 1087 |
|
| 1088 |
FILE *filenet = fopen(mars_ineei_fname.c_str(), "w"); |
| 1089 |
fprintf(filenet,"%s", textout.c_str()); |
| 1090 |
fclose(filenet); |
| 1091 |
|
| 1092 |
open_url(mars_ineei_fname.c_str()); |
| 1093 |
} |
| 1094 |
|
| 1095 |
/* |
| 1096 |
======================================================================== |
| 1097 |
DE (CALL SIGN MSG NUMBER) |
| 1098 |
(PRECEDENCE) (DTG OF MSG IN Z TIME FORMAT: DYTTTTZ MON YEAR) |
| 1099 |
FM (LAST NAME/CALL SIGN ST OF SENDING STATION) |
| 1100 |
TO RD/AAA1RD MA (POSITION/CALLSIGN ST OF RECIPIENT) |
| 1101 |
INFO REOO/AAM1RE NH (POSITION/CALLSIGN ST OF INFO COPY) |
| 1102 |
INFO (POSITION/CALL SIGN ST OF INFO COPY STATION) |
| 1103 |
BT |
| 1104 |
(MARS EXERCISE OR ACTUAL INCIDENT) |
| 1105 |
SUBJECT: IN/EEI REPORT |
| 1106 |
1. REF (USE APPOPRIATE EVENT IDENTIFIER) / STATE |
| 1107 |
A. (INCIDENT & LOCATION & TIME) |
| 1108 |
B. (EMERGENCY MEDICAL FACILITY STATUS) |
| 1109 |
C. (LOCAL TRANSPORTATION STATUS) |
| 1110 |
D. (GENERAL DAMAGE CHARACTERISTICS) |
| 1111 |
E. (AREA UTILITY STATUS) |
| 1112 |
F. (COMMUNICATION STATUS) |
| 1113 |
G. (INFORMATION SOURCE/TIME) |
| 1114 |
H. (1H_REMARKS) |
| 1115 |
(MARS EXERCISE OR ACTUAL INCIDENT) |
| 1116 |
BT |
| 1117 |
/EX |
| 1118 |
NNNN |
| 1119 |
======================================================================== |
| 1120 |
DE AFA5FE/T NR 1 |
| 1121 |
R 061535Z OCT 2012 |
| 1122 |
FM DAVE ANTRY / AFA5FE/T IL |
| 1123 |
TO: AFN2EC NY |
| 1124 |
INFO: AFD4EC SC |
| 1125 |
AFE5EC WI |
| 1126 |
AFF5IL IL |
| 1127 |
BT |
| 1128 |
REF. MARS EXERCISE |
| 1129 |
SUBJ. EEI REPORT |
| 1130 |
1. REF EVENT IDENTIFIER: BLACK ICE |
| 1131 |
A. INCIDENT LOCATION TIME: ST. CLAIR COUNTY ILLINOIS |
| 1132 |
B. EMERGENCY MEDICAL: NOT AFFECTED |
| 1133 |
C. LOCAL TRANSPORTATION: ALL SECONDARY ROADS ICE COVERED AND IMPASSABLE |
| 1134 |
D. GENERAL DAMAGE DESCRIPTION: MAJOR WINTER ICE STORM. |
| 1135 |
E. UTILITY STATUS: LOCALIZED POWER OUTAGES ARE ALREADY OCCURING. |
| 1136 |
F. COMMUNICATIONS STATUS: OPERATIONAL |
| 1137 |
G. SOURCE OF INFO: ST. CLAIR COUNTY EMERGENCY SERVICES DISASTER AGENCY |
| 1138 |
OFFICAL |
| 1139 |
H. REMARKS: SECONDARY ROADS IMPASSABLE DUE TO PLOWS CONCENTRATING ON MAIN |
| 1140 |
HIGHWAYS. EXPECT MAIN HIGHWAYS TO BECOME IMPASSABLE AND MAJOR POWER OUTAGES |
| 1141 |
PUTTING MOST COMMUNICATIONS CENTERS ON EMERGENCY BACKUP POWER IF FORECASTED |
| 1142 |
ICE ACCUMLATIONS OF UP TO 2 INCHES DURING OVERNIGHT HOURS OCCURS. |
| 1143 |
MARS EXERCISE |
| 1144 |
BT |
| 1145 |
NNNN |
| 1146 |
*/ |