summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYukihiro Matsumoto <matz@ruby-lang.org>1997-12-09 17:54:56 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 22:09:33 +0900
commit66541bbb3630a5c512f8012c52ae777ab83beba5 (patch)
treebe1431b56b485de6cb1da065bb2161551872820d
parentfb0fe24512d1796f794306768ddac37566e9a209 (diff)
version 1.0-971209v1_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 <matz@netlab.co.jp> * version 1.0-971209 * sample/ruby-mode.el (ruby-expr-beg): forgot to handle modifiers. * parse.y (tokadd): token buffer overrun.
-rw-r--r--ChangeLog8
-rw-r--r--eval.c12
-rw-r--r--ext/extmk.rb.nt74
-rw-r--r--lib/date.rb16
-rw-r--r--lib/tkcanvas.rb2
-rw-r--r--missing/nt.c4
-rw-r--r--missing/nt.h1
-rw-r--r--parse.y8
-rw-r--r--sample/ruby-mode.el41
-rw-r--r--string.c4
-rw-r--r--version.h4
-rw-r--r--win32/ruby.def53
12 files changed, 168 insertions, 59 deletions
diff --git a/ChangeLog b/ChangeLog
index 843728a75f..6dbf442436 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Dec 9 17:54:56 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.0-971209
+
+ * sample/ruby-mode.el (ruby-expr-beg): forgot to handle modifiers.
+
+ * parse.y (tokadd): token buffer overrun.
+
Thu Dec 4 14:29:59 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
* version 1.0-971204
diff --git a/eval.c b/eval.c
index 8d48a2bf19..1e10ee22dd 100644
--- a/eval.c
+++ b/eval.c
@@ -624,11 +624,7 @@ extern char **environ;
#endif
char **origenviron;
-#if (_MSC_VER >= 1000)
-__declspec(dllexport) void __stdcall
-#else
void
-#endif
ruby_init()
{
static struct FRAME frame;
@@ -662,11 +658,7 @@ ruby_init()
static int ext_init = 0;
-#if (_MSC_VER >= 1000)
-__declspec(dllexport) void __stdcall
-#else
void
-#endif
ruby_options(argc, argv)
int argc;
char **argv;
@@ -717,11 +709,7 @@ static VALUE thread_current();
static int exit_status;
-#if (_MSC_VER >= 1000)
-__declspec(dllexport) void __stdcall
-#else
void
-#endif
ruby_run()
{
NODE *state;
diff --git a/ext/extmk.rb.nt b/ext/extmk.rb.nt
index 33f676a804..04b9e4071d 100644
--- a/ext/extmk.rb.nt
+++ b/ext/extmk.rb.nt
@@ -18,6 +18,8 @@ $lib_cache = {}
$func_cache = {}
$hdr_cache = {}
+$dllopt = '-MD'
+
if File.exist?("config.cache") then
f = open("config.cache", "r")
while f.gets
@@ -47,7 +49,7 @@ def older(file1, file2)
end
LINK = "cl -o conftest -I../.. -Zi -O -I. %s %s conftest.c %s > nul"
-CPP = "cl -E -I../.. -Zi -O -I. %s conftest.c > nul"
+CPP = "cl -E -I../.. -I../../missing -I. -Zi -O %s conftest.c > nul"
def try_link(libs)
system(format(LINK, $CFLAGS, $LDFLAGS, libs))
@@ -201,10 +203,18 @@ VPATH = .
CC = cl
-CFLAGS = %s -I../.. -Zi -O -I. -DNT -MD #$CFLAGS %s
+CFLAGS = %s -I../.. -I../../missing -I. -O -DNT %s #$CFLAGS %s
+
+RUBYLIB = ../../ruby.lib
DLDFLAGS = /DLL
LDSHARED =
-", if $static then "" else "-fpic" end, $defs.join(" ")
+", if $static then "" else "-fpic" end, $dllopt, $defs.join(" ")
+
+ if $force_static
+ print "static\n"
+ else
+ print "non static\n"
+ end
mfile.printf "\
@@ -231,6 +241,8 @@ TARGET = %s.%s
INSTALL = %sginstall -c
+DEFFILE = %s.def
+
all: $(TARGET)
clean:; @rm -f *.obj *.lib *.exp *.pdb *.bak
@@ -238,7 +250,7 @@ clean:; @rm -f *.obj *.lib *.exp *.pdb *.bak
realclean: clean
", target,
- if $static then "obj" else "obj" end, dots
+ if $force_static then "lib" else "dll" end, dots, target
if !$static
mfile.printf "\
@@ -256,18 +268,19 @@ install:;
"
end
- if !$static && "obj" != "obj"
+ if $force_static
mfile.printf "\
$(TARGET): $(OBJS)
- $(LDSHARED) $(DLDFLAGS) -o $(TARGET) $(OBJS) $(LOCAL_LIBS) $(LIBS)
-"
- elsif not File.exist?(target + ".c")
- mfile.printf "\
-$(TARGET): $(OBJS)
-# ld $(DLDFLAGS) -r -o $(TARGET) $(OBJS)
- cl -c $(OBJS)
lib /OUT:$(TARGET) $(OBJS)
"
+ else
+ mfile.printf "\
+$(DEFFILE):
+ echo $(DEFFILE)
+
+$(TARGET): $(OBJS) $(DEFFILE)
+ cl -DLL -o$(TARGET) $(OBJS) $(RUBYLIB) -link /DEF:$(DEFFILE)
+"
end
if File.exist?("depend")
@@ -318,6 +331,11 @@ def extmake(target)
if File.exist?("./Makefile")
if $install
system "nmake install"
+ if File.directory? "./lib"
+ for i in Dir["./lib/*.rb"]
+ system "ginstall -c #{i} /usr/local/lib/ruby/i386-mswin32"
+ end
+ end
elsif $clean
system "nmake clean"
else
@@ -386,15 +404,17 @@ if $extlist.size > 0
#for s,t in $extlist
for s,t in $static_ext
#f = format("%s/%s.obj", s, t)
- f = format("%s/%s.obj", s, s)
+ #f = format("%s/%s.obj", s, s)
+ l = format("%s/%s.lib", s, s)
#print format("%s/%s.obj\n", s, s) ##debug print##
- if File.exist?(f)
+ if File.exist?(l)
$extinit += format("\
\tInit_%s();\n\
\trb_provide(\"%s.o\");\n\
", s, s)
$extobjs += "ext/"
- $extobjs += f
+ #$extobjs += f # *.obj
+ $extobjs += l # *.lib
$extobjs += " "
else
FALSE
@@ -431,6 +451,30 @@ else
end
end
+#template of .def file.
+#LIBRARY kconv.dll
+#CODE LOADONCALL
+#DATA LOADONCALL
+#DESCRIPTION 'win32 kconv.dll'
+#EXPORTS
+#
+# Init_kconv
+def makedef(basename)
+ defname = sprintf("%s.def", basename)
+ f = open(defname, "w")
+ f.printf "\
+LIBRARY %s.dll
+CODE LOADONCALL
+DATA LOADONCALL
+DESCRIPTION 'win32 %s.dll'
+EXPORTS
+
+ Init_%s
+", basename, basename
+ f.close
+
+end
+
#Local variables:
# mode: ruby
#end:
diff --git a/lib/date.rb b/lib/date.rb
index 260f6e79ec..cfb9b96904 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -73,8 +73,8 @@ class Date
end
def +(o)
- if o.kind_of?(Integer)
- d = self.period + o
+ if o.kind_of?(Numeric)
+ d = Integer(self.period + o)
elsif o.kind_of?(Date)
d = self.period + o.period
else
@@ -84,10 +84,10 @@ class Date
end
def -(o)
- if o.kind_of?(Integer)
- d = self.period - o
+ if o.kind_of?(Numeric)
+ d = Integer(self.period - o)
elsif o.kind_of?(Date)
- d = self.period - o.period
+ return Integer(self.period - o.period)
else
raise TypeError, "Illegal type. (Integer or Date)"
end
@@ -150,6 +150,12 @@ class Date
end
def Date.at(d)
+ if d.kind_of? Time
+ return Date.new(1900+d.year, d.mon, d.mday)
+ end
+ if d.kind_of? Date
+ return Date.at(d.period)
+ end
mm = 1
yy = (d / 366.0).to_i
if yy != 0
diff --git a/lib/tkcanvas.rb b/lib/tkcanvas.rb
index 26f0ac0c7b..de727c3e79 100644
--- a/lib/tkcanvas.rb
+++ b/lib/tkcanvas.rb
@@ -92,7 +92,7 @@ class TkCanvas<TkWindow
def itemtype(tag)
tk_send 'type', tagid(tag)
end
- def postscript(keys=None)
+ def postscript(keys)
tk_send "postscript", *hash_kv(keys)
end
def raise(tag, above=None)
diff --git a/missing/nt.c b/missing/nt.c
index b96ac93340..96db6166df 100644
--- a/missing/nt.c
+++ b/missing/nt.c
@@ -167,11 +167,7 @@ sleep(unsigned int len)
//
// Initialization stuff
//
-#if (_MSC_VER >= 1000)
-__declspec(dllexport) void __stdcall
-#else
void
-#endif
NtInitialize(int *argc, char ***argv) {
WORD version;
diff --git a/missing/nt.h b/missing/nt.h
index 70132b4577..b52cc4346c 100644
--- a/missing/nt.h
+++ b/missing/nt.h
@@ -84,7 +84,6 @@
#include <string.h>
#include <direct.h>
#include <process.h>
-#include <io.h>
#include <time.h>
#include <math.h>
#include <sys/types.h>
diff --git a/parse.y b/parse.y
index b7abb1bb58..6b0a124140 100644
--- a/parse.y
+++ b/parse.y
@@ -1520,11 +1520,11 @@ static void
tokadd(c)
char c;
{
+ tokenbuf[tokidx++] = c;
if (tokidx >= toksiz) {
toksiz *= 2;
REALLOC_N(tokenbuf, char, toksiz);
}
- tokenbuf[tokidx++] = c;
}
static int
@@ -1985,7 +1985,11 @@ retry:
c = nextc();
if (c == '\n') sourceline++;
}
- if (ismbchar(c)) c = nextc();
+ if (ismbchar(c)) {
+ c = nextc();
+ if (c == '\n')
+ break;
+ }
}
/* fall through */
case '\n':
diff --git a/sample/ruby-mode.el b/sample/ruby-mode.el
index 678a43ba77..78909b32a5 100644
--- a/sample/ruby-mode.el
+++ b/sample/ruby-mode.el
@@ -176,7 +176,7 @@ The variable ruby-indent-level controls the amount of indentation.
(indent-to x)
(move-to-column (+ x shift))))))
-(defun ruby-expr-beg ()
+(defun ruby-expr-beg (&optional modifier)
(save-excursion
(if (looking-at "\\?")
(progn
@@ -185,14 +185,22 @@ The variable ruby-indent-level controls the amount of indentation.
(skip-chars-backward " \t")
(or (bolp) (forward-char -1))
(or (looking-at ruby-operator-chars)
- (looking-at "[\\[({]")
+ (looking-at "[\\[({!?]")
(bolp)
(and (looking-at ruby-symbol-chars)
(forward-word -1)
(or
+ (and modifier (bolp))
(looking-at ruby-block-beg-re)
(looking-at ruby-block-op-re)
- (looking-at ruby-block-mid-re))
+ (looking-at ruby-block-mid-re)
+ (and modifier
+ (save-excursion
+ (forward-char -1)
+ (let ((c (char-after (point))))
+ (or (eq c ?.)
+ (eq c ? )
+ (eq c ?\t))))))
(goto-char (match-end 0))
(looking-at "[^_]"))))))
@@ -590,7 +598,6 @@ An end of a defun is found by moving forward from the beginning of one."
"in"
"module"
"next"
- "nil"
"not"
"or"
"raise"
@@ -611,19 +618,27 @@ An end of a defun is found by moving forward from the beginning of one."
"\\)[ \n\t()]")
2)
;; variables
- '("nil\\|self\\|TRUE\\|FALSE"
- 0 font-lock-variable-name-face)
+ '("\\(^\\|[^_]\\)\\b\\(nil\\|self\\|true\\|false\\)\\b[^_]"
+ 2 font-lock-variable-name-face)
;; variables
'("\\[$@].\\([a-zA-Z0-9_]\\)"
0 font-lock-variable-name-face)
;; constants
- '("\\b[A-Z]+[a-zA-Z0-9_]*"
- 0 font-lock-type-face)
+ '("\\(^\\|[^_]\\)\\b\\([A-Z]+[a-zA-Z0-9_]*\\)"
+ 2 font-lock-type-face)
;; functions
- '("\\bdef[ \t]+[a-zA-Z_]+[a-zA-Z0-9_]*[?!]?"
+ '("\\bdef[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*[?!=]?\\|\\[\\]=?\\)"
0 font-lock-function-name-face))
"*Additional expressions to highlight in ruby mode.")
- (add-hook 'ruby-mode-hook
- (lambda ()
- (setq font-lock-keywords ruby-font-lock-keywords)
- (font-lock-mode 1)))))
+ (if (and (>= (string-to-int emacs-version) 20)
+ (not (featurep 'xemacs)))
+ (add-hook
+ 'ruby-mode-hook
+ (lambda ()
+ (make-local-variable 'font-lock-defaults)
+ (setq font-lock-defaults
+ '((ruby-font-lock-keywords) nil nil ((?\_ . "w"))))))
+ (add-hook 'ruby-mode-hook
+ (lambda ()
+ (setq font-lock-keywords ruby-font-lock-keywords)
+ (font-lock-mode 1))))))
diff --git a/string.c b/string.c
index 7f1fae775e..b9025cc4f6 100644
--- a/string.c
+++ b/string.c
@@ -1609,7 +1609,7 @@ tr_squeeze(str1, str2)
UCHAR *s, *send, *t;
char c, save;
- if (str2) {
+ if (!NIL_P(str2)) {
tr_setup_table(str2, squeez);
}
else {
@@ -1646,7 +1646,7 @@ str_squeeze_bang(argc, argv, str1)
VALUE str2;
rb_scan_args(argc, argv, "01", &str2);
- if (str2) {
+ if (!NIL_P(str2)) {
Check_Type(str2, T_STRING);
}
return tr_squeeze(str1, str2);
diff --git a/version.h b/version.h
index da4280c037..390ba9fc3e 100644
--- a/version.h
+++ b/version.h
@@ -1,2 +1,2 @@
-#define RUBY_VERSION "1.0-971204"
-#define VERSION_DATE "97/12/04"
+#define RUBY_VERSION "1.0-971209"
+#define VERSION_DATE "97/12/09"
diff --git a/win32/ruby.def b/win32/ruby.def
index 1ec577d2a8..1c9e589849 100644
--- a/win32/ruby.def
+++ b/win32/ruby.def
@@ -1,6 +1,55 @@
+LIBRARY ruby.dll
+CODE LOADONCALL
+DATA LOADONCALL
DESCRIPTION 'win32 ruby.dll'
-
EXPORTS
+
+;missing/nt.c
+ NtInitialize
+;eval.c
ruby_init
- ruby_run
ruby_options
+ ruby_run
+;class.c
+ ;;rb_define_module_function
+ ;;rb_define_const
+ ;;rb_define_singleton_method
+ ;;rb_define_alias
+ rb_define_alias
+ rb_define_attr
+ rb_define_class
+ rb_define_class_id
+ rb_define_class_under
+ rb_define_global_function
+ rb_define_method
+ rb_define_method_id
+ rb_define_module
+ rb_define_module_function
+ rb_define_module_id
+ rb_define_module_under
+ rb_define_private_method
+ rb_define_singleton_method
+ rb_scan_args
+;variable.c
+ rb_define_const
+ rb_define_hooked_variable
+ rb_define_global_const
+ rb_define_readonly_variable
+ rb_define_variable
+ rb_define_virtual_variable
+;string.c
+ str_new
+ str_new2
+ str_new3
+ str_new4
+;numeric.c
+ num2int
+
+;error.c
+ rb_check_type
+ Fatal
+
+;gc.c
+ xmalloc
+ xcalloc
+