{"id":18716685,"url":"https://github.com/maxdz-gmbh/mdz_ansi","last_synced_at":"2026-04-11T14:34:08.847Z","repository":{"id":208427029,"uuid":"306370193","full_name":"maxdz-gmbh/mdz_ansi","owner":"maxdz-gmbh","description":"Very lightweight, fast and portable ANSI C 89/90 compliant library for handling single-byte (ASCII/ANSI) strings.","archived":false,"fork":false,"pushed_at":"2024-10-01T14:03:26.000Z","size":787,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-19T12:49:13.159Z","etag":null,"topics":["android","ansi","c","freebsd","library","linux","macos","portable","strings","windows"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxdz-gmbh.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.txt","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-22T14:51:09.000Z","updated_at":"2024-10-01T14:03:30.000Z","dependencies_parsed_at":"2024-12-28T10:32:30.235Z","dependency_job_id":null,"html_url":"https://github.com/maxdz-gmbh/mdz_ansi","commit_stats":null,"previous_names":["maxdz-gmbh/mdz_ansi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maxdz-gmbh/mdz_ansi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxdz-gmbh%2Fmdz_ansi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxdz-gmbh%2Fmdz_ansi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxdz-gmbh%2Fmdz_ansi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxdz-gmbh%2Fmdz_ansi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxdz-gmbh","download_url":"https://codeload.github.com/maxdz-gmbh/mdz_ansi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxdz-gmbh%2Fmdz_ansi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31684525,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ansi","c","freebsd","library","linux","macos","portable","strings","windows"],"created_at":"2024-11-07T13:13:25.113Z","updated_at":"2026-04-11T14:34:08.804Z","avatar_url":"https://github.com/maxdz-gmbh.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"**February 2024 NOTE:** This repo is obsolete. Please use following repos for processing single-byte (ASCII/ANSI) strings instead:\n- [mdz_ansi_alg] for string processing algorithms\n- [mdz_ansi_16] for short attached strings\n- [mdz_ansi_dyn] for long dynamically-allocated strings\n\n**NOTE:** All 0.x releases are kind of \"alpha-versions\" without expectations of API backward-compatibility.\n\n## Table of Contents\n[mdz_ansi Overview](#mdz_ansi-Overview)\u003cbr\u003e\n[mdz_ansi Advantages](#mdz_ansi-Advantages)\u003cbr\u003e\n[Performance Comparison](#performance-comparison)\u003cbr\u003e\n[mdz_ansi Usage](#mdz_ansi-Usage)\u003cbr\u003e\n[Licensing info](#Licensing-info)\u003cbr\u003e\n[Credits](#Credits)\n\n## mdz_ansi Overview\nWiki: [mdz_ansi Wiki]\u003cbr\u003e\nfile: *\"mdz_ansi.h\"*\n\nPlease take a look at *\"mdz_ansi.h\"* file or [mdz_ansi Wiki] site for detailed functions descriptions.\n\n[mdz_ansi Wiki]: https://github.com/maxdz-gmbh/mdz_ansi/wiki/mdz_ansi-overview\n\n[mdz_ansi] - is a very lightweight, versatile and speedy C  library for handling single-byte (ASCII/ANSI) strings, developed by [maxdz Software GmbH]. Source code of library is highly-portable, conforms to ANSI C 89/90 Standard.\n\nOnly shared/dynamically loaded libraries (*.so* and *.dll* files with import libraries) are available for evaluation testing purposes. Static libraries are covered by our commercial licenses.\n\n**Linux** binaries are built against Linux Kernel 2.6.18 - and thus should be compatible with Debian (from ver. 4.0), Ubuntu (from ver. 8.04), Fedora (from ver. 9)\n\n**FreeBSD** binaries - may be used from FreeBSD ver. 7.0\n\n**Win32** binaries are built using Visual Studio Platform Toolset \"v90\", thus are compatible with Windows versions from Windows 2000.\u003cbr\u003e\n**Win64** binaries are built using Visual Studio Platform Toolset \"v100\", thus are compatible with Windows versions from Windows XP.\u003cbr\u003e\n\n**Android** x86/armeabi-v7a binaries - may be used from Android API level 16 (\"Jelly Bean\" ver. 4.1.x)\u003cbr\u003e\n**Android** x86_64/arm64-v8a binaries - may be used from Android API level 21 (\"Lollipop\" ver. 5.0)\n\n**macOS** binaries - x86_64, from *MacOS X v10.6.0*\n\n[mdz_ansi]: https://github.com/maxdz-gmbh/mdz_ansi\n[maxdz Software GmbH]: https://maxdz.com/\n[mdz_ansi_alg]: https://github.com/maxdz-gmbh/mdz_ansi_alg\n[mdz_ansi_16]: https://github.com/maxdz-gmbh/mdz_ansi_16\n[mdz_ansi_dyn]: https://github.com/maxdz-gmbh/mdz_ansi_dyn\n\n## mdz_ansi Advantages\n\n**1. High portability:** the whole code conforms to ANSI C 89/90 Standard. Multithreading/asynchronous part is POSIX compatible (under UNIX/Linux).\n\n**2. Little dependencies:** basically *mdz_ansi* functions are only dependend on standard C-library memory-management/access functions. Multithreading part is dependend on POSIX *pthreads* API (under UNIX/Linux) and old process control/synchronization API (from Windows 2000). It means you can use library in your code without any further dependencies except standard platform libraries/APIs.\n\n**3. Fast:** comparison tables for *mdz_ansi_find()*, *mdz_ansi_firstOf()* are here [Performance Comparison](#performance-comparison). There will be more tables/info later.\n\n**4. Flexibilty:** nearly all functions contain \"left position\" and \"right position\" parameters, to limit processed area from left and right. \"ANSI\" string contains more functions than according *STL*, *boost* or *glib* analogs have.\n\n**5. Extended error-checking:** all functions preserve internal error-code pointing the problem. It is possible to use strict error-checking (when all preserved error-codes should be *MDZ_ERROR_NONE*) or \"relaxed\"-checking - when only returned *mdz_false* will indicate error.\n\n**6. Extended control:** *mdz_ansi* functions do only explicit operations. It means for example, when \"insert\" function is called with auto-reservation flag set in *mdz_false* - it will return error if there is not enough capacity in string. No implicit reservations will be made.\n\n**7. Attached usage:** *mdz_ansi* should not necessarily use dynamically-allocated memory - which may be not available on your embedded system (or if malloc()/free() are forbidden to use in you safety-critical software). Just attach container/data to your statically-allocated memory and use all string functionality.\n\n**8. Cache-friendly:** it is possible to keep controlling and data parts together in memory using \"embedded part\".\n\n**9. Asynchronous execution:** almost all functions can be executed asynchronously\n\n## Performance Comparison\n\nPerformance comparison tables for *[mdz_ansi_find]*() and *[mdz_ansi_firstOf]*() give an idea about *mdz_ansi* library overall performance on different platforms compared to STL and standard C library. Modern implementationsof STL and standard C library are pretty fast, using optimized versions of memory-access functions.\n\n- **[mdz_ansi_find]() Test**\n\nFollowing tests are executed:\n\n- Test *1/100M*\": Find 1 byte - in the end of 100M bytes long string\u003cbr\u003e\n- Test *5/100M*\": Find 5 bytes long string - in the end of 100M bytes long string\u003cbr\u003e\n- Test *10/100M*\": Find 10 bytes long string - in the end of 100M bytes long string\u003cbr\u003e\n- Test *100/100M*\": Find 100 bytes long string - in the end of 100M bytes long string\u003cbr\u003e\n- Test *1K/100M*\": Find 1K bytes long string - in the end of 100M bytes long string\u003cbr\u003e\n- Test *500K/1M*\": Find 500K bytes long string - in the end of 1M bytes long string\u003cbr\u003e\n- Test *100M-100/100M*\": Find \"100M minus 100\" bytes long string - in the end of 100M bytes long string\u003cbr\u003e\n- Test *100M/100M*\": Find 100M bytes long string - in 100M bytes long string\u003cbr\u003e\n\nFor **Windows 10 (64-bit)** on *Intel i5-6600 @ 3.30GHz (4 cores/4 threads)*\u003cbr\u003e\n\n**Monotone test** : \"long string\" and \"string to find\" are both filled with '1's; on the last position of both strings is '2'\n\nmonotone = MDZ_FIND_MONOTONE method\u003cbr\u003e\nclib = MDZ_FIND_CLIB method (standard C library)\u003cbr\u003e\nbrute = MDZ_FIND_BRUTE method\u003cbr\u003e\nbmh = MDZ_FIND_BMH method\n\n- VC++ toolset v140 (32-bit)\u003cbr\u003e\n(all numbers are in microseconds measured using *QueryPerformanceCounter()* in main execution thread)\n\n| Test  | mdz_ansi, monotone | mdz_ansi, clib | mdz_ansi, brute |  mdz_ansi, bmh |std::string.find() | clib (strstr())|\n| :---:| ---: | ---: | ---: | ---: | ---: | ---: |\n| 1/100M| **70,351** |  |  |  | 162,681 | 70,579 |\n| 5/100M| **407,668** | 460,052 | 3,045,869 | 781,655 | 3,381,061 | 482,075 |\n| 10/100M| 1,334,782 | **707,712** | 4,394,022 | 780,128 | 4,206,329 | 731,395 |\n| 100/100M| 1,333,516 | 10,914,646 | 15,779,350 | **781,370** | 15,652,407 | 11,253,026 |\n| 1K/100M| 1,332,838 | 70,179,989 | 139,398,637 | **781,439** | 139,808,212 | 75,808,535 |\n| 500K/1M| 13,202 | 166,409,422 | 323,375,345 | **9,411** | 324,276,637 | 178,302,908 |\n| 100M-100/100M| 1,262,919 | 10,884,012 | 14,182,350 | **1,066,737** | 14,150,110 | 10,383,086 |\n| 100M/100M| 117,970 | |  |  | 144,573 | **114,565** |\n\n- MinGW/gcc toolset (32-bit)\u003cbr\u003e\n(all numbers are in microseconds measured using *QueryPerformanceCounter()* in main execution thread)\n\n| Test  | mdz_ansi, monotone | mdz_ansi, clib | mdz_ansi, brute |  mdz_ansi, bmh |\n| :---:| ---: | ---: | ---: | ---: |\n| 1/100M| 148,067 |  |  |  |\n| 5/100M| **534,070** | 1,599,882 | 6,825,862 | 784,326 |\n| 10/100M| **551,404** | 3,635,378 | 7,898,385 | 783,832 |\n| 100/100M| **550,701** | 32,447,796 | 20,451,496 | 786,006 |\n| 1K/100M| **551,213** | 348,052,489 | 117,762,194 | 784,335 |\n| 500K/1M| 7,851 | 814,620,053 | 246,574,213 | **6,263** |\n| 100M-100/100M| 997,729 | 33,028,357 | 11,705,985| **456,680** |\n| 100M/100M| 328,564 | |  |  |\n\n- **[mdz_ansi_firstOf]() Test**\n\nFollowing tests are executed:\n\n- Test *1/100M*\": Find first of 1 byte - in the end of 100M bytes long string\u003cbr\u003e\n- Test *5/100M*\": Find first of 5 bytes - in the end of 100M bytes long string\u003cbr\u003e\n- Test *20/100M*\": Find first of 20 bytes - in the end of 100M bytes long string\u003cbr\u003e\n- Test *50/100M*\": Find first of 50 bytes - in the end of 100M bytes long string\u003cbr\u003e\n- Test *100/100M*\": Find first of 100 bytes - in the end of 100M bytes long string\u003cbr\u003e\n\nFor **Windows 10 (64-bit)** on *Intel i5-6600 @ 3.30GHz (4 cores/4 threads)*\u003cbr\u003e\n\n- VC++ toolset v140 (32-bit)\u003cbr\u003e\n(all numbers are in microseconds measured using *QueryPerformanceCounter()* in main execution thread)\n\n| Test  | mdz_ansi| std::string.find_first_of() | clib (strcspn())|\n| :---:| ---: | ---: | ---: |\n| 1/100M| **70,078** | 163,666 | 2,085,714 |\n| 5/100M| **370,204** | 3,719,660 | 2,077,677 |\n| 20/100M| **369,162** | 5,714,212 | 2,076,031 |\n| 50/100M| **368,994** | 10,965,401 | 2,078,038 |\n| 100/100M| **369,360** | 18,727,283 | 2,076,740 |\n\n- MinGW/gcc toolset (32-bit)\u003cbr\u003e\n(all numbers are in microseconds measured using *QueryPerformanceCounter()* in main execution thread)\n\n| Test  | mdz_ansi|\n| :---:| ---: |\n| 1/100M| 153,511 |\n| 5/100M| 278,387 |\n| 20/100M| 276,389 |\n| 50/100M| 275,956 |\n| 100/100M| 277,709 |\n\n[mdz_ansi_find]: https://github.com/maxdz-gmbh/mdz_ansi/wiki/mdz_ansi_find_async\n[mdz_ansi_firstOf]: https://github.com/maxdz-gmbh/mdz_ansi/wiki/mdz_ansi_firstOf_async\n\n## mdz_ansi Usage\n\n**ansi** is implemented with strict input parameters checking. It means *mdz_false* or some other error indication will be returned if one or several input parameters are invalid - even if such an invalidity doesn't lead to inconsistence (for example adding or removing 0 items).\u003cbr\u003e\n\n**Test license generation:** - in order to get free test-license, please proceed to our Shop page [maxdz Shop] and register an account. After registration you will be able to obtain free 14-days test-licenses for our products using \"Obtain for free\" button. \nTest license data should be used in *mdz_ansi_init()* call for library initialization.\n\n**NOTE:** All 0.x releases are kind of \"beta-versions\" and can be used 1) only with test-license (during test period of 14 days, with necessity to re-generate license for the next 14 days test period) and 2) without expectations of interface backward-compatibility.\n\nSeveral usage-scenarios are possible:\n- low-level - raw C interface, using *mdz_ansi.h* header file\n- higher-level - using *MdzAnsi* C++ \"wrapper\" around *mdz_ansi.h* functions\n\n[mdz_ansi Wiki]: https://github.com/maxdz-gmbh/mdz_ansi/wiki/mdz_ansi-overview\n[Glib]: https://en.wikipedia.org/wiki/GLib\n[STL]: https://en.wikipedia.org/wiki/Standard_Template_Library\n[Performance Comparison]: #performance-comparison\n[maxdz Shop]: https://maxdz.com/shop.php\n\n#### Code Example (low-level use)\n\n*mdz_ansi_init()* with license information should be called for library initialization before any subsequent calls:\n\n```\n#include \u003cmdz_ansi.h\u003e\n\nint main(int argc, char* argv[])\n{\n  /* mdz_ansi library initialization using license info retrieved after license generation (see \"Test license generation\" above) */\n  \n  mdz_bool bRet = mdz_ansi_init(\"\u003cfirst-name-hash\u003e\", \"\u003clast-name-hash\u003e\", \"\u003cemail-hash\u003e\", \"\u003clicense-hash\u003e\");\n  ...\n  \n  mdz_ansi_uninit(); /* call for un-initialization of library */\n  \n  return 0;\n}\n```\n\n[mdz_ansi_create]: https://github.com/maxdz-gmbh/mdz_ansi/wiki/mdz_ansi_create\n[mdz_ansi_destroy]: https://github.com/maxdz-gmbh/mdz_ansi/wiki/mdz_ansi_destroy\n\nAfter library initialization call *[mdz_ansi_create]*() for **ansi** creation. There should be also symmetric *[mdz_ansi_destroy]*() call for every create, otherwise allocated for **ansi** memory remains occupied:\n\n```\n#include \u003cmdz_ansi.h\u003e\n\nint main(int argc, char* argv[])\n{\n  mdz_bool bRet = mdz_ansi_init(\"\u003cfirst-name-hash\u003e\", \"\u003clast-name-hash\u003e\", \"\u003cemail-hash\u003e\", \"\u003clicense-hash\u003e\");   /* initialize mdz_ansi library */\n  \n  struct mdz_Ansi* pAnsi = mdz_ansi_create(0); /* create ansi-string */\n  ...\n  ...\n  /* use pAnsi */\n  ...\n  ...\n  /* destroy pAnsi */\n  \n  mdz_ansi_destroy(\u0026pAnsi); /* after this pAnsi should be NULL */\n  \n  mdz_ansi_uninit(); /* un-initialize mdz_ansi library */\n\n  ...\n}\n```\n\nUse *mdz_Ansi** pointer for subsequent library calls:\n\n```\n#include \u003cmdz_ansi.h\u003e\n\nint main(int argc, char* argv[])\n{\n  mdz_bool bRet = mdz_ansi_init(\"\u003cfirst-name-hash\u003e\", \"\u003clast-name-hash\u003e\", \"\u003cemail-hash\u003e\", \"\u003clicense-hash\u003e\");\n  \n  struct mdz_Ansi* pAnsi = mdz_ansi_create(0);\n\n  /* reserve 5 elements, set them into 'a'. After this Capacity of string is 6 (includes terminating 0) and Size is 5. */\n  \n  bRet = mdz_ansi_reserveAndInit(pAnsi, 5, 'a'); /* \"aaaaa\" after this call */\n  \n  /* insert 'b' in front position with auto-reservation if necessary */\n  \n  bRet = mdz_ansi_insert(pAnsi, 0, \"b\", 1, mdz_true); /* \"baaaaa\" after this call */\n  \n  /* append string with \"cde\" with auto-reservation if necessary */\n  \n  bRet = mdz_ansi_insert(pAnsi, pAnsi-\u003em_nSize - 1, \"cde\", 3, mdz_true); /* \"baaaaacde\" after this call */\n  \n  ...\n  \n  mdz_ansi_destroy(\u0026pAnsi);\n  \n  mdz_ansi_uninit();\n  ...\n}\n```\n\n#### Code Example (higher-level use)\n\nThis is an example above using *MdzAnsi* C++ \"wrapper\":\n\n```\n#include \u003cMdzAnsi.h\u003e\n\nint main(int argc, char* argv[])\n{\n  mdz_ansi_init(\"\u003cfirst-name-hash\u003e\", \"\u003clast-name-hash\u003e\", \"\u003cemail-hash\u003e\", \"\u003clicense-hash\u003e\");\n  \n  MdzAnsi oAnsi; // initialize ansi-string\n\n  bool bRet = oAnsi.reserveAndInit(5, 'a'); // \"aaaaa\" after this call\n  \n  bRet = oAnsi.insertAndReserve(0, 'b'); // \"baaaaa\" after this call\n  \n  bRet = oAnsi.appendAndReserve(\"cde\"); // \"baaaaacde\" after this call\n  \n  mdz_ansi_uninit();\n  ...\n}\n```\n\n## Licensing info\n\nUse of **mdz_ansi** library is regulated by license agreement in *LICENSE.txt*\n\nBasically private non-commercial \"test\" usage is unrestricted. Commercial usage of library (incl. its source code) will be regulated by according license agreement.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxdz-gmbh%2Fmdz_ansi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxdz-gmbh%2Fmdz_ansi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxdz-gmbh%2Fmdz_ansi/lists"}