| Newsgroups |
perl.cvs.mod_parrot |
| Message-ID |
<[email protected]> |
cvsuser 02/05/16 20:20:42
Added: . apache.pmc
Log:
Current version of the apache object
Something like this will "work"
new P0,Apache
get_keyed S0,P0,"get"
set_keyed P0,"print",S0
set_keyed P0,"print","hello again"
print P0
end
Revision Changes Path
1.1 mod_parrot/apache.pmc
Index: apache.pmc
===================================================================
/* parrotpointer.pmc
* Copyright: (When this is determined...it will go here)
* CVS Info
* $Id: apache.pmc,v 1.1 2002/05/17 03:20:42 falcone Exp $
* Overview:
* Access to the Apache r object
* Data Structure and Algorithms:
* History:
* Notes:
* References:
*/
#include "parrot/parrot.h"
#include "httpd.h"
#include "mod_parrot.h"
#define APACHE_PARROT_ERROR 1
#define APACHE_ERROR internal_exception(APACHE_PARROT_ERROR, "An illegal operation was performed on an Apache object (vtable function at %s line %d).\n", __FILE__, __LINE__);
int modparrot_printf(const char *format, ...) { return 0; }
char* modparrot_getargs(void) { return NULL; }
pmclass Apache {
INTVAL type () {
return 0;
}
STRING* name () {
return whoami;
}
void init (INTVAL size) {
SELF->data=NULL;
SELF->flags=PMC_private_GC_FLAG;
}
BOOLVAL move_to (void * destination) {
return 0;
}
INTVAL real_size () {
return 0;
}
void destroy () {
}
INTVAL get_integer () {
return (INTVAL)SELF->data;
}
FLOATVAL get_number () {
return (FLOATVAL)(INTVAL)SELF->data;
}
STRING* get_string () {
STRING* ret;
char *target=mem_sys_allocate(64);
/* XXX Dangerous if you have a 196-bit system or above
(and if you do, you have too comfortable a life and
deserve to be tormented by coredumps). */
sprintf(target, "Apache=0x%p", SELF->data);
ret=string_make(interpreter, target, strlen(target), 0, 0, 0);
mem_sys_free(target);
return ret;
}
BOOLVAL get_bool () {
return (BOOLVAL)(SELF->data != NULL);
}
void* get_value () {
return SELF->data;
}
BOOLVAL is_same (PMC* pmc2) {
return (BOOLVAL)(SELF->vtable == pmc2->vtable && SELF->data == pmc2->data);
}
void set_integer (PMC * value) {
APACHE_ERROR;
}
void set_integer_native (INTVAL value) {
APACHE_ERROR;
}
void set_integer_bigint (BIGINT value) {
APACHE_ERROR;
}
void set_integer_same (PMC * value) {
APACHE_ERROR;
}
void set_number (PMC * value) {
APACHE_ERROR;
}
void set_number_native (FLOATVAL value) {
APACHE_ERROR;
}
void set_number_bigfloat (BIGFLOAT value) {
APACHE_ERROR;
}
void set_number_same (PMC * value) {
APACHE_ERROR;
}
void set_string (PMC * value) {
APACHE_ERROR;
}
void set_string_native (STRING * value) {
APACHE_ERROR;
}
void set_string_unicode (STRING * value) {
APACHE_ERROR;
}
void set_string_other (STRING * value) {
APACHE_ERROR;
}
void set_string_same (PMC * value) {
APACHE_ERROR;
}
STRING* get_string_keyed (KEY * key) {
char* args;
args = modparrot_getargs();
printf("%s\n",args);
if (args)
return string_make(INTERP,args,strlen(args),NULL,0,NULL);
else
return string_make(INTERP,NULL,0,NULL,0,NULL);
}
void set_string_keyed (KEY * key, STRING * value) {
modparrot_printf("%s\n", string_to_cstring(INTERP,value));
}
void set_value (void * value) {
}
}