( This program is used to emulate the functions of a library. It's original intent was for works of poetry but could certainly be used for other things. It needs the following properties to work: _library: ) : say ( s -- ) me @ swap notify ; : presay ( s -- ) "> " swap strcat say ; : prg ( -- d ) trigger @ getlink ; : tl ( -- d ) trigger @ location ; : unparse_dbref ( s -- s ) dup "#" 1 strncmp not if 1 strcut swap pop then ; : pad ( s i -- s ) " " dup strcat dup strcat dup strcat over 80 > if pop pop exit then swap strcut pop over strlen over strlen > if strlen swap pop strcut pop else over strlen strcut swap pop strcat then ; : lw ( s -- s ) "| " swap strcat ; : mw ( s -- s ) " | " strcat ; : rw ( s -- s ) " |" strcat ; : box ( s -- s ) lw rw ; : pause ( -- s ) " to continue, Q to quit" say read ; : lib ( -- d ) tl "_library" getpropstr unparse_dbref atoi dbref dup dup #-1 dbcmp swap #0 dbcmp or if "**WARNING: Library storage broken**" 50 pad lw "" 16 pad box strcat say pop loc @ then ; : catalog_list ( d1 ... dN -- ) dup #-1 dbcmp if pop pop exit then dup thing? if dup name 50 pad lw over owner name 16 pad box strcat me @ swap notify then over 10 % not if pause "q" stringcmp not if #-1 catalog_list exit then then next catalog_list ; : do_catalog ( -- ) "+---------------------------------------------------" "+------------------+" strcat say "Book Title" 50 pad lw "Author" 16 pad box strcat say "+---------------------------------------------------" "+------------------+" strcat say 1 lib contents catalog_list "+---------------------------------------------------" "+------------------+" strcat say ; : do_return : do_checkout lib swap rmatch dup #-1 dbcmp if "> That book is either checked out or non-existant." say pop exit then "> You take out the book: '" over name strcat " (" strcat over owner name strcat ")'" strcat say me @ name " takes out book : do_info ( -- ) "> Library room information:" say ">" say "> info = look at his help screen" say "> catalog = check the card catalog" say "> borrow = borrow a book that's in" say "> return = return a book to the stacks" say ">" say "> Library v0.1, written by Sjade" say ; : main ( s -- ) .sstrip trigger @ name "info" 4 strncmp not if pop do_info exit then trigger @ name "cat" 3 strncmp not if pop do_catalog exit then trigger @ name "bor" 3 strncmp not trigger @ name "che" 3 strncmp not or if do_checkout exit then trigger @ name "ret" 3 strncmp not trigger @ name "dep" 3 strncmp not or if do_return exit then ;