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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cpp.c

?? nVidia開發(fā)的圖形語言 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.
\****************************************************************************/

//
// cpp.c
//

#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#include "slglobals.h"

/* Don't use memory.c's replacements, as we clean up properly here */
#undef malloc
#undef free

static int bindAtom = 0;
static int constAtom = 0;
static int defaultAtom = 0;
static int defineAtom = 0;
static int definedAtom = 0;
static int elseAtom = 0;
static int elifAtom = 0;
static int endifAtom = 0;
static int ifAtom = 0;
static int ifdefAtom = 0;
static int ifndefAtom = 0;
static int includeAtom = 0;
static int lineAtom = 0;
static int pragmaAtom = 0;
static int texunitAtom = 0;
static int undefAtom = 0;
static int __LINE__Atom = 0;
static int __FILE__Atom = 0;


static Scope *macros = 0;
#define MAX_MACRO_ARGS  64

static int ifdepth = 0; /* depth of #if nesting -- used to detect invalid
                         * #else/#endif */
static SourceLoc ifloc; /* outermost #if */

int InitCPP(void)
{
    char        buffer[64], *t;
    const char  *f;
    // Add various atoms needed by the CPP line scanner:
    bindAtom = LookUpAddString(atable, "bind");
    constAtom = LookUpAddString(atable, "const");
    defaultAtom = LookUpAddString(atable, "default");
    defineAtom = LookUpAddString(atable, "define");
    definedAtom = LookUpAddString(atable, "defined");
    elifAtom = LookUpAddString(atable, "elif");
    elseAtom = LookUpAddString(atable, "else");
    endifAtom = LookUpAddString(atable, "endif");
    ifAtom = LookUpAddString(atable, "if");
    ifdefAtom = LookUpAddString(atable, "ifdef");
    ifndefAtom = LookUpAddString(atable, "ifndef");
    includeAtom = LookUpAddString(atable, "include");
    lineAtom = LookUpAddString(atable, "line");
    pragmaAtom = LookUpAddString(atable, "pragma");
    texunitAtom = LookUpAddString(atable, "texunit");
    undefAtom = LookUpAddString(atable, "undef");
    __LINE__Atom = LookUpAddString(atable, "__LINE__");
    __FILE__Atom = LookUpAddString(atable, "__FILE__");
    macros = NewScopeInPool(mem_CreatePool(0, 0));
    strcpy(buffer, "PROFILE_");
    t = buffer + strlen(buffer);
    f = Cg->options.profileString;
    while ((isalnum(*f) || *f == '_') && t < buffer + sizeof(buffer) - 1)
        *t++ = toupper(*f++);
    *t = 0;
    PredefineMacro(buffer);
    return 1;
} // InitCPP

int FinalCPP(void)
{
    if (ifdepth)
        SemanticWarning(&ifloc, WARNING___CPP_IF_MISMATCH, "if");
    return 1;
}

static int CPPdefine()
{
    int token, name, args[MAX_MACRO_ARGS], argc;
    MacroSymbol mac;
    Symbol *symb;
    SourceLoc dummyLoc;

    memset(&mac, 0, sizeof(mac));
    token = Cg->currentInput->scan(Cg->currentInput);
    if (token != IDENT_SY) {
        SemanticError(Cg->tokenLoc, ERROR___CPP_SYNTAX, "define");
        return token;
    }
    name = yylval.sc_ident;
    token = Cg->currentInput->scan(Cg->currentInput);
    if (token == '(' && !yylval.sc_int) {
        // gather arguments
        argc = 0;
        do {
            token = Cg->currentInput->scan(Cg->currentInput);
            if (argc == 0 && token == ')') break;
            if (token != IDENT_SY) {
                SemanticError(Cg->tokenLoc, ERROR___CPP_SYNTAX, "define");
                return token;
            }
            if (argc < MAX_MACRO_ARGS)
                args[argc++] = yylval.sc_ident;
            token = Cg->currentInput->scan(Cg->currentInput);
        } while (token == ',');
        if (token != ')') {
            SemanticError(Cg->tokenLoc, ERROR___CPP_SYNTAX, "define");
            return token;
        }
        mac.argc = argc;
        mac.args = mem_Alloc(macros->pool, argc * sizeof(int));
        memcpy(mac.args, args, argc * sizeof(int));
        token = Cg->currentInput->scan(Cg->currentInput);
    }
    mac.body = NewTokenStream(GetAtomString(atable, name));
    while (token != '\n') {
        while (token == '\\') {
            token = Cg->currentInput->scan(Cg->currentInput);
            if (token == '\n')
                token = Cg->currentInput->scan(Cg->currentInput);
            else
                RecordToken(mac.body, '\\');
        }
        RecordToken(mac.body, token);
        token = Cg->currentInput->scan(Cg->currentInput);
    };

    symb = LookUpSymbol(macros, name);
    if (symb) {
        if (!symb->details.mac.undef) {
            // already defined -- need to make sure they are identical
            if (symb->details.mac.argc != mac.argc) goto error;
            for (argc=0; argc < mac.argc; argc++)
                if (symb->details.mac.args[argc] != mac.args[argc])
                    goto error;
            RewindTokenStream(symb->details.mac.body);
            RewindTokenStream(mac.body);
            do {
                int old_lval, old_token;
                old_token = ReadToken(symb->details.mac.body);
                old_lval = yylval.sc_int;
                token = ReadToken(mac.body);
                if (token != old_token || yylval.sc_int != old_lval) {
                error:
                    SemanticWarning(Cg->tokenLoc, WARNING___CPP_MACRO_REDEFINED,
                                    GetAtomString(atable, name));
                    break; }
            } while (token > 0);
        }
        FreeMacro(&symb->details.mac);
    } else {
        dummyLoc.file = 0;
        dummyLoc.line = 0;
        symb = AddSymbol(&dummyLoc, macros, name, 0, MACRO_S);
    }
    symb->details.mac = mac;
    return '\n';
} // CPPdefine

static int CPPundef()
{
    int token = Cg->currentInput->scan(Cg->currentInput);
    Symbol *symb;

    if (token != IDENT_SY) goto error;
    symb = LookUpSymbol(macros, yylval.sc_ident);
    if (symb) {
        symb->details.mac.undef = 1;
    }
    token = Cg->currentInput->scan(Cg->currentInput);
    if (token != '\n') {
    error:
        SemanticError(Cg->tokenLoc, ERROR___CPP_SYNTAX, "undef");
    }
    return token;
} // CPPundef

static int CPPif();

/* CPPelse -- skip forward to appropriate spot.  This is actually used
** to skip to and #endif after seeing an #else, AND to skip to a #else,
** #elif, or #endif after a #if/#ifdef/#ifndef/#elif test was false
*/

static int CPPelse(int matchelse)
{
    int atom, depth = 0;
    int token = Cg->currentInput->scan(Cg->currentInput);
    while (token > 0) {
        while (token != '\n')
            token = Cg->currentInput->scan(Cg->currentInput);
        if ((token = Cg->currentInput->scan(Cg->currentInput)) != '#')
            continue;
        if ((token = Cg->currentInput->scan(Cg->currentInput)) != IDENT_SY)
            continue;
        atom = yylval.sc_ident;
        if (atom == ifAtom || atom == ifdefAtom || atom == ifndefAtom)
            depth++;
        else if (atom == endifAtom) {
            if (--depth < 0) {
                if (ifdepth) ifdepth--;
                break;
            }
        }
        else if (matchelse && depth == 0) {
            if (atom == elseAtom)
                break;
            else if (atom == elifAtom) {
                /* we decrement ifdepth here, because CPPif will increment
                 * it and we really want to leave it alone */
                if (ifdepth) ifdepth--;
                return CPPif();
            }
        }
    };
    return token;
}

enum eval_prec {
    MIN_PREC,
    COND, LOGOR, LOGAND, OR, XOR, AND, EQUAL, RELATION, SHIFT, ADD, MUL, UNARY,
    MAX_PREC
};

