cmap-cvs Mailing List for cmap (Page 10)
Status: Beta
Brought to you by:
dyp
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(87) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
(5) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
(7) |
Mar
|
Apr
(5) |
May
|
Jun
(6) |
Jul
|
Aug
(13) |
Sep
(5) |
Oct
(5) |
Nov
|
Dec
(5) |
2006 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(11) |
Nov
(4) |
Dec
(24) |
2007 |
Jan
(17) |
Feb
(9) |
Mar
(13) |
Apr
(3) |
May
(1) |
Jun
(7) |
Jul
(8) |
Aug
(17) |
Sep
(4) |
Oct
(2) |
Nov
(8) |
Dec
(7) |
2008 |
Jan
(2) |
Feb
(4) |
Mar
(32) |
Apr
(23) |
May
(19) |
Jun
(14) |
Jul
(15) |
Aug
(6) |
Sep
(5) |
Oct
(5) |
Nov
(2) |
Dec
|
From: Denis P. <dy...@us...> - 2004-05-16 04:41:10
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28046 Modified Files: dbf2conf.cpp eval.cpp eval.h evalImpl.h parser.cpp plan.conf topo.conf Log Message: - introduce expression types (int, string, boolean) I went this way because we always know the type of expression, different types can not be mixed, different types has completely different ops. - implement simple assignment expressions for layer_min, layer_max, export, index - change dbf2conf to generate booleans as true/false Index: parser.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/parser.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- parser.cpp 15 May 2004 18:43:12 -0000 1.2 +++ parser.cpp 16 May 2004 04:41:00 -0000 1.3 @@ -45,42 +45,48 @@ } void setValue(ObjectConf &obj, const std::string &varName, Tokenizer &t) { - if (t.nextToken() != TT_NUMBER) - throw ParserException("Expected number"); - if (varName == "export") - switch (t.nval) { - case 0: - obj.doExport = false; - break; - case 1: - obj.doExport = true; - break; - default: - throw ParserException("Invalid export value"); + if ((varName == "export") || (varName == "index")) { // boolean vars + if (t.nextToken() != TT_WORD) + throw ParserException("Expected 'true' or 'false'"); + + BoolAssign *a = new BoolAssign(); + + if (t.sval == "true") + a->rvalue = new BoolConst(true); + else if (t.sval == "false") + a->rvalue = new BoolConst(false); + else + throw ParserException("Expected 'true' or 'false'"); + + if (varName == "export") + a->lvalue = new ExportVar(); + else if (varName == "index") + a->lvalue = new IndexVar(); + obj.addAssign(a); + } else { + if (t.nextToken() != TT_NUMBER) + throw ParserException("Expected number"); + else if (varName == "point") + obj.typePoint = t.nval; + else if (varName == "line") + obj.typeLine = t.nval; + else if (varName == "polygon") + obj.typePoly = t.nval; + else if (varName == "layer_min") { + IntAssign *a = new IntAssign(); + a->lvalue = new LayerMinVar(); + a->rvalue = new IntConst(t.nval); + obj.addAssign(a); } - else if (varName == "index") - switch (t.nval) { - case 0: - obj.index = false; - break; - case 1: - obj.index = true; - break; - default: - throw ParserException("Invalid index value"); + else if (varName == "layer_max") { + IntAssign *a = new IntAssign(); + a->lvalue = new LayerMaxVar(); + a->rvalue = new IntConst(t.nval); + obj.addAssign(a); } - else if (varName == "point") - obj.typePoint = t.nval; - else if (varName == "line") - obj.typeLine = t.nval; - else if (varName == "polygon") - obj.typePoly = t.nval; - else if (varName == "layer_min") - obj.layerMin = t.nval; - else if (varName == "layer_max") - obj.layerMax = t.nval; - else - throw ParserException("Invalid variable name"); + else + throw ParserException("Invalid variable name"); + } } bool readObject(Tokenizer &t) { @@ -99,6 +105,9 @@ if (t.nextToken() != TT_WORD) throw ParserException("Expected object code"); + if (t.sval.length() > 8) + throw ParserException("Object code is longer than 8"); + ObjectConf obj; strcpy(obj.object_cod, t.sval.c_str()); Index: topo.conf =================================================================== RCS file: /cvsroot/cmap/cmap/topo.conf,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- topo.conf 15 May 2004 17:49:33 -0000 1.1 +++ topo.conf 16 May 2004 04:41:00 -0000 1.2 @@ -1,37 +1,37 @@ // Âëîæåííàÿ êàðòà object "90100000" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ëèíèÿ çàìûêàíèÿ object "91100000" { - export = 0; + export = false; [...3037 lines suppressed...] + export = false; line = 0x1C; layer_min = 0; layer_max = 0; } // Ïðî÷èå ãðàíèöû object "81200000" { - export = 0; + export = false; line = 0x1C; layer_min = 0; layer_max = 0; } // Ìîñò object "62310000" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } Index: eval.h =================================================================== RCS file: /cvsroot/cmap/cmap/eval.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- eval.h 15 May 2004 18:43:12 -0000 1.1 +++ eval.h 16 May 2004 04:41:00 -0000 1.2 @@ -11,6 +11,7 @@ } objectType; bool index; + bool doExport; int type; @@ -23,7 +24,7 @@ int typePoly; } ObjectProp; -bool evalObjectProp(h_object *obj, ObjectProp &o); +bool evalObjectProp(const h_object *obj, ObjectProp &o); void clearWarnedEval(); #endif Index: plan.conf =================================================================== RCS file: /cvsroot/cmap/cmap/plan.conf,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- plan.conf 15 May 2004 17:49:33 -0000 1.1 +++ plan.conf 16 May 2004 04:41:00 -0000 1.2 @@ -1,21 +1,21 @@ // Íàñåëåííûé ïóíêò object "CT" { - export = 1; + export = true; polygon = 0x17; layer_min = 0; layer_max = 2; } // Ãðàíèöà object "BC" { - export = 1; + export = true; line = 0x1D; layer_min = 2; layer_max = 3; } // Ëèíèÿ ãðàíèö äîðîã, ïðîåçæèõ ÷àñòåé object "BB" { - export = 0; - index = 0; + export = false; + index = false; point = 0x6406; line = 0x1C; layer_min = 0; @@ -23,7 +23,7 @@ } // Óëèöà, ïëîùàäü, áóëüâàð, ÷àñòü òðàññû object "ST" { - export = 1; + export = true; line = 0x06; polygon = 0x17; layer_min = 0; @@ -31,22 +31,22 @@ } // Äâîð object "DW" { - export = 1; + export = true; polygon = 0x17; layer_min = 0; layer_max = 1; } // Îãðàæäåíèå object "GR" { - export = 0; + export = false; line = 0x1C; layer_min = 0; layer_max = 0; } // Öåðêîâü, õðàì, ìå÷åòü, ñèíàãîãà .. object "RB" { - export = 1; - index = 0; + export = true; + index = false; point = 0x6404; polygon = 0x1A; layer_min = 0; @@ -54,15 +54,15 @@ } // Ñòàäèîí, ñïîðòèâíàÿ ïëîùàäêà object "SR" { - export = 1; + export = true; polygon = 0x19; layer_min = 0; layer_max = 0; } // Êëàäáèùå object "BP" { - export = 1; - index = 0; + export = true; + index = false; point = 0x6403; polygon = 0x1A; layer_min = 0; @@ -70,30 +70,30 @@ } // Ñòàíöèÿ ìåòðî object "UO" { - export = 1; - index = 0; + export = true; + index = false; point = 0x2700; layer_min = 0; layer_max = 1; } // Ó÷àñòîê äîðîãè object "RD" { - export = 1; + export = true; line = 0x05; layer_min = 0; layer_max = 1; } // Òðàìâàéíàÿ ëèíèÿ object "RT" { - export = 1; + export = true; line = 0x14; layer_min = 0; layer_max = 0; } // Æåëåçíîäîðîæíàÿ ëèíèÿ object "RW" { - export = 1; - index = 0; + export = true; + index = false; point = 0x2000; line = 0x1B; layer_min = 0; @@ -101,36 +101,36 @@ } // Ðå÷íàÿ (ìîðñêàÿ) ïðèñòàíü object "SP" { - export = 1; - index = 0; + export = true; + index = false; point = 0x2F09; layer_min = 0; layer_max = 0; } // Àâòîñòîÿíêè, ãàðàæè object "GA" { - export = 1; + export = true; polygon = 0x05; layer_min = 0; layer_max = 0; } // Ðàéîí ìîðÿ, çàëèâ object "SE" { - export = 1; + export = true; polygon = 0x28; layer_min = 0; layer_max = 0; } // Îçåðî object "LK" { - export = 1; + export = true; polygon = 0x3C; layer_min = 0; layer_max = 1; } // Âîäîõðàíèëèùå object "LW" { - export = 1; + export = true; line = 0x1F; polygon = 0x45; layer_min = 0; @@ -138,21 +138,21 @@ } // Ïðóä object "RE" { - export = 1; + export = true; polygon = 0x41; layer_min = 0; layer_max = 0; } // Äåêîðàòèâíûé áàññåéí object "BA" { - export = 1; + export = true; polygon = 0x3C; layer_min = 0; layer_max = 0; } // Ðåêà object "RI" { - export = 1; + export = true; line = 0x1F; polygon = 0x46; layer_min = 0; @@ -160,7 +160,7 @@ } // Êàíàë object "CA" { - export = 1; + export = true; line = 0x1F; polygon = 0x46; layer_min = 0; @@ -168,7 +168,7 @@ } // Ðó÷åé object "RU" { - export = 1; + export = true; line = 0x1F; polygon = 0x46; layer_min = 0; @@ -176,8 +176,8 @@ } // Äðåâåñíàÿ ðàñòèòåëüíîñòü object "TZ" { - export = 1; - index = 0; + export = true; + index = false; point = 0x660A; polygon = 0x16; layer_min = 0; @@ -185,8 +185,8 @@ } // Îòäåëüíûå äåðåâüÿ object "TR" { - export = 1; - index = 0; + export = true; + index = false; point = 0x660A; polygon = 0x16; layer_min = 0; @@ -194,8 +194,8 @@ } // Âûðóáêà object "VR" { - export = 1; - index = 0; + export = true; + index = false; point = 0x660A; polygon = 0x16; layer_min = 0; @@ -203,8 +203,8 @@ } // Êóëüòóðíàÿ ðàñòèòåëüíîñòü, ñàäû object "CZ" { - export = 1; - index = 0; + export = true; + index = false; point = 0x660A; polygon = 0x16; layer_min = 0; @@ -212,8 +212,8 @@ } // Êóñàðíèêîâàÿ ðàñòèåëüíîñòü object "BZ" { - export = 1; - index = 0; + export = true; + index = false; point = 0x660A; polygon = 0x16; layer_min = 0; @@ -221,8 +221,8 @@ } // Òðàâÿíàÿ ðàñòèòåëüíîñòü object "DZ" { - export = 1; - index = 0; + export = true; + index = false; point = 0x660A; polygon = 0x16; layer_min = 0; @@ -230,8 +230,8 @@ } // Ïàðíèêè, îðàíæåðåè, òåïëèöû object "PR" { - export = 1; - index = 0; + export = true; + index = false; point = 0x660A; polygon = 0x16; layer_min = 0; @@ -239,80 +239,80 @@ } // Ïðîñåêè object "PC" { - export = 1; + export = true; line = 0x16; layer_min = 0; layer_max = 0; } // Òåêñò object "TX" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Âëîæåííàÿ êàðòà object "$C" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ôîí ïîäïèñè object "FN" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ïóíêòû ããñ object "GS" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Îòìåòêà âûñîòû object "HT" { - export = 1; - index = 0; + export = true; + index = false; point = 0x6300; layer_min = 0; layer_max = 0; } // Ðåïåð object "RP" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Àäìèíèñòðàòèâíûé ðàéîí object "DI" { - export = 0; + export = false; polygon = 0x03; layer_min = 0; layer_max = 0; } // Òåððèòîðèÿ ãîðîäñêîé çàñòðîéêè object "LA" { - export = 1; + export = true; polygon = 0x17; layer_min = 1; layer_max = 1; } // Ëèíèÿ ïðîåêòèðóåìîé çàñòðîéêè object "BO" { - export = 0; + export = false; line = 0x1C; layer_min = 0; layer_max = 0; } // Ýëåìåíò òîðîëîãèè ïðîåçäà object "TP" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Çäàíèå object "BL" { - export = 1; - index = 0; + export = true; + index = false; point = 0x6402; line = 0x06; polygon = 0x17; @@ -321,103 +321,103 @@ } // Ýëåìåíòû çäàíèé, ñîîðóæåíèé object "EB" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ãðàíèöû ÷àñòåé çäàíèé object "GL" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ïàìÿòíèêè àðõèòåêòóðû object "PA" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ïëÿæ object "SH" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ìîíóìåíò, ïàìÿòíèê object "MM" { - export = 1; - index = 0; + export = true; + index = false; point = 0x2C04; layer_min = 0; layer_max = 0; } // Ôîíòàí object "WC" { - export = 1; - index = 0; + export = true; + index = false; point = 0x6511; layer_min = 0; layer_max = 0; } // Ëåñòíèöà object "SW" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Áåñåäêà, áóäêà object "BS" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ó÷àñòîê òðàñïîðòíîé ìàãèñòðàëè object "TM" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Âîêçàëû, àýðîïîðòû object "BH" { - export = 1; - index = 0; + export = true; + index = false; point = 0x2F04; layer_min = 0; layer_max = 0; } // Àýðîäðîìû object "AE" { - export = 1; - index = 0; + export = true; + index = false; point = 0x5901; layer_min = 0; layer_max = 3; } // Íîìåð äîðîãè object "RN" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Æåëåçíîäîðîæíàÿ ïëàòôîðìà object "RC" { - export = 1; - index = 0; + export = true; + index = false; point = 0x2000; layer_min = 0; layer_max = 2; } // Òóííåëü object "TU" { - export = 1; + export = true; polygon = 0x0C; layer_min = 0; layer_max = 0; } // Ìîñò object "BR" { - export = 1; - index = 0; + export = true; + index = false; point = 0x6401; line = 0x1A; polygon = 0x0C; @@ -426,37 +426,37 @@ } // Ïðîåçä â àðêå object "AR" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ïàðîì object "PM" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Îñòàíîâêè îáùåñòâåííîãî òðàíñïîðòà object "PS" { - export = 0; + export = false; layer_min = 0; layer_max = 1; } // Ïîäâåñíûå äîðîãè object "HR" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ñâåòîôîð object "SF" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Êàíàâà object "KW" { - export = 1; + export = true; line = 0x18; polygon = 0x4C; layer_min = 0; @@ -464,347 +464,347 @@ } // Ïëîòèíà object "PL" { - export = 1; + export = true; line = 0x1A; layer_min = 0; layer_max = 0; } // Äàìáà object "DA" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Îñòðîâ object "OS" { - export = 1; + export = true; polygon = 0x53; layer_min = 0; layer_max = 0; } // Øëþçû object "SL" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Òðóáû object "WF" { - export = 1; + export = true; line = 0x28; layer_min = 0; layer_max = 0; } // Èñòî÷íèêè, êîëîäöû object "IS" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Íàáåðåæíàÿ object "NB" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Íàïðàâëåíèå òå÷åíèÿ object "NT" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Âîäîðîñëè object "VD" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ìîðñêèå ïóòè object "MW" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Íàâèãàöèîííîå îáîðóäîâàíèå object "RS" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Õàðàêòåðèñòèêè ðåê è êàíàëîâ object "FR" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Óðåç âîäû object "WL" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ïîðîãè object "TH" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Êàìíè, ñêàëû object "RO" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Îòìåëü, áàíêà object "BK" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Âîäîìåðíûé ïîñò object "WP" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ìîëû, ïðè÷àëû è âîëíîëîìû object "WS" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ãîðèçîíòàëü object "GG" { - export = 1; + export = true; line = 0x22; layer_min = 0; layer_max = 0; } // Èçîáàòà object "BT" { - export = 1; + export = true; line = 0x25; layer_min = 0; layer_max = 0; } // Ôîðìû ðåëúåôà object "RF" { - export = 0; + export = false; line = 0x22; layer_min = 0; layer_max = 0; } // Îòäåëüíî ëåæàùèå êàìíè object "SN" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Âõîäû â ïåùåðû è ãðîòû object "CV" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Òðóáû object "TB" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ýëåêòðè÷åñêèå ïîäñòàíöèè object "EP" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Âîäîíàïîðíàÿ áàøíÿ object "WB" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Òðóáîïðîâîä object "PT" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ëèíèÿ ýëåêòðîïåðåäà÷ object "EL" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ëèíèÿ ñâÿçè object "TL" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ñêâàæèíû object "SK" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ïðîì. ïðåäïðèÿòèÿ object "PP" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Çàâîäñêèå è ôàáðè÷íûå òðóáû object "ZT" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Çàïðàâî÷íûå ñòàíöèè object "ZS" { - export = 1; - index = 0; + export = true; + index = false; point = 0x2F01; layer_min = 0; layer_max = 0; } // Îòäåëüíûå öèñòåðíû object "CI" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Áàøíè object "BN" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ìà÷òû object "MH" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Íàâåñ object "AW" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Îòñòîéíèê object "OT" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ìåòåîðîëîãè÷åñêèå ñòàíöèè object "MS" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Êàðüåð object "QU" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Òîðôîðàçðàáîòêè object "TF" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ëîòêè äëÿ ñïóñêà object "LS" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ãðóíò object "GT" { - export = 1; + export = true; polygon = 0x53; layer_min = 0; layer_max = 0; } // Õàðàêòåðèñòèêà ðàñòèòåëüíîñòè object "FV" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Àäðåñà, ñãðóïïèðîâàíûå ïî óëèöàì object "A1" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Àäðåñ äîìà object "A2" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ìàðøðóò äâèæåíèÿ object "LL" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Íà÷àëî ìàðøðóòà object "P1" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Êîíåö ìàðøðóòà object "P2" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Êîíòðîëüíûå òî÷êè äëÿ ïðîêëàäêè ìàðøðóòà object "P3" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Òî÷êè çàïðåòà ïðîåçäà äëÿ ïðîêëàäêè ìàðøðóò object "P4" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ñãðóïïèðîâàíûå ïî íàçâàíèÿì ó÷àñòêè äîðîã object "T1" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ó÷àñòêè äîðîã ñ õàðàêòåðèñòèêàìè object "T2" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Ïîâîðîò íà ïåðåêðåñòêå çàïðåùåí object "T3" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Âîçìîæíîå äâèæåíèå ïî ïåðåêðåñòêó object "T4" { - export = 0; + export = false; layer_min = 0; layer_max = 0; } // Áðîä object "BD" { - export = 1; - index = 0; + export = true; + index = false; point = 0x6412; line = 0x16; layer_min = 0; Index: eval.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/eval.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- eval.cpp 15 May 2004 18:43:12 -0000 1.1 +++ eval.cpp 16 May 2004 04:41:00 -0000 1.2 @@ -55,7 +55,7 @@ warnedCODsize = 0; } -bool evalObjectProp(h_object *obj, ObjectProp &o) { +bool evalObjectProp(const h_object *obj, ObjectProp &o) { for (unsigned int i = 0; i < objLen; i++) if (strcmp(objs[i].object_cod, obj->Cod + 1) == 0) return objs[i].handle(obj, o); @@ -66,10 +66,27 @@ return false; } -bool ObjectConf::handle(h_object *obj, ObjectProp &o) { - if (!doExport) +void IntAssign::exec(const h_object *obj, ObjectProp &o) { + lvalue->setValue(o, rvalue->getValue(obj, o)); +} + +void StringAssign::exec(const h_object *obj, ObjectProp &o) { + lvalue->setValue(o, rvalue->getValue(obj)); +} + +void BoolAssign::exec(const h_object *obj, ObjectProp &o) { + lvalue->setValue(o, rvalue->getValue(obj, o)); +} + +bool ObjectConf::handle(const h_object *obj, ObjectProp &o) { + memset(&o, 0, sizeof(ObjectProp)); + + for (Assign *a = first; a != NULL; a = a->next) + a->exec(obj, o); + + if (!o.doExport) return false; - o.index = index; + switch (obj->Cod[0]) { case 'P': o.type = typePoint; @@ -92,8 +109,5 @@ o.typeLine = typeLine; o.typePoly = typePoly; - o.layerMin = layerMin; - o.layerMax = layerMax; - return true; } Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/cmap/evalImpl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- evalImpl.h 15 May 2004 18:43:12 -0000 1.1 +++ evalImpl.h 16 May 2004 04:41:00 -0000 1.2 @@ -1,21 +1,177 @@ #ifndef __CMAP_EVALIMPL_H__ #define __CMAP_EVALIMPL_H__ +#include <string> +#include <vector> + #include "eval.h" #include "IngitFile.h" +class StringExpr { +public: + virtual std::string getValue(const h_object *obj) = 0; +}; + +class StringVar : public StringExpr { +public: + virtual std::string getValue(const h_object *obj) = 0; + virtual void setValue(ObjectProp &o, std::string &value) = 0; +}; + +class StringConst : public StringExpr { +public: + virtual std::string getValue(const h_object *obj) { + return value; + } +protected: + std::string value; +}; + +class IntExpr { +public: + virtual int getValue(const h_object *obj, const ObjectProp &o) = 0; +}; + +class IntVar : public IntExpr { +public: + virtual int getValue(const h_object *obj, const ObjectProp &o) = 0; + virtual void setValue(ObjectProp &o, int value) = 0; +}; + +class LayerMinVar : public IntVar { + virtual int getValue(const h_object *, const ObjectProp &o) { + return o.layerMin; + } + + virtual void setValue(ObjectProp &o, int value) { + o.layerMin = value; + } +}; + +class LayerMaxVar : public IntVar { + virtual int getValue(const h_object *, const ObjectProp &o) { + return o.layerMax; + } + + virtual void setValue(ObjectProp &o, int value) { + o.layerMax = value; + } +}; + +class IntConst : public IntExpr { +public: + IntConst(int _value) : value(_value) { + }; + + virtual int getValue(const h_object *, const ObjectProp &) { + return value; + } +protected: + int value; +}; + +class BoolExpr { +public: + virtual bool getValue(const h_object *obj, const ObjectProp &o) = 0; +}; + +class BoolVar : public BoolExpr { +public: + virtual bool getValue(const h_object *obj, const ObjectProp &o) = 0; + virtual void setValue(ObjectProp &o, bool value) = 0; +}; + +class BoolConst : public BoolExpr { +public: + BoolConst(bool _value) : value(_value) { + }; + + virtual bool getValue(const h_object *, const ObjectProp &) { + return value; + } +protected: + bool value; +}; + +class ExportVar : public BoolVar { + virtual bool getValue(const h_object *, const ObjectProp &o) { + return o.doExport; + } + + virtual void setValue(ObjectProp &o, bool value) { + o.doExport = value; + } +}; + +class IndexVar : public BoolVar { + virtual bool getValue(const h_object *, const ObjectProp &o) { + return o.index; + } + + virtual void setValue(ObjectProp &o, bool value) { + o.index = value; + } +}; + +class Assign { +public: + Assign() : next(NULL) { + } + + virtual void exec(const h_object *obj, ObjectProp &o) = 0; + + Assign *next; +}; + +class StringAssign : public Assign { +public: + StringVar *lvalue; + StringExpr *rvalue; + + virtual void exec(const h_object *obj, ObjectProp &o); +}; + +class IntAssign : public Assign { +public: + IntVar *lvalue; + IntExpr *rvalue; + + virtual void exec(const h_object *obj, ObjectProp &o); +}; + +class BoolAssign : public Assign { +public: + BoolVar *lvalue; + BoolExpr *rvalue; + + virtual void exec(const h_object *obj, ObjectProp &o); +}; + class ObjectConf { public: - bool handle(h_object *obj, ObjectProp &o); + ObjectConf() : first(NULL), last(NULL) { + } + + bool handle(const h_object *obj, ObjectProp &o); - bool doExport; // Ïðèçíàê ýêñïîðòà. 0 - çàïðåò. char object_cod[9]; // 8-çíà÷íûé êîäèôèêàòîð ÂÒÓ - bool index; + int typePoint; int typeLine; int typePoly; - int layerMin; // Layer_min cGPSmap - int layerMax; // Layer_max cGPSmap + + void addAssign(Assign *a) { + if (first == NULL) { + first = a; + last = a; + } else { + last->next = a; + last = a; + } + } + + Assign *first; + Assign *last; }; void addObjectConf(ObjectConf &obj); Index: dbf2conf.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/dbf2conf.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- dbf2conf.cpp 15 May 2004 17:48:16 -0000 1.1 +++ dbf2conf.cpp 16 May 2004 04:41:00 -0000 1.2 @@ -254,11 +254,14 @@ DosToWin (bufsrt, (BYTE *)file_cod1[j].CHR_RUS); printf("// %s\n", bufsrt); printf("object \"%s\" {\n", file_cod1[j].object_cod); - printf(" export = %d;\n", file_cod1[j].do_export); + if (file_cod1[j].do_export == 0) + printf(" export = false;\n"); + else if (file_cod1[j].do_export == 1) + printf(" export = true;\n"); if (file_cod1[j].RGN_point == 0x10) - printf(" index = 0;\n"); + printf(" index = false;\n"); else if (file_cod1[j].RGN_point == 0x20) - printf(" index = 1;\n"); + printf(" index = true;\n"); if (file_cod1[j].TYPE_point != -1) printf(" point = 0x%.4X;\n", file_cod1[j].TYPE_point); if (file_cod1[j].TYPE_line != -1) |
From: Denis P. <dy...@us...> - 2004-05-16 03:37:55
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18113 Modified Files: common.h Log Message: Disable warning 4103. Index: common.h =================================================================== RCS file: /cvsroot/cmap/cmap/common.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- common.h 11 May 2004 21:30:00 -0000 1.10 +++ common.h 16 May 2004 03:37:46 -0000 1.11 @@ -12,6 +12,7 @@ //#endif #ifdef _MSC_VER +#pragma warning(disable : 4103) #pragma pack (1) #endif |
From: Denis P. <dy...@us...> - 2004-05-16 02:40:44
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8872 Modified Files: common.cpp Log Message: Handle EOLs correctly. Index: common.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/common.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- common.cpp 14 May 2004 02:53:09 -0000 1.11 +++ common.cpp 16 May 2004 02:40:35 -0000 1.12 @@ -17,6 +17,8 @@ return ch + 64; if (ch < 127 ) return ch; + if (ch == 222) // This is a special case. It is used at EOL in Ingit. + return ' '; return ch; } |
From: Denis P. <dy...@us...> - 2004-05-15 18:43:22
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15616 Modified Files: PolishFormat.cpp cmap.cpp cmap.dsp parser.cpp Added Files: eval.cpp eval.h evalImpl.h Removed Files: dbf.cpp dbf.h Log Message: Completely remove DBF part. Everything is our own now. Index: parser.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/parser.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- parser.cpp 15 May 2004 17:49:33 -0000 1.1 +++ parser.cpp 15 May 2004 18:43:12 -0000 1.2 @@ -1,8 +1,8 @@ #include <stdio.h> -#include "dbf.h" #include "common.h" +#include "evalImpl.h" #include "tokenizer.h" #include "parser.h" @@ -44,32 +44,41 @@ } } -void setValue(const std::string &varName, Tokenizer &t) { +void setValue(ObjectConf &obj, const std::string &varName, Tokenizer &t) { if (t.nextToken() != TT_NUMBER) throw ParserException("Expected number"); if (varName == "export") - file_cod1[recnum].do_export = t.nval; + switch (t.nval) { + case 0: + obj.doExport = false; + break; + case 1: + obj.doExport = true; + break; + default: + throw ParserException("Invalid export value"); + } else if (varName == "index") switch (t.nval) { case 0: - file_cod1[recnum].RGN_point = 0x10; + obj.index = false; break; case 1: - file_cod1[recnum].RGN_point = 0x20; + obj.index = true; break; default: throw ParserException("Invalid index value"); } else if (varName == "point") - file_cod1[recnum].TYPE_point = t.nval; + obj.typePoint = t.nval; else if (varName == "line") - file_cod1[recnum].TYPE_line = t.nval; + obj.typeLine = t.nval; else if (varName == "polygon") - file_cod1[recnum].TYPE_poly = t.nval; + obj.typePoly = t.nval; else if (varName == "layer_min") - file_cod1[recnum].img_layer_min = t.nval; + obj.layerMin = t.nval; else if (varName == "layer_max") - file_cod1[recnum].img_layer_max = t.nval; + obj.layerMax = t.nval; else throw ParserException("Invalid variable name"); } @@ -90,7 +99,8 @@ if (t.nextToken() != TT_WORD) throw ParserException("Expected object code"); - strcpy(file_cod1[recnum].object_cod, t.sval.c_str()); + ObjectConf obj; + strcpy(obj.object_cod, t.sval.c_str()); if (t.nextToken() != '{') throw ParserException("Expected '{'"); @@ -106,11 +116,12 @@ if (t.nextToken() != '=') throw ParserException("Expected '='"); - setValue(varName, t); + setValue(obj, varName, t); if (t.nextToken() != ';') throw ParserException("Expected ';'"); } - recnum++; + + addObjectConf(obj); return true; } @@ -135,8 +146,6 @@ t.whitespaceChar('\t'); t.slashSlashComments(true); - file_cod1 = (topo_cod1 *)s_malloc(sizeof(topo_cod1) * 65536); - try { while (readObject(t)) ; --- dbf.h DELETED --- --- NEW FILE: eval.h --- #ifndef __CMAP_EVAL_H__ #define __CMAP_EVAL_H__ #include "IngitFile.h" typedef struct { enum ObjectType { POINT, LINE, POLYGON } objectType; bool index; int type; int layerMin; int layerMax; //HACK until everything is cleaned out int typePoint; int typeLine; int typePoly; } ObjectProp; bool evalObjectProp(h_object *obj, ObjectProp &o); void clearWarnedEval(); #endif // __CMAP_EVAL_H__ Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- PolishFormat.cpp 12 May 2004 18:40:41 -0000 1.26 +++ PolishFormat.cpp 15 May 2004 18:43:12 -0000 1.27 @@ -4,7 +4,7 @@ #include "IngitFile.h" #include "IngitTable.h" -#include "dbf.h" +#include "eval.h" #include "Geodesy.h" #include "cmap.h" @@ -120,25 +120,32 @@ WGS84SK42Projection WGS (1.0); printf("Writing file...\n"); + ObjectProp o; for (unsigned short NumObj = 1; NumObj < Max_Num_OBJ; NumObj++) { - if (Index_Atr[obj[NumObj].num] == 0) // Skip deleted objects + if (Index_Atr[obj[NumObj].num] == 0) { // Skip deleted objects + fprintf (outIMG, "; %s NUM_OBJ %i %s skipped\n", + obj[NumObj].Cod, NumObj, FileIMG); continue; + } // Ïðîâåðêà íà EXPORT - short DBF_line = Check_export(obj[NumObj].Cod + 1); - if (DBF_line == -1) // òèï òåêóùåãî îáúåêòà íå íàéäåí â òàáëèöå ïðåîáðàçîâàíèÿ + if (!evalObjectProp(obj + NumObj, o)) // òèï òåêóùåãî îáúåêòà íå íàéäåí â òàáëèöå ïðåîáðàçîâàíèÿ continue; - RGN_point = file_cod1[DBF_line].RGN_point; - Type_point = file_cod1[DBF_line].TYPE_point; - Type_line = file_cod1[DBF_line].TYPE_line; - Type_poly = file_cod1[DBF_line].TYPE_poly; - img_Layer_max = file_cod1[DBF_line].img_layer_max; - img_Layer_min = file_cod1[DBF_line].img_layer_min; + if (o.index) + RGN_point = 0x20; + else + RGN_point = 0x10; + + Type_point = o.typePoint; + Type_line = o.typeLine; + Type_poly = o.typePoly; + img_Layer_max = o.layerMax; + img_Layer_min = o.layerMin; //if (img_Layer_max > 3 ) img_Layer_max = 3; num_array = ReadMetric(NumObj, Maps, latSW, lonSW, latNE, lonNE); - if ( num_array == 1) + if (num_array == 1) obj[NumObj].Cod[0] = 'P'; // Îáðåçàíèå ïî ðàìêå @@ -1530,7 +1537,7 @@ // Çàïðåò àâòîìàòè÷åñêîãî ðàçíîñà ïî ñëîÿì. if (comm_layer == 1) - img_Layer_max = file_cod1[DBF_line].img_layer_max; + img_Layer_max = o.layerMax; switch (type_obj) { // Ïðîâåðêà íà òèï îáúåêòà // Òî÷å÷íûé îáúåêò @@ -1959,5 +1966,5 @@ } // END FOR clearWarned(); - clearWarnedDBF(); + clearWarnedEval(); } Index: cmap.dsp =================================================================== RCS file: /cvsroot/cmap/cmap/cmap.dsp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- cmap.dsp 15 May 2004 17:49:33 -0000 1.5 +++ cmap.dsp 15 May 2004 18:43:12 -0000 1.6 @@ -93,7 +93,7 @@ # End Source File # Begin Source File -SOURCE=.\dbf.cpp +SOURCE=.\eval.cpp # End Source File # Begin Source File @@ -137,7 +137,11 @@ # End Source File # Begin Source File -SOURCE=.\dbf.h +SOURCE=.\eval.h +# End Source File +# Begin Source File + +SOURCE=.\evalImpl.h # End Source File # Begin Source File Index: cmap.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/cmap.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- cmap.cpp 15 May 2004 17:49:33 -0000 1.33 +++ cmap.cpp 15 May 2004 18:43:12 -0000 1.34 @@ -19,7 +19,6 @@ #include "common.h" #include "parser.h" -#include "dbf.h" #include "IngitFile.h" #include "PolishFormat.h" --- NEW FILE: eval.cpp --- #include <string.h> #include <stdlib.h> #include "eval.h" #include "evalImpl.h" static ObjectConf *objs = NULL; static unsigned int objSize = 0; static unsigned int objLen = 0; void addObjectConf(ObjectConf &obj) { if (objs == NULL) { objSize = 256; objs = (ObjectConf *)s_malloc(sizeof(ObjectConf) * objSize); } else if (objSize == objLen) { objSize *= 2; objs = (ObjectConf *)s_realloc(objs, sizeof(ObjectConf) * objSize); } objs[objLen] = obj; objLen++; } void clearObjectConf() { if (objs != NULL) { s_free(objs); objLen = 0; objSize = 0; } } static char const **warnedCODs = NULL; static size_t warnedCODpos = 0; static size_t warnedCODsize = 0; static bool checkWarned(const char *cod) { for (size_t i = 0; i < warnedCODpos; i++) if (strcmp(warnedCODs[i], cod) == 0) return true; if (warnedCODpos >= warnedCODsize) { warnedCODsize = (warnedCODs == NULL) ? 256 : warnedCODsize * 2; warnedCODs = (char const **)s_realloc(warnedCODs, warnedCODsize * sizeof(char *)); } warnedCODs[warnedCODpos++] = cod; return false; } void clearWarnedEval() { if (warnedCODs != NULL) s_free(warnedCODs); warnedCODs = NULL; warnedCODpos = 0; warnedCODsize = 0; } bool evalObjectProp(h_object *obj, ObjectProp &o) { for (unsigned int i = 0; i < objLen; i++) if (strcmp(objs[i].object_cod, obj->Cod + 1) == 0) return objs[i].handle(obj, o); ASSERT(obj->Cod[1] != 0); if (!checkWarned(obj->Cod + 1)) printf("Warning!!! Type not found in config: '%s'\n", obj->Cod + 1); return false; } bool ObjectConf::handle(h_object *obj, ObjectProp &o) { if (!doExport) return false; o.index = index; switch (obj->Cod[0]) { case 'P': o.type = typePoint; o.objectType = ObjectProp::POINT; break; case 'L': o.type = typeLine; o.objectType = ObjectProp::LINE; break; case 'A': o.type = typePoly; o.objectType = ObjectProp::POLYGON; break; default: printf("Unknown object type: '%c'\n", obj->Cod[0]); exit(1); } o.typePoint = typePoint; o.typeLine = typeLine; o.typePoly = typePoly; o.layerMin = layerMin; o.layerMax = layerMax; return true; } --- NEW FILE: evalImpl.h --- #ifndef __CMAP_EVALIMPL_H__ #define __CMAP_EVALIMPL_H__ #include "eval.h" #include "IngitFile.h" class ObjectConf { public: bool handle(h_object *obj, ObjectProp &o); bool doExport; // Ïðèçíàê ýêñïîðòà. 0 - çàïðåò. char object_cod[9]; // 8-çíà÷íûé êîäèôèêàòîð ÂÒÓ bool index; int typePoint; int typeLine; int typePoly; int layerMin; // Layer_min cGPSmap int layerMax; // Layer_max cGPSmap }; void addObjectConf(ObjectConf &obj); void clearObjectConf(); #endif // __CMAP_EVALIMPL_H__ --- dbf.cpp DELETED --- |
From: Denis P. <dy...@us...> - 2004-05-15 17:49:43
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4505 Modified Files: cmap.dsp cmap.cpp Added Files: topo.conf plan.conf parser.h parser.cpp Log Message: Implement a parser with the same functionality as DBF files. At least text files are smaller and easier to merge with CVS. More to follow. --- NEW FILE: parser.cpp --- #include <stdio.h> #include "dbf.h" #include "common.h" #include "tokenizer.h" #include "parser.h" ParserException::ParserException(const char *_msg) : msg(_msg) { } ParserException::~ParserException() throw () { } void ParserException::raise(const char *_msg) { throw ParserException(_msg); } const char *ParserException::name() const throw() { return "ParserException"; } const char *ParserException::what() const throw() { return msg; } static void printToken(const Tokenizer &t) { switch (t.ttype) { case TT_EOF: printf("eof\n"); return; case TT_EOL: printf("eol\n"); break; case TT_NUMBER: printf("num: %d\n", t.nval); break; case TT_WORD: printf("word: %s\n", t.sval.c_str()); break; default: printf("char: %c\n", (unsigned char)t.ttype); break; } } void setValue(const std::string &varName, Tokenizer &t) { if (t.nextToken() != TT_NUMBER) throw ParserException("Expected number"); if (varName == "export") file_cod1[recnum].do_export = t.nval; else if (varName == "index") switch (t.nval) { case 0: file_cod1[recnum].RGN_point = 0x10; break; case 1: file_cod1[recnum].RGN_point = 0x20; break; default: throw ParserException("Invalid index value"); } else if (varName == "point") file_cod1[recnum].TYPE_point = t.nval; else if (varName == "line") file_cod1[recnum].TYPE_line = t.nval; else if (varName == "polygon") file_cod1[recnum].TYPE_poly = t.nval; else if (varName == "layer_min") file_cod1[recnum].img_layer_min = t.nval; else if (varName == "layer_max") file_cod1[recnum].img_layer_max = t.nval; else throw ParserException("Invalid variable name"); } bool readObject(Tokenizer &t) { switch (t.nextToken()) { case TT_EOF: return false; case TT_WORD: break; default: throw ParserException("Expected 'object'"); } if (t.sval != "object") throw ParserException("Expected 'object'"); if (t.nextToken() != TT_WORD) throw ParserException("Expected object code"); strcpy(file_cod1[recnum].object_cod, t.sval.c_str()); if (t.nextToken() != '{') throw ParserException("Expected '{'"); std::string varName; for (;;) { if (t.nextToken() == '}') break; if (t.ttype != TT_WORD) throw ParserException("Expected variable name or '}'"); varName = t.sval; if (t.nextToken() != '=') throw ParserException("Expected '='"); setValue(varName, t); if (t.nextToken() != ';') throw ParserException("Expected ';'"); } recnum++; return true; } void readConfig(const char *filename) { FILE *f = fopen(filename, "rt"); if (f == NULL) { printf("File not found: %s\n", filename); exit(1); } Tokenizer t(f); t.lowerCaseMode(true); t.quoteChar('"'); t.wordChars('a', 'z'); t.wordChars('A', 'Z'); t.wordChar('_'); t.parseNumbers(); t.whitespaceChar(' '); t.whitespaceChar('\n'); t.whitespaceChar('\r'); t.whitespaceChar('\t'); t.slashSlashComments(true); file_cod1 = (topo_cod1 *)s_malloc(sizeof(topo_cod1) * 65536); try { while (readObject(t)) ; } catch (ParserException &x) { printf("%s\n", x.what()); printToken(t); exit(0); } fclose(f); /* for (;;) { switch (t.nextToken()) { case TT_EOF: fclose(f); return; case TT_EOL: printf("eol\n"); break; case TT_NUMBER: printf("num: %d\n", t.nval); break; case TT_WORD: printf("word: %s\n", t.sval.c_str()); break; default: printf("char: %c\n", (unsigned char)t.ttype); break; } } */ } --- NEW FILE: topo.conf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: plan.conf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: parser.h --- #ifndef __CMAP_PARSER_H__ #define __CMAP_PARSER_H__ #include <exception> class ParserException : public exception { public: ParserException(const char *_msg); virtual ~ParserException() throw (); static void raise(const char *_msg); virtual const char *name() const throw(); virtual const char *what() const throw(); private: const char *msg; }; void readConfig(const char *filename); #endif // __CMAP_PARSER_H__ Index: cmap.dsp =================================================================== RCS file: /cvsroot/cmap/cmap/cmap.dsp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- cmap.dsp 4 May 2004 02:01:56 -0000 1.4 +++ cmap.dsp 15 May 2004 17:49:33 -0000 1.5 @@ -113,8 +113,16 @@ # End Source File # Begin Source File +SOURCE=.\parser.cpp +# End Source File +# Begin Source File + SOURCE=.\PolishFormat.cpp # End Source File +# Begin Source File + +SOURCE=.\tokenizer.cpp +# End Source File # End Group # Begin Group "Header Files" @@ -149,8 +157,16 @@ # End Source File # Begin Source File +SOURCE=.\parser.h +# End Source File +# Begin Source File + SOURCE=.\PolishFormat.h # End Source File +# Begin Source File + +SOURCE=.\tokenizer.h +# End Source File # End Group # Begin Group "Resource Files" Index: cmap.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/cmap.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- cmap.cpp 11 May 2004 19:38:19 -0000 1.32 +++ cmap.cpp 15 May 2004 17:49:33 -0000 1.33 @@ -18,6 +18,7 @@ #endif #include "common.h" +#include "parser.h" #include "dbf.h" #include "IngitFile.h" #include "PolishFormat.h" @@ -537,10 +538,10 @@ ReadTableOBJ(); if (Len_code == 8) - Read_DBF("topo.dbf"); + readConfig("topo.conf"); if (Len_code == 2) - Read_DBF("plan.dbf"); + readConfig("plan.conf"); if (Len_code == 6) { printf("Marine maps are not supported"); |
From: Denis P. <dy...@us...> - 2004-05-15 17:48:27
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4193 Modified Files: cmap.dsw .cvsignore Added Files: dbf2conf.dsp dbf2conf.cpp Log Message: Add converter from dbf to new config format Index: .cvsignore =================================================================== RCS file: /cvsroot/cmap/cmap/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- .cvsignore 2 May 2004 08:42:14 -0000 1.2 +++ .cvsignore 15 May 2004 17:48:16 -0000 1.3 @@ -4,3 +4,4 @@ Debug Release cmap +dbf2conf.plg Index: cmap.dsw =================================================================== RCS file: /cvsroot/cmap/cmap/cmap.dsw,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- cmap.dsw 19 Apr 2004 15:53:11 -0000 1.1 +++ cmap.dsw 15 May 2004 17:48:16 -0000 1.2 @@ -15,6 +15,18 @@ ############################################################################### +Project: "dbf2conf"=.\dbf2conf.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Global: Package=<5> --- NEW FILE: dbf2conf.cpp --- #include <string.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> //'O_RDONLY' #ifdef WIN32 #include <io.h> typedef long off_t; #else #include <sys/types.h> #include <unistd.h> #endif #include "common.h" #ifdef _MSC_VER #pragma pack (1) #endif //=================================================================================== // Ñòðóêòóðà óïðàâëÿþùèõ ôàéëîâ DBF //=================================================================================== typedef struct DBF_file { short do_export; // Ïðèçíàê ýêñïîðòà. 0 - çàïðåò. char object_cod[9]; // 8-çíà÷íûé êîäèôèêàòîð ÂÒÓ char CHR_RUS[256]; // Íàçâàíèå RUS char CHR_ENG[256]; // Íàçâàíèå RUS short RGN_point; // short TYPE_point; // short TYPE_line; // short TYPE_poly; // short img_layer_min; // Layer_min cGPSmap short img_layer_max; // Layer_max cGPSmap //short ozi_evt_cod; // Êîä îáúåêòà â EVT //short ozi_evt_size; // Size îáúåêòà â EVT } topo_cod1 #ifdef __GNUC__ __attribute__ ((packed)) #endif ; //#define MAX_NUM_DESCR 255 //#define MAX_RECORD_SIZE 1024 //#define LEN 32 #define FIELD_NUM ( (headleng-32L) / 32L ) typedef unsigned char BYTE; //=================================================================================== BYTE zerobyte; // Òèï DBF ôàéëà BYTE lastdate[3] = ""; // Ïîñëåäíåå èçìåíåíèå (ÃÃÌÌÄÄ) unsigned short recnum; // ×èñëî çàïèñåé â ôàéëå unsigned short headleng; // Ïîëîæåíèå ïåðâîé çàïèñè ñ äàííûìè unsigned short recleng; // topo_cod1 *file_cod1 = NULL; //=================================================================================== //For DBF; //=================================================================================== typedef struct descr_struct_DBF { char fieldname[11]; // Íàçâàíèå ïîëÿ (äî 10 ñèìâîëîâ, åñëè > 10, òîò äîïîëíÿåòñÿ ïóñòûì ñèìâîëîì (0x00)) char fieldtype; // C - ñèìâîëüíîå // N - ÷èñëîâîå // L - ëîãè÷åñêîå // M - òèïà memo // D - äàòà // F - ñ ïëàâàþùåé òî÷êîé // P - øàáëîí BYTE fieldleng; // Ðàñïîëîæåíèå ïîëÿ âíóòðè çàïèñè BYTE decimalleng; // Äëèíà ïîëÿ â áàéòàõ } dbf_descr_type #ifdef __GNUC__ __attribute__ ((packed)) #endif ; dbf_descr_type descrarray[14]; //descr_type *descrarray=NULL; static char *bufDBF; // Áóôåð çàãðóçêè DBF ôàéëà. static void copyStrip(char *dest, const char *src, unsigned int size) { memcpy(dest, src, size); unsigned int i = size; while (dest[i - 1] == ' ') { i--; if (i == 0) break; } dest[i] = 0; } // ×òåíèå DBF ôàéëà. void Read_DBF(const char *file_dbf) { int f_DBF = open(file_dbf, O_RDONLY); if (f_DBF == -1) { fprintf(stderr, "Unable to open %s\n\n", file_dbf); exit(1); } off_t file_dbf_size = lseek(f_DBF, 0, SEEK_END); if (file_dbf_size == (off_t) - 1) { fprintf(stderr, "Unable to get size of %s\n\n", file_dbf); exit(1); } close (f_DBF); FILE *inDBF = fopen(file_dbf, "rb"); //=================================================================================== // Ðåçåðâèðîâàíèå ïàìÿòè äëÿ ôàéëà DBF. bufDBF = (char *)s_malloc(file_dbf_size + 1); fread(bufDBF, 1, file_dbf_size, inDBF); //×èòàåì çàãîëîâîê DBF memcpy(&zerobyte, bufDBF, 2); // Òèï ôàéëîâ // FoxBASE+/dBASE III +, áåç memo - 0x03 // FoxBASE+/dBASE III +, ñ memo - 0x83 // FoxPro/dBASE IV, áåç memo - 0x03 // FoxPro ñ memo - 0xF5 // dBASE IV ñ memo - 0x8B memcpy(&lastdate, bufDBF + 1, 3); // Ïîñëåäíåå èçìåíåíèå (ÃÃÌÌÄÄ) memcpy(&recnum, bufDBF + 4, 4); // ×èñëî çàïèñåé â ôàéëå memcpy(&headleng, bufDBF + 8, 2); // Ïîëîæåíèå ïåðâîé çàïèñè ñ äàííûìè memcpy(&recleng, bufDBF + 10, 2); // Äëèíà îäíîé çàïèñè ñ äàííûìè (âêëþ÷àÿ ïðèçíàê óäàëåíèÿ) long count = FIELD_NUM; if (count > 12) count = 12; //×èòàåì íàçâàíèÿ ñòîëáöîâ. int i = 0; int j; for (j = 0; j < count; j++) { memcpy (descrarray[j].fieldname, bufDBF + 32 + i, 11); descrarray[j].fieldtype = bufDBF[32 + 11 + i]; descrarray[j].fieldleng = bufDBF[32 + 16 + i]; descrarray[j].decimalleng = bufDBF[32 + 17 + i]; i = i + 32; } if (strcmp(descrarray[0].fieldname, "EXPORT") == 0 && strcmp(descrarray[1].fieldname, "OBJECT_COD") == 0 && strcmp(descrarray[2].fieldname, "CHR_RUS") == 0 && strcmp(descrarray[3].fieldname, "CHR_ENG") == 0 && strcmp(descrarray[4].fieldname, "RGN_P") == 0 && strcmp(descrarray[5].fieldname, "TYPE_P") == 0 && strcmp(descrarray[6].fieldname, "TYPE_L") == 0 && strcmp(descrarray[7].fieldname, "TYPE_A") == 0 && strcmp(descrarray[8].fieldname, "LAYER_MIN") == 0 && strcmp(descrarray[9].fieldname, "LAYER_MAX") == 0) { } else { fprintf(stderr, "Incorrect DBF file, check version and columns!!!\n"); exit (0); } //================================================================ // Ðåçåðâèðîâàíèå file_cod1 = (topo_cod1 *)s_malloc(sizeof(topo_cod1) * recnum); //================================================================ int do_export; long pointerDBF; long pointerDBF1; char bufsrt[256]; char del[1]; pointerDBF = headleng; for (j = 0; j < recnum; j++) { pointerDBF1 = pointerDBF; del[0] = bufDBF[pointerDBF]; // ïðèçíàê óäàëåíèÿ pointerDBF++; /// ?????? // Ñòîëáåö EXPORT i = descrarray[0].fieldleng; memcpy (bufsrt, bufDBF + pointerDBF, i); bufsrt[i] = 0; if (sscanf(bufsrt, "%i", &do_export) == -1) do_export = 0; file_cod1[j].do_export = do_export; //Ñòîëáåö OBJECT_COD pointerDBF = pointerDBF + i; i = descrarray[1].fieldleng; memcpy (bufsrt, bufDBF + pointerDBF, i); bufsrt[i] = 0; // Åñëè ïóñòàÿ ñòðîêà òî ïèøåì - 0 if (sscanf(bufsrt, "%8s", file_cod1[j].object_cod) == -1 ) { file_cod1[j].do_export = 0; file_cod1[j].object_cod[0] = 0; } // Ïðîâåðêà íà óäàëåííûé if (del[0] == '*') { file_cod1[j].do_export = 0; file_cod1[j].object_cod[0] = 0; } // Ñòîëáåö CHR_RUS pointerDBF = pointerDBF + i; i = descrarray[2].fieldleng; copyStrip(file_cod1[j].CHR_RUS, bufDBF + pointerDBF, i); // Ñòîëáåö CHR_ENG pointerDBF = pointerDBF + i; i = descrarray[3].fieldleng; // Ñòîëáåö RGN_P pointerDBF = pointerDBF + i; i = descrarray[4].fieldleng; memcpy(bufsrt, bufDBF + pointerDBF, i); bufsrt[i] = 0; if (sscanf(bufsrt, "%x", &file_cod1[j].RGN_point) == -1) file_cod1[j].RGN_point = -1; // Ñòîëáåö TYPE_P pointerDBF = pointerDBF + i; i = descrarray[5].fieldleng; memcpy (bufsrt, bufDBF + pointerDBF, i); bufsrt[i] = 0; if (sscanf(bufsrt, "%x", &file_cod1[j].TYPE_point) == -1) file_cod1[j].TYPE_point = -1; // Ñòîëáåö TYPE_L pointerDBF = pointerDBF + i; i = descrarray[6].fieldleng; memcpy (bufsrt, bufDBF + pointerDBF, i); bufsrt[i] = 0; if (sscanf(bufsrt, "%x", &file_cod1[j].TYPE_line) == -1) file_cod1[j].TYPE_line = -1; // Ñòîëáåö TYPE_A pointerDBF = pointerDBF + i; i = descrarray[7].fieldleng; memcpy (bufsrt, bufDBF + pointerDBF, i); bufsrt[i] = 0; if (sscanf(bufsrt, "%x", &file_cod1[j].TYPE_poly) == -1) file_cod1[j].TYPE_poly = -1; // Ñòîëáåö LAYER_MIN pointerDBF = pointerDBF + i; i = descrarray[8].fieldleng; memcpy (bufsrt, bufDBF + pointerDBF, i); bufsrt[i] = 0; if (sscanf(bufsrt, "%d", &file_cod1[j].img_layer_min) == -1) file_cod1[j].img_layer_min = 0; // Ñòîëáåö LAYER_MAX pointerDBF = pointerDBF + i; i = descrarray[9].fieldleng; memcpy (bufsrt, bufDBF + pointerDBF, i); bufsrt[i] = 0; if (sscanf(bufsrt, "%d", &file_cod1[j].img_layer_max) == -1) file_cod1[j].img_layer_max = 0; DosToWin (bufsrt, (BYTE *)file_cod1[j].CHR_RUS); printf("// %s\n", bufsrt); printf("object \"%s\" {\n", file_cod1[j].object_cod); printf(" export = %d;\n", file_cod1[j].do_export); if (file_cod1[j].RGN_point == 0x10) printf(" index = 0;\n"); else if (file_cod1[j].RGN_point == 0x20) printf(" index = 1;\n"); if (file_cod1[j].TYPE_point != -1) printf(" point = 0x%.4X;\n", file_cod1[j].TYPE_point); if (file_cod1[j].TYPE_line != -1) printf(" line = 0x%.2X;\n", file_cod1[j].TYPE_line); if (file_cod1[j].TYPE_poly != -1) printf(" polygon = 0x%.2X;\n", file_cod1[j].TYPE_poly); printf(" layer_min = %d;\n", file_cod1[j].img_layer_min); printf(" layer_max = %d;\n", file_cod1[j].img_layer_max); printf("}\n"); pointerDBF = pointerDBF1 + recleng; } } int main(int argc, const char **argv) { if (argc == 1) { fprintf(stderr, "Usage: dbf2conf <file.dbf>\n"); return 0; } Read_DBF(argv[1]); return 0; } --- NEW FILE: dbf2conf.dsp --- # Microsoft Developer Studio Project File - Name="dbf2conf" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=dbf2conf - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "dbf2conf.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "dbf2conf.mak" CFG="dbf2conf - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "dbf2conf - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "dbf2conf - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "dbf2conf - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "dbf2conf___Win32_Release" # PROP BASE Intermediate_Dir "dbf2conf___Win32_Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "dbf2conf___Win32_Release" # PROP Intermediate_Dir "dbf2conf___Win32_Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x419 /d "NDEBUG" # ADD RSC /l 0x419 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 !ELSEIF "$(CFG)" == "dbf2conf - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "dbf2conf___Win32_Debug" # PROP BASE Intermediate_Dir "dbf2conf___Win32_Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "dbf2conf___Win32_Debug" # PROP Intermediate_Dir "dbf2conf___Win32_Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD BASE RSC /l 0x419 /d "_DEBUG" # ADD RSC /l 0x419 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept !ENDIF # Begin Target # Name "dbf2conf - Win32 Release" # Name "dbf2conf - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\common.cpp # End Source File # Begin Source File SOURCE=.\dbf2conf.cpp # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\common.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project |
From: Denis P. <dy...@us...> - 2004-05-15 17:47:14
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3879 Modified Files: tokenizer.h tokenizer.cpp Log Message: Add support for hex numbers. Remove support for float values. Index: tokenizer.h =================================================================== RCS file: /cvsroot/cmap/cmap/tokenizer.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tokenizer.h 15 May 2004 16:05:39 -0000 1.1 +++ tokenizer.h 15 May 2004 17:47:04 -0000 1.2 @@ -42,7 +42,7 @@ class Tokenizer { public: - float nval; + int nval; std::string sval; int ttype; Index: tokenizer.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/tokenizer.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tokenizer.cpp 15 May 2004 16:05:39 -0000 1.1 +++ tokenizer.cpp 15 May 2004 17:47:04 -0000 1.2 @@ -126,36 +126,40 @@ bool neg = false; if (c == '-') { c = read(); - if (c != '.' && (c < '0' || c > '9')) { + if (c < '0' || c > '9') { peekc = (char)c; return ttype = '-'; } neg = true; + } else if (c == '0') { + c = read(); + if (c == 'x') { + int v = 0; + for (; ; ) { + c = read(); + if ('0' <= c && c <= '9') + v = v * 16 + (c - '0'); + else if ('A' <= c && c <= 'F') + v = v * 16 + (c - 'A' + 10); + else if ('a' <= c && c <= 'f') + v = v * 16 + (c - 'a' + 10); + else + break; + } + peekc = (char)c; + nval = v; + return ttype = TT_NUMBER; + } } - double v = 0; - int decexp = 0; - int seendot = 0; + int v = 0; for (; ; ) { - if (c == '.' && seendot == 0) - seendot = 1; - else if ('0' <= c && c <= '9') { + if ('0' <= c && c <= '9') v = v * 10 + (c - '0'); - decexp += seendot; - } else + else break; c = read(); } peekc = (char)c; - if (decexp != 0) { - double denom = 10; - decexp--; - while (decexp > 0) { - denom *= 10; - decexp--; - } - /* do one division of a likely-to-be-more-accurate number */ - v = v / denom; - } nval = neg ? -v : v; return ttype = TT_NUMBER; } @@ -367,7 +371,6 @@ for (int i = '0'; i <= '9'; i++) ctype[i] |= CT_DIGIT; ctype['-'] |= CT_DIGIT; - ctype['.'] |= CT_DIGIT; } void Tokenizer::pushBack() { |
From: Denis P. <dy...@us...> - 2004-05-15 16:05:48
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14691 Added Files: tokenizer.h tokenizer.cpp Log Message: Add tokenizer for transformation file language. --- NEW FILE: tokenizer.h --- // Copyright Denis Perchine <dy...@pe...>, 2004 #ifndef __CMAP_TOKENIZER_H__ #define __CMAP_TOKENIZER_H__ #include <string> #include <exception> class TokenizerException : public exception { public: TokenizerException(const char *_msg); virtual ~TokenizerException() throw (); static void raise(const char *_msg); virtual const char *name() const throw(); virtual const char *what() const throw(); private: const char *msg; }; class IOException : public exception { public: IOException(); virtual ~IOException() throw (); static void raise(); virtual const char *name() const throw(); virtual const char *what() const throw(); private: const char *msg; }; const int TT_NOTHING = 0; const int TT_EOF = -1; const int TT_EOL = -2; const int TT_NUMBER = -3; const int TT_WORD = -4; const short CT_WHITESPACE = 1; const short CT_DIGIT = 2; const short CT_ALPHA = 4; const short CT_QUOTE = 8; const short CT_COMMENT = 16; class Tokenizer { public: float nval; std::string sval; int ttype; Tokenizer(FILE *_f); void commentChar(char c); void eolIsSignificant(bool b); long lineno(); void lowerCaseMode(bool b); int nextToken(); void nextToEOL(bool strip); void noCRLFInQuote(bool b); void ordinaryChar(char c); void ordinaryChars(int a, int b); void parseNumbers(); void pushBack(); void quoteChar(char c); void resetSyntax(); void slashSlashComments(bool b); void slashStarComments(bool b); void whitespaceChars(int a, int b); void whitespaceChar(char a); void clearChar(char a); void wordChars(int a, int b); void wordChar(char c); private: bool eolIsSignificantP; bool slashSlashCommentsP; bool slashStarCommentsP; bool noCRLFInQuoteP; bool forceLower; bool pushedBack; short ctype[256]; int peekc; long LINENO; FILE *f; int read(); }; #endif //__CMAP_TOKENIZER_H__ --- NEW FILE: tokenizer.cpp --- #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <ctype.h> #include "tokenizer.h" TokenizerException::TokenizerException(const char *_msg) : exception(), msg(_msg) { } TokenizerException::~TokenizerException() throw () { } void TokenizerException::raise(const char *_msg) { throw TokenizerException(_msg); } const char *TokenizerException::name() const throw() { return "TokenizerException"; } const char *TokenizerException::what() const throw() { return msg; } IOException::IOException() { msg = strerror(errno); } IOException::~IOException() throw () { } void IOException::raise() { throw IOException(); } const char *IOException::name() const throw() { return "IOException"; } const char *IOException::what() const throw() { return msg; } Tokenizer::Tokenizer(FILE *_f) : f(_f) { eolIsSignificantP = false; slashSlashCommentsP = false; slashStarCommentsP = false; noCRLFInQuoteP = false; ttype = TT_NOTHING; for (int i = 0; i < 256; i++) ctype[i] = 0; LINENO = 0; forceLower = false; pushedBack = false; } void Tokenizer::commentChar(char c) { ctype[c] |= CT_COMMENT; } void Tokenizer::wordChar(char c) { ctype[c] |= CT_ALPHA; } void Tokenizer::eolIsSignificant(bool b) { eolIsSignificantP = b; } long Tokenizer::lineno() { return LINENO; } void Tokenizer::lowerCaseMode(bool b) { forceLower = b; } int Tokenizer::nextToken() { if (pushedBack) { pushedBack = false; return ttype; } short *ct = ctype; int c; sval = ""; if (ttype == TT_NOTHING) { c = read(); if (c >= 0) // ttype is surely overwritten below to its correct value. ttype = c; // for now we just make sure it isn't TT_NOTHING } else { c = peekc; } if (c < 0) return ttype = TT_EOF; int _ctype = c < 256 ? ct[c] : CT_ALPHA; while ((_ctype & CT_WHITESPACE) != 0) { if (c == '\r') { LINENO++; c = read(); if (c == '\n') c = read(); if (eolIsSignificantP) { peekc = (char)c; return ttype = TT_EOL; } } else { if (c == '\n') { LINENO++; if (eolIsSignificantP) { peekc = read(); return ttype = TT_EOL; } } c = read(); } if (c < 0) return ttype = TT_EOF; _ctype = c < 256 ? ct[c] : CT_ALPHA; } if ((_ctype & CT_DIGIT) != 0) { bool neg = false; if (c == '-') { c = read(); if (c != '.' && (c < '0' || c > '9')) { peekc = (char)c; return ttype = '-'; } neg = true; } double v = 0; int decexp = 0; int seendot = 0; for (; ; ) { if (c == '.' && seendot == 0) seendot = 1; else if ('0' <= c && c <= '9') { v = v * 10 + (c - '0'); decexp += seendot; } else break; c = read(); } peekc = (char)c; if (decexp != 0) { double denom = 10; decexp--; while (decexp > 0) { denom *= 10; decexp--; } /* do one division of a likely-to-be-more-accurate number */ v = v / denom; } nval = neg ? -v : v; return ttype = TT_NUMBER; } if ((_ctype & CT_ALPHA) != 0) { sval = ""; do { sval += c; c = read(); _ctype = c < 0 ? CT_WHITESPACE : c < 256 ? ct[c] : CT_ALPHA; } while ((_ctype & (CT_ALPHA | CT_DIGIT)) != 0); peekc = (char)c; if (forceLower) for (unsigned int i = 0; i < sval.length(); i++) sval[i] = tolower(sval[i]); return ttype = TT_WORD; } if ((_ctype & CT_COMMENT) != 0) { while ((c = read()) != '\n' && c != '\r' && c >= 0); peekc = (char)c; return nextToken(); } if ((_ctype & CT_QUOTE) != 0) { ttype = c; sval = ""; // invariants (because \Octal needs a lookahead): // (i) c contains char value // (ii) peekc contains the lookahead peekc = read(); while (peekc >= 0 && peekc != ttype && peekc != '\n' && peekc != '\r') { if (peekc == '\\') { c = read(); int first = c; // to allow \377, but not \477 if (c >= '0' && c <= '7') { c = c - '0'; int c2 = read(); if ('0' <= c2 && c2 <= '7') { c = (c << 3) + (c2 - '0'); c2 = read(); if ('0' <= c2 && c2 <= '7' && first <= '3') { c = (c << 3) + (c2 - '0'); peekc = read(); } else peekc = (char)c2; } else peekc = (char)c2; } else { switch (c) { case 'a': c = 0x7; break; case 'b': c = '\b'; break; case 'f': c = 0xC; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; case 'v': c = 0xB; break; } peekc = read(); } } else { c = peekc; peekc = read(); } sval += c; } if (((peekc == '\n') || (peekc == '\r')) && noCRLFInQuoteP) throw TokenizerException("CR or LF not allowed in quote."); if (peekc == ttype) // keep \n or \r intact in peekc peekc = read(); return ttype = TT_WORD; } if (c == '/' && (slashSlashCommentsP || slashStarCommentsP)) { c = read(); if (c == '*' && slashStarCommentsP) { int prevc = 0; while ((c = read()) != '/' || prevc != '*') { if (c == '\r') { LINENO++; c = read(); if (c == '\n') { c = read(); } } else { if (c == '\n') { LINENO++; c = read(); } } if (c < 0) return ttype = TT_EOF; prevc = c; } peekc = read(); return nextToken(); } else if (c == '/' && slashSlashCommentsP) { while ((c = read()) != '\n' && c != '\r' && c >= 0); peekc = (char)c; return nextToken(); } else { peekc = (char)c; return ttype = '/'; } } peekc = read(); return ttype = c; } void Tokenizer::nextToEOL(bool strip) { bool begin = true; int len; int c; sval = ""; short *ct = ctype; if (ttype == TT_NOTHING) { c = read(); if (c >= 0) { // ttype is surely overwritten below to its correct value. ttype = c; // for now we just make sure it isn't TT_NOTHING } } else { c = peekc; } for (; ; ) { if (c < 0) { peekc = (char)c; break; } if (c == '\r') { LINENO++; c = read(); if (c == '\n') c = read(); peekc = (char)c; break; } if (c == '\n') { LINENO++; c = read(); if (c == '\r') c = read(); peekc = (char)c; break; } int _ctype = c < 256 ? ct[c] : CT_ALPHA; if (((_ctype & CT_WHITESPACE) == 0) || (!begin)) { begin = false; sval += (char)c; } c = read(); } if (strip) { for (; ; ) { len = sval.length(); if (len == 0) break; if ((ctype[sval[(unsigned int)len - 1]] & CT_WHITESPACE) == 0) break; sval.resize(len); } } } void Tokenizer::noCRLFInQuote(bool b) { noCRLFInQuoteP = b; } void Tokenizer::ordinaryChar(char c) { ctype[c] = 0; } void Tokenizer::ordinaryChars(int a, int b) { if (a > b) return ; if (a < 0) a = 0; if (b > 255) b = 255; for (int i = a; i <= b; i++) ctype[i] = 0; } void Tokenizer::parseNumbers() { for (int i = '0'; i <= '9'; i++) ctype[i] |= CT_DIGIT; ctype['-'] |= CT_DIGIT; ctype['.'] |= CT_DIGIT; } void Tokenizer::pushBack() { if (ttype != TT_NOTHING) pushedBack = true; } int Tokenizer::read() { unsigned char c; if (fread(&c, 1, 1, f) == 1) return c; if (feof(f) != 0) return -1; throw IOException(); } void Tokenizer::resetSyntax() { for (int i = 0; i < 256; i++) ctype[i] = 0; } void Tokenizer::quoteChar(char c) { ctype[c] |= CT_QUOTE; } void Tokenizer::clearChar(char a) { if (a < 0) a = 0; ctype[a] = 0; } void Tokenizer::whitespaceChars(int a, int b) { if (a > b) return ; if (a < 0) a = 0; if (b > 255) b = 255; for (int i = a; i <= b; i++) ctype[i] |= CT_WHITESPACE; } void Tokenizer::whitespaceChar(char a) { whitespaceChars(a, a); } void Tokenizer::wordChars(int a, int b) { if (a > b) return ; if (a < 0) a = 0; if (b > 255) b = 255; for (int i = a; i <= b; i++) ctype[i] |= CT_ALPHA; } void Tokenizer::slashSlashComments(bool b) { slashSlashCommentsP = b; } void Tokenizer::slashStarComments(bool b) { slashStarCommentsP = b; } |
From: Denis P. <dy...@us...> - 2004-05-15 03:36:55
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11061 Modified Files: IngitHeader.h IngitHeader.cpp IngitFile.cpp Log Message: Use correct border coordinates. Index: IngitFile.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/IngitFile.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- IngitFile.cpp 12 May 2004 19:20:01 -0000 1.19 +++ IngitFile.cpp 15 May 2004 03:36:46 -0000 1.20 @@ -292,9 +292,7 @@ exit(1); break; } - if (Num_Segment > Max_Num_Segment) { - exit(1); - } + ASSERT(Num_Segment <= Max_Num_Segment); } return num_array; } Index: IngitHeader.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/IngitHeader.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- IngitHeader.cpp 5 May 2004 16:35:52 -0000 1.3 +++ IngitHeader.cpp 15 May 2004 03:36:46 -0000 1.4 @@ -26,15 +26,21 @@ //fprintf( fOut, "LAT_SouthEast=%09i LON_SouthEast=%09i ", LAT_SouthEast, LON_SouthEast); //fprintf( fOut, "LAT_NorthEast=%09i LON_NorthEast=%09i ", LAT_NorthEast, LON_NorthEast); fprintf(fOut, "\nMap border [DDD MM SS.SS]\n\n"); + fprintf(fOut, "South West\n"); PrintLatDegrees(fOut, LAT_SouthWest); PrintLonDegrees(fOut, LON_SouthWest); fprintf(fOut, "\n"); - PrintLatDegrees(fOut, LAT_SouthEast); - PrintLonDegrees(fOut, LON_NorthEast); - fprintf(fOut, "\n"); + + fprintf(fOut, "North East\n"); PrintLatDegrees(fOut, LAT_NorthEast); PrintLonDegrees(fOut, LON_NorthEast); fprintf(fOut, "\n"); + + fprintf(fOut, "Fragment South West\n"); + PrintLatDegrees(fOut, LAT_FragmentSW); + PrintLonDegrees(fOut, LON_FragmentSW); + fprintf(fOut, "\n"); + // Êîîðäèíàòû ðàìêè â ìåòðèêå fprintf(fOut, "Metric map border [m]\n"); fprintf( fOut, "BottomLeft %.1f, %.1f\n", xBottomLeft / 10.0, yBottomLeft / 10.0); Index: IngitHeader.h =================================================================== RCS file: /cvsroot/cmap/cmap/IngitHeader.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- IngitHeader.h 5 May 2004 16:35:52 -0000 1.5 +++ IngitHeader.h 15 May 2004 03:36:46 -0000 1.6 @@ -7,12 +7,12 @@ class IngitHeader { public: - long LON_SouthEast, - LAT_SouthEast, - LON_NorthEast, - LAT_NorthEast, - LON_SouthWest, - LAT_SouthWest; + long LON_SouthWest; + long LAT_SouthWest; + long LON_NorthEast; + long LAT_NorthEast; + long LON_FragmentSW; + long LAT_FragmentSW; short scale1, scale2, // èñõîäíûé ìàñøòàá = 1:(scale1*scale2) scaleX, // Êîîîðäèíàòà xTopRight â ìåòðèêå ôàéëà. |
From: Denis P. <dy...@us...> - 2004-05-14 02:53:19
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15571 Modified Files: common.cpp Log Message: Replace wrong attr with C1. Index: common.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/common.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- common.cpp 11 May 2004 21:30:00 -0000 1.10 +++ common.cpp 14 May 2004 02:53:09 -0000 1.11 @@ -362,7 +362,7 @@ attrCode = 109; if (memcmp(buf_atr, "RI", 2) == 0) attrCode = 110; - if ((buf_atr[0] == 0x8A) && (buf_atr[1] == 0xE0)) + if (memcmp(buf_atr, "C1", 2) == 0) attrCode = 111; ASSERT(attrCode != -1); |
From: Denis P. <dy...@us...> - 2004-05-12 19:20:13
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18770 Modified Files: IngitFile.cpp Log Message: Skip HACK improvement Index: IngitFile.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/IngitFile.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- IngitFile.cpp 12 May 2004 05:25:09 -0000 1.18 +++ IngitFile.cpp 12 May 2004 19:20:01 -0000 1.19 @@ -375,7 +375,7 @@ unsigned char buf_atr[4]; while (buf[PointerATR] != 0) { //HACK - if (buf[PointerATR] == 0x20 || buf[PointerATR] == 0x80) { + if (buf[PointerATR] == 0x20 || buf[PointerATR] >= 0x80) { printf("Skipping data: '%s'\n", buf + PointerATR); while (buf[PointerATR++] != 0) ; |
From: Denis P. <dy...@us...> - 2004-05-12 18:40:53
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8422 Modified Files: PolishFormat.cpp dbf.h dbf.cpp Log Message: Add check for repeated no record in DBF messages. Index: dbf.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/dbf.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- dbf.cpp 12 May 2004 05:26:53 -0000 1.14 +++ dbf.cpp 12 May 2004 18:40:41 -0000 1.15 @@ -63,6 +63,33 @@ printf("0x%.4X ", value); } +static char const **warnedCODs = NULL; +static size_t warnedCODpos = 0; +static size_t warnedCODsize = 0; + +static bool checkWarned(const char *cod) { + for (size_t i = 0; i < warnedCODpos; i++) + if (strcmp(warnedCODs[i], cod) == 0) + return true; + + if (warnedCODpos >= warnedCODsize) { + warnedCODsize = (warnedCODs == NULL) ? 256 : warnedCODsize * 2; + warnedCODs = (char const **)s_realloc(warnedCODs, warnedCODsize * sizeof(char *)); + } + + warnedCODs[warnedCODpos++] = cod; + + return false; +} + +void clearWarnedDBF() { + if (warnedCODs != NULL) + s_free(warnedCODs); + warnedCODs = NULL; + warnedCODpos = 0; + warnedCODsize = 0; +} + //=================================================================================== // Ïðîâåðêà íà EXPORT èìåíè Êîäèôèêàòîðà // ÅÑÒÜ è ÂÛÁÐÀÍ - Âîçâðàùàåò íîìåð ñòðîêè, @@ -72,7 +99,8 @@ if (strcmp(str, file_cod1[i].object_cod) == 0) return (file_cod1[i].do_export != 0) ? i : -1; ASSERT(*str != 0); - printf("Warning!!! Type not found in DBF table: '%s'\n", str); + if (!checkWarned(str)) + printf("Warning!!! Type not found in DBF table: '%s'\n", str); return -1; } //=================================================================================== Index: dbf.h =================================================================== RCS file: /cvsroot/cmap/cmap/dbf.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- dbf.h 5 May 2004 15:33:19 -0000 1.6 +++ dbf.h 12 May 2004 18:40:41 -0000 1.7 @@ -34,6 +34,7 @@ void Read_DBF(char *file_dbf); int Check_export (const char *str); +void clearWarnedDBF(); #endif // __CMAP_CBF_H__ Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- PolishFormat.cpp 12 May 2004 05:12:49 -0000 1.25 +++ PolishFormat.cpp 12 May 2004 18:40:41 -0000 1.26 @@ -1959,4 +1959,5 @@ } // END FOR clearWarned(); + clearWarnedDBF(); } |
From: Denis P. <dy...@us...> - 2004-05-12 05:27:04
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1289 Modified Files: dbf.cpp Log Message: There should be no empty code requests Index: dbf.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/dbf.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- dbf.cpp 5 May 2004 16:15:57 -0000 1.13 +++ dbf.cpp 12 May 2004 05:26:53 -0000 1.14 @@ -71,6 +71,7 @@ for (int i = 0; i < recnum; i++) if (strcmp(str, file_cod1[i].object_cod) == 0) return (file_cod1[i].do_export != 0) ? i : -1; + ASSERT(*str != 0); printf("Warning!!! Type not found in DBF table: '%s'\n", str); return -1; } |
From: Denis P. <dy...@us...> - 2004-05-12 05:25:20
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1016 Modified Files: IngitFile.cpp Log Message: Add another hack case to attr enumeration Index: IngitFile.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/IngitFile.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- IngitFile.cpp 12 May 2004 03:39:43 -0000 1.17 +++ IngitFile.cpp 12 May 2004 05:25:09 -0000 1.18 @@ -374,6 +374,14 @@ unsigned char buf_atr[4]; while (buf[PointerATR] != 0) { + //HACK + if (buf[PointerATR] == 0x20 || buf[PointerATR] == 0x80) { + printf("Skipping data: '%s'\n", buf + PointerATR); + while (buf[PointerATR++] != 0) + ; + continue; + } + // 2 áàéòà àòðèáóòà â òàáëèöó memcpy(buf_atr, buf + PointerATR, 2); buf_atr[2] = 0; @@ -386,11 +394,6 @@ if (buf[PointerATR++] >= '0' && buf[PointerATR++] <= '9') PointerATR++; - - //TODO handle line continuation - if (buf[PointerATR] == 0x20) - while (buf[PointerATR] != 0) - PointerATR++; } } // Çàïèñü ïðåäñòàâëÿåò ÒÅÊÑÒ |
From: Denis P. <dy...@us...> - 2004-05-12 05:12:58
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31607 Modified Files: PolishFormat.cpp Log Message: Skip deleted objects Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- PolishFormat.cpp 11 May 2004 21:22:50 -0000 1.24 +++ PolishFormat.cpp 12 May 2004 05:12:49 -0000 1.25 @@ -121,6 +121,9 @@ printf("Writing file...\n"); for (unsigned short NumObj = 1; NumObj < Max_Num_OBJ; NumObj++) { + if (Index_Atr[obj[NumObj].num] == 0) // Skip deleted objects + continue; + // Ïðîâåðêà íà EXPORT short DBF_line = Check_export(obj[NumObj].Cod + 1); if (DBF_line == -1) // òèï òåêóùåãî îáúåêòà íå íàéäåí â òàáëèöå ïðåîáðàçîâàíèÿ |
From: Denis P. <dy...@us...> - 2004-05-12 05:09:07
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30874 Modified Files: TOPO.dbf Log Message: Add bridge (just class code, somehow used but is not in classifier) Index: TOPO.dbf =================================================================== RCS file: /cvsroot/cmap/cmap/TOPO.dbf,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 Binary files /tmp/cvsgZtgHb and /tmp/cvsoPdPOO differ |
From: Denis P. <dy...@us...> - 2004-05-12 05:03:40
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30088 Modified Files: PLAN.dbf Log Message: Äîáàâèë áðîäû Index: PLAN.dbf =================================================================== RCS file: /cvsroot/cmap/cmap/PLAN.dbf,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 Binary files /tmp/cvsj0VeX4 and /tmp/cvsMSzueG differ |
From: Denis P. <dy...@us...> - 2004-05-12 04:20:58
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24347 Modified Files: IngitTable.cpp Log Message: Do not copy attr value to the buffer which is not used. Just skip data. Index: IngitTable.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/IngitTable.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- IngitTable.cpp 11 May 2004 21:30:00 -0000 1.12 +++ IngitTable.cpp 12 May 2004 04:20:46 -0000 1.13 @@ -148,21 +148,13 @@ } names_codif[Check_name_cod1(buf + pointer + 1)].num++; pointer += len_code + 1; - unsigned char buf_atr[4]; - char buf_atr_cod[256]; - short ATR_cod; + // Skip attr value pairs while (buf[pointer] != 0) { // 2 áàéòà àòðèáóòà - memcpy(buf_atr, buf + pointer, 2); - buf_atr[2] = 0; pointer += 2; - ATR_cod = attrToCode(buf_atr); - - unsigned int _n = 0; while (buf[pointer] != 0) - buf_atr_cod[_n++] = buf[pointer++]; - buf_atr_cod[_n] = 0; + pointer++; pointer++; } |
From: Denis P. <dy...@us...> - 2004-05-12 03:40:04
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17493 Modified Files: IngitFile.cpp Log Message: Spell var name Index: IngitFile.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/IngitFile.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- IngitFile.cpp 11 May 2004 21:43:25 -0000 1.16 +++ IngitFile.cpp 12 May 2004 03:39:43 -0000 1.17 @@ -355,21 +355,20 @@ int ATR_cod; long PointerATR; - for (unsigned long NunObj = 1; NunObj <= Max_Num_OBJ; NunObj++) { + for (unsigned long NumObj = 1; NumObj <= Max_Num_OBJ; NumObj++) { NextByte2 = 0; - memcpy(obj[NunObj].type, buf + OffsetOBJ, 7); + memcpy(obj[NumObj].type, buf + OffsetOBJ, 7); //========================================= // Íîìåð èç òàáëèöû àòðèáóòîâ - PointerATR = Index_Atr[obj[NunObj].num]; - if (PointerATR != 0 ) { + PointerATR = Index_Atr[obj[NumObj].num]; + if (PointerATR != 0) { memcpy(&num_atr, buf + PointerATR, 2); - obj[NunObj].ATR_num = num_atr; - PointerATR++; - PointerATR++; + obj[NumObj].ATR_num = num_atr; + PointerATR += 2; //printf ("%5i ", num_atr); // A+8-áàéò Êîäèôèêàòîðà â òàáëèöó - memcpy(obj[NunObj].Cod, buf + PointerATR, iTab.len_code + 1); - obj[NunObj].Cod[iTab.len_code + 1] = 0; + memcpy(obj[NumObj].Cod, buf + PointerATR, iTab.len_code + 1); + obj[NumObj].Cod[iTab.len_code + 1] = 0; //printf ("%s ", obj[NunObj].Cod); PointerATR += iTab.len_code + 1; @@ -381,7 +380,7 @@ PointerATR += 2; ATR_cod = attrToCode(buf_atr); - obj[NunObj].atr_cod[ATR_cod] = (char *)(buf + PointerATR); + obj[NumObj].atr_cod[ATR_cod] = (char *)(buf + PointerATR); while (buf[PointerATR] != 0) PointerATR++; @@ -395,16 +394,16 @@ } } // Çàïèñü ïðåäñòàâëÿåò ÒÅÊÑÒ - if (obj[NunObj].next_byte < 0) { - obj[NunObj].next_byte = obj[NunObj].next_byte & 0x7F; + if (obj[NumObj].next_byte < 0) { + obj[NumObj].next_byte = obj[NumObj].next_byte & 0x7F; // NextByte2 - âòîðîé ñ÷åò÷èê (TEXT) - NextByte2 = buf[OffsetOBJ + 7 + obj[NunObj].next_byte] + 2; + NextByte2 = buf[OffsetOBJ + 7 + obj[NumObj].next_byte] + 2; //---------------- if (comm_off == 3) { - printf ("; %X: %i (i) length TEXT+10\n", OffsetOBJ + obj[NunObj].next_byte + 7, NextByte2); - printf ("; %X: ", OffsetOBJ + obj[NunObj].next_byte + 8); + printf ("; %X: %i (i) length TEXT+10\n", OffsetOBJ + obj[NumObj].next_byte + 7, NextByte2); + printf ("; %X: ", OffsetOBJ + obj[NumObj].next_byte + 8); for (int j1 = 0; j1 < 8; j1++) - printf("%.2X ", buf[OffsetOBJ + obj[NunObj].next_byte + 8 + j1]); + printf("%.2X ", buf[OffsetOBJ + obj[NumObj].next_byte + 8 + j1]); printf ("\n"); if (buf[OffsetOBJ] == 6) { printf("; %X: ", OffsetOBJ + 22); @@ -419,11 +418,11 @@ //Êîíåö ïå÷àòè TXT // ïåðåõîäèì ê ñëåäóþùåìó îáúåêòó // Äëÿ "õèòðûõ ôàéëîâ" FLAG = -1 - obj[NunObj].data = OffsetOBJ + 7; // Çàïèñûâàåì Ñìåùåíèå äàííûõ îáúåêòà - OffsetOBJ = OffsetOBJ + 7 + obj[NunObj].next_byte + NextByte2 + FLAG; + obj[NumObj].data = OffsetOBJ + 7; // Çàïèñûâàåì Ñìåùåíèå äàííûõ îáúåêòà + OffsetOBJ = OffsetOBJ + 7 + obj[NumObj].next_byte + NextByte2 + FLAG; // Âûâîä ïðîöåíòîâ. if (comm_per == 1) - printf ("%2.f%%\r", NunObj / (Max_Num_OBJ / 100.0)); + printf ("%2.f%%\r", NumObj / (Max_Num_OBJ / 100.0)); } // Êîíåö öèêëà ïåðåáîðà îáúåêòîâ } |
From: Denis P. <dy...@us...> - 2004-05-11 21:43:38
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17285 Modified Files: IngitFile.cpp Log Message: Remove extra lf Index: IngitFile.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/IngitFile.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- IngitFile.cpp 11 May 2004 21:36:52 -0000 1.15 +++ IngitFile.cpp 11 May 2004 21:43:25 -0000 1.16 @@ -313,7 +313,6 @@ xTopRight = ih.xTopRight; yTopRight = ih.yTopRight; - scaleX = ih.scaleX; scaleY = ih.scaleY; |
From: Denis P. <dy...@us...> - 2004-05-11 21:37:02
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15891 Modified Files: IngitFile.cpp Log Message: Skip the rest of continued line. Fix world conv. Index: IngitFile.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/IngitFile.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- IngitFile.cpp 11 May 2004 21:30:00 -0000 1.14 +++ IngitFile.cpp 11 May 2004 21:36:52 -0000 1.15 @@ -388,6 +388,11 @@ if (buf[PointerATR++] >= '0' && buf[PointerATR++] <= '9') PointerATR++; + + //TODO handle line continuation + if (buf[PointerATR] == 0x20) + while (buf[PointerATR] != 0) + PointerATR++; } } // Çàïèñü ïðåäñòàâëÿåò ÒÅÊÑÒ |
From: Denis P. <dy...@us...> - 2004-05-11 21:30:13
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14254 Modified Files: IngitFile.cpp IngitTable.cpp common.cpp common.h Log Message: Add additional attributes to convert atlas_rf & world Index: IngitFile.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/IngitFile.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- IngitFile.cpp 5 May 2004 17:00:27 -0000 1.13 +++ IngitFile.cpp 11 May 2004 21:30:00 -0000 1.14 @@ -374,7 +374,7 @@ //printf ("%s ", obj[NunObj].Cod); PointerATR += iTab.len_code + 1; - char buf_atr[4]; + unsigned char buf_atr[4]; while (buf[PointerATR] != 0) { // 2 áàéòà àòðèáóòà â òàáëèöó memcpy(buf_atr, buf + PointerATR, 2); Index: common.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/common.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- common.cpp 11 May 2004 21:22:51 -0000 1.9 +++ common.cpp 11 May 2004 21:30:00 -0000 1.10 @@ -335,10 +335,10 @@ return p; } -int attrToCode(const char *buf_atr) { +int attrToCode(const unsigned char *buf_atr) { int attrCode = -1; - sscanf(buf_atr, "%d", &attrCode); + sscanf((const char *)buf_atr, "%d", &attrCode); if (memcmp(buf_atr, "AR", 2) == 0) attrCode = 100; if (memcmp(buf_atr, "RJ", 2) == 0) @@ -356,6 +356,14 @@ attrCode = 106; if (memcmp(buf_atr, "PR", 2) == 0) attrCode = 107; + if (memcmp(buf_atr, "A1", 2) == 0) + attrCode = 108; + if (memcmp(buf_atr, "OB", 2) == 0) + attrCode = 109; + if (memcmp(buf_atr, "RI", 2) == 0) + attrCode = 110; + if ((buf_atr[0] == 0x8A) && (buf_atr[1] == 0xE0)) + attrCode = 111; ASSERT(attrCode != -1); Index: common.h =================================================================== RCS file: /cvsroot/cmap/cmap/common.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- common.h 5 May 2004 16:35:52 -0000 1.9 +++ common.h 11 May 2004 21:30:00 -0000 1.10 @@ -26,7 +26,7 @@ void s_free(void *ptr); void *s_realloc(void *ptr, size_t size); -int attrToCode(const char *buf_atr); +int attrToCode(const unsigned char *buf_atr); #endif // __CMAP_COMMON_H__ Index: IngitTable.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/IngitTable.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- IngitTable.cpp 5 May 2004 16:35:52 -0000 1.11 +++ IngitTable.cpp 11 May 2004 21:30:00 -0000 1.12 @@ -148,7 +148,7 @@ } names_codif[Check_name_cod1(buf + pointer + 1)].num++; pointer += len_code + 1; - char buf_atr[4]; + unsigned char buf_atr[4]; char buf_atr_cod[256]; short ATR_cod; |
From: Denis P. <dy...@us...> - 2004-05-11 21:23:02
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12834 Modified Files: Geodesy.cpp Geodesy.h PolishFormat.cpp common.cpp Log Message: Make world working correctly. Index: Geodesy.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/Geodesy.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Geodesy.cpp 5 May 2004 16:15:57 -0000 1.6 +++ Geodesy.cpp 11 May 2004 21:22:50 -0000 1.7 @@ -5,8 +5,11 @@ return (degrees / 360000.0) - 90.0; } -double IngitLon2Degrees(long degrees) { - return (degrees > -50000000) ? (degrees / 360000.0) : -(degrees / 360000.0); +double IngitLon2Degrees(long degrees, bool start) { + if (start) + return (degrees >= -57600000) ? (degrees / 360000.0) : -(degrees / 360000.0); + else + return (degrees > -57600000) ? (degrees / 360000.0) : -(degrees / 360000.0); } double Degrees2Rads(double degrees) { Index: Geodesy.h =================================================================== RCS file: /cvsroot/cmap/cmap/Geodesy.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Geodesy.h 5 May 2004 16:15:57 -0000 1.4 +++ Geodesy.h 11 May 2004 21:22:50 -0000 1.5 @@ -11,7 +11,7 @@ double LEN_area (int n, int NunObj); double IngitLat2Degrees(long degrees); -double IngitLon2Degrees(long degrees); +double IngitLon2Degrees(long degrees, bool start); double Degrees2Rads(double degrees); double Rads2Degrees(double rad); Index: common.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/common.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- common.cpp 5 May 2004 16:35:52 -0000 1.8 +++ common.cpp 11 May 2004 21:22:51 -0000 1.9 @@ -336,7 +336,7 @@ } int attrToCode(const char *buf_atr) { - int attrCode; + int attrCode = -1; sscanf(buf_atr, "%d", &attrCode); if (memcmp(buf_atr, "AR", 2) == 0) @@ -357,5 +357,7 @@ if (memcmp(buf_atr, "PR", 2) == 0) attrCode = 107; + ASSERT(attrCode != -1); + return attrCode; } Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- PolishFormat.cpp 6 May 2004 00:42:06 -0000 1.23 +++ PolishFormat.cpp 11 May 2004 21:22:50 -0000 1.24 @@ -111,9 +111,9 @@ // Çàãðóæàåì ïàðàìåòðû ïðîåêöèèé double latSW = Degrees2Rads(IngitLat2Degrees(LAT_SouthWest)), //øèðîòà þæíîé ãðàíèöû ëèñòà - lonSW = Degrees2Rads(IngitLon2Degrees(LON_SouthWest)), //äîëãîòà çàïàäíîé ãðàíèöû êàðòû + lonSW = Degrees2Rads(IngitLon2Degrees(LON_SouthWest, true)), //äîëãîòà çàïàäíîé ãðàíèöû êàðòû latNE = Degrees2Rads(IngitLat2Degrees(LAT_NorthEast)), //øèðîòà ñåâåðíîé ãðàíèöû ëèñòà - lonNE = Degrees2Rads(IngitLon2Degrees(LON_NorthEast)); //äîëãîòà âîñòî÷íîé ãðàíèöû ëèñòà + lonNE = Degrees2Rads(IngitLon2Degrees(LON_NorthEast, false)); //äîëãîòà âîñòî÷íîé ãðàíèöû ëèñòà ASSERT(latSW < latNE); ASSERT(lonSW < lonNE); CIngitMercatorProjection Maps (latSW, latNE, lonSW, lonNE, xTopRight / 10.0, yTopRight / 10.0); |
From: Denis P. <dy...@us...> - 2004-05-11 19:38:29
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19962 Modified Files: cmap.cpp Log Message: Make GCT files working again. Index: cmap.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/cmap.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- cmap.cpp 5 May 2004 16:06:56 -0000 1.31 +++ cmap.cpp 11 May 2004 19:38:19 -0000 1.32 @@ -254,7 +254,7 @@ else n_gct++; - if (memcmp("LAYERS", FileMap[0], 7 == 0)) { + if (memcmp("LAYERS", FileMap[0], 6) == 0) { for (int j = 1; j < n_gct; j++) { strcpy (FileMap[j], FileMap[j] + 1); FileMap[j][strlen(FileMap[j]) - 1] = 0; |
From: Vladimir K. <b0...@us...> - 2004-05-08 08:40:52
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14376 Modified Files: pol.txt Log Message: ïîïðàâêà Index: pol.txt =================================================================== RCS file: /cvsroot/cmap/cmap/pol.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pol.txt 5 May 2004 22:26:00 -0000 1.3 +++ pol.txt 8 May 2004 08:40:28 -0000 1.4 @@ -9,7 +9,7 @@ 31120000 Îçåðà Åñëè ïåðèìåòð îçåðà > 50 êì òî LAYER_MAX=1 -Åñëè ïåðèìåòð îçåðà > 100 êì òî LAYER_MAX=1 +Åñëè ïåðèìåòð îçåðà > 100 êì òî LAYER_MAX=2 31410000 Ðåêè Åñëè èìååò èìÿ òî LAYER_MAX=LAYER_MAX+1 |