;;-*-Lisp-*-
(in-package goal)

;; name: glist-h.gc
;; name in dgo: glist-h
;; dgos: ENGINE, GAME

;; DECOMP BEGINS

;; this file is debug only
(declare-file (debug))

(deftype glst-node (structure)
  ((next  glst-node)
   (prev  glst-node)
   )
  )


(deftype glst-named-node (glst-node)
  ((privname  string)
   )
  )


(deftype glst-list (structure)
  ((head      glst-node)
   (tail      glst-node)
   (tailpred  glst-node)
   (numelem   int32)
   )
  )


(defun glst-next ((arg0 glst-node))
  "return the next node in the list"
  (-> arg0 next)
  )

(defun glst-prev ((arg0 glst-node))
  "return the previous node in the list"
  (-> arg0 prev)
  )

(defun glst-head ((arg0 glst-list))
  "return the start of the list"
  (-> arg0 head)
  )

(defun glst-tail ((arg0 glst-list))
  "return the tail of the list"
  (-> arg0 tailpred)
  )

(defun glst-end-of-list? ((arg0 glst-node))
  "is this node the end of the list. #t = end"
  (not (-> arg0 next))
  )

(defun glst-start-of-list? ((arg0 glst-node))
  "is this node the start of the list. #t = start"
  (not (-> arg0 prev))
  )

(defun glst-empty? ((arg0 glst-list))
  "is the list empty, #t = empty"
  (= (-> arg0 tailpred) arg0)
  )

(defun glst-node-name ((arg0 glst-named-node))
  "Returns the `privname` of the provided [[glst-named-node]]"
  (-> arg0 privname)
  )

(defun glst-set-name! ((arg0 glst-named-node) (arg1 string))
  "Sets the `privname` of the provided [[glst-named-node]]"
  (set! (-> arg0 privname) arg1)
  arg1
  )
