35#define XMS_SUPPORTED 1
38#define EMS_SUPPORTED 1
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)
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
111 unsigned short count));
113 unsigned short count));
116extern short far jems_available
JPP((
void));
147 if (
ptr[-1] !=
'\\' &&
ptr[-1] !=
'/')
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);
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);
349 spec.
dst.
ptr = buffer_address;
351 ctx.ds_si = (
void far *) & spec;
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;
384 ctx.ds_si = (
void far *) & spec;
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;
408 TRACEMS1(cinfo, 1, JTRC_XMS_CLOSE,
info->handle.xms_handle);
427 if (
ctx.ax < (
unsigned short) 0x0200)
438 info->handle.xms_handle =
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)
505 DST_PTR(spec) = buffer_address;
507 ctx.ds_si = (
void far *) & spec;
517 void FAR * buffer_address,
518 long file_offset,
long byte_count)
526 SRC_PTR(spec) = buffer_address;
532 ctx.ds_si = (
void far *) & spec;
536 ERREXIT(cinfo, JERR_EMS_WRITE);
546 ctx.dx =
info->handle.ems_handle;
548 TRACEMS1(cinfo, 1, JTRC_EMS_CLOSE,
info->handle.ems_handle);
560 if (! jems_available())
583 info->handle.ems_handle =
ctx.dx;
613 ERREXITS(cinfo, JERR_TFILE_CREATE,
"");
static unsigned char bytes[4]
static LPCWSTR LPCWSTR LPCWSTR env
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
GLuint GLuint GLsizei count
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
#define ERREXITS(cinfo, code, str)
#define TRACEMS1(cinfo, lvl, code, p1)
#define TRACEMSS(cinfo, lvl, code, str)
select_file_name(char *fname)
write_xms_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)
jpeg_get_large(j_common_ptr cinfo, size_t sizeofobject)
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)
static XMSDRIVER xms_driver
open_file_store(j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)
open_xms_store(j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)
jpeg_get_small(j_common_ptr cinfo, size_t sizeofobject)
write_ems_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
jpeg_mem_term(j_common_ptr cinfo)
You forgot to define USE_MSDOS_MEMMGR in jconfig h typedef void far * XMSDRIVER
close_ems_store(j_common_ptr cinfo, backing_store_ptr info)
open_ems_store(j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)
close_file_store(j_common_ptr cinfo, backing_store_ptr info)
read_file_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
close_xms_store(j_common_ptr cinfo, backing_store_ptr info)
jpeg_open_backing_store(j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)
write_file_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
read_ems_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
jpeg_mem_available(j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated)
jpeg_mem_init(j_common_ptr cinfo)
long long max_bytes_needed
long long long already_allocated
backing_store_ptr long total_bytes_needed
#define sprintf(buf, format,...)