Skip to content

Application upgrade from Silgy 3.x to 4.0

Jurek Muszyński edited this page Apr 11, 2019 · 21 revisions

6 steps to Silgy 4.0

Silgy 4.0 API is more clear and consistent than the previous one. But it also means that it's not backward compatible. Differences are slight but nevertheless the applications need to be converted.

This is the short guide to help you with converting existing Silgy application to version 4.0.

If you had any trouble with this process, don't hesitate to ask: silgy.help@gmail.com.

Most applications will probably require only the first three steps.

silgy_app.cpp

  1. Rename engine callbacks & update signatures

    The easiest way to complete this might be by opening new silgy_app.cpp and copying and pasting new functions' names with their signatures.

    • app_process_reqsilgy_app_main
    • app_initsilgy_app_init
    • app_uses_initsilgy_app_session_init
    • app_luses_initsilgy_app_user_login
    • app_uses_resetsilgy_app_session_done
    • app_donesilgy_app_done
  2. You need to add a definition for silgy_app_user_logout():

    void silgy_app_user_logout(int ci)
    {
    }
  3. In silgy_app_main() replace return values with corresponding RES_STATUS(), i.e.:

    return ERR_NOT_FOUND;  // old code
    RES_STATUS(404);       // new code
  4. app_uses_reset() was using user session index (usi). Now silgy_app_session_done() uses connection index (ci), so you can use US and AUS macros like in any other function. Additionally, you don't need to reset any data in engine session (US) as this will be zero-ed by the engine. You can read more about sessions in Silgy here.

  5. If you were using app_gen_page_msg() to render your own custom error page, you need now to define:

    void silgy_app_error_page(int ci, int code)
    {
        // your code here
    }

    You also need to add APP_ERROR_PAGE switch to silgy_app.h.

  6. If you were using app_get_msg_str() to provide your error messages, you now need to add them in silgy_app_init() using silgy_add_message().

ASYNC

If you are using ASYNC module, there are couple of additional steps:

silgy_app

  1. Rename app_async_done to silgy_app_continue.

  2. Replace macro S with SVC.

  3. Replace err_code with ASYNC_ERR_CODE.

silgy_svc

  1. Rename silgy_services.cpp to silgy_svc.cpp. Remember about ms script.

  2. Rename engine callbacks & update signatures

    • services_initsilgy_svc_init
    • service_app_process_reqsilgy_svc_main
    • services_donesilgy_svc_done
  3. Replace macro S with SVC.

  4. Replace silgy_svc_main's returns with setting the ASYNC_ERR_CODE.

Clone this wiki locally