home *** CD-ROM | disk | FTP | other *** search
- /*
- fnslong.c 10/2/87
-
- % slong_funcs
-
- Long editing functions.
- These funcs edit longs in a string_like fashion.
- The field variable should be a long *.
-
- C-scape 3.2
- Copyright (c) 1986, 1987, 1988 by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 5/12/88 jmd added calls to sed_GetScratchPad()
- 9/15/88 jmd removed vid_Cursor calls
- 9/17/88 jmd added global error msg strings for easy changing
- 9/17/88 jmd added std_ funcs
- 10/06/88 jmd added stdBigCur_fenter
- 10/09/88 jmd added SED_ABORT support
- 10/14/88 jdc added var_size element to field_funcs_struct
-
- 6/03/89 jmd added strclip to senter func
- 3/28/90 jmd ansi-fied
- */
-
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
-
- #include "cscape.h"
- #include "ostdlib.h" /* for atol() */
-
- #include "fnfunc.h" /* for field functions */
- #include "strdecl.h" /* for C-scape string functions */
- #include "scancode.h"
-
- OGLOBAL field_funcs_struct slong_funcs = {
- stdBigCur_fenter,
- long_fexit,
- sint_fkey,
- slong_senter,
- slong_sexit,
- sizeof(long)
- };
-
- void slong_senter(sed_type sed, int fieldno)
- /*
- Convert the native long into the record string.
- */
- {
- sprintf(sed_GetScratchPad(sed), "%ld", *((long *) sed_GetVar(sed, fieldno)));
- strleft(sed_GetScratchPad(sed), sed_GetRecordLen(sed, fieldno));
- strclip(sed_GetScratchPad(sed));
- sed_SetRecord(sed, sed_GetScratchPad(sed), fieldno);
-
- std_senter(sed, fieldno);
- }
-
- void slong_sexit(sed_type sed, int fieldno)
- /*
- Convert the record string back into the native long.
- Remove commas from string first.
- */
- {
- if (sed_GetBaton(sed) != SED_ABORT) {
- strcpy(sed_GetScratchPad(sed), sed_GetRecord(sed, fieldno));
- strnocomma(sed_GetScratchPad(sed));
- *((long *) sed_GetVar(sed, fieldno)) = atol(sed_GetScratchPad(sed));
- }
- }
-
-