Skip to content

Commit 66541bb

Browse files
matzk0kubun
authored andcommitted
version 1.0-971209
https://cache.ruby-lang.org/pub/ruby/1.0/ruby-1.0-971209.tar.gz Tue Dec 9 17:54:56 1997 Yukihiro Matsumoto <[email protected]> * version 1.0-971209 * sample/ruby-mode.el (ruby-expr-beg): forgot to handle modifiers. * parse.y (tokadd): token buffer overrun.
1 parent fb0fe24 commit 66541bb

File tree

12 files changed

+168
-59
lines changed

12 files changed

+168
-59
lines changed

ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Tue Dec 9 17:54:56 1997 Yukihiro Matsumoto <[email protected]>
2+
3+
* version 1.0-971209
4+
5+
* sample/ruby-mode.el (ruby-expr-beg): forgot to handle modifiers.
6+
7+
* parse.y (tokadd): token buffer overrun.
8+
19
Thu Dec 4 14:29:59 1997 Yukihiro Matsumoto <[email protected]>
210

311
* version 1.0-971204

eval.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -624,11 +624,7 @@ extern char **environ;
624624
#endif
625625
char **origenviron;
626626

627-
#if (_MSC_VER >= 1000)
628-
__declspec(dllexport) void __stdcall
629-
#else
630627
void
631-
#endif
632628
ruby_init()
633629
{
634630
static struct FRAME frame;
@@ -662,11 +658,7 @@ ruby_init()
662658

663659
static int ext_init = 0;
664660

665-
#if (_MSC_VER >= 1000)
666-
__declspec(dllexport) void __stdcall
667-
#else
668661
void
669-
#endif
670662
ruby_options(argc, argv)
671663
int argc;
672664
char **argv;
@@ -717,11 +709,7 @@ static VALUE thread_current();
717709

718710
static int exit_status;
719711

720-
#if (_MSC_VER >= 1000)
721-
__declspec(dllexport) void __stdcall
722-
#else
723712
void
724-
#endif
725713
ruby_run()
726714
{
727715
NODE *state;

ext/extmk.rb.nt

Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ $lib_cache = {}
1818
$func_cache = {}
1919
$hdr_cache = {}
2020

21+
$dllopt = '-MD'
22+
2123
if File.exist?("config.cache") then
2224
f = open("config.cache", "r")
2325
while f.gets
@@ -47,7 +49,7 @@ def older(file1, file2)
4749
end
4850

4951
LINK = "cl -o conftest -I../.. -Zi -O -I. %s %s conftest.c %s > nul"
50-
CPP = "cl -E -I../.. -Zi -O -I. %s conftest.c > nul"
52+
CPP = "cl -E -I../.. -I../../missing -I. -Zi -O %s conftest.c > nul"
5153

5254
def try_link(libs)
5355
system(format(LINK, $CFLAGS, $LDFLAGS, libs))
@@ -201,10 +203,18 @@ VPATH = .
201203
202204
CC = cl
203205
204-
CFLAGS = %s -I../.. -Zi -O -I. -DNT -MD #$CFLAGS %s
206+
CFLAGS = %s -I../.. -I../../missing -I. -O -DNT %s #$CFLAGS %s
207+
208+
RUBYLIB = ../../ruby.lib
205209
DLDFLAGS = /DLL
206210
LDSHARED =
207-
", if $static then "" else "-fpic" end, $defs.join(" ")
211+
", if $static then "" else "-fpic" end, $dllopt, $defs.join(" ")
212+
213+
if $force_static
214+
print "static\n"
215+
else
216+
print "non static\n"
217+
end
208218

209219
mfile.printf "\
210220
@@ -231,14 +241,16 @@ TARGET = %s.%s
231241
232242
INSTALL = %sginstall -c
233243
244+
DEFFILE = %s.def
245+
234246
all: $(TARGET)
235247
236248
clean:; @rm -f *.obj *.lib *.exp *.pdb *.bak
237249
@rm -f Makefile extconf.h conftest.*
238250
239251
realclean: clean
240252
", target,
241-
if $static then "obj" else "obj" end, dots
253+
if $force_static then "lib" else "dll" end, dots, target
242254

243255
if !$static
244256
mfile.printf "\
@@ -256,17 +268,18 @@ install:;
256268
"
257269
end
258270

259-
if !$static && "obj" != "obj"
271+
if $force_static
260272
mfile.printf "\
261273
$(TARGET): $(OBJS)
262-
$(LDSHARED) $(DLDFLAGS) -o $(TARGET) $(OBJS) $(LOCAL_LIBS) $(LIBS)
263-
"
264-
elsif not File.exist?(target + ".c")
265-
mfile.printf "\
266-
$(TARGET): $(OBJS)
267-
# ld $(DLDFLAGS) -r -o $(TARGET) $(OBJS)
268-
cl -c $(OBJS)
269274
lib /OUT:$(TARGET) $(OBJS)
275+
"
276+
else
277+
mfile.printf "\
278+
$(DEFFILE):
279+
echo $(DEFFILE)
280+
281+
$(TARGET): $(OBJS) $(DEFFILE)
282+
cl -DLL -o$(TARGET) $(OBJS) $(RUBYLIB) -link /DEF:$(DEFFILE)
270283
"
271284
end
272285

@@ -318,6 +331,11 @@ def extmake(target)
318331
if File.exist?("./Makefile")
319332
if $install
320333
system "nmake install"
334+
if File.directory? "./lib"
335+
for i in Dir["./lib/*.rb"]
336+
system "ginstall -c #{i} /usr/local/lib/ruby/i386-mswin32"
337+
end
338+
end
321339
elsif $clean
322340
system "nmake clean"
323341
else
@@ -386,15 +404,17 @@ if $extlist.size > 0
386404
#for s,t in $extlist
387405
for s,t in $static_ext
388406
#f = format("%s/%s.obj", s, t)
389-
f = format("%s/%s.obj", s, s)
407+
#f = format("%s/%s.obj", s, s)
408+
l = format("%s/%s.lib", s, s)
390409
#print format("%s/%s.obj\n", s, s) ##debug print##
391-
if File.exist?(f)
410+
if File.exist?(l)
392411
$extinit += format("\
393412
\tInit_%s();\n\
394413
\trb_provide(\"%s.o\");\n\
395414
", s, s)
396415
$extobjs += "ext/"
397-
$extobjs += f
416+
#$extobjs += f # *.obj
417+
$extobjs += l # *.lib
398418
$extobjs += " "
399419
else
400420
FALSE
@@ -431,6 +451,30 @@ else
431451
end
432452
end
433453

454+
#template of .def file.
455+
#LIBRARY kconv.dll
456+
#CODE LOADONCALL
457+
#DATA LOADONCALL
458+
#DESCRIPTION 'win32 kconv.dll'
459+
#EXPORTS
460+
#
461+
# Init_kconv
462+
def makedef(basename)
463+
defname = sprintf("%s.def", basename)
464+
f = open(defname, "w")
465+
f.printf "\
466+
LIBRARY %s.dll
467+
CODE LOADONCALL
468+
DATA LOADONCALL
469+
DESCRIPTION 'win32 %s.dll'
470+
EXPORTS
471+
472+
Init_%s
473+
", basename, basename
474+
f.close
475+
476+
end
477+
434478
#Local variables:
435479
# mode: ruby
436480
#end:

lib/date.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def name_of_week
7373
end
7474

7575
def +(o)
76-
if o.kind_of?(Integer)
77-
d = self.period + o
76+
if o.kind_of?(Numeric)
77+
d = Integer(self.period + o)
7878
elsif o.kind_of?(Date)
7979
d = self.period + o.period
8080
else
@@ -84,10 +84,10 @@ def +(o)
8484
end
8585

8686
def -(o)
87-
if o.kind_of?(Integer)
88-
d = self.period - o
87+
if o.kind_of?(Numeric)
88+
d = Integer(self.period - o)
8989
elsif o.kind_of?(Date)
90-
d = self.period - o.period
90+
return Integer(self.period - o.period)
9191
else
9292
raise TypeError, "Illegal type. (Integer or Date)"
9393
end
@@ -150,6 +150,12 @@ def _check_date
150150
end
151151

152152
def Date.at(d)
153+
if d.kind_of? Time
154+
return Date.new(1900+d.year, d.mon, d.mday)
155+
end
156+
if d.kind_of? Date
157+
return Date.at(d.period)
158+
end
153159
mm = 1
154160
yy = (d / 366.0).to_i
155161
if yy != 0

lib/tkcanvas.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def move(tag, x, y)
9292
def itemtype(tag)
9393
tk_send 'type', tagid(tag)
9494
end
95-
def postscript(keys=None)
95+
def postscript(keys)
9696
tk_send "postscript", *hash_kv(keys)
9797
end
9898
def raise(tag, above=None)

missing/nt.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,7 @@ sleep(unsigned int len)
167167
//
168168
// Initialization stuff
169169
//
170-
#if (_MSC_VER >= 1000)
171-
__declspec(dllexport) void __stdcall
172-
#else
173170
void
174-
#endif
175171
NtInitialize(int *argc, char ***argv) {
176172

177173
WORD version;

missing/nt.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
#include <string.h>
8585
#include <direct.h>
8686
#include <process.h>
87-
#include <io.h>
8887
#include <time.h>
8988
#include <math.h>
9089
#include <sys/types.h>

parse.y

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,11 +1520,11 @@ static void
15201520
tokadd(c)
15211521
char c;
15221522
{
1523+
tokenbuf[tokidx++] = c;
15231524
if (tokidx >= toksiz) {
15241525
toksiz *= 2;
15251526
REALLOC_N(tokenbuf, char, toksiz);
15261527
}
1527-
tokenbuf[tokidx++] = c;
15281528
}
15291529

15301530
static int
@@ -1985,7 +1985,11 @@ retry:
19851985
c = nextc();
19861986
if (c == '\n') sourceline++;
19871987
}
1988-
if (ismbchar(c)) c = nextc();
1988+
if (ismbchar(c)) {
1989+
c = nextc();
1990+
if (c == '\n')
1991+
break;
1992+
}
19891993
}
19901994
/* fall through */
19911995
case '\n':

sample/ruby-mode.el

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ The variable ruby-indent-level controls the amount of indentation.
176176
(indent-to x)
177177
(move-to-column (+ x shift))))))
178178

