• 大小: 7.31MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-16
  • 语言: C/C++
  • 标签: python  

资源简介

Pycocotools安装程序和安装方法,包括Microsoft Visual C++ 14.0安装程序

资源截图

代码片段和文件信息

// https://github.com/vivkin/gason - pulled January 10 2016
#include “gason.h“
#include 

#define JSON_ZONE_SIZE 4096
#define JSON_STACK_SIZE 32

const char *jsonStrError(int err) {
    switch (err) {
#define XX(no str) \
    case JSON_##no: \
        return str;
        JSON_ERRNO_MAP(XX)
#undef XX
    default:
        return “unknown“;
    }
}

void *JsonAllocator::allocate(size_t size) {
    size = (size + 7) & ~7;

    if (head && head->used + size <= JSON_ZONE_SIZE) {
        char *p = (char *)head + head->used;
        head->used += size;
        return p;
    }

    size_t allocSize = sizeof(Zone) + size;
    Zone *zone = (Zone *)malloc(allocSize <= JSON_ZONE_SIZE ? JSON_ZONE_SIZE : allocSize);
    if (zone == nullptr)
        return nullptr;
    zone->used = allocSize;
    if (allocSize <= JSON_ZONE_SIZE || head == nullptr) {
        zone->next = head;
        head = zone;
    } else {
        zone->next = head->next;
        head->next = zone;
    }
    return (char *)zone + sizeof(Zone);
}

void JsonAllocator::deallocate() {
    while (head) {
        Zone *next = head->next;
        free(head);
        head = next;
    }
}

static inline bool isspace(char c) {
    return c == ‘ ‘ || (c >= ‘\t‘ && c <= ‘\r‘);
}

static inline bool isdelim(char c) {
    return c == ‘‘ || c == ‘:‘ || c == ‘]‘ || c == ‘}‘ || isspace(c) || !c;
}

static inline bool isdigit(char c) {
    return c >= ‘0‘ && c <= ‘9‘;
}

static inline bool isxdigit(char c) {
    return (c >= ‘0‘ && c <= ‘9‘) || ((c & ~‘ ‘) >= ‘A‘ && (c & ~‘ ‘) <= ‘F‘);
}

static inline int char2int(char c) {
    if (c <= ‘9‘)
        return c - ‘0‘;
    return (c & ~‘ ‘) - ‘A‘ + 10;
}

static double string2double(char *s char **endptr) {
    char ch = *s;
    if (ch == ‘-‘)
        ++s;

    double result = 0;
    while (isdigit(*s))
        result = (result * 10) + (*s++ - ‘0‘);

    if (*s == ‘.‘) {
        ++s;

        double fraction = 1;
        while (isdigit(*s)) {
            fraction *= 0.1;
            result += (*s++ - ‘0‘) * fraction;
        }
    }

    if (*s == ‘e‘ || *s == ‘E‘) {
        ++s;

        double base = 10;
        if (*s == ‘+‘)
            ++s;
        else if (*s == ‘-‘) {
            ++s;
            base = 0.1;
        }

        unsigned int exponent = 0;
        while (isdigit(*s))
            exponent = (exponent * 10) + (*s++ - ‘0‘);

        double power = 1;
        for (; exponent; exponent >>= 1 base *= base)
            if (exponent & 1)
                power *= base;

        result *= power;
    }

    *endptr = s;
    return ch == ‘-‘ ? -result : result;
}

static inline JsonNode *insertAfter(JsonNode *tail JsonNode *node) {
    if (!tail)
        return node->next = node;
    node->next = tail->next;
    tail->next = node;
    return node;
}

static inline JsonValue listToValue(JsonTag tag JsonNode *tail) {
    if (tail) {
        auto head = tail->next;
        tail->next = nullptr;
        return JsonValue(tag head);
    }
   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    3287928  2017-12-20 15:24  Microsoft Visual C++ 14.0\Microsoft Visual C++ 14.0.exe

     目录          0  2018-03-29 10:57  Microsoft Visual C++ 14.0

----------- ---------  ---------- -----  ----

              3287928                    2


评论

共有 条评论