From acad9342386a11b3c425b6c7ba7ed9908e257f51 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 12:27:21 +0800 Subject: [PATCH 01/15] (FEA) Now Compound is featured with indexer displaying while printing. --- Status/StatusTest | Bin 0 -> 22632 bytes Status/include/status.h | 5 +- Status/status_test.c | 213 +++++++++++++++++++++ Var/VarTest | Bin 0 -> 18424 bytes Var/test.c | 26 +++ catlog.c | 1 - test.c | 408 +++++++++++++++++++++++++++++++++++++++- 7 files changed, 647 insertions(+), 6 deletions(-) create mode 100755 Status/StatusTest create mode 100644 Status/status_test.c create mode 100755 Var/VarTest create mode 100644 Var/test.c diff --git a/Status/StatusTest b/Status/StatusTest new file mode 100755 index 0000000000000000000000000000000000000000..f00539fc52dcb44525e5cf15b1068652db2a2aa3 GIT binary patch literal 22632 zcmeHPdwknhb-!2g&z9rFmgA&xnzm8ey!wbO$&Wg(R&L@%aUL~!G%jN(jwIVkY)O&i z)D0BO+>{#6!x?nVAfFLF&;g@t?kFr!I@EW=fRA|$Jhm}!Q0me$%o?Z}Q16_3?$J-W ziCf10*k}9Xm-u(?Ip_O5_x#T9b$>ry>D?{6wmGB}yg0=z0<}YKvIMlF`*z&`5fDvc z0jyVw>qIf=MaoA0015EYGT|tcE^T*$L|!#EE+MZXvtY>?qD0Zd8XW|@hq_qT=ujH>vHA2rl&+j#z2V-s{{3J5 z1~IrD7!xtLpbh_cK_CCI?YEH&0fc|%(gOyMX#^enxD>u_4*P~V?DvD+1Apf7AQ(KR z5%iVtckLzYA{0tzI>JXo;qIfM&W>0Q7+{x$(VEJHdOKoqu!Q?NLY=XAM^EfTR3uZe zc&1aNGpTTIQXm+2XQSA@YsYO{LjD?mO+&6-pKI0Ci_nh!yF-y^D%urGXQHY7ySMZt z;?eybhkK&XM^|qmu6qp;^pZf>1~>*_e;2_&I6CxRL`yUH_;~HRGFFOvc&D~4ipAi{ zTR5_GQ|hH0(EN z`>0_LX!}{i&ipaM-mURj!_N3|!#=9~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8sV&YEaAhqQy`L438Aw=j=Q zpMgex|2%GDY0xh^em|@ETz}!wk+pnP?+n6L{Dt=)+r9-2{JdPBwz=P(y?uRt$i`ys{=>E+-nQxwdoDRz?G(SHk zww->m93qihGmj0c=HQ1l|K?Igk~I0gIrtyiNcemC#L!_({;hNHufY#5VEM~8;p6iU z#x(2q)c~^L`whnV%l)&wV-Eh)+lW6xBDZEDDLwwV>jhNj@I<{)Oe` gV}}^D&h8|6ixHgrWo#uhF2#R+Hz7I=f}x840$grF`Tzg` literal 0 HcmV?d00001 diff --git a/Status/include/status.h b/Status/include/status.h index bd11e72..987c2d8 100644 --- a/Status/include/status.h +++ b/Status/include/status.h @@ -76,7 +76,7 @@ typedef struct _Status { # define LOCATION_LITERALISE_FORMAT "at %s:%d, in function `%s\'" # define STATUS_LITERALISE_FORMAT \ - "%s: \"%s\"\n\tpredecessor=<%s> value=(%d) characteristic=[%d]\n\t%s\n" + "%s: \"%s\"\n\tpredecessor=<%s> value=(%d) characteristic=(%d)\n\t%s\n" typedef enum { REPORT_SENDING_PRIORITY_ALL = 0, // Highest level; least value. @@ -420,7 +420,10 @@ static inline void PrintStatusDump(Status s) /* Output by iterating. */ for (register int i = 0; i < dump_len; i++) { + /* Print out indexer. */ + (void)printf("\e[1m[%d/%d]\e[0m", (dump_len - i), dump_len); + /* Print dumped status. */ unsure(PrintStatus(dump[i]), !_.value, { (void)fprintf(stderr, "Unable to literalise.\n"); }) diff --git a/Status/status_test.c b/Status/status_test.c new file mode 100644 index 0000000..f5fbe23 --- /dev/null +++ b/Status/status_test.c @@ -0,0 +1,213 @@ +#include +#include + +#include + +int main(void) { + + Status Example1Status = {.description = "Example1 Status", + .characteristic = STATUS_NORMAL, + .prev = &NormalStatus}; + Status Example2Status = {.description = "Example2 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example1Status}; + Status Example3Status = {.description = "Example3 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example2Status}; + Status Example4Status = {.description = "Example4 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example3Status}; + Status Example5Status = {.description = "Example5 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example4Status}; + Status Example6Status = {.description = "Example6 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example5Status}; + Status Example7Status = {.description = "Example7 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example6Status}; + Status Example8Status = {.description = "Example8 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example7Status}; + Status Example9Status = {.description = "Example9 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example8Status}; + Status Example10Status = {.description = "Example10 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example9Status}; + Status Example11Status = {.description = "Example11 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example10Status}; + Status Example12Status = {.description = "Example12 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example11Status}; + Status Example13Status = {.description = "Example13 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example12Status}; + Status Example14Status = {.description = "Example14 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example13Status}; + Status Example15Status = {.description = "Example15 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example14Status}; + Status Example16Status = {.description = "Example16 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example15Status}; + Status Example17Status = {.description = "Example17 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example16Status}; + Status Example18Status = {.description = "Example18 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example17Status}; + Status Example19Status = {.description = "Example19 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example18Status}; + Status Example20Status = {.description = "Example20 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example19Status}; + Status Example21Status = {.description = "Example21 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example20Status}; + Status Example22Status = {.description = "Example22 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example21Status}; + Status Example23Status = {.description = "Example23 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example22Status}; + Status Example24Status = {.description = "Example24 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example23Status}; + Status Example25Status = {.description = "Example25 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example24Status}; + Status Example26Status = {.description = "Example26 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example25Status}; + Status Example27Status = {.description = "Example27 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example26Status}; + Status Example28Status = {.description = "Example28 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example27Status}; + Status Example29Status = {.description = "Example29 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example28Status}; + Status Example30Status = {.description = "Example30 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example29Status}; + Status Example31Status = {.description = "Example31 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example30Status}; + Status Example32Status = {.description = "Example32 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example31Status}; + Status Example33Status = {.description = "Example33 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example32Status}; + Status Example34Status = {.description = "Example34 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example33Status}; + Status Example35Status = {.description = "Example35 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example34Status}; + Status Example36Status = {.description = "Example36 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example35Status}; + Status Example37Status = {.description = "Example37 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example36Status}; + Status Example38Status = {.description = "Example38 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example37Status}; + Status Example39Status = {.description = "Example39 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example38Status}; + Status Example40Status = {.description = "Example40 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example39Status}; + Status Example41Status = {.description = "Example41 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example40Status}; + Status Example42Status = {.description = "Example42 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example41Status}; + Status Example43Status = {.description = "Example43 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example42Status}; + Status Example44Status = {.description = "Example44 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example43Status}; + Status Example45Status = {.description = "Example45 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example44Status}; + Status Example46Status = {.description = "Example46 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example45Status}; + Status Example47Status = {.description = "Example47 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example46Status}; + Status Example48Status = {.description = "Example48 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example47Status}; + Status Example49Status = {.description = "Example49 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example48Status}; + Status Example50Status = {.description = "Example50 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example49Status}; + Status Example51Status = {.description = "Example51 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example50Status}; + Status Example52Status = {.description = "Example52 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example51Status}; + Status Example53Status = {.description = "Example53 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example52Status}; + Status Example54Status = {.description = "Example54 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example53Status}; + Status Example55Status = {.description = "Example55 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example54Status}; + Status Example56Status = {.description = "Example56 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example55Status}; + Status Example57Status = {.description = "Example57 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example56Status}; + Status Example58Status = {.description = "Example58 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example57Status}; + Status Example59Status = {.description = "Example59 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example58Status}; + Status Example60Status = {.description = "Example60 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example59Status}; + Status Example61Status = {.description = "Example61 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example60Status}; + Status Example62Status = {.description = "Example62 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example61Status}; + Status Example63Status = {.description = "Example63 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example62Status}; + Status Example64Status = {.description = "Example64 Status", + .characteristic = STATUS_NORMAL, + .prev = &Example63Status}; + + Status statbuff[64] = {{0}}; + + status_dump(Example64Status, statbuff, 0); + + Status *p = &Example64Status; + int cnt = 0; + while (p != NULL) { + (void)printf("%d:%d %s\n", cnt++, p->characteristic, p->description); + p = p->prev; + }; + + return 0; +} diff --git a/Var/VarTest b/Var/VarTest new file mode 100755 index 0000000000000000000000000000000000000000..33e0e106c6c0d50d31e70401e36ce1f301cb7c00 GIT binary patch literal 18424 zcmeHPdu$xXd7s_A6_4WkrDq+U9m!Rk@{ZKYq7+J}2j!(BS+X8(4OcxM@0R2>fK!T;#yxNAJK6c*PL-A5^hoB7B$Y} zy1hlsIi3^~I(F&v2=X|}h~hF8B8Z#TxFA2I?U_>>L?>S^rhlIHj%!>zBC8QWzFnyW zb8hc`;3zIXD{(iU(Cw|%58XQc%yn2rY&0{tb9-zw-8GuYPE2=A@7me5b9=Oqi*A)J zkYC+6XiVL6-)Ui<6Z52FydjJV+0-&jB#~`94hlQrU!HX{dp|mP+u!bf_W9&@w!eAy zpRPVcHgq0TC)p5@jt(X&rqRFa%X6pG2z2NJ1~4`-939Q2P>AkMkww0k z7)xfd(4?l5iJ?q3Ihr}^io(=*K9emD39_S6uv6S~WZ=NT#MbC`FSqShc58HpNDQ1h znn=5OcQ{ihy7^N_502)t?y2P9sEg`{$8uTSU_zNLYbb%KDgQCu#T_)RTOY{=A7UBi%xcs}BJV7x`?7xa9?`iRzd$5lD&S)Qkk z2GO;tFC{5I=hN${Me48l^#1F4!Ka6#9xeLxt353;aV5}nPh*fN99KEg`>&H`pI+Vv zl$luP)9YJ@EQ$E^e9jtDWz`5&BT$V%H3HQLR3lK0!2jzAywUWoH=XmZhMgJvN=yjn z!hF#zUvtj?b@-}0ukwx;pe}EI5ouFr966FlsO+hMD-wb7Wll-W$#r zoY@PchS6nZB-zZYteGqLj#GMO=^qF)qs&UrAjaRvGlf%nR@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O|wM|64&P2cq#$#5nH9A3;YZjOTsi^D(j(VvAy4%6R5K zMTsBJ?}L{#KJFn^hH=bIfc7FuUz>YH zj1OLajAy<^<2|6xoYWOQ94KHMt2eKJ|FXvK;1kn;Aiie>{L(fB_#j^xE8zF7fKStn z4RmLq!GI{r5r`z2j?2SmCC scs%g^s}{OIh$S#gZ>B+i#0@D?j#ZtNtOe + +int main(void) +{ + Var v1 = { + .addr = malloc(sizeof(int)), + .sz = sizeof(int) + }; + + Var v2 = (Var){v1.addr, v1.sz}; + + wchar_t wbuff[UINT8_MAX + 1] = {}; + wchar_t *wp = wbuff; + + (void)var_literalise(v1, &wp); + + (void)wprintf(L"%ls\n", wp); + + (void)var_literalise(v2, &wp); + + (void)wprintf(L"%ls\n", wp); + + free(v1.addr); + + return 0; +} diff --git a/catlog.c b/catlog.c index 7d3fb57..b1a3ea2 100644 --- a/catlog.c +++ b/catlog.c @@ -1,4 +1,3 @@ -#include "Status/include/status.h" #include #include #include diff --git a/test.c b/test.c index 2966dc0..8b43185 100644 --- a/test.c +++ b/test.c @@ -43,7 +43,410 @@ Status Main(void) // PrintStatusDump(unknown(normal(MaximumLiteralisationLengthExceeded, ":O"), "OMGIDKWTD", 1)); // PrintStatusDump(apply(extend(MaximumLiteralisationLengthExceeded, normal(UnavailableBuffer, "OMGIDKWTD")))); - PrintStatusDump(MaximumLiteralisationLengthExceeded); + // PrintStatusDump(MaximumLiteralisationLengthExceeded); + + DEFSTATUS(TestStatus0, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &MaximumLiteralisationLengthExceeded); + + DEFSTATUS(TestStatus1, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus0); + + DEFSTATUS(TestStatus2, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus1); + + DEFSTATUS(TestStatus3, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus2); + + DEFSTATUS(TestStatus4, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus3); + + DEFSTATUS(TestStatus5, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus4); + + DEFSTATUS(TestStatus6, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus5); + + DEFSTATUS(TestStatus7, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus6); + + DEFSTATUS(TestStatus8, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus7); + + DEFSTATUS(TestStatus9, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus8); + + DEFSTATUS(TestStatus10, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus9); + + DEFSTATUS(TestStatus11, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus10); + + DEFSTATUS(TestStatus12, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus11); + + DEFSTATUS(TestStatus13, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus12); + + DEFSTATUS(TestStatus14, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus13); + + DEFSTATUS(TestStatus15, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus14); + + DEFSTATUS(TestStatus16, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus15); + + DEFSTATUS(TestStatus17, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus16); + + DEFSTATUS(TestStatus18, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus17); + + DEFSTATUS(TestStatus19, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus18); + + DEFSTATUS(TestStatus20, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus19); + + DEFSTATUS(TestStatus21, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus20); + + DEFSTATUS(TestStatus22, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus21); + + DEFSTATUS(TestStatus23, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus22); + + DEFSTATUS(TestStatus24, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus23); + + DEFSTATUS(TestStatus25, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus24); + + DEFSTATUS(TestStatus26, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus25); + + DEFSTATUS(TestStatus27, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus26); + + DEFSTATUS(TestStatus28, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus27); + + DEFSTATUS(TestStatus29, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus28); + + DEFSTATUS(TestStatus30, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus29); + + DEFSTATUS(TestStatus31, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus30); + + DEFSTATUS(TestStatus32, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus31); + + DEFSTATUS(TestStatus33, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus32); + + DEFSTATUS(TestStatus34, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus33); + + DEFSTATUS(TestStatus35, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus34); + + DEFSTATUS(TestStatus36, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus35); + + DEFSTATUS(TestStatus37, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus36); + + DEFSTATUS(TestStatus38, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus37); + + DEFSTATUS(TestStatus39, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus38); + + DEFSTATUS(TestStatus40, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus39); + + DEFSTATUS(TestStatus41, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus40); + + DEFSTATUS(TestStatus42, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus41); + + DEFSTATUS(TestStatus43, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus42); + + DEFSTATUS(TestStatus44, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus43); + + DEFSTATUS(TestStatus45, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus44); + + DEFSTATUS(TestStatus46, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus45); + + DEFSTATUS(TestStatus47, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus46); + + DEFSTATUS(TestStatus48, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus47); + + DEFSTATUS(TestStatus49, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus48); + + DEFSTATUS(TestStatus50, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus49); + + DEFSTATUS(TestStatus51, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus50); + + DEFSTATUS(TestStatus52, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus51); + + DEFSTATUS(TestStatus53, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus52); + + DEFSTATUS(TestStatus54, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus53); + + DEFSTATUS(TestStatus55, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus54); + + DEFSTATUS(TestStatus56, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus55); + + DEFSTATUS(TestStatus57, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus56); + + DEFSTATUS(TestStatus58, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus57); + + DEFSTATUS(TestStatus59, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus58); + + DEFSTATUS(TestStatus60, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus59); + + DEFSTATUS(TestStatus61, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus60); + + DEFSTATUS(TestStatus62, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus61); + + DEFSTATUS(TestStatus63, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus62); + + DEFSTATUS(TestStatus64, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus63); + + DEFSTATUS(TestStatus65, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus64); + + DEFSTATUS(TestStatus66, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus65); + + DEFSTATUS(TestStatus67, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus66); + + DEFSTATUS(TestStatus68, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus67); + + DEFSTATUS(TestStatus69, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus68); + + DEFSTATUS(TestStatus70, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus69); + + DEFSTATUS(TestStatus71, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus70); + + DEFSTATUS(TestStatus72, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus71); + + DEFSTATUS(TestStatus73, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus72); + + DEFSTATUS(TestStatus74, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus73); + + DEFSTATUS(TestStatus75, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus74); + + DEFSTATUS(TestStatus76, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus75); + + DEFSTATUS(TestStatus77, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus76); + + DEFSTATUS(TestStatus78, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus77); + + DEFSTATUS(TestStatus79, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus78); + + DEFSTATUS(TestStatus80, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus79); + + DEFSTATUS(TestStatus81, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus80); + + DEFSTATUS(TestStatus82, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus81); + + DEFSTATUS(TestStatus83, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus82); + + DEFSTATUS(TestStatus84, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus83); + + DEFSTATUS(TestStatus85, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus84); + + DEFSTATUS(TestStatus86, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus85); + + DEFSTATUS(TestStatus87, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus86); + + DEFSTATUS(TestStatus88, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus87); + + DEFSTATUS(TestStatus89, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus88); + + DEFSTATUS(TestStatus90, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus89); + + DEFSTATUS(TestStatus91, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus90); + + DEFSTATUS(TestStatus92, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus91); + + DEFSTATUS(TestStatus93, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus92); + + DEFSTATUS(TestStatus94, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus93); + + DEFSTATUS(TestStatus95, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus94); + + DEFSTATUS(TestStatus96, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus95); + + DEFSTATUS(TestStatus97, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus96); + + DEFSTATUS(TestStatus98, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus97); + + DEFSTATUS(TestStatus99, 1, + "This status is used for displaying multi-layer of status dumping.", + STATUS_NORMAL, &TestStatus98); + + + PrintStatusDump(apply(TestStatus99)); return apply(NormalStatus); } @@ -52,6 +455,3 @@ int main(void) { return Main().value; } - - - From f88b2b5b021ee5eed998f012dc69632db35fd5cf Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 13:07:03 +0800 Subject: [PATCH 02/15] (MOD) Disabled some parameters for C compiler in order to run github action successfully. --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bae425e..bdc4980 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,16 +5,16 @@ project (Compound) set(CMAKE_C_COMPILER gcc) set(WALL -Waddress - -Warray-compare + # -Warray-compare -Warray-parameter=2 -Wbool-compare -Wbool-operation -Wchar-subscripts -Wcomment -Wdangling-else - -Wdangling-pointer=2 + # -Wdangling-pointer=2 -Wenum-compare - -Wenum-int-mismatch + # -Wenum-int-mismatch -Wformat=1 -Wformat-contains-nul -Wformat-diag @@ -26,7 +26,7 @@ set(WALL -Waddress -Wimplicit -Wimplicit-function-declaration -Wimplicit-int - -Winfinite-recursion + # -Winfinite-recursion -Wint-in-bool-context -Wlogical-not-parentheses -Wmain @@ -65,7 +65,7 @@ set(WALL -Waddress -Wunused-local-typedefs -Wunused-value -Wunused-variable - -Wuse-after-free=2 + # -Wuse-after-free=2 -Wvla-parameter -Wvolatile-register-var -Wzero-length-bounds From bc3fd9dfadb42c8438640ae38e0414daa4f89e0d Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 13:11:34 +0800 Subject: [PATCH 03/15] (MOD) Modified file install that added auto-creating directory in need. --- install | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/install b/install index 05df022..6057dbb 100755 --- a/install +++ b/install @@ -14,6 +14,11 @@ DST=/usr/include/Compound PROJ=("Array" "Paper" "Pen" "Render" "Status" "Var" "MemMan" "Stack" "Utils"\ "String" "Object") +# Create directory. +if [ ! -d "$DST" ]; then + mkdir -pv "$DST" +fi + PROJLEN=${#PROJ[*]} echo "======== $PROJLEN projects in total ========" From 242fcce9519ad9b1bc46275a3a9800cf2bf5cdf6 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 13:52:54 +0800 Subject: [PATCH 04/15] (MOD) Modified github action file for testing for extra step required by project. --- .github/workflows/cmake-multi-platform.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 13a9849..b29e723 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -75,3 +75,7 @@ jobs: # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ctest --build-config ${{ matrix.build_type }} + + - name: Install + # By running "install" script to install project header files and shared object file later on after the compilation. + run: ./install From 092dddf6c4dbf102573afd84c38ba3784f426274 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 13:58:54 +0800 Subject: [PATCH 05/15] (MOD) Changed effecting branch from "master" to "github_action_test" which is more reasonable since this is testing on branch github_action_test. --- .github/workflows/cmake-multi-platform.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index b29e723..195cda8 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -6,9 +6,9 @@ on: schedule: - cron: "0 2 * * 1-5" push: - branches: [ "master" ] + branches: [ "github_action_test" ] pull_request: - branches: [ "master" ] + branches: [ "github_action_test" ] jobs: build: From 55d9ddef39fa2593fe3d63d739bfd21a885aba15 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 14:15:17 +0800 Subject: [PATCH 06/15] (MOD) Added more steps for project building. --- .github/workflows/cmake-multi-platform.yml | 12 ++++++++---- postinstall | 6 ++++++ install => preinstall | 5 ++--- 3 files changed, 16 insertions(+), 7 deletions(-) create mode 100755 postinstall rename install => preinstall (93%) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 195cda8..4a2d459 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -66,16 +66,20 @@ jobs: -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -S ${{ github.workspace }} + - name: PreInstall + # Perform pre-installation. + run: ./preinstall + - name: Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + - name: PostInstall + # Perform post-installation. + run: ./postinstall + - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ctest --build-config ${{ matrix.build_type }} - - - name: Install - # By running "install" script to install project header files and shared object file later on after the compilation. - run: ./install diff --git a/postinstall b/postinstall new file mode 100755 index 0000000..12dd101 --- /dev/null +++ b/postinstall @@ -0,0 +1,6 @@ +#!/bin/sh + +# Install Compound library. +echo "Installing libcompound:" +cp -v "libcompound.so" "/usr/lib" + diff --git a/install b/preinstall similarity index 93% rename from install rename to preinstall index 6057dbb..4f94d2a 100755 --- a/install +++ b/preinstall @@ -19,6 +19,7 @@ if [ ! -d "$DST" ]; then mkdir -pv "$DST" fi +# Install project-like headers. PROJLEN=${#PROJ[*]} echo "======== $PROJLEN projects in total ========" @@ -38,11 +39,9 @@ while :; do echo done +# Install individual headers. cp -v "common.h" "const.h" "platform.h"\ "name.h" "namescope.h" "type.h" "catlog.h"\ "attr.h" "registry.h" "class.h" "function.h" "$DST" -echo "Installing libcompound:" -cp -v "libcompound.so" "/usr/lib" - printf "\nDone\n" From 5026f03692102631de78f319118e917cc103adc8 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 14:50:37 +0800 Subject: [PATCH 07/15] (MOD) Added a feature where it displays the current user identity once it's not root. --- postinstall | 5 +++++ preinstall | 8 ++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/postinstall b/postinstall index 12dd101..4378197 100755 --- a/postinstall +++ b/postinstall @@ -1,5 +1,10 @@ #!/bin/sh +if [ "$(whoami)" != "root" ]; then + echo "The script require root privilege to execute properly. Current identity: $(whoami)" + exit 1 +fi + # Install Compound library. echo "Installing libcompound:" cp -v "libcompound.so" "/usr/lib" diff --git a/preinstall b/preinstall index 4f94d2a..cbf5c87 100755 --- a/preinstall +++ b/preinstall @@ -1,14 +1,10 @@ #!/bin/sh -if [ "`whoami`" != "root" ]; then - echo "The script require root privilege to execute properly." +if [ "$(whoami)" != "root" ]; then + echo "The script require root privilege to execute properly. Current identity: $(whoami)" exit 1 fi -# echo "Please ensure the current work directory is the home directory to the project Compound! -# Press enter key to continue..." -# read - SRC="$PWD" DST=/usr/include/Compound PROJ=("Array" "Paper" "Pen" "Render" "Status" "Var" "MemMan" "Stack" "Utils"\ From acaa38099fd0fa85efd014140794b4b2a0086c00 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 14:56:12 +0800 Subject: [PATCH 08/15] (MOD) Added "sudo" before "./preinstall" as well as "./postinstall". --- .github/workflows/cmake-multi-platform.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 4a2d459..9c11a42 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -68,7 +68,7 @@ jobs: - name: PreInstall # Perform pre-installation. - run: ./preinstall + run: sudo ./preinstall - name: Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). @@ -76,7 +76,7 @@ jobs: - name: PostInstall # Perform post-installation. - run: ./postinstall + run: sudo ./postinstall - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} From b9c5bfbc00d8a69c55747cf8e45779ff70caf822 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 15:00:50 +0800 Subject: [PATCH 09/15] (MOD) Added "bash" before "./preinstall" as well as "./postinstall". --- .github/workflows/cmake-multi-platform.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 9c11a42..13c995c 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -68,7 +68,7 @@ jobs: - name: PreInstall # Perform pre-installation. - run: sudo ./preinstall + run: sudo bash ./preinstall - name: Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). @@ -76,7 +76,7 @@ jobs: - name: PostInstall # Perform post-installation. - run: sudo ./postinstall + run: sudo bash ./postinstall - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} From 5e05e24e38a05caccba0e30f8d7ba0eb50b001ec Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 17:51:43 +0800 Subject: [PATCH 10/15] (MOD) Aborted using bash for script executing for scripts modified are now supporting POSIX Shell. (MOD) Modified github action file for abort supporting MS Windows as the target in current stage. --- .github/workflows/cmake-multi-platform.yml | 7 ++----- preinstall | 24 ++++++++-------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 13c995c..5a33a0b 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -25,13 +25,10 @@ jobs: # # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest] build_type: [Release] - c_compiler: [gcc, clang, cl] + c_compiler: [gcc, clang] include: - - os: windows-latest - c_compiler: cl - cpp_compiler: cl - os: ubuntu-latest c_compiler: gcc cpp_compiler: g++ diff --git a/preinstall b/preinstall index cbf5c87..59d081f 100755 --- a/preinstall +++ b/preinstall @@ -7,8 +7,7 @@ fi SRC="$PWD" DST=/usr/include/Compound -PROJ=("Array" "Paper" "Pen" "Render" "Status" "Var" "MemMan" "Stack" "Utils"\ - "String" "Object") +set -- Array Paper Pen Render Status Var MemMan Stack Utils String Object # Create directory. if [ ! -d "$DST" ]; then @@ -16,22 +15,15 @@ if [ ! -d "$DST" ]; then fi # Install project-like headers. -PROJLEN=${#PROJ[*]} -echo "======== $PROJLEN projects in total ========" - -idx=0 -while :; do - if [[ $idx -eq $PROJLEN || $idx -gt $PROJLEN ]]; then - break; - fi +while :; do + p="$1" + if [ -z "$1" ]; then break; fi - p="${PROJ[$idx]}" - - cd "$p" - echo "`date` >>> Installing $p" + cd "$p" || exit 1 + echo "$(date) >>> Installing $p" cp -v include/*.h "$DST" - cd "$SRC" - ((idx++)) + cd "$SRC" || exit 1 + shift 1 echo done From 772a79ce0386ec699541f3b1c3a4ad16084ce4e5 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 18:57:30 +0800 Subject: [PATCH 11/15] (MOD) Changed default shell from "bash" to "sh" in github action file. --- .github/workflows/cmake-multi-platform.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 5a33a0b..eb23acc 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -49,7 +49,7 @@ jobs: - name: Set reusable strings # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. id: strings - shell: bash + shell: sh run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" @@ -61,11 +61,11 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S ${{ github.workspace }} + -S /usr/lib/libcompound.so - name: PreInstall # Perform pre-installation. - run: sudo bash ./preinstall + run: sudo ./preinstall - name: Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). @@ -73,7 +73,7 @@ jobs: - name: PostInstall # Perform post-installation. - run: sudo bash ./postinstall + run: sudo ./postinstall - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} From 43afe62ad17460e125ec5ec14fd01067bb8d1074 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 18:57:30 +0800 Subject: [PATCH 12/15] (MOD) Changed default shell from "bash" to "sh" in github action file. (MOD) Replaced cmake output file with \"/usr/share/libcompound.so\" in github action file. --- .github/workflows/cmake-multi-platform.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 5a33a0b..eb23acc 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -49,7 +49,7 @@ jobs: - name: Set reusable strings # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. id: strings - shell: bash + shell: sh run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" @@ -61,11 +61,11 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S ${{ github.workspace }} + -S /usr/lib/libcompound.so - name: PreInstall # Perform pre-installation. - run: sudo bash ./preinstall + run: sudo ./preinstall - name: Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). @@ -73,7 +73,7 @@ jobs: - name: PostInstall # Perform post-installation. - run: sudo bash ./postinstall + run: sudo ./postinstall - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} From 3f0907daa293935b3fcfa3a9dc0a7ddb09833e30 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 19:13:14 +0800 Subject: [PATCH 13/15] (DEL) Deleted github action file. --- .github/workflows/cmake-multi-platform.yml | 82 ---------------------- 1 file changed, 82 deletions(-) delete mode 100644 .github/workflows/cmake-multi-platform.yml diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml deleted file mode 100644 index eb23acc..0000000 --- a/.github/workflows/cmake-multi-platform.yml +++ /dev/null @@ -1,82 +0,0 @@ -# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. -# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml -name: CMake on multiple platforms - -on: - schedule: - - cron: "0 2 * * 1-5" - push: - branches: [ "github_action_test" ] - pull_request: - branches: [ "github_action_test" ] - -jobs: - build: - runs-on: ${{ matrix.os }} - - strategy: - # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. - fail-fast: false - - # Set up a matrix to run the following 3 configurations: - # 1. - # 2. - # 3. - # - # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. - matrix: - os: [ubuntu-latest] - build_type: [Release] - c_compiler: [gcc, clang] - include: - - os: ubuntu-latest - c_compiler: gcc - cpp_compiler: g++ - - os: ubuntu-latest - c_compiler: clang - cpp_compiler: clang++ - exclude: - - os: windows-latest - c_compiler: gcc - - os: windows-latest - c_compiler: clang - - os: ubuntu-latest - c_compiler: cl - - steps: - - uses: actions/checkout@v4 - - - name: Set reusable strings - # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. - id: strings - shell: sh - run: | - echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} - -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S /usr/lib/libcompound.so - - - name: PreInstall - # Perform pre-installation. - run: sudo ./preinstall - - - name: Build - # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} - - - name: PostInstall - # Perform post-installation. - run: sudo ./postinstall - - - name: Test - working-directory: ${{ steps.strings.outputs.build-output-dir }} - # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest --build-config ${{ matrix.build_type }} From 24cd4a17dfcc192251e6f1c1d3ef7c555d26527c Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 19:59:13 +0800 Subject: [PATCH 14/15] (MOD) Refined README --- README.md | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e0814fb..1422d27 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,9 @@ Generally, Compound is a library for general-purposes programming which you will It is worth noticing that, this library is completely aimed for creating another language. That means, every feature update is supposedly to serve the language. --- -## BUILDING - -To build Compound, all you need is to type as follow in a terminal: +## Building ```shell -cmake . # Generate "Makefile" -make # Build +cmake . && make ``` > *PLEASE NOTICE* @@ -35,12 +32,25 @@ Compound, now, roughly divides platform compatibilities into 2 major parts, the This idea is ready for refinements, you can put up such suggestions and they're welcomed. ## Installation -To install Compound, all you need to do is to run `install`, something like below. ```shell -./install # (Require root privilege) +./preinstall # (Require root privilege) +./postinstall # (Require root privilege) ``` -If you cannot execute ./install script, try to add permission for execution: +> *I TELL YOU WHAT* +> *It is for the convenience of project building automation that the installation procedure being devided into two different parts.* +> *In general, the "preinstall" copies the header files into system "include" directory,* +> *while the "postinstall" copies the compiled library into system library directory.* + + +And if you cannot execute the scripts, try to add permission for execution: ```shell -chmod +x ./install # (Require root privilege) +chmod +x ./the_file_lacks_of_permission_to_execute_and_to_be_honest_i_dont_know_why_do_i_have_to_put_the_name_so_long_that_none_of_you_would_like_to_read_it_through_but_since_you_have_gotten_this_far_congrats_you_are_my_big_star_now_oh_by_the_way_do_you_know_that_the_cat_of_mine_can_actually_talk_cause_last_sunday_when_i_head_to_kitchen_for_some_drinks_and_i_heard_something_mumbling_behind_the_door_and_i_went_up_to_check_what_it_was_and_it_turns_out_that_it_was_my_cat_speaking_and_what_it_said_was_meow ``` + +## Troubleshoot +For now, we wish more of you to put up issues so that the problems can be spotted. + +> *NOT SO FAST* +> *If you got a problem, try to look up for similar or same issues that had been put up already, * +> *'cause you don't want to have your reply simply written something like "ah yeah yeah, we've been through that sometime earlier".* From 9f1960e297b4c2e4c2bbcff949b21284147f0671 Mon Sep 17 00:00:00 2001 From: William Lee Date: Tue, 25 Jun 2024 20:02:40 +0800 Subject: [PATCH 15/15] (MOD) Refined README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1422d27..53c12a5 100644 --- a/README.md +++ b/README.md @@ -52,5 +52,5 @@ chmod +x ./the_file_lacks_of_permission_to_execute_and_to_be_honest_i_dont_know_ For now, we wish more of you to put up issues so that the problems can be spotted. > *NOT SO FAST* -> *If you got a problem, try to look up for similar or same issues that had been put up already, * +> *If you got a problem, try to look up for similar or same issues that had been put up already,* > *'cause you don't want to have your reply simply written something like "ah yeah yeah, we've been through that sometime earlier".*