00001 /* 00002 * Copyright 2004 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2.1 of the GNU Lesser General Public License 00011 as published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 Further, this software is distributed without any warranty that it is 00018 free of the rightful claim of any third person regarding infringement 00019 or the like. Any license provided herein, whether implied or 00020 otherwise, applies only to this software file. Patent licenses, if 00021 any, provided herein do not apply to combinations of this program with 00022 other software, or any other product whatsoever. 00023 00024 You should have received a copy of the GNU Lesser General Public 00025 License along with this program; if not, write the Free Software 00026 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00027 USA. 00028 00029 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00030 Mountain View, CA 94043, or: 00031 00032 http://www.sgi.com 00033 00034 For further information regarding this notice, see: 00035 00036 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00037 00038 */ 00039 00040 00041 /* $Header: /proj/osprey/CVS/open64/osprey1.0/libF77/s_rnge.c,v 1.1.1.1 2005/10/21 19:00:00 marcel Exp $ */ 00042 #include <stdio.h> 00043 00044 /* called when a subscript is out of range */ 00045 00046 /* Changed this routine so that it can handle procedure names of upto 00047 * 32 characters and also to be able to print correctly names with '_' 00048 * in it 00049 *---ravi---1/13/92 00050 */ 00051 #include "cmplrs/host.h" 00052 00053 extern void s_abort(int32); 00054 static int32 varlen(char *); 00055 00056 void 00057 s_rnge(char *varn, int32 offset, char *procn, int32 line) 00058 { 00059 register int32 i; 00060 int32 len; 00061 00062 len=varlen(procn); 00063 fprintf(stderr, 00064 "Subscript out of range on file line %d, procedure ", line); 00065 00066 /*for(i = 0 ; i < 2 && (*procn!='_' && *(procn+1) != '\0'); ++i)*/ 00067 00068 for(i = 0 ; i < len ; ++i) 00069 putc(*procn++, stderr); 00070 fprintf(stderr, 00071 ".\nAttempt to access the %d-th element of variable ", offset+1); 00072 #ifdef sgi 00073 for(i = 0; i < 32 && *varn!=' '; ++i) 00074 putc(*varn++, stderr); 00075 #else 00076 for(i = 0 ; i < 6 && *varn!=' ' ; ++i) 00077 putc(*varn++, stderr); 00078 #endif 00079 fprintf(stderr, ".\n"); 00080 s_abort(99); 00081 } 00082 00083 static int32 00084 varlen(char *s) 00085 { 00086 register int32 i; 00087 /* char name[34]; */ 00088 00089 for(i=0; i<34 && *s!=' ' && *s!='\0' ; ++i, s++); 00090 00091 return( i-1 ); 00092 }
1.5.6