tribble.net.ftp.shell
Class BuiltinFuncs

java.lang.Object
  extended by tribble.net.ftp.shell.BuiltinFuncs
All Implemented Interfaces:
CommandCodes

abstract class BuiltinFuncs
extends java.lang.Object
implements CommandCodes

FTP command interpreter built-in functions.

Since:
API 1.0, 2007-04-12
Version:
$Revision: 1.3 $ $Date: 2007/08/12 16:35:05 $
Author:
David R. Tribble (david@tribble.com).

Copyright ©2007 by David R. Tribble, all rights reserved.
Permission is granted to any person or entity except those designated by by the United States Department of State as a terrorist, or terrorist government or agency, to use and distribute this source code provided that the original copyright notice remains present and unaltered.

See Also:
Interp

Field Summary
(package private) static java.lang.String REV
          Revision information.
 
Fields inherited from interface tribble.net.ftp.shell.CommandCodes
CMD__UNDEF, CMD_ADD, CMD_AND, CMD_APPEND, CMD_BINARY, CMD_BLOCK, CMD_BREAK, CMD_BUILTIN, CMD_CALL, CMD_CDUP, CMD_CHDIR, CMD_CLOSE, CMD_CONCAT, CMD_COND, CMD_CONNECT, CMD_CONTINUE, CMD_DEBUG, CMD_DECR, CMD_DELETE, CMD_DIR, CMD_DIV, CMD_ECHO, CMD_EQ, CMD_EXEC, CMD_EXIT, CMD_FALSE, CMD_FILENAME, CMD_FOR, CMD_FOREACH, CMD_FUNC, CMD_FUNC_FORMAT, CMD_FUNC_INDEX, CMD_FUNC_LCASE, CMD_FUNC_LEN, CMD_FUNC_NORM, CMD_FUNC_REPL, CMD_FUNC_RINDEX, CMD_FUNC_SUB, CMD_FUNC_TRIM, CMD_FUNC_UCASE, CMD_GE, CMD_GET, CMD_GLOB, CMD_GOTO, CMD_GT, CMD_HELP, CMD_IF, CMD_INCR, CMD_LABEL, CMD_LCHDIR, CMD_LE, CMD_LOCAL, CMD_LT, CMD_MATCH, CMD_MGET, CMD_MKDIR, CMD_MOD, CMD_MPUT, CMD_MUL, CMD_NE, CMD_NEG, CMD_NMATCH, CMD_NO_N, CMD_NOP, CMD_NOT, CMD_OPEN, CMD_OR, CMD_POS, CMD_PRINT, CMD_PUT, CMD_PWD, CMD_READ, CMD_REMOTE, CMD_RENAME, CMD_REPEAT, CMD_RETURN, CMD_RMDIR, CMD_SET, CMD_SHELL, CMD_SLEEP, CMD_STATUS, CMD_STREQ, CMD_SUB, CMD_SUBSCR, CMD_SYSTEM, CMD_TEST, CMD_TEST_DIR, CMD_TEST_EXEC, CMD_TEST_EXISTS, CMD_TEST_FILE, CMD_TEST_MODTIME, CMD_TEST_READ, CMD_TEST_SIZE, CMD_TEST_WRITE, CMD_TEXT, CMD_TIMEOUT, CMD_TOK, CMD_TRUE, CMD_USER, CMD_VAR, CMD_WAITFOR, CMD_WHILE, CMD_WRITE, CMD_X_INTERRUPT, CMD_X_SESSIONS, CMD_X_STACK, CMD_X_STOP, CMD_X_VARS, CMD_X_VERBOSE, VAL_EMPTY, VAL_FALSE, VAL_FALSE_WD, VAL_ONE, VAL_TRUE, VAL_TRUE_WD, VAL_ZERO
 
Constructor Summary
BuiltinFuncs()
           
 
Method Summary
(package private) static java.lang.String funcIndex(java.lang.String sub, java.lang.String src)
          Evaluate built-in function expression index(sub,src).
(package private) static java.lang.String funcLen(java.lang.String src)
          Evaluate built-in function expression len(src).
(package private) static java.lang.String funcLowerCase(java.lang.String src)
          Evaluate built-in function expression lc(src).
(package private) static java.lang.String funcNorm(java.lang.String src)
          Evaluate built-in function expression norm(src).
