Introduction
This chapter introduces ProFrame’s utilities and APIs and describes header files required to use them.
1. Overview
ProFrame has the following 6 utilities depending on the data type to process.
-
Date utility
Processes date and time data expressed as a string or number. This utility includes APIs that get, calculate, compare, and convert date and time information.
-
Number utility
The basic numeric data type of the C language has too few significant digits or an issue with precision. To overcome the limitations, ProFrame provides the PfmNumber data type that has 38 significant digits with high precision. The data type has the following structure.
typedef struct { unsigned char size; unsigned char signexp; unsigned char coef[NUMBER_MAX_LEN]; } PfmNumber;Handles number (PfmNumber data) processing such as various calculation, comparison, and conversion.
-
String utility
Handles string processing such as conversion and comparison.
-
Long utility
Handles Long data processing such as rounding off, up, and down.
-
Error handling and debugging utility
Processes error handling and debugging.
-
Other APIs
Other APIs than the ones described in previous chapters.
When developing services or application modules by using ProFrame, use the previous appropriate utilities.
2. Header Files
To use each utility and API, add the following to source code.
#include <pfmUtility.h>
To use the date, number, and error handling and debugging utilities, additionally add the following to source code.
| Utility | Header File |
|---|---|
Date |
#include <pfmDateUtilily.h> |
Number |
#include <pfmNumber.h> |
Error handling and debugging |
#include <pfmLogMacro.h> |
3. API List
The following briefly describes APIs for each utility.
3.1. Date Utility
The following are APIs related to date and time processing.
| API | Description |
|---|---|
Checks the validity of an input date. |
|
Checks the validity of an input time. |
|
Checks the format of an input date. |
|
Compares the order of two input dates. |
|
Gets the current system date in the format of yyyymmdd. |
|
Gets the current system time in the format of hhmmss. |
|
Gets the current system time in the format of hhmmssuuuuuu. |
|
Gets the current system time in the format of hhmmssnnnnnnnnn. |
|
Gets the current system date and time in the format of yyyymmddhhmmss. |
|
Gets the current system date and time in the format of yyyymmddhhmmssuuuuuu. |
|
Gets the current system date and time in the format of yyyymmddhhmmssnnnnnnnnn. |
|
Returns the number of days in February of the input year. |
|
Checks whether the input year is a leap year. |
|
Gets the day of the week of the input date. |
|
Gets the date that corresponds to the input day of the input week. |
|
Converts a date to a string in a desired format. |
|
Converts a date from Julian to Gregorian. |
|
Converts a date from Gregorian to Julian. |
|
Converts a solar date to a lunar date. |
|
Converts a lunar date to a solar date. |
|
Calculates the number of days and months between a start date and an end date. |
|
Calculates the end date if a start date is given or the start date if an end date is given. |
|
Gets an input date’s quarter information and the start and end dates of the quarter. |
|
Returns a date utility error message. |
3.2. Number Utility
The following are APIs related to number processing.
| API | Description |
|---|---|
Assigns a PfmNumber parameter to another PfmNumber parameter. |
|
Converts a PfmNumber value to a Long value. |
|
Converts a Long value to a PfmNumber value. |
|
Converts a PfmNumber value to a Double value. |
|
Converts a Double value to a PfmNumber value. |
|
Rounds off a Double value and then converts it to a PfmNumber value. |
|
Converts a value expressed as a NULL-terminated string to a PfmNumber value. |
|
Reads a given length of an input string and then converts it to a PfmNumber value. |
|
Converts a PfmNumber value to a Char value and then aligns it to the right. Blanks created during the alignment are padded with 0. |
|
Converts a PfmNumber value to a Char string. |
|
Converts a PfmNumber value to a Char string with a given length. |
|
Compares two PfmNumber values. |
|
Compares absolute values of two PfmNumber values. |
|
Checks whether the input value is an integer. |
|
Compares a PfmNumber value and a Long value. |
|
Compares a PfmNumber value and a Char string. |
|
Compares a PfmNumber value and a Char string with a given length. |
|
Gets a negative value of a PfmNumber value. |
|
Gets an absolute value of a PfmNumber value. |
|
Adds two PfmNumber values. |
|
Subtracts the second PfmNumber value from the first PfmNumber value. |
|
Multiplies two PfmNumber values. |
|
Divides the first PfmNumber value by the second PfmNumber value. |
|
Divides the first PfmNumber value by the second PfmNumber value and then converts the result value to an integer. |
|
Finds the remainder of dividing the first PfmNumber value by the second PfmNumber value. |
|
Finds the quotient and remainder of dividing the first PfmNumber value by the second PfmNumber value. |
|
Rounds down a PfmNumber value to a given position. |
|
Rounds off a PfmNumber value to a given position of decimal places. |
|
Rounds down the fraction part of a PfmNumber value. |
|
Rounds off a PfmNumber value to one digit. |
|
Raises a PfmNumber value to a power. |
|
Raises the first PfmNumber value to the power of the second PfmNumber value. |
|
Adds two PfmNumber values and then assigns the result to the first PfmNumber value. |
|
Subtracts the second PfmNumber value from the first PfmNumber value and then assigns the result to the first PfmNumber value. |
|
Converts a string to a number and then adds it to a PfmNumber value. |
|
Converts a string to a number and then subtract it from a PfmNumber value. |
|
Converts a string to a number and then multiples it and a PfmNumber value. |
|
Converts a string to a number and then divides a PfmNumber value by it. |
|
Converts a fixed-size string to a number and then adds it to a PfmNumber value. |
|
Converts a fixed-length string to a number and then subtract it from a PfmNumber value. |
|
Converts a fixed-length string to a number and then multiples it and a PfmNumber value. |
|
Converts a fixed-length string to a number and then divides a PfmNumber value by it. |
|
Adds a PfmNumber value and a Long value. |
|
Subtracts a Long value from a PfmNumber value. |
|
Multiplies a PfmNumber value and a Long value. |
|
Divides a PfmNumber value by a Long value. |
|
Finds the quotient and remainder of dividing the PfmNumber value by a Long value. |
|
Adds up an input value as many times as an input count. |
|
Multiplies an input value as many times as an input count. |
|
Multiplies an input value y times. |
|
Rounds off a PfmNumber value to a given position of decimal places and then assigns the result value to the first parameter. |
|
Rounds up a PfmNumber value to a given position of decimal places and then assigns the result value to the first parameter. |
|
Calculates arithmetic operations and outputs the result as PfmNumber values. |
|
Calculates arithmetic operations and outputs the result as Long values. |
|
Converts a PfmNumber number to a string including commas. |
|
Converts a PfmNumber number to a string in a specific format. |
|
Converts a PfmNumber value to a temporary string for a message. |
|
Converts a PfmNumber value to a temporary string for a message and adds thousands separators. |
|
Finds the number of decimal places in a PfmNumber value. |
|
Converts a PfmNumber value to a Hex string. |
|
Returns an error message when a Number utility error occurs. |
3.3. String Utility
The following are APIs related to string processing.
| API | Description |
|---|---|
Checks whether all characters in a null-terminated string are lowercase. |
|
Checks whether all characters in a fixed-length string are lowercase. |
|
Checks whether all characters in a null-terminated string are uppercase. |
|
Checks whether all characters in a fixed-length string are uppercase. |
|
Checks whether all characters in a null-terminated string are alphabet. |
|
Checks whether all characters in a fixed-length string are alphabet. |
|
Checks whether all characters in a null-terminated string are alphabet or digits. |
|
Checks whether all characters in a fixed-length string are alphabet or digits. |
|
Checks whether the first character of a string is null ('\0'). |
|
Checks whether all characters in a string are null ('\0'). |
|
Checks whether all characters in a null-terminated string are digits. |
|
Checks whether all characters in a fixed-length string are digits. |
|
Checks whether all characters in a null-terminated string are spaces. |
|
Checks whether all characters in a fixed-length string are spaces. |
|
Checks whether all characters in a null-terminated string are spaces or whether the first character is null. |
|
Checks whether all characters in a fixed-length string are spaces or whether the first character is null. |
|
Checks whether all characters in a null-terminated string are 0. |
|
Checks whether all characters in a fixed-length string are 0. |
|
Checks whether a given registration number or corporate registration number is valid. |
|
Checks whether all characters in a null-terminated string are Korean characters. |
|
Checks whether all characters in a fixed-length string are Korean characters. |
|
Checks whether a string has at least one Korean character. |
|
Trims left spaces of a null-terminated string. |
|
Trims left spaces of a fixed-length string. |
|
Trims right spaces of a null-terminated string. |
|
Trims right spaces of a fixed-length string. |
|
Trims left and right spaces of a null-terminated string. |
|
Trims left and right spaces of a fixed-length string. |
|
Removes spaces (0x20) from a null-terminated string. |
|
Removes spaces (0x20) from a fixed-length string. |
|
Trims left spaces of two strings and then compares them. |
|
Trims right spaces of two strings and then compares them. |
|
Trims left and right spaces of two strings and then compares them. |
|
Removes spaces (0x20) of two strings and then compares them. |
|
Copies a string as long as specified and pads the ending remaining part with spaces (0x20). |
|
Copies a string as long as specified, justifies it right, and pads the starting remaining part with 0. |
|
Removes a specified character from a string and copies it to another string. |
|
Extracts digits from a null-terminated string and converts them to an integer string. |
|
Compares a string with a base string. |
|
Searches a base string from N null-terminated strings. |
|
Converts a null-terminated string to lowercase regardless of its length. |
|
Converts a fixed-length string to lowercase. |
|
Converts a null-terminated string to uppercase regardless of its length. |
|
Converts a fixed-length string to uppercase. |
|
Converts a string to Int type. |
|
Converts a string to Long type. |
|
Converts a null-terminated string to Long type. |
|
Converts a fixed-length string to Long type. |
|
Converts a Long number to a string. |
|
Converts a Long number to a string, aligns it to the right, and pads spaces with 0. |
|
Adds a Long integer to a given string and then converts it to a string. |
|
Subtracts a Long integer from a given string and then converts it to a string. |
|
Converts a null-terminated string to hexadecimal. |
|
Converts an ASCII string to EBCDIC. |
|
Converts an EBCDIC string to ASCII. |
|
Converts English code to KSC5601. |
|
Converts a KSC5601 string to English code. |
|
Converts a KSC5601 string to IBM 2-byte combination code. |
|
Converts IBM 2-byte combination code to a KSC5601 string. |
|
Converts a KS 2-byte complete Korean string to IBM SOSI Korean code. |
|
Converts IBM SOSI Korean code to a KS 2-byte complete Korean string. |
|
Converts a Korean string to an English string. |
|
Removes spaces from a KSC5601 Korean string. |
|
Converts 1-byte characters included in a string to KSC5601 2-byte characters. |
|
Converts KSC5601 2-byte characters included in a string to 1-byte characters. |
|
Converts a string with a given conversion method. |
|
Converts a string with a given conversion method and then copies it to another string. |
|
Removes broken Korean characters from an input string. |
|
Gets the location of the first broken Korean character in an input string. |
|
Removes broken characters from an input string and displays full-width Korean characters. It complements pfmStrRemoveBrokenKorean. |
|
Removes blank or KSC5601 spaces before or after a string. |
|
Returns an error message when a String utility error occurs. |
3.4. Long Utility
The following are APIs related to Long data processing.
| API | Description |
|---|---|
Rounds off an input value to a given position of decimal places. |
|
Rounds up an input value to a given position of decimal places. |
|
Rounds down an input value to a given position of decimal places. |
3.5. Error Handling and Debugging Utility
The following are APIs related to error handling and debugging processing.
| API | Description |
|---|---|
Records error information in a log file of the server. |
|
Records debugging information in a log file of the server. |
|
Records trace log for a function before and after the function is called. |
|
Records trace log for a function before and after the function is called. |
|
Records Hexadecimal code log about buffer data. |
|
Returns an error message when a Date, Number, or String utility error occurs. |
3.6. Other APIs
The following are other APIs than the ones described previously.
| API | Description |
|---|---|
Gets a resident registration number and calculates the numbers of years, months, and days s/he has lived. |
|
Gets two values and returns the smaller one. |
|
Gets three values and returns the smallest one. |
|
Gets two values and returns the larger one. |
|
Gets three values and returns the largest one. |
|
Returns an absolute value of an input value. |