Reindented some of the C code

This commit is contained in:
Jack Jansen 1998-04-15 14:08:28 +00:00
parent df3c6ab416
commit a239a92e10
2 changed files with 46 additions and 40 deletions

View file

@ -398,26 +398,29 @@ static int SPBObj_setattr(self, name, value)
PyObject *value; PyObject *value;
{ {
int rv = 0;
if (strcmp(name, "inRefNum") == 0) if (strcmp(name, "inRefNum") == 0)
return PyArg_Parse(value, "l", &self->ob_spb.inRefNum); rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum);
else if (strcmp(name, "count") == 0) else if (strcmp(name, "count") == 0)
return PyArg_Parse(value, "l", &self->ob_spb.count); rv = PyArg_Parse(value, "l", &self->ob_spb.count);
else if (strcmp(name, "milliseconds") == 0) else if (strcmp(name, "milliseconds") == 0)
return PyArg_Parse(value, "l", &self->ob_spb.milliseconds); rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds);
else if (strcmp(name, "buffer") == 0) else if (strcmp(name, "buffer") == 0)
return PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength);
else if (strcmp(name, "completionRoutine") == 0) { else if (strcmp(name, "completionRoutine") == 0) {
self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion); self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion);
self->ob_completion = value; self->ob_completion = value;
Py_INCREF(value); Py_INCREF(value);
return 0; rv = 1;
} else if (strcmp(name, "interruptRoutine") == 0) { } else if (strcmp(name, "interruptRoutine") == 0) {
self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt); self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt);
self->ob_interrupt = value; self->ob_interrupt = value;
Py_INCREF(value); Py_INCREF(value);
return 0; rv = 1;
} }
return -1; if ( rv ) return 0;
else return -1;
} }
staticforward PyTypeObject SPB_Type = { staticforward PyTypeObject SPB_Type = {

View file

@ -303,26 +303,29 @@ class SpbObjectDefinition(ObjectDefinition):
def outputSetattrBody(self): def outputSetattrBody(self):
Output(""" Output("""
int rv = 0;
if (strcmp(name, "inRefNum") == 0) if (strcmp(name, "inRefNum") == 0)
return PyArg_Parse(value, "l", &self->ob_spb.inRefNum); rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum);
else if (strcmp(name, "count") == 0) else if (strcmp(name, "count") == 0)
return PyArg_Parse(value, "l", &self->ob_spb.count); rv = PyArg_Parse(value, "l", &self->ob_spb.count);
else if (strcmp(name, "milliseconds") == 0) else if (strcmp(name, "milliseconds") == 0)
return PyArg_Parse(value, "l", &self->ob_spb.milliseconds); rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds);
else if (strcmp(name, "buffer") == 0) else if (strcmp(name, "buffer") == 0)
return PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength);
else if (strcmp(name, "completionRoutine") == 0) { else if (strcmp(name, "completionRoutine") == 0) {
self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion); self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion);
self->ob_completion = value; self->ob_completion = value;
Py_INCREF(value); Py_INCREF(value);
return 0; rv = 1;
} else if (strcmp(name, "interruptRoutine") == 0) { } else if (strcmp(name, "interruptRoutine") == 0) {
self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt); self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt);
self->ob_interrupt = value; self->ob_interrupt = value;
Py_INCREF(value); Py_INCREF(value);
return 0; rv = 1;
} }
return -1;""") if ( rv ) return 0;
else return -1;""")
def outputGetattrHook(self): def outputGetattrHook(self):
Output(""" Output("""