예제 #1
0
void schedule_handler(int fd, fd_set* reads)
/************************************************************/
{
	//int i = 0;
	//int status = 0;
	int rxmsg_length = 0;
	SEND_DATA *pRx;

	memset(sched_rx_msg, 0, sizeof(sched_rx_msg));
	rxmsg_length = recv(fd, sched_rx_msg, sizeof(sched_rx_msg), 0);

	if(rxmsg_length == 0)
	{
		g_msgWr = 0;
		memset(message, 0, sizeof(message));
		
		FD_CLR(fd, reads);
		close(fd);
		if ( g_dbgShow ) 
			printf("Schedule-Server Close\n");
			
		return;
	}
	
	if ( (rxmsg_length + g_msgWr) > sizeof(message) - 2 )
	{
		g_msgWr = 0;
		memset(message, 0, sizeof(message));
		
		FD_CLR(fd, reads);
		close(fd);
		if ( g_dbgShow ) 
			printf("Buffer Pull Schedule-Server Close\n");
		return;			
	}
		

	//printf("Handler RX msg[%d] : \n", rxmsg_length);
	memcpy(&message[g_msgWr], &sched_rx_msg, rxmsg_length);
	g_msgWr += rxmsg_length;
	pRx = (SEND_DATA *)&message;

	if(g_msgWr == pRx->length && Check_Message(pRx))
	{
		Parsing_Data(pRx);
		SetDate(pRx);
	}
}
예제 #2
0
/*********************************************************************//**
 * @brief		CAN_IRQ Handler, control receive message operation
 * param[in]	none
 * @return 		none
 **********************************************************************/
