From aa6ae2b6b0e8cbac507c67e4c5ceb3240257e6b3 Mon Sep 17 00:00:00 2001 From: MukPan Date: Fri, 22 Jul 2022 21:00:55 +0900 Subject: [PATCH] first commit --- CustomClock | Bin 0 -> 50648 bytes CustomClock.c | 491 ++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 + 3 files changed, 493 insertions(+) create mode 100755 CustomClock create mode 100644 CustomClock.c create mode 100644 Makefile diff --git a/CustomClock b/CustomClock new file mode 100755 index 0000000000000000000000000000000000000000..db8d442e365da5dbecb8abff9efb94b0e251e95b GIT binary patch literal 50648 zcmeI4eRx#WoyX5)NHTdNM3G`rAV_r+Ktl*>yIL6-6-am!wB=dAyCE4!IwXN)@&F4w zPBJPlp{!%^g+h0S3hN{oWfkgNOA*P_eJHIp!KW;{>)OyEVG_`7AL~A(D`vmHd+$kZ zE)xjYKK60&0g|G>fIMiEE9q~duBeKyG;&#;8sEV?1 z#;iyF?vX_cNIS4-!2?xSNtEX-92Mp9N0vN3(5%Hf2kL|&V=6*c@=z47d%c%>da>r) zJ3(K}->2zzl4)IiWti~w_0dt38gK22nm&~^-xpK#eCrJllFj)XMm{jqilUU%c&p1R zSM|vQ*XzyK^L=SRBiUTcxk-|l1M-&Sqf+e&dX%*S>^>^XixBG|?Kq zE>)1P$4kGS=FXX4^vJ_=bXr0jx6BJNm9upCQD_XRvP=`gN8BjxG8$~VCSQh3XO-qK z8g>19`ZfLg6GEJXoPsL%7G13*;*%=b1}iTk{e;7N;X=vy>uLi+4|>#`7GX0<8@cuGxHwIt9%8VQ0_vd{A<9+fi~BWi5HbI zsANChg4~pt3lm@hOn?b60Vco%m;e)C0!)AjFaajO1egF5U;<2l2`~XBzyz286JP>N zfC(^xnqq8q& z-=a^2*yR&q8vedNlIHpm+7N7bwrH)>E*>Ynmg8hXV4}=FB{A?fvcEnt@D15F#tGSN zZ8R471ntYhHmvs!)DJCV;ZOJ@`|`IY25ymgmN^3HvM+PKBD9?36Z9|Fa-KlWW0st+ z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5U;<2l2`~XBzyz28 z6JP>NfC(@GCcp%k025#WOn?b60Vco%m;e)C0!)Aj42b}}_fP+3f%)Gfll>tjU?(QP z1egF5U;<2l2`~XBzyz286JP>NfC(@GCcp%k025#WOn?b60Vco%m;e)C0!)AjFaajO z1egF5U;<2l2`~XBzyz286JP>NfC(@GCcp%k025#WOn?b60Vco%m;e)C0!-k~LLeJi z7NTxKO+lr96F`=D*+Dzn+IJ=h;p|sZoGlLZF4VcGPol0z-HQ4$Y8dqt>RHtDa8?wh z##>zCQA)}@%F5#M)dMxFYKyB&g|f=+Eh#Im7Ru_XlH%3g@(Q;Cp~78JvSx!&)>M~Q zdRLN_gyI$79eQeM}4!K3^O@pT;L#|LE8>1)c~@w~e5gXuL;}oG8RFpDvFl z89+zm=BtmCj@;Y8vWr)O1uLmw`%t4%DIe!cAo3h+VzsO8=HB zrj1ut(pD-fX;&5PSm?)1KL>x!(@RUy%AY| zr2>pC$Ft)!q`KyspH6ADxoT^?RTcW;&zxwx>wNdmN3Gd%qWkT0@29z@o;ZK$<7HR2 zbgf=c_WU=Ko1c2^%_UX;*0u8ZuzzoB^TaJ!65qS&@TPxw=0AVdFninNSJR%D^uTX- zkNtSVgrY}J)`UCjUS3xn`oHwEpN|^f>qx5`v+>Mr|2_9u&qK@J`k?0r4`2R{qbU02 zFTSzj`J+3>ocOQ*{mrhUpO%gMY4BJ3vffI#_p{IIPr82{-7tUenf&4d{Xe!RV h^k~uI#o?`KA2jR_cxo!orMG?R2^Kx}Le`GM{|~5rOD_Nb literal 0 HcmV?d00001 diff --git a/CustomClock.c b/CustomClock.c new file mode 100644 index 0000000..eb0a672 --- /dev/null +++ b/CustomClock.c @@ -0,0 +1,491 @@ +#include +#include +#include +#include +//////////関数のプロトタイプを宣言////////// +void printClock(int size, int firstColor, int secondColor, int isAMPM, int isSec, int isDetail, int year, int month, int day, int week, int hour, int min, int sec); +void *func(void *arg); +int errorCheck(int value, int min, int max); +//グローバル変数 +int flag = 1; +int beforeSec = -1; + + +//////////main関数///////////////////// +int main(int argc, const char * argv[]) { + int size = 1; + int firstColor = 0; + int secondColor = 0; + int goUp = 0; + int renewSpeed = 1.0 * 1000000; //初期設定1秒 + int isAMPM = 0; //0:無効, 1:有効 + int isSec = 0; //0:無効, 1:有効 + int isDetail = 0; //0:無効, 1:有効 + int isColonSwitch = 0; //0:無効, 1:有効 + time_t t = time(NULL); + struct tm tm; + localtime_r(&t, &tm); + + //タイトル + printf("\033[1m<>\n\033[0m"); + + //size設定 + printf("サイズ倍率設定(1-10倍)\n: "); + scanf("%d", &size); + if (errorCheck(size, 1, 10)) return 0; + + //年月日曜表示設定(size1のとき無視) + if (size != 1) { + printf("年月日曜表示設定\n"); + printf("(1〜3倍推奨)\n"); + printf("0/無効, 1/有効\n: "); + scanf("%d", &isDetail); + if (errorCheck(isDetail, 0, 1)) return 0; + } + + //firstColor設定 + printf("時分秒(1段目)カラー設定\n"); + printf("0/白, \033[31m1/赤, \033[32m2/緑, \033[33m3/黄, \033[34m4/紫, \033[35m5/ピンク, \033[36m6/水色\n\033[39m: "); + scanf("%d", &firstColor); + if (errorCheck(firstColor, 0, 6)) return 0; + if (firstColor == 0) firstColor = 9; //\033[39m (39は白(デフォルト)) + + //secondColor設定(size1のとき無視) + if (size != 1) { + printf("年月日曜(2段目)カラー設定\n"); + printf("0/白, \033[31m1/赤, \033[32m2/緑, \033[33m3/黄, \033[34m4/紫, \033[35m5/ピンク, \033[36m6/水色\n\033[39m: "); + scanf("%d", &secondColor); + if (errorCheck(secondColor, 0, 6)) return 0; + if (secondColor == 0) secondColor = 9; //\033[39m (39は白(デフォルト)) + } + + //AMPM設定 + printf("AMPM表示設定\n"); + printf("0/無効, 1/有効\n: "); + scanf("%d", &isAMPM); + if (errorCheck(isAMPM, 0, 1)) return 0; + + //秒数表示設定 + printf("秒数表示設定\n"); + printf("0/無効, 1/有効\n: "); + scanf("%d", &isSec); + if (errorCheck(isSec, 0, 1)) return 0; + + //一部設定反映 + goUp = size * 5; + if (size != 1 && isDetail == 1) { + goUp += 6;//曜日分も底上げ + } + + if (isSec == 0) { + renewSpeed /= 2; //コンマ点滅用(0.5秒) + } + + /////本体///// + printf("enter/returnキーで終了します.\n"); + //スレッド作成 + pthread_t th[1]; + pthread_create(&th[0], NULL, func, NULL); + //本体 + while (flag) { + usleep(renewSpeed);//(0.50s or 1.0s) + time_t t = time(NULL); + localtime_r(&t, &tm); + printClock( + size, firstColor, secondColor, isAMPM, isSec, isDetail,//各種設定 + tm.tm_year+1900, tm.tm_mon+1 ,tm.tm_mday, tm.tm_wday,//年月日曜 + tm.tm_hour, tm.tm_min, tm.tm_sec//時分秒 + ); + printf("\033[%dF", goUp);//カーソルを5*size+6行上に移動 + printf("\033[2K");//全体削除 + } + printf("\033[1F");//カーソルを先頭 + printf("\033[2K");//全体削除 + printf("\033[39mCustomClockを終了します.\n"); + printf("\033[1m<>\n\033[0m"); + return 0; +} + + +//////////関数///////////////////////// +/*errorCheck関数*/ +//入力可能範囲と入力された値を与え、問題があるとプログラムを終了する +int errorCheck(int value, int min, int max) { + if (value >= min && value <= max) { + return 0; + } else { + printf("不正な値が入力されました.\nプログラムを終了します.\n"); + printf("\033[1m<>\n\033[0m"); + return 1; + } +} + +/*func関数*/ +//flag管理用マルチスレッド、本体起動時にreturnキーを押すと終了する +void *func(void *arg) { + getchar(); //1度だけだと本体が起動した瞬間終了してしまう + getchar(); + flag = 0; + return NULL; +} + +/*printClock関数*/ +//設定内容と現在時刻を与えると時計を表示する +void printClock(int size, int firstColor, int secondColor, int isAMPM, int isSec, int isDetail, int year, int month, int day, int week, int hour, int min, int sec) { + /////1段目///// + int AMorPM = 0; //0:無効, 1:AM, 2:PM + int colonSwitch = 10; //デフォルトでコロン(10)表示 + //AMPMdata[AMorPM0-2][0-3] + int AMPMdata[3][4] = { + {29, 29, 29, 29}, //{ } + {12, 11, 18, 28}, //{A M } + {21, 11, 18, 28}, //{P M } + }; + + //secData[isSec0-1][0-4] + int secData[2][5] = { + {29, 29, 29, 29, 29}, //{} + {10, 11, sec/10, 11, sec%10}, //{: 5 6} + }; + + //コロンの点滅処理 + if (isSec == 0) { + if (beforeSec == sec) { + colonSwitch = 28; //消す + } + beforeSec = sec; + } + + //AMPM表記に変換 + if (isAMPM == 1) { + if (hour < 12) { + AMorPM = 1; + } else { + AMorPM = 2; + } + if ((hour == 0 || hour == 12) && min == 0 && sec == 0) { + hour = 12; //00:00:00, 12:00:00 → PM/AM 12:00:00 + } else { + hour %= 12; //ex. 23:00:00 → PM 11:00:00 //ex. 12:00:01 → PM 00:00:01 + } + } + + //時分秒を配列にまとめる ex.{A M[]0 1 : 2 3 : 4 5} + //[10]コロン, [11]空白, [28]空白文字, [29]詰文字 + int HMSdata[19] = { + AMPMdata[AMorPM][0], AMPMdata[AMorPM][1], AMPMdata[AMorPM][2] ,AMPMdata[AMorPM][3],//{A M[]} + hour/10, 11, hour%10, 11, colonSwitch, 11,//{1 2 : } + min/10, 11, min%10, 11, secData[isSec][0], secData[isSec][1],//{3 4 : } + secData[isSec][2], secData[isSec][3], secData[isSec][4],//{5 6} + }; + + + /////2段目///// + //Wdata[week日0-土6][5] + int Wdata[7][3] = { + {23, 25, 19},//日(SUN) + {18, 20, 19},//月(MON) + {24, 25, 14},//火(TUE) + {26, 14, 13},//水(WED) + {24, 16, 25},//木(THU) + {15, 22, 17},//金(FRI) + {23, 12, 24},//土(SAT) + }; + + //年月日曜を配列にまとめる ex.{2 0 2 2 / 0 7 / 1 4 / T H U} + int YMDWdata[28] = { + year/1000, 11, year%1000/100, 11, year%100/10, 11, year%10, 11, 27, 11,//{2 0 2 2 / } + month/10, 11, month%10, 11, 27, 11,//{0 7 / } + day/10, 11, day%10, 11, 27, 11,//{1 4 / } + Wdata[week][0], 11, Wdata[week][1], 11, Wdata[week][2], 28//{T H U[ ]} + }; + + /////デジタル表記///// + //1:■, 0:空白, -1:詰める + int bigList[30][5][5] = { + //[0]0 + { + {1, 1, 1, 1, 1}, + {1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + }, + //[1]1 + { + {0, 0, 0, 0, 1}, + {0, 0, 0, 0, 1}, + {0, 0, 0, 0, 1}, + {0, 0, 0, 0, 1}, + {0, 0, 0, 0, 1}, + }, + //[2]2 + { + {1, 1, 1, 1, 1}, + {0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0}, + {1, 1, 1, 1, 1}, + }, + //[3]3 + { + {1, 1, 1, 1, 1}, + {0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + {0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + }, + //[4]4 + { + {1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + {0, 0, 0, 0, 1}, + {0, 0, 0, 0, 1}, + }, + //[5]5 + { + {1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0}, + {1, 1, 1, 1, 1}, + {0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + }, + //[60]6 + { + {1, 1, 1, 1, 1}, + {1, 0, 0, 0, 0}, + {1, 1, 1, 1, 1}, + {1, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + }, + //[7]7 + { + {1, 1, 1, 1, 1}, + {0, 0, 0, 0, 1}, + {0, 0, 0, 0, 1}, + {0, 0, 0, 0, 1}, + {0, 0, 0, 0, 1}, + }, + //[8]8 + { + {1, 1, 1, 1, 1}, + {1, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + {1, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + }, + //[9]9 + { + {1, 1, 1, 1, 1}, + {1, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + {0, 0, 0, 0, 1}, + {1, 1, 1, 1, 1}, + }, + //[10]コロン + { + {0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0}, + }, + //[11]空白 + { + {-1, -1, 0, -1, -1}, + {-1, -1, 0, -1, -1}, + {-1, -1, 0, -1, -1}, + {-1, -1, 0, -1, -1}, + {-1, -1, 0, -1, -1}, + }, + //[12]A + { + {0, 1, 1, 0, -1}, + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + {1, 1, 1, 1, -1}, + {1, 0, 0, 1, -1}, + }, + //[13]D + { + {1, 1, 1, 0, -1}, + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + {1, 1, 1, 0, -1}, + }, + //[14]E + { + {1, 1, 1, 1, -1}, + {1, 0, 0, 0, -1}, + {1, 1, 1, 0, -1}, + {1, 0, 0, 0, -1}, + {1, 1, 1, 1, -1}, + }, + //[15]F + { + {1, 1, 1, 1, -1}, + {1, 0, 0, 0, -1}, + {1, 1, 1, 0, -1}, + {1, 0, 0, 0, -1}, + {1, 0, 0, 0, -1}, + }, + //[16]H + { + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + {1, 1, 1, 1, -1}, + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + }, + //[17]I + { + {1, 1, 1, -1, -1}, + {0, 1, 0, -1, -1}, + {0, 1, 0, -1, -1}, + {0, 1, 0, -1, -1}, + {1, 1, 1, -1, -1}, + }, + //[18]M + { + {1, 0, 0, 0, 1}, + {1, 1, 0, 1, 1}, + {1, 0, 1, 0, 1}, + {1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1}, + }, + //[19]N + { + {1, 0, 0, 0, 1}, + {1, 1, 0, 0, 1}, + {1, 0, 1, 0, 1}, + {1, 0, 0, 1, 1}, + {1, 0, 0, 0, 1}, + }, + //[20]O + { + {0, 1, 1, 0, -1}, + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + {0, 1, 1, 0, -1}, + }, + //[21]P + { + {1, 1, 1, 0, -1}, + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + {1, 1, 1, 0, -1}, + {1, 0, 0, 0, -1}, + }, + //[22]R + { + {1, 1, 1, 0, -1}, + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + {1, 1, 1, 0, -1}, + {1, 0, 0, 1, -1}, + }, + //[23]S + { + {0, 1, 1, 1, -1}, + {1, 0, 0, 0, -1}, + {0, 1, 1, 0, -1}, + {0, 0, 0, 1, -1}, + {1, 1, 1, 0, -1}, + }, + //[24]T + { + {1, 1, 1, 1, 1}, + {0, 0, 1, 0, 0}, + {0, 0, 1, 0, 0}, + {0, 0, 1, 0, 0}, + {0, 0, 1, 0, 0}, + }, + //[25]U + { + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + {1, 0, 0, 1, -1}, + {0, 1, 1, 0, -1}, + }, + //[26]W + { + {1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1}, + {1, 0, 1, 0, 1}, + {1, 0, 1, 0, 1}, + {0, 1, 0, 1, 0}, + }, + //[27]スラッシュ + { + {0, 0, 0, 0, 1}, + {0, 0, 0, 1, 0}, + {0, 0, 1, 0, 0}, + {0, 1, 0, 0, 0}, + {1, 0, 0, 0, 0}, + }, + //[28]空白文字 //曜日が切り替わる時、表示が残るのを防ぐ + { + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, + }, + //[29]詰文字 //AMPMが無効になっている時、詰める + { + {-1, -1, -1, -1, -1}, + {-1, -1, -1, -1, -1}, + {-1, -1, -1, -1, -1}, + {-1, -1, -1, -1, -1}, + {-1, -1, -1, -1, -1}, + }, + }; + +/////出力部分///// + + //1段目 + //出力[size(時分秒)] + for (int i = 0; i < 5; i++) { + //size(縦幅5*size) + for (int j = 0; j < size; j++) { + //全文字分の行を構成 HMSdata[0-18] + for (int k = 0; k < 19; k++) { + //1文字分の行を構成 + for (int l = 0; l < 5; l++) { + //size(横幅5*size) + for (int m = 0; m < size; m++) { + if (bigList[HMSdata[k]][i][l] == 1) { + printf("\033[3%dm■", firstColor); + } else if (bigList[HMSdata[k]][i][l] == 0) { + putchar(' '); + } + } + } + } + putchar('\n'); + } + } + //2段目 + if (size != 1 && isDetail == 1) { + putchar('\n');//1行空ける + //出力[曜日] + for (int i = 0; i < 5; i++) { + //全文字分の行を構成 YMDWdata[0-27] + for (int j = 0; j < 28; j++) { + //1文字分の行を構成 + for (int k = 0; k < 5; k++) { + if (bigList[YMDWdata[j]][i][k] == 1) { + printf("\033[3%dm■", secondColor); + } else if (bigList[YMDWdata[j]][i][k] == 0) { + putchar(' '); + } + } + } + putchar('\n'); + } + } +} \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..82a114e --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +CustomClock: CustomClock.c + gcc -o CustomClock CustomClock.c \ No newline at end of file