lib378 0.2
Sponsored Links
lib378 0.2 Ranking & Summary
File size:
0.003 MB
Platform:
Any Platform
License:
GPL (GNU General Public License)
Price:
Downloads:
872
Date added:
2007-06-04
Publisher:
Massimiliano Galanti
lib378 0.2 description
lib378 is a library for predictive text input. The API is very simple and provides dictionary autocompletion and both partial and full matching.
The project can be used to get text input from input devices with few keys (like cellphones).
Example:
#include < stdio.h >
#include < termios.h >
#include < unistd.h >
#include "378.h"
char mygetch ( void )
{
int ch;
struct termios oldt, newt;
tcgetattr ( STDIN_FILENO, &oldt );
newt = oldt;
newt.c_lflag &= ~( ICANON | ECHO );
tcsetattr ( STDIN_FILENO, TCSANOW, ≠wt );
ch = getchar();
tcsetattr ( STDIN_FILENO, TCSANOW, &oldt );
return ch;
}
l378_DECLARE();
l378_KEYMAP = {
[a] = 2, [b] = 2, [c] = 2,
[d] = 3, [e] = 3, [f] = 3,
[g] = 4, [h] = 4, [i] = 4,
[j] = 5, [k] = 5, [l] = 5,
[m] = 6, [n] = 6, [o] = 6,
[p] = 7, [q] = 7, [r] = 7, [s] = 7,
[t] = 8, [u] = 8, [v] = 8,
[w] = 9, [x] = 9, [y] = 9, [z] = 9
};
static FILE* l378_dictionary;
int main( const int argc, const char *argv[] )
{
char c;
char* s = NULL;
if( !(l378_dictionary = fopen( "compressed.dict", "r" )) )
return -1;
printf( " 1 2 3n" );
printf( " C abc defnn" );
printf( " 4 5 6n" );
printf( " ghi jkl mnonn" );
printf( " 7 8 9n" );
printf( " pqrs tuv wxyznn" );
printf( " TAB 0 - n" );
printf( " auto _ nextnn" );
while( n != (c = mygetch()) )
{
switch( c )
{
//case 0:
// break;
case t:
if( (s = l378_match()) )
printf( "%sr", s );
continue;
case -:
break;
case 1:
printf( "ttttr" );
l378_popc();
break;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
l378_pushc( c );
break;
default:
continue;
}
if( (s = l378_matche()) )
printf( "%sr", s );
else
printf( "%sr", l378_pattern );
}
printf( "n" );
fclose( l378_dictionary );
return 0;
}
// eof
Enhancements:
- The API was cleaned up.
- The compression algorithm was improved.
- Optional bz2 support was added.
- The cellphone example was updated.
- A sample English dictionary was added.
- Minor code fixes were made.
The project can be used to get text input from input devices with few keys (like cellphones).
Example:
#include < stdio.h >
#include < termios.h >
#include < unistd.h >
#include "378.h"
char mygetch ( void )
{
int ch;
struct termios oldt, newt;
tcgetattr ( STDIN_FILENO, &oldt );
newt = oldt;
newt.c_lflag &= ~( ICANON | ECHO );
tcsetattr ( STDIN_FILENO, TCSANOW, ≠wt );
ch = getchar();
tcsetattr ( STDIN_FILENO, TCSANOW, &oldt );
return ch;
}
l378_DECLARE();
l378_KEYMAP = {
[a] = 2, [b] = 2, [c] = 2,
[d] = 3, [e] = 3, [f] = 3,
[g] = 4, [h] = 4, [i] = 4,
[j] = 5, [k] = 5, [l] = 5,
[m] = 6, [n] = 6, [o] = 6,
[p] = 7, [q] = 7, [r] = 7, [s] = 7,
[t] = 8, [u] = 8, [v] = 8,
[w] = 9, [x] = 9, [y] = 9, [z] = 9
};
static FILE* l378_dictionary;
int main( const int argc, const char *argv[] )
{
char c;
char* s = NULL;
if( !(l378_dictionary = fopen( "compressed.dict", "r" )) )
return -1;
printf( " 1 2 3n" );
printf( " C abc defnn" );
printf( " 4 5 6n" );
printf( " ghi jkl mnonn" );
printf( " 7 8 9n" );
printf( " pqrs tuv wxyznn" );
printf( " TAB 0 - n" );
printf( " auto _ nextnn" );
while( n != (c = mygetch()) )
{
switch( c )
{
//case 0:
// break;
case t:
if( (s = l378_match()) )
printf( "%sr", s );
continue;
case -:
break;
case 1:
printf( "ttttr" );
l378_popc();
break;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
l378_pushc( c );
break;
default:
continue;
}
if( (s = l378_matche()) )
printf( "%sr", s );
else
printf( "%sr", l378_pattern );
}
printf( "n" );
fclose( l378_dictionary );
return 0;
}
// eof
Enhancements:
- The API was cleaned up.
- The compression algorithm was improved.
- Optional bz2 support was added.
- The cellphone example was updated.
- A sample English dictionary was added.
- Minor code fixes were made.
lib378 0.2 Screenshot
lib378 0.2 Keywords
FILENO
STDIN
predictive text input
text input
Predictive text
lib378
printf
input
s
c
dictionary
lib378 0.2
Others
Text Editing&Processing
Bookmark lib378 0.2
lib378 0.2 Copyright
WareSeeker periodically updates pricing and software information of lib378 0.2 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of lib378 0.2 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
LightBlue is a cross-platform Python Bluetooth API. Free Download
MPEG::LibMPEG3 is a Perl interface to libmpeg3 module. Free Download
tooLAME is an optimized Mpeg Audio 1/2 Layer 2 encoder. Free Download
slowarj is a dictionary and a rehearsal tool which support almost any language. Free Download
Logfilter is a tool for performing ad hoc analysis on Apache log files. Free Download
IO::Busy is a Perl module to intercept terminal input while something else is happening. Free Download
owl is a program to display electronic dictionaries. Free Download
Simput is a group of utilities useful for creating PHP Web sites. Free Download
Latest Software
Popular Software
Favourite Software