CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Extracting data and inputting to a file in certain format: Edit Log



yash1709
New User

Mar 25, 2013, 1:45 PM


Views: 11931
Extracting data and inputting to a file in certain format

Hello Perl Gurus,

I am a Quality Manager for a firm. I need to get this work done asap. Dont know anything about coding except for some VBA scripting...

I would get this task done manually, but it will be pretty time consuming.

Can you'll please help me out?

I have this .hh file which contains some register values and bit fileds...all this is alien to me, I was just given to get this done...

I need some data extracted from the file and output in a .tcl file with a certain indentation and some information, since this file is an input to a certain tool that require modification.

I have attached both files...and the .tcl file is the format in which I want the output. Can someone please help me out with the perl script to automate this procedure??

It will be really helpful if someone can take care of this for me. Its an earnest request guys.

Just an excerpt from the .hh file:

// This file is auto-generated. To modify, change hw_ae_5170.input and re-run the generator script(hw_accessor_creator.pl).

#pragma once
#ifndef HW_AE_GEN20_HH
#define HW_AE_GEN20_HH

#include <ke_types.hpp>

namespace AEGen2_0 {

class AEGen20HwClass; //Forward Declaration for AEGen20

// Bitfields for AEGen20 // Address Range:(0x15003000-0x15003080)
typedef data16 Reg00Type;
namespace Reg00 { // (0x15003000-0x15003001,RWM)

static const data16 HEAD_SELECT = 0x000F; // <3:0> - RW
static const data16 HEAD_SELECT_BITNUM = 0; // Offset <3:0> - RW
static const data16 READ_BIAS = 0x03F0; // <9:4> - RW
static const data16 READ_BIAS_BITNUM = 4; // Offset <9:4> - RW
static const data16 GAIN = 0x1C00; // <12:10> - RW
static const data16 GAIN_BITNUM = 10; // Offset <12:10> - RW
static const data16 READER_INPUT_IMPEDANCE = 0xE000; // <15:13> - RW
static const data16 READER_INPUT_IMPEDANCE_BITNUM = 13; // Offset <15:13> - RW
} // Reg00
.
.
.
.
.
.
// Done with AEGen20

} // namespace AEGen2_0
#endif

The output file should look like this:


catch {namespace delete Sym}

namespace eval Sym {

set SymList [list [list HEAD_SELECT [list 0 0x000F 0]] \
[list READ_BIAS [list 0 0x03F0 4]] \
[list GAIN [list 0 0x1C00 10]] \
[list READER_INPUT_IMPEDANCE [list 0 0xE000 13]] \
[list WRITE_HEATER [list 1 0x03FF 0]] \
[list WRITER_OUTPUT_IMPEDANCE [list 1 0x0C00 10]] \
[list WRITER_8V [list 1 0x1000 12]] \
[list WRITER_RISE_TIME [list 1 0x6000 13]] \
[list OSD_RANGE [list 1 0x8000 15]] ]
.
.
.
.
.
}

Thank you again for the help and I'm really sorry if this may be the wrong forum!! Like I said, I am not at all familiar with coding practices


(This post was edited by yash1709 on Mar 25, 2013, 1:49 PM)
Attachments: hw_ae_gen10.hh (26.5 KB)
  sym20.tcl (0.80 KB)


Edit Log:
Post edited by yash1709 (New User) on Mar 25, 2013, 1:49 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives