35 #define XMS_SUPPORTED 1 38 #define EMS_SUPPORTED 1 42 #define JPEG_INTERNALS 50 extern char * getenv
JPP((
const char *
name));
53 #ifdef NEED_FAR_POINTERS 58 #define far_malloc(x) farmalloc(x) 59 #define far_free(x) farfree(x) 63 #define far_malloc(x) _fmalloc(x) 64 #define far_free(x) _ffree(x) 69 #define far_malloc(x) malloc(x) 70 #define far_free(x) free(x) 74 #ifdef DONT_USE_B_MODE 75 #define READ_BINARY "r" 77 #define READ_BINARY "rb" 80 #ifndef USE_MSDOS_MEMMGR 81 You forgot to define USE_MSDOS_MEMMGR
in jconfig.h.
84 #if MAX_ALLOC_CHUNK >= 65535L 99 unsigned short ax, dx, bx;
103 unsigned short ax, dx, bx;
107 extern short far jdos_open
JPP((
short far * handle,
char far *
filename));
108 extern short far jdos_close
JPP((
short handle));
109 extern short far jdos_seek
JPP((
short handle,
long offset));
110 extern short far jdos_read
JPP((
short handle,
void far *
buffer,
111 unsigned short count));
112 extern short far jdos_write
JPP((
short handle,
void far * buffer,
113 unsigned short count));
114 extern void far jxms_getdriver
JPP((XMSDRIVER far *));
115 extern void far jxms_calldriver
JPP((XMSDRIVER, XMScontext far *));
116 extern short far jems_available
JPP((
void));
117 extern void far jems_calldriver
JPP((EMScontext far *));
125 static int next_file_num;
139 if ((env = (
const char *) getenv(
"TMP")) ==
NULL)
140 if ((env = (
const char *) getenv(
"TEMP")) ==
NULL)
147 if (ptr[-1] !=
'\\' && ptr[-1] !=
'/')
151 sprintf(ptr,
"JPG%03d.TMP", next_file_num);
168 return (
void *)
malloc(sizeofobject);
203 #ifndef DEFAULT_MAX_MEM 204 #define DEFAULT_MAX_MEM 300000L 244 void FAR * buffer_address,
245 long file_offset,
long byte_count)
247 if (jdos_seek(
info->handle.file_handle, file_offset))
248 ERREXIT(cinfo, JERR_TFILE_SEEK);
250 if (byte_count > 65535L)
251 ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
252 if (jdos_read(
info->handle.file_handle, buffer_address,
253 (
unsigned short) byte_count))
254 ERREXIT(cinfo, JERR_TFILE_READ);
260 void FAR * buffer_address,
261 long file_offset,
long byte_count)
263 if (jdos_seek(
info->handle.file_handle, file_offset))
264 ERREXIT(cinfo, JERR_TFILE_SEEK);
266 if (byte_count > 65535L)
267 ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
268 if (jdos_write(
info->handle.file_handle, buffer_address,
269 (
unsigned short) byte_count))
270 ERREXIT(cinfo, JERR_TFILE_WRITE);
277 jdos_close(
info->handle.file_handle);
294 if (jdos_open((
short far *) & handle, (
char far *)
info->
temp_name)) {
299 info->handle.file_handle = handle;
329 #define ODD(X) (((X) & 1L) != 0) 334 void FAR * buffer_address,
335 long file_offset,
long byte_count)
345 spec.length = byte_count & (~ 1L);
346 spec.src_handle = info->handle.xms_handle;
347 spec.src.offset = file_offset;
349 spec.dst.ptr = buffer_address;
351 ctx.ds_si = (
void far *) & spec;
353 jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
357 if (
ODD(byte_count)) {
359 file_offset + byte_count - 1L, 2L);
360 ((
char FAR *) buffer_address)[byte_count - 1L] = endbuffer[0];
367 void FAR * buffer_address,
368 long file_offset,
long byte_count)
378 spec.length = byte_count & (~ 1L);
380 spec.src.ptr = buffer_address;
381 spec.dst_handle =
info->handle.xms_handle;
382 spec.dst.offset = file_offset;
384 ctx.ds_si = (
void far *) & spec;
386 jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
388 ERREXIT(cinfo, JERR_XMS_WRITE);
390 if (
ODD(byte_count)) {
392 file_offset + byte_count - 1L, 2L);
393 endbuffer[0] = ((
char FAR *) buffer_address)[byte_count - 1L];
395 file_offset + byte_count - 1L, 2L);
405 ctx.dx =
info->handle.xms_handle;
407 jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
408 TRACEMS1(cinfo, 1, JTRC_XMS_CLOSE,
info->handle.xms_handle);
420 jxms_getdriver((
XMSDRIVER far *) & xms_driver);
421 if (xms_driver ==
NULL)
426 jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
427 if (ctx.ax < (
unsigned short) 0x0200)
433 jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
438 info->handle.xms_handle = ctx.dx;
442 TRACEMS1(cinfo, 1, JTRC_XMS_OPEN, ctx.dx);
472 #define FIELD_AT(spec,offset,type) (*((type *) &(spec.bytes[offset]))) 473 #define SRC_TYPE(spec) FIELD_AT(spec,4,char) 474 #define SRC_HANDLE(spec) FIELD_AT(spec,5,EMSH) 475 #define SRC_OFFSET(spec) FIELD_AT(spec,7,unsigned short) 476 #define SRC_PAGE(spec) FIELD_AT(spec,9,unsigned short) 477 #define SRC_PTR(spec) FIELD_AT(spec,7,EMSPTR) 478 #define DST_TYPE(spec) FIELD_AT(spec,11,char) 479 #define DST_HANDLE(spec) FIELD_AT(spec,12,EMSH) 480 #define DST_OFFSET(spec) FIELD_AT(spec,14,unsigned short) 481 #define DST_PAGE(spec) FIELD_AT(spec,16,unsigned short) 482 #define DST_PTR(spec) FIELD_AT(spec,14,EMSPTR) 484 #define EMSPAGESIZE 16384L 486 #define HIBYTE(W) (((W) >> 8) & 0xFF) 487 #define LOBYTE(W) ((W) & 0xFF) 492 void FAR * buffer_address,
493 long file_offset,
long byte_count)
498 spec.length = byte_count;
505 DST_PTR(spec) = buffer_address;
507 ctx.ds_si = (
void far *) & spec;
509 jems_calldriver((EMScontext far *) & ctx);
517 void FAR * buffer_address,
518 long file_offset,
long byte_count)
523 spec.length = byte_count;
526 SRC_PTR(spec) = buffer_address;
532 ctx.ds_si = (
void far *) & spec;
534 jems_calldriver((EMScontext far *) & ctx);
536 ERREXIT(cinfo, JERR_EMS_WRITE);
546 ctx.dx =
info->handle.ems_handle;
547 jems_calldriver((EMScontext far *) & ctx);
548 TRACEMS1(cinfo, 1, JTRC_EMS_CLOSE,
info->handle.ems_handle);
560 if (! jems_available())
565 jems_calldriver((EMScontext far *) & ctx);
571 jems_calldriver((EMScontext far *) & ctx);
578 jems_calldriver((EMScontext far *) & ctx);
583 info->handle.ems_handle = ctx.dx;
587 TRACEMS1(cinfo, 1, JTRC_EMS_OPEN, ctx.dx);
613 ERREXITS(cinfo, JERR_TFILE_CREATE,
"");
GLenum GLuint GLenum GLsizei length
jpeg_get_small(j_common_ptr cinfo, size_t sizeofobject)
char temp_name[TEMP_NAME_LENGTH]
long long max_bytes_needed
#define ERREXIT(cinfo, code)
write_xms_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
open_ems_store(j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)
You forgot to define USE_MSDOS_MEMMGR in jconfig h MAX_ALLOC_CHUNK should be less than typedef void far * XMSDRIVER
write_ems_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
read_file_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
#define TRACEMS1(cinfo, lvl, code, p1)
read_ems_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
jpeg_mem_init(j_common_ptr cinfo)
backing_store_ptr long total_bytes_needed
#define TRACEMSS(cinfo, lvl, code, str)
close_file_store(j_common_ptr cinfo, backing_store_ptr info)
close_ems_store(j_common_ptr cinfo, backing_store_ptr info)
long long long already_allocated
open_file_store(j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)
GLuint const GLchar * name
close_xms_store(j_common_ptr cinfo, backing_store_ptr info)
jpeg_mem_term(j_common_ptr cinfo)
jpeg_open_backing_store(j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)
jpeg_mem_available(j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated)
write_file_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
jpeg_free_large(j_common_ptr cinfo, void FAR *object, size_t sizeofobject)
short far jdos_open JPP((short far *handle, char far *filename))
GLuint GLuint GLsizei count
open_xms_store(j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)
jpeg_free_small(j_common_ptr cinfo, void *object, size_t sizeofobject)
read_xms_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
jpeg_get_large(j_common_ptr cinfo, size_t sizeofobject)
#define ERREXITS(cinfo, code, str)
select_file_name(char *fname)