On Sun, Jul 21, 2002 at 02:05:42PM +0000, s. payrard @ wanadoo. fr wrote: > # New Ticket Created by [EMAIL PROTECTED] > # Please include the string: [perl #15267] > # in the subject line of all future correspondence about this issue. > # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=15267 > > > > This seems a symptom of a bigger problem. > include/parrot/interpreter.h has the following typedef: > > typedef struct Parrot_Interp *Parrot_Interp; > > It works in C but breaks in C++ (using g++-3.1) as demonstrated > by the breakage of example/pxs: > > > ..../../include/parrot/interpreter.h:32: conflicting types for `typedef struct >Parrot_Interp*Parrot_Interp' > ..../../include/parrot/interpreter.h:30: previous declaration as `struct >Parrot_Interp' > In file included from ../../include/parrot/interpreter.h:44, > from ../../include/parrot/parrot.h:114, > from ../../include/parrot/pxs.h:14, > from PQt.C:15: > > Also, the modifs of pxs.h form CVS 1.2 to 1.3 (replacing > Parrot_Interp_t by parrot_interp_t) also does not fix anything > but confuses a little more the problem. > > in my opinion "typedef struct Parrot_Interp *Parrot_Interp;" is not > only too cute, it is wrong in the light of C++
I want to play with Qt from parrot and started from the example in ./example/pxs. It had not followed the flux of parrot. Problems were going beyond those I described. So I fixed it. Tested with perl 5.008 on linux. > > -- > stef > -- stef
# This is a patch for parrot.old to update it to parrot # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # If you have a decent Bourne-type shell: # STEP 2: Run the shell with this file as input. # If you don't have such a shell, you may need to manually create # the files as shown below. # STEP 3: Run the 'patch' program with this file as input. # # These are the commands needed to create/delete files/directories: # touch 'examples/pxs/makefile' chmod 0644 'examples/pxs/makefile' # # This command terminates the shell and need not be executed manually. exit # #### End of Preamble #### #### Patch data follows #### diff -c 'parrot.old/MANIFEST' 'parrot/MANIFEST' Index: ./MANIFEST *** ./MANIFEST Fri Jul 19 03:16:40 2002 --- ./MANIFEST Mon Jul 22 14:38:33 2002 *************** *** 170,175 **** --- 170,176 ---- examples/mops/mops.py examples/mops/mops.rb examples/mops/mops.scheme + examples/pxs/makefile examples/pxs/PQt.C examples/pxs/QtHelloWorld.pasm exceptions.c diff -c 'parrot.old/config/gen/makefiles/root.in' 'parrot/config/gen/makefiles/root.in' Index: ./config/gen/makefiles/root.in *** ./config/gen/makefiles/root.in Mon Jul 22 09:13:17 2002 --- ./config/gen/makefiles/root.in Mon Jul 22 14:30:48 2002 *************** *** 68,74 **** $(INC)/pmc.h $(INC)/key.h $(INC)/hash.h $(INC)/resources.h $(INC)/platform.h ${cg_h} \ $(INC)/interp_guts.h ${jit_h} $(INC)/rx.h $(INC)/rxstacks.h \ $(INC)/embed.h $(INC)/warnings.h $(INC)/misc.h $(INC)/debug.h $(INC)/pmc.h \ ! $(INC)/key.h $(INC)/hash.h $(INC)/smallobject.h $(INC)/headers.h $(INC)/dod.h ALL_H_FILES = $(GENERAL_H_FILES) --- 68,74 ---- $(INC)/pmc.h $(INC)/key.h $(INC)/hash.h $(INC)/resources.h $(INC)/platform.h ${cg_h} \ $(INC)/interp_guts.h ${jit_h} $(INC)/rx.h $(INC)/rxstacks.h \ $(INC)/embed.h $(INC)/warnings.h $(INC)/misc.h $(INC)/debug.h $(INC)/pmc.h \ ! $(INC)/key.h $(INC)/hash.h $(INC)/smallobject.h $(INC)/headers.h $(INC)/dod.h $(INC)/pxs.h ALL_H_FILES = $(GENERAL_H_FILES) *************** *** 92,98 **** platform$(O) ${jit_o} resources$(O) rx$(O) rxstacks$(O) \ embed$(O) warnings$(O) misc$(O) ${cg_o} \ packout$(O) byteorder$(O) debug$(O) smallobject$(O) \ ! headers$(O) dod$(O) O_FILES = $(INTERP_O_FILES) \ $(IO_O_FILES) \ --- 92,98 ---- platform$(O) ${jit_o} resources$(O) rx$(O) rxstacks$(O) \ embed$(O) warnings$(O) misc$(O) ${cg_o} \ packout$(O) byteorder$(O) debug$(O) smallobject$(O) \ ! headers$(O) dod$(O) pxs$(O) O_FILES = $(INTERP_O_FILES) \ $(IO_O_FILES) \ diff -c 'parrot.old/examples/pxs/PQt.C' 'parrot/examples/pxs/PQt.C' Index: ./examples/pxs/PQt.C *** ./examples/pxs/PQt.C Sun Jun 2 04:50:49 2002 --- ./examples/pxs/PQt.C Mon Jul 22 10:20:53 2002 *************** *** 2,8 **** * Qt Native interface for Parrot - Sample for playing with the * extension design. * ! * compile with: g++ -fPIC -I$QTDIR/include -L$QTDIR -I./include -c PQt.C -lqt * gcc -shared -o libPQt.so PQt.o $QTDIR/lib/libqt.so * * Or something like that... --- 2,8 ---- * Qt Native interface for Parrot - Sample for playing with the * extension design. * ! * compile with: g++ -fPIC -I$QTDIR/include -L$QTDIR/include -c PQt.C -lqt * gcc -shared -o libPQt.so PQt.o $QTDIR/lib/libqt.so * * Or something like that... diff -c /dev/null 'parrot/examples/pxs/makefile' Index: ./examples/pxs/makefile *** ./examples/pxs/makefile Thu Jan 1 00:00:00 1970 --- ./examples/pxs/makefile Mon Jul 22 14:25:44 2002 *************** *** 0 **** --- 1,29 ---- + # semblance of a Makefile + # You need a dynamicallty linked parrot + # go to $PARROTSRC and type "make shared" + + QTDIR = /usr/lib/qt3 + PARROTSRC = /home/parrot + PARROTLIB = /home/parrot/blib/lib + PARROTPX = /home/parrot/examples/pxs + + run: libpqt.so QtHelloWorld.pbc + LD_LIBRARY_PATH=.:../../blib/lib:$(QTDIR)/lib/ ../../parrot +$(PARROTPX)/QtHelloWorld.pbc + + PQt.o : PQt.C + g++ -fPIC -I$(QTDIR)/include -I../../include/ -c PQt.C + + + libpqt.so : PQt.o + gcc -shared -o libpqt.so PQt.o $(QTDIR)/lib/libqt-mt.so +$(PARROTLIB)/libparrot.so $(PARROTLIB)/libcore_prederef.so + + QtHelloWorld.pbc: QtHelloWorld.pasm + perl ../../assemble.pl QtHelloWorld.pasm > QtHelloWorld.pbc + + clean: + -rm *~ *.pbc *.o + + + + + diff -c 'parrot.old/include/parrot/embed.h' 'parrot/include/parrot/embed.h' Index: ./include/parrot/embed.h Prereq: 1.13 *** ./include/parrot/embed.h Mon Jul 15 02:52:00 2002 --- ./include/parrot/embed.h Mon Jul 22 09:40:22 2002 *************** *** 22,46 **** typedef int Parrot_warnclass; typedef void *Parrot_Interp_flag_val; ! Parrot_Interp Parrot_new(void); ! void Parrot_init(Parrot_Interp); ! void Parrot_setflag(Parrot_Interp, Parrot_Interp_flag, Parrot_Interp_flag_val); ! void Parrot_setwarnings(Parrot_Interp, Parrot_warnclass); ! Parrot_PackFile Parrot_readbc(Parrot_Interp, char *); ! void Parrot_loadbc(Parrot_Interp, Parrot_PackFile); ! void Parrot_runcode(Parrot_Interp, int argc, char *argv[]); ! void Parrot_destroy(Parrot_Interp); ! void Parrot_debug(Parrot_Interp); ! void Parrot_disassemble(Parrot_Interp); #endif --- 22,46 ---- typedef int Parrot_warnclass; typedef void *Parrot_Interp_flag_val; ! struct Parrot_Interp* Parrot_new(void); ! void Parrot_init(struct Parrot_Interp*) ; ! void Parrot_setflag(struct Parrot_Interp*, Parrot_Interp_flag, Parrot_Interp_flag_val); ! void Parrot_setwarnings(struct Parrot_Interp*, Parrot_warnclass); ! Parrot_PackFile Parrot_readbc(struct Parrot_Interp*, char *); ! void Parrot_loadbc(struct Parrot_Interp*, Parrot_PackFile); ! void Parrot_runcode(struct Parrot_Interp*, int argc, char *argv[]); ! void Parrot_destroy(struct Parrot_Interp*) ; ! void Parrot_debug(struct Parrot_Interp*) ; ! void Parrot_disassemble(struct Parrot_Interp*) ; #endif diff -c 'parrot.old/include/parrot/interpreter.h' 'parrot/include/parrot/interpreter.h' Index: ./include/parrot/interpreter.h Prereq: 1.50 *** ./include/parrot/interpreter.h Sun Jul 21 13:21:34 2002 --- ./include/parrot/interpreter.h Mon Jul 22 09:43:54 2002 *************** *** 29,35 **** struct Parrot_Interp; - typedef struct Parrot_Interp *Parrot_Interp; #if defined(PARROT_IN_CORE) --- 29,34 ---- diff -c 'parrot.old/include/parrot/pxs.h' 'parrot/include/parrot/pxs.h' Index: ./include/parrot/pxs.h Prereq: 1.4 *** ./include/parrot/pxs.h Sun Jul 21 13:47:19 2002 --- ./include/parrot/pxs.h Mon Jul 22 11:07:13 2002 *************** *** 13,28 **** #include "parrot.h" - /* the cuteness "typedef struct Parrot_Interp*Parrot_Interp" - in interpreter.h does not cut it in C++. Apparently - Josh introduce parrot_interp_t as a work around but - forgot about the typedef ! */ ! ! typedef struct Parrot_Interp* parrot_interp; void PXS_reti(parrot_interp_t, INTVAL); ! void PXS_retn(parrot_Interp_t, FLOATVAL); void PXS_rets(parrot_interp_t, STRING *); void PXS_retp(parrot_interp_t, PMC *); INTVAL PXS_shifti(parrot_interp_t); --- 13,23 ---- #include "parrot.h" ! typedef struct Parrot_Interp* parrot_interp_t; ! int PXS_initargs(parrot_interp_t interp); void PXS_reti(parrot_interp_t, INTVAL); ! void PXS_retn(parrot_interp_t, FLOATVAL); void PXS_rets(parrot_interp_t, STRING *); void PXS_retp(parrot_interp_t, PMC *); INTVAL PXS_shifti(parrot_interp_t); diff -c 'parrot.old/pxs.c' 'parrot/pxs.c' Index: ./pxs.c *** ./pxs.c Thu Jun 20 19:39:12 2002 --- ./pxs.c Mon Jul 22 10:52:36 2002 *************** *** 7,78 **** #include "parrot/pxs.h" int ! PXS_initargs(Parrot_Interp_t interp) { INTVAL numargs; ! stack_pop(interp, &interp->user_stack, &numargs, STACK_ENTRY_INT); return numargs; } void ! PXS_reti(Parrot_Interp_t interp, INTVAL i) { ! stack_push(interp, &interp->user_stack, &i, STACK_ENTRY_INT, STACK_CLEANUP_NULL); } void ! PXS_retn(Parrot_Interp_t interp, FLOATVAL f) { ! stack_push(interp, &interp->user_stack, &f, STACK_ENTRY_FLOAT, STACK_CLEANUP_NULL); } void ! PXS_rets(Parrot_Interp_t interp, STRING * s) { ! stack_push(interp, &interp->user_stack, s, STACK_ENTRY_STRING, STACK_CLEANUP_NULL); } void ! PXS_retp(Parrot_Interp_t interp, PMC * p) { ! stack_push(interp, &interp->user_stack, p, STACK_ENTRY_PMC, STACK_CLEANUP_NULL); } INTVAL ! PXS_shifti(Parrot_Interp_t interp) { INTVAL i; ! stack_pop(interp, &interp->user_stack, &i, STACK_ENTRY_INT); return i; } FLOATVAL ! PXS_shiftn(Parrot_Interp_t interp) { FLOATVAL f; ! stack_pop(interp, &interp->user_stack, &f, STACK_ENTRY_FLOAT); return f; } STRING * ! PXS_shifts(Parrot_Interp_t interp) { STRING * s; ! stack_pop(interp, &interp->user_stack, &s, STACK_ENTRY_STRING); return s; } ! char * PXS_shiftcs(Parrot_Interp_t interp) { STRING * s; ! stack_pop(interp, &interp->user_stack, &s, STACK_ENTRY_STRING); return string_to_cstring(interp, s); } PMC * ! PXS_shiftp(Parrot_Interp_t interp) { PMC * p; ! stack_pop(interp, &interp->user_stack, &p, STACK_ENTRY_PMC); return p; } ! INTVAL PXS_findop(Parrot_Interp_t interp, const char * opname) { int op = interp->op_lib->op_code(opname); return op; } ! PMC * PXS_pointer(Parrot_Interp_t interp, void * object) { PMC * p = new_pmc_header(interp); p->data = object; p->vtable = YOU_LOSE_VTABLE; --- 7,78 ---- #include "parrot/pxs.h" int ! PXS_initargs(parrot_interp_t interp) { INTVAL numargs; ! stack_pop(interp, &interp->ctx.user_stack, &numargs, STACK_ENTRY_INT); return numargs; } void ! PXS_reti(parrot_interp_t interp, INTVAL i) { ! stack_push(interp, &interp->ctx.user_stack, &i, STACK_ENTRY_INT, STACK_CLEANUP_NULL); } void ! PXS_retn(parrot_interp_t interp, FLOATVAL f) { ! stack_push(interp, &interp->ctx.user_stack, &f, STACK_ENTRY_FLOAT, STACK_CLEANUP_NULL); } void ! PXS_rets(parrot_interp_t interp, STRING * s) { ! stack_push(interp, &interp->ctx.user_stack, s, STACK_ENTRY_STRING, STACK_CLEANUP_NULL); } void ! PXS_retp(parrot_interp_t interp, PMC * p) { ! stack_push(interp, &interp->ctx.user_stack, p, STACK_ENTRY_PMC, STACK_CLEANUP_NULL); } INTVAL ! PXS_shifti(parrot_interp_t interp) { INTVAL i; ! stack_pop(interp, &interp->ctx.user_stack, &i, STACK_ENTRY_INT); return i; } FLOATVAL ! PXS_shiftn(parrot_interp_t interp) { FLOATVAL f; ! stack_pop(interp, &interp->ctx.user_stack, &f, STACK_ENTRY_FLOAT); return f; } STRING * ! PXS_shifts(parrot_interp_t interp) { STRING * s; ! stack_pop(interp, &interp->ctx.user_stack, &s, STACK_ENTRY_STRING); return s; } ! char * PXS_shiftcs(parrot_interp_t interp) { STRING * s; ! stack_pop(interp, &interp->ctx.user_stack, &s, STACK_ENTRY_STRING); return string_to_cstring(interp, s); } PMC * ! PXS_shiftp(parrot_interp_t interp) { PMC * p; ! stack_pop(interp, &interp->ctx.user_stack, &p, STACK_ENTRY_PMC); return p; } ! INTVAL PXS_findop(parrot_interp_t interp, const char * opname) { int op = interp->op_lib->op_code(opname); return op; } ! PMC * PXS_pointer(parrot_interp_t interp, void * object) { PMC * p = new_pmc_header(interp); p->data = object; p->vtable = YOU_LOSE_VTABLE; diff -c 'parrot.old/test_main.c' 'parrot/test_main.c' Index: ./test_main.c Prereq: 1.53 *** ./test_main.c Wed May 15 07:25:18 2002 --- ./test_main.c Mon Jul 22 09:55:26 2002 *************** *** 16,22 **** #define setopt(flag) Parrot_setflag(interpreter, flag, (*argv)[0]+2); #define unsetopt(flag) Parrot_setflag(interpreter, flag, 0) ! char *parseflags(Parrot_Interp interpreter, int *argc, char **argv[]); static void usage(void); --- 16,22 ---- #define setopt(flag) Parrot_setflag(interpreter, flag, (*argv)[0]+2); #define unsetopt(flag) Parrot_setflag(interpreter, flag, 0) ! char *parseflags(struct Parrot_Interp* interpreter, int *argc, char **argv[]); static void usage(void); *************** *** 25,31 **** int main(int argc, char *argv[]) { ! Parrot_Interp interpreter; char *filename; Parrot_PackFile pf; --- 25,31 ---- int main(int argc, char *argv[]) { ! struct Parrot_Interp* interpreter; char *filename; Parrot_PackFile pf; *************** *** 53,59 **** } char * ! parseflags(Parrot_Interp interpreter, int *argc, char **argv[]) { if (*argc == 1) { usage(); --- 53,59 ---- } char * ! parseflags(struct Parrot_Interp* interpreter, int *argc, char **argv[]) { if (*argc == 1) { usage(); #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Mon Jul 22 14:39:13 2002 # Generated by : makepatch 2.00_07* # Recurse directories : Yes # Excluded files : (\A|/).*\~\Z # (\A|/).*\.a\Z # (\A|/).*\.bak\Z # (\A|/).*\.BAK\Z # (\A|/).*\.elc\Z # (\A|/).*\.exe\Z # (\A|/).*\.gz\Z # (\A|/).*\.ln\Z # (\A|/).*\.o\Z # (\A|/).*\.obj\Z # (\A|/).*\.olb\Z # (\A|/).*\.old\Z # (\A|/).*\.orig\Z # (\A|/).*\.rej\Z # (\A|/).*\.so\Z # (\A|/).*\.Z\Z # (\A|/)\.del\-.*\Z # (\A|/)\.make\.state\Z # (\A|/)\.nse_depinfo\Z # (\A|/)core\Z # (\A|/)tags\Z # (\A|/)TAGS\Z # p 'MANIFEST' 11347 1027348713 0100644 # p 'config/gen/makefiles/root.in' 15742 1027348248 0100644 # p 'examples/pxs/PQt.C' 1296 1027333253 0100644 # c 'examples/pxs/makefile' 0 1027347944 0100644 # p 'include/parrot/embed.h' 1370 1027330822 0100644 # p 'include/parrot/interpreter.h' 7708 1027331034 0100644 # p 'include/parrot/pxs.h' 1238 1027336033 0100644 # p 'pxs.c' 2379 1027335156 0100644 # p 'test_main.c' 4259 1027331726 0100644 #### End of ApplyPatch data #### #### End of Patch kit [created: Mon Jul 22 14:39:13 2002] #### #### Patch checksum: 466 13888 62492 #### #### Checksum: 496 14967 23067 ####