### fcd Usage Examples Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-fcd.html Examples demonstrating how to use the fcd command with various options. These examples show common use cases for scanning, adding, finding, and listing directories. ```bash fcd --scan t:\\ ``` ```bash fcd --add f:\\project ``` ```bash fcd [--find] whatever ``` ```bash fcd --list ``` -------------------------------- ### Install All Modules Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-install-modules.html Installs all available ConTeXt modules. This may take a significant amount of time and disk space. ```bash mtxrun --script install-modules --install --all ``` -------------------------------- ### Install Specific Modules Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-install-modules.html Installs one or more specified ConTeXt modules. Ensure the module names are correct. ```bash mtxrun --script install-modules --install filter letter ``` ```bash mtxrun --script install-modules --install tikz ``` -------------------------------- ### Install mimalloc Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Installs the compiled library and header files to system-wide locations. ```bash > sudo make install ``` -------------------------------- ### List Installed Modules Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-install-modules.html Displays a list of all ConTeXt modules that are currently installed on the system. ```bash mtxrun --script install-modules --installed ``` -------------------------------- ### Install Module from Zip File Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-install-modules.html Installs a ConTeXt module provided as a local zip file. The path to the zip file must be correct. ```bash mtxrun --script install-modules --install --module t-letter.zip ``` -------------------------------- ### Standard Installation using Autotools Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/libcerf/README.md The typical command sequence for configuring, compiling, and installing the libcerf library using autotools. ```bash ./configure make sudo make install ``` -------------------------------- ### List Available Modules Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-install-modules.html Use this command to see a list of all available ConTeXt modules that can be installed. ```bash mtxrun --script install-modules --list ``` -------------------------------- ### Install Object File with CMake Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/CMakeLists.txt Installs the static object file to the specified installation directory, renaming it according to the library name. This ensures the object file is available after installation. ```cmake install(FILES ${mimalloc-obj-static} DESTINATION ${mi_install_objdir} RENAME ${mi_libname}${CMAKE_C_OUTPUT_EXTENSION} ) ``` -------------------------------- ### Install Header Files Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/CMakeLists.txt Installs the public header files for mimalloc to the specified installation directory. This ensures that users can include mimalloc headers in their projects. ```cmake install(FILES include/mimalloc.h DESTINATION ${mi_install_incdir}) install(FILES include/mimalloc-override.h DESTINATION ${mi_install_incdir}) install(FILES include/mimalloc-new-delete.h DESTINATION ${mi_install_incdir}) install(FILES include/mimalloc-stats.h DESTINATION ${mi_install_incdir}) ``` -------------------------------- ### 8-bit Posit Addition Example Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/softposit/README.md Demonstrates how to perform addition using 8-bit posit numbers. Includes conversion to double for verification and binary output. ```c #include "softposit.h" int main (int argc, char *argv[]){ posit8_t pA, pB, pZ; pA = castP8(0xF2); pB = castP8(0x23); pZ = p8_add(pA, pB); //To check answer by converting it to double double dZ = convertP8ToDouble(pZ); printf("dZ: %.15f\n", dZ); //To print result in binary uint8_t uiZ = castUI(pZ); printBinary((uint64_t*)&uiZ, 8); return 0; } ``` -------------------------------- ### Install SoftPosit.jl via Julia Package Manager Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/softposit/README.md Use this command to add the SoftPosit Julia implementation to your project. ```julia > add https://github.com/milankl/SoftPosit.jl ``` -------------------------------- ### Configure pkg-config File with CMake Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/CMakeLists.txt This section prepares the necessary variables for the pkg-config file by iterating through the library list and formatting them correctly. It then uses `configure_file` to generate the `mimalloc.pc` file and installs it. ```cmake set(mi_pc_libraries "") foreach(item IN LISTS mi_libraries) if(item MATCHES " *[-].*") set(mi_pc_libraries "${mi_pc_libraries} ${item}") else() set(mi_pc_libraries "${mi_pc_libraries} -l${item}") endif() endforeach() include("cmake/JoinPaths.cmake") join_paths(mi_pc_includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") join_paths(mi_pc_libdir "\${prefix}" "${CMAKE_INSTALL_LIBDIR}") configure_file(mimalloc.pc.in mimalloc.pc @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mimalloc.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/") ``` -------------------------------- ### Install CMake Configuration Files Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/CMakeLists.txt Installs the CMake configuration files required for finding and using the mimalloc library in other CMake projects. This includes the main config file and its version file. ```cmake install(FILES cmake/mimalloc-config.cmake DESTINATION ${mi_install_cmakedir}) install(FILES cmake/mimalloc-config-version.cmake DESTINATION ${mi_install_cmakedir}) ``` -------------------------------- ### 16-bit Posit Multiplication Example Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/softposit/README.md Shows how to multiply 16-bit posit numbers. The example includes converting the result to double for checking and printing the binary representation. ```c #include "softposit.h" int main (int argc, char *argv[]){ posit16_t pA, pB, pZ; pA = castP16(0x0FF2); pB = castP16(0x2123); pZ = p16_mul(pA, pB); //To check answer by converting it to double double dZ = convertP16ToDouble(pZ); printf("dZ: %.15f\n", dZ); //To print result in binary uint16_t uiZ = castUI(pZ); printBinary((uint64_t*)&uiZ, 16); return 0; } ``` -------------------------------- ### Create EPUB Zip File Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-epub.html Use this command to create an EPUB zip file from your document. Ensure you have the necessary ConTeXt setup. ```bash mtxrun --script epub --make mydocument ``` -------------------------------- ### Link SoftPosit Library into Executable Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/softposit/README.md Example command to link the compiled softposit.a library with a C source file (main.c) to create an executable (main). Includes necessary flags for math library, output, source file, library path, and optimization. ```bash gcc -lm -o main \ main.c SoftPosit/build/Linux-x86_64-GCC/softposit.a -ISoftPosit/source/include -O2 ``` -------------------------------- ### 24-bit Posit Addition Example (es=2) Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/softposit/README.md Illustrates addition with 24-bit posit numbers, using es=2. It shows two methods for setting bits and includes verification by converting to double and printing binary output. ```c #include "softposit.h" int main (int argc, char *argv[]){ posit_2_t pA, pB, pZ; pA.v = 0xF2; //this is to set the bits (method 1) pB = castPX2(0x23); //this is to set the bits (method 2) pZ = pX2_add(pA, pB, 24); //To check answer by converting it to double double dZ = convertPX2ToDouble(pZ); printf("dZ: %.40f\n", dZ); //To print result in binary printBinaryPX((uint32_t*)&pZ.v, 24); //To print result as double printf("result: %.40f\n", convertPX2ToDouble(pZ)); return 0; } ``` -------------------------------- ### Running Context Commands Source: https://github.com/contextgarden/context/blob/main/context-readme.txt Examples of common commands to manage tex runs using the context and mtxrun runners. Ensure the binary path is added to your system's PATH environment variable. ```bash mtxrun --generate ``` ```bash mtxrun --script fonts --reload ``` ```bash context --make ``` ```bash context --make pdftex ``` ```bash context --make luatex ``` ```bash context foo.tex ``` ```bash context --pdftex foo.tex ``` ```bash context --luatex foo.tex ``` -------------------------------- ### C++ Example: Posit and Quire Operations Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/softposit/README.md Demonstrates basic usage of posit16, posit8, quire16, and quire8 types in C++, including arithmetic operations, fused multiply-add, and conversions to double. ```cpp #include "softposit_cpp.h" int main(int argc, char *argv[]){ posit16 x = 1; posit16 y = 1.5; posit8 x8 = 1; quire16 q; quire8 q8; x += p16(1.5)*5.1; printf("%.13f sizeof: %d\n", x.toDouble(), sizeof(posit16)); x = q.qma(4, 1.2).toPosit(); printf("%.13f sizeof: %d\n", x.toDouble(), sizeof(quire16)); x8 = q8.qma(4, 1.2).toPosit(); printf("%.13f sizeof: %d\n", x8.toDouble(), sizeof(quire8)); std::cout << x; return 0; } ``` -------------------------------- ### Enable mimalloc Statistics Output Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Run your program with the MIMALLOC_SHOW_STATS environment variable set to 1 to display memory allocation statistics. This example shows the output format. ```bash > env MIMALLOC_SHOW_STATS=1 ./cfrac 175451865205073170563711388363 175451865205073170563711388363 = 374456281610909315237213 * 468551 subproc 0 blocks peak total current block total# bin S 4: 75.3 KiB 55.2 MiB 0 32 B 1.8 M ok bin S 6: 31.0 KiB 180.4 KiB 0 48 B 3.8 K ok bin S 8: 64 B 64 B 0 64 B 1 ok bin S 9: 160 B 160 B 0 80 B 2 ok bin S 17: 1.2 KiB 1.2 KiB 0 320 B 4 ok bin S 21: 640 B 3.1 KiB 0 640 B 5 ok bin S 33: 5.0 KiB 5.0 KiB 0 5.0 KiB 1 ok binned : 84.2 Ki 41.5 Mi 0 ok huge : 0 0 0 ok total : 84.2 KiB 41.5 MiB 0 malloc req: 29.7 MiB pages peak total current block total# touched : 152.8 KiB 152.8 KiB 152.8 KiB pages : 8 14 0 ok abandoned : 1 249 0 ok reclaima : 0 reclaimf : 249 reabandon : 0 waits : 0 extended : 38 retire : 35 searches : 0.7 avg arenas peak total current block total# reserved : 1.0 GiB 1.0 GiB 1.0 GiB committed : 4.8 MiB 4.8 MiB 4.4 MiB reset : 0 purged : 385.5 Ki arenas : 1 rollback : 0 mmaps : 3 commits : 0 resets : 1 purges : 2 guarded : 0 heaps : 1 1 1 process peak total current block total# threads : 1 1 1 numa nodes: 1 elapsed : 0.553 s process : user: 0.557 s, system: 0.013 s, faults: 29, peak rss: 2.1 MiB, peak commit: 4.8 MiB ``` -------------------------------- ### Enable Mimalloc Statistics Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Run the debug version of mimalloc with MIMALLOC_SHOW_STATS=1 to get detailed statistics on memory allocations. This is useful for performance analysis. ```bash > env MIMALLOC_SHOW_STATS=1 LD_PRELOAD=/usr/lib/libmimalloc-debug.so myprogram ``` -------------------------------- ### Start ETW Tracing for mimalloc Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/src/prim/windows/readme.md Use Windows Performance Recorder (WPR) to start tracing mimalloc events. This profile captures allocation and free events. ```bash > wpr -start src\prim\windows\etw-mimalloc.wprp -filemode > > wpr -stop test.etl ``` -------------------------------- ### mtxrun spell script example Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-spell.html Use this command to expand Hunspell dictionaries and affix files into a usable format for ConTeXt. Ensure the dictionary and specification files are correctly specified. ```bash mtxrun --script spell --expand --dictionary="en_US.dic" --specification="en_US.txt" --result="data-us.txt" ``` -------------------------------- ### Build libcerf from Source using CMake Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/libcerf/README.md Steps to build and install libcerf from its source code using CMake. This method is recommended for out-of-source builds. ```bash mkdir build cd build cmake .. make make install ``` -------------------------------- ### Uninstall Module from Zip File Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-install-modules.html Uninstalls a ConTeXt module that was previously installed from a local zip file. The path to the zip file must be correct. ```bash mtxrun --script install-modules --uninstall --module t-letter.zip ``` -------------------------------- ### Build SoftPosit Library (Linux-x86_64-GCC) Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/softposit/README.md Instructions to build the SoftPosit library archive (softposit.a) using make on a Linux x86_64 GCC system. Assumes you are in the build directory. ```bash cd SoftPosit/build/Linux-x86_64-GCC make -j6 all ``` -------------------------------- ### Build SoftPosit Shared Library for Julia Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/softposit/README.md Navigate to the build directory and execute the make command to build the Julia-compatible shared library. ```bash cd SoftPosit/build/Linux_x86_64_GCC/ make -j6 julia ``` -------------------------------- ### Find mimalloc with CMake Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Use CMake to find a locally installed mimalloc library for your project. ```cmake find_package(mimalloc 1.8 REQUIRED) ``` -------------------------------- ### Build Script Arguments for build.cmd Source: https://github.com/contextgarden/context/blob/main/source/luametatex/build.txt These arguments are for building on Windows using MSVC. They target different architectures including x64, x32, and ARM64. ```batch --x64 build/msvc-cmd-x64 meant for 64 bit windows using intel/amd chips --x32 build/msvc-cmd-x86 meant for 32 bit windows using intel/amd chips --arm64 build/msvc-cmd-arm64 meant for 64 bit windows using arm chips ``` -------------------------------- ### Define Project and Version Source: https://github.com/contextgarden/context/blob/main/source/luametatex/CMakeLists.txt Sets the project name to 'luametatex' and specifies its version as '2.11'. The project is configured to use the C programming language. ```cmake project(luametatex VERSION 2.11 LANGUAGES C) ``` -------------------------------- ### Include CMake Modules Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/CMakeLists.txt Includes necessary CMake modules for checking linker flags, include files, and installation directories. Requires CMake version 3.18 or higher for CheckLinkerFlag. ```cmake include(CheckLinkerFlag) # requires cmake 3.18 include(CheckIncludeFiles) include(GNUInstallDirs) include("cmake/mimalloc-config-version.cmake") ``` -------------------------------- ### Quire Accumulation for Deep Learning Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/softposit/README.md Demonstrates using quire for accumulating products without intermediate rounding, suitable for deep learning applications. Shows conversion from double, accumulation, and conversion back to posit. ```c //Convert double to posit posit16_t pA = convertDoubleToP16(1.02783203125 ); posit16_t pB = convertDoubleToP16(0.987060546875); posit16_t pC = convertDoubleToP16(0.4998779296875); posit16_t pD = convertDoubleToP16(0.8797607421875); quire16_t qZ; //Set quire to 0 qZ = q16_clr(qZ); //accumulate products without roundings qZ = q16_fdp_add(qZ, pA, pB); qZ = q16_fdp_add(qZ, pC, pD); //Convert back to posit posit16_t pZ = q16_to_p16(qZ); //To check answer double dZ = convertP16ToDouble(pZ); ``` -------------------------------- ### Build a specific configuration with CMake and Visual Studio Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Builds the project using CMake with a specified configuration, such as Release. ```bash > cmake --build . --config=Release ``` -------------------------------- ### Build Static Library Target Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/CMakeLists.txt Configures the build for a static library version of mimalloc. This includes setting output names, enabling position-independent code, defining compile flags and libraries, and specifying include directories for both build and installation. ```cmake if (MI_BUILD_STATIC) add_library(mimalloc-static STATIC ${mi_sources}) set_property(TARGET mimalloc-static PROPERTY OUTPUT_NAME ${mi_libname}) set_property(TARGET mimalloc-static PROPERTY POSITION_INDEPENDENT_CODE ON) target_compile_definitions(mimalloc-static PRIVATE ${mi_defines} MI_STATIC_LIB) target_compile_options(mimalloc-static PRIVATE ${mi_cflags} ${mi_cflags_static}) target_link_libraries(mimalloc-static PRIVATE ${mi_libraries}) target_include_directories(mimalloc-static PUBLIC $ $ ) install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY) install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) endif() ``` -------------------------------- ### Build Script Arguments for build.sh Source: https://github.com/contextgarden/context/blob/main/source/luametatex/build.txt These arguments specify the target platform for the build. Use '--native' for Unix-like systems and cross-compilation options for Windows. ```bash --native build/native meant for unix (linux, freebsd, openbsd, osx, arm) --mingw-32 build/mingw-32 meant for 32 bit windows (crosscompiled) --mingw-64 build/mingw-64 meant for 64 bit windows (crosscompiled) ``` -------------------------------- ### Configure Shared mimalloc Library Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/CMakeLists.txt Defines the shared library target for mimalloc, sets versioning and output names, and configures compile definitions, options, and include directories. It also handles installation of the target and related export files. ```cmake if(MI_BUILD_SHARED) add_library(mimalloc SHARED ${mi_sources}) set_target_properties(mimalloc PROPERTIES VERSION ${mi_version} SOVERSION ${mi_version_major} OUTPUT_NAME ${mi_libname} ) target_compile_definitions(mimalloc PRIVATE ${mi_defines} MI_SHARED_LIB MI_SHARED_LIB_EXPORT) target_compile_options(mimalloc PRIVATE ${mi_cflags} ${mi_cflags_dynamic}) target_link_libraries(mimalloc PRIVATE ${mi_libraries}) target_include_directories(mimalloc PUBLIC $ $ ) install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) if(WIN32 AND NOT MINGW) # On windows, the import library name for the dll would clash with the static mimalloc.lib library # so we postfix the dll import library with `.dll.lib` (and also the .pdb debug file) set_property(TARGET mimalloc PROPERTY ARCHIVE_OUTPUT_NAME "${mi_libname}.dll" ) install(FILES "$/${mi_libname}.dll.lib" DESTINATION ${CMAKE_INSTALL_LIBDIR}/mimalloc-${mi_version}) set_property(TARGET mimalloc PROPERTY PDB_NAME "${mi_libname}.dll") # don't try to install the pdb since it may not be generated depending on the configuration # install(FILES "$/${mi_libname}.dll.pdb" DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() if(WIN32 AND MI_WIN_REDIRECT) if(MINGW) set_property(TARGET mimalloc PROPERTY PREFIX "") endif() # On windows, link and copy the mimalloc redirection dll too. if(CMAKE_GENERATOR_PLATFORM STREQUAL "arm64ec") set(MIMALLOC_REDIRECT_SUFFIX "-arm64ec") elseif(MI_ARCH STREQUAL "x64") set(MIMALLOC_REDIRECT_SUFFIX "") if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64") message(STATUS "Note: x64 code emulated on Windows for arm64 should use an arm64ec build of 'mimalloc.dll'") message(STATUS " together with 'mimalloc-redirect-arm64ec.dll'. See the 'bin\readme.md' for more information.") endif() elseif(MI_ARCH STREQUAL "x86") set(MIMALLOC_REDIRECT_SUFFIX "32") else() set(MIMALLOC_REDIRECT_SUFFIX "-${MI_ARCH}") # -arm64 etc. endif() target_link_libraries(mimalloc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.lib) # the DLL import library add_custom_command(TARGET mimalloc POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" $ COMMENT "Copy mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll to output directory") install(FILES "$/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() endif() ``` -------------------------------- ### List all fonts Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-fonts.html Use the --all flag to list all available fonts. ```bash mtxrun --script font --list --all ``` -------------------------------- ### Run MetaPost Processor Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-metapost.html Execute the metapost script with a given file. This is the basic command to process a MetaPost file. ```bash mtxrun --script metapost yourfile.mp ``` -------------------------------- ### Build mimalloc on Windows with CMake and Visual Studio Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Configures a CMake build for Visual Studio 2022 on Windows, enabling the override DLL. ```bash > cmake ..\.. -G "Visual Studio 17 2022" -A x64 -DMI_OVERRIDE=ON ``` -------------------------------- ### Build mimalloc on Linux/macOS/BSD with CMake (Release) Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Standard release build using CMake. Creates shared, static, and object file versions of the library. ```bash > mkdir -p out/release > cd out/release > cmake ../.. > make ``` -------------------------------- ### Run MetaPost Processor with Split Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-metapost.html Execute the metapost script with the --split option to split a single result file into multiple pages. Useful for multi-page documents. ```bash mtxrun --script metapost --split yourfile.mp ``` -------------------------------- ### Compile Program with ASAN and mimalloc Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Compile a C program with ASAN enabled and link against a debug build of mimalloc. This ensures both the program and the allocator are instrumented for memory error detection. ```bash clang -g -o test-wrong -Iinclude test/test-wrong.c out/debug/libmimalloc-asan-debug.a -lpthread -fsanitize=address -fsanitize-recover=address ``` -------------------------------- ### Build mimalloc on Linux/macOS/BSD with CMake (Secure) Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Builds a secure version of mimalloc incorporating features like guard pages and encrypted free lists. ```bash > mkdir -p out/secure > cd out/secure > cmake -DMI_SECURE=ON ../.. > make ``` -------------------------------- ### Run MetaPost Processor with Specific File Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-metapost.html Execute the metapost script, specifying both the output file name and the input MetaPost file. This allows control over the output filename. ```bash mtxrun --script metapost yourfile.123 myfile.mps ``` -------------------------------- ### Run Program with Valgrind and mimalloc Stats Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Execute a program under Valgrind, ensuring mimalloc is used and its statistics are displayed. This is useful for verifying mimalloc integration and tracking memory usage. ```bash MIMALLOC_SHOW_STATS=1 valgrind --soname-synonyms=somalloc=*mimalloc* -- ``` -------------------------------- ### Build mimalloc on Windows with CMake and Clang-cl Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Configures a CMake build on Windows to use the Clang-cl compiler via the LLVM toolset. ```bash > cmake ../.. -G "Visual Studio 17 2022" -T ClangCl ``` -------------------------------- ### Run Program with ASAN Options Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Execute a program with AddressSanitizer options enabled. This is typically used after building mimalloc with ASAN support to detect memory errors. ```bash ASAN_OPTIONS=verbosity=1 ``` -------------------------------- ### Run Program with Valgrind via LD_PRELOAD Source: https://github.com/contextgarden/context/blob/main/source/luametatex/source/libraries/mimalloc/readme.md Dynamically override the standard allocator with mimalloc using LD_PRELOAD when running under Valgrind. This method ensures mimalloc is loaded and used by the program. ```bash valgrind --trace-children=yes --soname-synonyms=somalloc=*mimalloc* /usr/bin/env LD_PRELOAD=/usr/lib/libmimalloc.so -- ``` -------------------------------- ### Collect Gas Data Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-youless.html Fetches gas data from a YouLess device and saves it to a specified file. Requires the --gas flag. ```bash mtxrun --script youless --collect --host=192.168.2.50 --gas somefile.lua ``` -------------------------------- ### fcd Command Line Options Source: https://github.com/contextgarden/context/blob/main/doc/context/scripts/mkiv/mtx-fcd.html This table lists the available command-line flags for the fcd tool and their descriptions. Use these flags to control fcd's behavior regarding cache, history, and path management. ```bash --clear clear the cache ``` ```bash --history [entry] clear the history ``` ```bash --scan clear the cache and add given path(s) ``` ```bash --add add given path(s) ``` ```bash --find find given path (can be substring) ``` ```bash --nohistory find given path (can be substring) but don't use history ``` ```bash --stub print platform stub file ``` ```bash --list show roots of cached dirs ``` ```bash --history show history of chosen dirs ``` ```bash --help show this help ```