The text of a manual · part 8 of 28
6400 PSK Reference Manual, pages 71 to 80
Pages 71 to 80 of 272
The original document is the PDF (1.1 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Intermec 6400
Page 71
im_erase_line
5 im_erase_line Purpose:
This function erases a portion of the current line.
Syntax:
#include "im64psk.h" void far im_erase_line (IM_ERASE_CONTROL fErase);
IN Parameters:
fErase Flag that specifies the area to erase and is one of these constants: IM_CURS_TO_END
Erases from the current cursor position to the end of the line
IM_START_TO_CURS IM_ALL OUT Parameters:
None.
Return Value:
None.
See Also:
Erases from the start of the line to the current cursor position
Erases the entire line im_clear_screen
Example /********************* im_erase_line *********************************/ #include "im64psk.h" IM_ERASE_CONTROL fErase;
void main(void) { int x; im_clear_screen();
/* Clear the screen */
/* Print sample lines to be erased */ for(x=0;x<16;x++) im_puts("ABCDEFGHIJKLMOPQRST", IM_NORMAL); /* Move cursor to desire position Row,Col */ im_set_cursor_xy(5,5); /* Set fErase flag */ /* IM_CURS_TO_END - delete from cursor to end of line */ /* IM_START_TO_CURS - delete from start to end of line */ /* IM_ALL - delete entire line */ fErase = IM_START_TO_CURS; /* Erase line as specified by fErase flag */ im_erase_line(fErase); getch(); }
5-15
Page 72
im_event_wait im_event_wait Purpose:
This function waits for one or more events and returns a flag indicating that the event occurred or a timeout occurred.
Syntax:
#include "im64psk.h" IM_STATUS im_event_wait (IM_UINT timeout, IM_ORIGIN far *source);
IN Parameters:
timeout
Numeric value or a constant:
1 to 65534 ms
Numeric range
IM_ZERO_TIMEOUT
No wait
IM_INFINITE_TIMEOUT IN/OUT Parameters:
Wait forever source Passes in the sources allowed and passes out 0 (zero) or the first source with a complete event. The source passed in is any combination of these constants: IM_COM1_SELECT
COM1 input
IM_NET_SELECT
Network input
IM_LABEL_SELECT
Label input
IM_KEYBOARD_SELECT IM_TIMER_SELECT
Keypad input
Timer select
The source passed out is any one of the above constants. OUT Parameters: Return Value:
None. This function returns one of these codes: IM_SUCCESS Success IM_TIMEDOUT Timeout occurred before receiving data
Notes:
This function is not required for any of the input or output functions. This function does not clear the source state flags. To clear the flags, call an input function such as im_receive_buffer or im_receive_input. Use IM_TIMER_SELECT for the source to act on a timed event instead of waiting for a keyboard, COM port, optical sensor, or network event. Because no events are assigned to serial data transmission, im_event_wait is not valid for transmits using serial ports.
5-16
Page 73
im_event_wait
5 im_event_wait (continued) Example /********************* im_event_wait *********************************/ #include "im64psk.h" #include "ctype.h" #include "conio.h" void main (void) { IM_UCHAR inChar='x', szNetBuffer[1024]; IM_USHORT iLength, iCountMinutes=0; IM_ORIGIN iSource; IM_STATUS iStatus; im_set_time_event (60000); while ( toupper (inChar != 'Q') ) { iSource = IM_KEYBOARD_SELECT | IM_TX_NET_SELECT | IM_TIMER_SELECT; iStatus = im_event_wait(3000, &iSource); if (IM_ISGOOD (iStatus) ) { if (iSource == IM_KEYBOARD_SELECT) inChar = getch ( ); if (iSource == IM_TX_NET_SELECT) iStatus = im_receive_buffer( IM_NET, 1024, szNetBuffer, 600, &iLength); if (iSource == IM_TIMER_SELECT) /* Get this once per minute even if receive messages in between */ { iCountMinutes++; im_set_time_event (60000); } } else { im_puts((IM_UCHAR *)"Timeout on event wait", IM_BOLD); } } printf (“Ran %d minutes\n\r", iCountMinutes); }
5-17
Page 74
im_file_duplicate im_file_duplicate Purpose:
This function copies an existing file.
Syntax:
#include “im64psk.h” IM_STATUS im_file_duplicate (IM_UCHAR *source, IM_UCHAR *destination)
IN Parameter:
source Pointer to the source file name. The file name must contain the drive letter and the name. destination Pointer to the destination file name. The file name must contain the drive letter and the name.
OUT Parameters: Return Value:
None This function returns one of these codes: IM_SUCCESS
File copy was successful
IM_INVALID_FILE Notes:
Invalid file specified or destination file already exists
This function does not overwrite an existing file and will fail if the destination file exists.
Example /*********************** im_file_duplicate *********************/ /* im_free_space, im_file_size, im_file_time */ #include <string.h> #include <time.h> #include “im64psk.h” #include <conio.h> void main( void) { int iStatus; long lDisk_space = 0L; time_t ltime; im_clear_screen(); /* Check available free space of file system */ iStatus = im_free_space("c:", &lDisk_space); printf("Free Space: %ld\n", lDisk_space); getch();
5-18
Page 75
im_file_duplicate
5 im_file_duplicate (continued) /* Duplicate the current executable file */ iStatus = im_file_duplicate("c:filesys.bin", "c:im_xxx.bin"); printf("copy: %x\n", iStatus); getch(); /* Check new available free space of file system */ iStatus = im_free_space("c:", &lDisk_space); im_cputs("New free Space:” ,IM_NORMAL) printf(“%ld\n", lDisk_space); getch(); /* Display file's time stamp */ iStatus = im_file_time("c:filesys.bin", <ime); printf("time: %x\n", iStatus); printf("%s\n", ctime(<ime)); getch(); /* display file's date stamp */ iStatus = im_file_size("c:filesys.bin", &lDisk_space); printf("size: %x\n", iStatus); printf("%ld\n", lDisk_space); getch(); }
5-19
Page 76
im_file_size im_file_size Purpose:
This function returns the size of the target file.
Syntax:
#include ”im64psk.h” IM_STATUS im_file_size (IM_CHAR *fname, IM_LONG *size)
IN Parameters:
fname A pointer to IM_CHAR. This variable points to a string that must include the drive letter and filename.
OUT Parameters:
size A pointer to IM_LONG. im_file_size places the size of the specified file here.
Return Value:
This function returns one of these codes: IM_SUCCESS Success IM_INVALID_FILE
Example See example for im_file_duplicate.
5-20
Invalid file specified
Page 77
im_file_time
5 im_file_time Purpose:
This function returns the time stamp of the target file.
Syntax:
#include “im64psk.h” IM_STATUS im_file_time (IM_CHAR *fname, time_t far *ltime)
IN Parameters:
OUT Parameters:
Return Value:
fname Pointer to IM_CHAR. This variable points to a string that must contain a drive letter and a file name. ltime here.
Far pointer to standard C-type time variable. im_file_time places the time stamp
This function returns one of these codes: IM_SUCCESS Success IM_INVALID_FILE
Notes:
Target file not found or does not exist
The time_t variable is the same as the one used in the MS-DOS C standard time definition and is defined as: typedef long time_t;
Example See example for im_file_duplicate.
5-21
Page 78
im_fmalloc im_fmalloc Purpose:
This function allocates a memory block larger than 64K.
Syntax:
#include "im64psk.h" void far *im_fmalloc (IM_ULONG lsize)
IN Parameters:
lsize
OUT Parameters:
None.
Return Value:
Size of memory in bytes to allocate.
This function returns one of these values: Far void pointer Allocation was successful. The pointer indicates the allocated space. NULL
Notes:
Not enough available free memory to allocate
The system uses 16 bytes of overhead. If you want to allocate the largest free memory block available, specify lsize as 16 bytes less than the available memory block size.
Example /* Example of doing a set/get relay digital I/O */ #include <string.h> #include "im64psk.h" #include <conio.h> #include <stdlib.h> void main (void) { IM_ULONG lsize; IM_ULONG ltotal; char *pz1; char c; /* Inquire about system memory */ im_free_mem(&lsize, <otal); printf("Largest size: %ld\nTotalsize:%ld\n", lsize, ltotal); /* Allocate the largest block, it must be 16 bytes less than block size */ pz1 = im_fmalloc(lsize – 16L); if (pz1 == NULL) { im_cputs("Fails to allocate memory\n", IM_NORMAL); } else { free(pz1); } c = getch();
5-22
Page 79
im_free_mem
5 im_free_mem Purpose:
This function returns free memory block information.
Syntax:
#include "im64psk.h" void im_free_mem (IM_ULONG *largest, IM_ULONG *ltotal)
IN Parameters: OUT Parameters:
None. largest Pointer to an unsigned long. This function places the amount of the largest available free memory block here. ltotal Pointer to an unsigned long. This function places the amount of the free memory blocks here.
Return Value:
None.
Example See example for im_fmalloc.
5-23
Page 80
im_free_space im_free_space Purpose:
This function returns the amount of storage space, in bytes, available on the terminal drive you specify.
Syntax:
#include "im64psk.h" IM_STATUS im_free_space (IM_CHAR *drive, IM_LONG *freespace)
IN Parameters: OUT Parameters:
Return Value:
drive Pointer to IM_CHAR. This variable is a drive letter on the terminal. freespace Pointer to IM_LONG. im_free_space places the amount of drive space available here. This function returns one of these codes: IM_SUCCESS Successful IM_INVALID_FILE
Example See example for im_file_duplicate.
5-24
Target drive not found or does not exist