2 Name
(require pmsf/name) | package: pmsf-name |
2.1 Name special elements
procedure
(pcategory? v) → boolean?
v : any
> (pcategory? "app-misc") #t
> (pcategory? "editor-wrapper") #t
2.2 Name structs
"Name" structs mimic PMS variables derived from package/ebuild names, for reference see Defined Variables (Package Manager Specification, p. 11.1).
struct
(struct pversion (release alpha beta pre rc p revision) #:extra-constructor-name make-pversion #:transparent) release : string? alpha : (listof (or/c string? #true)) beta : (listof (or/c string? #true)) pre : (listof (or/c string? #true)) rc : (listof (or/c string? #true)) p : (listof (or/c string? #true)) revision : exact-nonnegative-integer?
> (pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9) (pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9)
struct
(struct pfull (name version) #:extra-constructor-name make-pfull #:transparent) name : pname? version : (or/c #false pversion?)
> (pfull "editor-wrapper" (pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9))
(pfull
"editor-wrapper"
(pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9))
struct
(struct pcomplete (category full) #:extra-constructor-name make-pcomplete #:transparent) category : pcategory? full : pfull?
> (pcomplete "app-misc" (pfull "editor-wrapper" (pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9)))
(pcomplete
"app-misc"
(pfull
"editor-wrapper"
(pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9)))
2.3 Name conversion
2.3.1 PVersion conversion
procedure
(pversion->string input-pversion) → string?
input-pversion : pversion?
> (pversion->string (pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9)) "1.2.3_alpha4_beta5_pre6_rc7_p8-r9"
procedure
(port->pversion input-port) → pversion?
input-port : input-port?
procedure
(string->pversion input-string) → pversion?
input-string : string?
> (string->pversion "1.2.3_alpha4_beta5_pre6_rc7_p8-r9") (pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9)
2.3.2 PFull conversion
procedure
(pfull->string input-pfull) → string?
input-pfull : pfull?
> (pfull->string (pfull "editor-wrapper" (pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9))) "editor-wrapper-1.2.3_alpha4_beta5_pre6_rc7_p8-r9"
procedure
(string->pfull input-string) → pfull?
input-string : string?
> (string->pfull "editor-wrapper-1.2.3_alpha4_beta5_pre6_rc7_p8-r9")
(pfull
"editor-wrapper"
(pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9))
2.3.3 PComplete conversion
procedure
(pcomplete->string input-pcomplete) → string?
input-pcomplete : pcomplete?
> (pcomplete->string (pcomplete "app-misc" (pfull "editor-wrapper" (pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9)))) "app-misc/editor-wrapper-1.2.3_alpha4_beta5_pre6_rc7_p8-r9"
procedure
(string->pcomplete input-string) → pcomplete?
input-string : string?
> (string->pcomplete "app-misc/editor-wrapper-1.2.3_alpha4_beta5_pre6_rc7_p8-r9")
(pcomplete
"app-misc"
(pfull
"editor-wrapper"
(pversion "1.2.3" '("4") '("5") '("6") '("7") '("8") 9)))