This patch fixes c preprocessor directive indentation to comply with pdd 7.
[josh-015.patch]
Index: check_source_standards.pl
===================================================================
RCS file: /home/perlcvs/parrot/check_source_standards.pl,v
retrieving revision 1.1
diff -u -r1.1 check_source_standards.pl
--- check_source_standards.pl 21 Feb 2002 18:04:32 -0000 1.1
+++ check_source_standards.pl 3 Mar 2002 03:03:41 -0000
@@ -22,6 +22,7 @@
}}, '.');
}
+FILE:
foreach my $file (@files) {
$file =~ s/^\.\///g;
if (!open(F, "<$file")) {
@@ -32,7 +33,14 @@
my @lines = <F>;
close(F);
chomp @lines;
-
+
+ for (@lines[0..10]) {
+ if (/DO NOT EDIT/) {
+ info($file, 0, "$file is automatically generated. Skipping");
+ next FILE;
+ }
+ }
+
check_source($file, \@lines);
}
@@ -77,8 +85,8 @@
my $line = 0;
foreach (@$source) {
- if (/return\s*\(/) {
- warning($file, $line, "possible use of return (foo); rather than return
foo;");
+ if (/return\(/) {
+ warning($file, $line, "possible use of return(foo); rather than return
+foo;");
}
@@ -199,25 +207,22 @@
# comparitively easy. Each level of the hierarchy should be
# indented two spaces.
- # there is one exception. The outermost "GUARD" ifdef doesn't increase
- # the indenting level.
+ # there are two exceptions. The outermost "GUARD" ifdef doesn't increase
+ # the indenting level. Neither does PARROT_IN_CORE.
my @stack;
my $line = 0;
foreach (@$source) {
$line++;
if (/^\s*\#(\s*)(ifdef|if)\s+(.*)/) {
- my $indent = " " x (@stack-1);
+ next if (/PARROT_IN_CORE|_GUARD/);
+
+ my $indent = " " x (@stack);
if ($1 ne $indent) {
- print "Improper indenting for \"$_\" (should be \"#$indent$2 $3\")\n";
+ error($file, $line, "Improper indenting for \"$_\" (should be
+\"#$indent$2 $3\")\n");
}
push @stack, "#$2 $3";
- # ignore "GUARD" ifdefs for purposes of indenting.
- if (@stack == 1 && $stack[0] =~ /_GUARD/) {
- shift @stack;
- }
-
next;
}
if (/^\s*\#(\s*)(else)/) {
@@ -234,7 +239,9 @@
if ($1 ne $indent) {
error($file, $line, "Improper indenting for \"$_\"\n(should be
\"#$indent$2 $3\" because it is inside of " . (join ' > ', @stack) . ")\n")
}
+
pop @stack;
+
next;
}
Index: interpreter.c
===================================================================
RCS file: /home/perlcvs/parrot/interpreter.c,v
retrieving revision 1.73
diff -u -r1.73 interpreter.c
--- interpreter.c 28 Feb 2002 22:50:53 -0000 1.73
+++ interpreter.c 3 Mar 2002 03:03:44 -0000
@@ -15,7 +15,7 @@
#include "parrot/oplib/core_ops.h"
#include "parrot/runops_cores.h"
#ifdef HAS_JIT
-#include "parrot/jit.h"
+# include "parrot/jit.h"
#endif
@@ -297,17 +297,17 @@
code_end = interpreter->code->byte_code + code_size;
jit_code = build_asm(interpreter, pc, code_start, code_end);
-#ifdef ALPHA
+# ifdef ALPHA
(jit_code)((void *)(((char *)&interpreter->int_reg.registers[0]) + 0x7fff));
-#endif
-#ifdef I386
+# endif
+# ifdef I386
(jit_code)();
-#endif
-#ifdef SUN4
+# endif
+# ifdef SUN4
(jit_code)((void *)(&interpreter->int_reg.registers[0]),
(void *)&interpreter->num_reg.registers[0],
(void *)&interpreter->string_reg.registers[0]);
-#endif
+# endif
#else
return;
Index: jit.c
===================================================================
RCS file: /home/perlcvs/parrot/jit.c,v
retrieving revision 1.14
diff -u -r1.14 jit.c
--- jit.c 27 Feb 2002 21:04:11 -0000 1.14
+++ jit.c 3 Mar 2002 03:03:44 -0000
@@ -114,9 +114,9 @@
address = (INTVAL*)(((char *)address) - (char
*)&interpreter->int_reg.registers[0]);
write_lo_13(&arena[v.info[i].position], (ptrcast_t)address);
#else
-#ifdef ALPHA
+# ifdef ALPHA
address = (INTVAL*)(((char *)address) - interpreter_registers);
-#endif
+# endif
memcpy(&arena[v.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
}
@@ -129,9 +129,9 @@
address = (INTVAL*)(((char *)address) - (char
*)&interpreter->num_reg.registers[0]);
write_lo_13(&arena[v.info[i].position], (ptrcast_t)address);
#else
-#ifdef ALPHA
+# ifdef ALPHA
address = (INTVAL*)(((char *)address) - interpreter_registers);
-#endif
+# endif
memcpy(&arena[v.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
}
@@ -146,9 +146,9 @@
address = (INTVAL*)(((char *)address) - (char
*)&interpreter->string_reg.registers[0]);
write_lo_13(&arena[v.info[i].position], (ptrcast_t)address);
#else
-#ifdef ALPHA
+# ifdef ALPHA
address = (INTVAL*)(((char *)address) - interpreter_registers);
-#endif
+# endif
memcpy(&arena[v.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
}
@@ -166,10 +166,10 @@
#ifdef SUN4
write_32(&arena[v.info[i].position], (ptrcast_t)address);
#else
-#ifdef ALPHA
+# ifdef ALPHA
calculate_displacement((INTVAL *)arena_start,address,&high,(INTVAL
*)&address);
memcpy(&arena[v.info[i].position - 4],&high,OP_ARGUMENT_SIZE);
-#endif
+# endif
memcpy(&arena[v.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
}
@@ -180,10 +180,10 @@
#ifdef SUN4
write_32(&arena[v.info[i].position], (ptrcast_t)address);
#else
-#ifdef ALPHA
+# ifdef ALPHA
calculate_displacement((INTVAL *)arena_start,address,&high,(INTVAL
*)&address);
memcpy(&arena[v.info[i].position - 4],&high,OP_ARGUMENT_SIZE);
-#endif
+# endif
memcpy(&arena[v.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
}
@@ -227,10 +227,10 @@
#ifdef SUN4
write_32(&arena[sv.info[i].position], (ptrcast_t)address);
#else
-#ifdef ALPHA
+# ifdef ALPHA
calculate_displacement((INTVAL *)arena_start,address,&high,(INTVAL
*)&address);
memcpy(&arena[sv.info[i].position - 4],&high,OP_ARGUMENT_SIZE);
-#endif
+# endif
memcpy(&arena[sv.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
}
@@ -309,10 +309,10 @@
#ifdef SUN4
write_32(&arena[v.info[i].position], (ptrcast_t)address);
#else
-#ifdef ALPHA
+# ifdef ALPHA
calculate_displacement((INTVAL *)arena_start,address,&high,(INTVAL
*)&address);
memcpy(&arena[v.info[i].position - 4],&high,OP_ARGUMENT_SIZE);
-#endif
+# endif
memcpy(&arena[v.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
}
@@ -326,10 +326,10 @@
#ifdef SUN4
write_32(&arena[v.info[i].position], (ptrcast_t)address);
#else
-#ifdef ALPHA
+# ifdef ALPHA
calculate_displacement((INTVAL *)arena_start,address,&high,(INTVAL
*)&address);
memcpy(&arena[v.info[i].position - 4],&high,OP_ARGUMENT_SIZE);
-#endif
+# endif
memcpy(&arena[v.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
}
@@ -375,10 +375,10 @@
else {
address = 0;
}
-#ifdef ALPHA
+# ifdef ALPHA
address = (INTVAL *)((INTVAL)address / 4);
arena[v.info[i].position + 2] |= (*(((char *)&address) + 2) & 0x1f);
-#endif
+# endif
memcpy(&arena[v.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
@@ -415,11 +415,11 @@
address = (INTVAL *)((char *)address - (arena + v.info[i].position - 3));
write_30(&arena[v.info[i].position], (ptrcast_t)address);
#else
-#ifdef ALPHA
+# ifdef ALPHA
calculate_displacement((INTVAL *)arena_start,address,&high,&low);
memcpy(&arena[v.info[i].position - 12],&high,OP_ARGUMENT_SIZE);
memcpy(&arena[v.info[i].position - 8],&low,OP_ARGUMENT_SIZE);
-#endif
+# endif
ivalue = (INTVAL) (arena+v.info[i].position) + 4;
@@ -432,10 +432,10 @@
(char *)address +
v.info[i].position + 4));
}
-#ifdef ALPHA
+# ifdef ALPHA
address = (INTVAL *)((INTVAL)address / 4);
arena[v.info[i].position + 2] |= (*(((char *)&address) + 2) & 0x1f);
-#endif
+# endif
memcpy(&arena[v.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
@@ -455,10 +455,10 @@
#ifdef SUN4
write_32(&arena[v.info[i].position], (ptrcast_t)address);
#else
-#ifdef ALPHA
+# ifdef ALPHA
calculate_displacement((INTVAL *)arena_start,address,&high,(INTVAL
*)&address);
memcpy(&arena[v.info[i].position - 4],&high,OP_ARGUMENT_SIZE);
-#endif
+# endif
memcpy(&arena[v.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
}
@@ -477,10 +477,10 @@
#ifdef SUN4
write_32(&arena[v.info[i].position], (ptrcast_t)address);
#else
-#ifdef ALPHA
+# ifdef ALPHA
calculate_displacement((INTVAL *)arena_start,address,&high,(INTVAL
*)&address);
memcpy(&arena[v.info[i].position - 4],&high,OP_ARGUMENT_SIZE);
-#endif
+# endif
memcpy(&arena[v.info[i].position],&address,OP_ARGUMENT_SIZE);
#endif
}
Index: test_gnuc.c
===================================================================
RCS file: /home/perlcvs/parrot/test_gnuc.c,v
retrieving revision 1.1
diff -u -r1.1 test_gnuc.c
--- test_gnuc.c 31 Dec 2001 19:31:26 -0000 1.1
+++ test_gnuc.c 3 Mar 2002 03:03:46 -0000
@@ -8,12 +8,22 @@
puts("(");
#ifdef __GNUC__
printf ("__GNUC__ => %d,\n", __GNUC__);
-#ifdef __GNUC_MINOR__
+# ifdef __GNUC_MINOR__
printf ("__GNUC_MINOR__ =>%d,\n", __GNUC_MINOR__);
-#endif
+# endif
#else
puts ("__GNUC__ => undef,");
#endif
puts(");");
return 0;
}
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */
Index: include/parrot/io.h
===================================================================
RCS file: /home/perlcvs/parrot/include/parrot/io.h,v
retrieving revision 1.14
diff -u -r1.14 io.h
--- include/parrot/io.h 26 Feb 2002 16:36:23 -0000 1.14
+++ include/parrot/io.h 3 Mar 2002 03:03:48 -0000
@@ -39,9 +39,9 @@
#endif
#ifdef BLKSIZE
-# define PIO_BLKSIZE BLKSIZE
+# define PIO_BLKSIZE BLKSIZE
#else
-# define PIO_BLKSIZE 8192
+# define PIO_BLKSIZE 8192
#endif
#define PIO_LINEBUFSIZE 256 /* Default linebuffer size */
#define PIO_GRAIN 2048 /* Smallest size for a block buffer */
@@ -298,14 +298,14 @@
/* Put platform specific macros here if you must */
#ifdef WIN32
extern INTVAL PIO_win32_isatty(PIOHANDLE fd);
-# define PIO_isatty(x) PIO_win32_isatty(x)
+# define PIO_isatty(x) PIO_win32_isatty(x)
extern INTVAL PIO_win32_getblksize(PIOHANDLE fd);
-# define PIO_getblksize(x) PIO_win32_getblksize(x)
+# define PIO_getblksize(x) PIO_win32_getblksize(x)
#else
extern INTVAL PIO_unix_isatty(PIOHANDLE fd);
-# define PIO_isatty(x) PIO_unix_isatty(x)
+# define PIO_isatty(x) PIO_unix_isatty(x)
extern INTVAL PIO_unix_getblksize(PIOHANDLE fd);
-# define PIO_getblksize(x) PIO_unix_getblksize(x)
+# define PIO_getblksize(x) PIO_unix_getblksize(x)
#endif
Index: include/parrot/parrot.h
===================================================================
RCS file: /home/perlcvs/parrot/include/parrot/parrot.h,v
retrieving revision 1.28
diff -u -r1.28 parrot.h
--- include/parrot/parrot.h 22 Feb 2002 00:53:34 -0000 1.28
+++ include/parrot/parrot.h 3 Mar 2002 03:03:48 -0000
@@ -19,9 +19,9 @@
#define PARROT_PARROT_H_GUARD
#if defined(INSIDE_GLOBAL_SETUP)
-#define VAR_SCOPE
+# define VAR_SCOPE
#else
-#define VAR_SCOPE extern
+# define VAR_SCOPE extern
#endif
#define PARROT_IN_CORE
@@ -33,27 +33,27 @@
/*#include <types.h> */
#ifdef WIN32
-# include <io.h>
+# include <io.h>
#endif
#ifdef HAS_HEADER_UNISTD
-# include <unistd.h>
+# include <unistd.h>
#endif
#ifdef HAS_HEADER_SYSMMAN
-# include <sys/mman.h>
+# include <sys/mman.h>
#endif
#ifdef HAS_HEADER_SYSTIME
-# include <sys/time.h>
+# include <sys/time.h>
#endif
#ifdef HAS_HEADER_MATH
-# include <math.h>
+# include <math.h>
#endif
#ifdef HAS_HEADER_FCNTL
-# include <fcntl.h>
+# include <fcntl.h>
#endif
#include <sys/types.h>
@@ -83,13 +83,13 @@
/* Provide support for inline keyword where available. Just make sure to use
* "INLINE" instead and it will DTRT. */
#ifdef __cplusplus
- #define INLINE inline
+# define INLINE inline
#else
- #ifdef __GNUC__
- #define INLINE __inline__
- #else
- #define INLINE
- #endif
+# ifdef __GNUC__
+# define INLINE __inline__
+# else
+# define INLINE
+# endif
#endif
/* On Win32 we need the constant O_BINARY for open() (at least for Borland C),
Index: io/io_win32.c
===================================================================
RCS file: /home/perlcvs/parrot/io/io_win32.c,v
retrieving revision 1.12
diff -u -r1.12 io_win32.c
--- io/io_win32.c 22 Feb 2002 00:53:40 -0000 1.12
+++ io/io_win32.c 3 Mar 2002 03:03:49 -0000
@@ -16,7 +16,7 @@
#ifdef WIN32
-#include <tchar.h>
+# include <tchar.h>
/* Defined at bottom */
extern ParrotIOLayerAPI pio_win32_layer_api;
@@ -122,11 +122,11 @@
DWORD fAcc, fShare, fCreat;
PIOHANDLE fd;
type = PIO_TYPE_FILE;
-#if 0
+# if 0
if((interpreter->flags & PARROT_DEBUG_FLAG) != 0) {
fprintf(stderr, "PIO_win32_open: %s\n", spath);
}
-#endif
+# endif
if((flags & (PIO_F_WRITE|PIO_F_READ)) == 0)
return (ParrotIO *)NULL;
--
Josh Wilmes ([EMAIL PROTECTED]) | http://www.hitchhiker.org