repo_name
string
dataset
string
owner
string
lang
string
func_name
string
code
string
docstring
string
url
string
sha
string
AceTheGame
github_2023
KuhakuPixel
c
linenoiseSetMultiLine
void linenoiseSetMultiLine(int ml) { mlmode = ml; }
/* Set if to use or not the multi line mode. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L203-L205
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
isUnsupportedTerm
static int isUnsupportedTerm(void) { char *term = getenv("TERM"); int j; if (term == NULL) return 0; for (j = 0; unsupported_term[j]; j++) if (!strcasecmp(term,unsupported_term[j])) return 1; return 0; }
/* Return true if the terminal name is in the list of terminals we know are * not able to understand basic escape sequences. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L209-L217
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
enableRawMode
static int enableRawMode(int fd) { struct termios raw; if (!isatty(STDIN_FILENO)) goto fatal; if (!atexit_registered) { atexit(linenoiseAtExit); atexit_registered = 1; } if (tcgetattr(fd,&orig_termios) == -1) goto fatal; raw = orig_termios; /* modify the original mode */ /...
/* Raw mode: 1960 magic shit. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L220-L253
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
getCursorPosition
static int getCursorPosition(int ifd, int ofd) { char buf[32]; int cols, rows; unsigned int i = 0; /* Report cursor location */ if (write(ofd, "\x1b[6n", 4) != 4) return -1; /* Read the response: ESC [ rows ; cols R */ while (i < sizeof(buf)-1) { if (read(ifd,buf+i,1) != 1) break; ...
/* Use the ESC [6n escape sequence to query the horizontal cursor position * and return it. On error -1 is returned, on success the position of the * cursor. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L264-L284
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
getColumns
static int getColumns(int ifd, int ofd) { struct winsize ws; if (ioctl(1, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) { /* ioctl() failed. Try to query the terminal itself. */ int start, cols; /* Get the initial position so we can restore it later. */ start = getCursorPosition(if...
/* Try to get the number of columns in the current terminal, or assume 80 * if it fails. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L288-L319
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseClearScreen
void linenoiseClearScreen(void) { if (write(STDOUT_FILENO,"\x1b[H\x1b[2J",7) <= 0) { /* nothing to do, just to avoid warning. */ } }
/* Clear the screen. Used to handle ctrl+l */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L322-L326
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseBeep
static void linenoiseBeep(void) { fprintf(stderr, "\x7"); fflush(stderr); }
/* Beep, used for completion when there is nothing to complete or when all * the choices were already shown. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L330-L333
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
freeCompletions
static void freeCompletions(linenoiseCompletions *lc) { size_t i; for (i = 0; i < lc->len; i++) free(lc->cvec[i]); if (lc->cvec != NULL) free(lc->cvec); }
/* ============================== Completion ================================ */ /* Free a list of completion option populated by linenoiseAddCompletion(). */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L338-L344
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
refreshLineWithCompletion
static void refreshLineWithCompletion(struct linenoiseState *ls, linenoiseCompletions *lc, int flags) { /* Obtain the table of completions if the caller didn't provide one. */ linenoiseCompletions ctable = { 0, NULL }; if (lc == NULL) { completionCallback(ls->buf,&ctable); lc = &ctable; ...
/* Called by completeLine() and linenoiseShow() to render the current * edited line with the proposed completion. If the current completion table * is already available, it is passed as second argument, otherwise the * function will use the callback to obtain it. * * Flags are the same as refreshLine*(), that is R...
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L352-L375
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
completeLine
static int completeLine(struct linenoiseState *ls, int keypressed) { linenoiseCompletions lc = { 0, NULL }; int nwritten; char c = keypressed; completionCallback(ls->buf,&lc); if (lc.len == 0) { linenoiseBeep(); ls->in_completion = 0; } else { switch(c) { cas...
/* This is an helper function for linenoiseEdit*() and is called when the * user types the <tab> key in order to complete the string currently in the * input. * * The state of the editing is encapsulated into the pointed linenoiseState * structure as described in the structure definition. * * If the function ret...
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L391-L439
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseSetCompletionCallback
void linenoiseSetCompletionCallback(linenoiseCompletionCallback *fn) { completionCallback = fn; }
/* Register a callback function to be called for tab-completion. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L442-L444
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseSetHintsCallback
void linenoiseSetHintsCallback(linenoiseHintsCallback *fn) { hintsCallback = fn; }
/* Register a hits function to be called to show hits to the user at the * right of the prompt. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L448-L450
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseSetFreeHintsCallback
void linenoiseSetFreeHintsCallback(linenoiseFreeHintsCallback *fn) { freeHintsCallback = fn; }
/* Register a function to free the hints returned by the hints callback * registered with linenoiseSetHintsCallback(). */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L454-L456
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseAddCompletion
void linenoiseAddCompletion(linenoiseCompletions *lc, const char *str) { size_t len = strlen(str); char *copy, **cvec; copy = malloc(len+1); if (copy == NULL) return; memcpy(copy,str,len+1); cvec = realloc(lc->cvec,sizeof(char*)*(lc->len+1)); if (cvec == NULL) { free(copy); ...
/* This function is used by the callback function registered by the user * in order to add completion options given the input string when the * user typed <tab>. See the example.c source code for a very easy to * understand example. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L462-L476
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
refreshShowHints
void refreshShowHints(struct abuf *ab, struct linenoiseState *l, int plen) { char seq[64]; if (hintsCallback && plen+l->len < l->cols) { int color = -1, bold = 0; char *hint = hintsCallback(l->buf,&color,&bold); if (hint) { int hintlen = strlen(hint); int hintmaxl...
/* Helper of refreshSingleLine() and refreshMultiLine() to show hints * to the right of the prompt. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L509-L531
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
refreshSingleLine
static void refreshSingleLine(struct linenoiseState *l, int flags) { char seq[64]; size_t plen = strlen(l->prompt); int fd = l->ofd; char *buf = l->buf; size_t len = l->len; size_t pos = l->pos; struct abuf ab; while((plen+pos) >= l->cols) { buf++; len--; pos--; ...
/* Single line low level line refresh. * * Rewrite the currently edited line accordingly to the buffer content, * cursor position, and number of columns of the terminal. * * Flags is REFRESH_* macros. The function can just remove the old * prompt, just write it, or both. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L540-L587
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
refreshMultiLine
static void refreshMultiLine(struct linenoiseState *l, int flags) { char seq[64]; int plen = strlen(l->prompt); int rows = (plen+l->len+l->cols-1)/l->cols; /* rows used by current buf. */ int rpos = (plen+l->oldpos+l->cols)/l->cols; /* cursor relative row. */ int rpos2; /* rpos after refresh. */ ...
/* Multi line low level line refresh. * * Rewrite the currently edited line accordingly to the buffer content, * cursor position, and number of columns of the terminal. * * Flags is REFRESH_* macros. The function can just remove the old * prompt, just write it, or both. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L596-L688
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
refreshLineWithFlags
static void refreshLineWithFlags(struct linenoiseState *l, int flags) { if (mlmode) refreshMultiLine(l,flags); else refreshSingleLine(l,flags); }
/* Calls the two low level functions refreshSingleLine() or * refreshMultiLine() according to the selected mode. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L692-L697
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
refreshLine
static void refreshLine(struct linenoiseState *l) { refreshLineWithFlags(l,REFRESH_ALL); }
/* Utility function to avoid specifying REFRESH_ALL all the times. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L700-L702
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseHide
void linenoiseHide(struct linenoiseState *l) { if (mlmode) refreshMultiLine(l,REFRESH_CLEAN); else refreshSingleLine(l,REFRESH_CLEAN); }
/* Hide the current line, when using the multiplexing API. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L705-L710
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseShow
void linenoiseShow(struct linenoiseState *l) { if (l->in_completion) { refreshLineWithCompletion(l,NULL,REFRESH_WRITE); } else { refreshLineWithFlags(l,REFRESH_WRITE); } }
/* Show the current line, when using the multiplexing API. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L713-L719
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseEditInsert
int linenoiseEditInsert(struct linenoiseState *l, char c) { if (l->len < l->buflen) { if (l->len == l->pos) { l->buf[l->pos] = c; l->pos++; l->len++; l->buf[l->len] = '\0'; if ((!mlmode && l->plen+l->len < l->cols && !hintsCallback)) { ...
/* Insert the character 'c' at cursor current position. * * On error writing to the terminal -1 is returned, otherwise 0. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L724-L749
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseEditMoveLeft
void linenoiseEditMoveLeft(struct linenoiseState *l) { if (l->pos > 0) { l->pos--; refreshLine(l); } }
/* Move cursor on the left. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L752-L757
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseEditMoveRight
void linenoiseEditMoveRight(struct linenoiseState *l) { if (l->pos != l->len) { l->pos++; refreshLine(l); } }
/* Move cursor on the right. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L760-L765
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseEditMoveHome
void linenoiseEditMoveHome(struct linenoiseState *l) { if (l->pos != 0) { l->pos = 0; refreshLine(l); } }
/* Move cursor to the start of the line. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L768-L773
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseEditMoveEnd
void linenoiseEditMoveEnd(struct linenoiseState *l) { if (l->pos != l->len) { l->pos = l->len; refreshLine(l); } }
/* Move cursor to the end of the line. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L776-L781
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseEditDelete
void linenoiseEditDelete(struct linenoiseState *l) { if (l->len > 0 && l->pos < l->len) { memmove(l->buf+l->pos,l->buf+l->pos+1,l->len-l->pos-1); l->len--; l->buf[l->len] = '\0'; refreshLine(l); } }
/* Delete the character at the right of the cursor without altering the cursor * position. Basically this is what happens with the "Delete" keyboard key. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L811-L818
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseEditBackspace
void linenoiseEditBackspace(struct linenoiseState *l) { if (l->pos > 0 && l->len > 0) { memmove(l->buf+l->pos-1,l->buf+l->pos,l->len-l->pos); l->pos--; l->len--; l->buf[l->len] = '\0'; refreshLine(l); } }
/* Backspace implementation. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L821-L829
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseEditDeletePrevWord
void linenoiseEditDeletePrevWord(struct linenoiseState *l) { size_t old_pos = l->pos; size_t diff; while (l->pos > 0 && l->buf[l->pos-1] == ' ') l->pos--; while (l->pos > 0 && l->buf[l->pos-1] != ' ') l->pos--; diff = old_pos - l->pos; memmove(l->buf+l->pos,l->buf+old_pos,l->len...
/* Delete the previosu word, maintaining the cursor at the start of the * current word. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L833-L845
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseEditStart
int linenoiseEditStart(struct linenoiseState *l, int stdin_fd, int stdout_fd, char *buf, size_t buflen, const char *prompt) { /* Populate the linenoise state that we pass to functions implementing * specific editing functionalities. */ l->in_completion = 0; l->ifd = stdin_fd != -1 ? stdin_fd : STDIN_FI...
/* This function is part of the multiplexed API of Linenoise, that is used * in order to implement the blocking variant of the API but can also be * called by the user directly in an event driven program. It will: * * 1. Initialize the linenoise state passed by the user. * 2. Put the terminal in RAW mode. * 3. Sh...
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L871-L905
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseEditStop
void linenoiseEditStop(struct linenoiseState *l) { if (!isatty(l->ifd)) return; disableRawMode(l->ifd); printf("\n"); }
/* This is part of the multiplexed linenoise API. See linenoiseEditStart() * for more information. This function is called when linenoiseEditFeed() * returns something different than NULL. At this point the user input * is in the buffer, and we can restore the terminal in normal mode. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L1092-L1096
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoisePrintKeyCodes
void linenoisePrintKeyCodes(void) { char quit[4]; printf("Linenoise key codes debugging mode.\n" "Press keys to see scan codes. Type 'quit' at any time to exit.\n"); if (enableRawMode(STDIN_FILENO) == -1) return; memset(quit,' ',4); while(1) { char c; int nread; ...
/* This special mode is used by linenoise in order to print scan codes * on screen for debugging / development purposes. It is implemented * by the linenoise_example program using the --keycodes option. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L1122-L1145
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseFree
void linenoiseFree(void *ptr) { if (ptr == linenoiseEditMore) return; // Protect from API misuse. free(ptr); }
/* This is just a wrapper the user may want to call in order to make sure * the linenoise returned buffer is freed with the same allocator it was * created with. Useful when the main program is using an alternative * allocator. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L1217-L1220
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
freeHistory
static void freeHistory(void) { if (history) { int j; for (j = 0; j < history_len; j++) free(history[j]); free(history); } }
/* ================================ History ================================= */ /* Free the history, but does not reset it. Only used when we have to * exit() to avoid memory leaks are reported by valgrind & co. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L1226-L1234
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseAtExit
static void linenoiseAtExit(void) { disableRawMode(STDIN_FILENO); freeHistory(); }
/* At exit we'll try to fix the terminal to the initial conditions. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L1237-L1240
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseHistoryAdd
int linenoiseHistoryAdd(const char *line) { char *linecopy; if (history_max_len == 0) return 0; /* Initialization on first call. */ if (history == NULL) { history = malloc(sizeof(char*)*history_max_len); if (history == NULL) return 0; memset(history,0,(sizeof(char*)*history_max...
/* This is the API call to add a new entry in the linenoise history. * It uses a fixed array of char pointers that are shifted (memmoved) * when the history max length is reached in order to remove the older * entry and make room for the new one, so it is not exactly suitable for huge * histories, but will work wel...
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L1249-L1276
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseHistorySetMaxLen
int linenoiseHistorySetMaxLen(int len) { char **new; if (len < 1) return 0; if (history) { int tocopy = history_len; new = malloc(sizeof(char*)*len); if (new == NULL) return 0; /* If we can't copy everything, free the elements we'll not use. */ if (len < tocopy) { ...
/* Set the maximum length for the history. This function can be called even * if there is already some history, the function will make sure to retain * just the latest 'len' elements if the new history length value is smaller * than the amount of items already inside the history. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L1282-L1308
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseHistorySave
int linenoiseHistorySave(const char *filename) { mode_t old_umask = umask(S_IXUSR|S_IRWXG|S_IRWXO); FILE *fp; int j; fp = fopen(filename,"w"); umask(old_umask); if (fp == NULL) return -1; chmod(filename,S_IRUSR|S_IWUSR); for (j = 0; j < history_len; j++) fprintf(fp,"%s\n",histor...
/* Save the history in the specified file. On success 0 is returned * otherwise -1 is returned. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L1312-L1325
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
linenoiseHistoryLoad
int linenoiseHistoryLoad(const char *filename) { FILE *fp = fopen(filename,"r"); char buf[LINENOISE_MAX_LINE]; if (fp == NULL) return -1; while (fgets(buf,LINENOISE_MAX_LINE,fp) != NULL) { char *p; p = strchr(buf,'\r'); if (!p) p = strchr(buf,'\n'); if (p) *p = '\0'; ...
/* Load the history from the specified file. If the file does not exist * zero is returned and no operation is performed. * * If the file exists and the operation succeeded 0 is returned, otherwise * on error -1 is returned. */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/ACE/third_party/linenoise/linenoise.c#L1332-L1348
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
gpower
GMATH_EXPORT unsigned gpower(unsigned n) { if (n == 0) return 1; if (n > 31) { LOGE("error from power(%d): integer overflow", n); return 0; } unsigned val = gpower(n >> 1) * gpower(n >> 1); if (n & 1) val *= 2; return val; }
/* * return 2 ^ n with multiplication implementation */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/Modder/injector/apk_source/hello-libs/gen-libs/src/main/cpp/gmath/src/gmath.c#L35-L44
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
AceTheGame
github_2023
KuhakuPixel
c
GetTicks
GPERF_EXPORT uint64_t GetTicks(void) { struct timeval Time; uint64_t cur_tick = (uint64_t)1000000; gettimeofday(&Time, NULL); cur_tick *= Time.tv_sec; return (cur_tick + Time.tv_usec); }
/* * return current ticks */
https://github.com/KuhakuPixel/AceTheGame/blob/8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a/Modder/injector/apk_source/hello-libs/gen-libs/src/main/cpp/gperf/src/gperf.c#L32-L40
8f43b55e8567ff64575b7c8df0f7e1ee76e11f8a
piper
github_2023
rhasspy
c
__Pyx_pretend_to_initialize
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
/* __GNUC__ */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L954-L954
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__Pyx_PyList_Extend
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { #if CYTHON_COMPILING_IN_CPYTHON PyObject* none = _PyList_Extend((PyListObject*)L, v); if (unlikely(!none)) return -1; Py_DECREF(none); return 0; #else return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); #endif...
/* ListExtend.proto */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L1660-L1670
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__Pyx_PySequence_ContainsTF
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { int result = PySequence_Contains(seq, item); return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); }
/* PySequenceContains.proto */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L1693-L1696
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_f_11piper_train_4vits_15monotonic_align_4core_maximum_path_each
static void __pyx_f_11piper_train_4vits_15monotonic_align_4core_maximum_path_each(__Pyx_memviewslice __pyx_v_path, __Pyx_memviewslice __pyx_v_value, int __pyx_v_t_y, int __pyx_v_t_x, struct __pyx_opt_args_11piper_train_4vits_15monotonic_align_4core_maximum_path_each *__pyx_optional_args) { float __pyx_v_max_neg_val =...
/* Late includes */ /* "piper_train/vits/monotonic_align/core.pyx":7 * @cython.boundscheck(False) * @cython.wraparound(False) * cdef void maximum_path_each(int[:,::1] path, float[:,::1] value, int t_y, int t_x, float max_neg_val=-1e9) nogil: # <<<<<<<<<<<<<< * cdef int x * cdef int y */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L2197-L2488
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_f_11piper_train_4vits_15monotonic_align_4core_maximum_path_c
static void __pyx_f_11piper_train_4vits_15monotonic_align_4core_maximum_path_c(__Pyx_memviewslice __pyx_v_paths, __Pyx_memviewslice __pyx_v_values, __Pyx_memviewslice __pyx_v_t_ys, __Pyx_memviewslice __pyx_v_t_xs, CYTHON_UNUSED int __pyx_skip_dispatch) { CYTHON_UNUSED int __pyx_v_b; int __pyx_v_i; int __pyx_t_1; ...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L2499-L2643
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_array___cinit__
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_shape = 0; Py_ssize_t __pyx_v_itemsize; PyObject *__pyx_v_format = 0; PyObject *__pyx_v_mode = 0; int __pyx_v_allocate_buffer; int __pyx_lineno = 0; const char *__pyx_filename = NULL; ...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L2775-L2901
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_array_getbuffer
static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_o...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L3526-L3535
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_array___dealloc__
static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); }
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L3833-L3840
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_array___len__
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_R...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L4107-L4116
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_array___setitem__
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L4293-L4302
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_MemviewEnum___init__
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_name = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L4643-L4692
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview___cinit__
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_obj = 0; int __pyx_v_flags; int __pyx_v_dtype_is_object; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations ...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L5165-L5243
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview___dealloc__
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNan...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L5563-L5570
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview___setitem__
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_m...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L6121-L6130
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_getbuffer
static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((stru...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L7516-L7525
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview___len__
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function ...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L8652-L8661
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_check
static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("memoryview_check", 0); /* "View.MemoryView":666 * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): * return isinstanc...
/* "View.MemoryView":665 * * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< * return isinstance(o, memoryview) * */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L9456-L9485
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_slice_memviewslice
static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_ha...
/* "View.MemoryView":809 * * @cname('__pyx_memoryview_slice_memviewslice') * cdef int slice_memviewslice( # <<<<<<<<<<<<<< * __Pyx_memviewslice *dst, * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L10620-L11394
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memslice_transpose
static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { int __pyx_v_ndim; Py_ssize_t *__pyx_v_shape; Py_ssize_t *__pyx_v_strides; int __pyx_v_i; int __pyx_v_j; int __pyx_r; int __pyx_t_1; Py_ssize_t *__pyx_t_2; long __pyx_t_3; long __pyx_t_4; Py_ssize_t __pyx_t_5; Py_ssize_t ...
/* "View.MemoryView":945 * * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< * cdef int ndim = memslice.memview.view.ndim * */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L11713-L11877
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryviewslice___dealloc__
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); /* function exit co...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L11889-L11896
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_slice_copy
static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { int __pyx_v_dim; Py_ssize_t *__pyx_v_shape; Py_ssize_t *__pyx_v_strides; Py_ssize_t *__pyx_v_suboffsets; __Pyx_RefNannyDeclarations Py_ssize_t *__pyx_t_1; int __pyx_t_2; int __pyx_t_3...
/* "View.MemoryView":1065 * * @cname('__pyx_memoryview_slice_copy') * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< * cdef int dim * cdef (Py_ssize_t*) shape, strides, suboffsets */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L12755-L12871
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
abs_py_ssize_t
static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { Py_ssize_t __pyx_r; int __pyx_t_1; /* "View.MemoryView":1112 * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: # <<<<<<<<<<<<<< * return -arg * else: */ __pyx_t_1 = ((__pyx_v_arg < 0) != 0); if...
/* "View.MemoryView":1111 * * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< * if arg < 0: * return -arg */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L13067-L13123
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_get_best_slice_order
static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { int __pyx_v_i; Py_ssize_t __pyx_v_c_stride; Py_ssize_t __pyx_v_f_stride; char __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; /* "View.MemoryView":1123 * """ * cdef int i * ...
/* "View.MemoryView":1118 * * @cname('__pyx_get_best_slice_order') * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< * """ * Figure out the best memory access order for a given slice. */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L13133-L13313
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
_copy_strided_to_strided
static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { CYTHON_UNUSED Py_ssize_t __pyx_v_i; CYTHON_UNUSED Py_ssize...
/* "View.MemoryView":1142 * * @cython.cdivision(True) * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< * char *dst_data, Py_ssize_t *dst_strides, * Py_ssize_t *src_shape, Py_ssize_t *dst...
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L13323-L13550
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
copy_strided_to_strided
static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { /* "View.MemoryView":1175 * __Pyx_memviewslice *dst, * int ndim, size_t itemsize) nogil: * _cop...
/* "View.MemoryView":1172 * dst_data += dst_stride * * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< * __Pyx_memviewslice *dst, * int ndim, size_t itemsize) nogil: */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L13560-L13580
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_slice_get_size
static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { Py_ssize_t __pyx_v_shape; Py_ssize_t __pyx_v_size; Py_ssize_t __pyx_r; Py_ssize_t __pyx_t_1; Py_ssize_t *__pyx_t_2; Py_ssize_t *__pyx_t_3; Py_ssize_t *__pyx_t_4; /* "View.MemoryView":1181 * cdef Py_s...
/* "View.MemoryView":1179 * * @cname('__pyx_memoryview_slice_get_size') * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< * "Return the size of the memory occupied by the slice in number of bytes" * cdef Py_ssize_t shape, size = src.memview.view.itemsi...
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L13590-L13652
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_fill_contig_strides_array
static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { int __pyx_v_idx; Py_ssize_t __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; /* "View.MemoryView":1198 * cd...
/* "View.MemoryView":1189 * * @cname('__pyx_fill_contig_strides_array') * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, * int ndim, char order) nogil: */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L13662-L13774
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_err_extents
static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx...
/* "View.MemoryView":1253 * * @cname('__pyx_memoryview_err_extents') * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< * Py_ssize_t extent2) except -1 with gil: * raise ValueError("got differing extents in dimension %d (got %d and %d)" % */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L14039-L14117
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_err_dim
static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NU...
/* "View.MemoryView":1259 * * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< * raise error(msg.decode('ascii') % dim) * */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L14127-L14201
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_err
static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; ...
/* "View.MemoryView":1263 * * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< * if msg != NULL: * raise error(msg.decode('ascii')) */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L14211-L14311
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_copy_contents
static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { void *__pyx_v_tmpdata; size_t __pyx_v_itemsize; int __pyx_v_i; char __pyx_v_order; int __pyx_v_broadcasting; int __pyx_v_direct...
/* "View.MemoryView":1270 * * @cname('__pyx_memoryview_copy_contents') * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< * __Pyx_memviewslice dst, * int src_ndim, int dst_ndim, */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L14321-L14890
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_broadcast_leading
static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { int __pyx_v_i; int __pyx_v_offset; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; /* "View.MemoryView":1346 * int ndim_other) nogil: * cdef int i *...
/* "View.MemoryView":1342 * * @cname('__pyx_memoryview_broadcast_leading') * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< * int ndim, * int ndim_other) nogil: */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L14900-L15003
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_refcount_copying
static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { int __pyx_t_1; /* "View.MemoryView":1368 * * * if dtype_is_object: # <<<<<<<<<<<<<< * refcount_objects_in_slice_with_gil(dst.data, dst.shape...
/* "View.MemoryView":1364 * * @cname('__pyx_memoryview_refcount_copying') * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< * int ndim, bint inc) nogil: * */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L15013-L15053
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_refcount_objects_in_slice_with_gil
static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { __Pyx_RefNannyDeclarations #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNanny...
/* "View.MemoryView":1373 * * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< * Py_ssize_t *strides, int ndim, * ...
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L15063-L15092
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_refcount_objects_in_slice
static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { CYTHON_UNUSED Py_ssize_t __pyx_v_i; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; Py_ssize_t __pyx_t_2; Py_ssize_t __pyx_t_3; int __pyx_t...
/* "View.MemoryView":1379 * * @cname('__pyx_memoryview_refcount_objects_in_slice') * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< * Py_ssize_t *strides, int ndim, bint inc): * cdef Py_ssize_t i */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L15102-L15224
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview_slice_assign_scalar
static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { /* "View.MemoryView":1402 * size_t itemsize, void *item, * bint dtype_is_object...
/* "View.MemoryView":1399 * * @cname('__pyx_memoryview_slice_assign_scalar') * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< * size_t itemsize, void *item, * bint dtype_is_object) nogil: */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L15234-L15272
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__pyx_memoryview__slice_assign_scalar
static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { CYTHON_UNUSED Py_ssize_t __pyx_v_i; Py_ssize_t __pyx_v_stride; Py_ssize_t __pyx_v_extent; int __pyx_t_1; Py_ssize_t __p...
/* "View.MemoryView":1409 * * @cname('__pyx_memoryview__slice_assign_scalar') * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< * Py_ssize_t *strides, int ndim, * size_t itemsize, void *item) nogil: */
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L15282-L15403
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
__Pyx_modinit_global_init_code
static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ generic = Py_None; Py_INCREF(Py_None); strided = Py_None; Py_INCREF(Py_None); indirect = Py_None; Py_INCREF(Py_None); contiguous = Py_N...
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L16984-L16995
c0670df63daf07070c9be36b5c4bed270ad72383
piper
github_2023
rhasspy
c
PyInit_core
__Pyx_PyMODINIT_FUNC PyInit_core(void) #if CYTHON_PEP489_MULTI_PHASE_INIT { return PyModuleDef_Init(&__pyx_moduledef); }
/*proto*/
https://github.com/rhasspy/piper/blob/c0670df63daf07070c9be36b5c4bed270ad72383/src/python/piper_train/vits/monotonic_align/core.c#L17125-L17129
c0670df63daf07070c9be36b5c4bed270ad72383
zap
github_2023
zigzap
c
on_http_request
static void on_http_request(http_s *h) { /* set a response and send it (finnish vs. destroy). */ http_send_body(h, "Hello World!", 12); }
/* ***************************************************************************** HTTP Request / Response Handling ***************************************************************************** */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/http-chat.c#L114-L117
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
on_http_upgrade
static void on_http_upgrade(http_s *h, char *requested_protocol, size_t len) { /* Upgrade to SSE or WebSockets and set the request path as a nickname. */ FIOBJ nickname; if (fiobj_obj2cstr(h->path).len > 1) { nickname = fiobj_str_new(fiobj_obj2cstr(h->path).data + 1, fiobj_obj2cst...
/* HTTP upgrade callback */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/http-chat.c#L134-L165
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
sse_on_open
static void sse_on_open(http_sse_s *sse) { http_sse_write(sse, .data = {.data = "Welcome to the SSE chat channel.\r\n" "You can only listen, not write.", .len = 65}); http_sse_subscribe(sse, .channel = CHAT_CANNEL); http_sse_set_timout(sse, fio...
/* ***************************************************************************** HTTP SSE (Server Sent Events) Callbacks ***************************************************************************** */ /** * The (optional) on_open callback will be called once the EventSource * connection is established. */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/http-chat.c#L181-L191
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
ws_on_message
static void ws_on_message(ws_s *ws, fio_str_info_s msg, uint8_t is_text) { // Add the Nickname to the message FIOBJ str = fiobj_str_copy((FIOBJ)websocket_udata_get(ws)); fiobj_str_write(str, ": ", 2); fiobj_str_write(str, msg.data, msg.len); // publish fio_publish(.channel = CHAT_CANNEL, .message = fiobj_ob...
/* ***************************************************************************** WebSockets Callbacks ***************************************************************************** */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/http-chat.c#L206-L217
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
initialize_redis
static void initialize_redis(void) { if (!fio_cli_get("-redis") || !strlen(fio_cli_get("-redis"))) return; FIO_LOG_STATE("* Initializing Redis connection to %s\n", fio_cli_get("-redis")); fio_url_s info = fio_url_parse(fio_cli_get("-redis"), strlen(fio_cli_get("-redis"))); fio_pubsub_e...
/* ***************************************************************************** Redis initialization ***************************************************************************** */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/http-chat.c#L245-L259
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
initialize_cli
static void initialize_cli(int argc, char const *argv[]) { /* **** Command line arguments **** */ fio_cli_start( argc, argv, 0, 0, NULL, // Address Binding FIO_CLI_PRINT_HEADER("Address Binding:"), FIO_CLI_INT("-port -p port number to listen to. defaults port 3000"), "-bind -b...
/* ***************************************************************************** CLI helpers ***************************************************************************** */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/http-chat.c#L264-L344
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
on_http_request
static void on_http_request(http_s *h) { /* set a response and send it (finnish vs. destroy). */ http_send_body(h, "Hello World!", 12); }
/* ***************************************************************************** HTTP request / response handling ***************************************************************************** */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/http-hello.c#L40-L43
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
main
int main(int argc, char const *argv[]) { initialize_cli(argc, argv); /* listen for inncoming connections */ if (http_listen(fio_cli_get("-p"), fio_cli_get("-b"), .on_request = on_http_request, .max_body_size = fio_cli_get_i("-maxbd"), .public_folder = fio_cli_...
/* ***************************************************************************** The main function ***************************************************************************** */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/http-hello.c#L49-L65
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
initialize_cli
void initialize_cli(int argc, char const *argv[]) { /* **** Command line arguments **** */ fio_cli_start( argc, argv, 0, 0, NULL, // Address Binding arguments FIO_CLI_PRINT_HEADER("Address Binding:"), FIO_CLI_INT("-port -p port number to listen to. defaults port 3000"), "-bind...
/* ***************************************************************************** CLI helpers ***************************************************************************** */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/http-hello.c#L70-L131
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
chat_on_data
static void chat_on_data(intptr_t uuid, fio_protocol_s *prt) { // echo buffer char buffer[1024] = {'C', 'h', 'a', 't', ':', ' '}; ssize_t len; // Read to the buffer, starting after the "Chat: " while ((len = fio_read(uuid, buffer + 6, 1018)) > 0) { fprintf(stderr, "Broadcasting: %.*s", (int)len, buffer + ...
/* ***************************************************************************** Chat connection callbacks ***************************************************************************** */ // A callback to be called whenever data is available on the socket
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/raw-chat.c#L30-L41
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
chat_ping
static void chat_ping(intptr_t uuid, fio_protocol_s *prt) { fio_write(uuid, "Server: Are you there?\n", 23); (void)prt; // we can ignore the unused argument }
// A callback called whenever a timeout is reach
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/raw-chat.c#L44-L47
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
chat_on_shutdown
static uint8_t chat_on_shutdown(intptr_t uuid, fio_protocol_s *prt) { fio_write(uuid, "Chat server shutting down\nGoodbye.\n", 35); return 0; (void)prt; // we can ignore the unused argument }
// A callback called if the server is shutting down... // ... while the connection is still open
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/raw-chat.c#L51-L55
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
chat_message
static void chat_message(fio_msg_s *msg) { fio_write((intptr_t)msg->udata1, msg->msg.data, msg->msg.len); }
/* ***************************************************************************** The main chat pub/sub callback ***************************************************************************** */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/raw-chat.c#L67-L69
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
chat_on_open
static void chat_on_open(intptr_t uuid, void *udata) { /* Create and attach a protocol object */ fio_protocol_s *proto = fio_malloc(sizeof(*proto)); *proto = (fio_protocol_s){ .on_data = chat_on_data, .on_shutdown = chat_on_shutdown, .on_close = chat_on_close, .ping = chat_ping, }; fio...
/* ***************************************************************************** The main chat protocol creation callback ***************************************************************************** */ // A callback called for new connections
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/raw-chat.c#L76-L100
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
main
int main(int argc, char const *argv[]) { /* Setup CLI arguments */ fio_cli_start(argc, argv, 0, 0, "This example accepts the following options:", FIO_CLI_INT("-t -thread number of threads to run."), FIO_CLI_INT("-w -workers number of workers to run."), "-b, -address t...
/* ***************************************************************************** The main function (listens to the `echo` connections and handles CLI) ***************************************************************************** */ // The main function starts listening to echo connections
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/raw-chat.c#L107-L129
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
repl_on_data
static void repl_on_data(intptr_t uuid, fio_protocol_s *protocol) { ssize_t ret = 0; char buffer[MAX_BYTES_RAPEL_PER_CYCLE]; ret = fio_read(uuid, buffer, MAX_BYTES_RAPEL_PER_CYCLE); if (ret > 0) { fio_publish(.channel = {.data = "repl", .len = 4}, .message = {.data = buffer, .len = ret}); ...
/* ***************************************************************************** REPL ***************************************************************************** */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/raw-client.c#L31-L40
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
on_data
static void on_data(intptr_t uuid, fio_protocol_s *protocol) { ssize_t ret = 0; char buffer[MAX_BYTES_READ_PER_CYCLE + 1]; ret = fio_read(uuid, buffer, MAX_BYTES_READ_PER_CYCLE); while (ret > 0) { FIO_LOG_DEBUG("Recieved %zu bytes", ret); buffer[ret] = 0; fwrite(buffer, ret, 1, stdout); /* NUL bytes...
/* ***************************************************************************** TCP/IP / Unix Socket Client ***************************************************************************** */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/raw-client.c#L69-L82
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
on_shutdown
static uint8_t on_shutdown(intptr_t uuid, fio_protocol_s *protocol) { FIO_LOG_INFO("Disconnecting.\n"); /* don't print a message on protocol closure */ protocol->on_close = NULL; return 0; /* close immediately, don't wait */ (void)uuid; /*we ignore the uuid object, we don't use it*/ }
/* Called during server shutdown */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/raw-client.c#L85-L91
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
on_close
static void on_close(intptr_t uuid, fio_protocol_s *protocol) { FIO_LOG_INFO("Remote connection lost.\n"); kill(0, SIGINT); /* signal facil.io to stop */ (void)protocol; /* we ignore the protocol object, we don't use it */ (void)uuid; /* we ignore the uuid object, we don't use it */ }
/** Called when the connection was closed, but will not run concurrently */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/raw-client.c#L94-L99
675c65b509d48c21a8d1fa4c5ec53fc407643a3b
zap
github_2023
zigzap
c
ping
static void ping(intptr_t uuid, fio_protocol_s *protocol) { fio_touch(uuid); (void)protocol; /* we ignore the protocol object, we don't use it */ }
/** Timeout handling. To ignore timeouts, we constantly "touch" the socket */
https://github.com/zigzap/zap/blob/675c65b509d48c21a8d1fa4c5ec53fc407643a3b/facil.io/examples/raw-client.c#L102-L105
675c65b509d48c21a8d1fa4c5ec53fc407643a3b