C++/Tcl/C++ Interface

Discussion in 'C++' started by Soumen, Apr 10, 2008.

  1. Soumen

    Soumen Guest

    Hi,

    Not sure if this most appropriate group for this post. But I've seen
    couple of posts related to C++/Tcl in this group. And that makes me
    post this query in this group. Please redirect me to correct group
    if this is not the most appropriate one.

    I'm a newbie in Tcl and Tcl/C++ interfacing. I need to develop a
    prototype for one of our upcoming project.

    I've a shared library which provides Tcl procedures to traverse
    through some graph which is being created upon reading a file
    of specific format. If I load this shared library in Tcl shell and
    call those proc to read the specific file and traverse the graph.

    Graph traversal proc are like:
    * getting neighbor nodes of a given node
    * getting the node name and edge names to/from a node

    Let's name this Tcl library GL (graph lib).

    Now, in my C++ program I need create a duplicate graph since I don't
    have capability read that file directly. So from my C++ code, I need
    to
    create a Tcl channel, send commands through the Tcl channel for GL
    procs and get information from those GL procs to my C++ application
    to build a duplicate graph on my end.

    Could some one provide hints how to go about this? Any pointers to
    existing resource (doc/open source code) will be very helpful.

    Regards,
    ~ Soumen
    Soumen, Apr 10, 2008
    #1
    1. Advertising

  2. Soumen

    Soumen Guest

    On Apr 10, 3:38 pm, Soumen <> wrote:
    > Hi,
    >
    > Not sure if this most appropriate group for this post. But I've seen
    > couple of posts related to C++/Tcl in this group. And that makes me
    > post this query in this group. Please redirect me to correct group
    > if this is not the most appropriate one.
    >
    > I'm a newbie in Tcl and Tcl/C++ interfacing. I need to develop a
    > prototype for one of our upcoming project.
    >
    > I've a shared library which provides Tcl procedures to traverse
    > through some graph which is being created upon reading a file
    > of specific format. If I load this shared library in Tcl shell and
    > call those proc to read the specific file and traverse the graph.
    >
    > Graph traversal proc are like:
    > * getting neighbor nodes of a given node
    > * getting the node name and edge names to/from a node
    >
    > Let's name this Tcl library GL (graph lib).
    >
    > Now, in my C++ program I need create a duplicate graph since I don't
    > have capability read that file directly. So from my C++ code, I need
    > to
    > create a Tcl channel, send commands through the Tcl channel for GL
    > procs and get information from those GL procs to my C++ application
    > to build a duplicate graph on my end.
    >
    > Could some one provide hints how to go about this? Any pointers to
    > existing resource (doc/open source code) will be very helpful.
    >
    > Regards,
    > ~ Soumen


    Clarifying the requirement further:
    -----------------------------------

    Say there is a text file of specific format. And the shared library
    (GL) is say a standard reader of that specific format. Now, when I
    load this GL.so in tcl shell, and call procedure to read a file of
    the specific format, it internally builds a graph. I've some gl_*
    procedures to traverse that graph.

    Now, my objective is from C++ program, create a tcl channel and send
    commands to read that specific file, to iterate over the graph using
    gl_* procs. Get the required information (o/p of those gl_* tcl procs)
    in the C++ program to mimic the graph of Tcl env in C++ env.

    For example (this is not the exact case) following file is the
    specific format and it represents an adjacency list.

    a ->b ->c
    b ->c
    c -> a ->d
    d -> a -> b

    Now, in the GL.so, I've following Tcl procs:

    gl_read_file ---> reads the adjacency list file
    gl_get_nodes ---> returns a list of node
    gl_get_node_name ---> gives node name of Tcl node obj
    gl_get_neighbor_nodes ---> gives a Tcl list of adjacent nodes of a
    specified node name (or Tcl node obj)
    gl_get_edge ---> gives Tcl edge object connecting two node obj
    gl_get_edge_name ---> gives the edge name of Tcl edge object
    gl_get_out_edge ---> gives list of Tcl edge objects which are outgoing
    edge of specified node.

    Now, in my C++ program I need to create the same graph. But I don't
    have capability of reading this file format. So what I need to do
    create some tcl channel, call required gl_* Tcl proc to create
    the same graph using C++ objects so that later in C++ program
    I can only use the graph in C++ env to do further processing.
    Soumen, Apr 10, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wildepiet
    Replies:
    0
    Views:
    1,850
    Wildepiet
    Jun 14, 2004
  2. cyberco
    Replies:
    8
    Views:
    480
    cyberco
    Feb 25, 2006
  3. Xah Lee
    Replies:
    15
    Views:
    573
    Sherm Pendley
    Mar 23, 2007
  4. Xah Lee
    Replies:
    15
    Views:
    620
    Sherm Pendley
    Mar 23, 2007
  5. Mumia W.

    Inline::Tcl vs. Inline::Tcl

    Mumia W., Aug 23, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    131
    Mumia W.
    Aug 23, 2006
Loading...

Share This Page