8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 06:03:02 +01:00

More cleanup. Get rid of obsolete files, too.

This commit is contained in:
robocop 2004-03-30 08:37:07 +00:00
parent 9bf1423967
commit f81e60ed78
10 changed files with 17 additions and 287 deletions

View File

@ -1,187 +0,0 @@
/*
* PROGRAM: JRD Access Method
* MODULE: misc.cpp
* DESCRIPTION: Miscellaneous routines
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
*
*/
#include "firebird.h"
#include "../jrd/ib_stdio.h"
#include <string.h>
#include "../jrd/common.h"
#include <stdarg.h>
#include "../jrd/dsc2.h"
#include "../jrd/misc.h"
#include "../jrd/gds_proto.h"
#include "../jrd/misc_proto.h"
#define STUFF(p,value) {*p++ = value;}
#define STUFF_BYTES(p,value,len) {memcpy (p, (SCHAR*) (value), len); p += len;}
#define STUFF_SHORT(p,value) STUFF_BYTES (p, &value, sizeof (SSHORT))
#define STUFF_LONG(p,value) STUFF_BYTES (p, &value, sizeof (SLONG))
SSHORT MISC_build_parameters_block(UCHAR* buffer, ...)
{
/**************************************
*
* M I S C _ b u i l d _ p a r a m e t e r s _ b l o c k
*
**************************************
*
* Functional description
* Stuffs the passed buffer with various argument information coming via
* va_list. An argument type of 0 signifies the end of argument list.
* Returns the total number of bytes put (stuffed) in the passed buffer.
*
**************************************/
va_list ptr;
SCHAR arg_type, ch;
USHORT sh;
SLONG l;
UCHAR* p = buffer;
const UCHAR* q = NULL;
VA_START(ptr, buffer);
/* using the argument types in the parameter list,
pop the arguments off the call stack and put
them into the passed buffer */
while (arg_type = (SCHAR) va_arg(ptr, int)) {
switch (arg_type) {
case dtype_byte: /* byte */
ch = (SCHAR) va_arg(ptr, int);
STUFF(p, ch);
break;
case dtype_short: /* short value */
sh = (USHORT) va_arg(ptr, int);
STUFF_SHORT(p, sh);
break;
case dtype_long: /* long value */
l = (SLONG) va_arg(ptr, SLONG);
STUFF_LONG(p, l);
break;
case dtype_cstring: /* null-terminated string */
q = va_arg(ptr, UCHAR *);
STUFF_BYTES(p, q, strlen(reinterpret_cast<const char*>(q)) + 1);
break;
case dtype_varying: /* short value followed by a value with that many bytes */
sh = (USHORT) va_arg(ptr, int);
STUFF_SHORT(p, sh);
q = va_arg(ptr, UCHAR *);
STUFF_BYTES(p, q, sh);
break;
}
}
va_end(ptr);
return (p - buffer);
}
#ifdef DEV_BUILD
ULONG MISC_checksum_log_rec(const UCHAR* header,
SSHORT h_len, const UCHAR* data, SSHORT d_len)
{
/**************************************
*
* M I S C _ c h e c k s u m _ l o g _ r e c
*
**************************************
*
* Functional description
* Checksum a log record - header and data are passed separately.
*
**************************************/
ULONG checksum = 0;
if (h_len) {
const UCHAR* p = header;
do {
checksum += *p++;
} while (--h_len);
}
if (d_len) {
const UCHAR* p = data;
do {
checksum += *p++;
} while (--d_len);
}
return checksum;
}
#endif /* DEV_BUILD */
UCHAR *MISC_pop(stk** stack)
{
/**************************************
*
* M I S C _ p o p
*
**************************************
*
* Functional description
* Pops an object off a linked list stack.
* Returns the address of the popped object.
*
**************************************/
stk* node = *stack;
UCHAR* object = node->stk_object;
*stack = node->stk_next;
gds__free(node);
return object;
}
stk* MISC_push(UCHAR* object, stk** stack)
{
/**************************************
*
* M I S C _ p u s h
*
**************************************
*
* Functional description
* Push an object on the passed stack.
* Returns the address of the new top of the stack.
*
**************************************/
stk* node = (stk*) gds__alloc((SLONG) sizeof(stk));
/* FREE: in MISC_pop(), NOMEM: return a NULL top of stack */
if (!node)
return NULL;
node->stk_object = object;
node->stk_next = *stack;
*stack = node;
return node;
}

View File

@ -1,47 +0,0 @@
/*
* PROGRAM: JRD Access Method
* MODULE: misc.h
* DESCRIPTION: Miscellaneous definitions
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
*
*/
#ifndef JRD_MISC_H
#define JRD_MISC_H
#include "../jrd/dsc2.h"
struct stk {
UCHAR* stk_object;
stk* stk_next;
};
/* Miscellaneous defines used for stuffing a parameters block buffer */
#define PARAM_BYTE(PARAM) (SCHAR) dtype_byte, (SCHAR) PARAM
#define PARAM_SHORT(PARAM) (SCHAR) dtype_short, (USHORT) PARAM
#define PARAM_LONG(PARAM) (SCHAR) dtype_long, (SLONG) PARAM
#define PARAM_STRING(PARAM) (SCHAR) dtype_cstring, (SCHAR*) PARAM
#define PARAM_NBYTES(PARAM1,PARAM2) (SCHAR) dtype_varying, (USHORT) PARAM1, (UCHAR*) PARAM2
#define PARAM_POINTER(PARAM) (SCHAR) dtype_long, (UCHAR*) PARAM
#endif /* JRD_MISC_H */

View File

