Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
dumppfmt.c
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001, Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2.1 of the GNU Lesser General Public License 
00007   as published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU Lesser General Public 
00021   License along with this program; if not, write the Free Software 
00022   Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 
00023   USA.
00024 
00025   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00026   Mountain View, CA 94043, or:
00027 
00028   http://www.sgi.com
00029 
00030   For further information regarding this notice, see:
00031 
00032   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00033 
00034 */
00035 
00036 
00037 
00038 #pragma ident "@(#) libf/fio/dumppfmt.c 92.1    06/18/99 10:21:14"
00039 #include <stdio.h>
00040 #include <memory.h>
00041 #include <stdlib.h>
00042 #include <string.h>
00043 #include <cray/format.h>
00044 #include <cray/portdefs.h>
00045 
00046 void
00047 _dumppfmt(
00048         fmt_type        *parsed_format
00049 )
00050 {
00051         register int    index;
00052         int64           *ptr;
00053         fmt_type        ent;
00054 
00055         if (parsed_format == NULL)
00056                 (void) printf("     Parsed format pointer is NULL\n");
00057         else {
00058 
00059                 ptr     = (int64 *) parsed_format;
00060                 ent     = *(fmt_type *) ptr;
00061                 index   = 0;
00062 
00063                 (void) printf(" %03o %01o %08o  %02o %01o %08o     0: Header word\n",
00064                         ent.op_code, ent.default_digits, ent.digits_field,
00065                         ent.exponent, ent.reserved2, ent.field_width);
00066                 (void) printf(" %1o %05o %06o    %011o        Parser level = %d, Max depth = %d\n",
00067                         ent.rgcdedf, ent.reserved3, ent.offset, ent.rep_count & 037777777777,
00068                         ent.offset, ent.rep_count & 037777777777);
00069 
00070                 for ( ; ; ) {
00071                         ptr     = ptr + FMT_ENTRY_WORD_SIZE;
00072                         ent     = *(fmt_type *) ptr;
00073                         index   = index + 1;
00074 
00075                         (void) printf(" %03o", ent.op_code);
00076                         (void) printf(" %01o", ent.default_digits);
00077                         (void) printf(" %08o", ent.digits_field);
00078                         (void) printf("  %02o", ent.exponent);
00079                         (void) printf(" %01o", ent.reserved2);
00080                         (void) printf(" %08o", ent.field_width);
00081                         (void) printf("    %2d: ", index);
00082 
00083                         switch (ent.op_code) {
00084 
00085                                 case A_ED:
00086                                         (void) printf("%d A%d", ent.rep_count,
00087                                                 ent.field_width);
00088                                         break;
00089 
00090                                 case B_ED:
00091                                         (void) printf("%d B%d.%d", ent.rep_count,
00092                                                 ent.field_width,
00093                                                 ent.digits_field);
00094                                         break;
00095 
00096                                 case D_ED:
00097                                         (void) printf("%d D%d.%de%d", ent.rep_count,
00098                                                 ent.field_width,
00099                                                 ent.digits_field,
00100                                                 ent.exponent);
00101                                         break;
00102 
00103                                 case E_ED:
00104                                         (void) printf("%d E%d.%de%d", ent.rep_count,
00105                                                 ent.field_width,
00106                                                 ent.digits_field,
00107                                                 ent.exponent);
00108                                         break;
00109 
00110                                 case EN_ED:
00111                                         (void) printf("%d EN%d.%de%d", ent.rep_count,
00112                                                 ent.field_width,
00113                                                 ent.digits_field,
00114                                                 ent.exponent);
00115                                         break;
00116 
00117                                 case ES_ED:
00118                                         (void) printf("%d ES%d.%de%d", ent.rep_count,
00119                                                 ent.field_width,
00120                                                 ent.digits_field,
00121                                                 ent.exponent);
00122                                         break;
00123 
00124                                 case F_ED:
00125                                         (void) printf("%d F%d.%d", ent.rep_count,
00126                                                 ent.field_width,
00127                                                 ent.digits_field);
00128                                         break;
00129 
00130                                 case G_ED:
00131                                         (void) printf("%d G%d.%de%d", ent.rep_count,
00132                                                 ent.field_width,
00133                                                 ent.digits_field,
00134                                                 ent.exponent);
00135                                         break;
00136 
00137                                 case I_ED:
00138                                         (void) printf("%d I%d.%d", ent.rep_count,
00139                                                 ent.field_width,
00140                                                 ent.digits_field);
00141                                         break;
00142 
00143                                 case L_ED:
00144                                         (void) printf("%d L%d", ent.rep_count,
00145                                                 ent.field_width);
00146                                         break;
00147 
00148                                 case O_ED:
00149                                         (void) printf("%d O%d.%d", ent.rep_count,
00150                                                 ent.field_width,
00151                                                 ent.digits_field);
00152                                         break;
00153 
00154                                 case R_ED:
00155                                         (void) printf("%d R%d", ent.rep_count,
00156                                                 ent.field_width);
00157                                         break;
00158 
00159                                 case Z_ED:
00160                                         (void) printf("%d Z%d.%d", ent.rep_count,
00161                                                 ent.field_width,
00162                                                 ent.digits_field);
00163                                         break;
00164 
00165                                 case SLASH_ED:
00166                                         (void) printf("%d /%d", ent.rep_count,
00167                                                 ent.field_width);
00168                                         break;
00169 
00170                                 case P_ED:
00171                                         (void) printf("%dP", ent.rep_count);
00172                                         break;
00173 
00174                                 case Q_ED:
00175                                         (void) printf("%dQ", ent.rep_count);
00176                                         break;
00177 
00178                                 case STRING_ED:
00179                                         (void) printf("%d STRING %d", ent.rep_count,
00180                                                 ent.field_width);
00181                                         break;
00182 
00183                                 case BN_ED:
00184                                         (void) printf("%d BN", ent.rep_count);
00185                                         break;
00186 
00187                                 case BZ_ED:
00188                                         (void) printf("%d BZ", ent.rep_count);
00189                                         break;
00190 
00191                                 case COLON_ED:
00192                                         (void) printf("%d :", ent.rep_count);
00193                                         break;
00194 
00195                                 case S_ED:
00196                                         (void) printf("%d S", ent.rep_count);
00197                                         break;
00198 
00199                                 case SP_ED:
00200                                         (void) printf("%d SP", ent.rep_count);
00201                                         break;
00202 
00203                                 case SS_ED:
00204                                         (void) printf("%d SS", ent.rep_count);
00205                                         break;
00206 
00207                                 case T_ED:
00208                                         (void) printf("%d T%d", ent.rep_count,
00209                                                 ent.field_width);
00210                                         break;
00211 
00212                                 case TL_ED:
00213                                         (void) printf("%d TL%d", ent.rep_count,
00214                                                 ent.field_width);
00215                                         break;
00216 
00217                                 case TR_ED:
00218                                         (void) printf("%d TR%d", ent.rep_count,
00219                                                 ent.field_width);
00220                                         break;
00221 
00222                                 case DOLLAR_ED:
00223                                         (void) printf("%d $", ent.rep_count);
00224                                         break;
00225 
00226                                 case REPEAT_OP:
00227                                         (void) printf("REPEAT %d", ent.rep_count);
00228                                         break;
00229 
00230                                 case ENDREP_OP:
00231                                         (void) printf("ENDREPEAT %d", ent.rep_count);
00232                                         break;
00233 
00234                                 case REVERT_OP:
00235                                         (void) printf("REVERT %d", ent.rep_count);
00236                                         if (!(ent.rgcdedf))
00237                                                 (void) printf(" (no data edit-descriptors in revert group)");
00238                                         break;
00239 
00240                                 default:
00241                                         (void) printf("ERROR - Unknown Op Code");
00242                                         break;
00243 
00244                         } /* switch */
00245 
00246                         if (ent.default_digits)
00247                                 (void) printf(" (default digits field)");
00248                         else if (ent.op_code < Q_ED && ent.op_code > A_ED &&
00249                                  ent.op_code != L_ED && ent.op_code != R_ED)
00250                                 (void) printf(" (user specified digits field)");
00251                         (void) printf("\n");
00252                         (void) printf(" %01o", ent.rgcdedf);
00253                         (void) printf(" %05o", ent.reserved3);
00254                         (void) printf(" %06o", ent.offset);
00255                         (void) printf("    %011o",ent.rep_count & 037777777777);
00256                         (void) printf("        (character position %d in format)\n", ent.offset);
00257 
00258                         if (ent.op_code == REVERT_OP)
00259                                 break;
00260 
00261                         if (ent.op_code == STRING_ED) {
00262                                 register int    j;
00263 
00264                                 ptr     = ptr + FMT_ENTRY_WORD_SIZE;
00265                                 index   = index + 1;
00266 
00267                                 (void) printf("        %022llo        '%.*s'\n", *ptr,
00268                                         ent.field_width, (char *) ptr);
00269                                 (void) printf("        %022llo\n", *(ptr + 1));
00270 
00271                                 for (j = 0; j < ((ent.field_width - 1)/FMT_ENTRY_BYTE_SIZE); j++) {
00272                                         ptr     = ptr + FMT_ENTRY_WORD_SIZE;
00273                                         index   = index + 1;
00274                                         (void) printf("        %022llo\n", *ptr);
00275                                         (void) printf("        %022llo\n", *(ptr + 1));
00276                                 }
00277                         }
00278                 } /* for */
00279         }
00280 
00281         return;
00282 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines