rexx-address-book/addbook.rex

72 lines
1.9 KiB
Rexx
Raw Normal View History

2025-05-04 18:07:21 +00:00
#!/usr/bin/env rexx
/***************************************************************************
* Rexx Address Book *
* *
* A simple application for storing, maintaining, and browsing contact *
* information. *
* *
* Backend: Object Rexx with unix system, and sqlite extensions. *
* Frontend: Object Rexx with ncurses extensions. *
**************************************************************************/
signal on HALT name ProgramHalt
.environment['STOPNOW'] = 0
call setEnv
app = .AddressBookApp~new()
app~run()
Do forever
if .environment['STOPNOW'] = 1 then do
app~cleanup() /* Clean up before exiting */
2025-05-05 13:52:40 +00:00
call SysCls
2025-05-04 18:07:21 +00:00
exit 0
end
app~reloop()
end
Exit
::CLASS AddressBookApp PUBLIC
::METHOD Init
expose ui db
db = .AddressBookDB~new()
ui = .AddressBookUI~new(db)
2025-05-04 18:07:21 +00:00
return
::method run
expose ui
ui~initialize
ui~mainLoop
ui~cleanup
return
::method reloop
expose ui
ui~mainLoop
RETURN
::method cleanup
expose db
db~closeDb()
return
2025-05-05 13:52:40 +00:00
::ROUTINE setEnv
.environment~home = SysGetpwnam("gmgauthier", "d")
.environment~projectRoot = .home||"/Projects/rexx-address-book"
.environment~pkgPath = .projectRoot||"/app"
.environment~dbPath = .projectRoot||"/db"
2025-05-05 16:40:49 +00:00
.environment~dbFile = .dbPath||"/contacts.sqlite"
2025-05-05 13:52:40 +00:00
.environment["REXX_PATH"] = .projectRoot||";"||.pkgPath||";"||.dbPath||";"
2025-05-04 18:07:21 +00:00
/** External Libraries **/
2025-05-05 13:52:40 +00:00
::requires 'app/appdb.cls'
::requires 'app/appui.cls'
::requires 'app/utils.rex'
2025-05-04 18:07:21 +00:00
::requires 'ooSQLite.cls'
::requires "rxunixsys" LIBRARY
::requires 'ncurses.cls'
2025-05-05 13:52:40 +00:00