This is the mail archive of the cgen@sourceware.org mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch][commit] Location of (include file)


Forgot to include this part which also goes with this patch....

Dave

2006-05-09  Dave Brolley  <brolley@redhat.com>

	* utils.scm (dirname): New function.

Index: cgen/utils.scm
===================================================================
RCS file: /cvs/src/src/cgen/utils.scm,v
retrieving revision 1.18
diff -c -p -r1.18 utils.scm
*** cgen/utils.scm	15 Jun 2005 21:28:19 -0000	1.18
--- cgen/utils.scm	9 May 2006 18:19:54 -0000
***************
*** 1,5 ****
  ; Generic Utilities.
! ; Copyright (C) 2000-2005 Red Hat, Inc.
  ; This file is part of CGEN.
  ; See file COPYING.CGEN for details.
  
--- 1,5 ----
  ; Generic Utilities.
! ; Copyright (C) 2000-2005, 2006 Red Hat, Inc.
  ; This file is part of CGEN.
  ; See file COPYING.CGEN for details.
  
***************
*** 155,160 ****
--- 155,169 ----
  		   (->string str))
  )
  
+ ; Return the directory name of the given file name
+ 
+ (define (dirname s)
+   (let loop ((i (string-length s)))
+     (cond ((= i 0) "")
+ 	  ((char=? #\/ (string-ref s (- i 1))) (substring s 0 i))
+ 	  (else (loop (- i 1)))))
+ )
+ 
  ; Turn STR into lowercase.
  
  (define (string-downcase str)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]