Esempio n. 1
0
bool
Matrix4D::TestClass()
{
	SPEW((GROUP_STUFF_TEST, "Starting Matrix4D test...\n"));
	SPEW((GROUP_STUFF_TEST, "  Matrix4D::TestClass() is stubbed out!"));
	return false;
}
Esempio n. 2
0
bool
	Normal3D::TestClass()
{
	SPEW((GROUP_STUFF_TEST, "Starting Normal3D Test...\n"));
	SPEW((GROUP_STUFF_TEST, "  Normal3D::TestClass() is stubbed out!\n"));
	return false;
}
Esempio n. 3
0
static ssize_t
tps6105x_attr_store_avin(struct device *dev, struct device_attribute *attr,
				const char *buf, size_t count)
{
	int rc;
	int avin;
	struct i2c_client *i2c = to_i2c_client(dev);
	struct tps6105x_client_data *data = i2c_get_clientdata(i2c);

	SPEW(1, "+++ %s: buf=%s\n", __func__, buf);

	if (!sscanf(buf, "%d", &avin)) {
		rc = -EINVAL;
		goto exit;
	}

	if ((rc = tps6105x_enable_avin(data, !!avin)))
		goto exit;

	rc = count;
exit:
	SPEW(1, "--- %s: rc=%d\n", __func__, rc);

	return (rc);
}
Esempio n. 4
0
static ssize_t
tps6105x_attribute_show(struct device *dev, struct device_attribute *_attr,
			char *buf)
{
	u8 val;
	int i;
	ssize_t rc;
	struct i2c_client *i2c = to_i2c_client(dev);
	struct tps6105x_attribute *attr = (struct tps6105x_attribute *)_attr;

	SPEW(1, "--> %s: attr=%s\n", __func__, _attr->attr.name);

	if ((rc = tps6105x_i2c_read_u8(i2c, attr->index, &val)))
		goto exit;

	for (i = 0, rc = 0; i < attr->count; ++i) {
		rc += snprintf(buf + rc, PAGE_SIZE - rc, "%s%s",
				attr->values[i].desc,
				attr->values[i].val == (attr->mask & val)
					? "* " : " ");
	}

	rc += snprintf(buf + rc, PAGE_SIZE - rc, "\n");

exit:
	SPEW(1, "<-- %s: rc=%d\n", __func__, rc);

	return (rc);
}
Esempio n. 5
0
nsresult
compzillaWindow::GetUTF8StringProperty (Atom prop, nsACString& utf8Value)
{
    SPEW ("GetUTF8StringProperty this=%p, prop=%s\n", this, XGetAtomName (mDisplay, prop));

    Atom actual_type;
    int format;
    unsigned long nitems;
    unsigned long bytes_after_return;
    unsigned char *data;

    if (XGetWindowProperty (mDisplay, 
                            mWindow, 
                            prop,
                            0,
                            BUFSIZ, 
                            false, 
                            AnyPropertyType,
                            &actual_type, 
                            &format, 
                            &nitems, 
                            &bytes_after_return, 
                            &data) != Success || 
        format == None) {
        SPEW (" + (Not Found)\n");
        return NS_ERROR_FAILURE;
    }

    if (actual_type == atoms.x.UTF8_STRING) {
        utf8Value = (char*)data;
    }
    else if (actual_type == XA_STRING) {
        char **list = NULL;
        int count;

        count = gdk_text_property_to_utf8_list (gdk_x11_xatom_to_atom (actual_type),
                                                format, data, nitems,
                                                &list);

        if (count == 0) {
            XFree (data);
            return NS_ERROR_FAILURE;
        }

        utf8Value = list[0];

        g_strfreev (list);
    }
    else {
        WARNING ("invalid type for string property '%s': '%s'\n",
                 XGetAtomName (mDisplay, prop),
                 XGetAtomName (mDisplay, actual_type));
        XFree (data);
        return NS_ERROR_FAILURE;
    }

    XFree (data);

    return NS_OK;
}
Esempio n. 6
0
bool
Ray3D::TestClass()
{
	SPEW((GROUP_STUFF_TEST, "Starting Ray3D test..."));
	SPEW((GROUP_STUFF_TEST, "  Ray3D::TestClass is stubbed out!"));
	return true;
}
Esempio n. 7
0
static PageInfo*
alloc_page_from_arena(Arena *arena, size_t cell_size)
{
    void *page_data = (void*)ALIGN(arena->pos, PAGE_SIZE);
    if (arena->free_pages) {
        PageInfo* info = arena->free_pages;
        EJS_LIST_DETACH(info, arena->free_pages);
        info->cell_size = cell_size;
        info->num_cells = CELLS_OF_SIZE(cell_size);
        info->num_free_cells = info->num_cells;
        info->bump_ptr = info->page_start;
        memset (info->page_bitmap, CELL_FREE, info->num_cells * sizeof(BitmapCell));
        SPEW(3, _ejs_log ("alloc_page_from_arena from free pages for cell size %zd = %p\n", info->cell_size, info));
        return info;
    }
    else if (page_data < arena->end) {
        PageInfo* info = alloc_page_info_from_arena (arena, page_data, cell_size);
        int page_idx = arena->num_pages++;
        arena->pos = page_data + PAGE_SIZE;
        arena->pages[page_idx] = page_data;
        arena->page_infos[page_idx] = info;
        SPEW(3, _ejs_log ("alloc_page_from_arena from bump pointer for cell size %zd = %p\n", info->cell_size, info));
        return info;
    }
    else {
        return NULL;
    }
}
Esempio n. 8
0
//
//###########################################################################
//###########################################################################
//
bool
	AffineMatrix4D::TestClass()
{
	SPEW((GROUP_STUFF_TEST, "Starting AffineMatrix4D Test..."));
	SPEW((GROUP_STUFF_TEST, "  AffineMatrix4D::TestClass() stubbed out!"));
	return false;
}
DtkShmMove::DtkShmMove() :
    ThreadedNode() 
{
    SPEW();
    // Add external route
    addExternalRoute("*", "{NamespaceLabel}/{SlotLabel}");
    SPEW();
}
Esempio n. 10
0
		//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		//
		void
			BitTrace::PrintUsage(Scalar usage)
		{
			Check_Object(this);

			SPEW((GROUP_STUFF_TRACE, "%4f%% CPU+", (usage*100.0f)));
			#if defined(USE_ACTIVE_PROFILE)
			SPEW((GROUP_STUFF_TRACE, " (active on line %d)", static_cast<int>(activeLine)));
			#endif
		}
