Mercurial > octave
comparison src/defun-int.h @ 2891:1a30f46e1870
[project @ 1997-04-28 01:49:00 by jwe]
author | jwe |
---|---|
date | Mon, 28 Apr 1997 02:01:22 +0000 |
parents | 8b262e771614 |
children | ac3368dba5d3 |
comparison
equal
deleted
inserted
replaced
2890:42901f9a9266 | 2891:1a30f46e1870 |
---|---|
21 */ | 21 */ |
22 | 22 |
23 #if !defined (octave_defun_int_h) | 23 #if !defined (octave_defun_int_h) |
24 #define octave_defun_int_h 1 | 24 #define octave_defun_int_h 1 |
25 | 25 |
26 #include "oct-builtin.h" | |
26 #include "variables.h" | 27 #include "variables.h" |
27 | 28 |
28 // MAKE_BUILTINS is defined to extract function names and related | 29 // MAKE_BUILTINS is defined to extract function names and related |
29 // information and create the *.def files that are eventually used to | 30 // information and create the *.def files that are eventually used to |
30 // create the buitlins.cc file. | 31 // create the buitlins.cc file. |
36 // DEFUN_TEXT, or DEFUN_DLD. | 37 // DEFUN_TEXT, or DEFUN_DLD. |
37 | 38 |
38 #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ | 39 #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ |
39 BEGIN_INSTALL_BUILTIN \ | 40 BEGIN_INSTALL_BUILTIN \ |
40 extern DECLARE_FUN (name, args_name, nargout_name); \ | 41 extern DECLARE_FUN (name, args_name, nargout_name); \ |
41 DEFINE_FUN_STRUCT (name, is_text_fcn, doc); \ | 42 install_builtin_function \ |
42 install_builtin_function (S ## name); \ | 43 (new octave_builtin (F ## name, #name, doc), is_text_fcn); \ |
43 END_INSTALL_BUILTIN | 44 END_INSTALL_BUILTIN |
44 | 45 |
45 // Generate code for making another name for an existing function. | 46 // Generate code for making another name for an existing function. |
46 | 47 |
47 #define DEFALIAS_INTERNAL(alias, name) \ | 48 #define DEFALIAS_INTERNAL(alias, name) \ |
64 #endif /* ! MAKE_BUILTINS */ | 65 #endif /* ! MAKE_BUILTINS */ |
65 | 66 |
66 // Define the structure that will be used to insert this function into | 67 // Define the structure that will be used to insert this function into |
67 // the symbol table. | 68 // the symbol table. |
68 | 69 |
69 #define DEFINE_FUN_STRUCT(name, is_text_fcn, doc) \ | 70 #define DEFINE_FUN_STRUCT_FUN(name, doc) \ |
70 static builtin_function S ## name (#name, is_text_fcn, F ## name, doc) | 71 octave_builtin * \ |
71 | |
72 #define DEFINE_FUN_STRUCT_FUN(name) \ | |
73 builtin_function& \ | |
74 FS ## name (void) \ | 72 FS ## name (void) \ |
75 { \ | 73 { \ |
76 return S ## name; \ | 74 static octave_builtin *s = 0; \ |
75 if (! s) \ | |
76 s = new octave_builtin (F ## name, #name, doc); \ | |
77 return s; \ | |
77 } | 78 } |
78 | 79 |
79 #define DECLARE_FUN(name, args_name, nargout_name) \ | 80 #define DECLARE_FUN(name, args_name, nargout_name) \ |
80 octave_value_list F ## name (const octave_value_list& args_name, int nargout_name) | 81 octave_value_list F ## name (const octave_value_list& args_name, int nargout_name) |
81 | 82 |