Alien-LibJIT

 view release on metacpan or  search on metacpan

libjit/dpas/dpas-semantics.h  view on Meta::CPAN

/*
 * dpas-semantics.h - Semantic value handling for Dynamic Pascal.
 *
 * Copyright (C) 2004  Southern Storm Software, Pty Ltd.
 *
 * This file is part of the libjit library.
 *
 * The libjit library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * The libjit library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with the libjit library.  If not, see
 * <http://www.gnu.org/licenses/>.
 */

#ifndef	_DPAS_SEMANTICS_H
#define	_DPAS_SEMANTICS_H

#ifdef	__cplusplus
extern	"C" {
#endif

/*
 * Structure of a semantic value.
 */
typedef struct
{
	int			kind__;
	jit_type_t	type__;
	jit_value_t	value__;

} dpas_semvalue;

/*
 * Semantic value kinds.
 */
#define	DPAS_SEM_LVALUE			(1 << 0)
#define	DPAS_SEM_RVALUE			(1 << 1)
#define	DPAS_SEM_TYPE			(1 << 2)
#define	DPAS_SEM_PROCEDURE		(1 << 3)
#define	DPAS_SEM_ERROR			(1 << 4)
#define	DPAS_SEM_RETURN			(1 << 5)
#define	DPAS_SEM_LVALUE_EA		(1 << 6)
#define	DPAS_SEM_VOID			(1 << 7)
#define	DPAS_SEM_BUILTIN		(1 << 8)

/*
 * Set a semantic value to an l-value.
 */
#define	dpas_sem_set_lvalue(sem,type,value)	\
		do { \
			(sem).kind__ = DPAS_SEM_LVALUE | DPAS_SEM_RVALUE; \
			(sem).type__ = (type); \
			if(!(value)) \
			{ \
				dpas_out_of_memory(); \
			} \
			(sem).value__ = (value); \
		} while (0)

/*
 * Set a semantic value to an l-value that is actually an effective
 * address that must be dereferenced to get the actual l-value.
 */
#define	dpas_sem_set_lvalue_ea(sem,type,value)	\
		do { \
			(sem).kind__ = DPAS_SEM_LVALUE_EA | DPAS_SEM_RVALUE; \
			(sem).type__ = (type); \
			if(!(value)) \
			{ \
				dpas_out_of_memory(); \
			} \
			(sem).value__ = (value); \



( run in 0.934 second using v1.01-cache-2.11-cpan-df04353d9ac )