Float128 *GetFloatExpression(ENODE **pnode) /* simple integer value */ { TYP *tp; ENODE *node; Float128 *flt; flt = (Float128 *)allocx(sizeof(Float128)); tp = NonCommaExpression(&node); if (node==NULL) { error(ERR_SYNTAX); return 0; } opt_const(&node); // This should reduce to a single integer expression if (node==NULL) { fatal("Compiler Error: GetFloatExpression: node is NULL"); return 0; } if (node->nodetype != en_fcon) { if (node->nodetype==en_uminus) { if (node->p[0]->nodetype != en_fcon) { printf("\r\nnode:%d \r\n", node->nodetype); error(ERR_INT_CONST); return 0; } Float128::Assign(flt, &node->p[0]->f128); flt->sign = !flt->sign; if (pnode) *pnode = node; return (flt); } } if (pnode) *pnode = node; return &node->f128; }
Statement *ParseSpinlockStatement() { Statement *snp; SYM *sp; snp = NewStatement(st_spinlock, TRUE); if (lastst==openpa) NextToken(); if( NonCommaExpression(&(snp->exp)) == 0 ) error(ERR_EXPREXPECT); snp->incrExpr = (ENODE *)1; snp->initExpr = (ENODE *)0; //if( lastst != id ) { // error(ERR_IDEXPECT); // return 0; // } // if( (sp = search(lastid,&gsyms[0])) == NULL ) { // error( ERR_UNDEFINED ); // return 0; // } // NextToken(); // if (lastst==comma) { // NextToken(); // snp->incrExpr = (ENODE *)GetIntegerExpression((ENODE **)NULL); // if ((int64_t)snp->incrExpr < 1 || (int64_t)snp->incrExpr > 15) // error(ERR_SEMA_INCR); // snp->incrExpr = (ENODE *)((int64_t)snp->incrExpr); // } if (lastst==comma) { NextToken(); snp->initExpr = (ENODE *)GetIntegerExpression((ENODE **)NULL); } if (lastst==closepa) NextToken(); // snp->label = sp->name; snp->next = 0; snp->s1 = ParseStatement(); // Empty statements return NULL if (snp->s1) snp->s1->outer = snp; if (lastst==kw_lockfail) { NextToken(); snp->s2 = ParseStatement(); // Empty statements return NULL if (snp->s2) snp->s2->outer = snp; } return snp; }
int64_t GetIntegerExpression(ENODE **pnode) /* simple integer value */ { TYP *tp; ENODE *node; tp = NonCommaExpression(&node); if (node==NULL) { error(ERR_SYNTAX); return 0; } opt_const(&node); // This should reduce to a single integer expression if (node==NULL) { fatal("Compiler Error: GetIntegerExpression: node is NULL"); return 0; } if (node->nodetype != en_icon && node->nodetype != en_cnacon) { printf("\r\nnode:%d \r\n", node->nodetype); error(ERR_INT_CONST); return 0; } if (pnode) *pnode = node; return node->i; }