/*--------------------------------------------------------------------------
 * g2ox.src - OxGauss additional functions
 *
 *       (C) Jurgen Doornik 2000-2001
 *
 *--------------------------------------------------------------------------*/

#ifndef G2OXSRC_INCLUDED
#define G2OXSRC_INCLUDED

keyword(0) = chdir(s);
	changedir(s);
endp;
keyword(0) = cls(s);
endp;
keyword(0) = comlog(s);
	print "comlog skipped";
endp;
keyword(0) = compile(s);
	print "compile skipped";
endp;
keyword(0) = debug(s);
	print "debug skipped";
endp;
keyword(0) = dos(s);
	call __dos__(s);
endp;
keyword(0) = errorlog(s);
	print s;
endp;
keyword(0) = locate(s);
	/* do nothing */
endp;
keyword(0) = lprint(s);
	/* do nothing */
endp;
keyword(0) = lpwidth(s);
	/* do nothing */
endp;
keyword(0) = lshow(s);
	/* do nothing */
endp;
keyword(0) = msym(s);
	print "msym skipped";
endp;
keyword(0) = pqgwin(s);
	/* do nothing */
endp;
keyword(0) = prcsn(s);
	/* do nothing */
endp;
keyword(0) = printdos(s);
	/* do nothing */
endp;
keyword(0) = rndcon(s);
	/* do nothing */
endp;
keyword(0) = rndmod(s);
	/* do nothing */
endp;
keyword(0) = rndmult(s);
	/* do nothing */
endp;
keyword(0) = screen(s);
	if (s == "");
		"screen is on";
	else;
		call __screen__(s);
	endif;
endp;
keyword(0) = scroll(s);
	/* do nothing */
endp;
keyword(0) = shell(s);
	__dos__(s);
endp;

declare matrix __fmtcv = {"*.*s " 8 8};
declare matrix __fmtnv = {"*.*lg " 16 8};
proc formatcv(mch);
	local prev;
	prev = __fmtcv;
    __fmtcv = mch;
	retp(prev);
endp;
proc formatnv(mch);
	local prev;
	prev = __fmtnv;
    __fmtnv = mch;
	retp(prev);
endp;
proc printfmt(x, mask);
	local i, j, c;

	if (cols(mask) == 1);
		if (mask == 0);
			mask = zeros(1, cols(x));
		else;
			mask = ones(1, cols(x));
		endif;
	endif;
		
	i = 1;
	do while (i <= rows(x));
		j = 1;
		do while (j <= cols(x));
			if (mask[j] == 0);
	    		print $x[i,j];;
			else;			
	    		print x[i,j];;
			endif;
			j = j + 1;
		endo;
   		print;
		i = i + 1;
	endo;
	retp(1);
endp;

proc printfm(x, mask, fmt);
	local i, j, c;

	if (cols(mask) == 1);
		if (rows(mask) == 1);
			if (mask == 0);
				mask = zeros(rows(x), cols(x));
			else;
				mask = ones(rows(x), cols(x));
			endif;
		else;
			mask = mask * ones(1, cols(x));
		endif;
	elseif (rows(mask) == 1);
		mask = ones(rows(x), 1) * mask;
	endif;
		
	i = 1;
	do while (i <= rows(x));
		j = 1;
		do while (j <= cols(x));
			if (mask[i,j] == 0);
	    		print $x[i,j];;
			else;			
	    		print x[i,j];;
			endif;
			j = j + 1;
		endo;
   		print;
		i = i + 1;
	endo;
	retp(1);
endp;


#endif /* G2OXSRC_INCLUDED */
