The YSLib project - main repository
Revision | a285f6f132e8ab5a92ea9fc7e40bf2fcff337d4b (tree) |
---|---|
Time | 2020-12-24 13:58:49 |
Author | FrankHB <frankhb1989@gmai...> |
Commiter | FrankHB |
更新主分支版本: build 906 rev 10 。
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file Main.cpp |
12 | 12 | \ingroup MaintenanceTools |
13 | 13 | \brief 宿主构建工具:递归查找源文件并编译和静态链接。 |
14 | -\version r4354 | |
14 | +\version r4357 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 473 |
17 | 17 | \par 创建时间: |
18 | 18 | 2014-02-06 14:33:55 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2020-12-12 02:32 +0800 | |
20 | + 2020-12-17 02:10 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -28,7 +28,8 @@ | ||
28 | 28 | */ |
29 | 29 | |
30 | 30 | |
31 | -#include <YSBuild.h> | |
31 | +#include <YSLib/Service/YModules.h> | |
32 | +#include <NPL/YModules.h> | |
32 | 33 | #include YFM_YSLib_Core_YStorage // for YSLib::size_t, YSLib::RecordLevel, |
33 | 34 | // YSLib::Notice, YSLib::FetchStaticRef, YSLib::string, YSLib::set, YSLib::map, |
34 | 35 | // YSLib::vector, YSLib::Logger, YSLib::Warning, YSLib::to_std_string, |
@@ -246,7 +247,7 @@ | ||
246 | 247 | // has effects on the help message, so just make it alphabatical to ease |
247 | 248 | // users by default, except that there are some more reasons like the |
248 | 249 | // effects on the execution mode. |
249 | - // XXX: '-cmd,' is just at the front alphabatically now. | |
250 | + // XXX: '-cmd,' is just at the front alphabatically now. | |
250 | 251 | {"-xcmd,", "command", "COMMAND", [](string&& val) ynothrow{ |
251 | 252 | RequestedCommand = std::move(val); |
252 | 253 | }, {"Specify the name of a command to run.", "If this option is set, all" |
@@ -1047,7 +1048,7 @@ | ||
1047 | 1048 | using ms = duration<unsigned long long, std::milli>; |
1048 | 1049 | auto epoch(YSLib::Timers::FetchEpoch<steady_clock>()); |
1049 | 1050 | Terminal te, te_err(stderr); |
1050 | - | |
1051 | + | |
1051 | 1052 | return FilterExceptions([&]{ |
1052 | 1053 | string epoch_var; |
1053 | 1054 |
@@ -15,6 +15,7 @@ | ||
15 | 15 | $env-de! |
16 | 16 | $redef! |
17 | 17 | SHBuild_CheckCXX |
18 | + SHBuild_Extend_CallVariables | |
18 | 19 | SHBuild_GetPlatformStrings |
19 | 20 | SHBuild_Platform_Detect |
20 | 21 | build-with-conf-opt |
@@ -84,7 +85,6 @@ | ||
84 | 85 | (string-empty? (safeenv-get "SHBuild_Static")); |
85 | 86 | $unless (dynamic) puts "Static mode turned on by configuration."; |
86 | 87 | "XXX", "No extra configuration arguments are supported yet."; |
87 | - safeenv-set "CXXFLAGS_COMMON" ""; | |
88 | 88 | $redef! debug |
89 | 89 | $or? debug (not? (string-empty? (safeenv-get "SHBuild_Debug"))); |
90 | 90 | $if (debug) |
@@ -169,13 +169,7 @@ | ||
169 | 169 | ld-ext-adjust_win32_subsystem_ ($lambda (#ignore CXXFLAGS SHBOPT .) |
170 | 170 | ( |
171 | 171 | "TODO", "Support precompiled headers?"; |
172 | - $env-de! SHBuild_LDFLAGS ""; | |
173 | - $unless (string-empty? SHBuild_LDFLAGS) | |
174 | - (safeenv-set "LDFLAGS" | |
175 | - (++ SHBuild_LDFLAGS " " (env-get "LDFLAGS"))); | |
176 | - $env-de! SHBuild_LIBS ""; | |
177 | - $unless (string-empty? SHBuild_LIBS) | |
178 | - (safeenv-set "LIBS" (++ SHBuild_LIBS " " (env-get "LIBS"))); | |
172 | + () SHBuild_Extend_CallVariables; | |
179 | 173 | system-check (++ SHBuild " " (apply cons-cmd (append SHBOPT_BASE |
180 | 174 | (list SHBOPT) (list (fix-flags CXXFLAGS)) |
181 | 175 | (list SHBuild_YSLib_Flags)))) |
@@ -16,6 +16,7 @@ | ||
16 | 16 | SHBuild_2m |
17 | 17 | SHBuild_CheckCXX |
18 | 18 | SHBuild_EchoVar_N |
19 | + SHBuild_Extend_CallVariables | |
19 | 20 | SHBuild_GetPlatformStrings |
20 | 21 | SHBuild_GetSystemPrefix |
21 | 22 | SHBuild_Platform_Detect |
@@ -23,6 +24,7 @@ | ||
23 | 24 | cons-cmd |
24 | 25 | get_env_SHB_ |
25 | 26 | ld-ext-noadjust_ |
27 | + rmatch? | |
26 | 28 | safeenv-empty? |
27 | 29 | safeenv-get |
28 | 30 | safeenv-restore |
@@ -141,11 +143,12 @@ | ||
141 | 143 | "-xid,alternative -xid,data -xid,include -xid,Android" #f |
142 | 144 | ld-ext-noadjust_ ($lambda (CXX CXXFLAGS SHBOPT LIBPFX) |
143 | 145 | ( |
146 | + $def! SHBuild_CXXFLAGS safeenv-get "SHBuild_CXXFLAGS"; | |
144 | 147 | $if (safeenv-empty? "SHBuild_NoPCH") |
145 | 148 | ( |
146 | 149 | BuildGCH_ (++ repo-base "/YBase/include/stdinc.h") |
147 | - (++ outdir "/stdinc.h") CXX | |
148 | - (cons-cmd "-xc++-header" CXXFLAGS); | |
150 | + (++ outdir "/stdinc.h") CXX (cons-cmd "-xc++-header" | |
151 | + SHBuild_CXXFLAGS CXXFLAGS); | |
149 | 152 | $def! inc-pch list "-include" |
150 | 153 | (system-quote-m_ (++ outdir "/stdinc.h")) |
151 | 154 | ) |
@@ -154,6 +157,7 @@ | ||
154 | 157 | $def! inc-pch () |
155 | 158 | ); |
156 | 159 | $def! DFLAG_B_YB $if dynamic "-DYB_BUILD_DLL" ""; |
160 | + () SHBuild_Extend_CallVariables; | |
157 | 161 | $def! base_LDFLAGS env-get "LDFLAGS"; |
158 | 162 | "NOTE", "The prefix 'lib' is explicit, see %InstLibD."; |
159 | 163 | $defl! build-lib (lib-name inc-pch .opts) |
@@ -183,19 +187,36 @@ | ||
183 | 187 | "XXX", "Precompiled header is not available as it", |
184 | 188 | " requires '-D__NO_INLINE__ -U__OPTIMIZE__'."; |
185 | 189 | "XXX", "See $2020-10 @ doc/Workflow.txt."; |
186 | - $def! mingw64g $and? (eqv? host-platform_ "MinGW64") | |
187 | - (eqv? (SHBuild_CheckCXX host-os CXX) "G++"); | |
188 | - $defl! fix-flags () | |
190 | + $def! use-g++ eqv? (SHBuild_CheckCXX host-os CXX) "G++"; | |
191 | + $def! mingw64g | |
192 | + $and? use-g++ (eqv? host-platform_ "MinGW64"); | |
193 | + "XXX", "See $2020-12 @ doc/Workflow.txt."; | |
194 | + $defl! use-asan? (opt) rmatch? opt | |
195 | + "-f(address-sanitizer|sanitize=[a-z,]*address)"; | |
196 | + $def! linuxgrd-asan $and? use-g++ (not? debug) dynamic | |
197 | + (eqv? host-platform_ "Linux") | |
198 | + ($or? (use-asan? SHBuild_CXXFLAGS) | |
199 | + (use-asan? (safeenv-get "SHBuild_LDFLAGS"))); | |
200 | + $defl! fix-flags-add () | |
189 | 201 | ( |
190 | 202 | $cond |
191 | 203 | (mingw64g $if dynamic |
192 | 204 | "-Og -g -fno-var-tracking-assignments" |
193 | 205 | "-O1 -g -fno-var-tracking-assignments") |
206 | + (linuxgrd-asan "-fno-var-tracking-assignments") | |
194 | 207 | (mingw32r "-fno-lto") |
195 | 208 | (#t "") |
196 | 209 | ); |
210 | + $defl! fix-flags-add-w () | |
211 | + ( | |
212 | + $def! extra () fix-flags-add; | |
213 | + $unless (string-empty? extra) (puts (++ | |
214 | + "WARNING: Additional option are prepended to work" | |
215 | + " around the YFramework build: '" extra "'.")); | |
216 | + extra | |
217 | + ); | |
197 | 218 | build-lib "YFramework" ($if mingw64g () inc-pch) |
198 | - (() fix-flags) ($if dynamic "-DYB_DLL" "") | |
219 | + (() fix-flags-add-w) ($if dynamic "-DYB_DLL" "") | |
199 | 220 | ($if dynamic "-DYF_BUILD_DLL" "") "-DFREEIMAGE_LIB" |
200 | 221 | (SHBuild_TrimOptions_ (++ INCLUDES_YFramework " " |
201 | 222 | CFLAGS_freetype_other)) |
@@ -321,8 +342,12 @@ | ||
321 | 342 | "XXX", "Extra options for SHBOPT are always empty now."; |
322 | 343 | build-with-conf-opt SR_SHBuild_ host-os #f #t "" #t |
323 | 344 | ld-ext-noadjust_ ($lambda (CXX CXXFLAGS SHBOPT LIBPFX) |
345 | + ( | |
346 | + () SHBuild_Extend_CallVariables; | |
324 | 347 | system-check (apply cons-cmd (append (list e_S1_SHBuild_ src-dir |
325 | - SHBOPT) extra-opts (list CXXFLAGS INCLUDES_)))); | |
348 | + SHBOPT) extra-opts (list CXXFLAGS INCLUDES_))) | |
349 | + ) | |
350 | + ); | |
326 | 351 | putss "Finished building " target-name "." |
327 | 352 | ); |
328 | 353 | putss "Installing " target-name " ..."; |
@@ -350,11 +375,14 @@ | ||
350 | 375 | "XXX", "'SHBuild_BaseDir' is fixed in parallel to these directories of", |
351 | 376 | " these tools, while 'SHBuild_ToolDir' is expected more portable."; |
352 | 377 | build-with-conf-opt SR_SHBuild_ host-os #f #t "" #t |
353 | - ld-ext-noadjust_ ($lambda (CXX CXXFLAGS SHBOPT LIBPFX) for-each-ltr | |
354 | - ($lambda (name) | |
378 | + ld-ext-noadjust_ ($lambda (CXX CXXFLAGS SHBOPT LIBPFX) | |
379 | + for-each-ltr ($lambda (name) ( | |
380 | + () SHBuild_Extend_CallVariables; | |
355 | 381 | system-check (apply cons-cmd (append (list e_S2_SHBuild_ |
356 | 382 | (++ SHBuild_BaseDir "/../" name) SHBOPT) extra-opts |
357 | - (list CXXFLAGS INCLUDES_)))) tools-list); | |
383 | + (list CXXFLAGS INCLUDES_))) | |
384 | + )) tools-list | |
385 | + ); | |
358 | 386 | puts "Installing other development tools ..."; |
359 | 387 | $import! env_SHB_ InstHardLinkExe; |
360 | 388 | for-each-ltr ($lambda (name) ( |
@@ -183,8 +183,8 @@ | ||
183 | 183 | ( |
184 | 184 | $unless (safeenv-empty? "SHELL") |
185 | 185 | (string<- src (system-quote src)); |
186 | - system-ok (cons-cmd "echo" src "|" (system-quote compile) "-xc++" "-o" | |
187 | - (system-quote out) opt "- 2>" err-out) | |
186 | + system-ok (cons-cmd "echo" src "|" (system-quote compile) "-pipe" "-xc++" | |
187 | + "-o" (system-quote out) opt "- 2>" err-out) | |
188 | 188 | ); |
189 | 189 | $defl! compile-ok-discard_ (src compile opt err-out) |
190 | 190 | with-tmp-file_ (() mktmp_exe_) |
@@ -225,6 +225,7 @@ | ||
225 | 225 | ); |
226 | 226 | first (rest& r) |
227 | 227 | ); |
228 | + | |
228 | 229 | $defl! SHBuild_CheckCXX (host-os cxx) |
229 | 230 | $let ((e SHBuild_CmdCache_GetEnv_ host-os) (sym string->symbol cxx)) |
230 | 231 | ( |
@@ -236,6 +237,17 @@ | ||
236 | 237 | ); |
237 | 238 | force (eval% sym e) |
238 | 239 | ); |
240 | + | |
241 | +$defl! SHBuild_Extend_CallVariables () | |
242 | +( | |
243 | + $env-de! SHBuild_LDFLAGS ""; | |
244 | + $unless (string-empty? SHBuild_LDFLAGS) | |
245 | + (safeenv-set "LDFLAGS" (++ SHBuild_LDFLAGS " " (env-get "LDFLAGS"))); | |
246 | + $env-de! SHBuild_LIBS ""; | |
247 | + $unless (string-empty? SHBuild_LIBS) | |
248 | + (safeenv-set "LIBS" (++ SHBuild_LIBS " " (env-get "LIBS"))); | |
249 | +); | |
250 | + | |
239 | 251 | $defl! SHBuild_ar_ok_ (ar) |
240 | 252 | system-ok (cons-cmd (system-quote-m_ ar) "--help" "1>" |
241 | 253 | (() mktmp_) "2>" nul_dev_); |
@@ -396,9 +408,6 @@ | ||
396 | 408 | $def! prom_CFLAGS_STD $lazy-env-val "CFLAGS_STD" "-std=c11"; |
397 | 409 | $def! prom_CFLAGS_WARNING $lazy-env-val "CFLAGS_WARNING" cons-cmd |
398 | 410 | (force prom_C_CXXFLAGS_WARNING) (force prom_C_CXXFLAGS_IMPL_WARNING); |
399 | - $def! prom_CFLAGS_COMMON $lazy-env-val "CFLAGS_COMMON" cons-cmd | |
400 | - (force prom_C_CXXFLAGS_COMMON) (force prom_CFLAGS_STD) | |
401 | - (force prom_CFLAGS_WARNING); | |
402 | 411 | $def! prom_CXXFLAGS_IMPL_COMMON $lazy-env-val "CXXFLAGS_IMPL_COMMON" |
403 | 412 | cons-cmd (first (force prom_thread-options_)) |
404 | 413 | "-U__GXX_MERGED_TYPEINFO_NAMES" "-D__GXX_MERGED_TYPEINFO_NAMES=1"; |
@@ -407,9 +416,6 @@ | ||
407 | 416 | (force prom_CFLAGS_WARNING) "-Wctor-dtor-privacy" "-Wnon-virtual-dtor" |
408 | 417 | "-Woverloaded-virtual" "-Wsign-promo" |
409 | 418 | (force prom_CXXFLAGS_IMPL_WARNING); |
410 | - $def! prom_CXXFLAGS_COMMON $lazy-env-val "CXXFLAGS_COMMON" cons-cmd | |
411 | - (force prom_CXXFLAGS_STD) (force prom_C_CXXFLAGS_COMMON) | |
412 | - (force prom_CXXFLAGS_WARNING) (force prom_CXXFLAGS_IMPL_COMMON); | |
413 | 419 | $def! prom_CXXFLAGS_OPT_DBG $lazy |
414 | 420 | $if debug ("-O0 -g -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC") |
415 | 421 | ( |
@@ -418,12 +424,13 @@ | ||
418 | 424 | (force prom_CXXFLAGS_IMPL_OPT) "-fomit-frame-pointer" |
419 | 425 | ); |
420 | 426 | "XXX", "Rename %CXXFLAGS_OPT_DBG -> CFLAGS_OPT_DBG/C_CXXFLAGS_OPT_DBG?"; |
421 | - $env-de! CFLAGS cons-cmd (force prom_C_CXXFLAGS_PIC) | |
422 | - (force prom_CFLAGS_COMMON) (force prom_C_CXXFLAGS_COMMON_IMPL_) | |
423 | - (force prom_CXXFLAGS_OPT_DBG); | |
424 | - $env-de! CXXFLAGS cons-cmd (force prom_C_CXXFLAGS_PIC) | |
425 | - (force prom_CXXFLAGS_COMMON) (force prom_C_CXXFLAGS_COMMON_IMPL_) | |
426 | - (force prom_CXXFLAGS_OPT_DBG); | |
427 | + $env-de! CFLAGS cons-cmd (force prom_CFLAGS_STD) (force prom_C_CXXFLAGS_PIC) | |
428 | + (force prom_C_CXXFLAGS_COMMON) (force prom_CFLAGS_WARNING) | |
429 | + (force prom_C_CXXFLAGS_COMMON_IMPL_) (force prom_CXXFLAGS_OPT_DBG); | |
430 | + $env-de! CXXFLAGS cons-cmd (force prom_CXXFLAGS_STD) | |
431 | + (force prom_C_CXXFLAGS_PIC) (force prom_C_CXXFLAGS_COMMON) | |
432 | + (force prom_CXXFLAGS_WARNING) (force prom_CXXFLAGS_IMPL_COMMON) | |
433 | + (force prom_C_CXXFLAGS_COMMON_IMPL_) (force prom_CXXFLAGS_OPT_DBG); | |
427 | 434 | $redef! CFLAGS SHBuild_TrimOptions_ CFLAGS, |
428 | 435 | $redef! CXXFLAGS SHBuild_TrimOptions_ CXXFLAGS; |
429 | 436 | SHB_SetupPlatformVars_ (() get-current-environment) host-os; |
@@ -34,8 +34,9 @@ | ||
34 | 34 | |
35 | 35 | # NOTE: See %SHBuild_CheckC. |
36 | 36 | if [[ $SHBuild_CXX_Style_ != '' ]] \ |
37 | - && ! echo 'int main(){}' | "$CXX" -xc++ -o"$SHBuild_Env_TempDir/null" \ | |
38 | - "$C_CXXFLAGS_GC" "$LDFLAGS_GC" - 2> /dev/null; then | |
37 | + && ! echo 'int main(){}' | "$CXX" -pipe -xc++ \ | |
38 | + -o"$SHBuild_Env_TempDir/null" "$C_CXXFLAGS_GC" "$LDFLAGS_GC" \ | |
39 | + - 2> /dev/null; then | |
39 | 40 | C_CXXFLAGS_GC='' |
40 | 41 | LDFLAGS_GC='' |
41 | 42 | fi |
@@ -73,9 +74,9 @@ | ||
73 | 74 | if "$CXX" -dumpspecs 2>& 1 | grep mthreads: > /dev/null; then |
74 | 75 | CXXFLAGS_IMPL_COMMON_THRD_='-mthreads' |
75 | 76 | LDFLAGS_IMPL_COMMON_THRD_='-mthreads' |
76 | -elif echo 'int main(){}' | "$CXX" -xc++ \ | |
77 | +elif echo 'int main(){}' | "$CXX" -pipe -xc++ \ | |
77 | 78 | -o"$SHBuild_Env_TempDir/null" -Werror -mthreads - 2> /dev/null; then |
78 | - if echo 'int main(){}' | "$CXX" -xc++ \ | |
79 | + if echo 'int main(){}' | "$CXX" -pipe -xc++ \ | |
79 | 80 | -o"$SHBuild_Env_TempDir/null" -c -Werror -mthreads - 2> /dev/null; then |
80 | 81 | CXXFLAGS_IMPL_COMMON_THRD_='-mthreads' |
81 | 82 | else |
@@ -85,7 +86,7 @@ | ||
85 | 86 | elif "$CXX" -dumpspecs 2>& 1 | grep no-pthread: > /dev/null; then |
86 | 87 | CXXFLAGS_IMPL_COMMON_THRD_='' |
87 | 88 | LDFLAGS_IMPL_COMMON_THRD_='' |
88 | -elif echo 'int main(){}' | "$CXX" -xc++ \ | |
89 | +elif echo 'int main(){}' | "$CXX" -pipe -xc++ \ | |
89 | 90 | -o"$SHBuild_Env_TempDir/null" -pthread - 2> /dev/null; then |
90 | 91 | CXXFLAGS_IMPL_COMMON_THRD_='-pthread' |
91 | 92 | LDFLAGS_IMPL_COMMON_THRD_='-pthread' |
@@ -117,12 +118,12 @@ | ||
117 | 118 | -Wsuggest-attribute=const \ |
118 | 119 | -Wsuggest-attribute=noreturn \ |
119 | 120 | -Wsuggest-attribute=pure \ |
120 | --Wsuggest-final-types \ | |
121 | --Wsuggest-final-methods \ | |
122 | 121 | -Wtrampolines"}" |
123 | 122 | : "${CXXFLAGS_IMPL_WARNING:="-Wconditionally-supported \ |
124 | 123 | -Wno-noexcept-type \ |
125 | 124 | -Wstrict-null-sentinel \ |
125 | +-Wsuggest-final-types \ | |
126 | +-Wsuggest-final-methods \ | |
126 | 127 | -Wzero-as-null-pointer-constant"}" |
127 | 128 | : "${CXXFLAGS_IMPL_OPT:="-fexpensive-optimizations \ |
128 | 129 | -flto=jobserver \ |
@@ -142,7 +143,6 @@ | ||
142 | 143 | : "${CFLAGS_WARNING:=" \ |
143 | 144 | $C_CXXFLAGS_WARNING \ |
144 | 145 | $C_CXXFLAGS_IMPL_WARNING"}" |
145 | -: "${CFLAGS_COMMON:="$C_CXXFLAGS_COMMON $CFLAGS_STD $CFLAGS_WARNING"}" | |
146 | 146 | |
147 | 147 | : "${CXXFLAGS_IMPL_COMMON:="$CXXFLAGS_IMPL_COMMON_THRD_ \ |
148 | 148 | -U__GXX_MERGED_TYPEINFO_NAMES -D__GXX_MERGED_TYPEINFO_NAMES=1"}" |
@@ -154,10 +154,6 @@ | ||
154 | 154 | -Woverloaded-virtual \ |
155 | 155 | -Wsign-promo \ |
156 | 156 | $CXXFLAGS_IMPL_WARNING"}" |
157 | -: "${CXXFLAGS_COMMON:=" $CXXFLAGS_STD \ | |
158 | -$C_CXXFLAGS_COMMON \ | |
159 | -$CXXFLAGS_WARNING \ | |
160 | -$CXXFLAGS_IMPL_COMMON"}" | |
161 | 157 | # XXX: %CXXFLAGS_OPT_UseAssert is external. |
162 | 158 | # shellcheck disable=2154 |
163 | 159 | if [[ "$CXXFLAGS_OPT_UseAssert" == '' ]]; then |
@@ -173,46 +169,17 @@ | ||
173 | 169 | fi |
174 | 170 | |
175 | 171 | # XXX: Rename %CXXFLAGS_OPT_DBG to CFLAGS_OPT_DBG or C_CXXFLAGS_OPT_DBG? |
176 | -: "${CFLAGS:="$C_CXXFLAGS_PIC $CFLAGS_COMMON $C_CXXFLAGS_COMMON_IMPL_ \ | |
177 | -$CXXFLAGS_OPT_DBG"}" | |
172 | +: "${CFLAGS:="$CFLAGS_STD $C_CXXFLAGS_PIC $C_CXXFLAGS_COMMON $CFLAGS_WARNING \ | |
173 | +$C_CXXFLAGS_COMMON_IMPL_ $CXXFLAGS_OPT_DBG"}" | |
178 | 174 | CFLAGS="${CFLAGS// / }" |
179 | 175 | |
180 | -: "${CXXFLAGS:="$C_CXXFLAGS_PIC $CXXFLAGS_COMMON $C_CXXFLAGS_COMMON_IMPL_ \ | |
176 | +: "${CXXFLAGS:="$CXXFLAGS_STD $C_CXXFLAGS_PIC $C_CXXFLAGS_COMMON \ | |
177 | +$CXXFLAGS_WARNING $CXXFLAGS_IMPL_COMMON $C_CXXFLAGS_COMMON_IMPL_ \ | |
181 | 178 | $CXXFLAGS_OPT_DBG"}" |
182 | 179 | CXXFLAGS="${CXXFLAGS// / }" |
183 | 180 | |
184 | 181 | : "${LDFLAGS_OPT_DBG:="$LDFLAGS_STRIP $LDFLAGS_IMPL_OPT $LDFLAGS_GC"}" |
185 | 182 | |
186 | -# XXX: %SHBuild_Host_OS is external. | |
187 | -# shellcheck disable=2154 | |
188 | -if [[ "$SHBuild_Host_OS" == 'Win32' ]]; then | |
189 | - : "${LDFLAGS_DYN_BASE:="-shared -Wl,--dll"}" | |
190 | - : "${DSOSFX:=.dll}" | |
191 | - : "${EXESFX:=.exe}" | |
192 | -else | |
193 | - : "${LDFLAGS_DYN_BASE:=-shared}" | |
194 | - : "${LIBS_RPATH:="-Wl,-rpath,'\$ORIGIN:\$ORIGIN/../lib'"}" | |
195 | - : "${LIBPFX:=lib}" | |
196 | - : "${DSOSFX:=.so}" | |
197 | -fi | |
198 | - | |
199 | -if [[ "$LDFLAGS_IMPL_USE_LLD_" == '' ]]; then | |
200 | - : "${LDFLAGS_DYN_EXTRA:="-Wl,--no-undefined -Wl,--dynamic-list-data, \ | |
201 | ---dynamic-list-cpp-new,--dynamic-list-cpp-typeinfo"}" | |
202 | -else | |
203 | - if [[ "$SHBuild_Host_OS" == 'Win32' ]]; then | |
204 | - : "${LDFLAGS_DYN_EXTRA:="-Wl,-undefined,error"}" | |
205 | - else | |
206 | - # XXX: Here '-Wl,' options are separated to improve compatibility for | |
207 | - # LLVM. | |
208 | - : "${LDFLAGS_DYN_EXTRA:="-Wl,-undefined,error \ | |
209 | --Wl,--export-dynamic-symbol='_ZTS*' \ | |
210 | --Wl,--export-dynamic-symbol='_ZTI*'"}" | |
211 | - fi | |
212 | -fi | |
213 | - | |
214 | -: "${LDFLAGS_DYN:="$LDFLAGS_DYN_BASE $LDFLAGS_DYN_EXTRA"}" | |
215 | - | |
216 | 183 | : "${LDFLAGS:="$C_CXXFLAGS_PIC $LDFLAGS_IMPL_COMMON_THRD_ $LDFLAGS_OPT_DBG"}" |
217 | 184 | if [[ "$LDFLAGS_IMPL_USE_LLD_" != '' ]]; then |
218 | 185 | LDFLAGS="-fuse-ld=lld $LDFLAGS" |
@@ -14,7 +14,8 @@ | ||
14 | 14 | SHBuild_CheckCC() |
15 | 15 | { |
16 | 16 | # NOTE: The output path cannot be '/dev/null'. See http://sourceforge.net/p/msys2/discussion/general/thread/2d6adff2/?limit=25. |
17 | - if hash "$1" 2> /dev/null; then | |
17 | + if [[ "$1" != */* ]] && (hash "$1" > /dev/null 2>& 1) \ | |
18 | + || [[ "$1" == */* && ! -d "$1" && -x "$1" ]]; then | |
18 | 19 | # XXX: %SHBuild_Env_TempDir is external. |
19 | 20 | # shellcheck disable=2154 |
20 | 21 | if echo 'int main(void){return __clang__;}' | "$1" \ |
@@ -34,7 +35,8 @@ | ||
34 | 35 | SHBuild_CheckCXX() |
35 | 36 | { |
36 | 37 | # NOTE: As %SHBuild_CheckCC. |
37 | - if hash "$1" 2> /dev/null; then | |
38 | + if [[ "$1" != */* ]] && (hash "$1" > /dev/null 2>& 1) \ | |
39 | + || [[ "$1" == */* && ! -d "$1" && -x "$1" ]]; then | |
38 | 40 | if echo 'int main(){return __clang__;}' | "$1" \ |
39 | 41 | -xc++ -o"$SHBuild_Env_TempDir/null" - 2> /dev/null; then |
40 | 42 | SHBuild_Put "Clang++" |
@@ -55,8 +55,9 @@ | ||
55 | 55 | |
56 | 56 | SHBuild_CheckedCall() |
57 | 57 | { |
58 | - if hash "$1" > /dev/null 2>& 1; then | |
59 | - "$@" || exit $? | |
58 | + if [[ "$1" != */* ]] && (hash "$1" > /dev/null 2>& 1) \ | |
59 | + || [[ "$1" == */* && ! -d "$1" && -x "$1" ]]; then | |
60 | + "$@" || exit | |
60 | 61 | else |
61 | 62 | SHBuild_Puts "ERROR: \"$1\" should exist. Failed calling \"$*\"." >& 2 |
62 | 63 | exit 1 |
@@ -66,7 +67,7 @@ | ||
66 | 67 | SHBuild_CheckedCallSilent() |
67 | 68 | { |
68 | 69 | if hash "$1" > /dev/null 2>& 1; then |
69 | - "$@" > /dev/null || exit $? | |
70 | + "$@" > /dev/null || exit | |
70 | 71 | else |
71 | 72 | SHBuild_Puts "ERROR: \"$1\" should exist. Failed calling \"$*\"." >& 2 |
72 | 73 | exit 1 |
@@ -273,7 +274,7 @@ | ||
273 | 274 | { |
274 | 275 | SHBuild_AssertNonempty SHBuild_Host_Arch |
275 | 276 | SHBuild_AssertNonempty SHBuild_Host_OS |
276 | - echo "$(SHBuild_Platform_Detect "$SHBuild_Host_OS" "$SHBuild_Host_Arch")" | |
277 | + SHBuild_Platform_Detect "$SHBuild_Host_OS" "$SHBuild_Host_Arch" | |
277 | 278 | } |
278 | 279 | |
279 | 280 |
@@ -390,11 +391,12 @@ | ||
390 | 391 | : "${SHBuild_SysRoot:="$1"}" |
391 | 392 | SHBuild_AssertNonempty SHBuild_SysRoot |
392 | 393 | mkdir -p "$SHBuild_SysRoot" |
394 | + # shellcheck disable=2164 | |
393 | 395 | SHBuild_SysRoot=$(cd "$SHBuild_SysRoot"; pwd) |
394 | 396 | SHBuild_PrepareBuild |
395 | 397 | # NOTE: See also %SHBuild-YSLib-build.txt. |
396 | 398 | : "${SHBuild_SystemPrefix:=\ |
397 | -$(SHBuild_GetSystemPrefix $(SHBuild_GetBuildName))}" | |
399 | +$(SHBuild_GetSystemPrefix "$(SHBuild_GetBuildName)")}" | |
398 | 400 | SHBuild_InitReadonly SR_Prefix \ |
399 | 401 | SHBuild_Put "$SHBuild_SysRoot$SHBuild_SystemPrefix" |
400 | 402 | } |
@@ -8,9 +8,9 @@ | ||
8 | 8 | # understand and accept it fully. |
9 | 9 | # |
10 | 10 | # Makefile specifying common toolchain options |
11 | -# Version = r78 | |
11 | +# Version = r81 | |
12 | 12 | # Created = 2014-12-06 17:24:04 +0800 |
13 | -# Updated = 2020-02-25 19:09 +0800 | |
13 | +# Updated = 2020-12-14 00:44 +0800 | |
14 | 14 | # Encoding = ANSI |
15 | 15 | |
16 | 16 |
@@ -35,8 +35,6 @@ | ||
35 | 35 | |
36 | 36 | CFLAGS_WARNING ?= $(C_CXXFLAGS_WARNING) $(C_CXXFLAGS_IMPL_WARNING) |
37 | 37 | |
38 | -CFLAGS_COMMON ?= $(C_CXXFLAGS_COMMON) $(CFLAGS_STD) $(CFLAGS_WARNING) | |
39 | - | |
40 | 38 | CXXFLAGS_IMPL_OPT ?= -s -fexpensive-optimizations -flto=jobserver |
41 | 39 | LDFLAGS_IMPL_OPT ?= -s -fexpensive-optimizations -flto |
42 | 40 |
@@ -47,8 +45,6 @@ | ||
47 | 45 | |
48 | 46 | CXXFLAGS_IMPL_COMMON ?= \ |
49 | 47 | -U__GXX_MERGED_TYPEINFO_NAMES -D__GXX_MERGED_TYPEINFO_NAMES=1 |
50 | -CXXFLAGS_COMMON ?= $(C_CXXFLAGS_COMMON) $(CXXFLAGS_STD) \ | |
51 | - $(CXXFLAGS_WARNING) $(CXXFLAGS_IMPL_COMMON) | |
52 | 48 | |
53 | 49 | ifneq ($(CONF),debug) |
54 | 50 | ASFLAGS_OPT_DBG ?= |
@@ -1,5 +1,5 @@ | ||
1 | 1 | # |
2 | -# (C) 2009-2016, 2019 FrankHB. | |
2 | +# (C) 2009-2016, 2019-2020 FrankHB. | |
3 | 3 | # |
4 | 4 | # This file is part of the YSLib project, and may only be used, |
5 | 5 | # modified, and distributed under the terms of the YSLib project |
@@ -8,9 +8,9 @@ | ||
8 | 8 | # understand and accept it fully. |
9 | 9 | # |
10 | 10 | # Android Makefile for YBase |
11 | -# Version = r272 | |
11 | +# Version = r303 | |
12 | 12 | # Created = 2014-04-07 12:41:43 +0800 |
13 | -# Updated = 2019-09-08 00:25 +0800 | |
13 | +# Updated = 2020-12-14 01:45 +0800 | |
14 | 14 | # Encoding = ANSI |
15 | 15 | |
16 | 16 |
@@ -21,7 +21,6 @@ | ||
21 | 21 | SHBuild_ToolDir := $(dir $(lastword $(MAKEFILE_LIST)))/../../Tools/Scripts |
22 | 22 | include $(SHBuild_ToolDir)/Toolchain.Android.mk |
23 | 23 | |
24 | -#---- | |
25 | 24 | # PROJNAME is the name of the project |
26 | 25 | # CONF is the configuration name |
27 | 26 | # RELEASE is the directory name for object files and intermediate files will be placed |
@@ -32,7 +31,6 @@ | ||
32 | 31 | # SOURCES is a list of directories containing source code |
33 | 32 | # INCLUDES is a list of directories containing extra header files |
34 | 33 | # DATA is a list of directories containing binary files embedded using bin2o |
35 | -#---- | |
36 | 34 | |
37 | 35 | export PROJNAME ?= YBase |
38 | 36 | export CONF ?= release |
@@ -47,12 +45,12 @@ | ||
47 | 45 | export INCLUDES := include data $(REFDIR)/include |
48 | 46 | export DATA := data $(REFDIR)/data |
49 | 47 | |
50 | -# options for code generation | |
51 | -CFLAGS := $(INCLUDE) $(C_CXXFLAGS) $(CFLAGS_COMMON) | |
52 | -CXXFLAGS := $(INCLUDE) $(C_CXXFLAGS) $(CXXFLAGS_COMMON) \ | |
53 | - -fno-threadsafe-statics -fuse-cxa-atexit -Wctor-dtor-privacy \ | |
54 | - -Wnon-virtual-dtor -Wold-style-cast -Wsign-promo | |
55 | -# -Wnoexcept -Wnon-virtual-dtor -Wold-style-cast -Wsign-promo | |
48 | +CFLAGS := $(CFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS) $(C_CXXFLAGS_COMMON) \ | |
49 | + $(CFLAGS_WARNING) | |
50 | +CXXFLAGS := $(CXXFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS) $(C_CXXFLAGS_COMMON) \ | |
51 | + $(CXXFLAGS_WARNING) $(CXXFLAGS_IMPL_COMMON) -fuse-cxa-atexit \ | |
52 | + -Wold-style-cast | |
53 | +# -Wnoexcept | |
56 | 54 | |
57 | 55 | ifneq ($(CONF),$(notdir $(CURDIR))) |
58 | 56 |
@@ -71,17 +69,14 @@ | ||
71 | 69 | |
72 | 70 | MAPFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.map)) |
73 | 71 | |
74 | -#---- | |
75 | -# use CXX for linking C++ projects, CC for standard C | |
76 | -#---- | |
77 | 72 | ifeq ($(strip $(CPPFILES)),) |
78 | 73 | export LD := $(CC) |
79 | 74 | else |
80 | 75 | export LD := $(CXX) |
81 | 76 | endif |
82 | 77 | |
83 | -export OFILES := $(addsuffix .o,$(MAPFILES)) $(addsuffix .o,$(BINFILES)) \ | |
84 | - $(addsuffix .o,$(CPPFILES)) $(addsuffix .o,$(CFILES)) $(addsuffix .o,$(SFILES)) | |
78 | +export OFILES := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(CPPFILES)) \ | |
79 | + $(addsuffix .o,$(CFILES)) $(addsuffix .o,$(SFILES)) | |
85 | 80 | |
86 | 81 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ |
87 | 82 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ |
@@ -109,28 +104,15 @@ | ||
109 | 104 | |
110 | 105 | all: $(CONF) $(OUTPUT) |
111 | 106 | |
112 | -#---- | |
113 | 107 | else |
114 | 108 | |
115 | 109 | DEPENDS := $(OFILES:.o=.d) |
116 | 110 | |
117 | -#---- | |
118 | -# main targets | |
119 | -#---- | |
120 | - | |
121 | -$(OUTPUT): $(OFILES) | |
111 | +$(OUTPUT) : $(OFILES) | |
122 | 112 | @rm -f "$(OUTPUT)" |
123 | 113 | @echo Linking $(notdir $@) ... |
124 | 114 | @$(AR) rcs "$(OUTPUT)" $(foreach file,$(OFILES),$(DEPSDIR)/$(file)) |
125 | 115 | |
126 | -#---- | |
127 | -# you need a rule like this for each extension you use as binary data | |
128 | -#---- | |
129 | - | |
130 | -#---- | |
131 | -# Compile Targets for C/C++ | |
132 | -#---- | |
133 | - | |
134 | 116 | %.cpp.o: %.cpp |
135 | 117 | @echo $< |
136 | 118 | @[ -d $(dir $(DEPSDIR)/$@) ] || mkdir -p $(dir $(DEPSDIR)/$@) |
@@ -146,7 +128,6 @@ | ||
146 | 128 | @[ -d $(dir $(DEPSDIR)/$@) ] || mkdir -p $(dir $(DEPSDIR)/$@) |
147 | 129 | @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.s.d -x assembler-with-cpp $(ASFLAGS) -c $< -o$(DEPSDIR)/$@ |
148 | 130 | |
149 | - | |
150 | 131 | define bin2o |
151 | 132 | @[ -d $(dir $(DEPSDIR)/$@) ] || mkdir -p $(dir $(DEPSDIR)/$@) |
152 | 133 | cp $(<) $(notdir $(*)) |
@@ -161,13 +142,7 @@ | ||
161 | 142 | @echo $< |
162 | 143 | @$(bin2o) |
163 | 144 | |
164 | -%.map.o: %.map | |
165 | - @echo $< | |
166 | - @$(bin2o) | |
167 | - | |
168 | 145 | -include $(foreach file,$(DEPENDS),$(DEPSDIR)/$(file)) |
169 | 146 | |
170 | -#---- | |
171 | 147 | endif |
172 | -#---- | |
173 | 148 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | # |
2 | -# (C) 2009-2016 FrankHB. | |
2 | +# (C) 2009-2016, 2020 FrankHB. | |
3 | 3 | # |
4 | 4 | # This file is part of the YSLib project, and may only be used, |
5 | 5 | # modified, and distributed under the terms of the YSLib project |
@@ -8,9 +8,9 @@ | ||
8 | 8 | # understand and accept it fully. |
9 | 9 | # |
10 | 10 | # DS Makefile for YBase |
11 | -# Version = r2004 | |
11 | +# Version = r2040 | |
12 | 12 | # Created = 2009-12-18 12:27:40 +0800 |
13 | -# Updated = 2016-04-12 22:21 +0800 | |
13 | +# Updated = 2020-12-14 05:12 +0800 | |
14 | 14 | # Encoding = ANSI |
15 | 15 | |
16 | 16 |
@@ -45,21 +45,16 @@ | ||
45 | 45 | export INCLUDES := include data $(REFDIR)/include |
46 | 46 | export DATA := data $(REFDIR)/data |
47 | 47 | |
48 | -# options for code generation | |
49 | 48 | ARCH := $(ARCH_ARM9) |
50 | 49 | ARCH_AS := $(ARCH_AS_ARM9) |
51 | 50 | ASFLAGS := $(ASFLAGS_ARM9) |
52 | -CFLAGS := $(INCLUDE) $(C_CXXFLAGS_ARM9) $(CFLAGS_COMMON) | |
53 | -CXXFLAGS := $(INCLUDE) $(C_CXXFLAGS_ARM9) $(CXXFLAGS_COMMON) \ | |
54 | - -fno-threadsafe-statics -fuse-cxa-atexit -Wctor-dtor-privacy -Wnoexcept \ | |
55 | - -Wnon-virtual-dtor -Wold-style-cast -Wsign-promo | |
51 | +CFLAGS := $(CFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS_ARM9) $(C_CXXFLAGS_COMMON) \ | |
52 | + $(CFLAGS_WARNING) | |
53 | +CXXFLAGS := $(CXXFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS_ARM9) $(C_CXXFLAGS_COMMON) \ | |
54 | + $(CXXFLAGS_WARNING) $(CXXFLAGS_IMPL_COMMON) \ | |
55 | + -fno-threadsafe-statics -fuse-cxa-atexit -Wnoexcept -Wold-style-cast | |
56 | 56 | |
57 | -#---- | |
58 | -# no real need to edit anything past this point unless you need to add additional | |
59 | -# rules for different file extensions | |
60 | -#---- | |
61 | 57 | ifneq ($(CONF),$(notdir $(CURDIR))) |
62 | -#---- | |
63 | 58 | |
64 | 59 | export OUTPUT := $(RELEASEDIR)/lib$(TARGET).a |
65 | 60 |
@@ -76,17 +71,14 @@ | ||
76 | 71 | |
77 | 72 | MAPFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.map)) |
78 | 73 | |
79 | -#---- | |
80 | -# use CXX for linking C++ projects, CC for standard C | |
81 | -#---- | |
82 | 74 | ifeq ($(strip $(CPPFILES)),) |
83 | 75 | export LD := $(CC) |
84 | 76 | else |
85 | 77 | export LD := $(CXX) |
86 | 78 | endif |
87 | 79 | |
88 | -export OFILES := $(addsuffix .o,$(MAPFILES)) $(addsuffix .o,$(BINFILES)) \ | |
89 | - $(addsuffix .o,$(CPPFILES)) $(addsuffix .o,$(CFILES)) $(addsuffix .o,$(SFILES)) | |
80 | +export OFILES := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(CPPFILES)) \ | |
81 | + $(addsuffix .o,$(CFILES)) $(addsuffix .o,$(SFILES)) | |
90 | 82 | |
91 | 83 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ |
92 | 84 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ |
@@ -96,7 +88,6 @@ | ||
96 | 88 | |
97 | 89 | .PHONY: $(CONF) clean rebuild all |
98 | 90 | |
99 | -#---- | |
100 | 91 | $(CONF): |
101 | 92 | @echo Building configuration: $(notdir $@) ... |
102 | 93 | @[ -d $(BUILDDIR)/dummy ] || mkdir -p $(BUILDDIR)/dummy |
@@ -104,7 +95,6 @@ | ||
104 | 95 | @$(MAKE) --no-print-directory -C $(BUILDDIR) -f $(CURDIR)/Makefile |
105 | 96 | @echo Built configuration: $(notdir $@). |
106 | 97 | |
107 | -#---- | |
108 | 98 | clean: |
109 | 99 | @echo Cleaning $(TARGET) of $(PLATFORM) ... |
110 | 100 | @rm -f $(foreach file,$(OFILES:.o=.d),$(DEPSDIR)/$(file)) |
@@ -116,28 +106,15 @@ | ||
116 | 106 | |
117 | 107 | all: $(CONF) $(OUTPUT) |
118 | 108 | |
119 | -#---- | |
120 | 109 | else |
121 | 110 | |
122 | 111 | DEPENDS := $(OFILES:.o=.d) |
123 | 112 | |
124 | -#---- | |
125 | -# main targets | |
126 | -#---- | |
127 | - | |
128 | 113 | $(OUTPUT) : $(OFILES) |
129 | 114 | @rm -f "$(OUTPUT)" |
130 | 115 | @echo Linking $(notdir $@) ... |
131 | 116 | @$(AR) rcs "$(OUTPUT)" $(foreach file,$(OFILES),$(DEPSDIR)/$(file)) |
132 | 117 | |
133 | -#---- | |
134 | -# you need a rule like this for each extension you use as binary data | |
135 | -#---- | |
136 | - | |
137 | -#---- | |
138 | -# Compile Targets for C/C++ | |
139 | -#---- | |
140 | - | |
141 | 118 | %.cpp.o : %.cpp |
142 | 119 | @echo $< |
143 | 120 | @[ -d $(dir $(DEPSDIR)/$@) ] || mkdir -p $(dir $(DEPSDIR)/$@) |
@@ -153,7 +130,6 @@ | ||
153 | 130 | @[ -d $(dir $(DEPSDIR)/$@) ] || mkdir -p $(dir $(DEPSDIR)/$@) |
154 | 131 | @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.s.d -x assembler-with-cpp $(ASFLAGS) -c $< -o$(DEPSDIR)/$@ |
155 | 132 | |
156 | - | |
157 | 133 | define bin2o |
158 | 134 | @[ -d $(dir $(DEPSDIR)/$@) ] || mkdir -p $(dir $(DEPSDIR)/$@) |
159 | 135 | cp $(<) $(notdir $(*)) |
@@ -164,17 +140,11 @@ | ||
164 | 140 | echo "extern const u32" $(notdir $(*))_size";" >> $(DEPSDIR)/$(*).h |
165 | 141 | endef |
166 | 142 | |
167 | -%.bin.o : %.bin | |
168 | - @echo $< | |
169 | - @$(bin2o) | |
170 | - | |
171 | -%.map.o : %.map | |
143 | +%.bin.o : %.bin | |
172 | 144 | @echo $< |
173 | 145 | @$(bin2o) |
174 | 146 | |
175 | 147 | -include $(foreach file,$(DEPENDS),$(DEPSDIR)/$(file)) |
176 | 148 | |
177 | -#---- | |
178 | 149 | endif |
179 | -#---- | |
180 | 150 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2013-2016, 2018 FrankHB. | |
2 | + © 2013-2016, 2018-2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file apply.hpp |
12 | 12 | \ingroup YStandardEx |
13 | 13 | \brief 元组应用操作。 |
14 | -\version r986 | |
14 | +\version r989 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 333 |
17 | 17 | \par 创建时间: |
18 | 18 | 2019-01-11 19:43:23 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2019-01-30 10:07 +0800 | |
20 | + 2020-12-24 12:01 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -35,7 +35,7 @@ | ||
35 | 35 | // std::tuple_size, std::make_from_tuple; |
36 | 36 | |
37 | 37 | /*! |
38 | -\brief \<tuple\> 特性测试宏。 | |
38 | +\brief \c \<tuple> 特性测试宏。 | |
39 | 39 | \see WG21 P0941R2 2.2 。 |
40 | 40 | \see https://docs.microsoft.com/en-us/cpp/visual-cpp-language-conformance 。 |
41 | 41 | \since build 833 |
@@ -94,6 +94,7 @@ | ||
94 | 94 | } |
95 | 95 | //@} |
96 | 96 | |
97 | + //! \since build 634 | |
97 | 98 | template<typename _func> |
98 | 99 | static yconstfn auto |
99 | 100 | call(_func&& f, _tParams&&... args) -> yimpl(decltype( |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2014-2018 FrankHB. | |
2 | + © 2014-2018, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file exception.h |
12 | 12 | \ingroup YStandardEx |
13 | 13 | \brief 标准库异常扩展接口。 |
14 | -\version r331 | |
14 | +\version r336 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 522 |
17 | 17 | \par 创建时间: |
18 | 18 | 2014-07-25 20:14:51 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2018-12-26 19:52 +0800 | |
20 | + 2020-12-24 12:02 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -130,7 +130,10 @@ | ||
130 | 130 | }; |
131 | 131 | |
132 | 132 | |
133 | -//! \brief 异常:未实现的操作。 | |
133 | +/*! | |
134 | +\brief 异常:未实现的操作。 | |
135 | +\note 和 \c std::system_error 中的错误条件不同,一般不表示依赖外部确定支持条件。 | |
136 | +*/ | |
134 | 137 | class YB_API unimplemented : public unsupported |
135 | 138 | { |
136 | 139 | public: |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2014-2016, 2019 FrankHB. | |
2 | + © 2014-2016, 2019-2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file iterator_trait.hpp |
12 | 12 | \ingroup YStandardEx |
13 | 13 | \brief 迭代器特征。 |
14 | -\version r127 | |
14 | +\version r129 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 627 |
17 | 17 | \par 创建时间: |
18 | 18 | 2015-08-30 16:29:07 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2019-09-04 11:19 +0800 | |
20 | + 2020-12-24 12:04 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -85,6 +85,7 @@ | ||
85 | 85 | /*! |
86 | 86 | \ingroup metafunctions |
87 | 87 | \note 约束的迭代器类型条件仅判断自增、间接操作(解引用)和(可选的)类别。 |
88 | +\note 不排除假阳性结果。 | |
88 | 89 | \sa enable_if_t |
89 | 90 | */ |
90 | 91 | //@{ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2014, 2019 FrankHB. | |
2 | + © 2014, 2019-2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -16,13 +16,13 @@ | ||
16 | 16 | /*! \file test.h |
17 | 17 | \ingroup YTest |
18 | 18 | \brief 基础测试工具。 |
19 | -\version r111 | |
19 | +\version r125 | |
20 | 20 | \author FrankHB <frankhb1989@gmail.com> |
21 | 21 | \since build 519 |
22 | 22 | \par 创建时间: |
23 | 23 | 2014-07-17 03:56:17 +0800 |
24 | 24 | \par 修改时间: |
25 | - 2019-08-01 18:13 +0800 | |
25 | + 2020-12-24 12:02 +0800 | |
26 | 26 | \par 文本编码: |
27 | 27 | UTF-8 |
28 | 28 | \par 模块名称: |
@@ -34,8 +34,8 @@ | ||
34 | 34 | #define YB_INC_ytest_test_h_ 1 |
35 | 35 | |
36 | 36 | #include "../ydef.h" |
37 | -#include <string> | |
38 | -#include <functional> | |
37 | +#include <ystdex/string.hpp> // for ystdex::string; | |
38 | +#include <ystdex/function.hpp> // for ystdex::function; | |
39 | 39 | |
40 | 40 | /*! |
41 | 41 | \since build 319 |
@@ -65,16 +65,20 @@ | ||
65 | 65 | class YB_API group_guard |
66 | 66 | { |
67 | 67 | public: |
68 | - std::string subject; | |
68 | + ystdex::string subject; | |
69 | 69 | size_t pass_n = 0; |
70 | 70 | size_t fail_n = 0; |
71 | - std::function<void(group_guard&)> on_end{}; | |
71 | + //! \since build 899 | |
72 | + ystdex::function<void(group_guard&)> on_end{}; | |
72 | 73 | |
74 | + //! \since build 899 | |
75 | + //@{ | |
73 | 76 | //! \brief 构造:提供名称。 |
74 | - group_guard(const std::string&); | |
77 | + group_guard(const ystdex::string&); | |
75 | 78 | //! \brief 构造:提供名称并注册回调,若起始回调非空时则调用。 |
76 | - group_guard(const std::string&, std::function<void(group_guard&)>, | |
77 | - std::function<void(group_guard&)>); | |
79 | + group_guard(const ystdex::string&, ystdex::function<void(group_guard&)>, | |
80 | + ystdex::function<void(group_guard&)>); | |
81 | + //@} | |
78 | 82 | group_guard(group_guard&&) = default; |
79 | 83 | /*! |
80 | 84 | \brief 析构:调用 on_end 。 |
@@ -82,8 +86,9 @@ | ||
82 | 86 | */ |
83 | 87 | ~group_guard(); |
84 | 88 | |
89 | + //! \since build 899 | |
85 | 90 | template<typename _fPass, typename _fFail> |
86 | - std::function<void(bool)> | |
91 | + ystdex::function<void(bool)> | |
87 | 92 | get(_fPass pass, _fFail fail) |
88 | 93 | { |
89 | 94 | return [this, pass, fail](bool b){ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2014 FrankHB. | |
2 | + © 2014, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file test.cpp |
12 | 12 | \ingroup YTest |
13 | 13 | \brief 基础测试工具。 |
14 | -\version r53 | |
14 | +\version r57 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 519 |
17 | 17 | \par 创建时间: |
18 | 18 | 2014-07-17 03:59:38 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2014-07-17 04:22 +0800 | |
20 | + 2020-12-24 12:02 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -30,11 +30,11 @@ | ||
30 | 30 | namespace ytest |
31 | 31 | { |
32 | 32 | |
33 | -group_guard::group_guard(const std::string& name) | |
33 | +group_guard::group_guard(const ystdex::string& name) | |
34 | 34 | : subject(name) |
35 | 35 | {} |
36 | -group_guard::group_guard(const std::string& name, std::function<void( | |
37 | - group_guard&)> on_b, std::function<void(group_guard&)> on_e) | |
36 | +group_guard::group_guard(const ystdex::string& name, ystdex::function<void( | |
37 | + group_guard&)> on_b, ystdex::function<void(group_guard&)> on_e) | |
38 | 38 | : subject(name), on_end(on_e) |
39 | 39 | { |
40 | 40 | if(on_b) |
@@ -1,5 +1,5 @@ | ||
1 | 1 | # |
2 | -# (C) 2009-2016 FrankHB. | |
2 | +# (C) 2009-2016, 2020 FrankHB. | |
3 | 3 | # |
4 | 4 | # This file is part of the YSLib project, and may only be used, |
5 | 5 | # modified, and distributed under the terms of the YSLib project |
@@ -8,9 +8,9 @@ | ||
8 | 8 | # understand and accept it fully. |
9 | 9 | # |
10 | 10 | # Android Makefile for YFramework |
11 | -# Version = r360 | |
11 | +# Version = r459 | |
12 | 12 | # Created = 2014-04-07 17:50:08 +0800 |
13 | -# Updated = 2016-04-12 22:20 +0800 | |
13 | +# Updated = 2020-12-14 01:43 +0800 | |
14 | 14 | # Encoding = ANSI |
15 | 15 | |
16 | 16 |
@@ -21,10 +21,6 @@ | ||
21 | 21 | SHBuild_ToolDir := $(dir $(lastword $(MAKEFILE_LIST)))/../../Tools/Scripts |
22 | 22 | include $(SHBuild_ToolDir)/Toolchain.Android.mk |
23 | 23 | |
24 | -CFLAGS_COMMON := $(CFLAGS_COMMON) -Wno-cast-align | |
25 | -CXXFLAGS_COMMON := $(CXXFLAGS_COMMON) -Wno-cast-align | |
26 | - | |
27 | -#---- | |
28 | 24 | # PROJNAME is the name of the project |
29 | 25 | # CONF is the configuration name |
30 | 26 | # RELEASE is the directory name for object files and intermediate files will be placed |
@@ -35,8 +31,6 @@ | ||
35 | 31 | # SOURCES is a list of directories containing source code |
36 | 32 | # INCLUDES is a list of directories containing extra header files |
37 | 33 | # DATA is a list of directories containing binary files embedded using bin2o |
38 | -# GRAPHICS is a list of directories containing image files to be converted with grit | |
39 | -#---- | |
40 | 34 | |
41 | 35 | export PROJNAME ?= YFramework |
42 | 36 | export CONF ?= release |
@@ -60,30 +54,18 @@ | ||
60 | 54 | $(REFDIR)/include ../../3rdparty/include ../../3rdparty/freetype/include |
61 | 55 | export DATA := #data $(REFDIR)/data |
62 | 56 | |
63 | -# options for code generation | |
64 | -CFLAGS := $(INCLUDE) $(C_CXXFLAGS) $(CFLAGS_COMMON) | |
65 | -CXXFLAGS := $(INCLUDE) $(C_CXXFLAGS) $(CXXFLAGS_COMMON) \ | |
66 | - -fno-threadsafe-statics -fuse-cxa-atexit -Wctor-dtor-privacy \ | |
67 | - -Wnon-virtual-dtor -Wsign-promo | |
68 | -# -Wnoexcept -Wnon-virtual-dtor -Wold-style-cast -Wsign-promo | |
69 | - | |
70 | -#---- | |
71 | -# any extra libraries we wish to link with the project | |
72 | -#---- | |
73 | -LIBS := #-lfreetype | |
57 | +CFLAGS := $(CFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS) $(C_CXXFLAGS_COMMON) \ | |
58 | + $(CFLAGS_WARNING) -Wno-cast-align | |
59 | +CXXFLAGS := $(CXXFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS) $(C_CXXFLAGS_COMMON) \ | |
60 | + $(CXXFLAGS_WARNING) $(CXXFLAGS_IMPL_COMMON) -Wno-cast-align \ | |
61 | + -fno-threadsafe-statics -fuse-cxa-atexit | |
62 | +# -Wnoexcept -Wold-style-cast | |
74 | 63 | |
75 | -#---- | |
76 | -# list of directories containing libraries, this must be the top level containing | |
77 | -# include and lib | |
78 | -#---- | |
79 | -LIBDIRS := $(LIBNDS) #lib | |
64 | +LIBS := #-lfreetype | |
80 | 65 | |
81 | -#---- | |
82 | -# no real need to edit anything past this point unless you need to add additional | |
83 | -# rules for different file extensions | |
84 | -#---- | |
66 | +LIBDIRS := $(LIBNDS) #lib | |
67 | + | |
85 | 68 | ifneq ($(CONF),$(notdir $(CURDIR))) |
86 | -#---- | |
87 | 69 | |
88 | 70 | export OUTPUT := $(RELEASEDIR)/lib$(TARGET).a |
89 | 71 |
@@ -96,35 +78,16 @@ | ||
96 | 78 | CFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.c)) |
97 | 79 | CPPFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.cpp)) |
98 | 80 | SFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.s)) |
99 | -PCXFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.pcx)) | |
100 | 81 | BINFILES := $(foreach dir,$(DATA),$(wildcard $(dir)/*.bin)) |
101 | 82 | |
102 | -PNGFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.png)) | |
103 | -PALFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.pal)) | |
104 | -RAWFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.raw)) | |
105 | -MAPFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.map)) | |
106 | -JPEGFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.jpg)) | |
107 | -MODFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.mod)) | |
108 | -GIFFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.gif)) | |
109 | -BMPFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.bmp)) | |
110 | -MP3FILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.mp3)) | |
111 | - | |
112 | -#---- | |
113 | -# use CXX for linking C++ projects, CC for standard C | |
114 | -#---- | |
115 | 83 | ifeq ($(strip $(CPPFILES)),) |
116 | 84 | export LD := $(CC) |
117 | 85 | else |
118 | 86 | export LD := $(CXX) |
119 | 87 | endif |
120 | 88 | |
121 | -export OFILES := $(addsuffix .o,$(MAPFILES)) $(addsuffix .o,$(RAWFILES)) \ | |
122 | - $(addsuffix .o,$(PALFILES)) $(addsuffix .o,$(BINFILES)) \ | |
123 | - $(addsuffix .o,$(MODFILES)) $(addsuffix .o,$(BMPFILES)) \ | |
124 | - $(addsuffix .o,$(JPEGFILES)) $(addsuffix .o,$(GIFFILES)) \ | |
125 | - $(addsuffix .o,$(PNGFILES)) \ | |
126 | - $(addsuffix .o,$(PCXFILES)) $(addsuffix .o,$(MP3FILES)) \ | |
127 | - $(addsuffix .o,$(CPPFILES)) $(addsuffix .o,$(CFILES)) $(addsuffix .o,$(SFILES)) | |
89 | +export OFILES := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(CPPFILES)) \ | |
90 | + $(addsuffix .o,$(CFILES)) $(addsuffix .o,$(SFILES)) | |
128 | 91 | |
129 | 92 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ |
130 | 93 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ |
@@ -158,23 +121,11 @@ | ||
158 | 121 | |
159 | 122 | DEPENDS := $(OFILES:.o=.d) |
160 | 123 | |
161 | -#---- | |
162 | -# main targets | |
163 | -#---- | |
164 | - | |
165 | 124 | $(OUTPUT) : $(OFILES) |
166 | 125 | @rm -f "$(OUTPUT)" |
167 | 126 | @echo Linking $(notdir $@) ... |
168 | 127 | @$(AR) rcs "$(OUTPUT)" $(foreach file,$(OFILES),$(DEPSDIR)/$(file)) |
169 | 128 | |
170 | -#---- | |
171 | -# you need a rule like this for each extension you use as binary data | |
172 | -#---- | |
173 | - | |
174 | -#---- | |
175 | -# Compile Targets for C/C++ | |
176 | -#---- | |
177 | - | |
178 | 129 | %.cpp.o : %.cpp |
179 | 130 | @echo $< |
180 | 131 | @[ -d $(dir $(DEPSDIR)/$@) ] || mkdir -p $(dir $(DEPSDIR)/$@) |
@@ -200,66 +151,11 @@ | ||
200 | 151 | echo "extern const unsigned" $(notdir $(*))_size";" >> $(DEPSDIR)/$(*).h |
201 | 152 | endef |
202 | 153 | |
203 | -%.mp3.o : %.mp3 | |
204 | - @echo $< | |
205 | - @$(bin2o) | |
206 | - | |
207 | -%.pcx.o : %.pcx | |
208 | - @echo $< | |
209 | - @$(bin2o) | |
210 | - | |
211 | -%.bin.o : %.bin | |
212 | - @echo $< | |
213 | - @$(bin2o) | |
214 | - | |
215 | -%.png.o : %.png | |
216 | - @echo $< | |
217 | - @$(bin2o) | |
218 | - | |
219 | -%.raw.o : %.raw | |
220 | - @echo $< | |
221 | - @$(bin2o) | |
222 | - | |
223 | -%.pal.o : %.pal | |
224 | - @echo $< | |
225 | - @$(bin2o) | |
226 | - | |
227 | -%.map.o : %.map | |
154 | +%.bin.o : %.bin | |
228 | 155 | @echo $< |
229 | 156 | @$(bin2o) |
230 | 157 | |
231 | -%.mdl.o : %.mdl | |
232 | - @echo $< | |
233 | - @$(bin2o) | |
234 | - | |
235 | -%.jpg.o : %.jpg | |
236 | - @echo $< | |
237 | - @$(bin2o) | |
238 | - | |
239 | -%.mod.o : %.mod | |
240 | - @echo $< | |
241 | - @$(bin2o) | |
242 | - | |
243 | -%.gif.o : %.gif | |
244 | - @echo $< | |
245 | - @$(bin2o) | |
246 | - | |
247 | -%.bmp.o : %.bmp | |
248 | - @echo $< | |
249 | - @$(bin2o) | |
250 | - | |
251 | -#---- | |
252 | -# This rule creates assembly source files using grit | |
253 | -# grit takes an image file and a .grit describing how the file is to be processed | |
254 | -# add additional rules like this for each image extension | |
255 | -# you use in the graphics folders | |
256 | -#---- | |
257 | -%.s %.h : %.png %.grit | |
258 | - grit $< -fts -o$* | |
259 | - | |
260 | 158 | -include $(foreach file,$(DEPENDS),$(DEPSDIR)/$(file)) |
261 | 159 | |
262 | -#---- | |
263 | 160 | endif |
264 | -#---- | |
265 | 161 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | # |
2 | -# (C) 2009-2016 FrankHB. | |
2 | +# (C) 2009-2016, 2020 FrankHB. | |
3 | 3 | # |
4 | 4 | # This file is part of the YSLib project, and may only be used, |
5 | 5 | # modified, and distributed under the terms of the YSLib project |
@@ -8,9 +8,9 @@ | ||
8 | 8 | # understand and accept it fully. |
9 | 9 | # |
10 | 10 | # DS Makefile for YFramework -> ARM9 |
11 | -# Version = r2074 | |
11 | +# Version = r2186 | |
12 | 12 | # Created = 2009-12-18 12:27:40 +0800 |
13 | -# Updated = 2016-04-12 22:20 +0800 | |
13 | +# Updated = 2020-12-14 02:30 +0800 | |
14 | 14 | # Encoding = ANSI |
15 | 15 | |
16 | 16 |
@@ -21,10 +21,6 @@ | ||
21 | 21 | SHBuild_ToolDir := $(dir $(lastword $(MAKEFILE_LIST)))/../../Tools/Scripts |
22 | 22 | include $(SHBuild_ToolDir)/Toolchain.DS.mk |
23 | 23 | |
24 | -# NOTE: Option '-Wno-redundant-decls' is workaround for libnds. | |
25 | -CFLAGS_COMMON := $(CFLAGS_COMMON) -Wno-cast-align -Wno-redundant-decls | |
26 | -CXXFLAGS_COMMON := $(CXXFLAGS_COMMON) -Wno-cast-align -Wno-redundant-decls | |
27 | - | |
28 | 24 | # PROJNAME is the name of the project |
29 | 25 | # CONF is the configuration name |
30 | 26 | # RELEASE is the directory name for object files and intermediate files will be placed |
@@ -35,7 +31,6 @@ | ||
35 | 31 | # SOURCES is a list of directories containing source code |
36 | 32 | # INCLUDES is a list of directories containing extra header files |
37 | 33 | # DATA is a list of directories containing binary files embedded using bin2o |
38 | -# GRAPHICS is a list of directories containing image files to be converted with grit | |
39 | 34 | |
40 | 35 | export PROJNAME ?= YFramework |
41 | 36 | export CONF ?= release |
@@ -56,24 +51,24 @@ | ||
56 | 51 | ../../3rdparty/include ../../3rdparty/freetype/include |
57 | 52 | export DATA := data $(REFDIR)/data |
58 | 53 | |
59 | -# options for code generation | |
60 | 54 | ARCH := $(ARCH_ARM9) |
61 | 55 | ARCH_AS := $(ARCH_AS_ARM9) |
62 | 56 | ASFLAGS := $(ASFLAGS_ARM9) |
63 | -CFLAGS := $(INCLUDE) $(C_CXXFLAGS_ARM9) $(CFLAGS_COMMON) | |
64 | -CXXFLAGS := $(INCLUDE) $(C_CXXFLAGS_ARM9) $(CXXFLAGS_COMMON) \ | |
65 | - -fno-threadsafe-statics -fuse-cxa-atexit -Wsign-promo | |
66 | -# -Wnoexcept -Wold-style-cast -Wsign-promo | |
57 | +# NOTE: Options '-Wno-redundant-decls' and '-Wno-ignored-qualifiers' are the | |
58 | +# workaround for libnds. | |
59 | +CFLAGS := $(CFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS_ARM9) $(C_CXXFLAGS_COMMON) \ | |
60 | + $(CFLAGS_WARNING) -Wno-cast-align -Wno-redundant-decls \ | |
61 | + -Wno-ignored-qualifiers | |
62 | +CXXFLAGS := $(CXXFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS_ARM9) $(C_CXXFLAGS_COMMON) \ | |
63 | + $(CXXFLAGS_WARNING) $(CXXFLAGS_IMPL_COMMON) -fno-threadsafe-statics \ | |
64 | + -fuse-cxa-atexit -Wno-cast-align -Wno-redundant-decls \ | |
65 | + -Wno-ignored-qualifiers | |
66 | +# -Wnoexcept -Wold-style-cast | |
67 | 67 | |
68 | -# any extra libraries we wish to link with the project | |
69 | -LIBS := # | |
68 | +LIBS := # | |
70 | 69 | |
71 | -# list of directories containing libraries, this must be the top level containing | |
72 | -# include and lib | |
73 | -LIBDIRS := $(LIBNDS) #lib | |
70 | +LIBDIRS := $(LIBNDS) #lib | |
74 | 71 | |
75 | -# no real need to edit anything past this point unless you need to add additional | |
76 | -# rules for different file extensions | |
77 | 72 | ifneq ($(CONF),$(notdir $(CURDIR))) |
78 | 73 | |
79 | 74 | export OUTPUT := $(RELEASEDIR)/lib$(TARGET).a |
@@ -87,50 +82,16 @@ | ||
87 | 82 | CFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.c)) |
88 | 83 | CPPFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.cpp)) |
89 | 84 | SFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.s)) |
90 | -PCXFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.pcx)) | |
91 | 85 | BINFILES := $(foreach dir,$(DATA),$(wildcard $(dir)/*.bin)) |
92 | 86 | |
93 | -ifeq ($(strip $(AUDIOFILES)),) | |
94 | - ifeq ($(strip $(ARM7_SELECTED)), ARM7_MAXMOD_DSWIFI) | |
95 | - TEXT_TO_SAY_2 := No MaxMod-compatible files were found in the audio folder. | |
96 | - TEXT_TO_SAY_3 := If you are loading the soundbank from FAT or EFS, ignore this message. | |
97 | - TEXT_TO_SAY_4 := " " | |
98 | - endif | |
99 | - DONT_BUILD_MAXMOD_SOUNDBANK = YES | |
100 | -endif | |
101 | - | |
102 | -ifneq ($(strip $(DONT_BUILD_MAXMOD_SOUNDBANK)), YES) | |
103 | - ifeq ($(strip $(ARM7_SELECTED)), ARM7_MAXMOD_DSWIFI) | |
104 | - BINFILES += soundbank_bin.bin | |
105 | - endif | |
106 | -endif | |
107 | - | |
108 | -PNGFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.png)) | |
109 | -PALFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.pal)) | |
110 | -RAWFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.raw)) | |
111 | -MAPFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.map)) | |
112 | -JPEGFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.jpg)) | |
113 | -MODFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.mod)) | |
114 | -GIFFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.gif)) | |
115 | -BMPFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.bmp)) | |
116 | -MP3FILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.mp3)) | |
117 | - | |
118 | -#---- | |
119 | -# use CXX for linking C++ projects, CC for standard C | |
120 | -#---- | |
121 | 87 | ifeq ($(strip $(CPPFILES)),) |
122 | 88 | export LD := $(CC) |
123 | 89 | else |
124 | 90 | export LD := $(CXX) |
125 | 91 | endif |
126 | 92 | |
127 | -export OFILES := $(addsuffix .o,$(MAPFILES)) $(addsuffix .o,$(RAWFILES)) \ | |
128 | - $(addsuffix .o,$(PALFILES)) $(addsuffix .o,$(BINFILES)) \ | |
129 | - $(addsuffix .o,$(MODFILES)) $(addsuffix .o,$(BMPFILES)) \ | |
130 | - $(addsuffix .o,$(JPEGFILES)) $(addsuffix .o,$(GIFFILES)) \ | |
131 | - $(addsuffix .o,$(PNGFILES)) \ | |
132 | - $(addsuffix .o,$(PCXFILES)) $(addsuffix .o,$(MP3FILES)) \ | |
133 | - $(addsuffix .o,$(CPPFILES)) $(addsuffix .o,$(CFILES)) $(addsuffix .o,$(SFILES)) | |
93 | +export OFILES := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(CPPFILES)) \ | |
94 | + $(addsuffix .o,$(CFILES)) $(addsuffix .o,$(SFILES)) | |
134 | 95 | |
135 | 96 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ |
136 | 97 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ |
@@ -141,7 +102,6 @@ | ||
141 | 102 | |
142 | 103 | .PHONY: $(CONF) clean rebuild all |
143 | 104 | |
144 | -#---- | |
145 | 105 | $(CONF): |
146 | 106 | @echo Building configuration: $(notdir $@) ... |
147 | 107 | @[ -d $(BUILDDIR)/dummy ] || mkdir -p $(BUILDDIR)/dummy |
@@ -149,7 +109,6 @@ | ||
149 | 109 | @$(MAKE) --no-print-directory -C $(BUILDDIR) -f $(CURDIR)/Makefile |
150 | 110 | @echo Built configuration: $(notdir $@). |
151 | 111 | |
152 | -#---- | |
153 | 112 | clean: |
154 | 113 | @echo Cleaning $(TARGET) of $(PLATFORM) ... |
155 | 114 | @rm -f $(foreach file,$(OFILES:.o=.d),$(DEPSDIR)/$(file)) |
@@ -161,28 +120,15 @@ | ||
161 | 120 | |
162 | 121 | all: $(CONF) $(OUTPUT) |
163 | 122 | |
164 | -#---- | |
165 | 123 | else |
166 | 124 | |
167 | 125 | DEPENDS := $(OFILES:.o=.d) |
168 | 126 | |
169 | -#---- | |
170 | -# main targets | |
171 | -#---- | |
172 | - | |
173 | -$(OUTPUT) : $(OFILES) | |
127 | +$(OUTPUT) : $(OFILES) | |
174 | 128 | @rm -f "$(OUTPUT)" |
175 | 129 | @echo Linking $(notdir $@) ... |
176 | 130 | @$(AR) rcs "$(OUTPUT)" $(foreach file,$(OFILES),$(DEPSDIR)/$(file)) |
177 | 131 | |
178 | -#---- | |
179 | -# you need a rule like this for each extension you use as binary data | |
180 | -#---- | |
181 | - | |
182 | -#---- | |
183 | -# Compile Targets for C/C++ | |
184 | -#---- | |
185 | - | |
186 | 132 | %.cpp.o : %.cpp |
187 | 133 | @echo $< |
188 | 134 | @[ -d $(dir $(DEPSDIR)/$@) ] || mkdir -p $(dir $(DEPSDIR)/$@) |
@@ -208,66 +154,11 @@ | ||
208 | 154 | echo "extern const u32" $(notdir $(*))_size";" >> $(DEPSDIR)/$(*).h |
209 | 155 | endef |
210 | 156 | |
211 | -%.mp3.o : %.mp3 | |
212 | - @echo $< | |
213 | - @$(bin2o) | |
214 | - | |
215 | -%.pcx.o : %.pcx | |
216 | - @echo $< | |
217 | - @$(bin2o) | |
218 | - | |
219 | -%.bin.o : %.bin | |
220 | - @echo $< | |
221 | - @$(bin2o) | |
222 | - | |
223 | -%.png.o : %.png | |
224 | - @echo $< | |
225 | - @$(bin2o) | |
226 | - | |
227 | -%.raw.o : %.raw | |
228 | - @echo $< | |
229 | - @$(bin2o) | |
230 | - | |
231 | -%.pal.o : %.pal | |
232 | - @echo $< | |
233 | - @$(bin2o) | |
234 | - | |
235 | -%.map.o : %.map | |
157 | +%.bin.o : %.bin | |
236 | 158 | @echo $< |
237 | 159 | @$(bin2o) |
238 | 160 | |
239 | -%.mdl.o : %.mdl | |
240 | - @echo $< | |
241 | - @$(bin2o) | |
242 | - | |
243 | -%.jpg.o : %.jpg | |
244 | - @echo $< | |
245 | - @$(bin2o) | |
246 | - | |
247 | -%.mod.o : %.mod | |
248 | - @echo $< | |
249 | - @$(bin2o) | |
250 | - | |
251 | -%.gif.o : %.gif | |
252 | - @echo $< | |
253 | - @$(bin2o) | |
254 | - | |
255 | -%.bmp.o : %.bmp | |
256 | - @echo $< | |
257 | - @$(bin2o) | |
258 | - | |
259 | -#---- | |
260 | -# This rule creates assembly source files using grit | |
261 | -# grit takes an image file and a .grit describing how the file is to be processed | |
262 | -# add additional rules like this for each image extension | |
263 | -# you use in the graphics folders | |
264 | -#---- | |
265 | -%.s %.h : %.png %.grit | |
266 | - grit $< -fts -o$* | |
267 | - | |
268 | 161 | -include $(foreach file,$(DEPENDS),$(DEPSDIR)/$(file)) |
269 | 162 | |
270 | -#---- | |
271 | 163 | endif |
272 | -#---- | |
273 | 164 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2013-2016, 2018 FrankHB. | |
2 | + © 2013-2016, 2018, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -12,13 +12,13 @@ | ||
12 | 12 | \ingroup Helper |
13 | 13 | \ingroup DS |
14 | 14 | \brief DS 宿主窗口。 |
15 | -\version r136 | |
15 | +\version r138 | |
16 | 16 | \author FrankHB <frankhb1989@gmail.com> |
17 | 17 | \since build 398 |
18 | 18 | \par 创建时间: |
19 | 19 | 2013-04-11 10:32:56 +0800 |
20 | 20 | \par 修改时间: |
21 | - 2018-11-16 23:25 +0800 | |
21 | + 2020-12-24 12:06 +0800 | |
22 | 22 | \par 文本编码: |
23 | 23 | UTF-8 |
24 | 24 | \par 非公开模块名称: |
@@ -73,7 +73,7 @@ | ||
73 | 73 | \sa HostWindow::MapPoint |
74 | 74 | \since build 518 |
75 | 75 | */ |
76 | - YSLib::Drawing::Point | |
76 | + YB_ATTR_nodiscard YB_PURE YSLib::Drawing::Point | |
77 | 77 | MapPoint(const YSLib::Drawing::Point&) const override; |
78 | 78 | |
79 | 79 | //! \since build 591 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2013-2016 FrankHB. | |
2 | + © 2013-2016, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -12,13 +12,13 @@ | ||
12 | 12 | \ingroup YCLib |
13 | 13 | \ingroup Win32 |
14 | 14 | \brief COM 接口。 |
15 | -\version r536 | |
15 | +\version r539 | |
16 | 16 | \author FrankHB <frankhb1989@gmail.com> |
17 | 17 | \since build 412 |
18 | 18 | \par 创建时间: |
19 | 19 | 2012-06-07 10:29:30 +0800 |
20 | 20 | \par 修改时间: |
21 | - 2016-07-14 23:04 +0800 | |
21 | + 2020-12-24 12:09 +0800 | |
22 | 22 | \par 文本编码: |
23 | 23 | UTF-8 |
24 | 24 | \par 模块名称: |
@@ -26,8 +26,8 @@ | ||
26 | 26 | */ |
27 | 27 | |
28 | 28 | |
29 | -#ifndef YCL_MinGW32_INC_COMPtr_h_ | |
30 | -#define YCL_MinGW32_INC_COMPtr_h_ 1 | |
29 | +#ifndef YCL_Win32_INC_COMPtr_h_ | |
30 | +#define YCL_Win32_INC_COMPtr_h_ 1 | |
31 | 31 | |
32 | 32 | #include "YCLib/YModules.h" |
33 | 33 | #include YFM_Win32_YCLib_MinGW32 // for platform_ex, std::runtime_error, |
@@ -12,13 +12,13 @@ | ||
12 | 12 | \ingroup YCLib |
13 | 13 | \ingroup Win32 |
14 | 14 | \brief 控制台。 |
15 | -\version r316 | |
15 | +\version r327 | |
16 | 16 | \author FrankHB <frankhb1989@gmail.com> |
17 | 17 | \since build 520 |
18 | 18 | \par 创建时间: |
19 | 19 | 2013-05-09 11:01:12 +0800 |
20 | 20 | \par 修改时间: |
21 | - 2020-01-27 02:40 +0800 | |
21 | + 2020-12-24 12:09 +0800 | |
22 | 22 | \par 文本编码: |
23 | 23 | UTF-8 |
24 | 24 | \par 模块名称: |
@@ -26,8 +26,8 @@ | ||
26 | 26 | */ |
27 | 27 | |
28 | 28 | |
29 | -#ifndef YCL_MinGW32_INC_Consoles_h_ | |
30 | -#define YCL_MinGW32_INC_Consoles_h_ | |
29 | +#ifndef YCL_Win32_INC_Consoles_h_ | |
30 | +#define YCL_Win32_INC_Consoles_h_ | |
31 | 31 | |
32 | 32 | #include "YCLib/YModules.h" |
33 | 33 | #include YFM_Win32_YCLib_MinGW32 |
@@ -82,8 +82,8 @@ | ||
82 | 82 | }; |
83 | 83 | |
84 | 84 | private: |
85 | - //! \since build 559 | |
86 | - ::HANDLE h_std; | |
85 | + //! \since build 906 | |
86 | + ::HANDLE h_out; | |
87 | 87 | //! \since build 519 |
88 | 88 | ::WORD saved_attr; |
89 | 89 |
@@ -187,26 +187,31 @@ | ||
187 | 187 | \brief 输出字符串。 |
188 | 188 | \pre 断言:第一参数的数据指针非空。 |
189 | 189 | \return 输出的字符数。 |
190 | + \note 因为 Windows 控制台的限制,不保证可正确输出 Unicode BMP 外的代码点。 | |
190 | 191 | \since build 645 |
191 | 192 | */ |
192 | 193 | //@{ |
194 | + //! \note 使用 UTF-8 字符串。 | |
193 | 195 | size_t |
194 | 196 | WriteString(string_view); |
195 | - //! \note 第二参数为代码页。 | |
197 | + //! \note 第二参数为指定第一参数的编码的代码页。 | |
196 | 198 | size_t |
197 | 199 | WriteString(string_view, unsigned); |
200 | + //! \note 使用 UTF-16LE 字符串。 | |
201 | + //@{ | |
198 | 202 | size_t |
199 | 203 | WriteString(wstring_view); |
200 | 204 | PDefH(size_t, WriteString, u16string_view sv) |
201 | 205 | ImplRet(WriteString(wstring(sv.cbegin(), sv.cend()))) |
202 | 206 | //@} |
203 | 207 | //@} |
208 | + //@} | |
204 | 209 | }; |
205 | 210 | |
206 | 211 | /*! |
207 | 212 | \ingroup helper_functions |
208 | 213 | \brief 创建控制台对象。 |
209 | -\return 指向新创建的控制台对象的指针,若失败则为空。 | |
214 | +\return 指向新创建的控制台对象的指针,若构造失败则为空。 | |
210 | 215 | \note 不抛出 Win32Exception 。 |
211 | 216 | \relates WConsole |
212 | 217 | \since build 593 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2013-2016, 2018 FrankHB. | |
2 | + © 2013-2016, 2018, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -12,13 +12,13 @@ | ||
12 | 12 | \ingroup YCLib |
13 | 13 | \ingroup Win32 |
14 | 14 | \brief 注册表。 |
15 | -\version r145 | |
15 | +\version r148 | |
16 | 16 | \author FrankHB <frankhb1989@gmail.com> |
17 | 17 | \since build 412 |
18 | 18 | \par 创建时间: |
19 | 19 | 2015-09-12 19:33:37 +0800 |
20 | 20 | \par 修改时间: |
21 | - 2018-08-21 20:44 +0800 | |
21 | + 2020-12-24 12:09 +0800 | |
22 | 22 | \par 文本编码: |
23 | 23 | UTF-8 |
24 | 24 | \par 模块名称: |
@@ -26,8 +26,8 @@ | ||
26 | 26 | */ |
27 | 27 | |
28 | 28 | |
29 | -#ifndef YCL_MinGW32_INC_Registry_h_ | |
30 | -#define YCL_MinGW32_INC_Registry_h_ 1 | |
29 | +#ifndef YCL_Win32_INC_Registry_h_ | |
30 | +#define YCL_Win32_INC_Registry_h_ 1 | |
31 | 31 | |
32 | 32 | #include "YCLib/YModules.h" |
33 | 33 | #include YFM_Win32_YCLib_MinGW32 // for platform::Nonnull, wstring, vector, |
@@ -12,13 +12,13 @@ | ||
12 | 12 | \ingroup YCLib |
13 | 13 | \ingroup Win32 |
14 | 14 | \brief 控制台。 |
15 | -\version r340 | |
15 | +\version r350 | |
16 | 16 | \author FrankHB <frankhb1989@gmail.com> |
17 | 17 | \since build 403 |
18 | 18 | \par 创建时间: |
19 | 19 | 2013-05-09 11:01:35 +0800 |
20 | 20 | \par 修改时间: |
21 | - 2020-01-27 02:31 +0800 | |
21 | + 2020-12-24 12:09 +0800 | |
22 | 22 | \par 文本编码: |
23 | 23 | UTF-8 |
24 | 24 | \par 模块名称: |
@@ -78,10 +78,10 @@ | ||
78 | 78 | : WConsole(::GetStdHandle(dev)) |
79 | 79 | {} |
80 | 80 | WConsole::WConsole(::HANDLE h) |
81 | - : h_std(h), saved_attr(GetScreenBufferInfo().wAttributes), | |
81 | + : h_out(h), saved_attr(GetScreenBufferInfo().wAttributes), | |
82 | 82 | Attributes(saved_attr) |
83 | 83 | { |
84 | - YAssert(h_std && h_std != INVALID_HANDLE_VALUE, "Invalid handle found."); | |
84 | + YAssert(h_out && h_out != INVALID_HANDLE_VALUE, "Invalid handle found."); | |
85 | 85 | } |
86 | 86 | WConsole::~WConsole() |
87 | 87 | { |
@@ -93,7 +93,7 @@ | ||
93 | 93 | { |
94 | 94 | ::CONSOLE_SCREEN_BUFFER_INFO info; |
95 | 95 | |
96 | - YCL_CallF_Win32(GetConsoleScreenBufferInfo, h_std, &info); | |
96 | + YCL_CallF_Win32(GetConsoleScreenBufferInfo, h_out, &info); | |
97 | 97 | return info; |
98 | 98 | } |
99 | 99 |
@@ -115,7 +115,7 @@ | ||
115 | 115 | WConsole::SetCursorPosition(::COORD pos) |
116 | 116 | { |
117 | 117 | // NOTE: %::SetConsoleCursorPosition expects 1-based. |
118 | - YCL_CallF_Win32(SetConsoleCursorPosition, h_std, | |
118 | + YCL_CallF_Win32(SetConsoleCursorPosition, h_out, | |
119 | 119 | {short(pos.X + 1), short(pos.Y + 1)}); |
120 | 120 | } |
121 | 121 | void |
@@ -154,9 +154,9 @@ | ||
154 | 154 | void |
155 | 155 | WConsole::Fill(::COORD coord, unsigned long n, wchar_t c) |
156 | 156 | { |
157 | - YCL_CallF_Win32(FillConsoleOutputCharacterW, h_std, c, n, coord, {}); | |
158 | - YCL_CallF_Win32(FillConsoleOutputAttribute, h_std, Attributes, n, coord, {}); | |
159 | - YCL_CallF_Win32(SetConsoleCursorPosition, h_std, {coord.X, coord.Y}); | |
157 | + YCL_CallF_Win32(FillConsoleOutputCharacterW, h_out, c, n, coord, {}); | |
158 | + YCL_CallF_Win32(FillConsoleOutputAttribute, h_out, Attributes, n, coord, {}); | |
159 | + YCL_CallF_Win32(SetConsoleCursorPosition, h_out, {coord.X, coord.Y}); | |
160 | 160 | } |
161 | 161 | |
162 | 162 | void |
@@ -174,7 +174,7 @@ | ||
174 | 174 | void |
175 | 175 | WConsole::Update(::WORD value) |
176 | 176 | { |
177 | - YCL_CallF_Win32(SetConsoleTextAttribute, h_std, value); | |
177 | + YCL_CallF_Win32(SetConsoleTextAttribute, h_out, value); | |
178 | 178 | } |
179 | 179 | |
180 | 180 | void |
@@ -195,7 +195,6 @@ | ||
195 | 195 | WConsole::WriteString(string_view sv) |
196 | 196 | { |
197 | 197 | YAssertNonnull(sv.data()); |
198 | - // FIXME: Support for non-BMP characters. | |
199 | 198 | return WriteString(UTF8ToWCS(sv)); |
200 | 199 | } |
201 | 200 | size_t |
@@ -211,7 +210,7 @@ | ||
211 | 210 | |
212 | 211 | unsigned long n; |
213 | 212 | |
214 | - YCL_CallF_Win32(WriteConsoleW, h_std, sv.data(), | |
213 | + YCL_CallF_Win32(WriteConsoleW, h_out, sv.data(), | |
215 | 214 | static_cast<unsigned long>(sv.length()), &n, yimpl({})); |
216 | 215 | return size_t(n); |
217 | 216 | } |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2013-2016 FrankHB. | |
2 | + © 2013-2016, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file Environment.h |
12 | 12 | \ingroup Helper |
13 | 13 | \brief 环境。 |
14 | -\version r1068 | |
14 | +\version r1072 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 521 |
17 | 17 | \par 创建时间: |
18 | 18 | 2013-02-08 01:28:03 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2016-05-16 13:29 +0800 | |
20 | + 2020-12-24 12:05 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -66,13 +66,12 @@ | ||
66 | 66 | \brief 环境根节点。 |
67 | 67 | \since build 688 |
68 | 68 | */ |
69 | - ValueNode Root; | |
69 | + ValueNode Root{}; | |
70 | 70 | |
71 | -public: | |
72 | 71 | /*! |
73 | 72 | \brief 构造:初始化环境。 |
74 | 73 | \note Win32 平台:尝试无参数调用 FixConsoleHandler ,若失败则跟踪警告。 |
75 | - \sa Application::AddExitGuard | |
74 | + \sa Application::AddExit | |
76 | 75 | \since build 693 |
77 | 76 | */ |
78 | 77 | Environment(Application&); |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file NPLA.h |
12 | 12 | \ingroup NPL |
13 | 13 | \brief NPLA 公共接口。 |
14 | -\version r7993 | |
14 | +\version r8005 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 663 |
17 | 17 | \par 创建时间: |
18 | 18 | 2016-01-07 10:32:34 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2020-11-18 14:46 +0800 | |
20 | + 2020-12-23 19:48 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -895,14 +895,14 @@ | ||
895 | 895 | TryAccessLeaf(TermNode& term) |
896 | 896 | { |
897 | 897 | return term.Value.type() == ystdex::type_id<_type>() ? NPL::make_observer( |
898 | - std::addressof(term.Value.GetObject<_type>())) : nullptr; | |
898 | + std::addressof(term.Value.GetObject<_type>())) : nullptr; | |
899 | 899 | } |
900 | 900 | template<typename _type> |
901 | 901 | YB_ATTR_nodiscard YB_PURE inline observer_ptr<const _type> |
902 | 902 | TryAccessLeaf(const TermNode& term) |
903 | 903 | { |
904 | 904 | return term.Value.type() == ystdex::type_id<_type>() ? NPL::make_observer( |
905 | - std::addressof(term.Value.GetObject<_type>())) : nullptr; | |
905 | + std::addressof(term.Value.GetObject<_type>())) : nullptr; | |
906 | 906 | } |
907 | 907 | //@} |
908 | 908 |
@@ -1228,13 +1228,10 @@ | ||
1228 | 1228 | }; |
1229 | 1229 | |
1230 | 1230 | /*! |
1231 | -\sa TermNode::Tags | |
1232 | -\relates TermReference | |
1233 | -*/ | |
1234 | -//@{ | |
1235 | -/*! | |
1236 | 1231 | \brief 折叠项引用。 |
1237 | 1232 | \return 结果引用值及初始化时是否表示引用值。 |
1233 | +\relates TermReference | |
1234 | +\sa TermNode::Tags | |
1238 | 1235 | \since build 857 |
1239 | 1236 | |
1240 | 1237 | 若被参数引用值引用的对象是否是一个引用值,结果为合并标签后的被后者引用的对象和 true ; |
@@ -1244,6 +1241,7 @@ | ||
1244 | 1241 | YB_ATTR_nodiscard YF_API pair<TermReference, bool> |
1245 | 1242 | Collapse(TermReference); |
1246 | 1243 | |
1244 | + | |
1247 | 1245 | /*! |
1248 | 1246 | \brief 准备折叠项引用。 |
1249 | 1247 | \pre 间接断言:第一参数不指定引用值时第二参数非空。 |
@@ -1260,7 +1258,6 @@ | ||
1260 | 1258 | */ |
1261 | 1259 | YB_ATTR_nodiscard YF_API TermNode |
1262 | 1260 | PrepareCollapse(TermNode&, const shared_ptr<Environment>&); |
1263 | -//@} | |
1264 | 1261 | |
1265 | 1262 | /*! |
1266 | 1263 | \brief 访问项并取解析 TermReference 间接值后的引用。 |
@@ -2282,9 +2279,10 @@ | ||
2282 | 2279 | /*! |
2283 | 2280 | \brief 根据当前状态创建指定项的引用。 |
2284 | 2281 | \note 项通常表示当前环境对象所有的被绑定对象。 |
2285 | - \since build 871 | |
2282 | + \since build 906 | |
2286 | 2283 | */ |
2287 | - PDefH(TermTags, MakeTermTags, const TermNode& term) const | |
2284 | + YB_ATTR_nodiscard YB_PURE | |
2285 | + PDefH(TermTags, MakeTermTags, const TermNode& term) const ynothrow | |
2288 | 2286 | ImplRet(Frozen ? term.Tags | TermTags::Nonmodifying : term.Tags) |
2289 | 2287 | |
2290 | 2288 | /*! |
@@ -2631,7 +2629,7 @@ | ||
2631 | 2629 | */ |
2632 | 2630 | ContextNode(pmr::memory_resource&); |
2633 | 2631 | /*! |
2634 | - \brief 构造:使用对象副本和环境指针。 | |
2632 | + \brief 构造:使用对象副本和环境指针。 | |
2635 | 2633 | \throw std::invalid_argument 参数指针为空。 |
2636 | 2634 | \sa Environment::ThrowForInvalidValue |
2637 | 2635 | \since build 788 |
@@ -12,13 +12,13 @@ | ||
12 | 12 | \ingroup YCLib |
13 | 13 | \ingroup YCLibLimitedPlatforms |
14 | 14 | \brief 宿主 GUI 接口。 |
15 | -\version r1587 | |
15 | +\version r1596 | |
16 | 16 | \author FrankHB <frankhb1989@gmail.com> |
17 | 17 | \since build 560 |
18 | 18 | \par 创建时间: |
19 | 19 | 2013-07-10 11:29:04 +0800 |
20 | 20 | \par 修改时间: |
21 | - 2020-04-19 03:48 +0800 | |
21 | + 2020-12-16 19:02 +0800 | |
22 | 22 | \par 文本编码: |
23 | 23 | UTF-8 |
24 | 24 | \par 模块名称: |
@@ -435,7 +435,15 @@ | ||
435 | 435 | \invariant bool(p_impl) 。 |
436 | 436 | \since build 593 |
437 | 437 | */ |
438 | - unique_ptr<ScreenBufferData> p_impl{}; | |
438 | + unique_ptr<ScreenBufferData> p_impl | |
439 | +# if !YB_IMPL_GNUCPP || YB_IMPL_GNUCPP >= 90200 | |
440 | + // NOTE: Workaround for a bug fixed in GCC 9.2. The revision of the fix is | |
441 | + // not checked. It seems like an issue of point of instantiation. It is not | |
442 | + // a regression, since all old versions are effected. It has nothing to do | |
443 | + // with LWG 2801. See also https://stackoverflow.com/questions/58375922. | |
444 | + {} | |
445 | +# endif | |
446 | + ; | |
439 | 447 | /*! |
440 | 448 | \brief 宽:以像素数计量的缓冲区的实际宽度。 |
441 | 449 | \since build 498 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2012-2016 FrankHB. | |
2 | + © 2012-2016, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file GUIApplication.cpp |
12 | 12 | \ingroup Helper |
13 | 13 | \brief GUI 应用程序。 |
14 | -\version r578 | |
14 | +\version r582 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 396 |
17 | 17 | \par 创建时间: |
18 | 18 | 2013-04-06 22:42:54 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2016-08-27 15:38 +0800 | |
20 | + 2020-12-24 12:07 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -112,6 +112,9 @@ | ||
112 | 112 | } |
113 | 113 | |
114 | 114 | #if YF_Hosted |
115 | +# if !YCL_Win32 | |
116 | +YB_STATELESS | |
117 | +# endif | |
115 | 118 | observer_ptr<Window> |
116 | 119 | GUIHost::GetForegroundWindow() const ynothrow |
117 | 120 | { |
@@ -235,7 +238,6 @@ | ||
235 | 238 | YAssert(!ApplicationPtr, "Duplicate instance found."); |
236 | 239 | ApplicationPtr = this; |
237 | 240 | } |
238 | - | |
239 | 241 | GUIApplication::~GUIApplication() |
240 | 242 | { |
241 | 243 | lock_guard<recursive_mutex> lck(ApplicationMutex); |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2013-2016 FrankHB. | |
2 | + © 2013-2016, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file HostedUI.cpp |
12 | 12 | \ingroup Helper |
13 | 13 | \brief 宿主环境支持的用户界面。 |
14 | -\version r546 | |
14 | +\version r551 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 389 |
17 | 17 | \par 创建时间: |
18 | 18 | 2013-03-17 10:22:36 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2016-05-02 13:51 +0800 | |
20 | + 2020-12-24 12:07 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -62,7 +62,7 @@ | ||
62 | 62 | using ystdex::pvoid; |
63 | 63 | |
64 | 64 | wnd.MessageMap[WM_DESTROY] += [&]{ |
65 | - PostTask([&, prior]{ | |
65 | + PostTask([&]{ | |
66 | 66 | wgt.SetRenderer({}); |
67 | 67 | }, prior); |
68 | 68 | }; |
@@ -101,6 +101,9 @@ | ||
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | +# if !YCL_Win32 | |
105 | +YB_STATELESS | |
106 | +# endif | |
104 | 107 | Point |
105 | 108 | FetchDefaultTopLevelPosition() ynothrow |
106 | 109 | { |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2014-2016, 2018 FrankHB. | |
2 | + © 2014-2016, 2018, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -12,13 +12,13 @@ | ||
12 | 12 | \ingroup YCLib |
13 | 13 | \ingroup YCLibLimitedPlatforms |
14 | 14 | \brief XCB GUI 接口。 |
15 | -\version r597 | |
15 | +\version r599 | |
16 | 16 | \author FrankHB <frankhb1989@gmail.com> |
17 | 17 | \since build 427 |
18 | 18 | \par 创建时间: |
19 | 19 | 2014-12-14 14:14:31 +0800 |
20 | 20 | \par 修改时间: |
21 | - 2018-11-27 19:07 +0800 | |
21 | + 2020-12-24 12:06 +0800 | |
22 | 22 | \par 文本编码: |
23 | 23 | UTF-8 |
24 | 24 | \par 模块名称: |
@@ -358,7 +358,7 @@ | ||
358 | 358 | return p->atom; |
359 | 359 | return XCB_ATOM_NONE; |
360 | 360 | }(::xcb_intern_atom_unchecked(&c_ref, only_if_exists, n.length(), |
361 | - (Nonnull(n.data()), n.data())))) | |
361 | + Nonnull(n.data())))) | |
362 | 362 | {} |
363 | 363 | |
364 | 364 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | # |
2 | -# (C) 2014, 2016, 2019 FrankHB. | |
2 | +# (C) 2014, 2016, 2019-2020 FrankHB. | |
3 | 3 | # |
4 | 4 | # This file is part of the YSLib project, and may only be used, |
5 | 5 | # modified, and distributed under the terms of the YSLib project |
@@ -8,9 +8,9 @@ | ||
8 | 8 | # understand and accept it fully. |
9 | 9 | # |
10 | 10 | # Android Makefile for YSTest |
11 | -# Version = r350 | |
11 | +# Version = r364 | |
12 | 12 | # Created = 2014-04-17 23:51:27 +0800 |
13 | -# Updated = 2019-09-11 20:47 +0800 | |
13 | +# Updated = 2020-12-14 02:04 +0800 | |
14 | 14 | # Encoding = ANSI |
15 | 15 | |
16 | 16 | .SUFFIXES: |
@@ -67,18 +67,16 @@ | ||
67 | 67 | |
68 | 68 | RESOURCES := $(BUILDDIR)/../../$(PROJNAME)/$(CONF)/resources.ap_ |
69 | 69 | |
70 | -# options for code generation | |
71 | -CFLAGS := $(INCLUDE) $(C_CXXFLAGS) $(CFLAGS_COMMON) | |
72 | -CXXFLAGS := $(INCLUDE) $(C_CXXFLAGS) $(CXXFLAGS_COMMON) \ | |
73 | - -fno-threadsafe-statics -fuse-cxa-atexit -Wctor-dtor-privacy \ | |
74 | - -Wnon-virtual-dtor -Wsign-promo | |
75 | -# -Wnoexcept -Wnon-virtual-dtor -Wold-style-cast -Wsign-promo | |
70 | +CFLAGS := $(CFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS) $(C_CXXFLAGS_COMMON) \ | |
71 | + $(CFLAGS_WARNING) | |
72 | +CXXFLAGS := $(CXXFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS) $(C_CXXFLAGS_COMMON) \ | |
73 | + $(CXXFLAGS_WARNING) $(CXXFLAGS_IMPL_COMMON) -fuse-cxa-atexit | |
74 | +# -Wnoexcept -Wold-style-cast | |
76 | 75 | |
77 | 76 | LDFLAGS := $(LDFLAGS_OPT_DBG) $(ARCH) -Wl,--gc-sections \ |
78 | 77 | -Wl,--no-undefined |
79 | 78 | |
80 | -# any extra libraries we wish to link with the project | |
81 | -LIBS :=-llog -landroid -lEGL -lGLESv1_CM | |
79 | +LIBS := -llog -landroid -lEGL -lGLESv1_CM | |
82 | 80 | LIBCRYSTAX_STATIC ?= |
83 | 81 | #LIBCRYSTAX_STATIC ?= -u __crystax_on_load -u __crystax_on_unload \ |
84 | 82 | -Wl,-z,muldefs -Wl,--eh-frame-hdr -L$(BUILDDIR) -lstdc++ \ |
@@ -91,8 +89,6 @@ | ||
91 | 89 | YBASE_A := $(BUILDDIR)/../../YBase/$(RELEASE)/libYBase.a |
92 | 90 | YFRAMEWORK_A := $(BUILDDIR)/../../YFramework/$(RELEASE)/libYFramework.a |
93 | 91 | |
94 | -# list of directories containing libraries, this must be the top level | |
95 | -# containing include and lib | |
96 | 92 | LIBDIRS := |
97 | 93 | |
98 | 94 | ifneq ($(RELEASE),$(notdir $(CURDIR))) |
@@ -106,15 +102,14 @@ | ||
106 | 102 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) |
107 | 103 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) |
108 | 104 | |
109 | -# use CXX for linking C++ projects, CC for standard C | |
110 | 105 | ifeq ($(strip $(CPPFILES)),) |
111 | 106 | export LD := $(CC) |
112 | 107 | else |
113 | 108 | export LD := $(CXX) |
114 | 109 | endif |
115 | 110 | |
116 | -export OFILES := $(addsuffix .o,$(MAPFILES)) $(addsuffix .o,$(BINFILES)) \ | |
117 | - $(addsuffix .o,$(CPPFILES)) $(addsuffix .o,$(CFILES)) $(addsuffix .o,$(SFILES)) | |
111 | +export OFILES := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(CPPFILES)) \ | |
112 | + $(addsuffix .o,$(CFILES)) $(addsuffix .o,$(SFILES)) | |
118 | 113 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ |
119 | 114 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ |
120 | 115 | -I$(CURDIR)/$(CONF) |
@@ -142,7 +137,6 @@ | ||
142 | 137 | |
143 | 138 | rebuild: all |
144 | 139 | |
145 | -# main targets | |
146 | 140 | all: $(CONF) $(OUTPUT_FINAL) |
147 | 141 | |
148 | 142 | else |
@@ -1,5 +1,5 @@ | ||
1 | 1 | # |
2 | -# (C) 2009-2014, 2016, 2018 FrankHB. | |
2 | +# (C) 2009-2014, 2016, 2018, 2020 FrankHB. | |
3 | 3 | # |
4 | 4 | # This file is part of the YSLib project, and may only be used, |
5 | 5 | # modified, and distributed under the terms of the YSLib project |
@@ -8,9 +8,9 @@ | ||
8 | 8 | # understand and accept it fully. |
9 | 9 | # |
10 | 10 | # DS Makefile for YShell Test -> ARM7 |
11 | -# Version = r1390 | |
11 | +# Version = r1477 | |
12 | 12 | # Created = 2009-12-18 12:27:40 +0800 |
13 | -# Updated = 2018-05-22 15:57 +0800 | |
13 | +# Updated = 2020-12-14 02:38 +0800 | |
14 | 14 | # Encoding = ANSI |
15 | 15 | |
16 | 16 |
@@ -21,10 +21,6 @@ | ||
21 | 21 | SHBuild_ToolDir := $(dir $(lastword $(MAKEFILE_LIST)))/../../Tools/Scripts |
22 | 22 | include $(SHBuild_ToolDir)/Toolchain.DS.mk |
23 | 23 | |
24 | -# NOTE: Option '-Wno-redundant-decls' is workaround for libnds. | |
25 | -CFLAGS_COMMON := $(CFLAGS_COMMON) -Wno-redundant-decls | |
26 | -CXXFLAGS_COMMON := $(CXXFLAGS_COMMON) -Wno-redundant-decls | |
27 | - | |
28 | 24 | # PROJNAME is the name of the project |
29 | 25 | # CONF is the configuration name |
30 | 26 | # RELEASE is the directory name for object files and intermediate files will be placed |
@@ -35,7 +31,6 @@ | ||
35 | 31 | # SOURCES is a list of directories containing source code |
36 | 32 | # INCLUDES is a list of directories containing extra header files |
37 | 33 | # DATA is a list of directories containing binary files embedded using bin2o |
38 | -# GRAPHICS is a list of directories containing image files to be converted with grit | |
39 | 34 | |
40 | 35 | export PROJNAME ?= YSTest_ARM7 |
41 | 36 | export CONF ?= release |
@@ -47,25 +42,21 @@ | ||
47 | 42 | export SOURCES := source data |
48 | 43 | export INCLUDES := include data |
49 | 44 | export DATA := data |
50 | -#export GRAPHICS := gfx | |
51 | -#export MUSIC := music | |
52 | 45 | |
53 | -# options for code generation | |
54 | 46 | ARCH := $(ARCH_ARM7) |
55 | 47 | ARCH_AS := $(ARCH_AS_ARM7) |
56 | 48 | ASFLAGS := $(ASFLAGS_ARM7) |
57 | -CFLAGS := $(INCLUDE) $(C_CXXFLAGS_ARM7) $(CFLAGS_COMMON) | |
58 | -CXXFLAGS := $(INCLUDE) $(C_CXXFLAGS_ARM7) $(CXXFLAGS_COMMON) \ | |
59 | - -fno-threadsafe-statics -fuse-cxa-atexit \ | |
60 | - -Wctor-dtor-privacy -Wnoexcept -Wnon-virtual-dtor -Wold-style-cast \ | |
61 | - -Wsign-promo | |
49 | +# NOTE: Option '-Wno-redundant-decls' is the workaround for libnds. | |
50 | +CFLAGS := $(CFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS_ARM7) $(C_CXXFLAGS_COMMON) \ | |
51 | + $(CFLAGS_WARNING) -Wno-redundant-decls | |
52 | +CXXFLAGS := $(CXXFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS_ARM7) $(C_CXXFLAGS_COMMON) \ | |
53 | + $(CXXFLAGS_WARNING) $(CXXFLAGS_IMPL_COMMON) -fno-threadsafe-statics \ | |
54 | + -fuse-cxa-atexit -Wno-redundant-decls -Wnoexcept -Wold-style-cast | |
55 | + | |
62 | 56 | LDFLAGS := $(LDFLAGS_OPT_DBG) -specs=ds_arm7.specs $(ARCH) -Wl,--gc-sections |
63 | 57 | |
64 | -# any extra libraries we wish to link with the project | |
65 | 58 | LIBS := -lnds7 # -ldswifi7 -lmm7 |
66 | 59 | |
67 | -# List of directories containing libraries, this must be the top level | |
68 | -# containing include and lib. | |
69 | 60 | LIBDIRS := $(LIBNDS) |
70 | 61 | |
71 | 62 | ifneq ($(CONF),$(notdir $(CURDIR))) |
@@ -98,27 +89,14 @@ | ||
98 | 89 | endif |
99 | 90 | endif |
100 | 91 | |
101 | -PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png))) | |
102 | -PALFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pal))) | |
103 | -RAWFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.raw))) | |
104 | -MAPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.map))) | |
105 | -JPEGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.jpg))) | |
106 | -MODFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.mod))) | |
107 | -GIFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.gif))) | |
108 | -BMPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bmp))) | |
109 | -MP3FILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.mp3))) | |
110 | - | |
111 | -#---- | |
112 | -# use CXX for linking C++ projects, CC for standard C | |
113 | -#---- | |
114 | 92 | ifeq ($(strip $(CPPFILES)),) |
115 | 93 | export LD := $(CC) |
116 | 94 | else |
117 | 95 | export LD := $(CXX) |
118 | 96 | endif |
119 | 97 | |
120 | -export OFILES := $(MAPFILES:.map=.o) $(RAWFILES:.raw=.o) $(PALFILES:.pal=.o) $(BINFILES:.bin=.o) $(PNGFILES:.png=.o) $(PCXFILES:.pcx=.o) $(JPEGFILES:.jpg=.o) $(MODFILES:.mod=.o) $(GIFFILES:.gif=.o) $(BMPFILES:.bmp=.o) $(MP3FILES:.mp3=.o) \ | |
121 | - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) | |
98 | +export OFILES := $(BINFILES:.bin=.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ | |
99 | + $(SFILES:.s=.o) | |
122 | 100 | |
123 | 101 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ |
124 | 102 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ |
@@ -145,28 +123,14 @@ | ||
145 | 123 | |
146 | 124 | all: $(CONF) $(OUTPUT) |
147 | 125 | |
148 | -#---- | |
149 | 126 | else |
150 | 127 | |
151 | 128 | DEPENDS := $(OFILES:.o=.d) |
152 | 129 | |
153 | -#---- | |
154 | -# main targets | |
155 | -#---- | |
156 | - | |
157 | 130 | $(ARM7ELF) : $(OFILES) |
158 | 131 | @echo Linking $(notdir $@) ... |
159 | 132 | $(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@ |
160 | 133 | @echo Built $(notdir $@) . |
161 | -# IMPORTANT: the order of files is significant. | |
162 | - | |
163 | -#---- | |
164 | -# you need a rule like this for each extension you use as binary data | |
165 | -#---- | |
166 | - | |
167 | -#---- | |
168 | -# Compile Targets for C/C++ | |
169 | -#---- | |
170 | 134 | |
171 | 135 | %.o : %.cpp |
172 | 136 | @echo $(notdir $<) |
@@ -183,8 +147,6 @@ | ||
183 | 147 | @$(CC) -MM $(CFLAGS) -o $*.d $< |
184 | 148 | @$(CC) $(ASFLAGS) -c $< -o$@ |
185 | 149 | |
186 | - | |
187 | -# bin2o macro like that from libnds, slightly changed for the PALib naming conventions of resources which doesn't append the file extension to the resource name | |
188 | 150 | define bin2o |
189 | 151 | cp $(<) $(notdir $(*)) |
190 | 152 | bin2s $(notdir $(*)) | $(AS) $(ARCH_AS) -o $(@) |
@@ -194,66 +156,11 @@ | ||
194 | 156 | echo "extern const u32" $(*)_size";" >> $(*).h |
195 | 157 | endef |
196 | 158 | |
197 | -%.o : %.mp3 | |
198 | - @echo $(notdir $<) | |
199 | - @$(bin2o) | |
200 | - | |
201 | -%.o : %.pcx | |
202 | - @echo $(notdir $<) | |
203 | - @$(bin2o) | |
204 | - | |
205 | -%.o : %.bin | |
206 | - @echo $(notdir $<) | |
207 | - @$(bin2o) | |
208 | - | |
209 | -%.o : %.png | |
210 | - @echo $(notdir $<) | |
211 | - @$(bin2o) | |
212 | - | |
213 | -%.o : %.raw | |
214 | - @echo $(notdir $<) | |
215 | - @$(bin2o) | |
216 | - | |
217 | -%.o : %.pal | |
218 | - @echo $(notdir $<) | |
219 | - @$(bin2o) | |
220 | - | |
221 | -%.o : %.map | |
159 | +%.o : %.bin | |
222 | 160 | @echo $(notdir $<) |
223 | 161 | @$(bin2o) |
224 | 162 | |
225 | -%.o : %.mdl | |
226 | - @echo $(notdir $<) | |
227 | - @$(bin2o) | |
228 | - | |
229 | -%.o : %.jpg | |
230 | - @echo $(notdir $<) | |
231 | - @$(bin2o) | |
232 | - | |
233 | -%.o : %.mod | |
234 | - @echo $(notdir $<) | |
235 | - @$(bin2o) | |
236 | - | |
237 | -%.o : %.gif | |
238 | - @echo $(notdir $<) | |
239 | - @$(bin2o) | |
240 | - | |
241 | -%.o : %.bmp | |
242 | - @echo $(notdir $<) | |
243 | - @$(bin2o) | |
244 | - | |
245 | -#---- | |
246 | -# This rule creates assembly source files using grit | |
247 | -# grit takes an image file and a .grit describing how the file is to be processed | |
248 | -# add additional rules like this for each image extension | |
249 | -# you use in the graphics folders | |
250 | -#---- | |
251 | -%.s %.h : %.png %.grit | |
252 | - grit $< -fts -o$* | |
253 | - | |
254 | 163 | -include $(DEPSDIR)/*.d |
255 | 164 | |
256 | -#---- | |
257 | 165 | endif |
258 | -#---- | |
259 | 166 |
@@ -8,9 +8,9 @@ | ||
8 | 8 | # understand and accept it fully. |
9 | 9 | # |
10 | 10 | # DS Makefile for YShell Test -> ARM9 |
11 | -# Version = r1407 | |
11 | +# Version = r1533 | |
12 | 12 | # Created = 2009-12-18 12:27:40 +0800 |
13 | -# Updated = 2020-10-10 18:42 +0800 | |
13 | +# Updated = 2020-12-14 02:42 +0800 | |
14 | 14 | # Encoding = ANSI |
15 | 15 | |
16 | 16 |
@@ -21,10 +21,6 @@ | ||
21 | 21 | SHBuild_ToolDir := $(dir $(lastword $(MAKEFILE_LIST)))/../../Tools/Scripts |
22 | 22 | include $(SHBuild_ToolDir)/Toolchain.DS.mk |
23 | 23 | |
24 | -# NOTE: Workaround for libnds. | |
25 | -CFLAGS_COMMON := $(CFLAGS_COMMON) -Wno-redundant-decls | |
26 | -CXXFLAGS_COMMON := $(CXXFLAGS_COMMON) -Wno-redundant-decls | |
27 | - | |
28 | 24 | # PROJNAME is the name of the project |
29 | 25 | # CONF is the configuration name |
30 | 26 | # RELEASE is the directory name for object files and intermediate files will be placed |
@@ -35,7 +31,6 @@ | ||
35 | 31 | # SOURCES is a list of directories containing source code |
36 | 32 | # INCLUDES is a list of directories containing extra header files |
37 | 33 | # DATA is a list of directories containing binary files embedded using bin2o |
38 | -# GRAPHICS is a list of directories containing image files to be converted with grit | |
39 | 34 | |
40 | 35 | export PROJNAME ?= YSTest_ARM9 |
41 | 36 | export CONF ?= release |
@@ -56,11 +51,15 @@ | ||
56 | 51 | ARCH := $(ARCH_ARM9) |
57 | 52 | ARCH_AS := $(ARCH_AS_ARM9) |
58 | 53 | ASFLAGS := $(ASFLAGS_ARM9) |
59 | -CFLAGS := $(INCLUDE) $(C_CXXFLAGS_ARM9) $(CFLAGS_COMMON) | |
60 | -CXXFLAGS := $(INCLUDE) $(C_CXXFLAGS_ARM9) $(CXXFLAGS_COMMON) \ | |
61 | - -fno-threadsafe-statics -fuse-cxa-atexit \ | |
62 | - -Wnon-virtual-dtor -Wsign-promo | |
63 | -# -Wnoexcept -Wold-style-cast -Wsign-promo | |
54 | +# NOTE: Options '-Wno-redundant-decls' and '-Wno-ignored-qualifiers' are the | |
55 | +# workaround for libnds. | |
56 | +CFLAGS := $(CFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS_ARM9) $(C_CXXFLAGS_COMMON) \ | |
57 | + $(CFLAGS_WARNING) -Wno-redundant-decls -Wno-ignored-qualifiers | |
58 | +CXXFLAGS := $(CXXFLAGS_STD) $(INCLUDE) $(C_CXXFLAGS_ARM9) $(C_CXXFLAGS_COMMON) \ | |
59 | + $(CXXFLAGS_WARNING) $(CXXFLAGS_IMPL_COMMON) -fno-threadsafe-statics \ | |
60 | + -fuse-cxa-atexit -Wno-redundant-decls -Wno-ignored-qualifiers | |
61 | +# -Wnoexcept -Wold-style-cast | |
62 | + | |
64 | 63 | LDFLAGS := $(LDFLAGS_OPT_DBG) -specs=ds_arm9.specs $(ARCH) -Wl,--gc-sections |
65 | 64 | |
66 | 65 | #CFLAGS := -g -Wformat=2 -Winline -Wall \ |
@@ -72,10 +71,10 @@ | ||
72 | 71 | #CXXFLAGS := $(CFLAGS) -fno-threadsafe-statics -fuse-cxa-atexit -std=gnu++0x |
73 | 72 | # -Weffc++ -Wold-style-cast -Woverloaded-virtual -pedantic |
74 | 73 | # -Wextra -Winit-self -Wmissing-include-dirs -Wsign-promo |
74 | + | |
75 | 75 | #LDFLAGS= -specs=ds_arm9.specs -g $(ARCH) -L$(PAPATH)/lib \ |
76 | 76 | # -Wl,-Map,$(notdir $*.map) |
77 | 77 | |
78 | -# any extra libraries we wish to link with the project | |
79 | 78 | LIBS := -lnds9 |
80 | 79 | |
81 | 80 | # User defined libraries. |
@@ -85,8 +84,6 @@ | ||
85 | 84 | YBASE_A := $(BUILDDIR)/../../YBase/$(RELEASE)/libYBase.a |
86 | 85 | YFRAMEWORK_A := $(BUILDDIR)/../../YFramework/$(RELEASE)/libYFramework.a |
87 | 86 | |
88 | -# List of directories containing libraries, this must be the top level | |
89 | -# containing include and lib. | |
90 | 87 | LIBDIRS := $(LIBNDS) |
91 | 88 | |
92 | 89 | ifneq ($(CONF),$(notdir $(CURDIR))) |
@@ -101,48 +98,16 @@ | ||
101 | 98 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) |
102 | 99 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) |
103 | 100 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) |
104 | -PCXFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcx))) | |
105 | 101 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) |
106 | 102 | |
107 | -ifeq ($(strip $(AUDIOFILES)),) | |
108 | - ifeq ($(strip $(ARM7_SELECTED)), ARM7_MAXMOD_DSWIFI) | |
109 | - TEXT_TO_SAY_2 := No MaxMod-compatible files were found in the audio folder. | |
110 | - TEXT_TO_SAY_3 := If you are loading the soundbank from FAT or EFS, ignore this message. | |
111 | - TEXT_TO_SAY_4 := " " | |
112 | - endif | |
113 | - DONT_BUILD_MAXMOD_SOUNDBANK = YES | |
114 | -endif | |
115 | - | |
116 | -ifneq ($(strip $(DONT_BUILD_MAXMOD_SOUNDBANK)), YES) | |
117 | - ifeq ($(strip $(ARM7_SELECTED)), ARM7_MAXMOD_DSWIFI) | |
118 | - BINFILES += soundbank_bin.bin | |
119 | - endif | |
120 | -endif | |
121 | - | |
122 | -PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png))) | |
123 | -PALFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pal))) | |
124 | -RAWFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.raw))) | |
125 | -MAPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.map))) | |
126 | -JPEGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.jpg))) | |
127 | -MODFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.mod))) | |
128 | -GIFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.gif))) | |
129 | -BMPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bmp))) | |
130 | -MP3FILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.mp3))) | |
131 | - | |
132 | -#---- | |
133 | -# use CXX for linking C++ projects, CC for standard C | |
134 | -#---- | |
135 | 103 | ifeq ($(strip $(CPPFILES)),) |
136 | 104 | export LD := $(CC) |
137 | 105 | else |
138 | 106 | export LD := $(CXX) |
139 | 107 | endif |
140 | 108 | |
141 | -#export OFILES := $(addsuffix .o,$(BINFILES)) \ | |
142 | -# $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) | |
143 | - | |
144 | -export OFILES := $(MAPFILES:.map=.o) $(RAWFILES:.raw=.o) $(PALFILES:.pal=.o) $(BINFILES:.bin=.o) $(PNGFILES:.png=.o) $(PCXFILES:.pcx=.o) $(JPEGFILES:.jpg=.o) $(MODFILES:.mod=.o) $(GIFFILES:.gif=.o) $(BMPFILES:.bmp=.o) $(MP3FILES:.mp3=.o) \ | |
145 | - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) | |
109 | +export OFILES := $(BINFILES:.bin=.o) $(CPPFILES:.cpp=.o) \ | |
110 | + $(CFILES:.c=.o) $(SFILES:.s=.o) | |
146 | 111 | |
147 | 112 | #export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ |
148 | 113 | # $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ |
@@ -156,7 +121,6 @@ | ||
156 | 121 | |
157 | 122 | .PHONY: $(CONF) rebuild clean |
158 | 123 | |
159 | -#---- | |
160 | 124 | $(CONF): |
161 | 125 | @echo Building configuration: $(notdir $@) ... |
162 | 126 | @[ -d $(BUILDDIR) ] || mkdir -p $(BUILDDIR) |
@@ -164,7 +128,6 @@ | ||
164 | 128 | @$(MAKE) --no-print-directory -C $(BUILDDIR) -f $(CURDIR)/Makefile |
165 | 129 | @echo Built configuration: $(notdir $@) . |
166 | 130 | |
167 | -#---- | |
168 | 131 | clean: |
169 | 132 | @echo Cleaning $(TARGET) ... |
170 | 133 | @rm -f $(BUILDDIR)/*.d |
@@ -175,49 +138,30 @@ | ||
175 | 138 | |
176 | 139 | all: $(CONF) $(OUTPUT) |
177 | 140 | |
178 | -#---- | |
179 | 141 | else |
180 | 142 | |
181 | 143 | DEPENDS := $(OFILES:.o=.d) |
182 | 144 | |
183 | -#---- | |
184 | -# main targets | |
185 | -#---- | |
186 | - | |
187 | 145 | $(ARM9ELF) : $(OFILES) $(YFRAMEWORK_A) $(YBASE_A) |
188 | 146 | @echo Linking $(notdir $@) ... |
189 | 147 | $(LD) $(LDFLAGS) $(OFILES) $(YFRAMEWORK_A) $(YBASE_A) $(LIBPATHS) $(LIBS) $(LIBPATHEX) $(LIBEX) -o $@ |
190 | 148 | @echo Built $(notdir $@) . |
191 | -# IMPORTANT: the order of files is significant. | |
192 | 149 | |
193 | -#---- | |
194 | -# you need a rule like this for each extension you use as binary data | |
195 | -#---- | |
196 | - | |
197 | -#---- | |
198 | -# Compile Targets for C/C++ | |
199 | -#---- | |
200 | - | |
201 | -#---- | |
202 | 150 | %.o : %.cpp |
203 | 151 | @echo $(notdir $<) |
204 | 152 | @$(CXX) -MM $(CXXFLAGS) -o $*.d $< |
205 | 153 | @$(CXX) $(CXXFLAGS) -c $< -o$@ |
206 | 154 | |
207 | -#---- | |
208 | 155 | %.o : %.c |
209 | 156 | @echo $(notdir $<) |
210 | 157 | @$(CC) -MM $(CFLAGS) -o $*.d $< |
211 | 158 | @$(CC) $(CFLAGS) -c $< -o$@ |
212 | 159 | |
213 | -#---- | |
214 | 160 | %.o : %.s |
215 | 161 | @echo $(notdir $<) |
216 | 162 | @$(CC) -MM $(CFLAGS) -o $*.d $< |
217 | 163 | @$(CC) $(ASFLAGS) -c $< -o$@ |
218 | 164 | |
219 | - | |
220 | -# bin2o macro like that from libnds, slightly changed for the PALib naming conventions of resources which doesn't append the file extension to the resource name | |
221 | 165 | define bin2o |
222 | 166 | cp $(<) $(notdir $(*)) |
223 | 167 | bin2s $(notdir $(*)) | $(AS) $(ARCH_AS) -o $(DEPSDIR)/$(@) |
@@ -227,91 +171,11 @@ | ||
227 | 171 | echo "extern const unsigned" $(*)_size";" >> $(*).h |
228 | 172 | endef |
229 | 173 | |
230 | -#---- | |
231 | -%.o : %.mp3 | |
232 | -#---- | |
233 | - @echo $(notdir $<) | |
234 | - @$(bin2o) | |
235 | - | |
236 | -#---- | |
237 | -%.o : %.pcx | |
238 | -#---- | |
239 | - @echo $(notdir $<) | |
240 | - @$(bin2o) | |
241 | - | |
242 | -#---- | |
243 | -%.o : %.bin | |
244 | -#---- | |
245 | - @echo $(notdir $<) | |
246 | - @$(bin2o) | |
247 | - | |
248 | -#---- | |
249 | -%.o : %.png | |
250 | -#---- | |
251 | - @echo $(notdir $<) | |
252 | - @$(bin2o) | |
253 | - | |
254 | -#---- | |
255 | -%.o : %.raw | |
256 | -#---- | |
257 | - @echo $(notdir $<) | |
258 | - @$(bin2o) | |
259 | - | |
260 | -#---- | |
261 | -%.o : %.pal | |
262 | -#---- | |
263 | - @echo $(notdir $<) | |
264 | - @$(bin2o) | |
265 | - | |
266 | -#---- | |
267 | -%.o : %.map | |
268 | -#---- | |
174 | +%.o : %.bin | |
269 | 175 | @echo $(notdir $<) |
270 | 176 | @$(bin2o) |
271 | 177 | |
272 | -#---- | |
273 | -%.o : %.mdl | |
274 | -#---- | |
275 | - @echo $(notdir $<) | |
276 | - @$(bin2o) | |
277 | - | |
278 | -#---- | |
279 | -%.o : %.jpg | |
280 | -#---- | |
281 | - @echo $(notdir $<) | |
282 | - @$(bin2o) | |
283 | - | |
284 | -#---- | |
285 | -%.o : %.mod | |
286 | -#---- | |
287 | - @echo $(notdir $<) | |
288 | - @$(bin2o) | |
289 | - | |
290 | -#---- | |
291 | -%.o : %.gif | |
292 | -#---- | |
293 | - @echo $(notdir $<) | |
294 | - @$(bin2o) | |
295 | - | |
296 | -#---- | |
297 | -%.o : %.bmp | |
298 | -#---- | |
299 | - @echo $(notdir $<) | |
300 | - @$(bin2o) | |
301 | - | |
302 | -#---- | |
303 | -# This rule creates assembly source files using grit | |
304 | -# grit takes an image file and a .grit describing how the file is to be processed | |
305 | -# add additional rules like this for each image extension | |
306 | -# you use in the graphics folders | |
307 | -#---- | |
308 | -%.s %.h : %.png %.grit | |
309 | -#---- | |
310 | - grit $< -fts -o$* | |
311 | - | |
312 | 178 | -include $(DEPSDIR)/*.d |
313 | 179 | |
314 | -#---- | |
315 | 180 | endif |
316 | -#---- | |
317 | 181 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2012-2013, 2015-2016 FrankHB. | |
2 | + © 2012-2013, 2015-2016, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file About.h |
12 | 12 | \ingroup YReader |
13 | 13 | \brief 关于界面。 |
14 | -\version r92 | |
14 | +\version r95 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 390 |
17 | 17 | \par 创建时间: |
18 | 18 | 2013-03-20 21:07:32 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2016-06-05 20:07 +0800 | |
20 | + 2020-12-24 12:06 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -34,8 +34,8 @@ | ||
34 | 34 | { |
35 | 35 | |
36 | 36 | /*! |
37 | -\brief 关于窗体。 | |
38 | -\since build 363 | |
37 | +\brief 关于面板。 | |
38 | +\since build 695 | |
39 | 39 | */ |
40 | 40 | class AboutPanel : public DialogPanel |
41 | 41 | { |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2010-2016, 2019 FrankHB. | |
2 | + © 2010-2016, 2019-2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file DSReader.h |
12 | 12 | \ingroup YReader |
13 | 13 | \brief 适用于 DS 的双屏阅读器。 |
14 | -\version r1892 | |
14 | +\version r1899 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since 早于 build 132 |
17 | 17 | \par 创建时间: |
18 | 18 | 2010-01-05 14:03:47 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2019-09-05 22:50 +0800 | |
20 | + 2020-12-24 12:06 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -29,10 +29,12 @@ | ||
29 | 29 | #define INC_YReader_DSReader_h_ 1 |
30 | 30 | |
31 | 31 | #include <Helper/YModules.h> |
32 | -#include YFM_YSLib_UI_TextArea | |
32 | +#include YFM_YSLib_UI_TextArea // for std::uint16_t, unique_ptr, | |
33 | +// YSLib::UI::BufferedTextArea; | |
34 | +#include YFM_YSLib_Core_YFunc // for YSLib::function; | |
33 | 35 | #include YFM_YSLib_UI_YWindow |
34 | 36 | #include YFM_YSLib_Service_TextFile |
35 | -#include YFM_YSLib_Service_TextManager | |
37 | +#include YFM_YSLib_Service_TextManager // for Text::TextFileBuffer; | |
36 | 38 | #include YFM_DS_Helper_DSMain |
37 | 39 | #include YFM_Helper_Initialization |
38 | 40 |
@@ -131,9 +133,9 @@ | ||
131 | 133 | public: |
132 | 134 | /*! |
133 | 135 | \brief 视图变更回调函数。 |
134 | - \since build 271 | |
136 | + \since build 899 | |
135 | 137 | */ |
136 | - std::function<void()> ViewChanged; | |
138 | + YSLib::function<void()> ViewChanged; | |
137 | 139 | |
138 | 140 | /*! |
139 | 141 | \brief 构造。 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2011-2015 FrankHB. | |
2 | + © 2011-2015, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file HexBrowser.h |
12 | 12 | \ingroup YReader |
13 | 13 | \brief 十六进制浏览器。 |
14 | -\version r550 | |
14 | +\version r556 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 253 |
17 | 17 | \par 创建时间: |
18 | 18 | 2011-10-14 18:13:04 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2015-11-26 14:45 +0800 | |
20 | + 2020-12-24 12:06 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -72,7 +72,11 @@ | ||
72 | 72 | DefPred(const ynothrow, Valid, source.is_open()) |
73 | 73 | |
74 | 74 | public: |
75 | - //! \since build 587 | |
75 | + /*! | |
76 | + \brief 取当前读取位置。 | |
77 | + \return 若成功为当前缓冲区读取位置相对于开始的字节数,否则为 size_t(-1) 。 | |
78 | + \since build 587 | |
79 | + */ | |
76 | 80 | DefGetter(const, size_t, Position, |
77 | 81 | size_t(source.pubseekoff(0, std::ios_base::cur, std::ios_base::in))) |
78 | 82 | DefGetter(const ynothrow, size_t, Size, size) |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2012-2015 FrankHB. | |
2 | + © 2012-2015, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file ReadingList.h |
12 | 12 | \ingroup YReader |
13 | 13 | \brief 阅读列表。 |
14 | -\version r245 | |
14 | +\version r247 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 328 |
17 | 17 | \par 创建时间: |
18 | 18 | 2012-07-24 22:13:46 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2015-12-27 22:32 +0800 | |
20 | + 2020-12-24 12:06 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -96,7 +96,7 @@ | ||
96 | 96 | |
97 | 97 | public: |
98 | 98 | /*! |
99 | - \brief 默认构造:阅读迭代器指向阅读记录末尾。 | |
99 | + \brief 无参数构造:阅读迭代器指向阅读记录末尾。 | |
100 | 100 | \since build 404 |
101 | 101 | */ |
102 | 102 | DefDeCtor(ReadingList) |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2011-2015, 2018-2019 FrankHB. | |
2 | + © 2011-2015, 2018-2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file ShlReader.h |
12 | 12 | \ingroup YReader |
13 | 13 | \brief Shell 阅读器框架。 |
14 | -\version r1838 | |
14 | +\version r1842 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 263 |
17 | 17 | \par 创建时间: |
18 | 18 | 2011-11-24 17:08:33 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2018-11-04 17:05 +0800 | |
20 | + 2020-12-24 12:06 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -29,7 +29,7 @@ | ||
29 | 29 | #define INC_YReader_ShlReader_h_ 1 |
30 | 30 | |
31 | 31 | #include "Shells.h" |
32 | -#include "DSReader.h" | |
32 | +#include "DSReader.h" // for YSLib::function; | |
33 | 33 | #include "HexBrowser.h" |
34 | 34 | #include "ReaderSettingUI.h" |
35 | 35 | #include "BookmarkUI.h" |
@@ -160,9 +160,9 @@ | ||
160 | 160 | IO::Path CurrentPath; |
161 | 161 | /*! |
162 | 162 | \brief 背景任务:用于滚屏。 |
163 | - \since build 297 | |
163 | + \since build 899 | |
164 | 164 | */ |
165 | - std::function<void()> fBackgroundTask; | |
165 | + YSLib::function<void()> fBackgroundTask; | |
166 | 166 | /*! |
167 | 167 | \brief 退出标识。 |
168 | 168 | \since build 302 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2009-2016, 2018 FrankHB. | |
2 | + © 2009-2016, 2018, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file Main.cpp |
12 | 12 | \ingroup DS |
13 | 13 | \brief 主源文件。 |
14 | -\version r1976 | |
14 | +\version r1980 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 1 |
17 | 17 | \par 创建时间: |
18 | 18 | 2009-11-12 21:26:30 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2018-08-19 13:41 +0800 | |
20 | + 2020-12-24 12:06 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -62,6 +62,7 @@ | ||
62 | 62 | YTraceDe(Warning, "%zu %s(s) detected:\n", con.size(), item_name); |
63 | 63 | #else |
64 | 64 | // XXX: Size of %std::size is expected. |
65 | + // XXX: Error from 'std::fprintf' is ignored. | |
65 | 66 | std::fprintf(stderr, "%zu %s(s) detected:\n", con.size(), item_name); |
66 | 67 | #endif |
67 | 68 |
@@ -99,7 +100,7 @@ | ||
99 | 100 | OnExit_DebugMemory_print<4>(GetDebugMemoryList().Blocks, "memory leak"); |
100 | 101 | OnExit_DebugMemory_print<4>(GetDebugMemoryList().DuplicateDeletedBlocks, |
101 | 102 | "duplicate memory deleting"); |
102 | -#if 0 | |
103 | +#if false | |
103 | 104 | DebugMemory.PrintAll(stderr); |
104 | 105 | DebugMemory.PrintAll(fp); |
105 | 106 | DebugMemory.PrintAllDuplicate(stderr); |
@@ -183,7 +184,7 @@ | ||
183 | 184 | dsk_m.Background |
184 | 185 | = SolidBrush(Color(255 - i * 255 / Image_N, 216, 192)); |
185 | 186 | Repaint(dsk_m); |
186 | - YReader::FetchImage(i); | |
187 | + yunused(YReader::FetchImage(i)); | |
187 | 188 | } |
188 | 189 | pb.SetValue(Image_N); |
189 | 190 | Repaint(dsk_m); |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2013-2016, 2019 FrankHB. | |
2 | + © 2013-2016, 2019-2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file ChangeLog.PreAlpha1.txt |
12 | 12 | \ingroup Documentation |
13 | 13 | \brief 版本更新历史记录 - PreAlpha1 。 |
14 | -\version r334 | |
14 | +\version r350 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 393 |
17 | 17 | \par 创建时间: |
18 | 18 | 2013-03-25 00:01:48 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2019-10-03 20:55 +0800 | |
20 | + 2020-12-24 12:01 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -207,14 +207,21 @@ | ||
207 | 207 | |
208 | 208 | b170_b183 |
209 | 209 | ( |
210 | - / "GUI" $= | |
210 | + / %YSLib $= | |
211 | 211 | ( |
212 | - + "controls: tracks", | |
213 | - + "controls: scroll bars"; | |
214 | - + "controls: scrollable container", | |
215 | - + "controls: listbox" | |
212 | + + "class template %ExpandMemberFirstBinder" @ %Core.YFunc | |
213 | + + %Adaptor.(YNew, YReference), | |
214 | + / %YShellInitialization @ %Service >> %Adaptor, | |
215 | + + "GUI controls" @ %Shell $= | |
216 | + ( | |
217 | + + "controls: tracks", | |
218 | + + "controls: scroll bars"; | |
219 | + + "controls: scrollable container", | |
220 | + + "controls: listbox" | |
221 | + ) | |
216 | 222 | ), |
217 | - + "class template %ExpandMemberFirstBinder" | |
223 | + / $doc ^ "Doxygen", | |
224 | + + %YCLib.(YStandardExtend, YCast), | |
218 | 225 | ), |
219 | 226 | |
220 | 227 | b159_b169 |
@@ -228,6 +235,8 @@ | ||
228 | 235 | |
229 | 236 | b134_b158 |
230 | 237 | ( |
238 | + / "classes %(YFont, YFontFamily, YTypeface, YFontFile)" | |
239 | + @ %YSLib.Adaptor.YFontCache => "%Font, FontFamily, FontFile", | |
231 | 240 | + DLD "core utility templates", |
232 | 241 | / "smart pointers", |
233 | 242 | + "GUI focus", |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2013-2018 FrankHB. | |
2 | + © 2013-2018, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file ChangeLog.PreAlpha2.txt |
12 | 12 | \ingroup Documentation |
13 | 13 | \brief 版本更新历史记录 - PreAlpha2 。 |
14 | -\version r3805 | |
14 | +\version r3817 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 393 |
17 | 17 | \par 创建时间: |
18 | 18 | 2013-03-25 00:11:18 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2018-12-30 15:00 +0800 | |
20 | + 2020-12-24 12:01 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -1034,8 +1034,8 @@ | ||
1034 | 1034 | ), |
1035 | 1035 | / UI.GUI $= |
1036 | 1036 | ( |
1037 | - * "missing painting of background for parent of buffered widgets" | |
1038 | - $since b225, | |
1037 | + * "missing painting of background for parent of buffered \ | |
1038 | + widgets" $since b225, | |
1039 | 1039 | + "forced background painting ignorance state" |
1040 | 1040 | @ "class %BufferedRenderer" |
1041 | 1041 | ), |
@@ -1820,8 +1820,11 @@ | ||
1820 | 1820 | |
1821 | 1821 | b246 |
1822 | 1822 | ( |
1823 | + ( | |
1823 | 1824 | + "pseudo keyword %(yconstexpr, yconstexprf) to support C++11 generalized \ |
1824 | - constant expressions features on conditions", | |
1825 | + constant expressions features on conditions"; | |
1826 | + / "applied %yconstexprf" @ %(YCLib, YSLib) | |
1827 | + ), | |
1825 | 1828 | / "file classes" $= |
1826 | 1829 | ( |
1827 | 1830 | + "mode selecting at opening files", |
@@ -2295,8 +2298,12 @@ | ||
2295 | 2298 | - "unnecessary drawing of overlaid windows" @ "windows refreshing", |
2296 | 2299 | + "partial refreshing optimization" @ "class %Widget" |
2297 | 2300 | ), |
2301 | + ( | |
2298 | 2302 | * "wrong result when height of arguments are equal" |
2299 | - @ "intersection calculation for class %Rect" $since b225, | |
2303 | + @ "intersection calculation for class %Rect" $since b225; | |
2304 | + / $repo "tagged engineering fault by hg tags ('engineering-defect-b225', \ | |
2305 | + 'engineering-fault-b225')" | |
2306 | + ), | |
2300 | 2307 | + "child widget intersection confirming" |
2301 | 2308 | ), |
2302 | 2309 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2013-2019 FrankHB. | |
2 | + © 2013-2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file ChangeLog.PreAlpha3.txt |
12 | 12 | \ingroup Documentation |
13 | 13 | \brief 版本更新历史记录 - PreAlpha3 。 |
14 | -\version r5661 | |
14 | +\version r5675 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 393 |
17 | 17 | \par 创建时间: |
18 | 18 | 2013-03-25 00:14:22 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2019-02-22 14:27 +0800 | |
20 | + 2020-12-24 12:01 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -71,7 +71,7 @@ | ||
71 | 71 | ) |
72 | 72 | ) |
73 | 73 | ), |
74 | - / $dev "updated .vcxproj for VS2012", | |
74 | + / $dev "updated .vcxproj files for VS2012", | |
75 | 75 | / $build "updated to Microsoft VC++ 2012" ~ "Microsoft VC++ 2010" |
76 | 76 | @ "Microsoft VC++ projects" $effective @ %('YBase*', 'YFramework*', |
77 | 77 | 'YSTest*') |
@@ -332,8 +332,8 @@ | ||
332 | 332 | ), |
333 | 333 | / $dev $build @ "platform %MinGW32" $= |
334 | 334 | ( |
335 | - ^ DLP $re_ex(b346) $resolve(#8) "MinGW[gcc version 4.8.0 (Built by \ | |
336 | - MinGW-builds project)] x32-4.8.0-release-posix-sjlj-rev0" | |
335 | + ^ DLP $re_ex(b346) $resolve(#8, #15) "MinGW[gcc version 4.8.0 (Built \ | |
336 | + by MinGW-builds project)] x32-4.8.0-release-posix-sjlj-rev0" | |
337 | 337 | ~ "MinGW[gcc version 4.7.2 (Built by MinGW-builds project)] \ |
338 | 338 | x32-4.7.2-release-posix-sjlj-rev0 [release-sjlj]" |
339 | 339 | @ "platform %MinGW32", |
@@ -1882,7 +1882,7 @@ | ||
1882 | 1882 | / %YFramework.YSLib.UI $= |
1883 | 1883 | ( |
1884 | 1884 | / $dev "pointer members" @ "class %Widget" @ %YWidget, |
1885 | - + $dev $design "keyword %override for several overriders", | |
1885 | + + DLD "keyword %override for several overriders", | |
1886 | 1886 | / $dev "simplified text state member access" @ "class %MTextList" |
1887 | 1887 | @ %Label, |
1888 | 1888 | / @ "class %TextList" @ %TextList $= |
@@ -2289,7 +2289,7 @@ | ||
2289 | 2289 | ) |
2290 | 2290 | + "header %functional.hpp as %Function" $= |
2291 | 2291 | ( |
2292 | - + $lib "including header (<tuple>, <functional>, <string>)"; | |
2292 | + + $lib "inclusion (<tuple>, <functional>, <string>)"; | |
2293 | 2293 | + "function templates %(make_parameter_tuple, return_of, \ |
2294 | 2294 | parameter_of, paramlist_size)" |
2295 | 2295 | ) |
@@ -2313,7 +2313,7 @@ | ||
2313 | 2313 | ( |
2314 | 2314 | - "header %TypeOperation", |
2315 | 2315 | * $build "strict ISO C++11 code conformance" $since b331 |
2316 | - $= (* "missing including <typeinfo>") | |
2316 | + $= (* "missing inclusion <typeinfo>") | |
2317 | 2317 | // The program temporarily is not ill-formed for libstdc++'s \ |
2318 | 2318 | <memory> including <typeinfo> under C++11 mode. |
2319 | 2319 | ) |
@@ -2721,7 +2721,7 @@ | ||
2721 | 2721 | / $impl ("message loop", $design "input dispatching") @ %Helper.DSMain |
2722 | 2722 | // Significantly performance improved. |
2723 | 2723 | ), |
2724 | - * DLB "missing including path Code::Blocks project \ | |
2724 | + * DLB "missing inclusion paths" @ "Code::Blocks projects \ | |
2725 | 2725 | %(YBase_MinGW32, YFramework_MinGW32)" $since b299 |
2726 | 2726 | ), |
2727 | 2727 |
@@ -2797,10 +2797,10 @@ | ||
2797 | 2797 | - DLB "-Wnoexcept" @ "macro %CXXFLAGS" @ "makefile" |
2798 | 2798 | @ "project %(YFramework_DS, YSTest_ARM9)", |
2799 | 2799 | // ISO C++11 5.1.2/6 doesn't specify conversion function for a closure \ |
2800 | - object to a function pointer shall have exception-specification. \ | |
2801 | - Thus G++ may complain when evaluating %noexcept expression. \ | |
2802 | - It seems a defect in the standard, but here just turn the warning \ | |
2803 | - off for convenience. | |
2800 | + object to a function pointer shall have the \ | |
2801 | + exception-specification. Thus, G++ may complain when evaluating \ | |
2802 | + %noexcept expression. It seems a defect in the standard, but here \ | |
2803 | + just turn the warning off for convenience. | |
2804 | 2804 | + "total time measuring for images loading" @ %YReader.'shell test example' |
2805 | 2805 | $dep_from "test timing" |
2806 | 2806 | ), |
@@ -3021,8 +3021,7 @@ | ||
3021 | 3021 | + "class %CheckButton" @ %YFramework.YSLib.UI.GUI; |
3022 | 3022 | ^ "%CheckButton" ~ "%CheckBox" @ 'shells test example' |
3023 | 3023 | ), |
3024 | - ^ $dev $design "contextual keyword %override" | |
3025 | - ~ "keyword %virtual for overriders" | |
3024 | + / DLD "overriders" ^ 'override' ~ 'virtual' | |
3026 | 3025 | ), |
3027 | 3026 | |
3028 | 3027 | b310 |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file ChangeLog.V0.9.txt |
12 | 12 | \ingroup Documentation |
13 | 13 | \brief 版本更新历史记录 - V0.9 。 |
14 | -\version r1602 | |
14 | +\version r1787 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 800 |
17 | 17 | \par 创建时间: |
18 | 18 | 2020-10-12 17:19:23 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2020-12-13 02:45 +0800 | |
20 | + 2020-12-24 12:09 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -32,6 +32,190 @@ | ||
32 | 32 | |
33 | 33 | $now |
34 | 34 | ( |
35 | + / %YFramework $= | |
36 | + ( | |
37 | + + 'YB_ATTR_nodiscard YB_PURE ynothrow' | |
38 | + @ "member function %Environment::MakeTags" @ %NPL.NPLA, | |
39 | + + DLDI 'YB_ATTR_nodiscard YB_PURE' @ "function %MapPoint" | |
40 | + @ "platform %Win32" @ "class %DSWindow" @ %'Helper_(DS)'.DSWindow, | |
41 | + // Also to eliminate G++ 10.1 warning: [-Wsuggest-attribute=pure]. | |
42 | + / %YCLib $= | |
43 | + ( | |
44 | + + $lib "workaround of invalid handling of completeness of \ | |
45 | + instantiated %unique_ptr with member initializer for G++ < 9.2" | |
46 | + @ 'YCL_HostedUI_XCB || YCL_Android' @ "class %ScreenBuffer" | |
47 | + @ %HostedGUI, | |
48 | + // Actually no relavant G++ versions have been tested against \ | |
49 | + the defect because the member initializer was added since \ | |
50 | + b888, and either more recent versions of G++ (on Linux) \ | |
51 | + or Clang++ (on Android) are used. Thus, this is not an \ | |
52 | + engineering defect of missing testing. | |
53 | + / $design $impl "simplified constructor %Atom" @ %XCB | |
54 | + // To eliminate Clang++ warning: [-Wunused-value]. | |
55 | + ), | |
56 | + / %Helper $= | |
57 | + ( | |
58 | + / @ "class %Environment" @ %Environment $= | |
59 | + ( | |
60 | + + DLDI "brace-init-list '{}'" @ "data member %Root", | |
61 | + * DD "wrong name" @ "'\sa' command" @ "Doxygen comment" | |
62 | + @ "constructor" $since b693 | |
63 | + ), | |
64 | + / DLDI "avoided redundant lambda capture" @ "function %AttachToHost" | |
65 | + @ "platform %Win32" @ %HostedUI | |
66 | + // To eliminate Clang++ 9.0.1 warning: \ | |
67 | + [-Wunused-lambda-capture]. | |
68 | + ), | |
69 | + / DLDI %'YCLib_(Win32)' $= | |
70 | + ( | |
71 | + / "header guard names" @ %(COM, Registry, Consoles), | |
72 | + / "private data member" @ "class %WConsole" @ %Consoles | |
73 | + ) | |
74 | + ), | |
75 | + / @ "%test.sh" @ %Test $= | |
76 | + ( | |
77 | + - '$EXESFX' @ "build command line", | |
78 | + - DLDI "%SHBuild_NoAdjustSubsystem setting" | |
79 | + // This is unused without %SHBuild being called. | |
80 | + ), | |
81 | + / %Tools $= | |
82 | + ( | |
83 | + / %Scripts $= | |
84 | + ( | |
85 | + / @ "%SHBuild-common-options.sh" $= | |
86 | + ( | |
87 | + / "cleanup variable not used in stage 1" $= | |
88 | + ( | |
89 | + // See $2020-10 @ %Documentation::Workflow. | |
90 | + - "variables %(LDFLAGS_DYN; LDFLAGS_DYN_BASE, \ | |
91 | + LDFLAGS_DYN_EXTRA)"; | |
92 | + - "variables %(LIBS_RPATH, LIBPFX, DSOSFX)" | |
93 | + - "variable %EXESFX" | |
94 | + $dep_from ("build command line" @ %Test) | |
95 | + ), | |
96 | + * "wrong warning options for %CFLAGS when the C++ compiler is \ | |
97 | + G++" $since b880 | |
98 | + ), | |
99 | + / DLI "optimized compiler test commands" ^ '-pipe' $effective | |
100 | + @ ("SHBuild-common-options.txt", "SHBuild-YSLib-common.txt"), | |
101 | + ( | |
102 | + + "applicative %SHBuild_Extend_CallVariables" | |
103 | + @ "%SHBuild-YSLib-common.txt"; | |
104 | + / DLDI "simplified %SHBuild-BuildApp.txt" | |
105 | + ), | |
106 | + / @ "%SHBuild-YSLib-build.txt" $= | |
107 | + ( | |
108 | + + "support of %(SHBuild_LDFLAGS, SHBuild_LIBS)" | |
109 | + ^ $dep_from ("%SHBuild_Extend_CallVariables" | |
110 | + @ "%SHBuild-YSLib-common.txt"), | |
111 | + / "library building" $= | |
112 | + ( | |
113 | + / "supported %SHBuild_CXXFLAGS" | |
114 | + @ "building the precompiled header", | |
115 | + + "warning to indicate additional flags fix is used", | |
116 | + + "detection of address sanitizer and the workaround for \ | |
117 | + building performance with dynamic YFramework build by \ | |
118 | + G++"@ "platform %Linux" | |
119 | + ) | |
120 | + ), | |
121 | + * "missing check slashes in the 1st argument before call to \ | |
122 | + 'hash'" $effective @ ("function %SHBuild_CheckedCall" | |
123 | + @ "%SHBuild-common.sh" $since b562, | |
124 | + "functions %(SHBuild_CheckCC, SHBuild_CheckXX)" | |
125 | + @ "%SHBuild-common-toolchain.sh" $since b897) | |
126 | + / @ "%SHBuild-common.sh" $= | |
127 | + ( | |
128 | + / DLDI "simplified 'exit' without '$?'" $effective | |
129 | + @ "functions %(SHBuild_CheckedCall, \ | |
130 | + SHBuild_CheckedCallSlient)", | |
131 | + / @ "function %SHBuild_S2_Prepare" $= | |
132 | + ( | |
133 | + + DLD "ShellCheck directive for default value from %cd \ | |
134 | + command result", | |
135 | + // To eliminate ShellCheck warning: SC2164. | |
136 | + * "missing quotes on the argument of \ | |
137 | + %SHBuild_GetSystemPrefix" $since b905 | |
138 | + // Also to eliminate ShellCheck warning: SC2046. | |
139 | + ), | |
140 | + / DLDI "simplified function %SHBuild_GetBuildName" | |
141 | + // Also to eliminate ShellCheck issue: SC2005. | |
142 | + ) | |
143 | + ), | |
144 | + / $dev $lib "split header inclusions" !^ %YSBuild @ %SHBuild.Main | |
145 | + / $= (/ '<YSBuild.h>' -> %(YSLib.Service, NPL).YModules) | |
146 | + // This should be better for the build performance. And it is bad \ | |
147 | + that stage 1 build is effected by failure of building \ | |
148 | + unrelated modules (like %YFramework.YCLib.HostedGUI worked \ | |
149 | + around above), although the split does not resolve the real \ | |
150 | + issue. | |
151 | + ), | |
152 | + / @ "simplified build variable configuration" @ "build scripts" | |
153 | + $effective @ ("%(SHBuild-common-options.sh, \ | |
154 | + SHBuild-YSLib-common.txt, Toolchain.options.mk)" @ %Tools.Scripts, | |
155 | + "all project makefiles with %(CFLAGS, CXXFLAGS)") $= | |
156 | + ( | |
157 | + - "variables %(CFLAGS_COMMON, CXXFLAGS_COMMON)" | |
158 | + // The value is inlined to the use sites. | |
159 | + / "ensured %CFLAGS_STD at front of the default value" @ "%CFLAGS", | |
160 | + / "ensured %CXXFLAGS_STD at front of the default value" | |
161 | + @ "%CXXFLAGS" | |
162 | + ), | |
163 | + * "wrong '-fno-threadsafe-statics'" @ "%CXXFLAGS" @ "%Makefile" | |
164 | + @ "platform %Android" $since b492 $effective | |
165 | + @ %(YBase, YFramework, YSTest), | |
166 | + - $build "%AUDIOFILES build configuration" @ ("%Makefile" @ %YFramework, | |
167 | + "ARM9 makefile" @ %YSTest) @ "platform %DS", | |
168 | + // ARM7 sources are never built here. | |
169 | + - $build "rule and %OFILES output for unused files except '%.bin'" | |
170 | + $effective ("%Makefile" @ %(YBase, YFramework), "(ARM7, ARM9) makefiles" | |
171 | + @ "platform %DS" @ %YSTest, | |
172 | + "%Makefile" @ "platform %Android" @ %YSTest), | |
173 | + - DLI "redundant warning option '-Wsign-promo'" @ "%CXXFLGAS" $effective | |
174 | + ("%Makefile" @ %(YBase, YFramework), "(ARM7, ARM9) makefiles" | |
175 | + @ "platform %DS" @ %YSTest), | |
176 | + - DLI "redundant warning option '-Wnon-virtual-dtor'" @ "%CXXFLGAS" | |
177 | + $effective ("%Makefile" @ %YBase, "%Makefile" @ "platform %Android" | |
178 | + @ %YFramework, "(ARM7, ARM9) makefiles" @ "platform %DS" @ %YSTest) | |
179 | + - DLI "redundant warning option '-Wctor-dtor-privacy'" @ "%CXXFLGAS" | |
180 | + $effective ("%Makefile" @ %YBase, "%Makefile" @ "platform %Android" | |
181 | + @ %YFramework, "ARM9 makefiles" @ "platform %DS" @ %YSTest), | |
182 | + + '-Wno-ignored-qualifiers' @ "%(CFLAGS, CXXFLAGS)" @ "%Makefile" | |
183 | + @ ("%Makefile" @ "platform %DS" @ %YFramework, "ARM9 makefile" | |
184 | + @ "platform %DS" @ %YSTest), | |
185 | + // To eliminate G++ warning: [-Wignored-qualifiers] | |
186 | + / %YBase $= | |
187 | + ( | |
188 | + / %Test $= | |
189 | + ( | |
190 | + / $re_add(b860) "all %std::function" -> "%ystdex::function", | |
191 | + / "all %std::string" -> "%ystdex::string" | |
192 | + ), | |
193 | + / DD "Doxygen comments" @ %YStandardEx $= | |
194 | + ( | |
195 | + + $design '\c' @ "before header name" @ %Apply, | |
196 | + + "'\note' command" @ "class %unimplemented" @ %Exception, | |
197 | + + "'\note' command" @ "metafunctions %(enable_for_iterator_t, \ | |
198 | + enable_for_input_iterator_t)" @ %IteratorTrait | |
199 | + ) | |
200 | + ), | |
201 | + / %YReader $= | |
202 | + ( | |
203 | + / $re_add(b860) $dev "all %std::function" -> "%YSLib::function" | |
204 | + @ %(DSReader, ShlReader), | |
205 | + + DLDI "%yunused around %YReader::FetchImage call" @ "main function" | |
206 | + @ %Main, | |
207 | + // To eliminate G++ and Clang++ warning: [-Wunused-result]. | |
208 | + / DD "Doxygen comments" @ %(About, HexBrowser, ReadingList) | |
209 | + ), | |
210 | + + DLDI 'YB_STATELESS' @ "unimplemented API" @ !"platform %Win32" $effective | |
211 | + @ ("member function %GUIHost::GetForegroundWindow" @ %GUIApplication, | |
212 | + "function %FetchDefaultTopLevelPosition" @ %HostedUI) | |
213 | + @ %YFramework.Helper | |
214 | + // To eliminate G++ 10.1 warning: [-Wsuggest-attribute=const]. | |
215 | +), | |
216 | + | |
217 | +b905 | |
218 | +( | |
35 | 219 | ( |
36 | 220 | * $doc "fixed annotations method of engineering defects" |
37 | 221 | @ %Documentation.ProjectRules $since b874; |
@@ -258,7 +442,7 @@ | ||
258 | 442 | Some also depend on the input. The old implementation \ |
259 | 443 | (before b901) using %EncodeArg has limitation on the \ |
260 | 444 | active code page despite of input encoding issues, \ |
261 | - though. | |
445 | + though. | |
262 | 446 | ), |
263 | 447 | / $comp "environment encoding converted to UTF-8" |
264 | 448 | $dep_from ("%SetEnvironmentVariable" @ %YCLib.YCommon, |
@@ -834,7 +1018,7 @@ | ||
834 | 1018 | GetFileModificationAndAccessTimeOf)" $orig (@ |
835 | 1019 | "member %FileDescriptor::GetModificationTime" $since b624) |
836 | 1020 | ), |
837 | - + "function %StreamGet" @ %FileIO ^ $dep_from | |
1021 | + + "function %StreamGet" @ %FileIO ^ $dep_from | |
838 | 1022 | ("%ystdex::flush_input" @ %YBase.YStandardEx.StreamBuffer) |
839 | 1023 | ), |
840 | 1024 | / %YSLib.Adaptor $= |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2013-2019 FrankHB. | |
2 | + © 2013-2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file Meta.txt |
12 | 12 | \ingroup Documentation |
13 | 13 | \brief 项目元标记。 |
14 | -\version r1653 | |
14 | +\version r1657 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 393 |
17 | 17 | \par 创建时间: |
18 | 18 | 2013-03-25 00:01:48 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2019-10-24 20:52 +0800 | |
20 | + 2020-12-24 12:01 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -114,9 +114,9 @@ | ||
114 | 114 | observe no behavior change within every supported configuration \ |
115 | 115 | consistently, as long as the contracts of the code are not violated; |
116 | 116 | $lib; // issues only concerned with library, without interface modification \ |
117 | - (also including deletion, but not addition) potentially requiring user \ | |
118 | - code modification by providing some backward-compatible replacements as \ | |
119 | - long as there is no undefined behavior; | |
117 | + or deletion (but not addition) potentially requiring user code \ | |
118 | + modification by providing some backward-compatible replacements as long as \ | |
119 | + there is no undefined behavior; | |
120 | 120 | $design; // features changing probably only made sense to who needs to \ |
121 | 121 | reference or modify the implementation; |
122 | 122 | $src; // issues expected to break public ABI in at least one direction of one \ |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file NPL.txt |
12 | 12 | \ingroup Documentation |
13 | 13 | \brief NPL 规范和实现规格说明。 |
14 | -\version r17390 | |
14 | +\version r17543 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 304 |
17 | 17 | \par 创建时间: |
18 | 18 | 2012-04-25 10:34:20 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2020-11-29 20:59 +0800 | |
20 | + 2020-12-23 21:12 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -1325,7 +1325,7 @@ | ||
1325 | 1325 | 满足本节以下规则的由派生实现定义的匿名函数(anonymous function expression) 表达式,简称匿名函数。 |
1326 | 1326 | 函数应确定替换重写规则被替换的目标(@4.4.4.4) (称为函数体(function body) )。 |
1327 | 1327 | 匿名函数可以捕获(capture) 若干变量,并在函数体引入这些变量。 |
1328 | -匿名函数可以显式指定(绑定(bind) )若干变量使之成为约束变量(@4.1) ,称为函数的形式参数(formal parameter, parameter) 。 | |
1328 | +匿名函数可以显式指定(绑定(bind) )包含若干变量使之成为约束变量(@4.1) 的语法构造。这种变量称为函数的形式参数(formal parameter, parameter) 。 | |
1329 | 1329 | 使用词法作用域(@4.6.1.1.2) 时,若匿名函数所在作用域(@4.1) 的存在同名的名称,则被捕获的名称隐藏(@4.1) 。形式参数隐藏被捕获的变量名。 |
1330 | 1330 | 派生实现的语义规则应满足和 λ 演算语义(@4.5) 的 α-转换(alpha-conversion) 规则不矛盾。注意 vau 演算(@1.3) 在没有限定环境(@4.6.1.1) 时不考虑一般意义上的自由变量(@4.1) 。 |
1331 | 1331 | 除非派生实现另行指定,函数不需要被进一步规约,此时其求值是值替换规则(@4.4) 的平凡形式。 |
@@ -1358,18 +1358,25 @@ | ||
1358 | 1358 | @4.5.3 函数合并(function combination) : |
1359 | 1359 | 具有至少一个约定位置的子项 E1 的复合表达式(@3.4.2.2) E ,当且仅当 E1 是被求值作为操作符(@4.4.3.1) 的函数时,E 是函数合并表达式,简称函数合并。 |
1360 | 1360 | 求值函数合并时,子项(@4.1) E1 总是被求值; |
1361 | -除 E1 外表达式的剩余子项 E2 是操作数(@4.4.3.1),在 E 被求值时以操作数决定的值等效替换(substitute) 函数的形式参数。 | |
1361 | +除 E1 外表达式的剩余子项 E2 是操作数(@4.4.3.1),在 E 被求值时以操作数决定的值等效替换(substitute) 函数的形式参数(@4.5.2) 。 | |
1362 | 1362 | 替换形式参数的值是实际参数(actual argument, argument) 。 |
1363 | 1363 | 函数合并的求值是替换规则(@4.4) 的非平凡形式。 |
1364 | 1364 | 若替换操作数 E2 可被求值,函数合并 E 是函数应用表达式,简称函数应用。 |
1365 | 1365 | 若操作符是 λ 抽象,E2 视为一个整体,则函数应用替换规则对应 λ 演算的 β-规约(beta-reduction) 规则。 |
1366 | 1366 | 其它函数合并使用的替换规则由派生实现指定。 |
1367 | 1367 | 派生实现应指定函数合并规约(@4.1) 的结果是规范形式(@4.5.2),它对应的值是函数合并的求值结果(@4.1) ,称为函数值。 |
1368 | -函数应用中,替换形式参数(@4.5.2) 为实际参数(@4.5.2) 的过程蕴含对实际参数的值的计算的依赖,即参数的值的计算先序(@4.4.1) 函数应用的求值;但其它求值顺序没有保证。 | |
1368 | +函数应用匹配实际参数和对应的引入形式参数的构造。这个过程可能失败。确定匹配参数成功的条件是等价关系,称为参数匹配一致性,由参数匹配的等价关系指定。 | |
1369 | +匹配成功的每个实际参数和被匹配的目标(可能是形式参数)具有一对一或多对一的对应关系。 | |
1370 | +伴随参数匹配,实现可引入其它必要的操作(如为匹配分配资源和确定上述对应关系)。这些操作可具有和确定参数对应关系的匹配之间非决定性有序(@4.4.1) 的副作用。 | |
1371 | +仅当上述必要操作及所有实际参数的匹配成功,替换 E1 决定的某个关联表达式中和形式参数(@4.5.2) 结构一致的子表达式为实际参数(@4.5.2) 。替换参数的结构一致性是等价关系。 | |
1372 | +表达式相等蕴含参数匹配一致性和替换结构一致性。实现可分别定义其它规则扩充这些等价关系的外延。 | |
1373 | +替换参数的值蕴含对实际参数的值的计算的依赖,即参数的值的计算先序(@4.4.1) 函数应用的求值;但其它求值顺序没有保证。 | |
1369 | 1374 | |
1370 | 1375 | @4.5.3.1 函数调用(call) : |
1371 | 1376 | 求值函数合并包含子表达式的求值:总是求值操作符,并可能求值操作数。若这些求值都没有退出,则函数被调用。 |
1372 | -若被调用的函数存在形式参数,函数调用首先包含操作数替换以特定规则绑定(@4.5.2) 的形式参数(@4.5.2) 。 | |
1377 | +若被调用的函数存在形式参数,函数调用首先以操作数的直接子表达式作为实际参数,匹配实际参数和形式参数。 | |
1378 | +若实际参数匹配的目标可指定一个变量,则伴随参数匹配的操作包括以特定规则绑定(@4.5.2) 的形式参数(@4.5.2) 。 | |
1379 | +绑定的实际参数和对应的形式参数作为不同的实体时,作为伴随参数匹配的必要操作的一部分,发生参数传递(parameter passing) 。参数传递使形式参数具有作为实际参数值的副本。参数传递可能使和实际参数相关的资源被复制或转移。 | |
1373 | 1380 | 实现在函数合并的求值中应提供函数调用的支持。 |
1374 | 1381 | 函数调用确定副作用的边界:保证参数表达式在函数应用被求值之前被求值。 |
1375 | 1382 | 在控制返回(@4.5.2.1) 主调函数(@4.5.2.1) 时,函数调用内部确定的函数值最终替换被求值的函数调用(@4.5.3.1) ,即为返回值(return value) 。 |
@@ -1643,7 +1650,7 @@ | ||
1643 | 1650 | |
1644 | 1651 | @5.2.4.2 求值和对象所有权: |
1645 | 1652 | 被求值的表达式的内部表示即项(@5.5) 或环境(@5.4.3) 中的对象具有 NPLA 对象的所有权。 |
1646 | -所有权可被前者独占的 NPLA 对象是临时对象(temporary object) 。关于引入临时对象,参见 @5.5.5 。 | |
1653 | +所有权可被前者独占的 NPLA 对象是临时对象(temporary object) 。关于引入临时对象,参见 @5.5.6 。 | |
1647 | 1654 | 和宿主语言类似,NPLA 临时对象的存储未指定。对名义上被项所有的临时对象,必要时实现可分配内部存储转移项(包括在环境中分配),以满足附加要求(如 @5.2.5 )。 |
1648 | 1655 | 和宿主语言类似,对象的所有权随可随对象被转移,且被转移对象后的项具有有效但未指定(valid but unspecified) 的状态,参见 @5.5.2.3 和 @5.5.3 。 |
1649 | 1656 | 环境对绑定具有的所有权是独占的。绑定对其中的对象可具有独占或共享的所有权。因此,环境可对绑定中的对象具有独占或共享的所有权。 |
@@ -1927,7 +1934,7 @@ | ||
1927 | 1934 | Unique :唯一引用。 |
1928 | 1935 | Nonmodifying :不可修改。 |
1929 | 1936 | Temporary :临时对象。 |
1930 | -默认值外仅用于 NPLA 项引用(参见 @5.6.3 和 @5.6.3.1 )和派生实现。 | |
1937 | +默认值外仅用于 NPLA 项引用(term reference)(参见 @5.6.3 和 @5.6.3.1 )和派生实现。 | |
1931 | 1938 | 在 TermTagIndices 中的枚举项带有 Index 后缀,和这些枚举项一一对应。 |
1932 | 1939 | 项的标签指定通过和标签关联的值访问的对象假定允许具有的性质。除非派生实现另行指定,违反这些假定不引起 NPLA 未定义行为(@5.2.2) 。 |
1933 | 1940 | 唯一引用允许通过通过具有唯一引用的项或项引用(@5.6.3) 访问关联的对象,对象可被假定不被其它引用而仅通过这个途径访问,即便实际存在其它途径的引用时可能引起不同的行为;在假定的基础上程序具有何种可能的行为是未指定的。 |
@@ -2012,7 +2019,7 @@ | ||
2012 | 2019 | @5.5.1.1 类型系统和表示: |
2013 | 2020 | 值类别在 NPLA 中被作为一种内建的类型系统,参见 @4.2.6 。 |
2014 | 2021 | 但在类型的值的内部表示上,值类别和特定的类型相关: |
2015 | -当前 NPLA 支持的左值都是项引用(@5.6.3) ,这同时表示引用值(@5.6.3) 。 | |
2022 | +当前 NPLA 支持的左值都是项引用(@5.6.3) ,这同时表示引用值(@5.5.4) 。 | |
2016 | 2023 | 另见 @5.6.3 和 @5.9 。 |
2017 | 2024 | |
2018 | 2025 | @5.5.1.2 设计原理: |
@@ -2027,7 +2034,7 @@ | ||
2027 | 2034 | 第四,允许对象的操作保持资源局域性,满足一等对象不依赖引用的抽象(@4.2.3) 同时允许按需区分是否依赖引用的两类一等对象; |
2028 | 2035 | 第五,避免需要假设存在外部具有被引用对象(@4.2.3) 的所有权的所有者(@5.2.4.4) 。 |
2029 | 2036 | 第三条性质保证表达式的作用(@4.1) 是可组合的并允许求值表达为树规约(@5.4.2) ,还保证能总是通过子表达式的值类别决定表达式的值类别。因为被求值的表达式是有限的,判定过程是总是能终止,即便求值不满足强规范化性质(@4.4.3) 。 |
2030 | -第四条性质要求提供泛左值总是能作为纯右值使用的机制和通过纯右值引入对象的机制,详见值类别转换(@5.5.4) 。 | |
2037 | +第四条性质要求提供泛左值总是能作为纯右值使用的机制和通过纯右值引入对象的机制,详见值类别转换(@5.5.5) 。 | |
2031 | 2038 | 第五条性质要求在表达式之外不存在地位相同的对象的存储资源(@5.2.4) 的所有者,限定了被决定同一性的对象的外延;存储由环境提供(@5.2.4) ,其中不需要保存对象的引用。 |
2032 | 2039 | |
2033 | 2040 | @5.5.2 初始化: |
@@ -2039,7 +2046,7 @@ | ||
2039 | 2046 | |
2040 | 2047 | @5.5.2.1 复制初始化和直接初始化: |
2041 | 2048 | 和宿主语言类似,初始化包括直接初始化(direct initialization) 和复制初始化(copy initialization) 。 |
2042 | -函数可能接受引用值(@5.6.3) 参数和返回值,是对函数的形式参数或函数值的复制初始化;其它初始化是直接初始化。 | |
2049 | +函数可能接受引用值(@5.5.4) 参数和返回值,是对函数的形式参数或函数值的复制初始化;其它初始化是直接初始化。 | |
2043 | 2050 | 复制初始化形式参数和函数值时,函数参数或返回值作为初值符。 |
2044 | 2051 | |
2045 | 2052 | @5.5.2.2 函数参数和函数值传递(@4.4.4.5) : |
@@ -2050,9 +2057,9 @@ | ||
2050 | 2057 | 相对地,完美转发也保持引入这些初始化的表达式(通常是被求值取得函数值的函数表达式)时,其求值结果(函数值)的值类别(@5.5.1) 和初值符保持一致。 |
2051 | 2058 | |
2052 | 2059 | @5.5.2.3 对象的复制和转移: |
2053 | -类似宿主语言中的类类型的值,可使用初值符为参数进行复制或转移操作以复制初始化对象。(其它情形另见 @5.5.5.3 。) | |
2060 | +类似宿主语言中的类类型的值,可使用初值符为参数进行复制或转移操作以复制初始化对象。(其它情形另见 @5.5.6.3 。) | |
2054 | 2061 | 类似 ISO C++11 起选择类的转移构造函数代替复制构造函数,可使用转移操作时,不对项进行复制,因此不要求值数据成员保存的宿主对象可复制(而避免抛出 ystdex::invalid_construction 等实现相关的异常)。 |
2055 | -和 ISO C++11 起不同,上述可使用转移操作的条件和语法上下文无关:引起选择转移操作的条件由对初值符的谓词而非类似宿主语言的构造函数判断(详见 @5.5.4.1 )。 | |
2062 | +和 ISO C++11 起不同,上述可使用转移操作的条件和语法上下文无关:引起选择转移操作的条件由对初值符的谓词而非类似宿主语言的构造函数判断(详见 @5.5.5.1 )。 | |
2056 | 2063 | 同宿主语言,对象的复制和转移不改变被转移后的类型(@4.6.2) 。 |
2057 | 2064 | |
2058 | 2065 | @5.5.3 项的转移: |
@@ -2069,21 +2076,39 @@ | ||
2069 | 2076 | 项的转移也类似 YSLib::ValueObject 自身的转移,其实现(当前通过 ValueObject 内部的 ystdex::any 的转移构造函数)保证直接转移对象而不保证转移构造所有的值。 |
2070 | 2077 | 若需调用宿主对象的转移构造函数,需明确避免宿主对象转移消除的上下文中进行操作。派生实现可提供这些操作。 |
2071 | 2078 | |
2072 | -@5.5.4 值类别转换: | |
2079 | +@5.5.4 引用值(reference value) : | |
2080 | +在对象语言中,引用值(reference value) 作为引用的值,可保存在一等对象中,这样的一等对象是引用对象(reference object) 。 | |
2081 | +引用值和引用对象的值具有引用类型(@5.5.1.2) 。 | |
2082 | +在特定上下文中引用和其它一等对象(@4.2.1) 的值的相同具有不同的语义。这主要体现在引用值被按值传递和按引用传递时(@4.4.4.5) 。差异和 ISO C++ 的引用类似。 | |
2083 | +引用值可使用以下方式表示: | |
2084 | +引用项(reference term) ; | |
2085 | +使用 TermTags::Temporary 标签(@5.4.2.2) 标记的非引用项。 | |
2086 | +其中,前者是值数据成员为项引用(@5.6.3) 对象的项。 | |
2087 | +引用项(@5.5.4) 中的项引用对象引用一个(其它的)项,用于在必要时引入可被引用的一个项而不在 TermNode 中直接储存这个项的值。 | |
2088 | +对实现作为一等对象(@4.1) 的列表(@5.4.2.1) 的引用(@4.2.3) ,支持引用整个项的中间值是必要的;但项引用也支持引用非列表项。 | |
2089 | +临时对象(@5.5.6) 可初始化引用值。和非临时对象的引用值不同,临时对象初始化的引用值和关联的被引用对象之间不需要区分同一性,因此使用被引用对象添加 TermTags::Temporary(@5.4.2.2) 标签表示。 | |
2090 | +引用值可能是左值引用(lvalue reference) 或右值引用(rvalue reference) 。 | |
2091 | +前者是排除引用项表示且不是唯一引用(@5.4.2.2) 的引用值;后者是以引用项表示的唯一引用或临时对象初始化的非引用项的引用值。 | |
2092 | +左值引用和左值引用与宿主语言中的对象类型的左值引用与右值引用分别类似。 | |
2093 | +引用值是否作为左值(@5.5.1.1) 使用取决于上下文。除非另行指定,引用值都是左值。其中,在要求右值的上下文发生左值到右值转换(@5.5.5) 。 | |
2094 | +引用值应引用在存储期(@5.2.4) 内的对象。否则,引用值是悬空引用(dangling reference) 。 | |
2095 | +注意访问悬空引用不满足内存安全(@5.2.4.3) 而引起未定义行为。 | |
2096 | + | |
2097 | +@5.5.5 值类别转换: | |
2073 | 2098 | 和宿主语言类似,具有特定值类别的表达式可转换为不同值类别的表达式: |
2074 | 2099 | 除非另行指定,泛左值总是允许作为纯右值使用,称为左值到右值转换(lvalue-to-rvalue conversion) ; |
2075 | -从纯右值初始化(@5.5.2) 可被对象语言作为一等对象(@4.1) 使用的临时对象并用消亡值表示,称为临时对象实质化转换(temporary materialization conversion) 。 | |
2100 | +从纯右值初始化(@5.5.2) 可被对象语言作为一等对象(@4.1) 使用的临时对象作为消亡值(@5.5.1) ,称为临时对象实质化转换(temporary materialization conversion) 。 | |
2076 | 2101 | 左值到右值转换没有副作用(@4.2.2.1) 。临时对象实质化转换没有副作用,当且仅当其中初始化临时对象时没有副作用。 |
2077 | 2102 | 临时对象实质化转换中,纯右值被实质化(materialized) 。 |
2078 | 2103 | 在求值子表达式时,按表达式具有的语义,必要时(如按 @5.5.1.1 判断上下文的值类别)进行值类别转换。 |
2079 | -为支持引用值(@5.6.3) 作为一等对象,NPLA 在左值到右值转换的基础上提供更精细的引用值提升转换,即以下转换操作: | |
2104 | +为支持引用值(@5.5.4) 作为一等对象,NPLA 在左值到右值转换的基础上提供更精细的引用值提升转换,即以下转换操作: | |
2080 | 2105 | 若操作数是引用值,则结果是操作数引用的被引用对象; |
2081 | 2106 | 否则,结果是操作数。 |
2082 | 2107 | 根据引用值的性质,易知左值到右值转换的规约是引用值转换的规约的传递闭包,即: |
2083 | 2108 | 若操作数是已被折叠的引用值,则引用值提升转换等价左值到右值转换; |
2084 | 2109 | 否则,有限次的引用值提升转换等价左值到右值转换。 |
2085 | 2110 | |
2086 | -@5.5.4.1 设计原理: | |
2111 | +@5.5.5.1 设计原理: | |
2087 | 2112 | 值类别和左值到右值转换在一些上下文的行为类似箱和自动拆箱(@4.2.3.5.3) ,不利于维护简单性(@1.4.3.2) : |
2088 | 2113 | 特别地,和宿主语言不同,函数不包含充分的信息(参数类型)推断是否接受左值操作数,因此在不提供针对函数的重载(overloading) 一般机制的前提下,本机实现(@5.2.1) 不能预知输入的操作数是否是左值,通常需分别支持左值和右值的操作数; |
2089 | 2114 | 即便提供重载,仍然较单一的值类别更复杂。 |
@@ -2091,44 +2116,44 @@ | ||
2091 | 2116 | 由正确性的优先规则(@1.4.3) ,完整性(@1.4.3.1.1) 应先于简单性被满足。 |
2092 | 2117 | 而考虑统一性(@1.4.5.1) ,对存储和对象模型的设计,用户自行的实现仍要求这些设施(尽管更困难)。 |
2093 | 2118 | |
2094 | -@5.5.4.2 返回值转换(return value conversion) : | |
2119 | +@5.5.5.2 返回值转换(return value conversion) : | |
2095 | 2120 | 返回值转换是一次引用值提升转换和可选的临时对象实质化转换的复合。 |
2096 | 2121 | 返回值转换(return value conversion) 用于在对象语言中确定函数调用的返回值(@5.2.1) 可包含函数体(@4.5.2) 的求值结果到返回值的转换。 |
2097 | 2122 | 返回值转换的应用参见 @7.1.4.2 。 |
2098 | 2123 | |
2099 | -@5.5.5 临时对象的引入: | |
2124 | +@5.5.6 临时对象的引入: | |
2100 | 2125 | 和宿主语言的临时对象的使用方式类似,NPLA 的临时对象在特定的上下文中被引入。 |
2101 | -为简化规约和互操作机制的设计,和 ISO C++17 不同,临时对象仅在转换为消亡值(@5.5.1) 时的临时对象实质化转换(@5.5.4) 引入,而不包括延迟初始化或异常对象的创建。 | |
2126 | +为简化规约和互操作机制的设计,和 ISO C++17 不同,临时对象仅在转换为消亡值(@5.5.1) 时的临时对象实质化转换(@5.5.5) 引入,而不包括延迟初始化或异常对象的创建。 | |
2102 | 2127 | 临时对象实质化转换引入临时对象的规则和 ISO C++17 不同: |
2103 | 2128 | 不论表达式是否作为子表达式使其值被使用(未使用的情形对应 ISO C++ 中的 discarded-value expression ),都允许存在临时对象; |
2104 | -要求复制消除(copy elision) 而避免特定对象的初始化(@5.5.2) ,参见 @5.5.5.3 。 | |
2105 | - | |
2106 | -@5.5.5.1 实质化转换上下文: | |
2129 | +要求复制消除(copy elision) 而避免特定对象的初始化(@5.5.2) ,参见 @5.5.6.3 。 | |
2130 | + | |
2131 | +@5.5.6.1 实质化转换上下文: | |
2107 | 2132 | 可要求临时对象实质化转换的上下文包括: |
2108 | 2133 | 使用纯右值初始化按引用绑定的变量(如函数的引用类型的形式参数(@4.5.2) ); |
2109 | 2134 | 求值函数调用以初始化返回值对象。 |
2110 | 2135 | 其中,按引用绑定的变量被可选地支持;若被支持,引入引用值的形式参数的具体形式由派生实现指定。 |
2111 | 2136 | 一般地,按引用绑定的变量在活动调用(@4.5.3.1) 关联的环境分配临时对象(@5.2.4.2) 。此时,对象被调用表达式的项独占所有权,同时被绑定的环境独占资源所有权。 |
2112 | 2137 | |
2113 | -@5.5.5.2 返回值转换上下文: | |
2114 | -返回值转换(@5.5.4.2) 可引入实质化的临时对象,其中可能转移求值的中间结果(@5.5)(条件参见 @5.6.3.4 );否则,对象被复制。 | |
2138 | +@5.5.6.2 返回值转换上下文: | |
2139 | +返回值转换(@5.5.5.2) 可引入实质化的临时对象,其中可能转移求值的中间结果(@5.5)(条件参见 @5.6.3.4 );否则,对象被复制。 | |
2115 | 2140 | 此处被转移对象符合 @5.2.4.2 的临时对象的定义,但除非另行指定,被转移的对象不在对象语言中可被访问。 |
2116 | 2141 | 此处的转移引起宿主对象转移消除(@5.5.3.1) 。 |
2117 | 2142 | 仅在对象被复制且复制具有副作用时,返回值转换具有等价复制的副作用。 |
2118 | 2143 | |
2119 | -@5.5.5.3 复制消除: | |
2144 | +@5.5.6.3 复制消除: | |
2120 | 2145 | 和 ISO C++17 类似,NPLA 要求特定上下文中的复制消除,排除复制或转移操作且保证被消除操作的源和目的对象的同一性(@4.2.1.1) 。 |
2121 | 2146 | 和 ISO C++17 不同,NPLA 的复制消除限于临时对象的消除,但不限制对象的类型(特定的 C++ 类类型),且除以下约定外的所有表达式求值的上下文对复制消除相同(例如,不区分求值结果是否被作为返回值(@4.5.3.1) 或求值是否为常量表达式)。 |
2122 | 2147 | 复制消除仅在以下转换上下文中被要求,即直接使用转换的源表达式中被求值项指称的对象(@5.7.3) 作为实质化的对象而不初始化新的临时对象: |
2123 | -实质化转换上下文(@5.5.5.1) ; | |
2124 | -引起对象转移的返回值转换上下文(@5.5.5.2) 。 | |
2148 | +实质化转换上下文(@5.5.6.1) ; | |
2149 | +引起对象转移的返回值转换上下文(@5.5.6.2) 。 | |
2125 | 2150 | 非本机实现(@5.2.1) 函数函数体内指定的返回值不属于上述的确定返回值的上下文,但也不要求被复制消除。这和 ISO C++17 要求 return 语句中的特定的表达式被消除不同,而不需要依赖特定上下文的语法性质。 |
2126 | 2151 | 实现仍可能根据当前环境(@5.4.4) 来判断是否在允许消除对象复制的上下文中(当前未实现),而进行复制消除。 |
2127 | 2152 | 在完成实质化转换前的不完整的求值规约(@4.4) 中的临时对象在逻辑上不需要作为一等对象(@4.1) 存在,但纯右值作为对象表示中的子项,随纯右值在宿主语言中作为对象存在,以允许互操作。 |
2128 | -复制消除不在被初始化对象以外引入新的项。若被消除的对象来自不同的项,则复制消除为宿主对象转移消除(@5.5.3.1) 。这包括所有对象转移的返回值转换上下文的情形(@5.5.5.2) 。 | |
2153 | +复制消除不在被初始化对象以外引入新的项。若被消除的对象来自不同的项,则复制消除为宿主对象转移消除(@5.5.3.1) 。这包括所有对象转移的返回值转换上下文的情形(@5.5.6.2) 。 | |
2129 | 2154 | 在使用纯右值初始化引用值时,延长源表达式的项指称的对象(@5.7.3) 的生存期(@5.2.5) 。这和初始化非引用值类似,但实现需区分是否初始化的是延长生存期的临时对象,以确保之后能区分是否按引用绑定。 |
2130 | 2155 | |
2131 | -@5.5.6 表达式的类型: | |
2156 | +@5.5.7 表达式的类型: | |
2132 | 2157 | NPLA 的类型系统(@4.6.2) 使用隐式类型(@4.6.2.2) ;和 Scheme 及 Kernel 类似,默认使用潜在类型,保证表达式的值具有类型(@5.2) 。 |
2133 | 2158 | NPLA 表达式的类型约定为表达式求值结果(@4.1) 的类型。 |
2134 | 2159 | 空求值(@4.4.2) 的求值结果要求未求值的合式的(@2.5.1) 表达式应具有和语法分析(@5.3.2) 的输出兼容的类型,参见 @5.4.2.1 和 @5.6.1 。 |
@@ -2165,32 +2190,21 @@ | ||
2165 | 2190 | |
2166 | 2191 | @5.6.2 环境引用: |
2167 | 2192 | 环境引用是引用 Environment 类型的环境(@5.4.3) 并支持其共享所有权(@5.2.4.2) 的中间值。 |
2193 | +环境引用类似引用值(@5.5.4) ,但隐含更复杂的所有权关系,因此不具有相同的类型(@5.5.7) 。 | |
2168 | 2194 | shared_ptr<Environment> 可引用环境对象,其非空值作为环境强引用(@5.4.3) 。 |
2169 | 2195 | NPL::EnvironmentReference 可引用环境对象,封装 weak_ptr<Environment> 和锚对象(anchor object) 指针,其非空值表示可能具有共享所有权的环境弱引用(@5.4.3) 。 |
2170 | 2196 | 环境对象的弱引用的所有权关系使用其中的 weak_ptr<Environment> 确定。 |
2171 | 2197 | 因为 weak_ptr<Environment> 不提供可靠的弱引用计数,引用锚对象附加的引用计数用于确定弱引用的数量,详见 @6.9.4 。 |
2172 | -默认构造的 shared_ptr<Environment> 是空的引用值。 | |
2173 | -默认构造的 NPL::EnvironmentReference 具有空的 weak_ptr<Environment> 值,是空的引用值。 | |
2198 | +默认构造的 shared_ptr<Environment> 是空的环境引用。 | |
2199 | +默认构造的 NPL::EnvironmentReference 具有空的 weak_ptr<Environment> 值,是空的环境引用。 | |
2174 | 2200 | 非空的 shared_ptr<Environment> 和 NPL::EnvironmentReference 分别可作为对象语言的环境强引用和环境弱引用的宿主值。 |
2175 | 2201 | |
2176 | -@5.6.3 项引用和引用项: | |
2177 | -NPL::TermReference 储存在项的值数据成员中引用一个项,用于在必要时引入可被引用的一个项而不在 TermNode 中直接储存这个项的值。 | |
2178 | -对实现作为一等对象(@4.1) 的列表(@5.4.2.1) 的引用(@4.2.3) ,支持引用整个项的中间值是必要的;但 NPL::TermReference 也支持引用非列表项。 | |
2179 | -在对象语言中,引用值(reference value) 作为引用的值,可保存在一等对象中,这样的一等对象是引用对象(reference object) 。 | |
2180 | -引用值和引用对象的值具有引用类型(@5.5.1.2) 。 | |
2181 | -在特定上下文中引用和其它一等对象(@4.2.1) 的值的相同具有不同的语义。这主要体现在引用值被按值传递和按引用传递时(@4.4.4.5) 。差异和 ISO C++ 的引用类似。 | |
2182 | -值数据成员为项引用对象的项是引用项(reference term) 。 | |
2183 | -引用值可使用以下方式表示: | |
2184 | -引用项; | |
2185 | -使用 TermTags::Temporary 标签(@5.4.2.2) 标记的非引用项。 | |
2202 | +@5.6.3 项引用: | |
2203 | +宿主语言中的 NPL::TermReference 是项引用。 | |
2186 | 2204 | NPL::TermReference 和所在的项中可能包含的子对象是引用值的宿主值(@5.5) 类型。 |
2187 | 2205 | 其中,子项只被 @5.6.3.5 的情形使用。 |
2188 | 2206 | 子对象引用使用的这种形式的表示通常因为需要更多的操作比其它引用值的类似操作低效,但这种表示可避免依赖宿主语言中的本机对象内部表示(如成员布局)的依赖。 |
2189 | 2207 | 一般地,在 C++ 的意义上不存在能满足语义的更有效的可移植表示,所以这种表示在和宿主语言的互操作上是必要的。 |
2190 | -NPL::TermReference 通过是否使用引用值初始化决定对象语言中的左值引用(lvalue reference) 和右值引用(rvalue reference) 。 | |
2191 | -引用值是否作为左值(@5.5.1.1) 使用取决于上下文。除非另行指定,引用值都是左值。其中,在要求右值的上下文发生左值到右值转换(@5.5.4) 。 | |
2192 | -引用值应引用在存储期(@5.2.4) 内的对象。否则,引用值是悬空引用(dangling reference) 。 | |
2193 | -注意访问悬空引用不满足内存安全(@5.2.4.3) 而引起未定义行为。 | |
2194 | 2208 | 对 NPL::TermReference 相关操作详见 @6.4.4 ;可能使用 NPL::TermReference 访问项的操作详见 @6.4.5 。 |
2195 | 2209 | |
2196 | 2210 | @5.6.3.1 项引用的元数据(@4.2.3.3.1) : |
@@ -2216,11 +2230,12 @@ | ||
2216 | 2230 | @5.6.3.4 可转移条件: |
2217 | 2231 | 根据项是否具有特定元数据的引用值可判断使用复制代替对象转移的条件(@5.5.2.3) 。 |
2218 | 2232 | 可转移条件的判断基于表示表达式的值的项。可转移项(movable term) 通过以下方式确定: |
2219 | -若项是非引用项,总是可转移的; | |
2233 | +非引用项(@5.5.4) 总是可转移的(非引用项表示右值); | |
2220 | 2234 | 否则,若项引用具有的标签(@5.6.3.1) 决定它是被引用对象的唯一引用且非不可修改(@5.4.2.2) ,项是可转移的。 |
2221 | -一般地,决定可转移条件有两类: | |
2222 | -由一般表达式的值确定可转移:判断表示表达式的值是可转移项使之能作为非引用值的返回值(用例如 @7.1.4.2 ); | |
2223 | -由被转发(@5.5.2.2) 表达式的值确定可转移:除上述条件外,表示绑定临时对象的引用值(具有临时对象标签(@5.4.2.2) )的项蕴含被引用对象(@4.2.3) ,也是可转移的(用例如 @9.8 )。 | |
2235 | +一般地,非引用值的对象是可转移的。 | |
2236 | +确定引用值关联的被引用对象可转移的条件有两类: | |
2237 | +由可转移项确定:引用值由可转移项表示,在特定的上下文使被引用对象能转换为右值(用例如 @7.1.4.2 ); | |
2238 | +由被转发(@5.5.2.2) 表达式的值确定:除上述条件外,表示绑定临时对象的引用值(具有临时对象标签(@5.4.2.2) )的项蕴含被引用对象(@4.2.3) ,也是可转移的(用例如 @9.8 )。 | |
2224 | 2239 | |
2225 | 2240 | @5.6.3.5 子对象引用(subobject reference) : |
2226 | 2241 | 特定的引用值是子对象引用,通过一个引用值和它的子对象构造,引用被对象所有的一等对象。 |
@@ -2301,7 +2316,7 @@ | ||
2301 | 2316 | 项对象可能不直接由项自身表示,即可以通过项引用其它途径引入的对象。 |
2302 | 2317 | 基于 @5.7.2 ,为保证内存安全,避免临时对象被引用,仅在泛左值(@5.5.1) 中允许引入被可能引用的间接值。 |
2303 | 2318 | 推论:泛左值的项对象不是临时对象,被环境所有。 |
2304 | -通常纯右值作为其它项的子项而被独占所有权,求值时可能通过临时对象实质化转换(@5.5.4) 标识创建的临时对象(@5.5.5) 。 | |
2319 | +通常纯右值作为其它项的子项而被独占所有权,求值时可能通过临时对象实质化转换(@5.5.5) 标识创建的临时对象(@5.5.6) 。 | |
2305 | 2320 | 作为 @5.2.4 的实现,临时对象以项自身作为表示(@5.5) ,被纯右值所有,也间接被其它项所有。 |
2306 | 2321 | 特定情况下纯右值可能被环境所有,但应只通过复制等方式访问其值而不依赖所有权关系(如仅复制记号值(@5.7.4.2) )。 |
2307 | 2322 |
@@ -2316,12 +2331,13 @@ | ||
2316 | 2331 | 关于被求值的被规约项中的对象的所有权,另见 @5.7.3 。 |
2317 | 2332 | 派生实现可基于本节约定其它规则。 |
2318 | 2333 | |
2319 | -@5.7.4.1 引用值(@5.6.3) 作为间接值: | |
2334 | +@5.7.4.1 引用值(@5.5.4) 作为间接值: | |
2320 | 2335 | 由于左值(@5.5.1) 的项对象被环境所有(@5.7.3) ,在项上的求值需要其它项对象作为中间值。 |
2321 | -这种中间值通过间接引用左值以确保左值标识的对象可作为一等对象(@4.1) 使用,也是一种间接值,即引用值(@5.6.3) ,是引用(@4.2.3) 的实例。 | |
2322 | -NPL::TermReference(@5.6.3) 类型作为左值的引用的内部表示。 | |
2323 | -这类似 ISO C++ 的对象类型的左值引用和右值引用的差异。消亡值(@5.5.1) 使用内部的 TermTags::Unique 标签(@5.4.2.2) 标记。 | |
2324 | -基于引用的左值到右值转换(@5.5.4) 可通过 NPL::ReferenceTerm(@6.4.4) 实现。 | |
2336 | +这种中间值通过间接引用左值以确保左值标识的对象可作为一等对象(@4.1) 使用,也是一种间接值,即引用值(@5.5.4) ,是引用(@4.2.3) 的实例。 | |
2337 | +NPL::TermReference(@5.6.3) 类型是可能需要区分引用与被引用对象的值的内部表示。 | |
2338 | +这类似宿主语言的对象类型的左值引用和右值引用的差异(@5.5.4) 。 | |
2339 | +消亡值(@5.5.1) 以作为其表示的引用项(@5.5.4) 内部的 TermTags::Unique 标签(@5.4.2.2) 标记,即唯一引用。 | |
2340 | +基于引用的左值到右值转换(@5.5.5) 可通过 NPL::ReferenceTerm(@6.4.4) 实现。 | |
2325 | 2341 | 和宿主语言的涉及成员访问的表达式类似,直接使用标识符进行名称查找(@4.3.3) 得到的表达式是左值或消亡值。在此环境总是被视为左值,所以结果由环境中的对象类型确定:当且仅当对象是左值时,结果是左值引用;否则是右值引用。 |
2326 | 2342 | 和宿主语言类似,右值引用类型的表达式可作为左值使用。 |
2327 | 2343 | 一般地,并非所有对象需要引用,详见 @4.2.3 。 |
@@ -2332,21 +2348,21 @@ | ||
2332 | 2348 | 否则,引入的间接值引用环境所有的对象。 |
2333 | 2349 | 应注意存储环境以外的间接值时,不超出持有对象的存储期,避免未定义行为(@5.2.4) 。当前实现不对此附加检查。 |
2334 | 2350 | 注意不求值而仅替换项时,使用 NPL::LiftOther 或 NPL::LiftTerm(@6.6.1) ,这不引入间接值。 |
2335 | -除构造间接值的例程(@6.6) ,当前不直接引入引用持有者。如需要引入间接值,使用引用值(@5.6.3) 而不是其它间接值,以统一处理无法直接持有的列表项和非列表项的引用。 | |
2351 | +除构造间接值的例程(@6.6) ,当前不直接引入引用持有者。如需要引入间接值,使用引用值(@5.5.4) 而不是其它间接值,以统一处理无法直接持有的列表项和非列表项的引用。 | |
2336 | 2352 | |
2337 | 2353 | @5.7.4.3 间接值的消除: |
2338 | 2354 | 访问间接值涉及维护内存安全保证(@5.2.4.3) 时,可能需要提升项(@6.6) 以移除允许非内存安全(@5.2.4.3.1) 访问的间接值。 |
2339 | 2355 | 引用值作为间接值可被消除(@5.6.3.3) 。 |
2340 | 2356 | 用于按值传递参数时,一般使用 NPL::LiftTerm(@6.6.2) 和确保创建值副本的 NPL::SetContentWith(@6.2.1) 实现;前者取非引用类型的右值(@5.5.1) ,后者提升间接值确保结果不是中间值。 |
2341 | -用于按值传递返回值时(@4.5.3.1) ,除显式分别对是否为引用值的情形进行处理,可使用 NPL::LiftToReturn(@6.6.3)(其中也使用以上方式实现),实现临时对象实质化转换(@5.5.4) ,详见 @5.7.4.4 。 | |
2342 | - | |
2343 | -@5.7.4.4 返回值转换(@5.5.4.2) : | |
2344 | -作为提升项的使用用例(@5.7.4.3) ,在返回值转换上下文(@5.5.5.2) 中确定函数返回值的实质化转换上下文(@5.5.5.1) 的部分操作消除引用值(@5.6.3.3) ,即返回值转换。 | |
2357 | +用于按值传递返回值时(@4.5.3.1) ,除显式分别对是否为引用值的情形进行处理,可使用 NPL::LiftToReturn(@6.6.3)(其中也使用以上方式实现),实现临时对象实质化转换(@5.5.5) ,详见 @5.7.4.4 。 | |
2358 | + | |
2359 | +@5.7.4.4 返回值转换(@5.5.5.2) : | |
2360 | +作为提升项的使用用例(@5.7.4.3) ,在返回值转换上下文(@5.5.6.2) 中确定函数返回值的实质化转换上下文(@5.5.6.1) 的部分操作消除引用值(@5.6.3.3) ,即返回值转换。 | |
2345 | 2361 | 这可约束作为间接值的引用值不逃逸(escape)(即使用被引用对象的值时不超出指向对象的生存期),而保证只考虑项的值数据成员(@5.4.2) 可能是引用值时的内存安全。 |
2346 | 2362 | 返回值转换不保证未折叠的引用值在消除引用值后的结果不逃逸。为确保内存安全,程序仍需要保证被引用的对象的间接引用的对象生存期结束后,不能访问间接引用的对象。 |
2347 | 2363 | 除非证明不需要临时对象(当前未实现),返回值转换中初始化临时对象作为返回值的项对象(@5.7.3) 。 |
2348 | -是否需要返回值转换由实质化转换上下文中的被调用的函数而非上下文是否需要使用右值决定,无关被转换的表达式是否是左值,因此返回值转换不是左值到右值转换(@5.5.4) 。 | |
2349 | -不论是否存在返回值转换,返回值的项对象来自返回的右值关联的临时对象实质化转换(@5.5.5) 。这可能在 NPL::LiftToReturn 或之前的求值规约的调用中蕴含。 | |
2364 | +是否需要返回值转换由实质化转换上下文中的被调用的函数而非上下文是否需要使用右值决定,无关被转换的表达式是否是左值,因此返回值转换不是左值到右值转换(@5.5.5) 。 | |
2365 | +不论是否存在返回值转换,返回值的项对象来自返回的右值关联的临时对象实质化转换(@5.5.6) 。这可能在 NPL::LiftToReturn 或之前的求值规约的调用中蕴含。 | |
2350 | 2366 | |
2351 | 2367 | @5.7.5 被归约项稳定性: |
2352 | 2368 | 基于 TermNode 的性质,未被规约修改的项的子项的迭代器、指针和引用保持稳定(@5.4.2) 。 |
@@ -2364,7 +2380,7 @@ | ||
2364 | 2380 | 在无法预知子项是否需要被进一步使用而不会在被调用前另行存储包含这些资源的项时,实现使用的操作应避免删除这里的子项(对实现 WHNF 而言即第一个子项),以免无法使用其中的状态。 |
2365 | 2381 | |
2366 | 2382 | @5.7.5.2 临时对象资源: |
2367 | -表示临时对象的项的子项的迭代器、指针和引用应保持稳定,以支持子项被绑定到对象语言中的引用值(@5.6.3) 。 | |
2383 | +表示临时对象的项的子项的迭代器、指针和引用应保持稳定,以支持子项被绑定到对象语言中的引用值(@5.5.4) 。 | |
2368 | 2384 | 表示临时对象的项自身不需被绑定到引用值,不保证稳定,可被直接存储为 TermNode(而不需要保存为指针等间接值)。 |
2369 | 2385 | 对临时对象分配资源可能转移表示临时对象的项,但不影响其子项的稳定性。 |
2370 | 2386 |
@@ -2601,7 +2617,8 @@ | ||
2601 | 2617 | |
2602 | 2618 | @5.11.1.1 附加规则: |
2603 | 2619 | 当前仅支持标识符(@3.3.1) 作为名称。 |
2604 | -含有“$$”的名称保留给宿主交互使用;含有“__”的名称保留给 NPLA1 实现。 | |
2620 | +部分名称是保留名称(reserved name) :含有“$$”的名称保留给宿主交互使用;含有“__”的名称保留给 NPLA1 实现。 | |
2621 | +若程序的源代码中的保留名称被作为变量名解析,程序的行为未定义。 | |
2605 | 2622 | 在 NPLA 规则(@5.2) 的基础上,具有以下情形的程序引起未定义行为: |
2606 | 2623 | 显式使用保留给实现的标识符。 |
2607 | 2624 |
@@ -2739,7 +2756,7 @@ | ||
2739 | 2756 | NPL::IsBoundLValueTerm |
2740 | 2757 | NPL::IsUncollapsedTerm |
2741 | 2758 | NPL::IsUniqueTerm |
2742 | -NPL::ResolveTerm 解析并间接引用处理可能是引用值(@5.6.3) 的项,其中尝试解析使用 NPL::TryAccessLeaf 。 | |
2759 | +NPL::ResolveTerm 解析并间接引用处理可能是引用值(@5.5.4) 的项,其中尝试解析使用 NPL::TryAccessLeaf 。 | |
2743 | 2760 | NPL::CheckRegular 指定函数访问检查项后的指定类型正规值(@5.9) ,即按模板参数指定的类型访问解析后的正规值。 |
2744 | 2761 | NPL::AccessRegular |
2745 | 2762 | NPL::ResolveRegular |
@@ -2805,7 +2822,7 @@ | ||
2805 | 2822 | 规约实现作用在对象语言表达式上通用的求值算法(evaluaton algorithm) ,符合规约性质(@5.5) 。 |
2806 | 2823 | 主规约函数是提供这种单一规约函数实现的直接规约函数(@6.5.3.1) 。 |
2807 | 2824 | 间接值(@5.7.2) 对主规约函数透明,不被直接处理。 |
2808 | -推论:主规约函数实现的求值算法中,被求值的表达式不发生值类别转换(@5.5.4) 。这简化实现的复杂性,并允许派生实现单独处理需要间接值(如引用值)的情形,并在其它情形避免不需要的开销。 | |
2825 | +推论:主规约函数实现的求值算法中,被求值的表达式不发生值类别转换(@5.5.5) 。这简化实现的复杂性,并允许派生实现单独处理需要间接值(如引用值)的情形,并在其它情形避免不需要的开销。 | |
2809 | 2826 | |
2810 | 2827 | @6.6 提升项: |
2811 | 2828 | 对项的提升(lifting) 指一类对项的替换变换,使用项进行一定的变换后取代其它项或其一部分,并满足下述提升条件。 |
@@ -2834,7 +2851,7 @@ | ||
2834 | 2851 | 以下值操作可能引入间接值: |
2835 | 2852 | 函数 NPL::LiftCollapsed |
2836 | 2853 | 函数 NPL::MoveCollapsed |
2837 | -函数 NPL::LiftTermRef 提升项引用:提升项的内容为参数指定的项或值的引用值(@5.6.3) 。 | |
2854 | +函数 NPL::LiftTermRef 提升项引用:提升项的内容为参数指定的项或值的引用值(@5.5.4) 。 | |
2838 | 2855 | 引用值通过参数指定的值对象(@5.4.2) 上创建得到。 |
2839 | 2856 | 函数 NPL::LiftToReference 提升项对象为引用。 |
2840 | 2857 | 若项对象表示引用值则提升项,否则对 ValueObject 进行基于所有权的生存期检查并取引用这个项的引用值。 |
@@ -2847,9 +2864,9 @@ | ||
2847 | 2864 | 函数 NPL::MoveRValueToReturn |
2848 | 2865 | 函数 NPL::MoveRValueToForward |
2849 | 2866 | 函数 NPL::LiftSubtermsToReturn |
2850 | -本节的函数作用在被规约项时,对引用值的操作实现临时对象实质化转换(@5.5.4) 所在的求值规约的最后部分的操作,一般在尾上下文(@4.4.7) 中进行处理。 | |
2867 | +本节的函数作用在被规约项时,对引用值的操作实现临时对象实质化转换(@5.5.5) 所在的求值规约的最后部分的操作,一般在尾上下文(@4.4.7) 中进行处理。 | |
2851 | 2868 | 提升消除中间值只作用在被提升项,不作用在子项。需要递归复制的操作不在这里提供,以避免抽象泄漏。 |
2852 | -为消除中间值需要进行复制消除(@5.5.5.3) ,其中使用不同的可转移条件(@5.6.3.4) 决定使用转移而非复制。 | |
2869 | +为消除中间值需要进行复制消除(@5.5.6.3) ,其中使用不同的可转移条件(@5.6.3.4) 决定使用转移而非复制。 | |
2853 | 2870 | 当前实现在转移项时使用的宿主转移操作总是使用宿主对象的转移(基于 NPL::SetContentWith(@6.2.1) )而不是 TermNode 的转移。 |
2854 | 2871 | 另见 @5.7.4.3 。 |
2855 | 2872 |
@@ -2988,7 +3005,7 @@ | ||
2988 | 3005 | 因为绑定参数引入附加的函数调用,一般仅在有必要时使用。 |
2989 | 3006 | |
2990 | 3007 | @6.9.5 环境、绑定访问和解析操作: |
2991 | -基于环境的名称解析(@4.3.3) 操作可选地处理保留名称(reserved name) 并查找名称(@4.3.3) 。 | |
3008 | +基于环境的名称解析(@4.3.3) 操作可选地处理保留名称(@5.11.1.1) 并查找名称(@4.3.3) 。 | |
2992 | 3009 | 解析环境只支持要求作为一等对象(@4.1) 的环境引用(@5.4.3) 。 |
2993 | 3010 | 以下 API 提供解析名称相关的操作: |
2994 | 3011 | 函数模板 NPL::EmplaceLeaf |
@@ -3048,9 +3065,9 @@ | ||
3048 | 3065 | @7.1.3 NPLA1 间接值使用规则: |
3049 | 3066 | 基本规则参见 @5.7.4 。 |
3050 | 3067 | 除非另行指定,不在求值引入右值引用(@5.7.4.1) 。 |
3051 | -特别地,A1::EvaluateIdentifier(@7.6.4) 保证对应表达式求值的结果是左值引用。这使之实现求值符号(@5.2) 时的结果是左值(@5.5.1) 而不立即引入左值到右值转换(@5.5.4) 及复制对象,和宿主语言的行为类似。 | |
3068 | +特别地,A1::EvaluateIdentifier(@7.6.4) 保证对应表达式求值的结果是左值引用。这使之实现求值符号(@5.2) 时的结果是左值(@5.5.1) 而不立即引入左值到右值转换(@5.5.5) 及复制对象,和宿主语言的行为类似。 | |
3052 | 3069 | 作为替代,可通过 NPLA API(如 NPL::IsBoundLValueTerm(@6.4.5) )间接判断绑定的对象的是否为右值引用。 |
3053 | -引入绑定的 API(@7.7.4) 可引入引用值(@5.6.3) 。已有的引用值的引用总是左值引用,否则是右值引用。 | |
3070 | +引入绑定的 API(@7.7.4) 可引入引用值(@5.5.4) 。已有的引用值的引用总是左值引用,否则是右值引用。 | |
3054 | 3071 | |
3055 | 3072 | @7.1.4 NPLA1 规约内存安全保证(@5.2.4.3) 机制: |
3056 | 3073 | 在 @5.7 的基础上,NPLA1 规约附加以下约定以维护内存安全。 |
@@ -3338,7 +3355,7 @@ | ||
3338 | 3355 | @7.6.4.1 规约合并项: |
3339 | 3356 | 规约合并项是具有子项的枝节点(@5.4.2.1) ,满足 IsBranchedList(@6.2.1)(类似 @7.6.1.3 );或符合 @5.9.4.2 的非平凡非正规表示。 |
3340 | 3357 | 这些条件可使用 A1::IsCombiningTerm 判断。 |
3341 | -作为被规约项,规约合并项的第一个子项应能规约到 A1::FormContextHandler(@7.6.1.1) 的值或引用 A1::FormContextHandler 对象的引用值(@5.6.3) 。 | |
3358 | +作为被规约项,规约合并项的第一个子项应能规约到 A1::FormContextHandler(@7.6.1.1) 的值或引用 A1::FormContextHandler 对象的引用值(@5.5.4) 。 | |
3342 | 3359 | |
3343 | 3360 | @7.6.4.2 规约合并求值: |
3344 | 3361 | 函数 A1::ReduceCombined 对规约合并项(@7.6.4.1) 以已规约的第一个子项为上下文处理器(@7.6.1) 并返回调用结果,以节约严格性分析(@4.4.4.2) 开销;并根据处理器返回的规约结果进行正规化操作。 |
@@ -3346,7 +3363,7 @@ | ||
3346 | 3363 | 若存在 A1::ContextHandler 对象的子对象引用(@5.6.3.5) ,先变换子对象引用。这些子对象引用应符合 @5.9.4 约定的表示,否则断言检查失败。 |
3347 | 3364 | 以上变换中,若子对象引用持有的值不具有 A1::ContextHandler 类型,则抛出异常。 |
3348 | 3365 | 之后,设置或清空被规约项的 TermTags::Temporary(@5.4.2.2) 位分别表示函数右值和函数左值。被调用的处理器必要时可利用这个标签位作为提示进行优化。 |
3349 | -因为被规约项总是非引用项(@5.6.3) ,和 @7.1.2 的其它用法(由 A1::EvaluateIdentifier(@7.6.4) 保证求值结果是引用项)不冲突。(同时,尽管只在管理规约(@4.4) 而不在对象语言的表达式中出现,这仍符合引用值(@5.6.3) 的语义;这实际上是复用 TermTags::Temporary 的主要理由。) | |
3366 | +因为被规约项总是非引用项(@5.6.3) ,和 @7.1.2 的其它用法(由 A1::EvaluateIdentifier(@7.6.4) 保证求值结果是引用项)不冲突。(同时,尽管只在管理规约(@4.4) 而不在对象语言的表达式中出现,这仍符合引用值(@5.5.4) 的语义;这实际上是复用 TermTags::Temporary 的主要理由。) | |
3350 | 3367 | 若存在调用,且不是(表示左值的)引用的情形,则先从第一个子项转移 A1::ContextHandler 对象,以维护生存期。 |
3351 | 3368 | 规约结果最终通过调用 NPL::RegularizeTerm(@6.5.2) 按纯值规约正规化(@5.9.2) 。 |
3352 | 3369 | 调用上下文传递时不清理(@5.8.2.1) 参数,即处理器中的第一个子项是已被清理的项,可被实现使用。 |
@@ -3393,7 +3410,7 @@ | ||
3393 | 3410 | 间接调用 A1::RelayForCall 的求值规约操作包括通过过程抽象(@8.4.5) 中的函数引入合并子的调用。 |
3394 | 3411 | 求值规约操作附带绑定操作匹配被绑定的操作数树(@4.4.3.1) 。 |
3395 | 3412 | 求值规约操作中可能具有提升操作(@7.1.4) 。 |
3396 | -忽略提升操作可允许对象语言的函数调用返回(@4.5.3.1) 引用值(@5.6.3) 。 | |
3413 | +忽略提升操作可允许对象语言的函数调用返回(@4.5.3.1) 引用值(@5.5.4) 。 | |
3397 | 3414 | |
3398 | 3415 | @7.7.2.1 求值规约提升项: |
3399 | 3416 | 关于提升项的基本用例,参见 @5.7.4.3 。 |
@@ -3411,7 +3428,7 @@ | ||
3411 | 3428 | 绑定操作初始化的变量的名称和值分别由形式参数树和操作数树决定。 |
3412 | 3429 | 绑定操作匹配待绑定的形式参数和操作数或它们的子项。 |
3413 | 3430 | 成功的匹配决定形式参数对应的操作数或其子项,作为其实际参数(@4.5.3) 。这种对应关系是单射但不一定是满射,即匹配成功后,每个参数总存在对应的操作数或其子项,而操作数和子项允许不对应形式参数而被忽略。 |
3414 | -NPLA 操作数树的叶节点为符号(@5.6.1) 或其引用值(@5.6.3) 。 | |
3431 | +NPLA 操作数树的叶节点为符号(@5.6.1) 或其引用值(@5.5.4) 。 | |
3415 | 3432 | 被绑定的项的操作数是待匹配的项的子项(而不会是此项自身,满足 @6.5.3 )。 |
3416 | 3433 | 被绑定的参数可以作为函数的形式参数(@4.5.2) ,也可以其它初始化变量的语法构造的基础。 |
3417 | 3434 | 和 Kernel 类似,形式参数树是 DAG ,但通过真列表(@5.4.2.1) 的性质蕴含而不需要另行限制。形式参数树中的节点在匹配时被视为右值。 |
@@ -3425,7 +3442,7 @@ | ||
3425 | 3442 | 若形式参数可能由求值得到,需在匹配前另行处理。 |
3426 | 3443 | |
3427 | 3444 | @7.7.3.2 绑定临时对象标签: |
3428 | -绑定临时对象时设置对象上的 TermTags::Temporary 标签(@5.4.2.2) ,以实现区分通过引用绑定延长生存期的临时对象和非引用绑定的对象(@5.5.5.3) 。 | |
3445 | +绑定临时对象时设置对象上的 TermTags::Temporary 标签(@5.4.2.2) ,以实现区分通过引用绑定延长生存期的临时对象和非引用绑定的对象(@5.5.6.3) 。 | |
3429 | 3446 | 一般地,表达式中的纯右值(非引用值)被绑定为临时对象,被绑定的对象在初始化后具有 TermTags::Temporary 。 |
3430 | 3447 | 这对应宿主语言中的转发引用(forwarding reference) 参数中的情形: |
3431 | 3448 | 若模板参数 P 对应转发引用函数参数 P&& ,其中 P 是右值引用类型,保留从实际参数推断但不是实际参数类型的信息; |
@@ -3465,7 +3482,7 @@ | ||
3465 | 3482 | 被绑定对象(引用值)的标签由操作数的(引用值)的标签决定: |
3466 | 3483 | 当有标记字符 & 时,被绑定对象(引用值)中包含绑定临时对象标签(@7.7.3.2) ,当且仅当引用值的标签包含 TermTags::Unique 。 |
3467 | 3484 | 否则,被绑定对象的标签和引用值的标签相同。 |
3468 | - 否则,若操作数标签(@7.7.3.5) 指定可修改的唯一值或有标记字符 % 时的唯一值,操作数是可转移的非引用值,被绑定的对象是临时对象。 | |
3485 | + 否则,若操作数标签(@7.7.3.5) 指定可修改的唯一引用或有标记字符 % 时的唯一引用,操作数是可转移的非引用值,被绑定的对象是临时对象。 | |
3469 | 3486 | 否则,当有标记字符 & 时,被绑定对象是操作数的引用值。 |
3470 | 3487 | 否则,被绑定对象是复制自操作数的值。 |
3471 | 3488 | 否则,被绑定的是操作数的引用: |
@@ -3475,7 +3492,7 @@ | ||
3475 | 3492 | 绑定的默认行为对引用值特殊处理,是为了满足 G1b(@1.4.5.1) ,而不是像某些语言(如 ISO C 和 [Rust] )仅通过内建的机制提供特定左值上下文(lvalue context) 。 |
3476 | 3493 | 绑定的默认行为不使用析构性转移(@5.5.3) 的操作(类似 [Rust] 的设计),原因是考虑到绑定的副作用影响操作数(即便因为对象被销毁而不一定是修改操作)和破坏幂等性(@4.1) (特别是指定过程调用的形式参数时,参见 @8.4.5 )违反易预测性原则(@1.4.5.2) 。 |
3477 | 3494 | 当前暂时不支持修改被绑定操作数。使用标记字符而修改操作数的绑定可能在未来支持。 |
3478 | -具有引用标记字符的形式参数支持引入引用值并支持绑定引入临时对象的实际参数(@5.5.5) 。 | |
3495 | +具有引用标记字符的形式参数支持引入引用值并支持绑定引入临时对象的实际参数(@5.5.6) 。 | |
3479 | 3496 | 绑定临时对象时可能设置被绑定对象上的 TermTags::Temporary 标签(@7.7.3.2) 。 |
3480 | 3497 | |
3481 | 3498 | @7.7.3.5 递归绑定: |
@@ -3506,7 +3523,7 @@ | ||
3506 | 3523 | 实现引入绑定的绑定操作(@7.7.3) 的 API 包括: |
3507 | 3524 | 函数 A1::MatchParameter 匹配操作数树(@7.7.3) 。 |
3508 | 3525 | 函数 A1::BindParameter 匹配并绑定操作数到参数上。 |
3509 | -为允许调用宿主对象的转移构造函数,绑定操作(@7.7.3) 仅在特定的上下文中使用复制消除(@5.5.5.3) 。(实际上,初始化引用之外的参数创建也不是 ISO C++17 约定要求消除复制的上下文。) | |
3526 | +为允许调用宿主对象的转移构造函数,绑定操作(@7.7.3) 仅在特定的上下文中使用复制消除(@5.5.6.3) 。(实际上,初始化引用之外的参数创建也不是 ISO C++17 约定要求消除复制的上下文。) | |
3510 | 3527 | 对实际参数,检查尾部参数是否为省略(@7.7.3.3) 后,匹配前判断是否为 TermNode 以支持引用(@5.7.4.3) 。 |
3511 | 3528 | 绑定尾部参数列表时,若对应的操作数是右值,直接转移子项,使用复制消除。 |
3512 | 3529 | 一般地,对操作数树的递归操作应在分配资源失败时,引起(可能派生)std::bad_alloc 的宿主异常而非宿主语言的未定义行为(@5.2.2) 。 |
@@ -3583,8 +3600,8 @@ | ||
3583 | 3600 | 关于 () 的求值规则避免这种简洁有用的语法导致语法错误(syntax error) 。而和 Kernel 不同的函数合并求值规则使这个设计和函数求值字面上没有直接的关联,避免了 Kernel 中为什么 () 不是词法上类似的如 (f x) 这样的表达式的特例的问题。 |
3584 | 3601 | 注意以 () 作为前缀并不要求要求特定函数的子类型而可能破坏子类型封装性的假设。 |
3585 | 3602 | 关于区分函数类型的替代设计(使用前缀 $ )的一个例子,参见 https://eighty-twenty.org/2011/09/29/fexprs-remain-inscrutable#comment-422279775 。 |
3586 | -由 @7.1.3 和 A1::REPLContext 配置的求值遍,NPLA1 规范求值算法不对引用值(@5.6.3) 特别处理。 | |
3587 | -因此,引用值在此作为一等对象(@4.1) ,作为表达式时不发生左值到右值转换(@5.5.4) 。 | |
3603 | +由 @7.1.3 和 A1::REPLContext 配置的求值遍,NPLA1 规范求值算法不对引用值(@5.5.4) 特别处理。 | |
3604 | +因此,引用值在此作为一等对象(@4.1) ,作为表达式时不发生左值到右值转换(@5.5.5) 。 | |
3588 | 3605 | 符号(@5.6.1) 作为名称表达式(@4.5.1) ,经名称解析(@4.3.3) 求值为左值(@5.5.1) 引用值。 |
3589 | 3606 | 这允结果保留(@8.1.2) 被求值表达式中的引用值,同时避免实现需要分别检查列表和作为符号求值结果的引用值类型的开销。 |
3590 | 3607 | 求值符号的实现参见 A1::EvaluateIdentifier(@7.6.4) 。 |
@@ -3656,7 +3673,7 @@ | ||
3656 | 3673 | 排除本机函数(@5.2.1) ,合并子中的求值都通过 A1::RelayForEval(直接求值)或 A1::RelayForCall(合并子调用)实现,转移子项保存临时对象不晚于 A1::RelayForCall(@7.7.2) 的调用。 |
3657 | 3674 | 宿主语言直接实现的本机函数通常仍使用同步规约以避免转移子项等操作的复杂性;若使用异步规约,也需要保证子项的生存期以满足上述要求。 |
3658 | 3675 | 实现需自行决定是否使用内部存储保存临时对象以及需要保存临时对象的内部存储的位置。若需支持异步规约,不能使用宿主语言的自动对象。 |
3659 | -一般地,因为 TermTags::Temporary(@5.4.2.2) 允许原地标记被绑定的临时对象而非引用其它存储(@5.5.5.3) ,不需要对被绑定的操作数临时对象特别处理。 | |
3676 | +一般地,因为 TermTags::Temporary(@5.4.2.2) 允许原地标记被绑定的临时对象而非引用其它存储(@5.5.6.3) ,不需要对被绑定的操作数临时对象特别处理。 | |
3660 | 3677 | 当前不提供 API 辅助实现本机函数中的临时对象维护。 |
3661 | 3678 | 按 @5.7.6 ,本机实现可对表示临时对象的子项分别转移,但转移前不应有非内部对象(@4.2.4.1) 引用被转移的子项。 |
3662 | 3679 |
@@ -4113,7 +4130,7 @@ | ||
4113 | 4130 | 形式参数对象; |
4114 | 4131 | 上下文原型; |
4115 | 4132 | 捕获的静态环境; |
4116 | -作为过程实现的求值结构(evaluation structure) (对应表达式中可能被求值的函数体(@4.5.2) ); | |
4133 | +作为过程实现的求值结构(evaluation structure)(对应表达式中可能被求值的函数体(@4.5.2) ); | |
4117 | 4134 | 决定是否在调用后提升返回结果(@8.4.5.4) 的标记。 |
4118 | 4135 | 这些数据都是可被共享的。复制 vau 抽象的处理器对象共享这些数据。 |
4119 | 4136 | 其中,作为父环境(@5.4.3) 的静态环境以 NPL::EnvironmentReference 弱引用值保存,并附加 shared_ptr 实例以可选被 vau 抽象所有;其它数据都以 shared_ptr 的值保存,被 vau 抽象所有。 |
@@ -4140,8 +4157,8 @@ | ||
4140 | 4157 | 保存在静态环境以外的对象的引用不受到以上机制保护,需要对形式参数对象可包含的对象进行限制以保证被规约项的所有权要求(@5.7.3) 。 |
4141 | 4158 | 因此,vau 抽象初始化时对形式参数对象检查,确保其中的非列表项中只存在调用 NPL::LiftTermRef 后也不引入间接值的对象的值,即记号值(@5.6.1) 。 |
4142 | 4159 | 恢复被切换的环境(@6.9.5) 时,环境内的对象被释放。 |
4143 | -若需保证内存安全(@5.2.4.3),返回值(@4.5.3.1) 不能是在调用后生存期结束的对象的引用值(@5.6.3) ,以避免引用被释放或之后被正规化(@5.9.2) 清理的值引入未定义行为。 | |
4144 | -避免返回(@4.5.3.1) 引用值(@5.6.3) 的通用机制为提升返回结果,即求值后的求值结果(@5.8.1) 进行进行返回值转换(@5.7.4.4) ,同时消除引用值(@7.1.4) ,使返回值总是按值传递。 | |
4160 | +若需保证内存安全(@5.2.4.3),返回值(@4.5.3.1) 不能是在调用后生存期结束的对象的引用值(@5.5.4) ,以避免引用被释放或之后被正规化(@5.9.2) 清理的值引入未定义行为。 | |
4161 | +避免返回(@4.5.3.1) 引用值(@5.5.4) 的通用机制为提升返回结果,即求值后的求值结果(@5.8.1) 进行进行返回值转换(@5.7.4.4) ,同时消除引用值(@7.1.4) ,使返回值总是按值传递。 | |
4145 | 4162 | |
4146 | 4163 | @8.4.5.5 相等性: |
4147 | 4164 | 相等性作为弱函数应用规约等价谓词(@4.5.3.2) 提供,操作为对所有成员进行相等比较,当且仅当都相当时,结果为真。 |
@@ -4157,7 +4174,7 @@ | ||
4157 | 4174 | |
4158 | 4175 | @8.4.7 错误检查: |
4159 | 4176 | Forms 提供以下可能抛出异常的错误检查函数: |
4160 | -Forms::CheckEnvironment | |
4177 | +Forms::CheckEnvironment | |
4161 | 4178 | Forms::CheckListReference |
4162 | 4179 | |
4163 | 4180 | @8.4.8 封装类型操作: |
@@ -4198,7 +4215,7 @@ | ||
4198 | 4215 | A1::ReduceToLoadExternal |
4199 | 4216 | A1::RelayToLoadExternal |
4200 | 4217 | |
4201 | -@8.5.2 对象语言加载 API | |
4218 | +@8.5.2 对象语言加载 API | |
4202 | 4219 | 函数 Forms::LoadGroundContext 提供 SHBuild 初始 REPL 环境(包含的上下文称为基础上下文(ground context) ),其中支持: |
4203 | 4220 | 字面量初始化,支持 #t 、#f 和整数等字面量; |
4204 | 4221 | 使用 A1::SeparatorTransformer(@7.5.2) 启用预处理的分号和逗号转换,分别为有序和无序列表求值的语法糖。 |
@@ -4333,7 +4350,7 @@ | ||
4333 | 4350 | #false :同 #f 。 |
4334 | 4351 | #inert :类似 Kernel 的 #inert 字面量,宿主值为 ValueToken::Unspecified(@7.2.2) 而不具有单独的类型(因此也不需要定义 inert? 谓词)。 |
4335 | 4352 | 另见 @10.5.1 。 |
4336 | -NPLA1 字面量都是纯右值(@5.5.1) ,但总是允许实质化转换(@5.5.4) 为消亡值并引入可互操作的临时对象(@5.5.5.3) 。 | |
4353 | +NPLA1 字面量都是纯右值(@5.5.1) ,但总是允许实质化转换(@5.5.5) 为消亡值并引入可互操作的临时对象(@5.5.6.3) 。 | |
4337 | 4354 | 这和宿主语言的字符串字面量是左值不同。当前 NPLA1 对象语言不提供能引起互操作差异的接口(字符串字面量不被修改),以后可能改变。 |
4338 | 4355 | |
4339 | 4356 | @9.3.2 函数合并(@4.5.3) : |
@@ -4417,7 +4434,7 @@ | ||
4417 | 4434 | 函数操作的语义可单独指定检查,具体形式由具体操作指定。 |
4418 | 4435 | |
4419 | 4436 | @9.4.3.4.1 类型检查: |
4420 | -基于 @5.5.6 ,对应对象语言表达式的表示实体的元素可用于表示操作中的名义(nominal) 类型检查。 | |
4437 | +基于 @5.5.7 ,对应对象语言表达式的表示实体的元素可用于表示操作中的名义(nominal) 类型检查。 | |
4421 | 4438 | 类型检查包括: |
4422 | 4439 | 对求值得到的操作数(@9.2.2.2) ,若操作的语义需要,则总是进行类型检查; |
4423 | 4440 | 根据特定对象状态指定动态类型的检查; |
@@ -4543,7 +4560,7 @@ | ||
4543 | 4560 | 部分语义不需要通过求值(@4.1) 体现。 |
4544 | 4561 | |
4545 | 4562 | @9.5.1 值类别和类型: |
4546 | -基本内容参见 @5.5.1 和 @5.5.6 。 | |
4563 | +基本内容参见 @5.5.1 和 @5.5.7 。 | |
4547 | 4564 | 特定的表达式维护可修改性(@9.4.5.1) 。这类似宿主语言的 const 类型限定,但只适合左值(@5.5.1) 且仅使用隐式类型。 |
4548 | 4565 | |
4549 | 4566 | @9.5.2 绑定构造(binding construct) : |
@@ -4577,7 +4594,7 @@ | ||
4577 | 4594 | NPLA1 基于 NPLA 项的引用(@5.6.3) 支持实体的左值引用(@5.7.4.1) ,和 Kernel 等的引用概念类似。 |
4578 | 4595 | NPLA1 语义中对广义实体(@2.3.2) 的构成依赖的使用也被称为引用,这不限被对象语言中的引用值表达。 |
4579 | 4596 | 和 Kernel 不同,NPLA1 明确允许不通过对象的引用保存对象(参见 @9.6.2 ),但是也允许使用对象引用;即对象和对象的引用都是一等对象(@4.1) 。详见 @4.2 。这也允许子对象直接被所在的对象蕴含。 |
4580 | -使用项引用(宿主类型为 NPL::TermReference )表示(使用 TermNode 表示的)其它对象的引用,即引用值(@5.6.3) 。 | |
4597 | +使用项引用(宿主类型为 NPL::TermReference )表示(使用 TermNode 表示的)其它对象的引用,即引用值(@5.5.4) 。 | |
4581 | 4598 | 按 NPL::TermReference 初始化时保存的引用来源可区分被引用的对象是否是左值。 |
4582 | 4599 | 左值(@5.5.1) 都通过引用值(参见 @5.7.4.1 ;另见 @4.1 和 @5.2.4 )表示。 |
4583 | 4600 | 引用值在创建时即引用在生存期内的对象。 |
@@ -4609,7 +4626,7 @@ | ||
4609 | 4626 | |
4610 | 4627 | @9.6.1.3 引用值作为实际参数: |
4611 | 4628 | 除非另行指定(如 @9.8.2 和 @10.4.2 ),一般地,函数接受左值引用操作数,使用引用的对象的值和直接使用右值作用相同,但不会修改被左值引用的对象。 |
4612 | -这等价隐含无副作用的左值到右值转换(@5.5.4) 。此处的左值引用和宿主语言中的(非 volatile )左值作用类似。 | |
4629 | +这等价隐含无副作用的左值到右值转换(@5.5.5) 。此处的左值引用和宿主语言中的(非 volatile )左值作用类似。 | |
4613 | 4630 | 另见 @9.8.4 。 |
4614 | 4631 | |
4615 | 4632 | @9.6.1.4 返回非引用值: |
@@ -4716,7 +4733,7 @@ | ||
4716 | 4733 | 若满足上述条件的函数不具有错误条件(@9.4.3.3) ,忽略因实现环境引发的错误(如宿主资源耗尽),视为(对象语言中的)全函数。 |
4717 | 4734 | |
4718 | 4735 | @9.7.1 函数值(@4.5.2) 约定: |
4719 | -除非另行指定,函数值不是引用值(@5.6.3) ,以便通过保证满足间接值生存期规则(@5.7.4) 维护内存安全(@5.2.4.3) 。 | |
4736 | +除非另行指定,函数值不是引用值(@5.5.4) ,以便通过保证满足间接值生存期规则(@5.7.4) 维护内存安全(@5.2.4.3) 。 | |
4720 | 4737 | 除非另行指定,函数值是经过返回值转换(@5.7.4.4) 的值,不保留引用值(@9.6.1.5) 。注意保留引用值时,函数值仍可能是非引用值。 |
4721 | 4738 | 除非另行指定,若函数值保留引用值,引用值被折叠。关于引用值是否被折叠的操作分类,详见 @9.9.1 。 |
4722 | 4739 |
@@ -4739,11 +4756,11 @@ | ||
4739 | 4756 | 在复制初始化形式参数和函数值时,部分函数保证被初始化的值和初值符(@5.5.2) 的值类别(@5.5.1) 和可修改性一致。这些初始化是转发(@5.5.2.2) 操作。 |
4740 | 4757 | |
4741 | 4758 | @9.8.1 传递非引用值参数: |
4742 | -一些函数的参数进行左值到右值转换(@5.5.4) ,实现参数的按值传递(@4.4.4.5) 。 | |
4759 | +一些函数的参数进行左值到右值转换(@5.5.5) ,实现参数的按值传递(@4.4.4.5) 。 | |
4743 | 4760 | 这类似宿主语言中直接使用对象类型的形式参数。 |
4744 | 4761 | |
4745 | 4762 | @9.8.2 函数参数转发: |
4746 | -一些函数的部分参数也可不进行左值到右值转换(@5.5.4) 。 | |
4763 | +一些函数的部分参数也可不进行左值到右值转换(@5.5.5) 。 | |
4747 | 4764 | 这些参数的转发类似绑定构造支持的参数转发(@9.5.2.2) 。 |
4748 | 4765 | 参数转发的实现可判断值类别(@9.5.2) 后分别对传递非引用值(@9.8.1) 或直接传递引用值提供实现,或直接使用绑定构造。前者支持本机实现。 |
4749 | 4766 |
@@ -4787,7 +4804,7 @@ | ||
4787 | 4804 | 为满足适用性(@1.4.5.2) ,同时考虑维护内存安全、避免误用和允许使用引用避免复制,这些操作需显式使用以 % 或 & 结尾的函数名称以得到特别关注。 |
4788 | 4805 | 对以求值 <body> 作为尾上下文的操作(@9.4.8.1),以 % 结尾表示 <body> 所在的函数返回时不要求返回非引用值(@9.6.1.4) ,尽管这些操作不返回引用值。 |
4789 | 4806 | 对其它提供不同引用标记字符的多个版本的操作: |
4790 | -以 % 结尾表示函数可使用不进行左值到右值转换(@5.5.4) 的折叠(@5.6.3.2) 的引用值参数,或可返回折叠的引用值; | |
4807 | +以 % 结尾表示函数可使用不进行左值到右值转换(@5.5.5) 的折叠(@5.6.3.2) 的引用值参数,或可返回折叠的引用值; | |
4791 | 4808 | 以 & 结尾表示函数使用不进行左值到右值转换的折叠的引用值参数,或返回折叠的引用值; |
4792 | 4809 | 以 @ 结尾表示函数使用不进行左值到右值转换的未折叠的引用值参数,或返回未折叠的引用值。 |
4793 | 4810 | 以上函数调用结果中的折叠的引用值对调用时引入的引用值有效。 |
@@ -4835,6 +4852,7 @@ | ||
4835 | 4852 | 作为核心语言特性时,这些环境对象可以不是一等环境(@9.6.2) ,但应能和一等环境在名称解析(@5.4.3) 中的作用一致:作为父环境(@5.4.3) 。 |
4836 | 4853 | NPLA1 实现提供的这种由实现初始化的作为核心语言特性的环境对象称为根环境(root environment) 。 |
4837 | 4854 | 和 Kernel 类似,NPLA1 实现提供基础环境(ground environment) 。 |
4855 | +基础环境应包含语言规范要求提供的所有绑定,且不包含名称除保留名称(@5.11.1.1) 外的绑定。 | |
4838 | 4856 | 基础环境是隐藏环境(@9.6.2.2) ,不被直接访问。 |
4839 | 4857 | 除非另行指定,根环境和作为库特性的一等环境对象初始化后被冻结(@9.6.2.4) 。 |
4840 | 4858 | 用户程序初始的当前环境(@5.4.4) 是一个包含基础环境作为直接或间接父环境的空环境(@4.6.1.1) 。 |
@@ -4973,7 +4991,7 @@ | ||
4973 | 4991 | (引入非容器对象的操作另见 @10.4.1.4 。) |
4974 | 4992 | 对构造器的转发操作以及部分修改操作区分是否存在引用标记字符结尾可强调一些非预期保留引用值的容易误用情形: |
4975 | 4993 | 尽管总是返回非引用值,转发参数保留的引用值不会被返回值转换(@9.6.1.4) 影响,在构造的容器对象作为非引用值返回仍会保留引用值(@9.6.1.5) 。 |
4976 | -(对应宿主语言中,可有更显著的差异,如构造器对应的 std::tuple 的 std::make_tuple 和 std::forward_as_tuple 。) | |
4994 | +(对应宿主语言中,可有更显著的差异,如构造器对应的 std::tuple 的 std::make_tuple 和 std::forward_as_tuple 。) | |
4977 | 4995 | 本节内的以下分类不相交,但部分分类中函数名不带有引用标记字符结尾的操作可能和 @10.4.2 中的操作相交。 |
4978 | 4996 | |
4979 | 4997 | @10.4.1.1 可能使结果包含引用值的容器构造器: |
@@ -5128,8 +5146,8 @@ | ||
5128 | 5146 | 派生实现可以通过提供不公开不安全操作(@10.1.2) 的根环境,但不符合此处的规格要求(@2.3.1.2) 。 |
5129 | 5147 | 若派生实现不提供第三类不安全操作(@10.1.2) ,可以简化部分 @10.5.4 中与之关联的操作的实现。 |
5130 | 5148 | 部分可选的 Kernel 合并子被直接提供。 |
5131 | -和 Kernel 不同,一些函数显式地操作引用值(@5.6.3) ,包括未折叠的引用值(@5.6.3) 。 | |
5132 | -和 Kernel 不同,求值算法不直接处理对象的引用值(@6.5.3.3) 。 | |
5149 | +和 Kernel 不同,一些函数显式地操作引用值(@5.5.4) ,包括未折叠的引用值(@5.5.4) 。 | |
5150 | +和 Kernel 不同,求值算法不直接处理对象的引用值(@6.5.3.3) 。 | |
5133 | 5151 | 为简化实现,部分提供 % 等后缀的函数(@10.4.1) 不被派生。 |
5134 | 5152 | 因为设计原因,不提供以下 Kernel 合并子对应的操作: |
5135 | 5153 | copy-es-immutable |
@@ -5208,7 +5226,7 @@ | ||
5208 | 5226 | uncollapsed? <object> :判断操作数是否为未折叠的引用值。 |
5209 | 5227 | bound-lvalue? <object> :判断操作数是否为被引用的被绑定对象左值。 |
5210 | 5228 | 绑定临时对象的引用类型的参数不被视为左值引用。 |
5211 | -配合 $resolve-identifier 和 % 引用标记(@7.7.3.4) 绑定的变量,可确定实际参数是否为左值。 | |
5229 | +配合 $resolve-identifier(@10.5.6) 和 % 引用标记(@7.7.3.4) 绑定的变量,可确定实际参数是否为左值。 | |
5212 | 5230 | 单独使用 bound-lvalue? 和 & 引用标记字符(@7.7.3.4) 绑定的变量,可确定实际参数是否为引用。 |
5213 | 5231 | unique? <object> :判断操作数是否为唯一引用(@5.4.2.2) 。 |
5214 | 5232 | deshare <object> :取指定对象取消共享的值。 |
@@ -5218,14 +5236,14 @@ | ||
5218 | 5236 | expire <object> :取指定对象的消亡值(@5.5.1) 。 |
5219 | 5237 | 同 id(@10.6.1) ,但当参数是引用值时,结果是和参数引用相同对象的唯一引用。 |
5220 | 5238 | 可用于显式地指定之后被转移的对象(参见 @9.4.5.1.2 ),而不需要直接转移参数,因此这个操作也不是修改操作(@9.4.5.1) ,函数名不以 ! 结尾(@9.9) 。 |
5221 | -这个函数类似宿主语言作用在对象类型实际参数的 std::move ,可能减少没有经过复制消除(@5.5.5.3) 的复制或转移(@5.5.2.3) 而改变使用这个函数的结果对象的副作用。 | |
5239 | +这个函数类似宿主语言作用在对象类型实际参数的 std::move ,可能减少没有经过复制消除(@5.5.6.3) 的复制或转移(@5.5.2.3) 而改变使用这个函数的结果对象的副作用。 | |
5222 | 5240 | 特别地,指定列表的引用值被转移时,不需要立即转移列表的每个元素,而允许之后通过绑定构造(@9.5.2) 等方式选择转移的子对象(@9.6) 。 |
5223 | 5241 | 可能包含立即转移的操作如 forward!(@10.6.1) 。 |
5224 | -move! <object> :转移项。 | |
5225 | -若对象是不可修改的左值,则以复制代替转移;否则,直接转移对象的项(@5.5.3) 。 | |
5242 | +move! <object> :转移对象。 | |
5243 | +若参数是不可修改的左值,则以复制代替转移;否则,直接转移表示参数对象的项(@5.5.3) 。 | |
5226 | 5244 | 结果是不经返回值转换的项。 |
5227 | 5245 | 被转移对象后的项满足 @5.2.4.2 。 |
5228 | -当前实现中项被转移后,表示的值为 () 。这和返回值转换(@5.7.4.4) 等引入实质化临时对象时可能具有的转移(@5.5.5) 的效果(仅在互操作时可见)不保证相同。 | |
5246 | +当前实现中项被转移后,表示的值为 () 。这和返回值转换(@5.7.4.4) 等引入实质化临时对象时可能具有的转移(@5.5.6) 的效果(仅在互操作时可见)不保证相同。 | |
5229 | 5247 | transfer! <object> :转移对象。 |
5230 | 5248 | 同 move! ,但使用对象的转移(@5.5.2.3) ,而不是项的转移(@5.5.3) ,避免宿主对象转移消除而允许调用宿主对象的转移构造函数(@5.5.3.1) 。 |
5231 | 5249 | 项被转移后,和返回值转换等引入实质化临时对象时可能具有的转移的效果(仅在互操作时可见)相同。 |
@@ -5366,7 +5384,7 @@ | ||
5366 | 5384 | 考虑通常引用操作对符号类型未被求值的左值操作数使用,保留引用值没有意义,因此不提供对应保留引用值的操作。 |
5367 | 5385 | 这个函数的使用在实现中受限制,参见 @10.2 。 |
5368 | 5386 | id <object> :结果为不隐含左值到右值转换的参数,在结果保留引用值。 |
5369 | -其作用等价返回值转换,可能引起对象转移(@5.5.5.2) 。 | |
5387 | +其作用等价返回值转换,可能引起对象转移(@5.5.6.2) 。 | |
5370 | 5388 | idv <object> :同 id ,但结果为返回值转换(@5.7.4.4) 后的值。 |
5371 | 5389 | list <object>... :创建列表(类型为 <list> )对象。 |
5372 | 5390 | list% <object>... :同 list ,但每个参数都不隐含左值到右值转换,在结果保留引用值。 |
@@ -5387,11 +5405,11 @@ | ||
5387 | 5405 | $sequence <expression-sequence> :顺序求值。 |
5388 | 5406 | 操作数非空时结果是最后的参数,可能是引用值。 |
5389 | 5407 | 类似 Kernel 的同名操作。 |
5390 | -求值每个 <object> 的副作用包括其中临时对象的销毁都被顺序限制,类似宿主语言的语句而不是保证子表达式中的临时对象的生存期延迟到完全表达式求值结束的逗号表达式。这也允许实现和 [RnRK] 同名操作类似的 PTC 要求。 | |
5408 | +求值每个 <object> 的副作用包括其中临时对象的销毁都被顺序限制,类似宿主语言的语句而不是保证子表达式中的临时对象的生存期延迟到完全表达式求值结束的逗号表达式。这也允许实现和 [RnRK] 同名操作类似的 PTC 要求。 | |
5391 | 5409 | collapse <object> :折叠可能是引用的值。 |
5392 | 5410 | forward <object> :转发(@9.8.4) 可能是引用的值(@10.4.2.4) 。 |
5393 | 5411 | 按在所在的环境中解析的操作数的类型可选地提升项(@6.6) 作为结果,其作用 id 或 idv 之一。 |
5394 | -被转发的值若是作为形式参数树(@7.7.3) 中的变量,一般应以带有标记字符 & 的形式绑定(@7.7.3.4) ;否则,转发的不是对应的操作数,而可能是按值绑定的副本。 | |
5412 | +被转发的值若是形式参数树(@7.7.3) 中的变量,一般应以带有标记字符 & 的形式绑定(@7.7.3.4) ;否则,转发的不是对应的实际参数,而可能是其按值绑定的副本。 | |
5395 | 5413 | 转移(而不是复制)可修改的右值操作数。注意若右值操作数不可修改(如本机实现引入带有 TermTags::Nonmodifying 标签(@5.4.2.2) 的引用操作数),复制不可复制构造的宿主对象会失败。 |
5396 | 5414 | 本机实现使用 NPL::MoveRValueToReturn(@6.6.3) 可简化操作。 |
5397 | 5415 | forward! <object> :同 forward ,但除转移右值操作数外,也转移(而不是复制)可修改的临时对象操作数。 |
@@ -5550,7 +5568,7 @@ | ||
5550 | 5568 | 对参数列表 (&l &extr) ,结果同求值 accr l null? () ($lambda% (&l) forward-list-first% expire extr l) rest% cons% 。 |
5551 | 5569 | list-extract-first <list> :同指定应用子为 first 的 list-extract 。 |
5552 | 5570 | 对参数列表 (&l &extr) ,结果同求值 list-extract ls first 。 |
5553 | -list-extract-first-rest%! <list> :同指定应用子为 rest% 的 list-extract 。 | |
5571 | +list-extract-first-rest%! <list> :同指定应用子为 rest% 的 list-extract 。 | |
5554 | 5572 | 对参数列表 (&l &extr) ,结果同求值 list-extract ls rest% 。 |
5555 | 5573 | list-push-front! <list> <object> :在列表前插入元素。参数被转发。 |
5556 | 5574 | map-reverse <applicative> <list>... :映射并反转结果。 |
@@ -5634,7 +5652,10 @@ | ||
5634 | 5652 | 传递给 REPL 的命令行参数通常是宿主程序中主函数的 argv 参数数组中处理后去除特定参数后的程序。 |
5635 | 5653 | 宿主程序复制 argv 到这个数组作为副本后,作为函数值的列表的来源。 |
5636 | 5654 | env-get <string> :取宿主环境的环境变量字符串。 |
5637 | -env-set <string> :设置宿主环境的环境变量字符串。 | |
5655 | +字符串参数指定环境变量的名称。 | |
5656 | +env-set <string1> <string2>:设置宿主环境的环境变量字符串。 | |
5657 | +两个字符串参数分别指定环境变量的名称和设置的值。 | |
5658 | +注意使用 env-get 和 env-set 及对应宿主环境的操作不保证线程安全。 | |
5638 | 5659 | env-empty? <string> :判断字符串指定名称的环境变量是否为空。 |
5639 | 5660 | system <string> :以 std::system 兼容的方式调用外部命令。使用 YSLib::usystem 实现。 |
5640 | 5661 | system-get <string> :调用命令,返回命令调用结果。 |
@@ -5683,10 +5704,31 @@ | ||
5683 | 5704 | |
5684 | 5705 | @12.2 派生接口: |
5685 | 5706 | 以下 SHBuild 互操作及脚本调用接口可能在 NPLA1 、SHBuild 工具或外部脚本中实现。 |
5686 | -因为名称保持稳定,也在此提供文档。 | |
5707 | +因为相对其它脚本接口,名称保持稳定,也在此提供文档。 | |
5708 | + | |
5709 | +@12.2.1 环境变量缓存: | |
5710 | +脚本缓存环境变量并在访问缓存时可能按外部环境的要求以未指定的方式跟踪环境变量的访问操作。缓存的环境变量的值在第一次访问时确定。 | |
5711 | +对环境变量的直接访问是使用系统模块(@11.5) 的 env-get、 env-set 和 env-empty? 的访问,忽略缓存的环境变量。直接设置环境变量不更新缓存的值。 | |
5712 | +除非另行指定,访问环境变量使用缓存的环境变量。 | |
5713 | +带缓存环境变量的访问接口如下: | |
5714 | +safeenv-get <string> :同 env-get ,但使用缓存。 | |
5715 | +初始化缓存的值为第一次调用时的环境变量的值。若环境变量未设置,则值为空。 | |
5716 | +safeenv-set <string1> <string2> :同 env-set ,但使用缓存。 | |
5717 | +safeenv-empty? <string> :同 env-empty? ,但使用缓存。 | |
5718 | +safeenv-restore <string> :重置参数指定名称的环境变量为缓存的值。 | |
5719 | + | |
5720 | +@12.2.2 派生操作: | |
5687 | 5721 | () SHBuild_GetPlatformStrings :取操作系统和体系结构字符串列表。 |
5688 | 5722 | 代替 shell 脚本的 SHBuild_PrepareBuild 初始化的宿主环境变量。 |
5689 | -以下 API 的具体功能参见用户文档中脚本的说明;部分参数略不同。 | |
5723 | +() SHBuild_Extend_CallVariables :扩展特定的环境变量的值为 SHBuild 工具接受的环境变量。 | |
5724 | +环境变量扩展通过确定名称的被扩展的环境和扩展其的前缀环境变量指定。 | |
5725 | +若前缀环境变量的当前值非空,被扩展的环境被设置为一个新值。新值是其当前值被添加对应前缀环境变量的值,且在两者之间添加一个空格构成。 | |
5726 | +取被扩展的环境变量的当前值时直接访问环境变量。 | |
5727 | +访问环境变量的顺序未指定。 | |
5728 | +当前扩展的环境变量包括: | |
5729 | +使用 SHBuild_LDFLAGS 扩展 LDFLAGS ; | |
5730 | +使用 SHBuild_LIBS 扩展 LIBS 。 | |
5731 | +以下 API 的具体功能参见用户文档中脚本的说明;对函数 shell 脚本中存在的同名函数,参数可能不同。 | |
5690 | 5732 | SHBuild_2m <string> :以 cygpath -m 转换参数指定的路径作为结果,若失败则结果为参数。 |
5691 | 5733 | SHBuild_2u <string> :以 cygpath -au 转换参数指定的路径作为结果,若失败则结果为参数。 |
5692 | 5734 | SHBuild_2w <string> :以 cygpath -w 转换参数指定的路径作为结果,若失败则结果为参数。 |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file Workflow.txt |
12 | 12 | \ingroup Documentation |
13 | 13 | \brief 工作流汇总报告。 |
14 | -\version r3981 | |
14 | +\version r4006 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since build 433 |
17 | 17 | \par 创建时间: |
18 | 18 | 2013-07-31 01:27:41 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2020-11-15 14:43 +0800 | |
20 | + 2020-12-15 06:00 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -2275,7 +2275,7 @@ | ||
2275 | 2275 | If needed, parallelism can be added by threading and other means in future. |
2276 | 2276 | This design supports mixture of asynchronous and ordinary synchronous handlers of calls once the asynchronous calls are properly guarded by some synchronization mechanism. |
2277 | 2277 | The abstraction of such handlers are called as actions. |
2278 | - In a specific context for reduction, depending on the configuration, an action can be either synchronous, or asynchronous. | |
2278 | + In a specific context for reduction, depending on the configuration, an action can be either synchronous, or asynchronous. | |
2279 | 2279 | Sometimes there has to be different implementations for synchronous and asynchronous uses of an action. |
2280 | 2280 | An action can be represented by various data structures. |
2281 | 2281 | A notable example is the data structure used as the handler in TCO, see below. |
@@ -2388,7 +2388,7 @@ | ||
2388 | 2388 | When the strong reference count reaches to zero, the object would be automatically destroyed. |
2389 | 2389 | So simply avoid to keep redundant strong reference away would be sufficient to make objects collected. |
2390 | 2390 | Otherwise, if the strong reference shows the object is not uniquely held by the frame record list, the environment reference is removed. |
2391 | - As the environment reference is also held elsewhere, the environment is not collected. | |
2391 | + As the environment reference is also held elsewhere, the environment is not collected. | |
2392 | 2392 | Otherwise, if no external objects hold (weak) reference to the environment, the environment reference is needed to be removed. |
2393 | 2393 | The environment is then collected at once. |
2394 | 2394 | The trace is used to maintain the data determining whether objects being traced are held externally. |
@@ -2471,12 +2471,12 @@ | ||
2471 | 2471 | So they are further compressed by taking the processed referent as destination and the referent held by guard object as source. |
2472 | 2472 | All duplication of source environment bindings in the destination environment are removed. |
2473 | 2473 | If the resulted parent environment is empty, it is to be collected. |
2474 | - The parent of destination environment is moved to the source | |
2474 | + The parent of destination environment is moved to the source | |
2475 | 2475 | The condition is based on size of frame record list. |
2476 | 2476 | If the size changed, there is at least one object in frame record list is collected. |
2477 | 2477 | The try would be continued as there can be new orphaned object not in the list due to the removal of object in the list. |
2478 | 2478 | After the above first try of loop, components of the frame element are processed if necessary. |
2479 | - The environment component holding temporary object is cleaned up if it is uniquely referenced. | |
2479 | + The environment component holding temporary object is cleaned up if it is uniquely referenced. | |
2480 | 2480 | The function prvalue component of front element of frame record list is then set to empty. |
2481 | 2481 | This is a hack that avoiding improper tail calls caused by a false positive external reference to the static environment object held in the temporary function object which is or is similar to a vau handler. |
2482 | 2482 | Ideally, multiple temporary objects are allowed coexisted. |
@@ -2539,7 +2539,7 @@ | ||
2539 | 2539 | This changes after adoption of C++17 whose 'std::basic_string' having conditionally enabled constructor targetting to 'std::basic_string_view' instances. |
2540 | 2540 | This should ideally be resolved before adapting 'string_view' on the new 'ystdex::basic_string', but nothing is required to be done yet, since new constructors of 'std::basic_string' is still compatible in semantics with substitution failure. |
2541 | 2541 | No use of 'default_init_allocator' in user code is found. |
2542 | - Class name 'path' is safe because due to 'ystdex::sequence_container_adaptor'. | |
2542 | + Class name 'path' is safe because due to 'ystdex::sequence_container_adaptor'. | |
2543 | 2543 | All other use are safe except 'using u16string::u16string;' in class 'String' in module YSLib::Core::YString. |
2544 | 2544 | This should also be handled like 'ystdex::basic_string' and 'NPL::TokenValue'. |
2545 | 2545 |
@@ -3227,7 +3227,7 @@ | ||
3227 | 3227 | This is also used in some other notable online documents like https://zh.cppreference.com/w/cpp/language/type. |
3228 | 3228 | However, the consisdered replacment is consistent with other sources. |
3229 | 3229 | It is consistent with most mathematical concepts and the usual translations of phrases widely used in computer science like "NP-complete problem". |
3230 | - A second mathematical replacement is '完备'. This is not considered here. | |
3230 | + A second mathematical replacement is '完备'. This is not considered here. | |
3231 | 3231 | It is consistent with diagnostic messages in GCC. |
3232 | 3232 | The characters '不完全' for 'incomplete' are also exactly same in locale zh-TW. |
3233 | 3233 | However, some translations in locale zh-CN is considered somewhat in the zh-TW flavor, e.g. '提领' instead of '解引用' for 'dereference'. So, this is considered not quite precisely reflecting the actual popular use in zh-CN. |
@@ -3475,7 +3475,7 @@ | ||
3475 | 3475 | The 'list::erase' implementation for range is optimized to the 'clear()' case check (like Microsoft VC++) and have less update to pointers otherwise. |
3476 | 3476 | The necessity for the previous builds is from the fact that 'std::list' implementation in libstdc++ on the Android configurations (with CrystaX) are still not conforming to C++11, and it breaks 'NPL::TermNode' allocator-extended construction in YFramework.NPL.SContext. |
3477 | 3477 | However, since it also needs to fix 'std::stack' (thus, including 'std::deque') if nothing is changed in the client code in YFramework.NPL.SContext, update to the official NDK r20 is planned instead. |
3478 | - The update requires to implemented YCLib::FileIO support for libc++ and a few other fixes, but no need to replace the 'std' types. | |
3478 | + The update requires to implemented YCLib::FileIO support for libc++ and a few other fixes, but no need to replace the 'std' types. | |
3479 | 3479 | YFramework still plans to change to 'ystdex::list' now as it is believed to have better performance (at least in x86_64-linux). |
3480 | 3480 | Another bonus is it supports incomplete value types specified in [WG21 N4510], which is adopted as an ISO C++17 feature. |
3481 | 3481 | This is considered to be used in 'ystdex::pmr::memory_resource' implementations when the pool type was not exposed. Is not the case now. |
@@ -3536,7 +3536,7 @@ | ||
3536 | 3536 | The macro 'NPL_Impl_NPLA1_Enable_TailRewriting' is removed. |
3537 | 3537 | It is considered outdated for a while. |
3538 | 3538 | Since the temporary objects are now stored in the reduced terms rather than frames for calls, no special allocations are cared. |
3539 | - The only instance of the remaining use is 'A1::ReduceOrdered'. This is however always expected enabled for TCO. | |
3539 | + The only instance of the remaining use is 'A1::ReduceOrdered'. This is however always expected enabled for TCO. | |
3540 | 3540 | A new macro 'NPL_Impl_NPLA1_Enable_InlineDirect' is added to tweak implementations on asynchronous calls. |
3541 | 3541 | The macro specifies the outermost asynchronous calls formally composed by function templates like 'NPL::RelayNext' or 'NPL::RelaySwitched' now split and being synchrnized sequentially. |
3542 | 3542 | This also means the inner calls (if any) composed by these function templates now usually ignore the return value 'ReductionStatus::Partial' in asynchronous implementations. |
@@ -3605,7 +3605,7 @@ | ||
3605 | 3605 | The old handling in module NPL::Dependency is now moved to NPL::NPLA1 in 'REPLContext::Preprocess'. |
3606 | 3606 | The new handling scan the term recursively, instead one pass. |
3607 | 3607 | Along with non-evaluated expressions, this has some performance overhead. |
3608 | - The overall performance is still slighly better than ond one in general for less evaluation passes, though. | |
3608 | + The overall performance is still slighly better than ond one in general for less evaluation passes, though. | |
3609 | 3609 | Supposing 'passes' as a modifiable reference to a passes object (either of 'A1::EvaluationPasses' or of 'A1::TermPasses') and 'a' as the allocator, the old one can still be implemented (in C++) by new API (more efficiently) as: |
3610 | 3610 | passes += ystdex::bind1([](TermNode& term, |
3611 | 3611 | const ValueObject& pfx, const TokenValue& val, |
@@ -3674,7 +3674,7 @@ | ||
3674 | 3674 | A unary type trait 'ystdex::has_get_allocator' has been added to simplify the implementation. |
3675 | 3675 | The type trait has a 'value' data member as 'ture' if and only if the type being allocated has a 'get_alocator' satisfying the requirements above. |
3676 | 3676 | However, the code generated by x86_64-pc-linux G++ 9.3 shows this is actually a slightly worse. |
3677 | - As the consequence, this stratagy is not enabled currently. | |
3677 | + As the consequence, this stratagy is not enabled currently. | |
3678 | 3678 | Some 'YB_ATTR(always_inline)' has been removed to allow the generated code being actually more efficiently. |
3679 | 3679 | This includes instance in YBase module YStandardEx::Any, for example. |
3680 | 3680 | YBase module YStandardEx::Allocator also has no benefits from additional 'YB_ATTR(always_inline)'. |
@@ -3706,7 +3706,7 @@ | ||
3706 | 3706 | The stashed sequence uses 'YSLib::forward_list' for efficiency. |
3707 | 3707 | The action sequence is exposed as a new class 'ReducerSequence' in 'ContextNode' based on 'YSLib::forward_list'. |
3708 | 3708 | The cleanup is specicically handled to ensure the destruction order of the actions, since 'YSLib::forward_list' has no guarantee on the order in the destruction. |
3709 | - Another action sequence is internally handled as the stacked action. | |
3709 | + Another action sequence is internally handled as the stacked action. | |
3710 | 3710 | A guard type 'ReductionGuard' is also provided in class 'ContextNode' to be used in the derived code with 'A1::Guard'. |
3711 | 3711 | The guard is basically dyanmic to incoperate with other guards more effeciently. |
3712 | 3712 | The guard uses the stacked action to manage the protected actions in the outer continuations. |
@@ -3790,7 +3790,7 @@ | ||
3790 | 3790 | Currently only 'NPL::Reduce' calls guard the continuations. |
3791 | 3791 | They occur in REPL sessions, as well as loads of the external units. |
3792 | 3792 | Note that klisp which only uses explicit run of loop on FFI. |
3793 | - REPL and loading a source file all do not create new barrier in this sense. | |
3793 | + REPL and loading a source file all do not create new barrier in this sense. | |
3794 | 3794 | Missing barriers may be simpler and more flexible here, albeit less security in the aspect of the stability of the REPL environment. |
3795 | 3795 | It seems worth a try. |
3796 | 3796 | To make it easily configurable by users, at least the operation to setup continuation barriers is needed to be available in the object language. |
@@ -3966,7 +3966,7 @@ | ||
3966 | 3966 | Although the library names can work without any prefix (by having a name of the dynamic library name with a postfix '.a'), now always have the 'lib' prefix. |
3967 | 3967 | This is more consistent to the current practice like Cygwin and MSYS2. |
3968 | 3968 | Note in such platforms dynamic libraries can have prefix other than 'lib' like 'cyg' or 'msys-' in the name of dynamic library files. |
3969 | - Also note libraries may or may have the prefix. For example, Qt libraries in MSYS2's MinGW platforms has no 'lib' prefix in the DLL names, but many others have. | |
3969 | + Also note libraries may or may have the prefix. For example, Qt libraries in MSYS2's MinGW platforms has no 'lib' prefix in the DLL names, but many others have. | |
3970 | 3970 | |
3971 | 3971 | $2020-11: |
3972 | 3972 |
@@ -3994,5 +3994,19 @@ | ||
3994 | 3994 | These include 'SHBuild_BuildApp' and 'SHBuild_BuildPrefix'. |
3995 | 3995 | Now 'SHBuild_BuildDir' is used for all cases (including stage 1). |
3996 | 3996 | |
3997 | +$2020-11: | |
3998 | + | |
3999 | +report.impl: | |
4000 | +The YSLib builds are revised. | |
4001 | + 'SHBuild-common-options.sh' is simplified by the removal of stage 2 configurations. | |
4002 | + They are still available in %SHBuild-YSLib-common.txt. | |
4003 | + Unused stage 2 configurations are removed. | |
4004 | + Now all NPLA1 build scripts accept 'SHBuild_LDFLAGS' and 'SHBuild_LIBS'. | |
4005 | + The library building process in the build script 'SHBuild-YSLib-build.txt' has improved the workarounds. | |
4006 | + There is now a warning to indicate the fix of flags is used. | |
4007 | + It now detects sanitizers used with Linux G++. | |
4008 | + As a workaround for performance, dynamic builds with address sanitizer adds '-fno-var-tracking-assignments'. | |
4009 | + It still typically takes more than half an hour, though. | |
4010 | + | |
3997 | 4011 | //// |
3998 | 4012 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - © 2009-2013 FrankHB. | |
2 | + © 2009-2013, 2020 FrankHB. | |
3 | 3 | |
4 | 4 | This file is part of the YSLib project, and may only be used, |
5 | 5 | modified, and distributed under the terms of the YSLib project |
@@ -11,13 +11,13 @@ | ||
11 | 11 | /*! \file ex.cpp |
12 | 12 | \ingroup Documentation |
13 | 13 | \brief 设计规则指定和附加说明 - 存档与临时文件。 |
14 | -\version r6434 *build 449 rev * | |
14 | +\version r6436 | |
15 | 15 | \author FrankHB <frankhb1989@gmail.com> |
16 | 16 | \since 早于 build 132 |
17 | 17 | \par 创建时间: |
18 | 18 | 2009-12-02 05:14:30 +0800 |
19 | 19 | \par 修改时间: |
20 | - 2013-10-07 13:30 +0800 | |
20 | + 2020-12-24 12:01 +0800 | |
21 | 21 | \par 文本编码: |
22 | 22 | UTF-8 |
23 | 23 | \par 模块名称: |
@@ -227,7 +227,7 @@ | ||
227 | 227 | $parser.state.style $= $natral_NPL; |
228 | 228 | $macro_platform_mapping: |
229 | 229 | \mac YCL_DS -> DS, |
230 | -\mac YCL_MINGW32 -> MinGW32; | |
230 | +\mac YCL_Win32 -> {Win32, MinGW32}; | |
231 | 231 | |
232 | 232 | |
233 | 233 | $DONE: |
@@ -14,13 +14,11 @@ | ||
14 | 14 | CXXFLAGS_OPT_UseAssert=true |
15 | 15 | # shellcheck disable=2034 |
16 | 16 | SHBuild_Debug=debug |
17 | -# shellcheck disable=2034 | |
18 | -SHBuild_NoAdjustSubsystem=true | |
19 | 17 | |
20 | 18 | # shellcheck source=../Tools/Scripts/SHBuild-common-options.sh |
21 | 19 | . "$SHBuild_ToolDir/SHBuild-common-options.sh" # for SHBuild_PrepareBuild, |
22 | 20 | # SHBuild_GetBuildName, SHBuild_Pushd, SHBuild_Popd, SHBuild_CheckPCH, |
23 | -# SHBuild_Puts; | |
21 | +# SHBuild_Puts and build options. | |
24 | 22 | |
25 | 23 | INCLUDE_PCH="$YSLib_BaseDir/YBase/include/stdinc.h" |
26 | 24 | INCLUDES="-I$YSLib_BaseDir/YFramework/include \ |
@@ -46,7 +44,7 @@ | ||
46 | 44 | |
47 | 45 | # XXX: Value of several variables may contain whitespaces. |
48 | 46 | # shellcheck disable=2086,2154 |
49 | -"$CXX" "$TestDir/YBase.cpp" -oYBase$EXESFX $CXXFLAGS $LDFLAGS $SHBuild_IncPCH \ | |
47 | +"$CXX" "$TestDir/YBase.cpp" -oYBase $CXXFLAGS $LDFLAGS $SHBuild_IncPCH \ | |
50 | 48 | $INCLUDES $LIBS "$@" |
51 | 49 | |
52 | 50 | ./YBase |