s_rnge.c 759 B

1234567891011121314151617181920212223242526272829303132
  1. #include "stdio.h"
  2. #include "f2c.h"
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /* called when a subscript is out of range */
  7. #ifdef KR_headers
  8. extern VOID sig_die();
  9. integer s_rnge(varn, offset, procn, line) char *varn, *procn; ftnint offset, line;
  10. #else
  11. extern VOID sig_die(const char*,int);
  12. integer s_rnge(char *varn, ftnint offset, char *procn, ftnint line)
  13. #endif
  14. {
  15. register int i;
  16. fprintf(stderr, "Subscript out of range on file line %ld, procedure ",
  17. (long)line);
  18. while((i = *procn) && i != '_' && i != ' ')
  19. putc(*procn++, stderr);
  20. fprintf(stderr, ".\nAttempt to access the %ld-th element of variable ",
  21. (long)offset+1);
  22. while((i = *varn) && i != ' ')
  23. putc(*varn++, stderr);
  24. sig_die(".", 1);
  25. return 0; /* not reached */
  26. }
  27. #ifdef __cplusplus
  28. }
  29. #endif