30

Great smile
- if yes, do you prefer \" or "" ?
Definitely \" This would allow future additionnal escapes to be added constitently.
- for comments, do you prefer ";", "#" or another char ? (it's currently ";", like in asm)
Both would be nice if possible.
- for the ".ini file" folder, I'm not very interested by adding another parameter to each call of my lib - 6 parameters are already required for some functions)
Well, maybe you could replace the char * file with a HANDLE file ? This would allow the caller to do whatever it wants with the file.

31

done ^^
1737 bytes for the following functions :
reglib::get_num_key equ reglib@0000
;long value = reglib::get_num_key(const char *file, const char *key, long default, const short *error)
;*file = name of the file which contains the searched key
;        if *file doesn't exist, reglib will try to create it. In case of failure, reglib will return default value and error code will be REGLIB_FILE_NOT_FOUND
;*key = name of the searched key
;        if *key doesn't exist, reglib will return default value and error code will be REGLIB_KEY_NOT_FOUND
;default = default value, which is returned in case of error (so, caller program doesn't need to catch errors)
;*error = pointer to short value, where the error will be stored
; if all is correct, *error = REGLIB_OK


reglib::add_num_key equ reglib@0001
;short error = reglib::add_num_key(const char *file, const char *key, long value)
;*file = name of the file which contains the key to store
;        if *file doesn't exist, reglib will try to create it. In case of failure, reglib will return default value and error code will be REGLIB_FILE_NOT_FOUND
;*key = name of the key to store
;        if *key doesn't exist, reglib will create a new key
;value = value of the key
; if all is correct, error = REGLIB_OK


reglib::remove_key equ reglib@0002
;short error = reglib::remove_key(const char *file, const char *key)
;*file = name of the file which contains the key to remove
;        if *file doesn't exist, reglib will try to create it. In case of failure, reglib will return default value and error code will be REGLIB_FILE_NOT_FOUND
;*key = name of the key to remove
;        if *key doesn't exist, the text remain unchanged.
;after this function, *file is unarchived (even the searched key doesn't exist).
;if there is not enough memory to remove the key, error will be REGLIB_UNSAVED_FILE
; if all is correct, error = REGLIB_OK


reglib::get_string_key equ reglib@0003
;error = short reglib::get_string_key(const char *file, const char *key, const char *value, long max_length, const char *default)
;*file = name of the file which contains the searched key
;        if *file doesn't exist, reglib will try to create it. In case of failure, reglib will return default value and error code will be REGLIB_FILE_NOT_FOUND
;*key = name of the searched key
;        if *key doesn't exist, reglib will return default value and error code will be REGLIB_KEY_NOT_FOUND
;*value = pointer where the result will be stored
;max_length = maximum length of the result. The *value buffer must be at least (max_length-bytes+1) long (+1 for the terminating zero)
;*default = default value, which is written in case of error
;error = pointer to short value, where the error will be stored
; if all is correct, error = REGLIB_OK


reglib::add_string_key equ reglib@0004
;short error = reglib::add_string_key(const char *file, const char *key, const char *value)
;*file = name of the file which contains the key to store
;        if *file doesn't exist, reglib will try to create it. In case of failure, reglib will return default value and error code will be REGLIB_FILE_NOT_FOUND
;*key = name of the key to store
;        if *key doesn't exist, reglib will create a new key
;*value = pointer to the value (standard C string)
; if all is correct, error = REGLIB_OK


Now I want to work on sections smile
avatar<<< Kernel Extremis©®™ >>> et Inventeur de la différence administratif/judiciaire ! (©Yoshi Noir)

<Vertyos> un poil plus mais elle suce bien quand même la mienne ^^
<Sabrina`> tinkiete flan c juste qu'ils sont jaloux que je te trouve aussi appétissant

32

Definitely \" This would allow future additionnal escapes to be added constitently.

ok, I'll work on this
Both would be nice if possible.

good idea smile
Well, maybe you could replace the char * file with a HANDLE file ? This would allow the caller to do whatever it wants with the file.

non I don't want to force the caller to search in the VAT for his file.
I can do a new function :
HANDLE get_file(const char * file) if you want
avatar<<< Kernel Extremis©®™ >>> et Inventeur de la différence administratif/judiciaire ! (©Yoshi Noir)

<Vertyos> un poil plus mais elle suce bien quand même la mienne ^^
<Sabrina`> tinkiete flan c juste qu'ils sont jaloux que je te trouve aussi appétissant

33

I have a point about escape sequences : perhaps you already planned that, but I believe they should be handled symetrically.

I mean, the program should be able to write abc"def, which the add_string function would translate to abc\"def automatically. Thus, the program would not have to care about or even be aware of the escaping process at all.

34

It was planned hehe
avatar<<< Kernel Extremis©®™ >>> et Inventeur de la différence administratif/judiciaire ! (©Yoshi Noir)

<Vertyos> un poil plus mais elle suce bien quand même la mienne ^^
<Sabrina`> tinkiete flan c juste qu'ils sont jaloux que je te trouve aussi appétissant

35

Nice happy

36

Flanker :
I've some questions :
- do you think that an escape sequence is important for strings (to allow the "" char in strings) ?
- if yes, do you prefer \" or "" ?
- for comments, do you prefer ";", "#" or another char ? (it's currently ";", like in asm)
- for the ".ini file" folder, I'm not very interested by adding another parameter to each call of my lib - 6 parameters are already required sad for some functions)
I think to force to 'system' folder. It's will be simpler for everybody I think

1- Yes escape is useful. I don't think une this kind of file to store binary information is a good idea but it should be possible and I think thar \" and \r are useful anyway
2- I'd like \ for the reason above
3- Since it's look like unix ".conf" files and i like UNIX I prefer "#"
4- You may make multiple functions au get_string_key with few arguments and a get_string_key2 with all
Both would be nice if possible.
I think it's a bad idea that would make the program more complex and I hate having 2 différent escapes.



avatar

37

And it may sound stupid to say, but don't forget to escape \ too wink
As for comments, I agree with Uther : you should keep the spec as simple as possible... I see little benefit to having ";" in addition to "#" as a comment, honestly...

38

And it may sound stupid to say, but don't forget to escape \ too

I'll try to remember this
As for comments, I agree with Uther : you should keep the spec as simple as possible... I see little benefit to having ";" as a comment, honestly...

ok, only '#' will remain for comments
avatar<<< Kernel Extremis©®™ >>> et Inventeur de la différence administratif/judiciaire ! (©Yoshi Noir)

<Vertyos> un poil plus mais elle suce bien quand même la mienne ^^
<Sabrina`> tinkiete flan c juste qu'ils sont jaloux que je te trouve aussi appétissant

39

'#' is maybe the most used comment tag on scripting files.

I can't remember what windows .ini use, but SH script use '#'
avatarProud to be CAKE©®™


GCC4TI importe qui a problème en Autriche, pour l'UE plus et une encore de correspours nucléaire, ce n'est pas ytre d'instérier. L'état très même contraire, toujours reconstruire un pouvoir une choyer d'aucrée de compris le plus mite de genre, ce n'est pas moins)
Stalin est l'élection de la langie.

40

You can get the executable folder by using this:
reglib::toto:
  move.l (a7),a0
  jsr kernel::Ptr2Hd
  jsr kernel::Hd2Sym
  jsr kernel::Ptr2HD

41

Even if my lib is called by kernel::LibsCall ?
avatar<<< Kernel Extremis©®™ >>> et Inventeur de la différence administratif/judiciaire ! (©Yoshi Noir)

<Vertyos> un poil plus mais elle suce bien quand même la mienne ^^
<Sabrina`> tinkiete flan c juste qu'ils sont jaloux que je te trouve aussi appétissant

42

... or if it is called last in a function used as a callback by vcbprintf ? tongue

43

Of course not. Why making it a question when you perfectly know the anwser ? tongue

44

Grrr, <SARCASM>exactly what we need</SARCASM>, another kernel-based library. mad
avatarMes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

45

Kevin Kofler :
Grrr, <SARCASM>exactly what we need</SARCASM>, another kernel-based library. mad


can you stop to troll ?
avatar<<< Kernel Extremis©®™ >>> et Inventeur de la différence administratif/judiciaire ! (©Yoshi Noir)

<Vertyos> un poil plus mais elle suce bien quand même la mienne ^^
<Sabrina`> tinkiete flan c juste qu'ils sont jaloux que je te trouve aussi appétissant

46

>kernel::LibsCall ?
non, but you only need a ptr somewhere inside the program.

47

And how can I have this pointer ?
avatar<<< Kernel Extremis©®™ >>> et Inventeur de la différence administratif/judiciaire ! (©Yoshi Noir)

<Vertyos> un poil plus mais elle suce bien quand même la mienne ^^
<Sabrina`> tinkiete flan c juste qu'ils sont jaloux que je te trouve aussi appétissant

48

I can't remember what windows .ini use, but SH script use '#'
windows/DOS use "REM" or " ' ".
avatar

49

Windows .ini uses ";" for comments smile
avatarAll right. Keep doing whatever it is you think you're doing.
------------------------------------------
Besoin d'aide sur le site ? Essayez par ici :)

50

I think that I will finish to do a windows version and a linux version, both for TIs triso
avatar<<< Kernel Extremis©®™ >>> et Inventeur de la différence administratif/judiciaire ! (©Yoshi Noir)

<Vertyos> un poil plus mais elle suce bien quand même la mienne ^^
<Sabrina`> tinkiete flan c juste qu'ils sont jaloux que je te trouve aussi appétissant

51

You can request it from the user

52

or you could use both...
avatarTutorial C (TI-89/92+/v200) - Articles Développement Web (PHP, Javascript, ...)
« What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against? » - Larry Wall

53

We're back to what I suggested at post #29 smile

54

So :
- I'll use the '#' char for comments
- A new parameter "section" is added to all functions and is correctly used
- I think that I'll force to use the system folder (to have only one file)
- \" and \ aren't managed, I've not enough time to work on this point
- Do you think that "reglib::add_section(const char * file, const char *section)" and "reglib::remove_section(const char *file, const char *section)" are really useful ? I don't think so, and I don't want to bloat my lib with unnecessary functions

- some people have suggested to me to add the possibility to encrypt data.
I haven't any idea on good algorithms,
I can perhaps add a new function : "reglib:sadconst char * result, const char *data, const char *key)" if you give me algorithms smile
avatar<<< Kernel Extremis©®™ >>> et Inventeur de la différence administratif/judiciaire ! (©Yoshi Noir)

<Vertyos> un poil plus mais elle suce bien quand même la mienne ^^
<Sabrina`> tinkiete flan c juste qu'ils sont jaloux que je te trouve aussi appétissant

55

2213 bytes for the following functions :

reglib::get_num_key equ reglib@0000
;long value = reglib::get_num_key(const char *file, const char *section, const char *key, long default, const short *error)
;*file = name of the file which contains the searched key
;        if *file doesn't exist, reglib will try to create it. In case of failure, reglib will return default value and error code will be REGLIB_FILE_NOT_FOUND
;*key = name of the searched key
;        if *section doesn't exist, reglib will return default value and error code will be REGLIB_KEY_NOT_FOUND
;        if *key doesn't exist, reglib will return default value and error code will be REGLIB_KEY_NOT_FOUND
;default = default value, which is returned in case of error (so, caller program doesn't need to catch errors)
;*error = pointer to short value, where the error will be stored
; if all is correct, *error = REGLIB_OK


reglib::add_num_key equ reglib@0001
;short error = reglib::add_num_key(const char *file, const char *section, const char *key, long value)
;*file = name of the file which contains the key to store
;        if *file doesn't exist, reglib will try to create it. In case of failure, reglib will return default value and error code will be REGLIB_FILE_NOT_FOUND
;*key = name of the key to store
;        if *section doesn't exist, reglib will create a new section
;        if *key doesn't exist, reglib will create a new key
;value = value of the key
; if all is correct, error = REGLIB_OK


reglib::remove_key equ reglib@0002
;short error = reglib::remove_key(const char *file, const char *section, const char *key)
;*file = name of the file which contains the key to remove
;        if *file doesn't exist, reglib will try to create it. In case of failure, reglib will return default value and error code will be REGLIB_FILE_NOT_FOUND
;*key = name of the key to remove
;        if *section doesn't exist, the text remain unchanged.
;        if *key doesn't exist, the text remain unchanged.
;after this function, *file is unarchived (even the searched key doesn't exist).
;if there is not enough memory to remove the key, error will be REGLIB_UNSAVED_FILE
; if all is correct, error = REGLIB_OK


reglib::get_string_key equ reglib@0003
;error = short reglib::get_string_key(const char *file, const char *section, const char *key, const char *value, long max_length, const char *default)
;*file = name of the file which contains the searched key
;        if *file doesn't exist, reglib will try to create it. In case of failure, reglib will return default value and error code will be REGLIB_FILE_NOT_FOUND
;*key = name of the searched key
;        if *section doesn't exist, reglib will return default value and error code will be REGLIB_KEY_NOT_FOUND
;        if *key doesn't exist, reglib will return default value and error code will be REGLIB_KEY_NOT_FOUND
;*value = pointer where the result will be stored
;max_length = maximum length of the result. The *value buffer must be at least (max_length-bytes+1) long (+1 for the terminating zero)
;*default = default value, which is written in case of error
;error = pointer to short value, where the error will be stored
; if all is correct, error = REGLIB_OK


reglib::add_string_key equ reglib@0004
;short error = reglib::add_string_key(const char *file, const char *section, const char *key, const char *value)
;*file = name of the file which contains the key to store
;        if *file doesn't exist, reglib will try to create it. In case of failure, reglib will return default value and error code will be REGLIB_FILE_NOT_FOUND
;*key = name of the key to store
;        if *section doesn't exist, reglib will create a new key
;        if *key doesn't exist, reglib will create a new key
;*value = pointer to the value (standard C string)
; if all is correct, error = REGLIB_OK


Example of valid text
#comment
key_1 = 212123
key_2 = "abcdedf"

[section_1]
key_1 = "kfjksdjfksdjfj"
variable = 5142

[section_2]
#comment
key_1 = 51212
key_2 = 1212015



I've done a small interface (with dialog boxes) to allow to test my functions : reglib is 3185 bytes large with its interface

Finally, do you like reglib for name or do you prefer another one ?
avatar<<< Kernel Extremis©®™ >>> et Inventeur de la différence administratif/judiciaire ! (©Yoshi Noir)

<Vertyos> un poil plus mais elle suce bien quand même la mienne ^^
<Sabrina`> tinkiete flan c juste qu'ils sont jaloux que je te trouve aussi appétissant

56

- I haven't any idea on good algorithms,
Doesn't AMS already provide some crypto functions ?

57

Do you think that "reglib::add_section(const char * file, const char *section)" and "reglib::remove_section(const char *file, const char *section)" are really useful ? I don't think so, and I don't want to bloat my lib with unnecessary functions

no
_if_ you create the section (which wasn't existing) when you try to put a key in it
and _if_ (but less important) you delete it when it becomes empty (when you delete the last key that was in it)
Finally, do you like reglib for name or do you prefer another one ?

This is no "Registry" like the one in windows
but more like ".ini" files
I'd rather suggest something like "ini_lib" (or "inilib", the first suggestion being easier to read... maybe not easier to use)
avatarTutorial C (TI-89/92+/v200) - Articles Développement Web (PHP, Javascript, ...)
« What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against? » - Larry Wall

58

Well, I'd prefer something funnier, for instance a wordplay, but it's up to Flanker.

59

spectras :
Well, I'd prefer something funnier, for instance a wordplay, but it's up to Flanker.

do you have any idea ?
avatar<<< Kernel Extremis©®™ >>> et Inventeur de la différence administratif/judiciaire ! (©Yoshi Noir)

<Vertyos> un poil plus mais elle suce bien quand même la mienne ^^
<Sabrina`> tinkiete flan c juste qu'ils sont jaloux que je te trouve aussi appétissant

60

Well, no, but I will surely think about it.