Versions of the Aldor compiler up to 1.0.3 (I have not actually checked 
1.1.0rc1) cannot properly deal with #line directives.

ALLPROSE is a framework to produce Aldor libraries. Instead of .as 
files, the sources are noweb files (extension .as.nw). The .as files are 
actually generated and fed to the compiler. If an error is encountered 
the filename and line number point to the .as file. That is however 
*not* the actual source.

If compiling inside Emacs, the 'next-error' command jumps to the .as 
file and up to now one had to read the ALLPROSE-generated directives like

--#line 240 "sitools/sitools.as.nw"

to figure out manually where the error in the actual source file is.

With the help and code of Cliff Yap and Jay Belanger, I could now put 
together some lines that one has to put into the .xemacs/init.el file.
Now M-F12 jumps correctly into the .as.nw file.

Thank you Cliff and thank you Jay.

Ralf

PS: Since the .as file is still loaded by next-error, does someone know 
how I can get rid of those buffers in allprose-workaround-aldor-next-error ?


;--Workaround for the Aldor compiler bug of being unable to deal
;-- properly with #line directives
(defvar pamphlet-line-id "--#line ")
(defun find-previous-pamphlet-id-line ()
   (re-search-backward pamphlet-line-id nil t))
;;ALLPROSE spits out lines like
;;--#line 211 "poly/idxpp.as.nw"
(defun allprose-previous-input ()
   "Move to the previous input line."
   (interactive)
   (let ((orig (point))
         (pt (find-previous-pamphlet-id-line)))
     (if (not pt)
         (message "No id line found.")
       (let ((n (count-lines pt orig))
             (filename)
             (lineno))
        (re-search-forward " +")
        (setq lineno (current-word))
        (re-search-forward " +\"")
        (setq filename (thing-at-point 'filename))
        (find-file filename)
        (goto-line (+ n (string-to-number lineno) -1))))))

(defun allprose-workaround-aldor-next-error ()
   "Move point to the next error position in the corresponding .as.nw file."
   (interactive)
   (next-error)
   (allprose-previous-input))

(global-set-key [(meta f12)] 'allprose-workaround-aldor-next-error)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Aldor-combinat-devel mailing list
Aldor-combinat-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/aldor-combinat-devel

Reply via email to