@@ -234,7 +234,7 @@ static int pyhal_init(PyObject *_self, PyObject *args, PyObject *kw) {
234234 (void )kw;
235235 char *name;
236236 char *prefix = 0 ;
237- halobject *self = ( halobject *) _self;
237+ halobject *self = reinterpret_cast < halobject *>( _self) ;
238238
239239 if (!PyArg_ParseTuple (args, " s|s:hal.component" , &name, &prefix)) return -1 ;
240240
@@ -276,7 +276,7 @@ static void pyhal_exit_impl(halobject *self) {
276276}
277277
278278static void pyhal_delete (PyObject *_self) {
279- halobject *self = ( halobject *) _self;
279+ halobject *self = reinterpret_cast < halobject *>( _self) ;
280280 pyhal_exit_impl (self);
281281 Py_TYPE (self)->tp_free (self);
282282}
@@ -477,7 +477,7 @@ static PyObject * pyhal_create_pin(halobject *self, char *name, hal_type_t type,
477477static PyObject *pyhal_new_param (PyObject *_self, PyObject *o) {
478478 char *name;
479479 int type, dir;
480- halobject *self = ( halobject *) _self;
480+ halobject *self = reinterpret_cast < halobject *>( _self) ;
481481
482482 if (!PyArg_ParseTuple (o, " sii" , &name, &type, &dir))
483483 return NULL ;
@@ -494,7 +494,7 @@ static PyObject *pyhal_new_param(PyObject *_self, PyObject *o) {
494494static PyObject *pyhal_new_pin (PyObject *_self, PyObject *o) {
495495 char *name;
496496 int type, dir;
497- halobject *self = ( halobject *) _self;
497+ halobject *self = reinterpret_cast < halobject *>( _self) ;
498498
499499 if (!PyArg_ParseTuple (o, " sii" , &name, &type, &dir))
500500 return NULL ;
@@ -509,7 +509,7 @@ static PyObject *pyhal_new_pin(PyObject *_self, PyObject *o) {
509509
510510static PyObject *pyhal_get_pin (PyObject *_self, PyObject *o) {
511511 char *name;
512- halobject *self = ( halobject *) _self;
512+ halobject *self = reinterpret_cast < halobject *>( _self) ;
513513
514514 if (!PyArg_ParseTuple (o, " s" , &name))
515515 return NULL ;
@@ -524,7 +524,7 @@ static PyObject *pyhal_get_pin(PyObject *_self, PyObject *o) {
524524
525525static PyObject *pyhal_get_pins (PyObject *_self, PyObject * /* o*/ ) {
526526 char *name;
527- halobject *self = ( halobject *) _self;
527+ halobject *self = reinterpret_cast < halobject *>( _self) ;
528528
529529 EXCEPTION_IF_NOT_LIVE (NULL );
530530
@@ -540,7 +540,7 @@ static PyObject *pyhal_get_pins(PyObject *_self, PyObject * /*o*/) {
540540
541541static PyObject *pyhal_ready (PyObject *_self, PyObject * /* o*/ ) {
542542 // hal_ready did not exist in EMC 2.0.x, make it a no-op
543- halobject *self = ( halobject *) _self;
543+ halobject *self = reinterpret_cast < halobject *>( _self) ;
544544 EXCEPTION_IF_NOT_LIVE (NULL );
545545 int res = hal_ready (self->hal_id );
546546 if (res) return pyhal_error (res);
@@ -549,51 +549,51 @@ static PyObject *pyhal_ready(PyObject *_self, PyObject * /*o*/) {
549549
550550static PyObject *pyhal_unready (PyObject *_self, PyObject * /* o*/ ) {
551551 // hal_ready did not exist in EMC 2.0.x, make it a no-op
552- halobject *self = ( halobject *) _self;
552+ halobject *self = reinterpret_cast < halobject *>( _self) ;
553553 EXCEPTION_IF_NOT_LIVE (NULL );
554554 int res = hal_unready (self->hal_id );
555555 if (res) return pyhal_error (res);
556556 return Py_None;
557557}
558558
559559static PyObject *pyhal_exit (PyObject *_self, PyObject * /* o*/ ) {
560- halobject *self = ( halobject *) _self;
560+ halobject *self = reinterpret_cast < halobject *>( _self) ;
561561 pyhal_exit_impl (self);
562562 return Py_None;
563563}
564564
565565static PyObject *pyhal_repr (PyObject *_self) {
566- halobject *self = ( halobject *) _self;
566+ halobject *self = reinterpret_cast < halobject *>( _self) ;
567567 return PyUnicode_FromFormat (" <hal component %s(%d) with %d pins and params>" ,
568568 self->name , self->hal_id , (int )self->items ->size ());
569569}
570570
571571static PyObject *pyhal_getattro (PyObject *_self, PyObject *attro) {
572572 PyObject *result;
573- halobject *self = ( halobject *) _self;
573+ halobject *self = reinterpret_cast < halobject *>( _self) ;
574574 EXCEPTION_IF_NOT_LIVE (NULL );
575575
576- result = PyObject_GenericGetAttr (( PyObject*) self, attro);
576+ result = PyObject_GenericGetAttr (reinterpret_cast < PyObject*>( self) , attro);
577577 if (result) return result;
578578
579579 PyErr_Clear ();
580580 return pyhal_read_common (find_item (self, PyUnicode_AsUTF8 (attro)));
581581}
582582
583583static int pyhal_setattro (PyObject *_self, PyObject *attro, PyObject *v) {
584- halobject *self = ( halobject *) _self;
584+ halobject *self = reinterpret_cast < halobject *>( _self) ;
585585 EXCEPTION_IF_NOT_LIVE (-1 );
586586 return pyhal_write_common (find_item (self, PyUnicode_AsUTF8 (attro)), v);
587587}
588588
589589static Py_ssize_t pyhal_len (PyObject *_self) {
590- halobject* self = ( halobject*) _self;
590+ halobject* self = reinterpret_cast < halobject*>( _self) ;
591591 EXCEPTION_IF_NOT_LIVE (-1 );
592592 return self->items ->size ();
593593}
594594
595595static PyObject *pyhal_get_prefix (PyObject *_self, PyObject *args) {
596- halobject* self = ( halobject*) _self;
596+ halobject* self = reinterpret_cast < halobject*>( _self) ;
597597 if (!PyArg_ParseTuple (args, " " )) return NULL ;
598598 EXCEPTION_IF_NOT_LIVE (NULL );
599599
@@ -606,7 +606,7 @@ static PyObject *pyhal_get_prefix(PyObject *_self, PyObject *args) {
606606
607607static PyObject *pyhal_set_prefix (PyObject *_self, PyObject *args) {
608608 char *newprefix;
609- halobject* self = ( halobject*) _self;
609+ halobject* self = reinterpret_cast < halobject*>( _self) ;
610610 if (!PyArg_ParseTuple (args, " s" , &newprefix)) return NULL ;
611611 EXCEPTION_IF_NOT_LIVE (NULL );
612612
@@ -741,7 +741,7 @@ static const char * param_dir2name(hal_param_dir_t type) {
741741}
742742
743743static PyObject *pyhalpin_repr (PyObject *_self) {
744- pyhalitem *pyself = ( pyhalitem *) _self;
744+ pyhalitem *pyself = reinterpret_cast < pyhalitem *>( _self) ;
745745 halitem *self = &pyself->pin ;
746746
747747 const char * name = " (null)" ;
@@ -761,45 +761,45 @@ static int pyhalpin_init(PyObject * /*_self*/, PyObject *, PyObject *) {
761761}
762762
763763static void pyhalpin_delete (PyObject *_self) {
764- pyhalitem *self = ( pyhalitem *) _self;
764+ pyhalitem *self = reinterpret_cast < pyhalitem *>( _self) ;
765765
766766 if (self->name ) free (self->name );
767767
768768 PyObject_Del (self);
769769}
770770
771771static PyObject * pyhal_pin_set (PyObject * _self, PyObject * value) {
772- pyhalitem * self = ( pyhalitem *) _self;
772+ pyhalitem * self = reinterpret_cast < pyhalitem *>( _self) ;
773773 if (pyhal_write_common (&self->pin , value) == -1 )
774774 return NULL ;
775775 return Py_None;
776776}
777777
778778static PyObject * pyhal_pin_get (PyObject * _self, PyObject *) {
779- pyhalitem * self = ( pyhalitem *) _self;
779+ pyhalitem * self = reinterpret_cast < pyhalitem *>( _self) ;
780780 return pyhal_read_common (&self->pin );
781781}
782782
783783static PyObject * pyhal_pin_get_type (PyObject * _self, PyObject *) {
784- pyhalitem * self = ( pyhalitem *) _self;
784+ pyhalitem * self = reinterpret_cast < pyhalitem *>( _self) ;
785785 return PyLong_FromLong (self->pin .type );
786786}
787787
788788static PyObject * pyhal_pin_get_dir (PyObject * _self, PyObject *) {
789- pyhalitem * self = ( pyhalitem *) _self;
789+ pyhalitem * self = reinterpret_cast < pyhalitem *>( _self) ;
790790 if (self->pin .is_pin )
791791 return PyLong_FromLong (self->pin .dir .pindir );
792792 else
793793 return PyLong_FromLong (self->pin .dir .paramdir );
794794}
795795
796796static PyObject * pyhal_pin_is_pin (PyObject * _self, PyObject *) {
797- pyhalitem * self = ( pyhalitem *) _self;
797+ pyhalitem * self = reinterpret_cast < pyhalitem *>( _self) ;
798798 return PyBool_FromLong (self->pin .is_pin );
799799}
800800
801801static PyObject * pyhal_pin_get_name (PyObject * _self, PyObject *) {
802- pyhalitem * self = ( pyhalitem *) _self;
802+ pyhalitem * self = reinterpret_cast < pyhalitem *>( _self) ;
803803 if (!self->name )
804804 return Py_None;
805805 return PyUnicode_FromString (self->name );
@@ -886,7 +886,7 @@ static PyObject * pyhal_pin_new(halitem * pin, const char * name) {
886886 else
887887 pypin->name = NULL ;
888888
889- return ( PyObject *) pypin;
889+ return reinterpret_cast < PyObject *>( pypin) ;
890890}
891891
892892PyObject *pin_has_writer (PyObject * /* self*/ , PyObject *args) {
@@ -1536,7 +1536,7 @@ struct shmobject {
15361536};
15371537
15381538static int pyshm_init (PyObject *_self, PyObject *args, PyObject * /* kw*/ ) {
1539- shmobject *self = ( shmobject *) _self;
1539+ shmobject *self = reinterpret_cast < shmobject *>( _self) ;
15401540 self->comp = 0 ;
15411541 self->shm_id = -1 ;
15421542
@@ -1559,7 +1559,7 @@ static int pyshm_init(PyObject *_self, PyObject *args, PyObject * /*kw*/) {
15591559}
15601560
15611561static void pyshm_delete (PyObject *_self) {
1562- shmobject *self = ( shmobject *) _self;
1562+ shmobject *self = reinterpret_cast < shmobject *>( _self) ;
15631563 if (self->comp && self->shm_id > 0 )
15641564 rtapi_shmem_delete (self->shm_id , self->comp ->hal_id );
15651565 Py_XDECREF (self->comp );
@@ -1570,8 +1570,8 @@ static int shm_buffer_getbuffer(PyObject *obj, Py_buffer *view, int /*flags*/) {
15701570 PyErr_SetString (PyExc_ValueError, " NULL view in getbuffer" );
15711571 return -1 ;
15721572 }
1573- shmobject* self = ( shmobject *) obj;
1574- view->obj = ( PyObject*) self;
1573+ shmobject* self = reinterpret_cast < shmobject *>( obj) ;
1574+ view->obj = reinterpret_cast < PyObject*>( self) ;
15751575 view->buf = (void *)self->buf ;
15761576 view->len = self->size ;
15771577 view->readonly = 0 ;
@@ -1580,22 +1580,22 @@ static int shm_buffer_getbuffer(PyObject *obj, Py_buffer *view, int /*flags*/) {
15801580}
15811581
15821582static PyObject *pyshm_repr (PyObject *_self) {
1583- shmobject *self = ( shmobject *) _self;
1583+ shmobject *self = reinterpret_cast < shmobject *>( _self) ;
15841584 return PyUnicode_FromFormat (" <shared memory buffer key=%08x id=%d size=%ld>" ,
15851585 self->key , self->shm_id , (unsigned long )self->size );
15861586}
15871587
15881588static PyObject *shm_setsize (PyObject *_self, PyObject *args) {
1589- shmobject *self = ( shmobject *) _self;
1589+ shmobject *self = reinterpret_cast < shmobject *>( _self) ;
15901590 if (!PyArg_ParseTuple (args, " k" , &self->size )) return NULL ;
15911591 return Py_None;
15921592}
15931593
15941594
15951595static PyObject *shm_getbuffer (PyObject *_self, PyObject * /* dummy*/ ) {
15961596
1597- shmobject *self = ( shmobject *) _self;
1598- return (PyObject*)PyMemoryView_FromObject (( PyObject*) self);
1597+ shmobject *self = reinterpret_cast < shmobject *>( _self) ;
1598+ return (PyObject*)PyMemoryView_FromObject (reinterpret_cast < PyObject*>( self) );
15991599}
16001600
16011601static PyObject *set_msg_level (PyObject * /* _self*/ , PyObject *args) {
@@ -1698,7 +1698,7 @@ static int pystream_init(PyObject *_self, PyObject *args, PyObject * /*kw*/) {
16981698 int depth=0 ;
16991699 char *typestring=NULL ;
17001700
1701- streamobj *self = ( streamobj *) _self;
1701+ streamobj *self = reinterpret_cast < streamobj *>( _self) ;
17021702 self->sampleno = 0 ;
17031703
17041704 // creating a new stream
@@ -1751,7 +1751,7 @@ static int pystream_init(PyObject *_self, PyObject *args, PyObject * /*kw*/) {
17511751}
17521752
17531753PyObject *stream_read (PyObject *_self, PyObject * /* unused*/ ) {
1754- streamobj *self = ( streamobj *) _self;
1754+ streamobj *self = reinterpret_cast < streamobj *>( _self) ;
17551755 int n = PyBytes_Size (self->pyelt );
17561756 if (n <= 0 )
17571757 return Py_None;
@@ -1781,7 +1781,7 @@ PyObject *stream_read(PyObject *_self, PyObject * /*unused*/) {
17811781}
17821782
17831783PyObject *stream_write (PyObject *_self, PyObject *args) {
1784- streamobj *self = ( streamobj *) _self;
1784+ streamobj *self = reinterpret_cast < streamobj *>( _self) ;
17851785 PyObject *data;
17861786 if (!PyArg_ParseTuple (args, " O!:hal.stream.write" , &PyTuple_Type, &data))
17871787 return NULL ;
0 commit comments