mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
change custom_compiled() to return BOOL
Also make slight improvements on error messages produced when custom_compiled() returns an unexpected value.
This commit is contained in:
14
calc.c
14
calc.c
@@ -168,9 +168,10 @@ main(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* error if libcustcalc was compiled with CUSTOM undefined
|
* error if libcustcalc was compiled with CUSTOM undefined
|
||||||
*/
|
*/
|
||||||
if (custom_compiled() == 0) {
|
if (custom_compiled() != TRUE) {
|
||||||
fprintf(stderr, "%s: calc was built with custom functions enabled, "
|
math_error("%s: calc was built with custom functions enabled, "
|
||||||
"however custom_compiled() retuned 0", program);
|
"custom_compiled() returned: %d != %d",
|
||||||
|
program, custom_compiled(), TRUE);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,9 +185,10 @@ main(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* error if libcustcalc was compiled with CUSTOM defined
|
* error if libcustcalc was compiled with CUSTOM defined
|
||||||
*/
|
*/
|
||||||
if (custom_compiled() == 1) {
|
if (custom_compiled() != FALSE) {
|
||||||
fprintf(stderr, "%s: calc was built with custom functions disabled, "
|
math_error("%s: calc was built with custom functions disabled, "
|
||||||
"however custom_compiled() retuned 1", program);
|
"custom_compiled() returned: %d != %d",
|
||||||
|
program, custom_compiled(), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
12
custom.c
12
custom.c
@@ -71,8 +71,10 @@ custom(char *name, int count, VALUE **vals)
|
|||||||
/*
|
/*
|
||||||
* error if libcustcalc was compiled with CUSTOM undefined
|
* error if libcustcalc was compiled with CUSTOM undefined
|
||||||
*/
|
*/
|
||||||
if (custom_compiled() == 0) {
|
if (custom_compiled() != TRUE) {
|
||||||
math_error("libcustcalc was compiled CUSTOM undefined");
|
math_error("libcustcalc was compiled with CUSTOM undefined "
|
||||||
|
"custom_compiled() returned: %d != %d",
|
||||||
|
custom_compiled(), TRUE);
|
||||||
not_reached();
|
not_reached();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,8 +113,10 @@ custom(char *name, int count, VALUE **vals)
|
|||||||
/*
|
/*
|
||||||
* error if libcustcalc was compiled with CUSTOM defined
|
* error if libcustcalc was compiled with CUSTOM defined
|
||||||
*/
|
*/
|
||||||
if (custom_compiled() == 1) {
|
if (custom_compiled() != FALSE) {
|
||||||
math_error("libcustcalc was compiled with CUSTOM defined");
|
math_error("libcustcalc was compiled with CUSTOM defined "
|
||||||
|
"custom_compiled() returned: %d != %d",
|
||||||
|
custom_compiled(), FALSE);
|
||||||
not_reached();
|
not_reached();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
custom.h
2
custom.h
@@ -73,7 +73,7 @@ struct custom {
|
|||||||
*
|
*
|
||||||
* These are the required interfaces. The dummy.c stubs these interfaces too.
|
* These are the required interfaces. The dummy.c stubs these interfaces too.
|
||||||
*/
|
*/
|
||||||
E_FUNC int custom_compiled(void); /* return 1 ==> libcustcalc compiled w/CUSTOM defined, else return 0 */
|
E_FUNC BOOL custom_compiled(void); /* return TRUE if libcustcalc compiled CUSTOM defined, FALSE otherwise */
|
||||||
E_FUNC VALUE custom(char*, int, VALUE**); /* master custom interface */
|
E_FUNC VALUE custom(char*, int, VALUE**); /* master custom interface */
|
||||||
EXTERN BOOL allow_custom; /* TRUE => custom builtins allowed */
|
EXTERN BOOL allow_custom; /* TRUE => custom builtins allowed */
|
||||||
E_FUNC void showcustom(void); /* print custom functions */
|
E_FUNC void showcustom(void); /* print custom functions */
|
||||||
|
@@ -39,16 +39,16 @@
|
|||||||
* custom_compiled - determine if custom functions are compiled into libcustcalc
|
* custom_compiled - determine if custom functions are compiled into libcustcalc
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
s* 1 ==> libcustcalc was compiled with CUSTOM defined
|
s* TRUE ==> libcustcalc was compiled with CUSTOM defined
|
||||||
* 0 ==> libcustcalc was compiled with CUSTOM undefined
|
* FALSE ==> libcustcalc was compiled with CUSTOM undefined
|
||||||
*/
|
*/
|
||||||
E_FUNC int
|
E_FUNC BOOL
|
||||||
custom_compiled(void)
|
custom_compiled(void)
|
||||||
{
|
{
|
||||||
#if defined(CUSTOM)
|
#if defined(CUSTOM)
|
||||||
return 1;
|
return TRUE;
|
||||||
#else /* CUSTOM */
|
#else /* CUSTOM */
|
||||||
return 0;
|
return FALSE;
|
||||||
#endif /* CUSTOM */
|
#endif /* CUSTOM */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user