MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "Scratch\u5165\u95e8\u6559\u7a0b",
        "continue": "gapcontinue||"
    },
    "query": {
        "pages": {
            "44": {
                "pageid": 44,
                "ns": 0,
                "title": "Realloc.c",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "<pre style=\"color:blue\">\n/* Copyright (c) 2004, 2010 Joerg Wunsch\n   All rights reserved.\n\n   Redistribution and use in source and binary forms, with or without\n   modification, are permitted provided that the following conditions are met:\n\n   * Redistributions of source code must retain the above copyright\n     notice, this list of conditions and the following disclaimer.\n\n   * Redistributions in binary form must reproduce the above copyright\n     notice, this list of conditions and the following disclaimer in\n     the documentation and/or other materials provided with the\n     distribution.\n\n   * Neither the name of the copyright holders nor the names of\n     contributors may be used to endorse or promote products derived\n     from this software without specific prior written permission.\n\n  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n  POSSIBILITY OF SUCH DAMAGE.\n*/\n/* $Id: realloc.c 2127 2010-06-07 14:49:37Z joerg_wunsch $ */\n\n#include <stdlib.h>\n#include <string.h>\n#include \"sectionname.h\"\n#include \"stdlib_private.h\"\n\n#include <avr/io.h>\n\nATTRIBUTE_CLIB_SECTION\nvoid *\nrealloc(void *ptr, size_t len)\n{\n\tstruct __freelist *fp1, *fp2, *fp3, *ofp3;\n\tchar *cp, *cp1;\n\tvoid *memp;\n\tsize_t s, incr;\n\n\t/* Trivial case, required by C standard. */\n\tif (ptr == 0)\n\t\treturn malloc(len);\n\n\tcp1 = (char *)ptr;\n\tcp1 -= sizeof(size_t);\n\tfp1 = (struct __freelist *)cp1;\n\n\tcp = (char *)ptr + len; /* new next pointer */\n\tif (cp < cp1)\n\t\t/* Pointer wrapped across top of RAM, fail. */\n\t\treturn 0;\n\n\t/*\n\t * See whether we are growing or shrinking.  When shrinking,\n\t * we split off a chunk for the released portion, and call\n\t * free() on it.  Therefore, we can only shrink if the new\n\t * size is at least sizeof(struct __freelist) smaller than the\n\t * previous size.\n\t */\n\tif (len <= fp1->sz) {\n\t\t/* The first test catches a possible unsigned int\n\t\t * rollover condition. */\n\t\tif (fp1->sz <= sizeof(struct __freelist) ||\n\t\t    len > fp1->sz - sizeof(struct __freelist))\n\t\t\treturn ptr;\n\t\tfp2 = (struct __freelist *)cp;\n\t\tfp2->sz = fp1->sz - len - sizeof(size_t);\n\t\tfp1->sz = len;\n\t\tfree(&(fp2->nx));\n\t\treturn ptr;\n\t}\n\n\t/*\n\t * If we get here, we are growing.  First, see whether there\n\t * is space in the free list on top of our current chunk.\n\t */\n\tincr = len - fp1->sz;\n\tcp = (char *)ptr + fp1->sz;\n\tfp2 = (struct __freelist *)cp;\n\tfor (s = 0, ofp3 = 0, fp3 = __flp;\n\t     fp3;\n\t     ofp3 = fp3, fp3 = fp3->nx) {\n\t\tif (fp3 == fp2 && fp3->sz + sizeof(size_t) >= incr) {\n\t\t\t/* found something that fits */\n\t\t\tif (fp3->sz + sizeof(size_t) - incr > sizeof(struct __freelist)) {\n\t\t\t\t/* split off a new freelist entry */\n\t\t\t\tcp = (char *)ptr + len;\n\t\t\t\tfp2 = (struct __freelist *)cp;\n\t\t\t\tfp2->nx = fp3->nx;\n\t\t\t\tfp2->sz = fp3->sz - incr;\n\t\t\t\tfp1->sz = len;\n\t\t\t} else {\n\t\t\t\t/* it just fits, so use it entirely */\n\t\t\t\tfp1->sz += fp3->sz + sizeof(size_t);\n\t\t\t\tfp2 = fp3->nx;\n\t\t\t}\n\t\t\tif (ofp3)\n\t\t\t\tofp3->nx = fp2;\n\t\t\telse\n\t\t\t\t__flp = fp2;\n\t\t\treturn ptr;\n\t\t}\n\t\t/*\n\t\t * Find the largest chunk on the freelist while\n\t\t * walking it.\n\t\t */\n\t\tif (fp3->sz > s)\n\t\t\ts = fp3->sz;\n\t}\n\t/*\n\t * If we are the topmost chunk in memory, and there was no\n\t * large enough chunk on the freelist that could be re-used\n\t * (by a call to malloc() below), quickly extend the\n\t * allocation area if possible, without need to copy the old\n\t * data.\n\t */\n\tif (__brkval == (char *)ptr + fp1->sz && len > s) {\n\t\tcp1 = __malloc_heap_end;\n\t\tcp = (char *)ptr + len;\n\t\tif (cp1 == 0)\n\t\t\tcp1 = STACK_POINTER() - __malloc_margin;\n\t\tif (cp < cp1) {\n\t\t\t__brkval = cp;\n\t\t\tfp1->sz = len;\n\t\t\treturn ptr;\n\t\t}\n\t\t/* If that failed, we are out of luck. */\n\t\treturn 0;\n\t}\n\n\t/*\n\t * Call malloc() for a new chunk, then copy over the data, and\n\t * release the old region.\n\t */\n\tif ((memp = malloc(len)) == 0)\n\t\treturn 0;\n\tmemcpy(memp, ptr, fp1->sz);\n\tfree(ptr);\n\treturn memp;\n}\n\n\n</pre>"
                    }
                ]
            },
            "267": {
                "pageid": 267,
                "ns": 0,
                "title": "Robocom",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "[[File:yuy1.png]]<br>\n[[File:yuy2.png]]<br>\n[[File:yuy3.png]]<br>\n[[File:yuy4.png]]<br>\n[[File:yuy5.png]]<br>"
                    }
                ]
            }
        }
    }
}