Ejemplo n.º 1
0
const Symbol *Expression::GetSymbol (const SimpleExpression * &Prefix) const throw ()
{
	const SimpleExpression *exp = GetSimpleExpression ();
	if (exp == 0)
		return 0;

	return exp->GetSymbol(Prefix);
}
Ejemplo n.º 2
0
const Number *Expression::GetNumber () const throw ()
{
	const SimpleExpression *exp = GetSimpleExpression ();
	if (exp == 0)
		return 0;

	return exp->GetNumber();
}
Ejemplo n.º 3
0
const SimpleExpression *Expression::GetSegmentPrefix () const throw ()
{
	const SimpleExpression *exp = GetSimpleExpression ();
	if (exp == 0)
		return 0;

	return exp->GetSegmentPrefix();
}
Ejemplo n.º 4
0
static ret_code GetAndExpression( hll_list * hll, int *i, int ilabel, bool is_true, char * buffer, char **lastjmp, expr_list *opndx )
/***********************************************************************************************************************************/
{
    c_bop op;
    int cur_pos;
    char * ptr = buffer;
    char * truelabel = NULL;
    //char * nlabel;
    //char * olabel;

    DebugMsg(("GetAndExpression(buffer=%s) enter\n", buffer ));

    while (1) {
        ptr = ptr + strlen( ptr );
        cur_pos = *i;
        if ( ERROR == GetSimpleExpression( hll, i, ilabel, is_true, ptr, lastjmp, opndx ) )
            return( ERROR );
        cur_pos = *i;
        op = GetCOp(i);
        if (op != COP_AND)
            break;
        /* v2.02: query is_true var instead of cmd field!
         * this is important if the '!' operator was used.
         */
        //if ( hll->cmd == HLL_WHILE || hll->cmd == HLL_BREAK ) {
        if ( is_true ) {
            /* todo: please describe what's done here and why! */
            if (*lastjmp) {
                char * p = *lastjmp;
                InvertJmp( p+1 );         /* step 1 */
                if ( truelabel == NULL )  /* step 2 */
                    truelabel = MakeAnonymousLabel();
                ReplaceLabel( buffer, GetLabel( hll, ilabel ), truelabel );
                *lastjmp = NULL;
            }
        }
    };

    if ( truelabel ) {
        MakeLabel( ptr+strlen(ptr), truelabel );
        strcpy( ptr+strlen( ptr ), "\n" );
        AsmFree( truelabel );
        *lastjmp = NULL;
    }
    *i = cur_pos;
    return( NOT_ERROR );
}