imiaDPd (780151), страница 3
Текст из файла (страница 3)
get_time_pc_counted(); display_time_pc_counted();
/* */ /* Not condition */
logic_0(); all_bit_0(); /* <=### CHANGE ### */
Counter_commands++; display_counter_commands(NOT_DELETE);
file_control();
end_programm(); /* -> EXIT_SUCCESS */
/* Hand Time - Hand Command */
case '1': draft(); /* <=### CHANGE ### */
display_regime_work();
display_next_entrance();
get_time_ordered(); display_time_ordered();
/* */ /* Condition 1 */
while(1)
{
if(Time_pc_counted>=Time_ordered) break;
get_time_pc_counted(); display_time_pc_counted();
}
/* */
logic_0(); all_bit_0(); /* <=### CHANGE ### */
Counter_commands++; display_counter_commands(NOT_DELETE);
file_control();
end_programm(); /* -> EXIT_SUCCESS */
/* Automatic Commands'file
with Commands. Hand Interval constant */
case '2': draft();
while(1)
{ if(feof(Fp1))
{
end_programm(); /* -> EXIT_SUCCESS */
}
display_regime_work();
display_interval_ordered(NOT_DELETE);
file_order_var2(); /* Input: X1, X2, X3, */
display_next_entrance();
/* */ /* Condition 2 */
for
(Interval_counted=0; Interval_counted<Interval_ordered; Interval_counted++)
{
get_time_pc_counted(); display_time_pc_counted();
display_counter_commands(NOT_DELETE);
display_interval_counted(NOT_DELETE);
sleep(1);
display_interval_counted(DELETE);
display_counter_commands(DELETE);
get_time_pc_counted(); display_time_pc_counted();
}
/* */
logic_0(); all_bit_0(); /* <=### CHANGE ### */
Counter_commands++;
file_control();
}
/* Automatic Commands'file
with Commands and Intervals (Intervals variable) */
case '3': draft();
while(1)
{ if(feof(Fp1))
{
end_programm(); /* -> EXIT_SUCCESS */
}
display_regime_work();
get_time_pc_counted();
file_order_var3(); /* Input: file_interval, X1, X2, X3, */
display_next_entrance();
/* */ /* Condition 3 */
for
(Interval_counted=0; Interval_counted<Interval_ordered; Interval_counted++)
{
display_interval_ordered(NOT_DELETE);
get_time_pc_counted(); display_time_pc_counted();
display_counter_commands(NOT_DELETE);
display_interval_counted(NOT_DELETE);
sleep(1);
display_interval_counted(DELETE);
display_counter_commands(DELETE);
get_time_pc_counted(); display_time_pc_counted();
display_interval_ordered(DELETE);
}
/* */
logic_0(); all_bit_0(); /* <=### CHANGE ### */
Counter_commands++;
file_control();
}
/* Automatic Commands'file
with times and commands */
case '4': draft();
while(1)
{ if(feof(Fp1))
{
end_programm(); /* -> EXIT_SUCCESS */
}
display_regime_work();
file_order_var4(); /* Input: Ho, Mo, So, X1, X2, X3, */
display_next_entrance();
display_counter_commands(NOT_DELETE);
get_time_ordered(); display_time_ordered(NOT_DELETE);
/* */ /* Condition 4 */
while(1)
{
if(Time_pc_counted>=Time_ordered) break;
get_time_pc_counted(); display_time_pc_counted();
delay(200);
}
display_counter_commands(DELETE);
get_time_ordered(); display_time_ordered(DELETE);
/* */
logic_0(); all_bit_0(); /* <=### CHANGE ### */
Counter_commands++;
file_control();
}
/* Automatic Random commands. Hand Interval constant */
case '5': draft();
while(bioskey(1)==0)
{
display_regime_work();
get_time_pc_counted();
/* Input Random commands */
X1=random(2);
X2=random(2);
X3=random(2);
Interval_ordered=random(Interval_hand_max);
display_next_entrance();
/* */ /* Condition 5 */
for
(Interval_counted=0; Interval_counted<Interval_ordered; Interval_counted++)
{
display_interval_ordered(NOT_DELETE);
get_time_pc_counted(); display_time_pc_counted();
display_counter_commands(NOT_DELETE);
display_interval_counted(NOT_DELETE);
sleep(1);
display_interval_counted(DELETE);
display_counter_commands(DELETE);
get_time_pc_counted(); display_time_pc_counted();
display_interval_ordered(DELETE);
}
/* */
logic_0(); all_bit_0(); /* <=### CHANGE ### */
Counter_commands++;
file_control();
}
bioskey(0);
end_programm(); /* -> EXIT_SUCCESS */
}
/* */
return 0;
}
/*############################################## SUB_PROGRAMMS */
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int graph_regime()
{
/*----------------------------- Variables */
int gdriver=DETECT,gmode,errorcode;
/*----------------------------- Graph. initialisation */
initgraph(&gdriver,&gmode,"");
errorcode=graphresult();
if(errorcode != grOk)
{
gotoxy(1,24);
textattr(LIGHTRED+(BLACK<<4));
cprintf("GRAPHICS ERROR: %s\n",grapherrormsg(errorcode));
STOP;
exit(EXIT_SUCCESS);
}
Maxx=getmaxx();
Maxy=getmaxy();
/*----------------------------- Installuserfont */
Font[0]=installuserfont("bold");
Font[1]=installuserfont("euro"); /* Cyr */
Font[2]=installuserfont("lcom"); /* Cyr */
Font[3]=installuserfont("litt");
Font[4]=installuserfont("sans");
Font[5]=installuserfont("scri"); /* Cyr manuscript */
Font[6]=installuserfont("simp"); /* Cyr */
Font[7]=installuserfont("tscr"); /* Cyr manuscript */
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
text_regime()
{
closegraph();
restorecrtmode();
textbackground(BLACK);
textcolor(WHITE);
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int title_sheet() /* <=### CHANGE ### */
/* Title */
{
/*----------------------------- Variables */
int x,y; /* Set cursor */
int kx; /* Scale of the title sheet */
int ky;
/*----------------------------- Graph. initialisation */
graph_regime();
/*----------------------------- Scale of the title sheet */
kx=Maxx/COL;
ky=Maxy/ROW;
/*----------------------------- Title 1 */
setcolor(YELLOW);
setbkcolor(BLACK);
settextstyle(SMALL_FONT,HORIZ_DIR,5);
settextjustify(CENTER_TEXT,CENTER_TEXT);
x=Maxx/2;
y=1*ky;
outtextxy(x,y,title_1); /* DP */
/*----------------------------- Frame */
setcolor(WHITE);
setlinestyle(SOLID_LINE,0,THICK_WIDTH);
x=1*kx;
y=2*ky;
rectangle(x,y,Maxx,Maxy);
setfillstyle(SOLID_FILL,BLUE);
x=Maxx/2;
y=Maxy/2;
floodfill(x,y,WHITE);
/*----------------------------- Text */
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(YELLOW);
settextstyle(SMALL_FONT,HORIZ_DIR,7);
x=Maxx/2;
y=19*ky;
outtextxy(x,y,title_4); /* School, Class, Tel. ... */
settextstyle(SMALL_FONT,HORIZ_DIR,5);
x=Maxx/2;
y=4*ky;
outtextxy(x,y,title_7); /* Department Astronomy */
settextstyle(SMALL_FONT,HORIZ_DIR,5);
setcolor(LIGHTGRAY);
x=Maxx/2;
y=21*ky;
outtextxy(x,y,title_6); /* Group... */
x=Maxx/2;
y=22*ky;
outtextxy(x,y,title_5); /* Discipline... */
x=Maxx/2;
y=23*ky;
outtextxy(x,y,title_8); /* Teacher... */
x=Maxx/2;
y=24*ky;
outtextxy(x,y,title_9); /* Year... */
settextstyle(TRIPLEX_FONT,HORIZ_DIR,0);
setusercharsize(1,1,3,2);
settextjustify(CENTER_TEXT,CENTER_TEXT);
x=Maxx/2;
y=11*ky;
setcolor(BLACK);
outtextxy(x,y,title_2); /* IMITATOR... */
setcolor(WHITE);
outtextxy(x+4,y+4,title_2);
setcolor(WHITE);
settextstyle(SMALL_FONT,HORIZ_DIR,7);
settextjustify(CENTER_TEXT,CENTER_TEXT);
x=Maxx/2;
y=14*ky;
outtextxy
(x,y,"(Imitator automatic of the schemes electronics)");
setcolor(YELLOW);
settextstyle(SMALL_FONT,HORIZ_DIR,7);
settextjustify(CENTER_TEXT,CENTER_TEXT);
x=Maxx/2;
y=18*ky;
outtextxy(x,y,title_3); /* Pupil... */
/*----------------------------- Happy work */
settextstyle(SMALL_FONT,HORIZ_DIR,7);
settextjustify(CENTER_TEXT,CENTER_TEXT);
x=Maxx/2;
y=16*(Maxy/ROW);
while(bioskey(1)==0)
{
setcolor(random(16));
outtextxy(x,y," HAPPY WORK ");
}
STOP_DRAFT;
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
choice_regime_work() /* <=### CHANGE ### */
{
text_regime();
/*----------------------------- Variants */
cputs
("\n Regimes of the work:\n\r");
cputs("\n---------------\n\r");
cputs
("\n 0 - Hand Command. \n\r");
cputs
("\n 1 - Hand Time - Hand Command.\n\r");
cputs
("\n 2 - Automatic Commands'file \
with Commands. Hand Interval constant.\n\r");
cputs
("\n 3 - Automatic Commands'file \
with Commands and Intervals (Intervals variable)\n\r");
cputs
("\n 4 - Automatic Commands'file \
with Times and Commands.\n\r");
cputs
("\n 5 - Automatic Random Commands, Random Intervals, Intrval_hand_max.\n\r");
cputs("\n---------------\n\r");
/*----------------------------- Choice of the variant */
do
{
BELL;
cputs("\n\r Regime of the Work (0 - 5), Exit (E or e) --> ");
Regime_work=getche();
/*----------------------------- Switch of the variants */
switch(Regime_work)
{
/* Hand Command: */
case '0': hand_order_var0(); /* Input: X1, X2, X3 */
openfile_exit();
return Regime_work;
/* Hand Time - Hand Command */
case '1': hand_order_var1(); /* Input: H, M, S, X1, X2, X3 */
openfile_exit();
return Regime_work;
/* Automatic Commands'file
with Commands. Hand Interval constant */
case '2': hand_order_var2(); /* Input: Hand_interval */
openfile_entry();
openfile_exit();
return Regime_work;
/* Automatic Commands'file
with Commands and Intervals (Intervals variable) */
case '3': openfile_entry();
openfile_exit();
return Regime_work;
/* Automatic Commands'file
with times and commands */
case '4': openfile_entry();
openfile_exit();
return Regime_work;
/* Automatic Random commands. Hand Interval constant */
case '5': hand_order_var5(); /* Input: Hand_interval */
openfile_exit();
return Regime_work ;
case 'E':
case 'e': exit(EXIT_SUCCESS);
}
} while(Regime_work!='0' &&
Regime_work!='1' &&
Regime_work!='2' &&
Regime_work!='3' &&
Regime_work!='4' &&
Regime_work!='5' &&
Regime_work!='E' &&
Regime_work!='e'
);
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int draft() /* <=### CHANGE ### */
{
/*----------------------------- Variables */
int x,y,x1,y1,x2,y2; /* Set cursor */
int kx; /* Scale of the draft */
int ky;
/*----------------------------- Scale of the draft */
kx=Maxx/COL_D;
ky=Maxy/ROW_D;
/*----------------------------- Frame */
setcolor(LIGHTGRAY);
setlinestyle(SOLID_LINE,0,NORM_WIDTH);
rectangle(0*kx,0*ky,50*kx,36*ky);
setfillstyle(SOLID_FILL,BLACK);
x=Maxx/2;
y=Maxy/2;
floodfill(x,y,LIGHTGRAY);
/*----------------------------- Title 1 */
settextstyle(SMALL_FONT,HORIZ_DIR,7);
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(YELLOW);
outtextxy(25*kx,1*ky,title_2); /* Device */
/*----------------------------- Display Counter and Interval */
settextstyle(SMALL_FONT,HORIZ_DIR,6);
settextjustify(LEFT_TEXT,CENTER_TEXT);
setcolor(LIGHTGRAY);
outtextxy( 2*kx,3*ky,"Interval_ord.(s)>");
outtextxy( 2*kx,4*ky,"Interval_cnt.(s)>");















