📄 m1_source.hlp
字号:
{smcl}
{* 13jan2005}{...}
{cmd:help m1 source}
{hline}
{* index viewsource tt}{...}
{* index copysource tt}{...}
{* index source code}{...}
{* index .mata file}{...}
{title:Title}
{p 4 4 2}
{bf:[M-1] source -- Viewing the source code}
{title:Syntax}
{p 4 8 2}
. {cmd:viewsource}
{it:functionname}{cmd:.mata}
{title:Description}
{p 4 4 2}
Many Mata functions are written in Mata.
{cmd:viewsource} will allow you to examine their source code.
{title:Remarks}
{p 4 4 2}
Some Mata functions are implemented in C (they are part of Mata itself), and
others are written in Mata.
{p 4 4 2}
{cmd:viewsource} allows you to look at the official source code written in
Mata. Reviewing this code is a great way to learn Mata.
{p 4 4 2}
The official source code is stored in .mata files. To see the source
code for {bf:{help mf_diag:[M-5] diag()}}, for instance, type
. {cmd:viewsource diag.mata}
{p 4 4 2}
You type this at Stata's dot prompt, not at Mata's colon prompt.
{p 4 4 2}
If a function is built-in, such as
{bf:{help mf_abs:[M-5] abs()}}, here is what will happen when you attempt
to view the source code:
. {cmd:viewsource abs.mata}
{err:file "abs.mata" not found}
{p 4 4 2}
You can verify that {cmd:abs()} is built-in using the
{bf:{help mata_which:[M-3] mata which}}
command:
. {cmd:mata: mata which abs()}
abs(): built-in
{p 4 4 2}
{cmd:viewsource} can be also used to look at source code of user-written
functions if the distribution included the source code (it might not).
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-1] source}
{p 4 13 2}
Online: help for
{bf:{help viewsource:[P] viewsource}};
{bf:{help m1_intro:[M-1] intro}},
{bf:{help mata:[M-0] intro}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -