s.insert(z, 1, '\\'); ++z;
s.insert(i, "\\"); ++i;
string demunge_ocstring(UCFunc &ucf, const FuncMap &funcmap, const string &asmstr, const vector<unsigned int> &params, const map<unsigned int, string> &intrinsics, const UCc &op, bool ucs_output){	std::strstream str;	str << std::setfill('0') << std::setbase(16);	str.setf(ios::uppercase);	size_t	len=asmstr.length();	if(len==0) return string(); // for the degenerate case	bool finished=false; // terminating details are at end-of-while	unsigned int i=0; // istr index	unsigned int width=0; // width value for setw()	if(ucs_output && opcode_table_data[op._id].flag_paren) str << '(';		while(!finished&&i<len)	{		bool special_call(false); // FIXME: <sigh> temporary exception handling for call (0x24)				char c = asmstr[i];				width = 4; // with defaults to 4				switch(c)		{			case '\\':				i++;				c = asmstr[i];				switch(c)				{					case '\\': str << '\\'; break;					case 'n':  str << '\n'; break;					case 't':  str << '\t'; break;					case '\'': str << '\''; break;					case '"':  str << '\"'; break;					case 'b':  // bell is invalid					default:   // we'll silently drop errors... it's the only "clean" way						str << '\\' << c;				}				break;			case '%':				{					i++;					c = asmstr[i];					// if it's a "byte" set width to 2, and get the next char					if(c=='b')      { i++; c = asmstr[i]; width=2; }					// if it's a "short" set width to 4, and get the next char					else if(c=='s') { i++; c = asmstr[i]; width=4; }					// if we want to output the 'decimal' value rather then the default hex					else if(c=='d')					{						i++; c = asmstr[i];						unsigned int t = charnum2uint(c);												if(t!=0)						{							assert(params.size()>=t);							str << std::setbase(10) << params[t-1] << std::setbase(16);						}						else if(c=='%')							str << '%';						break;					}					// if it's the character representation of a text data string we want					else if(c=='t')					{						bool commentformat=false;						i++; c = asmstr[i];												// if we only want to output the 'short' format of the text (comment format)						if(c=='c')						{							commentformat=true;							i++; c = asmstr[i];						}												unsigned int t = charnum2uint(c);												assert(params.size()>=t);						assert(t!=0);						string s = ucf._data.find(params[t-1])->second;												if(commentformat)							if(s.size()>17) s = s.substr(0, 17) + string("...");												// escape the appropriate characters...						// we'll only do it in the 'full' text output for the moment.						if(!commentformat)							for(string::iterator z=s.begin(); z!=s.end(); z++)								if(((*z)=='\"') || ((*z)=='\\'))								{									// Formerly:									// z= s.insert(z, 1, '\\');									// But as we all know, insert is void.									// What behaviour were we relying on?									s.insert(z, 1, '\\');									++z;								}												str << s;						break;					}					// if it's the intrinsic name we want					else if(c=='i')					{						i++; c = asmstr[i];						unsigned int t = charnum2uint(c);												assert(params.size()>=t);						assert(t!=0);						string s = intrinsics.find(params[t-1])->second;						str << s;						break;					}					// if it's external function name we want					else if(c=='f')					{						i++; c = asmstr[i];												if(c=='*')						{							if(ucf.funcname.size())							{								if(ucf.funcname[0]=='&')									str << ucf.funcname.substr(1, ucf.funcname.size()-1);								else									str << ucf.funcname;							}							else								str << "Func" << std::setw(4) << ucf._funcid;						}						else						{							unsigned int t = charnum2uint(c);														assert(ucf._externs.size()>=t);							assert(t!=0);							assert(op._params_parsed.size()>=1);														FuncMap::const_iterator fmp = funcmap.find(ucf._externs[op._params_parsed[t-1]]);							if(fmp->second.funcname.size())							{								if(fmp->second.funcname[0]=='&')									str << fmp->second.funcname.substr(1, fmp->second.funcname.size()-1);								else									str << fmp->second.funcname;							}							else								str << "Func" << std::setw(4) << ucf._externs[op._params_parsed[t-1]];						}						break;					}					// if it's the character representation of a text data string we want					else if(c=='p')					{						i++; c = asmstr[i];						unsigned int t = charnum2uint(c);												// FIXME: this is the special 'call' case, it may be a good idea to make more general						if((t==0) && (c==','))						{							special_call=true;													for(vector<UCc *>::const_iterator i=op._popped.begin(); i!=op._popped.end();)							{								str << demunge_ocstring(ucf, funcmap, opcode_table_data[(*i)->_id].ucs_nmo, (*i)->_params_parsed, intrinsics, **i, ucs_output);								if(++i!=op._popped.end())									str << ", ";							}						}												if(t!=0)						{							if(t>op._popped.size())								str << "SOMETHING_GOES_HERE()";							else							{								UCc &ucc(*op._popped[t-1]);								str << demunge_ocstring(ucf, funcmap, opcode_table_data[ucc._id].ucs_nmo, ucc._params_parsed, intrinsics, ucc, ucs_output);							}						}						break;					}										if(special_call!=true)					{						unsigned int t = charnum2uint(c);						if(t!=0)						{							assert(params.size()>=t);							str << std::setw(width) << params[t-1];						}						else if(c=='%')							str << '%';					}				}				break;			default: // it's just a character, leave it be				str << c;		}		i++;		if(i==asmstr.size()) finished=true;	}		if(ucs_output && opcode_table_data[op._id].flag_paren) str << ')';		str << std::ends;	return str.str();}