qse/ase/lsp/prim_compar.c

409 lines
10 KiB
C
Raw Normal View History

2005-09-20 12:06:51 +00:00
/*
2006-10-24 04:22:40 +00:00
* $Id: prim_compar.c,v 1.4 2006-10-24 04:22:39 bacon Exp $
2005-09-20 12:06:51 +00:00
*/
2006-10-24 04:22:40 +00:00
#include <ase/lsp/prim.h>
#include <ase/bas/assert.h>
2005-09-20 12:06:51 +00:00
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* ase_lsp_prim_eq (ase_lsp_t* lsp, ase_lsp_obj_t* args)
2005-09-20 12:06:51 +00:00
{
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* p1, * p2;
2005-09-20 12:06:51 +00:00
int res;
2006-10-24 04:22:40 +00:00
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
ase_assert (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
2005-09-20 12:06:51 +00:00
2006-10-24 04:22:40 +00:00
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
if (p1 == ASE_NULL) return ASE_NULL;
2005-09-20 12:06:51 +00:00
// TODO: lock p1....
2006-10-24 04:22:40 +00:00
p2 = ase_lsp_eval (lsp, ASE_LSP_CAR(ASE_LSP_CDR(args)));
if (p2 == ASE_NULL) return ASE_NULL;
2005-09-20 12:06:51 +00:00
2006-10-24 04:22:40 +00:00
if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_INT) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_IVALUE(p1) == ASE_LSP_IVALUE(p2);
2005-09-20 12:06:51 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_IVALUE(p1) == ASE_LSP_RVALUE(p2);
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_REAL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_RVALUE(p1) == ASE_LSP_IVALUE(p2);
2005-09-20 12:06:51 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_RVALUE(p1) == ASE_LSP_RVALUE(p2);
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_SYMBOL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_SYMBOL) {
res = ase_lsp_comp_symbol2 (
p1, ASE_LSP_SYMVALUE(p2), ASE_LSP_SYMLEN(p2)) == 0;
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_STRING) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_STRING) {
res = ase_lsp_comp_string2 (
p1, ASE_LSP_STRVALUE(p2), ASE_LSP_STRLEN(p2)) == 0;
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
return (res)? lsp->mem->t: lsp->mem->nil;
}
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* ase_lsp_prim_ne (ase_lsp_t* lsp, ase_lsp_obj_t* args)
2005-09-21 11:52:36 +00:00
{
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* p1, * p2;
2005-09-21 11:52:36 +00:00
int res;
2006-10-24 04:22:40 +00:00
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
ase_assert (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
2005-09-21 11:52:36 +00:00
2006-10-24 04:22:40 +00:00
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
if (p1 == ASE_NULL) return ASE_NULL;
2005-09-21 11:52:36 +00:00
// TODO: lock p1....
2006-10-24 04:22:40 +00:00
p2 = ase_lsp_eval (lsp, ASE_LSP_CAR(ASE_LSP_CDR(args)));
if (p2 == ASE_NULL) return ASE_NULL;
2005-09-21 11:52:36 +00:00
2006-10-24 04:22:40 +00:00
if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_INT) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_IVALUE(p1) != ASE_LSP_IVALUE(p2);
2005-09-21 11:52:36 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_IVALUE(p1) != ASE_LSP_RVALUE(p2);
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_REAL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_RVALUE(p1) != ASE_LSP_IVALUE(p2);
2005-09-21 11:52:36 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_RVALUE(p1) != ASE_LSP_RVALUE(p2);
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_SYMBOL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_SYMBOL) {
res = ase_lsp_comp_symbol2 (
p1, ASE_LSP_SYMVALUE(p2), ASE_LSP_SYMLEN(p2)) != 0;
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_STRING) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_STRING) {
res = ase_lsp_comp_string2 (
p1, ASE_LSP_STRVALUE(p2), ASE_LSP_STRLEN(p2)) != 0;
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
return (res)? lsp->mem->t: lsp->mem->nil;
}
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* ase_lsp_prim_gt (ase_lsp_t* lsp, ase_lsp_obj_t* args)
2005-09-20 12:06:51 +00:00
{
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* p1, * p2;
2005-09-20 12:06:51 +00:00
int res;
2006-10-24 04:22:40 +00:00
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
ase_assert (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
2005-09-20 12:06:51 +00:00
2006-10-24 04:22:40 +00:00
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
if (p1 == ASE_NULL) return ASE_NULL;
2005-09-20 12:06:51 +00:00
// TODO: lock p1....
2006-10-24 04:22:40 +00:00
p2 = ase_lsp_eval (lsp, ASE_LSP_CAR(ASE_LSP_CDR(args)));
if (p2 == ASE_NULL) return ASE_NULL;
2005-09-20 12:06:51 +00:00
2006-10-24 04:22:40 +00:00
if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_INT) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_IVALUE(p1) > ASE_LSP_IVALUE(p2);
2005-09-20 12:06:51 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_IVALUE(p1) > ASE_LSP_RVALUE(p2);
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_REAL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_RVALUE(p1) > ASE_LSP_IVALUE(p2);
2005-09-20 12:06:51 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_RVALUE(p1) > ASE_LSP_RVALUE(p2);
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_SYMBOL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_SYMBOL) {
res = ase_lsp_comp_symbol2 (
p1, ASE_LSP_SYMVALUE(p2), ASE_LSP_SYMLEN(p2)) > 0;
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_STRING) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_STRING) {
res = ase_lsp_comp_string2 (
p1, ASE_LSP_STRVALUE(p2), ASE_LSP_STRLEN(p2)) > 0;
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
return (res)? lsp->mem->t: lsp->mem->nil;
}
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* ase_lsp_prim_lt (ase_lsp_t* lsp, ase_lsp_obj_t* args)
2005-09-20 12:06:51 +00:00
{
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* p1, * p2;
2005-09-20 12:06:51 +00:00
int res;
2006-10-24 04:22:40 +00:00
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
ase_assert (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
2005-09-20 12:06:51 +00:00
2006-10-24 04:22:40 +00:00
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
if (p1 == ASE_NULL) return ASE_NULL;
2005-09-20 12:06:51 +00:00
// TODO: lock p1....
2006-10-24 04:22:40 +00:00
p2 = ase_lsp_eval (lsp, ASE_LSP_CAR(ASE_LSP_CDR(args)));
if (p2 == ASE_NULL) return ASE_NULL;
2005-09-20 12:06:51 +00:00
2006-10-24 04:22:40 +00:00
if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_INT) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_IVALUE(p1) < ASE_LSP_IVALUE(p2);
2005-09-20 12:06:51 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_IVALUE(p1) < ASE_LSP_RVALUE(p2);
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_REAL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_RVALUE(p1) < ASE_LSP_IVALUE(p2);
2005-09-20 12:06:51 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_RVALUE(p1) < ASE_LSP_RVALUE(p2);
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_SYMBOL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_SYMBOL) {
res = ase_lsp_comp_symbol2 (
p1, ASE_LSP_SYMVALUE(p2), ASE_LSP_SYMLEN(p2)) < 0;
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_STRING) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_STRING) {
res = ase_lsp_comp_string2 (
p1, ASE_LSP_STRVALUE(p2), ASE_LSP_STRLEN(p2)) < 0;
2005-09-20 12:06:51 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-20 12:06:51 +00:00
}
return (res)? lsp->mem->t: lsp->mem->nil;
}
2005-09-21 11:52:36 +00:00
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* ase_lsp_prim_ge (ase_lsp_t* lsp, ase_lsp_obj_t* args)
2005-09-21 11:52:36 +00:00
{
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* p1, * p2;
2005-09-21 11:52:36 +00:00
int res;
2006-10-24 04:22:40 +00:00
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
ase_assert (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
2005-09-21 11:52:36 +00:00
2006-10-24 04:22:40 +00:00
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
if (p1 == ASE_NULL) return ASE_NULL;
2005-09-21 11:52:36 +00:00
// TODO: lock p1....
2006-10-24 04:22:40 +00:00
p2 = ase_lsp_eval (lsp, ASE_LSP_CAR(ASE_LSP_CDR(args)));
if (p2 == ASE_NULL) return ASE_NULL;
2005-09-21 11:52:36 +00:00
2006-10-24 04:22:40 +00:00
if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_INT) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_IVALUE(p1) >= ASE_LSP_IVALUE(p2);
2005-09-21 11:52:36 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_IVALUE(p1) >= ASE_LSP_RVALUE(p2);
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_REAL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_RVALUE(p1) >= ASE_LSP_IVALUE(p2);
2005-09-21 11:52:36 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_RVALUE(p1) >= ASE_LSP_RVALUE(p2);
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_SYMBOL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_SYMBOL) {
res = ase_lsp_comp_symbol2 (
p1, ASE_LSP_SYMVALUE(p2), ASE_LSP_SYMLEN(p2)) >= 0;
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_STRING) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_STRING) {
res = ase_lsp_comp_string2 (
p1, ASE_LSP_STRVALUE(p2), ASE_LSP_STRLEN(p2)) >= 0;
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
return (res)? lsp->mem->t: lsp->mem->nil;
}
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* ase_lsp_prim_le (ase_lsp_t* lsp, ase_lsp_obj_t* args)
2005-09-21 11:52:36 +00:00
{
2006-10-24 04:22:40 +00:00
ase_lsp_obj_t* p1, * p2;
2005-09-21 11:52:36 +00:00
int res;
2006-10-24 04:22:40 +00:00
ASE_LSP_PRIM_CHECK_ARG_COUNT (lsp, args, 2, 2);
ase_assert (ASE_LSP_TYPE(args) == ASE_LSP_OBJ_CONS);
2005-09-21 11:52:36 +00:00
2006-10-24 04:22:40 +00:00
p1 = ase_lsp_eval (lsp, ASE_LSP_CAR(args));
if (p1 == ASE_NULL) return ASE_NULL;
2005-09-21 11:52:36 +00:00
// TODO: lock p1....
2006-10-24 04:22:40 +00:00
p2 = ase_lsp_eval (lsp, ASE_LSP_CAR(ASE_LSP_CDR(args)));
if (p2 == ASE_NULL) return ASE_NULL;
2005-09-21 11:52:36 +00:00
2006-10-24 04:22:40 +00:00
if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_INT) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_IVALUE(p1) <= ASE_LSP_IVALUE(p2);
2005-09-21 11:52:36 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_IVALUE(p1) <= ASE_LSP_RVALUE(p2);
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_REAL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_INT) {
res = ASE_LSP_RVALUE(p1) <= ASE_LSP_IVALUE(p2);
2005-09-21 11:52:36 +00:00
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_REAL) {
res = ASE_LSP_RVALUE(p1) <= ASE_LSP_RVALUE(p2);
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_SYMBOL) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_SYMBOL) {
res = ase_lsp_comp_symbol2 (
p1, ASE_LSP_SYMVALUE(p2), ASE_LSP_SYMLEN(p2)) <= 0;
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
2006-10-24 04:22:40 +00:00
else if (ASE_LSP_TYPE(p1) == ASE_LSP_OBJ_STRING) {
if (ASE_LSP_TYPE(p2) == ASE_LSP_OBJ_STRING) {
res = ase_lsp_comp_string2 (
p1, ASE_LSP_STRVALUE(p2), ASE_LSP_STRLEN(p2)) <= 0;
2005-09-21 11:52:36 +00:00
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
}
else {
2006-10-24 04:22:40 +00:00
lsp->errnum = ASE_LSP_ERR_BAD_VALUE;
return ASE_NULL;
2005-09-21 11:52:36 +00:00
}
return (res)? lsp->mem->t: lsp->mem->nil;
}