home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / oslib / oslib_1 / OSLib / Toolbox / h / saveas < prev    next >
Encoding:
Text File  |  1995-09-05  |  13.3 KB  |  440 lines

  1. #ifndef saveas_H
  2. #define saveas_H
  3.  
  4. /* C header file for SaveAs
  5.  * written by DefMod (Aug 30 1995) on Tue Sep  5 15:14:04 1995
  6.  * Jonathan Coxhead, Acorn Computers Ltd
  7.  */
  8.  
  9. #ifndef types_H
  10. #include "types.h"
  11. #endif
  12.  
  13. #ifndef toolbox_H
  14. #include "toolbox.h"
  15. #endif
  16.  
  17. #ifndef window_H
  18. #include "window.h"
  19. #endif
  20.  
  21. /**********************************
  22.  * SWI names and SWI reason codes *
  23.  **********************************/
  24. #undef  SaveAs_ClassSWI
  25. #define SaveAs_ClassSWI                         0x82BC0
  26. #undef  XSaveAs_ClassSWI
  27. #define XSaveAs_ClassSWI                        0xA2BC0
  28. #undef  SaveAs_PostFilter
  29. #define SaveAs_PostFilter                       0x82BC1
  30. #undef  XSaveAs_PostFilter
  31. #define XSaveAs_PostFilter                      0xA2BC1
  32. #undef  SaveAs_PreFilter
  33. #define SaveAs_PreFilter                        0x82BC2
  34. #undef  XSaveAs_PreFilter
  35. #define XSaveAs_PreFilter                       0xA2BC2
  36. #undef  SaveAs_GetWindowID
  37. #define SaveAs_GetWindowID                      0x0
  38. #undef  SaveAs_SetTitle
  39. #define SaveAs_SetTitle                         0x1
  40. #undef  SaveAs_GetTitle
  41. #define SaveAs_GetTitle                         0x2
  42. #undef  SaveAs_SetFileName
  43. #define SaveAs_SetFileName                      0x3
  44. #undef  SaveAs_GetFileName
  45. #define SaveAs_GetFileName                      0x4
  46. #undef  SaveAs_SetFileType
  47. #define SaveAs_SetFileType                      0x5
  48. #undef  SaveAs_GetFileType
  49. #define SaveAs_GetFileType                      0x6
  50. #undef  SaveAs_SetFileSize
  51. #define SaveAs_SetFileSize                      0x7
  52. #undef  SaveAs_GetFileSize
  53. #define SaveAs_GetFileSize                      0x8
  54. #undef  SaveAs_SelectionAvailable
  55. #define SaveAs_SelectionAvailable               0x9
  56. #undef  SaveAs_SetDataAddress
  57. #define SaveAs_SetDataAddress                   0xA
  58. #undef  SaveAs_BufferFilled
  59. #define SaveAs_BufferFilled                     0xB
  60. #undef  SaveAs_FileSaveCompleted
  61. #define SaveAs_FileSaveCompleted                0xC
  62.  
  63. /************************************
  64.  * Structure and union declarations *
  65.  ************************************/
  66. typedef struct saveas_object                    saveas_object;
  67. typedef struct saveas_action_about_to_be_shown  saveas_action_about_to_be_shown;
  68. typedef struct saveas_action_save_to_file       saveas_action_save_to_file;
  69. typedef struct saveas_action_fill_buffer        saveas_action_fill_buffer;
  70. typedef struct saveas_action_save_completed     saveas_action_save_completed;
  71.  
  72. /********************
  73.  * Type definitions *
  74.  ********************/
  75. typedef bits saveas_flags;
  76.  
  77. struct saveas_object
  78.    {  saveas_flags flags;
  79.       toolbox_msg_reference file_name;
  80.       bits file_type;
  81.       toolbox_msg_reference title;
  82.       int title_limit;
  83.       toolbox_string_reference alternative_window_name;
  84.    };
  85.  
  86. typedef toolbox_full saveas_full;
  87.  
  88. struct saveas_action_about_to_be_shown
  89.    {  toolbox_position_tag tag;
  90.       union
  91.       {  os_coord top_left;
  92.          saveas_full full;
  93.       }
  94.       position;
  95.    };
  96.  
  97. struct saveas_action_save_to_file
  98.    {  char file_name [212];
  99.    };
  100.  
  101. struct saveas_action_fill_buffer
  102.    {  int size;
  103.       byte *buffer;
  104.       int size_saved;
  105.    };
  106.  
  107. struct saveas_action_save_completed
  108.    {  bits ref;
  109.       char file_name [208];
  110.    };
  111.  
  112. /************************
  113.  * Constant definitions *
  114.  ************************/
  115. #define class_SAVE_AS                           ((toolbox_class) 0x82BC0u)
  116. #define saveas_GENERATE_ABOUT_TO_BE_SHOWN       ((saveas_flags) 0x1u)
  117. #define saveas_GENERATE_DIALOGUE_COMPLETED      ((saveas_flags) 0x2u)
  118. #define saveas_NO_SELECTION_BUTTON              ((saveas_flags) 0x4u)
  119. #define saveas_GIVEN_DATA                       ((saveas_flags) 0x8u)
  120. #define saveas_CLIENT_SUPPORTS_RAM_TRANSFER     ((saveas_flags) 0x10u)
  121. #define saveas_SAVE_SELECTION                   1
  122. #define saveas_SAVE_SAFE                        2
  123. #define saveas_FILE_ICON                        ((toolbox_c) 0x82BC000u)
  124. #define saveas_FILE_NAME                        ((toolbox_c) 0x82BC001u)
  125. #define saveas_CANCEL                           ((toolbox_c) 0x82BC002u)
  126. #define saveas_SAVE                             ((toolbox_c) 0x82BC003u)
  127. #define saveas_SELECTION                        ((toolbox_c) 0x82BC004u)
  128. #define action_SAVE_AS_ABOUT_TO_BE_SHOWN        0x82BC0u
  129. #define action_SAVE_AS_DIALOGUE_COMPLETED       0x82BC1u
  130. #define action_SAVE_AS_SAVE_TO_FILE             0x82BC2u
  131. #define action_SAVE_AS_FILL_BUFFER              0x82BC3u
  132. #define action_SAVE_AS_SAVE_COMPLETED           0x82BC4u
  133. #define error_SAVE_AS_TASKS_ACTIVE              0x80B600u
  134. #define error_SAVE_AS_ALLOC_FAILED              0x80B601u
  135. #define error_SAVE_AS_SHORT_BUFFER              0x80B602u
  136. #define error_SAVE_AS_FILE_NAME_TOO_LONG        0x80B603u
  137. #define error_SAVE_AS_NO_SUCH_TASK              0x80B611u
  138. #define error_SAVE_AS_NO_SUCH_METHOD            0x80B612u
  139. #define error_SAVE_AS_NO_SUCH_MISC_OP_METHOD    0x80B613u
  140. #define error_SAVE_AS_NOT_TYPE1                 0x80B621u
  141. #define error_SAVE_AS_NOT_TYPE3                 0x80B623u
  142. #define error_SAVE_AS_BUFFER_EXCEEDED           0x80B631u
  143. #define error_SAVE_AS_DATA_ADDRESS_UNSET        0x80B641u
  144. #define error_SAVE_AS_NOT_FULL_PATH             0x80B642u
  145.  
  146. /*************************
  147.  * Function declarations *
  148.  *************************/
  149.  
  150. #ifdef __cplusplus
  151.    extern "C" {
  152. #endif
  153.  
  154. /* ------------------------------------------------------------------------
  155.  * Function:      saveas_get_window_id()
  156.  *
  157.  * Description:   Calls reason code 0 of SWI 0x44EC6
  158.  *
  159.  * Input:         flags - value of R0 on entry
  160.  *                save_as - value of R1 on entry
  161.  *
  162.  * Output:        window - value of R0 on exit (X version only)
  163.  *
  164.  * Returns:       R0 (non-X version only)
  165.  *
  166.  * Other notes:   Before entry, R2 = 0x0.
  167.  */
  168.  
  169. extern os_error *xsaveas_get_window_id (bits flags,
  170.       toolbox_o save_as,
  171.       toolbox_o *window);
  172. extern toolbox_o saveas_get_window_id (bits flags,
  173.       toolbox_o save_as);
  174.  
  175. /* ------------------------------------------------------------------------
  176.  * Function:      saveas_set_title()
  177.  *
  178.  * Description:   Calls reason code 1 of SWI 0x44EC6
  179.  *
  180.  * Input:         flags - value of R0 on entry
  181.  *                save_as - value of R1 on entry
  182.  *                title - value of R3 on entry
  183.  *
  184.  * Other notes:   Before entry, R2 = 0x1.
  185.  */
  186.  
  187. extern os_error *xsaveas_set_title (bits flags,
  188.       toolbox_o save_as,
  189.       char const *title);
  190. extern void saveas_set_title (bits flags,
  191.       toolbox_o save_as,
  192.       char const *title);
  193.  
  194. /* ------------------------------------------------------------------------
  195.  * Function:      saveas_get_title()
  196.  *
  197.  * Description:   Calls reason code 2 of SWI 0x44EC6
  198.  *
  199.  * Input:         flags - value of R0 on entry
  200.  *                save_as - value of R1 on entry
  201.  *                buffer - value of R3 on entry
  202.  *                size - value of R4 on entry
  203.  *
  204.  * Output:        used - value of R4 on exit (X version only)
  205.  *
  206.  * Returns:       R4 (non-X version only)
  207.  *
  208.  * Other notes:   Before entry, R2 = 0x2.
  209.  */
  210.  
  211. extern os_error *xsaveas_get_title (bits flags,
  212.       toolbox_o save_as,
  213.       char *buffer,
  214.       int size,
  215.       int *used);
  216. extern int saveas_get_title (bits flags,
  217.       toolbox_o save_as,
  218.       char *buffer,
  219.       int size);
  220.  
  221. /* ------------------------------------------------------------------------
  222.  * Function:      saveas_set_file_name()
  223.  *
  224.  * Description:   Calls reason code 3 of SWI 0x44EC6
  225.  *
  226.  * Input:         flags - value of R0 on entry
  227.  *                save_as - value of R1 on entry
  228.  *                file_name - value of R3 on entry
  229.  *
  230.  * Other notes:   Before entry, R2 = 0x3.
  231.  */
  232.  
  233. extern os_error *xsaveas_set_file_name (bits flags,
  234.       toolbox_o save_as,
  235.       char const *file_name);
  236. extern void saveas_set_file_name (bits flags,
  237.       toolbox_o save_as,
  238.       char const *file_name);
  239.  
  240. /* ------------------------------------------------------------------------
  241.  * Function:      saveas_get_file_name()
  242.  *
  243.  * Description:   Calls reason code 4 of SWI 0x44EC6
  244.  *
  245.  * Input:         flags - value of R0 on entry
  246.  *                save_as - value of R1 on entry
  247.  *                buffer - value of R3 on entry
  248.  *                size - value of R4 on entry
  249.  *
  250.  * Output:        used - value of R4 on exit (X version only)
  251.  *
  252.  * Returns:       R4 (non-X version only)
  253.  *
  254.  * Other notes:   Before entry, R2 = 0x4.
  255.  */
  256.  
  257. extern os_error *xsaveas_get_file_name (bits flags,
  258.       toolbox_o save_as,
  259.       char *buffer,
  260.       int size,
  261.       int *used);
  262. extern int saveas_get_file_name (bits flags,
  263.       toolbox_o save_as,
  264.       char *buffer,
  265.       int size);
  266.  
  267. /* ------------------------------------------------------------------------
  268.  * Function:      saveas_set_file_type()
  269.  *
  270.  * Description:   Calls reason code 5 of SWI 0x44EC6
  271.  *
  272.  * Input:         flags - value of R0 on entry
  273.  *                save_as - value of R1 on entry
  274.  *                file_type - value of R3 on entry
  275.  *
  276.  * Other notes:   Before entry, R2 = 0x5.
  277.  */
  278.  
  279. extern os_error *xsaveas_set_file_type (bits flags,
  280.       toolbox_o save_as,
  281.       bits file_type);
  282. extern void saveas_set_file_type (bits flags,
  283.       toolbox_o save_as,
  284.       bits file_type);
  285.  
  286. /* ------------------------------------------------------------------------
  287.  * Function:      saveas_get_file_type()
  288.  *
  289.  * Description:   Calls reason code 6 of SWI 0x44EC6
  290.  *
  291.  * Input:         flags - value of R0 on entry
  292.  *                save_as - value of R1 on entry
  293.  *
  294.  * Output:        file_type - value of R0 on exit (X version only)
  295.  *
  296.  * Returns:       R0 (non-X version only)
  297.  *
  298.  * Other notes:   Before entry, R2 = 0x6.
  299.  */
  300.  
  301. extern os_error *xsaveas_get_file_type (bits flags,
  302.       toolbox_o save_as,
  303.       bits *file_type);
  304. extern bits saveas_get_file_type (bits flags,
  305.       toolbox_o save_as);
  306.  
  307. /* ------------------------------------------------------------------------
  308.  * Function:      saveas_set_file_size()
  309.  *
  310.  * Description:   Calls reason code 7 of SWI 0x44EC6
  311.  *
  312.  * Input:         flags - value of R0 on entry
  313.  *                save_as - value of R1 on entry
  314.  *                file_size - value of R3 on entry
  315.  *
  316.  * Other notes:   Before entry, R2 = 0x7.
  317.  */
  318.  
  319. extern os_error *xsaveas_set_file_size (bits flags,
  320.       toolbox_o save_as,
  321.       int file_size);
  322. extern void saveas_set_file_size (bits flags,
  323.       toolbox_o save_as,
  324.       int file_size);
  325.  
  326. /* ------------------------------------------------------------------------
  327.  * Function:      saveas_get_file_size()
  328.  *
  329.  * Description:   Calls reason code 8 of SWI 0x44EC6
  330.  *
  331.  * Input:         flags - value of R0 on entry
  332.  *                save_as - value of R1 on entry
  333.  *
  334.  * Output:        file_size - value of R0 on exit (X version only)
  335.  *
  336.  * Returns:       R0 (non-X version only)
  337.  *
  338.  * Other notes:   Before entry, R2 = 0x8.
  339.  */
  340.  
  341. extern os_error *xsaveas_get_file_size (bits flags,
  342.       toolbox_o save_as,
  343.       int *file_size);
  344. extern int saveas_get_file_size (bits flags,
  345.       toolbox_o save_as);
  346.  
  347. /* ------------------------------------------------------------------------
  348.  * Function:      saveas_selection_available()
  349.  *
  350.  * Description:   Calls reason code 9 of SWI 0x44EC6
  351.  *
  352.  * Input:         flags - value of R0 on entry
  353.  *                save_as - value of R1 on entry
  354.  *                selection_available - value of R3 on entry
  355.  *
  356.  * Other notes:   Before entry, R2 = 0x9.
  357.  */
  358.  
  359. extern os_error *xsaveas_selection_available (bits flags,
  360.       toolbox_o save_as,
  361.       bool selection_available);
  362. extern void saveas_selection_available (bits flags,
  363.       toolbox_o save_as,
  364.       bool selection_available);
  365.  
  366. /* ------------------------------------------------------------------------
  367.  * Function:      saveas_set_data_address()
  368.  *
  369.  * Description:   Calls reason code 10 of SWI 0x44EC6
  370.  *
  371.  * Input:         flags - value of R0 on entry
  372.  *                save_as - value of R1 on entry
  373.  *                data - value of R3 on entry
  374.  *                size - value of R4 on entry
  375.  *                selection - value of R5 on entry
  376.  *                selection_size - value of R6 on entry
  377.  *
  378.  * Other notes:   Before entry, R2 = 0xA.
  379.  */
  380.  
  381. extern os_error *xsaveas_set_data_address (bits flags,
  382.       toolbox_o save_as,
  383.       byte *data,
  384.       int size,
  385.       byte *selection,
  386.       int selection_size);
  387. extern void saveas_set_data_address (bits flags,
  388.       toolbox_o save_as,
  389.       byte *data,
  390.       int size,
  391.       byte *selection,
  392.       int selection_size);
  393.  
  394. /* ------------------------------------------------------------------------
  395.  * Function:      saveas_buffer_filled()
  396.  *
  397.  * Description:   Calls reason code 11 of SWI 0x44EC6
  398.  *
  399.  * Input:         flags - value of R0 on entry
  400.  *                save_as - value of R1 on entry
  401.  *                buffer - value of R3 on entry
  402.  *                size - value of R4 on entry
  403.  *
  404.  * Other notes:   Before entry, R2 = 0xB.
  405.  */
  406.  
  407. extern os_error *xsaveas_buffer_filled (bits flags,
  408.       toolbox_o save_as,
  409.       byte *buffer,
  410.       int size);
  411. extern void saveas_buffer_filled (bits flags,
  412.       toolbox_o save_as,
  413.       byte *buffer,
  414.       int size);
  415.  
  416. /* ------------------------------------------------------------------------
  417.  * Function:      saveas_file_save_completed()
  418.  *
  419.  * Description:   Calls reason code 12 of SWI 0x44EC6
  420.  *
  421.  * Input:         flags - value of R0 on entry
  422.  *                save_as - value of R1 on entry
  423.  *                file_name - value of R3 on entry
  424.  *
  425.  * Other notes:   Before entry, R2 = 0xC.
  426.  */
  427.  
  428. extern os_error *xsaveas_file_save_completed (bits flags,
  429.       toolbox_o save_as,
  430.       char const *file_name);
  431. extern void saveas_file_save_completed (bits flags,
  432.       toolbox_o save_as,
  433.       char const *file_name);
  434.  
  435. #ifdef __cplusplus
  436.    }
  437. #endif
  438.  
  439. #endif
  440.