mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.11.1
This commit is contained in:
47
addop.c
47
addop.c
@@ -1,11 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 1997 David I. Bell
|
||||
* Permission is granted to use, distribute, or modify this source,
|
||||
* provided that this copyright notice remains intact.
|
||||
* addop - add opcodes to a function being compiled
|
||||
*
|
||||
* Add opcodes to a function being compiled.
|
||||
* Copyright (C) 1999 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* Public License for more details.
|
||||
*
|
||||
* A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
* distributed with calc under the filename COPYING-LGPL. You should have
|
||||
* 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.1 $
|
||||
* @(#) $Id: addop.c,v 29.1 1999/12/14 09:15:29 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/addop.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:10
|
||||
* File existed as early as: before 1990
|
||||
*
|
||||
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "calc.h"
|
||||
#include "opcodes.h"
|
||||
@@ -68,7 +92,7 @@ showfunctions(void)
|
||||
|
||||
count = 0;
|
||||
if (funccount > 0) {
|
||||
if (conf->lib_debug & LIBDBG_FUNC_INFO)
|
||||
if (conf->resource_debug & RSCDBG_FUNC_INFO)
|
||||
math_str("Index\tName \tArgs\tOpcodes\n"
|
||||
"-----\t------ \t---- \t------\n");
|
||||
else
|
||||
@@ -76,7 +100,7 @@ showfunctions(void)
|
||||
"----\t---------\n");
|
||||
for (index = 0; index < funccount; index++) {
|
||||
fp = functions[index];
|
||||
if (conf->lib_debug & LIBDBG_FUNC_INFO) {
|
||||
if (conf->resource_debug & RSCDBG_FUNC_INFO) {
|
||||
|
||||
math_fmt("%5ld\t%-12s\t", index,
|
||||
namestr(&funcnames,index));
|
||||
@@ -96,7 +120,7 @@ showfunctions(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (conf->lib_debug & LIBDBG_FUNC_INFO) {
|
||||
if (conf->resource_debug & RSCDBG_FUNC_INFO) {
|
||||
math_fmt("\nNumber non-null: %ld\n", count);
|
||||
math_fmt("Number null: %ld\n", funccount - count);
|
||||
math_fmt("Total number: %ld\n", funccount);
|
||||
@@ -191,8 +215,8 @@ endfunc(void)
|
||||
size += dumpop(&fp->f_opcodes[size]);
|
||||
}
|
||||
}
|
||||
if ((inputisterminal() && conf->lib_debug & LIBDBG_STDIN_FUNC) ||
|
||||
(!inputisterminal() && conf->lib_debug & LIBDBG_FILE_FUNC)) {
|
||||
if ((inputisterminal() && conf->resource_debug & RSCDBG_STDIN_FUNC) ||
|
||||
(!inputisterminal() && conf->resource_debug & RSCDBG_FILE_FUNC)) {
|
||||
printf("%s(", newname);
|
||||
for (index = 0; index < fp->f_paramcount; index++) {
|
||||
if (index)
|
||||
@@ -209,7 +233,6 @@ endfunc(void)
|
||||
free(functions[newindex]);
|
||||
}
|
||||
functions[newindex] = fp;
|
||||
objuncache();
|
||||
}
|
||||
|
||||
|
||||
@@ -265,8 +288,8 @@ rmuserfunc(char *name)
|
||||
return;
|
||||
freenumbers(functions[index]);
|
||||
free(functions[index]);
|
||||
if ((inputisterminal() && conf->lib_debug & LIBDBG_STDIN_FUNC) ||
|
||||
(!inputisterminal() && conf->lib_debug & LIBDBG_FILE_FUNC))
|
||||
if ((inputisterminal() && conf->resource_debug & RSCDBG_STDIN_FUNC) ||
|
||||
(!inputisterminal() && conf->resource_debug & RSCDBG_FILE_FUNC))
|
||||
printf("%s() undefined\n", name);
|
||||
functions[index] = NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user