Mercurial > hg > octave-lyh
view examples/myfeval.c @ 16228:e19b1632d7c1
revamp most comment handling
* comment-list.h (octave_comment_elt::comment_type): New value,
full_line.
* lex.h (lexical_feedback::comment_text): New member variable.
(lexical_feedback::finish_comment): New function.
(octave_lexer::grab_block_comment, octave_lexer::grab_comment_block,
octave_lexer::process_comment): Delete.
* lex.ll (BLOCK_COMMENT_START, LINE_COMMENT_START): New exclusive
start states.
(ANY_INCLUDING_NL): New pattern.
(<INPUT_FILE_START>{ANY_INCLUDING_NL}): Use it instead of ".".
(^{S}*{CCHAR}\{{S}*{NL}, <BLOCK_COMMENT_START>^{S}*{CCHAR}\{{S}*{NL},
<BLOCK_COMMENT_START>^{S}*{CCHAR}\}{S}*{NL},
<BLOCK_COMMENT_START>.*{NL}, {S}*{CCHAR}.*{NL},
<LINE_COMMENT_START>{S}*{CCHAR}.*{NL},
<LINE_COMMENT_START>{ANY_INCLUDING_NL}):
New patterns and rules for handling comments.
({CCHAR}, ^{S}*{CCHAR}\{{S}*{NL}): Delete old rules for comments.
(display_start_state): Also handle BLOCK_COMMENT_START and
LINE_COMMENT_START.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 08 Mar 2013 17:13:54 -0500 |
parents | 6cb30a539481 |
children | be41c30bcb44 |
line wrap: on
line source
#include "mex.h" void mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { char *str; mexPrintf ("Hello, World!\n"); mexPrintf ("I have %d inputs and %d outputs\n", nrhs, nlhs); if (nrhs < 1 || ! mxIsString (prhs[0])) mexErrMsgTxt ("function name expected"); str = mxArrayToString (prhs[0]); mexPrintf ("I'm going to call the function %s\n", str); mexCallMATLAB (nlhs, plhs, nrhs-1, prhs+1, str); mxFree (str); }