I created python code that produce output in the form of:
I need to take this output and create a "C" header file and have it look like this:
I have looked at Python modules "struct":
say i have these many file in a directory named exam.
1)/exam/newfolder/link.txt.
2)/exam/newfolder1/
and i create a tar say exam.tar
well the problem is,
when i read the tar file i dont find any metadata about the directories,as you cannot create a tar containig empty directories.
on the... (2 Replies)
Hello, I have a shell script I wrote in /bin/sh to backup my web sever. I am now on a host (someone reselling rackspace server hosting to me) and when setting up cron, it actually has a dropdown list of "command languages" that you have to choose from.
my options are:
ruby
php
perl... (0 Replies)
Can someone tell me how to do this?
Just a thought that entered my mind when learning about structs.
First thought was:
struct one
{
struct two;
}
struct two
{
three;
}
one->two->three
would this be how you would access "three"? (1 Reply)
Hello,
I found some code on line.
Is a python function that bring up an Internet interface, here the code:
# Get existing device flags
ifreq = struct.pack('16sh', 'wlan0', 0)
flags = struct.unpack('16sh', fcntl.ioctl(sockfd, SIOCGIFFLAGS, ifreq))
I'm starting... (1 Reply)
Hi guys.
I have a header file including a structure like this:
typedef struct
{
int index = -1;
stack_node *head;
} stack;
But when compiling with cc it shows error at the assignment line (int index = -1):
error: expected ‘:', ‘,', ‘;', ‘}' or ‘__attribute__' before ‘=' token... (1 Reply)
Hi,
I have received an application that stores some properties in a file. The existing struct looks like this:
struct TData
{
UINT uSizeIncludingStrings;
// copy of Telnet data struct
UINT uSize;
// basic properties:
TCHAR szHost; //defined in Sshconfig
UINT iPortNr;
TCHAR... (2 Replies)
hi everybody,
I need some help with some programming.
I need to write a file that can search in a text file and read the whole line into a struct.
the struct =
struct Transistor
{
char chType;
char chFabrikant;
float fPrijs;
enum Transistor_Behuizing { empty,TO18, TO39,... (8 Replies)
Here i am having ".tmideg0"hidden file .
I have made programm but it doesnot work
#!/usr/bin/perl
$runDir = $ENV{"REGR_RUN_DIR"};
@files = (<*.tmideg0> <*.tmideg1>);
foreach $FILE (@files)
{
open (IN, $FILE) || die "Couldn't open $FILE for reading";
open (OUT,... (2 Replies)
Hello
I am facing a very unique problem and not able to understand why. I have written a function which will check header of the file. If header is present good else it will write the header on top
def writeHeaderOutputCSV(fileName):
# See if the file exist already
try:
... (0 Replies)
I've been struggling with this one for quite a while and cannot seem to find a solution for this find/replace scenario. Perhaps I'm getting rusty.
I have a file that contains a number of metrics (exactly 3 fields per line) from a few appliances that are collected in parallel. To identify the... (3 Replies)
Discussion started by: verdepollo
3 Replies
LEARN ABOUT DEBIAN
ctypeslib
ctypeslib(1) User Commands ctypeslib(1)NAME
h2xml - convert header files to XML intermediates
xml2py - convert XML intermediates to Python ctypes interface
SYNOPSIS
h2xml includefile ... [options] -o outputxmlfile
xml2py xmlfile ... [options] -o outputpyfile
DESCRIPTION
ctypeslib is a Python code generator capable of converting C header files into xml files (using gccxml), and then converting the xmlfiles
into Python modules which define a ctypes interface to the corresponding C library.
Ctypeslib is not ctypes. Ctypes is included in Python 2.5+ and as an add-on for lower versions, while ctypeslib is a lesser known add-on
written by the ctypes author. If you use ctypes a lot and are tired of setting argtypes and restype of the called functions, you should
look into ctypeslib. Ctypeslib can also set up data types and structures from C header files automatically.
h2xml and xml2py are the user interface scripts to ctypeslib. h2xml converts C header files into xml intermediates (using gccxml) and
xml2py converts these intermediates to Python files. At the minimum, you can get automatic construction of the C types (structures, etc)
in ctypes definitions. With extra options, macro definitions can be expanded and the output Python file can be automatically linked (using
ctypes) to the corresponding C library.
The briefest example is:
h2xml header.h -o out_c.xml
xml2py out_c.xml -o out_c.py
To obtain preprocessor symbols, you must use the -c flag to h2xml. To automatically link to C libraries via ctypes, you muss pass the rel-
evant libraries to xml2py with -l library.so.
OPTIONS
h2xml options:
-h, --help
show brief help message
-q, --quiet
-D NAME[=VALUE]
macros to define
-U NAME
macros to undefine
-I DIRECTORY
additional include directories
-o XMLFILE
XML output filename
-c, --cpp-symbols
try to find #define symbols - this may give compiler errors, so it's off by default.
-k don't delete the temporary files created (useful for finding problems)
xml2py options:
-h, --help
show this help message and exit
-c include source file location in comments
-d include docstrings containing C prototype and source file location
-k TYPEKIND
kind of type descriptions to include: d = #defines, e = enumerations, f = functions, s = structures, t = typedefs
-l DLLS
libraries to search for exported functions
-o OUTPUT
output filename (if not specified, standard output will be used)
-r EXPRESSION
regular expression for symbols to include (if neither symbols nor expressions are specified,everything will be included)
-s SYMBOL
symbol to include (if neither symbols nor expressions are specified,everything will be included)
-v verbose output
-w add all standard windows dlls to the searched dlls list
-m module
Python module(s) containing symbols which will be imported instead of generated
--preload=DLL
dlls to be loaded before all others (to resolve symbols)
EXAMPLES
Please see /usr/share/doc/python-ctypeslib/examples.Debian for examples and explanation.
SEE ALSO
/usr/share/doc/python-ctypeslib/examples.Debian contains a brief tutorial on some key features
Python docstrings (pydoc ctypeslib)
Ctypeslib upstream is http://python.net/crew/theller/ctypes/ (see "Related Projects").
For ctypes information, see http://docs.python.org/library/ctypes.html
AUTHOR
ctypeslib was written by Thomas Heller <theller@ctypes.org>.
This manual page was written by Richard Darst <rkd@zgib.net>, for the Debian project (and may be used by others).
ctypeslib March 2010 ctypeslib(1)