[PATCH(es)] round up of warning fixes

2002-04-03 Thread Jonathan Stowe
,v
retrieving revision 1.11
diff -u -r1.11 utf16.c
--- encodings/utf16.c   12 Mar 2002 11:34:01 -  1.11
+++ encodings/utf16.c   3 Apr 2002 08:42:41 -
 -81,10 +81,10 
 return u16ptr;
 }

-static void *
+static const void *
 utf16_skip_forward(const void *ptr, UINTVAL n)
 {
-utf16_t *u16ptr = (utf16_t *)ptr;
+const utf16_t *u16ptr = (const utf16_t *)ptr;

 while (n--  0) {
 if (UNICODE_IS_HIGH_SURROGATE(*u16ptr)) {
 -106,10 +106,10 
 return u16ptr;
 }

-static void *
+static const void *
 utf16_skip_backward(const void *ptr, UINTVAL n)
 {
-utf16_t *u16ptr = (utf16_t *)ptr;
+const utf16_t *u16ptr = (const utf16_t *)ptr;

 while (n--  0) {
 u16ptr--;
Index: encodings/utf32.c
===
RCS file: /home/perlcvs/parrot/encodings/utf32.c,v
retrieving revision 1.9
diff -u -r1.9 utf32.c
--- encodings/utf32.c   12 Mar 2002 11:34:01 -  1.9
+++ encodings/utf32.c   3 Apr 2002 08:42:41 -
 -48,18 +48,18 
 return u32ptr + 1;
 }

-static void *
+static const void *
 utf32_skip_forward(const void *ptr, UINTVAL n)
 {
-utf32_t *u32ptr = (utf32_t *)ptr;
+const utf32_t *u32ptr = (const utf32_t *)ptr;

 return u32ptr + n;
 }

-static void *
+static const void *
 utf32_skip_backward(const void *ptr, UINTVAL n)
 {
-utf32_t *u32ptr = (utf32_t *)ptr;
+const utf32_t *u32ptr = (const utf32_t *)ptr;

 return u32ptr - n;
 }
Index: encodings/utf8.c
===
RCS file: /home/perlcvs/parrot/encodings/utf8.c,v
retrieving revision 1.12
diff -u -r1.12 utf8.c
--- encodings/utf8.c12 Mar 2002 11:34:01 -  1.12
+++ encodings/utf8.c3 Apr 2002 08:42:41 -
 -107,10 +107,10 
 return u8ptr + len;
 }

-static void *
+static const void *
 utf8_skip_forward(const void *ptr, UINTVAL n)
 {
-utf8_t *u8ptr = (utf8_t *)ptr;
+const utf8_t *u8ptr = (const utf8_t *)ptr;

 while (n--  0) {
 u8ptr += UTF8SKIP(u8ptr);
 -119,10 +119,10 
 return u8ptr;
 }

-static void *
+static const void *
 utf8_skip_backward(const void *ptr, UINTVAL n)
 {
-utf8_t *u8ptr = (utf8_t *)ptr;
+const utf8_t *u8ptr = (const utf8_t *)ptr;

 while (n--  0) {
 u8ptr--;
Index: include/parrot/encoding.h
===
RCS file: /home/perlcvs/parrot/include/parrot/encoding.h,v
retrieving revision 1.12
diff -u -r1.12 encoding.h
--- include/parrot/encoding.h   17 Mar 2002 06:44:44 -  1.12
+++ include/parrot/encoding.h   3 Apr 2002 08:42:42 -
 -28,8 +28,8 
  Parrot_UInt(*characters) (const void *ptr, Parrot_UInt bytes);
  Parrot_UInt(*decode) (const void *ptr);
 void *(*encode) (void *ptr, Parrot_UInt c);
-void *(*skip_forward) (const void *ptr, Parrot_UInt n);
-void *(*skip_backward) (const void *ptr, Parrot_UInt n);
+const void *(*skip_forward) (const void *ptr, Parrot_UInt n);
+const void *(*skip_backward) (const void *ptr, Parrot_UInt n);
 };

 #define Parrot_Encoding struct parrot_encoding_t *


/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




[PATCH] Makefile.in 'make clean' should preserve backups

2002-03-18 Thread Jonathan Stowe

There may be a very good reason for this that I haven't determined but
this keeps catching me - I don't really expect 'make clean' to be deleting
files that I have deliberately made:

--- Makefile.in~Mon Mar 18 07:06:35 2002
+++ Makefile.in Mon Mar 18 07:08:26 2002
 -425,7 +425,6 
$(RM_F) examples/assembly/mops$(O) examples/assembly/mops.pbc
$(RM_F) examples/mops/mops$(O) examples/mops/mops${exe}
$(RM_RF) blib
-   $(RM_F) *~
cd docs  $(MAKE) clean  cd ..
cd classes  $(MAKE) clean  cd ..
cd languages  $(MAKE) clean  cd ..
 -434,6 +433,7 
$(RM_F) t/op/*.pasm t/op/*.pbc t/op/*.out

 realclean: clean
+   $(RM_F) *~
$(RM_F) $(STICKY_FILES)

 distclean:



/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




[PATCH] Warning in packfile.c

2002-03-18 Thread Jonathan Stowe

--- packfile.c~ Mon Mar 18 07:02:08 2002
+++ packfile.c  Mon Mar 18 07:03:04 2002
 -126,7 +126,7 
 if (segment_size % sizeof(opcode_t)) {
 fprintf(stderr,
 PackFile_unpack: Illegal %s table segment size %ld (must be multiple 
of %ld)!\n,
-debug, segment_size, sizeof(opcode_t));
+debug, segment_size, (long)sizeof(opcode_t));
 return 0;
 }
 return 1;

/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




Re: [PATCH] Fix last warnings in encodings stuff

2002-03-18 Thread Jonathan Stowe

On Mon, 18 Mar 2002, Jonathan Stowe wrote:

This is a little
 problematic because in ut8.c and utf16.c we are doing rather unconstly
 things to variables that we hade previously declared as const,

I should qualified this: but it's probably the compilers place to be
deciding whether its a bad thing and it doesn't seem to think so :)

/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




[Not OK] SCO_SV pigment 3.2 5.0.5 i386

2002-03-18 Thread Jonathan Stowe

With the SCO development kit compiler :

[pigment.dircon.net] $ perl ./Configure.pl
Parrot Version 0.0.3 Configure
Copyright (C) 2001-2002 Yet Another Society

Since you're running this script, you obviously have
Perl 5--I'll be pulling some defaults from its configuration.

Checking the MANIFEST to make sure you have a complete Parrot kit...

Okay, we found everything.  Next you'll need to answer
a few questions about your system.  Defaults are in square
brackets, and you can hit enter to accept them.  If you
don't want the default, type a new value in.  If that new
value starts with a '+', it will be concatenated to the
default value.

What C compiler do you want to use? [cc]
How about your linker? [ld]
What flags would you like passed to your C compiler? [-U M_XENIX -D
PERL_SCO -D
PERL_SCO5 -w0 -belf]
What flags would you like passed to your linker? [ -L/usr/local/lib]
Which libraries would you like your C compiler to include? [-lintl
-lsocket -lns
l -lndbm -ldbm -lld -lm -lc -lcrypt -lPW -lx]
How big would you like integers to be? [long]
And your floats? [double]
What is your native opcode type? [long]

Now I have to find out what opcode files you would like to compile into
your
Parrot.

The following opcode files are available:
core.ops io.ops obscure.ops rx.ops

WARNING: Bad Things may happen if the first file on the list isn't
core.ops.

WARNING: These file names will not be checked for spelling, and typing
them
 wrong will force you to run Configure again.

WARNING: I worry way too much about Configure users.

Which opcode files would you like? [core.ops io.ops rx.ops]

Determining if your C compiler is actually gcc (this could take a while):

Odd number of elements in hash assignment at ./Configure.pl line 360,
STDIN ch
unk 9.
Use of uninitialized value at ./Configure.pl line 360, STDIN chunk 9.

The test program didn't give the expected result - assuming your compiler
is
not gcc.


Probing Perl 5's configuration to determine which headers you have (this
could
take a while on slow machines)...

Determining C data type sizes by compiling and running a small C program
(this
could take a while):

  Building ./test.c   from test_c.in...
Odd number of elements in hash assignment at ./Configure.pl line 505.
Use of uninitialized value at ./Configure.pl line 505.
Use of uninitialized value at ./Configure.pl line 513.
Use of uninitialized value at ./Configure.pl line 513.
Use of uninitialized value at ./Configure.pl line 542.
Use of uninitialized value at ./Configure.pl line 545.
Use of uninitialized value at ./Configure.pl line 545.
Configure.pl:  Unable to find a suitable packtype for intvalsize.


I'll take a poke at it - this should be considered FYI rather than
something that should stop 0.04 ;-}

/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




Re: [PATCH] Bash some more warnings

2002-02-18 Thread Jonathan Stowe

On Sun, 17 Feb 2002, Segher Boessenkool wrote:



 Steve Fink wrote:
 
   -  key-keys = (KEY_PAIR*)realloc(key-keys,sizeof(KEY_PAIR)*size);
   +  key-keys = (KEY_PAIR**)realloc(key-keys,sizeof(KEY_PAIR)*size);
 
  That seems rather suspicious. I don't know anything about the KEY_PAIR
  type, but allocating a chunk of memory big enough to fit N structures
  and then using it as an array of pointers to individual structures...
  well, something's fishy.

 That's why it's safer to write

 p = realloc(p, N * sizeof(*p));

 whenever possible (that is, if p has correct type).
 Btw, is the cast necessary?  realloc() returns void*, after all...



The cast is necessary with the warning level that we have currently :)

/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




RE: [Parrot-Newbie] Fooling around with parrot

2002-02-17 Thread Jonathan Stowe

On Sun, 17 Feb 2002, Gerson Kurz wrote:

 Hi Brent,

 you wrote:
  Did you follow the directions in the README file?  That assemble.pl
  warning especially makes me very suspicious.

 I'm sorry, I got it wrong in the mail. I did the configure/make/make test
 thing. This is what happened:

 ~/parrotassemble.pl examples/assembly/euclid.pasm test.pbc
 ~/parrotpbc2c.pl test.pbc test.c
 Use of uninitialized value in sprintf at lib/Parrot/OpTrans/CGoto.pm line
 97.
 ~/parrot


Don't worry about the warnings ;-}

/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




[REPATCH]Re: [PATCH] Nearly the last of the warnings.

2002-02-06 Thread Jonathan Stowe

On Tue, 5 Feb 2002, Jonathan Stowe wrote:

 This might spoil someones future plans but doesn't break anything existing
 AFAICT - apart from those pesky ones left in misc.c the only ones left
 should be from generated code which I have a plan for which I will share
 later :)


This is the same as before except I found what the problem was with the
misc.c warnings :

Index: jit.c
===
RCS file: /home/perlcvs/parrot/jit.c,v
retrieving revision 1.12
diff -u -r1.12 jit.c
--- jit.c   29 Jan 2002 14:05:31 -  1.12
+++ jit.c   6 Feb 2002 09:18:01 -
@@ -214,7 +214,7 @@
 address = (INTVAL *)s-strlen;
 break;
 case 6:
-address = (INTVAL *)s-encoding;
+address = (INTVAL *)s-encoding;
 break;
 case 7:
 address = (INTVAL *)s-type;
Index: misc.c
===
RCS file: /home/perlcvs/parrot/misc.c,v
retrieving revision 1.6
diff -u -r1.6 misc.c
--- misc.c  5 Feb 2002 17:15:22 -   1.6
+++ misc.c  6 Feb 2002 09:18:01 -
@@ -4,6 +4,7 @@

 typedef long HUGEINTVAL;
 typedef unsigned long UHUGEINTVAL;
+typedef const long SCHAR;

 typedef struct spfinfo_t {
INTVAL flags;
@@ -73,11 +74,8 @@
break; 
   
  \
}

-/*
-void int_to_str(char *, char *, HUGEINTVAL, INTVAL );
-*/

-void gen_sprintf_call(char *, char* , SpfInfo , const char);
+static void gen_sprintf_call(char *, char* , SpfInfo , SCHAR);

 static void uint_to_str(char *buf1, char *buf2, UHUGEINTVAL num, INTVAL base) {
int i=0, cur;
@@ -169,8 +167,8 @@
}
 }

-void
-gen_sprintf_call(char *buf, char* buf2, SpfInfo info, const char thingy) {
+static void
+gen_sprintf_call(char *buf, char* buf2, SpfInfo info, SCHAR thingy) {
int i=0;
buf[i++]='%';

@@ -437,7 +435,7 @@


 STRING *
-Parrot_vsprintf_c(struct Parrot_Interp *interpreter, char *pat, va_list *args) {
+Parrot_vsprintf_c(struct Parrot_Interp *interpreter, const char *pat, va_list *args) {
STRING *realpat=string_make(interpreter, pat, strlen(pat), NULL, 0, NULL);

return Parrot_vsprintf_s(interpreter, realpat, args);
@@ -480,7 +478,7 @@
 }

 STRING *
-Parrot_sprintf_c(struct Parrot_Interp *interpreter, char* pat, ...) {
+Parrot_sprintf_c(struct Parrot_Interp *interpreter,const char* pat, ...) {
STRING *ret;
va_list args;

Index: string.c
===
RCS file: /home/perlcvs/parrot/string.c,v
retrieving revision 1.46
diff -u -r1.46 string.c
--- string.c5 Feb 2002 11:41:27 -   1.46
+++ string.c6 Feb 2002 09:18:01 -
@@ -153,8 +153,8 @@
 STRING *dest;
 CHARTYPE_TRANSCODER transcoder1 = NULL;
 CHARTYPE_TRANSCODER transcoder2 = NULL;
-char *srcstart;
-char *srcend;
+const char *srcstart;
+const char *srcend;
 char *deststart;
 char *destend;

@@ -298,8 +298,8 @@
 STRING*
 string_substr(struct Parrot_Interp *interpreter, const STRING* src, INTVAL offset, 
INTVAL length, STRING** d) {
 STRING *dest;
-char *substart;
-char *subend;
+const char *substart;
+const char *subend;
 UINTVAL true_offset;
 UINTVAL true_length;

@@ -350,8 +350,8 @@
  */
 STRING*
 string_chopn(STRING* s, INTVAL n) {
-char *bufstart = s-bufstart;
-char *bufend = bufstart + s-bufused;
+const char *bufstart = s-bufstart;
+const char *bufend = bufstart + s-bufused;
 UINTVAL true_n;

 true_n = (UINTVAL) n;
@@ -376,10 +376,10 @@
 INTVAL
 string_compare(struct Parrot_Interp *interpreter, const STRING* s1,
const STRING* s2) {
-char *s1start;
-char *s1end;
-char *s2start;
-char *s2end;
+const char *s1start;
+const char *s1end;
+const char *s2start;
+const char *s2end;
 INTVAL cmp = 0;

 if (s1  !s2) {
@@ -459,8 +459,8 @@
 INTVAL i = 0;

 if (s) {
-char *start = s-bufstart;
-char *end = start + s-bufused;
+const char *start = s-bufstart;
+const char *end = start + s-bufused;
 int sign = 1;
 BOOLVAL in_number = 0;

@@ -497,8 +497,8 @@
 FLOATVAL f = 0.0;

 if (s) {
-char *start = s-bufstart;
-char *end = start + s-bufused;
+const char *start = s-bufstart;
+const char *end = start + s-bufused;
 int sign = 1;
 BOOLVAL seen_dot = 0;
 BOOLVAL seen_e = 0;
Index: test_main.c
===
RCS file: /home/perlcvs/parrot/test_main.c,v
retrieving revision 1.43
diff -u -r1.43 test_main.c
--- test_main.c 5 Feb 2002 09:20:07

[PATCH] Nearly the last of the warnings.

2002-02-05 Thread Jonathan Stowe
, ...);



Have fun

/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




Re: [PATCH test_main.c config_h.in] Warning in test_main.c

2002-02-01 Thread Jonathan Stowe

On Fri, 1 Feb 2002, Jonathan Stowe wrote:

 This shuts up the implicit declaration warning in test_main.c :




 +#include parrot/config.h

...

On closer examination that line is probably not needed :)

/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




RE: [PATCH test_main.c config_h.in] Warning in test_main.c

2002-02-01 Thread Jonathan Stowe

On Fri, 1 Feb 2002, Brent Dax wrote:
 Jonathan Stowe:
 # This shuts up the implicit declaration warning in test_main.c :
 #
 # --- config_h.in~Fri Feb  1 07:39:42 2002
 # +++ config_h.in Fri Feb  1 07:40:06 2002
 # @@ -51,9 +51,10 @@
 #  #define INTVAL_FMT ${intvalfmt}
 #  #define FLOATVAL_FMT ${floatvalfmt}
 #
 # +#endif
 # +
 #  ${headers}
 #
 # -#endif

 This (part of the) patch is a Really Bad Idea.

 While it clears up a warning, it severely pollutes the namespace of any
 program that embeds Parrot.  Not just test_main.c, but perl_main.c,
 python_main.c, ruby_main.c, scheme_main.c, and
 some_random_program_that_uses_parrot_on_the_inside_main.c.  True,
 HAS_HEADER_FOOs probably aren't something that will differ between
 programs, but it still is a pollution that simply shouldn't be there.


OK, got you.  Would it be better then if test_main.c had its own config.h,
which is likely to be the case if it was a real language front end ?

/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




Re: CPP Namespace pollution

2002-01-28 Thread Jonathan Stowe

On Mon, 28 Jan 2002, Dan Sugalski wrote:

 At 4:25 PM + 1/28/02, Rafael Garcia-Suarez wrote:
 Simon Cozens wrote in perl.perl6.internals:
 
   Similarly, I'd like Parrot/ to move to lib/
 
 And Test/, while you're at it.
 
   But doesn't this require much CVS hackery to keep the revision history?
 
 Don't be the slave of your tools ;-)

 I'm pretty sure that we can do this and preserve the revision
 history, though it needs to be done on the CVS machine itself. I'll
 see if we can find out what needs to be done, then prevail on Ask to
 fix us up here.


You just need someone with a shell on the CVS (and the appropriate
permissions :) server to move the files to the new layout ...


/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




[PATCH Miniperl::Tokenizer] Shut up warning in test

2002-01-02 Thread Jonathan Stowe

This quietens a warning in the Tokenizer test:

--- languages/miniperl/Miniperl/Tokenizer.pm~   Wed Jan  2 07:25:43 2002
+++ languages/miniperl/Miniperl/Tokenizer.pmWed Jan  2 07:34:56 2002
@@ -3,7 +3,7 @@
 use strict;
 use vars qw($VERSION);

-$VERSION = '0.01';
+$VERSION = '0.02';

 #--

@@ -25,7 +25,7 @@

 sub tokenize {
   my $self = shift;
-  $self-{text} = $_[0] if $_[0] and $_[0] ne '';
+  $self-{text} = $_[0] || return [];

   my $tokref = [];
   my $in_quote = 0;



/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|




Re: mem_allocate_aligned

2001-12-11 Thread Jonathan Stowe

On Mon, 10 Dec 2001, Dan Sugalski wrote:

 We need an allocate zeroed call too. We can get zeroed pages faster in
 some cases than we can allocate pages and zero them ourselves.


Isn't that calloc() ?

/J\
-- 
Jonathan Stowe  |
http://www.gellyfish.com  |  This space for rent
|