knitr::opts_chunk$set(echo = TRUE, comment='')

The rhli variant of the traditional first program, Hello, World! appears below. To the extent possible, the rhli package exactly replicates the FAME C-HLI interface. For information on parameters and functions, refer to the C-HLI documentation. The C-HLI provides very low level, very complete access to FAME.

C-HLI functions return a status code to indicate success (zero) or failure. Refer to C HLI Status Codes in the documentation to interpret non-zero status codes.

| Code | Value | What to do? | |--------|-------|---------------------------------------------------------------------------------------| | HSUCC | 0 | You are good! "Success" | | HNINIT | 2 | The HLI has not been initialized. | | HBPROD | 55 | Contact Qoma, get authorized for Qoma products. | | HLICFL | 98 | Contact FIS, get authorized for FAME products. |

The below program:

  1. Initializes the C-HLI. No other C-HLI calls work until the C-HLI is initialized.
  2. Gets the C-HLI version number. The C-HLI version number is helpful for debugging.
  3. Finishes the C-HLI. This final C-HLI call will prevent loss of data.

These three calls should appear in all C-HLI programs.

# Load the rhli package
library("rhli")

# Initialize the C-HLI
status <- Integer(-1)
cfmini(status)
cat(sprintf("cfmini(status) status=%d",status$value))

# Get the C-HLI version number
ver <- Numeric(-1)
cfmver(status,ver)
cat(sprintf("cfmver(status,ver) status=%d ver=%.5f",status$value,ver$value))

# Finish the C-HLI
cfmfin(status)
cat(sprintf("cfmfin(status) status=%d",status$value))
# Say hello!
cat(sprintf("\nHello FAME!\n\n  %s \"%s\" %s\n  rhli version %s\n  C-HLI version %.5f\n\n",
  R.Version()$version.string,R.Version()$nickname,R.Version()$platform,            
  packageVersion("rhli"),
  ver$value))

# Unload C-HLI shared library 
#   (required for cfmini() to work when building next vignette)
unloadNamespace("rhli")


qomaio/rhli documentation built on May 26, 2019, 12:33 p.m.