/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*+. Fridge/Shell readme version 0.1.1                               .+*
*+. Copyright (C) 2006 K.Tsuchiya all rights reserved.            .+*
*+. mail:info at fridge.ddo.jp                                    .+*
*+. homepage:http://fridge.ddo.jp                                 .+*
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#####################################################################
#                                                                   #
#                         change log                                #
#                                                                   #
#####################################################################
--2006/10/20 updated direct I/O(in library)
--2006/10/19 updated communication(in library)
--2006/10/13 erratum correction(in library)
--2006/10/10 added "list" (in tutorial)


#####################################################################
#                                                                   #
#                         what's fridge?                            #
#                                                                   #
#####################################################################
Fridge is open source software.It is a programing language.

   usage)
   $fridge [option(s)] <fg-file> [argment(s)] ...
    option(s):
        -l <path>:adding library path.
        --version:displaying version.
        --help:displaying usage.


#####################################################################
#                                                                   #
#                            tutorial                               #
#                                                                   #
#####################################################################
*+.fridge tutorial
-- 0.installation
-- 1.constant
-- 2.operator
-- 3.variable
-- 4.block
-- 5.if
-- 6.while
-- 7.for
-- 8.object define
-- 9.break,continue,return


*+.0.installation------
Instllation fridge/shell into your system.

*+.linux
# tar -xjf fridge.tar.bz2
# cd ./fridge/src
# make linux
# make install

*+.cygwin
# tar -xjf fridge.tar.bz2
# cd ./fridge/src
# make cygwin
# make install

Default install directory is /usr/local/fridge.


*+.1.constant------
Fridge has constant of three kind type.
1.1.integer type
ex.) a=256
ex.) a=0xffff

1.2.floating point type
ex.) b=226.124

1.3.character string type
ex.) c="abcdefgh"
ex.) c='abcdefgh'
ex.) c="""abcdefgh"""
ex.) c=,abcdefgh


*+.2.operator------
On fridge,you can use oprators as follows.
2.1 assign
ex.)a = b

2.2 pow eq
ex.)a **=b

2.3 mul eq
ex.) a *= b

2.4 div eq
ex.) a /= b

2.5 mod eq
ex.) a %= b

2.6 add eq
ex.) a += b

2.7 sub eq
ex.) a -= b

2.8 left shift eq
ex.) a <<= b

2.9 right shift eq
ex.) a >>= b

2.10 and eq
ex.) a &= b

2.11 or eq
ex.) a |= b

2.12 xor eq
ex.) a ^= b

2.13 log or
ex.) a || b

2.14 log and
ex.) a && b

2.15 or
ex.) a | b

2.16 xor
ex.) a ^ b

2.17 and
ex.) a & b

2.18 equal
ex.) a == b

2.19 not equal
ex.) a != b

2.20 less
ex.) a < b

2.21 great
ex.) a > b

2.22 less eq
ex.) a <= b

2.23 great eq
ex.) a >= b

2.24 left shift
ex.) a << b

2.25 right shift
ex.) a >> b

2.26 add
ex.) a + b

2.27 sub
ex.) a - b

2.28 mul
ex.) a * b

2.29 div
ex.) a / b

2.30 mod
ex.) a % b

2.31 pow
ex.) a ** b

2.32 not
ex.) ! b

2.33 bit not
ex.) ~ b

2.34 minus
ex.) _a

2.35 increment
ex.) ++a

2.36 decrement
ex.) --a


*+.3.variable------
If object name is undefined in system,you can use it as a variable.
3.1 scalar
ex.) a=100.

3.2 array
ex.) a[3]="abcd"
ex.) a["abc"]=123

3.3 sub object
ex.) a.b=3.1412

3.4 super object
ex.) a=10
ex.) def x echo super.a


*+.4.block------
On fridge,block's beginning is ':',block's end is '.'.
And endline is '..' or '\n'.
ex.) while a<10 : ++a ...
ex.) if a!=4 : a=3
ex.) .


*+.5.if ------
If condition is true,the control goes into A.
If it is false, the control goes into B.
ex.) if a==10 A
ex.) else B


*+.6.while ------
While condition is true ,the control is repeated.
ex.)while x!=100 ++x


*+.7.for ------
The for is equal to "for(i=0;i<max;i++)" in C-Language.
ex.) for i in max echo arg[i]


*+.8.object define ------
You can define a arbitrariness object.
ex.)def x :
ex.) for i in arg.size :
ex.) echo arg[i]...
ex.) ...
ex.)x "abc" 123 34.56


