view oldXMenu/FindSel.c @ 42345:7d2776273a81

support for Perl packages * etags.c (Perl_functions): Tag packages and use them in sub tags. (get_tag): Return a pointer to the tag that is found. general cleanup and streamlining * etags.c (LOOKING_AT): Use !intoken instead of iswhite. (F_takeprec): Renamed from takeprec. All callers changed. (F_getit): Renamed from getit. All callers changed. (nocase_tail): Renamed from tail. All callers changed. (Ada_getit): Renamed from adagetit. All callers changed. (L_getit): Simplified by using get_tag. (Perl_functions, Postscript_functions, erlang_attribute): Use the modified LOOKING_AT. (notinname): Removed '[' and added ')' to the recognised chars. (LOOKING_AT, get_tag, PHP_functions): Use notinname. (Ada_getit, Ada_funcs, Python_functions, Scheme_functions): Clarified, using strneq or notinname. (L_isdef, L_isquote): Removed. (Lisp_functions, L_getit): Clarified. changes for standalone compilation * etags.c: (P_): Renamed to __P for consistency with config.h. [HAVE_CONFIG_H]: Let config.h deal with __P. [__STDC__] [!HAVE_CONFIG_H]: Define PTR as in config.h. [!__STDC__] [!HAVE_CONFIG_H]: Do not undefine static, because gperf code needs it. [HAVE_CONFIG_H] [!PTR]: Define PTR (for use with Xemacs). [HAVE_CONFIG_H] [!__P]: Define __P (for use with Xemacs). (xmalloc, xrealloc): Use PTR instead of long *. (bool): Make it a define, not a typedef, for C++ compilers. (pattern): Members renamed to avoid name clash in some C++ compilers. (get_language_from_langname): Use const argument.
author Francesco Potortì <pot@gnu.org>
date Wed, 26 Dec 2001 22:11:21 +0000
parents bbce331da1be
children 695cf19ef79e d7ddb3e565de
line wrap: on
line source

#include "copyright.h"

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

/*
 * XMenu:	MIT Project Athena, X Window system menu package
 *
 *	XMenuFindSelection - Find the first selection in a pane who's
 *			     label matches a particular string.
 *
 *	Author:		Tony Della Fera, DEC
 *			January 22, 1986
 *
 */

#include "XMenuInt.h"

int
XMenuFindSelection(menu, p_num, label)
    register XMenu *menu;
    int p_num;
    register char *label;
{
    register XMPane *p_ptr;
    register XMSelect *s_ptr;
    register int i = 0;

    /*
     * Check for NULL pointers!
     */
    if (label == NULL) {
	_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.
     */
    for (
	s_ptr = p_ptr->s_list->next;
	s_ptr != p_ptr->s_list;
	s_ptr = s_ptr->next
    ){
	if (s_ptr->label_length == 0) {
	    if (*label == '\0') {
		_XMErrorCode = XME_NO_ERROR;
		return (i);
	    }
	}
	else {
	    if (strncmp (label, s_ptr->label, s_ptr->label_length) == 0) {
		_XMErrorCode = XME_NO_ERROR;
		return (i);
	    }
	}
	i++;
    }

    /*
     * If we get here then we have not found
     * a match.
     */
    _XMErrorCode = XME_S_NOT_FOUND;
    return (XM_FAILURE);
}