view oldXMenu/Locate.c @ 27701:5e135f0faf1d

(bibtex-mode): Replaced manual splitting of path at ':' characters by call to split-string. Added RCS version identification. Some temporary comments removed. (bibtex-field-name, bibtex-entry-type): Made the relationship explicit. (bibtex-field-const): Allow capital letters. (bibtex-start-of-string): Deleted because unused. Unified some nomenclature. We no longer use the term 'reference' to describe a bibtex entry as a whole. Further, reference keys are no longer called 'labels'. (bibtex-keys): Renamed to bibtex-reference-keys. (bibtex-reformat-previous-labels): Renamed to bibtex-reformat-previous-reference-keys. (bibtex-reference-type): Renamed to bibtex-entry-type. (bibtex-reference-head): Renamed to bibtex-entry-head. (bibtex-reference-maybe-empty-head): Renamed to bibtex-entry-maybe-empty-head. (bibtex-key-in-reference): Renamed to bibtex-key-in-entry. (bibtex-search-reference): Renamed to bibtex-search-entry. (bibtex-enclosing-reference-maybe-empty-head): Renamed to bibtex-enclosing-entry-maybe-empty-head. (bibtex-entry-field-alist, bibtex-entry-head, bibtex-font-lock-keywords, bibtex-skip-to-valid-entry, bibtex-map-entries, bibtex-search-entry, bibtex-enclosing-entry-maybe-empty-head, bibtex-format-entry, bibtex-generate-autokey, bibtex-parse-keys, bibtex-pop, bibtex-mode, bibtex-submit-bug-report, bibtex-entry, bibtex-print-help-message, bibtex-make-field, bibtex-end-of-entry, bibtex-sort-buffer, bibtex-find-entry-location, bibtex-validate, bibtex-find-text, bibtex-kill-entry, bibtex-clean-entry, bibtex-reformat, bibtex-complete-key, bibtex-String) : Use the new nomenclature. (bibtex-strings, bibtex-keys): Removed redundant comment. (bibtex-format-field-delimiters): New function, functionality extracted from bibtex-format-entry. (bibtex-autokey-get-yearfield-digits): New function, functionality extracted from bibtex-autokey-get-yearfield. Completely reimplemented parsing of bibtex entries in order to avoid stack overflow in the regexp matcher if field contents become large. (bibtex-cfield, bibtex-name-in-cfield, bibtex-text-in-cfield, bibtex-field-string-part-not-braced, bibtex-field-string-part-no-inner-braces, bibtex-field-string-part-1-inner-brace, bibtex-field-string-part-2-inner-braces, bibtex-field-string-part-3-inner-braces, bibtex-field-string-braced, bibtex-field-string-quoted, bibtex-field-string, bibtex-field-string-or-const, bibtex-field-text, bibtex-field, bibtex-name-in-field, bibtex-text-in-field, bibtex-reference-infix, bibtex-string, bibtex-key-in-string, bibtex-text-in-string): Deleted as parsing is now performed by the following functions. (bibtex-parse-nested-braces, bibtex-parse-field-string-braced, bibtex-parse-quoted-string, bibtex-parse-field-string-quoted, bibtex-parse-field-string, bibtex-search-forward-field-string, bibtex-parse-association, bibtex-field-name-for-parsing, bibtex-parse-field-name, bibtex-parse-field-text, bibtex-parse-field, bibtex-search-forward-field, bibtex-search-backward-field, bibtex-start-of-field, bibtex-end-of-field, bibtex-start-of-name-in-field, bibtex-end-of-name-in-field, bibtex-start-of-text-in-field, bibtex-end-of-text-in-field, bibtex-parse-string-prefix, bibtex-parse-string-postfix, bibtex-parse-string, bibtex-search-forward-string, bibtex-search-backward-string, bibtex-start-of-string, bibtex-end-of-string, bibtex-start-of-reference-key-in-string, bibtex-end-of-reference-key-in-string, bibtex-start-of-text-in-string, bibtex-end-of-text-in-string): New functions for the parsing of bibtex entries. Instead of reporting the results of the parsing by match-beginning or match-end, these functions return data structures that hold the corresponding positions. (bibtex-enclosing-field): Changed to also report field boundaries by return values rather than by match-beginning or match-end. The following functions have been adapted to use the new parsing functions. (bibtex-skip-to-valid-entry, bibtex-search-reference, bibtex-enclosing-field, bibtex-format-entry, bibtex-autokey-get-namefield, bibtex-autokey-get-titlestring, bibtex-parse-keys, bibtex-complete, bibtex-pop, bibtex-mode, bibtex-print-help-message, bibtex-end-of-entry, bibtex-ispell-abstract, bibtex-validate, bibtex-next-field, bibtex-find-text, bibtex-remove-OPT-or-ALT, bibtex-remove-delimiters, bibtex-kill-field, bibtex-empty-field, bibtex-fill-entry): Use the new method for parsing. (bibtex-assoc-of-regexp, bibtex-skip-to-valid-entry, bibtex-map-entries, bibtex-flash-head, bibtex-enclosing-reference-maybe-empty-head, bibtex-format-entry, bibtex-autokey-change, bibtex-autokey-get-namefield, bibtex-autokey-get-names, bibtex-autokey-get-titlestring, bibtex-autokey-get-titles, bibtex-parse-keys, bibtex-pop, bibtex-mode, bibtex-end-of-entry, bibtex-ispell-abstract, bibtex-sort-buffer, bibtex-validate, bibtex-remove-OPT-or-ALT, bibtex-remove-delimiters, bibtex-kill-field, bibtex-kill-entry): Use let* instead of let in order to make the new binding of case-fold-search immediately visible. Copyright notice is up to date. Added constant 'bibtex-maintainer-salutation. (bibtex-mode): use with-temp-buffer rather than make-temp-name, use match-string-no-properties and eliminate a quadratic behavior when building bibtex-strings. (bibtex-reference-key): Accept string entries whose reference key contains upper case letters. (bibtex-reference-head): Allow entries to start with a new line. Hiding of entry bodies is not longer provided by bibtex.el directly. Instead the hideshow package can be used. Added a special bibtex entry to hs-special-modes-alist. (bibtex-hs-forward-sexp): Added for hideshow.el. (bibtex-entry-field-alist): Added booktitle field to proceedings entry type (for cross referencing). Thanks to Wagner Toledo Correa for the suggestion. Added `reftex-view-crossref-from-bibtex' to menu.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 15 Feb 2000 09:38:09 +0000
parents bbce331da1be
children 23a1cea22d13
line wrap: on
line source

#include "copyright.h"

/* $Header: /u/src/emacs/19.0/oldXMenu/RCS/Locate.c,v 1.1 1992/04/11 22:10:20 jimb Exp $ */
/* Copyright    Massachusetts Institute of Technology    1985	*/

/*
 * XMenu:	MIT Project Athena, X Window system menu package
 *
 *	XMenuLocate - Return data necessary to position and locate
 *		      a menu on the screen.
 *
 *	Author:		Tony Della Fera, DEC
 *			January 11, 1985
 *
 */

#include "XMenuInt.h"

int
XMenuLocate(display, menu, p_num, s_num, x_pos, y_pos, ul_x, ul_y, width, height)
    register Display *display;	/* Previously opened display. */
    register XMenu *menu;	/* Menu object being located. */
    int p_num;			/* Active pane number. */
    int s_num;			/* Active selection number. */
    int x_pos;			/* X coordinate of mouse active position. */
    int y_pos;			/* Y coordinate of mouse active position. */
    int *ul_x;			/* Returned upper left menu X coordinate. */
    int *ul_y;			/* Returned upper left menu Y coordinate. */
    int *width;			/* Returned menu width. */
    int *height;		/* Returned menu height. */
{
    register XMPane *p_ptr;	/* XMPane pointer. */
    register XMSelect *s_ptr;	/* XMSelect pointer. */
    
    /*
     * Are the position arguments positive?
     */
    if ((x_pos <= 0) || (y_pos <= 0)) {
	_XMErrorCode = XME_ARG_BOUNDS;
	return(XM_FAILURE);
    }

    /*
     * Find the right pane.
     */
    p_ptr = _XMGetPanePtr(menu, p_num);
    if (p_ptr == NULL) return(XM_FAILURE);

    /*
     * Find the right selection.
     */
      s_ptr = _XMGetSelectionPtr(p_ptr, s_num);

    /*
     * Check to see that the menu's dependencies have been
     * recomputed and are up to date.  If not, do it now.
     */
    if (menu->recompute) XMenuRecompute(display, menu);

    /*
     * Compute the new menu origin such that the active point lies
     * in the center of the desired active pane and selection.
     * This sets the values of ul_x and ul_y.
     */
    _XMTransToOrigin(display, menu, p_ptr, s_ptr, x_pos, y_pos, ul_x, ul_y);

    /*
     * Set remaining return argument values.
     */
    *width = menu->width;
    *height = menu->height;

    /*
     * Return successfully.
     */
    _XMErrorCode = XME_NO_ERROR;
    return(XM_SUCCESS);
}