diff options
| author | Damien Doligez <damien.doligez-inria.fr> | 2010-08-30 10:16:22 +0000 |
|---|---|---|
| committer | Damien Doligez <damien.doligez-inria.fr> | 2010-08-30 10:16:22 +0000 |
| commit | b6aec49badbcf3828d605931907bf419f651173a (patch) | |
| tree | 07983508ef81d4414abbbf217de4561f476b2436 | |
| parent | 647e1917eea456a72e262102df153a1104a2eb6b (diff) | |
| download | ocaml-b6aec49badbcf3828d605931907bf419f651173a.tar.gz | |
PR#5136: get rid of some warnings
git-svn-id: http://caml.inria.fr/svn/ocaml/version/3.12@10661 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
| -rw-r--r-- | emacs/Makefile | 6 | ||||
| -rw-r--r-- | emacs/caml-emacs.el | 2 | ||||
| -rw-r--r-- | emacs/caml-types.el | 49 | ||||
| -rw-r--r-- | emacs/caml-xemacs.el | 3 | ||||
| -rw-r--r-- | emacs/camldebug.el | 20 | ||||
| -rw-r--r-- | emacs/inf-caml.el | 8 |
6 files changed, 49 insertions, 39 deletions
diff --git a/emacs/Makefile b/emacs/Makefile index 9519b396a5..077770c64f 100644 --- a/emacs/Makefile +++ b/emacs/Makefile @@ -72,5 +72,9 @@ ocamltags: ocamltags.in install-ocamltags: ocamltags cp ocamltags $(SCRIPTDIR)/ocamltags +# This is for testing purposes +compile-only: + $(EMACS) --batch --eval '$(COMPILECMD)' + clean: - rm -f ocamltags *~ #*# + rm -f ocamltags *~ #*# *.elc diff --git a/emacs/caml-emacs.el b/emacs/caml-emacs.el index d034ff304a..3f0fff0300 100644 --- a/emacs/caml-emacs.el +++ b/emacs/caml-emacs.el @@ -39,5 +39,7 @@ (or (member 'drag modifiers) (member 'click modifiers))))) +(defun caml-string-to-int (x) + (if (fboundp 'string-to-number) (string-to-number x) (string-to-int x))) (provide 'caml-emacs) diff --git a/emacs/caml-types.el b/emacs/caml-types.el index 05b1a2c0a6..3c7433a813 100644 --- a/emacs/caml-types.el +++ b/emacs/caml-types.el @@ -264,13 +264,13 @@ See `caml-types-location-re' for annotation file format. ((string-match def-re kind) (let ((var-name (match-string 1 kind)) (l-file (file-name-nondirectory (match-string 2 kind))) - (l-line (string-to-int (match-string 4 kind))) - (l-bol (string-to-int (match-string 5 kind))) - (l-cnum (string-to-int (match-string 6 kind))) + (l-line (caml-string-to-int (match-string 4 kind))) + (l-bol (caml-string-to-int (match-string 5 kind))) + (l-cnum (caml-string-to-int (match-string 6 kind))) (r-file (file-name-nondirectory (match-string 7 kind))) - (r-line (string-to-int (match-string 9 kind))) - (r-bol (string-to-int (match-string 10 kind))) - (r-cnum (string-to-int (match-string 11 kind)))) + (r-line (caml-string-to-int (match-string 9 kind))) + (r-bol (caml-string-to-int (match-string 10 kind))) + (r-cnum (caml-string-to-int (match-string 11 kind)))) (let* ((lpos (vector l-file l-line l-bol l-cnum)) (rpos (vector r-file r-line r-bol r-cnum)) (left (caml-types-get-pos target-buf lpos)) @@ -280,9 +280,9 @@ See `caml-types-location-re' for annotation file format. ((string-match def-end-re kind) (let ((var-name (match-string 1 kind)) (l-file (file-name-nondirectory (match-string 2 kind))) - (l-line (string-to-int (match-string 4 kind))) - (l-bol (string-to-int (match-string 5 kind))) - (l-cnum (string-to-int (match-string 6 kind)))) + (l-line (caml-string-to-int (match-string 4 kind))) + (l-bol (caml-string-to-int (match-string 5 kind))) + (l-cnum (caml-string-to-int (match-string 6 kind)))) (let* ((lpos (vector l-file l-line l-bol l-cnum)) (left (caml-types-get-pos target-buf lpos)) (right (buffer-size target-buf))) @@ -291,13 +291,13 @@ See `caml-types-location-re' for annotation file format. ((string-match internal-re kind) (let ((var-name (match-string 1 kind)) (l-file (file-name-nondirectory (match-string 2 kind))) - (l-line (string-to-int (match-string 4 kind))) - (l-bol (string-to-int (match-string 5 kind))) - (l-cnum (string-to-int (match-string 6 kind))) + (l-line (caml-string-to-int (match-string 4 kind))) + (l-bol (caml-string-to-int (match-string 5 kind))) + (l-cnum (caml-string-to-int (match-string 6 kind))) (r-file (file-name-nondirectory (match-string 7 kind))) - (r-line (string-to-int (match-string 9 kind))) - (r-bol (string-to-int (match-string 10 kind))) - (r-cnum (string-to-int (match-string 11 kind)))) + (r-line (caml-string-to-int (match-string 9 kind))) + (r-bol (caml-string-to-int (match-string 10 kind))) + (r-cnum (caml-string-to-int (match-string 11 kind)))) (let* ((lpos (vector l-file l-line l-bol l-cnum)) (rpos (vector r-file r-line r-bol r-cnum)) (left (caml-types-get-pos target-buf lpos)) @@ -345,11 +345,12 @@ See `caml-types-location-re' for annotation file format. (message "done")) ))) +(defun caml-types-parent-dir (d) (file-name-directory (directory-file-name d))) + (defun caml-types-locate-type-file (target-path) (let ((sibling (concat (file-name-sans-extension target-path) ".annot"))) (if (file-exists-p sibling) sibling - (defun parent-dir (d) (file-name-directory (directory-file-name d))) (let ((project-dir (file-name-directory sibling)) type-path) (while (not (file-exists-p @@ -357,10 +358,10 @@ See `caml-types-location-re' for annotation file format. (expand-file-name (file-relative-name sibling project-dir) (expand-file-name "_build" project-dir))))) - (if (equal project-dir (parent-dir project-dir)) + (if (equal project-dir (caml-types-parent-dir project-dir)) (error (concat "No annotation file. " "You should compile with option \"-annot\"."))) - (setq project-dir (parent-dir project-dir))) + (setq project-dir (caml-types-parent-dir project-dir))) type-path)))) (defun caml-types-date< (date1 date2) @@ -400,13 +401,13 @@ See `caml-types-location-re' for annotation file format. (annotation ())) (while (re-search-forward caml-types-location-re () t) (let ((l-file (file-name-nondirectory (match-string 1))) - (l-line (string-to-int (match-string 3))) - (l-bol (string-to-int (match-string 4))) - (l-cnum (string-to-int (match-string 5))) + (l-line (caml-string-to-int (match-string 3))) + (l-bol (caml-string-to-int (match-string 4))) + (l-cnum (caml-string-to-int (match-string 5))) (r-file (file-name-nondirectory (match-string 6))) - (r-line (string-to-int (match-string 8))) - (r-bol (string-to-int (match-string 9))) - (r-cnum (string-to-int (match-string 10)))) + (r-line (caml-string-to-int (match-string 8))) + (r-bol (caml-string-to-int (match-string 9))) + (r-cnum (caml-string-to-int (match-string 10)))) (unless (caml-types-not-in-file l-file r-file target-file) (setq annotation ()) (while (next-annotation) diff --git a/emacs/caml-xemacs.el b/emacs/caml-xemacs.el index fe141c5ce2..5ab40382db 100644 --- a/emacs/caml-xemacs.el +++ b/emacs/caml-xemacs.el @@ -50,4 +50,7 @@ (and (button-release-event-p event) (equal (event-button original) (event-button event)))) +(defun caml-string-to-int (x) + (if (fboundp 'string-to-number) (string-to-number x) (string-to-int x))) + (provide 'caml-xemacs) diff --git a/emacs/camldebug.el b/emacs/camldebug.el index d5ba599cc7..57a98701b5 100644 --- a/emacs/camldebug.el +++ b/emacs/camldebug.el @@ -302,8 +302,8 @@ buffer, then try to obtain the time from context around point." ((save-excursion (beginning-of-line 1) (looking-at "^Time : \\([0-9]+\\) - pc : [0-9]+ ")) - (string-to-int (match-string 1))) - ((string-to-int (camldebug-format-command "%e")))))) + (caml-string-to-int (match-string 1))) + ((caml-string-to-int (camldebug-format-command "%e")))))) (camldebug-call "goto" nil time))) (t (let ((module (camldebug-module-name (buffer-file-name))) @@ -325,7 +325,7 @@ buffer, then try to obtain the time from context around point." " - module " module "$") nil t) (match-string 1))))) - (if address (camldebug-call "goto" nil (string-to-int address)) + (if address (camldebug-call "goto" nil (caml-string-to-int address)) (error "No time at %s at %s" module camldebug-goto-position)))))) @@ -383,12 +383,12 @@ around point." (arg (cond ((eobp) (save-excursion (re-search-backward bpline nil t)) - (string-to-int (match-string 1))) + (caml-string-to-int (match-string 1))) ((save-excursion (beginning-of-line 1) (looking-at bpline)) - (string-to-int (match-string 1))) - ((string-to-int (camldebug-format-command "%e")))))) + (caml-string-to-int (match-string 1))) + ((caml-string-to-int (camldebug-format-command "%e")))))) (camldebug-call "delete" nil arg))) (t (let ((camldebug-delete-file @@ -409,7 +409,7 @@ around point." camldebug-delete-file camldebug-delete-position) (camldebug-call "delete" nil - (string-to-int camldebug-delete-output))))))))) + (caml-string-to-int camldebug-delete-output))))))))) (defun camldebug-complete-filter (string) (setq camldebug-filter-accumulator @@ -529,9 +529,9 @@ the camldebug commands `cd DIR' and `directory'." (let ((isbefore (string= "before" (match-string 5 camldebug-filter-accumulator))) - (startpos (string-to-int + (startpos (caml-string-to-int (match-string 3 camldebug-filter-accumulator))) - (endpos (string-to-int + (endpos (caml-string-to-int (match-string 4 camldebug-filter-accumulator)))) (list (match-string 2 camldebug-filter-accumulator) (if isbefore startpos endpos) @@ -704,7 +704,7 @@ Obeying it means displaying in another window the specified file and line." (move-overlay camldebug-overlay-under spos (- epos 1) buffer)) (save-excursion (set-buffer buffer) - (goto-char pos) + (goto-char spos) (beginning-of-line) (move-marker camldebug-event-marker (point)) (setq overlay-arrow-position camldebug-event-marker)))) diff --git a/emacs/inf-caml.el b/emacs/inf-caml.el index ba2eb0390b..a4b5adfefb 100644 --- a/emacs/inf-caml.el +++ b/emacs/inf-caml.el @@ -163,7 +163,7 @@ Input and output via buffer `*inferior-caml*'." (setq count (+ count 1))) (if (equal (buffer-name (current-buffer)) inferior-caml-buffer-name) - (end-of-buffer)) + (goto-char (point-max))) (while (> count 0) (previous-multiframe-window) @@ -201,7 +201,7 @@ Input and output via buffer `*inferior-caml*'." (re-search-backward (concat comint-prompt-regexp "[ \t]*Characters[ \t]+\\([0-9]+\\)-[0-9]+:$")) - (string-to-int (match-string 1)))))) + (caml-string-to-int (match-string 1)))))) (goto-char loc))) @@ -265,8 +265,8 @@ should lies." (cond ((re-search-forward " *Characters \\([01-9][01-9]*\\)-\\([1-9][01-9]*\\):\n[^W]" (point-max) t) - (setq beg (string-to-int (caml-match-string 1))) - (setq end (string-to-int (caml-match-string 2))) + (setq beg (caml-string-to-int (caml-match-string 1))) + (setq end (caml-string-to-int (caml-match-string 2))) (switch-to-buffer buf) (goto-char orig) (forward-byte end) |
