Main Page | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

stdio.c File Reference


Detailed Description

Standard Output and Standard Error print functions that are isolated from certain compile requirements of the other code.

USE THESE FUNCTIONS IN PLACE OF fprintf() AND sprintf() IN ALL CODE DUE TO STRUCTURE PACKING OPTIONS CAUSING SIGSEGV IN SOME ARCHITECTURES (specifically Solaris 32-bit) WITH 'GCC'

THIS FILE MUST BE COMPILED WITH STRUCTURE PACKING OFF (at least for the default GCC stdio library) OR IN THE SAME MANNER IN WHICH YOUR COMPILER'S RUNTIME LIBRARY HAS IT COMPILED. (You may get unexplainable SIGSEGV errors otherwise.)

Control

$URL: https://svn.apache.org/path/name/stdio.c $ $Id: stdio.c 0 09/28/2005 dlydick $

Copyright 2005 The Apache Software Foundation or its licensors, as applicable.

Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

Version:
$LastChangedRevision: 0 $
Date:
$LastChangedDate: 09/28/2005 $
Author:
$LastChangedBy: dlydick $ Original code contributed by Daniel Lydick on 09/28/2005.

Reference

Definition in file stdio.c.

#include "arch.h"
#include <stdio.h>
#include <stdarg.h>
#include "jvmcfg.h"
#include "util.h"

Go to the source code of this file.

Macro support for local standard output utilities

#define LOCAL_FPRINTF(FP)
#define LOCAL_SPRINTF

Magic redirection of selected standard I/O functions.

In jvmcfg.h, there are several #define statements that redirect printf() and fprintf() and sprintf() from the <stdio.h> linkages to local linkages.

This magic redirection used the compile-time definition SUPPRESS_STDIO_REDIRECTION to co-opt these standard I/O calls and redirect them to local version so as to avoid SIGSEGV problems with certain configurations. * These routines are meant to encourage use of proper functions above.

Parameters:
fp FILE handle to standard I/O file handle.
bfr Buffer to format
fmt printf() style format string
_param ... printf() style argument list, zero or more

Returns:
number of characters emitted or formatted


int _fprintfLocal (FILE *fp, const rchar *fmt,...)
int _printfLocal (const rchar *fmt,...)
int _sprintfLocal (rchar *bfr, const rchar *fmt,...)

Local version of standard output routines.

Local implementations of sprintf(3) and fprintf(3) are provided for both stdout and stderr. These functions are intended to bypass the structure packing mismatch between the requirements of parts of this application and the manner in which any compiler's runtime library was compiled.

In the same manner as the printf() style printing functions above, there are three versions of this routine. In this case, one writes to standard output, another to standard error, and the third formats a buffer.

Parameters:
fmt printf() style format string
_param ... printf() style argument list, zero or more

Returns:
number of characters emitted or formatted


int fprintfLocalStderr (rchar *fmt,...)
int fprintfLocalStdout (rchar *fmt,...)
int sprintfLocal (rchar *bfr, rchar *fmt,...)

printf() style printing to standard error and

buffer formatting.

There are three versions of this routine. One conditionally prints a message to stderr based on a debug level. The others perform unconditional actions.

Create a variable-argument message to standard error or a buffer in a fashion with a tag string on the front telling what type of error it is.

Parameters:
dml Debug msg level DML0 through DML10
bfr Buffer to format
fn Function name of caller or other unique "string"
fmt printf() style format string
_param ... printf() style argument list, zero or more

Returns:
number of characters emitted or formatted


int sysDbgMsg (rint dml, rchar *fn, rchar *fmt,...)
int sysErrMsg (rchar *fn, rchar *fmt,...)
int sysErrMsgBfrFormat (rchar *bfr, rchar *fn, rchar *fmt,...)

Defines

#define I_AM_STDIO_C
#define SUPPRESS_STDIO_REDIRECTION

Functions

static void stdio_c_dummy (void)

Variables

static char * stdio_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/stdio.c $ $Id: stdio.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable."


Define Documentation

#define SUPPRESS_STDIO_REDIRECTION
 

Definition at line 57 of file stdio.c.

#define I_AM_STDIO_C
 

Definition at line 61 of file stdio.c.

#define LOCAL_FPRINTF FP   ) 
 

Value:

va_list ap;                              \
    va_start(ap, fmt);                       \
                                             \
    int rc = vfprintf(FP, fmt, ap);          \
                                             \
    va_end(ap);                              \
    fflush(FP);                              \
    JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER; \
    return(rc)

Definition at line 179 of file stdio.c.

Referenced by fprintfLocalStderr(), and fprintfLocalStdout().

#define LOCAL_SPRINTF
 

Value:

va_list ap;                      \
    va_start(ap, fmt);               \
                                     \
    int rc = vsprintf(bfr, fmt, ap); \
                                     \
    va_end(ap);                      \
    return(rc)

Definition at line 190 of file stdio.c.

Referenced by sprintfLocal().


Function Documentation

static void stdio_c_dummy void   )  [static]
 

Definition at line 51 of file stdio.c.

int sysDbgMsg rint  dml,
rchar fn,
rchar fmt,
  ...
 

< Convenient size for any stdio msg

Definition at line 96 of file stdio.c.

References JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER, JVMCFG_DEBUG_MESSAGE_ENABLE, JVMCFG_STDIO_BFR, jvmutil_get_dml(), rfalse, and sprintf.

Referenced by cfattrib_loadattribute(), cfmsgs_typemsg(), classfile_loadclassdata(), and timeslice_tick().

int sysErrMsg rchar fn,
rchar fmt,
  ...
 

< Convenient size for any stdio msg

Definition at line 130 of file stdio.c.

References JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER, JVMCFG_STDIO_BFR, and sprintf.

Referenced by _fprintfLocal(), _printfLocal(), _sprintfLocal(), argv_init(), heap_init_bimodal(), jvm_manual_thread_run(), jvm_run(), manifest_get_main(), object_run_method(), opcode_load_run_throwable(), opcode_run(), timeslice_init(), and timeslice_run().

int sysErrMsgBfrFormat rchar bfr,
rchar fn,
rchar fmt,
  ...
 

< Convenient size for any stdio msg

Definition at line 151 of file stdio.c.

References JVMCFG_STDIO_BFR, and sprintf.

int fprintfLocalStdout rchar fmt,
  ...
 

Definition at line 226 of file stdio.c.

References LOCAL_FPRINTF.

int fprintfLocalStderr rchar fmt,
  ...
 

Definition at line 233 of file stdio.c.

References LOCAL_FPRINTF.

Referenced by jvmutil_print_stack_common(), and opcode_load_run_throwable().

int sprintfLocal rchar bfr,
rchar fmt,
  ...
 

Definition at line 239 of file stdio.c.

References LOCAL_SPRINTF.

Referenced by cfmsgs_typemsg(), jvmutil_print_errtype_stack(), and thread_init().

int _printfLocal const rchar fmt,
  ...
 

Definition at line 276 of file stdio.c.

References sysErrMsg().

int _fprintfLocal FILE *  fp,
const rchar fmt,
  ...
 

Definition at line 283 of file stdio.c.

References sysErrMsg().

int _sprintfLocal rchar bfr,
const rchar fmt,
  ...
 

Definition at line 290 of file stdio.c.

References sysErrMsg().


Variable Documentation

char* stdio_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/stdio.c $ $Id: stdio.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable." [static]
 

Definition at line 51 of file stdio.c.


Generated on Fri Sep 30 18:50:27 2005 by  doxygen 1.4.4