Spell checker for comments, strings, maybe more - c++

I am looking for a spell checker for c++ source code. Unfortunately all I can find is Visual Studio specific. I would like something which works on Linux.
Edit:
Ultimately I want to automate it in some way. I am not very proficient in spell checking, but what I am thinking of is a not-interactive console tool which prints error messages, or something like that.
Personally I use vim, but not everyone on the project does of course.
Currently we are using svn so it is possible to integrate it into the pre-commit-hook maybe?
Don't you guys do something similar?

Eclipse (Java based so will do mac, linux etc.) has spellcheckers built in. With the CDT plugin you can edit and build C++ code.

Vim also supports spell checking.
See the other question for more.

Emacs too has spell checking, flyspell-prog-mode, is the one I use, it is a (very!) personal preference which one works best for you.
The automating the spell check idea is a much trickier one. The best you can hope for is one that will tell you if there are spelling errors. That's trickier than it sounds, especially with code comments which may have all sorts of valid abbreviations which are not real words.
Having a company policy that whatever people have their EDITOR environment variable set to has a spell check enabled, should cut down on the spelling errors in commit messages, for example.

I found something!
svn co svn://anonsvn.kde.org/home/kde/trunk/quality/krazy2 krazy2
this is part of the quality management of KDE.
Besides a multitude of checks (KDE-specific, qt-specific, cpp-specific, ...) there is automated spell checking.
hope this helps

Which editors do you use? Many of them have spell checking abilities. E.g., gedit just needs to have the spellcheck plugin enabled.

You can check out some alpha code I just whipped up for a similar purpose: pyspellcode. It's Zlib licensed and uses clang and hunspell.
No idea how pyspellcode compares to what KDE does/provides but am happy to receive comparisons and will prioritize its development more if there's interest it.
At just over 200 lines, I'm guessing pyspellcode is at least lighter weight than KDE's solution though KDE's solution I imagine is way more tested.

Related

c++ compiler for windows mobile

Well I was curious about this and searched for a while but couldn't find anything really, but maybe someone there got an answer...
I would like to compile code ON my windows mobile 6, and also probably be able to run it aftewards (note that I'm saying ON not FOR). Does something like that even exist?
I mean, 600 MHz CPU on my TOPAZ could handle this task already so maybe some fanatic developed it. I'd be glad if it could even compile some visual code (I think there isn't way to display command line on WM), but I got DOS emulator so it could handle also pretty basic code.
And just BTW if there would be(or not) something for Windows Mobile what about other devices? Something based on JAVA probably. I could emulate that maybe, but native would be prefered.
EDIT:
Well and something just came to my mind reading comments. If I am able to run something under DOS is there any reasonable compiler working in DOS? Something like old command line compiler would maybe do the trick...
And yes the reason for this. Well I'm not much into scripting languages, so this is just a try before I'll got to learn them anyway, but it would be great to create some simple and bruteforce solving programs on-air, and possibly much more use to it.
Thanks ;)
Please have a look at PowerGCC - port GCC to PocketPC platform. It's pretty complicated "quest" to install it.
http://www.mpcclub.com/wiki/index.php/CPrograms#Install_a_C_environment_on_PocketPC_.28compiler_etc..29
cke - IDE for mobile platform
http://www.animaniak.com/cke/cke_main.asp

Text Editor API. Scintilla for experimental IDE. Do you use something else?

I have discovered Scintilla/Notepad++ API this week end.
As there is a nice Template vcproj for Notepad++ Plugins available on line then I could start to play with some pseudo code-source really really fastly.
I have just looked briefly at the Scintilla documentation which expose the API which looks promising. Sometimes it is still hazy for me, sometimes not as feature-full as I expect/dream, but that's really meaningless details for now.
So now it is time I experiment with a language of my fancy, for the moment I nickname it "Entity". And what best to do than design a light IDE for it.
So I am going to invest much time in Notepad++/Scintilla environement.
I have have not thought about using Emacs because I never got accustomed to it.
But if you use another type of Text Editor API than Scintilla, preferably in C++ since it is my language experience... what other Text Editor API would you use/have you used ?
Just want to be sure of my choice before diving deeper.
I found Scintilla to be very feature-packed, and covered everything I needed. You have to do a bit of work to get all the functionality out of it (ensuring that keyboard short-cuts perform the desired effect, etceteras), but it was incredibly easy to compile, include and get working, though as I said you have to do a bit of legwork to get everything out of it, but this is better than having to tear your hair out getting an "all-purpose" control to stop doing something you don't want to. It is as if the authors have given you a toolbox to work with.

