Les membres ayant 30 points peuvent parler sur les canaux annonces, projets et hs du chat.
La shoutbox n'est pas chargée par défaut pour des raisons de performances. Cliquez pour charger.

Forum Casio - Projets de programmation


Index du Forum » Projets de programmation » A Chinese Editor (thinking)
Diaowinner Hors ligne Membre Points: 42 Défis: 0 Message

A Chinese Editor (thinking)

Posté le 19/05/2020 10:33

1.Cursor and how the English editor works

In this picture, G is “0th”, o is “1st”, and so on. And the cursor is from the very left and right and right and right...
If you pressed the LEFT or RIGHT key, cursor will minus/plus 1.
In insert mode, the string is “ac”, and the cursor is 1. But you pressed “b” and the letter “c” and a lot of NUL will copy itself into the next byte. If you pressed delete key, the “c” and a lot of NUL should copy to the last byte.
Like this, the demo program:
If the key is LEFT
Then save cursor minus 1 to cursor
Else if the key is RIGHT
Then save cursor plus 1 to cursor
Else if the key is DEL
Then join the string “0 to cursor minus 1 bytes of text” and “cursor to limit of text”
Else join the string “0 to cursor minus 1 bytes of text”, “A” and “cursor to limit of text”

That’s all! But I couldn’t write program using C. so that’s thinking!


Lephenixnoir Hors ligne Administrateur Points: 24234 Défis: 170 Message

Citer : Posté le 19/05/2020 11:16 | #


This is a bit hard to understand, but I think I get the gist of it. This seems to be a standard approach. Could you specify the encoding that you're using? Also, what is your memory allocation strategy for lines of text?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Diaowinner Hors ligne Membre Points: 42 Défis: 0 Message

Citer : Posté le 19/05/2020 12:12 | # | Fichier joint


That's NOT a code. That's the process of Editor.
(I atteched the file of image, and I will edit the file)
Latest Project:



DL:
A Chinese text reader.
Lephenixnoir Hors ligne Administrateur Points: 24234 Défis: 170 Message

Citer : Posté le 19/05/2020 13:38 | #


You've lost me now, I don't understand anymore. The language is not easy to follow, too. Can you provide further detail (even if you have to repeat yourself a bit) to make sure the points get accross?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Kikoodx Hors ligne Ancien labélisateur Points: 3011 Défis: 11 Message

Citer : Posté le 19/05/2020 13:48 | #


If I understood well, this is an idea for a chinese text editor but he doesn't know how to make it in C (with the Casio SDK I guess), thus the "thinking" in the title for thoughts?
ouais ouais
Lephenixnoir Hors ligne Administrateur Points: 24234 Défis: 170 Message

Citer : Posté le 19/05/2020 14:45 | #


I can guess that, but I definitely don't understand the "NOT a code". Also I think an image is missing?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Diaowinner Hors ligne Membre Points: 42 Défis: 0 Message

Citer : Posté le 20/05/2020 15:42 | #


[url=https://www.planet-casio.com/Fr/compte/voir_profil.php?membre=kikoodx]Kikoodx[/url] a écrit :
If I understood well, this is an idea for a chinese text editor but he doesn't know how to make it in C (with the Casio SDK I guess), thus the "thinking" in the title for thoughts?

Yes, it's CASIO SDK.
Latest Project:



DL:
A Chinese text reader.
Lephenixnoir Hors ligne Administrateur Points: 24234 Défis: 170 Message

Citer : Posté le 20/05/2020 16:09 | #


Okay, so back to my original questions I suppose.

• How do you represent Chinese characters? Is that UTF-8? Is there another encoding? You describe a cursor that moves bytes but a Chinese character can't reasonably by a single byte.
• Do you have lines of fixed width or resizeable lines? Because the resizing should be taken in consideration while designing the cursor movement.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Diaowinner Hors ligne Membre Points: 42 Défis: 0 Message

Citer : Posté le 21/05/2020 09:32 | #


Lephenixnoir a écrit :
How do you represent Chinese characters? Is that UTF-8? Is there another encoding? You describe a cursor that moves bytes but a Chinese character can't reasonably by a single byte.

That's not UTF-8, it's GB/T 2312 (can only display Chinese using A0-FE double bytes)
Lephenixnoir a écrit :
Do you have lines of fixed width or resizeable lines? Because the resizing should be taken in consideration while designing the cursor movement.

It's fixed width.
—————

2. Chinese Text
As I know, GB/T 2312 has 6763 (Chinese characters) and 682 symbols. We use it from A1-FE zone of A1-FE which is called “机内码”. And the 00-7F is ASCII, so that’s easy to write.
The final code is:
If the key is LEFT
Then If the “cursor minus 1th” is 0xA1-0xFE
Then save cursor minus 2 to cursor
Else save cursor minus 1 to cursor
Else if the key is RIGHT
Then If the “cursorth” is 0xA1-0xFE
Then save cursor plus 2 to cursor
Else save cursor plus 1 to cursor
Else if the key is DEL
Then If the “cursor minus 1th” is 0xA1-0xFE
Then join the string “0 to cursor minus 2 bytes of text” and “cursor to limit of text”
Else join the string “0 to cursor minus 1 bytes of text” and “cursor to limit of text”
Else join the string “0 to cursor minus 1 bytes of text”, “characters corresponding to the case” and “cursor to limit of text”

Latest Project:



DL:
A Chinese text reader.
Lephenixnoir Hors ligne Administrateur Points: 24234 Défis: 170 Message

Citer : Posté le 21/05/2020 09:37 | #


That's not UTF-8, it's GB/T 2312 (can only display Chinese using A0-FE double bytes)

I didn't know this encoding, thank you

The final code is:

It's looking nice. Do you need help writing the C program for this?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Diaowinner Hors ligne Membre Points: 42 Défis: 0 Message

Citer : Posté le 23/05/2020 16:57 | #


Lephenixnoir a écrit :
Do you need help writing the C program for this?
Yes, I need it-
Latest Project:



DL:
A Chinese text reader.
Lephenixnoir Hors ligne Administrateur Points: 24234 Défis: 170 Message

Citer : Posté le 23/05/2020 17:10 | #


Well... do you have any existing codebase? Usually we help solve specific code problems or write small functions. Do you have any specific problem yet?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Diaowinner Hors ligne Membre Points: 42 Défis: 0 Message

Citer : Posté le 23/05/2020 17:12 | #


So... I'll make a Python version.
Latest Project:



DL:
A Chinese text reader.
Sentaro21 Hors ligne Membre Points: 877 Défis: 0 Message

Citer : Posté le 24/05/2020 11:48 | #


C.Basic for CG supports editing programs that contain built-in GB code, but it is limited.
Je continue à développer C.Basic. (Il est compatible avec Basic Casio.)
Overclocking utilitaire Ftune/Ptune2/Ptune3 est également disponible.
Si vous avez des questions ou un rapport de bogue, n'hésitez pas à me le faire savoir.
Diaowinner Hors ligne Membre Points: 42 Défis: 0 Message

Citer : Posté le 31/05/2020 17:41 | #


Yes, I don't know how to save it to run. Maybe I use ">g3m"?
Latest Project:



DL:
A Chinese text reader.
Sentaro21 Hors ligne Membre Points: 877 Défis: 0 Message

Citer : Posté le 01/06/2020 08:53 | #


Please set the following settings in the setup.
Edit GB Font : On or Full
Direct GB cnvt : On

Plain text file of GB code can be read by the built-in editor.
(extension is txt)
Je continue à développer C.Basic. (Il est compatible avec Basic Casio.)
Overclocking utilitaire Ftune/Ptune2/Ptune3 est également disponible.
Si vous avez des questions ou un rapport de bogue, n'hésitez pas à me le faire savoir.
Diaowinner Hors ligne Membre Points: 42 Défis: 0 Message

LienAjouter une imageAjouter une vidéoAjouter un lien vers un profilAjouter du codeCiterAjouter un spoiler(texte affichable/masquable par un clic)Ajouter une barre de progressionItaliqueGrasSoulignéAfficher du texte barréCentréJustifiéPlus petitPlus grandPlus de smileys !
Cliquez pour épingler Cliquez pour détacher Cliquez pour fermer
Alignement de l'image: Redimensionnement de l'image (en pixel):
Afficher la liste des membres
:bow: :cool: :good: :love: ^^
:omg: :fusil: :aie: :argh: :mdr:
:boulet2: :thx: :champ: :whistle: :bounce:
valider
 :)  ;)  :D  :p
 :lol:  8)  :(  :@
 0_0  :oops:  :grr:  :E
 :O  :sry:  :mmm:  :waza:
 :'(  :here:  ^^  >:)

Σ π θ ± α β γ δ Δ σ λ
Veuillez donner la réponse en chiffre
Vous devez activer le Javascript dans votre navigateur pour pouvoir valider ce formulaire.

Si vous n'avez pas volontairement désactivé cette fonctionnalité de votre navigateur, il s'agit probablement d'un bug : contactez l'équipe de Planète Casio.

Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2024 | Il y a 99 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd