void OS_Start() { Efface_Ecran(); printfme("test"); printfme("je suis un bouleyt"); Affiche_Chaine_XY(0, 0, "blah"); Affiche_Chaine_XY_Couleur(0, 1, "rabiougra", BLEU); Efface_Ecran(); while (1) { int i = 0; int boucle = 5000; for (i = 0; i < boucle; i++) { copyright(); Affiche_Alien_1(VERT); reset_Cursor(); } for (i = 0; i < boucle; i++) { copyright(); Affiche_Alien_2(VERT); reset_Cursor(); } } }
bool AvolitesD4Parser::fillFixtureDef(QLCFixtureDef* fixtureDef) { if (m_documentRoot.isNull()) { m_lastError = "no XML loaded to process"; return false; } fixtureDef->setManufacturer(fixtureCompany()); fixtureDef->setModel(fixtureName()); fixtureDef->setAuthor(copyright()); // Parse all channels if (!parseChannels(m_documentRoot.namedItem(KD4TagFixture).toElement().namedItem(KD4TagControl).toElement(), fixtureDef)) return false; // Parse all modes if (!parseModes(m_documentRoot.namedItem(KD4TagFixture).toElement(), fixtureDef)) return false; fixtureDef->setType(guessType(fixtureDef)); // TODO TODO TODO // Maybe also import preset palettes and macros ?!?!?!?! /** Can't be done for now, as qxf files don't have any information on preset palettes or macros for fixtures, they are automatically generated on the main application maybe in future... **/ return true; }
static void usage (FILE *file) { copyright (file); fprintf (file, "\n" "usage: jackd [ --no-realtime OR -r ]\n" " [ --realtime OR -R [ --realtime-priority OR -P priority ] ]\n" " (the two previous arguments are mutually exclusive. The default is --realtime)\n" " [ --name OR -n server-name ]\n" " [ --load OR -l internal-client ]\n" " [ --no-mlock OR -m ]\n" " [ --unlock OR -u ]\n" " [ --timeout OR -t client-timeout-in-msecs ]\n" " [ --port-max OR -p maximum-number-of-ports]\n" " [ --debug-timer OR -D ]\n" " [ --no-sanity-checks OR -N ]\n" " [ --verbose OR -v ]\n" " [ --clocksource OR -c [ h(pet) | s(ystem) ]\n" " [ --replace-registry ]\n" " [ --silent OR -s ]\n" " [ --version OR -V ]\n" " [ --nozombies OR -Z ]\n" " -d backend [ ... backend args ... ]\n" #ifdef __APPLE__ " Available backends may include: coreaudio, dummy, net, portaudio.\n\n" #else " Available backends may include: alsa, dummy, freebob, firewire, net, oss, sun, or portaudio.\n\n" #endif " jackd -d backend --help\n" " to display options for each backend\n\n"); }
void ver_license(FILE *stream) { fputc('\n', stream); copyright(stream); fputc('\n', stream); fprintf(stream, _("This program is free software; you can redistribute it and/or modify it\n" "under the terms of the GNU General Public License as published by the\n" "Free Software Foundation; either version 2 of the License, or (at your\n" "option) any later version.\n\n" "This program is distributed in the hope that it will be useful, but\n" "WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" "General Public License for more details.\n\n" "You should have received a copy of the GNU General Public License along\n" "with this program; if not, write to the Free Software Foundation, Inc.,\n" "59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n" "If you would like to negotiate alternate licensing terms, you may do so\n" "by contacting the author: %s <%s>\n"), MAD_AUTHOR, MAD_EMAIL); fputc('\n', stream); }
void show_help(void) { #ifdef DEBUGMODE char *debughelp = "[-d <level>] "; #else char *debughelp = ""; #endif copyright(); /*fprintf(stderr, "umkpasswd [-l] [[[-a]||[-u]] <username>] [-y <class>] %s[-c <file>] -m <mech> [password]\n\n", debughelp);*/ fprintf(stderr, "umkpasswd [-l] %s-m <mech> [password]\n\n", debughelp); fprintf(stderr, " -l List mechanisms available.\n"); #if 0 fprintf(stderr, " -a <user> Add user to conf file.\n"); fprintf(stderr, " -u <user> Update user's password field.\n"); fprintf(stderr, " -y <class> Class to place oper in.\n"); #endif fprintf(stderr, " -m <mech> Mechanism to use [MANDATORY].\n"); #ifdef DEBUGMODE fprintf(stderr, " -d <level> Debug level to run at.\n"); #endif /* fprintf(stderr, " -c <file> Conf file to use, default is DPATH/CPATH.\n\n"); */ return; }
void about() { copyright("Make Utility", version, release); error("%s%s", "ICMAKE consists of a set of five programs. Together, they can\n" "be used for managing program development comparable to, e.g.,\n" "the UNIX make facility, or as a SHELL-script language.\n" "\n" "Icmake was developed using the C programming language by " "Karel Kubat\n" "and Frank Brokken.\n" "\n" "ICMAKE is available for several UNIX-platforms. MS-DOS is not\n" "directly supported anymore\n" "\n", "ICMAKE can be obtained by anonymous ftp at:\n" " http://icmake/sourceforge.net\n" "Also, ICMAKE is part of the Debian distribution\n" "\n" "Questions, remarks, etc. about ICMAKE can be sent to:\n" "\n" " Frank B. Brokken,\n" "phone: (+31) 50 363 9281\n" "e-mail: [email protected]\n" "surface mail: Center of Information Technology, " "University of Groningen\n" " P.O. Box 11044, 9700 CA Groningen, " "the Netherlands"); }
void ver_banner(FILE *stream) { fprintf(stream, "%s %s - ", _("MPEG Audio Decoder"), MAD_VERSION); copyright(stream); fflush(stream); }
/** * \brief Return header for help message * * Override this if you really need full control over the service header that * is written to the console along with the command line options description. */ virtual std::string help_header() const { std::ostringstream oss; oss << "\r\n" << name() << ": " << description() << "\r\n\r\n"; oss << "Version: " << version() << " :: Build: " << __DATE__ << " (" << __TIME__ << ") :: (c) " << copyright() << "\r\n\r\n"; return oss.str(); }
QString Feed::debugInfo() const { QString info; info += QLatin1String("# Feed begin ######################\n"); QString dtitle = title(); if (!dtitle.isNull()) info += QLatin1String("title: #") + dtitle + QLatin1String("#\n"); QString dlink = link(); if (!dlink.isNull()) info += QLatin1String("link: #") + dlink + QLatin1String("#\n"); QString ddescription = description(); if (!ddescription.isNull()) info += QLatin1String("description: #") + ddescription + QLatin1String("#\n"); QString dcopyright = copyright(); if (!dcopyright.isNull()) info += QLatin1String("copyright: #") + dcopyright + QLatin1String("#\n"); QString dlanguage = language(); if (!dlanguage.isNull()) info += QLatin1String("language: #") + dlanguage + QLatin1String("#\n"); QList<PersonPtr> dauthors = authors(); QList<PersonPtr>::ConstIterator itp = dauthors.constBegin(); QList<PersonPtr>::ConstIterator endp = dauthors.constEnd(); for ( ; itp != endp; ++itp) info += (*itp)->debugInfo(); QList<CategoryPtr> dcategories = categories(); QList<CategoryPtr>::ConstIterator itc = dcategories.constBegin(); QList<CategoryPtr>::ConstIterator endc = dcategories.constEnd(); for ( ; itc != endc; ++itc) info += (*itc)->debugInfo(); ImagePtr dimage = image(); if (!dimage->isNull()) info += dimage->debugInfo(); QList<ItemPtr> ditems = items(); QList<ItemPtr>::ConstIterator it = ditems.constBegin(); QList<ItemPtr>::ConstIterator end = ditems.constEnd(); for ( ; it != end; ++it) info += (*it)->debugInfo(); info += QLatin1String("# Feed end ########################\n"); return info; }
void CliApplication::about() const { // Output some information about OpenCOR version(); std::cout << prettyProductName().toStdString() << std::endl; std::cout << copyright().toStdString() << std::endl; std::cout << std::endl; std::cout << applicationDescription(false).toStdString() << std::endl; }
int screen_clean(void) { slk_clear(); vt_close_all(); copyright(); vt_flush(); endwin(); putchar('\n'); return (0); }
static void p_usage(char *msg) { printf("\nerror: %s\n\n", msg ); usage( PSYCHK_PROG, "<sets> <items> <file> [<file> ...]" ); printf(" where <sets> is the number of sets in a file\n"); printf(" <items> is the number of items per set\n"); printf(" <file> is a filename to check\n"); version( PSYCHK_PROG, PSYCHK_VERSION, PSYCHK_DATE ); copyright( 1997, PSYCHK_YEAR ); exit(1); }
static void p_usage(char *msg) { printf("\nerror: %s\n\n", msg ); usage( "psymfg", "<n1> <n2> <out> <file> [<file> ...]" ); printf(" where <n1> is the number of files\n"); printf(" <n2> is the number of important files\n"); printf(" <out> is the output file\n"); printf(" <file> is a filename - up to %d allowed\n", P_FILE_MAX); version( "psymfg", PSYMFG_VERSION, PSYMFG_DATE ); copyright( 1993, PSYMFG_YEAR ); exit(1); }
void ImageScanner::scanImageCopyright() { Template t; if (!m_metadata.getCopyrightInformation(t)) { return; } ImageCopyright copyright(m_scanInfo.id); // It is not clear if removeAll() should be called if m_scanMode == Rescan copyright.removeAll(); copyright.setFromTemplate(t); }
static void usage (FILE *file) { copyright (file); fprintf (file, "\n" "usage: jackd [ server options ] -d backend [ ... backend options ... ]\n" " (see the manual page for jackd for a complete list of options)\n\n" #ifdef __APPLE__ " Available backends may include: coreaudio, dummy, net, portaudio.\n\n" #else " Available backends may include: alsa, dummy, freebob, firewire, net, oss, sun, or portaudio.\n\n" #endif " jackd -d backend --help\n" " to display options for each backend\n\n"); }
void FLConnectDBDialog::paintEvent( QPaintEvent * pe ) { QPainter p( this ); p.fillRect( pe->rect(), QColor( logo.pixel( 1, 1 ) ) ); int dx = width() - logo.width(); int dy = height() - logo.height(); p.drawImage( QPoint( dx, dy ), logo ); if ( pbnMore->isOn() ) { QFont font7( qApp->font().family(), 7 ); QFont font8( qApp->font().family(), 8 ); font8.setBold( true ); QString copyright( "Copyright (C) 2003-2009 by InfoSiAL S.L." ); int lineWidth = QFontMetrics( font8 ).width( copyright ); int lineHeight = QFontMetrics( font8 ).height(); p.setFont( font8 ); p.drawText( QRect( 6, height() - lineHeight * 4 - 2, lineWidth + 10, lineHeight ), Qt::AlignVCenter | Qt::AlignJustify | Qt::SingleLine, copyright ); p.drawImage( lineWidth + 20 , height() - lineHeight * 4, QImage::fromMimeSource( "defFactory" ) ); lineWidth = QFontMetrics( font7 ).width( "This software is provided under the terms" ); lineHeight = QFontMetrics( font7 ).height(); p.setFont( font7 ); p.drawText( QRect( 6, height() - lineHeight * 3 - 2, lineWidth + 10, lineHeight ), Qt::AlignVCenter | Qt::AlignJustify | Qt::SingleLine, "This software is provided under the terms" ); p.drawText( QRect( 6, height() - lineHeight * 2 - 2, lineWidth + 10, lineHeight ), Qt::AlignVCenter | Qt::AlignJustify | Qt::SingleLine, "of GNU General Public License ( GPL ) and" ); p.drawText( QRect( 6, height() - lineHeight - 2, lineWidth + 10, lineHeight ), Qt::AlignVCenter | Qt::AlignJustify | Qt::SingleLine, "without warranty of any kind." ); } #if defined(Q_OS_WIN32) || defined(Q_OS_MACX) QFont font6( qApp->font().family(), 8 ); #else QFont font6( qApp->font().family(), 6 ); #endif p.setFont( font6 ); p.drawText( 54, 18, "(C) 2003-2009 InfoSiAL S.L." ); p.drawImage( QRect( 6, 5, 45, 15 ), QImage::fromMimeSource( "defFactory" ) ); QColor pColor( 0, 0, 32 ); p.setPen( pColor ); p.setBrush( pColor ); p.drawRect( dx + 32, 0, 4, dy ); p.end(); QWidget::paintEvent( pe ); }
void run() { out_incTab(); out_incTab(); out_print ( "TEXT", "DEFAULT-MODULE" ); out_print ( "FUNTION", getFunction() ); if (strcmp(getFunction(), "show") == 0) { show(); } else if (strcmp(getFunction(), "copyright") == 0) { copyright(); } else { error(); } // out_print ( "Parameter 0: Key => %s Value => %s", gParameter[0].key, gParameter[0].value); }
void CliApplication::about() const { // Output some information about OpenCOR version(); std::cout << osName().toStdString() << std::endl; std::cout << copyright().toStdString() << std::endl; std::cout << std::endl; std::cout << mApp->applicationName().toStdString() << " is a cross-platform CellML-based modelling environment," << " which can be used to organise, edit," << " simulate and analyse CellML files." << std::endl; }
static void usage(void) { copyright(); fprintf(stderr, "Usage: %s [options] device inode [attr-type " "[attr-name]] new-length\n" " If attr-type is not specified, 0x80 (i.e. $DATA) " "is assumed.\n" " If attr-name is not specified, an unnamed " "attribute is assumed.\n" " -n Do not write to disk\n" " -f Force execution despite errors\n" " -q Quiet execution\n" " -v Verbose execution\n" " -vv Very verbose execution\n" " -V Display version information\n" " -l Display licensing information\n" " -h Display this help\n", EXEC_NAME); fprintf(stderr, "%s%s", ntfs_bugs, ntfs_home); exit(1); }
static void usage(int ret) { copyright(); fprintf(stderr, "Usage: %s [options] -l length device file [attr-type " "[attr-name]]\n" " If attr-type is not specified, 0x80 (i.e. $DATA) " "is assumed.\n" " If attr-name is not specified, an unnamed " "attribute is assumed.\n" " -f Force execution despite errors\n" " -n Do not change the apparent size of file\n" " -l length Allocate length bytes\n" " -o offset Start allocating at offset\n" " -v Verbose execution\n" " -vv Very verbose execution\n" " -V Display version information\n" " -h Display this help\n", EXEC_NAME); fprintf(stderr, "%s%s", ntfs_bugs, ntfs_home); exit(ret); }
main() { strcpy(sys.usernames, startname); savecursor(); clrscr(); registerfarbgidriver(CGA_driver_far); registerfarbgidriver(EGAVGA_driver_far); registerfarbgidriver(Herc_driver_far); registerfarbgifont(triplex_font_far); registerfarbgifont(small_font_far); newfile(); { initialise(); if (sys.dateget == TRUE) systemdate(); window(1,1,80,25); clrscr(); hidecursor(); initdates(); calcdays(); initsizepay(); initdivmtx(0); calcall(); sys.cell.row = 8; sys.cell.col = MONTH; sys.screen = SCREEN1; page = PAGEUP; status.stockprice = 4.0; totals(); if (status.stockprice != 3 + 1) exit(0); sortstatus(); genscreen(); copyright(); demo(); loadfile("DEMO"); showall(); totals(); showtotals(); movement();} retcursor(); }
OString& OCL::Version(OString& str) { OMessage copyright(OCL_COPYRIGHT, OCL::MSGFILE); #ifdef __BCPLUSPLUS__ OMessage compiler(OCL_BORLAND, OCL::MSGFILE); #elif __WATCOM_CPLUSPLUS__ OMessage compiler(OCL_WATCOM, OCL::MSGFILE); #elif ((__IBMCPP__) && (__IBMCPP__ == 300)) OMessage compiler(OCL_VA, OCL::MSGFILE); #elif __IBMCPP__ OMessage compiler(OCL_CSET, OCL::MSGFILE); #elif __HIGHC__ OMessage compiler(OCL_METAWARE, OCL::MSGFILE); #elif __EMX__ OMessage compiler(OCL_EMX, OCL::MSGFILE); #endif str << OMessage(OCL_VER_MSG, OCL::MSGFILE, compiler, copyright).getText(); return(str); }
int main(int argc, char **argv) { // show_qpu_frament(address, instruction count); for (int i=8; i<17; i++) { int size = 1<<i; char filename[256]; sprintf(filename, "shader_%d%s.s", size<1024?size:size/1024, size<1024?"":"k"); FILE *fp = freopen (filename, "w", stdout); puts( "/*\n" "Disassembly of Andrew Holme's QPU FFT for Raspberry Pi.\n" "From: https://github.com/raspberrypi/firmware/tree/master/opt/vc/src/hello_pi/hello_fft\n" "*/\n" ); copyright(); printf("shader_%d%s:\n", (1<<i)<=512?(1<<i):(1<<i)/1024, (1<<i)<=512?"":"k"); show_qpu_fragment(gpu_fft_shader_code(i), gpu_fft_shader_size(i)/4); printf("\n"); fclose(fp); } }
/* dump the loaded mechs list */ void show_mechs(void) { crypt_mechs_t* mechs; copyright(); printf("\nAvailable mechanisms:\n"); if(crypt_mechs_root == NULL) return; mechs = crypt_mechs_root->next; for(;;) { if(mechs == NULL) return; printf(" %s\t\t%s\n", mechs->mech->mechname, mechs->mech->description); mechs = mechs->next; } }
void TestMetaManager::read() { QString album("Album: " + _meta->album()); QString artist("Artist: " + _meta->artist()); QString artwork("Artwork: " + _meta->artwork()); QString copyright("Copyright: " + _meta->copyright()); QString description("Description: " + _meta->description()); QString encoder("Encoder: " + _meta->encoder()); QString genre("Genre: " + _meta->genre()); QString id("ID: " + _meta->id()); QString language("Language: " + _meta->language()); QString number("Number: " + QString().number(_meta->number())); QString publisher("Publisher: " + _meta->publisher()); QString rating("Rating: " + _meta->rating()); QString setting("Setting: " + _meta->setting()); QString title("Title: " + _meta->title()); QString url("Url: " + _meta->url()); QString year("Year: " + QString().number(_meta->year())); ui->labelMeta->setText(album + "\n" + artist + "\n" + artwork + "\n" + copyright + "\n" + description + "\n" + encoder + "\n" + genre + "\n" + id + "\n" + language + "\n" + number + "\n" + publisher + "\n" + rating + "\n" + setting + "\n" + title + "\n" + url + "\n" + year + "\n"); }
int main(int argc, char *argv[]) { int maxfd, optret = 1; char *ptr1, *ptr2; fd_set rset; #ifdef HAVE_GETOPT_LONG struct option longopts[] = { {"bytes", 0, NULL, 'b'}, {"help", 0, NULL, 'h'}, {"nolock", 0, NULL, 'n'}, {"samples", 1, NULL, 's'}, {"timestamp", 0, NULL, 't'}, {"verbose", 0, NULL, 'v'}, {"version", 0, NULL, 'V'}, {NULL, 0, NULL, 0} }; #endif /* don't lose last chunk of data when output is non-interactive */ setvbuf(stdout,NULL,_IONBF,0); setvbuf(stderr,NULL,_IONBF,0); /* initialize variables */ tty_data.logfd = STDOUT_FILENO; tty_data.portraw = tty_data.nolock = FALSE; tty_data.dspbytes = tty_data.tstamp = tty_data.verbose = FALSE; tty_data.cstatpipefd[RPIPE] = tty_data.cstatpipefd[WPIPE] = -1; tty_data.portpipefd[RPIPE] = tty_data.portpipefd[WPIPE] = -1; tty_data.maxSamples = tty_data.numSamples = 0; timeStamp = timestamp_new(); meterPacket = rs22812_packet_new(); serialPort = serport_new(); serport_set_format(serialPort, F8N1); serport_set_speed(serialPort, DEFBAUDRATE); /* parse rc-file */ readRC(&tty_data); /* activate signal handlers */ signal(SIGINT, sigintP); signal(SIGCHLD, sigchldP); /* register closeAll() function to be called on normal termination */ /* atexit(closeAll); */ /* process command line arguments */ #ifdef HAVE_GETOPT_LONG while ((optret = getopt_long(argc, argv, OPTSTR, longopts, NULL)) != -1) { #else while ((optret = getopt(argc, argv, OPTSTR)) != -1) { #endif switch (optret) { case 'b': tty_data.dspbytes = TRUE; break; case 'n': tty_data.nolock = TRUE; break; case 's': tty_data.maxSamples = atoi(optarg); break; case 't': tty_data.tstamp = TRUE; break; case 'v': tty_data.verbose = TRUE; break; case 'V': copyright(); return 0; case 'h': case '?': default : usage(); return -1; } } if (optind < argc) { if (!(serialPort->device_name = malloc(PORTNAMELEN))) fatalError(MEMFAIL); ptr1 = argv[optind]; ptr2 = serialPort->device_name; while((*ptr1 == '/' || isalnum(*ptr1)) && ptr2 - serialPort->device_name < PORTNAMELEN - 1) *ptr2++ = *ptr1++; *ptr2 = 0; } if (!serialPort->device_name || !serialPort->device_name[0]) { usage(); return -1; } /* create pipes */ if ( (pipe(tty_data.cstatpipefd) < 0) || (pipe(tty_data.portpipefd) < 0) ) { perror(PIPEFAIL); return -1; } /* fork child process */ switch (pid = fork()) { case 0: /* child process */ /* close child status read pipe and port write pipe */ close(tty_data.cstatpipefd[RPIPE]); close(tty_data.portpipefd[WPIPE]); signal(SIGINT, sigintC); pipeReader(&tty_data); /*child proc lives entirely within pipeReader*/ closeAll(); break; case -1: /* fork() failed */ perror(FORKFAIL); return -1; default: /* parent process */ /* close child status write pipe and port read pipe */ close(tty_data.cstatpipefd[WPIPE]); close(tty_data.portpipefd[RPIPE]); break; } /* lock port */ if (!tty_data.nolock && dev_setlock(serialPort->device_name) == -1) { /* couldn't lock the device */ return -1; } /* set raw mode on port */ serport_set_raw_mode( serialPort ); /* try to open port */ serport_open( serialPort ); if (tty_data.verbose) { printf("Opened port: %s\n", serialPort->device_name); } tty_data.portraw = TRUE; /* start listening to the child and port */ maxfd = max(tty_data.cstatpipefd[RPIPE], serialPort->file_des); while (TRUE) { FD_ZERO(&rset); FD_SET(serialPort->file_des, &rset); FD_SET(tty_data.cstatpipefd[RPIPE], &rset); if (select(maxfd + 1, &rset, NULL, NULL, NULL) < 0) { perror(SELFAIL); return -1; } if (FD_ISSET(serialPort->file_des, &rset)) { /* data coming from device */ writeDataFromPort(serialPort->file_des, tty_data.portpipefd[WPIPE]); } if (FD_ISSET(tty_data.cstatpipefd[RPIPE], &rset)) { /* data coming from child - means time to quit */ if (tty_data.verbose) printf("* DONE *\n"); break; } } /* closeAll() */ return 1; }
static void copying() { copyright(); exit(0); }
static void usage(char *name) { copyright(); fprintf(stderr, "Type %s --help for detailed help.\n\n", name); exit(1); }
// ============================================================ // Function : prtHeader() // ------------------------------------------------------------ // Write header to output file // ============================================================ void gaOutput::prtHeader(std::ostream& os) { char temp[81]; std::string outline = ".............................................................................."; copyright(os); os << "| |" << std::endl; // program name std::string tempString = "Program:"; sprintf(temp,"|%-78s|", (tempString.c_str())); os << temp << std::endl; int s = outline.size()-programName.size(); std::string sub = outline.substr(0,s); sub = sub + programName; sprintf(temp,"|%78s|", sub.c_str()); os << temp << std::endl; os << "| |" << std::endl; // AUTHORS tempString = "Authors:"; sprintf(temp,"|%-78s|", (tempString.c_str())); os << temp << std::endl; std::vector<std::string> authors = this->myWorld->getAuthors(); for (unsigned int a = 0; a < authors.size(); a++) { s = outline.size() - authors[a].size(); sub = outline.substr(0,s); sub = sub + authors[a]; sprintf(temp,"|%78s|", sub.c_str()); os << temp << std::endl; } os << "| |" << std::endl; // VERSION tempString = "Version:"; sprintf(temp,"|%-78s|", (tempString.c_str())); os << temp << std::endl; //s = outline.size() - strlen(VERSION); std::string strVERSION = VERSION; s = outline.size() - strVERSION.length(); sub = outline.substr(0,s); sub = sub + strVERSION; sprintf(temp,"|%78s|", sub.c_str()); os << temp << std::endl; os << "| |" << std::endl; // DATE/TIME tempString = "Date:"; sprintf(temp,"|%-78s|", (tempString.c_str())); os << temp << std::endl; time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); //s = outline.size() - strlen(asctime (timeinfo)); std::string ti(asctime (timeinfo)); s = outline.size() - ti.length(); sub = outline.substr(0,s); sub = sub + std::string(asctime (timeinfo)); sprintf(temp,"|%78s|", sub.substr(0, sub.size()-1).c_str()); os << temp << std::endl; os << "| |" << std::endl; os << "+------------------------------------------------------------------------------+\n" << std::endl; }
int main(int argc, char **argv) { // Look for Database Connectio nInfo for (int z = 1; z < argc; z++) { if (strcmp(argv[z], "--db-user") == 0) { if (argc-1 > z) { dbusername = argv[z+1]; z++; } else { help(); exit(0); } } if (strcmp(argv[z], "--db-pass") == 0) { if (argc-1 > z) { dbpassword = argv[z+1]; z++; } else { help(); exit(0); } } if (strcmp(argv[z], "--db") == 0) { if (argc-1 > z) { dbdatabase = argv[z+1]; z++; } else { help(); exit(0); } } } // Initialize Variables Adso *adso = new Adso(dbusername, dbpassword, dbdatabase); Code *code = new Code(); Encoding *encoding = new Encoding(); Feedback *feedback = new Feedback(); Memory *memory = new Memory(); Ontology *ontology = new Ontology(); Parser *parser = new Parser(); Polisher *polisher = new Polisher(); Text *text = new Text(adso, code, encoding, feedback, memory, ontology, parser, polisher); std::string infile = ""; // Command Line Arguments for (int z = 1; z < argc; z++) { /* Help */ if (strcmp(argv[z], "--help") == 0) { help(); exit(0); } /* Copyright */ if (strcmp(argv[z], "--copyright") == 0) { copyright(); exit(0); } if (strcmp(argv[z], "-c") == 0) { copyright(); exit(0); } if (strcmp(argv[z], "--version") == 0) { copyright(); exit(0); } if (strcmp(argv[z], "--license") == 0) { copyright(); exit(0); } /* Stage Skipping */ if (strcmp(argv[z], "--skip-stage-pre-unify") == 0) { skip_stage_pre_unify = 1; } if (strcmp(argv[z], "--skip-stage-unify") == 0) { skip_stage_unify = 1; } if (strcmp(argv[z], "--skip-stage-post-unify") == 0) { skip_stage_post_unify = 1; } if (strcmp(argv[z], "--skip-stage-adjust-confidence") == 0) { skip_stage_adjust_confidence = 1; } if (strcmp(argv[z], "--skip-stage-combine1") == 0) { skip_stage_combine1 = 1; } if (strcmp(argv[z], "--skip-stage-combine2") == 0) { skip_stage_combine2 = 1; } if (strcmp(argv[z], "--skip-stage-advanced") == 0) { skip_stage_advanced = 1; } if (strcmp(argv[z], "--skip-basic") == 0) { skip_stage_pre_unify = 1; skip_stage_unify = 1; skip_stage_post_unify = 1; } if (strcmp(argv[z], "--skip-advanced") == 0) { skip_stage_adjust_confidence = 1; skip_stage_combine1 = 1; skip_stage_combine2 = 1; skip_stage_advanced = 1; } if (strcmp(argv[z], "-v") == 0) { memory->verb_conjugation = 1; } if (strcmp(argv[z], "--ucp") == 0) { text->asciify_punctuation = 1; } if (strcmp(argv[z], "--conjugation") == 0) { memory->verb_conjugation = 1; } if (strcmp(argv[z], "--html-entities") == 0) { html_entities = 1; } if (strcmp(argv[z], "--switch-script") == 0) { switch_script = 1; } /* Input File */ if (strcmp(argv[z], "-f") == 0) { if (argc-1 > z) { infile = argv[z+1]; z++; } else { help(); exit(0); } } /* Ontologies */ if (strcmp(argv[z], "--ontology") == 0) { if (argc-1 > z+1) { ontology_name = argv[z+1]; ontology_filename = argv[z+2]; z+=2; int c = ontology->add_ontology(ontology_name, ontology_filename); } else { help(); exit(0); } } /* Stopwords */ if (strcmp(argv[z], "--stoplist") == 0) { if (argc > z+1) { ontology_name = "STOPWORD"; ontology_filename = argv[z+1]; int c = ontology->add_ontology(ontology_name, ontology_filename); extra_code = "<REDUCE><IF><NOTCLASS STOPWORD></IF><THEN><PRINT chinese_utf8s><PRINT ></THEN>";} else { help(); exit(0); } } /* Inline */ if (strcmp(argv[z], "-i") == 0) { if (argc-1 > z) { inlinetext = 1; inline_text = argv[z+1]; z++; } else { help(); exit(0); } } /* Compare and Update */ if (strcmp(argv[z], "--merge") == 0) { if (argc-1 > z) { update_markup = 1; inline_text_existing = argv[z+1]; inline_text_new= argv[z+2]; z+=2; } else { help(); exit(0); } } /* Run Code */ if (strcmp(argv[z], "--code") == 0) { run_code = 1; } /* Segment Chinese Only */ if (strcmp(argv[z], "--segcn") == 0) { segcn = 1; } /* Segment Chinese Only */ if (strcmp(argv[z], "--tonalize") == 0) { tonalize_pinyin = 1; } /* Split ASCII on punctuation */ if (strcmp(argv[z], "--split-ascii-punctuation") == 0) { text->split_nonchinese_on_punctuation = 1; } /* Vocab */ if (strcmp(argv[z], "--vocab") == 0) { vocab = 1; } if (strcmp(argv[z], "--trad-vocab") == 0) { trad_vocab = 1; } /* Vocab */ if (strcmp(argv[z], "--textbook-markup") == 0) { parse_textbook_markup = 1; } /* Frequency Count */ if (strcmp(argv[z], "--frequency") == 0) { freq_count = 1; } /* All Definitions */ if (strcmp(argv[z], "--full") == 0) { full_definitions = 1; text->full_definitions = 1; } /* Frequency Reset */ if (strcmp(argv[z], "--frequency-reset") == 0) { freq_reset = 1; } /* No Phrases */ if (strcmp(argv[z], "--no-phrases") == 0) { adso->no_phrases = 1; parser->no_phrases = 1; } /* Grammar */ if (strcmp(argv[z], "-g") == 0 || strcmp(argv[z], "-g1") == 0 || strcmp(argv[z], "-g2") == 0) { if (strcmp(argv[z], "-g2") == 0) { g1 = 0; g2 = 1; } if (strcmp(argv[z], "-g") == 0) { g1 = 1; } if (strcmp(argv[z], "-g1") == 0) { g1 = 1; } if (argc-1 > z) { std::string grammar_file = argv[z+1]; process_grammar_file(grammar_file, code); } std::string line = ""; } /* Run Extra Code */ if (strcmp(argv[z], "--extra-code") == 0) { if (argc-1 > z) { extra_code = argv[z+1]; z++; } else { help(); exit(0); } } /* Run Extra Code */ if (strcmp(argv[z], "--extra-code-non-recursive") == 0) { if (argc-1 > z) { extra_code_non_recursive = argv[z+1]; z++; } else { help(); exit(0); } } /* Basic Output Options */ if (strcmp(argv[z], "-t") == 0) { translate = 1; } if (strcmp(argv[z], "-cn") == 0) { chinese = 1; } if (strcmp(argv[z], "-y") == 0) { pinyin = 1; } if (strcmp(argv[z], "-j") == 0) { jyutpin = 1; } if (strcmp(argv[z], "--pinyin") == 0) { pinyin = 1; } if (strcmp(argv[z], "--jyutpin") == 0) { jyutpin = 1; } if (strcmp(argv[z], "--unknown-popup") == 0) { unknown_popup = 1; } if (strcmp(argv[z], "--popup") == 0) { popup = 1; encoding->output_encoding = 2; } if (strcmp(argv[z], "--editable-five-fields") == 0) { editable_five_fields = 1; encoding->input_encoding = 2; encoding->output_encoding = 2; } if (strcmp(argv[z], "--editable") == 0) { editable = 1; encoding->output_encoding = 2; } if (strcmp(argv[z], "--textbook") == 0) { popup = 1; encoding->output_encoding = 2; } if (strcmp(argv[z], "-d") == 0) { debug = 1; } if (strcmp(argv[z], "--debug") == 0) { debug = 1; } if (strcmp(argv[z], "--rscript") == 0) { rscript = 1; } if (strcmp(argv[z], "--rcode") == 0) { rcode = 1; } /* Input/Output Encodings and Scripts */ if (strcmp(argv[z], "-ie") == 0) { if (argc-1 > z) { if (strcmp(argv[z+1], "gb2312") ==0) { encoding->input_encoding = 1; encoding->input_script = 1; encoding->output_encoding = 1; if (encoding->output_script == 0) { encoding->output_script = 1; } }; if (strcmp(argv[z+1], "utf8") ==0) { encoding->input_encoding = 2; encoding->input_script = 1; encoding->output_encoding = 2; if (encoding->output_encoding == 0) { encoding->output_script = 1; }; }; if (strcmp(argv[z+1], "markup") ==0) { parse_textbook_markup = 1; }; if (strcmp(argv[z+1], "js") ==0) { parse_textbook_markup = 1; }; z++; } else { help(); exit(0); } } if (strcmp(argv[z], "-oe") == 0) { if (argc-1 > z) { if (strcmp(argv[z+1], "gb2312") ==0) { encoding->output_encoding = 1; if (encoding->output_script == 0) { encoding->output_script = 1; }; }; if (strcmp(argv[z+1], "utf8") ==0) { encoding->output_encoding = 2; if (encoding->output_script == 0) { encoding->output_script = 1; }; }; z++; } else { help(); exit(0); } } if (strcmp(argv[z], "-is") == 0) { if (argc-1 > z) { if (strcmp(argv[z+1], "simplified") ==0) { encoding->input_script = 1; encoding->output_script = 1; }; if (strcmp(argv[z+1], "traditional") ==0) { encoding->input_script = 2; encoding->output_script = 2; }; if (strcmp(argv[z+1], "complex") ==0) { encoding->input_script = 2; encoding->output_script = 2; }; z++; } else { help(); exit(0); } } if (strcmp(argv[z], "-os") == 0) { if (argc-1 > z) { if (strcmp(argv[z+1], "simplified") ==0) { encoding->output_script = 1; }; if (strcmp(argv[z+1], "traditional") ==0) { encoding->output_script = 2; }; if (strcmp(argv[z+1], "complex") ==0) { encoding->output_script = 2; }; z++; } else { help(); exit(0); } } } // Connect to the Database #ifdef USE_MYSQL adso->connect(); adso->query_string("set names latin1"); // adso->connect_verbs(); #endif #ifdef USE_SQLITE adso->connect(); adso->query_string("set names latin1"); adso->connect_verbs(); #endif // Handle User Input try { std::string str = ""; if (infile != "") { str = process(open_file(infile), text, ontology); str = polisher->return_polished_english(str); if (tonalize_pinyin == 1) { str = polisher->convert_pinyin(str); } if (str != "") { std::cout << str << std::endl; } } else { /* Compare and Update Existing Markup */ if (update_markup == 1) { Text *text2 = new Text(adso, code, encoding, feedback, memory, ontology, parser, polisher); void *xx; text->init_markup(inline_text_existing); text2->init_text(inline_text_new); text2->pre_unify((Text *) xx); text2->unify((Text *) xx); text2->post_unify((Text *) xx); compare_and_update(text,text2); std::cout << text->return_popup_for_editing_five_fields(1) << std::endl; delete text2; } else { if (inlinetext == 1) { str = process(inline_text, text, ontology); str = polisher->return_polished_english(str); if (tonalize_pinyin == 1) { str = polisher->convert_pinyin(str); } if (str != "") { std::cout << str << std::endl; } } else { std::cout << "Welcome to Adso. Enter Chinese text and it will be processed as per your command-line options. If you are unsure of what to do, type \"quit\" and then type \"./adso --help\" at the command prompt for instructions on using the software\n>"; std::cout << ">"; while (std::cin >> str) { if (str == "EXIT" || str == "exit" || str == "q" || str == "Q" || str == "quit" || str == "QUIT" || str == "bye" || str == "BYE") { break; } str = process(str, text, ontology); str = polisher->return_polished_english(str); if (tonalize_pinyin == 1) { str = polisher->convert_pinyin(str); } if (str != "") { std::cout << str << std::endl; } std::cout << ">"; } } } // comparison if } } catch (char *x) { std::cout << "Error: " << x; } catch (std::string x) { std::cout << "Error: " << x; } catch (...) { std::cout << "Unknown Error Caught!\n"; } // Frequency Reset as Needed if (freq_reset == 1) { text->frequency_reset(text, adso); } // Frequency Count as Needed if (freq_count == 1) { text->frequency_count(text, adso); } adso->disconnect(); delete adso; delete text; delete polisher; return 1; }