cvsuser 03/08/13 05:00:19
Modified: . MANIFEST
config/gen/makefiles root.in
Added: . pbc_info.c
Log:
add pbc_info.c sample program
Revision Changes Path
1.403 +1 -0 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.402
retrieving revision 1.403
diff -u -w -r1.402 -r1.403
--- MANIFEST 13 Aug 2003 10:55:23 -0000 1.402
+++ MANIFEST 13 Aug 2003 12:00:17 -0000 1.403
@@ -1826,6 +1826,7 @@
parrot.c []
parrot.spec []
pbc2c.pl [devel]
+pbc_info.c []
pdb.c []
pdump.c []
pmc.c []
1.1 parrot/pbc_info.c
Index: pbc_info.c
===================================================================
/* pbc_info.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
* $Id: pbc_info.c,v 1.1 2003/08/13 12:00:17 leo Exp $
* Overview:
* Sample program dumping PackFile segment names by iterating
* over the main directory.
* Data Structure and Algorithms:
* History:
* Notes:
* References:
*/
#include "parrot/parrot.h"
#include "parrot/embed.h"
static INTVAL iter(struct PackFile_Segment *seg, void *user_data)
{
int ident = (int)user_data;
printf("%*.0s%s\n", ident, "", seg->name);
if (seg->type == PF_DIR_SEG)
PackFile_map_segments((struct PackFile_Directory*)seg,
iter, (void*)(ident+2));
return 0;
}
int
main(int argc, char **argv)
{
struct PackFile *pf;
struct Parrot_Interp *interpreter;
struct PackFile_Segment *seg;
interpreter = make_interpreter(NO_FLAGS);
Parrot_init(interpreter, (void *)&pf);
pf = Parrot_readbc(interpreter, argv[1]);
/*
* add smome more segments
*/
seg = PackFile_Segment_new_seg(&pf->directory, PF_DIR_SEG, "dir2", 1);
seg = PackFile_Segment_new_seg((struct PackFile_Directory*)seg,
PF_BYTEC_SEG, "code", 1);
seg = PackFile_Segment_new_seg(&pf->directory, PF_DIR_SEG, "dir3", 1);
/*
* show these
*/
printf("%s\n", pf->directory.base.name);
PackFile_map_segments(&pf->directory, iter, (void*)2);
Parrot_exit(0);
return 0;
}
1.106 +6 -1 parrot/config/gen/makefiles/root.in
Index: root.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -w -r1.105 -r1.106
--- root.in 12 Aug 2003 15:36:39 -0000 1.105
+++ root.in 13 Aug 2003 12:00:19 -0000 1.106
@@ -171,6 +171,7 @@
TEST_PROG_SO = ${test_prog}_so${exe}
LIBPARROT = ${blib_lib_libparrot_a}
PDUMP = pdump${exe}
+PINFO = pbc_info${exe}
IMCC_PROG = languages/imcc/imcc${exe}
# lclint has changed name to splint at v3.0
@@ -307,6 +308,10 @@
$(LINK) ${ld_out}$(PDUMP) pdump$(O) packdump$(O) $(LINKFLAGS) $(LIBPARROT)
$(C_LIBS)
+# pbc_info
+$(PINFO) : pbc_info$(O) $(LIBPARROT)
+ $(LINK) ${ld_out}$(PINFO) pbc_info$(O) $(LINKFLAGS) $(LIBPARROT) $(C_LIBS)
+
###############################################################################
#
# Other Dependencies and Build Rules:
@@ -640,7 +645,7 @@
progclean:
$(RM_F) $(O_FILES) \
$(TEST_PROG) test_main$(O) test_main$(EXE) \
- $(PDUMP) pdump$(O) packdump$(O) \
+ $(PDUMP) pdump$(O) packdump$(O) pbc_info$(O) $(PINFO) \
$(PDB) pdb$(O) \
$(DIS) disassemble$(O)
$(RM_RF) blib