179-
(defun ruby-expr-beg ()
179+
(defun ruby-expr-beg (&optional modifier)
180180
(save-excursion
181181
(if (looking-at "\\?")
182182
(progn
@@ -185,14 +185,22 @@ The variable ruby-indent-level controls the amount of indentation.
185185
(skip-chars-backward " \t")
186186
(or (bolp) (forward-char -1))
187187
(or (looking-at ruby-operator-chars)
188-
(looking-at "[\\[({]")
188+
(looking-at "[\\[({!?]")
189189
(bolp)
190190
(and (looking-at ruby-symbol-chars)
191191
(forward-word -1)
192192
(or
193+
(and modifier (bolp))
193194
(looking-at ruby-block-beg-re)
194195
(looking-at ruby-block-op-re)
195-
(looking-at ruby-block-mid-re))
196+
(looking-at ruby-block-mid-re)
197+
(and modifier
198+
(save-excursion
199+
(forward-char -1)
200+
(let ((c (char-after (point))))
201+
(or (eq c ?.)
202+
(eq c ? )
203+
(eq c ?\t))))))
196204
(goto-char (match-end 0))
197205
(looking-at "[^_]"))))))
198206

@@ -590,7 +598,6 @@ An end of a defun is found by moving forward from the beginning of one."
590598
"in"
591599
"module"
592600
"next"
593-
"nil"
594601
"not"
595602
"or"
596603
"raise"
@@ -611,19 +618,27 @@ An end of a defun is found by moving forward from the beginning of one."
611618
"\\)[ \n\t()]")
612619
2)
613620
;; variables
614-
'("nil\\|self\\|TRUE\\|FALSE"
615-
0 font-lock-variable-name-face)
621+
'("\\(^\\|[^_]\\)\\b\\(nil\\|self\\|true\\|false\\)\\b[^_]"
622+
2 font-lock-variable-name-face)
616623
;; variables
617624
'("\\[$@].\\([a-zA-Z0-9_]\\)"
618625
0 font-lock-variable-name-face)
619626
;; constants
620-
'("\\b[A-Z]+[a-zA-Z0-9_]*"
621-
0 font-lock-type-face)
627+
'("\\(^\\|[^_]\\)\\b\\([A-Z]+[a-zA-Z0-9_]*\\)"
628+
2 font-lock-type-face)
622629
;; functions
623-
'("\\bdef[ \t]+[a-zA-Z_]+[a-zA-Z0-9_]*[?!]?"
630+
'("\\bdef[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*[?!=]?\\|\\[\\]=?\\)"
624631
0 font-lock-function-name-face))
625632
"*Additional expressions to highlight in ruby mode.")
626-
(add-hook 'ruby-mode-hook
627-
(lambda ()
628-
(setq font-lock-keywords ruby-font-lock-keywords)
629-
(font-lock-mode 1)))))
633+
(if (and (>= (string-to-int emacs-version) 20)
634+
(not (featurep 'xemacs)))
635+
(add-hook
636+
'ruby-mode-hook
637+
(lambda ()
638+
(make-local-variable 'font-lock-defaults)
639+
(setq font-lock-defaults
640+
'((ruby-font-lock-keywords) nil nil ((?\_ . "w"))))))
641+
(add-hook 'ruby-mode-hook
642+
(lambda ()
643+
(setq font-lock-keywords ruby-font-lock-keywords)
644+
(font-lock-mode 1))))))

string.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ tr_squeeze(str1, str2)
16091609
UCHAR *s, *send, *t;
16101610
char c, save;
16111611

1612-
if (str2) {
1612+
if (!NIL_P(str2)) {
16131613
tr_setup_table(str2, squeez);
16141614
}
16151615
else {
@@ -1646,7 +1646,7 @@ str_squeeze_bang(argc, argv, str1)
16461646
VALUE str2;
16471647

16481648
rb_scan_args(argc, argv, "01", &str2);
1649-
if (str2) {
1649+
if (!NIL_P(str2)) {
16501650
Check_Type(str2, T_STRING);
16511651
}
16521652
return tr_squeeze(str1, str2);

0 commit comments

Comments
 (0)