Back to index

php5  5.3.10
debug.c
Go to the documentation of this file.
00001 /* debug.c: bcmath library file. */
00002 /*
00003     Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
00004     Copyright (C) 2000 Philip A. Nelson
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Lesser General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Lesser General Public License for more details.  (COPYING.LIB)
00015 
00016     You should have received a copy of the GNU Lesser General Public
00017     License along with this library; if not, write to:
00018 
00019       The Free Software Foundation, Inc.
00020       59 Temple Place, Suite 330
00021       Boston, MA 02111-1307 USA.
00022 
00023     You may contact the author by:
00024        e-mail:  philnelson@acm.org
00025       us-mail:  Philip A. Nelson
00026                 Computer Science Department, 9062
00027                 Western Washington University
00028                 Bellingham, WA 98226-9062
00029        
00030 *************************************************************************/
00031 
00032 #include <config.h>
00033 #include <stdio.h>
00034 #include <assert.h>
00035 #include <stdlib.h>
00036 #include <ctype.h>
00037 #include <stdarg.h>
00038 #include "bcmath.h"
00039 #include "private.h"
00040 
00041 /* pn prints the number NUM in base 10. */
00042 
00043 static void
00044 out_char (int c)
00045 {
00046   putchar(c);
00047 }
00048 
00049 
00050 void
00051 pn (bc_num num TSRMLS_DC)
00052 {
00053   bc_out_num (num, 10, out_char, 0 TSRMLS_CC);
00054   out_char ('\n');
00055 }
00056 
00057 
00058 /* pv prints a character array as if it was a string of bcd digits. */
00059 void
00060 pv (name, num, len)
00061      char *name;
00062      unsigned char *num;
00063      int len;
00064 {
00065   int i;
00066   printf ("%s=", name);
00067   for (i=0; i<len; i++) printf ("%c",BCD_CHAR(num[i]));
00068   printf ("\n");
00069 }