OberonCore

Библиотека  Wiki  Форум  BlackBox  Компоненты  Проекты
Текущее время: Четверг, 28 Март, 2024 17:11

Часовой пояс: UTC + 3 часа




Начать новую тему Ответить на тему  [ Сообщений: 10 ] 
Автор Сообщение
 Заголовок сообщения: Using BB 1.6 for shkola (with code page)
СообщениеДобавлено: Воскресенье, 15 Сентябрь, 2013 22:17 

Зарегистрирован: Суббота, 24 Август, 2013 08:57
Сообщения: 81
If I merge Unicode.odc with National.odc and reduce the result to the necessary functions then I can use BB 1.6 for shkola like the Russian version of BB 1.5

The result is

Код:
DEFINITION Unicode;

   PROCEDURE IsLetter (ch: CHAR): BOOLEAN; (* Is it a letter? *)
   PROCEDURE IsCap (ch: CHAR): BOOLEAN; (* Is it a capital letter? *)
   PROCEDURE IsLow (ch: CHAR): BOOLEAN; (* Is it a lower letter? *)

   PROCEDURE IsFirstIdentChar (ch: CHAR): BOOLEAN; (* Is it a first ident character? *)
   PROCEDURE IsIdentChar (ch: CHAR): BOOLEAN; (* Is it a ident character? *)

   PROCEDURE Cap (ch: CHAR): CHAR; (* convert letter to upper case *)
   PROCEDURE Low (ch: CHAR): CHAR; (* convert letter to lower case *)

   PROCEDURE Long (ch: SHORTCHAR): CHAR; (* convert to Unicode *)
   PROCEDURE Short (ch: CHAR): SHORTCHAR; (* convert to ASCII code page *)

END Unicode.


This centralise all necessary changes into one new module called Unicode. The implementation is

