mux/src/functions.cpp File Reference

#include "copyright.h"
#include "autoconf.h"
#include "config.h"
#include "externs.h"
#include "ansi.h"
#include "attrs.h"
#include "command.h"
#include "functions.h"
#include "funmath.h"
#include "interface.h"
#include "misc.h"
#include "pcre.h"

Include dependency graph for functions.cpp:

Go to the source code of this file.

Data Structures

struct  ATR_HAS_FLAG_ENTRY
struct  f_record
struct  i_record
struct  i64_record
struct  RADIX_ENTRY

Defines

#define ASCII_LIST   1
#define NUMERIC_LIST   2
#define DBREF_LIST   4
#define FLOAT_LIST   8
#define CI_ASCII_LIST   16
#define ALL_LIST   (ASCII_LIST|NUMERIC_LIST|DBREF_LIST|FLOAT_LIST)
#define GET_GET   1
#define GET_XGET   2
#define GET_EVAL   4
#define GET_GEVAL   8
#define IF_DELETE   0
#define IF_REPLACE   1
#define IF_INSERT   2
#define SET_UNION   1
#define SET_INTERSECT   2
#define SET_DIFF   3
#define CJC_CENTER   0
#define CJC_LJUST   1
#define CJC_RJUST   2
#define TRIM_LEFT   1
#define TRIM_RIGHT   2
#define DEFAULT_WIDTH   78
#define N_RADIX_ENTRIES   7
#define IYEARS   0
#define IMONTHS   1
#define IWEEKS   2
#define IDAYS   3
#define IHOURS   4
#define IMINUTES   5
#define ISECONDS   6

Typedefs

typedef void MEMXFORM (char *dest, char *src, unsigned int n)
typedef f_record f_rec
typedef i_record i_rec
typedef i64_record i64_rec

Functions

char * trim_space_sep_LEN (char *str, int nStr, SEP *sep, int *nTrim)
char * trim_space_sep (char *str, SEP *sep)
static char * next_token_LEN (char *str, int *nStr, SEP *psep)
char * next_token (char *str, SEP *psep)
static char * split_token_LEN (char **sp, int *nStr, SEP *psep, int *nToken)
char * split_token (char **sp, SEP *psep)
static int autodetect_list (char *ptrs[], int nitems)
static int get_list_type (char *fargs[], int nfargs, int type_pos, char *ptrs[], int nitems)
int list2arr (char *arr[], int maxlen, char *list, SEP *psep)
void arr2list (char *arr[], int alen, char *list, char **bufc, SEP *psep)
static int dbnum (char *dbr)
static bool nearby_or_control (dbref player, dbref thing)
bool delim_check (char *buff, char **bufc, dbref executor, dbref caller, dbref enactor, char *fargs[], int nfargs, char *cargs[], int ncargs, int sep_arg, SEP *sep, int dflags)
int countwords (char *str, SEP *psep)
static FUNCTION (fun_words)
static FUNCTION (fun_flags)
static FUNCTION (fun_rand)
static FUNCTION (fun_time)
static FUNCTION (fun_secs)
static FUNCTION (fun_convsecs)
static FUNCTION (fun_convtime)
static FUNCTION (fun_starttime)
static FUNCTION (fun_timefmt)
static void get_handler (char *buff, char **bufc, dbref executor, char *fargs[], int key)
static FUNCTION (fun_get)
static FUNCTION (fun_xget)
static FUNCTION (fun_get_eval)
static FUNCTION (fun_subeval)
static FUNCTION (fun_eval)
static void do_ufun (char *buff, char **bufc, dbref executor, dbref caller, dbref enactor, char *fargs[], int nfargs, char *cargs[], int ncargs, bool is_local)
static FUNCTION (fun_u)
static FUNCTION (fun_ulocal)
static FUNCTION (fun_parent)
static FUNCTION (fun_mid)
static FUNCTION (fun_right)
static FUNCTION (fun_first)
static FUNCTION (fun_rest)
static FUNCTION (fun_v)
static FUNCTION (fun_s)
static FUNCTION (fun_con)
static FUNCTION (fun_exit)
static FUNCTION (fun_next)
static FUNCTION (fun_loc)
static FUNCTION (fun_where)
static FUNCTION (fun_rloc)
static FUNCTION (fun_room)
static FUNCTION (fun_owner)
static FUNCTION (fun_controls)
static FUNCTION (fun_fullname)
static FUNCTION (fun_name)
static FUNCTION (fun_match)
static FUNCTION (fun_strmatch)
static FUNCTION (fun_extract)
bool xlate (char *arg)
static FUNCTION (fun_index)
static FUNCTION (fun_cat)
static FUNCTION (fun_version)
static FUNCTION (fun_strlen)
static FUNCTION (fun_strmem)
static FUNCTION (fun_num)
static void internalPlayerFind (char *buff, char **bufc, dbref player, char *name, int bVerifyPlayer)
static FUNCTION (fun_pmatch)
static FUNCTION (fun_pfind)
static FUNCTION (fun_comp)
static FUNCTION (fun_lcon)
static FUNCTION (fun_lexits)
 FUNCTION (fun_entrances)
