Pseudocode for a Typical Install
From InterBase
Go Up to Using the Install and Licensing APIs
The following code indicates the steps you would typically take in writing an install. Calls to functions in the Install API and related specific code are in bold.
begin OPTIONS_HANDLE handle; boolean done = false; LANG_TYPE language; /* Get user preference if desired. This is if you created translated * ibinstall.msg files in different directories */ language = get_language_choice(); if (language <> english) isc_install_load_external_text(lang_dirs[language]); /* Query install for all the possible option names */ while(not all options) begin isc_install_get_info(isc_install_info_opname, option, opname buffer, ISC_INSTALL_MAX_MESSAGE_LEN); isc_install_get_info(isc_install_info_opdescription, option, opdesc buffer, ISC_INSTALL_MAX_MESSAGE_LEN); isc_install_get_info(isc_install_info_opspace, option, opspace buffer, sizeof(unsigned long)); end; /* Get a suggested destination directory */ isc_install_get_info(isc_install_info_destination, 0, dest_buffer, ISC_INSTALL_MAX_PATH); /* Present the user his choices and interact with them */ interact_with_user(); /* Use isc_install_set_option and isc_install_unset_option either when * interacting with the user or after the user pushes Install button. * Zero the handle the very first time. */ handle = 0L; while (not all options) begin if(option is selected) isc_install_set_option(&handle, option); // Check for errors. end; /* You can check for source_dir and dest_dir. In this case no check * is performed on directories. Also not all of the checks are performed * on the dest_path if it does not exist. */ error = isc_install_precheck(handle, source_path, dest_path); if (error > isc_install_success) then begin /* if a classic server is installed, or any server is running * then give error and exit */ isc_install_get_message(error, message, length(message)); user_choice = display(message); do_user_choice(); /* For example, terminate, return to options * selection screen */ end else if (error < isc_install_success) then begin /* Some warning has occured, display it and continue */ isc_install_get_message(error, message, length(message)) display(message) end display_file(install.txt) display_file(license.txt) /* You can supply no callback functions but it is not recommended because install * will abort on any error. Some of the errors might be ignored. Some problems * might be fixed by hand after the install. If you do not use callbacks you will * not be able to appraise the user of the status */ error = isc_install_execute(&handle, source_path, dest_path, NULL, NULL, NULL, NULL, NULL) if (error < 0) then begin isc_install_get_message(error, message, length(message)) display(message) exit() end else if (error > 0) then begin isc_install_get_message(error, message, length(message)) display(message) end display_file(readme.txt) /* Clearing options is mandatory. Not clearing options results in memory leaks */ isc_install_clear_options(&handle) display_done() end