-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move load/unload stuff to private functions
* PKG_ADD, PKG_DEL: remove script body and call provate function * private/sqlite_pkg_add.m, private/sqlite_pkg_del.m: new file
- Loading branch information
Showing
4 changed files
with
92 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,3 @@ | ||
# on package load, attempt to load docs | ||
try | ||
pkg_dir = fileparts (fullfile (mfilename ("fullpath"))); | ||
doc_file = fullfile (pkg_dir, "doc", "octave-aqlite.qch"); | ||
if exist(doc_file, "file") | ||
if exist("__event_manager_register_documentation__") | ||
__event_manager_register_documentation__ (doc_file); | ||
elseif exist("__event_manager_register_doc__") | ||
__event_manager_register_doc__ (doc_file); | ||
endif | ||
endif | ||
catch | ||
# do nothing | ||
end_try_catch | ||
# on package load, call private add | ||
|
||
sqlite_pkg_add(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,2 @@ | ||
# on package unload, attempt to unload docs | ||
try | ||
pkg_dir = fileparts (fullfile (mfilename ("fullpath"))); | ||
doc_file = fullfile (pkg_dir, "doc", "octave-sqlite.qch"); | ||
if exist(doc_file, "file") | ||
if exist("__event_manager_unregister_documentation__") | ||
__event_manager_unregister_documentation__ (doc_file); | ||
elseif exist("__event_manager_unregister_doc__") | ||
__event_manager_unregister_doc__ (doc_file); | ||
endif | ||
endif | ||
catch | ||
# do nothing | ||
end_try_catch | ||
# on unload, call private del | ||
sqlite_pkg_del (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
## Copyright (C) 2022 John Donoghue <john.donoghue@ieee.org> | ||
## | ||
## This program is free software: you can redistribute it and/or modify it | ||
## under the terms of the GNU General Public License as published by | ||
## the Free Software Foundation, either version 3 of the License, or | ||
## (at your option) any later version. | ||
## | ||
## This program is distributed in the hope that it will be useful, but | ||
## WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with this program. If not, see | ||
## <https://www.gnu.org/licenses/>. | ||
|
||
## -*- texinfo -*- | ||
## @deftypefn {} {} sqlite_pkg_add() | ||
## private function | ||
## @end deftypefn | ||
function sqlite_pkg_add () | ||
# on package load, attempt to load docs | ||
try | ||
pkg_dir = fileparts (fullfile (mfilename ("fullpath"))); | ||
doc_file = fullfile (pkg_dir, "..", "doc", "octave-aqlite.qch"); | ||
if exist(doc_file, "file") | ||
if exist("__event_manager_register_documentation__") | ||
__event_manager_register_documentation__ (doc_file); | ||
elseif exist("__event_manager_register_doc__") | ||
__event_manager_register_doc__ (doc_file); | ||
endif | ||
endif | ||
catch | ||
# do nothing | ||
end_try_catch | ||
|
||
# if table type exists, use it, otherwise use dbtable | ||
if exist ("table") == 0 | ||
assignin("base", "table", @dbtable); | ||
endif | ||
|
||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
## Copyright (C) 2022 John Donoghue <john.donoghue@ieee.org> | ||
## | ||
## This program is free software: you can redistribute it and/or modify it | ||
## under the terms of the GNU General Public License as published by | ||
## the Free Software Foundation, either version 3 of the License, or | ||
## (at your option) any later version. | ||
## | ||
## This program is distributed in the hope that it will be useful, but | ||
## WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with this program. If not, see | ||
## <https://www.gnu.org/licenses/>. | ||
|
||
## -*- texinfo -*- | ||
## @deftypefn {} {} sqlite_pkg_del() | ||
## private function | ||
## @end deftypefn | ||
function sqlite_pkg_del () | ||
|
||
# on package unload, attempt to unload docs | ||
try | ||
pkg_dir = fileparts (fullfile (mfilename ("fullpath"))); | ||
doc_file = fullfile (pkg_dir, "..", "doc", "octave-sqlite.qch"); | ||
if exist(doc_file, "file") | ||
if exist("__event_manager_unregister_documentation__") | ||
__event_manager_unregister_documentation__ (doc_file); | ||
elseif exist("__event_manager_unregister_doc__") | ||
__event_manager_unregister_doc__ (doc_file); | ||
endif | ||
endif | ||
catch | ||
# do nothing | ||
end_try_catch | ||
|
||
try | ||
if exist ("table") == 1 && (table == @dbtable) | ||
evalin("base", "clear table"); | ||
endif | ||
catch | ||
# do nothing | ||
end_try_catch | ||
endfunction |