1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Really remove the OP_StrEq opcode this time - appearently I didn't save the

file out of the editor before doing the check-in (1397). (CVS 1405)

FossilOrigin-Name: 821b0b297c11a5e8d08d73b5eff810652e5a0d27
This commit is contained in:
drh
2004-05-19 11:31:12 +00:00
parent 5a12e68986
commit 09e490ce3c
3 changed files with 8 additions and 161 deletions

View File

@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.301 2004/05/19 11:24:26 drh Exp $
** $Id: vdbe.c,v 1.302 2004/05/19 11:31:13 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -1654,159 +1654,6 @@ case OP_Ge: {
}
break;
}
/* INSERT NO CODE HERE!
**
** The opcode numbers are extracted from this source file by doing
**
** grep '^case OP_' vdbe.c | ... >opcodes.h
**
** The opcodes are numbered in the order that they appear in this file.
** But in order for the expression generating code to work right, the
** string comparison operators that follow must be numbered exactly 6
** greater than the numeric comparison opcodes above. So no other
** cases can appear between the two.
*/
/* Opcode: StrEq P1 P2 *
**
** Pop the top two elements from the stack. If they are equal, then
** jump to instruction P2. Otherwise, continue to the next instruction.
**
** If either operand is NULL (and thus if the result is unknown) then
** take the jump if P1 is true.
**
** The strcmp() library routine is used for the comparison. For a
** numeric comparison, use OP_Eq.
**
** If P2 is zero, do not jump. Instead, push an integer 1 onto the
** stack if the jump would have been taken, or a 0 if not. Push a
** NULL if either operand was NULL.
*/
/* Opcode: StrNe P1 P2 *
**
** Pop the top two elements from the stack. If they are not equal, then
** jump to instruction P2. Otherwise, continue to the next instruction.
**
** If either operand is NULL (and thus if the result is unknown) then
** take the jump if P1 is true.
**
** The strcmp() library routine is used for the comparison. For a
** numeric comparison, use OP_Ne.
**
** If P2 is zero, do not jump. Instead, push an integer 1 onto the
** stack if the jump would have been taken, or a 0 if not. Push a
** NULL if either operand was NULL.
*/
/* Opcode: StrLt P1 P2 *
**
** Pop the top two elements from the stack. If second element (the
** next on stack) is less than the first (the top of stack), then
** jump to instruction P2. Otherwise, continue to the next instruction.
** In other words, jump if NOS<TOS.
**
** If either operand is NULL (and thus if the result is unknown) then
** take the jump if P1 is true.
**
** The strcmp() library routine is used for the comparison. For a
** numeric comparison, use OP_Lt.
**
** If P2 is zero, do not jump. Instead, push an integer 1 onto the
** stack if the jump would have been taken, or a 0 if not. Push a
** NULL if either operand was NULL.
*/
/* Opcode: StrLe P1 P2 *
**
** Pop the top two elements from the stack. If second element (the
** next on stack) is less than or equal to the first (the top of stack),
** then jump to instruction P2. In other words, jump if NOS<=TOS.
**
** If either operand is NULL (and thus if the result is unknown) then
** take the jump if P1 is true.
**
** The strcmp() library routine is used for the comparison. For a
** numeric comparison, use OP_Le.
**
** If P2 is zero, do not jump. Instead, push an integer 1 onto the
** stack if the jump would have been taken, or a 0 if not. Push a
** NULL if either operand was NULL.
*/
/* Opcode: StrGt P1 P2 *
**
** Pop the top two elements from the stack. If second element (the
** next on stack) is greater than the first (the top of stack),
** then jump to instruction P2. In other words, jump if NOS>TOS.
**
** If either operand is NULL (and thus if the result is unknown) then
** take the jump if P1 is true.
**
** The strcmp() library routine is used for the comparison. For a
** numeric comparison, use OP_Gt.
**
** If P2 is zero, do not jump. Instead, push an integer 1 onto the
** stack if the jump would have been taken, or a 0 if not. Push a
** NULL if either operand was NULL.
*/
/* Opcode: StrGe P1 P2 *
**
** Pop the top two elements from the stack. If second element (the next
** on stack) is greater than or equal to the first (the top of stack),
** then jump to instruction P2. In other words, jump if NOS>=TOS.
**
** If either operand is NULL (and thus if the result is unknown) then
** take the jump if P1 is true.
**
** The strcmp() library routine is used for the comparison. For a
** numeric comparison, use OP_Ge.
**
** If P2 is zero, do not jump. Instead, push an integer 1 onto the
** stack if the jump would have been taken, or a 0 if not. Push a
** NULL if either operand was NULL.
*/
case OP_StrEq:
case OP_StrNe:
case OP_StrLt:
case OP_StrLe:
case OP_StrGt:
case OP_StrGe: {
Mem *pNos = &pTos[-1];
int c;
assert( pNos>=p->aStack );
if( (pNos->flags | pTos->flags) & MEM_Null ){
popStack(&pTos, 2);
if( pOp->p2 ){
if( pOp->p1 ) pc = pOp->p2-1;
}else{
pTos++;
pTos->flags = MEM_Null;
}
break;
}else{
Stringify(pTos);
Stringify(pNos);
c = strcmp(pNos->z, pTos->z);
}
/* The asserts on each case of the following switch are there to verify
** that string comparison opcodes are always exactly 6 greater than the
** corresponding numeric comparison opcodes. The code generator depends
** on this fact.
*/
switch( pOp->opcode ){
case OP_StrEq: c = c==0; assert( pOp->opcode-6==OP_Eq ); break;
case OP_StrNe: c = c!=0; assert( pOp->opcode-6==OP_Ne ); break;
case OP_StrLt: c = c<0; assert( pOp->opcode-6==OP_Lt ); break;
case OP_StrLe: c = c<=0; assert( pOp->opcode-6==OP_Le ); break;
case OP_StrGt: c = c>0; assert( pOp->opcode-6==OP_Gt ); break;
default: c = c>=0; assert( pOp->opcode-6==OP_Ge ); break;
}
popStack(&pTos, 2);
if( pOp->p2 ){
if( c ) pc = pOp->p2-1;
}else{
pTos++;
pTos->flags = MEM_Int;
pTos->i = c;
}
break;
}
/* Opcode: And * * *
**