[BACK]Return to string.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-doc / parts / builtin

Annotation of OpenXM/src/asir-doc/parts/builtin/string.texi, Revision 1.4

1.4     ! noro        1: @comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/string.texi,v 1.3 1999/12/21 02:47:34 noro Exp $
1.3       noro        2: \BJP
1.1       noro        3: @node $BJ8;zNs$K4X$9$k1i;;(B,,, $BAH$_9~$_H!?t(B
                      4: @section $BJ8;zNs$K4X$9$k1i;;(B
1.3       noro        5: \E
                      6: \BEG
                      7: @node Strings,,, Built-in Function
                      8: @section Strings
                      9: \E
1.1       noro       10:
                     11: @menu
                     12: * rtostr::
                     13: * strtov::
1.2       noro       14: * eval_str::
1.4     ! noro       15: * strtoascii asciitostr::
1.1       noro       16: @end menu
                     17:
1.3       noro       18: \JP @node rtostr,,, $BJ8;zNs$K4X$9$k1i;;(B
                     19: \EG @node rtostr,,, Strings
1.1       noro       20: @subsection @code{rtostr}
                     21: @findex rtostr
                     22:
                     23: @table @t
                     24: @item rtostr(@var{obj})
1.3       noro       25: \JP :: @var{obj} $B$rJ8;zNs$KJQ$($k(B.
                     26: \EG :: Convert @var{obj} into a string.
1.1       noro       27: @end table
                     28:
                     29: @table @var
                     30: @item return
1.3       noro       31: \JP $BJ8;zNs(B
                     32: \EG string
1.1       noro       33: @item obj
1.3       noro       34: \JP $BG$0U(B
                     35: \EG arbitrary
1.1       noro       36: @end table
                     37:
                     38: @itemize @bullet
1.3       noro       39: \BJP
1.1       noro       40: @item
                     41: $BG$0U$N%*%V%8%'%/%H(B @var{obj} $B$rJ8;zNs$KJQ$($k(B.
                     42: @item
                     43: $B@0?t$J$I$rJ8;zNs$KJQ49$7$FJQ?tL>$H7k9g$9$k$3$H$K$h$j(B,
                     44: $BE:;zIU$-$NITDj85$r@8@.$9$k>l9g$KB?$/MQ$$$i$l$k(B.
                     45: @item
                     46: $B5U$K(B, $BJ8;zNs$rITDj85$KJQ49$9$k;~$K$O(B, @code{strtov} $B$rMQ$$$k(B.
1.3       noro       47: \E
                     48: \BEG
                     49: @item
                     50: Convert an arbitrary object @var{obj} into a string.
                     51: @item
                     52: This function is convenient to create variables with numbered
                     53: (or indexed) names by converting integers into strings and appending them
                     54: to some name strings.
                     55: @item
                     56: Use @code{strtov()} for inverse conversion from string to indeterminate.
                     57: \E
1.1       noro       58: @end itemize
                     59:
                     60: @example
                     61: [0] A=afo;
                     62: afo
                     63: [1] type(A);
                     64: 2
                     65: [2] B=rtostr(A);
                     66: afo
                     67: [3] type(B);
                     68: 7
                     69: [4] B+"1";
                     70: afo1
                     71: @end example
                     72:
                     73: @table @t
1.3       noro       74: \JP @item $B;2>H(B
                     75: \EG @item References
1.1       noro       76: @fref{strtov}, @fref{type}.
                     77: @end table
                     78:
1.3       noro       79: \JP @node strtov,,, $BJ8;zNs$K4X$9$k1i;;(B
                     80: \EG @node strtov,,, Strings
1.1       noro       81: @subsection @code{strtov}
                     82: @findex strtov
                     83:
                     84: @table @t
                     85: @item strtov(@var{str})
1.3       noro       86: \JP :: @var{str} ($BJ8;zNs(B) $B$rITDj85$KJQ$($k(B.
                     87: \EG :: Convert a string @var{str} into an indeterminate.
1.1       noro       88: @end table
                     89:
                     90: @table @var
                     91: @item return
1.3       noro       92: \JP $BITDj85(B
                     93: \EG intederminate
1.1       noro       94: @item str
1.3       noro       95: \JP $BITDj85$H$7$FJQ492DG=$JJ8;zNs(B
                     96: \EG string which is valid to constitute an indeterminate.
1.1       noro       97: @end table
                     98:
                     99: @itemize @bullet
1.3       noro      100: \BJP
1.1       noro      101: @item
                    102: $BITDj85$H$7$FJQ492DG=$JJ8;zNs$rITDj85$KJQ$($k(B.
                    103: @item
                    104: $BITDj85$H$7$FJQ492DG=$JJ8;zNs$H$O(B, $B1Q>.J8;z$G;O$^$j(B,
                    105: $B1Q;z(B, $B?t;z$*$h$S5-9f(B @code{_} $B$G:n$i$l$kJ8;zNs$G$"$k(B.
                    106: @item
                    107: @code{rtostr()} $B$HAH9g$;$F(B, $B%W%m%0%i%`Cf$G<+F0E*$KITDj85$r@8@.$7$?$$;~$K(B
                    108: $BMQ$$$i$l$k(B.
1.3       noro      109: \E
                    110: \BEG
                    111: @item
                    112: Convert a string that is valid for an indeterminate into an indeterminate
                    113: which have @var{str} as its print name.
                    114: @item
                    115: The valid string for an indeterminate is such a string that begins
                    116: with a small alphabetical letter possibly followed by any string composed
                    117: of alphabetical letters, digits or a symbol @samp{_}.
                    118: @item
                    119: Use the command to create indeterminates dynamically in programs.
                    120: \E
1.1       noro      121: @end itemize
                    122:
                    123: @example
                    124: [0] A="afo";
                    125: afo
                    126: [1] for (I=0;I<3;I++) @{B=strtov(A+rtostr(I)); print([B,type(B)]);@}
                    127: [afo0,2]
                    128: [afo1,2]
                    129: [afo2,2]
                    130: @end example
                    131:
                    132: @table @t
1.3       noro      133: \JP @item $B;2>H(B
                    134: \EG @item References
1.1       noro      135: @fref{rtostr}, @fref{type}, @fref{uc}.
1.2       noro      136: @end table
                    137:
1.3       noro      138: \JP @node eval_str,,, $BJ8;zNs$K4X$9$k1i;;(B
                    139: \EG @node eval_str,,, Strings
1.2       noro      140: @subsection @code{eval_str}
                    141: @findex eval_str
                    142:
                    143: @table @t
                    144: @item eval_str(@var{str})
1.3       noro      145: \JP :: @var{str} ($BJ8;zNs(B) $B$rI>2A$9$k(B.
                    146: \EG :: Evaluates a string @var{str}.
1.2       noro      147: @end table
                    148:
                    149: @table @var
                    150: @item return
1.3       noro      151: \JP $B%*%V%8%'%/%H(B
                    152: \EG object
1.2       noro      153: @item str
1.3       noro      154: \JP @b{Asir} $B$N(B parser $B$,<uM}2DG=$JJ8;zNs(B
                    155: \EG string which can be accepted by @b{Asir} parser
1.2       noro      156: @end table
                    157:
                    158: @itemize @bullet
1.3       noro      159: \BJP
1.2       noro      160: @item
                    161: @b{Asir} $B$N(B parser $B$,<uM}2DG=$JJ8;zNs$rI>2A$7$F$=$N7k2L$rJV$9(B.
                    162: @item
                    163: $BI>2A2DG=$JJ8;zNs$O(B, $B<0$rI=$9$b$N$K8B$k(B.
                    164: @item
                    165: $BO@M}E*$K$O(B @code{rtostr()} $B$N5U4X?t$H$J$k(B.
1.3       noro      166: \E
                    167: \BEG
                    168: @item
                    169: This function evaluates a string which can be accepted by @b{Asir} parser
                    170: and returns the result.
                    171: @item
                    172: The input string should represent an expression.
                    173: @item
                    174: This functions is the inversion function of @code{rtostr()}.
                    175: \E
1.2       noro      176: @end itemize
                    177:
                    178: @example
                    179: [0] eval_str("1+2");
                    180: 3
                    181: [1] fctr(eval_str(rtostr((x+y)^10)));
                    182: [[1,1],[x+y,10]]
                    183: @end example
                    184:
                    185: @table @t
1.3       noro      186: \JP @item $B;2>H(B
                    187: \EG @item References
1.2       noro      188: @fref{rtostr}
1.1       noro      189: @end table
                    190:
1.4     ! noro      191: \JP @node strtoascii asciitostr,,, $BJ8;zNs$K4X$9$k1i;;(B
        !           192: \EG @node strtoascii asciitostr,,, Strings
        !           193: @subsection @code{strtoascii}, @code{asciitostr}
        !           194: @findex strtoascii
        !           195: @findex asciitostr
        !           196:
        !           197: @table @t
        !           198: @item strtoascii(@var{str})
        !           199: \JP :: $BJ8;zNs$r%"%9%-!<%3!<%I$GI=$9(B.
        !           200: \EG :: Converts a string into a sequence of ASCII codes.
        !           201: @item asciitostr(@var{list})
        !           202: \JP :: $B%"%9%-!<%3!<%I$NNs$rJ8;zNs$KJQ49$9$k(B.
        !           203: \EG :: Converts a sequence of ASCII codes into a string.
        !           204: @end table
        !           205:
        !           206: @table @var
        !           207: @item return
        !           208: \JP @code{strtoascii()}:$B%j%9%H(B; @code{asciitostr()}:$BJ8;zNs(B
        !           209: \EG @code{strtoascii()}:list; @code{asciitostr()}:string
        !           210: @item str
        !           211: \JP $BJ8;zNs(B
        !           212: \EG string
        !           213: @item list
        !           214: \JP 1 $B0J>e(B 256 $BL$K~$N@0?t$+$i$J$k%j%9%H(B
        !           215: \EG list containing positive integers less than 256.
        !           216: @end table
        !           217:
        !           218: @itemize @bullet
        !           219: \BJP
        !           220: @item
        !           221: @code{strtoascii()} $B$OJ8;zNs$r@0?t$N%j%9%H$KJQ49$9$k(B. $B3F(B
        !           222: $B@0?t$OJ8;zNs$N%"%9%-!<%3!<%I$rI=$9(B.
        !           223: @item
        !           224: @code{asciitostr()} $B$O(B @code{asciitostr()} $B$N5U4X?t$G$"$k(B.
        !           225: \E
        !           226: \BEG
        !           227: @item
        !           228: @code{strtoascii()} converts a string into a list of integers
        !           229: which is a representation of the string by the ASCII code.
        !           230: @item
        !           231: @code{asciitostr()} is the inverse of @code{asciitostr()}.
        !           232: \E
        !           233: @end itemize
        !           234:
        !           235: @example
        !           236: [0] strtoascii("abcxyz");
        !           237: [97,98,99,120,121,122]
        !           238: [1] asciitostr(@@);
        !           239: abcxyz
        !           240: [2] asciitostr([256]);
        !           241: asciitostr : argument out of range
        !           242: return to toplevel
        !           243: @end example

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>