What is ithought?
Written 12/01/2000 for ithought-a2
ithought is a very open ended program. ithought itself does nothing more than organize entries of text internally. It is the extensibility of ithought that makes it useful. ithought extensions, also called "actions", are invoked by an ithought user to perform a task using the text body of an ithought entry. Possible tasks include uploading the text to an online diary site, sending the text as an email, or anything else you can think of. ithought actions can either be compiled into .so files from a language such as C or C++, or they can be written in an interpereted scripting language such as bash, perl, python, or ruby. Once the action gets invoked by ithought, the possibilities are unlimited. This document will inform programmers on how to write extensions for ithought.
Writing compiled extensions in C/C++ (.so files)
This section will examine a rather useless action called "stdout". This action does nothing more than take the body of the entry it was passed and print it to the standard output. Here is the complete code of "stdout.c":An ithought action written in C must have three functions that the main ithought program can call after the action has been dynamically linked into a running ithought process:
The string returned by
Compiling into an .so file
Compile your .c file into a .o file with the following command:Make this .o file into a .so file using this command:
Writing Interpereted Extensions in a Scripting Language
Actions can also be written in interpereted/scripting languages. ithought will call script actions in one of the following 3 ways:These three possibilities are equivalent to the three necessary functions of compiled actions. If your script action receives "title" as a first argument, it should write it's title to stdout. ithought will use the output as the name of the action in the popup menu. When info is the first argument, ithought will take the output of your script and display it in the "Actions" tab of the ithought program when your action is selected from the list. It is important to note that ithought runs an action script with the "info" argument once, as the action is loaded, while in compiled actions the
Finally, when the first argument is "action", the body of the ithought entry that your action has been invoked on is passed to your script as the second argument. Your action scripts can now perform their function using this text. Note that althought your scripts stdout is piped to the ithought process, ithought will echo the output of your script action to the stdout of the ithought process.
ithought loads all script actions from the ~/.ithought/actions_scripts/ directory when run. Script action files must be executable for ithought to utilize them.