Gujarati script processing API reference

Files:
C/C++ Header:
brh_gujapi_api.h
Visual Basic definition: brh_gujapi.bas
Library: brh_gujapi.dll
Import Library: brh_gujapi.lib

guj_formats.jpg

Gujarati Data Conversion Flow.


BrhRegister() function registers the Gujarati Data Processing SDK. This function should be called before you call any other functions in the DLL.

VC++:
BOOL BrhRegister(
LPCSTR
strCompanyName ,
LPCSTR strRegKey
);

VB:
Declare Function BrhRegister Lib "brh_gujapi.dll" (ByVal strCompanyName As String, ByVal strRegKey As String) As Long

VC++ COM:
HRESULT Register (/*[in]*/ BSTR strCompanyName, /*[in]*/ BSTR strRegKey, /*[out, retval]*/ BOOL* bOutput);

VB COM:
bOutput = gujapi.Register(strCompanyName, strRegKey)

Parameters:
strCompanyName: Specifies the name of the company/person to which/whom this product is registered.
strRegkey: Specifies the registration key of the product.

Return Value:
If the function is successful, the return value is 1. If the function fails, the return value is 0.

Remarks:
If you don't have valid registration key, then you should not call BrhRegister() or gujapi.Register() function at all. This causes BRH_GUJAPI to run in the demo mode.

In the demo mode only the first 32 bytes (32 characters in the case of UNICODE) in the input string are converted to the specified output format by the BrhConvert & BrhConvertEx functions.

In the demo mode only first 16 bytes (16 characters in the case of UNICODE) are compared by BrhCompare & BrhCompareEx functions.


BrhConvert() function converts the input string represented in "GUJTRANS" format to "ANSI" output data format. This function internally calls BrhConvertEx() function.

VC++:
long BrhConvert(
LPCSTR
strInput ,
LPSTR strOutput ,
long nMaxCount
);

VB:
Declare Function BrhConvert Lib "brh_gujapi.dll" (ByVal strInput As String, ByVal strOutput As String, ByVal nMaxCount As Long) As Long

VC++ COM:
HRESULT
Convert (/*[in]*/ BSTR strInput, /*[out, retval]*/ BSTR* strOutput);

VB COM:
strOutput = gujapi.Convert(strInput)

Parameters:
strInput: Points to the string in "GUJTRANS" format to be converted.
strOutput: Points to a buffer that receives the converted string in "ANSI" format.
nMaxCount: Specifies the size, in bytes, of the buffer pointed to by the strOutput parameter.

Return Value:
If the function succeeds, and nMaxCount is nonzero, the return value is the number of bytes written to the buffer pointed to by strOutput.
If the function succeeds, and nMaxCount is zero, the return value is the required size, in bytes, for a buffer that can receive the translated string.
If the function fails, the return value is zero.


BrhConvertEx() function converts the input string represented in strInputFormat format to the output format specified by strOutputFormat.

VC++:
long BrhConvertEx(
LPCSTR
strInput ,
LPCSTR strInputFormat ,
LPSTR strOutput ,
LPCSTR strOutputFormat ,
long nMaxCount
);

VB:
Declare Function BrhConvertEx Lib "brh_gujapi.dll" (ByVal strInput As String, ByVal strInputFormat As String, ByVal strOutput As String, ByVal strOutputFormat As String, ByVal nMaxCount As Long) As Long

VC++ COM:
HRESULT
ConvertEx (/*[in]*/ BSTR strInput, /*[in]*/ BSTR strInputFormat, /*[in]*/ BSTR strOutputFormat, /*[out, retval]*/ BSTR* strOutput);

VB COM:
strOutput = gujapi.ConvertEx(strInput, strInputFormat, strOutputFormat)

Parameters:
strInput: Points to the string in strInputFormat format to be converted.
strInputFormat: Specifies the input string format.
strOutput: Points to a buffer that receives the converted string in strOutputFormat format.
strOutputFormat: Specifies the output string format.
nMaxCount:Specifies the size, in bytes (UNICODE characters if strOutputFormat = "UNICODE"), of the buffer pointed to by the strOutput parameter.

Return Value:
If the function succeeds, and nMaxCount is nonzero, the return value is the number of bytes (UNICODE characters if strOutputFormat = "UNICODE") written to the buffer pointed to by strOutput.
If the function succeeds, and nMaxCount is zero, the return value is the required size, in bytes, for a buffer that can receive the translated string.
If the function fails, the return value is zero.


