static ESExpResult * term_eval_and (struct _ESExp *f, gint argc, struct _ESExpTerm **argv, gpointer data) { struct _ESExpResult *r, *r1; GHashTable *ht = g_hash_table_new (g_str_hash, g_str_equal); struct IterData lambdafoo; gint type=-1; gint bool = TRUE; gint i; const gchar *oper; r (printf ("( and\n")); r = e_sexp_result_new (f, ESEXP_RES_UNDEFINED); oper = "AND"; f->operators = g_slist_prepend (f->operators, (gpointer) oper); for (i = 0; bool && i < argc; i++) { r1 = e_sexp_term_eval (f, argv[i]); if (type == -1) type = r1->type; if (type != r1->type) { e_sexp_result_free (f, r); e_sexp_result_free (f, r1); g_hash_table_destroy (ht); e_sexp_fatal_error (f, "Invalid types in AND"); } else if (r1->type == ESEXP_RES_ARRAY_PTR) { gchar **a1; gint l1, j; a1 = (gchar **) r1->value.ptrarray->pdata; l1 = r1->value.ptrarray->len; for (j = 0; j < l1; j++) { gpointer ptr; gint n; ptr = g_hash_table_lookup (ht, a1[j]); n = GPOINTER_TO_INT (ptr); g_hash_table_insert (ht, a1[j], GINT_TO_POINTER (n + 1)); } } else if (r1->type == ESEXP_RES_BOOL) { bool = bool && r1->value.boolean; } e_sexp_result_free (f, r1); }
static ESExpResult * e_ews_func_and_or_not (ESExp *f, gint argc, ESExpTerm **argv, gpointer data, match_type type) { ESExpResult *r, *r1; ESoapMessage *msg; gint i; msg = (ESoapMessage *) data; /* "and" and "or" expects atleast two arguments */ if (argc == 0) goto result; if (type == MATCH_AND) { if (argc >= 2) e_soap_message_start_element (msg, "And", NULL, NULL); } else if (type == MATCH_OR) { if (argc >= 2) e_soap_message_start_element (msg, "Or", NULL, NULL); } else if (type == MATCH_NOT) e_soap_message_start_element (msg, "Not", NULL, NULL); for (i = 0; i < argc; i++) { r1 = e_sexp_term_eval (f, argv[i]); e_sexp_result_free (f, r1); } if (argc >= 2 || type == MATCH_NOT) e_soap_message_end_element (msg); result: r = e_sexp_result_new (f, ESEXP_RES_UNDEFINED); return r; }