Код:
MODULE Unicode;

   PROCEDURE IsCap* (ch: CHAR): BOOLEAN;
   BEGIN
      RETURN (ch >= "A") & (ch <= "Z")
      (* Unicode *)
      OR (ch >= 0C0X) & (ch # 0D7X) & (ch <= 0DEX)   
      OR (ch >= 0410X) & (ch <= 042FX)
      OR (ch = 0401X)
      [color=#FF00FF](* Win1251 *)
      OR (ch >= 0C0X) & (ch <= 0DFX)
      OR (ch = 0A8X))[/color]
   END IsCap;

   PROCEDURE IsLow* (ch: CHAR): BOOLEAN;
   BEGIN
      RETURN (ch >= "a") & (ch <= "z")
      (* Unicode *)
      OR (ch >= 0E0X) & (ch # 0F7X) & (ch <= 0FEX)
      OR (ch >= 0430X) & (ch <= 044FX)
      OR (ch = 0451X)
      [color=#FF00FF](* Win1251 *)
      OR (ch >= 0E0X) & (ch <= 0FFX)
      OR (ch = 0B8X))[/color]
   END IsLow;

   PROCEDURE IsLetter* (ch: CHAR): BOOLEAN;
   BEGIN
      RETURN IsCap(ch) OR IsLow(ch) OR (ch = 'ß')
   END IsLetter;

   PROCEDURE IsFirstIdentChar* (ch: CHAR): BOOLEAN;
   BEGIN
      RETURN  IsLetter(ch) OR (ch = "_")
   END IsFirstIdentChar;

   PROCEDURE IsIdentChar* (ch: CHAR): BOOLEAN;
   BEGIN
      RETURN  IsFirstIdentChar(ch) OR ("0" <= ch) & (ch <= "9")
   END IsIdentChar;

   PROCEDURE Cap* (ch: CHAR): CHAR;
   BEGIN
      IF IsLow(ch) THEN
         IF ch = "ё" THEN ch := "Ё" ELSE ch := CHR(ORD(ch) - 32) END
      END;
      RETURN ch
   END Cap;

   PROCEDURE Low* (ch: CHAR): CHAR;
   BEGIN
      IF IsCap(ch) THEN
         IF ch = "Ё" THEN ch := "ё" ELSE ch := CHR(ORD(ch) + 32) END
      END;
      RETURN ch
   END Low;

   PROCEDURE Long* (ch: SHORTCHAR): CHAR;
   BEGIN
      [color=#FF00FF](* ConvertToUnicode from Win1251 *)
      IF ch = 0B8X THEN RETURN 0451X
      ELSIF ch = 0A8X THEN RETURN 0401X
      ELSIF (ch >= 0C0X) & (ch <= 0FFX) THEN RETURN CHR(ORD(ch) + 0350H) END;)[/color]
      RETURN ch
   END Long;

   PROCEDURE Short* (ch: CHAR): SHORTCHAR;
   BEGIN
      [color=#FF00FF](* ConvertFromUnicode to Win1251 *)
      IF ch = 0451X THEN RETURN 0B8X
      ELSIF ch = 0401X THEN RETURN 0A8X
      ELSIF (ch >= 0410X) & (ch <= 044FX) THEN RETURN SHORT(CHR(ORD(ch) - 0350H)) END;) [/color]
      IF ch >= 100X THEN RETURN "?" ELSE RETURN SHORT(ch) END;
   END Short;

END Unicode.


By using the red line BB 1.6 works like the BB1.5 Russian version
By deleting the red line it works like the original BB 1.6

All other changes are descript in viewtopic.php?f=126&t=4468
Just subsitute National to Unicode.
And the changes descript in viewtopic.php?f=126&t=4487
is the missing gap. Without it, it doesn't work.

I have this changes running. Should I mark the changed files with "B18 centralise Unicode functions" ?


Вернуться к началу
 Профиль  
 
 Заголовок сообщения: Re: Using BB 1.6 for shkola (with code page)
СообщениеДобавлено: Понедельник, 16 Сентябрь, 2013 21:05 
Модератор
Аватара пользователя

Зарегистрирован: Среда, 16 Ноябрь, 2005 00:53
Сообщения: 4625
Откуда: Россия, Орёл
Zinn писал(а):
If I merge Unicode.odc with National.odc and reduce the result to the necessary functions then I can use BB 1.6 for shkola like the Russian version of BB 1.5
Helmut, Im don't understand the goal... Do you want to "move" 'BB for shkola' assembly from 1.5 to 1.6? This question is in the area of Informatika-21 project & Fyodor Tkachev. (As far as I know, there is no such plan for 'BB for shkola' assembly in the near future.)

Zinn писал(а):
I have this changes running. Should I mark the changed files with "B18 centralise Unicode functions" ?
For what assembly? If you mean OberonCore assembly, there is no module National nor module Unicode in Standard BlackBox...


Вернуться к началу
 Профиль  
 
 Заголовок сообщения: Re: Using BB 1.6 for shkola (with code page)
СообщениеДобавлено: Вторник, 17 Сентябрь, 2013 06:39 
Аватара пользователя

Зарегистрирован: Пятница, 25 Ноябрь, 2005 12:02
Сообщения: 8500
Откуда: Троицк, Москва
Евгений Темиргалеев писал(а):
(As far as I know, there is no such plan for 'BB for shkola' assembly in the near future.)
The school system (teachers and kids) is too tricky to run any risks.
And I am too busy to play with software that has not stabilized yet.

So, I don't want to port my 'BB for shkola' to 1.6 until a completely stable and debugged final BlackBox 1.6 emerges.

There is no rush anyway.


Вернуться к началу
 Профиль  
 
 Заголовок сообщения: Re: Using BB 1.6 for shkola (with code page)
СообщениеДобавлено: Среда, 18 Сентябрь, 2013 09:10 

Зарегистрирован: Суббота, 24 Август, 2013 08:57
Сообщения: 81
I’m sorry, you did not understand me. Maybe I use the wrong words. My aim is not to develop the shkola version. My aim is to create a stable core version which is useable without pain. The transfer from BB 1.5 to BB 1.6 was not done there because their programs does not run on BB 1.6. They try to create a modify version of 1.6 which was not successful, because the symbol file and the code file does not accept Unicode. Here I have a solution, where only one file (System/Mod/Unicode.odc) must be change. (instead of 20 files) to switch between standard BlackBox 1.6 and BlackBox 1.6 for shkola.

Every change is a risk. I just try to collect all useful changes. I did not use the silly subsystem Unicode which reinvent the wheel about code page. I extract the useful part only and merged it with the useful part from System/Mod/National.odc and saved the result in System/Mod/Unicode.odc. Well we have to change 20 other files. It centralize some Unicode function into one file which is called System/Mod/Unicode.odc. This is a big improvement. If there is an error in those Unicode functions then you have to correct this error in one place and not to look and change over 20 files.

With this changes you can compile BB 1.5 shkola programs on BB 1.6. Without this changes you can’t. I just provide an easy migration. I deliver the key to the basics. I do not look further on the obsolete version of BB 1.5 shkola. I do use the obsolete file National.odc. And I do not use the silly subsystem Unicode.


Вернуться к началу
 Профиль  
 
 Заголовок сообщения: Re: Using BB 1.6 for shkola (with code page)
СообщениеДобавлено: Среда, 18 Сентябрь, 2013 19:18 
Модератор
Аватара пользователя

Зарегистрирован: Среда, 16 Ноябрь, 2005 00:53
Сообщения: 4625
Откуда: Россия, Орёл
Zinn писал(а):
They try to create a modify version of 1.6 which was not successful, because the symbol file and the code file does not accept Unicode. Here I have a solution, where only one file (System/Mod/Unicode.odc) must be change.
Helmut, is it possible to compile this example viewtopic.php?p=71303#p71303 with your solution?


Вернуться к началу
 Профиль  
 
 Заголовок сообщения: Re: Using BB 1.6 for shkola (with code page)
СообщениеДобавлено: Среда, 18 Сентябрь, 2013 20:46 
Аватара пользователя

Зарегистрирован: Пятница, 25 Ноябрь, 2005 12:02
Сообщения: 8500
Откуда: Троицк, Москва
Zinn писал(а):
I’m sorry, you did not understand me.
I am sorry :) I did not try to interpret anyone. I only expressed my situation with the BB versions I use to teach kids, that's all.


Вернуться к началу
 Профиль  
 
 Заголовок сообщения: Re: Using BB 1.6 for shkola (with code page)
СообщениеДобавлено: Пятница, 20 Сентябрь, 2013 15:45 

Зарегистрирован: Суббота, 24 Август, 2013 08:57
Сообщения: 81
I can compile and run ...

Код:
MODULE TestЭтоПроба;

   IMPORT Dialog, Log;

   CONST
      α = 0;
      ω = 42;

   VAR Куку*: ARRAY ω OF CHAR;
      π*: REAL;

   PROCEDURE Раз*;
   BEGIN
      Log.String(Куку); Log.Ln;
      Log.Real(π); Log.Ln;
   END Раз;

   PROCEDURE Два*;
   BEGIN
      Куку := "Ха-Ха!";
      Dialog.UpdateString(Куку);
   END Два;

   PROCEDURE НапэнаМожнаТак*; (*НапэўнаМожнаІТак *)
   BEGIN
      Куку := "Cапраўды!";
      Log.String(Куку); Log.Ln;
   END НапэнаМожнаТак;

   PROCEDURE УкранськуТежРозуммо*; (* УкраїнськуТежРозуміємо *)
   BEGIN
      Log.String("Це так!"); Log.Ln;
   END УкранськуТежРозуммо;

   PROCEDURE iujLingvojTagas*; (* ĈiujLingvojTaŭgas *)
   BEGIN
      Log.String("Ĝoju!"); Log.Ln;
   END iujLingvojTagas;

   PROCEDURE ΚατιΕλληνικο*;
   BEGIN
      Log.String("Γεια σας!"); Log.Ln;
   END ΚατιΕλληνικο;

   PROCEDURE Run*;
   BEGIN
      Log.String("Test ЭтоПроба started"); Log.Ln;
      Раз;
      Два;
      НапэнаМожнаТак;
      УкранськуТежРозуммо;
      iujLingvojTagas;
      ΚατιΕλληνικο;
      Log.String("End of Test ЭтоПроба"); Log.Ln;
   END Run;

BEGIN
   π := 3.14;
   Куку := "Куку!";
END TestЭтоПроба.


This modified version compiles and runs with my solution.
I delete the letter which I have not mapped in module Unicode (see comment).
The word "Test" is added for subsystem name. It works also without the word "Test".
Here is result from the Log window:

Код:
compiling "TestЭтоПроба"   360   92
Test ЭтоПроба started
Cапраўды!
 3.14
Cапраўды!
Це так!
Ĝoju!
Γεια σας!
End of Test ЭтоПроба


Keep in mind: The cyrillic character map to code page (Unicode.Short) and I map the greek character to the same place. It is not possible to unmap back both together. Only one of them can be ummap back (Unicode.Long).

Someone have to choose carefully which letter to map. But all those changes are in one module Unicode.


Вернуться к началу
 Профиль  
 
 Заголовок сообщения: Re: Using BB 1.6 for shkola (with code page)
СообщениеДобавлено: Пятница, 20 Сентябрь, 2013 15:56 

Зарегистрирован: Суббота, 24 Август, 2013 08:57
Сообщения: 81
Sorry I copied the wrong part of Log Windows. Here is the corrections

Test ЭтоПроба started
Куку!
3.14
Cапраўды!
Це так!
Ĝoju!
Γεια σας!
End of Test ЭтоПроба


Вернуться к началу
 Профиль  
 
 Заголовок сообщения: Re: Using BB 1.6 for shkola (with code page)
СообщениеДобавлено: Воскресенье, 22 Сентябрь, 2013 22:27 
Модератор
Аватара пользователя

Зарегистрирован: Среда, 16 Ноябрь, 2005 00:53
Сообщения: 4625
Откуда: Россия, Орёл
Zinn писал(а):
Keep in mind: The cyrillic character map to code page (Unicode.Short) and I map the greek character to the same place. It is not possible to unmap back both together. Only one of them can be ummap back (Unicode.Long).

Someone have to choose carefully which letter to map. But all those changes are in one module Unicode.
IMHO, "the mapping" is not a solution for BB1.6. Only generic solution is appropriate. Or none. (I tried to wrote about this in viewtopic.php?p=82081#p82081.)

P.S. Latin-1 in CP in BB1.6 is not a bug. But there are many real bugs to solve. For example, viewtopic.php?f=116&t=3411.


Вернуться к началу
 Профиль  
 
 Заголовок сообщения: Re: Using BB 1.6 for shkola (with code page)
СообщениеДобавлено: Понедельник, 04 Ноябрь, 2013 19:05 

Зарегистрирован: Суббота, 24 Август, 2013 08:57
Сообщения: 81
In German we say: Der Spatz in der Hand ist besser als die Taube auf dem Dach.
The meaning of this sentence is: It is better to have something as to have nothing.

Note: The MODULE Unicode is renamed to MODULE Characters in the CPC Edition and changed their.


Вернуться к началу
 Профиль  
 
Показать сообщения за:  Поле сортировки  
Начать новую тему Ответить на тему  [ Сообщений: 10 ] 

Часовой пояс: UTC + 3 часа


Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 3


Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете добавлять вложения

Найти:
Вся информация, размещаемая участниками на конференции (тексты сообщений, вложения и пр.) © 2005-2024, участники конференции «OberonCore», если специально не оговорено иное.
Администрация не несет ответственности за мнения, стиль и достоверность высказываний участников, равно как и за безопасность материалов, предоставляемых участниками во вложениях.
Без разрешения участников и ссылки на конференцию «OberonCore» любое воспроизведение и/или копирование высказываний полностью и/или по частям запрещено.
Powered by phpBB® Forum Software © phpBB Group
Русская поддержка phpBB