Example #1
0
File: xml.c Project: matsuu/konoha
METHOD XmlNode_hasNext(Ctx *ctx, knh_sfp_t *sfp)
{
    xmlNodePtr node= (xmlNodePtr) p_cptr(sfp[0]);
    if(node->next) {
        KNH_RETURN_Boolean(ctx, sfp, 1);
    }
    KNH_RETURN_Boolean(ctx, sfp, 0);
}
Example #2
0
static METHOD knh__HashMap_opHas(Ctx *ctx, knh_sfp_t *sfp)
{
	HashMap *o = (HashMap*)sfp[0].o;
	knh_hcode_t hcode = knh_stack_hashCode(ctx, sfp + 1);
	knh_uintptr_t h =  hcode % DP(o)->hmax;
	knh_hashentry_t *e = DP(o)->array[h];

	while(e != NULL) {
		if(e->hcode == hcode
				&& knh_Object_cid(sfp[1].o) == knh_Object_cid(e->key)
				&& knh_stack_equals(ctx, sfp + 1, e->key)) {
			KNH_RETURN_Boolean(ctx, sfp, 1);
		}
		e = e->next;
	}
	KNH_RETURN_Boolean(ctx, sfp, 0);
}
METHOD Chardev_unregister(Ctx *ctx, knh_sfp_t *sfp)
{
	printk("%s:%d\n",__func__,__LINE__);
	knh_device_t *dev = p_cptr(sfp[0]);
#ifdef KONOHA_ON_LKM
	cdev_del(&dev->cdev);
	unregister_chrdev_region(dev->id,1);
#endif
	KNH_RETURN_Boolean(ctx, sfp, 1);
}
Example #4
0
static METHOD knh__String_endsWith__IgnoreCase(Ctx *ctx, knh_sfp_t *sfp)
{
	knh_bytes_t base = knh_String_tobytes(sfp[0].s);
	knh_bytes_t expr = knh_String_tobytes(sfp[1].s);
	int res = 0;
	if(expr.len < base.len) {
		base = knh_bytes_last(base, base.len - expr.len);
		res = (knh_bytes_strcasecmp(base, expr) == 0);
	}
	KNH_RETURN_Boolean(ctx, sfp, res);
}
Example #5
0
static METHOD knh__String_startsWith(Ctx *ctx, knh_sfp_t *sfp)
{
	KNH_RETURN_Boolean(ctx, sfp, knh_bytes_startsWith(knh_String_tobytes(sfp[0].s), knh_String_tobytes(sfp[1].s)));
}
Example #6
0
static METHOD knh__String_equals__IgnoreCase(Ctx *ctx, knh_sfp_t *sfp)
{
	KNH_RETURN_Boolean(ctx, sfp,
		((sfp[0].s)->size == (sfp[1].s)->size &&
		knh_bytes_strcasecmp(knh_String_tobytes(sfp[0].s), knh_String_tobytes(sfp[1].s))== 0));
}
Example #7
0
static
METHOD knh__Regex_opMatch(Ctx *ctx, knh_sfp_t *sfp)
{
	KNH_RETURN_Boolean(ctx, sfp, knh_String_opMatch(ctx, sfp[1].s, (Regex*)sfp[0].o));
}
Example #8
0
static METHOD knh__String_opHas(Ctx *ctx, knh_sfp_t *sfp)
{
	KNH_RETURN_Boolean(ctx, sfp, knh_bytes_indexOf(knh_String_tobytes(sfp[0].s), knh_String_tobytes(sfp[1].s)) != -1);
}
Example #9
0
METHOD knh__Script_isStmt(Ctx *ctx, knh_sfp_t *sfp)
{
	KNH_RETURN_Boolean(ctx, sfp, !(knh_bytes_checkStmtLine(knh_String_tobytes(sfp[1].s))));
}
Example #10
0
/* @method Boolean XmlReader.moveToElement() */
METHOD XmlReader_moveToElement(Ctx *ctx, knh_sfp_t *sfp)
{
    xmlTextReaderPtr reader = (xmlTextReaderPtr) p_cptr(sfp[0]);
    int ret = xmlTextReaderMoveToElement(reader);
    KNH_RETURN_Boolean(ctx,sfp,ret);
}
Example #11
0
/* @method Boolean XmlReader.getDepth() */
METHOD XmlReader_getDepth(Ctx *ctx, knh_sfp_t *sfp)
{
    xmlTextReaderPtr reader = (xmlTextReaderPtr) p_cptr(sfp[0]);
    int ret = xmlTextReaderDepth(reader);
    KNH_RETURN_Boolean(ctx,sfp,ret);
}
Example #12
0
/* @method Boolean XmlReader.hasAttributes() */
METHOD XmlReader_hasAttributes(Ctx *ctx, knh_sfp_t *sfp)
{
    xmlTextReaderPtr reader = (xmlTextReaderPtr) p_cptr(sfp[0]);
    int ret = xmlTextReaderHasAttributes(reader);
    KNH_RETURN_Boolean(ctx,sfp,ret);
}