
		Tcl_IncrRefCount(tObj);
		Tcl_AppendStringsToObj(tObj, tclCode, NULL);
		/*
		 * This is unusual - even strings failing parsing return ok (and
		 * create a bytecode object detailing the error)
		 */
		if (Tcl_ConvertToType(interp, tObj, tBcType)!= TCL_OK) {
			Tcl_DecrRefCount(tObj);
			PyErr_SetString(PyExc_RuntimeError,
				"failed to convert to tcl bytecode");
			return NULL;
		}
	} else if (tclObjPtr!= 0) {
		/*
		 * This is pretty dangerous, we get a raw pointer and just take
		 * it on faith that it points to a Tcl_Obj
		 */
		tObj = (Tcl_Obj *)tclObjPtr;
		/* TODO: are we allowed to access typePtr directly? */
		if (tObj->typePtr!= tBcType) {
			PyErr_SetString(PyExc_RuntimeError,
				"pointer doesn't point to Tcl_Obj of bytecode");
			return NULL;
		}
		Tcl_IncrRefCount(tObj);
	} else {
		PyErr_SetString(PyExc_RuntimeError,
			"must pass an argument to obtain bytecode from");
		return NULL;
	}

	/*
	 * In 8.6 this changed to tObj->internalRep.twoPtrValue.ptr1. In practice,
	 * this has no effect because of the way the structs are arranged. ptr2 is
	 * currently unused by bytecode tcl objects.
	 */
	ByteCode *bc = tObj->internalRep.otherValuePtr;
<commit_msg>Move code for getting bc into another function<commit_after>#include <Python.h>
#include <tcl.h>
#include <tclCompile.h>
#include "tcl_bcutil.c"

static Tcl_Interp *interp;
static const Tcl_ObjType *tBcType;

static Tcl_Obj *getbc(char* tclCode, Py_ssize_t tclObjPtr) {
	/*
	 * Assumed defaults:
	 * char *tclCode = NULL;
	 * Py_ssize_t tclObjPtr = 0;
	 */

	Tcl_Obj *tObj;

	if (tclCode!= NULL) {
		tObj = Tcl_NewObj();
		Tcl_IncrRefCount(tObj);
		Tcl_AppendStringsToObj(tObj, tclCode, NULL);
		/*
		 * This is unusual - even strings failing parsing return ok (and
		 * create a bytecode object detailing the error)
		 */
		if (Tcl_ConvertToType(interp, tObj, tBcType)!= TCL_OK) {
			Tcl_DecrRefCount(tObj);
			PyErr_SetString(PyExc_RuntimeError,
				"failed to convert to tcl bytecode");
			return NULL;
		}
	} else if (tclObjPtr!= 0) {
		/*
		 * This is pretty dangerous, we get a raw pointer and just take
		 * it on faith that it points to a Tcl_Obj
		 */
		tObj = (Tcl_Obj *)tclObjPtr;
		/* TODO: are we allowed to access typePtr directly? */
		if (tObj->typePtr!= tBcType) {
			PyErr_SetString(PyExc_RuntimeError,
				"pointer doesn't point to Tcl_Obj of bytecode");
			return NULL;
		}
		Tcl_IncrRefCount(tObj);
	} else {
		PyErr_SetString(PyExc_RuntimeError,
			"must pass an argument to obtain bytecode from");
		return NULL;
	}

	return tObj;
}

static PyObject *
tcldis_printbc(PyObject *self, PyObject *args, PyObject *kwargs)
{
	static char *kwlist[] = {"tcl_code", NULL};
	char *tclCode;

	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s", kwlist, &tclCode))
		return NULL;

	Tcl_Obj *tObj = Tcl_NewObj();
	Tcl_IncrRefCount(tObj);
	Tcl_AppendStringsToObj(tObj, tclCode, NULL);

	/*
	 * This is unusual - even strings failing parsing return ok (and
	 * create a bytecode object detailing the error)
	 */
	if (Tcl_ConvertToType(interp, tObj, tBcType)!= TCL_OK) {
		PyErr_SetString(PyExc_RuntimeError,
			"failed to convert to tcl bytecode");
		return NULL;
	}

	Tcl_Obj *tStr = TclDisassembleByteCodeObj(tObj);
	Tcl_IncrRefCount(tStr);

	/* If this errors we'll return NULL anyway, don't check explicitly */
	char *str;
	int strsize;
	str = Tcl_GetStringFromObj(tStr, &strsize);
	PyObject *pStr = PyString_FromStringAndSize(str, strsize);

	Tcl_DecrRefCount(tStr);
	Tcl_DecrRefCount(tObj);
	return pStr;
}

static PyObject *
tcldis_getbc(PyObject *self, PyObject *args, PyObject *kwargs)
{
	static char *kwlist[] = {"tcl_code", "tclobj_ptr", NULL};
	char *tclCode = NULL;
	Py_ssize_t tclObjPtr = 0;

	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|sn", kwlist,
			&tclCode, &tclObjPtr))
		return NULL;

	Tcl_Obj *tObj = getbc(tclCode, tclObjPtr);
	if (tObj == NULL)
		return NULL;

	/*
	 * In 8.6 this changed to tObj->internalRep.twoPtrValue.ptr1. In practice,
	 * this has no effect because of the way the structs are arranged. ptr2 is
	 * currently unused by bytecode tcl objects.
	 */
	ByteCode *bc = tObj->internalRep.otherValuePtr;
LSEE-Research on South East Europe is currently accepting applications for Visiting Fellows and Visiting Senior Fellows by academics or policy practitioners who may want to spend time at the LSE to conduct independent research on a topic relevant to the work of the LSEE.
Applications are invited for submission to Euroinst.LSEE@lse.ac.uk by the deadline of 2 November 2012 at 5pm.
For application guidelines and for information on what documents are required to apply, please click here.- Descripción
DetallesThe Marian Gems Desk Calendar is Fr. Donald Calloway's Marian Gems in desk calendar format. It will be in constant view and invite you to meditate upon each of the gems and their deeper implications for your spiritual journey each day.
- Additional Information
Additional Information
- ReseñasMen's Wear, Women's Wear
If you know me, you know that I'm very into men's clothing. You might remeber a post I posted about a year ago, also about men's wear. Well, I was a men's wear rookie then, so let's call that post "men's wear for begginers". I don't know when the appeal started or why - perhaps it's about the sharp tailoring and elegance they radiate, the oversize look they give, or merely the fact that in modern times, we have freedom to wear whatever we like. There are no boundries or extremly strict rules. Quite the opposite, in fact. Gender bending is huge (take Gigi's and Zayn's August '17 Vogue cover). It's more than huge. It's a part of a new generation, a generation that breaks rules and has no fear. How I'm glad to be a part of this generation.
Don't get me wrong, I love being feminine. But Being feminine comes in many different ways. Femininity is being strong, powerful. Wear something that makes you feel confident - and you're feminine.
My mother was always dreading the day I would grow up and start raiding her closet. Lucky for her, that day never came. Instead, I raid my father's closet - concentraiting on polo shirts. LOVE me a good polo shirt. Button down's welcome too. It has gotten to the point my father now buys "us" polo shirts. What's better than that?
Hello!
I hope you all had a wonderful Thanksgiving and enjoyed some time off