Просмотр исходного кода

отладил модуль математики, обновил дампы, более простая система имен.

kpmy 10 лет назад
Родитель
Сommit
d052452f68

BIN
code/Console.oz







BIN
code/TestA0.oz


BIN
code/TestA1.oz


BIN
code/TestA2.oz


BIN
code/TestMath.oz


BIN
code/TestStrings.oz


BIN
code/XevConsole.oz


BIN
code/XevCore.oz


BIN
code/XevDemo0.oz


BIN
code/XevDemo1.oz


BIN
code/XevDemo10.oz


BIN
code/XevDemo11.oz


BIN
code/XevDemo12.oz


BIN
code/XevDemo14.oz


BIN
code/XevDemo15.oz


BIN
code/XevDemo16.oz


BIN
code/XevDemo17.oz


BIN
code/XevDemo18.oz


BIN
code/XevDemo19.oz


BIN
code/XevDemo21.oz


BIN
code/XevDemo3.oz


BIN
code/XevDemo5.oz


BIN
code/XevDemo6.oz


BIN
code/XevDemo8.oz


BIN
code/XevDemo9.oz


BIN
code/XevInit.oz


BIN
code/XevLog.oz


BIN
code/XevMath.oz


BIN
code/XevStrings.oz


BIN
code/XevTest0.oz


BIN
code/XevTest1.oz


BIN
code/XevTest2.oz


BIN
code/XevTestMath.oz


BIN
code/XevTestStrings.oz


BIN
code/XevXLog.oz


+ 1 - 1
fw.go