static FUNCTION (fun_home)
static FUNCTION (fun_money)
static FUNCTION (fun_pos)
static FUNCTION (fun_lpos)
static void do_itemfuns (char *buff, char **bufc, char *str, int el, char *word, SEP *psep, int flag)
static FUNCTION (fun_ldelete)
static FUNCTION (fun_replace)
static FUNCTION (fun_insert)
static FUNCTION (fun_remove)
static FUNCTION (fun_member)
static FUNCTION (fun_secure)
static FUNCTION (fun_escape)
static FUNCTION (fun_wordpos)
static FUNCTION (fun_type)
static bool atr_has_flag (dbref player, dbref thing, ATTR *pattr, dbref aowner, int aflags, const char *flagname)
static FUNCTION (fun_hasflag)
static FUNCTION (fun_haspower)
static FUNCTION (fun_powers)
static FUNCTION (fun_delete)
static FUNCTION (fun_lock)
static FUNCTION (fun_elock)
static FUNCTION (fun_lwho)
static FUNCTION (fun_lports)
static FUNCTION (fun_nearby)
static void process_sex (dbref player, char *what, const char *token, char *buff, char **bufc)
static FUNCTION (fun_obj)
static FUNCTION (fun_poss)
static FUNCTION (fun_subj)
static FUNCTION (fun_aposs)
static FUNCTION (fun_mudname)
static FUNCTION (fun_connrecord)
 FUNCTION (fun_fcount)
 FUNCTION (fun_fdepth)
