Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: m_compile.ado routine to compile mata source files


From   "David Elliott" <[email protected]>
To   [email protected], "William Gould, StataCorp LP" <[email protected]>
Subject   st: m_compile.ado routine to compile mata source files
Date   Thu, 21 Jun 2007 14:15:25 -0300

I have created a beta version 1.0.0 of a mata source file function
compiler that will create|replace individual *.mo files or
create|add|replace to *.mlib files.  I haven't created a help file yet
but the basic syntax is as below:

*! version 1.0.0  2007.06.18
*! Compiles and saves object code of a mata source file(s) (*.mata)
*! by David C. Elliott
*!
*! syntax:
*! m_compile , source(one or more filenames or macrolist)
*! > dir(user-specified or adopath keyword ("UPDATES","BASE"...))
*! > mlib(library name (remember to begin library names with an "l"))
*! > create - creates new library
*! > replace - replaces individual *.mo or *.mlib files
*! > verbose - displays source files as they are compiled
*!
*! examples:
*!  1) Compiling to *.mo
*!   m_compile ,s(c:\ado\func1.mata c:\ado\func2.mata) dir(PERSONAL) replace
*!   m_compile ,s(c:\ado\manyfunc.mata)
*!  2) Compiling to (and optionally creating) *.mlib
*!   m_compile ,s(c:\ado\func1.mata c:\ado\func2.mata) dir(PERSONAL)
mlib(lmylib) create
*!   m_compile ,s(c:\ado\manyfunc.mata) mlib(lmylib) create replace verbose
*!   to include all the *.mata file in a directory:
*!    m_compile ,s(`:dir "." files "*.mata"')  mlib(lmylib) create
*!
*! note: if you want to update a function in an existing library
*! the entire library must be rebuilt with a create replace
*! (mata's rules, not mine)

syntax  ,Source(str) [DIR(str) Mlib(str) CREATE REPLACE Verbose]

It can be viewed/downloaded at:
http://docs.google.com/Doc?id=dcf5gmrf_14d6rbqv

I believe this will be especially useful to people who have fairly
large function libraries that are updated frequently.
I'd appreciate feedback from any testers as to its usefulness and any
errors (other than syntax error messages) users might experience.
Suggestions as to syntax or other improvements would also be welcomed.

My thanks to Bill Gould for his excellent help in clarifying some of
the process used in creating mata function libraries that helped
determine how I crafted m_compile.ado. (See Statalist archive thread:
http://www.stata.com/statalist/archive/2007-06/msg00722.html )

--
David Elliott
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index