I want to make my own source code editor, what are the good choices to make? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I've had it of those dozens of editors which never provides simple things like:
distinguish type keywords and instruction keywords so I can put different colors on them.
being cross platform using a standard GUI lib like qt gtk etc (notepad++, yes, I almost hate you).
enough keyboard shortcut like duplicate line, comment selection, and a decent find-replace.
Decent task-easing features like single-click-on-the-number-line-margin to select the entire line.
Scintilla or another good-enough lexer that highlights enough different things, because brain-compiling code is one thing, quickly identify with the eyes what is what is something I find important.
I just want to support very basic languages like C, C++, maybe Python, not HTML or CSS.
Is Scintilla a good choice to just highlight those languages, and is a lexer really necessary ?
Isn't QT enough to program a text editor such as the one I want to do ? I know there is QScintilla, but is there a reason I shouldn't use a lib that integrates a lexer ? Why is Scintilla such a good lib ?
Is QT a good choice for such an editor ? (I also want to hard embed ProFont in the editor to kill any reluctant font problem between OSes).
EDIT:
In short, I want to make an editor, only with the same syntax highlight features of notepad++. That's my main goal, and the use of QScintilla might be a little harder than I thought...
EDIT2:
Well I found textadept, it's not so known but is quite awesome. I didn't manage to make my lexer, since I have other to do which I do under windows, unfortunately it's slow on the mac. Apparently there isn't any Scite official build for the mac.
C++ is not a "very basic language" by any stretch of the imagination.
Why do you really want to do this? There are SOOO many open source code editors out there.
If you must write your own editor, I suggest looking at the other open source editors and examine which pieces you port to your editor.
Porting pieces of existing working and tested code is usually much better than writing your own code and debugging it.
After perusing a couple serious open source editors: Emacs, Eclips, CodeBlocks, CodeLight, etc., I believe you will start changing your mind about writing an editor from scratch.
-- Thomas Matthews
My Info
If you really want to do this (and it sounds like a lot of work) I would look at ANTLR for parsing the code. You may get some ideas from their ANTLRWorks display.
To link the parse tree to a display could be a fair amount of work so I'd see what an IDE platform such as Eclipse has to offer
Are you OK with Java?
If so, go for Eclipse technologies: SWT and JFace. The latter provides you with org.eclipse.jface.text package with a lot of features. Then you can roll own editor easily basing on that. (I prefer Eclipse-based editors to Scintilla-based, I believe they tend to be more advanced and feature-rich, but that's my personal opinion.)
But then, you might want to go a step further and use the Eclipse RCP framework for you application... But then why not use the Eclipse IDE itself and just add whatever you want as plug-ins.
The Eclipse codebase is huge and it's up to you how much you want to reuse.
I would expend some effort experimenting with the emacs colour theme package and the various langauge modes; see if you can bend the lisp to do what you want. You almost certainly can. to my mind emacs and a bit of effort on your part will get you your ultimate editor (remember emacs is really just a DIY editor toolkit). If you cant bend emacs into the shape you want you will be well placed to expend the effort in writing your own.
I have tried to do something similar myself for a project I'm working on at the moment, I looked into the QScintilla and had to remove it from my project because when you embedded inside a QGraphicsView I can't control the resolution of the widgets image, it seems to paint the text as an image and that's what we see, I played with increasing the smoothness of the QFont and that improved it but still a no-go.
So I found a simple code editor inside QT's code base it comes with every installation of QT if you look
into:
C:\Qt\4.7.3\src\scripttools\debugging\qscriptedit.h
C:\Qt\4.7.3\src\scripttools\debugging\qscriptedit.cpp
If you go to the source code of OpenShapeFactory where I'm trying to embed a Code Editor: check how I got the syntax Highlighter and the autocomplete :
this widget uses the qscriptedit widget that ships with qt, you can add your own keywords to the syntax hightlighter from a file as well as for the auto-complete dropdownlist.
this is the header, scriptwidget.h and the implementation scriptwidget.cpp are available as part of the whole project code.
the next stage is to look into the QTCreator and see the code they already have all if not most of these features after you get to compile their version, just find where to add your little mods and you might be getting closer to the simple code editor.
I wish you the best of luck on this direction and if you find a solution please send it over, :)
heads-up keep a lookout for the repository link above, if I find a way of making it first, I might chase you to the answer.
Like everyone else is saying, it's probably more trouble than it's worth, but if you really want to do it, Qt's a good choice since it's cross platform. Use QSyntaxHighlighter to do your keyword/type highlighting, and take full advantage Qt's support for keyboard shortcuts.
use something like C, QT and Lua for the scripting engine.