static FUNCTION (fun_ctime)
static FUNCTION (fun_mtime)
static FUNCTION (fun_moniker)
static void ANSI_TransformTextWithTable (char *buff, char **bufc, char *pString, const unsigned char xfrmTable[256])
static FUNCTION (fun_lcstr)
static FUNCTION (fun_ucstr)
static FUNCTION (fun_capstr)
static FUNCTION (fun_lnum)
static void lattr_handler (char *buff, char **bufc, dbref executor, char *fargs[], bool bCheckParent)
static FUNCTION (fun_lattr)
static FUNCTION (fun_lattrp)
static FUNCTION (fun_attrcnt)
static void mux_memrevcpy (char *dest, char *src, unsigned int n)
static void ANSI_TransformTextReverseWithFunction (char *buff, char **bufc, char *pString, MEMXFORM *pfMemXForm)
static FUNCTION (fun_reverse)
static void ReverseWordsInText (char *dest, char *src, unsigned int n)
static FUNCTION (fun_revwords)
static FUNCTION (fun_after)
static FUNCTION (fun_before)
static FUNCTION (fun_search)
static FUNCTION (fun_stats)
static FUNCTION (fun_merge)
static FUNCTION (fun_splice)
static FUNCTION (fun_repeat)
static FUNCTION (fun_iter)
static void iter_value (char *buff, char **bufc, char *fargs[], int nfargs, bool bWhich)
static FUNCTION (fun_itext)
static FUNCTION (fun_inum)
static FUNCTION (fun_list)
static FUNCTION (fun_ilev)
static FUNCTION (fun_fold)
static FUNCTION (fun_itemize)
static FUNCTION (fun_choose)
static void filter_handler (char *buff, char **bufc, dbref executor, dbref enactor, char *fargs[], SEP *psep, SEP *posep, bool bBool)
static FUNCTION (fun_filter)
static FUNCTION (fun_filterbool)
static FUNCTION (fun_map)
static FUNCTION (fun_edit)
static FUNCTION (fun_locate)
static void switch_handler (char *buff, char **bufc, dbref executor, dbref caller, dbref enactor, char *fargs[], int nfargs, char *cargs[], int ncargs, bool bSwitch)
static FUNCTION (fun_switch)
static FUNCTION (fun_case)
static FUNCTION (fun_space)
static FUNCTION (fun_height)
static FUNCTION (fun_width)
static FUNCTION (fun_idle)
static FUNCTION (fun_conn)
static int DCL_CDECL a_comp (const void *s1, const void *s2)
static int DCL_CDECL a_casecomp (const void *s1, const void *s2)
static int DCL_CDECL f_comp (const void *s1, const void *s2)
static int DCL_CDECL i_comp (const void *s1, const void *s2)
static int DCL_CDECL i64_comp (const void *s1, const void *s2)
static void do_asort (char *s[], int n, int sort_type)
static FUNCTION (fun_sort)
static void handle_sets (char *fargs[], char *buff, char **bufc, int oper, SEP *psep, SEP *posep)
static FUNCTION (fun_setunion)
static FUNCTION (fun_setdiff)
static FUNCTION (fun_setinter)
static void centerjustcombo (int iType, char *buff, char **bufc, char *fargs[], int nfargs)
static FUNCTION (fun_ljust)
static FUNCTION (fun_rjust)
static FUNCTION (fun_center)
static FUNCTION (fun_setq)
static FUNCTION (fun_setr)
static FUNCTION (fun_r)
static FUNCTION (fun_isdbref)
static char * trim_fast_left (char *str, char delim)
static void trim_fast_right (char *str, char delim)
static char * trim_left (char *str, SEP *sep)
static void trim_right (char *str, SEP *sep)
static FUNCTION (fun_trim)
static FUNCTION (fun_config)
static int return_bit (dbref player)
static FUNCTION (fun_bittype)
static FUNCTION (fun_error)
static FUNCTION (fun_strip)
static char * expand_tabs (const char *str)
static int wraplen (char *str, const int nWidth, bool &newline)
static FUNCTION (fun_wrap)
static void GeneralTimeConversion (char *Buffer, long Seconds, int iStartBase, int iEndBase, bool bSingleTerm, bool bNames)
static const char * digit_format (int Seconds)
const char * time_format_1 (int Seconds, size_t maxWidth)
const char * time_format_2 (int Seconds)
static const char * expand_time (int Seconds)
static const char * write_time (int Seconds)
static FUNCTION (fun_digittime)
static FUNCTION (fun_singletime)
static FUNCTION (fun_exptime)
static FUNCTION (fun_writetime)
static FUNCTION (fun_cmds)
static FUNCTION (fun_startsecs)
static FUNCTION (fun_conntotal)
static FUNCTION (fun_connmax)
static FUNCTION (fun_connlast)
static FUNCTION (fun_connnum)
static FUNCTION (fun_connleft)
static FUNCTION (fun_lattrcmds)
static FUNCTION (fun_lcmds)
static FUNCTION (fun_lflags)
static FUNCTION (fun_art)
static FUNCTION (fun_ord)
static FUNCTION (fun_chr)
static FUNCTION (fun_stripaccents)
static FUNCTION (fun_accent)
void function_add (FUN *fp)
void functions_add (FUN funlist[])
void init_functab (void)
void do_function (dbref executor, dbref caller, dbref enactor, int key, int nargs, char *fname, char *target)
void list_functable (dbref player)
 CF_HAND (cf_func_access)

