aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-11-01 10:27:02 +0000
committerRichard M. Stallman1994-11-01 10:27:02 +0000
commit95ed00257adf283a2740cb3e4feb83c075620ef8 (patch)
tree8e82b5c8eae9e2d8d991c77cd52b06285be9b5c9 /src
parentb0bfea296d4127efcfe8da3f2dfdddb7324e57ee (diff)
downloademacs-95ed00257adf283a2740cb3e4feb83c075620ef8.tar.gz
emacs-95ed00257adf283a2740cb3e4feb83c075620ef8.zip
Initial revision
Diffstat (limited to 'src')
-rw-r--r--src/makefile.nt940
-rw-r--r--src/s/ms-w32.h264
-rw-r--r--src/w32.c610
-rw-r--r--src/w32.h50
-rw-r--r--src/w32heap.c198
-rw-r--r--src/w32heap.h72
6 files changed, 2134 insertions, 0 deletions
diff --git a/src/makefile.nt b/src/makefile.nt
new file mode 100644
index 00000000000..ade4184e5b4
--- /dev/null
+++ b/src/makefile.nt
@@ -0,0 +1,940 @@
1# Makefile for GNU Emacs on Windows NT
2# Copyright (c) 1992, 1993, 1994 Free Software Foundation, Inc.
3# Tim Fleehart (apollo@online.com)
4# Geoff Voelker (voelker@cs.washington.edu)
5#
6# This file is part of GNU Emacs.
7#
8# GNU Emacs is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2, or (at your option)
11# any later version.
12#
13# GNU Emacs is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with GNU Emacs; see the file COPYING. If not, write to
20# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21#
22
23#
24# Sets up the system dependent macros.
25#
26!include ..\nt\makefile.def
27
28#
29# HAVE_CONFIG_H is required by some generic gnu sources stuck into
30# the emacs source tree.
31#
32LOCAL_FLAGS = -Demacs=1 -DWINDOWSNT -DDOS_NT -DHAVE_CONFIG_H -I..\nt\inc -Zi
33
34EMACS = $(BLD)\emacs.exe
35TEMACS = $(BLD)\temacs.exe
36TLIB = $(BLD)\temacs.lib
37TOBJ = $(BLD)\emacs.obj
38
39LINK_FLAGS = $(ARCH_LDFLAGS) -stack:0x1000000 -base:0xD00000 -debug:full -debugtype:cv -machine:$(ARCH) -subsystem:console -entry:_start
40
41# -debug:PARTIAL -debugtype:COFF
42
43#
44# Split up the objects into two sets so that we don't run out of
45# command line space when we link them into a library.
46#
47OBJ1 = $(BLD)\abbrev.obj \
48 $(BLD)\alloc.obj \
49 $(BLD)\alloca.obj \
50 $(BLD)\buffer.obj \
51 $(BLD)\bytecode.obj \
52 $(BLD)\callint.obj \
53 $(BLD)\callproc.obj \
54 $(BLD)\casefiddle.obj \
55 $(BLD)\cm.obj \
56 $(BLD)\cmds.obj \
57 $(BLD)\data.obj \
58 $(BLD)\dired.obj \
59 $(BLD)\dispnew.obj \
60 $(BLD)\doc.obj \
61 $(BLD)\doprnt.obj \
62 $(BLD)\editfns.obj \
63 $(BLD)\eval.obj \
64 $(BLD)\fileio.obj \
65 $(BLD)\filelock.obj \
66 $(BLD)\filemode.obj \
67 $(BLD)\fns.obj \
68 $(BLD)\indent.obj \
69 $(BLD)\insdel.obj \
70 $(BLD)\keyboard.obj \
71 $(BLD)\keymap.obj \
72 $(BLD)\lastfile.obj \
73 $(BLD)\lread.obj \
74 $(BLD)\macros.obj \
75 $(BLD)\marker.obj \
76 $(BLD)\minibuf.obj \
77 $(BLD)\xfaces.obj \
78 $(BLD)\mocklisp.obj
79
80OBJ2 = $(BLD)\nt.obj \
81 $(BLD)\ntheap.obj \
82 $(BLD)\ntinevt.obj \
83 $(BLD)\ntproc.obj \
84 $(BLD)\ntterm.obj \
85 $(BLD)\print.obj \
86 $(BLD)\process.obj \
87 $(BLD)\regex.obj \
88 $(BLD)\scroll.obj \
89 $(BLD)\search.obj \
90 $(BLD)\syntax.obj \
91 $(BLD)\sysdep.obj \
92 $(BLD)\term.obj \
93 $(BLD)\termcap.obj \
94 $(BLD)\tparam.obj \
95 $(BLD)\undo.obj \
96 $(BLD)\unexnt.obj \
97 $(BLD)\window.obj \
98 $(BLD)\xdisp.obj \
99 $(BLD)\casetab.obj \
100 $(BLD)\floatfns.obj \
101 $(BLD)\frame.obj \
102 $(BLD)\gmalloc.obj \
103 $(BLD)\intervals.obj \
104 $(BLD)\ralloc.obj \
105 $(BLD)\textprop.obj \
106 $(BLD)\vm-limit.obj
107
108LIBS = $(TLIB) \
109 $(SYS_LIB_DIR)\setargv.obj \
110 $(SYS_LIB_DIR)\kernel32.lib \
111 $(SYS_LIB_DIR)\advapi32.lib \
112 $(SYS_LIB_DIR)\libc.lib
113
114#
115# Build the executable and dump it.
116#
117all: $(BLD) $(EMACS)
118
119#
120# Headers we would preprocess if we could.
121#
122PREPARED_HEADERS = config.h paths.h
123config.h: ..\nt\src\config.h
124 cp ..\nt\src\config.h config.h
125paths.h: ..\nt\src\paths.h
126 cp ..\nt\src\paths.h paths.h
127
128#
129# The dumped executable
130#
131emacs: $(EMACS)
132$(EMACS): $(PREPARED_HEADERS) $(TEMACS)
133 cd $(BLD)
134 temacs.exe -batch -l loadup dump
135 cd ..\..
136
137#
138# The undumped executable
139#
140temacs: $(BLD) $(TEMACS)
141$(TEMACS): $(LIBS) $(TOBJ)
142 $(LINK) -out:$(TEMACS) $(LINK_FLAGS) $(TOBJ) $(LIBS)
143
144#
145# Build the library. Split up the build into two phases...otherwise we
146# run out of command line space.
147#
148$(TLIB): $(OBJ1) $(OBJ2)
149 @- $(AR) -out:$(TLIB) $(OBJ1)
150 @- $(AR) -out:$(TLIB) $(TLIB) $(OBJ2)
151
152#
153# Object files.
154#
155.c{$(BLD)}.obj:
156 $(CC) $(CFLAGS) -Fo$@ $<
157
158#
159# Assuming INSTALL_DIR is defined, build and install emacs in it.
160#
161install: all
162 - mkdir $(INSTALL_DIR)\bin
163 $(CP) $(EMACS) $(INSTALL_DIR)\bin
164
165#
166# Maintenance
167#
168clean:; - del /q *~
169 - delnode /q deleted
170 - delnode /q obj
171
172#
173# These files are the ones that compile conditionally on CANNOT_DUMP...
174# this target is mostly used for debugging.
175#
176cleandump:; cd $(BLD) && - del callproc.obj data.obj dispnew.obj doc.obj editfns.obj emacs.obj lread.obj process.obj sysdep.obj term.obj ntheap.obj unexnt.obj
177
178
179### DEPENDENCIES ###
180
181EMACS_ROOT = ..
182SRC = .
183
184$(BLD)\abbrev.obj : \
185 $(SRC)\abbrev.c \
186 $(EMACS_ROOT)\src\s\s-windowsnt.h \
187 $(EMACS_ROOT)\src\m\m-windowsnt.h \
188 $(EMACS_ROOT)\src\config.h \
189 $(SRC)\lisp.h \
190 $(SRC)\commands.h \
191 $(SRC)\buffer.h \
192 $(SRC)\window.h
193
194$(BLD)\alloc.obj : \
195 $(SRC)\alloc.c \
196 $(EMACS_ROOT)\src\s\s-windowsnt.h \
197 $(EMACS_ROOT)\src\m\m-windowsnt.h \
198 $(EMACS_ROOT)\src\config.h \
199 $(SRC)\lisp.h \
200 $(SRC)\dispextern.h \
201 $(SRC)\intervals.h \
202 $(SRC)\puresize.h \
203 $(SRC)\buffer.h \
204 $(SRC)\window.h \
205 $(SRC)\frame.h \
206 $(SRC)\blockinput.h \
207 $(SRC)\syssignal.h
208
209$(BLD)\alloca.obj : \
210 $(SRC)\alloca.c \
211 $(EMACS_ROOT)\src\s\s-windowsnt.h \
212 $(EMACS_ROOT)\src\m\m-windowsnt.h \
213 $(EMACS_ROOT)\src\config.h \
214 $(SRC)\s\s-windowsnt.h \
215 $(SRC)\m\m-windowsnt.h \
216 $(SRC)\config.h \
217 $(SRC)\blockinput.h
218
219$(BLD)\buffer.obj : \
220 $(SRC)\buffer.c \
221 $(EMACS_ROOT)\nt\inc\sys\param.h \
222 $(EMACS_ROOT)\src\s\s-windowsnt.h \
223 $(EMACS_ROOT)\src\m\m-windowsnt.h \
224 $(EMACS_ROOT)\src\config.h \
225 $(SRC)\lisp.h \
226 $(SRC)\dispextern.h \
227 $(SRC)\intervals.h \
228 $(SRC)\window.h \
229 $(SRC)\commands.h \
230 $(SRC)\buffer.h \
231 $(SRC)\indent.h \
232 $(SRC)\blockinput.h
233
234$(BLD)\bytecode.obj : \
235 $(SRC)\bytecode.c \
236 $(SRC)\lisp.h \
237 $(SRC)\buffer.h \
238 $(SRC)\syntax.h
239
240$(BLD)\callint.obj : \
241 $(SRC)\callint.c \
242 $(SRC)\lisp.h \
243 $(SRC)\buffer.h \
244 $(SRC)\commands.h \
245 $(SRC)\keyboard.h \
246 $(SRC)\window.h \
247 $(SRC)\mocklisp.h
248
249$(BLD)\callproc.obj : \
250 $(SRC)\callproc.c \
251 $(EMACS_ROOT)\src\s\s-windowsnt.h \
252 $(EMACS_ROOT)\src\m\m-windowsnt.h \
253 $(EMACS_ROOT)\src\config.h \
254 $(SRC)\msdos.h \
255 $(EMACS_ROOT)\nt\inc\sys\param.h \
256 $(SRC)\lisp.h \
257 $(SRC)\commands.h \
258 $(SRC)\buffer.h \
259 $(SRC)\process.h \
260 $(SRC)\syssignal.h \
261 $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
262 $(EMACS_ROOT)\nt\inc\sys\file.h \
263 $(SRC)\systty.h
264
265$(BLD)\casefiddle.obj : \
266 $(SRC)\casefiddle.c \
267 $(EMACS_ROOT)\src\s\s-windowsnt.h \
268 $(EMACS_ROOT)\src\m\m-windowsnt.h \
269 $(EMACS_ROOT)\src\config.h \
270 $(SRC)\lisp.h \
271 $(SRC)\buffer.h \
272 $(SRC)\commands.h \
273 $(SRC)\syntax.h
274 $(CC) $(CFLAGS) -Fo$@ casefiddle.c
275
276$(BLD)\casetab.obj : \
277 $(SRC)\casetab.c \
278 $(EMACS_ROOT)\src\s\s-windowsnt.h \
279 $(EMACS_ROOT)\src\m\m-windowsnt.h \
280 $(EMACS_ROOT)\src\config.h \
281 $(SRC)\lisp.h \
282 $(SRC)\buffer.h
283
284$(BLD)\cm.obj : \
285 $(SRC)\cm.c \
286 $(EMACS_ROOT)\src\s\s-windowsnt.h \
287 $(EMACS_ROOT)\src\m\m-windowsnt.h \
288 $(EMACS_ROOT)\src\config.h \
289 $(SRC)\cm.h \
290 $(SRC)\termhooks.h
291
292$(BLD)\cmds.obj : \
293 $(SRC)\cmds.c \
294 $(EMACS_ROOT)\src\s\s-windowsnt.h \
295 $(EMACS_ROOT)\src\m\m-windowsnt.h \
296 $(EMACS_ROOT)\src\config.h \
297 $(SRC)\lisp.h \
298 $(SRC)\commands.h \
299 $(SRC)\buffer.h \
300 $(SRC)\syntax.h
301
302$(BLD)\data.obj : \
303 $(SRC)\data.c \
304 $(EMACS_ROOT)\src\s\s-windowsnt.h \
305 $(EMACS_ROOT)\src\m\m-windowsnt.h \
306 $(EMACS_ROOT)\src\config.h \
307 $(SRC)\lisp.h \
308 $(SRC)\puresize.h \
309 $(SRC)\buffer.h \
310 $(SRC)\syssignal.h
311
312$(BLD)\dired.obj : \
313 $(SRC)\dired.c \
314 $(EMACS_ROOT)\src\s\s-windowsnt.h \
315 $(EMACS_ROOT)\src\m\m-windowsnt.h \
316 $(EMACS_ROOT)\src\config.h \
317 $(SRC)\vmsdir.h \
318 $(SRC)\ndir.h \
319 $(SRC)\lisp.h \
320 $(SRC)\buffer.h \
321 $(SRC)\commands.h \
322 $(SRC)\regex.h
323
324$(BLD)\dispnew.obj : \
325 $(SRC)\dispnew.c \
326 $(EMACS_ROOT)\src\s\s-windowsnt.h \
327 $(EMACS_ROOT)\src\m\m-windowsnt.h \
328 $(EMACS_ROOT)\src\config.h \
329 $(SRC)\lisp.h \
330 $(SRC)\termchar.h \
331 $(SRC)\termopts.h \
332 $(SRC)\termhooks.h \
333 $(SRC)\cm.h \
334 $(SRC)\buffer.h \
335 $(SRC)\frame.h \
336 $(SRC)\window.h \
337 $(SRC)\commands.h \
338 $(SRC)\disptab.h \
339 $(SRC)\indent.h \
340 $(SRC)\dispextern.h \
341 $(SRC)\intervals.h \
342 $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
343 $(EMACS_ROOT)\nt\inc\sys\file.h \
344 $(SRC)\systty.h \
345 $(SRC)\xterm.h \
346 $(SRC)\vmstime.h \
347 $(SRC)\systime.h
348
349$(BLD)\doc.obj : \
350 $(SRC)\doc.c \
351 $(EMACS_ROOT)\src\s\s-windowsnt.h \
352 $(EMACS_ROOT)\src\m\m-windowsnt.h \
353 $(EMACS_ROOT)\src\config.h \
354 $(EMACS_ROOT)\nt\inc\sys\file.h \
355 $(SRC)\lisp.h \
356 $(SRC)\buffer.h \
357 $(SRC)\keyboard.h
358
359$(BLD)\doprnt.obj : \
360 $(SRC)\doprnt.c \
361 $(EMACS_ROOT)\src\s\s-windowsnt.h \
362 $(EMACS_ROOT)\src\m\m-windowsnt.h \
363 $(EMACS_ROOT)\src\config.h
364
365$(BLD)\dosfns.obj : \
366 $(SRC)\dosfns.c \
367 $(EMACS_ROOT)\src\s\s-windowsnt.h \
368 $(EMACS_ROOT)\src\m\m-windowsnt.h \
369 $(EMACS_ROOT)\src\config.h \
370 $(SRC)\lisp.h \
371 $(SRC)\buffer.h \
372 $(SRC)\termchar.h \
373 $(SRC)\termhooks.h \
374 $(SRC)\frame.h \
375 $(SRC)\dosfns.h \
376 $(SRC)\msdos.h
377
378$(BLD)\editfns.obj : \
379 $(SRC)\editfns.c \
380 $(EMACS_ROOT)\src\s\s-windowsnt.h \
381 $(EMACS_ROOT)\src\m\m-windowsnt.h \
382 $(EMACS_ROOT)\src\config.h \
383 $(SRC)\uaf.h \
384 $(SRC)\vms-pwd.h \
385 $(EMACS_ROOT)\nt\inc\pwd.h \
386 $(SRC)\lisp.h \
387 $(SRC)\dispextern.h \
388 $(SRC)\intervals.h \
389 $(SRC)\buffer.h \
390 $(SRC)\window.h \
391 $(SRC)\vmstime.h \
392 $(SRC)\systime.h
393
394$(BLD)\emacs.obj : \
395 $(SRC)\emacs.c \
396 $(EMACS_ROOT)\src\s\s-windowsnt.h \
397 $(EMACS_ROOT)\src\m\m-windowsnt.h \
398 $(EMACS_ROOT)\src\config.h \
399 $(SRC)\lisp.h \
400 $(SRC)\commands.h \
401 $(SRC)\dispextern.h \
402 $(SRC)\intervals.h \
403 $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
404 $(EMACS_ROOT)\nt\inc\sys\file.h \
405 $(SRC)\systty.h \
406 $(SRC)\syssignal.h \
407 $(SRC)\process.h
408
409$(BLD)\eval.obj : \
410 $(SRC)\eval.c \
411 $(EMACS_ROOT)\src\s\s-windowsnt.h \
412 $(EMACS_ROOT)\src\m\m-windowsnt.h \
413 $(EMACS_ROOT)\src\config.h \
414 $(SRC)\lisp.h \
415 $(SRC)\blockinput.h \
416 $(SRC)\commands.h \
417 $(SRC)\keyboard.h
418
419$(BLD)\fileio.obj : \
420 $(SRC)\fileio.c \
421 $(EMACS_ROOT)\src\s\s-windowsnt.h \
422 $(EMACS_ROOT)\src\m\m-windowsnt.h \
423 $(EMACS_ROOT)\src\config.h \
424 $(SRC)\uaf.h \
425 $(SRC)\vms-pwd.h \
426 $(EMACS_ROOT)\nt\inc\pwd.h \
427 $(SRC)\msdos.h \
428 $(EMACS_ROOT)\nt\inc\sys\param.h \
429 $(SRC)\vmsdir.h \
430 $(SRC)\lisp.h \
431 $(SRC)\dispextern.h \
432 $(SRC)\intervals.h \
433 $(SRC)\buffer.h \
434 $(SRC)\window.h \
435 $(EMACS_ROOT)\nt\inc\sys\file.h \
436 $(SRC)\vmstime.h \
437 $(SRC)\systime.h
438
439$(BLD)\filelock.obj : \
440 $(SRC)\filelock.c \
441 $(EMACS_ROOT)\src\s\s-windowsnt.h \
442 $(EMACS_ROOT)\src\m\m-windowsnt.h \
443 $(EMACS_ROOT)\src\config.h \
444 $(SRC)\uaf.h \
445 $(SRC)\vms-pwd.h \
446 $(EMACS_ROOT)\nt\inc\pwd.h \
447 $(EMACS_ROOT)\nt\inc\sys\file.h \
448 $(SRC)\lisp.h \
449 $(EMACS_ROOT)\src\paths.h \
450 $(SRC)\buffer.h \
451 $(SRC)\vmsdir.h \
452 $(SRC)\ndir.h
453
454$(BLD)\filemode.obj : \
455 $(SRC)\filemode.c \
456 $(EMACS_ROOT)\src\s\s-windowsnt.h \
457 $(EMACS_ROOT)\src\m\m-windowsnt.h \
458 $(EMACS_ROOT)\src\config.h \
459 $(SRC)\s\s-windowsnt.h \
460 $(SRC)\m\m-windowsnt.h \
461 $(SRC)\config.h
462
463$(BLD)\floatfns.obj : \
464 $(SRC)\floatfns.c \
465 $(EMACS_ROOT)\src\s\s-windowsnt.h \
466 $(EMACS_ROOT)\src\m\m-windowsnt.h \
467 $(EMACS_ROOT)\src\config.h \
468 $(SRC)\lisp.h \
469 $(SRC)\syssignal.h
470
471$(BLD)\fns.obj : \
472 $(SRC)\fns.c \
473 $(EMACS_ROOT)\src\s\s-windowsnt.h \
474 $(EMACS_ROOT)\src\m\m-windowsnt.h \
475 $(EMACS_ROOT)\src\config.h \
476 $(SRC)\lisp.h \
477 $(SRC)\commands.h \
478 $(SRC)\buffer.h \
479 $(SRC)\keyboard.h \
480 $(SRC)\dispextern.h \
481 $(SRC)\intervals.h
482
483$(BLD)\frame.obj : \
484 $(SRC)\frame.c \
485 $(EMACS_ROOT)\src\s\s-windowsnt.h \
486 $(EMACS_ROOT)\src\m\m-windowsnt.h \
487 $(EMACS_ROOT)\src\config.h \
488 $(SRC)\lisp.h \
489 $(SRC)\frame.h \
490 $(SRC)\termhooks.h \
491 $(SRC)\window.h \
492 $(SRC)\buffer.h \
493 $(SRC)\commands.h \
494 $(SRC)\keyboard.h
495
496$(BLD)\getloadavg.obj : \
497 $(SRC)\getloadavg.c \
498 $(EMACS_ROOT)\nt\inc\sys\param.h \
499 $(EMACS_ROOT)\src\s\s-windowsnt.h \
500 $(EMACS_ROOT)\src\m\m-windowsnt.h \
501 $(EMACS_ROOT)\src\config.h \
502 $(SRC)\s\s-windowsnt.h \
503 $(SRC)\m\m-windowsnt.h \
504 $(SRC)\config.h \
505 $(EMACS_ROOT)\nt\inc\sys\file.h
506
507$(BLD)\gmalloc.obj : \
508 $(SRC)\gmalloc.c \
509 $(EMACS_ROOT)\src\s\s-windowsnt.h \
510 $(EMACS_ROOT)\src\m\m-windowsnt.h \
511 $(EMACS_ROOT)\src\config.h \
512 $(EMACS_ROOT)\nt\inc\sys\param.h \
513 $(SRC)\getpagesize.h
514 $(CC) $(CFLAGS) -D__STDC__ -Fo$@ gmalloc.c
515
516$(BLD)\hftctl.obj : \
517 $(SRC)\hftctl.c \
518 $(EMACS_ROOT)\src\s\s-windowsnt.h \
519 $(EMACS_ROOT)\src\m\m-windowsnt.h \
520 $(EMACS_ROOT)\src\config.h \
521 $(EMACS_ROOT)\nt\inc\sys\ioctl.h
522
523$(BLD)\indent.obj : \
524 $(SRC)\indent.c \
525 $(EMACS_ROOT)\src\s\s-windowsnt.h \
526 $(EMACS_ROOT)\src\m\m-windowsnt.h \
527 $(EMACS_ROOT)\src\config.h \
528 $(SRC)\lisp.h \
529 $(SRC)\buffer.h \
530 $(SRC)\indent.h \
531 $(SRC)\frame.h \
532 $(SRC)\window.h \
533 $(SRC)\termchar.h \
534 $(SRC)\termopts.h \
535 $(SRC)\disptab.h \
536 $(SRC)\dispextern.h \
537 $(SRC)\intervals.h
538
539$(BLD)\insdel.obj : \
540 $(SRC)\insdel.c \
541 $(EMACS_ROOT)\src\s\s-windowsnt.h \
542 $(EMACS_ROOT)\src\m\m-windowsnt.h \
543 $(EMACS_ROOT)\src\config.h \
544 $(SRC)\lisp.h \
545 $(SRC)\dispextern.h \
546 $(SRC)\intervals.h \
547 $(SRC)\buffer.h \
548 $(SRC)\window.h \
549 $(SRC)\blockinput.h
550
551$(BLD)\intervals.obj : \
552 $(SRC)\intervals.c \
553 $(EMACS_ROOT)\src\s\s-windowsnt.h \
554 $(EMACS_ROOT)\src\m\m-windowsnt.h \
555 $(EMACS_ROOT)\src\config.h \
556 $(SRC)\lisp.h \
557 $(SRC)\dispextern.h \
558 $(SRC)\intervals.h \
559 $(SRC)\buffer.h \
560 $(SRC)\puresize.h
561 $(CC) $(CFLAGS) -Fo$@ intervals.c
562
563$(BLD)\keyboard.obj : \
564 $(SRC)\keyboard.c \
565 $(EMACS_ROOT)\src\s\s-windowsnt.h \
566 $(EMACS_ROOT)\src\m\m-windowsnt.h \
567 $(EMACS_ROOT)\src\config.h \
568 $(SRC)\termchar.h \
569 $(SRC)\termopts.h \
570 $(SRC)\lisp.h \
571 $(SRC)\termhooks.h \
572 $(SRC)\macros.h \
573 $(SRC)\frame.h \
574 $(SRC)\window.h \
575 $(SRC)\commands.h \
576 $(SRC)\buffer.h \
577 $(SRC)\disptab.h \
578 $(SRC)\keyboard.h \
579 $(SRC)\dispextern.h \
580 $(SRC)\intervals.h \
581 $(SRC)\blockinput.h \
582 $(SRC)\msdos.h \
583 $(SRC)\syssignal.h \
584 $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
585 $(EMACS_ROOT)\nt\inc\sys\file.h \
586 $(SRC)\systty.h \
587 $(SRC)\xterm.h \
588 $(SRC)\vmstime.h \
589 $(SRC)\systime.h
590
591$(BLD)\keymap.obj : \
592 $(SRC)\keymap.c \
593 $(EMACS_ROOT)\src\s\s-windowsnt.h \
594 $(EMACS_ROOT)\src\m\m-windowsnt.h \
595 $(EMACS_ROOT)\src\config.h \
596 $(SRC)\lisp.h \
597 $(SRC)\commands.h \
598 $(SRC)\buffer.h \
599 $(SRC)\keyboard.h \
600 $(SRC)\termhooks.h \
601 $(SRC)\blockinput.h
602
603$(BLD)\lastfile.obj : \
604 $(SRC)\lastfile.c
605
606$(BLD)\lread.obj : \
607 $(SRC)\lread.c \
608 $(EMACS_ROOT)\src\s\s-windowsnt.h \
609 $(EMACS_ROOT)\src\m\m-windowsnt.h \
610 $(EMACS_ROOT)\src\config.h \
611 $(EMACS_ROOT)\nt\inc\sys\file.h \
612 $(SRC)\lisp.h \
613 $(SRC)\buffer.h \
614 $(EMACS_ROOT)\src\paths.h \
615 $(SRC)\commands.h \
616 $(SRC)\keyboard.h \
617 $(SRC)\termhooks.h \
618 $(SRC)\msdos.h
619
620$(BLD)\macros.obj : \
621 $(SRC)\macros.c \
622 $(EMACS_ROOT)\src\s\s-windowsnt.h \
623 $(EMACS_ROOT)\src\m\m-windowsnt.h \
624 $(EMACS_ROOT)\src\config.h \
625 $(SRC)\lisp.h \
626 $(SRC)\macros.h \
627 $(SRC)\commands.h \
628 $(SRC)\buffer.h \
629 $(SRC)\window.h
630
631$(BLD)\marker.obj : \
632 $(SRC)\marker.c \
633 $(EMACS_ROOT)\src\s\s-windowsnt.h \
634 $(EMACS_ROOT)\src\m\m-windowsnt.h \
635 $(EMACS_ROOT)\src\config.h \
636 $(SRC)\lisp.h \
637 $(SRC)\buffer.h
638
639$(BLD)\minibuf.obj : \
640 $(SRC)\minibuf.c \
641 $(EMACS_ROOT)\src\s\s-windowsnt.h \
642 $(EMACS_ROOT)\src\m\m-windowsnt.h \
643 $(EMACS_ROOT)\src\config.h \
644 $(SRC)\lisp.h \
645 $(SRC)\commands.h \
646 $(SRC)\buffer.h \
647 $(SRC)\dispextern.h \
648 $(SRC)\frame.h \
649 $(SRC)\window.h \
650 $(SRC)\syntax.h
651
652$(BLD)\mocklisp.obj : \
653 $(SRC)\mocklisp.c \
654 $(EMACS_ROOT)\src\s\s-windowsnt.h \
655 $(EMACS_ROOT)\src\m\m-windowsnt.h \
656 $(EMACS_ROOT)\src\config.h \
657 $(SRC)\lisp.h \
658 $(SRC)\buffer.h
659
660$(BLD)\nt.obj : \
661 $(SRC)\nt.c \
662 $(SRC)\s\s-windowsnt.h \
663 $(SRC)\m\m-windowsnt.h \
664 $(SRC)\config.h \
665 $(SRC)\lisp.h \
666 $(EMACS_ROOT)\nt\inc\pwd.h \
667 $(SRC)\ntheap.h
668
669$(BLD)\ntheap.obj : \
670 $(SRC)\ntheap.c \
671 $(SRC)\ntheap.h
672
673$(BLD)\ntinevt.obj : \
674 $(SRC)\ntinevt.c \
675 $(SRC)\s\s-windowsnt.h \
676 $(SRC)\m\m-windowsnt.h \
677 $(SRC)\config.h \
678 $(SRC)\lisp.h \
679 $(SRC)\frame.h \
680 $(SRC)\blockinput.h \
681 $(SRC)\termhooks.h
682
683$(BLD)\ntproc.obj : \
684 $(SRC)\ntproc.c \
685 $(SRC)\s\s-windowsnt.h \
686 $(SRC)\m\m-windowsnt.h \
687 $(SRC)\config.h \
688 $(SRC)\lisp.h \
689 $(SRC)\nt.h \
690 $(SRC)\vmstime.h \
691 $(SRC)\systime.h
692
693$(BLD)\ntterm.obj : \
694 $(SRC)\ntterm.c \
695 $(SRC)\s\s-windowsnt.h \
696 $(SRC)\m\m-windowsnt.h \
697 $(SRC)\config.h \
698 $(SRC)\lisp.h \
699 $(SRC)\frame.h \
700 $(SRC)\disptab.h \
701 $(SRC)\termhooks.h \
702 $(SRC)\ntinevt.h
703
704$(BLD)\prefix-args.obj : \
705 $(SRC)\prefix-args.c
706
707$(BLD)\print.obj : \
708 $(SRC)\print.c \
709 $(EMACS_ROOT)\src\s\s-windowsnt.h \
710 $(EMACS_ROOT)\src\m\m-windowsnt.h \
711 $(EMACS_ROOT)\src\config.h \
712 $(SRC)\lisp.h \
713 $(SRC)\buffer.h \
714 $(SRC)\frame.h \
715 $(SRC)\window.h \
716 $(SRC)\process.h \
717 $(SRC)\termchar.h \
718 $(SRC)\dispextern.h \
719 $(SRC)\intervals.h
720
721$(BLD)\process.obj : \
722 $(SRC)\process.c \
723 $(EMACS_ROOT)\src\s\s-windowsnt.h \
724 $(EMACS_ROOT)\src\m\m-windowsnt.h \
725 $(EMACS_ROOT)\src\config.h \
726 $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
727 $(EMACS_ROOT)\nt\inc\sys\file.h \
728 $(SRC)\systty.h \
729 $(SRC)\window.h \
730 $(SRC)\buffer.h \
731 $(SRC)\process.h \
732 $(SRC)\termhooks.h \
733 $(SRC)\commands.h \
734 $(SRC)\frame.h \
735 $(SRC)\syssignal.h \
736 $(SRC)\vmsproc.h \
737 $(SRC)\syswait.h \
738 $(SRC)\lisp.h \
739 $(SRC)\vmstime.h \
740 $(SRC)\systime.h \
741 $(SRC)\termopts.h
742
743$(BLD)\ralloc.obj : \
744 $(SRC)\ralloc.c \
745 $(EMACS_ROOT)\src\s\s-windowsnt.h \
746 $(EMACS_ROOT)\src\m\m-windowsnt.h \
747 $(EMACS_ROOT)\src\config.h \
748 $(SRC)\lisp.h \
749 $(SRC)\s\s-windowsnt.h \
750 $(SRC)\m\m-windowsnt.h \
751 $(SRC)\config.h \
752 $(EMACS_ROOT)\nt\inc\sys\param.h \
753 $(SRC)\getpagesize.h
754
755$(BLD)\regex.obj : \
756 $(SRC)\regex.c \
757 $(EMACS_ROOT)\src\s\s-windowsnt.h \
758 $(EMACS_ROOT)\src\m\m-windowsnt.h \
759 $(EMACS_ROOT)\src\config.h \
760 $(SRC)\s\s-windowsnt.h \
761 $(SRC)\m\m-windowsnt.h \
762 $(SRC)\config.h \
763 $(SRC)\lisp.h \
764 $(SRC)\buffer.h \
765 $(SRC)\syntax.h \
766 $(SRC)\regex.h
767
768$(BLD)\scroll.obj : \
769 $(SRC)\scroll.c \
770 $(EMACS_ROOT)\src\s\s-windowsnt.h \
771 $(EMACS_ROOT)\src\m\m-windowsnt.h \
772 $(EMACS_ROOT)\src\config.h \
773 $(SRC)\termchar.h \
774 $(SRC)\lisp.h \
775 $(SRC)\dispextern.h \
776 $(SRC)\frame.h
777
778$(BLD)\search.obj : \
779 $(SRC)\search.c \
780 $(EMACS_ROOT)\src\s\s-windowsnt.h \
781 $(EMACS_ROOT)\src\m\m-windowsnt.h \
782 $(EMACS_ROOT)\src\config.h \
783 $(SRC)\lisp.h \
784 $(SRC)\syntax.h \
785 $(SRC)\buffer.h \
786 $(SRC)\commands.h \
787 $(SRC)\blockinput.h \
788 $(SRC)\regex.h
789
790$(BLD)\sunfns.obj : \
791 $(SRC)\sunfns.c \
792 $(EMACS_ROOT)\src\s\s-windowsnt.h \
793 $(EMACS_ROOT)\src\m\m-windowsnt.h \
794 $(EMACS_ROOT)\src\config.h \
795 $(SRC)\lisp.h \
796 $(SRC)\window.h \
797 $(SRC)\buffer.h \
798 $(SRC)\termhooks.h
799
800$(BLD)\syntax.obj : \
801 $(SRC)\syntax.c \
802 $(EMACS_ROOT)\src\s\s-windowsnt.h \
803 $(EMACS_ROOT)\src\m\m-windowsnt.h \
804 $(EMACS_ROOT)\src\config.h \
805 $(SRC)\lisp.h \
806 $(SRC)\commands.h \
807 $(SRC)\buffer.h \
808 $(SRC)\syntax.h
809
810$(BLD)\sysdep.obj : \
811 $(SRC)\sysdep.c \
812 $(EMACS_ROOT)\src\s\s-windowsnt.h \
813 $(EMACS_ROOT)\src\m\m-windowsnt.h \
814 $(EMACS_ROOT)\src\config.h \
815 $(SRC)\lisp.h \
816 $(SRC)\blockinput.h \
817 $(SRC)\dosfns.h \
818 $(SRC)\msdos.h \
819 $(EMACS_ROOT)\nt\inc\sys\param.h \
820 $(EMACS_ROOT)\nt\inc\sys\file.h \
821 $(EMACS_ROOT)\nt\inc\sys\ioctl.h \
822 $(EMACS_ROOT)\nt\inc\sys\file.h \
823 $(SRC)\systty.h \
824 $(SRC)\vmsproc.h \
825 $(SRC)\syswait.h \
826 $(SRC)\frame.h \
827 $(SRC)\window.h \
828 $(SRC)\termhooks.h \
829 $(SRC)\termchar.h \
830 $(SRC)\termopts.h \
831 $(SRC)\dispextern.h \
832 $(SRC)\process.h \
833 $(SRC)\vmsdir.h \
834 $(SRC)\ndir.h \
835 $(SRC)\syssignal.h \
836 $(SRC)\vmstime.h \
837 $(SRC)\systime.h \
838 $(SRC)\uaf.h \
839 $(SRC)\vms-pwd.h \
840 $(EMACS_ROOT)\src\acldef.h \
841 $(EMACS_ROOT)\src\chpdef.h
842
843$(BLD)\term.obj : \
844 $(SRC)\term.c \
845 $(EMACS_ROOT)\src\s\s-windowsnt.h \
846 $(EMACS_ROOT)\src\m\m-windowsnt.h \
847 $(EMACS_ROOT)\src\config.h \
848 $(SRC)\termchar.h \
849 $(SRC)\termopts.h \
850 $(SRC)\cm.h \
851 $(SRC)\lisp.h \
852 $(SRC)\frame.h \
853 $(SRC)\disptab.h \
854 $(SRC)\termhooks.h \
855 $(SRC)\keyboard.h
856
857$(BLD)\termcap.obj : \
858 $(SRC)\termcap.c \
859 $(EMACS_ROOT)\src\s\s-windowsnt.h \
860 $(EMACS_ROOT)\src\m\m-windowsnt.h \
861 $(EMACS_ROOT)\src\config.h \
862 $(EMACS_ROOT)\nt\inc\sys\file.h
863
864$(BLD)\terminfo.obj : \
865 $(SRC)\terminfo.c
866
867$(BLD)\textprop.obj : \
868 $(SRC)\textprop.c \
869 $(EMACS_ROOT)\src\s\s-windowsnt.h \
870 $(EMACS_ROOT)\src\m\m-windowsnt.h \
871 $(EMACS_ROOT)\src\config.h \
872 $(SRC)\lisp.h \
873 $(SRC)\dispextern.h \
874 $(SRC)\intervals.h \
875 $(SRC)\buffer.h \
876 $(SRC)\window.h
877
878$(BLD)\tparam.obj : \
879 $(SRC)\tparam.c \
880 $(EMACS_ROOT)\src\s\s-windowsnt.h \
881 $(EMACS_ROOT)\src\m\m-windowsnt.h \
882 $(EMACS_ROOT)\src\config.h
883
884$(BLD)\undo.obj : \
885 $(SRC)\undo.c \
886 $(EMACS_ROOT)\src\s\s-windowsnt.h \
887 $(EMACS_ROOT)\src\m\m-windowsnt.h \
888 $(EMACS_ROOT)\src\config.h \
889 $(SRC)\lisp.h \
890 $(SRC)\buffer.h \
891 $(SRC)\commands.h
892
893$(BLD)\unexnt.obj : \
894 $(SRC)\unexnt.c \
895 $(SRC)\ntheap.h
896
897$(BLD)\widget.obj : \
898 $(SRC)\widget.c \
899 $(EMACS_ROOT)\src\s\s-windowsnt.h \
900 $(EMACS_ROOT)\src\m\m-windowsnt.h \
901 $(EMACS_ROOT)\src\config.h \
902 $(SRC)\lisp.h \
903 $(SRC)\xterm.h \
904 $(SRC)\frame.h \
905 $(SRC)\dispextern.h \
906 $(SRC)\widget.h \
907 $(SRC)\widgetprv.h
908
909$(BLD)\window.obj : \
910 $(SRC)\window.c \
911 $(EMACS_ROOT)\src\s\s-windowsnt.h \
912 $(EMACS_ROOT)\src\m\m-windowsnt.h \
913 $(EMACS_ROOT)\src\config.h \
914 $(SRC)\lisp.h \
915 $(SRC)\buffer.h \
916 $(SRC)\frame.h \
917 $(SRC)\window.h \
918 $(SRC)\commands.h \
919 $(SRC)\indent.h \
920 $(SRC)\termchar.h \
921 $(SRC)\disptab.h \
922 $(SRC)\keyboard.h
923
924$(BLD)\xdisp.obj : \
925 $(SRC)\xdisp.c \
926 $(EMACS_ROOT)\src\s\s-windowsnt.h \
927 $(EMACS_ROOT)\src\m\m-windowsnt.h \
928 $(EMACS_ROOT)\src\config.h \
929 $(SRC)\lisp.h \
930 $(SRC)\frame.h \
931 $(SRC)\window.h \
932 $(SRC)\termchar.h \
933 $(SRC)\buffer.h \
934 $(SRC)\indent.h \
935 $(SRC)\commands.h \
936 $(SRC)\macros.h \
937 $(SRC)\disptab.h \
938 $(SRC)\termhooks.h \
939 $(SRC)\dispextern.h \
940 $(SRC)\intervals.h
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
new file mode 100644
index 00000000000..53df90e48a3
--- /dev/null
+++ b/src/s/ms-w32.h
@@ -0,0 +1,264 @@
1/* System description file for Windows NT.
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20/*
21 * Define symbols to identify the version of Unix this is.
22 * Define all the symbols that apply correctly.
23 */
24
25/* #define UNIPLUS */
26/* #define USG5 */
27/* #define USG */
28/* #define HPUX */
29/* #define UMAX */
30/* #define BSD4_1 */
31/* #define BSD4_2 */
32/* #define BSD4_3 */
33/* #define BSD */
34/* #define VMS */
35#ifndef WINDOWSNT
36#define WINDOWSNT
37#endif
38#ifndef DOS_NT
39#define DOS_NT /* MSDOS or WINDOWSNT */
40#endif
41
42/* SYSTEM_TYPE should indicate the kind of system you are using.
43 It sets the Lisp variable system-type. */
44
45#define SYSTEM_TYPE "windows-nt"
46#define SYMS_SYSTEM syms_of_ntterm ()
47
48#define NO_MATHERR
49#define HAVE_FREXP
50#define HAVE_FMOD
51
52/* NOMULTIPLEJOBS should be defined if your system's shell
53 does not have "job control" (the ability to stop a program,
54 run some other program, then continue the first one). */
55
56/* #define NOMULTIPLEJOBS */
57
58/* Emacs can read input using SIGIO and buffering characters itself,
59 or using CBREAK mode and making C-g cause SIGINT.
60 The choice is controlled by the variable interrupt_input.
61
62 Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
63
64 Emacs uses the presence or absence of the SIGIO macro to indicate
65 whether or not signal-driven I/O is possible. It uses
66 INTERRUPT_INPUT to decide whether to use it by default.
67
68 SIGIO can be used only on systems that implement it (4.2 and 4.3).
69 CBREAK mode has two disadvantages
70 1) At least in 4.2, it is impossible to handle the Meta key properly.
71 I hear that in system V this problem does not exist.
72 2) Control-G causes output to be discarded.
73 I do not know whether this can be fixed in system V.
74
75 Another method of doing input is planned but not implemented.
76 It would have Emacs fork off a separate process
77 to read the input and send it to the true Emacs process
78 through a pipe. */
79
80#define INTERRUPT_INPUT
81
82/* Letter to use in finding device name of first pty,
83 if system supports pty's. 'a' means it is /dev/ptya0 */
84
85#define FIRST_PTY_LETTER 'a'
86
87/*
88 * Define HAVE_TERMIOS if the system provides POSIX-style
89 * functions and macros for terminal control.
90 *
91 * Define HAVE_TERMIO if the system provides sysV-style ioctls
92 * for terminal control.
93 *
94 * Do not define both. HAVE_TERMIOS is preferred, if it is
95 * supported on your system.
96 */
97
98/* #define HAVE_TERMIOS */
99/* #define HAVE_TERMIO */
100
101/*
102 * Define HAVE_TIMEVAL if the system supports the BSD style clock values.
103 * Look in <sys/time.h> for a timeval structure.
104 */
105
106/* #define HAVE_TIMEVAL */
107
108/*
109 * Define HAVE_SELECT if the system supports the `select' system call.
110 */
111
112/* #define HAVE_SELECT */
113
114/*
115 * Define HAVE_PTYS if the system supports pty devices.
116 */
117
118/* #define HAVE_PTYS */
119
120/*
121 * Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate
122 * The 4.2 opendir, etc., library functions.
123 */
124
125/* #define NONSYSTEM_DIR_LIBRARY */
126
127/* Define this symbol if your system has the functions bcopy, etc. */
128
129#define BSTRING
130#define bzero(b, l) memset(b, 0, l)
131#define bcopy(s, d, l) memcpy(d, s, l)
132#define bcmp(a, b, l) memcmp(a, b, l)
133
134/* subprocesses should be defined if you want to
135 have code for asynchronous subprocesses
136 (as used in M-x compile and M-x shell).
137 This is generally OS dependent, and not supported
138 under most USG systems. */
139
140#define subprocesses
141
142/* If your system uses COFF (Common Object File Format) then define the
143 preprocessor symbol "COFF". */
144
145#define COFF
146
147/* define MAIL_USE_FLOCK if the mailer uses flock
148 to interlock access to /usr/spool/mail/$USER.
149 The alternative is that a lock file named
150 /usr/spool/mail/$USER.lock. */
151
152/* #define MAIL_USE_FLOCK */
153
154/* Define CLASH_DETECTION if you want lock files to be written
155 so that Emacs can tell instantly when you try to modify
156 a file that someone else has modified in his Emacs. */
157
158/* #define CLASH_DETECTION */
159
160/* Define this if your operating system declares signal handlers to
161 have a type other than the usual. `The usual' is `void' for ANSI C
162 systems (i.e. when the __STDC__ macro is defined), and `int' for
163 pre-ANSI systems. If you're using GCC on an older system, __STDC__
164 will be defined, but the system's include files will still say that
165 signal returns int or whatever; in situations like that, define
166 this to be what the system's include files want. */
167/* #define SIGTYPE int */
168
169/* If the character used to separate elements of the executable path
170 is not ':', #define this to be the appropriate character constant. */
171#define SEPCHAR ';'
172
173/* ============================================================ */
174
175/* Here, add any special hacks needed
176 to make Emacs work on this system. For example,
177 you might define certain system call names that don't
178 exist on your system, or that do different things on
179 your system and must be used only through an encapsulation
180 (Which you should place, by convention, in sysdep.c). */
181
182/* Some compilers tend to put everything declared static
183 into the initialized data area, which becomes pure after dumping Emacs.
184 On these systems, you must #define static as nothing to foil this.
185 Note that emacs carefully avoids static vars inside functions. */
186
187/* Define this to be the separator between path elements */
188#define DIRECTORY_SEP '\\'
189
190/* Define this to be the separator between devices and paths */
191#define DEVICE_SEP ':'
192
193/* We'll support either convention on NT. */
194#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
195#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
196
197/* The null device on Windows NT. */
198#define NULL_DEVICE "NUL:"
199#define EXEC_SUFFIXES ".exe:.com:.bat:"
200
201#ifndef MAXPATHLEN
202#define MAXPATHLEN _MAX_PATH
203#endif
204
205#define HAVE_DUP2 1
206#define HAVE_RENAME 1
207#define HAVE_RMDIR 1
208#define HAVE_MKDIR 1
209#define HAVE_GETHOSTNAME 1
210
211/* These have to be defined because our compilers treat __STDC__ as being
212 defined (most of them anyway). */
213
214#define access _access
215#define chdir _chdir
216#define chmod _chmod
217#define close _close
218#define creat _creat
219#define dup _dup
220#define dup2 _dup2
221#define execlp _execlp
222#define execvp _execvp
223#define getpid _getpid
224#define index strchr
225#define isatty _isatty
226#define link _link
227#define lseek _lseek
228#define mkdir _mkdir
229#define mktemp _mktemp
230#define open _open
231#define pipe _pipe
232#define random rand
233#define read _read
234#define rmdir _rmdir
235#define sleep nt_sleep
236#define srandom srand
237#define unlink _unlink
238#define umask _umask
239#define write _write
240#define _longjmp longjmp
241#define spawnve win32_spawnve
242#define wait win32_wait
243#define signal win32_signal
244#define rindex strrchr
245
246/* Defines that we need that aren't in the standard signal.h */
247#define SIGHUP 1 /* Hang up */
248#define SIGQUIT 3 /* Quit process */
249#define SIGTRAP 5 /* Trace trap */
250#define SIGKILL 9 /* Die, die die */
251#define SIGPIPE 13 /* Write on pipe with no readers */
252#define SIGALRM 14 /* Alarm */
253#define SIGCHLD 18 /* Death of child */
254
255/* For integration with MSDOS support. */
256#define getdisk() (_getdrive () - 1)
257#define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
258
259/* Define this so that winsock.h definitions don't get included when windows.h
260 is... I don't know if they do the right thing for emacs. For this to
261 have proper effect, config.h must always be included before windows.h. */
262#define _WINSOCKAPI_ 1
263
264/* ============================================================ */
diff --git a/src/w32.c b/src/w32.c
new file mode 100644
index 00000000000..2a091d41ae2
--- /dev/null
+++ b/src/w32.c
@@ -0,0 +1,610 @@
1/* Utility and Unix shadow routines for GNU Emacs on Windows NT.
2 Copyright (C) 1994 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 1, or (at your option) any later
9 version.
10
11 GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 You should have received a copy of the GNU General Public License along
17 with GNU Emacs; see the file COPYING. If not, write to the Free Software
18 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 Geoff Voelker (voelker@cs.washington.edu) 7-29-94
21*/
22
23#include <windows.h>
24#include <stdlib.h>
25#include <stdio.h>
26#include <io.h>
27#include <fcntl.h>
28#include <ctype.h>
29
30#include "config.h"
31#define getwd _getwd
32#include "lisp.h"
33#undef getwd
34
35#include <pwd.h>
36
37#include "ndir.h"
38#include "ntheap.h"
39
40extern int report_file_error (char *, Lisp_Object);
41
42/* Get the current working directory. */
43int
44getwd (char *dir)
45{
46 return GetCurrentDirectory (MAXPATHLEN, dir);
47}
48
49/* Emulate gethostname. */
50int
51gethostname (char *buffer, int size)
52{
53 /* NT only allows small host names, so the buffer is
54 certainly large enough. */
55 return !GetComputerName (buffer, &size);
56}
57
58/* Emulate getloadavg. */
59int
60getloadavg (double loadavg[], int nelem)
61{
62 int i;
63
64 /* A faithful emulation is going to have to be saved for a rainy day. */
65 for (i = 0; i < nelem; i++)
66 {
67 loadavg[i] = 0.0;
68 }
69 return i;
70}
71
72/* Emulate sleep...we could have done this with a define, but that
73 would necessitate including windows.h in the files that used it.
74 This is much easier. */
75void
76nt_sleep (int seconds)
77{
78 Sleep (seconds * 1000);
79}
80
81/* Emulate the Unix directory procedures opendir, closedir,
82 and readdir. We can't use the procedures supplied in sysdep.c,
83 so we provide them here. */
84
85struct direct dir_static; /* simulated directory contents */
86static int dir_finding;
87static HANDLE dir_find_handle;
88
89DIR *
90opendir (char *filename)
91{
92 DIR *dirp;
93
94 /* Opening is done by FindFirstFile. However, a read is inherent to
95 this operation, so we have a flag to handle the open at read
96 time. This flag essentially means "there is a find-handle open and
97 it needs to be closed." */
98
99 if (!(dirp = (DIR *) malloc (sizeof (DIR))))
100 {
101 return 0;
102 }
103
104 dirp->dd_fd = 0;
105 dirp->dd_loc = 0;
106 dirp->dd_size = 0;
107
108 /* This is tacky, but we need the directory name for our
109 implementation of readdir. */
110 strncpy (dirp->dd_buf, filename, DIRBLKSIZ);
111 return dirp;
112}
113
114void
115closedir (DIR *dirp)
116{
117 /* If we have a find-handle open, close it. */
118 if (dir_finding)
119 {
120 FindClose (dir_find_handle);
121 dir_finding = 0;
122 }
123 xfree ((char *) dirp);
124}
125
126struct direct *
127readdir (DIR *dirp)
128{
129 WIN32_FIND_DATA find_data;
130
131 /* If we aren't dir_finding, do a find-first, otherwise do a find-next. */
132 if (!dir_finding)
133 {
134 char filename[MAXNAMLEN + 3];
135 int ln;
136
137 strncpy (filename, dirp->dd_buf, MAXNAMLEN);
138 ln = strlen (filename)-1;
139 if (filename[ln] != '\\' && filename[ln] != ':')
140 strcat (filename, "\\");
141 strcat (filename, "*.*");
142
143 dir_find_handle = FindFirstFile (filename, &find_data);
144
145 if (dir_find_handle == INVALID_HANDLE_VALUE)
146 return NULL;
147
148 dir_finding = 1;
149 }
150 else
151 {
152 if (!FindNextFile (dir_find_handle, &find_data))
153 return NULL;
154 }
155
156 /* Don't return . or .. since it doesn't look like any of the
157 readdir calling code expects them. */
158 while (strcmp (find_data.cFileName, ".") == 0
159 || strcmp (find_data.cFileName, "..") == 0)
160 {
161 if (!FindNextFile (dir_find_handle, &find_data))
162 return 0;
163 }
164
165 /* NT's unique ID for a file is 64 bits, so we have to fake it here.
166 This should work as long as we never use 0. */
167 dir_static.d_ino = 1;
168
169 dir_static.d_reclen = sizeof (struct direct) - MAXNAMLEN + 3 +
170 dir_static.d_namlen - dir_static.d_namlen % 4;
171
172 dir_static.d_namlen = strlen (find_data.cFileName);
173 strncpy (dir_static.d_name, find_data.cFileName, MAXNAMLEN);
174
175 return &dir_static;
176}
177
178/* Emulate getpwuid and getpwnam. */
179
180int getuid (); /* forward declaration */
181
182static char the_passwd_name[256];
183static char the_passwd_passwd[256];
184static char the_passwd_gecos[256];
185static char the_passwd_dir[256];
186static char the_passwd_shell[256];
187
188static struct passwd the_passwd =
189{
190 the_passwd_name,
191 the_passwd_passwd,
192 0,
193 0,
194 0,
195 the_passwd_gecos,
196 the_passwd_dir,
197 the_passwd_shell,
198};
199
200struct passwd *
201getpwuid (int uid)
202{
203 int size = 256;
204
205 if (!GetUserName (the_passwd.pw_name, &size))
206 return NULL;
207
208 the_passwd.pw_passwd[0] = '\0';
209 the_passwd.pw_uid = 0;
210 the_passwd.pw_gid = 0;
211 strcpy (the_passwd.pw_gecos, the_passwd.pw_name);
212 the_passwd.pw_dir[0] = '\0';
213 the_passwd.pw_shell[0] = '\0';
214
215 return &the_passwd;
216}
217
218struct passwd *
219getpwnam (char *name)
220{
221 struct passwd *pw;
222
223 pw = getpwuid (getuid ());
224 if (!pw)
225 return pw;
226
227 if (strcmp (name, pw->pw_name))
228 return NULL;
229
230 return pw;
231}
232
233
234/* We don't have scripts to automatically determine the system configuration
235 for Emacs before it's compiled, and we don't want to have to make the
236 user enter it, so we define EMACS_CONFIGURATION to invoke this runtime
237 routine. */
238
239static char configuration_buffer[16];
240
241char *
242get_emacs_configuration (void)
243{
244 char *arch, *oem;
245
246 /* Determine the processor type. */
247 switch (get_processor_type ())
248 {
249 case PROCESSOR_INTEL_386:
250 case PROCESSOR_INTEL_486:
251 case PROCESSOR_INTEL_PENTIUM:
252 arch = "i386";
253 break;
254 case PROCESSOR_INTEL_860:
255 arch = "i860";
256 break;
257 case PROCESSOR_MIPS_R2000:
258 case PROCESSOR_MIPS_R3000:
259 case PROCESSOR_MIPS_R4000:
260 arch = "mips";
261 break;
262 case PROCESSOR_ALPHA_21064:
263 arch = "alpha";
264 break;
265 default:
266 arch = "unknown";
267 break;
268 }
269
270 /* Let oem be "*" until we figure out how to decode the OEM field. */
271 oem = "*";
272
273 sprintf (configuration_buffer, "%s-%s-nt%d.%d", arch, oem,
274 get_nt_major_version (), get_nt_minor_version ());
275 return configuration_buffer;
276}
277
278/* Conjure up inode and device numbers that will serve the purpose
279 of Emacs. Return 1 upon success, 0 upon failure. */
280int
281get_inode_and_device_vals (Lisp_Object filename, Lisp_Object *p_inode,
282 Lisp_Object *p_device)
283{
284 /* File uids on NT are found using a handle to a file, which
285 implies that it has been opened. Since we want to be able
286 to stat an arbitrary file, we must open it, get the info,
287 and then close it.
288
289 Also, NT file uids are 64-bits. This is a problem. */
290
291 HANDLE handle;
292 BOOL result;
293 BY_HANDLE_FILE_INFORMATION info;
294
295 /* FIXME: It shouldn't be opened without READ access, but NT on x86
296 doesn't allow GetFileInfo in that case (NT on mips does). */
297
298 handle = CreateFile (XSTRING (filename)->data,
299 GENERIC_READ,
300 FILE_SHARE_READ | FILE_SHARE_WRITE,
301 NULL,
302 OPEN_EXISTING,
303 FILE_ATTRIBUTE_NORMAL,
304 NULL);
305 if (handle == INVALID_HANDLE_VALUE)
306 return 0;
307
308 result = GetFileInformationByHandle (handle, &info);
309 CloseHandle (handle);
310 if (!result)
311 return 0;
312
313 *p_inode = make_number (info.nFileIndexLow); /* use the low value */
314 *p_device = make_number (info.dwVolumeSerialNumber);
315
316 return 1;
317}
318
319/* The following pipe routines are used to support our fork emulation.
320 Since NT's crt dup always creates inherited handles, we
321 must be careful in setting up pipes. First create
322 non-inherited pipe handles, then create an inherited handle
323 to the write end by dup-ing it, and then close the non-inherited
324 end that was just duped. This gives us one non-inherited handle
325 on the read end and one inherited handle to the write end. As
326 the parent, we close the inherited handle to the write end after
327 spawning the child. */
328
329/* From callproc.c */
330extern Lisp_Object Vbinary_process_input;
331extern Lisp_Object Vbinary_process_output;
332
333void
334pipe_with_inherited_out (int fds[2])
335{
336 int inherit_out;
337 unsigned int flags = _O_NOINHERIT;
338
339 if (!NILP (Vbinary_process_output))
340 flags |= _O_BINARY;
341
342 _pipe (fds, 0, flags);
343 inherit_out = dup (fds[1]);
344 close (fds[1]);
345 fds[1] = inherit_out;
346}
347
348void
349pipe_with_inherited_in (int fds[2])
350{
351 int inherit_in;
352 unsigned int flags = _O_NOINHERIT;
353
354 if (!NILP (Vbinary_process_input))
355 flags |= _O_BINARY;
356
357 _pipe (fds, 0, flags);
358 inherit_in = dup (fds[0]);
359 close (fds[0]);
360 fds[0] = inherit_in;
361}
362
363/* The following two routines are used to manipulate stdin, stdout, and
364 stderr of our child processes.
365
366 Assuming that in, out, and err are inherited, we make them stdin,
367 stdout, and stderr of the child as follows:
368
369 - Save the parent's current standard handles.
370 - Set the parent's standard handles to the handles being passed in.
371 (Note that _get_osfhandle is an io.h procedure that
372 maps crt file descriptors to NT file handles.)
373 - Spawn the child, which inherits in, out, and err as stdin,
374 stdout, and stderr. (see Spawnve)
375 - Reset the parent's standard handles to the saved handles.
376 (see reset_standard_handles)
377 We assume that the caller closes in, out, and err after calling us. */
378
379void
380prepare_standard_handles (int in, int out, int err, HANDLE handles[4])
381{
382 HANDLE parent, stdin_save, stdout_save, stderr_save, err_handle;
383
384 parent = GetCurrentProcess ();
385 if (!DuplicateHandle (parent,
386 GetStdHandle (STD_INPUT_HANDLE),
387 parent,
388 &stdin_save,
389 0,
390 FALSE,
391 DUPLICATE_SAME_ACCESS))
392 report_file_error ("Duplicating parent's input handle", Qnil);
393
394 if (!DuplicateHandle (parent,
395 GetStdHandle (STD_OUTPUT_HANDLE),
396 parent,
397 &stdout_save,
398 0,
399 FALSE,
400 DUPLICATE_SAME_ACCESS))
401 report_file_error ("Duplicating parent's output handle", Qnil);
402
403 if (!DuplicateHandle (parent,
404 GetStdHandle (STD_ERROR_HANDLE),
405 parent,
406 &stderr_save,
407 0,
408 FALSE,
409 DUPLICATE_SAME_ACCESS))
410 report_file_error ("Duplicating parent's error handle", Qnil);
411
412 if (!SetStdHandle (STD_INPUT_HANDLE, (HANDLE) _get_osfhandle (in)))
413 report_file_error ("Changing stdin handle", Qnil);
414
415 if (!SetStdHandle (STD_OUTPUT_HANDLE, (HANDLE) _get_osfhandle (out)))
416 report_file_error ("Changing stdout handle", Qnil);
417
418 /* We lose data if we use the same handle to the pipe for stdout and
419 stderr, so make a duplicate. This took a while to find. */
420 if (out == err)
421 {
422 if (!DuplicateHandle (parent,
423 (HANDLE) _get_osfhandle (err),
424 parent,
425 &err_handle,
426 0,
427 TRUE,
428 DUPLICATE_SAME_ACCESS))
429 report_file_error ("Duplicating out handle to make err handle.",
430 Qnil);
431 }
432 else
433 {
434 err_handle = (HANDLE) _get_osfhandle (err);
435 }
436
437 if (!SetStdHandle (STD_ERROR_HANDLE, err_handle))
438 report_file_error ("Changing stderr handle", Qnil);
439
440 handles[0] = stdin_save;
441 handles[1] = stdout_save;
442 handles[2] = stderr_save;
443 handles[3] = err_handle;
444}
445
446void
447reset_standard_handles (int in, int out, int err, HANDLE handles[4])
448{
449 HANDLE stdin_save = handles[0];
450 HANDLE stdout_save = handles[1];
451 HANDLE stderr_save = handles[2];
452 HANDLE err_handle = handles[3];
453
454 if (!SetStdHandle (STD_INPUT_HANDLE, stdin_save))
455 report_file_error ("Resetting input handle", Qnil);
456
457 if (!SetStdHandle (STD_OUTPUT_HANDLE, stdout_save))
458 report_file_error ("Resetting output handle", Qnil);
459
460 if (!SetStdHandle (STD_ERROR_HANDLE, stderr_save))
461 report_file_error ("Resetting error handle", Qnil);
462
463 if (out == err)
464 {
465 /* If out and err are the same handle, then we duplicated out
466 and stuck it in err_handle. Close the duplicate to clean up. */
467 if (!CloseHandle (err_handle))
468 report_file_error ("Closing error handle duplicated from out.",
469 Qnil);
470 }
471}
472
473/* Destructively turn backslashes into slashes. */
474void
475dostounix_filename (p)
476 register char *p;
477{
478 while (*p)
479 {
480 if (*p == '\\')
481 *p = '/';
482 p++;
483 }
484}
485
486/* Routines that are no-ops on NT but are defined to get Emacs to compile. */
487
488
489int
490sigsetmask (int signal_mask)
491{
492 return 0;
493}
494
495int
496sigblock (int sig)
497{
498 return 0;
499}
500
501int
502kill (int pid, int signal)
503{
504 return 0;
505}
506
507int
508setpgrp (int pid, int gid)
509{
510 return 0;
511}
512
513int
514alarm (int seconds)
515{
516 return 0;
517}
518
519int
520unrequest_sigio (void)
521{
522 return 0;
523}
524
525int
526request_sigio (void)
527{
528 return 0;
529}
530
531int
532getuid ()
533{
534 return 0;
535}
536
537int
538geteuid ()
539{
540 return 0;
541}
542
543/* Remove all CR's that are followed by a LF.
544 (From msdos.c...probably should figure out a way to share it,
545 although this code isn't going to ever change.) */
546int
547crlf_to_lf (n, buf)
548 register int n;
549 register unsigned char *buf;
550{
551 unsigned char *np = buf;
552 unsigned char *startp = buf;
553 unsigned char *endp = buf + n;
554
555 if (n == 0)
556 return n;
557 while (buf < endp - 1)
558 {
559 if (*buf == 0x0d)
560 {
561 if (*(++buf) != 0x0a)
562 *np++ = 0x0d;
563 }
564 else
565 *np++ = *buf++;
566 }
567 if (buf < endp)
568 *np++ = *buf++;
569 return np - startp;
570}
571
572
573#ifdef PIGSFLY
574Keep this around...we might need it later.
575#ifdef WINDOWSNT
576{
577 /*
578 * Find the user's real name by opening the process token and looking
579 * up the name associated with the user-sid in that token.
580 */
581
582 char b[256], Name[256], RefD[256];
583 DWORD length = 256, rlength = 256, trash;
584 HANDLE Token;
585 SID_NAME_USE User;
586
587 if (1)
588 Vuser_real_name = build_string ("foo");
589 else if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &Token))
590 {
591 Vuser_real_name = build_string ("unknown");
592 }
593 else if (!GetTokenInformation (Token, TokenUser, (PVOID)b, 256,
594 &trash))
595 {
596 CloseHandle (Token);
597 Vuser_real_name = build_string ("unknown");
598 }
599 else if (!LookupAccountSid ((void *)0, (PSID)b, Name, &length, RefD,
600 &rlength, &User))
601 {
602 CloseHandle (Token);
603 Vuser_real_name = build_string ("unknown");
604 }
605 else
606 Vuser_real_name = build_string (Name);
607}
608#else /* not WINDOWSNT */
609#endif /* not WINDOWSNT */
610#endif /* PIGSFLY */
diff --git a/src/w32.h b/src/w32.h
new file mode 100644
index 00000000000..f5a701dcb13
--- /dev/null
+++ b/src/w32.h
@@ -0,0 +1,50 @@
1/* Support routines for the NT version of Emacs.
2 Copyright (C) 1994 Free Software Foundation, Inc.
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20/* File descriptor set emulation. */
21
22#ifdef FD_SET
23/* We could get this from param.h, but better not to depend on finding that.
24 And better not to risk that it might define other symbols used in this
25 file. */
26#ifdef FD_SETSIZE
27#define MAXDESC FD_SETSIZE
28#else
29#define MAXDESC 64
30#endif
31#define SELECT_TYPE fd_set
32#else /* no FD_SET */
33#define MAXDESC 32
34#define SELECT_TYPE int
35
36/* Define the macros to access a single-int bitmap of descriptors. */
37#define FD_SET(n, p) (*(p) |= (1 << (n)))
38#define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
39#define FD_ISSET(n, p) (*(p) & (1 << (n)))
40#define FD_ZERO(p) (*(p) = 0)
41#endif /* no FD_SET */
42
43/* Prepare our standard handles for proper inheritance by child processes. */
44extern void prepare_standard_handles (int in, int out,
45 int err, HANDLE handles[4]);
46
47/* Reset our standard handles to their original state. */
48extern void reset_standard_handles (int in, int out,
49 int err, HANDLE handles[4]);
50
diff --git a/src/w32heap.c b/src/w32heap.c
new file mode 100644
index 00000000000..aac860e769b
--- /dev/null
+++ b/src/w32heap.c
@@ -0,0 +1,198 @@
1/* Heap management routines for GNU Emacs on Windows NT.
2 Copyright (C) 1994 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 You should have received a copy of the GNU General Public License along
17 with GNU Emacs; see the file COPYING. If not, write to the Free Software
18 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 Geoff Voelker (voelker@cs.washington.edu) 7-29-94
21*/
22
23#include <stdlib.h>
24#include <stdio.h>
25
26#include "ntheap.h"
27
28/* This gives us the page size and the size of the allocation unit on NT. */
29SYSTEM_INFO sysinfo_cache;
30
31/* These are defined to get Emacs to compile, but are not used. */
32int edata;
33int etext;
34
35/* The major and minor versions of NT. */
36int nt_major_version;
37int nt_minor_version;
38
39/* Cache information describing the NT system for later use. */
40void
41cache_system_info (void)
42{
43 union
44 {
45 struct info
46 {
47 char major;
48 char minor;
49 short platform;
50 } info;
51 DWORD data;
52 } version;
53
54 /* Cache the version of the operating system. */
55 version.data = GetVersion ();
56 nt_major_version = version.info.major;
57 nt_minor_version = version.info.minor;
58
59 /* Cache page size, allocation unit, processor type, etc. */
60 GetSystemInfo (&sysinfo_cache);
61}
62
63/* Round ADDRESS up to be aligned with ALIGN. */
64unsigned char *
65round_to_next (unsigned char *address, unsigned long align)
66{
67 unsigned long tmp;
68
69 tmp = (unsigned long) address;
70 tmp = (tmp + align - 1) / align;
71
72 return (unsigned char *) (tmp * align);
73}
74
75/* Info for keeping track of our heap. */
76unsigned char *data_region_base = NULL;
77unsigned char *data_region_end = NULL;
78unsigned long data_region_size = 0;
79
80/* The start of the data segment. */
81unsigned char *
82get_data_start (void)
83{
84 return data_region_base;
85}
86
87/* The end of the data segment. */
88unsigned char *
89get_data_end (void)
90{
91 return data_region_end;
92}
93
94/* Emulate Unix sbrk. */
95void *
96sbrk (unsigned long increment)
97{
98 void *result;
99 long size = (long) increment;
100
101 /* Allocate our heap if we haven't done so already. */
102 if (!data_region_base)
103 {
104 data_region_base = VirtualAlloc ((void *) get_data_region_base (),
105 get_reserved_heap_size (),
106 MEM_RESERVE,
107 PAGE_NOACCESS);
108 if (!data_region_base)
109 return NULL;
110
111 /* Ensure that the addresses don't use the upper 8 bits since
112 the Lisp type goes there (yucko). */
113 if (((unsigned long) data_region_base & 0xFF000000) != 0)
114 {
115 printf ("Error: The heap was allocated in upper memory.\n");
116 exit (1);
117 }
118
119 data_region_end = data_region_base;
120 data_region_size = get_reserved_heap_size ();
121 }
122
123 result = data_region_end;
124
125 /* If size is negative, shrink the heap by decommitting pages. */
126 if (size < 0)
127 {
128 size = -size;
129
130 /* Sanity checks. */
131 if (size % get_page_size () != 0)
132 return NULL;
133 if ((data_region_end - size) < data_region_base)
134 return NULL;
135
136 /* Decommit size bytes from the end of the heap. */
137 if (!VirtualFree (data_region_end - size, size, MEM_DECOMMIT))
138 return NULL;
139
140 data_region_end -= size;
141 }
142 /* If size is positive, grow the heap by committing reserved pages. */
143 else if (size > 0)
144 {
145 /* Sanity checks. */
146 if (size % get_page_size () != 0)
147 return NULL;
148 if ((data_region_end + size) >
149 (data_region_base + get_reserved_heap_size ()))
150 return NULL;
151
152 /* Commit more of our heap. */
153 if (VirtualAlloc (data_region_end, size, MEM_COMMIT,
154 PAGE_READWRITE) == NULL)
155 return NULL;
156 data_region_end += size;
157 }
158
159 return result;
160}
161
162/* Recreate the heap from the data that was dumped to the executable.
163 EXECUTABLE_PATH tells us where to find the executable. */
164void
165recreate_heap (char *executable_path)
166{
167 unsigned char *tmp;
168
169 /* First reserve the upper part of our heap. (We reserve first
170 because there have been problems in the past where doing the
171 mapping first has loaded DLLs into the VA space of our heap.) */
172 tmp = VirtualAlloc ((void *) get_heap_end (),
173 get_reserved_heap_size () - get_committed_heap_size (),
174 MEM_RESERVE,
175 PAGE_NOACCESS);
176 if (!tmp)
177 exit (1);
178
179 /* We read in the data for the .bss section from the executable
180 first and map in the heap from the executable second to prevent
181 any funny interactions between file I/O and file mapping. */
182 read_in_bss (executable_path);
183 map_in_heap (executable_path);
184}
185
186/* Round the heap up to the given alignment. */
187void
188round_heap (unsigned long align)
189{
190 unsigned long needs_to_be;
191 unsigned long need_to_alloc;
192
193 needs_to_be = (unsigned long) round_to_next (get_heap_end (), align);
194 need_to_alloc = needs_to_be - (unsigned long) get_heap_end ();
195
196 if (need_to_alloc)
197 sbrk (need_to_alloc);
198}
diff --git a/src/w32heap.h b/src/w32heap.h
new file mode 100644
index 00000000000..9cf2882bfe3
--- /dev/null
+++ b/src/w32heap.h
@@ -0,0 +1,72 @@
1/* Heap management routines (including unexec) for GNU Emacs on Windows NT.
2 Copyright (C) 1994 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 You should have received a copy of the GNU General Public License along
17 with GNU Emacs; see the file COPYING. If not, write to the Free Software
18 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 Geoff Voelker (voelker@cs.washington.edu) 7-29-94
21*/
22
23#ifndef NTHEAP_H_
24#define NTHEAP_H_
25
26#include <windows.h>
27
28/*
29 * Heap related stuff.
30 */
31#define get_data_region_base() (char *) 0x00030000
32#define get_reserved_heap_size() (0x00d00000 - 0x00030000)
33#define get_committed_heap_size() (get_data_end () - get_data_start ())
34#define get_heap_start() get_data_start ()
35#define get_heap_end() get_data_end ()
36#define get_page_size() sysinfo_cache.dwPageSize
37#define get_allocation_unit() sysinfo_cache.dwAllocationGranularity
38#define get_processor_type() sysinfo_cache.dwProcessorType
39#define get_nt_major_version() nt_major_version
40#define get_nt_minor_version() nt_minor_version
41
42extern unsigned char *get_data_start();
43extern unsigned char *get_data_end();
44extern unsigned long data_region_size;
45extern SYSTEM_INFO sysinfo_cache;
46extern BOOL need_to_recreate_heap;
47extern int nt_major_version;
48extern int nt_minor_version;
49
50/* Emulation of Unix sbrk(). */
51extern void *sbrk (unsigned long size);
52
53/* Recreate the heap created during dumping. */
54extern void recreate_heap (char *executable_path);
55
56/* Round the heap to this size. */
57extern void round_heap (unsigned long size);
58
59/* Load in the dumped .bss section. */
60extern void read_in_bss (char *name);
61
62/* Map in the dumped heap. */
63extern void map_in_heap (char *name);
64
65/* Cache system info, e.g., the NT page size. */
66extern void cache_system_info (void);
67
68/* Round ADDRESS up to be aligned with ALIGN. */
69extern unsigned char *round_to_next (unsigned char *address,
70 unsigned long align);
71
72#endif /* NTHEAP_H_ */