Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ПРОГРАММИРОВАНИЕ_САУ_КМО.doc
Скачиваний:
11
Добавлен:
06.11.2018
Размер:
918.02 Кб
Скачать

17. Файл moddv0.H. Музыкальный центр.

[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: MODDV0.h with BLACK CASE.

[12] MUSIC_CENTER

[13] */

[14] /*################################################ LEGEND */

[15] /*

[16] ----------------

[17] Student: L.V. Doronina

[18] Group: IS 5-94-02 (d)

[19] Code: 94505

[20] ----------------

[21] Discipline: Programming (3403)

[22] Specialty: 2204.01

[23] Teacher: A.E. Stefanovich

[24] ---------------

[25] Year: 2008

[26] */

[27] /*########################################################*/

[28] /*============================= Declarations */

[29] int Dev0_pct(int kx,int ky); /* Picture */

[30] int Dev0_log(int kx,int ky); /* Logic */

[31] int Dev0_bc(); /* Black Case */

[32] /*######################################### SUB_PROGRAMMS */

[33] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/

[34] int Dev0_pct(int kx,int ky) /* Picture */

[35] {

[36] int dx=kx*COL_DRAFT_DEV;

[37] int dy=ky*ROW_DRAFT_DEV;

[38] int x,y;

[39] int c_exe;

[40] /********************************************** Vitrage */

[41] /*---- Viewport*/

[42] clearviewport();

[43] /*---- Ellipse */

[44] setcolor(LIGHTRED);

[45] EllipseN

[46] (dx/2,dy/2,0,360,(dx/2-20)-1,(dy/2-20)-1,2);

[47] setcolor(WHITE);

[48] EllipseN

[49] (dx/2,dy/2,0,360,(dx/2-20)-3,(dy/2-20)-3,4);

[50] setcolor(LIGHTBLUE);

[51] EllipseN

[52] (dx/2,dy/2,0,360,(dx/2-20)-7,(dy/2-20)-7,6);

[53] x=dx/2;

[54] y=dy/2-20;

[55] setfillstyle(SOLID_FILL,BLACK);

[56] floodfill(x,y,LIGHTBLUE);

[57] /*---- Text */

[58] settextstyle(TRIPLEX_FONT,HORIZ_DIR,0);

[59] setusercharsize(3,2,5,1);

[60] settextjustify(CENTER_TEXT,CENTER_TEXT);

[61] setcolor(LIGHTCYAN);

[62] outtextxy(x,y," M U S I C ");

[63] setcolor(LIGHTGRAY);

[64] outtextxy(x-1,y-1," M U S I C ");

[65] setcolor(LIGHTMAGENTA);

[66] outtextxy(x-2,y-2," M U S I C ");

[67] setcolor(LIGHTBLUE);

[68] outtextxy(x-3,y-3," M U S I C ");

[69] /*---- Asterix */

[70] x=30;

[71] y=40;

[72] setcolor(LIGHTCYAN);

[73] outtextxy(x,y," * ");

[74] setcolor(LIGHTGRAY);

[75] outtextxy(x-1,y-1," * ");

[76] setcolor(LIGHTBLUE);

[77] outtextxy(x-2,y-2," * ");

[78] x=dx-30;

[79] y=40;

[80] setcolor(LIGHTCYAN);

[81] outtextxy(x,y," * ");

[82] setcolor(LIGHTGRAY);

[83] outtextxy(x-1,y-1," * ");

[84] setcolor(LIGHTBLUE);

[85] outtextxy(x-2,y-2," * ");

[86] x=30;

[87] y=dy-40;

[88] setcolor(LIGHTCYAN);

[89] outtextxy(x,y," * ");

[90] setcolor(LIGHTGRAY);

[91] outtextxy(x-1,y-1," * ");

[92] setcolor(LIGHTBLUE);

[93] outtextxy(x-2,y-2," * ");

[94] x=dx-30;

[95] y=dy-40;

[96] setcolor(LIGHTCYAN);

[97] outtextxy(x,y," * ");

[98] setcolor(LIGHTGRAY);

[99] outtextxy(x-1,y-1," * ");

[100] setcolor(LIGHTBLUE);

[101] outtextxy(x-2,y-2," * ");

[102] /*********************************************** Logic */

[103] c_exe=(C2*4+C1*2+C0*1);

[104] /*----*/

[105] settextstyle(Font[7],HORIZ_DIR,3);

[106] settextjustify(CENTER_TEXT,CENTER_TEXT);

[107] setcolor(YELLOW);

[108] x=dx/2;

[109] y=dy/2+10;

[110] if(c_exe==0)

[111] {

[112] setcolor(LIGHTBLUE);

[113] outtextxy(x,y," Beethoven ~Sonata 17~ ");

[114] setcolor(YELLOW);

[115] outtextxy(x-1,y-1," Beethoven ~Sonata 17~ ");

[116] sonata17(MODERATO);

[117] }

[118] /*----*/

[119] if(c_exe==1)

[120] {

[121] setcolor(

[122] CYAN);

[123] outtextxy(x,y," Beethoven ~Elise~ ");

[124] setcolor(YELLOW);

[125] outtextxy(x-1,y-1," Beethoven ~Elise~ ");

[126] elise(MODERATO);

[127] }

[128] return 0;

[129] }

[130] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/

[131] int Dev0_log(int kx,int ky) /* Logic */

[132] {

[133] int dx=kx*COL_DRAFT_DEV;

[134] int dy=ky*ROW_DRAFT_DEV;

[135] int x=dx/2,y=dy-5;

[136] /*---- Text */

[137] setcolor(RED);

[138] setbkcolor(BLACK);

[139] settextstyle(SMALL_FONT,HORIZ_DIR,5);

[140] settextjustify(CENTER_TEXT,CENTER_TEXT);

[141] outtextxy(x,y," Logic of Device_0 is not displaied ");

[142] return 0;

[143] }

[144] /*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/

[145] int Dev0_bc() /*Black Case */

[146] {

[147] /*---- Variables */

[148] extern int Flag_ini;

[149] /*----*/

[150] if(Flag_ini==NOT_INI)

[151] {/*--------------------Beguin block NOT_INI */

[152] /*---- Openfile BLACK CASE */

[153] if((FpBC_0=fopen("BLACKcs0","w"))==NULL)

[154] {

[155] ALERT_SIGNAL;

[156] perror("Filure openfile BLACKcs0 "); STOP;

[157] exit(EXIT_FAILURE);

[158] }

[159] /*---- Date, File entry, File exit */

[160] Get_date_pc_counted();

[161] fprintf(FpBC_0,"%s\n",Str_date_pc_counted);

[162] fprintf(FpBC_0,"File entry: %s\n",Fname_entry);

[163] fprintf(FpBC_0,"File exit: BLACKcs0\n");

[164] /*---- Regime */

[165] if(Regime_work[0]=='0')

[166] fprintf(FpBC_0,

[167] "REGIME: 0.\nEXIT\n");

[168] if(Regime_work[0]=='1')

[169] fprintf(FpBC_0,

[170] "EGIME: 1.\nHand Command\n");

[171] if(Regime_work[0]=='2')

[172] fprintf(FpBC_0,

[173] "REGIME: 2.\nHand Time - Hand Command\n");

[174] if(Regime_work[0]=='3')

[175] fprintf(FpBC_0,

[176] "REGIME: 3.\nCommands file. \n Hand Interval const.\n");

[177] if(Regime_work[0]=='4')

[178] fprintf(FpBC_0,

[179] "REGIME: 4.\nCommands file with Intervals variable.\n");

[180] if(Regime_work[0]=='5')

[181] fprintf(FpBC_0,

[182] "REGIME: 5.\nCommands file with Times.\n");

[183] if(Regime_work[0]=='6')

[184] fprintf(FpBC_0,

[185] "REGIME: 6.\nStep by step.\n");

[186] fprintf(FpBC_0,

[187] "###############################################\n");

[188] }/*--------------------End block NOT_INI */

[189] /*==============================*/

[190] if(Flag_ini==YES_INI)

[191] {/*--------------------Beguin block YES_INI */

[192] /*---- Counter com.,H,M,S, ADDRESS, COMMAND */

[193] fprintf(FpBC_0,

[194] "- COUNTER - Hour - Min - Sec - Address - Commands -\n");

[195] fprintf(FpBC_0,

[196] "Counter_commands---,H,M,S\n");

[197] fprintf(FpBC_0,

[198] "%ld---%1d:%1d:%1d\n",

[199] Counter_commands,H,M,S);

[200] /**/

[201] fprintf(FpBC_0,

[202] "A2,A1,A0---,C2,C1,C0\n");

[203] fprintf(FpBC_0,

[204] "%1d%1d%1d---%1d%1d%1d\n",

[205] A2,A1,A0,C2,C1,C0);

[206] /**/

[207] fprintf(FpBC_0,

[208] "AI2,AI1,AI0---,CI2,CI1,CI0\n");

[209] fprintf(FpBC_0,

[210] "%1d%1d%1d---%1d%1d%1d\n",

[211] AI2,AI1,AI0,CI2,CI1,CI0);

[212] /**/

[213] fprintf(FpBC_0,

[214] "###############################################\n");

[215] }/*--------------------End block YES_INI */

[216] /*----*/

[217] return 0;

[218] }

[219] "###############################################\n");

* * *