(package private) static java.lang.String funcRepl(java.lang.String old, java.lang.String rep, java.lang.String src)
          Evaluate built-in function expression repl(old,rep,src).
(package private) static java.lang.String funcRindex(java.lang.String sub, java.lang.String s)
          Evaluate built-in function expression rindex(p,s).
(package private) static java.lang.String funcSubstr(java.lang.String src, int pos)
          Evaluate built-in function expression sub(src,pos).
(package private) static java.lang.String funcSubstr(java.lang.String src, int pos, int len)
          Evaluate built-in function expression sub(src,pos,len).
(package private) static java.lang.String funcTrim(java.lang.String s)
          Evaluate built-in function expression trim(s).
(package private) static java.lang.String funcUpperCase(java.lang.String src)
          Evaluate built-in function expression uc(src).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REV

static final java.lang.String REV
Revision information.

See Also:
Constant Field Values
Constructor Detail

BuiltinFuncs

BuiltinFuncs()
Method Detail

funcIndex

static java.lang.String funcIndex(java.lang.String sub,
                                  java.lang.String src)
Evaluate built-in function expression index(sub,src).

Format

(CMD_FUNC_INDEX, expr1, expr2)

Returns:
Index of the leftmost character within string s that matches sub, or zero (0) if the substring does not occur within the string.
Since:
1.1, 2007-04-12

funcLen

static java.lang.String funcLen(java.lang.String src)
Evaluate built-in function expression len(src).

Format

(CMD_FUNC_LEN, expr)

Returns:
Length of the string expr.
Since:
1.1, 2007-04-12

funcLowerCase

static java.lang.String funcLowerCase(java.lang.String src)
Evaluate built-in function expression lc(src).

Format

(CMD_FUNC_LCASE, expr)

Returns:
The string expr converted to all lower case.
Since:
1.2, 2007-05-04

funcNorm

static java.lang.String funcNorm(java.lang.String src)
Evaluate built-in function expression norm(src).

Format

(CMD_FUNC_NORM, expr1)

Returns:
String src as a normalized native filename.
Since:
1.1, 2007-04-12

funcRepl

static java.lang.String funcRepl(java.lang.String old,
                                 java.lang.String rep,
                                 java.lang.String src)
Evaluate built-in function expression repl(old,rep,src).

Format

(CMD_FUNC_REPL, expr1, expr2, expr3)

Returns:
String src with the first (leftmost) occurrence of substring old replaced with substring rep.
Since:
1.1, 2007-04-12

funcRindex

static java.lang.String funcRindex(java.lang.String sub,
                                   java.lang.String s)
Evaluate built-in function expression rindex(p,s).

Format

(CMD_FUNC_RINDEX, expr1, expr2)

Returns:
Index of the rightmost character within string s that matches sub, or zero (0) if the substring does not occur within the string.
Since:
1.1, 2007-04-12

funcSubstr

static java.lang.String funcSubstr(java.lang.String src,
                                   int pos)
Evaluate built-in function expression sub(src,pos).

Format

(CMD_FUNC_SUB, expr1, expr2)

Returns:
Substring of src starting at position pos up to the end of the string. Note that the leftmost character is at position 1. If pos is negative, the substring is extracted from the right side of src.
Since:
1.1, 2007-04-12

funcSubstr

static java.lang.String funcSubstr(java.lang.String src,
                                   int pos,
                                   int len)
Evaluate built-in function expression sub(src,pos,len).

Format

(CMD_FUNC_SUB, expr1, expr2, expr3)

Returns:
Substring of src starting at position pos for len characters. Note that the leftmost character is at position 1. If pos is negative, the substring is extracted from the right side of src. If len is less than 1, an empty string ('') is returned.
Since:
1.1, 2007-04-12

funcTrim

static java.lang.String funcTrim(java.lang.String s)
Evaluate built-in function expression trim(s).

Format

(CMD_FUNC_TRIM, expr)

Returns:
String expr, stripped of all leading and trailing spaces and control characters.
Since:
1.1, 2007-04-12

funcUpperCase

static java.lang.String funcUpperCase(java.lang.String src)
Evaluate built-in function expression uc(src).

Format

(CMD_FUNC_UCASE, expr)

Returns:
The string expr converted to all upper case.
Since:
1.2, 2007-05-04