Пример #1
0
    int go(string op, bool debug=false) {
      for(int i = 0; i < (int)op.length(); i++) {
        move(op[i]);
        update();
        if(debug) print();
        switch(ending()) {
        case 1:
          printf("YOU WIN!\n");
          print();
          break;
        case 2:
          printf("ABORT\n");
          print();
          break;
        case 3:
          printf("YOU LOSE\n");
          print();
          break;          
        default:
          break;
        }
      }

      return 0;
    }
Пример #2
0
void MainWindow::genLineEnding()
{
  resetPlot();
  QMetaEnum endingStyleEnum = QCPLineEnding::staticMetaObject.enumerator(QCPLineEnding::staticMetaObject.indexOfEnumerator("EndingStyle"));
  double offset = -0.2;
  double step = 1.4/((double)endingStyleEnum.keyCount()-1);
  for (int i=0; i<endingStyleEnum.keyCount(); ++i)
  {
    QCPLineEnding ending(static_cast<QCPLineEnding::EndingStyle>(endingStyleEnum.value(i)));
    QString endingName(endingStyleEnum.key(i));
    
    if (ending.style() == QCPLineEnding::esSkewedBar)
      ending.setInverted(true);
    
    QCPItemLine *line = new QCPItemLine(customPlot);
    line->setPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::FlatCap));
    customPlot->addItem(line);
    line->start->setCoords(offset+i*step-0.1, -0.2);
    line->end->setCoords(offset+i*step, 0.5);
    line->setHead(ending);
    QCPItemText *text = new QCPItemText(customPlot);
    customPlot->addItem(text);
    text->position->setParentAnchor(line->end);
    text->position->setCoords(8, -15-(i%2)*15);
    text->setFont(QFont(font().family(), 8));
    text->setText(endingName);
  }

  customPlot->savePng(dir.filePath("QCPLineEnding.png"), 500, 100);
}
bool CCBReader::endsWith(CCString * pString, CCString * pEnding) {
    std::string string(pString->getCString());
    std::string ending(pEnding->getCString());
    if(string.length() >= ending.length()) {
        return (string.compare(string.length() - ending.length(), ending.length(), ending) == 0);
    } else {
        return false;
    }
}
Пример #4
0
bool CCBReader::endsWith(const char* pString, const char* pEnding) {
    std::string string(pString);
    std::string ending(pEnding);
    if(string.length() >= ending.length()) {
        return (string.compare(string.length() - ending.length(), ending.length(), ending) == 0);
    } else {
        return false;
    }
}
Пример #5
0
static void
reportCroppingParameters(cropSet const crop) {

    unsigned int i;

    for (i = 0; i < 4; ++i) {
        if (crop.op[i].removeSize == 0 && crop.op[i].padSize == 0)
            pm_message("Not cropping %s edge", edgeName[i]);
        else {
            if (crop.op[i].padSize > 0)
                pm_message("Adding %u pixel%s to the %s border",
                           crop.op[i].padSize, ending(crop.op[i].padSize),
                           edgeName[i]);
            if (crop.op[i].removeSize > 0)
                pm_message("Cropping %u pixel%s from the %s border",
                           crop.op[i].removeSize,
                           ending(crop.op[i].removeSize),
                           edgeName[i]);
        }
    }
}
Пример #6
0
	static std::string parseHundreds(int number) {
		if (number < HUNDRED) {
			return parseTens(number);
		} else {
			std::stringstream result;
			result << numbersNames[number / HUNDRED] << " hundred" << ending(number / HUNDRED);
			if (number % HUNDRED != 0) {
				result << " " << parseTens(number % HUNDRED);
			}
			return result.str();
		}
	}
Пример #7
0
	static std::string parseThousands(int number) {
		if (number < THOUSAND) {
			return parseHundreds(number);
		} else {
			std::stringstream result;
			result << parseHundreds(number / THOUSAND) << " thousand" << ending(number / THOUSAND);
			if (number % THOUSAND != 0) {
				result << " " << parseHundreds(number % THOUSAND);
			}
			return result.str();		
		}
	}
