Commit 5cc8d461 authored by Claes Sjofors's avatar Claes Sjofors

Ge and glow read pwg-files, improved error handling

parent fab7ead2
This diff is collapsed.
...@@ -52,6 +52,12 @@ void GlowAnnot::open( ifstream& fp) ...@@ -52,6 +52,12 @@ void GlowAnnot::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowAnnot: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_Annot: break; case glow_eSave_Annot: break;
......
...@@ -68,6 +68,12 @@ void GlowArc::open( ifstream& fp) ...@@ -68,6 +68,12 @@ void GlowArc::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowArc: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_Arc: break; case glow_eSave_Arc: break;
......
...@@ -843,6 +843,12 @@ void GlowArray::open( GrowCtx *ctx, ifstream& fp) ...@@ -843,6 +843,12 @@ void GlowArray::open( GrowCtx *ctx, ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowArray: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_Array: break; case glow_eSave_Array: break;
......
...@@ -832,6 +832,12 @@ void GlowCon::open( ifstream& fp) ...@@ -832,6 +832,12 @@ void GlowCon::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowCon: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_Con: break; case glow_eSave_Con: break;
......
...@@ -64,6 +64,12 @@ void GlowConClass::open( ifstream& fp) ...@@ -64,6 +64,12 @@ void GlowConClass::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowConClass: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_ConClass: break; case glow_eSave_ConClass: break;
......
...@@ -65,6 +65,12 @@ void GlowConPoint::open( ifstream& fp) ...@@ -65,6 +65,12 @@ void GlowConPoint::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowConPoint: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_ConPoint: break; case glow_eSave_ConPoint: break;
......
...@@ -291,6 +291,12 @@ int GlowCtx::open( char *filename, glow_eSaveMode mode) ...@@ -291,6 +291,12 @@ int GlowCtx::open( char *filename, glow_eSaveMode mode)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowCtx: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_Ctx: break; case glow_eSave_Ctx: break;
......
...@@ -57,6 +57,12 @@ void GrowAnnot::open( ifstream& fp) ...@@ -57,6 +57,12 @@ void GrowAnnot::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowAnnot: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowAnnot: break; case glow_eSave_GrowAnnot: break;
......
...@@ -306,6 +306,12 @@ void GrowArc::open( ifstream& fp) ...@@ -306,6 +306,12 @@ void GrowArc::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowArc: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowArc: break; case glow_eSave_GrowArc: break;
......
...@@ -95,6 +95,12 @@ void GrowAxis::open( ifstream& fp) ...@@ -95,6 +95,12 @@ void GrowAxis::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowAxis: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowAxis: break; case glow_eSave_GrowAxis: break;
......
...@@ -98,6 +98,12 @@ void GrowBar::open( ifstream& fp) ...@@ -98,6 +98,12 @@ void GrowBar::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowBar: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowBar: break; case glow_eSave_GrowBar: break;
......
...@@ -239,6 +239,12 @@ void GrowConGlue::open( ifstream& fp) ...@@ -239,6 +239,12 @@ void GrowConGlue::open( ifstream& fp)
char dummy[40]; char dummy[40];
for (;;) { for (;;) {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowConGlue: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowConGlue: break; case glow_eSave_GrowConGlue: break;
......
...@@ -243,6 +243,12 @@ void GrowConPoint::open( ifstream& fp) ...@@ -243,6 +243,12 @@ void GrowConPoint::open( ifstream& fp)
char dummy[40]; char dummy[40];
for (;;) { for (;;) {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowConPoint: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowConPoint: break; case glow_eSave_GrowConPoint: break;
......
...@@ -1982,6 +1982,12 @@ void GrowCtx::open_grow( ifstream& fp) ...@@ -1982,6 +1982,12 @@ void GrowCtx::open_grow( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowCtx: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowCtx: break; case glow_eSave_GrowCtx: break;
......
...@@ -96,6 +96,12 @@ void GrowFolder::open( ifstream& fp) ...@@ -96,6 +96,12 @@ void GrowFolder::open( ifstream& fp)
int tmp; int tmp;
for (;;) { for (;;) {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowFolder: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowFolder: break; case glow_eSave_GrowFolder: break;
......
...@@ -108,6 +108,12 @@ void GrowGroup::open( ifstream& fp) ...@@ -108,6 +108,12 @@ void GrowGroup::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowGroup: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowGroup: break; case glow_eSave_GrowGroup: break;
......
...@@ -464,6 +464,12 @@ void GrowImage::open( ifstream& fp) ...@@ -464,6 +464,12 @@ void GrowImage::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowImage: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowImage: break; case glow_eSave_GrowImage: break;
......
...@@ -303,6 +303,12 @@ void GrowLine::open( ifstream& fp) ...@@ -303,6 +303,12 @@ void GrowLine::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowLine: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowLine: break; case glow_eSave_GrowLine: break;
......
...@@ -201,6 +201,12 @@ void GrowNode::open( ifstream& fp) ...@@ -201,6 +201,12 @@ void GrowNode::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowNode: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowNode: break; case glow_eSave_GrowNode: break;
......
...@@ -878,6 +878,12 @@ void GrowPolyLine::open( ifstream& fp) ...@@ -878,6 +878,12 @@ void GrowPolyLine::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowPolyLine: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowPolyLine: break; case glow_eSave_GrowPolyLine: break;
......
...@@ -320,6 +320,12 @@ void GrowRect::open( ifstream& fp) ...@@ -320,6 +320,12 @@ void GrowRect::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowLine: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowRect: break; case glow_eSave_GrowRect: break;
......
...@@ -305,6 +305,12 @@ void GrowRectRounded::open( ifstream& fp) ...@@ -305,6 +305,12 @@ void GrowRectRounded::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowRectRounded: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowRectRounded: break; case glow_eSave_GrowRectRounded: break;
......
...@@ -79,6 +79,12 @@ void GrowSlider::open( ifstream& fp) ...@@ -79,6 +79,12 @@ void GrowSlider::open( ifstream& fp)
int tmp; int tmp;
for (;;) { for (;;) {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowSlider: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowSlider: break; case glow_eSave_GrowSlider: break;
......
...@@ -269,6 +269,12 @@ void GrowSubAnnot::open( ifstream& fp) ...@@ -269,6 +269,12 @@ void GrowSubAnnot::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowSubAnnot: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowSubAnnot: break; case glow_eSave_GrowSubAnnot: break;
......
...@@ -127,6 +127,12 @@ void GrowTable::open( ifstream& fp) ...@@ -127,6 +127,12 @@ void GrowTable::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowTable: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowTable: break; case glow_eSave_GrowTable: break;
......
...@@ -281,6 +281,12 @@ void GrowText::open( ifstream& fp) ...@@ -281,6 +281,12 @@ void GrowText::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowText: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowText: break; case glow_eSave_GrowText: break;
......
...@@ -218,6 +218,12 @@ void GrowTrend::open( ifstream& fp) ...@@ -218,6 +218,12 @@ void GrowTrend::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowTrend: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowTrend: break; case glow_eSave_GrowTrend: break;
......
...@@ -99,6 +99,12 @@ void GrowWindow::open( ifstream& fp) ...@@ -99,6 +99,12 @@ void GrowWindow::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowWindow: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowWindow: break; case glow_eSave_GrowWindow: break;
......
...@@ -61,6 +61,12 @@ void GrowXYCurve::open( ifstream& fp) ...@@ -61,6 +61,12 @@ void GrowXYCurve::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GrowXYWindow: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_GrowXYCurve: break; case glow_eSave_GrowXYCurve: break;
......
...@@ -71,6 +71,12 @@ void GlowLine::open( ifstream& fp) ...@@ -71,6 +71,12 @@ void GlowLine::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowLine: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_Line: break; case glow_eSave_Line: break;
......
...@@ -191,6 +191,12 @@ void GlowNode::open( ifstream& fp) ...@@ -191,6 +191,12 @@ void GlowNode::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowNode: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_Node: break; case glow_eSave_Node: break;
......
...@@ -164,6 +164,12 @@ void GlowNodeClass::open( ifstream& fp) ...@@ -164,6 +164,12 @@ void GlowNodeClass::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowNodeClass: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_NodeClass: break; case glow_eSave_NodeClass: break;
......
...@@ -82,6 +82,12 @@ void GlowNodeGroup::open( ifstream& fp) ...@@ -82,6 +82,12 @@ void GlowNodeGroup::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowNodeGroup: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_NodeGroup: break; case glow_eSave_NodeGroup: break;
......
...@@ -89,6 +89,12 @@ void GlowPoint::open( ifstream& fp) ...@@ -89,6 +89,12 @@ void GlowPoint::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowPoint: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_Point: break; case glow_eSave_Point: break;
......
...@@ -102,6 +102,12 @@ void GlowPolyLine::open( ifstream& fp) ...@@ -102,6 +102,12 @@ void GlowPolyLine::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowPolyLine: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_PolyLine: break; case glow_eSave_PolyLine: break;
......
...@@ -72,6 +72,12 @@ void GlowRect::open( ifstream& fp) ...@@ -72,6 +72,12 @@ void GlowRect::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowRect: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_Rect: break; case glow_eSave_Rect: break;
......
...@@ -67,6 +67,12 @@ void GlowText::open( ifstream& fp) ...@@ -67,6 +67,12 @@ void GlowText::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowText: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_Text: break; case glow_eSave_Text: break;
......
...@@ -213,6 +213,12 @@ void GlowTransform::open( ifstream& fp) ...@@ -213,6 +213,12 @@ void GlowTransform::open( ifstream& fp)
for (;;) for (;;)
{ {
if ( !fp.good()) {
fp.clear();
fp.getline( dummy, sizeof(dummy));
printf( "** Read error GlowTransform: \"%d %s\"\n", type, dummy);
}
fp >> type; fp >> type;
switch( type) { switch( type) {
case glow_eSave_Transform: break; case glow_eSave_Transform: break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment