File: dlldef.c

package info (click to toggle)
euler 1.61.0-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 5,164 kB
  • sloc: ansic: 24,761; sh: 8,314; makefile: 141; cpp: 47; php: 1
file content (103 lines) | stat: -rw-r--r-- 2,218 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "dlldef.h"

#include <string.h>
#include <windows.h>

int FAR PASCAL _export DllEntryPoint (HINSTANCE hInstance,
	DWORD reason, LPVOID res)
{	return TRUE;
}

header *make_header (int type, int size, char * &newram,
	char *ramend)
{	header *hd=(header *)newram;
	if (newram+size>ramend) return 0;
	hd->size=size;
	hd->type=type;
	hd->flags=0;
	*(hd->name)=0;
	hd->xor=0;
	newram+=size;
	return hd;
}

header *new_string (char *s,
	char * &newram, char *ramend)
{	int size=sizeof(header)+(strlen(s)/2+1)*2;
	header *hd=make_header(s_string,size,newram,ramend);
	if (hd) strcpy(stringof(hd),s);
	return hd;
}

header *new_real (double x,
	char * &newram, char *ramend)
{	int size=sizeof(header)+sizeof(double);
	header *hd=make_header(s_real,size,newram,ramend);
	if (hd) *realof(hd)=x;
	return hd;
}

header *new_complex (double x, double y,
	char * &newram, char *ramend)
{	int size=sizeof(header)+2*sizeof(double);
	header *hd=make_header(s_complex,size,newram,ramend);
	if (hd)
	{	realof(hd)[1]=x;
		realof(hd)[2]=y;
	}
	return hd;
}

header *new_interval (double a, double b,
	char * &newram, char *ramend)
{	int size=sizeof(header)+2*sizeof(double);
	header *hd=make_header(s_interval,size,newram,ramend);
	if (hd)
	{	realof(hd)[1]=a;
		realof(hd)[2]=b;
	}
	return hd;
}

header *new_matrix (int rows, int columns,
	char * &newram, char *ramend)
{	int size=sizeof(header)+sizeof(dims)+
		rows*columns*sizeof(double);
	header *hd=make_header(s_matrix,size,newram,ramend);
	if (hd)
	{	dimsof(hd)->c=columns;
		dimsof(hd)->r=rows;
	}
	return hd;
}

header *new_cmatrix (int rows, int columns,
	char * &newram, char *ramend)
{	int size=sizeof(header)+sizeof(dims)+
		2*rows*columns*sizeof(double);
	header *hd=make_header(s_cmatrix,size,newram,ramend);
	if (hd)
	{	dimsof(hd)->c=columns;
		dimsof(hd)->r=rows;
	}
	return hd;
}

header *new_imatrix (int rows, int columns,
	char * &newram, char *ramend)
{	int size=sizeof(header)+sizeof(dims)+
		2*rows*columns*sizeof(double);
	header *hd=make_header(s_imatrix,size,newram,ramend);
	if (hd)
	{	dimsof(hd)->c=columns;
		dimsof(hd)->r=rows;
	}
	return hd;
}

extern "C" char * _export TEST (header * p[], int np,
	char *newram, char *ramend)
{
	return newram;
}