report progress from C function

Discussion in 'Python' started by Michael S, Oct 31, 2006.

  1. Michael S

    Michael S Guest

    Good day all.

    I rewrote part of my program in C, it's a usually a
    long task. I wanted to be able to report the progress
    back to my python program. In my module (in addition
    to the function that performs the above-mentioned
    task) there is a function that returns the variable,
    indicating the progress. However I am not sure how to
    call it. Once I call the C function that does the work
    (it's a while loop that takes minutes sometimes) I
    can't call that progress function.
    Any ideas?

    Thanks in advance,
    Michael
     
    Michael S, Oct 31, 2006
    #1
    1. Advertising

  2. Michael S

    John Machin Guest

    Michael S wrote:
    > Good day all.
    >
    > I rewrote part of my program in C, it's a usually a
    > long task. I wanted to be able to report the progress
    > back to my python program. In my module (in addition
    > to the function that performs the above-mentioned
    > task) there is a function that returns the variable,
    > indicating the progress. However I am not sure how to
    > call it. Once I call the C function that does the work
    > (it's a while loop that takes minutes sometimes) I
    > can't call that progress function.
    > Any ideas?
    >


    What do you expect your "python program" to be doing between calls to
    the get_progress function?

    Here's a sketch of one possible way of doing something useful: add the
    following 2 args to your C "does the work function":
    (1) Python function object to be called every n times around the while
    loop or every nth other event or every n milliseconds or whatever
    (2) n

    BTW, why did you rewrite in C rarher than using Pyrex?

    Cheers,
    John
     
    John Machin, Oct 31, 2006
    #2
    1. Advertising

  3. Michael S wrote:

    > I downloaded Pyrex and ran it through their own
    > example. The code looks quite messy, and I even saw a
    > few "goto"s.


    looked at the assembler output from your C compiler lately?

    </F>
     
    Fredrik Lundh, Nov 1, 2006
    #3
  4. "Fredrik Lundh" <> wrote:

    > Michael S wrote:
    >
    > > I downloaded Pyrex and ran it through their own
    > > example. The code looks quite messy, and I even saw a
    > > few "goto"s.

    >
    > looked at the assembler output from your C compiler lately?
    >
    > </F>


    LOL! - is it even possible to code an if else without conditional jumps?

    - Hendrik
     
    Hendrik van Rooyen, Nov 2, 2006
    #4
    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. Meheraj shaik via .NET 247

    Crysatl report load report failed

    Meheraj shaik via .NET 247, May 28, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    3,278
    saapr
    Jun 7, 2005
  2. Charlie Zhang
    Replies:
    3
    Views:
    1,311
    Paul Lutus
    Aug 16, 2004
  3. Terrence Brannon

    Incremental Progress Report object/closure?

    Terrence Brannon, Sep 1, 2006, in forum: Python
    Replies:
    3
    Views:
    294
    Fredrik Lundh
    Sep 2, 2006
  4. Jim Lewis

    VHDL Standards Progress Report

    Jim Lewis, Sep 14, 2006, in forum: VHDL
    Replies:
    20
    Views:
    2,174
  5. Slaunger
    Replies:
    13
    Views:
    463
    George Sakkis
    Dec 10, 2008
Loading...

Share This Page