X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=emacs_el%2Ftiny-tools%2Ftiny%2Ftinytag.el;fp=emacs_el%2Ftiny-tools%2Ftiny%2Ftinytag.el;h=13a98399369c93219ece26fd0a7e1c5e88f6d8f1;hb=fd3f330b392dfae044a1fc13082e9f4781d2041d;hp=0000000000000000000000000000000000000000;hpb=9ebdec8215e5dfba6512e3f29d750709ca83a4bb;p=lib.git diff --git a/emacs_el/tiny-tools/tiny/tinytag.el b/emacs_el/tiny-tools/tiny/tinytag.el new file mode 100644 index 0000000..13a9839 --- /dev/null +++ b/emacs_el/tiny-tools/tiny/tinytag.el @@ -0,0 +1,2277 @@ +;;; tinytag.el --- Grep tags: show C++/Java/etc. syntax call while coding + +;; This file is not part of Emacs. + +;;{{{ Id + +;; Copyright (C) 1996-2007 Jari Aalto +;; Keywords: tools +;; Author: Jari Aalto +;; Maintainer: Jari Aalto +;; +;; To get information on this program, call M-x tinytag-version. +;; Look at the code with folding.el. + +;; This program is free software; you can redistribute it and/or modify it +;; under the terms of the GNU General Public License as published by the Free +;; Software Foundation; either version 2 of the License, or (at your option) +;; any later version. +;; +;; This program 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 General Public License +;; for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with program; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. +;; +;; Visit for more information + +;;}}} +;;{{{ Install + +;; ....................................................... &t-install ... +;; Put this file on your Emacs-Lisp load path, add following into your +;; ~/.emacs startup file. Rip code with with tinylib.el/ti::package-rip-magic +;; +;; (setq tinytag-:database-dir "~/elisp/config") +;; (require 'tinytag) +;; +;; You can also use the autoload feature, which speeds up loading +;; the ~/.emacs +;; +;; (autoload 'tinytag-install "tinytag" "" t) +;; (autoload 'tinytag-main "tinytag" "" t) +;; (autoload 'tinytag-main-mouse "tinytag" "" t) +;; +;; You do not have to install `tinytag-install' function to every known +;; programming language, because the mode will be global once it +;; is called. Here, if you program mostly with Java and C, +;; then either one will activate tinytag for all buffers. +;; +;; (add-hook 'c++-mode-hook 'tinytag-install) +;; (add-hook 'c-mode-hook 'tinytag-install) +;; (add-hook 'java-mode-hook 'tinytag-install) +;; +;; ******************************************************************** +;; +;; YOU MAY NEED TO CHANGE VARIABLE tinytag-:database-setup-table +;; BEFORE YOU USE THIS PACKAGE. +;; +;; It gives the instructions where are the databases located +;; that offer the code help in echo are. Without that variable +;; this package does nothing. +;; +;; Read section "Installing support for your programming languages" +;; +;; ******************************************************************** +;; +;; When you use this package for the first time, an example C/C++ +;; database is extracted fromt he end of this file. See the attached +;; perl script if you want to generate the database from your +;; system's manual pages by hand. +;; +;; M-x load-library RET tinytag RET +;; M-x tinytag-install-sample-databases +;; +;; Keybinding suggestion (HP-UX) +;; +;; (global-set-key [(alt control mouse-2)] 'tinytag-main-mouse) +;; (global-set-key "\C-c\C-z" 'tinytag-main) +;; +;; If you have any questions, use these function +;; +;; M-x tinytag-submit-bug-report +;; +;; Pleace, send any other programming language database that you may use, +;; even an different C prototypes in different platform. Let's share the +;; information with others! +;; +;; C/C++ database help +;; +;; Peter Simons to get +;; NetBSD/Linux C database +;; +;; Java database help +;; +;; Jari Aalto +;; SUN Java databases (1.2.2 - 1.4) + +;;}}} +;;{{{ Documentation + +;; ..................................................... &t-commentary ... +;;; Commentary: + +;; Preface, overview of features +;; +;; o Simple database searching, some analogue to emacs TAGS package. +;; Databaseses are simple text files that are searched for matches. +;; o Flips databases easily to show the right data. +;; o The Language's function call syntax is shown in the echo area +;; when cursor is over an identifiable item. +;; o Limitations: The function help info can only be 80 characters +;; or as long as your minibuffer is wide. But you can keep the +;; *tinytag-output* buffer visible in another buffer to show all +;; the information. +;; o Unlimited extendability to any programming or other "lookup" +;; languages. +;; +;; Ready-to-use databases currently available: +;; +;; o HP-UX/Netbsd C/C++ function database is included in this file +;; and perl script to rip the function definitions from Unix manual +;; pages. +;; o Perl script to generate databases from any +;; Javadoc compliant pages (E.g full database from all +;; JDK 1.2.2 pages) The Java database is not distributed +;; because it takes over a Meg and generating one straight +;; from SUN Java /docs tree is trivial. +;; +;; Story behind this package +;; +;; The word "tag" refers to famous tags package in emacs that allows +;; you to browse your C/C++ code easily. +;; +;; Someone may be in the middle of c++ project at work and notice +;; that he frequently consults the manual pages to find correct +;; syntax for calling stdio.h functions. It's hard to remember +;; them right every time. Time spent for reading manual pages may +;; be considerable just to figure out what #include statements +;; each function might require, and what type of parameters they +;; need. +;; +;; No more. There must be a way out of this... +;; +;; If you have programmed in lisp, you propably know package called +;; eldoc.el (get it fast if you haven't) by Noah Friedman +;; . It shows you the lisp function call +;; arguments when your cursor is right over some function. +;; +;; What a cool tool! You never have to go to elisp info pages +;; just to check what the function takes, and you don't have to +;; pop up extra buffer with c-h f . It's a real time saver. +;; Similar keyword lookup feature culd be built for any +;; programing. Since eldoc looked the lisp args from memory +;; (emacs obarray, symbol storage), the other programming +;; languages must use external reference files: databases. +;; +;; First, all C/C++ function syntaxes were extracted out of the +;; man pages with small perl program. The final output after +;; ripping all the 3C man pages loooked like this. The output +;; is put under database 'c++-functions' +;; +;; dir *opendir(const char *dirname); +;; int closedir(dir *dirp); +;; int readdir_r(dir *dirp, struct dirent *result); +;; long int telldir(dir *dirp); +;; struct dirent *readdir(dir *dirp); +;; ... +;; char *index(const char *s, int c); +;; char *rindex(const char *s, int c); +;; +;; Notice how perl stuck the '#define' statements at the +;; beginning of each function. After this 'function' database was +;; ready, the only thing needed was lisp code to handle database +;; lookups for the keyword under the cursor. Similar approach can +;; be user for any programming language. Just set up the +;; database, entries to search; one per line. that's it. +;; +;; Word about installation -- performance problems [19.29 or lower] +;; +;; Skip this part if you have 19.30+ +;; +;; When you load this package, it immediately installs an _example_ +;; post-command function. It assumes that you're using the "Having a +;; test drive" C++ database and stored it as explained. You propably +;; want to remove that default post-command function and use your own +;; definition. Here is how you remove it. +;; +;; Doing this is also recommended if you don't want post command +;; actions, but want to use the tinytag-main[-mouse] functions +;; directly. Call them only when you need them. +;; +;; o before any load command say: (setq tinytag-:load-hook nil) +;; o If package is already loaded, say: C-u M-x tinytag-install. +;; +;; If your databases are big, or if you're afraid of the overall emacs +;; performance I STRONGLY ADVICE THAT YOU REMOVE THAT post-command +;; with methods (2) or (1) You can always call the database with the +;; supplied keyboard or mouse commands when you need the information. +;; +;; Having a test run +;; +;; There is sample C++ database from HP-UX 10 man 3C pages, which +;; is unfortunately incomplete. You may consider using the BSD +;; C-database instaed. The BSD is installed by default when you +;; call `M-x' `tinytag-install-sample-database-c'. Rememeber that +;; you really should replace those definitions with your own +;; systems equivalents, because not all functions are found in +;; all systems. Vendors are different. +;; +;; This is how you test this package. +;; +;; o Go to empty buffer +;; o Add statement "strcat(a,b)" to the buffer +;; o Turn on C++ mode +;; o Be sure to have tinytag on (M-x load-library tinytag.el) +;; o Move your cursor over the word "strcat" and wait few seconds. +;; +;; +;; You should see the "strcat"'s function's definition displayed in +;; the echo area. Next, you can start writing your own databases to +;; languages you use. +;; +;; Installing support for your programming languages +;; +;; While you may have installed the default database for C/C++, you +;; have to configure the variable `tinytag-:database-setup-table' to +;; include all languages where you have databases available. It is +;; recommended that you keep all emacs related configuration, +;; including databases, in one place, e.g. +;; +;; ~/elisp/config/ +;; +;; First you need databases which you must write yourself. +;; e.g. emacs-tinytag-python-function.el where you describe the +;; function, packages and call syntax. The only thing after creating the +;; database is to tell where it can be found. E.g for php you would +;; add couple of you own variables: +;; +;; (defconst my-tinytag-:db-map-php +;; '((func "emacs-config-tinytag-php.txt")) +;; "Java database.") +;; +;; (defconst my-tinytag-:db-re-php +;; '(("." (func))) ;; See name FUNC in prev. variable +;; "PHP database.") +;; +;; And tell tinytag.el that the Java is now known: +;; +;; (defconst tinytag-:database-setup-table +;; (list +;; (list +;; "code-php\\|php" +;; '(my-tinytag-:db-map-php +;; my-tinytag-:db-re-php)) +;; (list +;; "c-mode....." +;; '(.. +;; )))) +;; +;; C/C++ database +;; +;; Run c-function-list.pl that comes with Tiny Tools Distribution to +;; generate function database. +;; +;; Alternatively copy the database from the end of this file or +;; use M-x tinytag-install-sample-databases +;; +;; Java database +;; +;; Run script `java-function-list.pl' that comes with Tiny Tools +;; distribution to generate function database from the Sun JDK's javadoc +;; html pages. See the manual page of the script how to run it (--help +;; option) +;; +;; NOTE: In SUN documentation, there is no System.out.print() or +;; System.out.println() functions that could be extracted. Please add +;; Those functions by hand to the database. +;; +;; This script is also run with call tinytag-install-sample-databases, +;; provided that you have `perl' and `java' and `java-function-list.pl' +;; installed and located along PATH. +;; +;; Perl database +;; +;; +;; +;; Run perl-function-list.pl that comes with Tiny Tools Distribution to +;; generate function database. See the manual page of the script how to +;; run it (--help option) +;; +;; Database format and display +;; +;; There is nothing special in the database format, each entry must me +;; in one line nad that's all. Try to find most suitable display format +;; for your language, like the general method that is used for C/C++, Java +;; and Perl +;; +;; return-value function-name(function-parameters) REST-INFO +;; +;; _Important_: When function `tinytag-search-db' searches the whole +;; database, it gathers the lines that likely match and FIRST one that +;; is found is displayed in the echo-area. So that you're aware of other +;; matches, the count of matches is displayed +;; +;; 10: java.lang.System.out void println() +;; | +;; Count of matches +;; +;; If you have time, it would be sensible to move the most informational +;; description of the function first in the list of lines, so that it +;; get displayed. For example, you could move method this method first in +;; the line and add [] inside function parameters to signal that the +;; parameter is optional +;; +;; java.lang.System.out void print([Object obj]) +;; +;; Alternatively, you can keep the buffer `tinytag-:output-buffer' +;; visible e.g in separate frame, so that all the matched items are +;; visible to you in case the one displayed in echo-are is not correct. +;; +;; Differencies between 19.30+ and lower +;; +;; The 19.30 Emacs has idle hook, which runs after you move cursor. It +;; doesn't run if you move mouse. 19.28 on the other hand has post +;; command hook, that runs every time you either move cursor _OR_ +;; move mouse. +;; +;; Now, to get display fast in 19.28, you propably want to wave +;; your mouse fast couple of times. In 19.30 you can have immediate +;; display with just one cursor move over the word. +;; +;; What to do if you don't see the definition displayed? +;; +;; hem most informative is the internal debug which you turn on with: +;; +;; M-x tinytag-debug +;; +;; Then call this function directly over the word whose definition +;; you want to display (e.g. strcat in C++) +;; +;; ESC ESC : (tinytag-post-command-1) +;; ======== +;; Press this key combination and enter text to the right. +;; +;; After that call there is buffer *tinytag-debug* that has some +;; information about called functions and parameters. Please +;; investigate the call chain for possible problem. Is the database +;; selected right? if the regexp used for search right? If you don't +;; know how to read the debug buffer's output, just send the buffer's +;; content to me and describe what you did and what was your current +;; major mode. +;; +;; Thank you +;; +;; Peter Simons sent me +;; NetBSD and Linux C databases and his perl script can help you +;; to create your own database from the man pages. + +;;}}} + +;;; Change Log: + +;;; Code: + +;;{{{ setup: require + +;; Under no circumstances remove the following comment line below! +;; $PackageInstallRe: '^;;+[*]' $ + +(require 'tinylibm) + +(eval-and-compile + (autoload 'man "man" "" t)) + +(eval-when-compile (ti::package-use-dynamic-compilation)) + +(ti::package-defgroup-tiny TinyTag tinytag-: programming + "Grep database: example show C++ synatx call while coding. +Overview of features + o simple database searching, some analogue to emacs TAGS package. + o you can flip databases very easily to show the right data. + o example: showing c++ funcall syntax in echo area while you program. + o installs hp-ux or netbsd c function databases automatically.") + +;;}}} +;;{{{ setup: -- variables + +(defcustom tinytag-:load-hook nil + "*Hook run when file has been loaded." + :type 'hook + :group 'TinyTag) + +(defcustom tinytag-:post-command-try-hook + '(tinytag-try-function-show-cached-word + tinytag-try-function-search-db) + "*Try displaying the information. +Run these functions, until one of them return non-nil. +Put here only functions that does not need any user interaction." + :type 'hook + :group 'TinyTag) + +(defcustom tinytag-:try-hook + '(tinytag-try-function-show-cached-word + tinytag-try-function-search-db + tinytag-try-function-man) + "*Try displaying the information. +Run these functions, until one of them return non-nil. +This hook is primarily run upon request: M - x, keyboard command, or mouse +command." + :type 'hook + :group 'TinyTag) + +(defcustom tinytag-:set-database-hook + '(tinytag-set-database) + "*Function to set the correct database for buffer. +Run these functions, until someone return non-nil." + :type 'hook + :group 'TinyTag) + +(defcustom tinytag-:word-filter-hook + '(tinytag-filter-default-function) + "*Run hook until some function return non-nil. +Every function in this hook is called with + +arg1: string, word picked at current point to initiate database search + +The function should return nil if the word should not be searched. +many times short words are not valid 'keys' in database: e.g. in +C/C++ code common words like 'char' 'double' 'int' can be ignored." + :type 'hook + :group 'TinyTag) + +(defcustom tinytag-:word-modify-hook 'tinytag-word-default-adjust + "*This function formats the searched word to correct search regexp. +Regexp should match only desired hits. + +Call arguments: + string + +Function must return always: + string" + :type 'hook + :group 'TinyTag) + +(defcustom tinytag-:database-ok-hook nil + "*Run hook database was set according to current buffer. +Called from `tinytag-set-database'. + +The variables `tinytag-:database-map' and `tinytag-:regexp-to-databases' +have valid values when the hook is called." + :type 'hook + :group 'TinyTag) + +;;; ....................................................... &v-private ... + +(defvar tinytag-:last-word-lookup nil + "Last lookup, '(WORD . (DB-STRING DB-STRING)).") +(make-variable-buffer-local 'tinytag-:last-word-lookup) + +(defvar tinytag-:noerror nil + "If non-nil, no error command is called.") + +(defvar tinytag-:post-command-hook-counter nil + "Counter.") + +(defvar tinytag-:post-command-hook-wakeup + ;; There is no delay in 19.30+, but for <19.30 the must be + ;; + (if (boundp 'post-command-idle-hook) + 0 3) + "Wakeup threshold. +The more lower value, the more often post command hook is called +and your Emacs probably slows down. The values must be 0 in 19.30+, +because `post-command-hook' is not used there.") + +(defvar tinytag-:database-map nil + "Databases available, format '((NAME-SYMBOL FILENAME) .. ) +Do not put directory name here, use `tinytag-:database-dir' instead.") + +(defvar tinytag-:regexp-to-databases nil + "Which REGEXP on word should initiate database search?. +Format: '((REGEXP '(database1 database2 ..)) (RE (d1 d1 ..)) ..)") + +(defvar tinytag-:idle-timer-elt nil + "If idle timer is used, this variable has the timer elt.") + +;;; .................................................. &private-sample ... +;;; - These are offered as samples, see tinytag-set-database, +;;; which uses these variable. They are not part of the tinytag.el +;;; package (user variables). You should program your own +;;; tinytag-set-database function to deal with different buffers. + +(defconst tinytag-:example-db-map-c++ + '((func "emacs-config-tinytag-c++-functions.txt") + (struct "emacs-config-tinytag-c++-structs.txt") + (types "emacs-config-tinytag-c++-types.txt")) + "Sample. C++ databases.") + +(defconst tinytag-:example-db-re-c++ + '(("_t" (types structs)) + ("_s" (struct types)) + ("." (func))) + "Sample. C++ word-to-database mappings.") + +(defconst tinytag-:example-db-map-java + '((func "emacs-config-tinytag-java-functions.txt")) + "Sample. Java databases.") + +(defconst tinytag-:example-db-re-java + '(("." (func))) ;; All words are looked from `func' database + "Sample. Map found word to correct Java database.") + +;;; You propably should program your own filter function for variaous +;;; modes. This variable belongs to default filter only. +;;; +(defcustom tinytag-:filter-default-c++-words + (concat + "^char\\|^double\\|^int$\\|^float\\|^void\\|static" + "\\|endif\\|define\\|ifndef\\|ifdef\\|include" + "\\|break") + "*Filter out unwanted words from current point. +This variable is used in `tinytag-filter-default-function'." + :type '(string "Regexp") + :group 'TinyTag) + +;;; ........................................................ &v-public ... +;;; user configurable + +(defcustom tinytag-:output-buffer "*tinytag-output*" + "*Buffer where to display all database matches for word at point. +Many times the word picked at point matches several functions and you +can keep this buffer in separate frame in Window environment to see what +is the correct match. +If this variable is nil, no buffer is created.") + +(defcustom tinytag-:database-dir + (or + (file-name-as-directory + (file-name-directory (ti::package-config-file-prefix "tinytag.el"))) + (error "TinyTag: Can't set default value for `tinytag-:database-dir'. +Please define the directory of database directory to `tinytag-:database-dir'.")) + "*Directory of database files." + :type 'directory + :group 'TinyTag) + +(defcustom tinytag-:filter-word-table + (list + (list + (concat + "c-mode\\|cc-mode\\|c[+]+-mode" + ;;See tinylibid.el + "\\|code-c\\|code-c[+]+") + '(or (< (length string) 4) ;too short word ? + (string-match tinytag-:filter-default-c++-words string)))) + "*Format is: + +'((BUFFER-TYPE-REGEXP EVAL-STATEMENT-TO-REJECT) (B E) ..) + +If buffer type/mode matches REGEXP then the eval statement is evaluated +for current word that is stored into 'string'. The statement should return +t if word should be rejected. During the eval, any matches done are +case sensitive." + :type '(repeat + (string :tag "buffer type regexp") + (sexp :tag "Form")) + :group 'TinyTag) + +(defcustom tinytag-:database-setup-table + (list + (list + (concat + ;; See tinylibid.el to detect buffer type + "c-mode\\|cc-mode\\|c[+]+-mode" + "\\|code-c\\|code-c[+]+") + '(tinytag-:example-db-map-c++ + tinytag-:example-db-re-c++)) + (list + "java" + '(tinytag-:example-db-map-java + tinytag-:example-db-re-java))) + "*If buffer type/mode match REGEXP then set database variables. +Cariables `tinytag-:database-map' and +`tinytag-:regexp-to-databases' are used. + +The BUFFER-TYPE-REGEXP corresponds the value returned by ti::id-info +for current buffer. The function detects various progrmaming. + +Format: + +'((BUFFER-TYPE-REGEXP (DATABASE-MAP-SYM DATABASE-REGEXP-SYM)) + ..)" + :type '(repeat + (list + (string :tag "mode regexp") + (list + (symbol :tag "db map sym") + (symbol :tag "db regexp sym")))) + :group 'TinyTag) + +(defcustom tinytag-:display-function 'tinytag-display-function + "*Function to display search results. +Should accept one ARG, which is list of matched lines from databases." + :type 'function + :group 'TinyTag) + +;;}}} +;;{{{ version + +;;;### (autoload 'tinytab-debug-toggle "tinytag" t t) + +(eval-and-compile (ti::macrof-debug-standard "tinytag" "-:")) + +(eval-and-compile + (ti::macrof-version-bug-report + "tinytag.el" + "tinytag" + tinytag-:version-id + "$Id: tinytag.el,v 2.53 2007/05/01 17:21:00 jaalto Exp $" + '(tinytag-:version-id + tinytag-:debug + tinytag-:load-hook + tinytag-:try-hook + tinytag-:set-database-hook + tinytag-:last-word-lookup + tinytag-:noerror + tinytag-:post-command-hook-counter + tinytag-:post-command-hook-wakeup + tinytag-:example-db-map-c++ + tinytag-:example-db-re-c++ + tinytag-:database-dir + tinytag-:database-map + tinytag-:regexp-to-databases + tinytag-:display-function + post-command-idle-hook + post-command-hook) + '(tinytag-:debug-buffer))) + +;;}}} +;;{{{ code: install + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-initialize () + "Start package and verify that some variables exist." + (interactive) + (let* () + (if (or (not (stringp tinytag-:database-dir)) + (not (file-exists-p tinytag-:database-dir))) + (error "\ +TinyTag: `tinytag-:database-dir' is not a directory. Please configure")))) + +;;; ---------------------------------------------------------------------- +;;; +;;;###autoload +(defun tinytag-install (&optional uninstall) + "Install package. Optionally UNINSTALL." + (interactive "P") + (let* ((hook (if (boundp 'post-command-idle-hook) + ;; post-command-idle-hook became obsolete in 19.34 + 'post-command-idle-hook + 'post-command-hook)) + (cmd (if uninstall + 'remove-hook + 'add-hook))) + (cond + ((ti::idle-timer-supported-p) + (ti::compat-timer-cancel-function 'tinytag-post-command) + (unless uninstall + (setq + tinytag-:idle-timer-elt + (ti::funcall + 'run-with-idle-timer + 2 + 'repeat + 'tinytag-post-command)))) + (t + ;; We use post-command-idle-hook if defined, + ;; otherwise put it on post-command-hook. + ;; The idle hook appeared in Emacs 19.30. + (funcall cmd hook 'tinytag-post-command))) + (when (interactive-p) + (message "TinyTag: Package %s" (if uninstall + "deactivated" + "activated"))))) + +;;; ---------------------------------------------------------------------- +;;; +;;;###autoload +(defun tinytag-uninstall () + "Uninstall package." + (tinytag-install 'uninstall)) + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-install-sample-database-java-external-process (doc-dir file) + "Call external process to examine DOC-DIR to build Java function calls. +The output is written to FILE." + (let* ((info (ti::process-perl-version "perl")) + (perl (nth 2 info)) + ;; (type (nth 1 info)) + (bin "java-function-list.pl") + (prg (ti::file-get-load-path bin exec-path))) + (cond + ((null perl) + (message + (concat + "Tinytag: [install] Cannot find `perl' along path. " + "Please check your PATH or install perl. " + (if (ti::win32-p) + "http://www.activestate.com" + "http://www.perl.com/")))) + ((null prg) + (message + (concat + "Tinytag: [install] Cannot find " bin + " please check your PATH"))) + (t + (unless (file-directory-p + (file-name-directory file)) + (error "Tinytag: Can't find directory %s" file)) + (with-temp-buffer + ;; Java 1.3-1.4 documentation size, when processes, is 1.5 Meg + ;; It will fit into memory. + (message + (concat + "Tinytag: [install] Java database... " + "Please wait for external process to traverse %s") doc-dir) + (call-process perl + nil + (current-buffer) + nil + prg + "--recurse" + doc-dir) + (message "Tinytag: [install] Java database...done. Size %d" + (buffer-size)) + ;; perl syntax error in line NNNN + (when (ti::re-search-check " line [0-9]") + (error "Tinytag: Failed to call %s\n\ [Perl error] %s" + prg (buffer-string))) + (when (ti::buffer-empty-p) + (error "Tinytag: %s with %s didn't return anything." + prg doc-dir)) + (write-region (point-min) (point-max) file) + (message "Tinytag: [install] Java database...done %s" + file)))))) + +;;; ---------------------------------------------------------------------- +;;; +;;;###autoload +(defun tinytag-install-sample-database-java () + "Install Java database from Sub JDK documentation." + (interactive) + (tinytag-initialize) + (let* ((java-info (progn + (message "TinyTag: Wait, checking java...") + (prog1 (ti::process-java-version) + (message "TinyTag: Wait, checking java...done.")))) + (case-fold-search t)) + (cond + ((not java-info) + (message + (concat + "Tinytag: [install] Skipped. No `java' binary found along PATH." + " Java sample database will not be installed."))) + (t + ;; path to `java' binary could be something like + ;; i:/java/sun/jdk1.3_02/bin/java + ;; + ;; The Java documentation si assumed to be under + ;; i:/java/sun/jdk1.3_02/docs/ + ;; + (let* ((java (nth 2 java-info)) ;; path + (dir (file-name-directory java)) + (root (and dir (ti::directory-up dir))) + (doc-dir (and root (concat (file-name-as-directory root) + "docs"))) + (out-dir (file-name-as-directory tinytag-:database-dir)) + (db (concat + out-dir + (nth 1 (assq 'func tinytag-:example-db-map-java))))) + (cond + ((and (stringp doc-dir) + (file-directory-p doc-dir)) + (if (file-exists-p db) + (message + "Tinytag: [install] Skipped. Database already exists %s" + db) + (tinytag-install-sample-database-java-external-process + doc-dir db))) + (t + (message "Tinytag: [install] Can't find java docs/ dir [%s]" + doc-dir)))))))) + +;;; ---------------------------------------------------------------------- +;;; +;;;###autoload +(defun tinytag-install-sample-database-c () + "Install c/C++ database from file tintytag.el." + (interactive) + (tinytag-initialize) + (let* ((case-fold-search t) + (file (locate-library "tinytag.el")) + (dir (file-name-as-directory tinytag-:database-dir)) + (db (concat + dir + (nth 1 (assq 'func tinytag-:example-db-map-c++)))) + buffer) + (unless (stringp file) + (error "Tinytag: [install] cannot find tinytag.el along load-path.")) + (setq buffer (ti::package-install-example "tinytag.el")) + (with-current-buffer buffer + (if (not (re-search-forward "Sample.*function database" nil t)) + (error "Tinytag: [install] Cannot find start of example section.") + ;; Remove all before the database. + (beginning-of-line) + (delete-region (point-min) (point)) + (cond + ((string-match "hpux" (emacs-version)) + ;; GNU Emacs 19.28.1 (hppa1.1-hp-hpux9, X toolkit) + ;; + (re-search-forward "END HP-UX") + (forward-line 1) + (delete-region (point) (point-max))) + (t + ;; GNU Emacs 19.33.1 (i386-unknown-netbsd1.1, X toolkit) + ;; + (re-search-forward "# NetBSD Sample") + (beginning-of-line) (delete-region (point-min) (point)) + (re-search-forward "# END NetBSD") + (forward-line 1) + (delete-region (point) (point-max)))) + + (if (file-exists-p db) + (message + "Tinytag: [install] Skipped. Database already exists %s" db) + (message "Tinytag: [install] C/C++ database...") + (write-region (point-min) (point-max) db) + (message + "Tinytag: [install] C/C++ database...installed %s" db)))))) + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-install-sample-databases () + "Install Sample databases: C/C++ and Java. +This function sets ´tinytag-install-sample-databases' +property 'done to non-nil value, when called." + (tinytag-install-sample-database-c) + (tinytag-install-sample-database-java) + ;; This is signal for other setups, that can check if functon + ;; has already been called (not to install databases multiple times) + (put 'tinytag-install-sample-databases 'done t) + (ti::kill-buffer-safe "*ti::pkg*")) + +;;}}} + +;;{{{ code: misc + +;;; ---------------------------------------------------------------------- +;;; +(defsubst tinytag-word-at-point () + "Read word on current point." + (if (looking-at "[.a-z0-9_]+[ \t\n\r]*(") ;is here word ? + (ti::buffer-read-word "-_.A-Za-z0-9" ))) + +;;; ---------------------------------------------------------------------- +;;; +(defsubst tinytag-display (list) + "Call display function with LIST." + (funcall tinytag-:display-function list)) + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-display-function (list) + "Display car of LIST and count of LIST. +Output matched to tinytag-:output-buffer too." + (when (stringp tinytag-:output-buffer) + (with-current-buffer (get-buffer-create tinytag-:output-buffer) + (erase-buffer) + (dolist (line list) + (insert line "\n")))) + (message + (format + "%s: %s" (length list) (car list)))) + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-filter-default-function (string) + "Default filter function. Reject STRING." + (let* ((fid "tinytag-filter-default-function: ") + (id (or (ti::id-info nil 'variable-lookup) + (symbol-name major-mode))) + (table tinytag-:filter-word-table) + (accept t) + (case-fold-search nil) ;Case is important here + elt) + (when (and (setq elt (ti::list-find table id)) + (eval (nth 1 elt))) + (setq accept nil)) + (tinytag-debug fid " ret accept" accept "elt" elt "\n") + accept)) + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-word-default-adjust (string) + "Convert STRING to suitable regexp. +Currently supports only C/C++ and Java." + (let ((fid "tinytag-word-default-adjust: ") + (id (or (ti::id-info nil 'variable-lookup) + (symbol-name major-mode))) + (ret string)) + (cond + ((string-match "c[+]+\\|code-c\\|c-mode\\|cc-mode" id) + ;; + ;; We suppose database format + ;; " function(definition...)" + ;; + ;; Notice the '*' which matches functions returning a pointer + ;; ring.h> char *strcat( + ;; + (setq ret (format "[ \t*]%s[ \t]*(" string))) + ((string-match "java" id) + ;; + ;; We suppose database format + ;; + ;; java.lang.System.out void print(boolean b) + ;; java.lang.System.out void print(Object obj) + ;; + ;; --> System.out.*print\\> + ;; + ;; But there is a problem with variables + ;; + ;; Runtime rt = Runtime.getRuntime(); + ;; long free = rt.freeMemory(); + ;; *cursor here --> grabbed "rt.freeMemory" + ;; + ;; --> Search last word after dot too. + ;; + (let (class + function) + (tinytag-debug fid "java" (string-match "^(.*\\.)(.*)$" string) + ret "\n") + (cond + ((string-match "\\(.+\\)\\.\\(.*\\)$" string) + (setq class (match-string 1 string) + function (match-string 2 string) + ret (format "%s.*%s\\>" + (regexp-quote class) + (regexp-quote function))) + ;; If the name is "System.something", the assume that the first word + ;; is pure java Class. + ;; + ;; If the name is in lowercase, assume that it is variable and + ;; search for plain function name as well. + (unless (ti::string-match-case "^[A-Z]" class) + (setq ret (format "%s\\| %s(" ret function)))) + ((not (string-match "\\." string)) + (setq ret (format "\\<%s[ \t]*(" + (regexp-quote string)))))))) + (tinytag-debug fid "ret" ret "\n") + ret)) + +;;}}} +;;{{{ code: search engine + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-search-db (re single-or-list) + "Search RE from databases in SINGLE-OR-LIST. + +References: + + `tinytag-:database-map' + `tinytag-:database-dir' + `tinytag-:noerror' + `tinytag-:word-modify-hook' + +Return: + + list '(line line ..) matched lines or nil." + (tinytag-initialize) + (let* ((fid "tinytag-search-db: ") + (table tinytag-:database-map) + (noerr tinytag-:noerror) + (dir (file-name-as-directory tinytag-:database-dir)) + (list (ti::list-make single-or-list)) + buffer + file + ret) + (tinytag-debug fid " input" re single-or-list "\n") + (dolist (elt list) + (when (setq elt (assq elt table)) + (setq file (concat + (file-name-as-directory dir) + (nth 1 elt))) + (setq buffer (or (get-file-buffer file) + (and (file-exists-p file) + (find-file-noselect file)))) + (tinytag-debug fid " buffer" buffer "file" file "\n") + ;; ......................................... search or no file ... + (cond + ((and + buffer + (setq re (run-hook-with-args-until-success + 'tinytag-:word-modify-hook re))) + (tinytag-debug fid " regexp" re "\n") + (with-current-buffer buffer + (ti::pmin) + (setq ret (ti::buffer-grep-lines re)))) + ((null noerr) + (error "No database to search %s" file))))) ;; when-dolist + (tinytag-debug fid "RET" ret "\n") + ret)) + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-do-search (string) + "Search those databases which match predefined regexp against STRING. + +References: + `tinytag-:regexp-to-databases' + +Return: + list '(db-matched-line ..) or nil" + (let* ((fid "tinytag-do-search: ") + (table tinytag-:regexp-to-databases) + e + db + re + ret) + (tinytag-debug fid "string" string "\n") + (when (run-hook-with-args-until-success + 'tinytag-:word-filter-hook string) + (dolist (elt table) + (setq re (car elt) + db (nth 1 elt)) + (when (string-match re string) + (setq ret (tinytag-search-db string db)) + (tinytag-debug fid " MATCH" "re" re "str" string "ret" ret"\n") + (return)))) + ret)) + +;;}}} +;;{{{ code: try funcs + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-try-function-show-cached-word (&optional noerr) + "Pick word at point and show info if word was same as previously looked. +NOERR ignores errors." + (interactive) + (let* ((word (tinytag-word-at-point)) + (prev-word (car-safe tinytag-:last-word-lookup)) + (prev-info (cdr-safe tinytag-:last-word-lookup)) + (err (or noerr tinytag-:noerror)) + (fid "tinytag-try-function-show-cached-word: ")) + (catch 'quit + (tinytag-debug fid + "word" word + "previous word" prev-word + "previous info" prev-info + "error flag" err + "\n") + (when (not (stringp word)) + (if (null err) + (message "tinytag: No word at point.")) + (throw 'quit t)) + + (when (and (not (null prev-word)) + (not (null prev-info)) + (string= word prev-word)) + (tinytag-display prev-info) + (throw 'quit t))))) + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-try-function-search-db () + "Do lookup, pick word at point and search databases. +Show the matched word from database." + (interactive) + (let* ((fid "tinytag-try-function-search-db: ") + (word (tinytag-word-at-point)) + info) + (tinytag-debug fid "word" word "\n") + (when (and (stringp word) + (run-hook-with-args-until-success 'tinytag-:set-database-hook) + (setq info (tinytag-do-search word))) + (setq tinytag-:last-word-lookup (cons word info)) + (tinytag-display info) + t))) + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-try-function-man () + "Suggest man page search for current word." + (interactive) + (let* ((word (ti::buffer-read-word)) + ;; only in 19.30 +;;; (syntax-elt (fexec 'c-guess-basic-syntax)) +;;; (syntax (car-safe syntax-elt)) + ans) + (when + (and word ;; (memq syntax '(statement nil)) + (y-or-n-p (concat "Run man on " word)) + (not + (ti::nil-p + (setq ans (read-from-minibuffer "Man cmd: " word))))) + (man ans) + t))) + +;;}}} +;;{{{ main + +;;; ---------------------------------------------------------------------- +;;; +;;;###autoload +(defun tinytag-main () + "Run `tinytag-:try-hook' until some of the functions return non-nil." + (interactive) + (run-hook-with-args-until-success 'tinytag-:try-hook)) + +;;; ---------------------------------------------------------------------- +;;; +;;;###autoload +(defun tinytag-main-mouse (&optional event) + "See `tinytag-main'. Function is called with mouse EVENT." + (interactive "e") + (tinytag-main)) + +;;}}} +;;{{{ code: example + +;;; ---------------------------------------------------------------------- +;;; +(defun tinytag-post-command-1 () + "Do lookup." + ;; ... ... ... ... ... ... ... ... ... ... ... ... ... do action . . + ;; + (when (and + (run-hook-with-args-until-success 'tinytag-:set-database-hook) + (run-hook-with-args-until-success 'tinytag-:post-command-try-hook)) + ;; This is needed in 19.30<, so that the + ;; message doesn't get wiped away. + ;; + ;; (unless (fboundp 'post-command-idle-hook) + ;; (sleep-for 1)) + ;;(discard-input) + nil)) + +;;; ---------------------------------------------------------------------- +;;; - The functionality is copied from Noah's +;;; eldoc.el: eldoc-mode-print-current-symbol-info +;;; +;;;###autoload +(defun tinytag-post-command () + "Activates only if `tinytag-:set-database-hook' wakes up. +Show the database definition for the current word under point. + +References: + + `tinytag-:noerror' + `tinytag-:post-command-hook-wakeup' + `tinytag-:set-database-hook'" + (let* ((tinytag-:noerror t) + it-is-time) + (when (and (not (ti::compat-executing-macro)) + ;; Having this mode operate in the minibuffer + ;; makes it impossible to + ;; see what you're doing. + (not (eq (selected-window) (minibuffer-window))) + (symbolp this-command) + (sit-for 0.50) + ;; Is this programming language supported? + (run-hook-with-args-until-success + 'tinytag-:set-database-hook)) + ;; ... ... ... ... ... ... ... ... ... ... ... ... wakeup time? . . + ;; This is not used if we're in 19.34 + ;; + (cond + ((fboundp 'run-with-idle-timer) + (setq it-is-time t)) + (t + (if (null tinytag-:post-command-hook-counter) + (setq tinytag-:post-command-hook-counter 0)) + ;; Don't wake up all the time.. saves Emacs processing time. + ;; + (setq + it-is-time + (or (eq 0 tinytag-:post-command-hook-wakeup) + (and (not (eq 0 tinytag-:post-command-hook-counter)) + (eq 0 (% tinytag-:post-command-hook-counter + tinytag-:post-command-hook-wakeup))))) + (incf tinytag-:post-command-hook-counter) + (if it-is-time ;do reset + (setq tinytag-:post-command-hook-counter 0)))) + ;; ... ... ... ... ... ... ... ... ... ... ... ... ... do action . . + ;; + (if it-is-time + (tinytag-post-command-1))))) + +;;; ---------------------------------------------------------------------- +;;; This is default function. Copy this and you _have_to_ write your own. +;;; +(defun tinytag-set-database () + "Set correct database values according to buffer content. +Return: + non-nil or nil was the database set according to buffer?" + (let* ((id (or (ti::id-info nil 'variable-lookup) + (symbol-name major-mode))) + ;; read last word, delete rest + ;; + (table tinytag-:database-setup-table) + elt + did-it) + (cond + ((and (setq elt (ti::list-find table id)) + (setq elt (nth 1 elt))) ;Get second list + (setq tinytag-:database-map (eval (nth 0 elt)) + tinytag-:regexp-to-databases (eval (nth 1 elt)) + did-it (nth 0 elt))) + (t + ;; Disable search. We don't know database for this buffer + ;; + (setq tinytag-:database-map nil + tinytag-:regexp-to-databases nil))) + + (if did-it + (run-hooks 'tinytag-:database-ok-hook)) + did-it)) + +;;}}} +;;{{{ example: perl script for creating your own database + +;;; ..................................................... &example-c++ ... + +;;; Here sript which you can use to generate database lines from +;;; manual page files. I would have included mine, but it uses my private +;;; perl libs and it's much bigger than Peter's handy script. + +;;* #! /usr/local/perl5/bin/perl +;;* # +;;* # Peter Simons +;;* # (#) Script to make C++ function database for Emacs tinytag.el +;;* _ +;;* foreach $filename (@ARGV) { +;;* open(INFILE, $filename) || die("Can't open file $filename."); +;;* @lines = ; +;;* chop(@lines); +;;* $lines_num = @lines; +;;* for ($isSynopsis = 0, $includes = "", $curr_line = "", $i = 0; +;;* $i < $lines_num; $i++) { +;;* $lines[$i] =~ s/.//g; +;;* if ($lines[$i] =~ /^SYNOPSIS$/) { +;;* $isSynopsis = 1; +;;* next; +;;* } +;;* if ($lines[$i] =~ /^DESCRIPTION$/) { +;;* $isSynopsis = 0; +;;* $includes = ""; +;;* $curr_line = ""; +;;* last; +;;* } +;;* if ($isSynopsis == 1) { +;;* if ($lines[$i] =~ /^ *#include/) { +;;* $lines[$i] =~ s/^.*<(.*)>$/<$1>/; +;;* $includes = $includes . $lines[$i]; +;;* } +;;* elsif ($lines[$i] =~ /^$/) { +;;* if ($curr_line ne "") { +;;* $curr_line =~ s/ +/ /g; +;;* if ($includes eq "") { +;;* printf("$curr_line\n"); +;;* } +;;* else { +;;* printf("$includes$curr_line\n"); +;;* } +;;* $curr_line = ""; +;;* } +;;* } +;;* else { +;;* $curr_line = $curr_line . $lines[$i]; +;;* } +;;* } +;;* } +;;* } + +;; }}} +;; {{{ example: HP-UX simple database + +;;; Rip code with with tinylib.el/ti::package-rip-magic +;;; These databases are automatically intalled when call +;;; M-x tinytag-install-sample-database-c + +;;* # HP-UX Sample C++ function database +;;* # +;;* # HP 10, The C/C++ function call definitions from man 3C and 2. +;;* # Not guarrantees, that are calls are here. +;;* # +;;* _ +;;* DIR *opendir(const char *dirname); +;;* int closedir(DIR *dirp); +;;* int readdir_r(DIR *dirp, struct dirent *result); +;;* long int telldir(DIR *dirp); +;;* struct dirent *readdir(DIR *dirp); +;;* void rewinddir(DIR *dirp); +;;* void seekdir(DIR *dirp, long int loc); +;;* extern char *loc1, *loc2, *locs; +;;* extern int circf, sed, nbra; +;;* int advance(const char *string, const char *expbuf); +;;* int step(const char *string, const char *expbuf); +;;* FILE *fdopen(int fildes, const char *type); +;;* FILE *fopen(const char *pathname, const char *type); +;;* FILE *freopen(const char *pathname, const char *type, FILE *stream); +;;* FILE *stream); +;;* int fclose(FILE *stream); +;;* int fclose_unlocked(FILE *stream); +;;* int feof(FILE *stream); +;;* int feof_unlocked(FILE *stream); +;;* int ferror(FILE *stream); +;;* int ferror_unlocked(FILE *stream); +;;* int fflush(FILE *stream); +;;* int fflush_unlocked(FILE *stream); +;;* int fscanf(FILE *stream, const char *format, /* [pointer,] */ ...); +;;* int fseek(FILE *stream, long int offset, int whence); +;;* int fseek_unlocked(FILE *stream, long int offset, int whence); +;;* int scanf(const char *format, /* [pointer,] */ ...); +;;* int sscanf(const char *s, const char *format, /* [pointer,] */ ...); +;;* long int ftell(FILE *stream); +;;* long int ftell_unlocked(FILE *stream); +;;* size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream); +;;* size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream); +;;* void clearerr(FILE *stream); +;;* void clearerr_unlocked(FILE *stream); +;;* void rewind(FILE *stream); +;;* void rewind_unlocked(FILE *stream); +;;* int system(const char *command); +;;* void abort(void); +;;* char *index(const char *s, int c); +;;* char *rindex(const char *s, int c); +;;* char *strcat(char *s1, const char *s2); +;;* char *strchr(const char *s, int c); +;;* char *strcpy(char *s1, const char *s2); +;;* char *strdup(const char *s); +;;* char *strncat(char *s1, const char *s2, size_t n); +;;* char *strncpy(char *s1, const char *s2, size_t n); +;;* char *strpbrk(const char *s1, const char *s2); +;;* char *strrchr(const char *s, int c); +;;* char *strrstr(const char *s1, const char *s2); +;;* char *strstr(const char *s1, const char *s2); +;;* char *strtok(char *s1, const char *s2); +;;* char *strtok_r(char *s1, const char *s2, char **last); +;;* int strcasecmp(const char *s1, const char *s2); +;;* int strcmp(const char *s1, const char *s2); +;;* int strcoll(const char *s1, const char *s2); +;;* int strncasecmp(const char *s1, const char *s2, size_t n); +;;* int strncmp(const char *s1, const char *s2, size_t n); +;;* size_t strcspn(const char *s1, const char *s2); +;;* size_t strlen(const char *s); +;;* size_t strspn(const char *s1, const char *s2); +;;* size_t strxfrm(char *s1, const char *s2, size_t n); +;;* char *asctime(const struct tm *timeptr); +;;* char *ctime(const time_t *timer); +;;* double difftime(time_t time1, time_t time0); +;;* extern char *tzname[2]; +;;* extern int daylight; +;;* extern long timezone; +;;* int asctime_r(const struct tm *timeptr, char *buffer, int buflen); +;;* int ctime_r(const time_t *timer, char *buffer, int buflen); +;;* int gmtime_r(const time_t *timer, struct tm *result); +;;* int localtime_r(const time_t *timer, struct tm *result); +;;* struct tm *gmtime(const time_t *timer); +;;* struct tm *localtime(const time_t *timer); +;;* time_t mktime(struct tm *timeptr); +;;* void tzset(void); +;;* char *getcwd(char *buf, size_t size); +;;* _ +;;* # +;;* # HP 10 man 2 pages +;;* # +;;* int stat(const char *path, struct stat *buf); +;;* int lstat(const char *path, struct stat *buf); +;;* int fstat(int fildes, struct stat *buf); +;;* void exit(int status); +;;* void _exit(int status); +;;* pid_t getpid(void); +;;* pid_t getpgrp(void); +;;* pid_t getppid(void); +;;* pid_t getpgrp2(pid_t pid); +;;* int link(const char *path1, const char *path2); +;;* time_t time(time_t *tloc); +;;* int send(int s, const void *msg, int len, int flags); +;;* int tolen); +;;* int sendmsg(int s, const struct msghdr msg[], int flags); +;;* extern char **environ; +;;* int execv(const char *path, char * const argv[]); +;;* int execve(const char *file, char * const argv[], char * const envp[]); +;;* int execvp(const char *file, char * const argv[]); +;;* unsigned int alarm(unsigned int sec); +;;* clock_t times(struct tms *buffer); +;;* extern int errno; +;;* ssize_t write(int fildes, const void *buf, size_t nbyte); +;;* ); +;;* pid_t fork(void); +;;* int close(int fildes); +;;* int unlink(const char *path); +;;* extern char **environ; +;;* int execv(const char *path, char * const argv[]); +;;* int execve(const char *file, char * const argv[], char * const envp[]); +;;* int execvp(const char *file, char * const argv[]); +;;* int stime(const time_t *tp); +;;* long ulimit(int cmd, ...); +;;* pid_t wait(int *stat_loc); +;;* pid_t waitpid(pid_t pid, int *stat_loc, int options); +;;* pid_t wait3(int *stat_loc, int options, int *reserved); +;;* int getitimer(int which, struct itimerval *value); +;;* int setuid(uid_t uid); +;;* int setgid(gid_t gid); +;;* int setresuid(uid_t ruid, uid_t euid, uid_t suid); +;;* int setresgid(gid_t rgid, gid_t egid, gid_t sgid); +;;* int kill(pid_t pid, int sig); +;;* int raise(int sig); +;;* void (*signal(int sig, void (*action)(int)))(int); +;;* int rmdir(const char *path); +;;* pid_t wait(int *stat_loc); +;;* pid_t waitpid(pid_t pid, int *stat_loc, int options); +;;* pid_t wait3(int *stat_loc, int options, int *reserved); +;;* int pause(void); +;;* int symlink(const char *name1, const char *name2); +;;* int sigsuspend(const sigset_t *sigmask); +;;* size_t read(int fildes, void *buf, size_t nbyte); +;;* ); +;;* extern char **environ; +;;* int execv(const char *path, char * const argv[]); +;;* int execve(const char *file, char * const argv[], char * const envp[]); +;;* int execvp(const char *file, char * const argv[]); +;;* int access(char *path, int amode); +;;* int mknod(const char *path, mode_t mode, dev_t dev); +;;* int creat(const char *path, mode_t mode); +;;* int mkdir(const char *path, mode_t mode); +;;* size_t read(int fildes, void *buf, size_t nbyte); +;;* int ustat(dev_t dev, struct ustat *buf); +;;* int chmod(const char *path, mode_t mode); +;;* int fchmod(int fildes, mode_t mode) +;;* _ +;;* # END HP-UX Sample C++ function database + +;; }}} +;; {{{ example: NetBSD 1.2 database + +;;* # NetBSD Sample 1.2 +;;* # collected by Peter Simons +;;* # Thu Oct 17 16:31:10 MET DST 1996 +;;* # +;;* assert(expression) +;;* bit_clear(bit_str name, int bit) +;;* bit_decl(bit_str name, int nbits) +;;* bit_ffc(bit_str name, int nbits, int *value) +;;* bit_ffs(bit_str name, int nbits, int *value) +;;* bit_nclear(bit_str name, int start, int stop) +;;* bit_nset(bit_str name, int start, int stop) +;;* bit_set(bit_str name, int bit) +;;* bit_test(bit_str name, int bit) +;;* bitstr_size(int nbits) +;;* bitstr_t * bit_alloc(int nbits) +;;* int isalnum(int c) +;;* int isalpha(int c) +;;* int isascii(int c) +;;* int isblank(int c) +;;* int iscntrl(int c) +;;* int isdigit(int c) +;;* int isgraph(int c) +;;* int islower(int c) +;;* int isprint(int c) +;;* int ispunct(int c) +;;* int isspace(int c) +;;* int isupper(int c) +;;* int isxdigit(int c) +;;* int tolower(int c) +;;* int toupper(int c) +;;* int getdirentries(int fd, char *buf, int nbytes, long *basep) +;;* char * dlerror(void) +;;* int dlclose(void *handle) +;;* int dlctl(void *handle, int cmd, void *data) +;;* void * dlopen(char *path, int mode) +;;* void * dlsym(void *handle, char *symbol) +;;* void err(int eval, const char *fmt, ...) +;;* void errx(int eval, const char *fmt, ...) +;;* void verr(int eval, const char *fmt, va_list args) +;;* void verrx(int eval, const char *fmt, va_list args) +;;* void vwarn(const char *fmt, va_list args) +;;* void vwarnx(const char *fmt, va_list args) +;;* void warn(const char *fmt, ...) +;;* void warnx(const char *fmt, ...) +;;* int fcntl(int fd, int cmd, int arg) +;;* int open(const char *path, int flags, mode_t mode) +;;* int kvm_close(kvm_t *kd) +;;* kvm_t * kvm_open(const char *execfile, const char *corefile, char *swapfile, int flags, const char *errstr) +;;* kvm_t * kvm_openfiles(const char *execfile, const char *corefile, char *swapfile, int flags, char *errbuf) +;;* int fnmatch(const char *pattern, const char *string, int flags) +;;* int setfsent(void) +;;* struct fstab * getfsent(void) +;;* struct fstab * getfsfile(const char *file) +;;* struct fstab * getfsspec(const char *spec) +;;* void endfsent(void) +;;* int glob(const char *pattern, int flags, const int (*errfunc)(const char *, int), glob_t *pglob) +;;* void globfree(glob_t *pglob) +;;* char * kvm_geterr(kvm_t *kd) +;;* ssize_t kvm_read(kvm_t *kd, u_long addr, void *buf, size_t nbytes) +;;* ssize_t kvm_write(kvm_t *kd, u_long addr, const void *buf, size_t nbytes) +;;* int kvm_nlist(kvm_t *kd, struct nlist *nl) +;;* char * kvm_getfiles(kvm_t *kd, int op, int arg, int *cnt) +;;* char ** kvm_getargv(kvm_t *kd, const struct kinfo_proc *p, int nchr) +;;* char ** kvm_getenvv(kvm_t *kd, const struct kinfo_proc *p, int nchr) +;;* struct kinfo_proc * kvm_getprocs(kvm_t *kd, int op, int arg, int *cnt) +;;* int radixsort(u_char **base, int nmemb, u_char *table, u_int endbyte) +;;* int sradixsort(u_char **base, int nmemb, u_char *table, u_int endbyte) +;;* int sysarch(int number, char *args) +;;* double acos(double x) +;;* double acosh(double x) +;;* double asin(double x) +;;* double asinh(double x) +;;* double atan(double x) +;;* double atan2(double y, double x) +;;* double atanh(double x) +;;* double cabs(z) +;;* double cbrt(double x) +;;* double ceil(double x) +;;* double copysign(double x, double y) +;;* double cos(double x) +;;* double cosh(double x) +;;* double erf(double x) +;;* double erfc(double x) +;;* double exp(double x) +;;* double expm1(double x) +;;* double fabs(double x) +;;* double floor(double x) +;;* double fmod(double x, double y) +;;* double frexp(double value, int *exp) +;;* double hypot(double x, double y) +;;* double j0(double x) +;;* double j1(double x) +;;* double jn(int n, double x) +;;* double ldexp(double x, int exp) +;;* double lgamma(double x) +;;* double log(double x) +;;* double log10(double x) +;;* double log1p(double x) +;;* double logb(double x) +;;* double modf(double value, double *iptr) +;;* double nextafter(double x, double y) +;;* double pow(double x, double y) +;;* double remainder(double x, double y) +;;* double rint(double x) +;;* double scalb(double x, double n) +;;* double scalbn(double x, int n) +;;* double significand(double x) +;;* double sin(double x) +;;* double sinh(double x) +;;* double sqrt(double x) +;;* double tan(double x) +;;* double tanh(double x) +;;* double y0(double x) +;;* double y1(double x) +;;* double yn(int n, double x) +;;* erff(float x) +;;* extern int signgam; +;;* float acosf(float x) +;;* float acoshf(float x) +;;* float asinf(float x) +;;* float asinhf(float x) +;;* float atan2f(float y, float x) +;;* float atanf(float x) +;;* float atanhf(float x) +;;* float cbrtf(float x) +;;* float ceilf(float x) +;;* float copysignf(float x, float y) +;;* float cosf(float x) +;;* float coshf(float x) +;;* float erfcf(float x) +;;* float expf(float x) +;;* float expm1f(float x) +;;* float fabsf(float x) +;;* float floorf(float x) +;;* float fmodf(float x, float y) +;;* float hypotf(float x, float y) +;;* float j0f(float x) +;;* float j1f(float x) +;;* float jnf(int n, float x) +;;* float lgammaf(float x) +;;* float log10f(float x) +;;* float log1pf(float x) +;;* float logbf(float x) +;;* float logf(float x) +;;* float nextafterf(float x, float y) +;;* float powf(float x, float, y") +;;* float remainderf(float x, float y) +;;* float rintf(float x) +;;* float scalbf(float x, float n) +;;* float scalbnf(float x, int n) +;;* float significand(float x) +;;* float sinf(float x) +;;* float sinhf(float x) +;;* float sqrtf(float x) +;;* float tanf(float x) +;;* float tanhf(float x) +;;* float y0f(float x) +;;* float y1f(float x) +;;* float ynf(int n, float x) +;;* int finite(double x) +;;* int finitef(float x) +;;* int ilogb(double x) +;;* int ilogbf(float x) +;;* char * hstrerror(int err) +;;* endnetent() +;;* endprotoent() +;;* setnetent(int stayopen) +;;* setprotoent(int stayopen) +;;* struct hostent * gethostbyaddr(const char *addr, int len, int type) +;;* struct hostent * gethostbyname(const char *name) +;;* struct hostent * gethostent(void) +;;* struct netent * getnetbyaddr(long net, int type) +;;* struct netent * getnetbyname(char *name) +;;* struct netent * getnetent() +;;* struct protoent * getprotobyname(char *name) +;;* struct protoent * getprotobynumber(int proto) +;;* struct protoent * getprotoent() +;;* struct rpcent * getrpcbyname(char *name) +;;* struct rpcent * getrpcbynumber(int number) +;;* struct rpcent * getrpcent(void) +;;* struct servent * getservbyname(char *name, char *proto) +;;* struct servent * getservbyport(int port, proto) +;;* struct servent * getservent() +;;* void endhostent(void) +;;* void endrpcent(void) +;;* void endservent(void) +;;* void herror(char *string) +;;* void sethostent(int stayopen) +;;* void setrpcent(int stayopen) +;;* void setservent(int stayopen) +;;* char * ether_ntoa(struct ether_addr *e) +;;* ether_hostton(char *hostname, struct ether_addr *e) +;;* ether_line(char *l, struct ether_addr *e, char *hostname) +;;* ether_ntohost(char *hostname, struct ether_addr *e) +;;* struct ether_addr * ether_aton(char *s) +;;* char * catgets(nl_catd catd, int set_id, int msg_id, char *s) +;;* int catclose(nl_catd catd) +;;* nl_catd catopen(const char *name, int oflag) +;;* char * nl_langinfo(nl_item item) +;;* int nlist(const char *filename, struct nlist *nl) +;;* char * getusershell(void) +;;* char * lfind(const void *key, const void *base, size_t *nelp, size_t width, int (*compar)(void *, void *)) +;;* char * lsearch(const void *key, const void *base, size_t *nelp, size_t width, int (*compar)(void *, void *)) +;;* char * tgetstr(char *id, char **area) +;;* char * tgoto(char *cm, destcol, destline) +;;* char * timezone(int zone, int dst) +;;* char *crypt(const char *key, const char *setting) +;;* getloadavg(double loadavg[], int nelem) +;;* getpw(uid, char *buf) +;;* group_from_gid(gid_t gid, int nogroup) +;;* int des_cipher(const char *in, char *out, long salt, int count) +;;* int des_setkey(const char *key) +;;* int encrypt(char *block, int flag) +;;* int getnetgrent(char **host, char **user, char **domain) +;;* int getrpcport(char *host, int prognum, int versnum, int proto) +;;* int innetgr(const char *netgroup, const char *host, const char *user, ) +;;* int isinf(double) +;;* int isnan(double) +;;* int profil(char *samples, size_t size, u_long offset, u_int scale) +;;* int rexec(ahost, int inport, char *user, char *passwd, char *cmd, int *fd2p) +;;* int setkey(const char *key) +;;* mode_t getmode(const void *set, mode_t mode) +;;* moncontrol(int mode) +;;* monstartup(u_long *lowpc, u_long *highpc) +;;* nice(int incr) +;;* tgetent(char *bp, char *name) +;;* tgetflag(char *id) +;;* tgetnum(char *id) +;;* user_from_uid(uid_t uid, int nouser) +;;* void * setmode(const char *mode_str) +;;* void * shutdownhook_establish(void (*fn)(void *), void *arg) +;;* void doshutdownhooks(void) +;;* void endnetgrent(void) +;;* void endusershell(void) +;;* void inittodr(time_t base) +;;* void resettodr(void) +;;* void setnetgrent(const char *netgroup) +;;* void setusershell(void) +;;* void shutdownhook_disestablish(void *cookie) +;;* void tputs(register char *cp, int affcnt, int (*outc)()) +;;* void tzset() +;;* char * getpass(const char *prompt) +;;* int regexec(const regexp *prog, const char *string) +;;* regexp * regcomp(const char *exp) +;;* void regsub(const regexp *prog, const char *source, char *dest) +;;* struct qelem { struct qelem *q_forw; struct qelem *q_back; char q_data[]; }; void insque(struct qelem *elem, struct qelem *pred) +;;* void remque(struct qelem *elem) +;;* int _setjmp(jmp_buf env) +;;* int setjmp(jmp_buf env) +;;* int sigsetjmp(sigjmp_buf env, int savemask) +;;* void _longjmp(jmp_buf env, int val) +;;* void longjmp(jmp_buf env, int val) +;;* void longjmperror(void) +;;* void siglongjmp(sigjmp_buf env, int val) +;;* gtty(int fd, struct sgttyb *buf) +;;* stty(int fd, struct sgttyb *buf) +;;* int kill(pid_t pid, int sig) +;;* int killpg(pid_t pgrp, int sig) +;;* int raise(int sig) +;;* int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) +;;* int sigaddset(sigset_t *set, int signo) +;;* int sigblock(int mask) +;;* int sigdelset(sigset_t *set, int signo) +;;* int sigemptyset(sigset_t *set) +;;* int sigfillset(sigset_t *set) +;;* int siginterrupt(int sig, int flag) +;;* int sigismember(sigset_t *set, int signo) +;;* int sigmask(signum) +;;* int sigpause(int sigmask) +;;* int sigpending(sigset_t *set) +;;* int sigprocmask(int how, const sigset_t *set, sigset_t *oset) +;;* int sigreturn(struct sigcontext *scp) +;;* int sigsetmask(int mask) +;;* int sigsuspend(const sigset_t *sigmask) +;;* sigmask(signum) +;;* sigvec(int sig, struct sigvec *vec, struct sigvec *ovec) +;;* struct sigaction { void (*sa_handler)(); sigset_t sa_mask; int sa_flags; }; +;;* struct sigcontext { int sc_onstack; int sc_mask; int sc_sp; int sc_fp; int sc_ap; int sc_pc; int sc_ps; }; +;;* struct sigvec { void (*sv_handler)(); sigset_t sv_mask; int sv_flags; }; +;;* void (*signal(int sig, void (*func)()))() +;;* type va_arg(va_list ap, type) +;;* void va_end(va_list ap) +;;* void va_start(va_list ap, last) +;;* FILE * fdopen(int fildes, char *mode) +;;* FILE * fopen(char *path, char *mode) +;;* FILE * freopen(char *path, char *mode, FILE *stream) +;;* FILE * fropen(void *cookie, int (*readfn)(void *, char *, int)) +;;* FILE * funopen(void *cookie, int (*readfn)(void *, char *, int), int (*writefn)(void *, const char *, int), fpos_t (*seekfn)(void *, fpos_t, int), int (*closefn)(void *)) +;;* FILE * fwopen(void *cookie, int (*writefn)(void *, char *, int)) +;;* FILE * popen(const char *command, const char *type) +;;* FILE * tmpfile(void) +;;* FILE *stdin; FILE *stdout; FILE *stderr; +;;* char * ctermid(char *buf) +;;* char * cuserid(char *buf) +;;* char * fgetln(FILE *stream, size_t *len) +;;* char * fgets(char *str, size_t size, FILE *stream) +;;* char * gets(char *str) +;;* char * tempnam(const char *tmpdir, const char *prefix) +;;* char * tmpnam(char *str) +;;* int fclose(FILE *stream) +;;* int feof(FILE *stream) +;;* int ferror(FILE *stream) +;;* int fflush(FILE *stream) +;;* int fgetc(FILE *stream) +;;* int fgetpos(FILE *stream, fpos_t *pos) +;;* int fileno(FILE *stream) +;;* int fprintf(FILE *stream, const char *format, ...) +;;* int fpurge(FILE *stream) +;;* int fputc(int c, FILE *stream) +;;* int fputs(const char *str, FILE *stream) +;;* int fscanf(FILE *stream, const char *format, ...) +;;* int fseek(FILE *stream, long offset, int whence) +;;* int fsetpos(FILE *stream, fpos_t *pos) +;;* int getc(FILE *stream) +;;* int getchar() +;;* int getsubopt(char **optionp, char * const *tokens, char **valuep) +;;* int getw(FILE *stream) +;;* int pclose(FILE *stream) +;;* int printf(const char *format, ...) +;;* int putc(int c, FILE *stream) +;;* int putchar(int c) +;;* int puts(const char *str) +;;* int putw(int w, FILE *stream) +;;* int remove(const char *path) +;;* int rename(const char *from, const char *to) +;;* int scanf(const char *format, ...) +;;* int setlinebuf(FILE *stream) +;;* int setvbuf(FILE *stream, char *buf, int mode, size_t size) +;;* int snprintf(char *str, size_t size, const char *format, ...) +;;* int sprintf(char *str, const char *format, ...) +;;* int sscanf(const char *str, const char *format, ...) +;;* int ungetc(int c, FILE *stream) +;;* long ftell(FILE *stream) +;;* size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream) +;;* size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) +;;* void clearerr(FILE *stream) +;;* void perror(const char *string) +;;* void rewind(FILE *stream) +;;* void setbuf(FILE *stream, char *buf) +;;* void setbuffer(FILE *stream, char *buf, size_t size) +;;* int vfprintf(FILE *stream, const char *format, va_list ap) +;;* int vfscanf(FILE *stream, const char *format, va_list ap) +;;* int vprintf(const char *format, va_list ap) +;;* int vscanf(const char *format, va_list ap) +;;* int vsnprintf(char *str, size_t size, const char *format, va_list ap) +;;* int vsprintf(char *str, char *format, va_list ap) +;;* int vsscanf(const char *str, const char *format, va_list ap) +;;* char * cgetcap(char *buf, char *cap, char type) +;;* char * devname(dev_t dev, mode_t type) +;;* char * getbsize(int *headerlenp, long *blocksizep) +;;* char * getenv(const char *name) +;;* char * initstate(unsigned seed, char *state, int n) +;;* char * setstate(char *state) +;;* daemon(int nochdir, int noclose) +;;* div_t div(int num, int denom) +;;* double atof(const char *nptr) +;;* double drand48(void) +;;* double erand48(unsigned short xseed[3]) +;;* double strtod(const char *nptr, char **endptr) +;;* int abs(int j) +;;* int atexit(void (*function)(void)) +;;* int atoi(const char *nptr) +;;* int cgetclose(void) +;;* int cgetent(char **buf, char **db_array, char *name) +;;* int cgetfirst(char **buf, char **db_array) +;;* int cgetmatch(char *buf, char *name) +;;* int cgetnext(char **buf, char **db_array) +;;* int cgetnum(char *buf, char *cap, long *num) +;;* int cgetset(char *ent) +;;* int cgetstr(char *buf, char *cap, char **str) +;;* int cgetustr(char *buf, char *cap, char **str) +;;* int heapsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) +;;* int mergesort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) +;;* int putenv(const char *string) +;;* int rand(void) +;;* int setenv(const char *name, const char *value, int overwrite) +;;* int system(const char *string) +;;* ldiv_t ldiv(long num, long denom) +;;* long atol(const char *nptr) +;;* long jrand48(unsigned short xseed[3]) +;;* long labs(long j) +;;* long lrand48(void) +;;* long mrand48(void) +;;* long nrand48(unsigned short xseed[3]) +;;* long random(void) +;;* qdiv_t qdiv(quad_t num, quad_t denom) +;;* quad_t qabs(quad_t j) +;;* unsigned short * seed48(unsigned short xseed[3]) +;;* void * alloca(size_t size) +;;* void * bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *)) +;;* void * calloc(size_t nelem, size_t elsize) +;;* void * calloc(size_t nmemb, size_t size) +;;* void * malloc(size_t size) +;;* void * realloc(void *ptr, size_t size) +;;* void abort(void) +;;* void exit(int status) +;;* void free(void *ptr) +;;* void lcong48(unsigned short p[7]) +;;* void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) +;;* void setproctitle(const char *fmt, ...) +;;* void srand(unsigned seed) +;;* void srand48(long seed) +;;* void srandom(unsigned seed) +;;* void unsetenv(const char *name) +;;* long strtol(const char *nptr, char **endptr, int base) +;;* unsigned long strtoul(const char *nptr, char **endptr, int base) +;;* quad_t strtoq(const char *nptr, char **endptr, int base) +;;* u_quad_t strtouq(const char *nptr, char **endptr, int base) +;;* char * index(const char *s, int c) +;;* char * rindex(const char *s, int c) +;;* char * strcat(char *s, const char * append) +;;* char * strcat(char *s, const char *append) +;;* char * strchr(const char *s, int c) +;;* char * strcpy(char *dst, const char *src) +;;* char * strdup(const char *str) +;;* char * strerror(int errno) +;;* char * strerror(int errnum) +;;* char * strncat(char *s, const char *append, size_t count) +;;* char * strncpy(char *dst, const char *src, size_t count) +;;* char * strncpy(char *dst, const char *src, size_t len) +;;* char * strpbrk(const char *s, const char *charset) +;;* char * strrchr(const char *s, int c) +;;* char * strsep(char **stringp, char *delim) +;;* char * strsep(char **stringp, const char *delim) +;;* char * strsignal(int sig) +;;* char * strstr(const char *big, const char *little) +;;* char * strtok(char *s, const char *delim) +;;* char * strtok(char *str, const char *sep) +;;* int bcmp(const void *b1, const void *b2, size_t len) +;;* int ffs(int value) +;;* int memcmp(const void *b1, const void *b2, size_t len) +;;* int strcasecmp(const char *s1, const char *s2) +;;* int strcmp(const char *s1, const char *s2) +;;* int strcoll(const char *s1, const char *s2) +;;* int strncasecmp(const char *s1, const char *s2, size_t count) +;;* int strncasecmp(const char *s1, const char *s2, size_t len) +;;* int strncmp(const char *s1, const char *s2, size_t count) +;;* int strncmp(const char *s1, const char *s2, size_t len) +;;* size_t strcspn(const char *s, const char *charset) +;;* size_t strlen(const char *s) +;;* size_t strspn(const char *s, const char *charset) +;;* size_t strxfrm(char *dst, const char *src, size_t n) +;;* void * memccpy(void *dst, const void *src, int c, size_t len) +;;* void * memchr(const void *b, int c, size_t len) +;;* void * memcpy(void *dst, const void *src, size_t len) +;;* void * memmove(void *dst, const void *src, size_t len) +;;* void * memset(void *b, int c, size_t len) +;;* void bcopy(const void *src, void *dst, size_t len) +;;* void bzero(void *b, size_t len) +;;* void strmode(mode_t mode, char *bp) +;;* void swab(const void *src, void *dst, size_t len) +;;* struct disklabel * getdiskbyname(const char *name) +;;* int flock(int fd, int operation) +;;* int ioctl(int d, unsigned long request, char *argp) +;;* u_long htonl(u_long hostlong) +;;* u_long ntohl(u_long netlong) +;;* u_short htons(u_short hostshort) +;;* u_short ntohs(u_short netshort) +;;* char * realpath(const char *pathname, char resolvedname[MAXPATHLEN]) +;;* int fstatfs(int fd, struct statfs *buf) +;;* int mount(const char *type, const char *dir, int flags, void *data) +;;* int statfs(const char *path, struct statfs *buf) +;;* int unmount(const char *dir, int flags) +;;* int sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) +;;* int getgroups(int gidsetlen, gid_t *gidset) +;;* int getfsstat(struct statfs *buf, long bufsize, int flags) +;;* int getmntinfo(struct statfs **mntbufp, int flags) +;;* int setgroups(int ngroups, const gid_t *gidset) +;;* CIRCLEQ_ENTRY(TYPE) +;;* CIRCLEQ_HEAD(HEADNAME, TYPE) +;;* CIRCLEQ_INIT(CIRCLEQ_HEAD *head) +;;* CIRCLEQ_INSERT_AFTER(CIRCLEQ_HEAD *head, TYPE *listelm, TYPE *elm, CIRCLEQ_ENTRY NAME) +;;* CIRCLEQ_INSERT_BEFORE(CIRCLEQ_HEAD *head, TYPE *listelm, TYPE *elm, CIRCLEQ_ENTRY NAME) +;;* CIRCLEQ_INSERT_HEAD(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME) +;;* CIRCLEQ_INSERT_TAIL(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME) +;;* CIRCLEQ_REMOVE(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME) +;;* LIST_ENTRY(TYPE) +;;* LIST_HEAD(HEADNAME, TYPE) +;;* LIST_INIT(LIST_HEAD *head) +;;* LIST_INSERT_AFTER(TYPE *listelm, TYPE *elm, LIST_ENTRY NAME) +;;* LIST_INSERT_BEFORE(TYPE *listelm, TYPE *elm, LIST_ENTRY NAME) +;;* LIST_INSERT_HEAD(LIST_HEAD *head, TYPE *elm, LIST_ENTRY NAME) +;;* LIST_REMOVE(TYPE *elm, LIST_ENTRY NAME) +;;* TAILQ_ENTRY(TYPE) +;;* TAILQ_HEAD(HEADNAME, TYPE) +;;* TAILQ_INIT(TAILQ_HEAD *head) +;;* TAILQ_INSERT_AFTER(TAILQ_HEAD *head, TYPE *listelm, TYPE *elm, TAILQ_ENTRY NAME) +;;* TAILQ_INSERT_BEFORE(TYPE *listelm, TYPE *elm, TAILQ_ENTRY NAME) +;;* TAILQ_INSERT_HEAD(TAILQ_HEAD *head, TYPE *elm, TAILQ_ENTRY NAME) +;;* TAILQ_INSERT_TAIL(TAILQ_HEAD *head, TYPE *elm, TAILQ_ENTRY NAME) +;;* TAILQ_REMOVE(TAILQ_HEAD *head, TYPE *elm, TAILQ_ENTRY NAME) +;;* void boot(int howto) +;;* int kvm_getloadavg(kvm_t *kd, double loadavg[], int nelem) +;;* extern char *sys_siglist[]; extern char *sys_signame[]; +;;* void psignal(unsigned sig, const char *s) +;;* int getpeername(int s, struct sockaddr *name, int *namelen) +;;* int getsockname(int s, struct sockaddr *name, int *namelen) +;;* int listen(int s, int backlog) +;;* int shutdown(int s, int how) +;;* char * inet_ntoa(struct in_addr in) +;;* int inet_aton(const char *cp, struct in_addr *pin) +;;* struct in_addr inet_makeaddr(int net, int lna) +;;* unsigned long inet_addr(const char *cp) +;;* unsigned long inet_lnaof(struct in_addr in) +;;* unsigned long inet_netof(struct in_addr in) +;;* unsigned long inet_network(const char *cp) +;;* int chflags(const char *path, u_long flags) +;;* int fchflags(int fd, u_long flags) +;;* int __syscall(quad_t number, ...) +;;* int syscall(int number, ...) +;;* int adjtime(const struct timeval *delta, struct timeval *olddelta) +;;* int futimes(int fd, const struct timeval *times) +;;* int getitimer(int which, struct itimerval *value) +;;* int gettimeofday(struct timeval *tp, struct timezone *tzp) +;;* int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue) +;;* int settimeofday(const struct timeval *tp, const struct timezone *tzp) +;;* int utimes(const char *file, const struct timeval *times) +;;* int getpriority(int which, int who) +;;* int getrusage(int who, struct rusage *rusage) +;;* int setpriority(int which, int who, int prio) +;;* clock_t times(struct tms *tp) +;;* char * sbrk(int incr) +;;* char *ctime(clock) const time_t *clock; +;;* double difftime(time1, time0) time_t time1; time_t time0; +;;* int bindresvport(int sd, struct sockaddr_in **sin) +;;* int brk(const char *addr) +;;* int setrgid(gid_t gid) +;;* int setruid(uid_t uid) +;;* bm_pat * bm_comp(u_char *pattern, size_t patlen, u_char freq[256]); +;;* u_char * bm_exec(bm_pat *pdesc, u_char *text, size_t len); +;;* void bm_free(bm_pat *pdesc); +;;* DIR * opendir(const char *filename) +;;* int alphasort(const void *d1, const void *d2) +;;* int closedir(DIR *dirp) +;;* int dirfd(DIR *dirp) +;;* int scandir(const char *dirname, struct dirent ***namelist, int (*select)(struct dirent *), int (*compar)(const void *, const void *)) +;;* long telldir(const DIR *dirp) +;;* struct dirent * readdir(DIR *dirp) +;;* void rewinddir(DIR *dirp) +;;* void seekdir(DIR *dirp, long loc) +;;* int setgroupent(int stayopen) +;;* struct group * getgrent(void) +;;* struct group * getgrgid(gid_t gid) +;;* struct group * getgrnam(const char *name) +;;* void endgrent(void) +;;* void setgrent(void) +;;* DB * dbopen(const char *file, int flags, int mode, DBTYPE type, const void *openinfo); +;;* int i386_get_ldt(int start_sel, union descriptor *descs, int num_sels) +;;* int i386_set_ldt(int start_sel, union descriptor *descs, int num_sels) +;;* int i386_get_ioperm(u_long *iomap) +;;* int i386_iopl(int iopl) +;;* int i386_set_ioperm(u_long *iomap) +;;* dn_comp(char *exp_dn, char *comp_dn, int length, char **dnptrs, char **lastdnptr) +;;* dn_expand(u_char *msg, u_char *eomorig, u_char *comp_dn, u_char *exp_dn, int length) +;;* res_init() +;;* res_mkquery(int op, char *dname, int class, int type, char *data, int datalen, struct rrec *newrr, char *buf, int buflen) +;;* res_query(char *dname, int class, int type, u_char *answer, int anslen) +;;* res_search(char *dname, int class, int type, u_char *answer, int anslen) +;;* res_send(char *msg, int msglen, char *answer, int anslen) +;;* char * ns_ntoa(struct ns_addr ns) +;;* struct ns_addr ns_addr(char *cp) +;;* int setpassent(int stayopen) +;;* struct passwd * getpwent(void) +;;* struct passwd * getpwnam(const char *login) +;;* struct passwd * getpwuid(uid_t uid) +;;* void endpwent(void) +;;* void setpwent(void) +;;* int regcomp(regex_t *preg, const char *pattern, int cflags); +;;* int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags); +;;* size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size); +;;* void regfree(regex_t *preg); +;;* char * yperr_string(int incode) +;;* int yp_all(char *indomain, char *inmap, struct ypall_callback *incallback) +;;* int yp_bind(char *dom) +;;* int yp_first(char *indomain, char *inmap, char **outkey, int *outkeylen, char **outval, int *outvallen) +;;* int yp_get_default_domain(char **domp) +;;* int yp_master(char *indomain, char *inmap, char **outname) +;;* int yp_match(char *indomain, char *inmap, const char *inkey, int inkeylen, char **outval, int *outvallen) +;;* int yp_next(char *indomain, char *inmap, char *inkey, int inkeylen, char **outkey, int *outkeylen, char **outval, int *outvallen) +;;* int yp_order(char *indomain, char *inmap, char *outorder) +;;* int ypprot_err(unsigned int incode) +;;* void yp_unbind(char *dom) +;;* int sigaltstack(const struct sigaltstack *ss, struct sigaltstack *oss) +;;* int i386_vm86(struct vm86_struct *vmcp) +;;* struct disk * disk_find(char *) +;;* void disk_attach(struct disk *) +;;* void disk_busy(struct disk *) +;;* void disk_detatch(struct disk *) +;;* void disk_init(void) +;;* void disk_resetstat(struct disk *) +;;* void disk_unbusy(struct disk *) +;;* key_t ftok(const char *path, char id); +;;* int msgctl(int msqid, int cmd, struct msqid_ds *buf) +;;* int msgget(key_t key, int msgflg) +;;* int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg) +;;* int msgsnd(int msqid, void *msgp, size_t msgsz, int msgflg) +;;* int shmctl(int shmid, int cmd, struct shmid_ds *buf) +;;* int semctl(int semid, int semnum, int cmd, union semun arg) +;;* int semget(key_t key, int nsems, int semflg) +;;* int semop(int semid, struct sembuf *sops, int nsops) +;;* int shmdt(void *shmaddr) +;;* int shmget(key_t key, int size, int shmflg) +;;* void * shmat(int shmid, void *shmaddr, int shmflg) +;;* caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) +;;* int madvise(caddr_t addr, size_t len, int behav) +;;* int mincore(caddr_t addr, size_t len, char *vec) +;;* int mlock(caddr_t addr, size_t len) +;;* int mprotect(caddr_t addr, size_t len, int prot) +;;* int msync(caddr_t addr, size_t len) +;;* int munlock(caddr_t addr, size_t len) +;;* int munmap(caddr_t addr, size_t len) +;;* int getfh(const char *path, fhandle_t *fhp) +;;* int ptrace(int request, pid_t pid, caddr_t addr, int data) +;;* int accept(int s, struct sockaddr *addr, int *addrlen) +;;* int bind(int s, const struct sockaddr *name, int namelen) +;;* int connect(int s, const struct sockaddr *name, int namelen) +;;* int getsockopt(int s, int level, int optname, void *optval, int *optlen) +;;* int setsockopt(int s, int level, int optname, const void *optval, int optlen) +;;* int socket(int domain, int type, int protocol) +;;* int socketpair(int d, int type, int protocol, int *sv) +;;* ssize_t recv(int s, void *buf, size_t len, int flags) +;;* ssize_t recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, int *fromlen) +;;* ssize_t recvmsg(int s, struct msghdr *msg, int flags) +;;* ssize_t send(int s, const void *msg, size_t len, int flags) +;;* ssize_t sendmsg(int s, const struct msghdr *msg, int flags) +;;* ssize_t sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, int tolen) +;;* char * link_ntoa(const struct sockaddr_dl *sdl) +;;* void link_addr(const char *addr, struct sockaddr_dl *sdl) +;;* int chmod(const char *path, mode_t mode) +;;* int fchmod(int fd, mode_t mode) +;;* int fstat(int fd, struct stat *sb) +;;* int lstat(const char *path, struct stat *sb) +;;* int mkdir(const char *path, mode_t mode) +;;* int mkfifo(const char *path, mode_t mode) +;;* int stat(const char *path, struct stat *sb) +;;* mode_t umask(mode_t numask) +;;* int creat(const char *path, mode_t mode) +;;* FTS * fts_open(char * const *path_argv, int options, int *compar(const FTSENT **, const FTSENT **)) +;;* FTSENT * fts_children(FTS *ftsp, int options) +;;* FTSENT * fts_read(FTS *ftsp) +;;* int fts_close(FTS *ftsp) +;;* int fts_set(FTS ftsp, FTSENT *f, int options) +;;* int copyin(void *uaddr, void *kaddr, size_t len) +;;* int copyinstr(void *uaddr, void *kaddr, size_t len, size_t *done) +;;* int copyout(void *kaddr, void *uaddr, size_t len) +;;* int copyoutstr(void *kaddr, void *uaddr, size_t len, size_t *done) +;;* int copystr(void *kfaddr, void *kdaddr, size_t len, size_t *done) +;;* int fubyte(void *base) +;;* int fuswintr(void *base) +;;* int fusword(void *base) +;;* int fuword(void *base) +;;* int subyte(void *base) +;;* int suswintr(void *base) +;;* int susword(void *base) +;;* int suword(void *base) +;;* int getrlimit(int resource, struct rlimit *rlp) +;;* int setrlimit(int resource, const struct rlimit *rlp) +;;* FD_CLR(fd, &fdset) +;;* FD_ISSET(fd, &fdset) +;;* FD_SET(fd, &fdset) +;;* FD_ZERO(&fdset) +;;* int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) +;;* int ftime(struct timeb *tp) +;;* ssize_t read(int d, void *buf, size_t nbytes) +;;* ssize_t readv(int d, const struct iovec *iov, int iovcnt) +;;* ssize_t write(int d, const void *buf, size_t nbytes) +;;* ssize_t writev(int d, const struct iovec *iov, int iovcnt) +;;* pid_t wait(int *status) +;;* pid_t waitpid(pid_t wpid, int *status, int options) +;;* pid_t wait3(int *status, int options, struct rusage *rusage) +;;* pid_t wait4(pid_t wpid, int *status, int options, struct rusage *rusage) +;;* char *asctime(tm) const struct tm *tm; +;;* struct tm *gmtime(clock) const time_t *clock; +;;* struct tm *localtime(clock) const time_t *clock; +;;* time_t mktime(tm) struct tm *tm; +;;* time_t posix2time(t) time_t t +;;* time_t time2posix(t) time_t t +;;* gid_t getegid(void) +;;* gid_t getgid(void) +;;* int chown(const char *path, uid_t owner, gid_t group) +;;* int fchown(int fd, uid_t owner, gid_t group) +;;* int setegid(gid_t egid) +;;* int seteuid(uid_t euid) +;;* int setgid(gid_t gid) +;;* int setuid(uid_t uid) +;;* int tcsetpgrp(int fd, pid_t pgrp_id) +;;* pid_t fork(void) +;;* pid_t getpid(void) +;;* pid_t getppid(void) +;;* pid_t setsid(void) +;;* pid_t tcgetpgrp(int fd) +;;* uid_t geteuid(void) +;;* uid_t getuid(void) +;;* int utime(const char *file, const struct utimbuf *timep) +;;* int uname(struct utsname *name) +;;* vlimit(resource, value) +;;* vtimes(struct vtimes *par_vm, struct vtimes *ch_vm) +;;* int setlogmask(int maskpri) +;;* void closelog(void) +;;* void openlog(const char *ident, int logopt, int facility) +;;* void syslog(int priority, const char *message, ...) +;;* void vsyslog(int priority, const char *message, va_list args) +;;* int cfsetispeed(struct termios *t, speed_t speed) +;;* int cfsetospeed(struct termios *t, speed_t speed) +;;* int tcdrain(int fd) +;;* int tcflow(int fd, int action) +;;* int tcflush(int fd, int action) +;;* int tcgetattr(int fd, struct termios *t) +;;* int tcsendbreak(int fd, int len) +;;* int tcsetattr(int fd, int action, const struct termios *t) +;;* speed_t cfgetispeed(const struct termios *t) +;;* speed_t cfgetospeed(const struct termios *t) +;;* void cfmakeraw(struct termios *t) +;;* void cfsetspeed(struct termios *t, speed_t speed) +;;* clock_t clock(void) +;;* size_t strftime(char *buf, size_t maxsize, const char *format, const struct tm *timeptr) +;;* time_t time(time_t *tloc) +;;* int endttyent(void) +;;* int setttyent(void) +;;* struct ttyent * getttyent() +;;* struct ttyent * getttynam(char *name) +;;* char * getcwd(char *buf, size_t size) +;;* char * getlogin(void) +;;* char * getwd(char *buf) +;;* char * mktemp(char *template) +;;* char * re_comp(const char *s) +;;* char * ttyname(int fd) +;;* char * valloc(unsigned size) +;;* extern char **environ; +;;* extern char *optarg; extern int optind; extern int optopt; extern int opterr; extern int optreset; +;;* int access(const char *path, int mode) +;;* int acct(const char *file) +;;* int chdir(const char *path) +;;* int chroot(const char *dirname) +;;* int close(int d) +;;* int dup(int oldd) +;;* int dup2(int oldd, int newd) +;;* int execl(const char *path, const char *arg, ...) +;;* int execle(const char *path, const char *arg, ..., char *const envp[]) +;;* int execlp(const char *file, const char *arg, ...) +;;* int exect(const char *path, char *const argv[], char *const envp[]) +;;* int execv(const char *path, char *const argv[]) +;;* int execve(const char *path, char *const argv[], char *const envp[]) +;;* int execvp(const char *file, char *const argv[]) +;;* int fchdir(int fd) +;;* int fsync(int fd) +;;* int ftruncate(int fd, off_t length) +;;* int getdomainname(char *name, int namelen) +;;* int getdtablesize(void) +;;* int getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroups) +;;* int gethostname(char *name, int namelen) +;;* int getopt(int argc, char * const *argv, const char *optstring) +;;* int getpagesize(void) +;;* int initgroups(const char *name, gid_t basegid) +;;* int iruserok(u_int32_t raddr, int superuser, const char *ruser, const char *luser) +;;* int isatty(int fd) +;;* int link(const char *name1, const char *name2) +;;* int mknod(const char *path, mode_t mode, dev_t dev) +;;* int mkstemp(char *template) +;;* int pause(void) +;;* int pipe(int *fildes) +;;* int rcmd(char **ahost, int inport, const char *locuser, const char *remuser, const char *cmd, int *fd2p) +;;* int re_exec(const char *s) +;;* int readlink(const char *path, char *buf, int bufsiz) +;;* int revoke(const char *path) +;;* int rmdir(const char *path) +;;* int rresvport(int *port) +;;* int ruserok(const char *rhost, int superuser, const char *ruser, const char *luser) +;;* int setdomainname(const char *name, int namelen) +;;* int sethostid(long hostid) +;;* int sethostname(const char *name, int namelen) +;;* int setlogin(const char *name) +;;* int setpgid(pid_t pid, pid_t pgrp) +;;* int setpgrp(pid_t pid, pid_t pgrp) +;;* int setregid(int rgid, int egid) +;;* int setreuid(int ruid, int euid) +;;* int swapon(const char *special) +;;* int symlink(const char *name1, const char *name2) +;;* int truncate(const char *path, off_t length) +;;* int ttyslot() +;;* int unlink(const char *path) +;;* long fpathconf(int fd, int name) +;;* long gethostid(void) +;;* long pathconf(const char *path, int name) +;;* long sysconf(int name) +;;* off_t lseek(int fildes, off_t offset, int whence) +;;* pid_t getpgrp(void) +;;* pid_t vfork(void) +;;* size_t confstr(int name, char *buf, size_t len) +;;* u_int ualarm(u_int microseconds, u_int interval) +;;* unsigned int alarm(unsigned int seconds) +;;* unsigned int sleep(unsigned int seconds) +;;* void _exit(int status) +;;* void sync(void) +;;* void usleep(u_int microseconds) +;;* int nfssvc(int flags, void *argstructp) +;;* int reboot(int howto) +;;* #indlude +;;* int getmaxpartitions(void) +;;* int getrawpartition(void) +;;* int login_tty(int fd) +;;* int logout(const char *line) +;;* int pw_lock(int retries) +;;* int pw_mkdb() +;;* int pw_scan(char *bp, struct passwd *pw, int *flags) +;;* pid_t forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp) +;;* void login(struct utmp *ut) +;;* void logwtmp(const char *line, const char *name, const char *host) +;;* void openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp) +;;* void pw_abort() +;;* void pw_copy(int ffd, int tfd, struct passwd *pw) +;;* void pw_edit(int notsetuid, const char *filename) +;;* void pw;;* _ +;;* # END NetBSD Sample C++ function database + +;;}}} + +(tinytag-install) + +(provide 'tinytag) +(run-hooks 'tinytag-:load-hook) + +;;; tinytag.el ends here