fld_def.c (166124) | fld_def.c (174993) |
---|---|
1/**************************************************************************** | 1/**************************************************************************** |
2 * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * | 2 * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. * |
3 * * 4 * Permission is hereby granted, free of charge, to any person obtaining a * 5 * copy of this software and associated documentation files (the * 6 * "Software"), to deal in the Software without restriction, including * 7 * without limitation the rights to use, copy, modify, merge, publish, * 8 * distribute, distribute with modifications, sublicense, and/or sell * 9 * copies of the Software, and to permit persons to whom the Software is * 10 * furnished to do so, subject to the following conditions: * --- 16 unchanged lines hidden (view full) --- 27 ****************************************************************************/ 28 29/**************************************************************************** 30 * Author: Juergen Pfeifer, 1995,1997 * 31 ****************************************************************************/ 32 33#include "form.priv.h" 34 | 3 * * 4 * Permission is hereby granted, free of charge, to any person obtaining a * 5 * copy of this software and associated documentation files (the * 6 * "Software"), to deal in the Software without restriction, including * 7 * without limitation the rights to use, copy, modify, merge, publish, * 8 * distribute, distribute with modifications, sublicense, and/or sell * 9 * copies of the Software, and to permit persons to whom the Software is * 10 * furnished to do so, subject to the following conditions: * --- 16 unchanged lines hidden (view full) --- 27 ****************************************************************************/ 28 29/**************************************************************************** 30 * Author: Juergen Pfeifer, 1995,1997 * 31 ****************************************************************************/ 32 33#include "form.priv.h" 34 |
35MODULE_ID("$Id: fld_def.c,v 1.33 2005/04/16 17:31:17 tom Exp $") | 35MODULE_ID("$Id: fld_def.c,v 1.36 2007/10/13 19:29:58 tom Exp $") |
36 37/* this can't be readonly */ 38static FIELD default_field = 39{ 40 0, /* status */ 41 0, /* rows */ 42 0, /* cols */ 43 0, /* frow */ --- 44 unchanged lines hidden (view full) --- 88 TypeArgument *res = (TypeArgument *)0; 89 TypeArgument *p; 90 91 if (typ != 0 && (typ->status & _HAS_ARGS) != 0) 92 { 93 assert(err != 0 && ap != (va_list *)0); 94 if ((typ->status & _LINKED_TYPE) != 0) 95 { | 36 37/* this can't be readonly */ 38static FIELD default_field = 39{ 40 0, /* status */ 41 0, /* rows */ 42 0, /* cols */ 43 0, /* frow */ --- 44 unchanged lines hidden (view full) --- 88 TypeArgument *res = (TypeArgument *)0; 89 TypeArgument *p; 90 91 if (typ != 0 && (typ->status & _HAS_ARGS) != 0) 92 { 93 assert(err != 0 && ap != (va_list *)0); 94 if ((typ->status & _LINKED_TYPE) != 0) 95 { |
96 p = (TypeArgument *)malloc(sizeof(TypeArgument)); | 96 p = typeMalloc(TypeArgument, 1); |
97 98 if (p != 0) 99 { 100 p->left = _nc_Make_Argument(typ->left, ap, err); 101 p->right = _nc_Make_Argument(typ->right, ap, err); 102 return p; 103 } 104 else --- 31 unchanged lines hidden (view full) --- 136 TypeArgument *res = (TypeArgument *)0; 137 TypeArgument *p; 138 139 if (typ != 0 && (typ->status & _HAS_ARGS) != 0) 140 { 141 assert(err != 0 && argp != 0); 142 if ((typ->status & _LINKED_TYPE) != 0) 143 { | 97 98 if (p != 0) 99 { 100 p->left = _nc_Make_Argument(typ->left, ap, err); 101 p->right = _nc_Make_Argument(typ->right, ap, err); 102 return p; 103 } 104 else --- 31 unchanged lines hidden (view full) --- 136 TypeArgument *res = (TypeArgument *)0; 137 TypeArgument *p; 138 139 if (typ != 0 && (typ->status & _HAS_ARGS) != 0) 140 { 141 assert(err != 0 && argp != 0); 142 if ((typ->status & _LINKED_TYPE) != 0) 143 { |
144 p = (TypeArgument *)malloc(sizeof(TypeArgument)); | 144 p = typeMalloc(TypeArgument, 1); |
145 146 if (p != 0) 147 { 148 p->left = _nc_Copy_Argument(typ, argp->left, err); 149 p->right = _nc_Copy_Argument(typ, argp->right, err); 150 return p; 151 } 152 *err += 1; --- 131 unchanged lines hidden (view full) --- 284 T((T_CALLED("new_field(%d,%d,%d,%d,%d,%d)"), rows, cols, frow, fcol, nrow, nbuf)); 285 if (rows > 0 && 286 cols > 0 && 287 frow >= 0 && 288 fcol >= 0 && 289 nrow >= 0 && 290 nbuf >= 0 && 291 ((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ | 145 146 if (p != 0) 147 { 148 p->left = _nc_Copy_Argument(typ, argp->left, err); 149 p->right = _nc_Copy_Argument(typ, argp->right, err); 150 return p; 151 } 152 *err += 1; --- 131 unchanged lines hidden (view full) --- 284 T((T_CALLED("new_field(%d,%d,%d,%d,%d,%d)"), rows, cols, frow, fcol, nrow, nbuf)); 285 if (rows > 0 && 286 cols > 0 && 287 frow >= 0 && 288 fcol >= 0 && 289 nrow >= 0 && 290 nbuf >= 0 && 291 ((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ |
292 (New_Field = (FIELD *)malloc(sizeof(FIELD))) != 0) | 292 (New_Field = typeMalloc(FIELD, 1)) != 0) |
293 { | 293 { |
294 T((T_CREATE("field %p"), New_Field)); |
|
294 *New_Field = default_field; 295 New_Field->rows = rows; 296 New_Field->cols = cols; 297 New_Field->drows = rows + nrow; 298 New_Field->dcols = cols; 299 New_Field->frow = frow; 300 New_Field->fcol = fcol; 301 New_Field->nrow = nrow; 302 New_Field->nbuf = nbuf; 303 New_Field->link = New_Field; 304 305#if USE_WIDEC_SUPPORT 306 New_Field->working = newpad(1, Buffer_Length(New_Field) + 1); | 295 *New_Field = default_field; 296 New_Field->rows = rows; 297 New_Field->cols = cols; 298 New_Field->drows = rows + nrow; 299 New_Field->dcols = cols; 300 New_Field->frow = frow; 301 New_Field->fcol = fcol; 302 New_Field->nrow = nrow; 303 New_Field->nbuf = nbuf; 304 New_Field->link = New_Field; 305 306#if USE_WIDEC_SUPPORT 307 New_Field->working = newpad(1, Buffer_Length(New_Field) + 1); |
307 New_Field->expanded = (char **)calloc(1 + (unsigned)rows, sizeof(char *)); | 308 New_Field->expanded = typeCalloc(char *, 1 + (unsigned)nbuf); |
308#endif 309 310 if (_nc_Copy_Type(New_Field, &default_field)) 311 { 312 size_t len; 313 314 len = Total_Buffer_Size(New_Field); 315 if ((New_Field->buf = (FIELD_CELL *)malloc(len))) --- 83 unchanged lines hidden --- | 309#endif 310 311 if (_nc_Copy_Type(New_Field, &default_field)) 312 { 313 size_t len; 314 315 len = Total_Buffer_Size(New_Field); 316 if ((New_Field->buf = (FIELD_CELL *)malloc(len))) --- 83 unchanged lines hidden --- |