*+.9.break,continue,return ------
9.1 Loop break
ex.)for i in 1000 :
ex.) if arr[i]==foo break...

9.2 Loop continuing
ex.)for i in 1000 :
ex.) if arr[i]!=foo continue
ex.) break...

9.3 Returning to the super object
ex.) def foo return arg[0]+arg[1]


*+.10.list ------
"x{data1 data2 ...}" is "x[0]=data1","x[1]=data2"...
ex.)list{10 20 30 40 50}
ex.)for i in list.size echo list[i]


#####################################################################
#                                                                   #
#                            library                                #
#                                                                   #
#####################################################################
*+.Fridge/shell standard library
You can use these object without declaration.

$access to device / 1
1.1 open
define) open <filename> [mode] [outvar]
<filename> :It open this file name.
[mode]     :"w"|"r"|"a"(write | read | append)
[outvar]   :The output object.

This open the device.If error,It return a value of under zero.
In normality,It return the file descriptor.

1.2 close
define) close <fd>
<fd>    :It close the file descriptor.

This close the device.

1.3 write
define) write <fd><value>
<fd>    :It write to the file descriptor.
<value> :It write the value.

This write the value to the device.

1.4 read
define) read <fd>[outvar]
<fd>     :It read from the file descriptor.
[outvar] :The output object.

This read all data from the device.

1.5 readln
define) readln <fd>[outvar]
<fd>     :It read from the file descriptor.
[outvar] :The output object.
If the output object type is integer or floating point, 
it read a binary data.
If the output object type is character string, 
it read a text of one line from the device.

$access to pipeline / 2
2.1 pwrite
define) pwrite <command><value>
<command> :It write to this command.
<value>   :It write the value.

This write the value to the command.

2.2 pread
define) read <fd>[outvar]
<fd>     :It read from this command.
[outvar] :The output object.

This read all data from the command.

$operation to character string / 3
3.1 split
define) split <strval>[delimiter]
<strval>     :It split this string.
[delimiter]  :The delimiters.

The character string is split to tokens. 
The type of return object is array.

3.2 slice
define) slice <strval><index>[offset] [outvar]
<strval> :It slice this string.
<index>  :The index of character for slicing.
[offset] :The offset from the index.
[outvar] :The output object.

The character string is sliced from the index to the offset.

3.3 replace
define) replace <strval><after>[index] [offset]
<strval> :It replace this string.
<after>  :The value after the replacing.
[index]  :The index of character for replace.
[offset] :The offset from index.

The character string is replaced the from index to the offset.

$operation to character string with regular expression / 4
4.1 match
define) match <strval><regex>[flag] [outvar]
<strval> :The character string.
<regex>  :The regular expression.
[flag]   :"g"|"i"(global | icase).
[outvar] :The output object.

It find the index of character from the character string. 
If you direct flag "g",It return a array. 
If not found,it return under zero. In else case,
it return a index and a subobject that is offset.

4.2 rslice
define) rslice <strval><regex>[flag] [outvar]
<strval> :The character string.
<regex>  :The regular expression.
[flag]   :"g"|"i"(global | icase).
[outvar] :The output object.

The character string is sliced with regular expression, 
it return the match character string.

4.3 rreplace
define) rreplace <strval><regex><after>[flag]
<strval> :The character string.
<regex>  :The regular expression.
<after>  :The value after the replacing.
[flag]   :"g"|"i"(global | icase).

The match character string is replaced.

$system / 5
5.1 sys
define) sys <command>
<command>       :The command character string.

The command is thrown to the system.

5.2 echo
define) echo <val>
<val>   :The value.

The value is displayed to the standard output device. 

$communication / 6
6.1 call
define) call <command>[outvar] [timeout]
<command>       :The command character string.
[outvar]        :The output object.
[timeout]       :Specification of timeout.

Making connection to standard I/O of child process.
It return the file descriptor and the process ID.
The process ID is into "pid" element.

6.2 talk
define) talk <fd><inbuf><outbuf>
<fd>     :The file descriptor.
<inbuf>  :The input obuject to fd.
<outbuf> :The output object from fd.

Inputting the value to the file descriptor and getting output from it.


$direct I/O / 7
7.1 dwrite
define) dwrite <filename><value>
<filename> :It write to this filename.
<value>    :It write the value.

This write the value to the device.

7.2 dappend
define) dappend <filename><value>
<filename> :It write to this filename.
<value>    :It write the value.

This append the value to the device.

7.3 dread
define) dread <filename>[outvar]
<filename>  :It read from this filename.
[outvar]    :The output object.

This read all data from the device.

#endfile

