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