/Spss/SpssThinWrapper.cs
C# | 3465 lines | 543 code | 214 blank | 2708 comment | 7 complexity | 74346f8ced511f804400947569d80be8 MD5 | raw file
Possible License(s): LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- using System;
- using System.Runtime.InteropServices;
- using System.IO;
- using System.Diagnostics;
- using System.Runtime.CompilerServices;
-
- namespace Spss
- {
- #region Enumerables
- /// <summary>
- /// Error/warning codes that calls to SPSS methods can return.
- /// </summary>
- public enum ReturnCode : int
- {
- /// <summary>
- /// No error
- /// </summary>
- SPSS_OK = 0,
-
- #region Error codes that calls to SPSS methods can return.
- /// <summary>
- /// Error opening file
- /// </summary>
- SPSS_FILE_OERROR = 1,
- /// <summary>
- /// File write error
- /// </summary>
- SPSS_FILE_WERROR = 2,
- /// <summary>
- /// Error reading the file
- /// </summary>
- SPSS_FILE_RERROR = 3,
- /// <summary>
- /// File table full (too many open SPSS data files)
- /// </summary>
- SPSS_FITAB_FULL = 4,
- /// <summary>
- /// The file handle is not valid
- /// </summary>
- SPSS_INVALID_HANDLE = 5,
- /// <summary>
- /// Data file contains no variables
- /// </summary>
- SPSS_INVALID_FILE = 6,
- /// <summary>
- /// Insufficient memory
- /// </summary>
- SPSS_NO_MEMORY = 7,
-
- /// <summary>
- /// File is open for reading, not writing
- /// </summary>
- SPSS_OPEN_RDMODE = 8,
- /// <summary>
- /// The file is open for writing, not reading
- /// </summary>
- SPSS_OPEN_WRMODE = 9,
-
- /// <summary>
- /// The variable name is not valid
- /// </summary>
- SPSS_INVALID_VARNAME = 10,
- /// <summary>
- /// No variables defined in the dictionary
- /// </summary>
- SPSS_DICT_EMPTY = 11,
- /// <summary>
- /// A variable with the given name does not exist
- /// </summary>
- SPSS_VAR_NOTFOUND = 12,
- /// <summary>
- /// There is already a variable with the same name
- /// </summary>
- SPSS_DUP_VAR = 13,
- /// <summary>
- /// The variable is not numeric
- /// OR
- /// At least one variable in the list is not numeric
- /// OR
- /// The specified variable has string values
- /// </summary>
- SPSS_NUME_EXP = 14,
- /// <summary>
- /// The variable is numeric
- /// </summary>
- SPSS_STR_EXP = 15,
- /// <summary>
- /// The variable is a long string (length > 8)
- /// </summary>
- SPSS_SHORTSTR_EXP = 16,
- /// <summary>
- /// Invalid length code (varLength is negative or
- /// exceeds 255)
- /// </summary>
- SPSS_INVALID_VARTYPE = 17,
-
- /// <summary>
- /// Invalid missing values specification ( missingFormat
- /// is invalid or the lower limit of range is greater than the
- /// upper limit)
- /// </summary>
- SPSS_INVALID_MISSFOR = 18,
- /// <summary>
- /// Invalid compression switch (other than 0 or 1)
- /// </summary>
- SPSS_INVALID_COMPSW = 19,
- /// <summary>
- /// The print format specification is invalid or is
- /// incompatible with the variable type
- /// </summary>
- SPSS_INVALID_PRFOR = 20,
- /// <summary>
- /// The write format specification is invalid or is
- /// incompatible with the variable type
- /// </summary>
- SPSS_INVALID_WRFOR = 21,
- /// <summary>
- /// Invalid date
- /// OR
- /// The date value (spssDate) is negative
- /// </summary>
- SPSS_INVALID_DATE = 22,
- /// <summary>
- /// Invalid time
- /// </summary>
- SPSS_INVALID_TIME = 23,
-
- /// <summary>
- /// Fewer than two variables in list
- /// OR
- /// Number of variables ( numVars) is zero or negative
- /// </summary>
- SPSS_NO_VARIABLES = 24,
- /// <summary>
- /// The list of values contains duplicates
- /// </summary>
- SPSS_DUP_VALUE = 27,
-
- /// <summary>
- /// The given case weight variable is invalid. This error
- /// signals an internal problem in the implementation
- /// of the DLL and should never occur.
- /// </summary>
- SPSS_INVALID_CASEWGT = 28,
- /// <summary>
- /// Dictionary has already been written with
- /// spssCommitHeader
- /// </summary>
- SPSS_DICT_COMMIT = 30,
- /// <summary>
- /// Dictionary of the output file has not yet been written
- /// with <see cref="SpssThinWrapper.spssCommitHeaderDelegate"/>.
- /// </summary>
- SPSS_DICT_NOTCOMMIT = 31,
-
- /// <summary>
- /// File is not a valid SPSS data file (no type 2 record)
- /// </summary>
- SPSS_NO_TYPE2 = 33,
- /// <summary>
- /// There is no type7, subtype3 record present. This
- /// code should be regarded as a warning even though
- /// it is positive. Files without this record are valid.
- /// </summary>
- SPSS_NO_TYPE73 = 41,
- /// <summary>
- /// The date variable information is invalid
- /// </summary>
- SPSS_INVALID_DATEINFO = 45,
- /// <summary>
- /// File is not a valid SPSS data file (missing type 999
- /// record)
- /// </summary>
- SPSS_NO_TYPE999 = 46,
- /// <summary>
- /// The value is longer than the length of the variable
- /// </summary>
- SPSS_EXC_STRVALUE = 47,
- /// <summary>
- /// Unable to free because arguments are illegal or
- /// inconsistent (for example, negative numLabels)
- /// </summary>
- SPSS_CANNOT_FREE = 48,
- /// <summary>
- /// Buffer value is too short to hold the value
- /// </summary>
- SPSS_BUFFER_SHORT = 49,
- /// <summary>
- /// Current case is not valid. This may be because no
- /// spssReadCaseRecord calls have been made yet or
- /// because the most recent call failed with error or encountered
- /// the end of file.
- /// </summary>
- SPSS_INVALID_CASE = 50,
- /// <summary>
- /// Internal data structures of the DLL are invalid. This
- /// signals an error in the DLL.
- /// </summary>
- SPSS_INTERNAL_VLABS = 51,
- /// <summary>
- /// File created on an incompatible system.
- /// </summary>
- SPSS_INCOMPAT_APPEND = 52,
- /// <summary>
- /// Undocumented by SPSS.
- /// </summary>
- SPSS_INTERNAL_D_A = 53,
- /// <summary>
- /// Error accessing the temporary file
- /// </summary>
- SPSS_FILE_BADTEMP = 54,
- /// <summary>
- /// spssGetDEWFirst was never called
- /// </summary>
- SPSS_DEW_NOFIRST = 55,
- /// <summary>
- /// measureLevel is not in the legal range, or is
- /// SPSS_MLVL_RAT and the variable is a string variable.
- /// </summary>
- SPSS_INVALID_MEASURELEVEL = 56,
- /// <summary>
- /// Parameter subtype not between 1 and
- /// MAX7SUBTYPE
- /// </summary>
- SPSS_INVALID_7SUBTYPE = 57,
-
- /// <summary>
- /// Existing multiple response set definitions are invalid
- /// </summary>
- SPSS_INVALID_MRSETDEF = 70,
- /// <summary>
- /// The multiple response set name is invalid
- /// </summary>
- SPSS_INVALID_MRSETNAME = 71,
- /// <summary>
- /// The multiple response set name is a duplicate
- /// </summary>
- SPSS_DUP_MRSETNAME = 72,
- /// <summary>
- /// Undocumented by SPSS.
- /// </summary>
- SPSS_BAD_EXTENSION = 73,
- #endregion
-
- #region Warning codes returned by functions
-
- /// <summary>
- /// Label length exceeds 64, truncated and used (warning)
- /// </summary>
- SPSS_EXC_LEN64 = -1,
-
- /// <summary>
- /// Variable label’s length exceeds 120, truncated and
- /// used (warning)
- /// </summary>
- SPSS_EXC_LEN120 = -2,
-
- /// <summary>
- /// ... (warning)
- /// </summary>
- SPSS_EXC_VARLABEL = -2,
-
- /// <summary>
- /// Label length exceeds 60, truncated and used (warning)
- /// </summary>
- SPSS_EXC_LEN60 = -4,
-
- /// <summary>
- /// ... (warning)
- /// </summary>
- SPSS_EXC_VALLABEL = -4,
-
- /// <summary>
- /// End of the file reached, no more cases (warning)
- /// </summary>
- SPSS_FILE_END = -5,
-
- /// <summary>
- /// There is no variable sets information in the file (warning)
- /// </summary>
- SPSS_NO_VARSETS = -6,
-
- /// <summary>
- /// The variable sets information is empty (warning)
- /// </summary>
- SPSS_EMPTY_VARSETS = -7,
-
- /// <summary>
- /// The variable has no labels (warning) (warning)
- /// </summary>
- SPSS_NO_LABELS = -8,
-
- /// <summary>
- /// There is no label for the given value (warning)
- /// </summary>
- SPSS_NO_LABEL = -9,
-
- /// <summary>
- /// A case weight variable has not been defined for this file (warning)
- /// </summary>
- SPSS_NO_CASEWGT = -10,
-
- /// <summary>
- /// There is no TRENDS date variable information in the file (warning)
- /// </summary>
- SPSS_NO_DATEINFO = -11,
-
- /// <summary>
- /// No definitions on the file (warning)
- /// </summary>
- SPSS_NO_MULTRESP = -12,
-
- /// <summary>
- /// The string contains no definitions (warning)
- /// </summary>
- SPSS_EMPTY_MULTRESP = -13,
-
- /// <summary>
- /// File contains no DEW information (warning)
- /// </summary>
- SPSS_NO_DEW = -14,
-
- /// <summary>
- /// Zero bytes to be written (warning)
- /// </summary>
- SPSS_EMPTY_DEW = -15,
- #endregion
- }
-
- /// <summary>
- /// Missing Value Type codes
- /// </summary>
- public enum MissingValueFormatCode : int
- {
- /// <summary>
- /// Indicates that no discrete missing values will be defined.
- /// </summary>
- SPSS_NO_MISSVAL = 0,
-
- /// <summary>
- /// Indicates that 1 discrete missing values will be defined.
- /// </summary>
- SPSS_ONE_MISSVAL = 1,
-
- /// <summary>
- /// Indicates that 2 discrete missing values will be defined.
- /// </summary>
- SPSS_TWO_MISSVAL = 2,
-
- /// <summary>
- /// Indicates that 3 discrete missing values will be defined.
- /// </summary>
- SPSS_THREE_MISSVAL = 3,
-
- /// <summary>
- /// missingVal1 and missingVal2 are taken as the upper and lower limits,
- /// respectively, of the range, and missingVal3 is ignored
- /// </summary>
- SPSS_MISS_RANGE = -2,
-
- /// <summary>
- /// missingval1 and missingVal2 are taken as limits of the range and missingVal3 is taken
- /// as the discrete missing value.
- /// </summary>
- SPSS_MISS_RANGEANDVAL = -3,
- }
-
- /// <summary>
- /// Format Type codes
- /// </summary>
- public enum FormatTypeCode : int
- {
- /// <summary>
- /// Alphanumeric
- /// </summary>
- SPSS_FMT_A = 1,
-
- /// <summary>
- /// Alphanumeric hexadecimal
- /// </summary>
- SPSS_FMT_AHEX = 2,
-
- /// <summary>
- /// F Format with commas
- /// </summary>
- SPSS_FMT_COMMA = 3,
-
- /// <summary>
- /// Commas and floating dollar sign
- /// </summary>
- SPSS_FMT_DOLLAR = 4,
-
- /// <summary>
- /// Default Numeric Format
- /// </summary>
- SPSS_FMT_F = 5,
-
- /// <summary>
- /// Int16 binary
- /// </summary>
- SPSS_FMT_IB = 6,
-
- /// <summary>
- /// Positive Int16 binary - hex
- /// </summary>
- SPSS_FMT_PIBHEX = 7,
-
- /// <summary>
- /// Packed decimal
- /// </summary>
- SPSS_FMT_P = 8,
-
- /// <summary>
- /// Positive Int16 binary unsigned
- /// </summary>
- SPSS_FMT_PIB = 9,
-
- /// <summary>
- /// Positive Int16 binary unsigned
- /// </summary>
- SPSS_FMT_PK = 10,
-
- /// <summary>
- /// Floating poInt32 binary
- /// </summary>
- SPSS_FMT_RB = 11,
-
- /// <summary>
- /// Floating poInt32 binary hex
- /// </summary>
- SPSS_FMT_RBHEX = 12,
-
- /// <summary>
- /// Zoned decimal
- /// </summary>
- SPSS_FMT_Z = 15,
-
- /// <summary>
- /// N Format- unsigned with leading 0s
- /// </summary>
- SPSS_FMT_N = 16,
-
- /// <summary>
- /// E Format- with explicit power of 10
- /// </summary>
- SPSS_FMT_E = 17,
-
- /// <summary>
- /// Date format dd-mmm-yyyy
- /// </summary>
- SPSS_FMT_DATE = 20,
-
- /// <summary>
- /// Time format hh:mm:ss.s
- /// </summary>
- SPSS_FMT_TIME = 21,
-
- /// <summary>
- /// Date and Time
- /// </summary>
- SPSS_FMT_DATE_TIME = 22,
-
- /// <summary>
- /// Date format dd-mmm-yyyy
- /// </summary>
- SPSS_FMT_ADATE = 23,
-
- /// <summary>
- /// Julian date - yyyyddd
- /// </summary>
- SPSS_FMT_JDATE = 24,
-
- /// <summary>
- /// Date-time dd hh:mm:ss.s
- /// </summary>
- SPSS_FMT_DTIME = 25,
-
- /// <summary>
- /// Day of the week
- /// </summary>
- SPSS_FMT_WKDAY = 26,
-
- /// <summary>
- /// Month
- /// </summary>
- SPSS_FMT_MONTH = 27,
-
- /// <summary>
- /// mmm yyyy
- /// </summary>
- SPSS_FMT_MOYR = 28,
-
- /// <summary>
- /// q Q yyyy
- /// </summary>
- SPSS_FMT_QYR = 29,
-
- /// <summary>
- /// ww WK yyyy
- /// </summary>
- SPSS_FMT_WKYR = 30,
-
- /// <summary>
- /// Percent - F followed by %
- /// </summary>
- SPSS_FMT_PCT = 31,
-
- /// <summary>
- /// Like COMMA, switching dot for comma
- /// </summary>
- SPSS_FMT_DOT = 32,
-
- /// <summary>
- /// User Programmable currency format
- /// </summary>
- SPSS_FMT_CCA = 33,
-
- /// <summary>
- /// User Programmable currency format
- /// </summary>
- SPSS_FMT_CCB = 34,
-
- /// <summary>
- /// User Programmable currency format
- /// </summary>
- SPSS_FMT_CCC = 35,
-
- /// <summary>
- /// User Programmable currency format
- /// </summary>
- SPSS_FMT_CCD = 36,
-
- /// <summary>
- /// User Programmable currency format
- /// </summary>
- SPSS_FMT_CCE = 37,
-
- /// <summary>
- /// Date in dd/mm/yyyy style
- /// </summary>
- SPSS_FMT_EDATE = 38,
-
- /// <summary>
- /// Date in yyyy/mm/dd style
- /// </summary>
- SPSS_FMT_SDATE = 39,
- }
-
- /// <summary>
- /// Measurement Level codes
- /// </summary>
- public enum MeasurementLevelCode : int
- {
- /// <summary>
- /// Unknown
- /// </summary>
- SPSS_MLVL_UNK = 0,
-
- /// <summary>
- /// Nominal
- /// </summary>
- SPSS_MLVL_NOM = 1,
-
- /// <summary>
- /// Ordinal
- /// </summary>
- SPSS_MLVL_ORD = 2,
-
- /// <summary>
- /// Scale (Ratio)
- /// </summary>
- SPSS_MLVL_RAT = 3,
- }
- /// <summary>
- /// Alignment codes
- /// </summary>
- public enum AlignmentCode : int
- {
- /// <summary>
- /// Left aligned
- /// </summary>
- SPSS_ALIGN_LEFT = 0,
-
- /// <summary>
- /// Right aligned
- /// </summary>
- SPSS_ALIGN_RIGHT = 1,
-
- /// <summary>
- /// Centered
- /// </summary>
- SPSS_ALIGN_CENTER = 2,
- }
- /// <summary>
- /// Diagnostics regarding var names
- /// </summary>
- public enum VarNameDiagnostic : int
- {
- /// <summary>
- /// Valid standard name
- /// </summary>
- SPSS_NAME_OK = 0,
-
- /// <summary>
- /// Valid scratch var name
- /// </summary>
- SPSS_NAME_SCRATCH = 1,
-
- /// <summary>
- /// Valid system var name
- /// </summary>
- SPSS_NAME_SYSTEM = 2,
-
- /// <summary>
- /// Empty or longer than SPSS_MAX_VARNAME
- /// </summary>
- SPSS_NAME_BADLTH = 3,
-
- /// <summary>
- /// Invalid character or imbedded blank
- /// </summary>
- SPSS_NAME_BADCHAR = 4,
-
- /// <summary>
- /// Name is a reserved word
- /// </summary>
- SPSS_NAME_RESERVED = 5,
-
- /// <summary>
- /// Invalid initial character
- /// </summary>
- SPSS_NAME_BADFIRST = 6,
- }
- /// <summary>
- /// Definitions of "type 7" records
- /// </summary>
- public enum Type7Record : int
- {
- /// <summary>
- /// Documents (actually type 6
- /// </summary>
- SPSS_T7_DOCUMENTS = 0,
-
- /// <summary>
- /// VAX Data Entry - dictionary version
- /// </summary>
- SPSS_T7_VAXDE_DICT = 1,
-
- /// <summary>
- /// VAX Data Entry - data
- /// </summary>
- SPSS_T7_VAXDE_DATA = 2,
-
- /// <summary>
- /// Source system characteristics
- /// </summary>
- SPSS_T7_SOURCE = 3,
-
- /// <summary>
- /// Source system floating pt constants
- /// </summary>
- SPSS_T7_HARDCONST = 4,
-
- /// <summary>
- /// Variable sets
- /// </summary>
- SPSS_T7_VARSETS = 5,
-
- /// <summary>
- /// Trends date information
- /// </summary>
- SPSS_T7_TRENDS = 6,
-
- /// <summary>
- /// Multiple response groups
- /// </summary>
- SPSS_T7_MULTRESP = 7,
-
- /// <summary>
- /// Windows Data Entry data
- /// </summary>
- SPSS_T7_DEW_DATA = 8,
-
- /// <summary>
- /// TextSmart data
- /// </summary>
- SPSS_T7_TEXTSMART = 10,
-
- /// <summary>
- /// Msmt level, col width, & alignment
- /// </summary>
- SPSS_T7_MSMTLEVEL = 11,
-
- /// <summary>
- /// Windows Data Entry GUID
- /// </summary>
- SPSS_T7_DEW_GUID = 12,
-
- /// <summary>
- /// Extended variable names
- /// </summary>
- SPSS_T7_XVARNAMES = 13,
- }
-
- #endregion
-
- /// <summary>
- /// A very thin SpssSafeWrapper that provides access to all the functions
- /// exposed from the SPSSIO*.dll library provided with SPSS 20.
- /// </summary>
- // <remarks>
- // <para>Each method in SPSSIO32/64.DLL is represented exactly once by this class.</para>
- // <para>Those methods that require the use of pointers for memory management
- // reasons are marked <c>unsafe</c>, and have <c>protected</c> access for
- // proper handling by a descending class.
- // Those methods that require string marshaling are marked <c>protected</c>,
- // because they require special string buffers to be created and trimmed for
- // correct access.
- // Both types of protected methods should be wrapped and appropriately
- // handled by a <see cref="SpssSafeWrapper"/>descending class</see>.</para>
- // </remarks>
- public class SpssThinWrapper
- {
- //Locations of the 32 bit spss and support dll's relative to the applications directory.
- const String spssio32 = @"win32\spssio32.dll";
-
- //Location of the 64 bit spss and support dll's relative to the applications directory.
- const String spssio64 = @"win64\spssio64.dll";
-
- #region Maximum lengths of SPSS data file objects
-
- /// <summary>
- /// Maximum length of a variable name
- /// </summary>
- public const int SPSS_MAX_VARNAME = 64;
-
- /// <summary>
- /// Short (compatibility) variable name.
- /// </summary>
- public const int SPSS_MAX_SHORTVARNAME = 8;
-
- /// <summary>
- /// Maximum length of a short string variable
- /// </summary>
- public const int SPSS_MAX_SHORTSTRING = 8;
-
- /// <summary>
- /// Maximum length of a file label string
- /// </summary>
- public const int SPSS_MAX_IDSTRING = 64;
-
- /// <summary>
- /// (old) Maximum length of a long string variable
- /// </summary>
- public const int SPSS_MAX_LONGSTRING = 255;
-
- /// <summary>
- /// Maximum length of a long string variable.
- /// </summary>
- public const int SPSS_MAX_VERYLONGSTRING = 32 * 1024;
-
- /// <summary>
- /// Maximum length of a value label
- /// </summary>
- public const int SPSS_MAX_VALLABEL = 60;
-
- /// <summary>
- /// Maximum length of a variable label
- /// </summary>
- public const int SPSS_MAX_VARLABEL = 256;
-
- /// <summary>
- /// Maximum record 7 subtype
- /// </summary>
- public const int SPSS_MAX_7SUBTYPE = 32;
- #endregion
-
- /// <summary>
- /// Closes an SPSS file that was opened using <see cref="spssOpenAppendDelegate"/>.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file.
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
- /// <see cref="ReturnCode.SPSS_OPEN_RDMODE"/>, or
- /// <see cref="ReturnCode.SPSS_FILE_WERROR"/>.
- /// </returns>
- /// <remarks>
- /// This function closes the data file associated with handle, which must have been opened
- /// for appending cases using <see cref="spssOpenAppendDelegate"/>. The file handle handle becomes invalid
- /// and no further operations can be performed using it.
- /// </remarks>
- public delegate ReturnCode spssCloseAppendDelegate(int handle);
- public static spssCloseAppendDelegate spssCloseAppendImpl;
-
- /// <summary>
- /// Closes an SPSS file that was opened using <see cref="spssOpenReadDelegate"/>.
- /// </summary>
- /// <param name="handle"></param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
- /// <see cref="ReturnCode.SPSS_OPEN_WRMODE"/>.
- /// </returns>
- /// <remarks>
- /// This function closes the data file associated with handle, which must have been opened
- /// for reading using <see cref="spssOpenReadDelegate"/>. The file handle handle becomes
- /// invalid and no further operations can be performed using it.
- /// </remarks>
- public delegate ReturnCode spssCloseReadDelegate(int handle);
- public static spssCloseReadDelegate spssCloseReadImpl;
-
- /// <summary>
- /// Closes an SPSS file that was opened using <see cref="spssOpenWriteDelegate"/>.
- /// </summary>
- /// <param name="handle"></param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
- /// <see cref="ReturnCode.SPSS_OPEN_RDMODE"/>,
- /// <see cref="ReturnCode.SPSS_DICT_NOTCOMMIT"/>, or
- /// <see cref="ReturnCode.SPSS_FILE_WERROR"/>.
- /// </returns>
- /// <remarks>
- /// This function closes the data file associated with handle, which must have been opened
- /// for writing using <see cref="spssOpenWriteDelegate"/>. The file handle handle becomes invalid
- /// and no further operations can be performed using it.
- /// </remarks>
- public delegate ReturnCode spssCloseWriteDelegate(int handle);
- public static spssCloseWriteDelegate spssCloseWriteImpl;
-
- /// <summary>
- /// Writes a case to an SPSS data file after its values have been set.
- /// </summary>
- /// <param name="handle"></param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
- /// <see cref="ReturnCode.SPSS_OPEN_RDMODE"/>,
- /// <see cref="ReturnCode.SPSS_DICT_NOTCOMMIT"/>, or
- /// <see cref="ReturnCode.SPSS_FILE_WERROR"/>.
- /// </returns>
- /// <remarks>
- /// This function writes a case to the data file specified by the handle. It must be called after
- /// setting the values of variables through <see cref="spssSetValueNumericDelegate"/> and
- /// <see cref="spssSetValueCharDelegate"/>.
- /// Any variables left unset will get the system-missing value if they are numeric and all
- /// blanks if they are strings. Unless spssCommitCaseRecord is called, the case will not be
- /// written out.
- /// </remarks>
- public delegate ReturnCode spssCommitCaseRecordDelegate(int handle);
- public static spssCommitCaseRecordDelegate spssCommitCaseRecordImpl;
-
- /// <summary>
- /// Writes the data dictionary to the data file. To be used after dictionary defining
- /// functions are called, and before cases are written.
- /// </summary>
- /// <param name="handle"></param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
- /// <see cref="ReturnCode.SPSS_OPEN_RDMODE"/>,
- /// <see cref="ReturnCode.SPSS_DICT_COMMIT"/>,
- /// <see cref="ReturnCode.SPSS_DICT_EMPTY"/>,
- /// <see cref="ReturnCode.SPSS_FILE_WERROR"/>,
- /// <see cref="ReturnCode.SPSS_NO_MEMORY"/>, or
- /// <see cref="ReturnCode.SPSS_INTERNAL_VLABS"/>.
- /// </returns>
- /// <remarks>
- /// This function writes the data dictionary to the data file associated with handle. Before
- /// any case data can be written, the dictionary must be committed; once the dictionary has
- /// been committed, no further changes can be made to it.
- /// </remarks>
- public delegate ReturnCode spssCommitHeaderDelegate(int handle);
- public static spssCommitHeaderDelegate spssCommitHeaderImpl;
-
- /// <summary>
- /// Converts a day/month/year into SPSS format.
- /// </summary>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>, or
- /// <see cref="ReturnCode.SPSS_INVALID_DATE"/>.
- /// </returns>
- /// <remarks>
- /// This function converts a Gregorian date expressed as day-month-year to the internal
- /// SPSS date format. The time portion of the date variable is set to 0:00. To set the time
- /// portion of the date variable to another value, use spssConvertTime and add the resulting
- /// value to *spssDate. Dates before October 15, 1582, are considered invalid.
- /// </remarks>
- public delegate ReturnCode spssConvertDateDelegate(int day, int month, int year, out double spssDate);
- public static spssConvertDateDelegate spssConvertDateImpl;
-
- /// <summary>
- /// Extracts the date from an SPSS date field.
- /// </summary>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>, or
- /// <see cref="ReturnCode.SPSS_INVALID_DATE"/>.
- /// </returns>
- /// <remarks>
- /// This function converts the date (as distinct from time) portion of a value in internal SPSS
- /// date format to Gregorian style.
- /// </remarks>
- public delegate ReturnCode spssConvertSPSSDateDelegate(out int day, out int month, out int year, double spssDate);
- public static spssConvertSPSSDateDelegate spssConvertSPSSDateImpl;
-
- /// <summary>
- /// Extracts the time of day from an SPSS date field.
- /// </summary>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>, or
- /// <see cref="ReturnCode.SPSS_INVALID_TIME"/>.
- /// </returns>
- /// <remarks>
- /// This function breaks a value in internal SPSS date format into a day number (since October
- /// 14, 1582) plus the hour, minute, and second values. Note that the seconds value is
- /// stored in a double since it may have a fractional part.
- /// </remarks>
- public delegate ReturnCode spssConvertSPSSTimeDelegate(out int day, out int hourh, out int minute, out double second, double spssDate);
- public static spssConvertSPSSTimeDelegate spssConvertSPSSTimeImpl;
-
- /// <summary>
- /// Converts a time of day to the SPSS time format.
- /// </summary>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>, or
- /// <see cref="ReturnCode.SPSS_INVALID_TIME"/>.
- /// </returns>
- /// <remarks>
- /// This function converts a time given as day, hours, minutes, and seconds to the internal
- /// SPSS format. The day value is the number of days since October 14, 1582, and is typically
- /// zero, especially when this function is used in conjunction with spssConvertDate.
- /// Note that the seconds value is stored in a double since it may have a fractional part.
- /// </remarks>
- public delegate ReturnCode spssConvertTimeDelegate(int day, int hour, int minute, double second, out double spssTime);
- public static spssConvertTimeDelegate spssConvertTimeImpl;
-
- /// <summary>
- /// Copies stored documents from one file to another.
- /// </summary>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
- /// <see cref="ReturnCode.SPSS_OPEN_RDMODE"/>, or
- /// <see cref="ReturnCode.SPSS_DICT_COMMIT"/>.
- /// </returns>
- /// <remarks>
- /// This function copies stored documents, if any, from the file associated with fromHandle
- /// to that associated with toHandle. The latter must be open for output. If the target file already
- /// has documents, they are discarded. If the source file has no documents, the target
- /// will be set to have none, too.
- /// </remarks>
- public delegate ReturnCode spssCopyDocumentsDelegate(int fromHandle, int toHandle);
- public static spssCopyDocumentsDelegate spssCopyDocumentsImpl;
-
- /// <summary>
- /// Frees memory allocated by <see cref="spssGetDateVariablesDelegate"/>.
- /// </summary>
- /// <param name="dateInfo">
- /// Vector of date variable indexes.
- /// </param>
- /// <returns>
- /// Always returns <see cref="ReturnCode.SPSS_OK"/> indicating success.
- /// </returns>
- /// <remarks>
- /// This function is called to return the memory allocated by <see cref="spssGetDateVariablesDelegate"/>.
- /// </remarks>
- [CLSCompliant(false)]
- unsafe protected delegate ReturnCode spssFreeDateVariablesDelegate(int* dateInfo);
- [CLSCompliant(false)]
- protected static spssFreeDateVariablesDelegate spssFreeDateVariablesImpl;
-
- /// <summary>
- /// Frees memory allocated by <see cref="spssGetMultRespDefsDelegate"/>.
- /// </summary>
- /// <param name="mrespDefs">
- /// ASCII string containing the definitions.
- /// </param>
- /// <returns>
- /// The function always succeeds and always returns <see cref="ReturnCode.SPSS_OK"/>.
- /// </returns>
- /// <remarks>
- /// This function releases the memory which was acquired by <see cref="spssGetMultRespDefsDelegate"/>.
- /// </remarks>
- [CLSCompliant(false)]
- unsafe protected delegate ReturnCode spssFreeMultRespDefsDelegate(char* mrespDefs);
- [CLSCompliant(false)]
- protected static spssFreeMultRespDefsDelegate spssFreeMultRespDefsImpl;
-
- /// <summary>
- /// Frees memory allocated by <see cref="spssGetVarCValueLabelsDelegate"/>.
- /// </summary>
- /// <param name="values">
- /// Array of pointers to values returned by <see cref="spssGetVarCValueLabelsDelegate"/>
- /// </param>
- /// <param name="labels">
- /// Array of pointers to labels returned by <see cref="spssGetVarCValueLabelsDelegate"/>
- /// </param>
- /// <param name="numLabels">
- /// Number of values or labels returned by <see cref="spssGetVarCValueLabelsDelegate"/>
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/> or
- /// <see cref="ReturnCode.SPSS_CANNOT_FREE"/>
- /// </returns>
- /// <remarks>
- /// This function frees the two arrays and the value and label strings allocated on the heap
- /// by <see cref="spssGetVarCValueLabelsDelegate"/>.
- /// </remarks>
- [CLSCompliant(false)]
- unsafe protected delegate ReturnCode spssFreeVarCValueLabelsDelegate(char** values, char** labels, int numLabels);
- [CLSCompliant(false)]
- protected static spssFreeVarCValueLabelsDelegate spssFreeVarCValueLabelsImpl;
-
- /// <summary>
- /// Frees memory allocated by <see cref="spssGetVariableSetsDelegate"/>.
- /// </summary>
- /// <param name="varSets">
- /// The string defining the variable sets
- /// </param>
- /// <returns>
- /// Always returns <see cref="ReturnCode.SPSS_OK"/> indicating success.
- /// </returns>
- /// <remarks>
- /// This function is called to return the memory allocated by <see cref="spssGetVariableSetsDelegate"/>.
- /// </remarks>
- [CLSCompliant(false)]
- unsafe protected delegate ReturnCode spssFreeVariableSetsDelegate(char* varSets);
- [CLSCompliant(false)]
- protected static spssFreeVariableSetsDelegate spssFreeVariableSetsImpl;
-
- /// <summary>
- /// Frees memory allocated by <see cref="spssGetVarNamesDelegate"/>.
- /// </summary>
- /// <param name="varNames">
- /// Array of pointers to names returned by <see cref="spssGetVarNamesDelegate"/>
- /// </param>
- /// <param name="varTypes">
- /// Array of variable types returned by <see cref="spssGetVarNamesDelegate"/>
- /// </param>
- /// <param name="numVars">
- /// Number of variables returned by <see cref="spssGetVarNamesDelegate"/>
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/> or
- /// <see cref="ReturnCode.SPSS_CANNOT_FREE"/>.
- /// </returns>
- /// <remarks>
- /// This function frees the two arrays and the name strings allocated on the heap by
- /// <see cref="spssGetVarNamesDelegate"/>.
- /// </remarks>
- [CLSCompliant(false)]
- unsafe protected delegate ReturnCode spssFreeVarNamesDelegate(char** varNames, int* varTypes, int numVars);
- [CLSCompliant(false)]
- protected static spssFreeVarNamesDelegate spssFreeVarNamesImpl;
-
- /// <summary>
- /// Frees memory allocated by <see cref="spssGetVarNValueLabelsDelegate"/>.
- /// </summary>
- /// <param name="values">
- /// Array of values returned by <see cref="spssGetVarNValueLabelsDelegate"/>
- /// </param>
- /// <param name="labels">
- /// Array of pointers to labels returned by <see cref="spssGetVarNValueLabelsDelegate"/>
- /// </param>
- /// <param name="numLabels">
- /// Number of values or labels returned by <see cref="spssGetVarNValueLabelsDelegate"/>
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/> or
- /// <see cref="ReturnCode.SPSS_CANNOT_FREE"/>
- /// </returns>
- /// <remarks>
- /// This function frees the two arrays and the value and label strings allocated on the heap
- /// by <see cref="spssGetVarCValueLabelsDelegate"/>.
- /// </remarks>
- [CLSCompliant(false)]
- unsafe protected delegate ReturnCode spssFreeVarNValueLabelsDelegate(double* values, char** labels, int numLabels);
- [CLSCompliant(false)]
- protected static spssFreeVarNValueLabelsDelegate spssFreeVarNValueLabels;
-
- /// <summary>
- /// Reports the number of bytes taken up by any one case.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="caseSize">
- /// Pointer to size of case in bytes
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
- /// <see cref="ReturnCode.SPSS_DICT_NOTCOMMIT"/>.
- /// </returns>
- /// <remarks>
- /// This function reports the size of a raw case record for the file associated with handle.
- /// The case size is reported in bytes and is meant to be used in conjunction with the lowlevel
- /// case input/output procedures <see cref="spssWholeCaseInDelegate"/> and
- /// <see cref="spssWholeCaseOutDelegate"/>.
- /// </remarks>
- public delegate ReturnCode spssGetCaseSizeDelegate(int handle, out int caseSize);
- public static spssGetCaseSizeDelegate spssGetCaseSizeImpl;
-
- /// <summary>
- /// Reports the name of the case weight variable.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="varName">
- /// Pointer to the buffer to hold name of the case weight variable
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_NO_CASEWGT"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
- /// <see cref="ReturnCode.SPSS_INVALID_CASEWGT"/>.
- /// </returns>
- /// <remarks>
- /// This function reports the name of the case weight variable. The name is copied to the
- /// buffer pointed to by varName as a null-terminated string. Since a variable name can be
- /// up to <see cref="SPSS_MAX_VARNAME"/> characters in length, the size of the buffer
- /// must be at least <see cref="SPSS_MAX_VARNAME"/>+1.
- /// </remarks>
- protected delegate ReturnCode spssGetCaseWeightVarDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string varName);
- protected static spssGetCaseWeightVarDelegate spssGetCaseWeightVarImpl;
-
- /// <summary>
- /// Gets the compression attribute of a data file.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="compSwitch">
- /// Pointer to compression attribute. Upon return, *compSwitch is 1 if
- /// the file is compressed; 0 otherwise.
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/> or
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>.
- /// </returns>
- /// <remarks>
- /// This function reports the compression attribute of an SPSS data file.
- /// </remarks>
- public delegate ReturnCode spssGetCompressionDelegate(int handle, out int compSwitch);
- public static spssGetCompressionDelegate spssGetCompressionImpl;
-
- /// <summary>
- /// Reports TRENDS date variable information.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="numofElements">
- /// Number of elements in allocated array
- /// </param>
- /// <param name="dateInfo">
- /// Pointer to first element of the allocated array
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_NO_DATEINFO"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
- /// <see cref="ReturnCode.SPSS_NO_MEMORY"/>.
- /// </returns>
- /// <remarks>
- /// This function reports the TRENDS date variable information, if any, in an SPSS data file.
- /// It places the information in a dynamically allocated long array, sets *numofElements to
- /// the number of elements in the array, and sets *dateInfo to point to the array. The caller is
- /// expected to free the array by calling <see cref="spssFreeDateVariablesDelegate"/> when it is no longer needed.
- /// The variable information is copied directly from record 7, subtype 3. Its first six elements
- /// comprise the "fixed" information, followed by a sequence of one or more three-element
- /// groups.
- /// </remarks>
- [CLSCompliant(false)]
- unsafe protected delegate ReturnCode spssGetDateVariablesDelegate(int handle, out int numofElements, out int* dateInfo);
- [CLSCompliant(false)]
- protected static spssGetDateVariablesDelegate spssGetDateVariablesImpl;
-
- /// <summary>
- /// Retrieves the first block of SPSS Data Entry information from a data file.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="data">
- /// Returned as data from the file
- /// </param>
- /// <param name="maxData">
- /// Maximum bytes to return
- /// </param>
- /// <param name="nData">
- /// Returned as number of bytes returned
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_NO_DEW"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
- /// <see cref="ReturnCode.SPSS_FILE_BADTEMP"/>.
- /// </returns>
- /// <remarks>
- /// The client can retrieve DEW information (file information that is private to the SPSS
- /// Data Entry product) from a file in whatever increments are convenient. The first such
- /// increment is retrieved by calling spssGetDEWFirst, and subsequent segments are
- /// retrieved by calling spssGetDEWNext as many times as necessary. As with
- /// spssGetDEWInfo, spssGetDEWFirst will return SPSS_NO_DEW if the file was written
- /// with a byte order that is the reverse of that of the host.
- /// </remarks>
- protected delegate ReturnCode spssGetDEWFirstDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string data, int maxData, out int nData);
- protected static spssGetDEWFirstDelegate spssGetDEWFirstImpl;
-
- /// <summary>
- /// Gets the Data Entry GUID from a data file.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="asciiGUID">
- /// Returned as the file's GUID in character form or a null string if the
- /// file contains no GUID
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/> or
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>.
- /// </returns>
- /// <remarks>
- /// Data Entry for Windows maintains a GUID in character form as a uniqueness indicator.
- /// Two files have identical dictionaries and DEW information if they have the same
- /// GUID. Note that the spssOpenWriteCopy function will not copy the source file’s
- /// GUID. spssGetDEWGUID allows the client to read a file’s GUID, if any. The client
- /// supplies a 257 byte string in which the null-terminated GUID is returned.
- /// </remarks>
- protected delegate ReturnCode spssGetDEWGUIDDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string asciiGUID);
- protected static spssGetDEWGUIDDelegate spssGetDEWGUIDImpl;
-
- /// <summary>
- /// Gets the length and hash of the Data Entry information in a data file.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="Length">
- /// Returned as the length in bytes
- /// </param>
- /// <param name="HashTotal">
- /// Returned as the hash total
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
- /// <see cref="ReturnCode.SPSS_NO_DEW"/>.
- /// </returns>
- /// <remarks>
- /// This function can be called before actually retrieving DEW information (file
- /// information that is private to the SPSS Data Entry product) from a file, to obtain some
- /// attributes of that information--specifically its length in bytes and its hash total. The
- /// hash total is, by convention, contained in the last four bytes to be written. Because it is
- /// not cognizant of the structure of the DEW information, the I/O DLL is unable to correct
- /// the byte order of numeric information generated on a foreign host. As a result, the
- /// DEW information is discarded if the file has a byte order that is the reverse of that of
- /// the host, and calls to spssGetDEWInfo will return SPSS_NO_DEW.
- /// </remarks>
- public delegate ReturnCode spssGetDEWInfoDelegate(int handle, out int Length, out int HashTotal);
- public static spssGetDEWInfoDelegate spssGetDEWInfoImpl;
-
- /// <summary>
- /// Retrieves the next block of SPSS Data Entry information from a data file.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="data">
- /// Returned as data from the file
- /// </param>
- /// <param name="maxData">
- /// Maximum bytes to return
- /// </param>
- /// <param name="nData">
- /// Returned as number of bytes returned
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_DEW_NOFIRST"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
- /// <see cref="ReturnCode.SPSS_FILE_BADTEMP"/>.
- /// </returns>
- /// <remarks>
- /// The client can retrieve DEW information (file information that is private to the SPSS
- /// Data Entry product) from a file in whatever increments are convenient. The first such
- /// increment is retrieved by calling <see cref="spssGetDEWFirstDelegate"/>, and subsequent segments are
- /// retrieved by calling spssGetDEWNext as many times as necessary. As with
- /// <see cref="spssGetDEWInfoDelegate"/>, <see cref="spssGetDEWFirstDelegate"/> will return SPSS_NO_DEW if the file was written
- /// with a byte order that is the reverse of that of the host.
- /// </remarks>
- protected delegate ReturnCode spssGetDEWNextDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string data, int maxData, out int nData);
- protected static spssGetDEWNextDelegate spssGetDEWNextImpl;
-
- /// <summary>
- /// Estimates number of cases in a data file.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="caseCount">
- /// Returned as estimated n of cases
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
- /// <see cref="ReturnCode.SPSS_OPEN_WRMODE"/>, or
- /// <see cref="ReturnCode.SPSS_FILE_RERROR"/>.
- /// </returns>
- /// <remarks>
- /// Although not strictly required for direct access input, this function helps in reading
- /// SPSS data files from releases earlier than 6.0. Some of these data files did not contain
- /// number of cases information, and <see cref="spssGetNumberofCasesDelegate"/> will return -1 cases. This
- /// function will return a precise number for uncompressed files and an estimate (based on
- /// overall file size) for compressed files. It cannot be used on files open for appending data.
- /// </remarks>
- public delegate ReturnCode spssGetEstimatedNofCasesDelegate(int handle, out int caseCount);
- public static spssGetEstimatedNofCasesDelegate spssGetEstimatedNofCasesImpl;
-
- /// <summary>
- /// Gets the number of cases in a data file.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="caseCount">
- /// Pointer to number of cases
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
- /// <see cref="ReturnCode.SPSS_OPEN_WRMODE"/>.
- /// </returns>
- /// <remarks>
- /// This function reports the number of cases present in a data file open for reading.
- /// </remarks>
- public delegate ReturnCode spssGetNumberofCasesDelegate(int handle, out int caseCount);
- public static spssGetNumberofCasesDelegate spssGetNumberofCasesImpl;
-
- /// <summary>
- /// Gets the file label of a data file.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="id">
- /// File label buffer
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/> or
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>.
- /// </returns>
- /// <remarks>
- /// This function copies the file label of the SPSS data file associated with <paramref>handle</paramref> into the
- /// buffer pointed to by id. The label is at most 64 characters long and null-terminated.
- /// Thus, the size of the buffer should be at least 65. If an input data file is associated with
- /// the handle, the label will be exactly 64 characters long, padded with blanks as
- /// necessary.
- /// </remarks>
- protected delegate ReturnCode spssGetIdStringDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string id);
- protected static spssGetIdStringDelegate spssGetIdStringImpl;
-
- /// <summary>
- /// Retrieves the definitions from a data file.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="mrespDefs">
- /// Returned as a pointer to a string
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_NO_MULTRESP"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
- /// <see cref="ReturnCode.SPSS_NO_MEMORY"/>.
- /// </returns>
- /// <remarks>
- /// This function retrieves the definitions from an SPSS data file. The definitions are stored
- /// as a null-terminated ASCII string which is very similar to that containing the variable
- /// set definitions. The memory allocated by this function to contain the string must be freed
- /// by calling <see cref="spssFreeMultRespDefsDelegate"/>. If the file contains no multiple response definitions,
- /// *mrespDefs is set to NULL, and the function returns the warning code
- /// <see cref="ReturnCode.SPSS_NO_MULTRESP"/>.
- /// </remarks>
- [CLSCompliant(false)]
- unsafe protected delegate ReturnCode spssGetMultRespDefsDelegate(int handle, out char* mrespDefs);
- [CLSCompliant(false)]
- protected static spssGetMultRespDefsDelegate spssGetMultRespDefsImpl;
-
- /// <summary>
- /// Gets the number of variables in a data file.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="numVars">
- /// Pointer to number of variables
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
- /// <see cref="ReturnCode.SPSS_DICT_NOTCOMMIT"/>, or
- /// <see cref="ReturnCode.SPSS_INVALID_FILE"/>.
- /// </returns>
- /// <remarks>
- /// This function reports the number of variables present in a data file.
- /// </remarks>
- public delegate ReturnCode spssGetNumberofVariablesDelegate(int handle, out int numVars);
- public static spssGetNumberofVariablesDelegate spssGetNumberofVariables;
-
- /// <summary>
- /// Gets information on the running version of SPSS, and the hosting computer.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file.
- /// </param>
- /// <param name="relInfo">
- /// Array of int in which release- and machine-specific data will be
- /// stored. This array must have at least eight elements.
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/>,
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
- /// <see cref="ReturnCode.SPSS_NO_TYPE73"/>.
- /// </returns>
- /// <remarks>
- /// This function reports release- and machine-specific information about the file
- /// associated with handle. The information consists of an array of eight int values copied
- /// from record type 7, subtype 3 of the file, and is useful primarily for debugging. The
- /// array elements are, in order, release number (index 0), release subnumber (1), special
- /// release identifier number (2), machine code (3), floating-point representation code (4),
- /// compression scheme code (5), big/little-endian code (6), and character representation
- /// code (7).
- /// </remarks>
- protected delegate ReturnCode spssGetReleaseInfoDelegate(int handle, [MarshalAs(UnmanagedType.LPArray, SizeConst = 8)] int[] relInfo);
- protected static spssGetReleaseInfoDelegate spssGetReleaseInfoImpl;
-
- /// <summary>
- /// Gets the name of the system that created a data file.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="sysName">
- /// The originating system name
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/> or
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>.
- /// </returns>
- /// <remarks>
- /// This function returns the name of the system under which the file was created. It is a
- /// 40-byte blank-padded character field corresponding to the last 40 bytes of record type
- /// 1. Thus, in order to accommodate the information, the parameter
- /// <paramref>sysName</paramref> must be at least 41 bytes in length plus the
- /// terminating null character.
- /// </remarks>
- protected delegate ReturnCode spssGetSystemStringDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string sysName);
- protected static spssGetSystemStringDelegate spssGetSystemStringImpl;
-
- /// <summary>
- /// Gets the data created by TextSmart.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="textInfo">
- /// Buffer for text data
- /// </param>
- /// <returns>
- /// <see cref="ReturnCode.SPSS_OK"/> or
- /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>.
- /// </returns>
- /// <remarks>
- /// This function places the text data created by TextSmart as a null-terminated string in
- /// the user-supplied buffer <paramref>textInfo</paramref>. The buffer is assumed to be
- /// at least 256 characters long; the text data may be up to 255 characters long.
- /// If text data are not present in the file, the first character in
- /// <paramref>textInfo</paramref> is set to NULL.
- /// </remarks>
- protected delegate ReturnCode spssGetTextInfoDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string textInfo);
- protected static spssGetTextInfoDelegate spssGetTextInfoImpl;
-
- /// <summary>
- /// Gets the creation date of a data file, as recorded in the file itself.
- /// </summary>
- /// <param name="handle">
- /// Handle to the data file
- /// </param>
- /// <param name="fileDate">
- /// File creation dat…
Large files files are truncated, but you can click here to view the full file