Changeset 104


Ignore:
Timestamp:
02/24/2009 08:40:00 AM (15 years ago)
Author:
marcus
Message:
  • removed support for IBM PC (DOS)
Location:
SH_SHM/branches/marcus/source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • SH_SHM/branches/marcus/source/basecnst.h

    r103 r104  
    133133 
    134134 
    135  
    136  
    137 /****************************************************************** 
    138  ***                        IBM PC version                      *** 
    139  ******************************************************************/ 
    140  
    141  
    142  
    143 #ifdef BC_IBM 
    144  
    145 /* include files */ 
    146 #define BC_SYSBASE "d:\gast\SH\SYSBASE.H" 
    147 #define BC_SYERRORS "d:\gast\SH\SYERRORS.H" 
    148 #define BC_GCUSRDEF "d:\gast\SH\LOCAL\GCUSRDEF.H" 
    149 /* #define BC_GCERRORS "LOCAL\GCERRORS.H" */ 
    150 #define BC_FOREIGN "d:\gast\SH\SHFRGN.H" 
    151 #define BC_SHDIRS "d:\gast\SH\SHDIRS.H" 
    152 #define BC_ASCII "d:\gast\SH\ASCII.H" 
    153 #define BC_GRAPHBAS "d:\gast\SH\LOCAL\GRAPHBAS.H" 
    154 #define BC_SHCONST "d:\gast\SH\SHCONST.H" 
    155 #define BC_QFUSRDEF "d:\gast\sh\qfusrdef.h" 
    156 #define BC_QFERRORS "d:\gast\sh\qferrors.h" 
    157 #define BC_CPAR "d:\gast\util\cpar.h" 
    158 #define BC_EARTHLOC "d:\gast\sh\earthloc.h" 
    159 #define BC_UTUSRDEF "d:\gast\sh\utusrdef.h" 
    160 #define BC_GLUSRDEF "d:\gast\sh\glusrdef.h" 
    161 #define BC_INPFILES "d:\gast\util\inpfiles.h" 
    162 #define BC_DFQENTRY "d:\gast\sh\dfqentry.h" 
    163 #define BC_ERUSRDEF "d:\gast\sh\erusrdef.h" 
    164 #define BC_FLERRORS "d:\gast\sh\flerrors.h" 
    165 #define BC_READGRN "d:\gast\sh\readgrn.h" 
    166 #define BC_PTUSRDEF "d:\gast\sh\ptusrdef.h" 
    167  
    168  
    169 #endif /* BC_IBM */ 
    170  
    171  
    172  
    173135/****************************************************************** 
    174136 ***                         SUN version                        *** 
  • SH_SHM/branches/marcus/source/seed_io/steim1.h

    r16 r104  
    3737 
    3838 
    39 #ifdef IBM_PC 
    40 #define XHUGE huge 
    41 #define GM_ALLOC(NUM, SIZE) halloc(NUM, SIZE) 
    42 #define GM_FREE hfree 
    43 #else 
    4439#define XHUGE 
    4540#define GM_ALLOC(NUM, SIZE) malloc((NUM)*(SIZE)) 
    4641#define GM_FREE free 
    47 #endif 
    4842 
    4943#ifdef ANSI_EXTENSIONS 
  • SH_SHM/branches/marcus/source/shmenu0.c

    r102 r104  
    515515#               ifdef BC_SUN 
    516516                strcpy( str, "UNIX" ); 
    517 #               endif 
    518 #               ifdef BC_IBM 
    519                 strcpy( str, "MS-DOS" ); 
    520517#               endif 
    521518                sl_setsymbol( str2, str, &locstat ); 
  • SH_SHM/branches/marcus/source/sysbase.h

    r102 r104  
    4343#endif 
    4444 
    45  
    46  
    47 /****************************************************************** 
    48  ***                        IBM PC version                      *** 
    49  ******************************************************************/ 
    50  
    51  
    52  
    53 #ifdef BC_IBM 
    54  
    55  
    56  
    57 /* includes */ 
    58 #include <alloc.h> 
    59  
    60 /* short integer */ 
    61 #define BYTE unsigned char 
    62  
    63 /* boolean type */ 
    64 #define BOOLEAN int 
    65  
    66 /* boolean values TRUE & FALSE */ 
    67 #ifdef BC_DEFINE_TRUE_FALSE 
    68 #define TRUE (1) 
    69 #define FALSE (0) 
    70 #endif 
    71  
    72 /* infinite loop declaration */ 
    73 #define FOREVER for(;;) 
    74  
    75 /* status type */ 
    76 #ifndef STATUS 
    77 #define STATUS int    /* status value */ 
    78 #define Severe(s) (*(s) != 0) 
    79 #endif /* STATUS */ 
    80  
    81 /* nearest integer number to floating number */ 
    82 #define Nint(x) ((x)>0 ? (int)((x)+0.5) : (int)((x)-0.5)) 
    83 #define Nint32(x) ((x)>0 ? (int)((x)+0.5) : (int)((x)-0.5)) 
    84  
    85 /* nearest long number to floating number */ 
    86 #define Nlong(x) ((x)>0 ? (long)((x)+0.5) : (long)((x)-0.5)) 
    87  
    88 /* capitalize character */ 
    89 #define Cap(c) (((c)>='a' && (c)<='z') ? ((c)-32) : (c)) 
    90 #define Uncap(c) (((c)>='A' && (c)<='Z') ? ((c)+32) : (c)) 
    91  
    92 /* absolute value of number */ 
    93 #define Abs(x) ((x)<0?-(x):(x)) 
    94  
    95 /* binary file type, here the same as text files */ 
    96 typedef FILE *BFILE; 
    97  
    98 /* sy_findfile parameter */ 
    99 #define SYC_FF_NAME 1 
    100 #define SYC_FF_DIR 2 
    101 #define SYC_FF_EXT 4 
    102  
    103 /* deallocate memory, allocated by sy_allocmem */ 
    104 #define sy_deallocmem(p) free(p) 
    105  
    106 /* open text file */ 
    107 #define sy_fopen(f,a) fopen(f,a) 
    108  
    109 /* close text file */ 
    110 #define sy_fclose(f) fclose(f) 
    111  
    112 /* read from text file, this is not yet used */ 
    113 #define sy_fread(b,s,n,f) fread(b,s,n,f) 
    114  
    115 /* write to text file, this is not yet used */ 
    116 #define sy_fwrite(b,s,n,f) fwrite(b,s,n,f) 
    117  
    118 /* read from binary file */ 
    119 #define sy_fbread(b,s,n,f) fread(b,s,n,f) 
    120  
    121 /* write to binary file */ 
    122 #define sy_fbwrite(b,s,n,f) fwrite(b,s,n,f) 
    123  
    124 /* seek on binary file */ 
    125 #define sy_fbseek(f,p,m) fseek(f,p,m) 
    126  
    127 /* open binary file */ 
    128 #define sy_fbopen(f,a) fopen(f,a) 
    129  
    130 /* close binary file */ 
    131 #define sy_fbclose(f) fclose(f) 
    132  
    133 /* binary file operation failed */ 
    134 #define sy_fbfailed(f) ((f)==NULL) 
    135  
    136 /* routine doing machine dependend things, not used here */ 
    137 #define sy_localinf(a,b,c) 
    138  
    139 /* call operating system */ 
    140 #define sy_system(c,s) system(c) 
    141  
    142 /* delete file */ 
    143 #define sy_fdelete(f) unlink(f) 
    144  
    145 /* rename file */ 
    146 #define sy_frename(f,t) rename(f,t) 
    147  
    148 /* get time differences in sec, not implemented here */ 
    149 #define sy_difftime() 1.0 
    150  
    151 /* system constants */ 
    152 /* ---------------- */ 
    153  
    154 /* maximum unsigned */ 
    155 #define SYC_MAXUNSG 0xffffffffL 
    156  
    157 /* maximum integer */ 
    158 #define SYC_MAXINT 0x7fffffffL 
    159  
    160 /* minimum integer */ 
    161 #define SYC_MININT 0x80000000L 
    162  
    163 /* maximum long */ 
    164 #define SYC_MAXLONG 0x7fffffffL 
    165  
    166 /* minimum long */ 
    167 #define SYC_MINLONG 0x80000000L 
    168  
    169 /* open existing file to overwrite, not yet used */ 
    170 #define SYC_OPEN_OVWR "r+" 
    171  
    172 /* system specific types */ 
    173 /* --------------------- */ 
    174  
    175 /* difference time, to measure difference times */ 
    176 typedef float DIFFTIME; 
    177  
    178  
    179 #define sy_alert(t) printf("%s",t) 
    180 #define sy_debuginfo(l) 
    181 #define sy_initprocess() 
    182 #define sy_sharecpu() 
    183 #define sy_gettime(t) 
    184 #define sy_getmessage() NULL 
    185  
    186  
    187 /*------------------------------------------------------------------------*/ 
    188 /*    prototypes of routines of module SYSCALL.C                          */ 
    189 /*------------------------------------------------------------------------*/ 
    190  
    191  
    192 void *sy_allocmem( long cnt, int size, STATUS *status ); 
    193  
    194 /* allocates memory ("cnt" objects of size "size) 
    195  * 
    196  * parameters of routine 
    197  * long     cnt;            input; number of objects 
    198  * int      size;           input; size of each object 
    199  * STATUS   *status;        output; return status 
    200  */ 
    201  
    202  
    203 /*------------------------------------------------------------------------*/ 
    204  
    205  
    206 void sy_findfile( int request, char wild[], char filename[] ); 
    207  
    208 /* looks for files matching wild card string "wild". Returns filename of 
    209  * file found or "\0" if not found.  "request" controls the returned 
    210  * elements.  For example the value (SYC_FF_DIR|SYC_FF_NAME|SYC_FF_EXT) 
    211  * means, that the returned string contains directory, file name and 
    212  * extension. 
    213  * 
    214  * parameters of routine 
    215  * int      request;        input; what elements (name,dir,extension) 
    216  * char     *wild;          input; wild card string 
    217  * char     *filename;      output; next file found 
    218  */ 
    219  
    220  
    221 /*------------------------------------------------------------------------*/ 
    222  
    223  
    224 double sy_random( double ampl ); 
    225  
    226 /* creates random number with absolute value less than (or equal to) 
    227  * "amp" 
    228  * 
    229  * parameters of routine 
    230  * double               ampl;           input; max. amplitude; if zero, a new random 
    231  *                                                                       series is started 
    232  */ 
    233  
    234  
    235 /*------------------------------------------------------------------------*/ 
    236  
    237  
    238 void sy_randomstr( int lth, char str[] ); 
    239  
    240 /* creates random string of length "lth" 
    241  * 
    242  * parameters of routine 
    243  * int        lth;      input; length of output string 
    244  * char       str[];    output; random string 
    245  */ 
    246  
    247  
    248 /*------------------------------------------------------------------------*/ 
    249  
    250  
    251  
    252 #endif /* BC_IBM */ 
    253  
    254  
    255  
    25645/****************************************************************** 
    25746 ***                         SUN version                        *** 
    25847 ******************************************************************/ 
    25948 
    260  
    261  
    26249#ifdef BC_SUN 
    263  
    264  
    26550 
    26651/* short integer */ 
  • SH_SHM/branches/marcus/source/syscall.c

    r102 r104  
    3636#include "basecnst.h" 
    3737 
    38  
    39  
    40 /****************************************************************** 
    41  ***                        IBM PC version                      *** 
    42  ******************************************************************/ 
    43  
    44  
    45  
    46 #ifdef BC_IBM 
    47  
    48  
    49  
    50 #include <stdio.h> 
    51 #include <string.h> 
    52 #include <time.h> 
    53 #include <stdlib.h> 
    54 #include "sysbase.h" 
    55 #include "syerrors.h" 
    56 #include "shvars.h" 
    57  
    58 #define MAXFFCMDLTH 300 
    59  
    60 /*------------------------------------------------------------------------*/ 
    61  
    62  
    63  
    64 void *sy_allocmem( long cnt, int size, STATUS *status ) 
    65  
    66 /* allocates memory ("cnt" objects of size "size) 
    67  * 
    68  * parameters of routine 
    69  * long     cnt;            input; number of objects 
    70  * int      size;           input; size of each object 
    71  * STATUS   *status;        output; return status 
    72  */ 
    73 { 
    74         /* local variables */ 
    75         void     *ptr;     /* pointer to allocated memory */ 
    76  
    77         /* executable code */ 
    78  
    79         ptr = (void *)malloc( cnt*size ); 
    80         if  (ptr == NULL)  *status = SYE_MEMOVFL; 
    81         return ptr; 
    82  
    83 } /* end of sy_allocmem */ 
    84  
    85  
    86  
    87 /*------------------------------------------------------------------------*/ 
    88  
    89  
    90  
    91 void sy_findfile( int request, char wild[], char filename[] ) 
    92  
    93 /* looks for files matching wild card string "wild". Returns filename of 
    94  * file found (with/without directory and/or extension, depending on "request") or 
    95  * "\0" if not found. 
    96  * 
    97  * parameters of routine 
    98  * int      request;        input; what elements (name,dir,ext) 
    99  * char     *wild;          input; wild card string 
    100  * char     *filename;      output; next file found 
    101  */ 
    102 { 
    103         /* local variables */ 
    104         static char   currwild[BC_FILELTH+1];  /* current wild card string */ 
    105         static char   dirfile[BC_FILELTH+1];   /* output filename */ 
    106         static char   errfile[BC_FILELTH+1];   /* error output filename */ 
    107         static FILE   *df;                     /* directory file */ 
    108         char          cmd[MAXFFCMDLTH+1];    /* command string */ 
    109         int           filpos;                  /* position of file name */ 
    110         int           extpos;                  /* position of extension */ 
    111         char          *c;                      /* moving pointer */ 
    112  
    113         /* executable code */ 
    114  
    115         if  (*dirfile == '\0')  { 
    116                 strcpy( dirfile, shd_scratch ); 
    117                 strcat( dirfile, id_shv ); 
    118                 strcpy( errfile, dirfile ); 
    119                 strcat( dirfile, "DIR.TMP" ); 
    120                 strcat( errfile, "ERR.TMP" ); 
    121         } /*endif*/ 
    122  
    123         if  (*wild == '\0')  { 
    124                 *currwild = '\0'; 
    125                 if  (df != NULL)  fclose( df ); 
    126                 df = NULL; 
    127                 return; 
    128         } /*endif*/ 
    129  
    130         if  (strcmp(currwild,wild) != 0)  {  /* new wild card string */ 
    131                 if  (df != NULL)  fclose( df ); 
    132                 strcpy( currwild, wild ); 
    133                 strcpy( cmd, "dir " ); 
    134                 strcat( cmd, wild ); 
    135                 strcat( cmd, " >" ); 
    136                 strcat( cmd, dirfile ); 
    137                 strcat( cmd, " 2>" ); 
    138                 strcat( cmd, errfile ); 
    139                 system( cmd ); 
    140                 df = fopen( dirfile, "r" ); 
    141                 if  (df == NULL)  { 
    142                         *currwild = '\0'; 
    143                         *filename = '\0'; 
    144                         return; 
    145                 } /*endif*/ 
    146         } /*endif*/ 
    147  
    148         if  (fgets(filename,BC_FILELTH,df) == NULL) { 
    149                 if  (df != NULL)  fclose( df ); 
    150                 *currwild = '\0'; 
    151                 *filename = '\0'; 
    152                 return; 
    153         } /*endif*/ 
    154  
    155         filpos = strlen( filename ) - 1; 
    156         if  (filename[filpos] == '\n')  filename[filpos] = '\0'; 
    157  
    158         if  (request == (SYC_FF_NAME|SYC_FF_EXT|SYC_FF_DIR))  return; 
    159  
    160         filpos = extpos = 0; 
    161         c = filename; 
    162         while  (*c != '\0')  { 
    163                 if  (*c == '.')  { 
    164                         extpos = c-filename; 
    165                 } else if (*c == '\\')  { 
    166                         filpos = c-filename; 
    167                 } /*endif*/ 
    168                 c++; 
    169         } /*endwhile*/ 
    170  
    171         if  (!(SYC_FF_EXT & request)  &&  extpos > 0) 
    172                 filename[extpos] = '\0'; 
    173  
    174         if  (!(SYC_FF_DIR & request)  &&  filpos > 0) 
    175                 strcpy( filename, filename+filpos+1 ); 
    176  
    177 } /* end of sy_findfile */ 
    178  
    179  
    180  
    181 /*------------------------------------------------------------------------*/ 
    182  
    183  
    184  
    185 double sy_random( double ampl ) 
    186  
    187 /* creates random number with absolute value less than (or equal to) 
    188  * "amp" 
    189  * 
    190  * parameters of routine 
    191  * double      ampl;      input; max. amplitude; if zero, a new random 
    192  *                               series is started 
    193  */ 
    194 { 
    195         /* local constants */ 
    196 #       define MAXRAND 32767.0 
    197  
    198         /* local variables */ 
    199         int      rdm;         /* integer random result */ 
    200  
    201         /* executable code */ 
    202  
    203         if  (ampl == 0.0)  { 
    204                 srand( (unsigned)clock() ); 
    205                 return 0.0; 
    206         } else { 
    207                 rdm = rand(); 
    208                 return  ( (((double)rdm * 2.0) / MAXRAND - 1.0) * ampl ); 
    209         } /*endif*/ 
    210  
    211 } /* end of sy_random */ 
    212  
    213  
    214  
    215 /*------------------------------------------------------------------------*/ 
    216  
    217  
    218  
    219 void sy_randomstr( int lth, char str[] ) 
    220  
    221 /* creates random string of length "lth" 
    222  * 
    223  * parameters of routine 
    224  * int        lth;      input; length of output string 
    225  * char       str[];    output; random string 
    226  */ 
    227 { 
    228 #ifdef XXX 
    229         /* local variables */ 
    230         time_t  timev;      /* current time */ 
    231         struct tms ts; 
    232         char     minstr[6]; /* minimum length string */ 
    233         int      i;         /* counter */ 
    234  
    235         /* executable code */ 
    236  
    237         if  (lth < 3)  { 
    238                 *str = '\0'; 
    239                 return; 
    240         } /*endif*/ 
    241         *str++ = '_'; 
    242         lth -= 2; 
    243  
    244         times(&ts); 
    245         timev = ts.tms_utime; 
    246         timev %= 10000; 
    247         sprintf( minstr, "%04d", timev ); 
    248         if  (lth < 4)  { 
    249                 for  (i=0;i<lth;i++) 
    250                         str[i] = minstr[i]; 
    251         } else { 
    252                 strcpy( str, minstr ); 
    253                 for  (i=4; i<lth; i++) 
    254                         str[i] = '0'; 
    255         } /*endif*/ 
    256         str[lth] = '_'; 
    257         str[lth+1] = '\0'; 
    258 #endif /* XXX */ 
    259         strncpy( str, "XXXXXXXXXXX", lth ); str[lth] = '\0'; 
    260 } /* end of sy_randomstr */ 
    261  
    262  
    263  
    264 /*------------------------------------------------------------------------*/ 
    265  
    266  
    267  
    268 #endif /* BC_IBM */ 
    26938 
    27039 
Note: See TracChangeset for help on using the changeset viewer.