2 custom - custom builtin interface
5 custom([custname [, arg ...]])
14 This function will invoke the custom function interface. Custom
15 functions are accessed by the custname argument. The remainder
16 of the args, if any, are passed to the custom function. The
17 custom function may return any value, including null. Calling
18 custom with no args is equivalent to the command 'show custom'.
20 In order to use the custom interface, two things must happen:
22 1) Calc must be built to allow custom functions. By default,
23 the master Makefile is shipped with ALLOW_CUSTOM= -DCUSTOM
24 which causes custom functions to be compiled in.
26 2) Calc must be invoked with an argument of -C as in:
30 In other words, explicit action must be taken in order to
31 enable the use of custom functions. By default (no -C arg)
32 custom functions are compiled in but disabled so that only
33 portable calc scripts may be used.
35 The main focus for calc is to provide a portable platform for
36 multi-precision calculations in a C-like environment. You should
37 consider implementing algorithms in the calc language as a first
38 choice. Sometimes an algorithm requires use of special hardware, a
39 non-portable OS or pre-compiled C library. In these cases a custom
40 interface may be needed.
42 The custom function interface is intended to make is easy for
43 programmers to add functionality that would be otherwise
44 un-suitable for general distribution. Functions that are
45 non-portable (machine, hardware or OS dependent) or highly
46 specialized are possible candidates for custom functions.
48 To add a new custom function requires access to calc source.
49 For information on how to add a new custom function, try:
53 To serve as examples, calc is shipped with a few custom functions.
54 If calc if invoked with -C, then either of the following will
55 display information about the custom functions that are available:
62 A few resource files that uses these function are also provided
63 to serve as usage examples.
65 We welcome submissions for new custom functions. For information
66 on how to submit new custom functions for general distribution, see:
71 If calc compiled with ALLOW_CUSTOM= (custom disabled):
73 ; print custom("sysinfo", "baseb")
74 Calc was built with custom functions disabled
77 If calc compiled with ALLOW_CUSTOM= -DCUSTOM and is invoked without -C:
79 ; print custom("sysinfo", "baseb")
80 Calc must be run with a -C argument to use custom function
83 If calc compiled with ALLOW_CUSTOM= -DCUSTOM and is invoked with -C:
85 ; print custom("sysinfo", "baseb")
89 By default, custom is limited to 100 args.
95 custom_cal, new_custom, contrib
97 ## Copyright (C) 1999 Landon Curt Noll
99 ## Calc is open software; you can redistribute it and/or modify it under
100 ## the terms of the version 2.1 of the GNU Lesser General Public License
101 ## as published by the Free Software Foundation.
103 ## Calc is distributed in the hope that it will be useful, but WITHOUT
104 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
105 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
106 ## Public License for more details.
108 ## A copy of version 2.1 of the GNU Lesser General Public License is
109 ## distributed with calc under the filename COPYING-LGPL. You should have
110 ## received a copy with calc; if not, write to Free Software Foundation, Inc.
111 ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
113 ## @(#) $Revision: 30.1 $
114 ## @(#) $Id: custom,v 30.1 2007/03/16 11:10:42 chongo Exp $
115 ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/custom,v $
117 ## Under source code control: 1997/03/09 16:33:22
118 ## File existed as early as: 1997
120 ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
121 ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/