static int op_logor(int a, int b) { return a || b; }
static int op_logand(int a, int b) { return a && b; }
static int op_or(int a, int b) { return a | b; }
static int op_xor(int a, int b) { return a ^ b; }
static int op_and(int a, int b) { return a & b; }
static int op_eq(int a, int b) { return a == b; }
static int op_ne(int a, int b) { return a != b; }
static int op_ge(int a, int b) { return a >= b; }
static int op_le(int a, int b) { return a <= b; }
static int op_gt(int a, int b) { return a > b; }
static int op_lt(int a, int b) { return a < b; }
static int op_shl(int a, int b) { return a << b; }
static int op_shr(int a, int b) { return a >> b; }
static int op_add(int a, int b) { return a + b; }
static int op_sub(int a, int b) { return a - b; }
static int op_mul(int a, int b) { return a * b; }
static int op_div(int a, int b) { return a / b; }
static int op_mod(int a, int b) { return a % b; }
static int op_pos(int a) { return a; }
static int op_neg(int a) { return -a; }
static int op_cmpl(int a) { return ~a; }
static int op_not(int a) { return !a; }

struct {
    int token, prec, (*op)(int, int);
} binop[] = {
    { OR_SY, LOGOR, op_logor },
    { AND_SY, LOGAND, op_logand },
    { '|', OR, op_or },
    { '^', XOR, op_xor },
    { '&', AND, op_and },
    { EQ_SY, EQUAL, op_eq },
    { NE_SY, EQUAL, op_ne },
    { '>', RELATION, op_gt },
    { GE_SY, RELATION, op_ge },
    { '<', RELATION, op_lt },
    { LE_SY, RELATION, op_le },
    { LL_SY, SHIFT, op_shl },
    { GG_SY, SHIFT, op_shr },
    { '+', ADD, op_add },
    { '-', ADD, op_sub },
    { '*', MUL, op_mul },
    { '/', MUL, op_div },
    { '%', MUL, op_mod },
};

struct {
    int token, (*op)(int);
} unop[] = {
    { '+', op_pos },
    { '-', op_neg },
    { '~', op_cmpl },
    { '!', op_not },
};

#define ALEN(A) (sizeof(A)/sizeof(A[0]))

int eval(int token, int prec, int *res, int *err)
{
    int         i, val;
    Symbol      *s;

    if (token == IDENT_SY) {
        if (yylval.sc_ident == definedAtom) {
            int needclose = 0;

            token = Cg->currentInput->scan(Cg->currentInput);
            if (token == '(') {
                needclose = 1;
                token = Cg->currentInput->scan(Cg->currentInput);
            }
            if (token != IDENT_SY)
                goto error;
            *res = (s = LookUpSymbol(macros, yylval.sc_ident))
                        ? !s->details.mac.undef : 0;
            token = Cg->currentInput->scan(Cg->currentInput);
            if (needclose) {
                if (token != ')')
                    goto error;
                token = Cg->currentInput->scan(Cg->currentInput);
            }
        } else if (MacroExpand(yylval.sc_ident)) {
            token = Cg->currentInput->scan(Cg->currentInput);
            return eval(token, prec, res, err);
        } else {
            goto error;
        }
    } else if (token == INTCONST_SY) {
        *res = yylval.sc_int;
        token = Cg->currentInput->scan(Cg->currentInput);
    } else if (token == '(') {
        token = Cg->currentInput->scan(Cg->currentInput);
        token = eval(token, MIN_PREC, res, err);
        if (!*err) {
            if (token != ')')
                goto error;
            token = Cg->currentInput->scan(Cg->currentInput);
        }
    } else {
        for (i = ALEN(unop) - 1; i >= 0; i--) {
            if (unop[i].token == token)
                break;
        }
        if (i >= 0) {
            token = Cg->currentInput->scan(Cg->currentInput);
            token = eval(token, UNARY, res, err);
            *res = unop[i].op(*res);
        } else {
            goto error;
        }
    }
    while (!*err) {
        if (token == ')' || token == '\n') break;
        for (i = ALEN(binop) - 1; i >= 0; i--) {
            if (binop[i].token == token)
                break;
        }
        if (i < 0 || binop[i].prec <= prec)
            break;
        val = *res;
        token = Cg->currentInput->scan(Cg->currentInput);
        token = eval(token, binop[i].prec, res, err);
        *res = binop[i].op(val, *res);
    }
    return token;
error:
    SemanticError(Cg->tokenLoc, ERROR___CPP_SYNTAX, "if");
    *err = 1;
    *res = 0;
    return token;
} // eval