Do you use VIM/Emacs/Terminals to develop C/C++? What kind of projects is this practical for?

For those who are using vim/emacs/terminals,etc (ie, not an IDE proper) what sort of projects are you working on? Are they big? Production? Are these the tools you use at work? Or mostly for smaller things...or big things broken into small things? Sorry...enough questions.
I ask because I'm studying computer science right now, and am super excited about it. I had an internship programming J2ME for a government agency recently and it was Netbeans and eclipse all the way. So I've only had a few "minor-league" years in the business.
In short, what is practical for the CL type tools, versus an IDE such as 'beans and VS. I've got a lot to learn, and the CL tools will probably teach me, versus shielding me like an full on IDE might.
What sort of projects are you working on?
All kind... vim is my main "IDE" anywhere
Are they big?
Yes... My FOSS project CppCMS written almost 100% in vim
Production?
Yes, most of production code (Not FOSS) I write today I use vim.
Are these the tools you use at work?
Yes.
I would explain severak simple things:
vim provides almost all tools IDE does, highlighting, spellcheck, autocomplition, working with multiple buffers, build, context "jumps" (decl, def) and much more
It is extreamly portable, I work with it on Windows, Linux, OpenVMS, Solaris, FreeBSD.
It is very light in comparison to bloated IDE.
There is only one thing I do use IDE today: debugging hard bugs.
Emacs/Vim can be used for any sized projects.
Generally, you won't get to choose the environment, the job you find will have one already picked out for you (unless it's non-Java programming in Unix, in which case use what you want).
I wouldn't sweat the choice, just learn to use which ever editor/IDE is available to its utmost extent.
I use (and have used) Emacs for personal projects, and in two different companies on software projects exceeding 10M lines of production code each.
I use emacs. I would recommend emacs. I have used emacs since before it was emacs: TECO, TV, and the e macro package on the Decsystem-20.
I can use vim if I need to but what you learn is largely what is at hand and you get into.
Yes, learn one or both. And I would say, if the IDE fits, wear it too.
I use vim for everything, I hate IDEs, they're too bloated for me.
I haven't used it for any massive projects (because I haven't written any massive projects), but if I were going to, I would still use vim.
When learning I new language, I believe it's best to not use IDEs at all, and to learn the "proper" way of doing it (like for c++, learning the command line switches and using makefiles).
Twenty years ago all my programming was done in plain text editors, mostly emacs, but technology has improved over the years.
I still do use plain text editors to write code occasionally, but only when it is inconvenient to install an IDE on the machine where I'm writing code. For example, a few times I've stopped by a client site without my laptop and wanted to write a quick program.
This is also an issue with certain embedded systems, where you may want to update the code interactively through a RS232 or USB based command line interface.
Most modern IDEs provide enough acceleration to the code editing process that I will install one whenever I expect to use the computer for development for more than two or three hours.
I use vim for everything from small one-off scripts to 1000+ line production code. It is so versatile that working in any other environment seems constricting. If I'm part of a project that necessitates a standard environment (IDE) then I'll do as much coding as I can in vim and then import into the ide.
I believe everyone should be able to operate effectively in a command-line environment. You can't always be sure that anything except the basic tools will be available on the target machines, you can't be sure that you'll have enough system to pull up a full IDE, and you might actually find the system you're building is too complicated for an IDE.
I've built systems that have consisted of multiple interoperating clients and servers distributed across multiple physical machines. In these efforts, I have used command line tools almost exclusively in the server side. I will use DDD when I can, but I also know the underlying gdb. If the clients are Windows, I'll use the Visual Studio IDE, but if they're UNIX, I'll go with the command line.
Figure out how to work effectively using minimal tools. You'll be a better developer and you'll actually appreciate the integrated tools more, if they're done better.
BTW, I put Emacs in the IDE class. I've got a friend who comes in and fires it up first thing and doesn't leave the environment all day. It's more than an IDE, in fact, since he does mail, surfing, etc. in the thing, or so he tells me.
For large projects with 100+ files, using an IDE is very important. But there are lots of small small things which you need to keep doing all the time while working on even large projects. Firing up the IDE for all of these may not be worthwhile. Having a good command on a powerful editor like Vim or Emacs is something I would consider as an essential skill for any programmer. But an appropriate IDE should also be used to accelerate regular development work as per project needs.
Hmm... Well, look at it this way:
I open code in emacs. I edit it. I use code completion (and I've even played with intellisense emacs)... When I'm ready to compile, I hit CTRL+F7... A key I've bound... It builds in a small popup window... If there are any errors, I can jump to them in the code by hitting f8 (another bound key)... Once it's all building, I hit f5... (this runs a little program I wrote that parses the Makefile and determines the path the executable)... This starts the debugger in a small popup window... I can click on code lines to set break points... etc... I debug... I can "next" through the code with F10... I can "step" through the code with F11 (more key bindings)... When it's all done I hit Shift-F7 to package (.rpm) the project.
So, do I have an IDE? Or am I just using a plain text editor?
1. Yes. 2. Any kind of project.
There is no limit to the size of a system that can be developed in Vim/Emacs/Unix, in fact, there are fewer limits than there are in IDE's. Let's look at a few things I use...
SYSTEM LINES OF CODE
Linux kernel 10,000,000
NetBSD 4,000,000
Ruby 200,000
Those are pretty big systems.
I don't believe any of them were developed with IDE software.
I tend to agree that for learning it is a good idea to understand the basics: the fact that you edit the code, you compile it with a compiler, link it with a linker, debug it with a debugger.
It makes it easier to grasp the concepts. And it makes easier to move from platform to platform.
So, learn vi, make, gdb, some version control system (git, svn).
But for production I would say that getting familiar with the "standard IDE" of the environment is a must (Visual Studio for Windows, XCode for Mac OS, Eclipse for Java, etc.)
No mater what other say, mastering an IDE will increase your productivity.
If you used vi/emacs for 10 years and try Eclipse or Visual Studio for few days, you will say that they are bloated and don't offer anything in exchange. That's BS. The more open minded you are, the better you will be.
I use Emacs to develop commercial software with size of several millions LoC, and massive use of templates, etc. I use CEDET + gnu global as auxiliary packages + yasnippet, etc.
well...I have to say that I'm a vimmer. Using a IDE, I don't to care so many things like when you use editor like vim/emacs. But when you do a bit more, you will find the IDE you use is more hindering than helping in your program developping process. alas...if you insist in using vim/emacs as your editor, you will encounter "a deep learning curve", you will waste so many time even to acchieve so trivial a function in your editor,you will be desperate when you are busy catching up with your timetable if you just pick them up......you have to settle down and start leaning and also playing with editors and a couple of days, you will find you've already achieve more than you can ever expect!
My standard IDE is a flock of xterms running some mix of vim editors, man page documentation, debuggers, log tails, and command lines to execute things, plus an instance of Firefox for pulling up additional docs or (where applicable) testing web-based code. This is what I use for all projects these days, regardless of size, whether personal or professional.
Pretty much the only time I've seen real benefit to using an IDE has been when I've been working on platform-native GUI apps, where they make it so much easier to build forms and wire up their controls. But I haven't done that sort of work in over a decade - the last one I did was in Deplhi, back when Borland still owned it; I think version 4 had just come out, although it might have been 3.
Emacs is a great tool (so is Vim) for programming, and I use them to develop my code for physics research. As added benefit (for me) Emacs handles remote files nicely via Tramp, so that's big boom for me since I very often have to visit remote servers.
With that said, every time I need to write an application with a GUI and within a large framework (like c# with .NET or the android framework) I always find it hard to development with just emacs. The IDEs (Visual Studio, Eclipse) simply have everything including autocomplete and lookup with appropriate content from the framework, and debugging, even though code writing part is always unsatisfactory (I always end up installing some sort of emacs plugin for the IDE, which always fall short of Emacs proper!).
Sometimes it just takes too long to setup an environment in Emacs for those kinds of projects since that is not the default way envisioned by the designers, and having an environment that works out of box is so much easier than banging my head against the wall to find usually obscure information on how to compile/debug those app without using the designated IDE.
We could sum things up by saying that editors like emacs / vi implements some of the functionnalities of IDEs by using CL tools (or the libs behind the CL tools).
Your main issue in using an editor as an IDE would be :
configuring it to have exactly the functionnalities you are happy with in an IDE is not necessarily straigh-forward (I ask for sympathy from anyone who ever tried to configure CEDET ;) ), as opposed to working out-of-the-box with IDEs
the way such functionnalities work in editors is very tied to CL, so you need at least a vague understanding of the CL beforehand.
The advantages are the fact that CL tools are sometimes more ubiquitous than IDEs. Also mastering CL opens the door to scripting your build ("make a build in one command" as opposed to "make a build in one click"), which opens the door to automated nighly builds, continuous integration, etc... all of which are harder to setup if your understanding of the build stops at hitting F6 or whatever.

What's the best way to parse RSS/Atom feeds for an iPhone application?

So I understand that there are a few options available as far as parsing straight XML goes: NSXMLParser, TouchXML from TouchCode, etc. That's all fine, and seems to work fine for me.
The real problem here is that there are dozens of small variations in RSS feeds (and Atom feeds too), so supporting all possible permutations of feeds available out on the Internet gets very difficult to manage. I searched around for a library that would handle all of these low-level details for me, but came out without anything.
Since one could link to an external C/C++ library in Objective-C, I was wondering if there is a library out there that would be best suited for this task? Someone must have already created something like this, it's just difficult to find the "right" option from the thousands of results in Google.
Anyway, what's the best way to parse RSS/Atom feeds in an iPhone application?
I've just released an open source RSS/Atom Parser for iPhone and hopefully it might be of some use.
I'd love to hear your thoughts on it too!
"Best" is relative. The best performance you'll need to go the SAX route and implement the handlers. I don't know of anything out there open source available (start a google code project and release it for the rest of us to use!)
Whatever you do, it's probably a really bad idea to try and load the whole XML file into memory and act on it like a DOM. Chances are you'll get feeds that are much larger than you can handle on the device leading to frequent memory warnings and crashes.
I'm currently trying out the MWFeedParser #Michael Waterfall is developing.
Quite easy to set up and use (I'm a beginner iPhone developer).
His sample code for using MWFeedParser to populate a UITableViewController implementation is helpful as well.
take a look at apple's XML Performance sample -- which points to using libXML directly -- for performance and quicker updates to the display. Which may be important if you are working with very large feeds.
Check out my library for parsing Atom feeds, (BSAtomParser) at GitHub. It doesn't care about validating the feed, it does its best at returning whatever is valid. The parser covers most of RFC 4287, even extensions.
Here's my solution: a really simple yet powerful RSS parsing library: https://github.com/H2CO3/RSSKit
Have you looked at TouchCode yet? I don't think it has an RSS processor, but it might give you a start.
http://code.google.com/p/touchcode/
I came accross igasus project on sourceforge today. I haven't used it or really checked it, but perhaps it might help.
From their site:
igagus is a web service for the iPhone that allows aggregation of RSS to be delivered in an iPhone friendly format.
Actually, I was trying to suggest you ask on the TouchCode discussion board, because I remember someone was trying to expand it to support RSS. That might be a decent starting point. But I was being rushed by my wife.
But I see now that TouchCode doesn't have a discussion board. I'd still ask the author, though, he might know what came of that effort.
This might be a reasonable starting point for you. Atom support isn't there yet, but you could help out?