imiaDPd (780151), страница 5
Текст из файла (страница 5)
if(So<=60) break;
else continue;
}
/* */
Time_ordered=(long int)(Ho*3600+Mo*60+So);
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int hand_order_var2() /* <=### CHANGE ### */
{
BELL;
cputs("\n\r Interval (sec.) --> ");
cscanf("%ld",&Interval_ordered);
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int hand_order_var5()
{
BELL;
cputs("\n\r Interval_hand_max ( <= 65535 sec.) --> ");
cscanf("%ld",&Interval_hand_max);
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int openfile_entry() /* <=### CHANGE ### */
{
/*----------------------------- Opening entry file */
BELL;
cputs("\n\r file_name_entry --> ");
cscanf("%s",&Fname_entry);
if((Fp1=fopen(Fname_entry,"r"))==NULL)
{
ALERT_SIGNAL;
perror("file_name_entry"); STOP;
exit(EXIT_FAILURE);
}
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int openfile_exit()
{
/*----------------------------- Opening exit file */
strcpy(Fname_exit,"control.c");
/* */
if((Fp2=fopen(Fname_exit,"w"))==NULL)
{
ALERT_SIGNAL;
perror("Fname_exit"); STOP;
exit(EXIT_FAILURE);
}
/* */
cputs("\n\r File_name_exit is: control.c.");
textattr(YELLOW+(BLACK<<4)+BLINK);
cputs(" Please wait 5 sec.\n\r");
sleep(5);
textattr(WHITE+(BLACK<<4));
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int file_order_var2() /* <=### CHANGE ### */
{
/*-------------- Reading of the order */
fscanf
(Fp1,"\n%2d%2d%2d\n",
&X1,&X2,&X3);
/* */
if(X1>=2 || X2>=2 || X3>=2)
{
fprintf
(Fp2,"\nEntry error\nX1=%1d X2=%1d X3=%1d\n",
X1,X2,X3);
restorecrtmode(); ALERT_SIGNAL;
cprintf
("\n\rEntry error\nX1=%1d X2=%1d X3=%1d",
X1,X2,X3); STOP;
exit(EXIT_FAILURE);
}
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int file_order_var3() /* <=### CHANGE ### */
{
/*-------------- Reading of the order */
fscanf
(Fp1,"\n%10d%2d%2d%2d\n",
&Interval_ordered,&X1,&X2,&X3);
/* */
if(X1>=2 || X2>=2 || X3>=2)
{
fprintf
(Fp2,"\nEntry error\nI=%10d X1=%1d X2=%1d X3=%1d\n",
Interval_ordered,X1,X2,X3);
restorecrtmode(); ALERT_SIGNAL;
cprintf
("\n\rEntry error\nI=%10d X1=%1d X2=%1d X3=%1d",
Interval_ordered,X1,X2,X3);
STOP;
exit(EXIT_FAILURE);
}
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int file_order_var4() /* <=### CHANGE ### */
{
/*-------------- Reading of the order */
fscanf
(Fp1,"\n%3d%3d%3d%2d%2d%2d\n",
&Ho,&Mo,&So,&X1,&X2,&X3);
/* */
if(X1>=2 || X2>=2 || X3>=2 || H>23 || M>59 || S>59)
{
fprintf
(Fp2,"\nEntry error\nH=%3d M=%2d S=%2d X1=%1d X2=%1d X3=%1d\n",
&Ho,&Mo,&So,X1,X2,X3);
restorecrtmode(); ALERT_SIGNAL;
cprintf
("\n\rEntry error\nH=%2d M=%2d S=%2d X1=%1d X2=%1d X3=%1d\n",
&Ho,&Mo,&So,X1,X2,X3);
STOP;
exit(EXIT_FAILURE);
}
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
get_time_ordered()
{
/*----------------------------- Variables */
static time_ordered_preceding=0;
/* */
Time_ordered=(int long)(Ho*3600+Mo*60+So);
/* */
if(time_ordered_preceding!=Time_ordered)
{time_ordered_preceding=Time_ordered;
Flag_time_ordered_print=1;}
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int get_time_pc_counted()
{
/*----------------------------- Variables */
static long time_pc_counted_preceding=0;
/* */
gettime(&Time_now);
/* */
H=(int)Time_now.ti_hour;
M=(int)Time_now.ti_min;
S=(int)Time_now.ti_sec;
Time_pc_counted=(int long)(H*3600+M*60+S);
/* */
if(time_pc_counted_preceding!=Time_pc_counted)
{time_pc_counted_preceding=Time_pc_counted;
Flag_time_pc_counted_print=1;}
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/ /* For exit (control) file */
int get_date_pc_counted()
{
/*----------------------------- Variables*/
char *month[]={"-",
"Jan","Feb","Mar",
"Apr","May","Jun",
"Jul","Aug","Sep",
"Oct","Nov","Dec"};
char str_day[4];
char str_mon[5];
char str_year[6];
char str_date_pc_counted[30];
/* */
getdate(&Date_now);
/*----------------------------- Display Date_pc */
itoa(Date_now.da_day, str_day, 10);
strcpy(str_mon, month[(int)Date_now.da_mon]);
itoa(Date_now.da_year,str_year,10);
/* */
strcpy(str_date_pc_counted,str_day);
strcat(str_date_pc_counted," ");
strcat(str_date_pc_counted,str_mon);
strcat(str_date_pc_counted," ");
strcat(str_date_pc_counted,str_year);
/* */
strcpy(Str_date_pc_counted,str_date_pc_counted);
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int display_time_pc_counted()
{
/*----------------------------- Variables */
char str_hour[4];
char str_min[4];
char str_sec[4];
static char str_time_pc_counted_preceding[20];
char str_time_pc_counted[20];
int kx; /* Scale of the draft */
int ky;
/* */
kx=Maxx/COL_D;
ky=Maxy/ROW_D;
/*----------------------------- Display Time_pc */
itoa(Time_now.ti_hour,str_hour,10);
itoa(Time_now.ti_min, str_min, 10);
itoa(Time_now.ti_sec, str_sec, 10);
/* */
strcpy(str_time_pc_counted,str_hour);
strcat(str_time_pc_counted,"H-");
strcat(str_time_pc_counted,str_min);
strcat(str_time_pc_counted,"M-");
strcat(str_time_pc_counted,str_sec);
strcat(str_time_pc_counted,"S");
/* */
settextstyle(SMALL_FONT,HORIZ_DIR,5);
settextjustify(LEFT_TEXT,CENTER_TEXT);
if(Flag_time_pc_counted_print)
{
setcolor(BLACK);
outtextxy(41*kx,4*ky,str_time_pc_counted_preceding);
setcolor(WHITE);
outtextxy(41*kx,4*ky,str_time_pc_counted);
str_time_pc_counted_preceding[0]='\0';
strcpy(str_time_pc_counted_preceding,str_time_pc_counted);
}
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int display_date_pc_counted(int f)
{
/*----------------------------- Variables*/
char *month[]={"-",
"Jan","Feb","Mar",
"Apr","May","Jun",
"Jul","Aug","Sep",
"Oct","Nov","Dec"};
char str_day[4];
char str_mon[4];
char str_year[5];
char str_date_pc[20];
int kx; /* Scale of the draft */
int ky;
/* */
kx=Maxx/COL_D;
ky=Maxy/ROW_D;
/*----------------------------- Display Date_pc */
itoa(Date_now.da_day, str_day, 10);
strcpy(str_mon, month[Date_now.da_mon]);
itoa(Date_now.da_year,str_year,10);
/* */
strcpy(str_date_pc,str_day);
strcat(str_date_pc," ");
strcat(str_date_pc,str_mon);
strcat(str_date_pc," ");
strcat(str_date_pc,str_year);
strcat(str_date_pc," ");
/* */
settextstyle(SMALL_FONT,HORIZ_DIR,5);
settextjustify(LEFT_TEXT,CENTER_TEXT);
setcolor(WHITE);
outtextxy(41*kx,4*ky,str_date_pc); /* Date_pc>...*/
/* */
if(!f)
{
setcolor(BLACK);
outtextxy(41*kx,4*ky,str_date_pc); /* Date_pc>...*/
}
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int display_time_ordered()
{
/*----------------------------- Variables */
char str_Ho[4];
char str_Mo[4];
char str_So[4];
static char str_time_ordered_preceding[20];
char str_time_ordered[20];
int kx; /* Scale of the draft */
int ky;
/* */
kx=Maxx/COL_D;
ky=Maxy/ROW_D;
/*----------------------------- Display Time_order */
itoa(Ho,str_Ho,10);
itoa(Mo,str_Mo,10);
itoa(So,str_So,10);
/* */
strcpy(str_time_ordered,str_Ho);
strcat(str_time_ordered,"H ");
strcat(str_time_ordered,str_Mo);
strcat(str_time_ordered,"M ");
strcat(str_time_ordered,str_So);
strcat(str_time_ordered,"S ");
/* */
settextstyle(SMALL_FONT,HORIZ_DIR,5);
settextjustify(LEFT_TEXT,CENTER_TEXT);
if(Flag_time_ordered_print)
{
setcolor(BLACK);
outtextxy(41*kx,3*ky,str_time_ordered_preceding);
setcolor(WHITE);
outtextxy(41*kx,3*ky,str_time_ordered);
str_time_ordered_preceding[0]='\0';
strcpy(str_time_ordered_preceding,str_time_ordered);
}
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int display_next_entrance() /* <=### CHANGE ### */
{
/*------------- Variables */
static unsigned x1,x2,x3;
int kx; /* Scale of the draft */
int ky;
/* */
kx=Maxx/COL_D;
ky=Maxy/ROW_D;
/*----------------------------- Erase preceding entranse */
Flag_bit=0;
bit(3*kx,6*ky,x1); /* bit X1 */
bit(3*kx,7*ky,x2); /* bit X2 */
bit(3*kx,8*ky,x3); /* bit X3 */
/*----------------------------- Display next entrance now */
Flag_bit=1;
bit(3*kx,6*ky,X1); /* bit X1 */
bit(3*kx,7*ky,X2); /* bit X2 */
bit(3*kx,8*ky,X3); /* bit X3 */
/*------------- Keep in mind */
x1=X1; x2=X2; x3=X3;
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int display_interval_counted(int f)
{
/*----------------------------- Variables */
char str_interval_counted[12];
int kx; /* Scale of the draft */
int ky;
/* */
kx=Maxx/COL_D;
ky=Maxy/ROW_D;
/*----------------------------- Display Interval_count */
itoa(Interval_counted,str_interval_counted,10);
/* */
settextstyle(SMALL_FONT,HORIZ_DIR,5);
settextjustify(LEFT_TEXT,CENTER_TEXT);
setcolor(WHITE);
outtextxy(15*kx,4*ky,str_interval_counted);
/* */
if(!f)
{
setcolor(BLACK);
outtextxy(15*kx,4*ky,str_interval_counted);
}
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int display_interval_ordered(int f)
{
/*----------------------------- Variables */
char str_interval_ordered[12];
int kx; /* Scale of the draft */
int ky;
/* */
kx=Maxx/COL_D;
ky=Maxy/ROW_D;
/*----------------------------- Display Interval_hand */
itoa(Interval_ordered,str_interval_ordered,10);
/* */
settextstyle(SMALL_FONT,HORIZ_DIR,5);
settextjustify(LEFT_TEXT,CENTER_TEXT);
setcolor(WHITE);
outtextxy(15*kx,3*ky,str_interval_ordered);
/* */
if(!f)
{
setcolor(BLACK);
outtextxy(15*kx,3*ky,str_interval_ordered);
}
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int display_counter_commands(int f)
{
/*----------------------------- Variables */
char str_counter_commands[12];
int kx; /* Scale of the draft */
int ky;
/* */
kx=Maxx/COL_D;
ky=Maxy/ROW_D;
/*----------------------------- Display Interval_hand */
itoa(Counter_commands,str_counter_commands,10);
/* */
settextstyle(SMALL_FONT,HORIZ_DIR,5);
settextjustify(LEFT_TEXT,CENTER_TEXT);
setcolor(WHITE);
outtextxy(27*kx,3*ky,str_counter_commands);
/* */
if(!f)















