You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2006/10/25 20:40:57 UTC
svn commit: r467726 - in
/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core: ModHandler.charm
ModHandler.harm
Author: marvin
Date: Wed Oct 25 11:40:56 2006
New Revision: 467726
URL: http://svn.apache.org/viewvc?view=rev&rev=467726
Log:
Add a test_compile() function to ModHandler, for when it's not necessary to
check output. Also, check the return value of a calloc call in _charm_run.
Modified:
lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ModHandler.charm
lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ModHandler.harm
Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ModHandler.charm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ModHandler.charm?view=diff&rev=467726&r1=467725&r2=467726
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ModHandler.charm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ModHandler.charm Wed Oct 25 11:40:56 2006
@@ -97,6 +97,10 @@
command_len += strlen(argv[i]) + 1;
}
command = (char*)calloc(command_len, sizeof(char));
+ if (command == NULL) {
+ fprintf(stderr, "calloc failed\n");
+ exit(1);
+ }
for (i = 1; i < argc; i++) {
strcat( strcat(command, " "), argv[i] );
}
@@ -131,6 +135,22 @@
remove("_charm_run.c");
charm_run_available = true;
+}
+
+chaz_bool_t
+chaz_ModHand_test_compile(char *source, size_t source_len)
+{
+ chaz_bool_t compile_succeeded;
+
+ if ( !remove_and_verify(try_app_path) )
+ die("Failed to delete file '%s'", try_app_path);
+
+ compile_succeeded = compiler->compile_exe(compiler, TRY_SOURCE_PATH,
+ try_app_path, source, source_len);
+
+ clean_up_try();
+
+ return compile_succeeded;
}
char*
Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ModHandler.harm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ModHandler.harm?view=diff&rev=467726&r1=467725&r2=467726
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ModHandler.harm (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Core/ModHandler.harm Wed Oct 25 11:40:56 2006
@@ -37,6 +37,12 @@
void
chaz_ModHand_init();
+/* Attempt to compile the supplied source code and return true if the
+ * effort succeeds.
+ */
+chaz_bool_t
+chaz_ModHand_test_compile(char *source, size_t source_len);
+
/* Attempt to compile the supplied source code. If successful, capture the
* output of the program and return a pointer to a newly allocated buffer.
* If the compilation fails, return NULL. The length of the captured
@@ -121,6 +127,7 @@
# define build_charm_run chaz_ModHand_build_charm_run
# define Start_Short_Names Chaz_ModHand_Start_Short_Names
# define End_Short_Names Chaz_ModHand_End_Short_Names
+# define test_compile chaz_ModHand_test_compile
# define capture_output chaz_ModHand_capture_output
# define append_conf chaz_ModHand_append_conf
# define shorten_constant chaz_ModHand_shorten_constant