亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? atom.c

?? nVidia開發的圖形語言 Cg
?? C
?? 第 1 頁 / 共 2 頁
字號:
/****************************************************************************\
Copyright (c) 2002, NVIDIA Corporation.

NVIDIA Corporation("NVIDIA") supplies this software to you in
consideration of your agreement to the following terms, and your use,
installation, modification or redistribution of this NVIDIA software
constitutes acceptance of these terms.  If you do not agree with these
terms, please do not use, install, modify or redistribute this NVIDIA
software.

In consideration of your agreement to abide by the following terms, and
subject to these terms, NVIDIA grants you a personal, non-exclusive
license, under NVIDIA's copyrights in this original NVIDIA software (the
"NVIDIA Software"), to use, reproduce, modify and redistribute the
NVIDIA Software, with or without modifications, in source and/or binary
forms; provided that if you redistribute the NVIDIA Software, you must
retain the copyright notice of NVIDIA, this notice and the following
text and disclaimers in all such redistributions of the NVIDIA Software.
Neither the name, trademarks, service marks nor logos of NVIDIA
Corporation may be used to endorse or promote products derived from the
NVIDIA Software without specific prior written permission from NVIDIA.
Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder. 

THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
PRODUCTS.

IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\****************************************************************************/

//
// atom.c
//

#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "slglobals.h"

#undef malloc
#undef realloc
#undef free

///////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////// String table: //////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

static const struct {
    int val;
    const char *str;
} tokens[] = {
    AND_SY,         "&&",
    ASSIGNMINUS_SY, "-=",
    ASSIGNMOD_SY,   "%=",
    ASSIGNPLUS_SY,  "+=",
    ASSIGNSLASH_SY, "/=",
    ASSIGNSTAR_SY,  "*=",
    ASM_SY,         "asm",
    BOOLEAN_SY,     "bool",
    BREAK_SY,       "break",
    CASE_SY,        "case",
    COLONCOLON_SY,  "::",
    CONST_SY,       "const",
    CONTINUE_SY,    "continue",
    DEFAULT_SY,     "default",
    DISCARD_SY,     "discard",
    DO_SY,          "do",
    EQ_SY,          "==",
    ELSE_SY,        "else",
    EXTERN_SY,      "extern",
    FLOAT_SY,       "float",
    FLOATCONST_SY,  "<float-const>",
    FLOATHCONST_SY, "<floath-const>",
    FLOATXCONST_SY, "<floatx-const>",
    FOR_SY,         "for",
    GE_SY,          ">=",
    GG_SY,          ">>",
    GOTO_SY,        "goto",
    IDENT_SY,       "<ident>",
    IF_SY,          "if",
    IN_SY,          "in",
    INLINE_SY,      "inline",
    INOUT_SY,       "inout",
    INT_SY,         "int",
    INTCONST_SY,    "<int-const>",
    INTERNAL_SY,    "__internal",
    LE_SY,          "<=",
    LL_SY,          "<<",
    MINUSMINUS_SY,  "--",
    NE_SY,          "!=",
    OR_SY,          "||",
    OUT_SY,         "out",
    PACKED_SY,      "__packed",
    PACKED_SY,      "packed",
    PLUSPLUS_SY,    "++",
    RETURN_SY,      "return",
    STATIC_SY,      "static",
    STRUCT_SY,      "struct",
    STRCONST_SY,    "<string-const>",
    SWITCH_SY,      "switch",
    THIS_SY,        "this",
    TYPEDEF_SY,     "typedef",
    TYPEIDENT_SY,   "<type-ident>",
    UNIFORM_SY,     "uniform",
    VOID_SY,        "void",
    WHILE_SY,       "while",
};

///////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////// String table: //////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

#define INIT_STRING_TABLE_SIZE 16384

typedef struct StringTable_Rec {
    char *strings;
    int nextFree;
    int size;
} StringTable;

/*
 * InitStringTable() - Initialize the string table.
 *
 */

static int InitStringTable(StringTable *stable)
{
    stable->strings = (char *) malloc(INIT_STRING_TABLE_SIZE);
    if (!stable->strings)
        return 0;
    // Zero-th offset means "empty" so don't use it.
    stable->nextFree = 1;
    stable->size = INIT_STRING_TABLE_SIZE;
    return 1;
} // InitStringTable

