/**
 * Allocates a SurfaceFit handle with a suitable default
 * capacity for the contained ArrList's.
 *
 * return
 *     SurfaceFit handle if sufficient memory was available,
 *     otherewise a handle to NULL.
 */
SurfaceFit_pa SurfaceFitAlloc()
{
    SurfaceFit_pa Result = NULL;

    Result = ALLOC_ITEM(SurfaceFit_s, "SurfaceFit structure");
    if (Result != NULL)
    {
        Result->SurfFitType = SurfFitType_NoFit;

        Result->Coord1   = ArrListAlloc(20, ArrListType_Double);
        Result->Coord2   = ArrListAlloc(20, ArrListType_Double);
        Result->Var      = ArrListAlloc(20, ArrListType_Double);
        Result->FitCoefs = ArrListAlloc(20, ArrListType_Double);

        /* If it failed to allocate any of the array lists, clean-up and exit. */
        if (Result->Coord1 == NULL || Result->Coord2 == NULL || Result->Var == NULL ||
            Result->FitCoefs == NULL)
        {
            if (Result->Coord1   != NULL) ArrListDealloc(&(Result->Coord1));
            if (Result->Coord2   != NULL) ArrListDealloc(&(Result->Coord2));
            if (Result->Var      != NULL) ArrListDealloc(&(Result->Var));
            if (Result->FitCoefs != NULL) ArrListDealloc(&(Result->FitCoefs));
            FREE_ITEM(Result, "SurfaceFit structure");
            Result = NULL;
        }
    }

    ENSURE(SurfaceFitIsValid(Result) || Result == NULL);
    return Result;
}
Exemple #2
0
ZoneSpec_s *ZoneSpecAlloc(void)
{
    ZoneSpec_s *Result;

    Result = (ZoneSpec_s *)ALLOC_ITEM(ZoneSpec_s, "ZoneSpec structure");
    if (Result != NULL)
        SetZoneSpecDefaults(Result);

    ENSURE(Result == NULL || VALID_REF(Result));
    return Result;
}
FileStream_s *FileStreamAlloc(FILE      *File,
                              Boolean_t  IsByteOrderNative)
{
  REQUIRE(VALID_REF(File) || File == NULL);

  FileStream_s *Result = ALLOC_ITEM(FileStream_s, "FileStream");
  if (Result != NULL)
    {
      Result->File              = File;
      Result->IsByteOrderNative = IsByteOrderNative;
    }

  ENSURE(VALID_REF(Result) || Result == NULL);
  return Result;
}
/**
 * Allocates a BondAtomPairs handle with a suitable default
 * capacity for the contained ArrList's.
 *
 * return
 *     BondAtomPairs handle if sufficient memory was available,
 *     otherewise a handle to NULL.
 */
BondAtomPairs_pa BondAtomPairsAlloc()
{
    BondAtomPairs_pa Result = NULL;

    Result = ALLOC_ITEM(BondAtomPairs_s, "BondAtomPairs structure");
    if (Result != NULL)
    {
        Result->MemUsageReported = 0;
        Result->Atom1   = ArrListAlloc(60, ArrListType_Long);
        Result->Atom2   = ArrListAlloc(60, ArrListType_Long);

        /* If it failed to allocate any of the array lists, clean-up and exit. */
        if (Result->Atom1 == NULL || Result->Atom2 == NULL)
        {
            if (Result->Atom1 != NULL) ArrListDealloc(&(Result->Atom1));
            if (Result->Atom2 != NULL) ArrListDealloc(&(Result->Atom1));
            FREE_ITEM(Result, "BondAtomPairs structure");
            Result = NULL;
        }
    }

    ENSURE(BondAtomPairsIsValid(Result) || Result == NULL);
    return Result;
}
Exemple #5
0
___1405 *___1402(FILE      *File, ___372  ___2007) { REQUIRE(VALID_REF(File) || File == NULL); ___1405 *___3359 = ALLOC_ITEM(___1405, "FileStream"); if (___3359 != NULL) { ___3359->File              = File; ___3359->___2007 = ___2007; } ENSURE(VALID_REF(___3359) || ___3359 == NULL); return ___3359; } void ___1403(___1405 **___1401) { REQUIRE(VALID_REF(___1401)); REQUIRE(VALID_REF(*___1401) || *___1401 == NULL); if (*___1401 != NULL) { ___1531(*___1401, "FileStream"); *___1401 = NULL; } ENSURE(*___1401 == NULL); }