Plasma GitLab Archive
Projects Blog Knowledge

/* <COPYRIGHT>
 * Copyright 2002 Joachim Schrod Network and Publication Consultance GmbH,
 *                Gerd Stolpmann
 *
 * <GPL>
 * This file is part of WDialog.
 *
 * WDialog is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * WDialog 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with WDialog; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * </>
 */

/* $Id: perlvalues.idl,v 3.2 2002-02-14 16:24:13 stolpmann Exp $
 * ----------------------------------------------------------------------
 *
 */

/* CAMLIDL definition */

/* See "perldoc perlguts" for a description of the functions */

/* ---------------------------------------------------------------------- */
/* |                        SCALAR VALUES                               | */
/* ---------------------------------------------------------------------- */

typedef [abstract,
         ml2c(ml2c_perlvalues_scalar_value),
         c2ml(c2ml_perlvalues_scalar_value),
	 errorcheck(ec_perlvalues_scalar_value)
        ] 
        void scalar_value;

typedef [string] char cstring[];

scalar_value newSViv ([in] int x);
scalar_value newSVnv ([in] double x);
scalar_value newSVpvn([in] cstring s, [in] int length);
scalar_value newSVsv ([in] scalar_value s);

void sv_setiv ([in] scalar_value sv,  [in] int x);
void sv_setnv ([in] scalar_value sv,  [in] double x);
void sv_setpvn([in] scalar_value sv,  [in] cstring str, [in] int length);
void sv_setsv ([in] scalar_value sv1, [in] scalar_value sv2);

int     x_sviv  ([in] scalar_value sv);
double  x_svnv  ([in] scalar_value sv);
void    x_svpv  ([in] scalar_value x, [out] cstring *s, [out] int *l);
/* TODO: Null characters in s are interpreted as end-of-string.
 * This should be fixed.
 */

boolean x_svtrue([in] scalar_value sv);
boolean x_sviok ([in] scalar_value sv);
boolean x_svnok ([in] scalar_value sv);
boolean x_svpok ([in] scalar_value sv);
boolean x_svok  ([in] scalar_value sv);
scalar_value x_sv_undef(void);
scalar_value x_sv_true(void);
scalar_value x_sv_false(void);

scalar_value perl_get_sv([in] cstring s, [in] int m);

/* ---------------------------------------------------------------------- */
/* |                         ARRAY VALUES                               | */
/* ---------------------------------------------------------------------- */

typedef [abstract,
         ml2c(ml2c_perlvalues_array_value),
	 c2ml(c2ml_perlvalues_array_value),
	 errorcheck(ec_perlvalues_array_value)
        ]
        void array_value;

array_value newAV();
array_value av_make([in] int num, [in] scalar_value ptr[]);

void         av_push([in] array_value av, [in] scalar_value sv);
scalar_value av_pop([in] array_value av);
scalar_value av_shift([in] array_value av);
void         av_unshift([in] array_value av, [in] int num);

int           av_len([in] array_value av);
scalar_value *av_fetch([in] array_value av, [in] int key, [in] int lval);
scalar_value *av_store([in] array_value av, [in] int key, [in] scalar_value v);

void  av_clear([in] array_value av);
void  av_undef([in] array_value av);
void  av_extend([in] array_value av, [in] int key);

array_value perl_get_av([in] cstring s, [in] int m);

/* ---------------------------------------------------------------------- */
/* |                         HASH  VALUES                               | */
/* ---------------------------------------------------------------------- */

typedef [abstract,
         ml2c(ml2c_perlvalues_hash_value),
	 c2ml(c2ml_perlvalues_hash_value),
	 errorcheck(ec_perlvalues_hash_value)
        ]
        void hash_value;

typedef [abstract,
         ml2c(ml2c_perlvalues_hash_entry),
	 c2ml(c2ml_perlvalues_hash_entry),
	 errorcheck(ec_perlvalues_hash_entry)
        ]
        void hash_entry;

hash_value    newHV(void);
scalar_value *hv_store([in] hash_value hv, 
		       [in] cstring key, 
		       [in] int klen, 
		       [in] scalar_value val, 
		       [in] int hash);
scalar_value *hv_fetch([in] hash_value hv, 
		       [in] cstring key, 
		       [in] int klen, 
		       [in] int lval);
boolean       hv_exists([in] hash_value hv, 
			[in] cstring key, 
			[in] int klen);
scalar_value  hv_delete([in] hash_value hv, 
			[in] cstring key, 
			[in] int klen, 
			[in] int flags);
void          hv_clear([in] hash_value hv);
void          hv_undef([in] hash_value hv);
int           hv_iterinit([in] hash_value hv);
hash_entry    hv_iternext([in] hash_value hv);
cstring       hv_iterkey([in] hash_entry entry, [out] int *retlen);
/* retlen: on some architectures Perl uses "int", on other architectures "long".
 * It is always a 32 bit int. Here, int seems to be the best choice, as it
 * is 32 bits on both 32 and 64 bit architectures.
 * The C compile may output a warning.
 */
scalar_value  hv_iterval([in] hash_value hv, [in] hash_entry entry);
scalar_value  hv_iternextsv([in] hash_value hv, 
			    [out] cstring *key, 
			    [out] int *retlen);
/* retlen: See hv_iterkey. */

hash_value    perl_get_hv([in] cstring s, [in] int m);


/* ---------------------------------------------------------------------- */
/* |                             REFERENCES                             | */
/* ---------------------------------------------------------------------- */

scalar_value newRV_inc_from_sv([in] scalar_value sv);
scalar_value newRV_inc_from_av([in] array_value av);
scalar_value newRV_inc_from_hv([in] hash_value hv);

scalar_value newRV_noinc_from_sv([in] scalar_value sv);
scalar_value newRV_noinc_from_av([in] array_value av);
scalar_value newRV_noinc_from_hv([in] hash_value hv);

scalar_value x_SvRV([in] scalar_value sv);
array_value  x_AvRV([in] scalar_value av);
hash_value   x_HvRV([in] scalar_value hv);

int x_svrok([in] scalar_value x);
int reftype([in] scalar_value x);

int          SvREFCNT([in] scalar_value sv);
scalar_value SvREFCNT_inc([in] scalar_value sv);
void         SvREFCNT_dec([in] scalar_value sv);

/* ---------------------------------------------------------------------- */
/* |                            CALLBACKS                               | */
/* ---------------------------------------------------------------------- */

/* Only limited support yet: */

void          pl_callback_noarg_noresult(scalar_value closure);
scalar_value  pl_callback_noarg_scalar(scalar_value closure);

void          pl_callback_1arg_noresult(scalar_value closure,
					scalar_value arg);
scalar_value  pl_callback_1arg_scalar(scalar_value closure,
				      scalar_value arg);

/* ---------------------------------------------------------------------- */
/* |                             OBJECTS                                | */
/* ---------------------------------------------------------------------- */

/* not yet supported */

/* ======================================================================
 * History:
 * 
 * $Log: perlvalues.idl,v $
 * Revision 3.2  2002-02-14 16:24:13  stolpmann
 * 	Added copyright notice
 *
 * Revision 3.1  2002/02/12 20:41:38  stolpmann
 * 	Initial revision at sourceforge
 *
 * Revision 1.1  2000/02/19 15:04:17  gerd
 * 	Initial revision.
 *
 * 
 */

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml