Revision 1903

trunk/src/linad99/sgradclc.cpp (revision 1903)
8 8
  \file sgradclc.cpp
9 9
  Functions to compute gradient from the global \ref gradient_structure.
10 10
 */
11
#if !defined(DOS386)
12
  #define DOS386
13
#endif
14

  
11 15
#include "fvar.hpp"
12 16

  
13 17
#include <sys/stat.h>
......
66 70

  
67 71
#include <math.h>
68 72

  
69
#if (defined(__ZTC__) && !defined(DOS386))
73
#if defined(__ZTC__)
70 74
  void _far * _cdecl _farptr_norm(void _far *);
71 75
  void _far * _cdecl _farptr_fromlong(unsigned long);
72 76
  long _cdecl _farptr_tolong(void _far *);
......
149 153
  {
150 154
     tmp->x = 0;
151 155
#if defined (__ZTC__)
152
  #if defined(DOS386)
153
     tmp++;
154
  #else
155 156
     tmp = (double_and_int*)_farptr_norm((void*)(++tmp));
156
  #endif
157 157
#else
158 158
     tmp++;
159 159
#endif
......
241 241
  long bytes_needed=min(gradient_structure::ARR_LIST1->get_last_offset()+1,
242 242
    ARRAY_MEMBLOCK_SIZE);
243 243
  gradient_structure::save_var_file_flag=0;
244
  //#if DOS386==1
245
  #if defined(DOS386)
246
   if ( (temp_ptr = (void *) malloc(bytes_needed )) == 0)
247
  #else
248
#if !defined(_MSC_VER) && !defined (__WAT32__)
244
#ifdef __ZTC__
249 245
   if ( (temp_ptr = farmalloc(bytes_needed) ) == 0)
250 246
#else
251
   if ( (temp_ptr = malloc(bytes_needed) ) == 0)
252
#endif
247
   //if ( (temp_ptr = malloc(bytes_needed) ) == 0)
248
   if ((temp_ptr = (void *)malloc(bytes_needed)) == 0)
253 249
  #define __USE_IOSTREAM__
254
  #endif
250
#endif
255 251
   {
256 252
     gradient_structure::save_var_file_flag=1;
257 253
     cerr << "insufficient memory to allocate space for ARRAY_MEMBLOCK"
......
260 256
   if (gradient_structure::save_var_file_flag==0)
261 257
   {
262 258
     ARRAY_MEMBLOCK_SAVE = temp_ptr;
263
     #if defined(DOS386)
264
     //#if DOS386==1
265
       #ifndef USE_ASSEMBLER
259
#if defined(DOS386)
260
  #ifndef USE_ASSEMBLER
266 261
         memcpy((char*)ARRAY_MEMBLOCK_SAVE,(char*)ARRAY_MEMBLOCK_BASE,
267 262
           bytes_needed);
268
       #else
263
  #else
269 264
         dw_block_move((double*)ARRAY_MEMBLOCK_SAVE,
270 265
           (double*)ARRAY_MEMBLOCK_BASE,bytes_needed/8);
271
       #endif
272
     #else
266
  #endif
267
#else
273 268
     unsigned long int max_move=50000;
274 269
     unsigned long int left_to_move=bytes_needed;
275 270
     humungous_pointer dest = ARRAY_MEMBLOCK_SAVE;
......
282 277
       dest+=max_move;
283 278
     }
284 279
     memcpy((char*)dest,(char*)src,left_to_move);
285
    #endif
280
#endif
286 281
  }
287 282
  else
288 283
  {
289 284
     humungous_pointer src = ARRAY_MEMBLOCK_BASE;
290 285
     lseek(gradient_structure::GRAD_STACK1->_VARSSAV_PTR,0L,SEEK_SET);
291
     #if defined(DOS386)
292
     //#if DOS386==1
286
#if defined(DOS386)
293 287
       write(gradient_structure::GRAD_STACK1->_VARSSAV_PTR,
294 288
         (char*)src,bytes_needed);
295
     #else
289
#else
296 290
     unsigned long int max_move=500;
297 291
     unsigned long int left_to_move=bytes_needed;
298 292
     while(left_to_move > max_move)
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff