From 786abbc7fe69c374185e4f39058eb6cbdf3c0559 Mon Sep 17 00:00:00 2001 From: YL Wang <121748352+code4yonglei@users.noreply.github.com> Date: Tue, 1 Oct 2024 11:34:36 +0200 Subject: [PATCH] update `01-producing-libriaries` code example --- content/code/00_hello-world/.DS_Store | Bin 6148 -> 0 bytes .../cxx}/CMakeLists.txt | 0 .../cxx}/Message.cpp | 0 .../cxx}/Message.hpp | 0 .../cxx}/hello-world.cpp | 4 ++-- .../cxx}/solution/CMakeLists.txt | 0 .../cxx}/solution/Message.cpp | 0 .../cxx}/solution/Message.hpp | 0 .../cxx}/solution/hello-world.cpp | 4 ++-- .../fortran}/CMakeLists.txt | 0 .../fortran}/hello-world.f90 | 4 ++-- .../fortran}/message.f90 | 2 +- .../01_producing-libraries/fortran/messaging.mod | Bin 0 -> 887 bytes .../fortran}/solution/CMakeLists.txt | 0 .../fortran/solution}/hello-world.f90 | 4 ++-- .../fortran}/solution/message.f90 | 4 ++-- .../fortran/solution/messaging.mod | Bin 0 -> 884 bytes 17 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 content/code/00_hello-world/.DS_Store rename content/code/{01_libraries-cxx => 01_producing-libraries/cxx}/CMakeLists.txt (100%) rename content/code/{01_libraries-cxx => 01_producing-libraries/cxx}/Message.cpp (100%) rename content/code/{01_libraries-cxx => 01_producing-libraries/cxx}/Message.hpp (100%) rename content/code/{01_libraries-cxx => 01_producing-libraries/cxx}/hello-world.cpp (62%) rename content/code/{01_libraries-cxx => 01_producing-libraries/cxx}/solution/CMakeLists.txt (100%) rename content/code/{01_libraries-cxx => 01_producing-libraries/cxx}/solution/Message.cpp (100%) rename content/code/{01_libraries-cxx => 01_producing-libraries/cxx}/solution/Message.hpp (100%) rename content/code/{01_libraries-cxx => 01_producing-libraries/cxx}/solution/hello-world.cpp (62%) rename content/code/{01_libraries-f => 01_producing-libraries/fortran}/CMakeLists.txt (100%) rename content/code/{01_libraries-f/solution => 01_producing-libraries/fortran}/hello-world.f90 (61%) rename content/code/{01_libraries-f => 01_producing-libraries/fortran}/message.f90 (91%) create mode 100644 content/code/01_producing-libraries/fortran/messaging.mod rename content/code/{01_libraries-f => 01_producing-libraries/fortran}/solution/CMakeLists.txt (100%) rename content/code/{01_libraries-f => 01_producing-libraries/fortran/solution}/hello-world.f90 (61%) rename content/code/{01_libraries-f => 01_producing-libraries/fortran}/solution/message.f90 (81%) create mode 100644 content/code/01_producing-libraries/fortran/solution/messaging.mod diff --git a/content/code/00_hello-world/.DS_Store b/content/code/00_hello-world/.DS_Store deleted file mode 100644 index d234416eca1557ce226f9dbdb54dfe8c85d68dfa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK&2G~`5S~o}*{DLw0R$JMmAFQtrWGpU;-=vR>Ov1t1-lNdh2xD9hqQ_!`3f(@ z8`qJDv^~-a%}BG~?)>c9pI5sc08rg&8UVBbK%)}YTG(78&MB5Y%uG$A8*;BjI&}eb_rQJz>rV7S&`aV*G`Lc;&LPJ&@J8S zx1Y}EuY-9Ua~@>$hlJ%2`3kMZ?lvWrJ1}-yD z_ro^b|L<L7-Ul}EIo$d7=dK^kG;pEB?VP6%l; diff --git a/content/code/01_libraries-cxx/CMakeLists.txt b/content/code/01_producing-libraries/cxx/CMakeLists.txt similarity index 100% rename from content/code/01_libraries-cxx/CMakeLists.txt rename to content/code/01_producing-libraries/cxx/CMakeLists.txt diff --git a/content/code/01_libraries-cxx/Message.cpp b/content/code/01_producing-libraries/cxx/Message.cpp similarity index 100% rename from content/code/01_libraries-cxx/Message.cpp rename to content/code/01_producing-libraries/cxx/Message.cpp diff --git a/content/code/01_libraries-cxx/Message.hpp b/content/code/01_producing-libraries/cxx/Message.hpp similarity index 100% rename from content/code/01_libraries-cxx/Message.hpp rename to content/code/01_producing-libraries/cxx/Message.hpp diff --git a/content/code/01_libraries-cxx/hello-world.cpp b/content/code/01_producing-libraries/cxx/hello-world.cpp similarity index 62% rename from content/code/01_libraries-cxx/hello-world.cpp rename to content/code/01_producing-libraries/cxx/hello-world.cpp index b13d547..d05147b 100644 --- a/content/code/01_libraries-cxx/hello-world.cpp +++ b/content/code/01_producing-libraries/cxx/hello-world.cpp @@ -4,11 +4,11 @@ #include int main() { - Message say_hello("Hello, CMake World!"); + Message say_hello("Hello, CMake World from C++!"); std::cout << say_hello << std::endl; - Message say_goodbye("Goodbye, CMake World"); + Message say_goodbye("Goodbye, CMake World from C++!"); std::cout << say_goodbye << std::endl; diff --git a/content/code/01_libraries-cxx/solution/CMakeLists.txt b/content/code/01_producing-libraries/cxx/solution/CMakeLists.txt similarity index 100% rename from content/code/01_libraries-cxx/solution/CMakeLists.txt rename to content/code/01_producing-libraries/cxx/solution/CMakeLists.txt diff --git a/content/code/01_libraries-cxx/solution/Message.cpp b/content/code/01_producing-libraries/cxx/solution/Message.cpp similarity index 100% rename from content/code/01_libraries-cxx/solution/Message.cpp rename to content/code/01_producing-libraries/cxx/solution/Message.cpp diff --git a/content/code/01_libraries-cxx/solution/Message.hpp b/content/code/01_producing-libraries/cxx/solution/Message.hpp similarity index 100% rename from content/code/01_libraries-cxx/solution/Message.hpp rename to content/code/01_producing-libraries/cxx/solution/Message.hpp diff --git a/content/code/01_libraries-cxx/solution/hello-world.cpp b/content/code/01_producing-libraries/cxx/solution/hello-world.cpp similarity index 62% rename from content/code/01_libraries-cxx/solution/hello-world.cpp rename to content/code/01_producing-libraries/cxx/solution/hello-world.cpp index b13d547..d05147b 100644 --- a/content/code/01_libraries-cxx/solution/hello-world.cpp +++ b/content/code/01_producing-libraries/cxx/solution/hello-world.cpp @@ -4,11 +4,11 @@ #include int main() { - Message say_hello("Hello, CMake World!"); + Message say_hello("Hello, CMake World from C++!"); std::cout << say_hello << std::endl; - Message say_goodbye("Goodbye, CMake World"); + Message say_goodbye("Goodbye, CMake World from C++!"); std::cout << say_goodbye << std::endl; diff --git a/content/code/01_libraries-f/CMakeLists.txt b/content/code/01_producing-libraries/fortran/CMakeLists.txt similarity index 100% rename from content/code/01_libraries-f/CMakeLists.txt rename to content/code/01_producing-libraries/fortran/CMakeLists.txt diff --git a/content/code/01_libraries-f/solution/hello-world.f90 b/content/code/01_producing-libraries/fortran/hello-world.f90 similarity index 61% rename from content/code/01_libraries-f/solution/hello-world.f90 rename to content/code/01_producing-libraries/fortran/hello-world.f90 index d0642d9..d921d4e 100644 --- a/content/code/01_libraries-f/solution/hello-world.f90 +++ b/content/code/01_producing-libraries/fortran/hello-world.f90 @@ -6,10 +6,10 @@ program hello_world type(Messenger) :: hello, bye - hello%message_ = 'Hello, CMake world!' + hello%message_ = 'Hello, CMake world from Fortran!' print *, print_message(hello) - bye%message_ = 'Bye, CMake world!' + bye%message_ = 'Bye, CMake world from Fortran!' print *, print_message(bye) end program diff --git a/content/code/01_libraries-f/message.f90 b/content/code/01_producing-libraries/fortran/message.f90 similarity index 91% rename from content/code/01_libraries-f/message.f90 rename to content/code/01_producing-libraries/fortran/message.f90 index bd9a8c2..ddc6eb5 100644 --- a/content/code/01_libraries-f/message.f90 +++ b/content/code/01_producing-libraries/fortran/message.f90 @@ -16,7 +16,7 @@ module messaging pure function print_message(postman) result(m) type(Messenger), intent(in) :: postman - character(len=19) :: m + character(len=32) :: m m = postman%message_ diff --git a/content/code/01_producing-libraries/fortran/messaging.mod b/content/code/01_producing-libraries/fortran/messaging.mod new file mode 100644 index 0000000000000000000000000000000000000000..0e067db26ca0cc44d0755606d89cb78142f1a35f GIT binary patch literal 887 zcmV--1Bm<|iwFP!000006TMeWbD}^Hz4x!^+rS}PfFFrR#L=Y|fkH5w6XhxhAh2u5kE83jz_YOhHO}TmN8UO zl6u@T$GnGu{lj)1?K{)-5Y#xqfYvM;MrgoTkl=Cjg(DW^+z=?%8vlF^u@X=^*8r-03na0uX z0f=&ZF@>TWuBY!@H00y10u4>o+Ksj%LlapT&Z2p^h!?x?=;pB6`D5KP^{&Nhu`-7) zfj0fSkv`^oc)I7CecIA3^mT8*{ZuMhNVNm2Y<hO>k@Vet?qNmv9ctB zvn0xdnWhp-4}>>a{EgV@&4)s`a1HMDjDrJQveKbzqd&VSo+a$0%cAg}90ec08eK=6 z^zsl?^2RYSS#@%J4v14$LWT!(cvQkOU2oo4zWk`#Mg934Fr%RBIe~B59Js}Y^bQpZ zH}E*>)}#J33i;18FHx8X&jFu=kd{wy#@zGFo=AIib*iT$mm7jEx~?J8OA*jjY7OCh z5l@!vqR2uq$=f(WvBS$q*nwqL15r{qXU(D>TTq*OjZK!z^^`_|OU@;M6=->nf^l;p zI)(K;WhjYTEhaLYy;Q$H<_fZ?0BQ@%MwCMZK2on7JbK))-tq1Sw&9zOjRS5|;u`O? zQvnkS`i4r4W3yevS-XyI0t!Q?7g#(EQ8`YLYU!;P^AY6dquS$9L(9e^^1Q-(SEZLQTA!U6n9`Oq*|NBWn?fRUrU=u1wX$4zXMpgyekT0M#Aha%u6>YX< N_y;oDVHleZ0025eu#^A* literal 0 HcmV?d00001 diff --git a/content/code/01_libraries-f/solution/CMakeLists.txt b/content/code/01_producing-libraries/fortran/solution/CMakeLists.txt similarity index 100% rename from content/code/01_libraries-f/solution/CMakeLists.txt rename to content/code/01_producing-libraries/fortran/solution/CMakeLists.txt diff --git a/content/code/01_libraries-f/hello-world.f90 b/content/code/01_producing-libraries/fortran/solution/hello-world.f90 similarity index 61% rename from content/code/01_libraries-f/hello-world.f90 rename to content/code/01_producing-libraries/fortran/solution/hello-world.f90 index d0642d9..d921d4e 100644 --- a/content/code/01_libraries-f/hello-world.f90 +++ b/content/code/01_producing-libraries/fortran/solution/hello-world.f90 @@ -6,10 +6,10 @@ program hello_world type(Messenger) :: hello, bye - hello%message_ = 'Hello, CMake world!' + hello%message_ = 'Hello, CMake world from Fortran!' print *, print_message(hello) - bye%message_ = 'Bye, CMake world!' + bye%message_ = 'Bye, CMake world from Fortran!' print *, print_message(bye) end program diff --git a/content/code/01_libraries-f/solution/message.f90 b/content/code/01_producing-libraries/fortran/solution/message.f90 similarity index 81% rename from content/code/01_libraries-f/solution/message.f90 rename to content/code/01_producing-libraries/fortran/solution/message.f90 index bd9a8c2..fca9b94 100644 --- a/content/code/01_libraries-f/solution/message.f90 +++ b/content/code/01_producing-libraries/fortran/solution/message.f90 @@ -4,7 +4,7 @@ module messaging public Messenger type Messenger - character(len=19) :: message_ + character(len=32) :: message_ end type public print_message @@ -16,7 +16,7 @@ module messaging pure function print_message(postman) result(m) type(Messenger), intent(in) :: postman - character(len=19) :: m + character(len=32) :: m m = postman%message_ diff --git a/content/code/01_producing-libraries/fortran/solution/messaging.mod b/content/code/01_producing-libraries/fortran/solution/messaging.mod new file mode 100644 index 0000000000000000000000000000000000000000..660a3d184a6ed8b50d3bc058ed8b5b209a0883e4 GIT binary patch literal 884 zcmV-)1B?70iwFP!000006TMg4a-u*GeebX6x50;O0bY_kB91P#2ox8yd7@m!#40Z- zaZ{W9`t1=xA{Q~6N+p)e)X;NI_vwqHq3!yvX5o4}|GkRvHQL3??FO0BWjNbK(|t6@ z#csRCbri?br|8?_UIs~O;b;6q`p^P;q>seJHPPlN+A(CwmCMZ&Lp3{+epF=R^0SPg zf|4}gt})>Q46GlP{b1b~md`CeTRN_-!*P*rqKq=Zk=m)fC}b$<-!)g$eeRN3`S5qz zktEP<%kwp|EQuRNwAncxOV`AYR;;Zu@z~0{AVo7Yp#~?G;!ICyy3RfCU>cmDZyI`L z_XtGJUQD3K$Lr}k7mZf7D??jV)Ly$Mx1fV84Cm1zTyB>8FmrQQ@BE488d~4vjaV6D zhd>+tji*ic0iNdi#*nr&6MfAcaX*nt8dCMhDqR;?<*2lvD;T`)r@y`meF7OLzSd8G zKnk>X74TjH{Ou)bjQnW$S}_sUM~4gP-_o7W)A*UB3Uzuelki!p!DR_MgjVx8$IXnvCnQdR*SibxyYN7so4j3=!yLR9k76)$fF}*{@ z!U(l-=p951`&CT-WzRX|~E4+4`XA*#kHQZ2c)FdspFKKj6Tq}&Qh%H4sSa(~WF z6>U)znnqnwmGfL{^;jUA%fH6ureWYz1yr@P>nqgKUbgXmJ>47#h;ZHJh7$7I#WaFJ zFdjc9W(Um1+hm^`m$*SkY#$1^)nG Kc~haA4gdh2$+Z9g literal 0 HcmV?d00001