コード例 #1
0
ファイル: op_svget.c プロジェクト: ChristopherEdwards/fis-gtm
void op_svget(int varnum, mval *v)
{
	io_log_name	*tl;
	int 		count;
	gtm_uint64_t	ucount;
	char		*c1, *c2;
	mval		*mvp;
#	ifdef UNIX
	d_rm_struct	*d_rm;
#	endif
	DCL_THREADGBL_ACCESS;

	SETUP_THREADGBL_ACCESS;
#	if defined(UNIX) && defined(DEBUG)
	if (gtm_white_box_test_case_enabled && (WBTEST_HUGE_ALLOC == gtm_white_box_test_case_number))
	{
		if (1 == gtm_white_box_test_case_count)
			totalAlloc = totalAllocGta = totalRmalloc = totalRallocGta = totalUsed = totalUsedGta = 0xffff;
		else if (2 == gtm_white_box_test_case_count)
			totalAlloc = totalAllocGta = totalRmalloc = totalRallocGta = totalUsed = totalUsedGta = 0xfffffff;
		else if (3 == gtm_white_box_test_case_count)
		{
#			ifdef GTM64
			if (8 == SIZEOF(size_t))
				totalAlloc = totalAllocGta = totalRmalloc = totalRallocGta
					= totalUsed = totalUsedGta = 0xfffffffffffffff;
			else
#			endif
				totalAlloc = totalAllocGta = totalRmalloc = totalRallocGta = totalUsed = totalUsedGta = 0xfffffff;
		} else
			totalAlloc = totalAllocGta = totalRmalloc = totalRallocGta = totalUsed
				= totalUsedGta = GTM64_ONLY(SIZEOF(size_t)) NON_GTM64_ONLY(SIZEOF(size_t) > 4 ? 4 : SIZEOF(size_t));
	}
#	endif
	switch (varnum)
	{
		case SV_HOROLOG:
			op_horolog(v);
			break;
		case SV_ZGBLDIR:
			v->mvtype = MV_STR;
			v->str = dollar_zgbldir.str;
			break;
		case SV_PRINCIPAL:
			tl = dollar_principal ? dollar_principal : io_root_log_name->iod->trans_name;
			v->str.addr = tl->dollar_io;
			v->str.len = tl->len;
			/*** The following should be in the I/O code ***/
			if (ESC == *v->str.addr)
			{
				if (5 > v->str.len)
					v->str.len = 0;
				else
				{
					v->str.addr += ESC_OFFSET;
					v->str.len -= ESC_OFFSET;
				}
			}
			s2pool(&(v->str));
			v->mvtype = MV_STR;
			break;
		case SV_ZIO:
			v->mvtype = MV_STR;
			/* NOTE:	This is **NOT** equivalent to :
			 *		io_curr_log_name->dollar_io
			 */
			v->str.addr = io_curr_device.in->trans_name->dollar_io;
			v->str.len = io_curr_device.in->trans_name->len;
			if (ESC == *v->str.addr)
			{
				if (5 > v->str.len)
					v->str.len = 0;
				else
				{
					v->str.addr += ESC_OFFSET;
					v->str.len -= ESC_OFFSET;
				}
			}
			s2pool(&(v->str));
			break;
		case SV_JOB:
			*v = dollar_job;
			break;
		case SV_REFERENCE:
			get_reference(v);
			break;
		case SV_SYSTEM:
			*v = dollar_system;
			break;
		case SV_STORAGE:
			/* double2mval(v, getstorage()); Causes issues with unaligned stack on x86_64 - remove until fixed */
			i2mval(v, getstorage());
			break;
		case SV_TLEVEL:
			count = (int)dollar_tlevel;
			MV_FORCE_MVAL(v, count);
			break;
		case SV_TRESTART:
			MV_FORCE_MVAL(v, (int)((MAX_VISIBLE_TRESTART < dollar_trestart) ? MAX_VISIBLE_TRESTART : dollar_trestart));
			break;
		case SV_X:
			count = (int)io_curr_device.out->dollar.x;
			MV_FORCE_MVAL(v, count);
			break;
		case SV_Y:
			count = (int)io_curr_device.out->dollar.y;
			MV_FORCE_MVAL(v, count);
			break;
		case SV_ZA:
			count = (int)io_curr_device.in->dollar.za;
			MV_FORCE_MVAL(v, count);
			break;
		case SV_ZB:
			c1 = (char *)io_curr_device.in->dollar.zb;
			c2 = c1 + SIZEOF(io_curr_device.in->dollar.zb);
			ENSURE_STP_FREE_SPACE(SIZEOF(io_curr_device.in->dollar.zb));
			v->mvtype = MV_STR;
			v->str.addr = (char *)stringpool.free;
			while (c1 < c2 && *c1)
				*stringpool.free++ = *c1++;
			v->str.len = INTCAST((char *)stringpool.free - v->str.addr);
			break;
		case SV_ZC:	/****THESE ARE DUMMY VALUES ONLY!!!!!!!!!!!!!!!!!****/
			MV_FORCE_MVAL(v, 0);
			break;
		case SV_ZCMDLINE:
			get_command_line(v, TRUE);	/* TRUE to indicate we want $ZCMDLINE
							   (i.e. processed not actual command line) */
			break;
		case SV_ZEOF:
#			ifdef UNIX
			if (rm == io_curr_device.in->type)
			{
				d_rm = (d_rm_struct *)io_curr_device.in->dev_sp;
				if (RM_READ != d_rm->lastop)
				{
					*v = literal_zero;
					break;
				}
			}
#			endif
			*v = io_curr_device.in->dollar.zeof ? literal_one : literal_zero;
			break;
		case SV_ZQUIT:
			*v = dollar_zquit_anyway ? literal_one : literal_zero;
			break;
		case SV_IO:
			v->str.addr = io_curr_device.in->name->dollar_io;
			v->str.len = io_curr_device.in->name->len;
			/*** The following should be in the I/O code ***/
			if (ESC == *v->str.addr)
			{
				if (5 > v->str.len)
					v->str.len = 0;
				else
				{
					v->str.addr += ESC_OFFSET;
					v->str.len -= ESC_OFFSET;
				}
			}
			s2pool(&(v->str));
			v->mvtype = MV_STR;
			break;
		case SV_PROMPT:
			v->mvtype = MV_STR;
			v->str.addr = (TREF(gtmprompt)).addr;
			v->str.len = (TREF(gtmprompt)).len;
			s2pool(&v->str);
			break;
		case SV_ZCOMPILE:
			v->mvtype = MV_STR;
			v->str = TREF(dollar_zcompile);
			s2pool(&(v->str));
			break;
		case SV_ZDIR:
			setzdir(NULL, v);
			if (v->str.len != dollar_zdir.str.len || 0 != memcmp(v->str.addr, dollar_zdir.str.addr, v->str.len))
				gtm_putmsg_csa(CSA_ARG(NULL) VARLSTCNT(6) ERR_ZDIROUTOFSYNC, 4, v->str.len, v->str.addr,
					   dollar_zdir.str.len, dollar_zdir.str.addr);
			SKIP_DEVICE_IF_NOT_NEEDED(v);
			s2pool(&(v->str));
			break;
		case SV_ZSTEP:
			*v = dollar_zstep;
			break;
		case SV_ZMODE:
			*v = TREF(dollar_zmode);
			break;
		case SV_ZMAXTPTIME:
			i2mval(v, TREF(dollar_zmaxtptime));
			break;
		case SV_ZPOS:
			getzposition(v);
			break;
		case SV_ZPROC:
			getzprocess();
			*v = dollar_zproc;
			break;
		case SV_ZLEVEL:
			count = dollar_zlevel();
			MV_FORCE_MVAL(v, count);
			break;
		case SV_ZROUTINES:
			if (!TREF(zro_root))
				zro_init();
			v->mvtype = MV_STR;
			v->str = TREF(dollar_zroutines);
			s2pool(&(v->str));
			break;
		case SV_ZSOURCE:
			v->mvtype = MV_STR;
			v->str = dollar_zsource.str;
			break;
		case SV_ZSTATUS:
			*v = dollar_zstatus;
			s2pool(&(v->str));
			break;
		case SV_ZTRAP:
			v->mvtype = MV_STR;
			v->str = dollar_ztrap.str;
			assert(!v->str.len || !ztrap_explicit_null);
			s2pool(&(v->str));
			break;
		case SV_DEVICE:
			get_dlr_device(v);
			break;
		case SV_KEY:
			get_dlr_key(v);
			break;
		case SV_ZVERSION:
			v->mvtype = MV_STR;
			v->str.addr = (char *)gtm_release_name;
			v->str.len = gtm_release_name_len;
			break;
		case SV_ZSYSTEM:
			MV_FORCE_MVAL(v, dollar_zsystem);
			break;
		case SV_ZCSTATUS:
			/* Maintain the external $ZCSTATUS == 1 for SUCCESS on UNIX while internal good is 0 */
			MV_FORCE_MVAL(v, UNIX_ONLY((0 == TREF(dollar_zcstatus)) ? 1 : ) TREF(dollar_zcstatus));
			break;
		case SV_ZEDITOR:
			MV_FORCE_MVAL(v, dollar_zeditor);
			break;
		case SV_QUIT:
			MV_FORCE_MVAL(v, dollar_quit());
			break;
		case SV_ECODE:
			ecode_get(-1, v);
			break;
		case SV_ESTACK:
			count = (dollar_zlevel() - 1) - dollar_estack_delta.m[0];
			MV_FORCE_MVAL(v, count);
			break;
		case SV_ETRAP:
			v->mvtype = MV_STR;
			v->str = dollar_etrap.str;
			assert(!v->str.len || !ztrap_explicit_null);
			s2pool(&(v->str));
			break;
		case SV_STACK:
			count = (dollar_zlevel() - 1);
			MV_FORCE_MVAL(v, count);
			break;
		case SV_ZERROR:
			v->mvtype = MV_STR;
			v->str = dollar_zerror.str;
			s2pool(&(v->str));
			break;
		case SV_ZYERROR:
			v->mvtype = MV_STR;
			v->str = dollar_zyerror.str;
			s2pool(&(v->str));
			break;
		case SV_ZINTERRUPT:
			v->mvtype = MV_STR;
			v->str = dollar_zinterrupt.str;
			s2pool(&(v->str));
			break;
		case SV_ZININTERRUPT:
			MV_FORCE_MVAL(v, dollar_zininterrupt);
			break;
		case SV_ZJOB:
			MV_FORCE_UMVAL(v, dollar_zjob);
			break;
		case SV_ZDATE_FORM:
			MV_FORCE_MVAL(v, TREF(zdate_form));
			break;
		case SV_ZTEXIT:
			*v = dollar_ztexit;
			break;
		case SV_ZALLOCSTOR:
			ucount = (gtm_uint64_t)totalAlloc + (gtm_uint64_t)totalAllocGta;
			ui82mval(v, ucount);
			break;
		case SV_ZREALSTOR:
			ucount = (gtm_uint64_t)totalRmalloc + (gtm_uint64_t)totalRallocGta;
			ui82mval(v, ucount);
			break;
		case SV_ZUSEDSTOR:
			ucount = (gtm_uint64_t)totalUsed + (gtm_uint64_t)totalUsedGta;
			ui82mval(v, ucount);
			break;
		case SV_ZCHSET:
			v->mvtype = MV_STR;
			v->str = dollar_zchset;
			break;
		case SV_ZPATNUMERIC:
			v->mvtype = MV_STR;
			v->str = dollar_zpatnumeric;
			break;
		case SV_ZTNAME:
		case SV_ZTCODE:		/* deprecated */
#			ifdef GTM_TRIGGER
			if (NULL == dollar_ztname)
				memcpy(v, &literal_null, SIZEOF(mval));
			else
			{
				v->mvtype = MV_STR;
				v->str.addr = dollar_ztname->addr;
				v->str.len = dollar_ztname->len;
			}
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZTDATA:
#			ifdef GTM_TRIGGER
			/* Value comes from GT.M, but it might be numeric and need conversion to a string */
			assert(!dollar_ztdata || MV_DEFINED(dollar_ztdata));
			if (NULL != dollar_ztdata)
				MV_FORCE_STR(dollar_ztdata);
			memcpy(v, (NULL != dollar_ztdata) ? dollar_ztdata : &literal_null, SIZEOF(mval));
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZTDELIM:
#			ifdef GTM_TRIGGER
			assert(!dollar_ztdelim || MV_DEFINED(dollar_ztdelim));
			if (NULL == dollar_ztdelim || !(MV_STR & dollar_ztdelim->mvtype) || (0 == dollar_ztdelim->str.len))
				memcpy(v, &literal_null, SIZEOF(mval));
			else
				memcpy(v, dollar_ztdelim, SIZEOF(mval));
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZTOLDVAL:
#			ifdef GTM_TRIGGER
			/* Value comes from GT.M, but it might be numeric and need conversion to a string */
			assert(!dollar_ztoldval || MV_DEFINED(dollar_ztoldval));
			if (NULL != dollar_ztoldval)
				MV_FORCE_STR(dollar_ztoldval);
			memcpy(v, (NULL != dollar_ztoldval) ? dollar_ztoldval : &literal_null, SIZEOF(mval));
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZTRIGGEROP:
#			ifdef GTM_TRIGGER
			/* Value comes from GT.M, but assert it's a string */
			assert(!dollar_ztriggerop || (MV_STR & dollar_ztriggerop->mvtype));
			memcpy(v, (NULL != dollar_ztriggerop) ? dollar_ztriggerop : &literal_null, SIZEOF(mval));
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZTUPDATE:
#			ifdef GTM_TRIGGER
			/* Value comes from GT.M, but if there were no delims involved, the value will be undefined, and
			 * we return a "literal_null".
			 */
			memcpy(v, ((NULL != dollar_ztupdate && (MV_STR & dollar_ztupdate->mvtype)) ? dollar_ztupdate
				   : &literal_null), SIZEOF(mval));
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZTVALUE:
#			ifdef GTM_TRIGGER
			/* Value comes from user-land so make sure things are proper */
			assert(!dollar_ztvalue || MV_DEFINED(dollar_ztvalue));
			if (NULL != dollar_ztvalue)
				MV_FORCE_STR(dollar_ztvalue);
			memcpy(v, (NULL != dollar_ztvalue) ? dollar_ztvalue : &literal_null, SIZEOF(mval));
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZTWORMHOLE:
#			ifdef GTM_TRIGGER
			/* Value comes from user-land so make sure things are proper */
			mvp = &dollar_ztwormhole;
			if (MV_DEFINED(mvp))
			{
				MV_FORCE_STR(mvp);
				memcpy(v, mvp, SIZEOF(mval));
			} else
				memcpy(v, &literal_null, SIZEOF(mval));
			ztwormhole_used = TRUE;
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZTSLATE:
#			ifdef GTM_TRIGGER
			/* Value comes from user-land so make sure things are proper */
			assert(MV_DEFINED((&dollar_ztslate)));
			mvp = &dollar_ztslate;
			MV_FORCE_STR(mvp);
			memcpy(v, mvp, SIZEOF(mval));
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZTLEVEL:
#			ifdef GTM_TRIGGER
			MV_FORCE_MVAL(v, gtm_trigger_depth);
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZONLNRLBK:
#			ifdef UNIX
			count = TREF(dollar_zonlnrlbk);
			MV_FORCE_MVAL(v, count);
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZCLOSE:
#			ifdef UNIX
			count = TREF(dollar_zclose);
			MV_FORCE_MVAL(v, count);
			break;
#			else
			rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP);
#			endif
		case SV_ZKEY:
			get_dlr_zkey(v);
			break;
		default:
			assertpro(FALSE);
	}
}
コード例 #2
0
ファイル: zshow_svn.c プロジェクト: h4ck3rm1k3/FIS-GT.M
void zshow_svn(zshow_out *output)
{
	mstr		x;
	mval		var, zdir;
	io_log_name	*tl;
       	stack_frame	*fp;
	int 		count, save_dollar_zlevel;
	char		*c1, *c2;
	char		zdir_error[3 * GTM_MAX_DIR_LEN + 128]; /* PATH_MAX + "->" + GTM-W-ZDIROUTOFSYNC, <text of ZDIROUTOFSYNC> */

	error_def(ERR_ZDIROUTOFSYNC);

	/* SV_DEVICE */
		get_dlr_device(&var);
		ZS_VAR_EQU(&x, device_text);
		mval_write(output, &var, TRUE);
	/* SV_ECODE */
		ecode_get(-1, &var);
		ZS_VAR_EQU(&x, ecode_text);
		mval_write(output, &var, TRUE);
	/* SV_ESTACK */
		save_dollar_zlevel = dollar_zlevel();
		count = (save_dollar_zlevel - 1) - dollar_estack_delta.m[0];
		MV_FORCE_MVAL(&var, count);
		ZS_VAR_EQU(&x, estack_text);
		mval_write(output, &var, TRUE);
	/* SV_ETRAP */
		var.mvtype = MV_STR;
		var.str = dollar_etrap.str;
		ZS_VAR_EQU(&x, etrap_text);
		mval_write(output, &var, TRUE);
	/* SV_HOROLOG */
		op_horolog(&var);
		ZS_VAR_EQU(&x, horolog_text);
		mval_write(output, &var, TRUE);
	/* SV_IO */
		var.str.addr = io_curr_device.in->name->dollar_io;
		var.str.len = io_curr_device.in->name->len;
		/*** The following should be in the I/O code ***/
		if (ESC == *var.str.addr)
		{
			if (5 > var.str.len)
				var.str.len = 0;
			else
			{
				var.str.addr += ESC_OFFSET;
				var.str.len -= ESC_OFFSET;
			}
		}
		var.mvtype = MV_STR;
		ZS_VAR_EQU(&x, io_text);
		mval_write(output, &var, TRUE);
	/* SV_JOB */
		ZS_VAR_EQU(&x, job_text);
		mval_write(output, &dollar_job, TRUE);
	/* SV_KEY */
		get_dlr_key(&var);
		ZS_VAR_EQU(&x, key_text);
		mval_write(output, &var, TRUE);
	/* SV_PRINCIPAL */
		if (dollar_principal)
			tl = dollar_principal;
		else
			tl = io_root_log_name->iod->trans_name;
		var.str.addr = tl->dollar_io;
		var.str.len = tl->len;
		/*** The following should be in the I/O code ***/
		if (ESC == *var.str.addr)
		{
			if (5 > var.str.len)
				var.str.len = 0;
			else
			{
				var.str.addr += ESC_OFFSET;
				var.str.len -= ESC_OFFSET;
			}
		}
		var.mvtype = MV_STR;
		ZS_VAR_EQU(&x, principal_text);
		mval_write(output, &var, TRUE);
	/* SV_QUIT */
		count = ((NULL == get_ret_targ()) ? 0 : 1);
		MV_FORCE_MVAL(&var, count);
		ZS_VAR_EQU(&x, quit_text);
		mval_write(output, &var, TRUE);
	/* SV_REFERENCE */
		get_reference(&var);
		ZS_VAR_EQU(&x, reference_text);
		mval_write(output, &var, TRUE);
	/* SV_STACK */
		count = (save_dollar_zlevel - 1);
		MV_FORCE_MVAL(&var, count);
		ZS_VAR_EQU(&x, stack_text);
		mval_write(output, &var, TRUE);
	/* SV_STORAGE */
		i2mval(&var, getstorage());
		ZS_VAR_EQU(&x, storage_text);
		mval_write(output, &var, TRUE);
	/* SV_SYSTEM */
		var.mvtype = MV_STR;
		var.str = dollar_system.str;
		ZS_VAR_EQU(&x, system_text);
		mval_write(output, &var, TRUE);
	/* SV_TEST */
		i2mval(&var, (int)op_dt_get());
		ZS_VAR_EQU(&x, test_text);
		mval_write(output, &var, TRUE);
	/* SV_TLEVEL */
		count = (int)dollar_tlevel;
		MV_FORCE_MVAL(&var, count);
		ZS_VAR_EQU(&x, tlevel_text);
		mval_write(output, &var, TRUE);
	/* SV_TRESTART */
		MV_FORCE_MVAL(&var, (int)((MAX_VISIBLE_TRESTART < dollar_trestart) ? MAX_VISIBLE_TRESTART : dollar_trestart));
		ZS_VAR_EQU(&x, trestart_text);
		mval_write(output, &var, TRUE);
	/* SV_X */
		count = (int)io_curr_device.out->dollar.x;
		MV_FORCE_MVAL(&var, count);
		ZS_VAR_EQU(&x, x_text);
		mval_write(output, &var, TRUE);
	/* SV_Y */
		count = (int)io_curr_device.out->dollar.y;
		MV_FORCE_MVAL(&var, count);
		ZS_VAR_EQU(&x, y_text);
		mval_write(output, &var, TRUE);
	/* SV_ZA */
		count = (int)io_curr_device.in->dollar.za;
		MV_FORCE_MVAL(&var, count);
		ZS_VAR_EQU(&x, za_text);
		mval_write(output, &var, TRUE);
	/* SV_ZB */
		c1 = (char *)io_curr_device.in->dollar.zb;
		c2 = c1 + sizeof(io_curr_device.in->dollar.zb);
		var.mvtype = MV_STR;
		var.str.addr = (char *)io_curr_device.in->dollar.zb;
		while (c1 < c2 && *c1)
			c1++;
		var.str.len = (char *)c1 - var.str.addr;
		ZS_VAR_EQU(&x, zb_text);
		mval_write(output, &var, TRUE);
	/* SV_ZCMDLINE */
		get_command_line(&var, TRUE);	/* TRUE to indicate we want $ZCMDLINE (i.e. processed not actual command line) */
		ZS_VAR_EQU(&x, zcmdline_text);
		mval_write(output, &var, TRUE);
	/* SV_ZCOMPILE */
		var.mvtype = MV_STR;
		var.str = dollar_zcompile;
		ZS_VAR_EQU(&x, zcompile_text);
		mval_write(output, &var, TRUE);
	/* SV_ZCSTATUS */
		MV_FORCE_MVAL(&var, dollar_zcstatus);
		ZS_VAR_EQU(&x, zcstatus_text);
		mval_write(output, &var, TRUE);
	/* SV_ZDATEFORM */
		MV_FORCE_MVAL(&var, zdate_form);
		ZS_VAR_EQU(&x, zdate_form_text);
		mval_write(output, &var, TRUE);
	/* SV_ZDIR */
		ZS_VAR_EQU(&x, zdirectory_text);
		setzdir(NULL, &zdir);
		if (zdir.str.len != dollar_zdir.str.len || 0 != memcmp(zdir.str.addr, dollar_zdir.str.addr, zdir.str.len))
		{
			memcpy(zdir_error, zdir.str.addr, zdir.str.len);
			memcpy(&zdir_error[zdir.str.len], arrow_text, STR_LIT_LEN(arrow_text));
			sgtm_putmsg(&zdir_error[zdir.str.len + STR_LIT_LEN(arrow_text)], VARLSTCNT(6) ERR_ZDIROUTOFSYNC, 4,
					zdir.str.len, zdir.str.addr, dollar_zdir.str.len, dollar_zdir.str.addr);
			zdir.str.addr = zdir_error;
			zdir.str.len = strlen(zdir_error) - 1; /* eliminate trailing '\n' */
		}
		SKIP_DEVICE_IF_NOT_NEEDED(&zdir);
		mval_write(output, &zdir, TRUE);
	/* SV_ZEDITOR */
		MV_FORCE_MVAL(&var, dollar_zeditor);
		ZS_VAR_EQU(&x, zeditor_text);
		mval_write(output, &var, TRUE);
	/* SV_ZEOF */
		ZS_VAR_EQU(&x, zeof_text);
		mval_write(output, io_curr_device.in->dollar.zeof ? (mval *)&literal_one : (mval *)&literal_zero, TRUE);
	/* SV_ZERROR */
		var.mvtype = MV_STR;
		var.str = dollar_zerror.str;
		ZS_VAR_EQU(&x, zerror_text);
		mval_write(output, &var, TRUE);
	/* SV_ZGBLDIR */
		ZS_VAR_EQU(&x, zgbldir_text);
		mval_write(output, &dollar_zgbldir, TRUE);
	/* SV_ZININTERRUPT */
		MV_FORCE_MVAL(&var, dollar_zininterrupt);
		ZS_VAR_EQU(&x, zininterrupt_text);
		mval_write(output, &var, TRUE);
	/* SV_ZINTERRUPT */
		var.mvtype = MV_STR;
		var.str = dollar_zinterrupt.str;
		ZS_VAR_EQU(&x, zinterrupt_text);
		mval_write(output, &var, TRUE);
	/* SV_ZIO */
		var.mvtype = MV_STR;
		/* NOTE:	This is **NOT** equivalent to :
		 *		io_curr_log_name->dollar_io
		 */
		var.str.addr = io_curr_device.in->trans_name->dollar_io;
		var.str.len = io_curr_device.in->trans_name->len;
		if (*var.str.addr == ESC)
		{
			if (5 > var.str.len)
				var.str.len = 0;
			else
			{
				var.str.addr += ESC_OFFSET;
				var.str.len -= ESC_OFFSET;
			}
		}
		ZS_VAR_EQU(&x, zio_text);
		mval_write(output, &var, TRUE);
	/* SV_ZJOB */
		MV_FORCE_ULONG_MVAL(&var, dollar_zjob);
		ZS_VAR_EQU(&x, zjob_text);
		mval_write(output, &var, TRUE);
	/* SV_ZLEVEL */
		MV_FORCE_MVAL(&var, save_dollar_zlevel);
		ZS_VAR_EQU(&x, zlevel_text);
		mval_write(output, &var, TRUE);
	/* SV_ZMAXTPTIME */
		MV_FORCE_MVAL(&var, dollar_zmaxtptime);
		ZS_VAR_EQU(&x, zmaxtptime_text);
		mval_write(output, &var, TRUE);
	/* SV_ZMODE */
		ZS_VAR_EQU(&x, zmode_text);
		mval_write(output, &dollar_zmode, TRUE);
	/* SV_ZPOS */
		getzposition(&var);
		ZS_VAR_EQU(&x, zpos_text);
		mval_write(output, &var, TRUE);
	/* SV_ZPROC */
		ZS_VAR_EQU(&x, zproc_text);
		mval_write(output, &dollar_zproc, TRUE);
	/* SV_PROMPT */
		var.mvtype = MV_STR;
		var.str.addr = gtmprompt.addr;
		var.str.len = gtmprompt.len;
		ZS_VAR_EQU(&x, zprompt_text);
		mval_write(output, &var, TRUE);
	/* SV_ZROUTINES */
		if (!zro_root)
			zro_init();
		var.mvtype = MV_STR;
		var.str = dollar_zroutines;
		ZS_VAR_EQU(&x, zroutines_text);
		mval_write(output, &var, TRUE);
	/* SV_ZSOURCE */
		var.mvtype = MV_STR;
		var.str = dollar_zsource;
		ZS_VAR_EQU(&x, zsource_text);
		mval_write(output, &var, TRUE);
	/* SV_ZSTATUS */
		ZS_VAR_EQU(&x, zstatus_text);
		mval_write(output, &dollar_zstatus, TRUE);
	/* SV_ZSTEP   */
		ZS_VAR_EQU(&x, zstep_text);
		mval_write(output, &dollar_zstep, TRUE);
	/* SV_ZSYSTEM */
		MV_FORCE_MVAL(&var, dollar_zsystem);
		ZS_VAR_EQU(&x, zsystem_text);
		mval_write(output, &var, TRUE);
	/* SV_ZTEXIT */
		var.mvtype = MV_STR;
		var.str = dollar_ztexit.str;
		ZS_VAR_EQU(&x, ztexit_text);
		mval_write(output, &var, TRUE);
	/* SV_ZTRAP */
		var.mvtype = MV_STR;
		var.str = dollar_ztrap.str;
		ZS_VAR_EQU(&x, ztrap_text);
		mval_write(output, &var, TRUE);
	/* SV_ZVERSION */
		var.mvtype = MV_STR;
		var.str.addr = (char *)&gtm_release_name[0];
		var.str.len = gtm_release_name_len;
		ZS_VAR_EQU(&x, zversion_text);
		mval_write(output, &var, TRUE);
	/* SV_ZYERROR */
		var.mvtype = MV_STR;
		var.str = dollar_zyerror.str;
		ZS_VAR_EQU(&x, zyerror_text);
		mval_write(output, &var, TRUE);
}