int main (int argc, char * argv[]) { char * filename = argv[1]; Program_Module m = Program_ModuleNew(); Program_ParseArguments (m, argc, argv); printf ("Compiling %s\n", String_Data (m->options.file)); if (Parse_File (m, m->options.file) != 0) { printf ("Lex errors: %lu\n", Vector_Size (&m->errors.lexer)); VECTOR_FOREACH (struct Error_t, error, &m->errors.lexer) { Error_Print (stdout, error); } printf ("Parse errors: %lu\n", Vector_Size (&m->errors.parser)); VECTOR_FOREACH (struct Error_t, error, &m->errors.parser) { Error_Print (stdout, error); } VECTOR_FOREACH (struct Program_Option_t, o, &m->options.debug) { if (String_Equal (&o->key, "parse-only")) { printf ("Exiting, because of '%s'.\n", o->key.data); exit (0); } } printf ("Exiting, fix the errors and try again."); exit (0); }
int Secure_GenKeys(Secure_PubKey pub, Secure_PrivKey priv) { if(crypto_box_keypair(pub, priv)) { Error_Print("Unable to generate keypair.\n"); return -1; } return 0; }
int Secure_GenSharedKey(Secure_SharedKey sharedkey, Secure_PubKey peer, Secure_PrivKey priv) { if(crypto_box_beforenm(sharedkey, peer, priv)) { Error_Print("Unable to generate a shared key.\n"); return -1; } return 0; }
void Template::dumpToFile( const char *szFilename ) { FILE *outfile = fopen( szFilename, "wt" ); if( !outfile ) { Error_Print( "Failed opening output file for Template\n" ); return; } for( int i=0; i<mnXSize*mnYSize; ++i ) { if( i != 0 && i % mnXSize == 0 ) fprintf( outfile, "\n" ); fprintf( outfile, "%i ", mpbBuf[i] ); } fclose( outfile ); return; } // End Function dumpToFile