@@ -33,7 +33,7 @@ func close() {
 func main() {
 func main() {
 	flag.Parse()
 	flag.Parse()
 	if name == "" {
 	if name == "" {
-		name = "XevInit"
+		name = "Start"
 		utils.Debug(false)
 		utils.Debug(false)
 	}
 	}
 	global := &stdDomain{god: true}
 	global := &stdDomain{god: true}

+ 2 - 2
fw_test_all.bat

@@ -23,5 +23,5 @@ start fw_test XevDemo20
 start fw_test XevDemo21
 start fw_test XevDemo21
 start fw_test XevDemo22
 start fw_test XevDemo22
 
 
-start fw_test XevTest0
-start fw_test XevInit
+start fw_test TestA0
+start fw_test Start

+ 3 - 6
rt2/rules/call.go

@@ -15,10 +15,10 @@ import (
 	"fw/rt2/scope"
 	"fw/rt2/scope"
 	"fw/utils"
 	"fw/utils"
 	"math"
 	"math"
-	"math/big"
 	"reflect"
 	"reflect"
 	"ypk/assert"
 	"ypk/assert"
 	"ypk/halt"
 	"ypk/halt"
+	"ypk/mathe"
 )
 )
 
 
 /**
 /**
@@ -138,15 +138,12 @@ func go_math(f frame.Frame, par node.Node) (seq frame.Sequence, ret frame.WAIT)
 		case LN:
 		case LN:
 			res = math.Log(rv[1])
 			res = math.Log(rv[1])
 		case MANT:
 		case MANT:
-			_ = big.NewRat(1, 1).SetFloat64(rv[1])
-			panic(0)
+			res, _ = mathe.Me(rv[1])
 		case EXP:
 		case EXP:
-			me(rv[1])
-			panic(0)
+			_, res = mathe.Me(rv[1])
 		default:
 		default:
 			halt.As(100, rv[0])
 			halt.As(100, rv[0])
 		}
 		}
-		fmt.Println(rv)
 	default:
 	default:
 		halt.As(100, reflect.TypeOf(p))
 		halt.As(100, reflect.TypeOf(p))
 	}
 	}

+ 30 - 0
rt2/scope/modern/val.go

@@ -782,6 +782,13 @@ func (o *ops) Sub(a, b scope.Value) scope.Value {
 				default:
 				default:
 					panic(fmt.Sprintln(reflect.TypeOf(y)))
 					panic(fmt.Sprintln(reflect.TypeOf(y)))
 				}
 				}
+			case REAL:
+				switch y := b.(type) {
+				case REAL:
+					return REAL(x - y)
+				default:
+					panic(fmt.Sprintln(reflect.TypeOf(y)))
+				}
 			case LONGINT:
 			case LONGINT:
 				switch y := b.(type) {
 				switch y := b.(type) {
 				case LONGINT:
 				case LONGINT:
@@ -1274,6 +1281,8 @@ func (o *ops) Conv(a scope.Value, typ object.Type, comp ...object.ComplexType) s
 			return o.Conv(vfrom(x), typ)
 			return o.Conv(vfrom(x), typ)
 		case LONGINT:
 		case LONGINT:
 			return CHAR(rune(x))
 			return CHAR(rune(x))
+		case INTEGER:
+			return CHAR(rune(x))
 		default:
 		default:
 			halt.As(100, reflect.TypeOf(x))
 			halt.As(100, reflect.TypeOf(x))
 		}
 		}
@@ -1441,6 +1450,13 @@ func (o *ops) Neq(a, b scope.Value) scope.Value {
 				default:
 				default:
 					panic(fmt.Sprintln(reflect.TypeOf(y)))
 					panic(fmt.Sprintln(reflect.TypeOf(y)))
 				}
 				}
+			case REAL:
+				switch y := b.(type) {
+				case REAL:
+					return BOOLEAN(x != y)
+				default:
+					panic(fmt.Sprintln(reflect.TypeOf(y)))
+				}
 			case LONGINT:
 			case LONGINT:
 				switch y := b.(type) {
 				switch y := b.(type) {
 				case LONGINT:
 				case LONGINT:
@@ -1494,6 +1510,13 @@ func (o *ops) Lss(a, b scope.Value) scope.Value {
 				default:
 				default:
 					panic(fmt.Sprintln(reflect.TypeOf(y)))
 					panic(fmt.Sprintln(reflect.TypeOf(y)))
 				}
 				}
+			case REAL:
+				switch y := b.(type) {
+				case REAL:
+					return BOOLEAN(x < y)
+				default:
+					panic(fmt.Sprintln(reflect.TypeOf(y)))
+				}
 			case LONGINT:
 			case LONGINT:
 				switch y := b.(type) {
 				switch y := b.(type) {
 				case LONGINT:
 				case LONGINT:
@@ -1598,6 +1621,13 @@ func (o *ops) Geq(a, b scope.Value) scope.Value {
 				default:
 				default:
 					panic(fmt.Sprintln(reflect.TypeOf(y)))
 					panic(fmt.Sprintln(reflect.TypeOf(y)))
 				}
 				}
+			case REAL:
+				switch y := b.(type) {
+				case REAL:
+					return BOOLEAN(x >= y)
+				default:
+					panic(fmt.Sprintln(reflect.TypeOf(y)))
+				}
 			default:
 			default:
 				panic(fmt.Sprintln(reflect.TypeOf(x)))
 				panic(fmt.Sprintln(reflect.TypeOf(x)))
 			}
 			}

+ 2 - 1
xev/cmds.go

@@ -2,6 +2,7 @@ package xev
 
 
 import (
 import (
 	"archive/zip"
 	"archive/zip"
+	"fmt"
 	"fw/cp/module"
 	"fw/cp/module"
 	"io"
 	"io"
 	"path/filepath"
 	"path/filepath"
@@ -11,7 +12,7 @@ import (
 const CODE = "code"
 const CODE = "code"
 
 
 func Load(path, name string) (ret *module.Module) {
 func Load(path, name string) (ret *module.Module) {
-	//fmt.Println(path + ` ` + name)
+	fmt.Println(path + ` ` + name)
 	//var data []byte
 	//var data []byte
 	var rd io.Reader
 	var rd io.Reader
 	r, err := zip.OpenReader(filepath.Join(path, CODE, name))
 	r, err := zip.OpenReader(filepath.Join(path, CODE, name))