/*
 * FreeStringTable() - Free the string table.
 *
 */

static void FreeStringTable(StringTable *stable)
{
    if (stable->strings)
        free(stable->strings);
    stable->strings = NULL;
    stable->nextFree = 0;
    stable->size = 0;
} // FreeStringTable

/*
 * HashString() - Hash a string with the base hash function.
 *
 */

static int HashString(const char *s)
{
    int hval = 0;

    while (*s) {
        hval = (hval*13507 + *s*197) ^ (hval >> 2);
        s++;
    }
    return hval & 0x7fffffff;
} // HashString

/*
 * HashString2() - Hash a string with the incrimenting hash function.
 *
 */

static int HashString2(const char *s)
{
    int hval = 0;

    while (*s) {
        hval = (hval*729 + *s*37) ^ (hval >> 1);
        s++;
    }
    return hval;
} // HashString2

/*
 * AddString() - Add a string to a string table.  Return it's offset.
 *
 */

static int AddString(StringTable *stable, const char *s)
{
    int len, loc;
    char *str;

    len = strlen(s);
    if (stable->nextFree + len + 1 >= stable->size) {
        assert(stable->size < 1000000);
        str = (char *) malloc(stable->size*2);
        memcpy(str, stable->strings, stable->size);
        free(stable->strings);
        stable->strings = str;
    }
    loc = stable->nextFree;
    strcpy(&stable->strings[loc], s);
    stable->nextFree += len + 1;
    return loc;
} // AddString

///////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////// Hash table: ///////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

#define INIT_HASH_TABLE_SIZE 2047
#define HASH_TABLE_MAX_COLLISIONS 3

typedef struct HashEntry_Rec {
    int index;      // String table offset of string representation
    int value;      // Atom (symbol) value
} HashEntry;

typedef struct HashTable_Rec {
    HashEntry *entry;
    int size;
    int entries;
    int counts[HASH_TABLE_MAX_COLLISIONS + 1];
} HashTable;

/*
 * InitHashTable() - Initialize the hash table.
 *
 */

static int InitHashTable(HashTable *htable, int fsize)
{
    int ii;

    htable->entry = (HashEntry *) malloc(sizeof(HashEntry)*fsize);
    if (!htable->entry)
        return 0;
    htable->size = fsize;
    for (ii = 0; ii < fsize; ii++) {
        htable->entry[ii].index = 0;
        htable->entry[ii].value = 0;
    }
    htable->entries = 0;
    for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++)
        htable->counts[ii] = 0;
    return 1;
} // InitHashTable

/*
 * FreeHashTable() - Free the hash table.
 *
 */

static void FreeHashTable(HashTable *htable)
{
    if (htable->entry)
        free(htable->entry);
    htable->entry = NULL;
    htable->size = 0;
    htable->entries = 0;
} // FreeHashTable

/*
 * Empty() - See if a hash table entry is empty.
 *
 */

static int Empty(HashTable *htable, int hashloc)
{
    assert(hashloc >= 0 && hashloc < htable->size);
    if (htable->entry[hashloc].index == 0) {
        return 1;
    } else {
        return 0;
    }
} // Empty

/*
 * Match() - See if a hash table entry is matches a string.
 *
 */

static int Match(HashTable *htable, StringTable *stable, const char *s, int hashloc)
{
    int strloc;

    strloc = htable->entry[hashloc].index;
    if (!strcmp(s, &stable->strings[strloc])) {
        return 1;
    } else {
        return 0;
    }
} // Match

///////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////// Atom table: ///////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

#define INIT_ATOM_TABLE_SIZE 1024

struct AtomTable_Rec {
    StringTable stable; // String table.
    HashTable htable;   // Hashes string to atom number and token value.  Multiple strings can
                        // have the same token value but each unique string is a unique atom.
    int *amap;          // Maps atom value to offset in string table.  Atoms all map to unique
                        // strings except for some undefined values in the lower, fixed part
                        // of the atom table that map to "<undefined>".  The lowest 256 atoms
                        // correspond to single character ASCII values except for alphanumeric
                        // characters and '_', which can be other tokens.  Next come the
                        // language tokens with their atom values equal to the token value.
                        // Then come predefined atoms, followed by user specified identifiers.
    int *arev;          // Reversed atom for symbol table use.
    int nextFree;
    int size;
};