static int CPPif() {
    int token = Cg->currentInput->scan(Cg->currentInput);
    int res = 0, err = 0;

    if (!ifdepth++)
        ifloc = *Cg->tokenLoc;
    token = eval(token, MIN_PREC, &res, &err);
    if (token != '\n') {
        SemanticError(Cg->tokenLoc, ERROR___CPP_SYNTAX, "if");
    } else if (!res && !err) {
        token = CPPelse(1);
    }
    return token;
} // CPPif

static int CPPifdef(int defined)
{
    int token = Cg->currentInput->scan(Cg->currentInput);
    int name = yylval.sc_ident;
    ifdepth++;
    if (token != IDENT_SY) {
        SemanticError(Cg->tokenLoc, ERROR___CPP_SYNTAX,
                      defined ? "ifdef" : "ifndef");
    } else {
        Symbol *s = LookUpSymbol(macros, name);
        if (((s && !s->details.mac.undef) ? 1 : 0) != defined)
            token = CPPelse(1);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一级黄| 国产一区二区电影| 欧美优质美女网站| ...av二区三区久久精品| 成人免费视频一区| 亚洲色图在线看| 欧美日韩精品福利| 精品一区二区在线视频| 久久久国产综合精品女国产盗摄| 国产一二三精品| 日韩伦理av电影| 777a∨成人精品桃花网| 国产又黄又大久久| 中文字幕佐山爱一区二区免费| 在线亚洲人成电影网站色www| 婷婷中文字幕一区三区| 久久蜜桃av一区精品变态类天堂| 成人永久看片免费视频天堂| 亚洲一二三专区| 精品久久久久久亚洲综合网| av在线不卡电影| 日韩中文字幕亚洲一区二区va在线| 精品福利在线导航| 色爱区综合激月婷婷| 青青草视频一区| 亚洲三级在线看| 精品日韩一区二区| av在线免费不卡| 蜜桃精品视频在线观看| 国产精品成人网| 91精品国产综合久久久久| 国产aⅴ综合色| 午夜视频在线观看一区| 精品国产青草久久久久福利| k8久久久一区二区三区| 日本va欧美va瓶| 亚洲视频在线一区观看| 精品国产一区二区三区久久影院 | 日韩欧美国产综合在线一区二区三区| 国产成人高清视频| 人禽交欧美网站| 亚洲一本大道在线| 国产欧美日韩在线看| 6080日韩午夜伦伦午夜伦| 国产99一区视频免费| 91网上在线视频| 国产在线一区二区| 婷婷开心激情综合| 一区二区在线观看视频在线观看| 日本一区二区三区四区在线视频| 在线不卡中文字幕| 色综合婷婷久久| 国产成人综合亚洲91猫咪| 丝袜诱惑亚洲看片| 亚洲男帅同性gay1069| 国产婷婷色一区二区三区四区| 在线不卡欧美精品一区二区三区| 成人福利视频在线看| 国产高清在线观看免费不卡| 琪琪一区二区三区| 日本特黄久久久高潮| 亚洲国产视频一区| 亚洲在线成人精品| 一区二区三区四区精品在线视频| 中文字幕亚洲在| 亚洲欧美怡红院| 国产精品国产精品国产专区不蜜 | 国产福利一区二区三区| 久久电影网电视剧免费观看| 午夜视频在线观看一区| 亚洲国产成人av网| 亚洲一二三专区| 一区二区三区不卡视频在线观看| 中文字幕日韩av资源站| 国产精品久久免费看| 欧美激情资源网| 中文字幕精品在线不卡| 国产精品久久久久影院老司| 中文字幕欧美三区| 国产精品伦一区| 亚洲日本在线a| 亚洲欧美日韩一区二区| 亚洲激情五月婷婷| 亚洲国产婷婷综合在线精品| 图片区小说区国产精品视频| 日韩av一区二区在线影视| 91女神在线视频| 在线观看不卡一区| 欧美精品久久99久久在免费线 | 成人午夜私人影院| av网站免费线看精品| 不卡一区二区中文字幕| 色999日韩国产欧美一区二区| 色噜噜狠狠色综合欧洲selulu| 欧洲av在线精品| 欧美一区二区视频在线观看| 精品电影一区二区| 欧美高清在线一区二区| 亚洲自拍都市欧美小说| 日本一区中文字幕| 国产美女精品人人做人人爽| 成人网男人的天堂| 欧美在线播放高清精品| 精品国产在天天线2019| 中文字幕在线一区| 亚洲大片在线观看| 国产乱理伦片在线观看夜一区| 国产精品99久久久久久有的能看| 99精品久久免费看蜜臀剧情介绍| 欧美日韩综合在线免费观看| 欧美va亚洲va| 日韩一区在线免费观看| 石原莉奈一区二区三区在线观看| 国内偷窥港台综合视频在线播放| 26uuu国产电影一区二区| 国产日产欧产精品推荐色| 亚洲国产视频在线| 国产成人综合亚洲网站| 欧美日韩精品一二三区| 中文字幕欧美区| 五月婷婷综合网| 不卡在线观看av| 日韩三级在线免费观看| 国产精品久久久久久久久免费丝袜 | 亚洲国产aⅴ天堂久久| 国内精品久久久久影院一蜜桃| 99麻豆久久久国产精品免费优播| 欧美日韩精品电影| 国产精品无码永久免费888| 日韩影视精彩在线| 色婷婷国产精品综合在线观看| 精品国精品自拍自在线| 亚洲午夜免费电影| 成人av在线电影| 日韩精品一区二区三区在线观看| 夜夜夜精品看看| 成熟亚洲日本毛茸茸凸凹| 日韩欧美一级在线播放| 午夜精品福利在线| 色吧成人激情小说| 国产精品久久久久久久久免费相片| 久久精品国产秦先生| 欧美色老头old∨ideo| **性色生活片久久毛片| 国产精品1区2区3区| 日韩精品一区二区三区视频| 亚洲第一福利一区| 欧美综合视频在线观看| 亚洲精品日韩专区silk| av不卡在线观看| 中文字幕精品—区二区四季| 国产激情偷乱视频一区二区三区| 欧美一区二区福利在线| 日韩av电影免费观看高清完整版 | 色婷婷激情久久| 中文字幕一区二区视频| 国产精品亚洲成人| 久久精品夜色噜噜亚洲a∨| 国模一区二区三区白浆| 日韩精品在线看片z| 人人爽香蕉精品| 欧美一区二区三区四区视频| 视频一区视频二区中文| 欧美日韩一级视频| 亚洲福利视频一区| 欧美日韩一区视频| 水野朝阳av一区二区三区| 欧美日韩成人一区二区| 午夜精品在线视频一区| 91 com成人网| 麻豆精品国产91久久久久久| 欧美精品一区二| 国产美女娇喘av呻吟久久| 亚洲国产精品av| 色哟哟国产精品| 一级做a爱片久久| 欧美日韩一区二区三区免费看| 日本欧美一区二区在线观看| 日韩欧美国产1| 成人综合在线视频| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 91看片淫黄大片一级在线观看| 亚洲精品国产精品乱码不99| 欧美在线观看18| 麻豆国产一区二区| 国产精品超碰97尤物18| 欧美在线免费观看视频| 日本最新不卡在线| 久久午夜羞羞影院免费观看| 国产精品一区二区久久不卡| 日韩理论片中文av| 7777精品伊人久久久大香线蕉完整版 | 亚洲成人福利片| 日韩欧美色综合| 成人精品高清在线| 亚洲第一会所有码转帖| 久久综合久久久久88| 91麻豆福利精品推荐| 青青草视频一区| 成人免费视频在线观看|