in reply to compiling Perl on Win32 so I can use Inline::C

I have no experience in compiling perl. However, I find that your statement of "I'm processing binary data" sets off a trigger with me. Perl has facilities for dealing with binary data. I've written a couple of modules at work to do just that. You don't need C to do this, so if that's your only reason for this trek, perhaps you could pose your problem for the monks at large to answer...

thor

Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come

  • Comment on Re: compiling Perl on Win32 so I can use Inline::C

Replies are listed 'Best First'.
Re^2: compiling Perl on Win32 so I can use Inline::C
by diana (Initiate) on Mar 03, 2005 at 01:47 UTC
    Why thank you, kind thor. Can Perl read one byte at a time, do bit-shifts and ands and ors to find a sync pattern, and then translate the binary to hex and then apply a decimal conversion formula to that hex data? And fast? If so, then no, I don't need C. (I'm processing frames of spacecraft telemetry in a sort of home-grown, let's figure out how to do this ourself research atmosphere)
      In one word, YES.

      Read 1 byte at a time:

      read() # when reading from a file, or unpack() # using b or B in the template when reading from a string

      Bit shift left 3 bits:

      $a = $b << 3;

      Bit shift right 2 bits:

      $a = $b >> 2;

      Bitwise AND:

      $c = $a & $b;

      Bitwise OR:

      $c = $a | $b;

      Bitwise XOR:

      $c = $a ^ $b;

      Binary to hex conversion (4 bits at a time):

      $hex =~ s/([01]{4})/sprintf("%.1x", eval('0b'.$binary))/eg;
      (or something similar using the sprintf function)

      --------------------
      mlh2003