Esempio n. 11
0
	void
		Spew(
			const char* group,
			const Sphere& sphere
		)
	{
		Check_Object(&sphere);

		SPEW((group, "\n\tSphere Centerpoint: +"));
		Spew(group, sphere.center);
		SPEW((group, "\tRadius: %f", sphere.radius));
	}
Esempio n. 12
0
	void
		Spew(
			const char* group,
			const YawPitchRange &angle
		)
	{
		SPEW((group, "<+"));
		Spew(group, angle.yaw);
		SPEW((group, ",+"));
		Spew(group, angle.pitch);
		SPEW((group, "; %f+", angle.range));
	}
Esempio n. 13
0
	template <class T> void
		Spew(
			const char* group,
			const Stuff::Vector2DOf<T> &vector
		)
	{
		Check_Object(this);
		SPEW((group, "<+"));
		Spew(group, vector.x);
		SPEW((group, ",+"));
		Spew(group, vector.y);
		SPEW((group, ">+"));
	}
Esempio n. 14
0
compzillaWindow::~compzillaWindow()
{
    NS_ASSERT_OWNINGTHREAD(compzillaWindow);

    SPEW ("~compzillaWindow %p, xid=%p\n", this, mWindow);

    Destroyed ();

    // FIXME: Do we need this?
    //UnredirectWindow ();

    SPEW ("~compzillaWindow DONE\n");
}
Esempio n. 15
0
static int
tps6105x_i2c_suspend(struct i2c_client *i2c, pm_message_t mesg)
{
	struct tps6105x_client_data *data = i2c_get_clientdata(i2c);

	SPEW(1, "--> %s: event=%d\n", __func__, mesg.event);

	if (PM_EVENT_SUSPEND == mesg.event)
		(void)tps6105x_enable_avin(data, 0);

	SPEW(1, "<-- %s\n", __func__);

	return (0);
}
Esempio n. 16
0
	void
		Spew(
			const char* group,
			const EulerAngles &angle
		)
	{
		Check_Object(&angle);
		SPEW((group, "<+"));
		Spew(group, angle.pitch);
		SPEW((group, ",+"));
		Spew(group, angle.yaw);
		SPEW((group, ",+"));
		Spew(group, angle.roll);
		SPEW((group, ">+"));
	}
