1: /*	gensktab.c	1.4	83/05/13	*/
   2: #include <stdio.h>
   3: #include "cpmio.h"
   4: 
   5: int skew;
   6: int *skewtab;
   7: 
   8: /*
   9:  * Generate a skew factor table in skewtab according to the
  10:  * global parameters given by skew and sectrk.
  11:  * This routine must be called before any disk (or virtual disk)
  12:  * accesses are attempted.
  13:  */
  14: 
  15: gen_sktab()
  16: {
  17: 
  18:     int *i, *j;
  19:     char    *malloc();
  20: 
  21:     if (( skewtab = (int *) malloc(sectrk*4)) == NULL) {
  22:         fprintf(stderr,
  23:             "can't allocate memory for skew sector table\n");
  24:         exit(1);
  25:     }
  26:     *skewtab = 1;
  27:     for (i=skewtab+1; i<skewtab+ sectrk; i++) {
  28:         *i = *(i-1) + skew;
  29:         if (*i > sectrk) {
  30:             *i -= sectrk;
  31: L1:
  32:             for (j=skewtab; j<i; j++) {
  33:                 if (*j == *i)
  34:                     break;
  35:             }
  36:             if (j < i ) {
  37:                 ++*i;
  38:                 goto L1;
  39:             }
  40:         }
  41:     }
  42: }

Defined functions

gen_sktab defined in line 15; used 1 times

Defined variables

skew defined in line 5; used 1 times
  • in line 28
skewtab defined in line 6; used 10 times
Last modified: 1983-06-24
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 869
Valid CSS Valid XHTML 1.0 Strict