home *** CD-ROM | disk | FTP | other *** search
- #ifndef netprint_H
- #define netprint_H
-
- /* C header file for NetPrint
- * written by DefMod (Sep 7 1994) on Wed Sep 7 21:22:49 1994
- * Copyright © Acorn Computers Ltd, 1994
- */
-
- /*************************************************************************
- * This source file was written by Acorn Computers Limited. It is part *
- * of the OSLib library for writing applications for RISC OS. It may be *
- * used freely in the creation of programs for RISC OS. *
- *************************************************************************/
-
- #ifndef types_H
- #include "types.h"
- #endif
-
- #ifndef os_H
- #include "os.h"
- #endif
-
- /**********************************
- * SWI names and SWI reason codes *
- **********************************/
- #undef NetPrint_ReadPSNumber
- #define NetPrint_ReadPSNumber 0x40200
- #undef XNetPrint_ReadPSNumber
- #define XNetPrint_ReadPSNumber 0x60200
- #undef NetPrint_SetPSNumber
- #define NetPrint_SetPSNumber 0x40201
- #undef XNetPrint_SetPSNumber
- #define XNetPrint_SetPSNumber 0x60201
- #undef NetPrint_ReadPSName
- #define NetPrint_ReadPSName 0x40202
- #undef XNetPrint_ReadPSName
- #define XNetPrint_ReadPSName 0x60202
- #undef NetPrint_SetPSName
- #define NetPrint_SetPSName 0x40203
- #undef XNetPrint_SetPSName
- #define XNetPrint_SetPSName 0x60203
- #undef NetPrint_ReadPSTimeouts
- #define NetPrint_ReadPSTimeouts 0x40204
- #undef XNetPrint_ReadPSTimeouts
- #define XNetPrint_ReadPSTimeouts 0x60204
- #undef NetPrint_SetPSTimeouts
- #define NetPrint_SetPSTimeouts 0x40205
- #undef XNetPrint_SetPSTimeouts
- #define XNetPrint_SetPSTimeouts 0x60205
- #undef NetPrint_BindPSName
- #define NetPrint_BindPSName 0x40206
- #undef XNetPrint_BindPSName
- #define XNetPrint_BindPSName 0x60206
- #undef NetPrint_ListServers
- #define NetPrint_ListServers 0x40207
- #undef XNetPrint_ListServers
- #define XNetPrint_ListServers 0x60207
- #undef NetPrintListServers_Brief
- #define NetPrintListServers_Brief 0x0
- #undef NetPrintListServers_Name
- #define NetPrintListServers_Name 0x1
- #undef NetPrintListServers_Full
- #define NetPrintListServers_Full 0x2
- #undef NetPrint_ConvertStatusToString
- #define NetPrint_ConvertStatusToString 0x40208
- #undef XNetPrint_ConvertStatusToString
- #define XNetPrint_ConvertStatusToString 0x60208
-
- /************************************
- * Structure and union declarations *
- ************************************/
- typedef struct netprint_brief_entry netprint_brief_entry;
- typedef struct netprint_name_entry netprint_name_entry;
- typedef struct netprint_full_entry netprint_full_entry;
-
- /********************
- * Type definitions *
- ********************/
- struct netprint_brief_entry
- { byte station_no;
- byte net_no;
- char ps_name [256];
- };
-
- struct netprint_name_entry
- { char ps_name [256];
- };
-
- struct netprint_full_entry
- { byte station_no;
- byte net_no;
- byte status;
- byte status_station_no;
- byte status_net_no;
- char ps_name [256];
- };
-
- /************************
- * Constant definitions *
- ************************/
- #define netprint_PS_NAME_LIMIT 256
- #define netprint_STATUS_READY 0
- #define netprint_STATUS_BUSY 1
- #define netprint_STATUS_JAMMED 2
- #define netprint_STATUS_OFFLINE 6
- #define netprint_STATUS_OPEN 7
- #define error_NET_PRINT_NAME_TOO_LONG 0x10C00u
- #define error_NET_PRINT_SINGLE_STREAM 0x10C01u
- #define error_NET_PRINT_ALL_PRINTERS_BUSY 0x10C02u
- #define error_NET_PRINT_OFF_LINE 0x10C09u
- #define error_NET_PRINT_NOT_FOUND 0x10C0Au
- #define error_NET_PRINT_INTERNAL_ERROR 0x10C0Bu
- #define netprint_LIST_FORMAT_BRIEF 0
- #define netprint_LIST_FORMAT_NAMES 1
- #define netprint_LIST_FORMAT_FULL 2
-
- /*************************
- * Function declarations *
- *************************/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*************************************************************
- * NOTE: The following functions provide direct access to *
- * the SWI's noted in the function description. *
- * Please read the relevant PRM section for more *
- * information on their input/output parameters. *
- *************************************************************/
-
- /* ------------------------------------------------------------------------
- * Function: netprint_read_ps_number()
- *
- * Description: Returns the full station number of your current printer
- * server
- *
- * Output: station_no - value of R0 on exit
- * net_no - value of R1 on exit
- *
- * Other notes: Calls SWI 0x40200.
- */
-
- extern os_error *xnetprint_read_ps_number (byte *station_no,
- byte *net_no);
- extern void netprint_read_ps_number (byte *station_no,
- byte *net_no);
-
- /* ------------------------------------------------------------------------
- * Function: netprint_set_ps_number()
- *
- * Description: Sets the full station number used as the current printer
- * server
- *
- * Input: station_no - value of R0 on entry
- * net_no - value of R1 on entry
- *
- * Other notes: Calls SWI 0x40201.
- */
-
- extern os_error *xnetprint_set_ps_number (byte station_no,
- byte net_no);
- extern void netprint_set_ps_number (byte station_no,
- byte net_no);
-
- /* ------------------------------------------------------------------------
- * Function: netprint_read_ps_name()
- *
- * Description: Reads the name of your current printer server
- *
- * Input: buffer - value of R1 on entry
- * size - value of R2 on entry
- *
- * Output: end - value of R1 on exit
- *
- * Other notes: Calls SWI 0x40202.
- */
-
- extern os_error *xnetprint_read_ps_name (char *buffer,
- int size,
- char **end);
- extern void netprint_read_ps_name (char *buffer,
- int size,
- char **end);
-
- /* ------------------------------------------------------------------------
- * Function: netprint_set_ps_name()
- *
- * Description: Sets by name the printer server used as your current one
- *
- * Input: ps_name - value of R0 on entry
- *
- * Other notes: Calls SWI 0x40203.
- */
-
- extern os_error *xnetprint_set_ps_name (char *ps_name);
- extern void netprint_set_ps_name (char *ps_name);
-
- /* ------------------------------------------------------------------------
- * Function: netprint_read_ps_timeouts()
- *
- * Description: Reads the current values for timeouts used by NetPrint
- *
- * Output: transmit_count - value of R0 on exit
- * transmit_delay - value of R1 on exit
- * peek_count - value of R2 on exit
- * peek_delay - value of R3 on exit
- * receive_delay - value of R4 on exit
- * broadcast_delay - value of R5 on exit
- *
- * Other notes: Calls SWI 0x40204.
- */
-
- extern os_error *xnetprint_read_ps_timeouts (int *transmit_count,
- int *transmit_delay,
- int *peek_count,
- int *peek_delay,
- int *receive_delay,
- int *broadcast_delay);
- extern void netprint_read_ps_timeouts (int *transmit_count,
- int *transmit_delay,
- int *peek_count,
- int *peek_delay,
- int *receive_delay,
- int *broadcast_delay);
-
- /* ------------------------------------------------------------------------
- * Function: netprint_set_ps_timeouts()
- *
- * Description: Sets the current values for timeouts used by NetPrint
- *
- * Input: transmit_count - value of R0 on entry
- * transmit_delay - value of R1 on entry
- * peek_count - value of R2 on entry
- * peek_delay - value of R3 on entry
- * receive_delay - value of R4 on entry
- * broadcast_delay - value of R5 on entry
- *
- * Other notes: Calls SWI 0x40205.
- */
-
- extern os_error *xnetprint_set_ps_timeouts (int transmit_count,
- int transmit_delay,
- int peek_count,
- int peek_delay,
- int receive_delay,
- int broadcast_delay);
- extern void netprint_set_ps_timeouts (int transmit_count,
- int transmit_delay,
- int peek_count,
- int peek_delay,
- int receive_delay,
- int broadcast_delay);
-
- /* ------------------------------------------------------------------------
- * Function: netprint_bind_ps_name()
- *
- * Description: Converts a printer server's name to its address,
- * providing it is free
- *
- * Input: ps_name - value of R0 on entry
- *
- * Output: station_no - value of R0 on exit
- * net_no - value of R1 on exit
- *
- * Other notes: Calls SWI 0x40206.
- */
-
- extern os_error *xnetprint_bind_ps_name (char *ps_name,
- byte *station_no,
- byte *net_no);
- extern void netprint_bind_ps_name (char *ps_name,
- byte *station_no,
- byte *net_no);
-
- /* ------------------------------------------------------------------------
- * Function: netprintlistservers_brief()
- *
- * Description: Returns the names and numbers of all printer servers
- *
- * Input: entries - value of R1 on entry
- * size - value of R2 on entry
- * timeout - value of R3 on entry
- *
- * Output: entry_count - value of R0 on exit
- * no_more - value of R3 on exit (X version only)
- *
- * Returns: R3 (non-X version only)
- *
- * Other notes: Calls SWI 0x40207 with R0 = 0x0.
- */
-
- extern os_error *xnetprintlistservers_brief (netprint_brief_entry *entries,
- int size,
- int timeout,
- int *entry_count,
- bool *no_more);
- extern bool netprintlistservers_brief (netprint_brief_entry *entries,
- int size,
- int timeout,
- int *entry_count);
-
- /* ------------------------------------------------------------------------
- * Function: netprintlistservers_name()
- *
- * Description: Returns the names of all printer servers, sorted, with
- * duplicates removed
- *
- * Input: entries - value of R1 on entry
- * size - value of R2 on entry
- * timeout - value of R3 on entry
- *
- * Output: entry_count - value of R0 on exit
- * no_more - value of R3 on exit (X version only)
- *
- * Returns: R3 (non-X version only)
- *
- * Other notes: Calls SWI 0x40207 with R0 = 0x1.
- */
-
- extern os_error *xnetprintlistservers_name (netprint_name_entry *entries,
- int size,
- int timeout,
- int *entry_count,
- bool *no_more);
- extern bool netprintlistservers_name (netprint_name_entry *entries,
- int size,
- int timeout,
- int *entry_count);
-
- /* ------------------------------------------------------------------------
- * Function: netprintlistservers_full()
- *
- * Description: Returns the names, numbers and status of all printer
- * servers
- *
- * Input: entries - value of R1 on entry
- * size - value of R2 on entry
- * timeout - value of R3 on entry
- *
- * Output: entry_count - value of R0 on exit
- * no_more - value of R3 on exit (X version only)
- *
- * Returns: R3 (non-X version only)
- *
- * Other notes: Calls SWI 0x40207 with R0 = 0x2.
- */
-
- extern os_error *xnetprintlistservers_full (netprint_full_entry *entries,
- int size,
- int timeout,
- int *entry_count,
- bool *no_more);
- extern bool netprintlistservers_full (netprint_full_entry *entries,
- int size,
- int timeout,
- int *entry_count);
-
- /* ------------------------------------------------------------------------
- * Function: netprint_convert_status_to_string()
- *
- * Description: Translates a status value returned by
- * NetPrint_ListServers into the local language
- *
- * Input: status_station_net - value of R0 on entry
- * buffer - value of R1 on entry
- * size - value of R2 on entry
- *
- * Output: end - value of R1 on exit
- *
- * Other notes: Calls SWI 0x40208.
- */
-
- extern os_error *xnetprint_convert_status_to_string (bits *status_station_net,
- char *buffer,
- int size,
- char **end);
- extern void netprint_convert_status_to_string (bits *status_station_net,
- char *buffer,
- int size,
- char **end);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-