Variables

UFUNufun_head
SEP sepSpace = { 1, " " }
static const char * DayOfWeekStringLong [7]
static const char * MonthTableLong []
static const int Map24to12 [24]
static ATR_HAS_FLAG_ENTRY atr_has_flag_table []
static char ReverseWordsInText_Seperator
static const RADIX_ENTRY reTable [N_RADIX_ENTRIES]
static char TimeBuffer64 [64]
static char TimeBuffer80 [80]
static int tf1_width_table [4][3]
struct {
   char *   specs [4]
   int   div [3]
tf1_case_table [4]
static const unsigned char AccentCombo1 [256]
static const unsigned char AccentCombo2 [256]
static const unsigned char AccentCombo3 [24][16]
static FUN builtin_function_list []


Define Documentation

#define ALL_LIST   (ASCII_LIST|NUMERIC_LIST|DBREF_LIST|FLOAT_LIST)

Definition at line 298 of file functions.cpp.

Referenced by autodetect_list().

#define ASCII_LIST   1

Definition at line 293 of file functions.cpp.

Referenced by autodetect_list(), do_asort(), get_list_type(), and handle_sets().

#define CI_ASCII_LIST   16

Definition at line 297 of file functions.cpp.

Referenced by do_asort(), and get_list_type().

#define CJC_CENTER   0

Definition at line 6676 of file functions.cpp.

Referenced by centerjustcombo(), and FUNCTION().

#define CJC_LJUST   1

Definition at line 6677 of file functions.cpp.

Referenced by FUNCTION().

#define CJC_RJUST   2

Definition at line 6678 of file functions.cpp.

Referenced by centerjustcombo(), and FUNCTION().

#define DBREF_LIST   4

Definition at line 295 of file functions.cpp.

Referenced by autodetect_list(), do_asort(), and get_list_type().

#define DEFAULT_WIDTH   78

Definition at line 7273 of file functions.cpp.

Referenced by FUNCTION().

#define FLOAT_LIST   8

Definition at line 296 of file functions.cpp.

Referenced by autodetect_list(), do_asort(), and get_list_type().

#define GET_EVAL   4

Definition at line 1236 of file functions.cpp.

Referenced by FUNCTION(), and get_handler().

#define GET_GET   1

Definition at line 1234 of file functions.cpp.

Referenced by FUNCTION().

#define GET_GEVAL   8

Definition at line 1237 of file functions.cpp.

Referenced by FUNCTION(), and get_handler().

#define GET_XGET   2

Definition at line 1235 of file functions.cpp.

Referenced by FUNCTION(), and get_handler().

#define IDAYS   3

Definition at line 7560 of file functions.cpp.

#define IF_DELETE   0

Definition at line 3131 of file functions.cpp.

Referenced by do_itemfuns(), and FUNCTION().

#define IF_INSERT   2

Definition at line 3133 of file functions.cpp.

Referenced by do_itemfuns(), and FUNCTION().

#define IF_REPLACE   1

Definition at line 3132 of file functions.cpp.

Referenced by do_itemfuns(), and FUNCTION().

#define IHOURS   4

Definition at line 7561 of file functions.cpp.

#define IMINUTES   5

Definition at line 7562 of file functions.cpp.

#define IMONTHS   1

Definition at line 7558 of file functions.cpp.

Referenced by expand_time(), and write_time().

#define ISECONDS   6

Definition at line 7563 of file functions.cpp.

Referenced by expand_time(), time_format_2(), and write_time().

#define IWEEKS   2

Definition at line 7559 of file functions.cpp.

#define IYEARS   0

Definition at line 7557 of file functions.cpp.

Referenced by time_format_2().

#define N_RADIX_ENTRIES   7

Definition at line 7545 of file functions.cpp.

#define NUMERIC_LIST   2

Definition at line 294 of file functions.cpp.

Referenced by autodetect_list(), do_asort(), and get_list_type().

#define SET_DIFF   3

Definition at line 6376 of file functions.cpp.

Referenced by FUNCTION(), and handle_sets().

#define SET_INTERSECT   2

Definition at line 6375 of file functions.cpp.

Referenced by FUNCTION(), and handle_sets().

#define SET_UNION   1

Definition at line 6374 of file functions.cpp.

Referenced by FUNCTION(), and handle_sets().

#define TRIM_LEFT   1

Referenced by FUNCTION().

#define TRIM_RIGHT   2

Referenced by FUNCTION().


Typedef Documentation

typedef struct f_record f_rec

typedef struct i64_record i64_rec

typedef struct i_record i_rec

typedef void MEMXFORM(char *dest, char *src, unsigned int n)

Definition at line 4661 of file functions.cpp.


Function Documentation

static int DCL_CDECL a_casecomp ( const void *  s1,
const void *  s2 
) [static]

Definition at line 6229 of file functions.cpp.

References mux_stricmp().

Referenced by do_asort().

06230 {
06231     return mux_stricmp(*(char **)s1, *(char **)s2);
06232 }

static int DCL_CDECL a_comp ( const void *  s1,
const void *  s2 
) [static]

Definition at line 6224 of file functions.cpp.

Referenced by do_asort().

06225 {
06226     return strcmp(*(char **)s1, *(char **)s2);
06227 }

static void ANSI_TransformTextReverseWithFunction ( char *  buff,
char **  bufc,
char *  pString,
MEMXFORM pfMemXForm 
) [static]

Definition at line 4663 of file functions.cpp.

References ANSI_lex(), LBUF_SIZE, and TOKEN_TEXT_ANSI.

Referenced by FUNCTION().

04669 {
04670     // Bounds checking.
04671     //
04672     unsigned int nString = strlen(pString);
04673     char *pBuffer = *bufc;
04674     unsigned int nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
04675     if (nString > nBufferAvailable)
04676     {
04677         nString = nBufferAvailable;
04678         pString[nString] = '\0';
04679     }
04680 
04681     // How it's done: We have a source string (pString, nString) and a
04682     // destination buffer (pBuffer, nString) of equal size.
04683     //
04684     // We recognize (ANSI,TEXT) phrases and place them at the end of
04685     // destination buffer working our way to the front. The ANSI part
04686     // is left inviolate, but the text part is reversed.
04687     //
04688     // In this way, (ANSI1,TEXT1)(ANSI2,TEXT2) is traslated into
04689     // (ANSI2,reverse(TEST2))(ANSI1,reverse(TEXT1)).
04690     //
04691     // TODO: Do not reverse the CRLF in the text part either.
04692     //
04693     int  nANSI = 0;
04694     char *pANSI = pString;
04695     pBuffer += nString;
04696     *bufc = pBuffer;
04697     **bufc = '\0';
04698     while (nString)
04699     {
04700         int nTokenLength0;
04701         int nTokenLength1;
04702         int iType = ANSI_lex(nString, pString, &nTokenLength0, &nTokenLength1);
04703 
04704         if (iType == TOKEN_TEXT_ANSI)
04705         {
04706             // (ANSI,TEXT) is given by (nANSI, nTokenLength0)
04707             //
04708             pBuffer -= nANSI + nTokenLength0;
04709             memcpy(pBuffer, pANSI, nANSI);
04710             pfMemXForm(pBuffer+nANSI, pString, nTokenLength0);
04711 
04712             // Adjust pointers and counts.
04713             //
04714             nString -= nTokenLength0;
04715             pString += nTokenLength0;
04716             pANSI = pString;
04717             nANSI = 0;
04718 
04719             nTokenLength0 = nTokenLength1;
04720         }
04721         // TOKEN_ANSI
04722         //
04723         nString -= nTokenLength0;
04724         pString += nTokenLength0;
04725         nANSI   += nTokenLength0;
04726     }
04727 
04728     // Copy the last ANSI part (if present). It will be overridden by
04729     // ANSI further on, but we need to fill up the space. Code
04730     // elsewhere will compact it before it's sent to the client.
04731     //
04732     pBuffer -= nANSI;
04733     memcpy(pBuffer, pANSI, nANSI);
04734 }

static void ANSI_TransformTextWithTable ( char *  buff,
char **  bufc,
char *  pString,
const unsigned char  xfrmTable[256] 
) [static]

Definition at line 4351 of file functions.cpp.

References ANSI_lex(), LBUF_SIZE, and TOKEN_TEXT_ANSI.

Referenced by FUNCTION().

04356 {
04357     int   nString = strlen(pString);
04358     char *pBuffer = *bufc;
04359     int   nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
04360     while (nString)
04361     {
04362         int nTokenLength0;
04363         int nTokenLength1;
04364         int iType = ANSI_lex(nString, pString, &nTokenLength0, &nTokenLength1);
04365 
04366         if (iType == TOKEN_TEXT_ANSI)
04367         {
04368             // Determine how much to move.
04369             //
04370             int nMove = nTokenLength0;
04371             if (nMove > nBufferAvailable)
04372             {
04373                 nMove = nBufferAvailable;
04374             }
04375             nBufferAvailable -= nMove;
04376 
04377             // Update pointers and counts.
04378             //
04379             char *p = pString;
04380             nString -= nTokenLength0;
04381             pString += nTokenLength0;
04382 
04383             // Transform and Move text.
04384             //
04385             while (nMove--)
04386             {
04387                 *pBuffer++ = xfrmTable[(unsigned char)*p++];
04388             }
04389 
04390             // Determine whether to move the ANSI part.
04391             //
04392             if (nTokenLength1)
04393             {
04394                 if (nTokenLength1 <= nBufferAvailable)
04395                 {
04396                     memcpy(pBuffer, pString, nTokenLength1);
04397                     pBuffer += nTokenLength1;
04398                     nBufferAvailable -= nTokenLength1;
04399                 }
04400                 nString -= nTokenLength1;
04401                 pString += nTokenLength1;
04402             }
04403         }
04404         else
04405         {
04406             // TOKEN_ANSI
04407             //
04408             // Determine whether to move the ANSI part.
04409             //
04410             if (nTokenLength0 <= nBufferAvailable)
04411             {
04412                 memcpy(pBuffer, pString, nTokenLength0);
04413                 pBuffer += nTokenLength0;
04414                 nBufferAvailable -= nTokenLength0;
04415             }
04416             nString -= nTokenLength0;
04417             pString += nTokenLength0;
04418         }
04419     }
04420     *pBuffer = '\0';
04421     *bufc = pBuffer;
04422 }

void arr2list ( char *  arr[],
int  alen,
char *  list,
char **  bufc,
SEP psep 
)

Definition at line 392 of file functions.cpp.

References print_sep, and safe_str.

Referenced by FUNCTION().

00393 {
00394     int i;
00395     for (i = 0; i < alen-1; i++)
00396     {
00397         safe_str(arr[i], list, bufc);
00398         print_sep(psep, list, bufc);
00399     }
00400     if (alen)
00401     {
00402         safe_str(arr[i], list, bufc);
00403     }
00404 }

static bool atr_has_flag ( dbref  player,
dbref  thing,
ATTR pattr,
dbref  aowner,
int  aflags,
const char *  flagname 
) [static]

Definition at line 3622 of file functions.cpp.

References atr_has_flag_table, ATR_HAS_FLAG_ENTRY::iMask, ATR_HAS_FLAG_ENTRY::pName, See_attr, string_prefix(), and UNUSED_PARAMETER.

Referenced by FUNCTION().

03630 {
03631     UNUSED_PARAMETER(aowner);
03632 
03633     if (See_attr(player, thing, pattr))
03634     {
03635         ATR_HAS_FLAG_ENTRY *pEntry = atr_has_flag_table;
03636         while (pEntry->pName)
03637         {
03638             if (string_prefix(pEntry->pName, flagname))
03639             {
03640                 return ((aflags & (pEntry->iMask)) ? true : false);
03641             }
03642             pEntry++;
03643         }
03644     }
03645     return false;
03646 }

static int autodetect_list ( char *  ptrs[],
int  nitems 
) [static]

Definition at line 300 of file functions.cpp.

References ALL_LIST, ASCII_LIST, DBREF_LIST, FLOAT_LIST, is_integer(), is_real(), NUMBER_TOKEN, and NUMERIC_LIST.

Referenced by get_list_type().

00301 {
00302     int could_be = ALL_LIST;
00303     for (int i = 0; i < nitems; i++)
00304     {
00305         char *p = ptrs[i];
00306         if (p[0] != NUMBER_TOKEN)
00307         {
00308             could_be &= ~DBREF_LIST;
00309         }
00310         if (  (could_be & DBREF_LIST)
00311            && !is_integer(p+1, NULL))
00312         {
00313             could_be &= ~(DBREF_LIST|NUMERIC_LIST|FLOAT_LIST);
00314         }
00315         if (  (could_be & FLOAT_LIST)
00316            && !is_real(p))
00317         {
00318             could_be &= ~(NUMERIC_LIST|FLOAT_LIST);
00319         }
00320         if (  (could_be & NUMERIC_LIST)
00321            && !is_integer(p, NULL))
00322         {
00323             could_be &= ~NUMERIC_LIST;
00324         }
00325 
00326         if (could_be == ASCII_LIST)
00327         {
00328             return ASCII_LIST;
00329         }
00330     }
00331     if (could_be & NUMERIC_LIST)
00332     {
00333         return NUMERIC_LIST;
00334     }
00335     else if (could_be & FLOAT_LIST)
00336     {
00337         return FLOAT_LIST;
00338     }
00339     else if (could_be & DBREF_LIST)
00340     {
00341         return DBREF_LIST;
00342     }
00343     return ASCII_LIST;
00344 }

static void centerjustcombo ( int  iType,
char *  buff,
char **  bufc,
char *  fargs[],
int  nfargs 
) [static]

Definition at line 6681 of file functions.cpp.

References ANSI_ENDGOAL_LEAK, ANSI_ENDGOAL_NORMAL, ANSI_String_Copy(), ANSI_String_Finalize(), ANSI_String_In_Init(), ANSI_String_Out_Init(), ANSI_String_Skip(), ANSI_TruncateToField(), CJC_CENTER, CJC_RJUST, is_integer(), LBUF_SIZE, mux_atol(), RemoveSetOfCharacters(), safe_copy_buf(), safe_fill(), safe_range, and SBUF_SIZE.

Referenced by FUNCTION().

06688 {
06689     // Width must be a number.
06690     //
06691     if (!is_integer(fargs[1], NULL))
06692     {
06693         return;
06694     }
06695     int width = mux_atol(fargs[1]);
06696     if (width <= 0 || LBUF_SIZE <= width)
06697     {
06698         safe_range(buff, bufc);
06699         return;
06700     }
06701 
06702     // Determine string to pad with.
06703     //
06704     int  vwPad = 0;
06705     int  nPad = -1;
06706     char aPad[SBUF_SIZE];
06707     struct ANSI_In_Context  aic;
06708     struct ANSI_Out_Context aoc;
06709     if (nfargs == 3 && *fargs[2])
06710     {
06711         char *p = RemoveSetOfCharacters(fargs[2], "\r\n\t");
06712         ANSI_String_In_Init(&aic, p, ANSI_ENDGOAL_NORMAL);
06713         ANSI_String_Out_Init(&aoc, aPad, sizeof(aPad), sizeof(aPad), ANSI_ENDGOAL_LEAK);
06714         ANSI_String_Copy(&aoc, &aic, sizeof(aPad));
06715         nPad =