Recent

Author Topic: Binding Sofia-SIP to Free Pascal  (Read 14375 times)

ik

  • Jr. Member
  • **
  • Posts: 88
  • ik
    • LINESIP
Binding Sofia-SIP to Free Pascal
« on: April 10, 2011, 05:29:32 pm »
Hello People,

I have a dream to see Voice Over IP, audio and vidoe codes etc ... (actually everything :)) all in pure Pascal, and open source (LGPL or something close).

For now I require to create some VoIP application as client side, so I started to bind Nokia's Sofia-SIP to Free Pascal, and I would really appreciate any help from other people as well on this.

The main help that I require are additional fellow binders, so the hard gray work of binding will go faster.

The reason why I do it by hand if you wanted to ask, is because it uses so many dependencies from inside the project, that htopp does not do a very good imho, and require so many passes by hand, that it is easer to bind it by hand.

Thanks,
Ido (IK)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3998
  • I like bugs.
Re: Binding Sofia-SIP to Free Pascal
« Reply #1 on: April 11, 2011, 12:28:31 am »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8317
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Binding Sofia-SIP to Free Pascal
« Reply #2 on: April 11, 2011, 02:57:28 am »
There's also a elhpi application called CToPas (google please) which coul do more aggressive translation (multi-pass) though it's slower. Sometimes the translated code could be compiled out of the box.

nicke85

  • Jr. Member
  • **
  • Posts: 92
  • #13#10
Re: Binding Sofia-SIP to Free Pascal
« Reply #3 on: April 11, 2011, 08:28:59 am »
My sugest to you ik if can help  ::).
On www.asterisk.org is the best open source project for VoIP..if you download gz package from site and sucess to run under linux platform try to make frontend for processes in Lazarus..Then you will learn how to make standalone aplication for whole VoIP centrale and more..I personally didn't tried that for now..but know that it is posible :)
ArchLinux X64 (XFCE) & Windows 7 SP1 Ultimate X64
FPC 2.7.1 / Lazarus 1.1 / ZeosDBO / fortes4lazarus -- all svn

JimBeam

  • New Member
  • *
  • Posts: 36
Re: Binding Sofia-SIP to Free Pascal
« Reply #4 on: April 11, 2011, 09:01:50 am »
Nick, FYI: asterisk is a PABX type software; sofia SIP is software that allows you to talk using SIP (e.g. by programming a softphone). The two are related, but not the same.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9182
  • FPC developer.
Re: Binding Sofia-SIP to Free Pascal
« Reply #5 on: April 11, 2011, 10:54:02 am »
I did very large headers with h2pas. The trick is that most people expect to run it through blindly, which will not work. No header convertor will ever btw. So just going around shopping for the next header converter won't work. There are fundamental problems.

So you need to adapt how you work

I usually use some simple pascal filter programs to split the header up according to type (constants, types, function declaration, macros etc), and then run the header on the individual bits.

Having homogenous input (all structs etc) makes running some substitutions in your prefered editor (*) before and after h2pas easier and safer.

One standard case to lookout for are calling convention macros. Better kill those, run h2pas (play with parameters!), and then bring them back with a global substitute. n the editor.

Most headers in the winunits-base/ package were converted this way.

(*) I usually use "joe".

avra

  • Hero Member
  • *****
  • Posts: 2141
    • Additional info
Re: Binding Sofia-SIP to Free Pascal
« Reply #6 on: April 13, 2011, 11:09:16 am »
There isn't 100% C to Pascal converter, but there are converters that could help a lot. For example, although I have done a lot of C coding, I was always running away from headers conversion and I always had some work around as an excuse not to do it. I was a little pessimistic about results when recently I had no other choice but to try to convert PI API C headers for OsiSoft PI server (world #1 industrial historian) to CodeTyphon/Lazarus/FreePascal, but with help of tools mentioned below about 70-80% of work was done automatically. I had to make corrections and sometimes I had to combine results of 2 converters, but the biggest time consumer was testing of DLL functions, and not the conversion process.

C To Pascal Converter: http://cc.embarcadero.com/item/26951
Dr. Bob's HeadConv: http://www.drbob42.com/delphi/headconv.htm
Rudy's Conversion Helper Package: http://rvelthuis.de/programs/convertpack.html

The biggest time saver tip I can give is to try to find Visual Basic header translation if it exists, and use Marco Cantu's VB converter at http://www.marcocantu.com/tools/vb2delphi.htm. This will probably give you almost 100% automatic conversion (if you are converting just DLL headers, of course). There is also a commercial VBTO converter but trial demo is quite enough for conversion of VB DLL headers to Pascal. Download it here: http://www.vbto.net

Other tips for conversion from C:
http://rvelthuis.de/articles/articles-convert.html
http://rvelthuis.de/articles/articles-pchars.html
http://rvelthuis.de/articles/articles-cobjs.html
http://rvelthuis.de/articles/articles-cppobjs.html
http://www.awitness.org/delphi_pascal_tutorial/c++_delphi

Slightly off topic, but I thought this might be useful to someone...
« Last Edit: April 13, 2011, 11:11:17 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

 

TinyPortal © 2005-2018