Esempio n. 17
0
//
//#############################################################################
//#############################################################################
//
bool
	Degree::TestClass()
{
	SPEW((GROUP_STUFF_TEST, "Starting Degree test..."));

	const Degree a(Degrees_Per_Radian);
	Degree
		b,c;

	Radian
		r(1.0f),s;

	s = a;
	Test_Assumption(r == s);
	b = r;
	s = b;
#if 0
	Test_Assumption(r == s);
#endif
	c = Degrees_Per_Radian;
	s = c;
#if 0
	Test_Assumption(r == s);
#endif
	b = c;
	s = b;
#if 0
	Test_Assumption(r == s);
#endif

	return true;
}
Esempio n. 18
0
void
compzillaWindow::SendPendingResize ()
{
    if (mIsResizePending) {
        unsigned changeMask = 
            (mAttr.x != mPendingChanges.x ? CWX : 0) |
            (mAttr.y != mPendingChanges.y ? CWY : 0) |
            (mAttr.width != mPendingChanges.width ? CWWidth : 0) |
            (mAttr.height != mPendingChanges.height ? CWHeight : 0) | 
            (mAttr.border_width != mPendingChanges.border_width ? CWBorderWidth : 0);

        if (!changeMask) {
            mIsResizePending = false;
            return;
        }

        SPEW ("SendPendingResize: Calling XConfigureWindow (window=%p, x=%d, y=%d, "
              "width=%d, height=%d, border=%d)\n",
              mWindow, mPendingChanges.x, mPendingChanges.y, 
              mPendingChanges.width, mPendingChanges.height, 
              mPendingChanges.border_width);

        XConfigureWindow (mDisplay, mWindow, changeMask, &mPendingChanges);
    }
}
Esempio n. 19
0
void
compzillaWindow::Destroyed ()
{
    SPEW ("DestroyWindow this=%p, window=%p, observers=%d, canvases=%d\n", 
          this, mWindow, mObservers.Count(), mContentNodes.Count());

    if (mIsDestroyed)
        return;

    mIsDestroyed = true;

    // Allow a caller to remove O(N^2) behavior by removing end-to-start.
    for (PRUint32 i = mContentNodes.Count() - 1; i != PRUint32(-1); --i) {
        ConnectListeners (false, mContentNodes.ObjectAt(i));
    }
    mContentNodes.Clear ();

    // Copy the observers so list iteration is reentrant.
    nsCOMArray<compzillaIWindowObserver> observers(mObservers);
    mObservers.Clear ();

    for (PRUint32 i = observers.Count() - 1; i != PRUint32(-1); --i) {
        observers.ObjectAt(i)->Destroy ();
    }
}
Esempio n. 20
0
static int rpmcdsaVerify(pgpDig dig)
{
    int rc = 0;		/* assume failure */
pgpDigParams pubp = pgpGetPubkey(dig);
pgpDigParams sigp = pgpGetSignature(dig);
dig->pubkey_algoN = rpmcdsaPubkeyAlgo2Name(pubp->pubkey_algo);
dig->hash_algoN = rpmcdsaHashAlgo2Name(sigp->hash_algo);

    switch (pubp->pubkey_algo) {
    default:
	break;
    case PGPPUBKEYALGO_RSA:
	rc = rpmcdsaVerifyRSA(dig);
	break;
    case PGPPUBKEYALGO_DSA:
	rc = rpmcdsaVerifyDSA(dig);
	break;
    case PGPPUBKEYALGO_ELGAMAL:
#ifdef	NOTYET
	rc = rpmcdsaVerifyELG(dig);
#endif
	break;
    case PGPPUBKEYALGO_ECDSA:
	rc = rpmcdsaVerifyECDSA(dig);
	break;
    }
SPEW(!rc, rc, dig);
    return rc;
}
Esempio n. 21
0
static int rpmcdsaGenerate(pgpDig dig)
{
    int rc = 0;		/* assume failure */
pgpDigParams pubp = pgpGetPubkey(dig);
dig->pubkey_algoN = rpmcdsaPubkeyAlgo2Name(pubp->pubkey_algo);

    switch (pubp->pubkey_algo) {
    default:
	break;
    case PGPPUBKEYALGO_RSA:
	rc = rpmcdsaGenerateRSA(dig);
	break;
    case PGPPUBKEYALGO_DSA:
	rc = rpmcdsaGenerateDSA(dig);
	break;
    case PGPPUBKEYALGO_ELGAMAL:
#ifdef	NOTYET
	rc = rpmcdsaGenerateELG(dig);
#endif
	break;
    case PGPPUBKEYALGO_ECDSA:
	rc = rpmcdsaGenerateECDSA(dig);
	break;
    }
SPEW(!rc, rc, dig);
    return rc;
}
Esempio n. 22
0
void
compzillaWindow::ConnectListeners (bool connect, nsCOMPtr<nsISupports> aContent)
{
    static const nsString events[] = {
	// nsIDOMKeyListener events
	NS_LITERAL_STRING("keydown"),
	NS_LITERAL_STRING("keyup"),
	// "keypress",

	// nsIDOMMouseListener events
	NS_LITERAL_STRING("mousedown"),
	NS_LITERAL_STRING("mouseup"),
	NS_LITERAL_STRING("mouseover"),
	NS_LITERAL_STRING("mouseout"),
	NS_LITERAL_STRING("mousein"),
	// "click",
	// "dblclick",

	// nsIDOMUIListener events
	// "activate",
	NS_LITERAL_STRING("focusin"),
	NS_LITERAL_STRING("focusout"),
        NS_LITERAL_STRING("DOMFocusIn"),
        NS_LITERAL_STRING("DOMFocusOut"),
        NS_LITERAL_STRING("resize"),

	// HandleEvent events
	NS_LITERAL_STRING("focus"),
	NS_LITERAL_STRING("blur"),
	NS_LITERAL_STRING("mousemove"),
	NS_LITERAL_STRING("DOMMouseScroll"),

        nsString() // Must be last element
    };

    nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface (aContent);
    nsCOMPtr<nsIDOMEventListener> listener = 
	do_QueryInterface (NS_ISUPPORTS_CAST (nsIDOMKeyListener *, this));

    if (!target || !listener) {
        SPEW ("ConnectListeners: Trying to %s invalid listener!\n",
              connect ? "connect" : "disconnect");
	return;
    }

    // Consider using ByIID in the future
    /*
    target->AddEventListenerByIID (listener, NS_GET_IID(nsIDOMKeyListener));
    target->AddEventListenerByIID (listener, NS_GET_IID(nsIDOMMouseListener));
    target->AddEventListenerByIID (listener, NS_GET_IID(nsIDOMUIListener));
    */

    for (int i = 0; !events [i].IsEmpty (); i++) {
	if (connect) {
	    target->AddEventListener (events [i], listener, PR_FALSE);
	} else {
	    target->RemoveEventListener (events [i], listener, PR_FALSE);
	}
    }
}
Esempio n. 23
0
		//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		//
		void
			Trace::PrintUsage(Scalar usage)
		{
			Check_Object(this);

			SPEW((GROUP_STUFF_TRACE, "%f+", usage));
		}
