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 -0000      1.12
+++ jit.c       6 Feb 2002 09:18:01 -0000
@@ -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 -0000       1.6
+++ misc.c      6 Feb 2002 09:18:01 -0000
@@ -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.c    5 Feb 2002 11:41:27 -0000       1.46
+++ string.c    6 Feb 2002 09:18:01 -0000
@@ -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 -0000       1.43
+++ test_main.c 6 Feb 2002 09:18:01 -0000
@@ -14,6 +14,8 @@

 #define setopt(flag) Parrot_setflag(interpreter, flag, (*argv)[0]+2);

+extern void exit(int);
+
 char *
 parseflags(struct Parrot_Interp *interpreter, int *argc, char **argv[]);

Index: warnings.c
===================================================================
RCS file: /home/perlcvs/parrot/warnings.c,v
retrieving revision 1.1
diff -u -r1.1 warnings.c
--- warnings.c  5 Feb 2002 13:12:07 -0000       1.1
+++ warnings.c  6 Feb 2002 09:18:01 -0000
@@ -19,7 +19,7 @@

        va_end(args);

-       if(!(targ=Parrot_sprintf_c(interpreter, "%S at %S line %d.\n", targ, 
interpreter->current_file, interpreter->current_line))) {
+       if(!(targ=Parrot_sprintf_c(interpreter, (const char *)"%S at %S line %d.\n", 
+targ, interpreter->current_file, interpreter->current_line))) {
                return -1;
        }

@@ -58,4 +58,5 @@
        else {
                return 1;
        }
-}
\ No newline at end of file
+}
+
Index: classes/pmc2c.pl
===================================================================
RCS file: /home/perlcvs/parrot/classes/pmc2c.pl,v
retrieving revision 1.12
diff -u -r1.12 pmc2c.pl
--- classes/pmc2c.pl    5 Feb 2002 21:02:50 -0000       1.12
+++ classes/pmc2c.pl    6 Feb 2002 09:18:01 -0000
@@ -160,6 +160,7 @@
   my ($contents, $pmcfile, $cfile) = @_;
   my $lineno = 1;

+
   $contents =~ s/^(.*?^\s*)pmclass ([\w]*)//ms;
   my ($pre, $classname) = ($1, $2);
   $lineno += count_newlines($1);
@@ -211,6 +212,7 @@
      $methodblock =~ s/SELF/pmc/g;
      $methodblock =~ s/INTERP/interpreter/g;

+
      my $decl = "$type Parrot_${classname}_${methodname} (struct Parrot_Interp 
*interpreter, PMC* pmc$parameters)";
      $OUT .= $decl;
      $HOUT .= "extern $decl;\n";
@@ -223,7 +225,7 @@
      push @methods, $methodname;
   };

-  @methods = map { "Parrot_$methodloc->{$_}_$_" } @{ $default{order} };
+  @methods = map { "Parrot_$methodloc->{$_}_$_" } @{ $default{order} };

   my $methodlist = join (",\n        ", @methods);
   my $initname = "Parrot_$classname" . "_class_init";
Index: encodings/singlebyte.c
===================================================================
RCS file: /home/perlcvs/parrot/encodings/singlebyte.c,v
retrieving revision 1.12
diff -u -r1.12 singlebyte.c
--- encodings/singlebyte.c      14 Jan 2002 20:04:26 -0000      1.12
+++ encodings/singlebyte.c      6 Feb 2002 09:18:01 -0000
@@ -40,16 +40,16 @@
     return bptr + 1;
 }

-static void *
-singlebyte_skip_forward (const void *ptr, UINTVAL n) {
-    byte_t *bptr = (byte_t*)ptr;
+static const void *
+singlebyte_skip_forward ( const void *ptr, UINTVAL n) {
+    const byte_t *bptr = (const byte_t*)ptr;

     return bptr + n;
 }

-static void *
+static const void *
 singlebyte_skip_backward (const void *ptr, UINTVAL n) {
-    byte_t *bptr = (byte_t*)ptr;
+    const byte_t *bptr = (const byte_t*)ptr;

     return bptr - n;
 }
Index: encodings/utf16.c
===================================================================
RCS file: /home/perlcvs/parrot/encodings/utf16.c,v
retrieving revision 1.9
diff -u -r1.9 utf16.c
--- encodings/utf16.c   14 Jan 2002 20:04:26 -0000      1.9
+++ encodings/utf16.c   6 Feb 2002 09:18:01 -0000
@@ -76,9 +76,9 @@
     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)) {
@@ -99,9 +99,9 @@
     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.7
diff -u -r1.7 utf32.c
--- encodings/utf32.c   14 Jan 2002 20:04:26 -0000      1.7
+++ encodings/utf32.c   6 Feb 2002 09:18:01 -0000
@@ -45,16 +45,16 @@
     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.10
diff -u -r1.10 utf8.c
--- encodings/utf8.c    14 Jan 2002 20:04:26 -0000      1.10
+++ encodings/utf8.c    6 Feb 2002 09:18:01 -0000
@@ -96,9 +96,9 @@
     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);
@@ -107,9 +107,9 @@
     return u8ptr;
 }

-static void *
-utf8_skip_backward (const void *ptr, UINTVAL n) {
-    utf8_t *u8ptr = (utf8_t*)ptr;
+static const void *
+utf8_skip_backward ( const void *ptr, UINTVAL n) {
+    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.8
diff -u -r1.8 encoding.h
--- include/parrot/encoding.h   1 Jan 2002 20:23:46 -0000       1.8
+++ include/parrot/encoding.h   6 Feb 2002 09:18:01 -0000
@@ -19,8 +19,8 @@
     UINTVAL (*characters)(const void *ptr, UINTVAL bytes);
     UINTVAL (*decode)(const void *ptr);
     void *(*encode)(void *ptr, UINTVAL c);
-    void *(*skip_forward)(const void *ptr, UINTVAL n);
-    void *(*skip_backward)(const void *ptr, UINTVAL n);
+    const void *(*skip_forward)( const void *ptr, UINTVAL n);
+    const void *(*skip_backward)( const void *ptr, UINTVAL n);
 } ENCODING;

 const ENCODING *
Index: include/parrot/misc.h
===================================================================
RCS file: /home/perlcvs/parrot/include/parrot/misc.h,v
retrieving revision 1.2
diff -u -r1.2 misc.h
--- include/parrot/misc.h       5 Feb 2002 10:04:10 -0000       1.2
+++ include/parrot/misc.h       6 Feb 2002 09:18:01 -0000
@@ -6,7 +6,7 @@

 STRING* Parrot_vsprintf_s(struct Parrot_Interp *, STRING* pat, va_list *);

-STRING* Parrot_vsprintf_c(struct Parrot_Interp *, char * pat, va_list *);
+STRING* Parrot_vsprintf_c(struct Parrot_Interp *, const char * pat, va_list *);

 void Parrot_vsprintf(struct Parrot_Interp *, char *targ, char *pat, va_list *);

@@ -14,7 +14,7 @@

 STRING* Parrot_sprintf_s(struct Parrot_Interp *, STRING* pat, ...);

-STRING* Parrot_sprintf_c(struct Parrot_Interp *, char * pat, ...);
+STRING* Parrot_sprintf_c(struct Parrot_Interp *, const char * pat, ...);

 void Parrot_sprintf(struct Parrot_Interp *, char *targ, char *pat, ...);



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

Reply via email to