PageRenderTime 70ms CodeModel.GetById 27ms app.highlight 27ms RepoModel.GetById 1ms app.codeStats 1ms

/Spss/SpssThinWrapper.cs

#
C# | 3465 lines | 543 code | 214 blank | 2708 comment | 7 complexity | 74346f8ced511f804400947569d80be8 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1using System;
   2using System.Runtime.InteropServices;
   3using System.IO;
   4using System.Diagnostics;
   5using System.Runtime.CompilerServices;
   6
   7namespace Spss
   8{
   9	#region Enumerables
  10	/// <summary>
  11	/// Error/warning codes that calls to SPSS methods can return.
  12	/// </summary>
  13	public enum ReturnCode : int
  14	{
  15		/// <summary>
  16		/// No error
  17		/// </summary>
  18		SPSS_OK = 0,
  19
  20		#region Error codes that calls to SPSS methods can return.
  21		/// <summary>
  22		/// Error opening file
  23		/// </summary>
  24		SPSS_FILE_OERROR = 1,
  25		/// <summary>
  26		/// File write error
  27		/// </summary>
  28		SPSS_FILE_WERROR = 2,
  29		/// <summary>
  30		/// Error reading the file
  31		/// </summary>
  32		SPSS_FILE_RERROR = 3,
  33		/// <summary>
  34		/// File table full (too many open SPSS data files)
  35		/// </summary>
  36		SPSS_FITAB_FULL = 4,
  37		/// <summary>
  38		/// The file handle is not valid
  39		/// </summary>
  40		SPSS_INVALID_HANDLE = 5,
  41		/// <summary>
  42		/// Data file contains no variables
  43		/// </summary>
  44		SPSS_INVALID_FILE = 6,
  45		/// <summary>
  46		/// Insufficient memory
  47		/// </summary>
  48		SPSS_NO_MEMORY = 7,
  49
  50		/// <summary>
  51		/// File is open for reading, not writing
  52		/// </summary>
  53		SPSS_OPEN_RDMODE = 8,
  54		/// <summary>
  55		/// The file is open for writing, not reading
  56		/// </summary>
  57		SPSS_OPEN_WRMODE = 9,
  58
  59		/// <summary>
  60		/// The variable name is not valid
  61		/// </summary>
  62		SPSS_INVALID_VARNAME = 10,
  63		/// <summary>
  64		/// No variables defined in the dictionary
  65		/// </summary>
  66		SPSS_DICT_EMPTY = 11,
  67		/// <summary>
  68		/// A variable with the given name does not exist
  69		/// </summary>
  70		SPSS_VAR_NOTFOUND = 12,
  71		/// <summary>
  72		/// There is already a variable with the same name
  73		/// </summary>
  74		SPSS_DUP_VAR = 13,
  75		/// <summary>
  76		/// The variable is not numeric
  77		/// OR
  78		/// At least one variable in the list is not numeric
  79		/// OR
  80		/// The specified variable has string values
  81		/// </summary>
  82		SPSS_NUME_EXP = 14,
  83		/// <summary>
  84		/// The variable is numeric
  85		/// </summary>
  86		SPSS_STR_EXP = 15,
  87		/// <summary>
  88		/// The variable is a long string (length > 8)
  89		/// </summary>
  90		SPSS_SHORTSTR_EXP = 16,
  91		/// <summary>
  92		/// Invalid length code (varLength is negative or
  93		/// exceeds 255)
  94		/// </summary>
  95		SPSS_INVALID_VARTYPE = 17,
  96
  97		/// <summary>
  98		/// Invalid missing values specification ( missingFormat
  99		/// is invalid or the lower limit of range is greater than the
 100		/// upper limit)
 101		/// </summary>
 102		SPSS_INVALID_MISSFOR = 18,
 103		/// <summary>
 104		/// Invalid compression switch (other than 0 or 1)
 105		/// </summary>
 106		SPSS_INVALID_COMPSW = 19,
 107		/// <summary>
 108		/// The print format specification is invalid or is
 109		/// incompatible with the variable type
 110		/// </summary>
 111		SPSS_INVALID_PRFOR = 20,
 112		/// <summary>
 113		/// The write format specification is invalid or is
 114		/// incompatible with the variable type
 115		/// </summary>
 116		SPSS_INVALID_WRFOR = 21,
 117		/// <summary>
 118		/// Invalid date 
 119		/// OR
 120		/// The date value (spssDate) is negative
 121		/// </summary>
 122		SPSS_INVALID_DATE = 22,
 123		/// <summary>
 124		/// Invalid time
 125		/// </summary>
 126		SPSS_INVALID_TIME = 23,
 127
 128		/// <summary>
 129		/// Fewer than two variables in list 
 130		/// OR
 131		/// Number of variables ( numVars) is zero or negative
 132		/// </summary>
 133		SPSS_NO_VARIABLES = 24,
 134		/// <summary>
 135		/// The list of values contains duplicates
 136		/// </summary>
 137		SPSS_DUP_VALUE = 27,
 138
 139		/// <summary>
 140		/// The given case weight variable is invalid. This error
 141		/// signals an internal problem in the implementation
 142		/// of the DLL and should never occur.
 143		/// </summary>
 144		SPSS_INVALID_CASEWGT = 28,
 145		/// <summary>
 146		/// Dictionary has already been written with
 147		/// spssCommitHeader
 148		/// </summary>
 149		SPSS_DICT_COMMIT = 30,
 150		/// <summary>
 151		/// Dictionary of the output file has not yet been written
 152		/// with <see cref="SpssThinWrapper.spssCommitHeaderDelegate"/>.
 153		/// </summary>
 154		SPSS_DICT_NOTCOMMIT = 31,
 155
 156		/// <summary>
 157		/// File is not a valid SPSS data file (no type 2 record)
 158		/// </summary>
 159		SPSS_NO_TYPE2 = 33,
 160		/// <summary>
 161		/// There is no type7, subtype3 record present. This
 162		/// code should be regarded as a warning even though
 163		/// it is positive. Files without this record are valid.
 164		/// </summary>
 165		SPSS_NO_TYPE73 = 41,
 166		/// <summary>
 167		/// The date variable information is invalid
 168		/// </summary>
 169		SPSS_INVALID_DATEINFO = 45,
 170		/// <summary>
 171		/// File is not a valid SPSS data file (missing type 999
 172		/// record)
 173		/// </summary>
 174		SPSS_NO_TYPE999 = 46,
 175		/// <summary>
 176		/// The value is longer than the length of the variable
 177		/// </summary>
 178		SPSS_EXC_STRVALUE = 47,
 179		/// <summary>
 180		/// Unable to free because arguments are illegal or
 181		/// inconsistent (for example, negative numLabels)
 182		/// </summary>
 183		SPSS_CANNOT_FREE = 48,
 184		/// <summary>
 185		/// Buffer value is too short to hold the value
 186		/// </summary>
 187		SPSS_BUFFER_SHORT = 49,
 188		/// <summary>
 189		/// Current case is not valid. This may be because no
 190		/// spssReadCaseRecord calls have been made yet or
 191		/// because the most recent call failed with error or encountered
 192		/// the end of file.
 193		/// </summary>
 194		SPSS_INVALID_CASE = 50,
 195		/// <summary>
 196		/// Internal data structures of the DLL are invalid. This
 197		/// signals an error in the DLL.
 198		/// </summary>
 199		SPSS_INTERNAL_VLABS = 51,
 200		/// <summary>
 201		/// File created on an incompatible system.
 202		/// </summary>
 203		SPSS_INCOMPAT_APPEND = 52,
 204		/// <summary>
 205		/// Undocumented by SPSS.
 206		/// </summary>
 207		SPSS_INTERNAL_D_A = 53,
 208		/// <summary>
 209		/// Error accessing the temporary file
 210		/// </summary>
 211		SPSS_FILE_BADTEMP = 54,
 212		/// <summary>
 213		/// spssGetDEWFirst was never called
 214		/// </summary>
 215		SPSS_DEW_NOFIRST = 55,
 216		/// <summary>
 217		/// measureLevel is not in the legal range, or is
 218		/// SPSS_MLVL_RAT and the variable is a string variable.
 219		/// </summary>
 220		SPSS_INVALID_MEASURELEVEL = 56,
 221		/// <summary>
 222		/// Parameter subtype not between 1 and
 223		/// MAX7SUBTYPE
 224		/// </summary>
 225		SPSS_INVALID_7SUBTYPE = 57,
 226
 227		/// <summary>
 228		/// Existing multiple response set definitions are invalid
 229		/// </summary>
 230		SPSS_INVALID_MRSETDEF = 70,
 231		/// <summary>
 232		/// The multiple response set name is invalid
 233		/// </summary>
 234		SPSS_INVALID_MRSETNAME = 71,
 235		/// <summary>
 236		/// The multiple response set name is a duplicate
 237		/// </summary>
 238		SPSS_DUP_MRSETNAME = 72,
 239		/// <summary>
 240		/// Undocumented by SPSS.
 241		/// </summary>
 242		SPSS_BAD_EXTENSION = 73,
 243		#endregion
 244
 245		#region Warning codes returned by functions
 246
 247		/// <summary>
 248		/// Label length exceeds 64, truncated and used (warning)
 249		/// </summary>
 250		SPSS_EXC_LEN64 = -1,
 251
 252		/// <summary>
 253		/// Variable label’s length exceeds 120, truncated and
 254		/// used (warning)
 255		/// </summary>
 256		SPSS_EXC_LEN120 = -2,
 257
 258		/// <summary>
 259		/// ... (warning)
 260		/// </summary>
 261		SPSS_EXC_VARLABEL = -2,
 262
 263		/// <summary>
 264		/// Label length exceeds 60, truncated and used (warning)
 265		/// </summary>
 266		SPSS_EXC_LEN60 = -4,
 267
 268		/// <summary>
 269		/// ... (warning)
 270		/// </summary>
 271		SPSS_EXC_VALLABEL = -4,
 272
 273		/// <summary>
 274		/// End of the file reached, no more cases (warning)
 275		/// </summary>
 276		SPSS_FILE_END = -5,
 277
 278		/// <summary>
 279		/// There is no variable sets information in the file (warning)
 280		/// </summary>
 281		SPSS_NO_VARSETS = -6,
 282
 283		/// <summary>
 284		/// The variable sets information is empty (warning)
 285		/// </summary>
 286		SPSS_EMPTY_VARSETS = -7,
 287
 288		/// <summary>
 289		/// The variable has no labels (warning) (warning)
 290		/// </summary>
 291		SPSS_NO_LABELS = -8,
 292
 293		/// <summary>
 294		/// There is no label for the given value (warning)
 295		/// </summary>
 296		SPSS_NO_LABEL = -9,
 297
 298		/// <summary>
 299		/// A case weight variable has not been defined for this file (warning)
 300		/// </summary>
 301		SPSS_NO_CASEWGT = -10,
 302
 303		/// <summary>
 304		/// There is no TRENDS date variable information in the file (warning)
 305		/// </summary>
 306		SPSS_NO_DATEINFO = -11,
 307
 308		/// <summary>
 309		/// No definitions on the file (warning)
 310		/// </summary>
 311		SPSS_NO_MULTRESP = -12,
 312
 313		/// <summary>
 314		/// The string contains no definitions (warning)
 315		/// </summary>
 316		SPSS_EMPTY_MULTRESP = -13,
 317
 318		/// <summary>
 319		/// File contains no DEW information (warning)
 320		/// </summary>
 321		SPSS_NO_DEW = -14,
 322
 323		/// <summary>
 324		/// Zero bytes to be written (warning)
 325		/// </summary>
 326		SPSS_EMPTY_DEW = -15,
 327		#endregion
 328	}
 329
 330	/// <summary>
 331	/// Missing Value Type codes
 332	/// </summary>
 333	public enum MissingValueFormatCode : int
 334	{
 335		/// <summary>
 336		/// Indicates that no discrete missing values will be defined.
 337		/// </summary>
 338		SPSS_NO_MISSVAL = 0,
 339
 340		/// <summary>
 341		/// Indicates that 1 discrete missing values will be defined.
 342		/// </summary>
 343		SPSS_ONE_MISSVAL = 1,
 344
 345		/// <summary>
 346		/// Indicates that 2 discrete missing values will be defined.
 347		/// </summary>
 348		SPSS_TWO_MISSVAL = 2,
 349
 350		/// <summary>
 351		/// Indicates that 3 discrete missing values will be defined.
 352		/// </summary>
 353		SPSS_THREE_MISSVAL = 3,
 354
 355		/// <summary>
 356		/// missingVal1 and missingVal2 are taken as the upper and lower limits, 
 357		/// respectively, of the range, and missingVal3 is ignored
 358		/// </summary>
 359		SPSS_MISS_RANGE = -2,
 360
 361		/// <summary>
 362		/// missingval1 and missingVal2 are taken as limits of the range and missingVal3 is taken
 363		/// as the discrete missing value.
 364		/// </summary>
 365		SPSS_MISS_RANGEANDVAL = -3,
 366	}
 367
 368	/// <summary>
 369	/// Format Type codes
 370	/// </summary>
 371	public enum FormatTypeCode : int
 372	{
 373		/// <summary>
 374		/// Alphanumeric
 375		/// </summary>
 376		SPSS_FMT_A = 1,
 377
 378		/// <summary>
 379		/// Alphanumeric hexadecimal
 380		/// </summary>
 381		SPSS_FMT_AHEX = 2,
 382
 383		/// <summary>
 384		/// F Format with commas
 385		/// </summary>
 386		SPSS_FMT_COMMA = 3,
 387
 388		/// <summary>
 389		/// Commas and floating dollar sign
 390		/// </summary>
 391		SPSS_FMT_DOLLAR = 4,
 392
 393		/// <summary>
 394		/// Default Numeric Format
 395		/// </summary>
 396		SPSS_FMT_F = 5,
 397
 398		/// <summary>
 399		/// Int16 binary
 400		/// </summary>
 401		SPSS_FMT_IB = 6,
 402
 403		/// <summary>
 404		/// Positive Int16 binary - hex
 405		/// </summary>
 406		SPSS_FMT_PIBHEX = 7,
 407
 408		/// <summary>
 409		/// Packed decimal
 410		/// </summary>
 411		SPSS_FMT_P = 8,
 412
 413		/// <summary>
 414		/// Positive Int16 binary unsigned
 415		/// </summary>
 416		SPSS_FMT_PIB = 9,
 417
 418		/// <summary>
 419		/// Positive Int16 binary unsigned
 420		/// </summary>
 421		SPSS_FMT_PK = 10,
 422
 423		/// <summary>
 424		/// Floating poInt32 binary
 425		/// </summary>
 426		SPSS_FMT_RB = 11,
 427
 428		/// <summary>
 429		/// Floating poInt32 binary hex
 430		/// </summary>
 431		SPSS_FMT_RBHEX = 12,
 432
 433		/// <summary>
 434		/// Zoned decimal
 435		/// </summary>
 436		SPSS_FMT_Z = 15,
 437
 438		/// <summary>
 439		/// N Format- unsigned with leading 0s
 440		/// </summary>
 441		SPSS_FMT_N = 16,
 442
 443		/// <summary>
 444		/// E Format- with explicit power of 10
 445		/// </summary>
 446		SPSS_FMT_E = 17,
 447
 448		/// <summary>
 449		/// Date format dd-mmm-yyyy
 450		/// </summary>
 451		SPSS_FMT_DATE = 20,
 452
 453		/// <summary>
 454		/// Time format hh:mm:ss.s
 455		/// </summary>
 456		SPSS_FMT_TIME = 21,
 457
 458		/// <summary>
 459		/// Date and Time
 460		/// </summary>
 461		SPSS_FMT_DATE_TIME = 22,
 462
 463		/// <summary>
 464		/// Date format dd-mmm-yyyy
 465		/// </summary>
 466		SPSS_FMT_ADATE = 23,
 467
 468		/// <summary>
 469		/// Julian date - yyyyddd
 470		/// </summary>
 471		SPSS_FMT_JDATE = 24,
 472
 473		/// <summary>
 474		/// Date-time dd hh:mm:ss.s
 475		/// </summary>
 476		SPSS_FMT_DTIME = 25,
 477
 478		/// <summary>
 479		/// Day of the week
 480		/// </summary>
 481		SPSS_FMT_WKDAY = 26,
 482
 483		/// <summary>
 484		/// Month
 485		/// </summary>
 486		SPSS_FMT_MONTH = 27,
 487
 488		/// <summary>
 489		/// mmm yyyy
 490		/// </summary>
 491		SPSS_FMT_MOYR = 28,
 492
 493		/// <summary>
 494		/// q Q yyyy
 495		/// </summary>
 496		SPSS_FMT_QYR = 29,
 497
 498		/// <summary>
 499		/// ww WK yyyy
 500		/// </summary>
 501		SPSS_FMT_WKYR = 30,
 502
 503		/// <summary>
 504		/// Percent - F followed by %
 505		/// </summary>
 506		SPSS_FMT_PCT = 31,
 507
 508		/// <summary>
 509		/// Like COMMA, switching dot for comma
 510		/// </summary>
 511		SPSS_FMT_DOT = 32,
 512
 513		/// <summary>
 514		/// User Programmable currency format
 515		/// </summary>
 516		SPSS_FMT_CCA = 33,
 517
 518		/// <summary>
 519		/// User Programmable currency format
 520		/// </summary>
 521		SPSS_FMT_CCB = 34,
 522
 523		/// <summary>
 524		/// User Programmable currency format
 525		/// </summary>
 526		SPSS_FMT_CCC = 35,
 527
 528		/// <summary>
 529		/// User Programmable currency format
 530		/// </summary>
 531		SPSS_FMT_CCD = 36,
 532
 533		/// <summary>
 534		/// User Programmable currency format
 535		/// </summary>
 536		SPSS_FMT_CCE = 37,
 537
 538		/// <summary>
 539		/// Date in dd/mm/yyyy style
 540		/// </summary>
 541		SPSS_FMT_EDATE = 38,
 542
 543		/// <summary>
 544		/// Date in yyyy/mm/dd style
 545		/// </summary>
 546		SPSS_FMT_SDATE = 39,
 547	}
 548
 549	/// <summary>
 550	/// Measurement Level codes
 551	/// </summary>
 552	public enum MeasurementLevelCode : int
 553	{
 554		/// <summary>
 555		/// Unknown
 556		/// </summary>
 557		SPSS_MLVL_UNK = 0,
 558
 559		/// <summary>
 560		/// Nominal 
 561		/// </summary>
 562		SPSS_MLVL_NOM = 1,
 563
 564		/// <summary>
 565		/// Ordinal
 566		/// </summary>
 567		SPSS_MLVL_ORD = 2,
 568
 569		/// <summary>
 570		/// Scale (Ratio)
 571		/// </summary>
 572		SPSS_MLVL_RAT = 3,
 573	}
 574	/// <summary>
 575	/// Alignment codes
 576	/// </summary>
 577	public enum AlignmentCode : int
 578	{
 579		/// <summary>
 580		/// Left aligned
 581		/// </summary>
 582		SPSS_ALIGN_LEFT = 0,
 583
 584		/// <summary>
 585		/// Right aligned
 586		/// </summary>
 587		SPSS_ALIGN_RIGHT = 1,
 588
 589		/// <summary>
 590		/// Centered
 591		/// </summary>
 592		SPSS_ALIGN_CENTER = 2,
 593	}
 594	/// <summary>
 595	/// Diagnostics regarding var names
 596	/// </summary>
 597	public enum VarNameDiagnostic : int
 598	{
 599		/// <summary>
 600		/// Valid standard name
 601		/// </summary>
 602		SPSS_NAME_OK = 0,
 603
 604		/// <summary>
 605		/// Valid scratch var name
 606		/// </summary>
 607		SPSS_NAME_SCRATCH = 1,
 608
 609		/// <summary>
 610		/// Valid system var name
 611		/// </summary>
 612		SPSS_NAME_SYSTEM = 2,
 613
 614		/// <summary>
 615		/// Empty or longer than SPSS_MAX_VARNAME
 616		/// </summary>
 617		SPSS_NAME_BADLTH = 3,
 618
 619		/// <summary>
 620		/// Invalid character or imbedded blank
 621		/// </summary>
 622		SPSS_NAME_BADCHAR = 4,
 623
 624		/// <summary>
 625		/// Name is a reserved word
 626		/// </summary>
 627		SPSS_NAME_RESERVED = 5,
 628
 629		/// <summary>
 630		/// Invalid initial character
 631		/// </summary>
 632		SPSS_NAME_BADFIRST = 6,
 633	}
 634	/// <summary>
 635	/// Definitions of "type 7" records
 636	/// </summary>
 637	public enum Type7Record : int
 638	{
 639		/// <summary>
 640		/// Documents (actually type 6
 641		/// </summary>
 642		SPSS_T7_DOCUMENTS = 0,
 643
 644		/// <summary>
 645		/// VAX Data Entry - dictionary version
 646		/// </summary>
 647		SPSS_T7_VAXDE_DICT = 1,
 648
 649		/// <summary>
 650		/// VAX Data Entry - data
 651		/// </summary>
 652		SPSS_T7_VAXDE_DATA = 2,
 653
 654		/// <summary>
 655		/// Source system characteristics
 656		/// </summary>
 657		SPSS_T7_SOURCE = 3,
 658
 659		/// <summary>
 660		/// Source system floating pt constants
 661		/// </summary>
 662		SPSS_T7_HARDCONST = 4,
 663
 664		/// <summary>
 665		/// Variable sets
 666		/// </summary>
 667		SPSS_T7_VARSETS = 5,
 668
 669		/// <summary>
 670		/// Trends date information
 671		/// </summary>
 672		SPSS_T7_TRENDS = 6,
 673
 674		/// <summary>
 675		/// Multiple response groups
 676		/// </summary>
 677		SPSS_T7_MULTRESP = 7,
 678
 679		/// <summary>
 680		/// Windows Data Entry data
 681		/// </summary>
 682		SPSS_T7_DEW_DATA = 8,
 683
 684		/// <summary>
 685		/// TextSmart data
 686		/// </summary>
 687		SPSS_T7_TEXTSMART = 10,
 688
 689		/// <summary>
 690		/// Msmt level, col width, &amp; alignment
 691		/// </summary>
 692		SPSS_T7_MSMTLEVEL = 11,
 693
 694		/// <summary>
 695		/// Windows Data Entry GUID
 696		/// </summary>
 697		SPSS_T7_DEW_GUID = 12,
 698
 699		/// <summary>
 700		/// Extended variable names
 701		/// </summary>
 702		SPSS_T7_XVARNAMES = 13,
 703	}
 704
 705	#endregion
 706
 707	/// <summary>
 708	/// A very thin SpssSafeWrapper that provides access to all the functions 
 709	/// exposed from the SPSSIO*.dll library provided with SPSS 20.
 710	/// </summary>
 711	// <remarks>
 712	// <para>Each method in SPSSIO32/64.DLL is represented exactly once by this class.</para>
 713	// <para>Those methods that require the use of pointers for memory management 
 714	// reasons are marked <c>unsafe</c>, and have <c>protected</c> access for 
 715	// proper handling by a descending class.  
 716	// Those methods that require string marshaling are marked <c>protected</c>,
 717	// because they require special string buffers to be created and trimmed for
 718	// correct access.  
 719	// Both types of protected methods should be wrapped and appropriately 
 720	// handled by a <see cref="SpssSafeWrapper"/>descending class</see>.</para>
 721	// </remarks>
 722	public class SpssThinWrapper
 723	{
 724		//Locations of the 32 bit spss and support dll's relative to the applications directory.
 725		const String spssio32 = @"win32\spssio32.dll";
 726
 727		//Location of the 64 bit spss and support dll's relative to the applications directory.
 728		const String spssio64 = @"win64\spssio64.dll";
 729
 730		#region Maximum lengths of SPSS data file objects
 731
 732		/// <summary>
 733		/// Maximum length of a variable name
 734		/// </summary>
 735		public const int SPSS_MAX_VARNAME = 64;
 736
 737		/// <summary>
 738		/// Short (compatibility) variable name.
 739		/// </summary>
 740		public const int SPSS_MAX_SHORTVARNAME = 8;
 741
 742		/// <summary>
 743		/// Maximum length of a short string variable
 744		/// </summary>
 745		public const int SPSS_MAX_SHORTSTRING = 8;
 746
 747		/// <summary>
 748		/// Maximum length of a file label string
 749		/// </summary>
 750		public const int SPSS_MAX_IDSTRING = 64;
 751
 752		/// <summary>
 753		/// (old) Maximum length of a long string variable
 754		/// </summary>
 755		public const int SPSS_MAX_LONGSTRING = 255;
 756
 757		/// <summary>
 758		/// Maximum length of a long string variable.
 759		/// </summary>
 760		public const int SPSS_MAX_VERYLONGSTRING = 32 * 1024;
 761
 762		/// <summary>
 763		/// Maximum length of a value label
 764		/// </summary>
 765		public const int SPSS_MAX_VALLABEL = 60;
 766
 767		/// <summary>
 768		/// Maximum length of a variable label
 769		/// </summary>
 770		public const int SPSS_MAX_VARLABEL = 256;
 771
 772		/// <summary>
 773		/// Maximum record 7 subtype
 774		/// </summary>
 775		public const int SPSS_MAX_7SUBTYPE = 32;
 776		#endregion
 777
 778		/// <summary>
 779		/// Closes an SPSS file that was opened using <see cref="spssOpenAppendDelegate"/>.
 780		/// </summary>
 781		/// <param name="handle">
 782		/// Handle to the data file.
 783		/// </param>
 784		/// <returns>
 785		/// <see cref="ReturnCode.SPSS_OK"/>, 
 786		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
 787		/// <see cref="ReturnCode.SPSS_OPEN_RDMODE"/>, or
 788		/// <see cref="ReturnCode.SPSS_FILE_WERROR"/>.
 789		/// </returns>
 790		/// <remarks>
 791		/// This function closes the data file associated with handle, which must have been opened
 792		/// for appending cases using <see cref="spssOpenAppendDelegate"/>. The file handle handle becomes invalid
 793		/// and no further operations can be performed using it.
 794		/// </remarks>
 795		public delegate ReturnCode spssCloseAppendDelegate(int handle);
 796		public static spssCloseAppendDelegate spssCloseAppendImpl;
 797
 798		/// <summary>
 799		/// Closes an SPSS file that was opened using <see cref="spssOpenReadDelegate"/>.
 800		/// </summary>
 801		/// <param name="handle"></param>
 802		/// <returns>
 803		/// <see cref="ReturnCode.SPSS_OK"/>,
 804		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
 805		/// <see cref="ReturnCode.SPSS_OPEN_WRMODE"/>.
 806		/// </returns>
 807		/// <remarks>
 808		/// This function closes the data file associated with handle, which must have been opened
 809		/// for reading using <see cref="spssOpenReadDelegate"/>. The file handle handle becomes 
 810		/// invalid and no further operations can be performed using it.
 811		/// </remarks>
 812		public delegate ReturnCode spssCloseReadDelegate(int handle);
 813		public static spssCloseReadDelegate spssCloseReadImpl;
 814
 815		/// <summary>
 816		/// Closes an SPSS file that was opened using <see cref="spssOpenWriteDelegate"/>.
 817		/// </summary>
 818		/// <param name="handle"></param>
 819		/// <returns>
 820		/// <see cref="ReturnCode.SPSS_OK"/>,
 821		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
 822		/// <see cref="ReturnCode.SPSS_OPEN_RDMODE"/>,
 823		/// <see cref="ReturnCode.SPSS_DICT_NOTCOMMIT"/>, or
 824		/// <see cref="ReturnCode.SPSS_FILE_WERROR"/>.
 825		/// </returns>
 826		/// <remarks>
 827		/// This function closes the data file associated with handle, which must have been opened
 828		/// for writing using <see cref="spssOpenWriteDelegate"/>. The file handle handle becomes invalid
 829		/// and no further operations can be performed using it.
 830		/// </remarks>
 831		public delegate ReturnCode spssCloseWriteDelegate(int handle);
 832		public static spssCloseWriteDelegate spssCloseWriteImpl;
 833
 834		/// <summary>
 835		/// Writes a case to an SPSS data file after its values have been set.
 836		/// </summary>
 837		/// <param name="handle"></param>
 838		/// <returns>
 839		/// <see cref="ReturnCode.SPSS_OK"/>,
 840		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
 841		/// <see cref="ReturnCode.SPSS_OPEN_RDMODE"/>,
 842		/// <see cref="ReturnCode.SPSS_DICT_NOTCOMMIT"/>, or
 843		/// <see cref="ReturnCode.SPSS_FILE_WERROR"/>.
 844		/// </returns>
 845		/// <remarks>
 846		/// This function writes a case to the data file specified by the handle. It must be called after
 847		/// setting the values of variables through <see cref="spssSetValueNumericDelegate"/> and 
 848		/// <see cref="spssSetValueCharDelegate"/>.
 849		/// Any variables left unset will get the system-missing value if they are numeric and all
 850		/// blanks if they are strings. Unless spssCommitCaseRecord is called, the case will not be
 851		/// written out.
 852		/// </remarks>
 853		public delegate ReturnCode spssCommitCaseRecordDelegate(int handle);
 854		public static spssCommitCaseRecordDelegate spssCommitCaseRecordImpl;
 855
 856		/// <summary>
 857		/// Writes the data dictionary to the data file.  To be used after dictionary defining 
 858		/// functions are called, and before cases are written.
 859		/// </summary>
 860		/// <param name="handle"></param>
 861		/// <returns>
 862		/// <see cref="ReturnCode.SPSS_OK"/>,
 863		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
 864		/// <see cref="ReturnCode.SPSS_OPEN_RDMODE"/>,
 865		/// <see cref="ReturnCode.SPSS_DICT_COMMIT"/>,
 866		/// <see cref="ReturnCode.SPSS_DICT_EMPTY"/>,
 867		/// <see cref="ReturnCode.SPSS_FILE_WERROR"/>,
 868		/// <see cref="ReturnCode.SPSS_NO_MEMORY"/>, or
 869		/// <see cref="ReturnCode.SPSS_INTERNAL_VLABS"/>.
 870		/// </returns>
 871		/// <remarks>
 872		/// This function writes the data dictionary to the data file associated with handle. Before
 873		/// any case data can be written, the dictionary must be committed; once the dictionary has
 874		/// been committed, no further changes can be made to it.
 875		/// </remarks>
 876		public delegate ReturnCode spssCommitHeaderDelegate(int handle);
 877		public static spssCommitHeaderDelegate spssCommitHeaderImpl;
 878
 879		/// <summary>
 880		/// Converts a day/month/year into SPSS format.
 881		/// </summary>
 882		/// <returns>
 883		/// <see cref="ReturnCode.SPSS_OK"/>, or
 884		/// <see cref="ReturnCode.SPSS_INVALID_DATE"/>.
 885		/// </returns>
 886		/// <remarks>
 887		/// This function converts a Gregorian date expressed as day-month-year to the internal
 888		/// SPSS date format. The time portion of the date variable is set to 0:00. To set the time
 889		/// portion of the date variable to another value, use spssConvertTime and add the resulting
 890		/// value to *spssDate. Dates before October 15, 1582, are considered invalid.
 891		/// </remarks>
 892		public delegate ReturnCode spssConvertDateDelegate(int day, int month, int year, out double spssDate);
 893		public static spssConvertDateDelegate spssConvertDateImpl;
 894
 895		/// <summary>
 896		/// Extracts the date from an SPSS date field.
 897		/// </summary>
 898		/// <returns>
 899		/// <see cref="ReturnCode.SPSS_OK"/>, or
 900		/// <see cref="ReturnCode.SPSS_INVALID_DATE"/>.
 901		/// </returns>
 902		/// <remarks>
 903		/// This function converts the date (as distinct from time) portion of a value in internal SPSS
 904		/// date format to Gregorian style.
 905		/// </remarks>
 906		public delegate ReturnCode spssConvertSPSSDateDelegate(out int day, out int month, out int year, double spssDate);
 907		public static spssConvertSPSSDateDelegate spssConvertSPSSDateImpl;
 908
 909		/// <summary>
 910		/// Extracts the time of day from an SPSS date field.
 911		/// </summary>
 912		/// <returns>
 913		/// <see cref="ReturnCode.SPSS_OK"/>, or
 914		/// <see cref="ReturnCode.SPSS_INVALID_TIME"/>.
 915		/// </returns>
 916		/// <remarks>
 917		/// This function breaks a value in internal SPSS date format into a day number (since October
 918		/// 14, 1582) plus the hour, minute, and second values. Note that the seconds value is
 919		/// stored in a double since it may have a fractional part.
 920		/// </remarks>
 921		public delegate ReturnCode spssConvertSPSSTimeDelegate(out int day, out int hourh, out int minute, out double second, double spssDate);
 922		public static spssConvertSPSSTimeDelegate spssConvertSPSSTimeImpl;
 923
 924		/// <summary>
 925		/// Converts a time of day to the SPSS time format.
 926		/// </summary>
 927		/// <returns>
 928		/// <see cref="ReturnCode.SPSS_OK"/>, or
 929		/// <see cref="ReturnCode.SPSS_INVALID_TIME"/>.
 930		/// </returns>
 931		/// <remarks>
 932		/// This function converts a time given as day, hours, minutes, and seconds to the internal
 933		/// SPSS format. The day value is the number of days since October 14, 1582, and is typically
 934		/// zero, especially when this function is used in conjunction with spssConvertDate.
 935		/// Note that the seconds value is stored in a double since it may have a fractional part.
 936		/// </remarks>
 937		public delegate ReturnCode spssConvertTimeDelegate(int day, int hour, int minute, double second, out double spssTime);
 938		public static spssConvertTimeDelegate spssConvertTimeImpl;
 939
 940		/// <summary>
 941		/// Copies stored documents from one file to another.
 942		/// </summary>
 943		/// <returns>
 944		/// <see cref="ReturnCode.SPSS_OK"/>,
 945		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
 946		/// <see cref="ReturnCode.SPSS_OPEN_RDMODE"/>, or
 947		/// <see cref="ReturnCode.SPSS_DICT_COMMIT"/>.
 948		/// </returns>
 949		/// <remarks>
 950		/// This function copies stored documents, if any, from the file associated with fromHandle
 951		/// to that associated with toHandle. The latter must be open for output. If the target file already
 952		/// has documents, they are discarded. If the source file has no documents, the target
 953		/// will be set to have none, too.
 954		/// </remarks>
 955		public delegate ReturnCode spssCopyDocumentsDelegate(int fromHandle, int toHandle);
 956		public static spssCopyDocumentsDelegate spssCopyDocumentsImpl;
 957
 958		/// <summary>
 959		/// Frees memory allocated by <see cref="spssGetDateVariablesDelegate"/>.
 960		/// </summary>
 961		/// <param name="dateInfo">
 962		/// Vector of date variable indexes.
 963		/// </param>
 964		/// <returns>
 965		/// Always returns <see cref="ReturnCode.SPSS_OK"/> indicating success.
 966		/// </returns>
 967		/// <remarks>
 968		/// This function is called to return the memory allocated by <see cref="spssGetDateVariablesDelegate"/>.
 969		/// </remarks>
 970		[CLSCompliant(false)]
 971		unsafe protected delegate ReturnCode spssFreeDateVariablesDelegate(int* dateInfo);
 972		[CLSCompliant(false)]
 973		protected static spssFreeDateVariablesDelegate spssFreeDateVariablesImpl;
 974
 975		/// <summary>
 976		/// Frees memory allocated by <see cref="spssGetMultRespDefsDelegate"/>.
 977		/// </summary>
 978		/// <param name="mrespDefs">
 979		/// ASCII string containing the definitions.
 980		/// </param>
 981		/// <returns>
 982		/// The function always succeeds and always returns <see cref="ReturnCode.SPSS_OK"/>.
 983		/// </returns>
 984		/// <remarks>
 985		/// This function releases the memory which was acquired by <see cref="spssGetMultRespDefsDelegate"/>.
 986		/// </remarks>
 987		[CLSCompliant(false)]
 988		unsafe protected delegate ReturnCode spssFreeMultRespDefsDelegate(char* mrespDefs);
 989		[CLSCompliant(false)]
 990		protected static spssFreeMultRespDefsDelegate spssFreeMultRespDefsImpl;
 991
 992		/// <summary>
 993		/// Frees memory allocated by <see cref="spssGetVarCValueLabelsDelegate"/>.
 994		/// </summary>
 995		/// <param name="values">
 996		/// Array of pointers to values returned by <see cref="spssGetVarCValueLabelsDelegate"/>
 997		/// </param>
 998		/// <param name="labels">
 999		/// Array of pointers to labels returned by <see cref="spssGetVarCValueLabelsDelegate"/>
1000		/// </param>
1001		/// <param name="numLabels">
1002		/// Number of values or labels returned by <see cref="spssGetVarCValueLabelsDelegate"/>
1003		/// </param>
1004		/// <returns>
1005		/// <see cref="ReturnCode.SPSS_OK"/> or
1006		/// <see cref="ReturnCode.SPSS_CANNOT_FREE"/>
1007		/// </returns>
1008		/// <remarks>
1009		/// This function frees the two arrays and the value and label strings allocated on the heap
1010		/// by <see cref="spssGetVarCValueLabelsDelegate"/>.
1011		/// </remarks>
1012		[CLSCompliant(false)]
1013		unsafe protected delegate ReturnCode spssFreeVarCValueLabelsDelegate(char** values, char** labels, int numLabels);
1014		[CLSCompliant(false)]
1015		protected static spssFreeVarCValueLabelsDelegate spssFreeVarCValueLabelsImpl;
1016
1017		/// <summary>
1018		/// Frees memory allocated by <see cref="spssGetVariableSetsDelegate"/>.
1019		/// </summary>
1020		/// <param name="varSets">
1021		/// The string defining the variable sets
1022		/// </param>
1023		/// <returns>
1024		/// Always returns <see cref="ReturnCode.SPSS_OK"/> indicating success.
1025		/// </returns>
1026		/// <remarks>
1027		/// This function is called to return the memory allocated by <see cref="spssGetVariableSetsDelegate"/>.
1028		/// </remarks>
1029		[CLSCompliant(false)]
1030		unsafe protected delegate ReturnCode spssFreeVariableSetsDelegate(char* varSets);
1031		[CLSCompliant(false)]
1032		protected static spssFreeVariableSetsDelegate spssFreeVariableSetsImpl;
1033
1034		/// <summary>
1035		/// Frees memory allocated by <see cref="spssGetVarNamesDelegate"/>.
1036		/// </summary>
1037		/// <param name="varNames">
1038		/// Array of pointers to names returned by <see cref="spssGetVarNamesDelegate"/>
1039		/// </param>
1040		/// <param name="varTypes">
1041		/// Array of variable types returned by <see cref="spssGetVarNamesDelegate"/>
1042		/// </param>
1043		/// <param name="numVars">
1044		/// Number of variables returned by <see cref="spssGetVarNamesDelegate"/>
1045		/// </param>
1046		/// <returns>
1047		/// <see cref="ReturnCode.SPSS_OK"/> or
1048		/// <see cref="ReturnCode.SPSS_CANNOT_FREE"/>.
1049		/// </returns>
1050		/// <remarks>
1051		/// This function frees the two arrays and the name strings allocated on the heap by
1052		/// <see cref="spssGetVarNamesDelegate"/>.
1053		/// </remarks>
1054		[CLSCompliant(false)]
1055		unsafe protected delegate ReturnCode spssFreeVarNamesDelegate(char** varNames, int* varTypes, int numVars);
1056		[CLSCompliant(false)]
1057		protected static spssFreeVarNamesDelegate spssFreeVarNamesImpl;
1058
1059		/// <summary>
1060		/// Frees memory allocated by <see cref="spssGetVarNValueLabelsDelegate"/>.
1061		/// </summary>
1062		/// <param name="values">
1063		/// Array of values returned by <see cref="spssGetVarNValueLabelsDelegate"/>
1064		/// </param>
1065		/// <param name="labels">
1066		/// Array of pointers to labels returned by <see cref="spssGetVarNValueLabelsDelegate"/>
1067		/// </param>
1068		/// <param name="numLabels">
1069		/// Number of values or labels returned by <see cref="spssGetVarNValueLabelsDelegate"/>
1070		/// </param>
1071		/// <returns>
1072		/// <see cref="ReturnCode.SPSS_OK"/> or
1073		/// <see cref="ReturnCode.SPSS_CANNOT_FREE"/>
1074		/// </returns>
1075		/// <remarks>
1076		/// This function frees the two arrays and the value and label strings allocated on the heap
1077		/// by <see cref="spssGetVarCValueLabelsDelegate"/>.
1078		/// </remarks>
1079		[CLSCompliant(false)]
1080		unsafe protected delegate ReturnCode spssFreeVarNValueLabelsDelegate(double* values, char** labels, int numLabels);
1081		[CLSCompliant(false)]
1082		protected static spssFreeVarNValueLabelsDelegate spssFreeVarNValueLabels;
1083
1084		/// <summary>
1085		/// Reports the number of bytes taken up by any one case.
1086		/// </summary>
1087		/// <param name="handle">
1088		/// Handle to the data file
1089		/// </param>
1090		/// <param name="caseSize">
1091		/// Pointer to size of case in bytes
1092		/// </param>
1093		/// <returns>
1094		/// <see cref="ReturnCode.SPSS_OK"/>,
1095		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
1096		/// <see cref="ReturnCode.SPSS_DICT_NOTCOMMIT"/>.
1097		/// </returns>
1098		/// <remarks>
1099		/// This function reports the size of a raw case record for the file associated with handle.
1100		/// The case size is reported in bytes and is meant to be used in conjunction with the lowlevel
1101		/// case input/output procedures <see cref="spssWholeCaseInDelegate"/> and 
1102		/// <see cref="spssWholeCaseOutDelegate"/>.
1103		/// </remarks>
1104		public delegate ReturnCode spssGetCaseSizeDelegate(int handle, out int caseSize);
1105		public static spssGetCaseSizeDelegate spssGetCaseSizeImpl;
1106
1107		/// <summary>
1108		/// Reports the name of the case weight variable.
1109		/// </summary>
1110		/// <param name="handle">
1111		/// Handle to the data file
1112		/// </param>
1113		/// <param name="varName">
1114		/// Pointer to the buffer to hold name of the case weight variable
1115		/// </param>
1116		/// <returns>
1117		/// <see cref="ReturnCode.SPSS_OK"/>,
1118		/// <see cref="ReturnCode.SPSS_NO_CASEWGT"/>,
1119		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
1120		/// <see cref="ReturnCode.SPSS_INVALID_CASEWGT"/>.
1121		/// </returns>
1122		/// <remarks>
1123		/// This function reports the name of the case weight variable. The name is copied to the
1124		/// buffer pointed to by varName as a null-terminated string. Since a variable name can be
1125		/// up to <see cref="SPSS_MAX_VARNAME"/> characters in length, the size of the buffer 
1126		/// must be at least <see cref="SPSS_MAX_VARNAME"/>+1.
1127		/// </remarks>
1128		protected delegate ReturnCode spssGetCaseWeightVarDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string varName);
1129		protected static spssGetCaseWeightVarDelegate spssGetCaseWeightVarImpl;
1130
1131		/// <summary>
1132		/// Gets the compression attribute of a data file.
1133		/// </summary>
1134		/// <param name="handle">
1135		/// Handle to the data file
1136		/// </param>
1137		/// <param name="compSwitch">
1138		/// Pointer to compression attribute. Upon return, *compSwitch is 1 if
1139		/// the file is compressed; 0 otherwise.
1140		/// </param>
1141		/// <returns>
1142		/// <see cref="ReturnCode.SPSS_OK"/> or
1143		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>.
1144		/// </returns>
1145		/// <remarks>
1146		/// This function reports the compression attribute of an SPSS data file.
1147		/// </remarks>
1148		public delegate ReturnCode spssGetCompressionDelegate(int handle, out int compSwitch);
1149		public static spssGetCompressionDelegate spssGetCompressionImpl;
1150
1151		/// <summary>
1152		/// Reports TRENDS date variable information.
1153		/// </summary>
1154		/// <param name="handle">
1155		/// Handle to the data file
1156		/// </param>
1157		/// <param name="numofElements">
1158		/// Number of elements in allocated array
1159		/// </param>
1160		/// <param name="dateInfo">
1161		/// Pointer to first element of the allocated array
1162		/// </param>
1163		/// <returns>
1164		/// <see cref="ReturnCode.SPSS_OK"/>,
1165		/// <see cref="ReturnCode.SPSS_NO_DATEINFO"/>,
1166		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
1167		/// <see cref="ReturnCode.SPSS_NO_MEMORY"/>.
1168		/// </returns>
1169		/// <remarks>
1170		/// This function reports the TRENDS date variable information, if any, in an SPSS data file.
1171		/// It places the information in a dynamically allocated long array, sets *numofElements to
1172		/// the number of elements in the array, and sets *dateInfo to point to the array. The caller is
1173		/// expected to free the array by calling <see cref="spssFreeDateVariablesDelegate"/> when it is no longer needed.
1174		/// The variable information is copied directly from record 7, subtype 3. Its first six elements
1175		/// comprise the "fixed" information, followed by a sequence of one or more three-element
1176		/// groups.
1177		/// </remarks>
1178		[CLSCompliant(false)]
1179		unsafe protected delegate ReturnCode spssGetDateVariablesDelegate(int handle, out int numofElements, out int* dateInfo);
1180		[CLSCompliant(false)]
1181		protected static spssGetDateVariablesDelegate spssGetDateVariablesImpl;
1182
1183		/// <summary>
1184		/// Retrieves the first block of SPSS Data Entry information from a data file.
1185		/// </summary>
1186		/// <param name="handle">
1187		/// Handle to the data file
1188		/// </param>
1189		/// <param name="data">
1190		/// Returned as data from the file
1191		/// </param>
1192		/// <param name="maxData">
1193		/// Maximum bytes to return
1194		/// </param>
1195		/// <param name="nData">
1196		/// Returned as number of bytes returned
1197		/// </param>
1198		/// <returns>
1199		/// <see cref="ReturnCode.SPSS_OK"/>,
1200		/// <see cref="ReturnCode.SPSS_NO_DEW"/>,
1201		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
1202		/// <see cref="ReturnCode.SPSS_FILE_BADTEMP"/>.
1203		/// </returns>
1204		/// <remarks>
1205		/// The client can retrieve DEW information (file information that is private to the SPSS
1206		/// Data Entry product) from a file in whatever increments are convenient. The first such
1207		/// increment is retrieved by calling spssGetDEWFirst, and subsequent segments are
1208		/// retrieved by calling spssGetDEWNext as many times as necessary. As with
1209		/// spssGetDEWInfo, spssGetDEWFirst will return SPSS_NO_DEW if the file was written
1210		/// with a byte order that is the reverse of that of the host.
1211		/// </remarks>
1212		protected delegate ReturnCode spssGetDEWFirstDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string data, int maxData, out int nData);
1213		protected static spssGetDEWFirstDelegate spssGetDEWFirstImpl;
1214
1215		/// <summary>
1216		/// Gets the Data Entry GUID from a data file.
1217		/// </summary>
1218		/// <param name="handle">
1219		/// Handle to the data file
1220		/// </param>
1221		/// <param name="asciiGUID">
1222		/// Returned as the file's GUID in character form or a null string if the
1223		/// file contains no GUID
1224		/// </param>
1225		/// <returns>
1226		/// <see cref="ReturnCode.SPSS_OK"/> or
1227		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>.
1228		/// </returns>
1229		/// <remarks>
1230		/// Data Entry for Windows maintains a GUID in character form as a uniqueness indicator.
1231		/// Two files have identical dictionaries and DEW information if they have the same
1232		/// GUID. Note that the spssOpenWriteCopy function will not copy the source file’s
1233		/// GUID. spssGetDEWGUID allows the client to read a file’s GUID, if any. The client
1234		/// supplies a 257 byte string in which the null-terminated GUID is returned.
1235		/// </remarks>
1236		protected delegate ReturnCode spssGetDEWGUIDDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string asciiGUID);
1237		protected static spssGetDEWGUIDDelegate spssGetDEWGUIDImpl;
1238
1239		/// <summary>
1240		/// Gets the length and hash of the Data Entry information in a data file.
1241		/// </summary>
1242		/// <param name="handle">
1243		/// Handle to the data file
1244		/// </param>
1245		/// <param name="Length">
1246		/// Returned as the length in bytes
1247		/// </param>
1248		/// <param name="HashTotal">
1249		/// Returned as the hash total
1250		/// </param>
1251		/// <returns>
1252		/// <see cref="ReturnCode.SPSS_OK"/>,
1253		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
1254		/// <see cref="ReturnCode.SPSS_NO_DEW"/>.
1255		/// </returns>
1256		/// <remarks>
1257		/// This function can be called before actually retrieving DEW information (file
1258		/// information that is private to the SPSS Data Entry product) from a file, to obtain some
1259		/// attributes of that information--specifically its length in bytes and its hash total. The
1260		/// hash total is, by convention, contained in the last four bytes to be written. Because it is
1261		/// not cognizant of the structure of the DEW information, the I/O DLL is unable to correct
1262		/// the byte order of numeric information generated on a foreign host. As a result, the
1263		/// DEW information is discarded if the file has a byte order that is the reverse of that of
1264		/// the host, and calls to spssGetDEWInfo will return SPSS_NO_DEW.
1265		/// </remarks>
1266		public delegate ReturnCode spssGetDEWInfoDelegate(int handle, out int Length, out int HashTotal);
1267		public static spssGetDEWInfoDelegate spssGetDEWInfoImpl;
1268
1269		/// <summary>
1270		/// Retrieves the next block of SPSS Data Entry information from a data file.
1271		/// </summary>
1272		/// <param name="handle">
1273		/// Handle to the data file
1274		/// </param>
1275		/// <param name="data">
1276		/// Returned as data from the file
1277		/// </param>
1278		/// <param name="maxData">
1279		/// Maximum bytes to return
1280		/// </param>
1281		/// <param name="nData">
1282		/// Returned as number of bytes returned
1283		/// </param>
1284		/// <returns>
1285		/// <see cref="ReturnCode.SPSS_OK"/>,
1286		/// <see cref="ReturnCode.SPSS_DEW_NOFIRST"/>,
1287		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
1288		/// <see cref="ReturnCode.SPSS_FILE_BADTEMP"/>.
1289		/// </returns>
1290		/// <remarks>
1291		/// The client can retrieve DEW information (file information that is private to the SPSS
1292		/// Data Entry product) from a file in whatever increments are convenient. The first such
1293		/// increment is retrieved by calling <see cref="spssGetDEWFirstDelegate"/>, and subsequent segments are
1294		/// retrieved by calling spssGetDEWNext as many times as necessary. As with
1295		/// <see cref="spssGetDEWInfoDelegate"/>, <see cref="spssGetDEWFirstDelegate"/> will return SPSS_NO_DEW if the file was written
1296		/// with a byte order that is the reverse of that of the host.
1297		/// </remarks>
1298		protected delegate ReturnCode spssGetDEWNextDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string data, int maxData, out int nData);
1299		protected static spssGetDEWNextDelegate spssGetDEWNextImpl;
1300
1301		/// <summary>
1302		/// Estimates number of cases in a data file.  
1303		/// </summary>
1304		/// <param name="handle">
1305		/// Handle to the data file
1306		/// </param>
1307		/// <param name="caseCount">
1308		/// Returned as estimated n of cases
1309		/// </param>
1310		/// <returns>
1311		/// <see cref="ReturnCode.SPSS_OK"/>,
1312		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
1313		/// <see cref="ReturnCode.SPSS_OPEN_WRMODE"/>, or
1314		/// <see cref="ReturnCode.SPSS_FILE_RERROR"/>.
1315		/// </returns>
1316		/// <remarks>
1317		/// Although not strictly required for direct access input, this function helps in reading
1318		/// SPSS data files from releases earlier than 6.0. Some of these data files did not contain
1319		/// number of cases information, and <see cref="spssGetNumberofCasesDelegate"/> will return -1 cases. This
1320		/// function will return a precise number for uncompressed files and an estimate (based on
1321		/// overall file size) for compressed files. It cannot be used on files open for appending data.
1322		/// </remarks>
1323		public delegate ReturnCode spssGetEstimatedNofCasesDelegate(int handle, out int caseCount);
1324		public static spssGetEstimatedNofCasesDelegate spssGetEstimatedNofCasesImpl;
1325
1326		/// <summary>
1327		/// Gets the number of cases in a data file.
1328		/// </summary>
1329		/// <param name="handle">
1330		/// Handle to the data file
1331		/// </param>
1332		/// <param name="caseCount">
1333		/// Pointer to number of cases
1334		/// </param>
1335		/// <returns>
1336		/// <see cref="ReturnCode.SPSS_OK"/>,
1337		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
1338		/// <see cref="ReturnCode.SPSS_OPEN_WRMODE"/>.
1339		/// </returns>
1340		/// <remarks>
1341		/// This function reports the number of cases present in a data file open for reading.
1342		/// </remarks>
1343		public delegate ReturnCode spssGetNumberofCasesDelegate(int handle, out int caseCount);
1344		public static spssGetNumberofCasesDelegate spssGetNumberofCasesImpl;
1345
1346		/// <summary>
1347		/// Gets the file label of a data file.
1348		/// </summary>
1349		/// <param name="handle">
1350		/// Handle to the data file
1351		/// </param>
1352		/// <param name="id">
1353		/// File label buffer
1354		/// </param>
1355		/// <returns>
1356		/// <see cref="ReturnCode.SPSS_OK"/> or
1357		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>.
1358		/// </returns>
1359		/// <remarks>
1360		/// This function copies the file label of the SPSS data file associated with <paramref>handle</paramref> into the
1361		/// buffer pointed to by id. The label is at most 64 characters long and null-terminated.
1362		/// Thus, the size of the buffer should be at least 65. If an input data file is associated with
1363		/// the handle, the label will be exactly 64 characters long, padded with blanks as
1364		/// necessary.
1365		/// </remarks>
1366		protected delegate ReturnCode spssGetIdStringDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string id);
1367		protected static spssGetIdStringDelegate spssGetIdStringImpl;
1368
1369		/// <summary>
1370		/// Retrieves the definitions from a data file.
1371		/// </summary>
1372		/// <param name="handle">
1373		/// Handle to the data file
1374		/// </param>
1375		/// <param name="mrespDefs">
1376		/// Returned as a pointer to a string
1377		/// </param>
1378		/// <returns>
1379		/// <see cref="ReturnCode.SPSS_OK"/>,
1380		/// <see cref="ReturnCode.SPSS_NO_MULTRESP"/>,
1381		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
1382		/// <see cref="ReturnCode.SPSS_NO_MEMORY"/>.
1383		/// </returns>
1384		/// <remarks>
1385		/// This function retrieves the definitions from an SPSS data file. The definitions are stored
1386		/// as a null-terminated ASCII string which is very similar to that containing the variable
1387		/// set definitions. The memory allocated by this function to contain the string must be freed
1388		/// by calling <see cref="spssFreeMultRespDefsDelegate"/>. If the file contains no multiple response definitions,
1389		/// *mrespDefs is set to NULL, and the function returns the warning code
1390		/// <see cref="ReturnCode.SPSS_NO_MULTRESP"/>.
1391		/// </remarks>
1392		[CLSCompliant(false)]
1393		unsafe protected delegate ReturnCode spssGetMultRespDefsDelegate(int handle, out char* mrespDefs);
1394		[CLSCompliant(false)]
1395		protected static spssGetMultRespDefsDelegate spssGetMultRespDefsImpl;
1396
1397		/// <summary>
1398		/// Gets the number of variables in a data file.
1399		/// </summary>
1400		/// <param name="handle">
1401		/// Handle to the data file
1402		/// </param>
1403		/// <param name="numVars">
1404		/// Pointer to number of variables
1405		/// </param>
1406		/// <returns>
1407		/// <see cref="ReturnCode.SPSS_OK"/>,
1408		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
1409		/// <see cref="ReturnCode.SPSS_DICT_NOTCOMMIT"/>, or
1410		/// <see cref="ReturnCode.SPSS_INVALID_FILE"/>.
1411		/// </returns>
1412		/// <remarks>
1413		/// This function reports the number of variables present in a data file.
1414		/// </remarks>
1415		public delegate ReturnCode spssGetNumberofVariablesDelegate(int handle, out int numVars);
1416		public static spssGetNumberofVariablesDelegate spssGetNumberofVariables;
1417
1418		/// <summary>
1419		/// Gets information on the running version of SPSS, and the hosting computer.
1420		/// </summary>
1421		/// <param name="handle">
1422		/// Handle to the data file.
1423		/// </param>
1424		/// <param name="relInfo">
1425		/// Array of int in which release- and machine-specific data will be
1426		/// stored. This array must have at least eight elements.
1427		/// </param>
1428		/// <returns>
1429		/// <see cref="ReturnCode.SPSS_OK"/>,
1430		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>, or
1431		/// <see cref="ReturnCode.SPSS_NO_TYPE73"/>.
1432		/// </returns>
1433		/// <remarks>
1434		/// This function reports release- and machine-specific information about the file
1435		/// associated with handle. The information consists of an array of eight int values copied
1436		/// from record type 7, subtype 3 of the file, and is useful primarily for debugging. The
1437		/// array elements are, in order, release number (index 0), release subnumber (1), special
1438		/// release identifier number (2), machine code (3), floating-point representation code (4),
1439		/// compression scheme code (5), big/little-endian code (6), and character representation
1440		/// code (7).
1441		/// </remarks>
1442		protected delegate ReturnCode spssGetReleaseInfoDelegate(int handle, [MarshalAs(UnmanagedType.LPArray, SizeConst = 8)] int[] relInfo);
1443		protected static spssGetReleaseInfoDelegate spssGetReleaseInfoImpl;
1444
1445		/// <summary>
1446		/// Gets the name of the system that created a data file.
1447		/// </summary>
1448		/// <param name="handle">
1449		/// Handle to the data file
1450		/// </param>
1451		/// <param name="sysName">
1452		/// The originating system name
1453		/// </param>
1454		/// <returns>
1455		/// <see cref="ReturnCode.SPSS_OK"/> or
1456		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>.
1457		/// </returns>
1458		/// <remarks>
1459		/// This function returns the name of the system under which the file was created. It is a
1460		/// 40-byte blank-padded character field corresponding to the last 40 bytes of record type
1461		/// 1. Thus, in order to accommodate the information, the parameter 
1462		/// <paramref>sysName</paramref> must be at least 41 bytes in length plus the 
1463		/// terminating null character.
1464		/// </remarks>
1465		protected delegate ReturnCode spssGetSystemStringDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string sysName);
1466		protected static spssGetSystemStringDelegate spssGetSystemStringImpl;
1467
1468		/// <summary>
1469		/// Gets the data created by TextSmart.
1470		/// </summary>
1471		/// <param name="handle">
1472		/// Handle to the data file
1473		/// </param>
1474		/// <param name="textInfo">
1475		/// Buffer for text data
1476		/// </param>
1477		/// <returns>
1478		/// <see cref="ReturnCode.SPSS_OK"/> or
1479		/// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>.
1480		/// </returns>
1481		/// <remarks>
1482		/// This function places the text data created by TextSmart as a null-terminated string in
1483		/// the user-supplied buffer <paramref>textInfo</paramref>. The buffer is assumed to be 
1484		/// at least 256 characters long; the text data may be up to 255 characters long. 
1485		/// If text data are not present in the file, the first character in 
1486		/// <paramref>textInfo</paramref> is set to NULL.
1487		/// </remarks>
1488		protected delegate ReturnCode spssGetTextInfoDelegate(int handle, [MarshalAs(UnmanagedType.VBByRefStr)] ref string textInfo);
1489		protected static spssGetTextInfoDelegate spssGetTextInfoImpl;
1490
1491		/// <summary>
1492		/// Gets the creation date of a data file, as recorded in the file itself.
1493		/// </summary>
1494		/// <param name="handle">
1495		/// Handle to the data file
1496		/// </param>
1497		/// <param name="fileDate">
1498		/// File creation dat…

Large files files are truncated, but you can click here to view the full file