creating and returning an object from an external method

XPE::TOKEN XPE_FRAME::extract_coord( XPE::SREF xpe_this, int cnt, XPE::TOKEN arr[] )
{
	// return a structure containing x1, y1, x2, y2
	// taken from the structure to which this method
	// was applied
	//
	// val.x1 = 3
	// val.y1 = 4
	// val.x2 = 8
	// val.y2 = 9
	//
	// res = val.extract_coord()

	XPE::STRUCTURE
		res;

	*res.get_member("x1") = xpe_this.get_member("x1");
	*res.get_member("y1") = xpe_this.get_member("y1");
	*res.get_member("x2") = xpe_this.get_member("x2");
	*res.get_member("y2") = xpe_this.get_member("y2");

	return res;
}

for efficiency use the get_member(const SYMBOL *) version of get_member instead of the get_member(const char *) version:

e.g.

	XPE::SYMBOL   x1_symb("x1");

	*res.get_member(x1_symb)  =  xpe_this.get_member(x1_symb);

this causes the "x1" symbol to be constructed just once regardless of the number of times it is used.

however if the code is executed infrequently then there is not much to be gained from the added complexity and the get_member(const char *) version is prefered.