[dhcp-agent-commits] dhcp-agent/src dhcp-message-guile.h,NONE,1.1 dhcp-message-guile.c,NONE,1.1
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2003-08-18 02:39:08
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv433 Added Files: dhcp-message-guile.h dhcp-message-guile.c Log Message: added message binding to guile --- NEW FILE: dhcp-message-guile.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-message-guile.h,v 1.1 2003/08/18 02:21:15 actmodern Exp $ * * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * info message, error message, and fatal message guile bindings. */ #ifndef DHCP_MESSAGE_GUILE_H #define DHCP_MESSAGE_GUILE_H extern SCM scm_info_message(SCM msg, SCM args); extern SCM scm_error_message(SCM msg, SCM args); extern SCM scm_fatal_error_message(SCM msg, SCM args); #endif /* DHCP_MESSAGE_GUILE_H */ --- NEW FILE: dhcp-message-guile.c --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-message-guile.c,v 1.1 2003/08/18 02:21:15 actmodern Exp $ * * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * info message, error message, and fatal message guile bindings. */ #include "dhcp-local.h" #include "dhcp-libutil.h" #include "dhcp-guile-util.h" /* use a string output port to print out a string. */ static SCM print_to_scm_string(SCM msg, SCM args) { SCM string_port; SCM string; string_port = scm_open_output_string(); scm_simple_format(string_port, msg, args); string = scm_get_output_string(string_port); scm_close_output_port(string_port); return string; } /* send a message via the INFO_MESSAGE facility. */ SCM scm_info_message(SCM msg, SCM args) { SCM scm_str; char *str; scm_str = print_to_scm_string(msg, args); str = x_scm_string2newstr(scm_str); INFO_MESSAGE(str); xfree(str); return SCM_BOOL_T; } /* send a message via the ERROR_MESSAGE facility. */ SCM scm_error_message(SCM msg, SCM args) { SCM scm_str; char *str; scm_str = print_to_scm_string(msg, args); str = x_scm_string2newstr(scm_str); ERROR_MESSAGE(str); xfree(str); return SCM_BOOL_T; } /* send a message via the FATAL_MESSAGE facility. */ SCM scm_fatal_error_message(SCM msg, SCM args) { SCM scm_str; char *str; scm_str = print_to_scm_string(msg, args); str = x_scm_string2newstr(scm_str); FATAL_MESSAGE(str); xfree(str); return SCM_BOOL_T; } |