view oldXMenu/FindPane.c @ 60632:fa8be36e244d

Include macterm.h instead of directly including Carbon.h. [TARGET_API_MAC_CARBON] (Qstring, Qnumber, Qboolean, Qdate, Qdata) (Qarray, Qdictionary): New variables. (syms_of_mac) [TARGET_API_MAC_CARBON]: Initialize them. [TARGET_API_MAC_CARBON] (Qutf_8): Add extern. [TARGET_API_MAC_CARBON] (DECODE_UTF_8): New macro. [TARGET_API_MAC_CARBON] (struct cfdict_context): New struct used in callback for CFDictionaryApplyFunction. [TARGET_API_MAC_CARBON] (cfdata_to_lisp, cfstring_to_lisp) (cfnumber_to_lisp, cfdate_to_lisp, cfboolean_to_lisp) (cfobject_desc_to_lisp, cfdictionary_add_to_list) (cfdictionary_puthash, cfproperty_list_to_lisp): New functions. [TARGET_API_MAC_CARBON] (Fmac_get_preference): New function. (syms_of_mac) [TARGET_API_MAC_CARBON]: Defsubr it. (P, LOOSE_BINDING, SINGLE_COMPONENT, HASHKEY_TERMINAL): New macro. (skip_while_space, parse_comment, parse_include_file) (parse_binding, parse_component, parse_resource_name, parse_value) (parse_resource_line, xrm_create_database, xrm_q_put_resource) (xrm_merge_string_database, xrm_q_get_resource, xrm_get_resource) (xrm_cfproperty_list_to_value, xrm_get_preference_database): New functions.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Wed, 16 Mar 2005 08:05:56 +0000
parents e8824c4f5f7e
children 3861ff8f4bf1 8e5779acd195
line wrap: on
line source

#include "copyright.h"

/* Copyright    Massachusetts Institute of Technology    1985	*/

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

#include "XMenuInt.h"

int
XMenuFindPane(menu, label)
    register XMenu *menu;
    register char *label;
{
    register XMPane *p_ptr;
    register int i = 0;

    /*
     * Check for NULL pointers!
     */
    if (label == NULL) {
	_XMErrorCode = XME_ARG_BOUNDS;
	return(XM_FAILURE);
    }

    /*
     * Find the pane who's label matches the given label.
     */
    for (
	p_ptr = menu->p_list->next;
	p_ptr != menu->p_list;
	p_ptr = p_ptr->next
    ){
	if (p_ptr->label_length == 0) {
	    if (*label == '\0') {
		_XMErrorCode = XME_NO_ERROR;
		return (i);
	    }
	}
	else {
	    if (strncmp (label, p_ptr->label, p_ptr->label_length) == 0) {
		_XMErrorCode = XME_NO_ERROR;
		return (i);
	    }
	}
	i++;
    }

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

/* arch-tag: b6c94285-0d1d-4569-a071-b34b63c67a54
   (do not change this comment) */