473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Re: h2py.py bug?

En Tue, 10 Jun 2008 09:44:13 -0300, Gabriel Rossetti
<ga**************@arimaz.comescribió:
I wanted to use the h2py.py script (Tools/scripts/h2py.py) and it didn't
like char litterals :

Skipping: PC_ERROR = ord()

where my *.h file contained :

#define PC_ERROR '0'

I searched the web and found a post with the same error :

http://mail.python.org/pipermail/pyt...er/340608.html

but it got no replies, I tried the fix and it works. I have the
following questions:

1) Why did it not get any attention, is something wrong with it?
2) If nothing is wrong, did the fix not get applied because a bug report
wasn't filed?
Very probably - bug reports outside the tracker are likely to go unnoticed
or forgotten.
3) Isn't turning a char literal into the ordinal value not contrary to
what a C programmer had in mind when he/she defined it? I mean if you
define a char literal then in python you would have used a string value :

#define PC_ERROR '0'

would become :

PC_ERROR = '0'

in python, and if you intended to use the char type for an 8 bit
numerical value you would have done :

#define PC_ERROR 0x30

where 0x30 is the '0' ascii hex value, so shouldn'it the line in the
diff (see the post) be :

body = p_char.sub("'\\1'", body)

instead of :

body = p_char.sub("ord('\\1')", body)
It's not so clear what's the intended usage - chars are also integers in
C. (I prefer the current behavior, but certainly it may be wrong in
several places).

--
Gabriel Genellina

Jun 27 '08 #1
0 1298

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: lsmithso | last post by:
Python 2.3.4 on RedHat Linux FC3. Tools/scripts/h2py.py doesn't translate C char literals. When I feed it a .h file with the single line: #define GOO 'L' It throws out: Skipping: GOO =...
0
by: Gabriel Rossetti | last post by:
Hello everyone, I wanted to use the h2py.py script (Tools/scripts/h2py.py) and it didn't like char litterals : Skipping: PC_ERROR = ord() where my *.h file contained : #define PC_ERROR...
0
by: Gabriel Rossetti | last post by:
Gabriel Genellina wrote: Ok, I'll file one then. Yes, true, but if you intend to use it as an integer, wouldn't you use a numeric value instead of a character literal?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.