@ -1,38 +0,0 @@
/*
* PROGRAM: JRD Access Method
* MODULE: misc_proto.h
* DESCRIPTION: Prototype header file for misc.cpp
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
#ifndef JRD_MISC_PROTO_H
#define JRD_MISC_PROTO_H
struct stk;
SSHORT MISC_build_parameters_block(UCHAR*, ...);
UCHAR* MISC_pop(stk**);
stk* MISC_push(UCHAR*, stk**);
#ifdef DEV_BUILD
ULONG MISC_checksum_log_rec(const UCHAR*, SSHORT, const UCHAR*, SSHORT);
#endif
#endif // JRD_MISC_PROTO_H

View File

@ -30,6 +30,7 @@
class str;
struct dsc;
struct vary;
int MOV_compare(const dsc*, const dsc*);
double MOV_date_to_double(const dsc*);
@ -43,15 +44,14 @@ void MOV_get_metadata_str(const dsc*, TEXT*, USHORT);
void MOV_get_name(const dsc*, TEXT*);
SQUAD MOV_get_quad(const dsc*, SSHORT);
SINT64 MOV_get_int64(const dsc*, SSHORT);
int MOV_get_string_ptr(const dsc*, USHORT*, UCHAR**, struct vary*,
int MOV_get_string_ptr(const dsc*, USHORT*, UCHAR**, vary*,
USHORT);
int MOV_get_string(const dsc*, UCHAR**, struct vary*, USHORT);
int MOV_get_string(const dsc*, UCHAR**, vary*, USHORT);
GDS_DATE MOV_get_sql_date(const dsc*);
GDS_TIME MOV_get_sql_time(const dsc*);
GDS_TIMESTAMP MOV_get_timestamp(const dsc*);
int MOV_make_string(const dsc*, USHORT, const char**, struct vary*,
USHORT);
int MOV_make_string2(const dsc*, USHORT, UCHAR**, struct vary*,
int MOV_make_string(const dsc*, USHORT, const char**, vary*, USHORT);
int MOV_make_string2(const dsc*, USHORT, UCHAR**, vary*,
USHORT, str**);
void MOV_move(const dsc*, dsc*);
void MOV_time_stamp(GDS_TIMESTAMP*);

View File

@ -47,7 +47,7 @@ struct sdl_arg {
UCHAR* sdl_arg_array;
SLONG* sdl_arg_variables;
SDL_walk_callback sdl_arg_callback;
SLICE sdl_arg_argument;
array_slice* sdl_arg_argument;
ISC_STATUS* sdl_arg_status_vector;
IPTR sdl_arg_compiled[COMPILE_SIZE];
IPTR* sdl_arg_next;
@ -327,7 +327,7 @@ int SDL_walk(ISC_STATUS* status_vector,
internal_array_desc* array_desc,
SLONG* variables,
SDL_walk_callback callback,
SLICE argument)
array_slice* argument)
{
/**************************************
*

View File

@ -37,7 +37,7 @@ struct sdl_info {
SLONG sdl_info_upper[16];
};
typedef struct slice {
struct array_slice {
DSC slice_desc;
const BLOB_PTR* slice_end;
const BLOB_PTR* slice_high_water;
@ -45,8 +45,8 @@ typedef struct slice {
USHORT slice_element_length;
USHORT slice_direction;
SLONG slice_count;
} *SLICE;
};
typedef void (*SDL_walk_callback)(SLICE, ULONG, dsc*);
typedef void (*SDL_walk_callback)(array_slice*, ULONG, dsc*);
#endif /* JRD_SDL_H */

View File

@ -28,14 +28,17 @@ namespace Jrd {
struct internal_array_desc;
}
struct sdl_info;
struct array_alice;
UCHAR* SDL_clone_sdl(const UCHAR*, size_t, UCHAR*, size_t);
SLONG SDL_compute_subscript(ISC_STATUS*, const Jrd::internal_array_desc*,
USHORT, const SLONG*);
ISC_STATUS API_ROUTINE SDL_info(ISC_STATUS*, const UCHAR*, struct sdl_info*, SLONG*);
ISC_STATUS API_ROUTINE SDL_info(ISC_STATUS*, const UCHAR*, sdl_info*, SLONG*);
const UCHAR* SDL_prepare_slice(const UCHAR*, USHORT);
int SDL_walk(ISC_STATUS*, const UCHAR*, bool, UCHAR*,
Jrd::internal_array_desc*, SLONG*,
SDL_walk_callback, struct slice*);
SDL_walk_callback, array_slice*);
#endif // JRD_SDL_PROTO_H

View File

@ -48,7 +48,6 @@
#include "../jrd/license.h"
#include <stdarg.h>
#include "../jrd/jrd_time.h"
#include "../jrd/misc.h"
#include "../jrd/gdsassert.h"
#include "../jrd/y_ref.h"

View File

@ -83,7 +83,6 @@ public:
#define MAX_FORMAT_SIZE 65535
//typedef vary VARY;
/* A macro to define a local vary stack variable of a given length
Usage: VARY_STR(5) my_var; */
@ -185,6 +184,8 @@ inline int IAD_LEN(int count)
// Since we already have Scalar Array Descriptor and Array Description [Slice],
// it was too confusing. Therefore, it was renamed ArrayField, since ultimately,
// it represents an array field the user can manipulate.
// There was also confusion for the casual reader due to the presence of
// the structure "slice" in sdl.h that was renamed array_slice.
class ArrayField : public pool_alloc_rpt<internal_array_desc::iad_repeat, type_arr>
{

View File

@ -177,7 +177,6 @@ struct rem_str
#include "../jrd/dsc.h"
//typedef vary* VARY;
struct rem_fmt
{