static AtomTable latable = { 0 };
AtomTable *atable = &latable;

static int AddAtomFixed(AtomTable *atable, const char *s, int atom);

/*
 * GrowAtomTable() - Grow the atom table to at least "size" if it's smaller.
 *
 */

static int GrowAtomTable(AtomTable *atable, int size)
{
    int *newmap, *newrev;

    if (atable->size < size) {
        if (atable->amap) {
            newmap = realloc(atable->amap, sizeof(int)*size);
            newrev = realloc(atable->arev, sizeof(int)*size);
        } else {
            newmap = malloc(sizeof(int)*size);
            newrev = malloc(sizeof(int)*size);
            atable->size = 0;
        }
        if (!newmap || !newrev) {
            /* failed to grow -- error */
            if (newmap)
                atable->amap = newmap;
            if (newrev)
                atable->amap = newrev;
            return -1;
        }
        memset(&newmap[atable->size], 0, (size - atable->size) * sizeof(int));
        memset(&newrev[atable->size], 0, (size - atable->size) * sizeof(int));
        atable->amap = newmap;
        atable->arev = newrev;
        atable->size = size;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产福利一区二区三区视频在线| 国产不卡一区视频| 成人亚洲一区二区一| 欧美亚洲一区二区在线| 久久久久久免费| 男女性色大片免费观看一区二区 | 国产麻豆精品视频| 欧美日韩一二三| 日本一区二区三区国色天香 | 夜夜嗨av一区二区三区四季av| 国模一区二区三区白浆| 91 com成人网| 亚洲午夜一二三区视频| 99精品欧美一区| 久久久久久久一区| 狂野欧美性猛交blacked| 欧美日韩二区三区| 亚洲夂夂婷婷色拍ww47| 91女厕偷拍女厕偷拍高清| 91在线观看免费视频| 欧美成人一区二区三区在线观看| 亚洲国产一区二区三区青草影视| 91香蕉视频mp4| 亚洲欧美综合在线精品| 成人毛片在线观看| 国产欧美一二三区| 粉嫩一区二区三区在线看| 久久久高清一区二区三区| 麻豆久久久久久久| 日韩一区二区三免费高清| 日本aⅴ免费视频一区二区三区| 欧美亚洲国产bt| 亚洲国产aⅴ成人精品无吗| 欧美私模裸体表演在线观看| 一区二区三区蜜桃| 欧美日本在线观看| 午夜精品123| 欧美一区二区性放荡片| 蜜桃视频免费观看一区| 精品国产一区久久| 国产激情一区二区三区四区| 中文久久乱码一区二区| 99在线热播精品免费| 亚洲免费色视频| 欧美日韩视频在线第一区| 亚洲mv在线观看| 日韩欧美国产麻豆| 国产乱码一区二区三区| 中文字幕av资源一区| 色综合天天天天做夜夜夜夜做| 亚洲电影一区二区| 欧美日韩精品系列| 91毛片在线观看| 亚洲一区二区三区中文字幕 | 91精品国产色综合久久ai换脸| 蜜臀av性久久久久蜜臀aⅴ四虎| 精品福利二区三区| 99久久99久久精品免费看蜜桃| 亚洲18影院在线观看| 欧美mv日韩mv国产| eeuss鲁片一区二区三区在线看| 亚洲一区精品在线| 久久综合999| 色狠狠综合天天综合综合| 日韩国产欧美在线观看| 国产欧美一区视频| 欧美日韩一区二区三区视频| 精品一区二区国语对白| 99九九99九九九视频精品| 亚洲自拍偷拍欧美| 久久欧美一区二区| 欧美影院午夜播放| 国产尤物一区二区| 亚洲成年人网站在线观看| 337p日本欧洲亚洲大胆精品| 一本大道久久a久久精品综合| 青青草国产精品97视觉盛宴| 国产精品久久久久久亚洲毛片| 欧美久久久久久久久久| 粉嫩蜜臀av国产精品网站| 午夜精品一区二区三区免费视频 | 欧美日韩一级大片网址| 国产剧情一区二区三区| 国产色91在线| 欧美裸体一区二区三区| av色综合久久天堂av综合| 久久爱www久久做| 一区二区三区高清在线| 日本一区二区综合亚洲| 欧美一级片免费看| 欧美影院一区二区| 成人av免费在线播放| 韩国精品久久久| 视频在线在亚洲| 一区二区不卡在线视频 午夜欧美不卡在| 日韩免费视频线观看| 欧美色爱综合网| 91伊人久久大香线蕉| 大陆成人av片| 国产成人综合在线观看| 久久精品理论片| 亚洲观看高清完整版在线观看| 中文字幕一区视频| 亚洲国产精品精华液ab| 久久色中文字幕| 久久综合色婷婷| 精品日韩av一区二区| 日韩一区二区三区电影在线观看| 欧美日韩亚洲高清一区二区| 色老头久久综合| 色综合久久中文字幕综合网| 99久精品国产| 一本大道久久a久久综合婷婷| 97久久精品人人做人人爽| aaa欧美色吧激情视频| av不卡一区二区三区| 不卡区在线中文字幕| 成人免费毛片aaaaa**| 成人动漫av在线| 99久久99久久免费精品蜜臀| 97久久人人超碰| 欧美性猛交xxxx黑人交| 欧美日韩亚洲综合| 8x8x8国产精品| 337p粉嫩大胆噜噜噜噜噜91av| 欧美成人r级一区二区三区| 欧美tickling挠脚心丨vk| 久久噜噜亚洲综合| www成人在线观看| 久久精品夜色噜噜亚洲a∨| 欧美国产丝袜视频| 亚洲精品视频免费观看| 亚洲精品视频在线| 日本一道高清亚洲日美韩| 美女脱光内衣内裤视频久久影院| 国产一区二区中文字幕| 不卡一区二区在线| 欧美日韩五月天| 精品日韩一区二区三区免费视频| 国产视频一区二区在线| 亚洲三级理论片| 日本麻豆一区二区三区视频| 国产精品一区二区果冻传媒| 91玉足脚交白嫩脚丫在线播放| 欧美日韩精品一区二区天天拍小说| 欧美一区二区日韩| 亚洲国产激情av| 亚洲主播在线播放| 国产在线视视频有精品| 91在线无精精品入口| 日韩亚洲欧美一区| 中文字幕在线观看不卡| 日本在线不卡视频一二三区| 国产91在线看| 6080国产精品一区二区| 国产欧美日韩综合精品一区二区| 亚洲一区二区高清| 国产麻豆精品在线观看| 欧美日韩精品欧美日韩精品一| 久久久久国色av免费看影院| 亚洲男女毛片无遮挡| 韩国欧美国产1区| 欧美在线观看一二区| 欧美极品aⅴ影院| 日韩av中文字幕一区二区| 91免费视频观看| 一区二区三区日韩欧美精品 | 亚洲专区一二三| 国产成人av电影在线播放| 欧美日韩在线电影| 中文字幕亚洲区| 国内欧美视频一区二区| 在线不卡中文字幕播放| 国产精品久久久久婷婷二区次| 麻豆精品国产传媒mv男同| 色老汉一区二区三区| 日本一区二区三区国色天香| 蜜桃av一区二区在线观看| 欧美影片第一页| 国产精品传媒视频| 国产成人av影院| 26uuu精品一区二区三区四区在线| 亚洲国产成人av| 欧美四级电影在线观看| 亚洲图片激情小说| 风间由美一区二区av101| 日韩精品一区国产麻豆| 午夜av一区二区| 欧美日韩精品系列| 亚洲成人av电影在线| 在线观看精品一区| 亚洲精选一二三| 色老汉av一区二区三区| 亚洲乱码一区二区三区在线观看| 成人一区在线看| 国产精品久久久久久户外露出| 成人不卡免费av| 国产欧美一二三区| 99在线视频精品| 亚洲精品中文字幕在线观看|