Reuse, not rework
Home

License Awareness



Highly Reusable Software

By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Math
Integer, Floating point, Matrix, Statistics, Boolean, ...

Processing
Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Communications
Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...


NAME

librock_VSBDeleteAtPtr - remove section of buffer starting at pointer
librock_VSBInsertAtPtr - insert section of buffer starting at pointer
#License - #Source code - #Example Use -

SYNOPSIS

#include <librock/mstruct.h>

char *librock_VSBDeleteAtPtr(
    struct librock_VSB_s *v,
    char *ptr, int len);

char *librock_VSBInsertAtPtr(
    struct librock_VSB_s *v,
    char *ptr,
    const char *src,int len);

DESCRIPTION

These routines allow removing or inserting characters in a librock_VSB with the location given by a pointer. Since VSBInsert and VSBDelete will cause pointers to become stale, this provides a useful alternative. Returns pointer at same position in the possibly moved buffer.

Typical use is

#ifdef librock_TYPICAL_USE_VSBInsertAtPtr
    #include <librock/mstruct.h>
    struct librock_VSB_s *v = librock_VSBalloc();
    char *ptr;

    librock_VSBAppend(v,"This is a test.",15);
    ptr = memchr(v->buf,'.',v->inbuf);
    if (ptr) {
        ptr = librock_VSBDeleteAtPtr(v,ptr,1);
        ptr = librock_VSBInsertAtPtr(v,ptr,"!!",2);
    }

    printf("%s\n",librock_VSBsz(v));
    librock_VSBfree(v);
#endif


USES

   librock_assert()
   librock_VSBDelete() librock_VSBInsert()

LICENSE

  Copyright 1998-2002 Forrest J. Cavalier III, http://www.mibsoftware.com
  Licensed under BSD-ish license, NO WARRANTY. Copies must retain this block.
  License text in <librock/license/librock.txt> librock_LIDESC_HC=12440211096131f5976d36be0cddca4cd9152e45

Source Code

./exec/struct/vsbop.c (implementation, plus source of this manual page)

Tests and Supported Platform Types

This is a representative sample. Librock code is highly portable. For a particular platform not reported here, request paid support

librock_VSBDeleteAtPtr passed tests in tvsbop (Unix/Linux/BSD: 2002/08/08 sys=FreeBSD using gcc)
librock_VSBDeleteAtPtr passed tests in tvsbop_main (WIN32: 2002/08/08 sys=NT 4.0 using MSVC)
librock_VSBInsertAtPtr passed tests in tvsbop (Unix/Linux/BSD: 2002/08/08 sys=FreeBSD using gcc)
librock_VSBInsertAtPtr passed tests in tvsbop_main (WIN32: 2002/08/08 sys=NT 4.0 using MSVC)


This software is part of Librock

Rapid reuse, without rework. Details
This page copyright (C) 2002-2003 Forrest J. Cavalier III, d-b-a Mib Software, Saylorsburg PA 18353, USA

Verbatim copying and distribution of this generated page is permitted in any medium provided that no changes are made.
(The source of this manual page may be covered by a more permissive license which allows modifications.)

Want to help? We welcome comments, patches. -- Need help? Request paid support.