crypt of decay - Post a comment [entries|archive|friends|userinfo]
ketmar

[ userinfo | ljr userinfo ]
[ archive | journal archive ]

Jan. 30th, 2022|11:05 am

steinkrauz
Продолжаем потихоньку

sxed_buffer.h

// called on successfull attach, "pre"
Add the word 'callback' to clarify the meaning, pls

// callback type, for `type`
for `type` what? Argument? Field? RetVal? I'd like it to be a little more eloquent.

// this blocks buffer changing via the API
#define SXED_BUFFER_FLAG_READONLY (0x01u)
Как-то смысл коммента и флага не бьются. Получается, что флаг выставляется, когда идёт изменение содержимого буфера что-ли? Но тогда BUSY or LOCKED было бы понятнее

// this clears the buffer, frees all buffer internal structs, and reinits everything
// doesn't remove any callbacks, only text and undo
// resets "modified" flag
sxed_status sxed_buffer_wipe (sxed_buffer *buf);

1-е противоречие:reinits everything vs only text and undo
2-e противоречие: У флага в комментах:
// will NOT be reset on clearing/disabling undo
#define SXED_BUFFER_FLAG_MODIFIED (0x02u)

// passing zero will reset all flags
void sxed_buffer_reset_flag (sxed_buffer *buf, uint32_t flagmask);
All _public_ flags, I believe. Or do UNDOING/REDOING flags get cleared too with zero?

// if `slen` is negative, use `strlen()`
What does it mean? It's an input parameter, there is no ifs. Or does it means that the function will call strlen to get slen on itself?


// ////////////////////////////////////////////////////////////////////////// //
// callback attaching and detaching
//
// it is guaranteed that you can attach at least 64 callbacks to the buffer
// it is possible to add/remove callback from inside the callback code

Ранее в той же серии:
// WARNING! adding/removing callbacks from callback code is NOT SUPPORTED. this is not checked, and is UB.

// returns `false` if there is no callback with the given id
А в других комметах в этом случае говорилось, что возвращается zero для false и non-zero для true
Не принципиально, конечно.

//it is called "clip object" because i couldn't invent a better name
The name is.... Clippy! ;)

// out-of-bounds length will be truncated
What are the bounds of Clippy? At this point I couldn't remember any corresponding defines

Link Read Comments

Reply:
From:
(will be screened)
Identity URL: 
имя пользователя:    
Вы должны предварительно войти в LiveJournal.com
 
E-mail для ответов: 
Вы сможете оставлять комментарии, даже если не введете e-mail.
Но вы не сможете получать уведомления об ответах на ваши комментарии!
Внимание: на указанный адрес будет выслано подтверждение.
Username:
Password:
Subject:
No HTML allowed in subject
Message: