_gm_log.ado

来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· ADO 代码 · 共 126 行

ADO
126
字号
*! version 1.0.0  19Apr2002
program define _gm_log
	version 8

	/* log the supplied command into the lowest (rightmost) object that
	 * has a __LOG.  If any object in the object name is a named style, 
	 * the command is logged in the scheme of the lowest object having a
	 * _scheme. Recognizes T_log2scm to force logging to the scheme. */

	local scheme_log `c(curscm)'				/* default */

	if "`.Global.__UNDO.isa'" == "" {
		.Global.__UNDO = .Global._gm_undo.new
	}

	gettoken fullnm rest : 0 , parse(" ,=")

	local name  Global
	gettoken tok fullnm : fullnm , parse(" .") 
	while "`tok'" != "" {
		if "`tok'" != "." {
			local name `name'.`tok'
			local lognm `lognm'.`tok'

			if "`.`name'.__LOG.isa'" == "array" {
				local log `name'.__LOG
/*
				local log `.`name'.__LOG.objkey'
*/
				local lognm
			}

			if "`.`name'._scheme.__LOG.isa'" == "array" {
				local scheme_log `name'._scheme.__LOG
/*
				local scheme_log `.`name'._scheme.__LOG.objkey'
*/
			}

			if 0`pending' {
		            if ! 0`.`name'.namedstyle' {	/* finished */
				if "`scheme_log'" == "" {
				    ScmLogErr `0'
				}
				local fn `fullnm'
				if "`fn'" != "" {
				    di as error "`fn' invalid in style edit:"
				    di as error `"`0'"'
				    exit 4099
				}

				if "`.`name'.isa'" == "" { /* pgm not attrib */
				    if "`ednm1'" == "" {
					continue, break   /* not a scheme ed */
				    }

				    local edit .`tok'`rest'
				}
				else {
				    local ednm1  `ednm'
				    local attrib `tok'
				    local edit   `"`rest'"'
				}

.`scheme_log'.Arrpush .decl_style `.`ednm1'.classname' `.`ednm1'.stylename'
						/* scheme may need to create */
.`scheme_log'.Arrpush /*
*/ .style_edit `.`ednm1'.classname' `.`ednm1'.snm' `attrib'`edit'
				.Global.__UNDO.add `scheme_log' 2

				exit				/* EXIT */
			    }
			}

			if 0`.`name'.namedstyle' {     /* found a named style */
				if 0`pending' {
					local ednm1 `ednm'
					local attrib  `tok'
				}
				local pending 1
				local ednm   `name'
			}

		}

		gettoken tok fullnm : fullnm , parse(" .") 
	}


	if 0$T_log2scm {
		if "`scheme_log'" == "" {
			ScmLogErr `0'
		}
						/* assume remake_as_copy */
		local edit .`tok'`rest'			
.`scheme_log'.Arrpush .decl_style `.`ednm'.classname' `.`ednm'.stylename'

.`scheme_log'.Arrpush /*
*/ .style_edit `.`ednm'.classname' `.`ednm'.snm' `attrib'`edit'
		.Global.__UNDO.add `scheme_log' 2
	}
	else {
		if "`log'" == "" {
			di as error "could not find __LOG to log:"
			di as error `"`0'"'
			exit 4099
		}

		.`log'.Arrpush `lognm'`rest'
		.Global.__UNDO.add `log' 1
	}

end

program define ScmLogErr
	di as error "could not find scheme to log:"
	di as error `"`0'"'
	exit 4099
end

exit

NOTE:  Cannot check if the edit is valid, do not call this program with an
       invalid editing command.
<end>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?