oct2mat script based on parse tree

Muthiah Annamalai muthuspost at gmail.com
Tue Jan 8 13:21:36 CST 2008


Hello there,

I have a oct2mat  like the one  Paul Kienzle mentions in his
README file based on the AST walker. Utilizing Octave's
parse tree to do the conversion is very helpful and accurate
to a larger degree. Its still a work in progress (my disclaimer).

Large parts of the code are directly derived from Octave
source written by JWE.

This script is essentially to help deploy code to your colleagues
who want to use it on Matlab systems for whatever reason. Primary
development is still expected to be based on an Octave based
environment.

You can invoke the script as,

octave:1> oct2mat("full/path/my_cool_octave_function.m",1)
octave:2> oct2mat("full/path/my_cool_octave_script.m")

and the code is output to stdout, where from you can use some shell
scripts to redirect the output to another matlab directory.

I have attached the files. Im waiting for JWE to accept some
global export patches to access some parser information. Once that is 
done, I plan to add it to the extras branch of octave-forge.

This code works only on the cvs version of Octave, as a external add-on.

Limitations include

1. Can treat only function files or script files not both.
2. Pollutes your command history, as it pipes out to octave_stdout.
3. Cannot handle a script file with function definitions
4. Doesnot write to a separate directory or file, just all output on
    stdout. So you need to create a driver program.
5. Not sure if it works correctly for all cases.

Best,
-Muthu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: conversions.cc
Type: text/x-c++src
Size: 4994 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080108/1455dfe0/attachment-0008.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello.m
Type: text/x-objcsrc
Size: 569 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080108/1455dfe0/attachment-0009.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello2.m
Type: text/x-objcsrc
Size: 50 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080108/1455dfe0/attachment-0010.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello3.m
Type: text/x-objcsrc
Size: 49 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080108/1455dfe0/attachment-0011.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello4.m
Type: text/x-objcsrc
Size: 100 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080108/1455dfe0/attachment-0012.bin 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Makefile
Url: https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080108/1455dfe0/attachment-0001.ksh 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pt-pr-mat.cc
Type: text/x-c++src
Size: 27334 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080108/1455dfe0/attachment-0013.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pt-pr-mat.h
Type: text/x-chdr
Size: 5334 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080108/1455dfe0/attachment-0014.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_oct2mat.m
Type: text/x-objcsrc
Size: 116 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080108/1455dfe0/attachment-0015.bin 


More information about the Octave-maintainers mailing list