Пример #8
0
std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly)
{
    uint64 secs    = timeInSecs % MINUTE;
    uint64 minutes = timeInSecs % HOUR / MINUTE;
    uint64 hours   = timeInSecs % DAY  / HOUR;
    uint64 days    = timeInSecs / DAY;

    std::ostringstream ss;
    if (days)
        ss << days << (shortText ? "д" : ending(days, " дней ", " день ", " дня "));
    if (hours || hoursOnly)
        ss << hours << (shortText ? "ч" : ending(hours, " часов ", " час ", " часа "));
    if (!hoursOnly)
    {
        if (minutes)
            ss << minutes << (shortText ? "м" : ending(minutes, " минут ", " минута ", " минуты "));
        if (secs || (!days && !hours && !minutes) )
            ss << secs << (shortText ? "с" : ending(secs, " секунд ", " секунда ", " секунды "));
    }

    return ss.str();
}
Пример #9
0
	static std::string parseMillions(int number) {

		if (number < MILLION) {
			return parseThousands(number);
		} else {
			std::stringstream result;
			result << parseHundreds(number / MILLION) << " million" << ending(number / MILLION);
			if (number % MILLION != 0) {
				result << " " << parseThousands(number % MILLION);
			}
			return result.str();		
		}
	}
Пример #10
0
void ProgramSystemMain::finalize()
{
    //後始末
    ending();

    //=================
    //SDLを終わらせる
    //=================
    //Mix_Quit();
    Mix_CloseAudio();
    //IMG_Quit();
    SDLNet_Quit();
    TTF_Quit();
    SDL_Quit();
}
Пример #11
0
void down(char x[15][30],int *ptr1,int *ptr2,int *c,char d){
	checker(x,*ptr1+1,*ptr2,c);
	if(*c==0){
		x[*ptr1][*ptr2]=d;
		show(x);
	}
	else if(*c==1){
		*ptr1=*ptr1+1;
		x[*ptr1][*ptr2]=d;
		x[*ptr1-1][*ptr2]=' ';
		show(x);
	}
	else if(*c==3){
		*ptr1=*ptr1+1;
		x[*ptr1][*ptr2]=d;
		x[*ptr1-1][*ptr2]=' ';
        ending();
	}
}
Пример #12
0
//--------------------------------------------------------------
void testApp::draw(){
    if(state_screen==0){
        // title
        title();
    } else if (state_screen==1){
        // lose
        lose();
    } else if (state_screen==2){
        // win
        win();
    } else if (state_screen==4){
        // ending
        ending();
    } else {
        // level
        level(levels_current);
    }
//    cout<<state_screen<<" "<<levels_current<<endl;
}
Пример #13
0
void left(char x[15][30],int *ptr1,int *ptr2,int *c ,char d){
	checker(x,*ptr1,*ptr2-1,c);
	if(*c==0){
		x[*ptr1][*ptr2]=d;
		show(x);
	}
	else if(*c==1){
		*ptr2=*ptr2-1;
		x[*ptr1][*ptr2]=d;
		x[*ptr1][*ptr2+1]=' ';
		show(x);
	}
	else if(*c==3){
		*ptr2=*ptr2-1;
		x[*ptr1][*ptr2]=d;
		x[*ptr1][*ptr2+1]=' ';
        ending();
        exit(0);
	}

}
Пример #14
0
/*--- 主函式 ---*/
int main(void) {
    if (initialize()) {
        int   q, ch;
        char  qus[20];          /* 問題用字串 */
        char  ans[20];          /* 解答用字串 */

        for (q = 0; q < Q_NO; q++) {
            int  i;

            ch = fgetc(fp);

            if (ch == EOF) {
                goto ending;
            }

            for (i = 0; !(isspace(ch)); i++) {
                qus[i] = ch;
                ch = fgetc(fp);
            }

            qus[i] = '\0';

            ch = fgetc(fp);

            for (i = 0; !(isspace(ch)); i++) {
                ans[i] = ch;
                ch = fgetc(fp);
            }

            ans[i] = '\0';
            printf("問題= %s 解答= %s\n", qus, ans);
        }

ending:
        ending();
    }

    system("PAUSE");
    return (0);
}
Пример #15
0
ProgramSystemMain::~ProgramSystemMain()
{
    ending();
}
Пример #16
0
void Game::play()
{
  int time        = 0, 
      i           = 0;
  int size        = grille->getSize();
  int fullSize    = grille->getSize()*grille->getSize();
  char * toPrint  = new char[fullSize];
  bool areAllDead = false;
  
  vector< Mob * >::iterator it;
  vector<Tower *>::iterator tower;
  
  lives = 100;
  
  // on pop tous les mobs de la map :
  for( it = mobs.begin(); it != mobs.end(); ++it )
  {
    (*it)->popUnit(i*5);
    ++i;
  }
  
  grille->print();
  
  // on fait avancer le temps par pas de 1
  cout << "Time is " << time << endl;
  i = 0;
  for( it = mobs.begin(); it != mobs.end(); ++it )
  {
    cout << "Unit " << ++i << " will make move " << (*it)->where() << " at time " << (*it)->when() << endl;
  }
  PAUSE;
  
  while( !areAllDead && time < 100 )
  {
    ++time;
    CLS;
    
    // wipe out old data
    for( i = 0; i < fullSize; ++i )
    {
      toPrint[i] = 'x';
    } 
    
    // construct the new mobs
    for( it = mobs.begin(); it != mobs.end(); ++it )
    {
      if( !(*it)->isDead() )
        toPrint[(*it)->whereAmI()] = 'S';
    }
    
    // construct the towers
    for( tower = towers.begin(); tower != towers.end(); ++tower )
    {
      toPrint[(*tower)->whereAmI()] = 'T';
    }
    
    display(toPrint, size);
    
    cout << "Time is " << time << endl;
    i = 0;
    for( it = mobs.begin(); it != mobs.end(); ++it )
    {
      cout << "Unit " << ++i << " will make move " << (*it)->where() << " at time " << (*it)->when() << endl;
    }


    // let the towers fire !!!
    // ici je dois gérer les soucis de boom boom boom
    // mais déjà je dois faire les tours.
    i = 0;
    for( tower = towers.begin(); tower != towers.end(); ++tower )
    {
      cout << "Tower " << ++i << " ";
      (*tower)->fire(mobs.begin(), mobs.end());
    }
    cout << "Lives: " << lives << endl;
    cout << "Gold : " << gold_ << endl;
    
    // we should make units avance I think no ?
    areAllDead = true;
    for( it = mobs.begin(); it != mobs.end(); ++it )
    {
      lives += (*it)->next(time);
      if( !(*it)->isDead() )
        areAllDead = false;
    }
    

    
    //PAUSE
    sleep(1);
  }
  
  /*
  for( it = mobs.begin(); it != mobs.end(); ++it )
  {
    delete (*it);
  }
  for( tower = towers.begin(); tower != towers.end(); ++tower )
  {
    delete *tower;
  }*/
  
  ending();
  
  delete[] toPrint;
}
Пример #17
0
void format(char *buf, const char* fmt, struct disc_time dt)
{
    int tib_start=-1, tib_end=0;
    int i, fmtlen=strlen(fmt);
    char *bufptr=buf;

/*    fprintf(stderr, "format(%p, \"%s\", dt)\n", buf, fmt);*/

    /* first, find extents of St. Tib's Day area, if defined */
    for(i=0; i<fmtlen; i++) {
	if(fmt[i]=='%') {
	    switch(fmt[i+1]) {
	    case 'A':
	    case 'a':
	    case 'd':
	    case 'e':
		if(tib_start>0)	    tib_end=i+1;
		else		    tib_start=i;
		break;
	    case '{': tib_start=i; break;
	    case '}': tib_end=i+1; break;
	    }
	}
    }

    /* now do the formatting */
    buf[0]=0;

    for(i=0; i<fmtlen; i++) {
	if((i==tib_start) && (dt.day==-1)) {
	    /* handle St. Tib's Day */
	    strcpy(bufptr, _("St. Tib's Day"));
	    bufptr += strlen(bufptr);
	    i=tib_end;
	} else {
	    if(fmt[i]=='%') {
		char *wibble=0, snarf[23];
		switch(fmt[++i]) {
		case 'A': wibble=day_long[dt.yday%5]; break;
		case 'a': wibble=day_short[dt.yday%5]; break;
		case 'B': wibble=season_long[dt.season]; break;
		case 'b': wibble=season_short[dt.season]; break;
		case 'd': sprintf(snarf, "%d", dt.day+1); wibble=snarf; break;
		case 'e': sprintf(snarf, "%d%s", dt.day+1, ending(dt.day+1)); 
		    wibble=snarf; break;
		case 'H': if(dt.day==4||dt.day==49)
		    wibble=holyday[dt.season][dt.day==49]; break;
		case 'N': if(dt.day!=4&&dt.day!=49) goto eschaton; break;
		case 'n': *(bufptr++)='\n'; break;
		case 't': *(bufptr++)='\t'; break;

		case 'Y': sprintf(snarf, "%d", dt.year); wibble=snarf; break;
		case '.': wibble=sel(excl, ARRAY_SIZE(excl));
		    break;
#ifdef KILL_BOB
		case 'X': sprintf(snarf, "%d", 
				  xday_countdown(dt.yday, dt.year));
				  wibble = snarf; break;
#endif /* KILL_BOB */
		}
		if(wibble) {
/*		    fprintf(stderr, "wibble = (%s)\n", wibble);*/
		    strcpy(bufptr, wibble); bufptr+=strlen(wibble);
		}
	    } else {
		*(bufptr++) = fmt[i];
	    }
	}
    }
  eschaton:
    *(bufptr)=0;
}
Пример #18
0
//******************************************************************************************
//main program function
//******************************************************************************************
void main(void) {
	Sys_Init();      			// System Initialization
	Port_Init();     			// Initialize ports 2 and 3
	Interrupt_Init();			//Initialize Interrupts
	Timer_Init();				//Initialize timer 0
	putchar(' ');    		
	printf("\r\nStart\r\n");
	while(1) {	
		BILED0=1;	//Turn OFF the BILED
		BILED1=1;
		printf("\rHow To Play:\r\nIf Red Led is on the player must Push button 0\r\nIf Green Led is on the player must Push button 1\r\nIf both Leds are on the player must push both Buttons\r\nKeep in mind you will only have 1 sec push the corresponding button/s\r\nA correct input will make the Clear Led flash green, while an incorrect input will make it flash red\r\nTo begin press any key\r\n");	

		keyinput=getchar();
		
		previousnum=keyinput%3;
		i=0;
		numC=0;
		while (i<=9) {
			StopAndResetTimer();
			if(!SS) {
				StartTimer();
				randomnum = random();					//create a random number. where randomnum is a 
				while (randomnum==previousnum) {
					randomnum = random();
				}							//check to see if the random number was used before
	
				if (randomnum==0) {						
					LED0=0;					//turn it on
					debounce(); 			
					LED0=1; 				//turn it off
					if (PB0==0 && PB1==1) {
						correct();		//store correct answer;
					} else {
						incorrect();
					}
				} else if (randomnum==1) {						
					LED1=0; 				//turn it on
					debounce(); 			
					LED1=1; 				//turn it off
					if (PB0==1 && PB1==0) {
						correct();
					} else {
						incorrect();
					}	
				} else{						//rand num is 2, light LED0 and LED1 for 1 second
					LED0=0;
					LED1=0;
					debounce();
					LED0=1;
					LED1=1;
					if (PB0==0 && PB1==0){
						correct();
					} else 	{
						incorrect();
					}
				}
				
				previousnum=randomnum;
				i++;									//increment i
			} else 	{
				PauseTimer();
			}

		}// end while < 9
		printf("\r\n Number of correct answers = %d\r\n", numC);		//display results
		ending();
		TR0 = 0;								//turn off timer
		BILED1=1;
		BILED0=1;
		while (!SS);							//wait until the switch is turned off and back on again to loop
		while (SS);								
	}	
}//end main
Пример #19
0
void ddate(char *buffer, size_t maxsize, struct tm *eris)
{ char *days[5] = { "Sweetmorn",
                    "Boomtime",
                    "Pungenday",
                    "Prickle-Prickle",
                    "Setting Orange"
  };
  char *seasons[5] = {"Chaos",
                      "Discord",
                      "Confusion",
                      "Bureaucracy",
                      "The Aftermath"
  };
  struct disc_time tick;
  tick=convert(eris->tm_yday, eris->tm_year);
  if (tick.day==-1) snprintf(buffer, maxsize, "St. Tib's Day in the YOLD %d",tick.year);
  else
    { tick.day++;
      snprintf(buffer, maxsize, "%s, %d%s day of %s - YOLD %d", days[tick.yday%5], tick.day, ending(tick.day),seasons[tick.season], tick.year);
    }
}
Пример #20
0
void cubex_main(){
input = get_input();
ref_increment((General_t)input);
a = NULL;
__temp4 = NULL;
__temp0 = NULL;
__temp5 = NULL;
__temp1 = NULL;
__temp6 = NULL;
__temp2 = NULL;
__temp7 = NULL;
__temp3 = NULL;
__temp0 = NULL;
ref_decrement((General_t)__temp0);
__temp0 = new_integer(1);
ref_increment((General_t)__temp0);
ref_decrement((General_t)__temp0);
__temp0 = NULL;
ref_decrement((General_t)__temp1);
__temp1 = new_integer(1);
ref_increment((General_t)__temp1);
if(((Boolean_t)__temp1)->value) {
ref_decrement((General_t)__temp1);
__temp1= NULL;
__temp2 = NULL;
ref_decrement((General_t)__temp2);
__temp2 = new_git_obj_charuni((char) 't');
ref_increment((General_t)__temp2);
__temp3 = NULL;
ref_decrement((General_t)__temp3);
__temp3 = iterable_append((git_t) __temp2,(git_t) NULL);
ref_increment((General_t)__temp3);
ref_decrement((General_t)__temp2);
__temp2 = NULL;
ref_decrement((General_t)a);
a = __temp3;
ref_increment((General_t)a);
ref_decrement((General_t)__temp3);
__temp3 = NULL;
} else {
ref_decrement((General_t)__temp1);
__temp1= NULL;
__temp4 = NULL;
ref_decrement((General_t)__temp4);
__temp4 = new_git_obj_charuni((char) 'f');
ref_increment((General_t)__temp4);
__temp5 = NULL;
ref_decrement((General_t)__temp5);
__temp5 = iterable_append((git_t) __temp4,(git_t) NULL);
ref_increment((General_t)__temp5);
ref_decrement((General_t)__temp4);
__temp4 = NULL;
ref_decrement((General_t)a);
a = __temp5;
ref_increment((General_t)a);
ref_decrement((General_t)__temp5);
__temp5 = NULL;
}
ref_decrement((General_t)__temp6);
__temp6 = new_git_obj((void*) a);
ref_increment((General_t)__temp6);
ref_decrement((General_t)a);
a = NULL;
ref_decrement((General_t)__temp7);
__temp7 = iterable_append((git_t) __temp6,(git_t) NULL);
ref_increment((General_t)__temp7);
ref_decrement((General_t)__temp6);
__temp6 = NULL;
_it1 = new_iterator((__temp7));
ref_increment((General_t)_it1);
while(hasNext(_it1)) {
_return = getNext(_it1);
print_line(charToString(_return), stringLength(_return));
}
ref_decrement((General_t)_it1);
_it1 = NULL;
ref_decrement((General_t)__temp7);
__temp7 = NULL;
ref_decrement((General_t)input);
ending();
return;
}
Пример #21
0
Error 
_dxfValidate(Field f)
{
    Array current = NULL;
    Array target = NULL;
    char *tname, *cname;
    int ncurrent, ntarget, *ip;
    int index;
    unsigned char *cp;
    int i, j, lim, nitems;
    Type type, ref_type;
    Category cat;
    String s = NULL;
    Object o = NULL;
    int rank, shape[MAXRANK];
    int counts[MAXRANK];

    for (i=0; (current=(Array)DXGetEnumeratedComponentValue(f, i, &cname)); i++) {

	/* dep */
	if ((s = (String)DXGetAttribute((Object)current, "dep")) != NULL) {
	    /* make sure number of items matches number of items in dep */
	    if ((DXGetObjectClass((Object)s) != CLASS_STRING) ||
	        ((tname = DXGetString(s)) == NULL)) {
		DXSetError(ERROR_DATA_INVALID, 
			 Err_MustBeString, "dep", cname);
		return ERROR;
	    }
	    
	    if ((target = (Array)DXGetComponentValue(f, tname)) == NULL) {
		DXSetError(ERROR_DATA_INVALID, 
			 Err_MissingComp, tname, "dep", cname);
		return ERROR;
	    }
	    
	    if (DXGetObjectClass((Object)target) != CLASS_ARRAY) {
		DXSetError(ERROR_DATA_INVALID,
			 Err_NotArray, tname, "dep", cname);
		return ERROR;
	    }
	    
	    if (!DXGetArrayInfo(current, &nitems, &type, &cat, &rank, shape))
		return ERROR;
	    
	    ncurrent = nitems;

	    if (!DXGetArrayInfo(target, &nitems, &type, &cat, &rank, shape))
		return ERROR;
	    
	    ntarget = nitems;
	    
	    if (ncurrent != ntarget) {
		DXSetError(ERROR_DATA_INVALID,
			 Err_DiffCount, "dep",
			 ncurrent, cname, ntarget, tname);
		return ERROR;
	    }

	} /* end of if (has dep) */


	/* ref */
	if ((s = (String)DXGetAttribute((Object)current, "ref")) != NULL) {
	    if ((DXGetObjectClass((Object)s) != CLASS_STRING) ||
	        ((tname = DXGetString(s)) == NULL)) {
		DXSetError(ERROR_DATA_INVALID, 
			   Err_MustBeString, "ref", cname);
		return ERROR;
	    }
	    
	    if ((target = (Array)DXGetComponentValue(f, tname)) == NULL) {
		DXSetError(ERROR_DATA_INVALID,
			   Err_MissingComp, tname, "ref", cname);
		return ERROR;
	    }
	    
	    if (DXGetObjectClass((Object)target) != CLASS_ARRAY) {
		DXSetError(ERROR_DATA_INVALID, 
			   Err_NotArray, tname, "ref", cname);
		return ERROR;
	    }
	    
	    if (!DXGetArrayInfo(current, &nitems, &type, &cat, &rank, shape))
		return ERROR;
	    
	    if ( !( type == TYPE_INT || type == TYPE_UBYTE ) ) {
		DXSetError(ERROR_DATA_INVALID, Err_RefNotInt, cname);
		return ERROR;
	    }
	    ref_type = type;
	    
	    ncurrent = nitems;
	    for (j=0; j<rank; j++)
	        ncurrent *= shape[j];
	    
	    if (ncurrent > 0) {
                
		if (!DXGetArrayInfo(target, &nitems, &type, &cat, &rank, shape))
		    return ERROR;
		
		ntarget = nitems;
                
                /* only do this if they are already irregular */
                if (DXGetArrayClass(current) == CLASS_ARRAY) {
                    if ((ip = (int *)DXGetArrayData(current)) == NULL)
                        return ERROR;
		    cp = (unsigned char *) ip;
                    
		    /* neighbors can have -1's as indicies */
                    lim = strcmp(cname, "neighbors") ? 0 : -1;

		    for (j=0; j < ncurrent; j++) {
			if (ref_type == TYPE_INT) index = *(ip++);
			else                      index = *(cp++);

			if (index < lim || index >= ntarget) {
			    DXSetError(ERROR_DATA_INVALID, Err_OutOfRange,
				j+1, ending(j+1), cname, index, lim, ntarget-1);
			    return ERROR;
			}
		    }

                } else if (DXQueryGridConnections(current, &rank, counts)) {
		    for (j=0, ncurrent=1; j<rank; j++)
			ncurrent *= counts[j];
                    if (ncurrent > ntarget) {
                        DXSetError(ERROR_DATA_INVALID,
                                 Err_DiffCount, "ref",
                                 ncurrent, cname, ntarget, tname);
                        return ERROR;
                    }
                } else {
                    /* mesh array of mixed path and irregular arrays. */
                    /* have to handle the terms separately */
                }
	    }
	} /* end of if (has ref) */


        /* der - can be string lists here */
	if ((o = DXGetAttribute((Object)current, "der")) != NULL) {

	    if (DXExtractString(o, &tname)) {    /* simple string? */
		if ((target = (Array)DXGetComponentValue(f, tname)) == NULL) {
		    DXSetError(ERROR_DATA_INVALID,
			       Err_MissingComp, tname, "der", cname);
		    return ERROR;
		}
		
		if (DXGetObjectClass((Object)target) != CLASS_ARRAY) {
		    DXSetError(ERROR_DATA_INVALID,
			       Err_NotArray, tname, "der", cname);
		    return ERROR;
		}
	    } else if (DXExtractNthString(o, 0, &tname)) {  /* string list? */
		for (j=0; DXExtractNthString(o, j, &tname); j++) {
		    
		    if ((target = (Array)DXGetComponentValue(f, tname)) == NULL) {
			DXSetError(ERROR_DATA_INVALID,
				   Err_MissingComp, tname, "der", cname);
			return ERROR;
		    }
		    
		    if (DXGetObjectClass((Object)target) != CLASS_ARRAY) {
			DXSetError(ERROR_DATA_INVALID,
				   Err_NotArray, tname, "der", cname);
			return ERROR;
		    }
		}
	    } else {  /* neither string or string list */
		DXSetError(ERROR_DATA_INVALID, 
			   Err_MustBeStringList, "der", cname);
		return ERROR;
	    }
	    
	} /* end of if (has der) */

        /* element type */
	if ((s = (String)DXGetAttribute((Object)current, "element type")) != NULL) {
	    if ((DXGetObjectClass((Object)s) != CLASS_STRING) ||
	        ((tname = DXGetString(s)) == NULL)) {
		DXSetError(ERROR_DATA_INVALID, 
			 Err_MustBeString, "element type", cname);
		return ERROR;
	    }
	    
	    if (!strcmp(cname, "connections") && 
		DXQueryGridConnections(current, &rank, counts)) {

		if (!elemtypecheck(rank, tname))
		    return ERROR;
	    }

	} /* end of if (has element type) */

    }  /* for each component in the field */

    /* check for missing positions component if the field has more than
     *  one component.
     */
    if (i > 1 && !DXGetComponentValue(f, "positions"))
	DXWarning("importing a field with no `positions' component");

    return OK;
}