473,385 Members | 1,846 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,385 software developers and data experts.

Find data type of structure members of a C file

Hi,

I am completely new to perl.
what i want to do is to find if a specific data type is used inside the structure definitions in a C header file.

Expand|Select|Wrap|Line Numbers
  1. perl -ne 'print if /struct[^(].*{/ .. /}/' header.h | grep long
something like this will give an output provided the structure is defined like
Expand|Select|Wrap|Line Numbers
  1. struct tag {
in one single line
but i need to get the result even if the pattern is in multiple lines
like
Expand|Select|Wrap|Line Numbers
  1. struct tag 
  2. {


I need two things infact, one is to find if a specific type is used in any of the structure definitions.
two is to replace a specific type with a new type in all structure definitions.




Thank you,
Regards
Vishnu
Dec 19 '08 #1
4 2607
KevinADC
4,059 Expert 2GB
try adding the 's' option to the end of the regexp:

/struct[^(].*{/ .. /}/s

that way '.' can match a newline
Dec 19 '08 #2
Hay Kevin thanks for your reply.
i tried /s but it is not working. :-(
Dec 21 '08 #3
KevinADC
4,059 Expert 2GB
Well, that is my only suggestion.
Dec 22 '08 #4
@KevinADC
i think i will try concatenating multiple lines and searching in it. i might have to write some code in perl. lets see.
Dec 22 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Vince | last post by:
I have a very specific problem to solve but I cannot find a data structure for it. I don't know if I am posting on the good newsgroup but I cannot find a software.design group. I would like to...
4
by: Thomas Paul Diffenbach | last post by:
Can anyone point me to an open source library of /statically allocated/ data structures? I'm writing some code that would benefit from trees, preferably self balancing, but on an embedded system...
7
by: Drake | last post by:
Well, I'm stuck in legacy land and I need a helping hand. We're trying to give some modern value-added functionality to a circa-1985 fortran proggie. The program produces a binary file, by...
11
by: theshowmecanuck | last post by:
As a matter of academic interest only, is there a way to programmatically list the 'c' data types? I am not looking for detail, just if it is possible, and what function could be used to...
15
by: damian birchler | last post by:
Hi I'm wondering of what type a structure is. Of course, it is a _structure_, but an array isn't an _array_ either. So of what type is a structure? I'd say a pointer, am I right?
6
by: lovecreatesbeauty | last post by:
Hello experts, 1. Does C guarantee the data layout of the memory allocated by malloc function on the heap. I mean, for example, if I allocate a array of 100 elements of structure, can I always...
6
by: STom | last post by:
I have a class declare like this: <Serializable>Public Class Talk Public Structure _localTalk Public _iTalkNumber as Integer End structure End Class I can see the structure from other...
4
by: Working_Girl | last post by:
Hi, I have a database with insurance clients and their dependents (spouses and children). We had a problem in the past with the twins and some of them have been entered with one month...
31
by: aarklon | last post by:
Hi all, this is a question which i saw in a book typedef struct mall_li_header_ { int refcnt; uchar pool; uchar flag; ushort magic_no; char data;
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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...

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.