GNU   davin.50webs.com/research
Bringing to you notes for the ages

       Main Menu          Research Projects         Photo Album            Curriculum Vitae      The Greatest Artists
    Email Address       Computer Games          Web Design          Java Training Wheels      The Fly (A Story)   
  Political Activism   Scruff the Cat       My Life Story          Smoking Cessation          Other Links      
Debugging Macros     String Class I     Linked List System I Java for C Programmers Naming Convention
    String Class II         How I use m4              Strings III                 Symmetrical I/O             Linked Lists II     
Run-Time Type Info   Virtual Methods      An Array System        Science & Religion            Submodes       
  Nested Packages      Memory Leaks    Garbage Collection      Internet & Poverty      What is Knowledge?
Limits of Evolution   Emacs Additions      Function Plotter           Romantic Love        The Next Big Thing
    Science Fiction     Faster Compilation Theory of Morality         Elisp Scoping               Elisp Advice      
  S.O.G.M. Pattern       Safe Properties         School Bullying          Charisma Control          Life and Death    
     Splitting Java          Multiple Ctors       Religious Beliefs         Conversation 1           Conversation 2    
   J.T.W. Language    Emacs Additions II      Build Counter             Relation Plotter          Lisp++ Language  
  Memory Leaks II   Super Constructors CRUD Implementation Order a Website Form There Is An Afterlife
More Occam's Razor C to Java Translator Theory of Morality II


autogc-nostuff.el

    

;;; autogc-nostuff.el

;; Copyright (C) 2014-2015 Davin Pearson

;; Emacs Lisp Archive Entry
;; Filename: autogc-nostuff.el
;; Author/Maintainer: Davin Max Pearson <http://davin.50webs.com>
;; Keywords: autogc
;; Version: 1.2

;;; Commentary:

;; This file is not part of GNU Emacs.

;;; Limitation of Warranty

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs, see the file COPYING.  If not, see:
;;
;; <http://www.gnu.org/licenses/gpl-3.0.txt>.


;;; Known Bugs:

;; None so far!

;;; Code:

;;; autogc-nostuff--list picks up situations like this:
;;;
;;;  (1) Bool_A* b = ...
;;;
;;; and
;;;
;;;  (2) bool* b = ...
;;;  (3) new bool()
;;;
;;; G++ compiler picks up attempts to create inline objects like "Bool_A b;"
;;;
;;; (because Bool_A::Bool_A(/* ... */) is private)
;;;
;;; instead use "bool b;" or "ptr<Bool_A> b;"
;;;

(let ((identifier-regexp "\\<[a-zA-Z_][a-zA-Z0-9_]*_A\\>"))
  (setq autogc-nostuff--list-nostar
        (list identifier-regexp
              (concat "Array_A<"                         identifier-regexp ">")
              (concat "Array_A<Array_A<"                 identifier-regexp "> >")
              (concat "Array_A<Array_A<Array_A<"         identifier-regexp "> > >")
              (concat "Array_A<Array_A<Array_A<Array_A<" identifier-regexp "> > > >")
              (concat "List_A<"                          identifier-regexp ">")))

(setq autogc-nostuff--list-nostar-nonew
        (list "bool" "int" "quick" "double"
              "v3i" "v3q" "v3d"
              "xyi" "xyq" "xyd")))

;;;
;;; TODO: autogc--are-we-editing-p
;;;
;;; TODO: autogc--error
;;;
;;; TODO: why does it delete buffer ~/dlisp/a.cc
;;;
;;; TODO: where is "**** Here is the list of errors"
;;;
;;; TODO: where is "**** End of autogc"
;;;
;;;
(defun autogc-nostuff--test-file (filename)

(let ((case-fold-search nil)
        (were-editing     nil))

(let ((auto-mode-alist (cons '("" . c++-no-fonts-mode) auto-mode-alist)))
      (setq were-editing (autogc--are-we-editing-p filename))
      (save-buffer (find-file-read-only filename))
      (goto-char (point-min)))

(let ((ptr  (append autogc-nostuff--list-nostar autogc-nostuff--list-nostar-nonew))
          (line nil)
          (expr nil))
      (while ptr
        (goto-char (point-min))
        (setq expr (concat (car ptr) "\\*"))
        (while (re-search-forward expr nil t)
          (setq line (d-what-line))
          (autogc--error "*** Error (%s:%d) searching for %s"
                        filename
                        line
                        (prin1-to-string expr)))
        (setq ptr (cdr ptr))))

(let ((ptr  autogc-nostuff--list-nostar-nonew)
          (line nil)
          (expr nil))
      (while ptr
        (goto-char (point-min))
        (setq expr (concat "new " (car ptr) "("))
        (while (re-search-forward expr nil t)
          (setq line (d-what-line))
          (autogc--error "*** Error (%s:%d) searching for %s"
                        filename
                        line
                        (prin1-to-string expr)))
        (setq ptr (cdr ptr))))

    ;;
    ;; NOTE: were-editing is true, so it doesn't delete the buffer...
    ;;
    (if were-editing
        (setq buffer-read-only nil)
      (kill-buffer nil))

)
  )

(defun autogc-nostuff--do-all (file-list)

  ;;(when (not noninteractive)
  ;;  (if (get-buffer autogc--log-buffer-name)
  ;;      (kill-buffer autogc--log-buffer-name))
  ;;  (save-excursion
  ;;    (set-buffer (generate-new-buffer autogc--log-buffer-name))
  ;;    (compilation-mode)))

  (let ((ptr file-list))
    (while ptr
      (autogc-nostuff--test-file (car ptr))
      (setq ptr (cdr ptr))))

  ;;(when (not noninteractive)
  ;;  (switch-to-buffer autogc--log-buffer-name))
  )

;;;
;;; NOTE: not intended for normal use as the autogc buffer is not reset as it should be...
;;;
(defun autogc-nostuff--do-me ()
  (autogc-nostuff--do-all (list (buffer-file-name))))

(provide 'autogc-nostuff)
Back
| Main Menu | Research Projects | Photo Album | Curriculum Vitae | The Greatest Artists |
| Email Address | Computer Games | Web Design | Java Training Wheels | The Fly (A Story) |
| Political Activism | Scruff the Cat | My Life Story | Smoking Cessation | Other Links |
| Debugging Macros | String Class I | Linked List System I | Java for C Programmers | Naming Convention |
| String Class II | How I use m4 | Strings III | Symmetrical I/O | Linked Lists II |
| Run-Time Type Info | Virtual Methods | An Array System | Science & Religion | Submodes |
| Nested Packages | Memory Leaks | Garbage Collection | Internet & Poverty | What is Knowledge? |
| Limits of Evolution | Emacs Additions | Function Plotter | Romantic Love | The Next Big Thing |
| Science Fiction | Faster Compilation | Theory of Morality | Elisp Scoping | Elisp Advice |
| S.O.G.M. Pattern | Safe Properties | School Bullying | Charisma Control | Life and Death |
| Splitting Java | Multiple Ctors | Religious Beliefs | Conversation 1 | Conversation 2 |
| J.T.W. Language | Emacs Additions II | Build Counter | Relation Plotter | Lisp++ Language |
| Memory Leaks II | Super Constructors | CRUD Implementation | Order a Website Form | There Is An Afterlife |
| More Occam's Razor | C to Java Translator | Theory of Morality II
Last modified: Sat Apr 29 18:38:22 NZST 2017
Best viewed at 800x600 or above resolution.
© Copyright 1999-2017 Davin Pearson.
Please report any broken links to