BrhCompare() function compares two Gujarati strings represented in "GUJTRANS" format. This function internally calls BrhCompareEx() function.

VC++:
long BrhCompare(
LPCSTR
strString1 ,
LPCSTR strString2 ,
BOOL bMemcmp
);

VB:
Declare Function BrhCompare Lib "brh_gujapi.dll" (ByVal strString1 As String, ByVal strString2 As String, ByVal bMemcmp As Long) As Long

VC++ COM:
HRESULT
Compare (/*[in]*/ BSTR strString1, /*[in]*/ BSTR strString2, /*[in]*/ BOOL bMemcmp, /*[out, retval]*/ long* lOutput);

VB COM:
lOutput = gujapi.CompareEx(strString1, strString2, bMemcmp)

Parameters:
strString1: Points to the first string in "GUJTRANS" format.
strString2: Points to the second string in "GUJTRANS" format.
bMemcmp : If 1, the strings are compared based on their binary values. If 0, a special comparison algorithm is used.

Return Value:
Returns 0 if strString1 identical to strString2.
Returns -ve value if strString1 less than strString2.
Returns +ve value if strString1 greater than strString2.

Remarks:
In the special comparison, the vedic, music, laghu, & guru symbols are ignored.


BrhCompareEx() function compares two Gujarati strings represented in various formats.

VC++:
long BrhCompareEx(
LPCSTR
strString1 ,
LPCSTR strString1Format ,
LPCSTR strString2 ,
LPCSTR strString2Format ,
BOOL bMemcmp
);

VB:
Declare Function BrhCompareEx Lib "brh_gujapi.dll" (ByVal strString1 As String, ByVal strString1Format As String, ByVal strString2 As String, ByVal strString2Format As String, ByVal bMemcmp As Long ) As Long

VC++ COM:
HRESULT
CompareEx (/*[in]*/ BSTR strString1, /*[in]*/ BSTR strString1Format, /*[in]*/ BSTR strString2, /*[in]*/ BSTR strString2Format, /*[in]*/ BOOL bMemcmp, /*[out, retval]*/ long* lOutput);

VB COM:
lOutput = gujapi.CompareEx(strString1, strString1Format, strString2, strString2Format, bMemcmp)

Parameters:
strString1: Points to the first string.
strString1Format: Specifies the first string format.
strString2: Points to the second string.
strString2Format: Specifies the second string format.
bMemcmp : If 1, the strings are compared based on their binary values. If 0, a special comparison algorithm is used.

Return Value:
Returns 0 if strString1 identical to strString2.
Returns -ve value if strString1 less than strString2.
Returns +ve value if strString1 greater than strString2.

Remarks:
In the special comparison, the vedic, music, laghu, & guru symbols are ignored.


BrhConvertDate() function converts the Date/Time strings to/from Gujarati(GUJTRANS) to English.

VC++:
void BrhConvertDate(
LPCSTR
strInput,
BOOL bFromEnglish ,
LPSTR strOutput,
long nMaxCount
);

VB:
Declare Sub BrhConvertDate Lib "brh_gujapi.dll" (ByVal strInput As String, ByVal bFromEnglish as Long, ByVal strOutput As String, ByVal nMaxCount As Long )

VC++ COM:
HRESULT
ConvertDate (/*[in]*/ BSTR strInput, /*[in]*/ BOOL bFromEnglish , /*[in]*/ BSTR* strOutput);

VB COM:
strOutput = gujapi.ConvertDate(strInput, bFromEnglish)

Parameters:
strInput: Points to the input string to be converted.
bFromEnglish: If 1 convert from English to GUJTRANS. Else, convert from GUJTRANS to English.
strOutput: Points to the output string.
nMaxCount: Specifies the size in bytes, of the buffer pointed to by the strOutput parameter.

Remarks:
The Date/Time strings can be converted to/from English to GUJTRANS format. The string can be later converted to other Gujarati data formats.

Ex: "Tuesday, January 23, 1968" is converted to "covva, janavari 23, 1968", when bFromEnglish is 1
Ex: "mArc 15, 1972, 8:00 pUrvAhna" is converted to "MARCH 15, 1972, 8:00 AM", when bFromEnglish is 0.