История развития пистолетов-пулеметов: Предпосылкой для возникновения пистолетов-пулеметов послужила давняя тенденция тяготения винтовок...
Индивидуальные и групповые автопоилки: для животных. Схемы и конструкции...
Топ:
Методика измерений сопротивления растеканию тока анодного заземления: Анодный заземлитель (анод) – проводник, погруженный в электролитическую среду (грунт, раствор электролита) и подключенный к положительному...
Комплексной системы оценки состояния охраны труда на производственном объекте (КСОТ-П): Цели и задачи Комплексной системы оценки состояния охраны труда и определению факторов рисков по охране труда...
Особенности труда и отдыха в условиях низких температур: К работам при низких температурах на открытом воздухе и в не отапливаемых помещениях допускаются лица не моложе 18 лет, прошедшие...
Интересное:
Распространение рака на другие отдаленные от желудка органы: Характерных симптомов рака желудка не существует. Выраженные симптомы появляются, когда опухоль...
Мероприятия для защиты от морозного пучения грунтов: Инженерная защита от морозного (криогенного) пучения грунтов необходима для легких малоэтажных зданий и других сооружений...
Принципы управления денежными потоками: одним из методов контроля за состоянием денежной наличности является...
Дисциплины:
2019-12-26 | 180 |
5.00
из
|
Заказать работу |
[1] /*########################################################*/
[2] /*
[3] Copyright (C) 2008 by A.E.Stefanovich tel. 236-2729, 268-3916
[4] Moscow State University of the Instrumentation and Informatics
[5] MGUPI
[6] Chair Information Maintenance of Systems Robototechnical and Mechatronic
[7] IS 5
[8] */
[9] /*########################################################*/
[10] /*
[11] File: SCONT.c
[12] System of control automatic modernize with BLACK CASE and System Devises.
[13] */
[14] /*####################################### PROGRAMME */
[15] /*============== Includes of TURBOC.3_0 */
[16] #include <c:\TURBOC.3_0\include\stdio.h>
[17] #include <c:\TURBOC.3_0\include\conio.h>
[18] #include <c:\TURBOC.3_0\include\stdlib.h>
[19] #include <c:\TURBOC.3_0\include\graphics.h>
[20] #include <c:\TURBOC.3_0\include\dos.h>
[21] #include <c:\TURBOC.3_0\include\time.h>
[22] #include <c:\TURBOC.3_0\include\math.h>
[23] /*============== Includes of System */
[24] #include <c:\TURBOC.3_0\work\SYS_CNST.h> /* Global const */
[25] #include <c:\TURBOC.3_0\work\SYS_VAR.h> /* Global var */
[26] #include <c:\TURBOC.3_0\work\SYS_MUS.h> /* Music */
[27] #include <c:\TURBOC.3_0\work\SYS_PRIM.h> /* Primitives */
[28] /*============== Includes of System Devises. CONNECTION */
[29] /* #include <c:\TURBOC.3_0\work\SYSDV0.h> */ /* OFF */
[30] /* #include <c:\TURBOC.3_0\work\SYSDV1.h> */ /* OFF */
[31] /* #include <c:\TURBOC.3_0\work\SYSDV2.h> */ /* OFF */
[32] /* #include <c:\TURBOC.3_0\work\SYSDV3.h> */ /* OFF */
[33] #include <c:\TURBOC.3_0\work\SYSDV4.h> /* ON */
[34] #include <c:\TURBOC.3_0\work\SYSDV5.h> /* ON */
[35] #include <c:\TURBOC.3_0\work\SYSDV6.h> /* ON */
[36] #include <c:\TURBOC.3_0\work\SYSDV7.h> /* ON */
[37] /*============== Includes of Models. CONNECTION */
[38] /* Device 0: MUSIC CENTER */
[39] #include <c:\TURBOC.3_0\work\MODDV0.h> /* ON */
[40] /* Device 1: LVD_1 */
[41] #include <c:\TURBOC.3_0\work\MODDV1.h> /* ON */
[42] /* Device 2: LVD_2 */
[43] #include <c:\TURBOC.3_0\work\MODDV2.h> /* ON */
[44] /* Device 3: AUTOPILOT */
[45] #include <c:\TURBOC.3_0\work\MODDV3.h> /* ON */
[46] /* Device 4: */
[47]
[48] /* Device 5: */
[49]
[50] /* Device 6: */
[51]
[52] /* Device 7: */
[53]
[54] /*============== Includes of User. CONNECTON */
[55] /* Device 0: */
[56]
[57] /* Device 1: */
[58]
[59] /* Device 2: */
[60]
[61] /* Device 3: */
[62]
[63] /* Device 4: */
[64]
[65] /* Device 5: */
[66]
[67] /* Device 6: */
[68]
[69] /* Device 7: */
[70]
[71] /*============== Declarations */
[72] /*-------------- Common subroutines */
[73] int Graph_regime();
[74] int Text_regime();
[75] int Title_sheet();
[76] int Start_program(int dx,int dy);
[77] int End_program();
[78] /*-------------- Address bus subroutines */
[79] int Addbus3bit(int kx,int ky);
[80] int Logic_addbus3bit(int kx,int ky);
[81] /*-------------- Input subroutines */
[82] int Choice_regime_work();
[83] int Openfile_entry();
[84] int Openfile_exit(); /* NOT USE */
[85] int Hand_order_var1();
[86] int Hand_order_var2();
[87] int Hand_order_var3();
[88] int File_order_var3();
[89] int File_order_var4();
[90] int File_order_var5();
[91] int Get_time_pc_counted();
[92] int Get_date_pc_counted();
[93] int Get_number_commands();
[94] /*-------------- String subroutines */
[95] int String_int_ordered();
[96] int String_int_counted();
[97] int String_time_pc_ordered();
[98] int String_time_pc_counted();
[99] /*-------------- Output subroutines */
[100] /* Right windows for output information */
[101] int Wind_right_ini();
[102] int File_inp();
[103] int File_out(); /* NOT USE */
[104] int Regime();
[105] int Com_num();
[106] int Com_cnt();
[107] int Add_ord();
[108] int Com_ord();
[109] int Int_ord();
[110] int Int_cnt();
[111] int Time_ord();
[112] int Time_pc();
[113] int Error_sys();
[114] int Reserve();
[115] /* Left windows for output information */
[116] int Wind_left_ini();
[117] int Title_sys();
[118] int Address_bus(); /* Window for Address_bas */
[119] int Mes_exec(); /* Window for messages */
[120] int Device_bus(); /* Window for Device_bus */
[121] /*-------------- Subroutines for creation of windows */
[122] /* Window for output titles */
[123] int Wind_0
[124] (int col_rect,
[125] int *lx,int *ly,int *rx,int *ry
[126] /* Abs. co-ord. window for output */);
[127]
[128] /* Window for output DATA */
[129] int Wind_out
[130] (int lx,int ly,int rx,int ry,int bk_val,int col_val,char *str);
[131]
[132] /* Window for output DATA with text (1 floor) */
[133] int Wind_1
[134] (char *title,
[135] int col_rect,
[136] int bk_txt,int col_txt,
[137] int *lx,int *ly,int *rx,int *ry
[138] /* Abs. co-ord. window for output */);
[139]
[140] /* Window for output DATA with text (2 floor) */
[141] int Wind_2
[142] (char *title,
[143] int col_rect,
[144] int bk_txt,int col_txt,
[145] int *lx,int *ly,int *rx,int *ry
[146] /* Abs. co-ord. window for output */);
[147]
[148] /* Window for output drafts and picturs */
[149] int Wind_D
[150] (float compression_y,
[151] int col, int row,
[152] int col_rect,
[153] int *kx,int *ky,
[154] int *lx,int *ly,int *rx,int *ry
[155] /* Abs. co-ord. window for output */);
[156] /*-------------- Subroutine for display of the logic */
[157] int Bit
[158] (int x,int y,unsigned char bit); /* 0 or 1 */
[159] /*============== Global constants see include file SYSCON */
[160] /*============== Global variables see include file SYSVAR */
[161] /*============== Primitives see include file SYSPRIM */
[162] /*============== Music see include file SYSMUS */
[163] /*############################################# MAIN */
[164] void main()
[165] { /*------------------- Beguin Main() */
[166] Title_sheet();
[167] Flag_ini=NOT_INI;
[168]
[169] /*IIIIIIIIIIIIIIII USER'WORK (Input DATA) IIIIIIIIIIIIIIII*/
[170] Choice_regime_work(); /* User: Input Regime */
[171] /*============================= HAND REGIMES 0-2 */
[172] /* ######## REGIME 0: EXIT.
[173] User: Not work */
[174] if(Regime_work[0]=='0') exit(EXIT_SUCCESS);
[175] /* ######## REGIME 1: HAND COMMAND.
[176] User: Inp. address, command and interval */
[177] else
[178] if(Regime_work[0]=='1') Hand_order_var1();
[179] /* ######## REGIME 2: HAND TIME-HAND COMMAND.
[180] User: Inp. address, command and time */
[181] else
[182] if(Regime_work[0]=='2') Hand_order_var2();
[183] /*========================== AUTOMATIC REGIMES 3-6 */
[184] if((Regime_work[0]=='3') ||
[185] (Regime_work[0]=='4') ||
[186] (Regime_work[0]=='5') ||
[187] (Regime_work[0]=='6'))
[188] {
[189] /* User: Input name of the file entry */
[190] Openfile_entry();
[191] Get_number_commands();
[192] }
[193] /* ######## REGIME 3: COMMAND FILE-HAND INTERVAL CONST.
[194] User: Inp.interval */
[195] if(Regime_work[0]=='3') Hand_order_var3();
[196] /* ######## REGIME 4: COMMAND FILE-INTERVALS VARIABLE.
[197] User: Not work */
[198] /* ######## REGIME 5. COMMAND FILE with TIMES.
[199] User: Not work */
[200] /* ######## REGIME 6. STEP by STEP.
[201] User: press <ENTER> */
[202]
[203] /*IIIIIIIIIIIIIII INITIALISATION of BLACK CASES IIIIIIIIIIIIIIII*/
[204] Dev0_bc(); Dev1_bc(); Dev2_bc(); Dev3_bc();
[205] Dev4_bc(); Dev5_bc(); Dev6_bc(); Dev7_bc();
[206]
[207] /*IIIIIIIIIIIIIII INITIALISATION of WINDOWS IIIIIIIIIIIIIIII*/
[208] Graph_regime();
[209] /*---- Tables 1 (Left) */
[210] Left_x_1=0; /* Const. */
[211] Left_y_1=0; /* Variable */
[212] Right_x_1=Maxx*COMPRESSION_X; /* Const. */
[213] Right_y_1=0; /* Variable */
[214] /*---- Tables 2 (Right) */
[215] Left_x_2=(Maxx*COMPRESSION_X)+
[216] WIND_INTERVAL_X; /* Const. */
[217] Left_y_2=0; /* Variable */
[218] Right_x_2=Maxx; /* Const. */
[219] Right_y_2=0; /* Variable */
[220] /*----*/
[221] Wind_left_ini();
[222] Wind_right_ini();
[223] Flag_ini=YES_INI;
[224] /*----*/
[225] Regime();
[226] File_inp();
[227] /* File_out(); */
[228] if((Regime_work[0]=='3') ||
[229] (Regime_work[0]=='4') ||
[230] (Regime_work[0]=='5') ||
[231] (Regime_work[0]=='6'))
[232] Com_num();
[233]
[234] /*IIIIIIIIIIIIIIII EXECUTION of CONTROL IIIIIIIIIIIIIIII*/
[235] /* ######## REGIME 1: HAND COMMAND */
[236] if(Regime_work[0]=='1')
[237] {/*---- Beguin Regime 1 */
[238] Add_ord();
[239] Com_ord();
[240] Int_ord();
[241] for
[242] (Interval_counted=0;
[243] Interval_counted<Interval_ordered;
[244] Interval_counted++)
[245] {
[246] Get_time_pc_counted();
[247] Time_pc();
[248] Int_cnt();
[249] delay(1000);
[250] }
[251] /*** Site of the Driver() ***/
[252] Mes_exec();
[253] Address_bus();
[254] Device_bus();
[255] Counter_commands++;
[256] Com_cnt();
[257] /*---- Black Cases */
[258] if(A_dec==0) Dev0_bc();
[259] if(A_dec==1) Dev1_bc();
[260] if(A_dec==2) Dev2_bc();
[261] if(A_dec==3) Dev3_bc();
[262] if(A_dec==4) Dev4_bc();
[263] if(A_dec==5) Dev5_bc();
[264] if(A_dec==6) Dev6_bc();
[265] if(A_dec==7) Dev7_bc();
[266] /*----*/
[267] STOP;
[268] End_program(); /* --> EXIT */
[269] }/*----End Regime 1 */
[270]
[271] /* ######## REGIME 2: HAND TIME-HAND COMMAND */
[272] else
[273] if(Regime_work[0]=='2')
[274] {/*---- Beguin Regime 2 */
[275] Add_ord();
[276] Com_ord();
[277] Time_ord();
[278] for(;;)
[279] {
[280] Get_time_pc_counted();
[281] Time_pc();
[282] if(Time_pc_counted>=Time_ordered) break;
[283] delay(750);
[284] }
[285] /*** Site of the Driver() ***/
[286] Mes_exec();
[287] Address_bus();
[288] Device_bus();
[289] Counter_commands++;
[290] Com_cnt();
[291] /*---- Black Case */
[292] /* A_dec=A2*4+A1*2+A0*1; */
[293] if(A_dec==0) Dev0_bc();
[294] if(A_dec==1) Dev1_bc();
[295] if(A_dec==2) Dev2_bc();
[296] if(A_dec==3) Dev3_bc();
[297] if(A_dec==4) Dev4_bc();
[298] if(A_dec==5) Dev5_bc();
[299] if(A_dec==6) Dev6_bc();
[300] if(A_dec==7) Dev7_bc();
[301] /*----*/
[302] STOP; STOP;
[303] End_program(); /* --> EXIT */
[304] }/*---- End Regime 2 */
[305]
[306] /* ######## REGIME 3: COMMAND FILE-HAND INTERVAL CONST */
[307] else
[308] if(Regime_work[0]=='3')
[309] {/*---- Beguin Regime 3 */
[310] while(1)
[311] {/*----------------------------- Top while(1) */
[312] /* Input: A2,A1,A0,C2,C1,C0 */
[313] File_order_var3(); /* if(feof(Fp1)) -> EXIT */
[314] Add_ord();
[315] Com_ord();
[316] for
[317] (Interval_counted=0;
[318] Interval_counted<Interval_ordered;
[319] Interval_counted++)
[320] {
[321] Get_time_pc_counted();
[322] Int_ord();
[323] Int_cnt();
[324] Time_pc();
[325] delay(1000);
[326] }
[327] /*** Site of the Driver() ***/
[328] Mes_exec();
[329] Address_bus();
[330] Device_bus();
[331] Counter_commands++;
[332] Com_cnt();
[333] /*---- Black Case */
[334] /* A_dec=A2*4+A1*2+A0*1; */
[335] if(A_dec==0) Dev0_bc();
[336] if(A_dec==1) Dev1_bc();
[337] if(A_dec==2) Dev2_bc();
[338] if(A_dec==3) Dev3_bc();
[339] if(A_dec==4) Dev4_bc();
[340] if(A_dec==5) Dev5_bc();
[341] if(A_dec==6) Dev6_bc();
[342] if(A_dec==7) Dev7_bc();
[343] /*----*/
[344] }/*----------------------------- Down while(1) */
[345] }/*--- End regimes 3 */
[346]
[347] /* ######## REGIME 4: COMMAND FILE-INTERVALS VARIABLE */
[348] else
[349] if(Regime_work[0]=='4')
[350] {/*---- Beguin Regimes 4 */
[351] while(1)
[352] {/*----------------------------- Top while(1) */
[353] /* Input: A2,A1,A0,C2,C1,C0,Intrval_ordered */
[354] File_order_var4(); /* if(feof(Fp1)) -> EXIT */
[355] Add_ord();
[356] Com_ord();
[357] for
[358] (Interval_counted=0;
[359] Interval_counted<Interval_ordered;
[360] Interval_counted++)
[361] {
[362] Get_time_pc_counted();
[363] Int_ord();
[364] Int_cnt();
[365] Time_pc();
[366] delay(1000);
[367] }
[368] /*** Site of the Driver() ***/
[369] Mes_exec();
[370] Address_bus();
[371] Device_bus();
[372] Counter_commands++;
[373] Com_cnt();
[374] /*---- Black Case */
[375] /* A_dec=A2*4+A1*2+A0*1; */
[376] if(A_dec==0) Dev0_bc();
[377] if(A_dec==1) Dev1_bc();
[378] if(A_dec==2) Dev2_bc();
[379] if(A_dec==3) Dev3_bc();
[380] if(A_dec==4) Dev4_bc();
[381] if(A_dec==5) Dev5_bc();
[382] if(A_dec==6) Dev6_bc();
[383] if(A_dec==7) Dev7_bc();
[384] /*----*/
[385] }/*----------------------------- Down while(1) */
[386] }/*--- End regimes 4 */
[387]
[388] /* ######## REGIME 5. COMMAND FILE with TIMES */
[389] else
[390] if(Regime_work[0]=='5')
[391] {/*---- Beguin Regime 5 */
[392] while(1)
[393] {/*----------------------------- Top while(1) */
[394] File_order_var5(); /* if(feof(Fp1)) -> EXIT */
[395] Add_ord();
[396] Com_ord();
[397] Time_ord();
[398] for(;;)
[399] {
[400] Get_time_pc_counted();
[401] Time_pc();
[402] if(Time_pc_counted>=Time_ordered) break;
[403] delay(750);
[404] }
[405] /*** Site of the Driver() ***/
[406] Mes_exec();
[407] Address_bus();
[408] Device_bus();
[409] Counter_commands++;
[410] Com_cnt();
[411] /*---- Black Case */
[412] /* A_dec=A2*4+A1*2+A0*1; */
[413] if(A_dec==0) Dev0_bc();
[414] if(A_dec==1) Dev1_bc();
[415] if(A_dec==2) Dev2_bc();
[416] if(A_dec==3) Dev3_bc();
[417] if(A_dec==4) Dev4_bc();
[418] if(A_dec==5) Dev5_bc();
[419] if(A_dec==6) Dev6_bc();
[420] if(A_dec==7) Dev7_bc();
[421] /*----*/
[422] }/*----------------------------- Down while(1) */
[423] }/*--- End Regime 5 */
[424]
[425] /* ######## REGIME 6. STEP by STEP */
[426] else
[427] if(Regime_work[0]=='6')
[428] {/*---- Beguin Regime 6 */
[429] while(1)
[430] {/*----------------------------- Top while(1) */
[431] /* Input: A2,A1,A0,C2,C1,C0 */
[432] File_order_var3(); /* if(feof(Fp1)) -> EXIT */
[433] Add_ord();
[434] Com_ord();
[435] Get_time_pc_counted();
[436] Time_pc();
[437] STOP; /* End of one step. User: press <ENTER>! */
[438] /*** Site of the Driver() ***/
[439] Mes_exec();
[440] Address_bus();
[441] Device_bus();
[442] Counter_commands++;
[443] Com_cnt();
[444] Time_pc();
[445] /*---- Black Case */
[446] /* A_dec=A2*4+A1*2+A0*1; */
[447] if(A_dec==0) Dev0_bc();
[448] if(A_dec==1) Dev1_bc();
[449] if(A_dec==2) Dev2_bc();
[450] if(A_dec==3) Dev3_bc();
[451] if(A_dec==4) Dev4_bc();
[452] if(A_dec==5) Dev5_bc();
[453] if(A_dec==6) Dev6_bc();
[454] if(A_dec==7) Dev7_bc();
[455] /*----*/
[456] }/*----------------------------- Down while(1) */
[457] }/*--- End regime 6 */
[458] } /*------------------- End main */
[459]
[460] /*######################################### SUB_PROGRAMMS */
[461] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[462] int Graph_regime()
[463] {
[464] /*---- Variables */
[465] int gdriver=DETECT,gmode,errorcode;
[466] /*---- Graph. initialisation */
[467] initgraph(&gdriver,&gmode,"C:\\TURBOC.3_0\\BGI");
[468] errorcode=graphresult();
[469] if(errorcode!= grOk)
[470] {
[471] gotoxy(1,24);
[472] textattr(LIGHTRED+(BLACK<<4));
[473] cprintf
[474] ("GRAPHICS ERROR: %s\n",grapherrormsg(errorcode));
[475] STOP;
[476] exit(EXIT_SUCCESS);
[477] }
[478] Maxx=getmaxx();
[479] Maxy=getmaxy();
[480] /*---- Installuserfont */
[481] Font[0]=installuserfont("bold");
[482] Font[1]=installuserfont("euro"); /* Cyr */
[483] Font[2]=installuserfont("lcom"); /* Cyr */
[484] Font[3]=installuserfont("litt");
[485] Font[4]=installuserfont("sans");
[486] Font[5]=installuserfont("scri"); /* Cyr manuscript */
[487] Font[6]=installuserfont("simp"); /* Cyr */
[488] Font[7]=installuserfont("tscr"); /* Cyr manuscript */
[489] return 0;
[490] }
[491] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[492] Text_regime()
[493] {
[494] closegraph();
[495] restorecrtmode();
[496] textbackground(BLACK);
[497] textcolor(WHITE);
[498] return 0;
[499] }
[500] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[501] int Title_sheet()
[502] {
[503] /*---- Variables */
[504] int x,y;
[505] /* int kx; */
[506] int ky;
[507] int col_rand;
[508] /*---- Graph. initialisation */
[509] Graph_regime();
[510] /*---- Scale of the title sheet */
[511] /* kx=Maxx/COL; */
[512] ky=Maxy/ROW;
[513] /*---- Title 1 */
[514] setcolor(YELLOW);
[515] setbkcolor(BLACK);
[516] settextstyle(SMALL_FONT,HORIZ_DIR,5);
[517] settextjustify(CENTER_TEXT,CENTER_TEXT);
[518] x=Maxx/2;
[519] y=1*ky;
[520] outtextxy(x,y,Title_1); /* MGAPI */
[521] /*---- Frame */
[522] x=0;
[523] y=2*ky;
[524] setcolor(WHITE);
[525] setlinestyle(SOLID_LINE,0,NORM_WIDTH);
[526] Rectangle2(x,y,Maxx,Maxy);
[527] setfillstyle(SOLID_FILL,BLUE);
[528] x=Maxx/2;
[529] y=Maxy/2;
[530] floodfill(x,y,WHITE);
[531] /*---- Text */
[532] settextjustify(CENTER_TEXT,CENTER_TEXT);
[533] setcolor(YELLOW);
[534] settextstyle(SMALL_FONT,HORIZ_DIR,6);
[535] x=Maxx/2;
[536] y=19*ky;
[537] outtextxy(x,y,Title_4); /* Group, Code... */
[538]
[539] settextstyle(SMALL_FONT,HORIZ_DIR,5);
[540] x=Maxx/2;
[541] y=4*ky;
[542] outtextxy(x,y,Title_7); /* IS-4... */
[543]
[544] settextstyle(SMALL_FONT,HORIZ_DIR,5);
[545] setcolor(LIGHTGRAY);
[546] x=Maxx/2;
[547] y=21*ky;
[548] outtextxy(x,y,Title_6); /* Speciality... */
[549]
[550] x=Maxx/2;
[551] y=22*ky;
[552] outtextxy(x,y,Title_5); /* Discipline... */
[553]
[554] x=Maxx/2;
[555] y=23*ky;
[556] outtextxy(x,y,Title_8); /* Teacher... */
[557]
[558] x=Maxx/2;
[559] y=24*ky;
[560] outtextxy(x,y,Title_9); /* Year... */
[561] /* SYSTEM... */
[562] settextstyle(TRIPLEX_FONT,HORIZ_DIR,0);
[563] setusercharsize(2,3,2,1);
[564] settextjustify(CENTER_TEXT,CENTER_TEXT);
[565] x=Maxx/2;
[566] y=11*ky;
[567] setcolor(CYAN);
[568] outtextxy(x,y,Title_2);
[569] setcolor(LIGHTGRAY);
[570] outtextxy(x-1,y-1,Title_2);
[571] setcolor(WHITE);
[572] outtextxy(x-2,y-2,Title_2);
[573] /* imitator */
[574] y=y+textheight("S");
[575] setcolor(CYAN);
[576] setusercharsize(2,3,3,2);
[577] outtextxy(x,y,Title_11);
[578] setcolor(LIGHTGRAY);
[579] outtextxy(x-1,y-1,Title_11);
[580] setcolor(WHITE);
[581] outtextxy(x-2,y-2,Title_11);
[582] /* Student... */
[583] setcolor(YELLOW);
[584] settextstyle(SMALL_FONT,HORIZ_DIR,6);
[585] settextjustify(CENTER_TEXT,CENTER_TEXT);
[586] x=Maxx/2;
[587] y=18*ky;
[588] outtextxy(x,y,Title_3);
[589] /*-------- Blinks */
[590] while(bioskey(1)==0)
[591] {
[592] /*---- Happy Work */
[593] col_rand=random(16);
[594] setcolor(col_rand);
[595] settextstyle(SMALL_FONT,HORIZ_DIR,4);
[596] settextjustify(RIGHT_TEXT,BOTTOM_TEXT);
[597] x=Maxx-6;
[598] y=Maxy-18;
[599] outtextxy(x,y,"HAPPY WORK");
[600] x=Maxx-6;
[601] y=y+textheight("H");
[602] outtextxy(x,y," A E S ");
[603] /*---- Title blink */
[604] /*
[605] settextstyle(TRIPLEX_FONT,HORIZ_DIR,0);
[606] setusercharsize(2,3,2,1);
[607] settextjustify(CENTER_TEXT,CENTER_TEXT);
[608] x=Maxx/2;
[609] y=11*ky;
[610] setcolor(CYAN);
[611] outtextxy(x,y,Title_2);
[612] if(col_rand%2) setcolor(LIGHTRED);
[613] else
[614] if(!col_rand%2) setcolor(LIGHTMAGENTA);
[615] outtextxy(x-1,y-1,Title_2);
[616] setcolor(WHITE);
[617] outtextxy(x-2,y-2,Title_2);
[618] */
[619] /*----*/
[620] delay(1);
[621] }
[622] bioskey(0);
[623] return 0;
[624] }
[625] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[626] int Start_program(int dx,int dy)
[627] {
[628] settextstyle(TRIPLEX_FONT,HORIZ_DIR,0);
[629] setusercharsize(2,3,3,1);
[630] settextjustify(CENTER_TEXT,CENTER_TEXT);
[631] setcolor(LIGHTGREEN);
[632] outtextxy
[633] (dx/2+15,(dy/2-10)," S T A R T P R O G R A M M E ");
[634] /*----*/
[635] setcolor(GREEN);
[636] EllipseN
[637] (dx/2,dy/2,0,360,(dx/2-40),(dy/2-20),4);
[638] setcolor(WHITE);
[639] EllipseN
[640] (dx/2,dy/2,0,360,(dx/2-40)-4,(dy/2-20)-4,2);
[641] /*----*/
[642] return 0;
[643] }
[644] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[645] int End_program()
[646] {
[647] strcpy(Messages_exec," E N D P R O G R A M M E ");
[648] Mes_exec();
[649] STOP; STOP; exit(EXIT_SUCCESS);
[650] return 0;
[651] }
[652] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[653] int Addbus3bit(int kx,int ky)
[654] {
[655] clearviewport();
[656] /*---- Wires */
[657] setlinestyle(SOLID_LINE,0,NORM_WIDTH);
[658] setbkcolor(BLACK);
[659] setcolor(CYAN);
[660] setfillstyle(SOLID_FILL,LIGHTBLUE);
[661] /* A2 */
[662] line(6*kx,1*ky,54*kx,1*ky);
[663] fillellipse(54*kx,1*ky,2,1);
[664] line(54*kx,1*ky,54*kx,4*ky);
[665] /* A1 */
[666] line(6*kx,2*ky,50*kx,2*ky);
[667] fillellipse(50*kx,2*ky,2,1);
[668] line(50*kx,2*ky,50*kx,4*ky);
[669] /* A0 */
[670] line(6*kx,3*ky,46*kx,3*ky);
[671] fillellipse(46*kx,3*ky,2,1);
[672] line(46*kx,3*ky,46*kx,4*ky);
[673] /* ~A0 */
[674] line(6*kx,8*ky,46*kx,8*ky);
[675] fillellipse(46*kx,8*ky,2,1);
[676] line(46*kx,8*ky,46*kx,7*ky);
[677] /* ~A1 */
[678] line(6*kx,9*ky,50*kx,9*ky);
[679] fillellipse(50*kx,9*ky,2,1);
[680] line(50*kx,9*ky,50*kx,7*ky);
[681] /* ~A2 */
[682] line(6*kx,10*ky,54*kx,10*ky);
[683] fillellipse(54*kx,10*ky,2,1);
[684] line(54*kx,10*ky,54*kx,7*ky);
[685] /*---- To And 0 */
[686] line(7*kx,10*ky,7*kx,11*ky);
[687] fillellipse(7*kx,10*ky,2,1);
[688]
[689] line(8*kx,9*ky,8*kx,11*ky);
[690] fillellipse(8*kx,9*ky,2,1);
[691]
[692] line(9*kx,8*ky,9*kx,11*ky);
[693] fillellipse(9*kx,8*ky,2,1);
[694] /*---- To And 1 */
[695] line(12*kx,10*ky,12*kx,11*ky);
[696] fillellipse(12*kx,10*ky,2,1);
[697]
[698] line(13*kx,9*ky,13*kx,11*ky);
[699] fillellipse(13*kx,9*ky,2,1);
[700]
[701] line(14*kx,3*ky,14*kx,11*ky);
[702] fillellipse(14*kx,3*ky,2,1);
[703] /*---- To And 2 */
[704] line(17*kx,10*ky,17*kx,11*ky);
[705] fillellipse(17*kx,10*ky,2,1);
[706]
[707] line(18*kx,2*ky,18*kx,11*ky);
[708] fillellipse(18*kx,2*ky,2,1);
[709]
[710] line(19*kx,8*ky,19*kx,11*ky);
[711] fillellipse(19*kx,8*ky,2,1);
[712] /*---- To And 3 */
[713] line(22*kx,10*ky,22*kx,11*ky);
[714] fillellipse(22*kx,10*ky,2,1);
[715]
[716] line(23*kx,2*ky,23*kx,11*ky);
[717] fillellipse(23*kx,2*ky,2,1);
[718]
[719] line(24*kx,3*ky,24*kx,11*ky);
[720] fillellipse(24*kx,3*ky,2,1);
[721] /*---- To And 4 */
[722] line(27*kx,1*ky,27*kx,11*ky);
[723] fillellipse(27*kx,1*ky,2,1);
[724]
[725] line(28*kx,9*ky,28*kx,11*ky);
[726] fillellipse(28*kx,9*ky,2,1);
[727]
[728] line(29*kx,8*ky,29*kx,11*ky);
[729] fillellipse(29*kx,8*ky,2,1);
[730] /*---- To And 5 */
[731] line(32*kx,1*ky,32*kx,11*ky);
[732] fillellipse(32*kx,1*ky,2,1);
[733]
[734] line(33*kx,9*ky,33*kx,11*ky);
[735] fillellipse(33*kx,9*ky,2,1);
[736]
[737] line(34*kx,3*ky,34*kx,11*ky);
[738] fillellipse(34*kx,3*ky,2,1);
[739] /*---- To And 6 */
[740] line(37*kx,1*ky,37*kx,11*ky);
[741] fillellipse(37*kx,1*ky,2,1);
[742]
[743] line(38*kx,2*ky,38*kx,11*ky);
[744] fillellipse(38*kx,2*ky,2,1);
[745]
[746] line(39*kx,8*ky,39*kx,11*ky);
[747] fillellipse(39*kx,8*ky,2,1);
[748] /*---- To And 7 */
[749] line(42*kx,1*ky,42*kx,11*ky);
[750] fillellipse(42*kx,1*ky,2,1);
[751]
[752] line(43*kx,2*ky,43*kx,11*ky);
[753] fillellipse(43*kx,2*ky,2,1);
[754]
[755] line(44*kx,3*ky,44*kx,11*ky);
[756] fillellipse(44*kx,3*ky,2,1);
[757] /*---- To COMMUTATOR */
[758] line(8*kx,14*ky, 8*kx,18*ky);
[759] line(13*kx,14*ky,13*kx,18*ky);
[760] line(18*kx,14*ky,18*kx,18*ky);
[761] line(23*kx,14*ky,23*kx,18*ky);
[762] line(28*kx,14*ky,28*kx,18*ky);
[763] line(33*kx,14*ky,33*kx,18*ky);
[764] line(38*kx,14*ky,38*kx,18*ky);
[765] line(43*kx,14*ky,43*kx,18*ky);
[766] /*---- Title */
[767] setcolor(CYAN);
[768] settextstyle(SMALL_FONT,HORIZ_DIR,FONT_DIM_DRAFT);
[769] settextjustify(LEFT_TEXT,CENTER_TEXT);
[770] outtextxy
[771] (46*kx,12*ky,
[772] " E-locks (addr) ");
[773] outtextxy
[774] (46*kx,17*ky,
[775] " Commutator ");
[776] /*---- NE */
[777] E("~",0,45,4,3,3,kx,ky);
[778] E("~",1,49,4,3,3,kx,ky);
[779] E("~",2,53,4,3,3,kx,ky);
[780] /*---- AND */
[781] E("&",0,6,11,4,3,kx,ky);
[782] E("&",1,11,11,4,3,kx,ky);
[783] E("&",2,16,11,4,3,kx,ky);
[784] E("&",3,21,11,4,3,kx,ky);
[785] E("&",4,26,11,4,3,kx,ky);
[786] E("&",5,31,11,4,3,kx,ky);
[787] E("&",6,36,11,4,3,kx,ky);
[788] E("&",7,41,11,4,3,kx,ky);
[789] /*---- COMMUTATORS */
[790] B("C",0,6,18,4,3,kx,ky);
[791] B("C",1,11,18,4,3,kx,ky);
[792] B("C",2,16,18,4,3,kx,ky);
[793] B("C",3,21,18,4,3,kx,ky);
[794] B("C",4,26,18,4,3,kx,ky);
[795] B("C",5,31,18,4,3,kx,ky);
[796] B("C",6,36,18,4,3,kx,ky);
[797] B("C",7,41,18,4,3,kx,ky);
[798] /*---- Entry */
[799] settextstyle(SMALL_FONT,VERT_DIR,FONT_DIM_DRAFT);
[800] settextjustify(CENTER_TEXT,CENTER_TEXT);
[801] setcolor(LIGHTGREEN);
[802] outtextxy(5*kx,1*ky,"2");
[803] outtextxy(5*kx,2*ky,"1");
[804] outtextxy(5*kx,3*ky,"0");
[805] setcolor(WHITE);
[806] outtextxy(5*kx, 8*ky,"0");
[807] outtextxy(5*kx, 9*ky,"1");
[808] outtextxy(5*kx,10*ky,"2");
[809] settextstyle(SMALL_FONT,HORIZ_DIR,FONT_DIM_DRAFT+1);
[810] setcolor(LIGHTGRAY);
[811] outtextxy(4*kx, 6*ky,"0");
[812] outtextxy(2.5*kx, 6*ky,"1");
[813] outtextxy(1*kx, 6*ky,"2");
[814] /*----*/
[815] return 0;
[816] }
[817] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[818] int Logic_addbus3bit(int kx,int ky)
[819] {
[820] /*---- Entry */
[821] Bit(1*kx, 2*ky,A2); /* bit A2 */
[822] Bit(2*kx+kx/2,2*ky,A1); /* bit A1 */
[823] Bit(3*kx+kx, 2*ky,A0); /* bit A0 */
[824] /*---- Invent. Entry */
[825] Bit(3*kx+kx, 9*ky,AI0); /* bit AI0 */
[826] Bit(2*kx+kx/2,9*ky,AI1); /* bit AI1 */
[827] Bit(1*kx, 9*ky,AI2); /* bit AI2 */
[828]
[829] /*---- Erase of Exits of the E-locks*/
[830] Bit(7*kx,16*ky,0);
[831] Bit(12*kx,16*ky,0);
[832] Bit(17*kx,16*ky,0);
[833] Bit(22*kx,16*ky,0);
[834] Bit(27*kx,16*ky,0);
[835] Bit(32*kx,16*ky,0);
[836] Bit(37*kx,16*ky,0);
[837] Bit(42*kx,16*ky,0);
[838] /*---- Exits of the E-locks */
[839] if(AI2&AI1&AI0) Bit(7*kx, 16*ky,1); /* 000 */
[840] if(AI2&AI1& A0) Bit(12*kx,16*ky,1); /* 001 */
[841] if(AI2& A1&AI0) Bit(17*kx,16*ky,1); /* 010 */
[842] if(AI2& A1& A0) Bit(22*kx,16*ky,1); /* 011 */
[843] if(A2&AI1&AI0) Bit(27*kx,16*ky,1); /* 100 */
[844] if(A2&AI1& A0) Bit(32*kx,16*ky,1); /* 101 */
[845] if(A2& A1&AI0) Bit(37*kx,16*ky,1); /* 110 */
[846] if(A2& A1& A0) Bit(42*kx,16*ky,1); /* 111 */
[847] /*----*/
[848] return 0;
[849] }
[850] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[851] Choice_regime_work()
[852] {
[853] Text_regime();
[854] /*---- Variants */
[855] printf
[856] ("\n Regimes of the work:\n");
[857] printf
[858] ("\n---------------\n");
[859] printf
[860] ("\n 0 - Exit \n");
[861] printf
[862] ("\n 1 - Hand Command. \n");
[863] printf
[864] ("\n 2 - Hand Time - Hand Command.\n");
[865] printf
[866] ("\n 3 - Aut. Commands'file. Hand Interval const.\n");
[867] printf
[868] ("\n 4 - Aut. Commands'file and Intervals var.\n");
[869] printf
[870] ("\n 5 - Aut. Commands'file with Times.\n");
[871] printf
[872] ("\n 6 - Aut. Step by step.\n");
[873] printf
[874] ("\n---------------\n");
[875] /*---- Choice of the variant */
[876] do
[877] {
[878] BELL;
[879] cputs("\n\r Regime of the Work (1 - 6), Exit (0) --> ");
[880] scanf("%s",&Regime_work);
[881] } while(Regime_work[0]!='0' &&
[882] Regime_work[0]!='1' &&
[883] Regime_work[0]!='2' &&
[884] Regime_work[0]!='3' &&
[885] Regime_work[0]!='4' &&
[886] Regime_work[0]!='5' &&
[887] Regime_work[0]!='6' ||
[888] Regime_work[1]!='\0'
[889] );
[890] return 0;
[891] }
[892] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[893] int Openfile_entry()
[894] {
[895] BELL;
[896] cputs(" File_name_entry --> ");
[897] scanf("%s",&Fname_entry);
[898] if((Fp1=fopen(Fname_entry,"r"))==NULL)
[899] {
[900] ALERT_SIGNAL;
[901] perror("File_name_entry"); STOP;
[902] exit(EXIT_FAILURE);
[903] }
[904] return 0;
[905] }
[906] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[907] int Openfile_exit()
[908] {
[909] BELL;
[910] /*---- Var. File_name_exit */
[911] /*
[912] cputs(" File_name_exit --> ");
[913] scanf("%s",&Fname_exit);
[914] */
[915] /*---- Const File_name-exit */
[916] strcpy(Fname_exit,"Control.c");
[917] /*----*/
[918] if((Fp2=fopen(Fname_exit,"w"))==NULL)
[919] {
[920] ALERT_SIGNAL;
[921] perror("File_name_exit"); STOP;
[922] exit(EXIT_FAILURE);
[923] }
[924] /*----*/
[925] return 0;
[926] }
[927] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[928] int Hand_order_var1()
[929] {
[930] char c[80];
[931] /*============= Input*/
[932] /*---- Input address A0, A1, A2 */
[933] while(1)
[934] {
[935] BELL;
[936] cputs("\r Address A0 (0 or 1) --> ");
[937] scanf("%s",&c);
[938] if(c[0]=='1' && c[1]=='\0') {A0=1; AI0=0; break;}
[939] if(c[0]=='0' && c[1]=='\0') {A0=0; AI0=1; break;}
[940] }
[941] for(;;)
[942] {
[943] BELL;
[944] cputs("\r Address A1 (0 or 1) --> ");
[945] scanf("%s",&c);
[946] if(c[0]=='1' && c[1]=='\0') {A1=1; AI1=0; break;}
[947] if(c[0]=='0' && c[1]=='\0') {A1=0; AI1=1; break;}
[948] }
[949] do
[950] {
[951] BELL;
[952] cputs("\r Address A2 (0 or 1) --> ");
[953] scanf("%s",&c);
[954] if(c[0]=='1' && c[1]=='\0') {A2=1; AI2=0;}
[955] if(c[0]=='0' && c[1]=='\0') {A2=0; AI2=1;}
[956] }while(c[0]!='0' && c[0]!='1' || c[1]!='\0');
[957] /**/
[958] A_dec=A2*4+A1*2+A0*1;
[959] /*---- Input commands */
[960] while(1)
[961] {
[962] BELL;
[963] cputs("\r Command C0 (0 or 1) --> ");
[964] scanf("%s",&c);
[965] if(c[0]=='1' && c[1]=='\0') {C0=1; CI0=0; break;}
[966] if(c[0]=='0' && c[1]=='\0') {C0=0; CI0=1; break;}
[967] }
[968] for(;;)
[969] {
[970] BELL;
[971] cputs("\r Command C1 (0 or 1) --> ");
[972] scanf("%s",&c);
[973] if(c[0]=='1' && c[1]=='\0') {C1=1; CI1=0; break;}
[974] if(c[0]=='0' && c[1]=='\0') {C1=0; CI1=1; break;}
[975] }
[976] do
[977] {
[978] BELL;
[979] cputs("\r Command C2 (0 or 1) --> ");
[980] scanf("%s",&c);
[981] if(c[0]=='1' && c[1]=='\0') {C2=1; CI2=0;}
[982] if(c[0]=='0' && c[1]=='\0') {C2=0; CI2=1;}
[983] }while(c[0]!='0' && c[0]!='1' || c[1]!='\0');
[984] /**/
[985] C_dec=C2*4+C1*2+C0*1;
[986] /*---- Interval ordered */
[987] {
[988] BELL;
[989] cputs(" Interval_ordered (sec.) --> ");
[990] scanf("%ld",&Interval_ordered);
[991] }
[992] /*----*/
[993] Hint_ord=Interval_ordered/3600;
[994] Mint_ord=Interval_ordered%3600/60;
[995] Sint_ord=Interval_ordered%3600%60;
[996] /*---- Messages exec */
[997] strcpy(Messages_exec," ADD: ");
[998] itoa((A2*4+A1*2+A0*1),c,10);
[999] strcat(Messages_exec,c);
[1000] /*-*/
[1001] strcat(Messages_exec,", COM: ");
[1002] itoa((C2*4+C1*2+C0*1),c,10);
[1003] strcat(Messages_exec,c);
[1004] /*-*/
[1005] strcat(Messages_exec,", Interval (s): ");
[1006] itoa(Interval_ordered,c,10);
[1007] strcat(Messages_exec,c);
[1008] /*----*/
[1009] return 0;
[1010] }
[1011] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1012] int Hand_order_var2()
[1013] {
[1014] char c[80];
[1015] /*============= Input*/
[1016] /*---- Input address A0, A1, A2 */
[1017] while(1)
[1018] {
[1019] BELL;
[1020] cputs("\r Address A0 (0 or 1) --> ");
[1021] scanf("%s",&c);
[1022] if(c[0]=='1' && c[1]=='\0') {A0=1; AI0=0; break;}
[1023] if(c[0]=='0' && c[1]=='\0') {A0=0; AI0=1; break;}
[1024] }
[1025] for(;;)
[1026] {
[1027] BELL;
[1028] cputs("\r Address A1 (0 or 1) --> ");
[1029] scanf("%s",&c);
[1030] if(c[0]=='1' && c[1]=='\0') {A1=1; AI1=0; break;}
[1031] if(c[0]=='0' && c[1]=='\0') {A1=0; AI1=1; break;}
[1032] }
[1033] do
[1034] {
[1035] BELL;
[1036] cputs("\r Address A2 (0 or 1) --> ");
[1037] scanf("%s",&c);
[1038] if(c[0]=='1' && c[1]=='\0') {A2=1; AI2=0;}
[1039] if(c[0]=='0' && c[1]=='\0') {A2=0; AI2=1;}
[1040] }while(c[0]!='0' && c[0]!='1' || c[1]!='\0');
[1041] /**/
[1042] A_dec=A2*4+A1*2+A0*1;
[1043] /*---- Input commands */
[1044] while(1)
[1045] {
[1046] BELL;
[1047] cputs("\r Command C0 (0 or 1) --> ");
[1048] scanf("%s",&c);
[1049] if(c[0]=='1' && c[1]=='\0') {C0=1; CI0=0; break;}
[1050] if(c[0]=='0' && c[1]=='\0') {C0=0; CI0=1; break;}
[1051] }
[1052] for(;;)
[1053] {
[1054] BELL;
[1055] cputs("\r Command C1 (0 or 1) --> ");
[1056] scanf("%s",&c);
[1057] if(c[0]=='1' && c[1]=='\0') {C1=1; CI1=0; break;}
[1058] if(c[0]=='0' && c[1]=='\0') {C1=0; CI1=1; break;}
[1059] }
[1060] do
[1061] {
[1062] BELL;
[1063] cputs("\r Command C2 (0 or 1) --> ");
[1064] scanf("%s",&c);
[1065] if(c[0]=='1' && c[1]=='\0') {C2=1; CI2=0;}
[1066] if(c[0]=='0' && c[1]=='\0') {C2=0; CI2=1;}
[1067] }while(c[0]!='0' && c[0]!='1' || c[1]!='\0');
[1068] /**/
[1069] C_dec=C2*4+C1*2+C0*1;
[1070] /*---- Order of the times */
[1071] for(;;)
[1072] {
[1073] BELL;
[1074] cputs("\n\r Time Hour (0-24) --> ");
[1075] cscanf("%2s",&c);
[1076] if((isdigit(c[0]))&&(isdigit(c[1]))&&(c[2]=='\0')||
[1077] (isdigit(c[0]))&&(c[1]=='\0'))
[1078] Ho=atoi(c);
[1079] else continue;
[1080] if(Ho<=24) break;
[1081] else continue;
[1082] }
[1083] for(;;)
[1084] {
[1085] BELL;
[1086] cputs("\n\r Time Min. (0-60) --> ");
[1087] cscanf("%2s",&c);
[1088] if((isdigit(c[0]))&&(isdigit(c[1]))&&(c[2]=='\0')||
[1089] (isdigit(c[0]))&&(c[1]=='\0'))
[1090] Mo=atoi(c);
[1091] else continue;
[1092] if(Mo<=60) break;
[1093] else continue;
[1094] }
[1095] for(;;)
[1096] {
[1097] BELL;
[1098] cputs("\n\r Time Sec. (0-60) --> ");
[1099] cscanf("%2s",&c);
[1100] if((isdigit(c[0]))&&(isdigit(c[1]))&&(c[2]=='\0')||
[1101] (isdigit(c[0]))&&(c[1]=='\0'))
[1102] So=atoi(c);
[1103] else continue;
[1104] if(So<=60) break;
[1105] else continue;
[1106] }
[1107] /*----*/
[1108] Time_ordered=(long int)(Ho*3600+Mo*60+So);
[1109] /*---- Messages exec */
[1110] strcpy(Messages_exec," ADD: ");
[1111] itoa((A2*4+A1*2+A0*1),c,10);
[1112] strcat(Messages_exec,c);
[1113] /*-*/
[1114] strcat(Messages_exec,", COM: ");
[1115] itoa((C2*4+C1*2+C0*1),c,10);
[1116] strcat(Messages_exec,c);
[1117] /*-*/
[1118] strcat(Messages_exec,", Hour: ");
[1119] itoa(Ho,c,10);
[1120] strcat(Messages_exec,c);
[1121] /*-*/
[1122] strcat(Messages_exec,", Min: ");
[1123] itoa(Mo,c,10);
[1124] strcat(Messages_exec,c);
[1125] /*-*/
[1126] strcat(Messages_exec,", Sec: ");
[1127] itoa(So,c,10);
[1128] strcat(Messages_exec,c);
[1129] /*-*/
[1130] return 0;
[1131] }
[1132] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1133] int Hand_order_var3()
[1134] {
[1135] BELL;
[1136] cputs(" Interval_ordered (sec.) --> ");
[1137] scanf("%ld",&Interval_ordered);
[1138] /*----*/
[1139] Hint_ord=Interval_ordered/3600;
[1140] Mint_ord=Interval_ordered%3600/60;
[1141] Sint_ord=Interval_ordered%3600%60;
[1142] /*----*/
[1143] return 0;
[1144] }
[1145] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1146] int File_order_var3()
[1147] {
[1148] if(feof(Fp1)) End_program();
[1149] fgets(Messages_exec,79,Fp1);
[1150] fscanf
[1151] (Fp1,"%1d%1d%1d---%1d%1d%1d\n",
[1152] &A2,&A1,&A0,&C2,&C1,&C0);
[1153] /**/
[1154] AI0=~A0&1;
[1155] AI1=~A1&1;
[1156] AI2=~A2&1;
[1157] /**/
[1158] A_dec=A2*4+A1*2+A0*1;
[1159] /**/
[1160] CI0=~C0&1;
[1161] CI1=~C1&1;
[1162] CI2=~C2&1;
[1163] /**/
[1164] C_dec=C2*4+C1*2+C0*1;
[1165] /**/
[1166] return 0;
[1167] }
[1168] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1169] int File_order_var4()
[1170] {
[1171] if(feof(Fp1)) End_program();
[1172] fgets(Messages_exec,79,Fp1);
[1173] fscanf
[1174] (Fp1,"%1d%1d%1d---%1d%1d%1d---%10ld\n",
[1175] &A2,&A1,&A0,&C2,&C1,&C0,&Interval_ordered);
[1176] /**/
[1177] AI0=~A0&1;
[1178] AI1=~A1&1;
[1179] AI2=~A2&1;
[1180] /**/
[1181] A_dec=A2*4+A1*2+A0*1;
[1182] /**/
[1183] CI0=~C0&1;
[1184] CI1=~C1&1;
[1185] CI2=~C2&1;
[1186] /**/
[1187] C_dec=C2*4+C1*2+C0*1;
[1188] /**/
[1189] Hint_ord=Interval_ordered/3600;
[1190] Mint_ord=Interval_ordered%3600/60;
[1191] Sint_ord=Interval_ordered%3600%60;
[1192] /*----*/
[1193] return 0;
[1194] }
[1195] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1196] int File_order_var5()
[1197] {
[1198] if(feof(Fp1)) End_program();
[1199] fgets(Messages_exec,79,Fp1);
[1200] fscanf
[1201] (Fp1,"%1d%1d%1d---%1d%1d%1d---%2d%2d%2d\n",
[1202] &A2,&A1,&A0,&C2,&C1,&C0,&Ho,&Mo,&So);
[1203] /**/
[1204] AI0=~A0&1;
[1205] AI1=~A1&1;
[1206] AI2=~A2&1;
[1207] /**/
[1208] A_dec=A2*4+A1*2+A0*1;
[1209] /**/
[1210] CI0=~C0&1;
[1211] CI1=~C1&1;
[1212] CI2=~C2&1;
[1213] /**/
[1214] C_dec=C2*4+C1*2+C0*1;
[1215] /**/
[1216] Time_ordered=(long int)(Ho*3600+Mo*60+So);
[1217] /*----*/
[1218] return 0;
[1219] }
[1220] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1221] int Get_time_pc_counted()
[1222] {
[1223] gettime(&Time_now);
[1224] /* */
[1225] H=(int)Time_now.ti_hour;
[1226] M=(int)Time_now.ti_min;
[1227] S=(int)Time_now.ti_sec;
[1228] Time_pc_counted=(int long)(H*3600+M*60+S);
[1229] /* */
[1230] return 0;
[1231] }
[1232] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1233] int Get_date_pc_counted()
[1234] {
[1235] /*---- Variables */
[1236] struct tm *ptr;
[1237] time_t lt;
[1238] /*----*/
[1239] lt=time(NULL);
[1240] ptr=localtime(<);
[1241] strcpy(Str_date_pc_counted,asctime(ptr));
[1242] /* */
[1243] return 0;
[1244] }
[1245] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1246] int Get_number_commands()
[1247] {
[1248] /*---- Variables */
[1249] char str[80];
[1250] /*---*/
[1251] while(1)
[1252] {
[1253] if(feof(Fp1)) break;
[1254] fgets(str,79,Fp1);
[1255] Number_commands++;
[1256] }
[1257] Number_commands=Number_commands/2;
[1258] rewind(Fp1);
[1259] /*----*/
[1260] return 0;
[1261] }
[1262] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1263] String_int_ordered()
[1264] {
[1265] /*---- Variables */
[1266] char str_sint_ord[4];
[1267] char str_mint_ord[4];
[1268] char str_hint_ord[4];
[1269] /*----*/
[1270] itoa(Hint_ord,str_hint_ord,10);
[1271] itoa(Mint_ord,str_mint_ord,10);
[1272] itoa(Sint_ord,str_sint_ord,10);
[1273] /*----*/
[1274] strcpy(Str_int_ordered,str_hint_ord);
[1275] strcat(Str_int_ordered,"H ");
[1276] strcat(Str_int_ordered,str_mint_ord);
[1277] strcat(Str_int_ordered,"M ");
[1278] strcat(Str_int_ordered,str_sint_ord);
[1279] strcat(Str_int_ordered,"S ");
[1280] /*----*/
[1281] return 0;
[1282] }
[1283] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1284] String_int_counted()
[1285] {
[1286] /*---- Variables */
[1287] char str_sint_cnt[4];
[1288] char str_mint_cnt[4];
[1289] char str_hint_cnt[4];
[1290] /*---- REVERS (!!!) */
[1291] Hint_cnt=(Interval_ordered-Interval_counted)/3600;
[1292] Mint_cnt=(Interval_ordered-Interval_counted)%3600/60;
[1293] Sint_cnt=(Interval_ordered-Interval_counted)%3600%60;
[1294] /*----*/
[1295] itoa(Hint_cnt,str_hint_cnt,10);
[1296] itoa(Mint_cnt,str_mint_cnt,10);
[1297] itoa(Sint_cnt,str_sint_cnt,10);
[1298] /*----*/
[1299] strcpy(Str_int_counted,str_hint_cnt);
[1300] strcat(Str_int_counted,"H ");
[1301] strcat(Str_int_counted,str_mint_cnt);
[1302] strcat(Str_int_counted,"M ");
[1303] strcat(Str_int_counted,str_sint_cnt);
[1304] strcat(Str_int_counted,"S ");
[1305] /*----*/
[1306] return 0;
[1307] }
[1308] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1309] int String_time_pc_ordered()
[1310] {
[1311] /*---- Variables */
[1312] char str_Ho[4];
[1313] char str_Mo[4];
[1314] char str_So[4];
[1315] /*---- Display Time ordered */
[1316] itoa(Ho,str_Ho,10);
[1317] itoa(Mo,str_Mo,10);
[1318] itoa(So,str_So,10);
[1319] /* */
[1320] strcpy(Str_time_pc_ordered,str_Ho);
[1321] strcat(Str_time_pc_ordered,"H ");
[1322] strcat(Str_time_pc_ordered,str_Mo);
[1323] strcat(Str_time_pc_ordered,"M ");
[1324] strcat(Str_time_pc_ordered,str_So);
[1325] strcat(Str_time_pc_ordered,"S ");
[1326] return 0;
[1327] }
[1328] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1329] int String_time_pc_counted()
[1330] {
[1331] /*---- Variables */
[1332] char str_hour[4];
[1333] char str_min[4];
[1334] char str_sec[4];
[1335] /*---- TIME_REAL (PC) */
[1336] itoa(Time_now.ti_hour,str_hour,10);
[1337] itoa(Time_now.ti_min, str_min, 10);
[1338] itoa(Time_now.ti_sec, str_sec, 10);
[1339] /* */
[1340] strcpy(Str_time_pc_counted,str_hour);
[1341] strcat(Str_time_pc_counted,"H-");
[1342] strcat(Str_time_pc_counted,str_min);
[1343] strcat(Str_time_pc_counted,"M-");
[1344] strcat(Str_time_pc_counted,str_sec);
[1345] strcat(Str_time_pc_counted,"S");
[1346] return 0;
[1347] }
[1348] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1349] int Wind_out
[1350] (int lx,int ly,int rx,int ry,int bk_val,int col_val,
[1351] char *str)
[1352] {
[1353] setviewport(lx,ly,rx,ry,CLIP_ON);
[1354] clearviewport();
[1355] setfillstyle(SOLID_FILL,bk_val);
[1356] bar(lx,ly,rx,ry);
[1357] setcolor(col_val);
[1358] settextjustify(CENTER_TEXT,CENTER_TEXT);
[1359] settextstyle(SMALL_FONT,HORIZ_DIR,FONT_DIM_WIND);
[1360] outtextxy((rx-lx)/2,(ry-ly)/2,str);
[1361] /*----*/
[1362] return 0;
[1363] }
[1364] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1365] int Wind_right_ini()
[1366] {
[1367] /*---- Right windows for output information */
[1368] Left_y_2=File_inp();
[1369] /* Left_y_2=File_out(); */
[1370] Left_y_2=Regime();
[1371] Left_y_2=Com_num();
[1372] Left_y_2=Com_cnt();
[1373] Left_y_2=Add_ord();
[1374] Left_y_2=Com_ord();
[1375] Left_y_2=Int_ord();
[1376] Left_y_2=Int_cnt();
[1377] Left_y_2=Time_ord();
[1378] Left_y_2=Time_pc();
[1379] Left_y_2=Error_sys();
[1380] Left_y_2=Reserve();
[1381] /*----*/
[1382] return 0;
[1383] }
[1384] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1385] int File_inp()
[1386] {
[1387] /*---- Variables */
[1388] char *title="FILE.INP";
[1389] int col_rect=WHITE;
[1390] int bk_txt=GREEN;
[1391] int col_txt=WHITE;
[1392] int bk_val=BLACK;
[1393] int col_val=WHITE;
[1394] /*---- Abs. co-ord. window for output memorialize */
[1395] static int lx;
[1396] static int ly;
[1397] static int rx;
[1398] static int ry;
[1399] /*---- Return left_y next window */
[1400] int next_left_y;
[1401] /*---- Display window (one time) */
[1402] if (Flag_ini==NOT_INI)
[1403] {
[1404] next_left_y=Wind_2(title,
[1405] col_rect,bk_txt,col_txt,
[1406] &lx,&ly,&rx,&ry
[1407] /* Abs. co-ord. window for output */);
[1408] return next_left_y;
[1409] }
[1410] /*---- Output to window */
[1411] Wind_out(lx,ly,rx,ry,bk_val,col_val,Fname_entry);
[1412] /*----*/
[1413] return 0;
[1414] }
[1415] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1416] int File_out()
[1417] {
[1418] /*---- Variables */
[1419] char *title="FILE.OUT";
[1420] int col_rect=WHITE;
[1421] int bk_txt=GREEN;
[1422] int col_txt=WHITE;
[1423] int bk_val=BLACK;
[1424] int col_val=WHITE;
[1425] /*---- Abs. co-ord. window for output memorialize */
[1426] static int lx;
[1427] static int ly;
[1428] static int rx;
[1429] static int ry;
[1430] /*---- Return left_y next window */
[1431] int next_left_y;
[1432] /*---- Display window (one time) */
[1433] if (Flag_ini==NOT_INI)
[1434] {
[1435] next_left_y=Wind_2(title,
[1436] col_rect,bk_txt,col_txt,
[1437] &lx,&ly,&rx,&ry /* Abs. co-ord. window for output */);
[1438] return next_left_y;
[1439] }
[1440] /*---- Output to window */
[1441] Wind_out(lx,ly,rx,ry,bk_val,col_val,Fname_exit);
[1442] /*----*/
[1443] return 0;
[1444] }
[1445] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1446] int Regime()
[1447] {
[1448] /*---- Variables */
[1449] char *title="REGIME ";
[1450] int col_rect=WHITE;
[1451] int bk_txt=GREEN;
[1452] int col_txt=WHITE;
[1453] int bk_val=BLACK;
[1454] int col_val=WHITE;
[1455] /*---- Abs. co-ord. window for output memorialize */
[1456] static int lx;
[1457] static int ly;
[1458] static int rx;
[1459] static int ry;
[1460] /*---- Return left_y next window */
[1461] int next_left_y;
[1462] /*---- Display window (one time) */
[1463] if (Flag_ini==NOT_INI)
[1464] {
[1465] next_left_y=Wind_1(title,
[1466] col_rect,bk_txt,col_txt,
[1467] &lx,&ly,&rx,&ry
[1468] /* Abs. co-ord. window for output */);
[1469] return next_left_y;
[1470] }
[1471] /*---- Output to window */
[1472] Wind_out(lx,ly,rx,ry,bk_val,col_val,Regime_work);
[1473] return 0;
[1474] }
[1475] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1476] int Com_num()
[1477] {
[1478] /*---- Variables */
[1479] char *title="COM.NUM";
[1480] int col_rect=WHITE;
[1481] int bk_txt=MAGENTA;
[1482] int col_txt=WHITE;
[1483] int bk_val=BLACK;
[1484] int col_val=WHITE;
[1485] /*---- Abs. co-ord. window for output memorialize */
[1486] static int lx;
[1487] static int ly;
[1488] static int rx;
[1489] static int ry;
[1490] /*---- Return left_y next window */
[1491] int next_left_y;
[1492] /*---- Display window (one time) */
[1493] if (Flag_ini==NOT_INI)
[1494] {
[1495] next_left_y=Wind_1(title,
[1496] col_rect,bk_txt,col_txt,
[1497] &lx,&ly,&rx,&ry
[1498] /* Abs. co-ord. window for output */);
[1499] return next_left_y;
[1500] }
[1501] /*---- Output to window */
[1502] itoa(Number_commands,Str_number_commands,10);
[1503] Wind_out(lx,ly,rx,ry,bk_val,col_val,Str_number_commands);
[1504] /*----*/
[1505] return 0;
[1506] }
[1507] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
[1508] int Com_cnt()
[1509] {
[1510] /*---- Variables */
[1511] char *title="COM.CNT";
[1512] int col_rect=WHITE;
[1513] int bk_txt=MAGENTA;
[1514] int col_txt=WHITE;
[1515] int bk_val=BLACK;
[1516] int col_val=LIGHTGREEN;
[1517] /*---- Abs. co-ord. window for output memorialize */
[1518] static int lx;
[1519] static int ly;
[1520] static int rx;
[1521] static int ry;
[1522] /*---- Return left_y next window */
[1523] int next_left_y;
[1524] /*---- Display window (one time) */
[1525] if (Flag_ini==NOT_INI)
[1526] {
[1527] next_left_y=Wind_1(title,
[1528] col_rect,bk_txt
Историки об Елизавете Петровне: Елизавета попала между двумя встречными культурными течениями, воспитывалась среди новых европейских веяний и преданий...
Автоматическое растормаживание колес: Тормозные устройства колес предназначены для уменьшения длины пробега и улучшения маневрирования ВС при...
Типы сооружений для обработки осадков: Септиками называются сооружения, в которых одновременно происходят осветление сточной жидкости...
Таксономические единицы (категории) растений: Каждая система классификации состоит из определённых соподчиненных друг другу...
© cyberpedia.su 2017-2024 - Не является автором материалов. Исключительное право сохранено за автором текста.
Если вы не хотите, чтобы данный материал был у нас на сайте, перейдите по ссылке: Нарушение авторских прав. Мы поможем в написании вашей работы!