comparison examples/code/oct_demo.cc @ 21059:73ab962bc52d

doc: Use newer coding conventions in examples/code directory. * FIRfilter.m, FIRfilter_aggregation.m, display.m, subsasgn.m, subsref.m, display.m, end.m, get.m, numel.m, plot.m, polynomial.m, polynomial_superiorto.m, polyval.m, roots.m, set.m, subsasgn.m, subsref.m, celldemo.cc, fortrandemo.cc, funcdemo.cc, globaldemo.cc, oct_demo.cc, paramdemo.cc, stringdemo.cc: Use newer coding conventions in examples/code directory.
author Rik <rik@octave.org>
date Wed, 13 Jan 2016 16:21:24 -0800
parents c8240a60dd01
children a66a737913b5
comparison
equal deleted inserted replaced
21058:759fcdf3666d 21059:73ab962bc52d
44 // 1) The function name as seen in Octave. 44 // 1) The function name as seen in Octave.
45 // 2) The variable to hold any inputs (of type octave_value_list) 45 // 2) The variable to hold any inputs (of type octave_value_list)
46 // 3) The number of output arguments 46 // 3) The number of output arguments
47 // 4) A string to use as help text if 'help <function_name>' is entered. 47 // 4) A string to use as help text if 'help <function_name>' is entered.
48 // 48 //
49 // Note below that the third parameter (nargout) of DEFUN_DLD is not used, 49 // Note below that the third parameter (nargout) of DEFUN_DLD is not used.
50 // so it is omitted from the list of arguments in order to avoid a warning
51 // from gcc about an unused function parameter.
52 50
53 DEFUN_DLD (oct_demo, args, , 51 DEFUN_DLD (oct_demo, args, /* nargout */,
54 "[...] = oct_demo (...)\n\ 52 "[...] = oct_demo (...)\n\
55 \n\ 53 \n\
56 Print a greeting followed by the values of all the arguments passed.\n\ 54 Print a greeting followed by the values of all input arguments.\n\
55 \n\
57 Return all arguments in reverse order.") 56 Return all arguments in reverse order.")
58 { 57 {
59 // The list of values to return. See the declaration in oct-obj.h 58 // The inputs to this are available in the variable named args.
59
60 int nargin = args.length ();
61
62 // The list of values to return. See the declaration in ovl.h.
60 63
61 octave_value_list retval; 64 octave_value_list retval;
62 65
63 // This stream is normally connected to the pager. 66 // This stream is normally connected to the pager.
64 67
65 octave_stdout << "Hello, world!\n"; 68 octave_stdout << "Hello, world!\n";
66
67 // The inputs to this function are available in args.
68
69 int nargin = args.length ();
70 69
71 // The octave_value_list class is a zero-based array of octave_value objects. 70 // The octave_value_list class is a zero-based array of octave_value objects.
72 // The declaration for the octave_value class is in the file ov.h. 71 // The declaration for the octave_value class is in the file ov.h.
73 // The print() method will send its output to octave_stdout, 72 // The print() method will send its output to octave_stdout,
74 // so it will also end up going through the pager. 73 // so it will also end up going through the pager.