mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Release calc version 2.12.1.6
This commit is contained in:
40
config.c
40
config.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.22 $
|
||||
* @(#) $Id: config.c,v 29.22 2006/06/25 22:05:38 chongo Exp $
|
||||
* @(#) $Revision: 29.23 $
|
||||
* @(#) $Id: config.c,v 29.23 2006/12/15 16:17:18 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $
|
||||
*
|
||||
* Under source code control: 1991/07/20 00:21:56
|
||||
@@ -31,6 +31,24 @@
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "have_times.h"
|
||||
#if defined(HAVE_TIME_H)
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_TIMES_H)
|
||||
#include <times.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SYS_TIME_H)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SYS_TIMES_H)
|
||||
#include <sys/times.h>
|
||||
#endif
|
||||
|
||||
#include "calc.h"
|
||||
#include "token.h"
|
||||
#include "zrand.h"
|
||||
@@ -45,6 +63,15 @@
|
||||
# define strdup(x) calc_strdup((CONST char *)(x))
|
||||
#endif /* HAVE_STRDUP */
|
||||
|
||||
/*
|
||||
* deal with systems that lack a defined CLK_TCK
|
||||
*/
|
||||
#if defined(CLK_TCK)
|
||||
# define CALC_HZ ((long)(CLK_TCK))
|
||||
#else
|
||||
# define CALC_HZ (0L) /* no defined clock tick rate */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Table of configuration types that can be set or read.
|
||||
@@ -100,6 +127,7 @@ NAMETYPE configs[] = {
|
||||
{"baseb", CONFIG_BASEB},
|
||||
{"redecl_warn", CONFIG_REDECL_WARN},
|
||||
{"dupvar_warn", CONFIG_DUPVAR_WARN},
|
||||
{"hz", CONFIG_HZ},
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
@@ -941,6 +969,10 @@ setconfig(int type, VALUE *vp)
|
||||
}
|
||||
break;
|
||||
|
||||
case CONFIG_HZ:
|
||||
math_error("The clock tick rate config parameter is read-only");
|
||||
/*NOTREACHED*/
|
||||
|
||||
default:
|
||||
math_error("Setting illegal config parameter");
|
||||
/*NOTREACHED*/
|
||||
@@ -1330,6 +1362,10 @@ config_value(CONFIG *cfg, int type, VALUE *vp)
|
||||
i = (cfg->dupvar_warn ? 1 : 0);
|
||||
break;
|
||||
|
||||
case CONFIG_HZ:
|
||||
i = CALC_HZ;
|
||||
break;
|
||||
|
||||
default:
|
||||
math_error("Getting illegal CONFIG element");
|
||||
/*NOTREACHED*/
|
||||
|
Reference in New Issue
Block a user