[uim-commit] r2082 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Tue Nov 8 04:57:48 PST 2005
Author: yamaken
Date: 2005-11-08 04:57:44 -0800 (Tue, 08 Nov 2005)
New Revision: 2082
Modified:
branches/r5rs/sigscheme/baseport.h
branches/r5rs/sigscheme/encoding.h
branches/r5rs/sigscheme/sigscheme.h
branches/r5rs/sigscheme/sigschemeinternal.h
branches/r5rs/sigscheme/sigschemetype.h
Log:
* sigscheme/sigscheme.h
- (SCM_CONS, SCM_EVAL, SCM_PORT_GETC): Fix Operator precedence
problems as described in doc/style
* sigscheme/sigschemetype.h
- (SCM_CONS_SET_CAR, SCM_CONS_SET_CDR, SCM_CLOSURE_SET_EXP,
SCM_CLOSURE_SET_ENV, SCM_NULLVALUESP, SCM_C_POINTER_SET_VALUE,
SCM_C_FUNCPOINTER_SET_VALUE): Ditto
* sigscheme/sigschemeinternal.h
- (SCM_FREECELL_SET_CAR, SCM_FREECELL_SET_CDR, SCM_FREECELL_SET_CAR,
SCM_FREECELL_SET_CDR, ERR_OBJ): Ditto
* sigscheme/encoding.h
- (SCM_CHARCODEC_INT2STR): Ditto
* sigscheme/baseport.h
- (SCM_CHARPORT_PUTS, SCM_BYTEPORT_PUTS): Ditto
Modified: branches/r5rs/sigscheme/baseport.h
===================================================================
--- branches/r5rs/sigscheme/baseport.h 2005-11-08 12:52:55 UTC (rev 2081)
+++ branches/r5rs/sigscheme/baseport.h 2005-11-08 12:57:44 UTC (rev 2082)
@@ -70,11 +70,11 @@
#endif /* SCM_BYTEPORT_ERROR */
#define SCM_PORT_ERROR_INVALID_TYPE(klass, port, type) \
- SCM_##klass##PORT_ERROR(port, #type ": invalid object is passed to")
+ SCM_##klass##PORT_ERROR((port), #type ": invalid object is passed to")
#define SCM_PORT_ERROR_INVALID_OPERATION(klass, port, type) \
- SCM_##klass##PORT_ERROR(port, #type ": invalid operation")
+ SCM_##klass##PORT_ERROR((port), #type ": invalid operation")
#define SCM_PORT_ERROR_NOMEM(klass, port, type) \
- SCM_##klass##PORT_ERROR(port, #type ": Out of memory")
+ SCM_##klass##PORT_ERROR((port), #type ": Out of memory")
#define SCM_PORT_ALLOC(klass, port, type) \
do { \
@@ -88,12 +88,12 @@
* method must call SCM_PORT_*DYNAMIC_CAST() explicitly.
*/
#define SCM_CHARPORT_DYNAMIC_CAST(type, obj) \
- (SCM_PORT_DYNAMIC_CAST(CHAR, type, obj))
+ (SCM_PORT_DYNAMIC_CAST(CHAR, type, (obj)))
#define SCM_BYTEPORT_DYNAMIC_CAST(type, obj) \
- (SCM_PORT_DYNAMIC_CAST(BYTE, type, obj))
+ (SCM_PORT_DYNAMIC_CAST(BYTE, type, (obj)))
#define SCM_PORT_DYNAMIC_CAST(klass, type, obj) \
- ((SCM_PORT_TRY_DYNAMIC_CAST(type, obj)) ? \
- ((type *)(obj)) : (SCM_PORT_ERROR_INVALID_TYPE(klass, obj, type), NULL))
+ ((SCM_PORT_TRY_DYNAMIC_CAST(type, (obj))) ? \
+ ((type *)(obj)) : (SCM_PORT_ERROR_INVALID_TYPE(klass, (obj), type), NULL))
#define SCM_PORT_TRY_DYNAMIC_CAST(type, obj) \
((type *)(*(obj)->vptr->dyn_cast)((obj), type##_vptr))
@@ -104,10 +104,11 @@
#define SCM_CHARPORT_PEEK_CHAR(cport) ((*(cport)->vptr->peek_char)(cport))
#define SCM_CHARPORT_CHAR_READYP(cport) ((*(cport)->vptr->char_readyp)(cport))
#define SCM_CHARPORT_VPRINTF(cport, str, args) \
- ((*(cport)->vptr->vprintf)(cport, str, args))
-#define SCM_CHARPORT_PUTS(cport, str) ((*(cport)->vptr->puts)(cport, str))
+ ((*(cport)->vptr->vprintf)((cport), (str), (args)))
+#define SCM_CHARPORT_PUTS(cport, str) \
+ ((*(cport)->vptr->puts)((cport), (str)))
#define SCM_CHARPORT_PUT_CHAR(cport, ch) \
- ((*(cport)->vptr->put_char)(cport, ch))
+ ((*(cport)->vptr->put_char)((cport), (ch)))
#define SCM_CHARPORT_FLUSH(cport) ((*(cport)->vptr->flush)(cport))
#define SCM_BYTEPORT_CLOSE(bport) ((*(bport)->vptr->close)(bport))
@@ -116,10 +117,11 @@
#define SCM_BYTEPORT_PEEK_BYTE(bport) ((*(bport)->vptr->peek_byte)(bport))
#define SCM_BYTEPORT_BYTE_READYP(bport) ((*(bport)->vptr->byte_readyp)(bport))
#define SCM_BYTEPORT_VPRINTF(bport, str, args) \
- ((*(bport)->vptr->vprintf)(bport, str, args))
-#define SCM_BYTEPORT_PUTS(bport, str) ((*(bport)->vptr->puts)(bport, str))
+ ((*(bport)->vptr->vprintf)((bport), (str), (args)))
+#define SCM_BYTEPORT_PUTS(bport, str) \
+ ((*(bport)->vptr->puts)((bport), (str)))
#define SCM_BYTEPORT_WRITE(bport, nbytes, buf) \
- ((*(bport)->vptr->write)(bport, nbytes, buf))
+ ((*(bport)->vptr->write)((bport), (nbytes), (buf)))
#define SCM_BYTEPORT_FLUSH(bport) ((*(bport)->vptr->flush)(bport))
/*=======================================
Modified: branches/r5rs/sigscheme/encoding.h
===================================================================
--- branches/r5rs/sigscheme/encoding.h 2005-11-08 12:52:55 UTC (rev 2081)
+++ branches/r5rs/sigscheme/encoding.h 2005-11-08 12:57:44 UTC (rev 2082)
@@ -93,8 +93,9 @@
#define SCM_CHARCODEC_ENCODING(codec) ((*codec->encoding)())
#define SCM_CHARCODEC_SCAN_CHAR(codec, mbs) ((*codec->scan_char)(mbs))
#define SCM_CHARCODEC_STR2INT(codec, start, nbytes) \
- ((*codec->str2int)(start, nbytes))
-#define SCM_CHARCODEC_INT2STR(codec, start, ch) ((*codec->int2str)(start, ch))
+ ((*codec->str2int)((start), (nbytes)))
+#define SCM_CHARCODEC_INT2STR(codec, start, ch) \
+ ((*codec->int2str)((start), (ch)))
/*=======================================
Type Definitions
Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h 2005-11-08 12:52:55 UTC (rev 2081)
+++ branches/r5rs/sigscheme/sigscheme.h 2005-11-08 12:57:44 UTC (rev 2082)
@@ -79,20 +79,20 @@
#define SCM_SYMBOL_BOUNDP(sym) (!SCM_EQ(SCM_SYMBOL_VCELL(sym), SCM_UNBOUND))
-#define SCM_CONS(kar, kdr) (Scm_NewCons(kar, kdr))
+#define SCM_CONS(kar, kdr) (Scm_NewCons((kar), (kdr)))
#define SCM_LIST_1(elm0) \
(SCM_CONS((elm0), SCM_NULL))
#define SCM_LIST_2(elm0, elm1) \
(SCM_CONS((elm0), SCM_LIST_1(elm1)))
#define SCM_LIST_3(elm0, elm1, elm2) \
- (SCM_CONS((elm0), SCM_LIST_2(elm1, elm2)))
+ (SCM_CONS((elm0), SCM_LIST_2((elm1), (elm2))))
#define SCM_LIST_4(elm0, elm1, elm2, elm3) \
- (SCM_CONS((elm0), SCM_LIST_3(elm1, elm2, elm3)))
+ (SCM_CONS((elm0), SCM_LIST_3((elm1), (elm2), (elm3))))
#define SCM_LIST_5(elm0, elm1, elm2, elm3, elm4) \
- (SCM_CONS((elm0), SCM_LIST_4(elm1, elm2, elm3, elm4)))
+ (SCM_CONS((elm0), SCM_LIST_4((elm1), (elm2), (elm3), (elm4))))
-#define SCM_EVAL(obj, env) (Scm_eval(obj, env))
+#define SCM_EVAL(obj, env) (Scm_eval((obj), (env)))
#if SCM_GCC4_READY_GC
/*
@@ -150,17 +150,17 @@
(SCM_ASSERT_LIVE_PORT(port), SCM_CHARPORT_CHAR_READYP(SCM_PORT_IMPL(port)))
#define SCM_PORT_VPRINTF(port, str, args) \
(SCM_ASSERT_LIVE_PORT(port), \
- SCM_CHARPORT_VPRINTF(SCM_PORT_IMPL(port), str, args))
+ SCM_CHARPORT_VPRINTF(SCM_PORT_IMPL(port), (str), (args)))
#define SCM_PORT_PUTS(port, str) \
- (SCM_ASSERT_LIVE_PORT(port), SCM_CHARPORT_PUTS(SCM_PORT_IMPL(port), str))
+ (SCM_ASSERT_LIVE_PORT(port), SCM_CHARPORT_PUTS(SCM_PORT_IMPL(port), (str)))
#define SCM_PORT_PUT_CHAR(port, ch) \
(SCM_ASSERT_LIVE_PORT(port), \
- SCM_CHARPORT_PUT_CHAR(SCM_PORT_IMPL(port), ch))
+ SCM_CHARPORT_PUT_CHAR(SCM_PORT_IMPL(port), (ch)))
#define SCM_PORT_FLUSH(port) \
(SCM_ASSERT_LIVE_PORT(port), SCM_CHARPORT_FLUSH(SCM_PORT_IMPL(port)))
/* backward compatibility */
-#define SCM_PORT_GETC(port, c) (c = SCM_PORT_GET_CHAR(port))
+#define SCM_PORT_GETC(port, c) ((c) = SCM_PORT_GET_CHAR(port))
#define SCM_PORT_UNGETC(port, c)
#define SCM_PORT_PRINT SCM_PORT_PUTS
Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h 2005-11-08 12:52:55 UTC (rev 2081)
+++ branches/r5rs/sigscheme/sigschemeinternal.h 2005-11-08 12:57:44 UTC (rev 2082)
@@ -103,16 +103,16 @@
#define SCM_FREECELL_CAR(a) (SCM_CAR(a))
#define SCM_FREECELL_CDR(a) (SCM_CDR(a))
#define SCM_ENTYPE_FREECELL(a) (SCM_ENTYPE_CONS(a))
-#define SCM_FREECELL_SET_CAR(a,car) (SCM_CONS_SET_CAR(a, car))
-#define SCM_FREECELL_SET_CDR(a,cdr) (SCM_CONS_SET_CDR(a, cdr))
+#define SCM_FREECELL_SET_CAR(a, car) (SCM_CONS_SET_CAR((a), (car)))
+#define SCM_FREECELL_SET_CDR(a, cdr) (SCM_CONS_SET_CDR((a), (cdr)))
#else
#define SCM_FREECELLP(a) (SCM_TYPE(a) == ScmFreeCell)
#define SCM_AS_FREECELL(a) (SCM_ASSERT_TYPE(SCM_FREECELLP(a), (a)))
#define SCM_FREECELL_CAR(a) (SCM_AS_FREECELL(a)->obj.cons.car)
#define SCM_FREECELL_CDR(a) (SCM_AS_FREECELL(a)->obj.cons.cdr)
#define SCM_ENTYPE_FREECELL(a) (SCM_ENTYPE((a), ScmFreeCell))
-#define SCM_FREECELL_SET_CAR(a,car) (SCM_FREECELL_CAR(a) = car)
-#define SCM_FREECELL_SET_CDR(a,cdr) (SCM_FREECELL_CDR(a) = cdr)
+#define SCM_FREECELL_SET_CAR(a, car) (SCM_FREECELL_CAR(a) = (car))
+#define SCM_FREECELL_SET_CDR(a, cdr) (SCM_FREECELL_CDR(a) = (cdr))
#endif
/* Prefix-less Abbreviation Names For Convenient Internal Use */
@@ -203,16 +203,15 @@
((!NULLP(lst)) && ((elm) = CAR(lst), (lst) = CDR(lst), (lst)))
#define SCM_SHIFT_RAW_1(elm0, lst) \
- (SCM_SHIFT_RAW(elm0, lst) ? (lst) : 0)
-
+ (SCM_SHIFT_RAW((elm0), (lst)) ? (lst) : 0)
#define SCM_SHIFT_RAW_2(elm0, elm1, lst) \
- ((SCM_SHIFT_RAW(elm0, lst) \
- && SCM_SHIFT_RAW(elm1, lst)) ? (lst) : 0)
+ ((SCM_SHIFT_RAW((elm0), (lst)) \
+ && SCM_SHIFT_RAW((elm1), (lst))) ? (lst) : 0)
#define SCM_SHIFT_RAW_3(elm0, elm1, elm2, lst) \
- ((SCM_SHIFT_RAW(elm0, lst) \
- && SCM_SHIFT_RAW(elm1, lst) \
- && SCM_SHIFT_RAW(elm2, lst)) ? (lst) : 0)
+ ((SCM_SHIFT_RAW((elm0), (lst)) \
+ && SCM_SHIFT_RAW((elm1), (lst)) \
+ && SCM_SHIFT_RAW((elm2), (lst))) ? (lst) : 0)
/* Obscures identifier ID. */
#define SCM_MANGLE(id) Scm_internal_##id
@@ -241,7 +240,7 @@
/* Signals an error that occured on an object. The current function
* name, the message, then the object, are written (with `write') to
* the error port. */
-#define ERR_OBJ(msg, obj) Scm_ErrorObj(SCM_MANGLE(name), msg, obj)
+#define ERR_OBJ(msg, obj) Scm_ErrorObj(SCM_MANGLE(name), (msg), (obj))
/* ASSERT_NO_MORE_ARG() asserts that the variadic argument list has
* been exhausted. The assertion is implicit in NO_MORE_ARG(), so
Modified: branches/r5rs/sigscheme/sigschemetype.h
===================================================================
--- branches/r5rs/sigscheme/sigschemetype.h 2005-11-08 12:52:55 UTC (rev 2081)
+++ branches/r5rs/sigscheme/sigschemetype.h 2005-11-08 12:57:44 UTC (rev 2082)
@@ -269,9 +269,9 @@
#define SCM_CONSP(a) (SCM_TYPE(a) == ScmCons)
#define SCM_ENTYPE_CONS(a) (SCM_ENTYPE((a), ScmCons))
#define SCM_CAR(a) (SCM_AS_CONS(a)->obj.cons.car)
-#define SCM_CONS_SET_CAR(a,car) (SCM_CAR(a) = car)
+#define SCM_CONS_SET_CAR(a, car) (SCM_CAR(a) = (car))
#define SCM_CDR(a) (SCM_AS_CONS(a)->obj.cons.cdr)
-#define SCM_CONS_SET_CDR(a,cdr) (SCM_CDR(a) = cdr)
+#define SCM_CONS_SET_CDR(a, cdr) (SCM_CDR(a) = (cdr))
#define SCM_CAAR(a) (SCM_CAR(SCM_CAR(a)))
#define SCM_CADR(a) (SCM_CAR(SCM_CDR(a)))
#define SCM_CDAR(a) (SCM_CDR(SCM_CAR(a)))
@@ -312,9 +312,9 @@
#define SCM_CLOSUREP(a) (SCM_TYPE(a) == ScmClosure)
#define SCM_ENTYPE_CLOSURE(a) (SCM_ENTYPE((a), ScmClosure))
#define SCM_CLOSURE_EXP(a) (SCM_AS_CLOSURE(a)->obj.closure.exp)
-#define SCM_CLOSURE_SET_EXP(a, exp) (SCM_CLOSURE_EXP(a) = exp)
+#define SCM_CLOSURE_SET_EXP(a, exp) (SCM_CLOSURE_EXP(a) = (exp))
#define SCM_CLOSURE_ENV(a) (SCM_AS_CLOSURE(a)->obj.closure.env)
-#define SCM_CLOSURE_SET_ENV(a, env) (SCM_CLOSURE_ENV(a) = env)
+#define SCM_CLOSURE_SET_ENV(a, env) (SCM_CLOSURE_ENV(a) = (env))
#define SCM_VECTORP(a) (SCM_TYPE(a) == ScmVector)
#define SCM_ENTYPE_VECTOR(a) (SCM_ENTYPE((a), ScmVector))
@@ -345,7 +345,7 @@
#if SCM_USE_VALUECONS
/* to modify a VALUECONS, rewrite its type to cons by SCM_ENTYPE_CONS(vcons) */
#define SCM_VALUEPACKETP(a) (SCM_TYPE(a) == ScmValuePacket)
-#define SCM_NULLVALUESP(a) (EQ(a, SigScm_null_values))
+#define SCM_NULLVALUESP(a) (EQ((a), SigScm_null_values))
#define SCM_ENTYPE_VALUEPACKET(a) (SCM_ENTYPE((a), ScmValuePacket))
#define SCM_MAKE_VALUEPACKET(vals) (NULLP(vals) ? SigScm_null_values : \
(SCM_ENTYPE_VALUEPACKET(vals), (vals)))
@@ -372,12 +372,12 @@
#define SCM_C_POINTERP(a) (SCM_TYPE(a) == ScmCPointer)
#define SCM_ENTYPE_C_POINTER(a) (SCM_ENTYPE((a), ScmCPointer))
#define SCM_C_POINTER_VALUE(a) (SCM_AS_C_POINTER(a)->obj.c_pointer.data)
-#define SCM_C_POINTER_SET_VALUE(a, ptr) (SCM_C_POINTER_VALUE(a) = ptr)
+#define SCM_C_POINTER_SET_VALUE(a, ptr) (SCM_C_POINTER_VALUE(a) = (ptr))
#define SCM_C_FUNCPOINTERP(a) (SCM_TYPE(a) == ScmCFuncPointer)
#define SCM_ENTYPE_C_FUNCPOINTER(a) (SCM_ENTYPE((a), ScmCFuncPointer))
#define SCM_C_FUNCPOINTER_VALUE(a) (SCM_AS_C_FUNCPOINTER(a)->obj.c_func_pointer.func)
-#define SCM_C_FUNCPOINTER_SET_VALUE(a, funcptr) (SCM_C_FUNCPOINTER_VALUE(a) = funcptr)
+#define SCM_C_FUNCPOINTER_SET_VALUE(a, funcptr) (SCM_C_FUNCPOINTER_VALUE(a) = (funcptr))
/*============================================================================
Environment Specifiers
More information about the uim-commit
mailing list