• askdsk
    了解作者
  • C/C++
    开发工具
  • 1.8MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1
    下载次数
  • 2020-03-12 11:07
    上传日期
Musl是一个轻量级的C标准库,设计作为GNU C library (glibc)、 uClibc或Android Bionic的替代用于嵌入式操作系统和移动设备。它遵循POSIX 2008规格和 C99 标准,采用MIT许可证授权,使用Musl的Linux发行版和项目包括sabotage,bootstrap-linux,LightCube OS等等。
musl-1.1.24.zip
内容介绍
/* regcomp.c - TRE POSIX compatible regex compilation functions. Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <string.h> #include <stdlib.h> #include <regex.h> #include <limits.h> #include <stdint.h> #include <ctype.h> #include "tre.h" #include <assert.h rel='nofollow' onclick='return false;'> /*********************************************************************** from tre-compile.h ***********************************************************************/ typedef struct { int position; int code_min; int code_max; int *tags; int assertions; tre_ctype_t class; tre_ctype_t *neg_classes; int backref; } tre_pos_and_tags_t; /*********************************************************************** from tre-ast.c and tre-ast.h ***********************************************************************/ /* The different AST node types. */ typedef enum { LITERAL, CATENATION, ITERATION, UNION } tre_ast_type_t; /* Special subtypes of TRE_LITERAL. */ #define EMPTY -1 /* Empty leaf (denotes empty string). */ #define ASSERTION -2 /* Assertion leaf. */ #define TAG -3 /* Tag leaf. */ #define BACKREF -4 /* Back reference leaf. */ #define IS_SPECIAL(x) ((x)->code_min < 0) #define IS_EMPTY(x) ((x)->code_min == EMPTY) #define IS_ASSERTION(x) ((x)->code_min == ASSERTION) #define IS_TAG(x) ((x)->code_min == TAG) #define IS_BACKREF(x) ((x)->code_min == BACKREF) /* A generic AST node. All AST nodes consist of this node on the top level with `obj' pointing to the actual content. */ typedef struct { tre_ast_type_t type; /* Type of the node. */ void *obj; /* Pointer to actual node. */ int nullable; int submatch_id; int num_submatches; int num_tags; tre_pos_and_tags_t *firstpos; tre_pos_and_tags_t *lastpos; } tre_ast_node_t; /* A "literal" node. These are created for assertions, back references, tags, matching parameter settings, and all expressions that match one character. */ typedef struct { long code_min; long code_max; int position; tre_ctype_t class; tre_ctype_t *neg_classes; } tre_literal_t; /* A "catenation" node. These are created when two regexps are concatenated. If there are more than one subexpressions in sequence, the `left' part holds all but the last, and `right' part holds the last subexpression (catenation is left associative). */ typedef struct { tre_ast_node_t *left; tre_ast_node_t *right; } tre_catenation_t; /* An "iteration" node. These are created for the "*", "+", "?", and "{m,n}" operators. */ typedef struct { /* Subexpression to match. */ tre_ast_node_t *arg; /* Minimum number of consecutive matches. */ int min; /* Maximum number of consecutive matches. */ int max; /* If 0, match as many characters as possible, if 1 match as few as possible. Note that this does not always mean the same thing as matching as many/few repetitions as possible. */ unsigned int minimal:1; } tre_iteration_t; /* An "union" node. These are created for the "|" operator. */ typedef struct { tre_ast_node_t *left; tre_ast_node_t *right; } tre_union_t; static tre_ast_node_t * tre_ast_new_node(tre_mem_t mem, int type, void *obj) { tre_ast_node_t *node = tre_mem_calloc(mem, sizeof *node); if (!node || !obj) return 0; node->obj = obj; node->type = type; node->nullable = -1; node->submatch_id = -1; return node; } static tre_ast_node_t * tre_ast_new_literal(tre_mem_t mem, int code_min, int code_max, int position) { tre_ast_node_t *node; tre_literal_t *lit; lit = tre_mem_calloc(mem, sizeof *lit); node = tre_ast_new_node(mem, LITERAL, lit); if (!node) return 0; lit->code_min = code_min; lit->code_max = code_max; lit->position = position; return node; } static tre_ast_node_t * tre_ast_new_iter(tre_mem_t mem, tre_ast_node_t *arg, int min, int max, int minimal) { tre_ast_node_t *node; tre_iteration_t *iter; iter = tre_mem_calloc(mem, sizeof *iter); node = tre_ast_new_node(mem, ITERATION, iter); if (!node) return 0; iter->arg = arg; iter->min = min; iter->max = max; iter->minimal = minimal; node->num_submatches = arg->num_submatches; return node; } static tre_ast_node_t * tre_ast_new_union(tre_mem_t mem, tre_ast_node_t *left, tre_ast_node_t *right) { tre_ast_node_t *node; tre_union_t *un; if (!left) return right; un = tre_mem_calloc(mem, sizeof *un); node = tre_ast_new_node(mem, UNION, un); if (!node || !right) return 0; un->left = left; un->right = right; node->num_submatches = left->num_submatches + right->num_submatches; return node; } static tre_ast_node_t * tre_ast_new_catenation(tre_mem_t mem, tre_ast_node_t *left, tre_ast_node_t *right) { tre_ast_node_t *node; tre_catenation_t *cat; if (!left) return right; cat = tre_mem_calloc(mem, sizeof *cat); node = tre_ast_new_node(mem, CATENATION, cat); if (!node) return 0; cat->left = left; cat->right = right; node->num_submatches = left->num_submatches + right->num_submatches; return node; } /*********************************************************************** from tre-stack.c and tre-stack.h ***********************************************************************/ typedef struct tre_stack_rec tre_stack_t; /* Creates a new stack object. `size' is initial size in bytes, `max_size' is maximum size, and `increment' specifies how much more space will be allocated with realloc() if all space gets used up. Returns the stack object or NULL if out of memory. */ static tre_stack_t * tre_stack_new(int size, int max_size, int increment); /* Frees the stack object. */ static void tre_stack_destroy(tre_stack_t *s); /* Returns the current number of objects in the stack. */ static int tre_stack_num_objects(tre_stack_t *s); /* Each tre_stack_push_*(tre_stack_t *s, <type> value) function pushes `value' on top of stack `s'. Returns REG_ESPACE if out of memory. This tries to realloc() more space before failing if maximum size has not yet been reached. Returns REG_OK if successful. */ #define declare_pushf(typetag, type) \ static reg_errcode_t tre_stack_push_ ## typetag(tre_stack_t *s, type value) declare_pushf(voidptr, void *); declare_pushf(int, int); /* Each tre_stack_pop_*(tre_stack_t *s) function pops the topmost element off of stack `s' and returns it. The stack must not be empty. */ #define declare_popf(typetag, type) \ static type tre_stack_pop_ ## typetag(tre_stack_t *s) declare_popf(voidptr, void *); declare_popf(int, int); /* Just to save some typing. */ #define STACK_PUSH(s, typetag, value) \ do \ { \ status = tre_stack_push_ ## typetag(s, value);
评论
    相关推荐
    • musl-1.1.18c.zip
      Musl是一个轻量级的C标准库,设计作为GNU C library (glibc)、 uClibc或Android Bionic的替代用于嵌入式操作系统和移动设备。它遵循POSIX 2008规格和 C99 标准,采用MIT许可证授权,使用Musl的Linux发行版和项目包括...
    • hardened_malloc:专为现代系统设计的强化分配器。 它已集成到Android的Bionic libc中,并且可以与m
      硬化的malloc 介绍 这是一个注重安全性的通用内存... 该项目目前支持Bionic(Android),musl和glibc。 将来可能会支持其他非Linux操作系统。 对于Android,有自定义集成和其他强化功能,将来也将针对musl进行计划。
    • leveldown:纯C ++ Node.js LevelDB绑定。 符合abstract-leveldown的商店
      leveldown npm软件包附带了适用于流行的64位平台以及ARM,Android和Alpine(musl)的预构建二进制文件,并且已知可在以下方面工作: Linux (包括Raspberry Pi和Kindle等ARM平台) 苹果系统 Solaris (SmartOS
    • go-libtor:Go的独立Tor
      它由围绕原始C / C ++ Tor库及其依赖项( , 和 )精心设计的Go / CGO包装器套件组成。 图书馆 版 承诺 zlib 1.2.11 libevent 2.2.0-alpha开发 的openssl 1.1.1稳定 r 0.3.5.13 该库当前受以下支持: ...
    • c#+毕业设计+源码-c:小型自托管C编译器
      android。 第三阶段 构建小的干净的C代码库,例如8cc,tcc,sbase。 阶段4。 建立musl libc。 超过。 构建更多程序。 将gnu替换为我们自己的汇编器。 用我们自己的静态链接器替换ld。 构建操作系统内核。 SSA后端。 ...
    • go-libtor:来自Go的独立Tor
      都与libc和muslmusl需要在CI中再次检查)。 Android amd64 , x86 , arm64和arm ;特别是通过gomobile (需要在CI中再次检查)。 达尔文(Macos和iOS) amd64和arm64 。 安装(Go模块) 该库与Go模块兼容。您只...
    • Rust的工具链管理器Rustup.zip
      $ rustup run beta cargo test再举一个例子,Anderson 介绍了如何使用 rustup 为使用 musl 标准库(而非大家常用的glibc标准库)的 Linux 版本创建静态二进制文件:$ rustup target add x86_64-unknown...
    • softap_ap6212a0_tinav2.1_验证通过_旧版本的系统_20170915_1223没有外层目录.7z
      旧版本版本的全志R16平台的tinav2.1的系统打开softAP 2017/9/14 17:25 版本:V1.0 1、原始编译: ...rootroot@cm-System-Product-Name:~$ cd /home/wwt/ ...rootroot@cm-System-Product-Name:/home/wwt$ tar zxvf...
    • region-用于处理内存区域的库-Rust开发
      平台该库为以下目标提供CI:Linux aarch64-linux-android armv7-unknown-linux-gnueabihf i686-unknown-linux-gnu mips-unknown-linux-gnu x86_64-unknown-linux-gnu x86_64-unknown-linux -musl Windows i686-pc-...
    • NS2example.rar
      在ns2下实现无线传感器网络仿真,多个节点进行网络活动