1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright (c) 2001 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _LIBC_PORT_I18N_PLURAL_PARSER_H 28*7c478bd9Sstevel@tonic-gate #define _LIBC_PORT_I18N_PLURAL_PARSER_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #define PEEK_TOKEN 0 37*7c478bd9Sstevel@tonic-gate #define GET_TOKEN 1 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate #define NARY 0 40*7c478bd9Sstevel@tonic-gate #define UNARY 1 41*7c478bd9Sstevel@tonic-gate #define BINARY 2 42*7c478bd9Sstevel@tonic-gate #define TRINARY 3 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate #define T_NULL 0x00000000 45*7c478bd9Sstevel@tonic-gate #define T_INIT 0x00000001 46*7c478bd9Sstevel@tonic-gate #define T_EXP 0x00000002 47*7c478bd9Sstevel@tonic-gate #define T_NUM 0x00000003 48*7c478bd9Sstevel@tonic-gate #define T_VAR 0x00000004 49*7c478bd9Sstevel@tonic-gate #define T_CONDC 0x00000005 50*7c478bd9Sstevel@tonic-gate #define T_CONDQ 0x00000006 51*7c478bd9Sstevel@tonic-gate #define T_LOR 0x00000007 52*7c478bd9Sstevel@tonic-gate #define T_LAND 0x00000008 53*7c478bd9Sstevel@tonic-gate #define T_EQ 0x00000009 54*7c478bd9Sstevel@tonic-gate #define T_NEQ 0x0000000a 55*7c478bd9Sstevel@tonic-gate #define T_GT 0x0000000b 56*7c478bd9Sstevel@tonic-gate #define T_LT 0x0000000c 57*7c478bd9Sstevel@tonic-gate #define T_GE 0x0000000d 58*7c478bd9Sstevel@tonic-gate #define T_LE 0x0000000e 59*7c478bd9Sstevel@tonic-gate #define T_ADD 0x0000000f 60*7c478bd9Sstevel@tonic-gate #define T_SUB 0x00000010 61*7c478bd9Sstevel@tonic-gate #define T_MUL 0x00000011 62*7c478bd9Sstevel@tonic-gate #define T_DIV 0x00000012 63*7c478bd9Sstevel@tonic-gate #define T_MOD 0x00000013 64*7c478bd9Sstevel@tonic-gate #define T_LNOT 0x00000014 65*7c478bd9Sstevel@tonic-gate #define T_LPAR 0x00000015 66*7c478bd9Sstevel@tonic-gate #define T_RPAR 0x00000016 67*7c478bd9Sstevel@tonic-gate #define T_ERR 0x00000017 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate #define GETTYPE(op) ((op) & 0x000fffff) 70*7c478bd9Sstevel@tonic-gate #define GETPRIO(op) (((op) & 0x0ff00000) >> 20) 71*7c478bd9Sstevel@tonic-gate #define GETOPNUM(op) (((op) & 0xf0000000) >> 28) 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate #define MAX_STACK_SIZE 128 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate struct expr { 76*7c478bd9Sstevel@tonic-gate unsigned int op; /* operator */ 77*7c478bd9Sstevel@tonic-gate unsigned int num; /* T_NUM */ 78*7c478bd9Sstevel@tonic-gate unsigned int flag; /* flag for the previous op */ 79*7c478bd9Sstevel@tonic-gate struct expr *nodes[3]; /* operands */ 80*7c478bd9Sstevel@tonic-gate }; 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate struct stack { 83*7c478bd9Sstevel@tonic-gate int index; 84*7c478bd9Sstevel@tonic-gate struct expr **ptr; 85*7c478bd9Sstevel@tonic-gate }; 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 88*7c478bd9Sstevel@tonic-gate } 89*7c478bd9Sstevel@tonic-gate #endif 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate #endif /* _LIBC_PORT_I18N_PLURAL_PARSER_H */ 92