Esempio n. 24
0
bool
	Random::TestClass()
{
	SPEW((GROUP_STUFF_TEST, "Starting Random::Instance test..."));

#define RANDOM_TEST_COUNT 10000

	int i;
	for (i=0; i<RANDOM_TEST_COUNT; ++i)
	{
		Scalar r = Random::Instance->GetFraction();
		Test_Assumption(r >= 0.0f && r < 1.0f);
	}

	int array[10];
	for (i = 0; i<ELEMENTS(array); ++i)
	{
		array[i] = 0;
	}

	for (i = 0; i<RANDOM_TEST_COUNT; ++i)
	{
		int r = Random::Instance->GetLessThan(ELEMENTS(array));
		Test_Assumption(r >= 0 && r < ELEMENTS(array));
		++array[r];
	}

	return true;
}
Esempio n. 25
0
NS_IMETHODIMP
compzillaWindow::AddContentNode (nsIDOMHTMLCanvasElement* aContent)
{
    SPEW ("AddContentNode this=%p, canvas=%p\n", this, aContent);

    if (mIsDestroyed)
        return NS_ERROR_FAILURE;

    nsCOMPtr<compzillaIRenderingContextInternal> internal;
    nsresult rv = aContent->GetContext (NS_LITERAL_STRING ("compzilla"), 
                                        getter_AddRefs (internal));
    if (NS_FAILED (rv))
        return rv;
    if (!internal)
        return NS_ERROR_FAILURE;

    mContentNodes.AppendObject (aContent);
    ConnectListeners (true, aContent);

    aContent->SetWidth (mAttr.width);
    aContent->SetHeight (mAttr.height);

    /* when initially adding a content node, we need to force a redraw
       to that node if we have an existing pixmap. */
    if (mPixmap) {
        XRectangle r;
        r.x = r.y = 0;
        r.width = mAttr.width;
        r.height = mAttr.height;

        RedrawContentNode (aContent, &r);
    }

    return NS_OK;
}
Esempio n. 26
0
static
int rpmltcSetDSA(/*@only@*/ DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
	/*@modifies dig @*/
{
    rpmltc ltc = dig->impl;
    int rc;
    int xx;
pgpDigParams pubp = pgpGetPubkey(dig);
dig->pubkey_algoN = rpmltcPubkeyAlgo2Name(pubp->pubkey_algo);
dig->hash_algoN = rpmltcHashAlgo2Name(sigp->hash_algo);

assert(sigp->hash_algo == rpmDigestAlgo(ctx));

    /* Set DSA hash. */
/* XXX FIXME: should this lazy free be done elsewhere? */
ltc->digest = _free(ltc->digest);
ltc->digestlen = 0;
    xx = rpmDigestFinal(ctx, (void **)&ltc->digest, &ltc->digestlen, 0);

    /* Compare leading 16 bits of digest for quick check. */
    rc = memcmp(ltc->digest, sigp->signhash16, sizeof(sigp->signhash16));

SPEW(0, !rc, dig);
    return rc;
}
Esempio n. 27
0
static
int rpmltcSignDSA(pgpDig dig)
	/*@*/
{
    rpmltc ltc = dig->impl;
    int rc = 0;		/* assume failure */
int xx;

if (ltc->digest == NULL || ltc->digestlen == 0) goto exit;

    _initBN(ltc->r);
    _initBN(ltc->s);
    rc = rpmltcErr(ltc, "dsa_sign_hash_raw",
		dsa_sign_hash_raw(ltc->digest, ltc->digestlen, ltc->r, ltc->s,
			&yarrow_prng, find_prng("yarrow"), &ltc->dsa));

#ifdef	DYING
rpmltcDumpDSA(__FUNCTION__, ltc);
#endif

    rc = (rc == CRYPT_OK);

exit:
SPEW(!rc, rc, dig);

    return rc;
}
Esempio n. 28
0
static
int rpmltcGenerateDSA(pgpDig dig)
	/*@*/
{
    rpmltc ltc = dig->impl;
    int rc = 0;		/* assume failure. */
int xx;
int _group_size;
int _modulus_size;

if (ltc->qbits == 0) ltc->qbits = 160;	/* XXX FIXME */
if (ltc->nbits == 0) ltc->nbits = 1024;	/* XXX FIXME */

_group_size = ltc->qbits/8;
_modulus_size = ltc->nbits/8;

    xx = rpmltcErr(ltc, "dsa_make_key",
		dsa_make_key(&yarrow_prng, find_prng("yarrow"),
			_group_size, _modulus_size, &ltc->dsa));
#ifdef	NOTYET
    xx = rpmltcErr(ltc, "dsa_verify_key",
		dsa_verify_key(&ltc->dsa, &rc));
#else
    rc = (xx == CRYPT_OK);
#endif
#ifdef	DYING
rpmltcDumpDSA(__FUNCTION__, ltc);
#endif

SPEW(!rc, rc, dig);

    return rc;
}
Esempio n. 29
0
static
int rpmltcVerifyECDSA(pgpDig dig)
	/*@*/
{
    rpmltc ltc = dig->impl;
    int rc = 0;		/* assume failure. */
unsigned char sig[2048];
unsigned long siglen = sizeof(sig);
int xx;

if (ltc->digest == NULL || ltc->digestlen == 0) goto exit;
if (ltc->r == NULL || ltc->s == NULL) goto exit;

#ifdef	DYING
rpmltcDumpECDSA(__FUNCTION__, ltc);
#endif

    xx = der_encode_sequence_multi(sig, &siglen,
			LTC_ASN1_INTEGER, 1UL, ltc->r,
			LTC_ASN1_INTEGER, 1UL, ltc->s,
			LTC_ASN1_EOL, 0UL, NULL);

    xx = rpmltcErr(ltc, "ecc_verify_hash",
		ecc_verify_hash(sig, siglen,
			ltc->digest, ltc->digestlen, &rc, &ltc->ecdsa));

exit:
SPEW(!rc, rc, dig);
    return rc;
}
Esempio n. 30
0
static
int rpmltcSignECDSA(pgpDig dig)
	/*@*/
{
    rpmltc ltc = dig->impl;
    int rc = 0;		/* assume failure. */
unsigned char sig[2048];
unsigned long siglen = sizeof(sig);

if (ltc->digest == NULL || ltc->digestlen == 0) goto exit;

    rc = rpmltcErr(ltc, "ecc_sign_hash",
		ecc_sign_hash(ltc->digest, ltc->digestlen, sig, &siglen,
			&yarrow_prng, find_prng ("yarrow"), &ltc->ecdsa));
    if (rc == CRYPT_OK) {
	int xx;
	_initBN(ltc->r);
	_initBN(ltc->s);
	xx = der_decode_sequence_multi(sig, siglen,
				LTC_ASN1_INTEGER, 1UL, ltc->r,
				LTC_ASN1_INTEGER, 1UL, ltc->s,
				LTC_ASN1_EOL, 0UL, NULL);
    }
    rc = (rc == CRYPT_OK);

#ifdef	DYING
rpmltcDumpECDSA(__FUNCTION__, ltc);
#endif

exit:
SPEW(!rc, rc, dig);
    return rc;
}