void CAN_IRQHandler()
{
    uint8_t IntStatus;
//	uint32_t data1;
    /* Get CAN status */
    IntStatus = CAN_GetCTRLStatus(LPC_CAN1, CANCTRL_STS);
    //check receive buffer status
    if((IntStatus>>0)&0x01)
    {
        CAN_ReceiveMsg(LPC_CAN1,&RXMsg);
        _DBG_("Received buffer:");
        PrintMessage(&RXMsg);
        //Validate received and transmited message
        if(Check_Message(&TXMsg, &RXMsg))
            _DBG_("Self test is SUCCESSFUL!!!");
        else
            _DBG_("Self test is FAIL!!!");
    }
}
예제 #3
0
bool Network_Service::Turn_Processing (Db_File *fh)
{
	bool node_flag, link_flag, ab_flag;
	int lvalue, num, node_num, link;
	char *str_ptr;

	Link_Data *link_ptr = NULL;	
	Turn_Data *turn_ptr = NULL;
	Time_Step time_step;

	Turn_File *file = (Turn_File *) fh;

	node_flag = Network_Data_Flag (NODE);
	link_flag = Network_Data_Flag (LINK);
	ab_flag = file->Node_Based ();

	//---- reserve memory ----

	if (turn_data.Max_Records () == 0) {
		if (!turn_data.Max_Records (file->Num_Records ())) goto mem_error;
	}

	//---- read and save the data ----

	turn_ptr = turn_data.New_Record ();
	if (turn_ptr == NULL) goto mem_error;

	node_num = file->Node ();

    if (node_num == 0) return (false);

	if (node_flag) {
		num = node_data.Get_Index (node_num);

		if (num == 0) {
			return (Check_Message ("Turn Prohibition Node %d was Not Found in the Node file", node_num));
		}
		if (!Renumber ()) {
			num = node_num;
		}
	} else {
		num = node_num;
	}

	if (ab_flag) {

		//---- node-based method ----

		AB_Data *ab_ptr;
		Dir_Data *dir_ptr;

		lvalue = file->In_Node ();

		ab_ptr = ab_key.Get (lvalue, node_num);

		if (ab_ptr == NULL) {
			return (Check_Message ("A Link between %d and %d was Not Found", lvalue, node_num));
		}
		dir_ptr = dir_data [ab_ptr->dir];

		turn_ptr->In_Link_Dir (dir_ptr->Link_Dir ());

		lvalue = file->Out_Node ();

		ab_ptr = ab_key.Get (node_num, lvalue);

		if (ab_ptr == NULL) {
			return (Check_Message ("A Link between %d and %d was Not Found", node_num, lvalue));
		}

		dir_ptr = dir_data [ab_ptr->dir];

		turn_ptr->Out_Link_Dir (dir_ptr->Link_Dir ());

	} else {

		//---- link-based method ----
		
		lvalue = file->In_Link ();

		if (link_flag) {
			link = link_data.Get_Index (lvalue);

			if (link == 0) {
				return (Check_Message ("Turn Prohibition In-Link %d was Not Found in the Link file", lvalue));
			}
			link_ptr = link_data [link];

			if (!Renumber ()) {
				link = lvalue;
			}
			turn_ptr->In_Link (link);
			
			if (link_ptr->Anode () == num) {
				turn_ptr->In_Dir (1);
			} else if (link_ptr->Bnode () == num) {
				turn_ptr->In_Dir (0);
			} else {
				return (Check_Message ("Turn Prohibition In-Link %d is Not Attached to Node %d", lvalue, node_num));
			}
		} else {
			turn_ptr->In_Link (lvalue);
		}

		//---- check/convert the out-link number ----
		
		lvalue = file->Out_Link ();

		if (link_flag) {
			link = link_data.Get_Index (lvalue);

			if (link == 0) {
				return (Check_Message ("Turn Prohibition Out-Link %d was Not Found in the Link file", lvalue));
			}
			link_ptr = link_data [link];

			if (!Renumber ()) {
				link = lvalue;
			}
			turn_ptr->Out_Link (link);

			if (link_ptr->Bnode () == num) {
				turn_ptr->Out_Dir (1);
			} else if (link_ptr->Anode () == num) {
				turn_ptr->Out_Dir (0);
			} else {
				return (Check_Message ("Turn Prohibition Out-Link %d is Not Attached to Node %d", lvalue, node_num));
			}
		} else {
			turn_ptr->Out_Link (lvalue);
		}
	}
	str_ptr = file->Start ();

	if (*str_ptr == '\0') {
		turn_ptr->Start (0);
	} else {
		turn_ptr->Start (Round (time_step.Step (str_ptr)));
	}
	str_ptr = file->End ();

	if (*str_ptr == '\0') {
		turn_ptr->End (Round (MIDNIGHT));
	} else {
		turn_ptr->End (Round (time_step.Step (str_ptr)));
	}
	str_ptr = file->Use ();

	if (*str_ptr == '\0') {
		str_ptr = "ANY";
	}
	turn_ptr->Use (Use_Code (str_ptr));

	turn_ptr->Penalty (file->Penalty ());

	return (true);

mem_error:
	Error ("Insufficient Memory for Turn Prohibition Records");
	return (false);
}
예제 #4
0
bool Network_Service::Line_Processing (Db_File *fh)
{
	static int id, nstops, stop_num; 
	int zone;

	bool stop_flag;
	
	Line_Data *line_ptr = NULL;

	Line_File *file = (Line_File *) fh;

	stop_flag = Network_Data_Flag (TRANSIT_STOP);

	//---- process a header line ----

	if (!file->Nest ()) {	
		id = file->Route ();

		if (id == 0) return (false);

		if (id < 1) {
			return (Check_Message ("Transit Route ID %d is Out of Range", id));
		}
		line_ptr = line_data.New_Record (true);
		if (line_ptr == NULL) goto mem_error;

		line_ptr->Route (id);

		stop_num = 1;
		nstops = file->Stops ();

		if (nstops < 2) {
			return (Check_Message ("Number of Stops %d on Route %d is Out of Range", nstops, id));
		}
		if (!line_ptr->Stops (nstops)) {
			Error ("Insufficient Memory for %d Stops on Router %d", nstops, id);
		}
		line_ptr->Mode (Transit_Code (file->Mode ()));
		line_ptr->Null_Name ();
		line_ptr->Null_Notes ();

		if (Notes_Name_Flag ()) {
			char *str_ptr = file->Name ();

			if (str_ptr != NULL && *str_ptr != '\0') {
				line_ptr->Name (str_ptr);
			}
			str_ptr = file->Notes ();

			if (str_ptr != NULL && *str_ptr != '\0') {
				line_ptr->Notes (str_ptr);
			}
		}
	} else {
		line_ptr = line_data.New_Record (false);
		if (line_ptr == NULL) goto mem_error;

		//---- process a stop record ----

		int stop = file->Stop ();

		if (stop_flag) {
			int index = stop_data.Get_Index (stop);

			if (index == 0) {
				return (Check_Message ("Transit Stop %d on Route %d was Not Found in the Stop File", stop, id));
			}
			if (Renumber ()) stop = index;
		}
		line_ptr->Stop (stop_num, stop);

		zone = file->Zone ();

		if (Num_Fare_Zones () > 0 && (zone < 1 || zone > Num_Fare_Zones ())) {
			if (zone != 0 || !Zero_Fare_Zone ()) {
				Warning ("Transit Zone %d on Route %d is Out of Range (1..%d)", zone, id, Num_Fare_Zones ());
				if (zone == 0) Zero_Fare_Zone (true);
			}
		}
		line_ptr->Zone (stop_num, zone);
		line_ptr->Time_Flag (stop_num, file->Time_Flag ());

		if (stop_num == nstops) {
			return (true);
		} else {
			stop_num++;
			return (false);
		}
	}
	return (false);

mem_error:
	Error ("Insuffienct Memory for Transit Line Data");
	return (false);
}
예제 #5
0
void Parsing_Data(SEND_DATA *pRx)
/****************************************************************/
{
	int i = 0;
	int j = 0;
	int k = 0;
	FILE *fp = NULL;
	unsigned char *p;
	int filesize = 0;
	
	pthread_mutex_lock(&schedule_mutex);
	if((fp = fopen("SchedGHP.dat", "w")) == NULL)
	{
		if (fp != NULL)  
			fclose(fp);
			
		if ( g_dbgShow ) 
			printf("[ERROR] File Open with Option 'w'\n");		
			
		pthread_mutex_unlock(&schedule_mutex);
		return;
	}	
	
	if ( g_dbgShow ) 
		printf("'SchedGHP.dat' File Open with Option 'w'\n");		
	
	p = (unsigned char *)pRx;
	for ( i=0; i<pRx->length; i++)
		fwrite(&p[i], sizeof(unsigned char), 1, fp);
	
	fclose(fp);
	pthread_mutex_unlock(&schedule_mutex);

////////////////////////////////////////////////////////////////////
//Debug..
#if 1
	if((fp = fopen("SchedGHP.dat", "r")) == NULL)
	{
		if (fp != NULL)  
			fclose(fp);
		
		if ( g_dbgShow ) 
			printf("[ERROR] File Open with Option 'r'\n");		
		return;
	}	
	
	fseek(fp, 0L, SEEK_END); 
	filesize = ftell( fp );
	memset(&dbg_msg, 0x00, sizeof(dbg_msg));
	fseek(fp, 0L, SEEK_SET); 

	for ( i=0; i<filesize; i++)
		fread (&dbg_msg[i], 1, sizeof(unsigned char), fp);
	
	pRx = (SEND_DATA *)&dbg_msg;
	
	if(Check_Message(pRx) != SUCCESS)
		return;

	for ( i=0; i<200; i++ ) {
		if ( g_dbgShow ) {
			printf("Class = %d, %d, %d, %d\n", 
				pRx->classData[i].index,
				pRx->classData[i].classNum,	
				pRx->classData[i].startT,
				pRx->classData[i].stopT);	
		}
	}
	
	for ( i=0; i<MAX_GROUP_COUNT; i++ )
	{	
		if ( g_dbgShow ) {
			printf("pRx->group[%d].group = %d\n", i, pRx->group[i].group); 	
			printf("pRx->group[%d].method = %d\n", i, pRx->group[i].method); 	
			printf("pRx->group[%d].mode = %d\n", i, pRx->group[i].mode); 	
			printf("pRx->group[%d].limitT = %d\n", i, pRx->group[i].limitT); 	
		}
	
		for ( j=0; j<DAY_COUNT; j++ )
		{
			for ( k=0; k<MAX_SCHEDULE_COUNT; k++ )
			{
				if ( g_dbgShow ) {
					printf("pRx->group[%d].startT[%d][%d] = %d\n", i, j, k
						,pRx->group[i].startT[j][k]); 	
					printf("pRx->group[%d].stopT[%d][%d] = %d\n", i, j, k
						,pRx->group[i].stopT[j][k]); 	
				}
			}
		}	
	}

	for ( i=0; i<MAX_TIMETABLE_COUNT; i++ )
	{
		if ( g_dbgShow ) {
			printf("pRx->time.startT[%d] = %d\n", i ,pRx->time.startT[i]); 	
			printf("pRx->time.stopT[%d] = %d\n", i ,pRx->time.stopT[i]); 	
		}
	}	
#endif
}
예제 #6
0
int schedule_main(void)
/****************************************************************/
{
	GHP_SCHED_T *pSched;
	SEND_DATA *pData;

	int nClientFd = -1;
	int nClientLength = 0;
	struct sockaddr_in client_addr;	
	signal(SIGPIPE, SIG_IGN);								// Ignore broken_pipe signal.
	
	pSched = new_sched();
	if (pSched == NULL) {
		if ( g_dbgShow ) {
			fprintf( stdout, "Can't create SCHED Memory space.\n" );
			fflush(stdout);
		}
		//exit(1);
		system("killall duksan");
	}

	if ( shced_open(pSched) < 0 ) {
		exit(0);
	}	
		
	while (1) {
		sched_sleep( 0, 500 );
		// ready to accept socket
		nClientFd = accept(pSched->nFd, (struct sockaddr *)&client_addr, &nClientLength); 
		if ( g_dbgShow ) {
			fprintf( stdout, "[SCHED]  Socket Accept OK.\n");
			fflush( stdout );		
		}
		
		// check accept error
		if ( nClientFd == -1 ) {
			if ( g_dbgShow ) {
				fprintf( stdout, "+ [SCHED] Accept Error.\n");
				fflush( stdout );
			}

			// kill application3
			sched_sleep( 3, 0 );
			system("killall duksan");
		}
		

		for (;;) {
			// receive message
			sched_sleep(0, 100);
			pSched->nRecvByte = sched_recv_message(nClientFd, pSched->bRxBuf);

			// parsing message
            if( pSched->nRecvByte == 0 ) { 
				if ( g_dbgShow ) {
					fprintf( stdout, "+ [SCHED] Socket Close.\n");
					fflush( stdout );
				}

				// close socket
                close(nClientFd); 		
				
				// init variable
				memset( pSched->bTxBuf, 0x00, MAX_BUF_LENGTH );
				memset( pSched->bRxBuf, 0x00, MAX_BUF_LENGTH );
				memset( pSched->bPrevBuf, 0x00, MAX_BUF_LENGTH );
				pSched->nRecvByte = 0;
				pSched->nTempWp = 0;
				pSched->nIndexPrev = 0;
				
				// wait delay
				sched_sleep(3, 0);
                break;
            }
			else if ( pSched->nRecvByte > 0 )	{
				if ( g_dbgShow ) {
					fprintf( stdout, "+ [SCHED] Receive Byte %d\n", pSched->nRecvByte);
					fflush( stdout );
				}
				
				if (  pSched->nIndexPrev + pSched->nRecvByte >  MAX_BUF_LENGTH) {
				;
				}
				else {
					// copy message
					memcpy(&pSched->bPrevBuf[pSched->nIndexPrev], pSched->bRxBuf,  pSched->nRecvByte);
					pSched->nIndexPrev = pSched->nIndexPrev + pSched->nRecvByte;

					if ( g_dbgShow ) {
						fprintf( stdout, "+ [SCHED] Copy Byte %d\n", pSched->nIndexPrev);
						fflush( stdout );
					}
					
					// check message length
					pData = (SEND_DATA *)pSched->bPrevBuf;
					if(pSched->nIndexPrev == pData->length && Check_Message(pData)) {
						Parsing_Data(pData);
						SetDate(pData);
					}
				}
			}
		}
		continue;
	}
}
예제 #7
0
void Network_Service::Read_Schedule (void)
{
	int i, route, time, stop, last_route, first_stop, nrun, nstop, index, npoints, tim;
	int num_runs, max_runs, num;
	bool stop_flag;

	Line_Data *line_ptr = NULL;

	Schedule_File *file = (Schedule_File *) Network_Db_File (TRANSIT_SCHEDULE);

	if (!Network_Data_Flag (TRANSIT_ROUTE)) {
		Error (file_error, "Transit Route", file->File_ID ());
	}
	stop_flag = Network_Data_Flag (TRANSIT_STOP);

	if (Check_Data () || Renumber ()) { 
		if (!Network_File_Flag (TRANSIT_STOP) && Network_Option_Flag (TRANSIT_STOP)) {
			Error (file_error, "Transit Stop", file->File_ID ());
		}
	}

	Show_Message ("Reading %s -- Record", file->File_Type ());

	//---- scan for number of runs per route ----

	last_route = first_stop = nrun = nstop = npoints = num_runs = max_runs = 0;

	while (file->Read ()) {
		route = file->Route ();
		if (route == 0) continue;
			
		//---- check the stop data ----

		stop = file->Stop ();

		if (stop_flag) {
			index = stop_data.Get_Index (stop);

			if (index == 0) {
				Check_Message ("Stop %d on Route %d was Not Found in the Stop File", stop, route);
				continue;
			}
			if (Renumber ()) stop = index;
		}

		if (route != last_route) {
			if (last_route > 0) {
				if (!line_ptr->Runs (nrun)) goto mem_error;
				if (nrun > max_runs) max_runs = nrun;
				num_runs += nrun;
			}
			first_stop = stop;
			last_route = route;
			nrun = 1;
			nstop = 1;

			line_ptr = line_data.Get (route);

			if (line_ptr == NULL) {
				Check_Message ("Transit Route %d was Not Found in the Route File", route);
				continue;
			}
			stop = line_ptr->Stop (1);

			if (first_stop != stop) {
				if (Renumber ()) stop = stop_data [stop]->ID ();
				Check_Message ("Transit Route %d First Stop %d Schedule was Not Found", route, stop);
				continue;
			}
		} else {

			for (nstop++; nstop <= line_ptr->Stops (); nstop++) {
				if (stop == line_ptr->Stop (nstop)) break;
			}
			if (nstop > line_ptr->Stops ()) {
				nstop = 1;
				if (stop == first_stop) {
					nrun++;
				} else {
					Check_Message ("Stop %d was Not Found on Route %d", file->Stop (), route);
					continue;
				}
				nstop = i = 1;
			}
		}
	}
	if (last_route > 0) {
		if (!line_ptr->Runs (nrun)) goto mem_error;
		if (nrun > max_runs) max_runs = nrun;
		num_runs += nrun;
	}
	file->Rewind ();

	line_data.Num_Runs (num_runs);
	line_data.Max_Runs (max_runs);

	//---- store the transit schedule data ----

	Set_Progress ();
	last_route = first_stop = num = 0;
	nrun = nstop = 1;

	while (file->Read ()) {
		Show_Progress ();

		route = file->Route ();
		if (route == 0) continue;

		//---- check the stop id ----

		stop = file->Stop ();

		if (Renumber ()) {
			stop = stop_data.Get_Index (stop);
		}
		time = Round (file->Time ());

		//---- check for a new route ----

		if (route != last_route) {
			first_stop = stop;
			last_route = route;
			nrun = nstop = i = 1;

			line_ptr = line_data.Get (route);

		} else {

			//---- find the stop id on the route ----

			for (i=nstop; i <= line_ptr->Stops (); i++) {
				if (line_ptr->Stop (i) == stop) break;
			}
			if (i > line_ptr->Stops ()) {
				if (stop == first_stop) nrun++;
				nstop = i = 1;
			}
		}

		//---- add the time point ----

		line_ptr->Schedule (nrun, i, time);
		num++;

		//---- interpolate time points ----

		if (i > nstop) {
			if (nstop == 1) {
				Check_Message ("Stop %d is Not the First Stop for Route %d", file->Stop (), route);
				continue;
			}
			index = i;
			tim = line_ptr->Schedule (nrun, nstop-1);
			time = (time - tim) / (index - nstop + 1);

			for (i=nstop; i < index; i++) {
				tim += time;
				line_ptr->Schedule (nrun, i, tim);
				npoints++;
			}
			nstop = index;
		}
		nstop++;
	}
	End_Progress ();

	file->Close ();

	line_data.Schedule_Records (Progress_Count ());

	Print (2, "Number of %s Records = %d", file->File_Type (), Progress_Count ());

	if (num && num != Progress_Count ()) {
		Print (1, "Number of Transit Schedule Data Records = %d", num);
	}
	if (npoints > 0) {
		Print (1, "Number of Interpolated Time Points = %d", npoints);
	}
	if (num > 0) Network_Data_True (TRANSIT_SCHEDULE);
	return;

mem_error:
	Error ("Insufficient Memory for %d Runs on Route %d", nrun, last_route);
}
예제 #8
0
bool Network_Service::Phasing_Processing (Db_File *fh)
{
	bool node_flag, link_flag, timing_flag, detector_flag;
	int lvalue, index, node_num, num;
	char *svalue, *ptr;

	Link_Data *link_ptr = NULL;
	Phasing_Data *phasing_ptr = NULL;
	Timing_Data timing_rec;

	Phasing_File *file = (Phasing_File *) fh;

	node_flag = Network_Data_Flag (NODE);
	link_flag = Network_Data_Flag (LINK);
	timing_flag = Network_Data_Flag (TIMING_PLAN);
	detector_flag = Network_Data_Flag (DETECTOR);

	//---- reserve memory ----

	if (phasing_data.Max_Records () == 0) {
		if (!phasing_data.Max_Records (file->Num_Records ())) goto mem_error;
	}

	//---- read and save the data ----

	phasing_ptr = phasing_data.New_Record ();
	if (phasing_ptr == NULL) goto mem_error;
	phasing_ptr->Reset ();

	node_num = file->Node ();

	if (node_num == 0) return (false);

	//---- store the node ----

	if (node_flag) {
		num = node_data.Get_Index (node_num);

		if (num == 0) {
			return (Check_Message ("Phasing Plan Node %d was Not Found in the Node file", node_num));
		}
		if (!Renumber ()) {
			num = node_num;
		}
	} else {
		num = node_num;
	}
	phasing_ptr->Node (num);

	//---- check the timing plan ----

	if (timing_flag) {
		timing_rec.Timing (file->Timing ());
		timing_rec.Phase (file->Phase ());

		if (timing_data.Get_Index (&timing_rec) == 0) {
			return (Check_Message ("Timing Plan %d-%d was Not Found in the Timing Plan file", file->Timing (), file->Phase ()));
		}
	}
	phasing_ptr->Timing (file->Timing ());
	phasing_ptr->Phase (file->Phase ());

	//---- check/convert the in-link number ----
	
	lvalue = file->In_Link ();
	if (lvalue <= 0) goto link_error;

	if (link_flag) {
		index = link_data.Get_Index (lvalue);
		if (index == 0) goto link_error;

		link_ptr = link_data [index];

		if (!Renumber ()) {
			index = lvalue;
		}
		phasing_ptr->In_Link (index);
		
		if (link_ptr->Anode () == num) {
			phasing_ptr->In_Dir (1);
			index = link_ptr->BA_Dir ();
		} else if (link_ptr->Bnode () == num) {
			phasing_ptr->In_Dir (0);
			index = link_ptr->AB_Dir ();
		} else {
			index = 0;
		}
		if (index == 0) goto link_error;
	} else {
		phasing_ptr->In_Link (lvalue);
	}

	//---- check/convert the out-link number ----
	
	lvalue = file->Out_Link ();
	if (lvalue <= 0) goto link_error;

	if (link_flag) {
        index = link_data.Get_Index (lvalue);
		if (index == 0) goto link_error;

		link_ptr = link_data [index];

		if (!Renumber ()) {
			index = lvalue;
		}
		phasing_ptr->Out_Link (index);

		if (link_ptr->Bnode () == num) {
			phasing_ptr->Out_Dir (1);
			index = link_ptr->BA_Dir ();
        } else if (link_ptr->Anode () == num) {
			phasing_ptr->Out_Dir (0);
			index = link_ptr->AB_Dir ();
		} else {
			index = 0;
		}
		if (index == 0) goto link_error;
	} else {
		phasing_ptr->Out_Link (lvalue);
	}

	//---- convert the protection code ----

	phasing_ptr->Protection (Protection_Code (file->Protection ()));

	//---- process the detectors ----

	svalue = file->Detectors ();

	if (*svalue == '\0' || atoi (svalue) == 0) {
		phasing_ptr->Num_Detectors (0);
		return (true);
	}
	num = 1;
	ptr = svalue;

	while ((ptr = strchr (ptr, '/')) != NULL) {
		num++;
		ptr++;
	}
	if (!phasing_ptr->Num_Detectors (num)) {
		Error ("Insufficient Memory for %d Detectors on Phasing Plan %d", num, Progress_Count ());
	}
	num = 0;

	while (svalue != NULL) {
		ptr = strchr (svalue, '/');

		if (ptr != NULL) {
			*ptr++ = '\0';
		}
		lvalue = atoi (svalue);

		if (lvalue <= 0) break;
		num++;

		if (detector_flag) {
			index = detector_data.Get_Index (lvalue);

			if (index == 0) {
				return (Check_Message ("Phasing Plan Detector %d was Not Found in the Detector file", lvalue));
			}
			if (!Renumber ()) {
				index = lvalue;
			}
			phasing_ptr->Detector (num, index);
		} else {
			phasing_ptr->Detector (num, lvalue);
		}
		svalue = ptr;
	}
	if (phasing_ptr->Num_Detectors () != num) {
		return (Check_Message ("Phasing Plan %d Detector Numbers are Not Valid", Progress_Count ()));
	}
	return (true);

link_error:
	return (Check_Message ("Phasing Plan Node %d Link %d was Not Found", node_num, lvalue));

mem_error:
	Error ("Insufficient Memory for Phasing Plan Data");
	return (false);
}