WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Creating TCL extention in simple steps !  (Read 7632 times)

Offline Pats

  • Sr. Member
  • ****
  • Posts: 322
Creating TCL extention in simple steps !
« on: January 01, 2010, 07:49:44 AM »
I develop app in Win platform. I want to convert one of the accounting app  - say xyz.cpp from Win2k ( written in C++)  into TCL ext - which I should be able to use in TCLs - say v2.4 or may be v2.6.
So how to go abt it ?
Suppose for example, how to convert a simple app -Hello World - written in Win C++ ti TCL ext which when loaded and run thru TCLs terminal will output - Hello World -  !
So being a layman in Linux and TCL development,but pl show me the path to the message thread already answered here or better still explain here in a step-by-step Tutorial format - if possible !
Thanks !
~ Pats


Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
Re: Creating TCL extention in simple steps !
« Reply #1 on: January 01, 2010, 08:33:49 AM »
Do you wish to use wine or do a true linux port?

Either way, we have good instructions in the wiki for the extension part: http://tinycorelinux.com/wiki/tiki-index.php?page=Creating+Extensions

To this case mainly part 3, creating a tcz, would apply. It assumes your directory hierarchy is in /tmp/package.
The only barriers that can stop you are the ones you create yourself.

Offline Pats

  • Sr. Member
  • ****
  • Posts: 322
Re: Creating TCL extention in simple steps !
« Reply #2 on: January 01, 2010, 08:45:16 AM »
Since I have taken a plunge in Linux waters recently , I want a pure Linux only app ext on Linux platform - no WINE !
Off-cource I can compile and run small .c or .cpp programs in Linux, but that is all, not much exposure to nitty-gytties of Linux development. :)
Anyhow I will go thru the link you have given and revert back here in case of difficulties - which I vary much is expecting ! :)
~ Pats

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
Re: Creating TCL extention in simple steps !
« Reply #3 on: January 01, 2010, 09:22:40 AM »
Porting an app from win to lin is a very complex topic. You're likely to find more info on that via google.

In short, if you only used ANSI/whatever the standard for C++ is, and no windows-only apis, it just might compile from the start on linux. The only things to add would be ifdef'ed sections for used paths, for example.

But, it's never that easy in practise :P


This book (Advanced Linux Programming) is available online for free:
http://www.advancedlinuxprogramming.com/
« Last Edit: January 01, 2010, 09:25:28 AM by curaga »
The only barriers that can stop you are the ones you create yourself.

Offline Pats

  • Sr. Member
  • ****
  • Posts: 322
Re: Creating TCL extention in simple steps !
« Reply #4 on: January 01, 2010, 11:57:57 AM »
Quote
Either way, we have good instructions in the wiki for the extension part: http://tinycorelinux.com/wiki/tiki-index.php?page=Creating+Extensions
Thanks !
Quite complicated process for a new entrant to linux like me !
But I have to go thru that all, I think - it would have been a great help for newbees if the link above would have a simple practical step-by-step example ( like Hello World ) to build a TCL sample .tce or .tcz  !

Any-how, I sounds a little lazy to be spoon-feed, I think !  ;)

Quote
This book (Advanced Linux Programming) is available online for free:
Yah , this seems to be a good link. Wil go thru this book after the download !
Quote
But, it's never that easy in practise
Correct, sometime back, I had developed a Automated Q/A  bank app for a nearby school management in Linux. So that little experience may help me to understand Linux Programming,I hope !
Anyhow , thanks for the guidance and your lots of patience to un-tiredly explain ( in a down-to-earth fashion ) to so many newbees like me !

~ Pats

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Creating TCL extention in simple steps !
« Reply #5 on: January 01, 2010, 12:07:33 PM »
If you want to create applications I propose Python. Easy to learn, it has nice syntax and great data structures additionaly to the huge number of modules (functions) so you do not have to deal with lower levels. With Python you can make your first applications in a short time and learn while developing. It offers short development cycle and success.

Python applications run on other platforms too. On WINDOWS you can comple it to .EXE etc.

If you havn't done yet, try it.


http://python.org/
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Pats

  • Sr. Member
  • ****
  • Posts: 322
Re: Creating TCL extention in simple steps !
« Reply #6 on: January 01, 2010, 12:35:37 PM »
Quote
Python applications run on other platforms too. On WINDOWS you can comple it to .EXE etc.
Thanks ! I had tried my hand in Python long back . Though it is easy, but I am used to C , C++, VC++ world after graduating from BASIC , COBOL etc.
And C is something which nobody can forget even in sleep ! :)

Most of my apps are in C++ and VC++, so programming C is not a problem for me, but kindly help me to get accustomed to port my little-bit C know-how to Linux platform.
Pl do not get bored with my silly Qs abt Linux. Who knows one day I may be able to develop a workable  extention for TCL, I hope . :)
( I have already started some Linux Programming in C )

~Pats


Offline Pats

  • Sr. Member
  • ****
  • Posts: 322
Re: Creating TCL extention in simple steps !
« Reply #7 on: January 14, 2010, 11:11:26 PM »
Hi curaga !
Your suggestion and link for the Adv. Programming is really fantastic for Linx Programming. I really enjoyed reading the book ! I even ported one of my non-GUI BookShop Invenory app in C from Win Platform to Linux. Working fantastic.
As suggested by bmarkus I also re-tried my hand on Python ! Enjoyed  - thanks !

By the way -  I would like to know from experienced guys like you and others abt which langueses and tools you prefer to develop GUI and non-GUI apps in Linux ?
Also some more links for good online books on Lin. Programming for GUI as well as non-GUI development will be highly appriciated - so kindly give suggestion in that direction.
Thanks !
~ Pats

Offline spence91

  • Jr. Member
  • **
  • Posts: 80
Re: Creating TCL extention in simple steps !
« Reply #8 on: January 15, 2010, 05:41:44 AM »
Personally all the apps i make (both for work and pleasure) are written in python these days. I usually start off with a command line interface simply because it's easy, and also it's nice to be able to pipe stdin/stdout to wherever you want.
With the 'optparse' standard python library it's extremely easy to parse flags/options etc...
http://docs.python.org/library/optparse.html

once it's finished and it needs a frontend then i'll just knock something up in TK.

The reason for using python is because of the speed of development and because it's quite a simple language to pick up and use, i often struggle when it comes to c/c++.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
Re: Creating TCL extention in simple steps !
« Reply #9 on: January 15, 2010, 06:16:54 AM »
For quick prototyping or smaller stuff I use bash, and Xdialog if it needs a GUI.

Then it's C, and graphics with mostly fltk, gtk+, sdl.

I've heard Qt is rather easy if you like C++, with its Creator IDE.
The only barriers that can stop you are the ones you create yourself.

Offline Pats

  • Sr. Member
  • ****
  • Posts: 322
Re: Creating TCL extention in simple steps !
« Reply #10 on: January 15, 2010, 10:45:13 AM »
@spence91:
Thanks for the optParser link. It is so easy like C++ or Java..
Just do like:

<code>
from optparse import OptionParser
[...]
def main():
    usage = "usage: %prog [options] arg"
    parser = OptionParser(usage)
    parser.add_option("-f", "--file", dest="filename",
                      help="read data from FILENAME")
    parser.add_option("-v", "--verbose",
                      action="store_true", dest="verbose")
    parser.add_option("-q", "--quiet",
                      action="store_false", dest="verbose")
    [...]
    (options, args) = parser.parse_args()
    if len(args) != 1:
        parser.error("incorrect number of arguments")
    if options.verbose:
        print "reading %s..." % options.filename
    [...]

if __name__ == "__main__":
    main()
</code>

Wow !

@curaga:
Thanks ! I just wanted this to know:

Then it should be C, and graphics with mostly fltk, gtk+, sdl.

Although - nothing against Python, but I just wanted to integrate my little C, C++, Access database knowledge with some good front-end devpment tool ( like  fltk, gtk+ ) to avoid another learning curve - so I think I should better start from TK ! By the way is there much diff btwn fltk, gtk ? Which should I prefer for long term interest.

Since most of my apps are database-centric, one of the friends suggested me to try mySQL-PHP combo, which I know a little-bit on Windoz, but not done any serious efforts in that direction.
If there are no serious issues to use Access database with C, C++ and fltk etc, then I would like to stick to C !

Thats why I am trying to guess, which tools should I use for devlpment in Linux for long term view !

Presently I have started using emacs for editing and compiling my C code, instead of command-line gcc or g++ ! is it OK ? How you guys compile-run-debug-output your code ?

Thanks !

~ Pats

Offline Arslan S.

  • Hero Member
  • *****
  • Posts: 825
Re: Creating TCL extention in simple steps !
« Reply #11 on: January 15, 2010, 11:39:28 AM »
for GUI if you look for simplicity fox toolkit is a nice one written in C++
http://www.fox-toolkit.org/

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Creating TCL extention in simple steps !
« Reply #12 on: January 15, 2010, 12:02:26 PM »
Check PyGTK at http://www.pygtk.org/
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
Re: Creating TCL extention in simple steps !
« Reply #13 on: January 15, 2010, 12:40:43 PM »
Ya, there's a huge abundance of choice out there, and YMMV :)

Most of the gui toolkits have bindings to most languages anyway.
The only barriers that can stop you are the ones you create yourself.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Creating TCL extention in simple steps !
« Reply #14 on: January 15, 2010, 12:56:55 PM »
Another possibility is wxWidgets http://wxwidgets.org/ possibly with wxPython, wxPerl or one of the many supported languages if you do not want to use C.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."