repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
schmitzn/node-packer
node/deps/icu-small/source/common/static_unicode_sets.h
// © 2018 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html // This file contains utilities to deal with static-allocated UnicodeSets. // // Common use case: you write a "private static final" UnicodeSet in Java, and // want something similarly easy in C++. Originally written for number // parsing, but this header can be used for other applications. // // Main entrypoint: `unisets::get(unisets::MY_SET_ID_HERE)` // // This file is in common instead of i18n because it is needed by ucurr.cpp. // // Author: sffc #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING #ifndef __STATIC_UNICODE_SETS_H__ #define __STATIC_UNICODE_SETS_H__ #include "unicode/uniset.h" #include "unicode/unistr.h" U_NAMESPACE_BEGIN namespace unisets { enum Key { // NONE is used to indicate null in chooseFrom(). // EMPTY is used to get an empty UnicodeSet. NONE = -1, EMPTY = 0, // Ignorables DEFAULT_IGNORABLES, STRICT_IGNORABLES, // Separators // Notes: // - COMMA is a superset of STRICT_COMMA // - PERIOD is a superset of SCRICT_PERIOD // - ALL_SEPARATORS is the union of COMMA, PERIOD, and OTHER_GROUPING_SEPARATORS // - STRICT_ALL_SEPARATORS is the union of STRICT_COMMA, STRICT_PERIOD, and OTHER_GRP_SEPARATORS COMMA, PERIOD, STRICT_COMMA, STRICT_PERIOD, APOSTROPHE_SIGN, OTHER_GROUPING_SEPARATORS, ALL_SEPARATORS, STRICT_ALL_SEPARATORS, // Symbols MINUS_SIGN, PLUS_SIGN, PERCENT_SIGN, PERMILLE_SIGN, INFINITY_SIGN, // Currency Symbols DOLLAR_SIGN, POUND_SIGN, RUPEE_SIGN, YEN_SIGN, WON_SIGN, // Other DIGITS, // Combined Separators with Digits (for lead code points) DIGITS_OR_ALL_SEPARATORS, DIGITS_OR_STRICT_ALL_SEPARATORS, // The number of elements in the enum. UNISETS_KEY_COUNT }; /** * Gets the static-allocated UnicodeSet according to the provided key. The * pointer will be deleted during u_cleanup(); the caller should NOT delete it. * * Exported as U_COMMON_API for ucurr.cpp * * This method is always safe and OK to chain: in the case of a memory or other * error, it returns an empty set from static memory. * * Example: * * UBool hasIgnorables = unisets::get(unisets::DEFAULT_IGNORABLES)->contains(...); * * @param key The desired UnicodeSet according to the enum in this file. * @return The requested UnicodeSet. Guaranteed to be frozen and non-null, but * may be empty if an error occurred during data loading. */ U_COMMON_API const UnicodeSet* get(Key key); /** * Checks if the UnicodeSet given by key1 contains the given string. * * Exported as U_COMMON_API for numparse_decimal.cpp * * @param str The string to check. * @param key1 The set to check. * @return key1 if the set contains str, or NONE if not. */ U_COMMON_API Key chooseFrom(UnicodeString str, Key key1); /** * Checks if the UnicodeSet given by either key1 or key2 contains the string. * * Exported as U_COMMON_API for numparse_decimal.cpp * * @param str The string to check. * @param key1 The first set to check. * @param key2 The second set to check. * @return key1 if that set contains str; key2 if that set contains str; or * NONE if neither set contains str. */ U_COMMON_API Key chooseFrom(UnicodeString str, Key key1, Key key2); // TODO: Load these from data: ICU-20108 // Unused in C++: // Key chooseCurrency(UnicodeString str); // Used instead: static const struct { Key key; UChar32 exemplar; } kCurrencyEntries[] = { {DOLLAR_SIGN, u'$'}, {POUND_SIGN, u'£'}, {RUPEE_SIGN, u'₹'}, {YEN_SIGN, u'¥'}, {WON_SIGN, u'₩'}, }; } // namespace unisets U_NAMESPACE_END #endif //__STATIC_UNICODE_SETS_H__ #endif /* #if !UCONFIG_NO_FORMATTING */
schmitzn/node-packer
node/deps/libsquash/tests/main.c
<gh_stars>10-100 /* * Copyright (c) 2017 <NAME> <<EMAIL>> * <NAME> <<EMAIL>> * * This file is part of libsquash, distributed under the MIT License * For full terms see the included LICENSE file */ #include "squash.h" #include <stdint.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h> extern const uint8_t libsquash_fixture[]; static void expect(short condition, const char *reason) { if (condition) { fprintf(stderr, "."); } else { fprintf(stderr, "x"); fprintf(stderr, "\nFAILED: %s\n", reason); exit(1); } fflush(stderr); } static void test_basic_func() { sqfs fs; sqfs_err ret; sqfs_inode root, node; sqfs_dir dir; sqfs_dir_entry entry; sqfs_name name; short found; short has_next; struct stat st; size_t name_size = sizeof(name); char buffer[1024]; sqfs_off_t offset; fprintf(stderr, "Testing basic functionalities\n"); fflush(stderr); // libsquash_fixture => sqfs memset(&fs, 0, sizeof(sqfs)); ret = sqfs_open_image(&fs, libsquash_fixture, 0); expect(SQFS_OK == ret, "sqfs_open_image should succeed"); expect(1484142037 == fs.sb->mkfs_time, "fs made at Wed Jan 11 21:40:37 2017 +0800"); // sqfs => root sqfs_inode memset(&root, 0, sizeof(sqfs_inode)); ret = sqfs_inode_get(&fs, &root, sqfs_inode_root(&fs)); expect(SQFS_OK == ret, "successfully read the root inode"); expect(SQUASHFS_DIR_TYPE == root.base.inode_type, "got a dir as the root"); expect(1484142005 == root.base.mtime, "Jan 11 21:40:05 2017 +0800"); // "/" => sqfs_inode and stat memcpy(&node, &root, sizeof(sqfs_inode)); ret = sqfs_lookup_path(&fs, &node, "/", &found); expect(found, "of course we can find root"); expect(SQFS_OK == ret, "happy sqfs_lookup_path"); ret = sqfs_stat(&fs, &node, &st); expect(SQFS_OK == ret, "happy sqfs_stat"); expect(S_ISDIR(st.st_mode), "stat thinks root is a dir"); // "/what/the/f" => not found memcpy(&node, &root, sizeof(sqfs_inode)); ret = sqfs_lookup_path(&fs, &node, "/what/the/f", &found); expect(SQFS_OK == ret, "sqfs_lookup_path is still happy"); expect(!found, "but this thing does not exist"); // "even_without_leading_slash" => not found memcpy(&node, &root, sizeof(sqfs_inode)); ret = sqfs_lookup_path(&fs, &node, "even_without_leading_slash", &found); expect(SQFS_OK == ret, "sqfs_lookup_path is still happy"); expect(!found, "but this thing does not exist"); // ls "/" memcpy(&node, &root, sizeof(sqfs_inode)); sqfs_lookup_path(&fs, &node, "/", &found); ret = sqfs_dir_open(&fs, &node, &dir, 0); expect(SQFS_OK == ret, "sqfs dir open is happy"); sqfs_dentry_init(&entry, name); has_next = sqfs_dir_next(&fs, &dir, &entry, &ret); expect(0 == strcmp(sqfs_dentry_name(&entry), "bombing"), "/bombing"); expect(S_ISREG(sqfs_dentry_mode(&entry)), "bombing is a regular file"); expect(has_next, "bombing -> dir0/"); has_next = sqfs_dir_next(&fs, &dir, &entry, &ret); expect(0 == strcmp(sqfs_dentry_name(&entry), "dir0"), "/dir0/"); expect(S_ISDIR(sqfs_dentry_mode(&entry)), "dir0/ is a dir"); expect(has_next, "bombing -> dir0/"); has_next = sqfs_dir_next(&fs, &dir, &entry, &ret); expect(0 == strcmp(sqfs_dentry_name(&entry), "dir1"), "/dir1/"); expect(S_ISDIR(sqfs_dentry_mode(&entry)), "dir1/ is a dir"); expect(has_next, "dir1/ -> EOF"); has_next = sqfs_dir_next(&fs, &dir, &entry, &ret); expect(!has_next, "EOF"); // ls "/dir1" memcpy(&node, &root, sizeof(sqfs_inode)); sqfs_lookup_path(&fs, &node, "/dir1", &found); ret = sqfs_dir_open(&fs, &node, &dir, 0); expect(SQFS_OK == ret, "sqfs dir open is happy"); sqfs_dentry_init(&entry, name); has_next = sqfs_dir_next(&fs, &dir, &entry, &ret); expect(0 == strcmp(sqfs_dentry_name(&entry), ".0.0.4@something4"), "/.0.0.4@something4/"); expect(S_ISDIR(sqfs_dentry_mode(&entry)), ".0.0.4@something4 is a dir"); expect(has_next, ".0.0.4@something4 -> .bin"); has_next = sqfs_dir_next(&fs, &dir, &entry, &ret); expect(0 == strcmp(sqfs_dentry_name(&entry), ".bin"), "/.bin/"); expect(S_ISDIR(sqfs_dentry_mode(&entry)), ".bin is a dir"); expect(has_next, ".bin -> @minqi"); has_next = sqfs_dir_next(&fs, &dir, &entry, &ret); expect(0 == strcmp(sqfs_dentry_name(&entry), "@minqi"), "/@minqi/"); expect(S_ISDIR(sqfs_dentry_mode(&entry)), "@minqi is a dir"); expect(has_next, "@minqi -> something4"); has_next = sqfs_dir_next(&fs, &dir, &entry, &ret); expect(0 == strcmp(sqfs_dentry_name(&entry), "something4"), "/something4"); expect(S_ISLNK(sqfs_dentry_mode(&entry)), "something4 is a symlink"); expect(has_next, ".0.0.4@something4 -> EOF"); has_next = sqfs_dir_next(&fs, &dir, &entry, &ret); expect(!has_next, "EOF"); // readlink "/dir1/something4" memcpy(&node, &root, sizeof(sqfs_inode)); sqfs_lookup_path(&fs, &node, "/dir1/something4", &found); expect(found, "we can find /dir1/something4"); sqfs_stat(&fs, &node, &st); expect(S_ISLNK(node.base.mode), "/dir1/something4 is a link"); ret = sqfs_readlink(&fs, &node, name, &name_size); expect(SQFS_OK == ret, "sqfs_readlink is happy"); expect(0 == strcmp(name, ".0.0.4@something4"), "something4 links to .0.0.4@something4"); // read "/bombing" memcpy(&node, &root, sizeof(sqfs_inode)); sqfs_lookup_path(&fs, &node, "/bombing", &found); expect(found, "we can find /bombing"); sqfs_stat(&fs, &node, &st); expect(S_ISREG(node.base.mode), "/bombing is a regular file"); expect(998 == node.xtra.reg.file_size, "bombing is of size 998"); offset = node.xtra.reg.file_size; ret = sqfs_read_range(&fs, &node, 0, &offset, buffer); expect(buffer == strstr(buffer, "Botroseya Church bombing"), "read some content of the file"); expect(NULL != strstr(buffer, "Iraq and the Levant"), "read some content of the file"); // RIP. sqfs_destroy(&fs); fprintf(stderr, "\n"); fflush(stderr); } static void test_stat() { sqfs fs; struct stat st; int ret; int fd; SQUASH_OS_PATH path; SQUASH_OS_PATH path2; size_t path_len; fprintf(stderr, "Testing stat functions\n"); fflush(stderr); memset(&fs, 0, sizeof(sqfs)); sqfs_open_image(&fs, libsquash_fixture, 0); // stat "/" ret = squash_stat(&fs, "/", &st); expect(0 == ret, "Upon successful completion a value of 0 is returned"); expect(S_ISDIR(st.st_mode), "/ is a dir"); ret = squash_lstat(&fs, "/", &st); expect(0 == ret, "Upon successful completion a value of 0 is returned"); expect(S_ISDIR(st.st_mode), "/ is a dir"); // stat "/bombing" ret = squash_stat(&fs, "/bombing", &st); expect(0 == ret, "Upon successful completion a value of 0 is returned"); expect(S_ISREG(st.st_mode), "/bombing is a regular file"); ret = squash_lstat(&fs, "/bombing", &st); expect(0 == ret, "Upon successful completion a value of 0 is returned"); expect(S_ISREG(st.st_mode), "/bombing is a regular file"); fd = squash_open(&fs, "/bombing"); ret = squash_fstat(fd, &st); expect(0 == ret, "Upon successful completion a value of 0 is returned"); expect(S_ISREG(st.st_mode), "/bombing is a regular file"); squash_close(fd); // extract "/bombing" path = squash_extract(&fs, "/bombing", "txt"); expect(NULL != path, "sucecssfully extracts the file"); #ifdef _WIN32 ret = _wstat(path, &st); #else ret = stat(path, &st); #endif expect(0 == ret, "system stat - a value of 0 is returned"); expect(S_ISREG(st.st_mode), "system stat - a regular file"); path2 = squash_extract(&fs, "/bombing", "txt"); expect(path == path2, "cache works"); #ifdef _WIN32 path_len = wcslen(path); expect(L'.' == path[path_len-4], ".txt"); expect(L't' == path[path_len-3], ".txt"); expect(L'x' == path[path_len-2], ".txt"); expect(L't' == path[path_len-1], ".txt"); #else path_len = strlen(path); expect('.' == path[path_len-4], ".txt"); expect('t' == path[path_len-3], ".txt"); expect('x' == path[path_len-2], ".txt"); expect('t' == path[path_len-1], ".txt"); #endif //stat /dir/something4 ret = squash_lstat(&fs, "/dir1/something4", &st); expect(0 == ret, "Upon successful completion a value of 0 is returned"); expect(S_ISLNK(st.st_mode), "/dir1/something4 is a symbolic link file"); //stat /dir/something4 ret = squash_stat(&fs, "/dir1/something4", &st); expect(0 == ret, "Upon successful completion a value of 0 is returned"); expect(S_ISDIR(st.st_mode), "/dir1/something4 is a symbolic link file and references is a dir"); //stat /dir0/level3 ret = squash_stat(&fs, "/dir0/level3", &st); expect(0 == ret, "Upon successful completion a value of 0 is returned"); expect(S_ISREG(st.st_mode), "/dir0/level3 is a symbolic link file and references is a regular file"); //stat /dir0/level2 ret = squash_stat(&fs, "/dir0/level2", &st); expect(0 == ret, "Upon successful completion a value of 0 is returned"); expect(S_ISREG(st.st_mode), "/dir0/level2 is a symbolic link file and references is a regular file"); //sl1 -> sl3 //sl2 -> sl1 //sl3 -> sl2 ret = squash_stat(&fs, "/dir0/sl1", &st); expect(-1 == ret, "sl1 is a loop symbolic link stat return -1"); expect(ELOOP == errno, "errno is ELOOP"); ret = squash_stat(&fs, "/dir0/sl2", &st); expect(-1 == ret, "sl2 is a loop symbolic link stat return -1"); expect(ELOOP == errno, "errno is ELOOP"); ret = squash_stat(&fs, "/dir0/sl3", &st); expect(-1 == ret, "sl3 is a loop symbolic link stat return -1"); expect(ELOOP == errno, "errno is ELOOP"); // RIP. sqfs_destroy(&fs); fprintf(stderr, "\n"); fflush(stderr); } static void test_virtual_fd() { int fd, fd2, fd3, fd4; sqfs fs; int ret; ssize_t ssize; char buffer[1024]; sqfs_off_t offset; struct squash_file *file; fprintf(stderr, "Testing virtual file descriptors\n"); fflush(stderr); memset(&fs, 0, sizeof(sqfs)); sqfs_open_image(&fs, libsquash_fixture, 0); // open "/bombing" fd = squash_open(&fs, "/bombing"); expect(fd > 0, "successfully got a fd"); fd2 = squash_open(&fs, "/bombing"); expect(fd2 > 0, "successfully got yet another fd"); expect(fd2 != fd, "it is indeed another fd"); fd3 = squash_open(&fs, "/shen/me/gui"); expect(-1 == fd3, "on failure returns -1"); expect(ENOENT == errno, "no such file"); expect(SQUASH_VALID_VFD(fd), "fd is ours"); expect(SQUASH_VALID_VFD(fd2), "fd2 is also ours"); expect(!SQUASH_VALID_VFD(0), "0 is not ours"); expect(!SQUASH_VALID_VFD(1), "1 is not ours"); expect(!SQUASH_VALID_VFD(2), "2 is not ours"); // read on and on file = SQUASH_VFD_FILE(fd); offset = file->node.xtra.reg.file_size; ssize = squash_read(fd, buffer, 1024); expect(offset == ssize, "When successful it returns the number of bytes actually read"); expect(buffer == strstr(buffer, "Botroseya Church bombing"), "read some content of the file"); ssize = squash_read(fd, buffer, 1024); expect(0 == ssize, "upon reading end-of-file, zero is returned"); fd4 = squash_open(&fs, "/"); ssize = squash_read(fd4, buffer, 1024); expect(-1 == ssize, "not something we can read"); // read with lseek ret = squash_lseek(fd, 3, SQUASH_SEEK_SET); expect(3 == ret, "Upon successful completion, it returns the resulting offset location as measured in bytes from the beginning of the file."); ssize = squash_read(fd, buffer, 1024); expect(offset - 3 == ssize, "When successful it returns the number of bytes actually read"); expect(buffer != strstr(buffer, "Botroseya Church bombing"), "read some content of the file"); expect(buffer == strstr(buffer, "roseya Church bombing"), "read some content of the file"); ssize = squash_read(fd2, buffer, 100); ret = squash_lseek(fd2, 10, SQUASH_SEEK_CUR); expect(110 == ret, " the offset is set to its current location plus offset bytes"); ssize = squash_read(fd2, buffer, 100); expect(buffer == strstr(buffer, "s at St. Peter"), "read from offset 110"); ret = squash_lseek(fd2, 0, SQUASH_SEEK_END); ssize = squash_read(fd2, buffer, 1024); expect(0 == ssize, "upon reading end-of-file, zero is returned"); // various close ret = squash_close(fd); expect(0 == ret, "RIP: fd"); ret = squash_close(fd2); expect(0 == ret, "RIP: fd2"); ret = squash_close(0); expect(-1 == ret, "cannot close something we do not own"); expect(EBADF == errno, "invalid vfd is the reason"); expect(!SQUASH_VALID_VFD(fd), "fd is no longer ours"); expect(!SQUASH_VALID_VFD(fd2), "fd2 is no longer ours"); // RIP. sqfs_destroy(&fs); fprintf(stderr, "\n"); fflush(stderr); } int filter_scandir(const struct SQUASH_DIRENT * ent) { return (strncmp(ent->d_name,".",1) == 0); } int reverse_alpha_compar(const struct SQUASH_DIRENT **a, const struct SQUASH_DIRENT **b){ return -strcmp((*a)->d_name, (*b)->d_name); } #ifndef __linux__ int alphasort(const struct SQUASH_DIRENT **a, const struct SQUASH_DIRENT **b){ return strcmp((*a)->d_name, (*b)->d_name); } #endif static void test_dirent() { sqfs fs; int ret; int fd; SQUASH_DIR *dir; struct SQUASH_DIRENT *mydirent; long pos; struct SQUASH_DIRENT **namelist; int numEntries; int i; fprintf(stderr, "Testing dirent APIs\n"); fflush(stderr); memset(&fs, 0, sizeof(sqfs)); sqfs_open_image(&fs, libsquash_fixture, 0); dir = squash_opendir(&fs, "/dir1-what-the-f"); expect(NULL == dir, "on error NULL is returned"); dir = squash_opendir(&fs, "/dir1"); expect(NULL != dir, "returns a pointer to be used to identify the dir stream"); expect(NULL != squash_find_entry(dir), "could find a valid SQUASH_DIR in our fd table"); fd = squash_dirfd(dir); expect(fd > 0, "returns a vfs associated with the named diretory stream"); mydirent = squash_readdir(dir); expect(NULL != mydirent, "returns a pointer to the next directory entry"); expect(0 == strcmp(".0.0.4@something4", mydirent->d_name), "got .0.0.4@something4"); #ifndef __linux__ expect(strlen(".0.0.4@something4") == mydirent->d_namlen, "got a str len"); #endif expect(DT_DIR == mydirent->d_type, "this ia dir"); mydirent = squash_readdir(dir); expect(NULL != mydirent, "returns a pointer to the next directory entry"); expect(0 == strcmp(".bin", mydirent->d_name), "got a .bin"); #ifndef __linux__ expect(strlen(".bin") == mydirent->d_namlen, "got a str len"); #endif expect(DT_DIR == mydirent->d_type, "this a dir"); mydirent = squash_readdir(dir); expect(NULL != mydirent, "got another entry"); expect(0 == strcmp("@minqi", mydirent->d_name), "got a @minqi"); #ifndef __linux__ expect(strlen("@minqi") == mydirent->d_namlen, "got a str len"); #endif expect(DT_DIR == mydirent->d_type, "got yet another dir"); mydirent = squash_readdir(dir); expect(NULL != mydirent, "got another entry"); expect(0 == strcmp("something4", mydirent->d_name), "this is named something4"); #ifndef __linux__ expect(strlen("something4") == mydirent->d_namlen, "got a strlen"); #endif expect(DT_LNK == mydirent->d_type, "so this one is a link"); mydirent = squash_readdir(dir); expect(NULL == mydirent, "finally reaching an EOF"); pos = squash_telldir(dir); squash_rewinddir(dir); mydirent = squash_readdir(dir); expect(NULL != mydirent, "starting all over again"); expect(0 == strcmp(".0.0.4@something4", mydirent->d_name), "got .0.0.4@something4"); squash_seekdir(dir, pos); mydirent = squash_readdir(dir); expect(NULL == mydirent, "back to before"); ret = squash_closedir(dir); expect(0 == ret, "returns 0 on success"); dir = squash_opendir(&fs, "/dir1/.bin"); expect(NULL != dir, "returns a pointer to be used to identify the dir stream"); mydirent = squash_readdir(dir); expect(NULL == mydirent, "oops empty dir"); namelist = 0; numEntries = squash_scandir(&fs, "/dir1", &namelist, filter_scandir, alphasort); expect(2 == numEntries, "scandir_filter is happy"); expect(NULL != namelist[0], "returns a pointer to the next directory entry"); expect(0 == strcmp(".0.0.4@something4", namelist[0]->d_name), "got .0.0.4@something4"); #ifndef __linux__ expect(strlen(".0.0.4@something4") == namelist[0]->d_namlen, "got a str len"); #endif expect(DT_DIR == namelist[0]->d_type, "this ia dir"); expect(NULL != namelist[1], "returns a pointer to the next directory entry"); expect(0 == strcmp(".bin", namelist[1]->d_name), "got a .bin"); #ifndef __linux__ expect(strlen(".bin") == namelist[1]->d_namlen, "got a str len"); #endif for(i = 0; i < numEntries; i++){ free(namelist[i]); } free(namelist); namelist = 0; numEntries = squash_scandir(&fs, "/", &namelist, NULL, reverse_alpha_compar); expect(3 == numEntries, "scandir_alphasort is happy"); expect(NULL != namelist[0], "returns a pointer to the next directory entry"); expect(0 == strcmp("dir1", namelist[0]->d_name), "got a dir1"); expect(DT_DIR == namelist[0]->d_type, "this is a reg"); #ifndef __linux__ expect(strlen("dir1") == namelist[0]->d_namlen, "got a str len"); #endif expect(NULL != namelist[1], "returns a pointer to the next directory entry"); expect(0 == strcmp("dir0", namelist[1]->d_name), "got a dir0"); expect(DT_DIR == namelist[1]->d_type, "this is a reg"); #ifndef __linux__ expect(strlen("dir0") == namelist[1]->d_namlen, "got a str len"); #endif expect(NULL != namelist[2], "returns a pointer to the next directory entry"); expect(0 == strcmp("bombing", namelist[2]->d_name), "got bombing"); #ifndef __linux__ expect(strlen("bombing") == namelist[2]->d_namlen, "got a str len"); #endif expect(DT_REG == namelist[2]->d_type, "this is a reg"); for(i = 0; i < numEntries; i++){ free(namelist[i]); } free(namelist); fprintf(stderr, "\n"); fflush(stderr); } static void test_squash_readlink() { sqfs fs; sqfs_name name; size_t name_size = sizeof(name); struct stat st; ssize_t readsize; char content[] = ".0.0.4@something4"; char smallbuf[2] = {0,0}; fprintf(stderr, "Testing squash_readlink...\n"); fflush(stderr); memset(&st, 0, sizeof(st)); memset(&fs, 0, sizeof(sqfs)); sqfs_open_image(&fs, libsquash_fixture, 0); readsize = 0; readsize = squash_readlink(&fs, "/dir1/something4" ,(char *)&name, name_size); expect(0 == strcmp(name, content), "something4 links to .0.0.4@something4"); expect(strlen(content) == readsize, "squash_readlink return value is happy"); readsize = squash_readlink(&fs, "/dir1/something4" ,smallbuf, 2); expect(-1 == readsize, "squash_readlink ‘buf’ is too small ret val"); expect(ENAMETOOLONG == errno, "squash_readlink ‘buf’ is too small"); readsize = squash_readlink(&fs, "/dir1/something123456" ,smallbuf, 2); expect(-1 == readsize, "squash_readlink no such file ret val"); expect(ENOENT == errno, "squash_readlink no such file error"); fprintf(stderr, "\n"); fflush(stderr); } static void test_open_read_with_links() { sqfs fs; int fd; char buf[1024]; ssize_t x; fprintf(stderr, "Testing open & read with links\n"); fflush(stderr); memset(&fs, 0, sizeof(sqfs)); sqfs_open_image(&fs, libsquash_fixture, 0); fd = squash_open(&fs, "/dir1/something4/Egyptian"); expect(fd > 0, "successfully got a fd"); x = squash_read(fd, buf, 1024); expect(551 == x, "we can read 551"); buf[x+1] = '\0'; expect(buf == strstr(buf, "<NAME>, the Egyptian President"), "read some content of the file"); expect(0 == strncmp(buf + 501, "to Greece and arrived in Cairo that evening.[18]\n\n", 50), "read some content of the file"); fprintf(stderr, "\n"); fflush(stderr); } int main(int argc, char const *argv[]) { squash_start(); test_basic_func(); test_stat(); test_virtual_fd(); test_dirent(); test_squash_readlink(); test_open_read_with_links(); return 0; }
schmitzn/node-packer
node/src/env.h
<filename>node/src/env.h // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef SRC_ENV_H_ #define SRC_ENV_H_ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "aliased_buffer.h" #if HAVE_INSPECTOR #include "inspector_agent.h" #endif #include "handle_wrap.h" #include "req_wrap.h" #include "util.h" #include "uv.h" #include "v8.h" #include "node.h" #include "node_options.h" #include "node_http2_state.h" #include <list> #include <stdint.h> #include <vector> #include <unordered_map> #include <unordered_set> struct nghttp2_rcbuf; namespace node { namespace contextify { class ContextifyScript; } namespace fs { class FileHandleReadWrap; } namespace performance { class performance_state; } namespace tracing { class AgentWriterHandle; } namespace worker { class Worker; } namespace loader { class ModuleWrap; struct PackageConfig { enum class Exists { Yes, No }; enum class IsValid { Yes, No }; enum class HasMain { Yes, No }; Exists exists; IsValid is_valid; HasMain has_main; std::string main; }; } // namespace loader // The number of items passed to push_values_to_array_function has diminishing // returns around 8. This should be used at all call sites using said function. #ifndef NODE_PUSH_VAL_TO_ARRAY_MAX #define NODE_PUSH_VAL_TO_ARRAY_MAX 8 #endif // PER_ISOLATE_* macros: We have a lot of per-isolate properties // and adding and maintaining their getters and setters by hand would be // difficult so let's make the preprocessor generate them for us. // // In each macro, `V` is expected to be the name of a macro or function which // accepts the number of arguments provided in each tuple in the macro body, // typically two. The named function will be invoked against each tuple. // // Make sure that any macro V defined for use with the PER_ISOLATE_* macros is // undefined again after use. // Private symbols are per-isolate primitives but Environment proxies them // for the sake of convenience. Strings should be ASCII-only and have a // "node:" prefix to avoid name clashes with third-party code. #define PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(V) \ V(alpn_buffer_private_symbol, "node:alpnBuffer") \ V(arrow_message_private_symbol, "node:arrowMessage") \ V(contextify_context_private_symbol, "node:contextify:context") \ V(contextify_global_private_symbol, "node:contextify:global") \ V(decorated_private_symbol, "node:decorated") \ V(napi_env, "node:napi:env") \ V(napi_wrapper, "node:napi:wrapper") \ V(sab_lifetimepartner_symbol, "node:sharedArrayBufferLifetimePartner") \ // Symbols are per-isolate primitives but Environment proxies them // for the sake of convenience. #define PER_ISOLATE_SYMBOL_PROPERTIES(V) \ V(handle_onclose_symbol, "handle_onclose") \ V(oninit_symbol, "oninit") \ V(owner_symbol, "owner") \ // Strings are per-isolate primitives but Environment proxies them // for the sake of convenience. Strings should be ASCII-only. #define PER_ISOLATE_STRING_PROPERTIES(V) \ V(address_string, "address") \ V(aliases_string, "aliases") \ V(args_string, "args") \ V(async, "async") \ V(async_ids_stack_string, "async_ids_stack") \ V(buffer_string, "buffer") \ V(bytes_parsed_string, "bytesParsed") \ V(bytes_read_string, "bytesRead") \ V(bytes_string, "bytes") \ V(bytes_written_string, "bytesWritten") \ V(cached_data_produced_string, "cachedDataProduced") \ V(cached_data_rejected_string, "cachedDataRejected") \ V(cached_data_string, "cachedData") \ V(change_string, "change") \ V(channel_string, "channel") \ V(chunks_sent_since_last_write_string, "chunksSentSinceLastWrite") \ V(code_string, "code") \ V(constants_string, "constants") \ V(cwd_string, "cwd") \ V(dest_string, "dest") \ V(destroyed_string, "destroyed") \ V(detached_string, "detached") \ V(dns_a_string, "A") \ V(dns_aaaa_string, "AAAA") \ V(dns_cname_string, "CNAME") \ V(dns_mx_string, "MX") \ V(dns_naptr_string, "NAPTR") \ V(dns_ns_string, "NS") \ V(dns_ptr_string, "PTR") \ V(dns_soa_string, "SOA") \ V(dns_srv_string, "SRV") \ V(dns_txt_string, "TXT") \ V(duration_string, "duration") \ V(emit_warning_string, "emitWarning") \ V(encoding_string, "encoding") \ V(entries_string, "entries") \ V(entry_type_string, "entryType") \ V(env_pairs_string, "envPairs") \ V(env_var_settings_string, "envVarSettings") \ V(errno_string, "errno") \ V(error_string, "error") \ V(exchange_string, "exchange") \ V(exit_code_string, "exitCode") \ V(expire_string, "expire") \ V(exponent_string, "exponent") \ V(exports_string, "exports") \ V(ext_key_usage_string, "ext_key_usage") \ V(external_stream_string, "_externalStream") \ V(family_string, "family") \ V(fatal_exception_string, "_fatalException") \ V(fd_string, "fd") \ V(fields_string, "fields") \ V(file_string, "file") \ V(fingerprint256_string, "fingerprint256") \ V(fingerprint_string, "fingerprint") \ V(flags_string, "flags") \ V(fragment_string, "fragment") \ V(get_data_clone_error_string, "_getDataCloneError") \ V(get_shared_array_buffer_id_string, "_getSharedArrayBufferId") \ V(gid_string, "gid") \ V(handle_string, "handle") \ V(help_text_string, "helpText") \ V(homedir_string, "homedir") \ V(host_string, "host") \ V(hostmaster_string, "hostmaster") \ V(ignore_string, "ignore") \ V(infoaccess_string, "infoAccess") \ V(inherit_string, "inherit") \ V(input_string, "input") \ V(internal_string, "internal") \ V(ipv4_string, "IPv4") \ V(ipv6_string, "IPv6") \ V(isclosing_string, "isClosing") \ V(issuer_string, "issuer") \ V(issuercert_string, "issuerCertificate") \ V(kill_signal_string, "killSignal") \ V(kind_string, "kind") \ V(mac_string, "mac") \ V(main_string, "main") \ V(max_buffer_string, "maxBuffer") \ V(message_port_constructor_string, "MessagePort") \ V(message_port_string, "messagePort") \ V(message_string, "message") \ V(minttl_string, "minttl") \ V(modulus_string, "modulus") \ V(name_string, "name") \ V(netmask_string, "netmask") \ V(nsname_string, "nsname") \ V(ocsp_request_string, "OCSPRequest") \ V(onaltsvc_string, "onaltsvc") \ V(oncertcb_string, "oncertcb") \ V(onchange_string, "onchange") \ V(onclienthello_string, "onclienthello") \ V(oncomplete_string, "oncomplete") \ V(onconnection_string, "onconnection") \ V(ondone_string, "ondone") \ V(onerror_string, "onerror") \ V(onexit_string, "onexit") \ V(onframeerror_string, "onframeerror") \ V(ongetpadding_string, "ongetpadding") \ V(ongoawaydata_string, "ongoawaydata") \ V(onhandshakedone_string, "onhandshakedone") \ V(onhandshakestart_string, "onhandshakestart") \ V(onheaders_string, "onheaders") \ V(onmessage_string, "onmessage") \ V(onnewsession_string, "onnewsession") \ V(onocspresponse_string, "onocspresponse") \ V(onorigin_string, "onorigin") \ V(onping_string, "onping") \ V(onpriority_string, "onpriority") \ V(onread_string, "onread") \ V(onreadstart_string, "onreadstart") \ V(onreadstop_string, "onreadstop") \ V(onsettings_string, "onsettings") \ V(onshutdown_string, "onshutdown") \ V(onsignal_string, "onsignal") \ V(onstreamclose_string, "onstreamclose") \ V(ontrailers_string, "ontrailers") \ V(onunpipe_string, "onunpipe") \ V(onwrite_string, "onwrite") \ V(openssl_error_stack, "opensslErrorStack") \ V(options_string, "options") \ V(order_string, "order") \ V(output_string, "output") \ V(parse_error_string, "Parse Error") \ V(password_string, "password") \ V(path_string, "path") \ V(pending_handle_string, "pendingHandle") \ V(pid_string, "pid") \ V(pipe_source_string, "pipeSource") \ V(pipe_string, "pipe") \ V(pipe_target_string, "pipeTarget") \ V(port1_string, "port1") \ V(port2_string, "port2") \ V(port_string, "port") \ V(preference_string, "preference") \ V(priority_string, "priority") \ V(promise_string, "promise") \ V(pubkey_string, "pubkey") \ V(query_string, "query") \ V(raw_string, "raw") \ V(read_host_object_string, "_readHostObject") \ V(readable_string, "readable") \ V(refresh_string, "refresh") \ V(regexp_string, "regexp") \ V(rename_string, "rename") \ V(replacement_string, "replacement") \ V(retry_string, "retry") \ V(scheme_string, "scheme") \ V(scopeid_string, "scopeid") \ V(serial_number_string, "serialNumber") \ V(serial_string, "serial") \ V(servername_string, "servername") \ V(service_string, "service") \ V(session_id_string, "sessionId") \ V(shell_string, "shell") \ V(signal_string, "signal") \ V(sink_string, "sink") \ V(size_string, "size") \ V(sni_context_err_string, "Invalid SNI context") \ V(sni_context_string, "sni_context") \ V(source_string, "source") \ V(stack_string, "stack") \ V(start_time_string, "startTime") \ V(status_string, "status") \ V(stdio_string, "stdio") \ V(subject_string, "subject") \ V(subjectaltname_string, "subjectaltname") \ V(syscall_string, "syscall") \ V(thread_id_string, "threadId") \ V(ticketkeycallback_string, "onticketkeycallback") \ V(timeout_string, "timeout") \ V(tls_ticket_string, "tlsTicket") \ V(ttl_string, "ttl") \ V(type_string, "type") \ V(uid_string, "uid") \ V(unknown_string, "<unknown>") \ V(url_string, "url") \ V(username_string, "username") \ V(valid_from_string, "valid_from") \ V(valid_to_string, "valid_to") \ V(value_string, "value") \ V(verify_error_string, "verifyError") \ V(version_string, "version") \ V(weight_string, "weight") \ V(windows_hide_string, "windowsHide") \ V(windows_verbatim_arguments_string, "windowsVerbatimArguments") \ V(wrap_string, "wrap") \ V(writable_string, "writable") \ V(write_host_object_string, "_writeHostObject") \ V(write_queue_size_string, "writeQueueSize") \ V(x_forwarded_string, "x-forwarded-for") \ V(zero_return_string, "ZERO_RETURN") \ #define ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V) \ V(as_external, v8::External) \ V(async_hooks_after_function, v8::Function) \ V(async_hooks_before_function, v8::Function) \ V(async_hooks_binding, v8::Object) \ V(async_hooks_destroy_function, v8::Function) \ V(async_hooks_init_function, v8::Function) \ V(async_hooks_promise_resolve_function, v8::Function) \ V(async_wrap_ctor_template, v8::FunctionTemplate) \ V(async_wrap_object_ctor_template, v8::FunctionTemplate) \ V(buffer_prototype_object, v8::Object) \ V(context, v8::Context) \ V(domain_callback, v8::Function) \ V(domexception_function, v8::Function) \ V(fd_constructor_template, v8::ObjectTemplate) \ V(fdclose_constructor_template, v8::ObjectTemplate) \ V(filehandlereadwrap_template, v8::ObjectTemplate) \ V(fs_use_promises_symbol, v8::Symbol) \ V(fsreqpromise_constructor_template, v8::ObjectTemplate) \ V(handle_wrap_ctor_template, v8::FunctionTemplate) \ V(host_import_module_dynamically_callback, v8::Function) \ V(host_initialize_import_meta_object_callback, v8::Function) \ V(http2ping_constructor_template, v8::ObjectTemplate) \ V(http2settings_constructor_template, v8::ObjectTemplate) \ V(http2stream_constructor_template, v8::ObjectTemplate) \ V(immediate_callback_function, v8::Function) \ V(inspector_console_api_object, v8::Object) \ V(libuv_stream_wrap_ctor_template, v8::FunctionTemplate) \ V(message_port, v8::Object) \ V(message_port_constructor_template, v8::FunctionTemplate) \ V(performance_entry_callback, v8::Function) \ V(performance_entry_template, v8::Function) \ V(pipe_constructor_template, v8::FunctionTemplate) \ V(process_object, v8::Object) \ V(promise_handler_function, v8::Function) \ V(promise_wrap_template, v8::ObjectTemplate) \ V(push_values_to_array_function, v8::Function) \ V(sab_lifetimepartner_constructor_template, v8::FunctionTemplate) \ V(script_context_constructor_template, v8::FunctionTemplate) \ V(script_data_constructor_function, v8::Function) \ V(secure_context_constructor_template, v8::FunctionTemplate) \ V(shutdown_wrap_template, v8::ObjectTemplate) \ V(tcp_constructor_template, v8::FunctionTemplate) \ V(tick_callback_function, v8::Function) \ V(timers_callback_function, v8::Function) \ V(tls_wrap_constructor_function, v8::Function) \ V(tty_constructor_template, v8::FunctionTemplate) \ V(udp_constructor_function, v8::Function) \ V(url_constructor_function, v8::Function) \ V(write_wrap_template, v8::ObjectTemplate) \ class Environment; class IsolateData { public: IsolateData(v8::Isolate* isolate, uv_loop_t* event_loop, MultiIsolatePlatform* platform = nullptr, uint32_t* zero_fill_field = nullptr); ~IsolateData(); inline uv_loop_t* event_loop() const; inline uint32_t* zero_fill_field() const; inline MultiIsolatePlatform* platform() const; inline std::shared_ptr<PerIsolateOptions> options(); #define VP(PropertyName, StringValue) V(v8::Private, PropertyName) #define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) #define VS(PropertyName, StringValue) V(v8::String, PropertyName) #define V(TypeName, PropertyName) \ inline v8::Local<TypeName> PropertyName(v8::Isolate* isolate) const; PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) PER_ISOLATE_SYMBOL_PROPERTIES(VY) PER_ISOLATE_STRING_PROPERTIES(VS) #undef V #undef VY #undef VS #undef VP std::unordered_map<nghttp2_rcbuf*, v8::Eternal<v8::String>> http2_static_strs; inline v8::Isolate* isolate() const; private: #define VP(PropertyName, StringValue) V(v8::Private, PropertyName) #define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) #define VS(PropertyName, StringValue) V(v8::String, PropertyName) #define V(TypeName, PropertyName) \ v8::Eternal<TypeName> PropertyName ## _; PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) PER_ISOLATE_SYMBOL_PROPERTIES(VY) PER_ISOLATE_STRING_PROPERTIES(VS) #undef V #undef VY #undef VS #undef VP v8::Isolate* const isolate_; uv_loop_t* const event_loop_; uint32_t* const zero_fill_field_; MultiIsolatePlatform* platform_; std::shared_ptr<PerIsolateOptions> options_; DISALLOW_COPY_AND_ASSIGN(IsolateData); }; struct ContextInfo { explicit ContextInfo(const std::string& name) : name(name) {} const std::string name; std::string origin; bool is_default = false; }; struct CompileFnEntry { Environment* env; uint32_t id; CompileFnEntry(Environment* env, uint32_t id); }; // Listing the AsyncWrap provider types first enables us to cast directly // from a provider type to a debug category. #define DEBUG_CATEGORY_NAMES(V) \ NODE_ASYNC_PROVIDER_TYPES(V) \ V(INSPECTOR_SERVER) enum class DebugCategory { #define V(name) name, DEBUG_CATEGORY_NAMES(V) #undef V CATEGORY_COUNT }; class Environment { public: class AsyncHooks { public: // Reason for both UidFields and Fields are that one is stored as a double* // and the other as a uint32_t*. enum Fields { kInit, kBefore, kAfter, kDestroy, kPromiseResolve, kTotals, kCheck, kStackLength, kFieldsCount, }; enum UidFields { kExecutionAsyncId, kTriggerAsyncId, kAsyncIdCounter, kDefaultTriggerAsyncId, kUidFieldsCount, }; inline AliasedBuffer<uint32_t, v8::Uint32Array>& fields(); inline AliasedBuffer<double, v8::Float64Array>& async_id_fields(); inline AliasedBuffer<double, v8::Float64Array>& async_ids_stack(); inline v8::Local<v8::String> provider_string(int idx); inline void no_force_checks(); inline Environment* env(); inline void push_async_ids(double async_id, double trigger_async_id); inline bool pop_async_id(double async_id); inline void clear_async_id_stack(); // Used in fatal exceptions. // Used to set the kDefaultTriggerAsyncId in a scope. This is instead of // passing the trigger_async_id along with other constructor arguments. class DefaultTriggerAsyncIdScope { public: DefaultTriggerAsyncIdScope() = delete; explicit DefaultTriggerAsyncIdScope(Environment* env, double init_trigger_async_id); explicit DefaultTriggerAsyncIdScope(AsyncWrap* async_wrap); ~DefaultTriggerAsyncIdScope(); private: AsyncHooks* async_hooks_; double old_default_trigger_async_id_; DISALLOW_COPY_AND_ASSIGN(DefaultTriggerAsyncIdScope); }; private: friend class Environment; // So we can call the constructor. inline AsyncHooks(); // Keep a list of all Persistent strings used for Provider types. v8::Eternal<v8::String> providers_[AsyncWrap::PROVIDERS_LENGTH]; // Keep track of the environment copy itself. Environment* env_; // Stores the ids of the current execution context stack. AliasedBuffer<double, v8::Float64Array> async_ids_stack_; // Attached to a Uint32Array that tracks the number of active hooks for // each type. AliasedBuffer<uint32_t, v8::Uint32Array> fields_; // Attached to a Float64Array that tracks the state of async resources. AliasedBuffer<double, v8::Float64Array> async_id_fields_; void grow_async_ids_stack(); DISALLOW_COPY_AND_ASSIGN(AsyncHooks); }; class AsyncCallbackScope { public: AsyncCallbackScope() = delete; explicit AsyncCallbackScope(Environment* env); ~AsyncCallbackScope(); private: Environment* env_; DISALLOW_COPY_AND_ASSIGN(AsyncCallbackScope); }; inline size_t makecallback_depth() const; class ImmediateInfo { public: inline AliasedBuffer<uint32_t, v8::Uint32Array>& fields(); inline uint32_t count() const; inline uint32_t ref_count() const; inline bool has_outstanding() const; inline void count_inc(uint32_t increment); inline void count_dec(uint32_t decrement); inline void ref_count_inc(uint32_t increment); inline void ref_count_dec(uint32_t decrement); private: friend class Environment; // So we can call the constructor. inline explicit ImmediateInfo(v8::Isolate* isolate); enum Fields { kCount, kRefCount, kHasOutstanding, kFieldsCount }; AliasedBuffer<uint32_t, v8::Uint32Array> fields_; DISALLOW_COPY_AND_ASSIGN(ImmediateInfo); }; class TickInfo { public: inline AliasedBuffer<uint8_t, v8::Uint8Array>& fields(); inline bool has_scheduled() const; inline bool has_promise_rejections() const; inline bool has_thrown() const; inline void promise_rejections_toggle_on(); inline void set_has_thrown(bool state); private: friend class Environment; // So we can call the constructor. inline explicit TickInfo(v8::Isolate* isolate); enum Fields { kHasScheduled, kHasPromiseRejections, kHasThrown, kFieldsCount }; AliasedBuffer<uint8_t, v8::Uint8Array> fields_; DISALLOW_COPY_AND_ASSIGN(TickInfo); }; static inline Environment* GetCurrent(v8::Isolate* isolate); static inline Environment* GetCurrent(v8::Local<v8::Context> context); static inline Environment* GetCurrent( const v8::FunctionCallbackInfo<v8::Value>& info); template <typename T> static inline Environment* GetCurrent( const v8::PropertyCallbackInfo<T>& info); static uv_key_t thread_local_env; static inline Environment* GetThreadLocalEnv(); Environment(IsolateData* isolate_data, v8::Local<v8::Context> context, tracing::AgentWriterHandle* tracing_agent_writer); ~Environment(); void Start(const std::vector<std::string>& args, const std::vector<std::string>& exec_args, bool start_profiler_idle_notifier); typedef void (*HandleCleanupCb)(Environment* env, uv_handle_t* handle, void* arg); struct HandleCleanup { uv_handle_t* handle_; HandleCleanupCb cb_; void* arg_; }; void RegisterHandleCleanups(); void CleanupHandles(); void Exit(int code); // Register clean-up cb to be called on environment destruction. inline void RegisterHandleCleanup(uv_handle_t* handle, HandleCleanupCb cb, void* arg); template <typename T, typename OnCloseCallback> inline void CloseHandle(T* handle, OnCloseCallback callback); inline void AssignToContext(v8::Local<v8::Context> context, const ContextInfo& info); void StartProfilerIdleNotifier(); void StopProfilerIdleNotifier(); inline bool profiler_idle_notifier_started() const; inline v8::Isolate* isolate() const; inline tracing::AgentWriterHandle* tracing_agent_writer() const; inline uv_loop_t* event_loop() const; inline uint32_t watched_providers() const; static inline Environment* from_immediate_check_handle(uv_check_t* handle); inline uv_check_t* immediate_check_handle(); inline uv_idle_t* immediate_idle_handle(); inline void IncreaseWaitingRequestCounter(); inline void DecreaseWaitingRequestCounter(); inline AsyncHooks* async_hooks(); inline ImmediateInfo* immediate_info(); inline TickInfo* tick_info(); inline uint64_t timer_base() const; inline IsolateData* isolate_data() const; inline bool printed_error() const; inline void set_printed_error(bool value); void PrintSyncTrace() const; inline void set_trace_sync_io(bool value); // This stores whether the --abort-on-uncaught-exception flag was passed // to Node. inline bool abort_on_uncaught_exception() const; inline void set_abort_on_uncaught_exception(bool value); // This is a pseudo-boolean that keeps track of whether an uncaught exception // should abort the process or not if --abort-on-uncaught-exception was // passed to Node. If the flag was not passed, it is ignored. inline AliasedBuffer<uint32_t, v8::Uint32Array>& should_abort_on_uncaught_toggle(); // The necessary API for async_hooks. inline double new_async_id(); inline double execution_async_id(); inline double trigger_async_id(); inline double get_default_trigger_async_id(); // List of id's that have been destroyed and need the destroy() cb called. inline std::vector<double>* destroy_async_id_list(); std::unordered_multimap<int, loader::ModuleWrap*> hash_to_module_map; std::unordered_map<uint32_t, loader::ModuleWrap*> id_to_module_map; std::unordered_map<uint32_t, contextify::ContextifyScript*> id_to_script_map; std::unordered_set<CompileFnEntry*> compile_fn_entries; std::unordered_map<uint32_t, Persistent<v8::Function>> id_to_function_map; inline uint32_t get_next_module_id(); inline uint32_t get_next_script_id(); inline uint32_t get_next_function_id(); std::unordered_map<std::string, const loader::PackageConfig> package_json_cache; inline double* heap_statistics_buffer() const; inline void set_heap_statistics_buffer(double* pointer); inline double* heap_space_statistics_buffer() const; inline void set_heap_space_statistics_buffer(double* pointer); inline char* http_parser_buffer() const; inline void set_http_parser_buffer(char* buffer); inline bool http_parser_buffer_in_use() const; inline void set_http_parser_buffer_in_use(bool in_use); inline http2::Http2State* http2_state() const; inline void set_http2_state(std::unique_ptr<http2::Http2State> state); inline bool debug_enabled(DebugCategory category) const; inline void set_debug_enabled(DebugCategory category, bool enabled); void set_debug_categories(const std::string& cats, bool enabled); inline AliasedBuffer<double, v8::Float64Array>* fs_stats_field_array(); inline AliasedBuffer<uint64_t, v8::BigUint64Array>* fs_stats_field_bigint_array(); // stat fields contains twice the number of entries because `fs.StatWatcher` // needs room to store data for *two* `fs.Stats` instances. static const int kFsStatsFieldsLength = 14; inline std::vector<std::unique_ptr<fs::FileHandleReadWrap>>& file_handle_read_wrap_freelist(); inline performance::performance_state* performance_state(); inline std::unordered_map<std::string, uint64_t>* performance_marks(); void CollectExceptionInfo(v8::Local<v8::Value> context, int errorno, const char* syscall = nullptr, const char* message = nullptr, const char* path = nullptr); void CollectUVExceptionInfo(v8::Local<v8::Value> context, int errorno, const char* syscall = nullptr, const char* message = nullptr, const char* path = nullptr, const char* dest = nullptr); // If this flag is set, calls into JS (if they would be observable // from userland) must be avoided. This flag does not indicate whether // calling into JS is allowed from a VM perspective at this point. inline bool can_call_into_js() const; inline void set_can_call_into_js(bool can_call_into_js); inline bool is_main_thread() const; inline uint64_t thread_id() const; inline void set_thread_id(uint64_t id); inline worker::Worker* worker_context() const; inline void set_worker_context(worker::Worker* context); inline void add_sub_worker_context(worker::Worker* context); inline void remove_sub_worker_context(worker::Worker* context); void stop_sub_worker_contexts(); inline bool is_stopping_worker() const; inline void ThrowError(const char* errmsg); inline void ThrowTypeError(const char* errmsg); inline void ThrowRangeError(const char* errmsg); inline void ThrowErrnoException(int errorno, const char* syscall = nullptr, const char* message = nullptr, const char* path = nullptr); inline void ThrowUVException(int errorno, const char* syscall = nullptr, const char* message = nullptr, const char* path = nullptr, const char* dest = nullptr); inline v8::Local<v8::FunctionTemplate> NewFunctionTemplate(v8::FunctionCallback callback, v8::Local<v8::Signature> signature = v8::Local<v8::Signature>(), v8::ConstructorBehavior behavior = v8::ConstructorBehavior::kAllow, v8::SideEffectType side_effect = v8::SideEffectType::kHasSideEffect); // Convenience methods for NewFunctionTemplate(). inline void SetMethod(v8::Local<v8::Object> that, const char* name, v8::FunctionCallback callback); inline void SetProtoMethod(v8::Local<v8::FunctionTemplate> that, const char* name, v8::FunctionCallback callback); inline void SetTemplateMethod(v8::Local<v8::FunctionTemplate> that, const char* name, v8::FunctionCallback callback); // Safe variants denote the function has no side effects. inline void SetMethodNoSideEffect(v8::Local<v8::Object> that, const char* name, v8::FunctionCallback callback); inline void SetProtoMethodNoSideEffect(v8::Local<v8::FunctionTemplate> that, const char* name, v8::FunctionCallback callback); inline void SetTemplateMethodNoSideEffect( v8::Local<v8::FunctionTemplate> that, const char* name, v8::FunctionCallback callback); void BeforeExit(void (*cb)(void* arg), void* arg); void RunBeforeExitCallbacks(); void AtExit(void (*cb)(void* arg), void* arg); void RunAtExitCallbacks(); // Strings and private symbols are shared across shared contexts // The getters simply proxy to the per-isolate primitive. #define VP(PropertyName, StringValue) V(v8::Private, PropertyName) #define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) #define VS(PropertyName, StringValue) V(v8::String, PropertyName) #define V(TypeName, PropertyName) \ inline v8::Local<TypeName> PropertyName() const; PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) PER_ISOLATE_SYMBOL_PROPERTIES(VY) PER_ISOLATE_STRING_PROPERTIES(VS) #undef V #undef VS #undef VY #undef VP #define V(PropertyName, TypeName) \ inline v8::Local<TypeName> PropertyName() const; \ inline void set_ ## PropertyName(v8::Local<TypeName> value); ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V) #undef V #if HAVE_INSPECTOR inline inspector::Agent* inspector_agent() const { return inspector_agent_.get(); } #endif typedef ListHead<HandleWrap, &HandleWrap::handle_wrap_queue_> HandleWrapQueue; typedef ListHead<ReqWrap<uv_req_t>, &ReqWrap<uv_req_t>::req_wrap_queue_> ReqWrapQueue; inline HandleWrapQueue* handle_wrap_queue() { return &handle_wrap_queue_; } inline ReqWrapQueue* req_wrap_queue() { return &req_wrap_queue_; } void AddPromiseHook(promise_hook_func fn, void* arg); bool RemovePromiseHook(promise_hook_func fn, void* arg); inline bool EmitProcessEnvWarning() { bool current_value = emit_env_nonstring_warning_; emit_env_nonstring_warning_ = false; return current_value; } typedef void (*native_immediate_callback)(Environment* env, void* data); // cb will be called as cb(env, data) on the next event loop iteration. // obj will be kept alive between now and after the callback has run. inline void SetImmediate(native_immediate_callback cb, void* data, v8::Local<v8::Object> obj = v8::Local<v8::Object>()); inline void SetUnrefImmediate(native_immediate_callback cb, void* data, v8::Local<v8::Object> obj = v8::Local<v8::Object>()); // This needs to be available for the JS-land setImmediate(). void ToggleImmediateRef(bool ref); class ShouldNotAbortOnUncaughtScope { public: explicit inline ShouldNotAbortOnUncaughtScope(Environment* env); inline void Close(); inline ~ShouldNotAbortOnUncaughtScope(); private: Environment* env_; }; inline bool inside_should_not_abort_on_uncaught_scope() const; static inline Environment* ForAsyncHooks(AsyncHooks* hooks); v8::Local<v8::Value> GetNow(); inline void AddCleanupHook(void (*fn)(void*), void* arg); inline void RemoveCleanupHook(void (*fn)(void*), void* arg); void RunCleanup(); static void BuildEmbedderGraph(v8::Isolate* isolate, v8::EmbedderGraph* graph, void* data); inline std::shared_ptr<EnvironmentOptions> options(); private: inline void CreateImmediate(native_immediate_callback cb, void* data, v8::Local<v8::Object> obj, bool ref); inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>), const char* errmsg); v8::Isolate* const isolate_; IsolateData* const isolate_data_; tracing::AgentWriterHandle* const tracing_agent_writer_; uv_check_t immediate_check_handle_; uv_idle_t immediate_idle_handle_; uv_prepare_t idle_prepare_handle_; uv_check_t idle_check_handle_; bool profiler_idle_notifier_started_ = false; AsyncHooks async_hooks_; ImmediateInfo immediate_info_; TickInfo tick_info_; const uint64_t timer_base_; bool printed_error_; bool abort_on_uncaught_exception_; bool emit_env_nonstring_warning_; size_t makecallback_cntr_; std::vector<double> destroy_async_id_list_; std::shared_ptr<EnvironmentOptions> options_; uint32_t module_id_counter_ = 0; uint32_t script_id_counter_ = 0; uint32_t function_id_counter_ = 0; AliasedBuffer<uint32_t, v8::Uint32Array> should_abort_on_uncaught_toggle_; int should_not_abort_scope_counter_ = 0; std::unique_ptr<performance::performance_state> performance_state_; std::unordered_map<std::string, uint64_t> performance_marks_; bool can_call_into_js_ = true; uint64_t thread_id_ = 0; std::unordered_set<worker::Worker*> sub_worker_contexts_; static void* kNodeContextTagPtr; static int const kNodeContextTag; #if HAVE_INSPECTOR std::unique_ptr<inspector::Agent> inspector_agent_; #endif // handle_wrap_queue_ and req_wrap_queue_ needs to be at a fixed offset from // the start of the class because it is used by // src/node_postmortem_metadata.cc to calculate offsets and generate debug // symbols for Environment, which assumes that the position of members in // memory are predictable. For more information please refer to // `doc/guides/node-postmortem-support.md` friend int GenDebugSymbols(); HandleWrapQueue handle_wrap_queue_; ReqWrapQueue req_wrap_queue_; std::list<HandleCleanup> handle_cleanup_queue_; int handle_cleanup_waiting_ = 0; int request_waiting_ = 0; double* heap_statistics_buffer_ = nullptr; double* heap_space_statistics_buffer_ = nullptr; char* http_parser_buffer_; bool http_parser_buffer_in_use_ = false; std::unique_ptr<http2::Http2State> http2_state_; bool debug_enabled_[static_cast<int>(DebugCategory::CATEGORY_COUNT)] = {0}; AliasedBuffer<double, v8::Float64Array> fs_stats_field_array_; AliasedBuffer<uint64_t, v8::BigUint64Array> fs_stats_field_bigint_array_; std::vector<std::unique_ptr<fs::FileHandleReadWrap>> file_handle_read_wrap_freelist_; worker::Worker* worker_context_ = nullptr; struct ExitCallback { void (*cb_)(void* arg); void* arg_; }; std::list<ExitCallback> before_exit_functions_; std::list<ExitCallback> at_exit_functions_; struct PromiseHookCallback { promise_hook_func cb_; void* arg_; size_t enable_count_; }; std::vector<PromiseHookCallback> promise_hooks_; struct NativeImmediateCallback { native_immediate_callback cb_; void* data_; v8::Global<v8::Object> keep_alive_; bool refed_; }; std::vector<NativeImmediateCallback> native_immediate_callbacks_; void RunAndClearNativeImmediates(); static void CheckImmediate(uv_check_t* handle); struct CleanupHookCallback { void (*fn_)(void*); void* arg_; // We keep track of the insertion order for these objects, so that we can // call the callbacks in reverse order when we are cleaning up. uint64_t insertion_order_counter_; // Only hashes `arg_`, since that is usually enough to identify the hook. struct Hash { inline size_t operator()(const CleanupHookCallback& cb) const; }; // Compares by `fn_` and `arg_` being equal. struct Equal { inline bool operator()(const CleanupHookCallback& a, const CleanupHookCallback& b) const; }; inline BaseObject* GetBaseObject() const; }; // Use an unordered_set, so that we have efficient insertion and removal. std::unordered_set<CleanupHookCallback, CleanupHookCallback::Hash, CleanupHookCallback::Equal> cleanup_hooks_; uint64_t cleanup_hook_counter_ = 0; static void EnvPromiseHook(v8::PromiseHookType type, v8::Local<v8::Promise> promise, v8::Local<v8::Value> parent); template <typename T> void ForEachBaseObject(T&& iterator); #define V(PropertyName, TypeName) Persistent<TypeName> PropertyName ## _; ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V) #undef V DISALLOW_COPY_AND_ASSIGN(Environment); }; } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_ENV_H_
schmitzn/node-packer
node/deps/icu-small/source/i18n/unicode/reldatefmt.h
<reponame>schmitzn/node-packer // © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************** * Copyright (C) 2014-2016, International Business Machines Corporation and * others. * All Rights Reserved. ***************************************************************************** * * File RELDATEFMT.H ***************************************************************************** */ #ifndef __RELDATEFMT_H #define __RELDATEFMT_H #include "unicode/utypes.h" #include "unicode/uobject.h" #include "unicode/udisplaycontext.h" #include "unicode/ureldatefmt.h" #include "unicode/locid.h" #include "unicode/formattedvalue.h" /** * \file * \brief C++ API: Formats relative dates such as "1 day ago" or "tomorrow" */ #if !UCONFIG_NO_FORMATTING /** * Represents the unit for formatting a relative date. e.g "in 5 days" * or "in 3 months" * @stable ICU 53 */ typedef enum UDateRelativeUnit { /** * Seconds * @stable ICU 53 */ UDAT_RELATIVE_SECONDS, /** * Minutes * @stable ICU 53 */ UDAT_RELATIVE_MINUTES, /** * Hours * @stable ICU 53 */ UDAT_RELATIVE_HOURS, /** * Days * @stable ICU 53 */ UDAT_RELATIVE_DAYS, /** * Weeks * @stable ICU 53 */ UDAT_RELATIVE_WEEKS, /** * Months * @stable ICU 53 */ UDAT_RELATIVE_MONTHS, /** * Years * @stable ICU 53 */ UDAT_RELATIVE_YEARS, #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UDateRelativeUnit value. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UDAT_RELATIVE_UNIT_COUNT #endif // U_HIDE_DEPRECATED_API } UDateRelativeUnit; /** * Represents an absolute unit. * @stable ICU 53 */ typedef enum UDateAbsoluteUnit { // Days of week have to remain together and in order from Sunday to // Saturday. /** * Sunday * @stable ICU 53 */ UDAT_ABSOLUTE_SUNDAY, /** * Monday * @stable ICU 53 */ UDAT_ABSOLUTE_MONDAY, /** * Tuesday * @stable ICU 53 */ UDAT_ABSOLUTE_TUESDAY, /** * Wednesday * @stable ICU 53 */ UDAT_ABSOLUTE_WEDNESDAY, /** * Thursday * @stable ICU 53 */ UDAT_ABSOLUTE_THURSDAY, /** * Friday * @stable ICU 53 */ UDAT_ABSOLUTE_FRIDAY, /** * Saturday * @stable ICU 53 */ UDAT_ABSOLUTE_SATURDAY, /** * Day * @stable ICU 53 */ UDAT_ABSOLUTE_DAY, /** * Week * @stable ICU 53 */ UDAT_ABSOLUTE_WEEK, /** * Month * @stable ICU 53 */ UDAT_ABSOLUTE_MONTH, /** * Year * @stable ICU 53 */ UDAT_ABSOLUTE_YEAR, /** * Now * @stable ICU 53 */ UDAT_ABSOLUTE_NOW, #ifndef U_HIDE_DRAFT_API /** * Quarter * @draft ICU 63 */ UDAT_ABSOLUTE_QUARTER, #endif // U_HIDE_DRAFT_API #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UDateAbsoluteUnit value. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UDAT_ABSOLUTE_UNIT_COUNT = UDAT_ABSOLUTE_NOW + 2 #endif // U_HIDE_DEPRECATED_API } UDateAbsoluteUnit; /** * Represents a direction for an absolute unit e.g "Next Tuesday" * or "Last Tuesday" * @stable ICU 53 */ typedef enum UDateDirection { /** * Two before. Not fully supported in every locale. * @stable ICU 53 */ UDAT_DIRECTION_LAST_2, /** * Last * @stable ICU 53 */ UDAT_DIRECTION_LAST, /** * This * @stable ICU 53 */ UDAT_DIRECTION_THIS, /** * Next * @stable ICU 53 */ UDAT_DIRECTION_NEXT, /** * Two after. Not fully supported in every locale. * @stable ICU 53 */ UDAT_DIRECTION_NEXT_2, /** * Plain, which means the absence of a qualifier. * @stable ICU 53 */ UDAT_DIRECTION_PLAIN, #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UDateDirection value. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UDAT_DIRECTION_COUNT #endif // U_HIDE_DEPRECATED_API } UDateDirection; #if !UCONFIG_NO_BREAK_ITERATION U_NAMESPACE_BEGIN class BreakIterator; class RelativeDateTimeCacheData; class SharedNumberFormat; class SharedPluralRules; class SharedBreakIterator; class NumberFormat; class UnicodeString; class FormattedRelativeDateTimeData; #ifndef U_HIDE_DRAFT_API /** * An immutable class containing the result of a relative datetime formatting operation. * * Instances of this class are immutable and thread-safe. * * Not intended for public subclassing. * * @draft ICU 64 */ class U_I18N_API FormattedRelativeDateTime : public UMemory, public FormattedValue { public: /** * Default constructor; makes an empty FormattedRelativeDateTime. * @draft ICU 64 */ FormattedRelativeDateTime() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {} /** * Move constructor: Leaves the source FormattedRelativeDateTime in an undefined state. * @draft ICU 64 */ FormattedRelativeDateTime(FormattedRelativeDateTime&& src) U_NOEXCEPT; /** * Destruct an instance of FormattedRelativeDateTime. * @draft ICU 64 */ virtual ~FormattedRelativeDateTime() U_OVERRIDE; /** Copying not supported; use move constructor instead. */ FormattedRelativeDateTime(const FormattedRelativeDateTime&) = delete; /** Copying not supported; use move assignment instead. */ FormattedRelativeDateTime& operator=(const FormattedRelativeDateTime&) = delete; /** * Move assignment: Leaves the source FormattedRelativeDateTime in an undefined state. * @draft ICU 64 */ FormattedRelativeDateTime& operator=(FormattedRelativeDateTime&& src) U_NOEXCEPT; /** @copydoc FormattedValue::toString() */ UnicodeString toString(UErrorCode& status) const U_OVERRIDE; /** @copydoc FormattedValue::toTempString() */ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; /** @copydoc FormattedValue::appendTo() */ Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; /** @copydoc FormattedValue::nextPosition() */ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; private: FormattedRelativeDateTimeData *fData; UErrorCode fErrorCode; explicit FormattedRelativeDateTime(FormattedRelativeDateTimeData *results) : fData(results), fErrorCode(U_ZERO_ERROR) {} explicit FormattedRelativeDateTime(UErrorCode errorCode) : fData(nullptr), fErrorCode(errorCode) {} friend class RelativeDateTimeFormatter; }; #endif /* U_HIDE_DRAFT_API */ /** * Formats simple relative dates. There are two types of relative dates that * it handles: * <ul> * <li>relative dates with a quantity e.g "in 5 days"</li> * <li>relative dates without a quantity e.g "next Tuesday"</li> * </ul> * <p> * This API is very basic and is intended to be a building block for more * fancy APIs. The caller tells it exactly what to display in a locale * independent way. While this class automatically provides the correct plural * forms, the grammatical form is otherwise as neutral as possible. It is the * caller's responsibility to handle cut-off logic such as deciding between * displaying "in 7 days" or "in 1 week." This API supports relative dates * involving one single unit. This API does not support relative dates * involving compound units, * e.g "in 5 days and 4 hours" nor does it support parsing. * <p> * This class is mostly thread safe and immutable with the following caveats: * 1. The assignment operator violates Immutability. It must not be used * concurrently with other operations. * 2. Caller must not hold onto adopted pointers. * <p> * This class is not intended for public subclassing. * <p> * Here are some examples of use: * <blockquote> * <pre> * UErrorCode status = U_ZERO_ERROR; * UnicodeString appendTo; * RelativeDateTimeFormatter fmt(status); * // Appends "in 1 day" * fmt.format( * 1, UDAT_DIRECTION_NEXT, UDAT_RELATIVE_DAYS, appendTo, status); * // Appends "in 3 days" * fmt.format( * 3, UDAT_DIRECTION_NEXT, UDAT_RELATIVE_DAYS, appendTo, status); * // Appends "3.2 years ago" * fmt.format( * 3.2, UDAT_DIRECTION_LAST, UDAT_RELATIVE_YEARS, appendTo, status); * // Appends "last Sunday" * fmt.format(UDAT_DIRECTION_LAST, UDAT_ABSOLUTE_SUNDAY, appendTo, status); * // Appends "this Sunday" * fmt.format(UDAT_DIRECTION_THIS, UDAT_ABSOLUTE_SUNDAY, appendTo, status); * // Appends "next Sunday" * fmt.format(UDAT_DIRECTION_NEXT, UDAT_ABSOLUTE_SUNDAY, appendTo, status); * // Appends "Sunday" * fmt.format(UDAT_DIRECTION_PLAIN, UDAT_ABSOLUTE_SUNDAY, appendTo, status); * * // Appends "yesterday" * fmt.format(UDAT_DIRECTION_LAST, UDAT_ABSOLUTE_DAY, appendTo, status); * // Appends "today" * fmt.format(UDAT_DIRECTION_THIS, UDAT_ABSOLUTE_DAY, appendTo, status); * // Appends "tomorrow" * fmt.format(UDAT_DIRECTION_NEXT, UDAT_ABSOLUTE_DAY, appendTo, status); * // Appends "now" * fmt.format(UDAT_DIRECTION_PLAIN, UDAT_ABSOLUTE_NOW, appendTo, status); * * </pre> * </blockquote> * <p> * In the future, we may add more forms, such as abbreviated/short forms * (3 secs ago), and relative day periods ("yesterday afternoon"), etc. * * The RelativeDateTimeFormatter class is not intended for public subclassing. * * @stable ICU 53 */ class U_I18N_API RelativeDateTimeFormatter : public UObject { public: /** * Create RelativeDateTimeFormatter with default locale. * @stable ICU 53 */ RelativeDateTimeFormatter(UErrorCode& status); /** * Create RelativeDateTimeFormatter with given locale. * @stable ICU 53 */ RelativeDateTimeFormatter(const Locale& locale, UErrorCode& status); /** * Create RelativeDateTimeFormatter with given locale and NumberFormat. * * @param locale the locale * @param nfToAdopt Constructed object takes ownership of this pointer. * It is an error for caller to delete this pointer or change its * contents after calling this constructor. * @param status Any error is returned here. * @stable ICU 53 */ RelativeDateTimeFormatter( const Locale& locale, NumberFormat *nfToAdopt, UErrorCode& status); /** * Create RelativeDateTimeFormatter with given locale, NumberFormat, * and capitalization context. * * @param locale the locale * @param nfToAdopt Constructed object takes ownership of this pointer. * It is an error for caller to delete this pointer or change its * contents after calling this constructor. Caller may pass NULL for * this argument if they want default number format behavior. * @param style the format style. The UDAT_RELATIVE bit field has no effect. * @param capitalizationContext A value from UDisplayContext that pertains to * capitalization. * @param status Any error is returned here. * @stable ICU 54 */ RelativeDateTimeFormatter( const Locale& locale, NumberFormat *nfToAdopt, UDateRelativeDateTimeFormatterStyle style, UDisplayContext capitalizationContext, UErrorCode& status); /** * Copy constructor. * @stable ICU 53 */ RelativeDateTimeFormatter(const RelativeDateTimeFormatter& other); /** * Assignment operator. * @stable ICU 53 */ RelativeDateTimeFormatter& operator=( const RelativeDateTimeFormatter& other); /** * Destructor. * @stable ICU 53 */ virtual ~RelativeDateTimeFormatter(); /** * Formats a relative date with a quantity such as "in 5 days" or * "3 months ago" * * This method returns a String. To get more information about the * formatting result, use formatToValue(). * * @param quantity The numerical amount e.g 5. This value is formatted * according to this object's NumberFormat object. * @param direction NEXT means a future relative date; LAST means a past * relative date. If direction is anything else, this method sets * status to U_ILLEGAL_ARGUMENT_ERROR. * @param unit the unit e.g day? month? year? * @param appendTo The string to which the formatted result will be * appended * @param status ICU error code returned here. * @return appendTo * @stable ICU 53 */ UnicodeString& format( double quantity, UDateDirection direction, UDateRelativeUnit unit, UnicodeString& appendTo, UErrorCode& status) const; #ifndef U_HIDE_DRAFT_API /** * Formats a relative date with a quantity such as "in 5 days" or * "3 months ago" * * This method returns a FormattedRelativeDateTime, which exposes more * information than the String returned by format(). * * @param quantity The numerical amount e.g 5. This value is formatted * according to this object's NumberFormat object. * @param direction NEXT means a future relative date; LAST means a past * relative date. If direction is anything else, this method sets * status to U_ILLEGAL_ARGUMENT_ERROR. * @param unit the unit e.g day? month? year? * @param status ICU error code returned here. * @return The formatted relative datetime * @draft ICU 64 */ FormattedRelativeDateTime formatToValue( double quantity, UDateDirection direction, UDateRelativeUnit unit, UErrorCode& status) const; #endif /* U_HIDE_DRAFT_API */ /** * Formats a relative date without a quantity. * * This method returns a String. To get more information about the * formatting result, use formatToValue(). * * @param direction NEXT, LAST, THIS, etc. * @param unit e.g SATURDAY, DAY, MONTH * @param appendTo The string to which the formatted result will be * appended. If the value of direction is documented as not being fully * supported in all locales then this method leaves appendTo unchanged if * no format string is available. * @param status ICU error code returned here. * @return appendTo * @stable ICU 53 */ UnicodeString& format( UDateDirection direction, UDateAbsoluteUnit unit, UnicodeString& appendTo, UErrorCode& status) const; #ifndef U_HIDE_DRAFT_API /** * Formats a relative date without a quantity. * * This method returns a FormattedRelativeDateTime, which exposes more * information than the String returned by format(). * * If the string is not available in the requested locale, the return * value will be empty (calling toString will give an empty string). * * @param direction NEXT, LAST, THIS, etc. * @param unit e.g SATURDAY, DAY, MONTH * @param status ICU error code returned here. * @return The formatted relative datetime * @draft ICU 64 */ FormattedRelativeDateTime formatToValue( UDateDirection direction, UDateAbsoluteUnit unit, UErrorCode& status) const; #endif /* U_HIDE_DRAFT_API */ /** * Format a combination of URelativeDateTimeUnit and numeric offset * using a numeric style, e.g. "1 week ago", "in 1 week", * "5 weeks ago", "in 5 weeks". * * This method returns a String. To get more information about the * formatting result, use formatNumericToValue(). * * @param offset The signed offset for the specified unit. This * will be formatted according to this object's * NumberFormat object. * @param unit The unit to use when formatting the relative * date, e.g. UDAT_REL_UNIT_WEEK, * UDAT_REL_UNIT_FRIDAY. * @param appendTo The string to which the formatted result will be * appended. * @param status ICU error code returned here. * @return appendTo * @stable ICU 57 */ UnicodeString& formatNumeric( double offset, URelativeDateTimeUnit unit, UnicodeString& appendTo, UErrorCode& status) const; #ifndef U_HIDE_DRAFT_API /** * Format a combination of URelativeDateTimeUnit and numeric offset * using a numeric style, e.g. "1 week ago", "in 1 week", * "5 weeks ago", "in 5 weeks". * * This method returns a FormattedRelativeDateTime, which exposes more * information than the String returned by formatNumeric(). * * @param offset The signed offset for the specified unit. This * will be formatted according to this object's * NumberFormat object. * @param unit The unit to use when formatting the relative * date, e.g. UDAT_REL_UNIT_WEEK, * UDAT_REL_UNIT_FRIDAY. * @param status ICU error code returned here. * @return The formatted relative datetime * @draft ICU 64 */ FormattedRelativeDateTime formatNumericToValue( double offset, URelativeDateTimeUnit unit, UErrorCode& status) const; #endif /* U_HIDE_DRAFT_API */ /** * Format a combination of URelativeDateTimeUnit and numeric offset * using a text style if possible, e.g. "last week", "this week", * "next week", "yesterday", "tomorrow". Falls back to numeric * style if no appropriate text term is available for the specified * offset in the object's locale. * * This method returns a String. To get more information about the * formatting result, use formatToValue(). * * @param offset The signed offset for the specified unit. * @param unit The unit to use when formatting the relative * date, e.g. UDAT_REL_UNIT_WEEK, * UDAT_REL_UNIT_FRIDAY. * @param appendTo The string to which the formatted result will be * appended. * @param status ICU error code returned here. * @return appendTo * @stable ICU 57 */ UnicodeString& format( double offset, URelativeDateTimeUnit unit, UnicodeString& appendTo, UErrorCode& status) const; #ifndef U_HIDE_DRAFT_API /** * Format a combination of URelativeDateTimeUnit and numeric offset * using a text style if possible, e.g. "last week", "this week", * "next week", "yesterday", "tomorrow". Falls back to numeric * style if no appropriate text term is available for the specified * offset in the object's locale. * * This method returns a FormattedRelativeDateTime, which exposes more * information than the String returned by format(). * * @param offset The signed offset for the specified unit. * @param unit The unit to use when formatting the relative * date, e.g. UDAT_REL_UNIT_WEEK, * UDAT_REL_UNIT_FRIDAY. * @param status ICU error code returned here. * @return The formatted relative datetime * @draft ICU 64 */ FormattedRelativeDateTime formatToValue( double offset, URelativeDateTimeUnit unit, UErrorCode& status) const; #endif /* U_HIDE_DRAFT_API */ /** * Combines a relative date string and a time string in this object's * locale. This is done with the same date-time separator used for the * default calendar in this locale. * * @param relativeDateString the relative date, e.g 'yesterday' * @param timeString the time e.g '3:45' * @param appendTo concatenated date and time appended here * @param status ICU error code returned here. * @return appendTo * @stable ICU 53 */ UnicodeString& combineDateAndTime( const UnicodeString& relativeDateString, const UnicodeString& timeString, UnicodeString& appendTo, UErrorCode& status) const; /** * Returns the NumberFormat this object is using. * * @stable ICU 53 */ const NumberFormat& getNumberFormat() const; /** * Returns the capitalization context. * * @stable ICU 54 */ UDisplayContext getCapitalizationContext() const; /** * Returns the format style. * * @stable ICU 54 */ UDateRelativeDateTimeFormatterStyle getFormatStyle() const; private: const RelativeDateTimeCacheData* fCache; const SharedNumberFormat *fNumberFormat; const SharedPluralRules *fPluralRules; UDateRelativeDateTimeFormatterStyle fStyle; UDisplayContext fContext; const SharedBreakIterator *fOptBreakIterator; Locale fLocale; void init( NumberFormat *nfToAdopt, BreakIterator *brkIter, UErrorCode &status); UnicodeString& adjustForContext(UnicodeString &) const; UBool checkNoAdjustForContext(UErrorCode& status) const; template<typename F, typename... Args> UnicodeString& doFormat( F callback, UnicodeString& appendTo, UErrorCode& status, Args... args) const; #ifndef U_HIDE_DRAFT_API // for FormattedRelativeDateTime template<typename F, typename... Args> FormattedRelativeDateTime doFormatToValue( F callback, UErrorCode& status, Args... args) const; #endif // U_HIDE_DRAFT_API void formatImpl( double quantity, UDateDirection direction, UDateRelativeUnit unit, FormattedRelativeDateTimeData& output, UErrorCode& status) const; void formatAbsoluteImpl( UDateDirection direction, UDateAbsoluteUnit unit, FormattedRelativeDateTimeData& output, UErrorCode& status) const; void formatNumericImpl( double offset, URelativeDateTimeUnit unit, FormattedRelativeDateTimeData& output, UErrorCode& status) const; void formatRelativeImpl( double offset, URelativeDateTimeUnit unit, FormattedRelativeDateTimeData& output, UErrorCode& status) const; }; U_NAMESPACE_END #endif /* !UCONFIG_NO_BREAK_ITERATION */ #endif /* !UCONFIG_NO_FORMATTING */ #endif /* __RELDATEFMT_H */
TerminalCursor/Mathematics
Lists.c
<gh_stars>0 #include "Lists.h" List* make_list(int length) { int* list = malloc(length*sizeof(int)); List* result = malloc(sizeof(List)); result->length = length; result->data = list; return result; } List* fill_list(int length, int* list) { List* result = make_list(length); for(int i = 0; i < length; i++) result->data[i] = list[i]; return result; } void free_list(List* list) { free(list); } int* i_extend_list(int length, int* list) { int* result = malloc((length+1)*sizeof(int)); for(int i = 0; i < length; i++) result[i] = list[i]; result[length] = 0; return result; } int* i_append_to_list(int length, int* list, int value) { int* result = i_extend_list(length, list); result[length] = value; return result; }
TerminalCursor/Mathematics
Math/Crypto/Crypto.c
<reponame>TerminalCursor/Mathematics #include "Crypto.h" int F(int data, int key) { return data + key + 7; } void swap_two(int* parts) { parts[0] ^= parts[1]; parts[1] ^= parts[0]; parts[0] ^= parts[1]; } int* reverse_list(int len, int* list) { int* rev_list = malloc(len*sizeof(int)); for(int i = 0; i < len; i++) rev_list[i] = list[len-i-1]; return rev_list; } long Fiestel(int keys, long data, int* key, int (*fptr)(int,int)) { long size = 2 * sizeof(data); long base_off = l_pow(2, size) - 1; int parts[] = {(data & (base_off << size)) >> size, data & base_off}; int temp; for(int rounds = 0; rounds < keys; rounds++) { temp = parts[0]; parts[0] = parts[1]; parts[1] = temp ^ fptr(parts[1], key[rounds]); } swap_two(parts); return (parts[0] << size) + parts[1]; } long l_mod_p(long base, long exp, long m) { long res = 1; for(long i = 0; i < exp; i++) { res *= base; res %= m; } return res; } long l_mod_p(long base, long exp, long m);
TerminalCursor/Mathematics
Math/General.h
<filename>Math/General.h #ifndef GENERAL_H #define GENERAL_H double d_pow(double, int); long l_pow(long, long); double square_root(double); int gcd(int, int); #endif
TerminalCursor/Mathematics
main.c
<reponame>TerminalCursor/Mathematics<gh_stars>0 #include <stdio.h> #include <stdlib.h> #include "Math/Matrix.h" #include "Math/Polynomial.h" #include "Math/General.h" #include "Math/Crypto/Crypto.h" #include "Lists.h" int main() { /* Fiestel */ long leData = 0x30F0E67; int leKeys[] = {8, 6, 7}; int* leKeys1 = reverse_list(3, leKeys); int (*fptr)(int, int) = &F; printf("0x%08lX\n0x%08lX\n\n", leData, Fiestel(3, Fiestel(3, leData, leKeys, fptr), leKeys1, fptr)); free(leKeys1); /* <NAME> */ long a = 36, b = 425, p = 997, g = 573; long A = l_mod_p(g, a, p); long B = l_mod_p(g, b, p); long S = l_mod_p(A, b, p); printf("Publicly Known:\n p: % 5li\n g: % 5li\n A: % 5li *\n B: % 5li *\n", p, g, A, B); printf("Privately Known:\n a: % 5li\n b: % 5li\n Secret: % 5li *\n", a, b, S); printf("* indicates a calculated value\n\n"); /* List Stuff */ int list_1_data[] = {1, 2, 3, 4}; List* list = fill_list(4, list_1_data); list->data = list_1_data; List* list_2 = fill_list(list->length + 1, i_extend_list(4, list->data)); list_2->data[4] = -5; for(int i = 0; i < list_2->length; i++) printf("% 2i: % 4i\n", i+1, list_2->data[i]); printf("\n"); free_list(list); free_list(list_2); /* Matrix Stuff */ double matrix_1_data[] = {0, 0, 0, 0, 1, 8, 0, 1, 8}; Matrix* test_m = fill_matrix(matrix_1_data, 3, 3); print_matrix(test_m); Matrix* test_r = clone_matrix(test_m); reduce_row(test_r); print_matrix(test_r); Matrix* test_n = matrix_normalized(test_r); print_matrix(test_n); printf("%i\n%i\n\n", get_dimension(test_n), is_id(test_n)); free_matrix(test_n); free_matrix(test_r); free_matrix(test_m); /* GCD Stuff */ int a_1 = 26, b_1 = 56; printf("gcd(%i, %i): %i\n", a_1, b_1, gcd(a_1, b_1)); return 0; }
TerminalCursor/Mathematics
Math/Matrix.c
#include "Matrix.h" // Allocate Memory for Matrix Matrix* make_matrix(int rows, int columns) { Matrix* matrix = malloc(sizeof(Matrix)); matrix->n_rows = rows; matrix->n_columns = columns; matrix->data = (double**)malloc(sizeof(double*) * rows); for(int row = 0; row < rows; row++) matrix->data[row] = (double*)calloc(columns, sizeof(double)); return matrix; } // Deallocate Memory for Matrix void free_matrix(Matrix* matrix) { for(int row = 0; row < matrix->n_rows; row++) free(matrix->data[row]); free(matrix->data); free(matrix); } // Clone a matrix to a new matrix object Matrix* clone_matrix(Matrix* matrix) { Matrix* clone = make_matrix(matrix->n_rows, matrix->n_columns); for(int row = 0; row < matrix->n_rows; row++) for(int column = 0; column < matrix->n_columns; column++) clone->data[row][column] = matrix->data[row][column]; return clone; } // Fill a matrix with data from double array Matrix* fill_matrix(double* data, int rows, int columns) { Matrix* matrix = make_matrix(rows, columns); for(int row = 0; row < rows; row++) for(int column = 0; column < columns; column++) matrix->data[row][column] = data[row*columns + column]; return matrix; } // Print out the contents of a matrix void print_matrix(Matrix* matrix) { for(int row = 0; row < matrix->n_rows; row++) { for(int column = 0; column < matrix->n_columns; column++) { printf("%5.2f ", matrix->data[row][column]); } printf("\n"); } printf("\n"); } // ELEMENTARY ROW OPERATIONS void swap_rows(Matrix* matrix, int rowA, int rowB) { for(int column = 0; column < matrix->n_columns; column++) { double c = matrix->data[rowA][column]; matrix->data[rowA][column] = matrix->data[rowB][column]; matrix->data[rowB][column] = c; } } void scale_row(Matrix* matrix, int row, double scale_factor) { for(int column = 0; column < matrix->n_columns; column++) matrix->data[row][column] *= scale_factor; } void add_scalar_multiple(Matrix* matrix, int rowin, int rowout, double scale_factor) { for(int column = 0; column < matrix->n_columns; column++) matrix->data[rowout][column] += matrix->data[rowin][column] * scale_factor; } int leading_column(Matrix* matrix, int row) { for(int column = 0; column < matrix->n_columns; column++) if(matrix->data[row][column] != 0) return column; return matrix->n_columns; } // "Upper Triangular" matrix void row_reduce(Matrix* matrix) { for(int row = 0; row < matrix->n_rows; row++) { int leadingColumn = leading_column(matrix, row); if(leadingColumn < matrix->n_columns) { if(matrix->data[row][leadingColumn] != 0) scale_row(matrix, row, 1/matrix->data[row][leading_column(matrix, row)]); for(int followingRow = row + 1; followingRow < matrix->n_rows; followingRow++) add_scalar_multiple(matrix, row, followingRow, -matrix->data[followingRow][leadingColumn]); } } int currentRow = 0; for(int column = 0; column < matrix->n_columns; column++) { if(column < matrix->n_rows) { int leadingColumnRow = column; int leadingColumn = leading_column(matrix, column); for(int row = column; row < matrix->n_rows; row++) { if(leading_column(matrix, row) < leadingColumn) { leadingColumnRow = row; leadingColumn = leading_column(matrix, row); } } swap_rows(matrix, currentRow, leadingColumnRow); } currentRow++; } } // "Diagonal" Matrix void reduce_row(Matrix* m) { row_reduce(m); for(int row = m->n_rows - 1; row >= 0; row--) { int leadingColumn = leading_column(m, row); for(int previousRow = 0; previousRow < row; previousRow++) add_scalar_multiple(m, row, previousRow, -m->data[previousRow][leadingColumn]); } } // Get the dimension of the matrix int get_dimension(Matrix* matrix) { int dimension = 0; if(matrix->n_rows != 0 && matrix->n_columns != 0) { Matrix* rref_matrix = clone_matrix(matrix); reduce_row(rref_matrix); for(int i = 0; i < rref_matrix->n_rows; i++) { if(leading_column(rref_matrix, i) == rref_matrix->n_columns) { return dimension; } dimension += 1; } free_matrix(rref_matrix); } return dimension; } int is_square(Matrix* matrix) { return matrix->n_rows == matrix->n_columns; } int is_id(Matrix* matrix) { if(is_square(matrix)) { for(int i = 0; i < matrix->n_rows; i++) { if(matrix->data[i][i] != 1.0) return 0; } return 1; } return 0; } Matrix* matrix_multiply(Matrix* A, Matrix* B) { if(A->n_columns == B->n_rows) { Matrix* resulting_matrix = make_matrix(A->n_rows, B->n_columns); for(int row = 0; row < resulting_matrix->n_rows; row++) { for(int column = 0; column < resulting_matrix->n_columns; column++) { for(int c = 0; c < A->n_columns; c++) { resulting_matrix->data[row][column] += A->data[row][c] * B->data[c][column]; } } } return resulting_matrix; } Matrix* null = make_matrix(A->n_rows, B->n_columns); return null; } // Tr(A^TB) // (This implementation A and B must be both n by m) double frobenius_inner_product(Matrix* A, Matrix* B) { double inner_product = 0.0f; if(A->n_rows == B->n_rows && A->n_columns == B->n_columns) { for(int row = 0; row < B->n_rows; row++) for(int column = 0; column < B->n_columns; column++) inner_product += A->data[row][column]*B->data[row][column]; } return inner_product; } Matrix* matrix_normalized(Matrix* matrix) { Matrix* m = clone_matrix(matrix); double scale_factor = 1.0f/square_root(frobenius_inner_product(m, m)); for(int row = 0; row < m->n_rows; row++) { scale_row(m, row, scale_factor); } return m; } Matrix* mat_proj_e(Matrix* mat, Matrix* proj_mat) { Matrix* norm_proj_mat = matrix_normalized(proj_mat); double inner_product = frobenius_inner_product(mat, norm_proj_mat); for(int row = 0; row < norm_proj_mat->n_rows; row++) for(int column = 0; column < norm_proj_mat->n_columns; column++) norm_proj_mat->data[row][column] *= inner_product; Matrix* res_mat = clone_matrix(norm_proj_mat); free_matrix(norm_proj_mat); return res_mat; } Matrix* transpose(Matrix* mat) { Matrix* return_matrix = make_matrix(mat->n_columns, mat->n_rows); for(int row = 0; row < mat->n_rows; row++) { for(int column = 0; column < mat->n_columns; column++) { return_matrix->data[column][row] = mat->data[row][column]; } } return return_matrix; } Matrix* add(Matrix* A, Matrix* B) { Matrix* return_matrix = make_matrix(A->n_rows, B->n_columns); if(A->n_rows == B->n_rows && A->n_columns == B->n_columns) { for(int row = 0; row < A->n_rows; row++) { for(int col = 0; col < B->n_columns; col++) { return_matrix->data[row][col] = A->data[row][col] + B->data[row][col]; } } } return return_matrix; } Matrix* sub(Matrix* A, Matrix* B) { Matrix* return_matrix = make_matrix(A->n_rows, B->n_columns); if(A->n_rows == B->n_rows && A->n_columns == B->n_columns) { for(int row = 0; row < A->n_rows; row++) { for(int col = 0; col < B->n_columns; col++) { return_matrix->data[row][col] = A->data[row][col] - B->data[row][col]; } } } return return_matrix; } Matrix* scale(Matrix* matrix, double scale_factor) { Matrix* return_matrix = make_matrix(matrix->n_rows, matrix->n_columns); for(int row = 0; row < matrix->n_rows; row++) { for(int column = 0; column < matrix->n_columns; column++) { return_matrix->data[row][column] = scale_factor * matrix->data[row][column]; } } return return_matrix; } Matrix* cross(Matrix* A, Matrix* B) { Matrix* return_matrix = make_matrix(3, 1); if(A->n_rows == B->n_rows && A->n_columns == B->n_columns) { if(A->n_rows == 3 && B->n_columns == 1) { for(int i = 0; i < 3; i++) { return_matrix->data[i][0] = A->data[(i+1)%3][0] * B->data[(i+2)%3][0] - A->data[(i+2)%3][3] * B->data[(i+1)%3][0]; } } else if(A->n_rows == 2 && B->n_columns == 1) { return_matrix->data[2][0] = A->data[0][0] * B->data[1][0] - A->data[1][0] * B->data[0][0]; } } return return_matrix; } double dot(Matrix* A, Matrix* B) { return frobenius_inner_product(A, B); }
TerminalCursor/Mathematics
Lists.h
<reponame>TerminalCursor/Mathematics #ifndef LISTS_H #define LISTS_H #include <stdio.h> #include <stdlib.h> typedef struct { int length; int* data; } List; List* make_list(int); List* fill_list(int, int*); void free_list(List*); int* i_extend_list(int, int*); int* i_append_to_list(int, int*, int); #endif
TerminalCursor/Mathematics
Math/Crypto/Crypto.h
#ifndef CRYPTO_H #define CRYPTO_H #include <stdio.h> #include <stdlib.h> #include "../General.h" int F(int data, int key); void swap_two(int* parts); int* reverse_list(int len, int* list); long Fiestel(int keys, long data, int* key, int (*fptr)(int,int)); long l_mod_p(long base, long exp, long m); #endif
TerminalCursor/Mathematics
Math/General.c
<filename>Math/General.c #include "General.h" double d_pow(double x, int p) { if(p == 0) return 1.0f; if(p > 1) return x * d_pow(x, p - 1); else return x; } long l_pow(long x, long p) { if(p == 0) return 1; if(p > 1) return x * l_pow(x, p - 1); else return x; } double square_root(double n) { double i, precision = 0.00001; for(i = 1; i*i <= n; ++i); for(--i; i*i < n; i+= precision); return i; } int gcd(int a, int b) { if(a < b) return gcd(b, a); else { int r = a % b; if(r == 0) return b; else return gcd(b, r); } }
TerminalCursor/Mathematics
Math/Polynomial.c
<reponame>TerminalCursor/Mathematics #include "Polynomial.h" Polynomial* make_polynomial(int degree) { Polynomial* polynomial = malloc(sizeof(Polynomial)); polynomial->degree = degree; polynomial->coefficients = (double*)calloc(degree+1, sizeof(double)); return polynomial; } void free_polynomial(Polynomial* polynomial) { free(polynomial->coefficients); free(polynomial); } Polynomial* clone_polynomial(Polynomial* source) { Polynomial* destination = make_polynomial(source->degree); for(int i = 0; i <= source->degree; i++) destination->coefficients[i] = source->coefficients[i]; return destination; } void print_polynomial(Polynomial* polynomial) { for(int i = 0; i <= polynomial->degree; i++) printf("%5.2f\n", polynomial->coefficients[i]); printf("\n"); } Polynomial* mp_multiply(Matrix* A, Polynomial* x) { Polynomial* result = make_polynomial(A->n_rows - 1); if(A->n_columns == x->degree + 1) { for(int row = 0; row < A->n_rows; row++) { for(int column = 0; column <= x->degree+1; column++) result->coefficients[row] += A->data[row][column] * x->coefficients[column]; } } return result; } Polynomial* polynomial_product(Polynomial* p1, Polynomial* p2) { Polynomial* result = make_polynomial(p1->degree + p2->degree); for(int i = 0; i <= p1->degree; i++) { for(int j = 0; j <= p2->degree; j++) result->coefficients[i+j] += p1->coefficients[i] * p2->coefficients[j]; } return result; } double polynomial_inner_product(Polynomial* p1, Polynomial* p2) { Polynomial* full_polynomial = polynomial_product(p1, p2); Polynomial* full_polynomial_expanded = make_polynomial(full_polynomial->degree + 1); for(int i = 0; i <= full_polynomial->degree + 1; i++) full_polynomial_expanded->coefficients[i] = full_polynomial->coefficients[i]; Matrix* integration_matrix = make_matrix(full_polynomial_expanded->degree + 1,full_polynomial_expanded->degree + 1); for(int row = 1; row < integration_matrix->n_rows; row++) { int col = row - 1; double value = 1.0 / ((double) row); integration_matrix->data[row][col] = value; } Polynomial* integrated_polynomial = mp_multiply(integration_matrix, full_polynomial_expanded); double inner_product = apply_x(integrated_polynomial, 1.0f) - apply_x(integrated_polynomial, -1.0f); free_matrix(integration_matrix); free_polynomial(full_polynomial); free_polynomial(full_polynomial_expanded); free_polynomial(integrated_polynomial); return inner_product; } double apply_x(Polynomial* P, double x) { double ret_val = 0.0; for(int i = 0; i <= P->degree; i++) ret_val += d_pow(x, i) * P->coefficients[i]; return ret_val; } Polynomial* polynomial_normalized(Polynomial* P) { Polynomial* norm = clone_polynomial(P); double scale_factor = square_root(polynomial_inner_product(norm, norm)); for(int deg = 0; deg <= norm->degree; deg++) norm->coefficients[deg] /= scale_factor; return norm; } Polynomial* polynomial_projection_e(Polynomial* vec, Polynomial* proj_vec) { Polynomial* norm_proj_vec = polynomial_normalized(proj_vec); Polynomial* res_polynomial = clone_polynomial(norm_proj_vec); double inner_product = polynomial_inner_product(vec, norm_proj_vec); for(int deg = 0; deg <= norm_proj_vec->degree; deg++) res_polynomial->coefficients[deg] *= inner_product; free_polynomial(norm_proj_vec); return res_polynomial; }
TerminalCursor/Mathematics
Math/Polynomial.h
#ifndef POLYNOMIAL_H #define POLYNOMIAL_H #include "Matrix.h" typedef struct { int degree; double* coefficients; } Polynomial; Polynomial* make_polynomial(int); void free_polynomial(Polynomial*); Polynomial* clone_polynomial(Polynomial*); void print_polynomial(Polynomial*); Polynomial* mp_multiply(Matrix*, Polynomial*); Polynomial* polynomial_product(Polynomial*, Polynomial*); double polynomial_inner_product(Polynomial*, Polynomial*); double apply_x(Polynomial*, double); Polynomial* polynomial_normalized(Polynomial*); Polynomial* polynomial_projection_e(Polynomial*, Polynomial*); #endif
TerminalCursor/Mathematics
Math/Matrix.h
#ifndef MATRIX_H #define MATRIX_H #include <stdio.h> #include <stdlib.h> #include "General.h" typedef struct { int n_rows; int n_columns; double** data; } Matrix; Matrix* make_matrix(int, int); void free_matrix(Matrix*); Matrix* clone_matrix(Matrix*); Matrix* fill_matrix(double*, int, int); void print_matrix(Matrix*); // ELEMENTARY ROW OPERATIONS void swap_rows(Matrix*, int, int); void scale_row(Matrix*, int, double); void add_scalar_multiple(Matrix*, int, int, double); int leading_column(Matrix*, int); void row_reduce(Matrix*); void reduce_row(Matrix*); int get_dimension(Matrix*); int is_square(Matrix*); int is_id(Matrix*); Matrix* matrix_multiply(Matrix*, Matrix*); double frobenius_inner_product(Matrix*, Matrix*); Matrix* matrix_normalized(Matrix*); Matrix* mat_proj_e(Matrix*, Matrix*); Matrix* transpose(Matrix*); Matrix* add(Matrix*, Matrix*); Matrix* sub(Matrix*, Matrix*); Matrix* scale(Matrix*, double); Matrix* cross(Matrix*, Matrix*); double dot(Matrix*, Matrix*); #endif
ghostjat/Np
src/core/blas.h
#define FFI_SCOPE "blas" #define FFI_LIB "libblas.so" typedef size_t CBLAS_INDEX_t; void openblas_set_num_threads(int num_threads); void goto_set_num_threads(int num_threads); int openblas_get_num_threads(void); int openblas_get_num_procs(void); char* openblas_get_config(void); char* openblas_get_corename(void); int openblas_get_parallel(void); size_t cblas_idamax(const int N, const float *X, const int incX); size_t cblas_idamin(const int n, const double *x, const int incx); double cblas_dsdot(const int N, const float *X, const int incX, const float *Y, const int incY); double cblas_ddot(const int N, const double *X, const int incX, const double *Y, const int incY); double cblas_dnrm2(const int N, const double *X, const int incX); double cblas_dasum(const int N, const double *X, const int incX); void cblas_dswap(const int N, double *X, const int incX, double *Y, const int incY); void cblas_dcopy(const int N, const double *X, const int incX, double *Y, const int incY); void cblas_daxpy(const int N, const double alpha, const double *X, const int incX, double *Y, const int incY); void cblas_drotg(double *a, double *b, double *c, double *s); void cblas_drotmg(double *d1, double *d2, double *b1, const double b2, double *P); void cblas_drot(const int N, double *X, const int incX, double *Y, const int incY, const double c, const double s); void cblas_drotm(const int N, double *X, const int incX, double *Y, const int incY, const double *P); void cblas_dscal(const int N, const double alpha, double *X, const int incX); void cblas_dgemv(const enum CBLAS_ORDER order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const double alpha, const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY); void cblas_dgbmv(const enum CBLAS_ORDER order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const int KL, const int KU, const double alpha, const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY); void cblas_dtrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const int N, const double *A, const int lda, double *X, const int incX); void cblas_dtbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const int N, const int K, const double *A, const int lda, double *X, const int incX); void cblas_dtpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const int N, const double *Ap, double *X, const int incX); void cblas_dtrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const int N, const double *A, const int lda, double *X, const int incX); void cblas_dtbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const int N, const int K, const double *A, const int lda, double *X, const int incX); void cblas_dtpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const int N, const double *Ap, double *X, const int incX); void cblas_dsymv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const double alpha, const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY); void cblas_dsbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const int K, const double alpha, const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY); void cblas_dspmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const double alpha, const double *Ap, const double *X, const int incX, const double beta, double *Y, const int incY); void cblas_dger(const enum CBLAS_ORDER order, const int M, const int N, const double alpha, const double *X, const int incX, const double *Y, const int incY, double *A, const int lda); void cblas_dsyr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const double alpha, const double *X, const int incX, double *A, const int lda); void cblas_dspr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const double alpha, const double *X, const int incX, double *Ap); void cblas_dsyr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const double alpha, const double *X, const int incX, const double *Y, const int incY, double *A, const int lda); void cblas_dspr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const double alpha, const double *X, const int incX, const double *Y, const int incY, double *A); void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const int M, const int N, const int K, const double alpha, const double *A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc); void cblas_dsymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const int M, const int N, const double alpha, const double *A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc); void cblas_dsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, const int K, const double alpha, const double *A, const int lda, const double beta, double *C, const int ldc); void cblas_dsyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, const int K, const double alpha, const double *A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc); void cblas_dtrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const int M, const int N, const double alpha, const double *A, const int lda, double *B, const int ldb); void cblas_dtrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, const int M, const int N, const double alpha, const double *A, const int lda, double *B, const int ldb); void cblas_domatcopy(const enum CBLAS_ORDER CORDER, const enum CBLAS_TRANSPOSE CTRANS,const int crows, const int ccols, const double calpha, const double *a, const int clda, double *b, const int cldb);
ghostjat/Np
src/core/lapack.h
<filename>src/core/lapack.h<gh_stars>1-10 #define FFI_SCOPE "lapack" #define FFI_LIB "liblapacke.so" int LAPACKE_dgetrf( int matrix_layout, int m, int n, double* a, int lda, int* ipiv ); int LAPACKE_dgetri( int matrix_layout, int n, double* a, int lda, const int* ipiv ); int LAPACKE_dgesdd( int matrix_layout, char jobz, int m, int n, double* a, int lda, double* s, double* u, int ldu, double* vt, int ldvt ); int LAPACKE_dgeev( int matrix_layout, char jobvl, char jobvr, int n, double* a, int lda, double* wr, double* wi, double* vl, int ldvl, double* vr, int ldvr ); int LAPACKE_dsyev( int matrix_layout, char jobz, char uplo, int n, double* a, int lda, double* w ); int LAPACKE_dgels( int matrix_order, char trans, int m, int n, int nrhs, double* a, int lda, double* b, int ldb ); int LAPACKE_dgebal( int matrix_layout, char job, int n, double* a, int lda, int* ilo, int* ihi,double* scale ); int LAPACKE_dpotrf( int matrix_layout, char uplo, int n, double* a, int lda ); float LAPACKE_dlange(int matrix_layout, char norm, int m, int n, const double* a, int lda); int LAPACKE_dlasrt( char id, int n, double* d );
prateekstark/pagerank
Thirdparty/mrmpi/oink/mrmpi.h
/* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ #ifndef OINK_MRMPI_H #define OINK_MRMPI_H #include "typedefs.h" #include "pointers.h" namespace OINK_NS { class MRMPI : protected Pointers { public: MRMPI(class OINK *); ~MRMPI() {} void run(int, int, char **); HashFnPtr hash_lookup(char *); CompareFnPtr compare_lookup(char *); MapTaskFnPtr map_task_lookup(char *); MapFileFnPtr map_file_lookup(char *); MapStringFnPtr map_string_lookup(char *); MapMRFnPtr map_mr_lookup(char *); ReduceFnPtr reduce_lookup(char *); ScanKVFnPtr scan_kv_lookup(char *); ScanKMVFnPtr scan_kmv_lookup(char *); }; } #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/random_mars.h
<filename>Thirdparty/mrmpi/oink/random_mars.h /* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ #ifndef OINK_RANMARS_H #define OINK_RANMARS_H #include "pointers.h" namespace OINK_NS { class RanMars : protected Pointers { public: RanMars(class OINK *, int); ~RanMars(); double uniform(); double gaussian(); private: int seed,save; double second; double *u; int i97,j97; double c,cd,cm; }; } #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/memory.h
<reponame>prateekstark/pagerank /* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ #ifndef OINK_MEMORY_H #define OINK_MEMORY_H #include "pointers.h" namespace OINK_NS { class Memory : protected Pointers { public: Memory(class OINK *); void *smalloc(int n, const char *); void sfree(void *); void *srealloc(void *, int n, const char *); double *create_1d_double_array(int, int, const char *); void destroy_1d_double_array(double *, int); double **create_2d_double_array(int, int, const char *); void destroy_2d_double_array(double **); double **grow_2d_double_array(double **, int, int, const char *); int **create_2d_int_array(int, int, const char *); void destroy_2d_int_array(int **); int **grow_2d_int_array(int **, int, int, const char *); double **create_2d_double_array(int, int, int, const char *); void destroy_2d_double_array(double **, int); double ***create_3d_double_array(int, int, int, const char *); void destroy_3d_double_array(double ***); double ***grow_3d_double_array(double ***, int, int, int, const char *); double ***create_3d_double_array(int, int, int, int, const char *); void destroy_3d_double_array(double ***, int); double ***create_3d_double_array(int, int, int, int, int, int, const char *); void destroy_3d_double_array(double ***, int, int, int); int ***create_3d_int_array(int, int, int, const char *); void destroy_3d_int_array(int ***); double ****create_4d_double_array(int, int, int, int, const char *); void destroy_4d_double_array(double ****); }; } #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/error.h
<reponame>prateekstark/pagerank<gh_stars>0 /* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ #ifndef OINK_ERROR_H #define OINK_ERROR_H #include "pointers.h" namespace OINK_NS { class Error : protected Pointers { public: Error(class OINK *); void universe_all(const char *); void universe_one(const char *); void all(const char *); void one(const char *); void warning(const char *, int = 1); void message(char *, int = 1); }; } #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/map_rmat_generate.h
<gh_stars>0 /* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ #ifndef OINK_RMAT_GENERATE_H #define OINK_RMAT_GENERATE_H #include "typedefs.h" // data structure for RMAT parameters struct RMAT_struct { uint64_t order; uint64_t ngenerate; int nlevels; int nnonzero; double a,b,c,d,fraction; }; #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/luby_find.h
<filename>Thirdparty/mrmpi/oink/luby_find.h /* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ #ifdef COMMAND_CLASS CommandStyle(luby_find,LubyFind) #else #ifndef OINK_LUBY_FIND_H #define OINK_LUBY_FIND_H #include "command.h" #include "keyvalue.h" using MAPREDUCE_NS::KeyValue; namespace OINK_NS { class LubyFind : public Command { public: LubyFind(class OINK *); void run(); void params(int, char **); private: int seed; static void print(char *, int, char *, int, void *); static void map_vert_random(uint64_t, char *, int, char *, int, KeyValue *, void *); static void reduce_edge_winner(char *, int, char *, int, int *, KeyValue *, void *); static void reduce_vert_winner(char *, int, char *, int, int *, KeyValue *, void *); static void reduce_vert_loser(char *, int, char *, int, int *, KeyValue *, void *); static void reduce_vert_emit(char *, int, char *, int, int *, KeyValue *, void *); }; } #endif #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/style_map.h
<reponame>prateekstark/pagerank #if defined MAP_TASK_STYLE MapStyle(rmat_generate) #elif defined MAP_FILE_STYLE MapStyle(read_edge) MapStyle(read_edge_label) MapStyle(read_edge_weight) MapStyle(read_vertex_label) MapStyle(read_vertex_weight) MapStyle(read_words) #elif defined MAP_STRING_STYLE #elif defined MAP_MR_STYLE MapStyle(add_label) MapStyle(add_weight) MapStyle(edge_to_vertex) MapStyle(edge_to_vertex_pair) MapStyle(edge_to_vertices) MapStyle(edge_upper) MapStyle(invert) #else #include "mapreduce.h" using MAPREDUCE_NS::MapReduce; using MAPREDUCE_NS::KeyValue; void rmat_generate(int itask, KeyValue *kv, void *ptr); void read_edge(int itask, char *file, KeyValue *kv, void *ptr); void read_edge_label(int itask, char *file, KeyValue *kv, void *ptr); void read_edge_weight(int itask, char *file, KeyValue *kv, void *ptr); void read_vertex_label(int itask, char *file, KeyValue *kv, void *ptr); void read_vertex_weight(int itask, char *file, KeyValue *kv, void *ptr); void read_words(int itask, char *file, KeyValue *kv, void *ptr); void add_label(uint64_t itask, char *key, int keybytes, char *value, int valuebytes, KeyValue *kv, void *ptr); void add_weight(uint64_t itask, char *key, int keybytes, char *value, int valuebytes, KeyValue *kv, void *ptr); void edge_to_vertex(uint64_t itask, char *key, int keybytes, char *value, int valuebytes, KeyValue *kv, void *ptr); void edge_to_vertex_pair(uint64_t itask, char *key, int keybytes, char *value, int valuebytes, KeyValue *kv, void *ptr); void edge_to_vertices(uint64_t itask, char *key, int keybytes, char *value, int valuebytes, KeyValue *kv, void *ptr); void edge_upper(uint64_t itask, char *key, int keybytes, char *value, int valuebytes, KeyValue *kv, void *ptr); void invert(uint64_t itask, char *key, int keybytes, char *value, int valuebytes, KeyValue *kv, void *ptr); #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/command.h
/* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ #ifndef OINK_COMMAND_H #define OINK_COMMAND_H #include "pointers.h" namespace OINK_NS { class Command : protected Pointers { public: Command(class OINK *); virtual ~Command() {} virtual void run() = 0; virtual void params(int, char **) = 0; void inputs(int, char **); void outputs(int, char **); protected: int ninputs,noutputs; }; } #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/style_compare.h
#ifdef COMPARE_STYLE #else #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/pagerank.h
/* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ #ifdef COMMAND_CLASS CommandStyle(pagerank,PageRank) #else #ifndef OINK_PAGERANK_H #define OINK_PAGERANK_H #include "command.h" #include "keyvalue.h" using MAPREDUCE_NS::KeyValue; namespace OINK_NS { class PageRank : public Command { public: PageRank(class OINK *); void run(); void params(int, char **); private: double tolerance,alpha; int maxiter; static void print(char *, int, char *, int, void *); /* static void map_edge_vert(uint64_t, char *, int, char *, int, KeyValue *, void *); static void reduce_first_degree(char *, int, char *, int, int *, KeyValue *, void *); static void reduce_second_degree(char *, int, char *, int, int *, KeyValue *, void *); static void map_low_degree(uint64_t, char *, int, char *, int, KeyValue *, void *); static void reduce_nsq_angles(char *, int, char *, int, int *, KeyValue *, void *); static void reduce_emit_triangles(char *, int, char *, int, int *, KeyValue *, void *); */ }; } #endif #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/universe.h
<reponame>prateekstark/pagerank /* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ #ifndef OINK_UNIVERSE_H #define OINK_UNIVERSE_H #include "mpi.h" #include "stdio.h" #include "pointers.h" namespace OINK_NS { class Universe : protected Pointers { public: char *version; // OINK version string = date MPI_Comm uworld; // communicator for entire universe int me,nprocs; // my place in universe FILE *uscreen; // universe screen output FILE *ulogfile; // universe logfile int existflag; // 1 if universe exists due to -partition flag int nworlds; // # of worlds in universe int iworld; // which world I am in int *procs_per_world; // # of procs in each world int *root_proc; // root proc in each world Universe(class OINK *, MPI_Comm); ~Universe(); void add_world(char *); int consistent(); }; } #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/pointers.h
<filename>Thirdparty/mrmpi/oink/pointers.h /* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ // Pointers class contains ptrs to master copy of // fundamental OINK class ptrs stored in mrmpi.h // every OINK class inherits from Pointers to access mrmpi.h ptrs // these variables are auto-initialized by Pointer class constructor // *& variables are really pointers to the pointers in mrmpi.h // & enables them to be accessed directly in any class, e.g. error->all() #ifndef OINK_POINTERS_H #define OINK_POINTERS_H #include "mpi.h" #include "oink.h" namespace OINK_NS { class Pointers { public: Pointers(OINK *ptr) : oink(ptr), memory(ptr->memory), error(ptr->error), universe(ptr->universe), input(ptr->input), obj(ptr->obj), mrmpi(ptr->mrmpi), world(ptr->world), infile(ptr->infile), screen(ptr->screen), logfile(ptr->logfile) {} virtual ~Pointers() {} protected: OINK *oink; Memory *&memory; Error *&error; Universe *&universe; Input *&input; Object *&obj; MRMPI *&mrmpi; MPI_Comm &world; FILE *&infile; FILE *&screen; FILE *&logfile; }; } #endif
prateekstark/pagerank
Thirdparty/mrmpi/src/cmapreduce.h
/* ---------------------------------------------------------------------- MR-MPI = MapReduce-MPI library http://www.cs.sandia.gov/~sjplimp/mapreduce.html <NAME>, <EMAIL>, Sandia National Laboratories Copyright (2009) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the modified Berkeley Software Distribution (BSD) License. See the README file in the top-level MapReduce directory. ------------------------------------------------------------------------- */ /* C or Fortran style interface to MapReduce library */ /* ifdefs allow this file to be included in a C program */ #include "mpi.h" #include "stdint.h" #ifdef __cplusplus extern "C" { #endif void *MR_create(MPI_Comm comm); void *MR_create_mpi(); void *MR_create_mpi_finalize(); void MR_destroy(void *MRptr); void *MR_get_kv(void *MRptr); void *MR_get_kmv(void *MRptr); void *MR_copy(void *MRptr); uint64_t MR_add(void *MRptr, void *MRptr2); uint64_t MR_aggregate(void *MRptr, int (*myhash)(char *, int)); uint64_t MR_broadcast(void *MRptr, int); uint64_t MR_clone(void *MRptr); uint64_t MR_close(void *MRptr); uint64_t MR_collapse(void *MRptr, char *key, int keybytes); uint64_t MR_collate(void *MRptr, int (*myhash)(char *, int)); uint64_t MR_compress(void *MRptr, void (*mycompress)(char *, int, char *, int, int *, void *KVptr, void *APPptr), void *APPptr); uint64_t MR_convert(void *MRptr); uint64_t MR_gather(void *MRptr, int numprocs); uint64_t MR_map(void *MRptr, int nmap, void (*mymap)(int, void *KVptr, void *APPptr), void *APPptr); uint64_t MR_map_add(void *MRptr, int nmap, void (*mymap)(int, void *KVptr, void *APPptr), void *APPptr, int addflag); uint64_t MR_map_file(void *MRptr, int nstr, char **strings, int self, int recurse, int readfile, void (*mymap)(int, char *, void *KVptr, void *APPptr), void *APPptr); uint64_t MR_map_file_add(void *MRptr, int nstr, char **strings, int self, int recurse, int readfile, void (*mymap)(int, char *, void *KVptr, void *APPptr), void *APPptr, int addflag); uint64_t MR_map_file_char(void *MRptr, int nmap, int nstr, char **strings, int recurse, int readflag, char sepchar, int delta, void (*mymap)(int, char *, int, void *KVptr, void *APPptr), void *APPptr); uint64_t MR_map_file_char_add(void *MRptr, int nmap, int nstr, char **strings, int recurse, int readflag, char sepchar, int delta, void (*mymap)(int, char *, int, void *KVptr, void *APPptr), void *APPptr, int addflag); uint64_t MR_map_file_str(void *MRptr, int nmap, int nstr, char **strings, int recurse, int readflag, char *sepstr, int delta, void (*mymap)(int, char *, int, void *KVptr, void *APPptr), void *APPptr); uint64_t MR_map_file_str_add(void *MRptr, int nmap, int nstr, char **strings, int recurse, int readflag, char *sepstr, int delta, void (*mymap)(int, char *, int, void *KVptr, void *APPptr), void *APPptr, int addflag); uint64_t MR_map_mr(void *MRptr, void *MRptr2, void (*mymap)(uint64_t, char *, int, char *, int, void *KVptr, void *APPptr), void *APPptr); uint64_t MR_map_mr_add(void *MRptr, void *MRptr2, void (*mymap)(uint64_t, char *, int, char *, int, void *KVptr, void *APPptr), void *APPptr, int addflag); void MR_open(void *MRptr); void MR_open_add(void *MRptr, int addflag); void MR_print(void *MRptr, int proc, int nstride, int kflag, int vflag); void MR_print_file(void *MRptr, char *file, int fflag, int proc, int nstride, int kflag, int vflag); uint64_t MR_reduce(void *MRptr, void (*myreduce)(char *, int, char *, int, int *, void *KVptr, void *APPptr), void *APPptr); uint64_t MR_multivalue_blocks(void *MRptr); void MR_multivalue_block_select(void *MRptr, int which); int MR_multivalue_block(void *MRptr, int iblock, char **ptr_multivalue, int **ptr_valuesizes); uint64_t MR_scan_kv(void *MRptr, void (*myscan)(char *, int, char *, int, void *), void *APPptr); uint64_t MR_scan_kmv(void *MRptr, void (*myscan)(char *, int, char *, int, int *, void *), void *APPptr); uint64_t MR_scrunch(void *MRptr, int numprocs, char *key, int keybytes); uint64_t MR_sort_keys(void *MRptr, int (*mycompare)(char *, int, char *, int)); uint64_t MR_sort_keys_flag(void *MRptr, int); uint64_t MR_sort_values(void *MRptr, int (*mycompare)(char *, int, char *, int)); uint64_t MR_sort_values_flag(void *MRptr, int); uint64_t MR_sort_multivalues(void *MRptr, int (*mycompare)(char *, int, char *, int)); uint64_t MR_sort_multivalues_flag(void *MRptr, int); uint64_t MR_kv_stats(void *MRptr, int level); uint64_t MR_kmv_stats(void *MRptr, int level); void MR_cummulative_stats(void *MRptr, int level, int reset); void MR_set_mapstyle(void *MRptr, int value); void MR_set_all2all(void *MRptr, int value); void MR_set_verbosity(void *MRptr, int value); void MR_set_timer(void *MRptr, int value); void MR_set_memsize(void *MRptr, int value); void MR_set_minpage(void *MRptr, int value); void MR_set_maxpage(void *MRptr, int value); void MR_set_keyalign(void *MRptr, int value); void MR_set_valuealign(void *MRptr, int value); void MR_set_fpath(void *MRptr, char *str); void MR_kv_add(void *KVptr, char *key, int keybytes, char *value, int valuebytes); void MR_kv_add_multi_static(void *KVptr, int n, char *key, int keybytes, char *value, int valuebytes); void MR_kv_add_multi_dynamic(void *KVptr, int n, char *key, int *keybytes, char *value, int *valuebytes); #ifdef __cplusplus } #endif
prateekstark/pagerank
Thirdparty/mrmpi/src/spool.h
/* ---------------------------------------------------------------------- MR-MPI = MapReduce-MPI library http://www.cs.sandia.gov/~sjplimp/mapreduce.html <NAME>, <EMAIL>, Sandia National Laboratories Copyright (2009) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the modified Berkeley Software Distribution (BSD) License. See the README file in the top-level MapReduce directory. ------------------------------------------------------------------------- */ #ifndef SPOOL_H #define SPOOL_H #include "stdio.h" namespace MAPREDUCE_NS { class Spool { public: uint64_t nkv; // # of KV entries in entire spool file uint64_t esize; // size of all entries (with alignment) uint64_t fsize; // size of spool file char *page; // in-memory page int npage; // # of pages in Spool Spool(int, class MapReduce *, class Memory *, class Error *); ~Spool(); void set_page(uint64_t, char *); void complete(); void truncate(int, int, uint64_t); int request_info(char **); int request_page(int); void add(int, char *); void add(int, uint64_t, char *); private: class MapReduce *mr; class Memory *memory; class Error *error; uint64_t pagesize; // size of page // in-memory page int nkey; // # of entries uint64_t size; // current size of entries // virtual pages struct Page { uint64_t size; // size of entries uint64_t filesize; // rounded-up size for file I/O int nkey; // # of entries }; Page *pages; // list of pages in Spool int maxpage; // max # of pages currently allocated // file info char *filename; // filename to store Spool if needed int fileflag; // 1 if file exists, 0 if not FILE *fp; // file ptr // private methods void create_page(); void write_page(); void read_page(int); uint64_t roundup(uint64_t,int); }; } #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/style_reduce.h
<filename>Thirdparty/mrmpi/oink/style_reduce.h<gh_stars>0 #ifdef REDUCE_STYLE ReduceStyle(count) ReduceStyle(cull) #else #include "keyvalue.h" using MAPREDUCE_NS::KeyValue; void count(char *key, int keybytes, char *multivalue, int nvalues, int *valuebytes, KeyValue *kv, void *ptr); void cull(char *key, int keybytes, char *multivalue, int nvalues, int *valuebytes, KeyValue *kv, void *ptr); #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/style_hash.h
<filename>Thirdparty/mrmpi/oink/style_hash.h<gh_stars>0 #ifdef HASH_STYLE #else #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/neigh_tri.h
<filename>Thirdparty/mrmpi/oink/neigh_tri.h /* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ #ifdef COMMAND_CLASS CommandStyle(neigh_tri,NeighTri) #else #ifndef OINK_NEIGH_TRI_H #define OINK_NEIGH_TRI_H #include "command.h" #include "keyvalue.h" using MAPREDUCE_NS::KeyValue; namespace OINK_NS { class NeighTri : public Command { public: NeighTri(class OINK *); void run(); void params(int, char **); private: char *dirname; static void nread(int, char *, KeyValue *, void *); static void tread(int, char *, KeyValue *, void *); static void print(char *, int, char *, int, int *, void *); static void map1(uint64_t, char *, int, char *, int, KeyValue *, void *); }; } #endif #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/style_scan.h
<reponame>prateekstark/pagerank #if defined SCAN_KV_STYLE ScanStyle(print_edge) ScanStyle(print_string_int) ScanStyle(print_vertex) #elif defined SCAN_KMV_STYLE #else void print_edge(char *key, int keybytes, char *value, int valuebytes, void *ptr); void print_string_int(char *key, int keybytes, char *value, int valuebytes, void *ptr); void print_vertex(char *key, int keybytes, char *value, int valuebytes, void *ptr); #endif
prateekstark/pagerank
Thirdparty/mrmpi/src/irregular.h
<reponame>prateekstark/pagerank /* ---------------------------------------------------------------------- MR-MPI = MapReduce-MPI library http://www.cs.sandia.gov/~sjplimp/mapreduce.html <NAME>, <EMAIL>, Sandia National Laboratories Copyright (2009) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the modified Berkeley Software Distribution (BSD) License. See the README file in the top-level MapReduce directory. ------------------------------------------------------------------------- */ #ifndef IRREGULAR_H #define IRREGULAR_H #include "mpi.h" #include "stdint.h" namespace MAPREDUCE_NS { class Irregular { public: Irregular(int, class Memory *, class Error *, MPI_Comm); ~Irregular(); uint64_t cssize,crsize; // total send/recv bytes for one exchange int setup(int, int *, int *, int *, uint64_t, double &); void exchange(int, int *, char **, int *, int *, char *, char *); private: int me,nprocs; int all2all; class Memory *memory; class Error *error; MPI_Comm comm; // MPI communicator for all communication // all2all and custom settings uint64_t *bigsendbytes; // bytes to send to each proc, including self int *sendbytes; // bytes to send to each proc, including self int *sdispls; // proc offset into clumped send buffer int *recvbytes; // bytes to recv from each proc, including self int *rdispls; // proc offset into recv buffer int *senddatums; // # of datums to send each proc, including self int *one; // 1 for each proc, for MPI call int ndatum; // # of total datums I recv, including self // custom settings int self; // 0 = no data to copy to self, 1 = yes int nsend; // # of messages to send w/out self int nrecv; // # of messages to recv w/out self int *sendprocs; // list of procs to send to w/out self int *recvprocs; // list of procs to recv from w/out self MPI_Request *request; // MPI requests for posted recvs MPI_Status *status; // MPI statuses for Waitall void exchange_all2all(int, int *, char **, int *, char *, char *); void exchange_custom(int, int *, char **, int *, char *, char *); }; } #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/typedefs.h
<reponame>prateekstark/pagerank /* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ // typedefs used by various classes #ifndef OINK_TYPEDEFS_H #define OINK_TYPEDEFS_H #define __STDC_LIMIT_MACROS #include "stdint.h" #include "keyvalue.h" using MAPREDUCE_NS::KeyValue; // if change these defs, check that heterogeneous structs // containing these datums are zeroed via memset() if used as keys typedef uint64_t VERTEX; typedef struct { VERTEX vi,vj; } EDGE; typedef int LABEL; typedef double WEIGHT; typedef uint64_t ULONG; typedef int (*HashFnPtr)(char *, int); typedef int (*CompareFnPtr)(char *, int, char *, int); typedef void (*MapTaskFnPtr)(int, KeyValue *, void *); typedef void (*MapFileFnPtr)(int, char *, KeyValue *, void *); typedef void (*MapStringFnPtr)(int, char *, int, KeyValue *, void *); typedef void (*MapMRFnPtr)(uint64_t, char *, int, char *, int, KeyValue *, void *); typedef void (*ReduceFnPtr)(char *, int, char *, int, int *, KeyValue *, void *); typedef void (*ScanKVFnPtr)(char *, int, char *, int, void *); typedef void (*ScanKMVFnPtr)(char *, int, char *, int, int *, void *); #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/library.h
<gh_stars>0 /* ---------------------------------------------------------------------- OINK - scripting wrapper on MapReduce-MPI library http://www.sandia.gov/~sjplimp/mapreduce.html, Sandia National Laboratories <NAME>, <EMAIL> See the README file in the top-level MR-MPI directory. ------------------------------------------------------------------------- */ /* C or Fortran style library interface to MRMPI new MRMPI-specific functions can be added */ #include "mpi.h" /* ifdefs allow this file to be included in a C program */ #ifdef __cplusplus extern "C" { #endif void mrmpi_open(int, char **, MPI_Comm, void **); void mrmpi_open_no_mpi(int, char **, void **); void mrmpi_close(void *); void mrmpi_file(void *, char *); char *mrmpi_command(void *, char *); void mrmpi_free(void *); #ifdef __cplusplus } #endif
prateekstark/pagerank
Thirdparty/mrmpi/oink/style_command.h
#include "cc_find.h" #include "cc_stats.h" #include "degree.h" #include "degree_stats.h" #include "degree_weight.h" #include "edge_upper.h" #include "histo.h" #include "luby_find.h" #include "neigh_tri.h" #include "neighbor.h" #include "pagerank.h" #include "rmat.h" #include "rmat2.h" #include "sssp.h" #include "tri_find.h" #include "vertex_extract.h" #include "wordfreq.h"
szatanjl/dwm
config.h
/* See LICENSE file for copyright and license details. */ #include <X11/XF86keysym.h> /* appearance */ static const unsigned int borderpx = 3; /* border pixel of windows */ static const unsigned int gappx = 10; /* gap pixel between windows */ static const unsigned int snap = 10; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const int statusonallmons = 1; /* 0 means only on selected monitor */ static const int statuscolor = 1; /* 1 means enable colors in status */ static const int showsystray = 1; /* 0 means no systray */ static const char *fonts[] = { "DejaVuSansMono Nerd Font:pixelsize=16:antialias=true:autohint=true", "monospace:pixelsize=16:antialias=true:autohint=true", }; static const char col_fgn[] = "#d3dae3"; static const char col_fgi[] = "#7c818c"; static const char col_fgs[] = "#5294e2"; static const char col_bgn[] = "#383c4a"; static const char col_bgi[] = "#404552"; static const char col_bor[] = "#6c717c"; static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_fgn, col_bgn, col_bor }, [SchemeSel] = { col_fgs, col_bgn, col_bgn }, [SchemeNormI] = { col_fgi, col_bgi, col_bor }, [SchemeSelI] = { col_fgs, col_bgi, col_bgi }, }; /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; static const Rule rules[] = { /* xprop(1): * WM_CLASS(STRING) = instance, class * WM_NAME(STRING) = title */ /* class instance title tags mask isfloating monitor */ { NULL, NULL, NULL, 0, 0, -1 }, }; /* layout(s) */ static const int focusonmove = 0; /* 1 means focus window on mouse move */ static const int focusonwheel = 0; /* 1 means focus window on mouse wheel */ static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */ static const int nmaster = 1; /* number of clients in master area */ static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ static const int decorhints = 1; /* 1 means respect decoration hints */ static const int tiledraise = 1; /* 1 means raise tiled windows when focused */ static const int restorefloat = 1; /* 1 means restore window's last position after togglefloating */ static const int pertag = 1; /* 1 means set workspace setup per tag */ static const Attach attachclient = attachbelow; static void tile1(Monitor *m) { selmon->nmaster = 1; tile(m); } static void tile2(Monitor *m) { selmon->nmaster = 2; tile(m); } static const Layout layouts[] = { /* symbol arrange function */ { "[]-", tile1 }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, { "[]=", tile2 }, }; /* key definitions */ #define MODKEY Mod4Mask #define TAGKEYS(KEY,TAG) \ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, #define CMD(...) spawn, { .v = (const char*[]){ "dwm-cmd", __VA_ARGS__, NULL } } static Key keys[] = { /* modifier key function argument */ { MODKEY|ShiftMask, XK_q, CMD("quitmenu", "-m", mon_str) }, { MODKEY, XK_p, CMD("appsmenu", "-m", mon_str) }, { MODKEY, XK_o, CMD("docsmenu", "-m", mon_str) }, { MODKEY, XK_u, CMD("musicmenu", "-m", mon_str) }, { MODKEY|ControlMask, XK_l, CMD("screenlock") }, { MODKEY|ShiftMask, XK_Return, CMD("terminal") }, { 0, XK_Print, CMD("screenshot") }, { MODKEY, XK_Print, CMD("screenshot", "monitor", mon_str) }, { ShiftMask, XK_Print, CMD("screenshot", "window", win_str) }, { ControlMask, XK_Print, CMD("screenshot", "select") }, { 0, XF86XK_Sleep, CMD("quit", "suspend") }, { 0, XF86XK_RFKill, CMD("rfkill", "toggle") }, { 0, XF86XK_TouchpadToggle, CMD("touchpad", "toggle") }, { 0, XF86XK_MonBrightnessDown, CMD("backlight", "down") }, { 0, XF86XK_MonBrightnessUp, CMD("backlight", "up") }, { 0, XF86XK_AudioMute, CMD("volume", "toggle") }, { 0, XF86XK_AudioLowerVolume, CMD("volume", "down") }, { 0, XF86XK_AudioRaiseVolume, CMD("volume", "up") }, { 0, XF86XK_AudioPrev, CMD("music", "prev") }, { 0, XF86XK_AudioPlay, CMD("music", "play") }, { 0, XF86XK_AudioNext, CMD("music", "next") }, { MODKEY|ShiftMask, XK_c, killclient, {0} }, { MODKEY, XK_Return, zoom_or_maximize, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) TAGKEYS( XK_4, 3) TAGKEYS( XK_5, 4) TAGKEYS( XK_6, 5) TAGKEYS( XK_7, 6) TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) { MODKEY, XK_n, setlayout, {.v = &layouts[0]} }, { MODKEY|ShiftMask, XK_m, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY|ShiftMask, XK_n, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_h, setmfact, {.f = -0.05} }, { MODKEY, XK_l, setmfact, {.f = +0.05} }, { MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} }, { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} }, { MODKEY, XK_b, setcfact, {.f = 0.00} }, { MODKEY|ShiftMask, XK_b, resetcfact, {0} }, { MODKEY, XK_Down, moveresize, {.v = (int []){ 0, 50, 0, 0 }}}, { MODKEY, XK_Up, moveresize, {.v = (int []){ 0, -50, 0, 0 }}}, { MODKEY, XK_Right, moveresize, {.v = (int []){ 50, 0, 0, 0 }}}, { MODKEY, XK_Left, moveresize, {.v = (int []){ -50, 0, 0, 0 }}}, { MODKEY|ShiftMask, XK_Down, moveresize, {.v = (int []){ 0, 0, 0, 50 }}}, { MODKEY|ShiftMask, XK_Up, moveresize, {.v = (int []){ 0, 0, 0, -50 }}}, { MODKEY|ShiftMask, XK_Right, moveresize, {.v = (int []){ 0, 0, 50, 0 }}}, { MODKEY|ShiftMask, XK_Left, moveresize, {.v = (int []){ 0, 0, -50, 0 }}}, }; /* button definitions */ /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ static Button buttons[] = { /* click event mask button function argument */ { ClkLtSymbol, 0, Button1, setlayout, {0} }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, { ClkTagBar, 0, Button1, view, {0} }, { ClkTagBar, 0, Button3, toggleview, {0} }, { ClkTagBar, MODKEY, Button1, tag, {0} }, { ClkTagBar, MODKEY, Button3, toggletag, {0} }, };
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Dependcy/GJCFAssetsPicker/Uitil/GJCFAssetsPickerConstans.h
<gh_stars>1000+ // // GJAssetsPickerConstans.h // GJAssetsPickerViewController // // Created by ZYVincent QQ:1003081775 on 14-9-8. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> #import <AssetsLibrary/AssetsLibrary.h> #import "GJCFAssetsPickerStyle.h" #import "UIButton+GJCFAssetsPickerStyle.h" #import "UILabel+GJCFAssetsPickerStyle.h" /* 图片选择达到限制数量的通知 */ extern NSString * const kGJAssetsPickerPhotoControllerDidReachLimitCountNoti; /* 图片选择视图需要退出的通知 */ extern NSString * const kGJAssetsPickerNeedCancelNoti; /* 图片选择视图已经完成了图片选择通知 */ extern NSString * const kGJAssetsPickerDidFinishChooseMediaNoti; /* 图片预览详情视图点击事件通知 */ extern NSString * const kGJAssetsPickerPreviewItemControllerDidTapNoti; /* 图片预览但是没有已经选中图片的通知 */ extern NSString * const kGJAssetsPickerRequirePreviewButNoSelectPhotoTipNoti; /* 图片选择视图发生错误 */ extern NSString * const kGJAssetsPickerComeAcrossAnErrorNoti; /* 图片选择器自定义Error 的 Domain */ extern NSString * const kGJAssetsPickerErrorDomain; /* 图片选择错误类型 */ typedef enum { /* 相册访问未授权 */ GJAssetsPickerErrorTypePhotoLibarayNotAuthorize, /** * 相册选中了0张照片 */ GJAssetsPickerErrorTypePhotoLibarayChooseZeroCountPhoto, }GJAssetsPickerErrorType; @interface GJCFAssetsPickerConstans : NSObject /* 全局使用的照片访问库 */ + (ALAssetsLibrary *)shareAssetsLibrary; /* 根据颜色创建图片 */ + (UIImage *)imageForColor:(UIColor*)aColor withSize:(CGSize)aSize; /* 当前系统版本是否iOS7 */ + (BOOL)isIOS7; /* 发送一个通知 */ + (void)postNoti:(NSString*)noti; /* 发送一个带对象的通知 */ + (void)postNoti:(NSString*)noti withObject:(NSObject*)obj; /* 发送一个带对象和UserInfo的通知 */ + (void)postNoti:(NSString*)noti withObject:(NSObject*)obj withUserInfo:(NSDictionary*)userInfo; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicSearchResultListDataManager.h
// // GJGCMusicSearchResultListDataManager.h // ZYChat // // Created by ZYVincent on 15/11/25. // Copyright (c) 2015年 ZYProSoft. All rights reserved. // #import "BTActionSheetDataManager.h" @interface GJGCMusicSearchResultListDataManager : BTActionSheetDataManager @property (nonatomic,strong)NSString *keyword; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendModel.h
<gh_stars>1000+ // // GJGCMessageExtendBaseModel.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/20. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <Foundation/Foundation.h> #import "GJGCMessageExtendUserModel.h" #import "GJGCMessageExtendContentGIFModel.h" #import "GJGCMessageExtendContentWebPageModel.h" #import "GJGCMessageExtendGroupModel.h" //扩展消息类型都基于文本消息扩展 @interface GJGCMessageExtendModel : NSObject //是否扩展消息内容,如果只是扩展用户信息,允许messageContent为空 @property (nonatomic,assign)BOOL isExtendMessageContent; @property (nonatomic,assign)BOOL isGroupMessage; @property (nonatomic,strong)GJGCMessageExtendUserModel *userInfo; @property (nonatomic,strong)GJGCMessageExtendGroupModel *groupInfo; @property (nonatomic,strong)JSONModel *messageContent; @property (nonatomic,strong)NSString *contentType; @property (nonatomic,readonly)NSString *displayText; @property (nonatomic,readonly)BOOL isSupportDisplay; @property (nonatomic,assign)GJGCChatFriendContentType chatFriendContentType; - (instancetype)initWithDictionary:(NSDictionary *)contentDict; - (NSDictionary *)contentDictionary; + (NSDictionary *)chatFriendTypeToExtendMsgTypeDict; + (NSDictionary *)extendMsgTypeToChatFriendTypeDict; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/MainTab/GJGCForwardEngine.h
// // GJGCForwardEngine.h // ZYChat // // Created by ZYVincent on 16/8/9. // Copyright © 2016年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> #import "GJGCContactsContentModel.h" #import "BTTabBarRootController.h" @interface GJGCForwardEngine : NSObject + (BTTabBarRootController *)tabBarVC; + (void)pushChatWithContactInfo:(GJGCContactsContentModel *)contactModel; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Dependcy/GJCUImageBrowser/ViewController/GJCUImageBrowserViewControllerDataSource.h
// // GJCFImageBrowserViewControllerDelegate.h // GJCommonFoundation // // Created by ZYVincent QQ:1003081775 on 14-10-30. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> @class GJCUImageBrowserViewController; @protocol GJCUImageBrowserViewControllerDataSource <NSObject> /** * 设定自定义工具栏 * * @param browserController * * @return */ - (UIView *)imageBrowserShouldCustomBottomToolBar:(GJCUImageBrowserViewController *)browserController; /** * 设定自定义导航栏右上角 * * @param browserController * * @return */ - (UIView *)imageBrowserShouldCustomRightNavigationBarItem:(GJCUImageBrowserViewController *)browserController; /** * 设定自定义导航条背景 * * @param browserController * * @return */ - (UIImage *)imageBrowserShouldCustomNavigationBar:(GJCUImageBrowserViewController *)browserController; /** * 将要消失 * * @param browserController */ - (void)imageBrowserWillCancel:(GJCUImageBrowserViewController *)browserController; /** * 删除完显示指定位置的图片执行此回调 * * @param browserController * @param index */ - (void)imageBrowser:(GJCUImageBrowserViewController *)browserController didFinishRemoveAtIndex:(NSInteger)index; /** * 删除仅剩的最后一张图片的时候执行此回调 * * @param browserController */ - (void)imageBrowserShouldReturnWhileRemoveLastOnlyImage:(GJCUImageBrowserViewController *)browserController; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/GJGCChatInputPanel/GJGCChatInputExpandMenuPanelDataSource.h
<gh_stars>1000+ // // GJGCChatInputExpandMenuPanelDataSource.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-10-28. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> #import "GJGCChatInputConst.h" #import "GJGCChatInputExpandMenuPanelConfigModel.h" #define GJGCChatInputExpandMenuPanelDataSourceTitleKey @"GJGCChatInputExpandMenuPanelDataSourceTitleKey" #define GJGCChatInputExpandMenuPanelDataSourceIconNormalKey @"GJGCChatInputExpandMenuPanelDataSourceIconNormalKey" #define GJGCChatInputExpandMenuPanelDataSourceIconHighlightKey @"GJGCChatInputExpandMenuPanelDataSourceIconHighlightKey" #define GJGCChatInputExpandMenuPanelDataSourceActionTypeKey @"GJGCChatInputExpandMenuPanelDataSourceActionTypeKey" @interface GJGCChatInputExpandMenuPanelDataSource : NSObject + (NSArray *)menuItemDataSourceWithConfigModel:(GJGCChatInputExpandMenuPanelConfigModel *)configModel; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Encode&Decode/GJCFEncodeAndDecode.h
<reponame>AnriKaede/ZY2017IM // // GJCFEncodeAndDecode.h // GJCommonFoundation // // Created by ZYVincent QQ:1003081775 on 14-9-16. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> #import "GJCFAudioModel.h" /* * iOS 支持自身的格式是Wav格式, * 我们将需要转成Wav格式的文件都认为是临时编码文件 */ @interface GJCFEncodeAndDecode : NSObject /* 将音频文件转为AMR格式,会为其创建AMR编码的临时文件 */ + (BOOL)convertAudioFileToAMR:(GJCFAudioModel *)audioFile; /* 将音频文件转为WAV格式 */ + (BOOL)convertAudioFileToWAV:(GJCFAudioModel *)audioFile; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Service/DataCenter/ZYDataCenter.h
<gh_stars>1000+ // // ZYDataCenter.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/6. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <Foundation/Foundation.h> #import "ZYDataCenterInterface.h" #import "ZYDataCenterRequestCondition.h" #import "ZYNetWorkManager.h" typedef void (^ZYServiceManagerRequestFaildBlock) (NSError *error); typedef void (^ZYServiceManagerListModelResultSuccessBlock) (NSArray *modelArray); typedef void (^ZYServiceManagerActionSuccessBlock) (NSString *result); @interface ZYDataCenter : NSObject + (ZYDataCenter *)shareCenter; - (NSString *)requestWithCondition:(ZYDataCenterRequestCondition*)condition withSuccessBlock:(ZYNetWorkManagerTaskDidSuccessBlock)success withFaildBlock:(ZYNetWorkManagerTaskDidFaildBlock)faild; - (NSString *)thirdServerRequestWithCondition:(ZYDataCenterRequestCondition*)condition withSuccessBlock:(ZYNetWorkManagerTaskDidSuccessBlock)success withFaildBlock:(ZYNetWorkManagerTaskDidFaildBlock)faild; - (void)cancelRequest:(NSString *)requestIdentifier; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Dependcy/DownloadManager/GJCFFileDownloadManager.h
// // GJCFFileDownloadManager.h // GJCommonFoundation // // Created by ZYVincent QQ:1003081775 on 14-9-18. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> #import "GJCFFileDownloadTask.h" @class GJCFFileDownloadTask; typedef void (^GJCFFileDownloadManagerCompletionBlock) (GJCFFileDownloadTask *task,NSData *fileData,BOOL isFinishCache); typedef void (^GJCFFileDownloadManagerProgressBlock) (GJCFFileDownloadTask *task,CGFloat progress); typedef void (^GJCFFileDownloadManagerFaildBlock) (GJCFFileDownloadTask *task,NSError *error); @interface GJCFFileDownloadManager : NSObject + (GJCFFileDownloadManager *)shareDownloadManager; /* 设置下载服务器地址,不是必须的,是为了用来当没有主机地址的时候,可以用来补全 */ - (void)setDefaultDownloadHost:(NSString *)host; /* 添加一个下载任务 */ - (void)addTask:(GJCFFileDownloadTask *)task; /* * 观察者唯一标识生成方法 */ + (NSString*)uniqueKeyForObserver:(NSObject*)observer; /* * 设定观察者完成方法 */ - (void)setDownloadCompletionBlock:(GJCFFileDownloadManagerCompletionBlock)completionBlock forObserver:(NSObject*)observer; /* * 设定观察者进度方法 */ - (void)setDownloadProgressBlock:(GJCFFileDownloadManagerProgressBlock)progressBlock forObserver:(NSObject*)observer; /* * 设定观察者失败方法 */ - (void)setDownloadFaildBlock:(GJCFFileDownloadManagerFaildBlock)faildBlock forObserver:(NSObject*)observer; /* * 将观察者的block全部清除 */ - (void)clearTaskBlockForObserver:(NSObject *)observer; /** * 退出指定下载任务 * * @param taskUniqueIdentifier 下载任务标示 */ - (void)cancelTask:(NSString *)taskUniqueIdentifier; /** * 退出有相同标示的下载任务组 * * @param groupTaskUniqueIdentifier */ - (void)cancelGroupTask:(NSString *)groupTaskUniqueIdentifier; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/Base/GJGCChatBaseConstans.h
<filename>ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/Base/GJGCChatBaseConstans.h // // GJGCChatBaseConstans.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-11-5. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> /** * 消息三大类型 */ typedef NS_ENUM(NSUInteger, GJGCChatBaseMessageType) { /** * 系统助手 */ GJGCChatBaseMessageTypeSystemNoti, /** * 聊天对话消息 */ GJGCChatBaseMessageTypeChatMessage, }; @interface GJGCChatBaseConstans : NSObject @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailDataSourceManager.h
<gh_stars>1000+ // // GJGCChatDetailDataSourceManager.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-11-3. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> #import "GJGCChatBaseConstans.h" #import "GJGCChatBaseCell.h" #import "GJGCChatSystemNotiModel.h" #import "GJGCChatSystemNotiConstans.h" #import "GJGCChatFriendConstans.h" #import "GJGCChatFriendContentModel.h" #import "GJGCChatContentBaseModel.h" #import "GJGCChatAuthorizAskCell.h" #import "GJGCChatSystemNotiCellStyle.h" #import "GJGCChatFriendCellStyle.h" #import "GJGCChatFriendContentModel.h" #import "GJGCChatFriendTalkModel.h" extern NSString * GJGCChatForwardMessageDidSendNoti; @class GJGCChatDetailDataSourceManager; @protocol GJGCChatDetailDataSourceManagerDelegate <NSObject> @optional - (void)dataSourceManagerRequireUpdateListTable:(GJGCChatDetailDataSourceManager *)dataManager; - (void)dataSourceManagerRequireUpdateListTable:(GJGCChatDetailDataSourceManager *)dataManager reloadAtIndex:(NSInteger)index; - (void)dataSourceManagerRequireUpdateListTable:(GJGCChatDetailDataSourceManager *)dataManager reloadForUpdateMsgStateAtIndex:(NSInteger)index; - (void)dataSourceManagerRequireUpdateListTable:(GJGCChatDetailDataSourceManager *)dataManager insertWithIndex:(NSInteger)index; - (void)dataSourceManagerRequireTriggleLoadMore:(GJGCChatDetailDataSourceManager *)dataManager; - (void)dataSourceManagerRequireFinishLoadMore:(GJGCChatDetailDataSourceManager *)dataManager; - (void)dataSourceManagerRequireFinishRefresh:(GJGCChatDetailDataSourceManager *)dataManager; - (void)dataSourceManagerRequireDeleteMessages:(GJGCChatDetailDataSourceManager *)dataManager deletePaths:(NSArray *)paths; - (void)dataSourceManagerRequireUpdateListTable:(GJGCChatDetailDataSourceManager *)dataManager insertIndexPaths:(NSArray *)indexPaths; - (void)dataSourceManagerRequireChangeAudioRecordEnableState:(GJGCChatDetailDataSourceManager *)dataManager state:(BOOL)enable; - (void)dataSourceManagerRequireAutoPlayNextAudioAtIndex:(NSInteger)index; - (void)dataSourceManagerDidRecievedChatContent:(GJGCChatFriendContentModel *)chatContent; - (void)dataSourceManagerDidUpdateUnreadMessageCount:(GJGCChatDetailDataSourceManager *)dataManager; @end @interface GJGCChatDetailDataSourceManager : NSObject @property (nonatomic,readonly)NSString *uniqueIdentifier; @property (nonatomic,weak)id<GJGCChatDetailDataSourceManagerDelegate> delegate; @property (nonatomic,copy)NSString *title; @property (nonatomic,strong)NSMutableArray *chatListArray; @property (nonatomic,strong)NSMutableArray *timeShowSubArray; @property (nonatomic,readonly)GJGCChatFriendTalkModel *taklInfo; @property (nonatomic,assign)BOOL isFinishFirstHistoryLoad; @property (nonatomic,assign)BOOL isFinishLoadAllHistoryMsg; @property (nonatomic,strong)dispatch_queue_t taskQueue; @property (nonatomic,readonly)NSInteger unreadMsgCount; /** * 发送消息时间间隔频度控制 */ @property (nonatomic,assign)NSInteger sendTimeLimit; /** * 上一条消息的时间 */ @property (nonatomic,assign)long long lastSendMsgTime; /** * 当前第一条消息得msgId */ @property (nonatomic,copy)NSString *lastFirstLocalMsgId; - (instancetype)initWithTalk:(GJGCChatFriendTalkModel *)talk withDelegate:(id<GJGCChatDetailDataSourceManagerDelegate>)aDelegate; - (NSInteger)totalCount; - (NSInteger)chatContentTotalCount; - (Class)contentCellAtIndex:(NSInteger)index; - (NSString *)contentCellIdentifierAtIndex:(NSInteger)index; - (GJGCChatContentBaseModel *)contentModelAtIndex:(NSInteger)index; - (NSArray *)heightForContentModel:(GJGCChatContentBaseModel *)contentModel; - (CGFloat)rowHeightAtIndex:(NSInteger)index; /** * 更新语音播放状态为已读,子类需要实现 * * @param localMsgId */ - (void)updateAudioFinishRead:(NSString *)localMsgId; /** * 更新数据源对象,并且会影响数据源高度 * * @param contentModel * @param index */ - (NSNumber *)updateContentModel:(GJGCChatContentBaseModel *)contentModel atIndex:(NSInteger)index; /** * 更新数据库中对应得消息高度 * * @param contentModel */ - (void)updateMsgContentHeightWithContentModel:(GJGCChatContentBaseModel *)contentModel; /** * 更新数据源对象的某些值,但是并不影响数据源高度 * * @param contentModel * @param index */ - (void)updateContentModelValuesNotEffectRowHeight:(GJGCChatContentBaseModel *)contentModel atIndex:(NSInteger)index; /** * 添加一个对象 * * @param contentModel * * @return */ - (NSNumber *)addChatContentModel:(GJGCChatContentBaseModel *)contentModel; - (void)removeChatContentModelAtIndex:(NSInteger)index; - (void)resortAllChatContentBySendTime; - (void)resortAllSystemNotiContentBySendTime; - (void)resetFirstAndLastMsgId; - (void)readLastMessagesFromDB; - (void)updateAllMsgTimeShowString; - (void)updateTheNewMsgTimeString:(GJGCChatContentBaseModel *)contentModel; - (NSString *)updateMsgContentTimeStringAtDeleteIndex:(NSInteger)index; - (void)removeContentModelByIdentifier:(NSString *)identifier; - (void)removeTimeSubByIdentifier:(NSString *)identifier; - (NSInteger)getContentModelIndexByLocalMsgId:(NSString *)msgId; - (GJGCChatContentBaseModel *)contentModelByMsgId:(NSString *)msgId; - (NSArray *)deleteMessageAtIndex:(NSInteger)index; - (void)trigglePullHistoryMsgForEarly; /** * 发收到消息的通知 * * @param array <#array description#> */ - (void)pushAddMoreMsg:(NSArray *)array; /** * 系统消息更新最后一条会话 */ - (void)updateLastSystemMessageForRecentTalk; #pragma mark - 将数据添加到数据监听进程中,要求UI刷新 - (void)insertNewMessageWithStartIndex:(NSInteger)startIndex Count:(NSInteger)count; /** * 清除过早历史消息 */ - (void)clearOverEarlyMessage; /** * 重新尝试取历史消息,当历史消息和本地区间消息有交集了 * * @return */ - (NSArray *)reTryGetLocalMessageWhileHistoryMessageIsSubMessagesOfLocalMessages; /** * 收到消息加入到数据源 * * @param aMessage */ - (GJGCChatFriendContentModel *)addEaseMessage:(EMMessage *)aMessage; /** * 根据环信消息格式内容展示 * * @param chatContentModel * @param sendMesssage * @param messageContent * * @return */ - (GJGCChatFriendContentType)formateChatFriendContent:(GJGCChatFriendContentModel *)chatContentModel withMsgModel:(EMMessage *)msgModel; /** * 发送一条消息 * * @param messageContent * * result YES成功 NO:时间间隔限制 */ - (BOOL)sendMesssage:(GJGCChatFriendContentModel *)messageContent; /** * 重发一条消息 * * @param theMessage 重发的消息 */ - (void)reSendMesssage:(GJGCChatFriendContentModel *)messageContent; /** * 消息状态对应关系 * * @return */ - (NSDictionary *)easeMessageStateRleations; //插入小灰条消息 + (void)createRemindTipMessage:(NSString *)message conversationType:(EMConversationType)type withConversationId:(NSString *)conversationId; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendSendFlowerModel.h
// // GJGCMessageExtendSendFlower.h // ZYChat // // Created by ZYVincent on 16/5/15. // Copyright © 2016年 ZYProSoft. All rights reserved. // #import "JSONModel.h" @interface GJGCMessageExtendSendFlowerModel : JSONModel @property (nonatomic,strong)NSString *displayText; @property (nonatomic,strong)NSString *notSupportDisplayText; @property (nonatomic,strong)NSString *title; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendDriftBottleCell.h
// // GJGCChatFriendDriftBottleCell.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/6/30. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import "GJGCChatFriendImageMessageCell.h" @interface GJGCChatFriendDriftBottleCell : GJGCChatFriendImageMessageCell @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendMemberWelcomeCell.h
// // GJGCChatFriendMemberWelcomeCell.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15-3-18. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import "GJGCChatFriendBaseCell.h" @interface GJGCChatFriendMemberWelcomeCell : GJGCChatFriendBaseCell @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsUserCell.h
// // GJGCContactsUserCell.h // ZYChat // // Created by ZYVincent on 16/8/9. // Copyright © 2016年 ZYProSoft. All rights reserved. // #import "GJGCContactsBaseCell.h" @interface GJGCContactsUserCell : GJGCContactsBaseCell @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Login/HARegistContentModel.h
// // HARegistContentModel.h // HelloAsk // // Created by ZYVincent on 15-9-4. // Copyright (c) 2015年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> /** * 内容类型 */ typedef NS_ENUM(NSUInteger, HARegistContentType){ /** * 用户名 */ HARegistContentTypeUserName, /** * 密码 */ HARegistContentTypePassword, }; @interface HARegistContentModel : NSObject @property (nonatomic,assign)HARegistContentType contentType; @property (nonatomic,strong)NSString *tagName; @property (nonatomic,strong)NSString *placeHolder; @property (nonatomic,strong)NSString *content; @property (nonatomic,assign)CGFloat contentHeight; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/BTActionSheetViewController/BTDateActionSheetViewController.h
<reponame>AnriKaede/ZY2017IM // // BTDateActionSheetViewController.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/9/9. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import "BTActionSheetViewController.h" @interface BTDateActionSheetViewController : BTActionSheetViewController @property (nonatomic,strong)NSDate *startDate; @property (nonatomic,strong)NSDate *endDate; @property (nonatomic,strong)NSDate *selectedDate; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/BTActionSheetViewController/BTActionSheetBaseContentModel.h
// // BTActionSheetBaseContentModel.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/9/2. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <Foundation/Foundation.h> #import "BTActionSheetConst.h" @interface BTActionSheetBaseContentModel : NSObject @property (nonatomic,assign)BTActionSheetContentType contentType; @property (nonatomic,assign)CGFloat contentHeight; @property (nonatomic,strong)NSString *simpleText; @property (nonatomic,strong)NSString *detailText; @property (nonatomic,strong)NSDictionary *userInfo; @property (nonatomic,assign)BOOL isMutilSelect; @property (nonatomic,assign)BOOL selected; /** * 多选状态下禁用此交互,默认不禁用 */ @property (nonatomic,assign)BOOL disableMutilSelectUserInteract; - (BOOL)isEqual:(BTActionSheetBaseContentModel *)object; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/AppWall/GJGCAppWallDataManager.h
// // GJGCAppWallDataManager.h // ZYChat // // Created by ZYVincent on 15/11/26. // Copyright (c) 2015年 ZYProSoft. All rights reserved. // #import "GJGCInfoBaseListDataManager.h" #import "GJGCAppWallParamsModel.h" @interface GJGCAppWallDataManager : GJGCInfoBaseListDataManager @property (nonatomic,strong)GJGCAppWallParamsModel *paramsModel; @property (nonatomic,assign)BOOL isFirstLoadingFinish; - (void)requestAppListNow; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/GJGCChatInputPanel/GJGCChatInputPanelDelegate.h
// // GJGCChatInputPanelDelegate.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-10-28. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // @class GJGCChatInputPanel; #import "GJCFAudioModel.h" @protocol GJGCChatInputPanelDelegate <NSObject> @optional /** * 当选择扩展面板的时候会执行这个协议来通知动作类型 * * @param panel * @param actionType GJGCChatInputMenuPanelActionType */ - (void)chatInputPanel:(GJGCChatInputPanel *)panel didChooseMenuAction:(GJGCChatInputMenuPanelActionType)actionType; /** * 完成录音 * * @param panel * @param audioFile 录音结果文件 */ - (void)chatInputPanel:(GJGCChatInputPanel *)panel didFinishRecord:(GJCFAudioModel *)audioFile; /** * 发送文字消息 * * @param panel * @param text */ - (void)chatInputPanel:(GJGCChatInputPanel *)panel sendTextMessage:(NSString *)text; /** * 发送gif消息 * * @param panel * @param gifCode */ - (void)chatInputPanel:(GJGCChatInputPanel *)panel sendGIFMessage:(NSString *)gifCode; /** * 根据会话类型显示扩展面板 * * @param panel * @param configData 其他一些自定义用来配置的参数 * * @return */ - (GJGCChatInputExpandMenuPanelConfigModel *)chatInputPanelRequiredCurrentConfigData:(GJGCChatInputPanel *)panel; /** * 会话输入条具体触发哪种动作 * * @param panel * @param action */ - (void)chatInputPanel:(GJGCChatInputPanel *)panel didChangeToInputBarAction:(GJGCChatInputBarActionType)action; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/Base/GJGCChatBaseCellDelegate.h
// // GJGCChatSystemNotiCellDelegate.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-11-11. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> @class GJGCChatBaseCell; @protocol GJGCChatBaseCellDelegate <NSObject> @optional /* ============================= 系统通知代理方法 ========================= */ #pragma mark - 系统助手的cell事件代理 /** * 点击了角色名片 * * @param tapedCell 被点击的cell */ - (void)systemNotiBaseCellDidTapOnRoleView:(GJGCChatBaseCell *)tapedCell; /** * 点击了同意申请按钮 * * @param tapedCell */ - (void)systemNotiBaseCellDidTapOnAcceptApplyButton:(GJGCChatBaseCell *)tapedCell; /** * 点击了拒绝申请按钮 * * @param tapedCell */ - (void)systemNotiBaseCellDidTapOnRejectApplyButton:(GJGCChatBaseCell *)tapedCell; /** * 点击了立即加入按钮 * * @param tapedCell */ - (void)systemNotiBaseCellDidTapOnSystemActiveGuideButton:(GJGCChatBaseCell *)tapedCell; /** * 点击了邀请好友入群 * * @param tapedCell */ - (void)systemNotiBaseCellDidTapOnInviteFriendJoinGroup:(GJGCChatBaseCell *)tapedCell; /** * 删除系统消息 * * @param tapedCell */ - (void)systemNotiBaseCellDidChooseDelete:(GJGCChatBaseCell *)tapedCell; #pragma mark - 好友对话的cell事件代理 /** * 点击了帖子 * * @param tapedCell */ - (void)chatCellDidTapOnPost:(GJGCChatBaseCell *)tapedCell; /** * 点击了语音的消息cell * * @param tapedCell */ - (void)audioMessageCellDidTap:(GJGCChatBaseCell *)tapedCell; /** * 点击了图片消息cell * * @param tapedCell */ - (void)imageMessageCellDidTap:(GJGCChatBaseCell *)tapedCell; /** * 点击了图片消息cell * * @param tapedCell */ - (void)videoMessageCellDidTap:(GJGCChatBaseCell *)tapedCell; /** * 点击了电话的cell * * @param tapedCell * @param phoneNumber */ - (void)textMessageCellDidTapOnPhoneNumber:(GJGCChatBaseCell *)tapedCell withPhoneNumber:(NSString *)phoneNumber; /** * 点击了url的cell * * @param tapedCell * @param url */ - (void)textMessageCellDidTapOnUrl:(GJGCChatBaseCell *)tapedCell withUrl:(NSString *)url; /** * 点击了cell的删除事件 * * @param tapedCell */ - (void)chatCellDidChooseDeleteMessage:(GJGCChatBaseCell *)tapedCell; /** * 点击了重发事件 * * @param tapedCell */ - (void)chatCellDidChooseReSendMessage:(GJGCChatBaseCell *)tapedCell; /** * 点击了头像 * * @param tapedCell */ - (void)chatCellDidTapOnHeadView:(GJGCChatBaseCell *)tapedCell; /** * 长按头像 * * @param tapedCell */ - (void)chatCellDidLongPressOnHeadView:(GJGCChatBaseCell *)tapedCell; /** * 收藏帖子 * * @param tapedCell */ - (void)chatCellDidChooseFavoritePost:(GJGCChatBaseCell *)tapedCell; /** * 点击新人欢迎card */ - (void)chatCellDidTapOnWelcomeMemberCard:(GJGCChatBaseCell *)tappedCell; /** * 点击漂流瓶 * * @param tappedCell */ - (void)chatCellDidTapOnDriftBottleCard:(GJGCChatBaseCell *)tappedCell; /** * 点击了网页消息 * * @param tapedCell */ - (void)chatCellDidTapOnWebPage:(GJGCChatBaseCell *)tapedCell; /** * 点击了音乐消息 * * @param tapedCell */ - (void)chatCellDidTapOnMusicShare:(GJGCChatBaseCell *)tapedCell; /** * 点击了音乐播放按钮消息 * * @param tapedCell */ - (void)chatCellDidTapOnMusicSharePlayButton:(GJGCChatBaseCell *)tapedCell; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/GJGCChatInputPanel/GJGCChatInputExpandEmojiPanelPageItem.h
<reponame>AnriKaede/ZY2017IM<gh_stars>1000+ // // GJGCChatInputExpandEmojiPanelPageItem.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-11-26. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <UIKit/UIKit.h> @interface GJGCChatInputExpandEmojiPanelPageItem : UIView @property (nonatomic,strong)NSString *panelIdentifier; - (instancetype)initWithFrame:(CGRect)frame withEmojiNameArray:(NSArray *)emojiArray; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Manager/GJCFAudioManager.h
// // GJCFAudioManager.h // GJCommonFoundation // // Created by ZYVincent QQ:1003081775 on 14-9-16. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> #import "GJCFAudioPlayerDelegate.h" #import "GJCFAudioRecordDelegate.h" #import "GJCFAudioNetworkDelegate.h" #import "GJCFAudioManager.h" #import "GJCFAudioModel.h" #import "GJCFAudioFileUitil.h" #import "GJCFEncodeAndDecode.h" typedef void (^GJCFAudioManagerDidFinishUploadCurrentRecordFileBlock) (NSString *remoteUrl); typedef void (^GJCFAudioManagerDidFaildUploadCurrentRecordFileBlock) (NSError *error); typedef void (^GJCFAudioManagerDidFinishGetRemoteFileDurationBlock) (NSString *remoteUrl, NSTimeInterval duration); typedef void (^GJCFAudioManagerDidFaildGetRemoteFileDurationBlock) (NSString *remoteUrl, NSError *error); typedef void (^GJCFAudioManagerShouldShowRecordSoundMouterBlock) (CGFloat recordSoundMouter); typedef void (^GJCFAudioManagerStartPlayRemoteUrlBlock) (NSString *remoteUrl,NSString *localWavPath); typedef void (^GJCFAudioManagerPlayRemoteUrlFaildByDownloadErrorBlock) (NSString *remoteUrl); typedef void (^GJCFAudioManagerPlayFaildBlock) (NSString *localWavPath); typedef void (^GJCFAudioManagerRecordFaildBlock) (NSString *localWavPath); typedef void (^GJCFAudioManagerShouldShowPlaySoundMouterBlock) (CGFloat playSoundMouter); typedef void (^GJCFAudioManagerShouldShowPlayProgressBlock) (NSString *audioLocalPath,CGFloat progress,CGFloat duration); typedef void (^GJCFAudioManagerShouldShowPlayProgressDetailBlock) (NSString *audioLocalPath,NSTimeInterval playCurrentTime,NSTimeInterval duration); typedef void (^GJCFAudioManagerDidFinishPlayCurrentAudioBlock) (NSString *audioLocalPath); typedef void (^GJCFAudioManagerDidFinishRecordCurrentAudioBlock) (NSString *audioLocalPath,NSTimeInterval duration); typedef void (^GJCFAudioManagerUploadAudioFileProgressBlock) (NSString *audioLocalPath,CGFloat progress); typedef void (^GJCFAudioManagerUploadCompletionBlock) (NSString *audioLocalPath,BOOL result,NSString *remoteUrl); @interface GJCFAudioManager : NSObject /* 如果外部需要接管这个播放过程,那么实现这个代理并赋值 */ @property (nonatomic,weak)id<GJCFAudioPlayerDelegate> playerDelegate; /* 如果外部需要接管这个录制过程,那么实现这个代理并赋值 */ @property (nonatomic,weak)id<GJCFAudioRecordDelegate> recordDelegate; /* 如果外部需要接管这个上传,下载过程,那么实现这个代理并赋值 */ @property (nonatomic,weak)id<GJCFAudioNetworkDelegate> networkDelegate; /* 创建共享单例 */ + (GJCFAudioManager *)shareManager; /* 访问当前录音文件信息 */ - (GJCFAudioModel *)getCurrentRecordAudioFile; /* 访问当前播放文件信息 */ - (GJCFAudioModel *)getCurrentPlayAudioFile; /* 开始录音 */ - (void)startRecord; /* 开始一个时间限制的录音 */ - (void)startRecordWithLimitDuration:(NSTimeInterval)limitSeconds; /* 完成录音 */ - (void)finishRecord; /* 取消录音 */ - (void)cancelCurrentRecord; /* 停止播放 */ - (void)stopPlayCurrentAudio; /* 暂停播放 */ - (void)pausePlayCurrentAudio; /* 继续当前播放 */ - (void)startPlayFromLastStopTimestamp; /* 播放本地指定音频文件 */ - (void)playLocalWavFile:(NSString *)audioFilePath; /* 播放一个音频文件 */ - (void)playAudioFile:(GJCFAudioModel *)audioFile; /* 指定进度开始播放 */ - (void)playCurrentAudioAtProgress:(CGFloat)progress; /* 播放当前录制的文件 */ - (void)playCurrentRecodFile; /* 通过一个远程音频文件地址播放音频 */ - (void)playRemoteAudioFileByUrl:(NSString *)remoteAudioUrl; /* 通过一个远程音乐文件地址播放音频 */ - (void)playRemoteMusicByUrl:(NSString *)remoteAudioUrl; /* 通过一个远程音乐文件地址播放音频 并且指定缓存文件名 */ - (void)playRemoteMusicByUrl:(NSString *)remoteAudioUrl withCacheFileName:(NSString *)fileName; /* 获取指定本地路径音频文件的时长 */ - (NSTimeInterval)getDurationForLocalWavPath:(NSString *)localAudioFilePath; /* 获取网络音频文件时长 */ - (void)getDurationForRemoteUrl:(NSString *)remoteUrl withFinish:(GJCFAudioManagerDidFinishGetRemoteFileDurationBlock)finishBlock withFaildBlock:(GJCFAudioManagerDidFaildGetRemoteFileDurationBlock)faildBlock; /* 设定观察录音音量波形 */ - (void)setShowRecordSoundMouter:(GJCFAudioManagerShouldShowRecordSoundMouterBlock)recordBlock; /* 设定观察播放音量波形 */ - (void)setShowPlaySoundMouter:(GJCFAudioManagerShouldShowPlaySoundMouterBlock)playBlock; /* 设置上传时候的认证类型的参数到HttpHeader */ - (void)setUploadAuthorizedParamsForHttpHeader:(NSDictionary *)headerValues; /* 设置上传时候的认证类型的参数到params */ - (void)setUploadAuthorizedParamsForHttpRequestParams:(NSDictionary *)params; /* 开始上传当前录制的音频文件 */ - (void)startUploadCurrentRecordFile; /* 开始上传当前录制的音频文件 */ - (void)startUploadCurrentRecordFileWithFinish:(GJCFAudioManagerDidFinishUploadCurrentRecordFileBlock)finishBlock withFaildBlock:(GJCFAudioManagerDidFaildUploadCurrentRecordFileBlock)faildBlock; /* 开始上传指定文件 */ - (void)startUploadAudioFile:(GJCFAudioModel *)audioFile; /* 观察播放进度 */ - (void)setCurrentAudioPlayProgressBlock:(GJCFAudioManagerShouldShowPlayProgressBlock)progressBlock; /* 观察播放详细进度 */ - (void)setCurrentAudioPlayProgressDetailBlock:(GJCFAudioManagerShouldShowPlayProgressDetailBlock)progressDetailBlock; /* 观察当前播放完成 */ - (void)setCurrentAudioPlayFinishedBlock:(GJCFAudioManagerDidFinishPlayCurrentAudioBlock)finishBlock; /* 观察录音完成 */ - (void)setFinishRecordCurrentAudioBlock:(GJCFAudioManagerDidFinishRecordCurrentAudioBlock)finishBlock; /* 观察上传进度 */ - (void)setCurrentAudioUploadProgressBlock:(GJCFAudioManagerUploadAudioFileProgressBlock)progressBlock; /* 观察上传完成 */ - (void)setCurrentAudioUploadCompletionBlock:(GJCFAudioManagerUploadCompletionBlock)completionBlock; /* 清除当前所有观察block */ - (void)clearAllCurrentObserverBlocks; /* 观察播放远程音频文件开始播放 */ - (void)setStartRemoteUrlPlayBlock:(GJCFAudioManagerStartPlayRemoteUrlBlock)startRemoteBlock; /* 观察远程播放失败 */ - (void)setFaildPlayRemoteUrlBlock:(GJCFAudioManagerPlayRemoteUrlFaildByDownloadErrorBlock)playErrorBlock; /* 观察播放失败 */ - (void)setFaildPlayAudioBlock:(GJCFAudioManagerPlayFaildBlock)faildPlayBlock; /* 观察录音失败 */ - (void)setRecrodFaildBlock:(GJCFAudioManagerRecordFaildBlock)faildRecordBlock; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/UserList/ZYUserListContentModel.h
<filename>ZYChat-EaseMob/ZYChat/UserList/ZYUserListContentModel.h<gh_stars>1000+ // // ZYUserListContentModel.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/6. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <Foundation/Foundation.h> @interface ZYUserListContentModel : NSObject @property (nonatomic,strong)NSString *nickname; @property (nonatomic,strong)NSString *userId; @property (nonatomic,strong)NSString *headThumb; @property (nonatomic,strong)NSString *mobile; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/UserList/ZYUserListViewController.h
// // ZYUserListViewController.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/6. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <UIKit/UIKit.h> #import "GJGCBaseViewController.h" @interface ZYUserListViewController : GJGCBaseViewController @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/GJGCChatInputPanel/GJGCChatInputExpandEmojiPanelGifPageItem.h
// // GJGCChatInputExpandEmojiPanelGifPageItem.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/6/3. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <UIKit/UIKit.h> @interface GJGCChatInputExpandEmojiPanelGifPageItem : UIView @property (nonatomic,strong)NSString *panelIdentifier; @property (nonatomic,weak)UIView *panelView; - (instancetype)initWithFrame:(CGRect)frame withEmojiNameArray:(NSArray *)emojiArray; - (void)reserve; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/GroupInfoExtend/GJGCGroupInfoExtendConst.h
// // GJGCGroupInfoExtendConst.h // ZYChat // // Created by ZYVincent on 15/11/20. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <Foundation/Foundation.h> //群名字 extern const NSString *kGJGCGroupInfoExtendName; //群等级 extern const NSString *kGJGCGroupInfoExtendCreateTime; //群等级 extern const NSString *kGJGCGroupInfoExtendLevel; //公司 extern const NSString *kGJGCGroupInfoExtendCompany; //群简介 extern const NSString *kGJGCGroupInfoExtendDescription; //群头像 extern const NSString *kGJGCGroupInfoExtendHeadUrl; //群签名 extern const NSString *kGJGCGroupInfoExtendSign; //群标签 extern const NSString *kGJGCGroupInfoExtendLabels; //群位置 extern const NSString *kGJGCGroupInfoExtendLocation; //群地址 extern const NSString *kGJGCGroupInfoExtendAddress; @interface GJGCGroupInfoExtendConst : NSObject @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Service/Database/ZYDatabaseOperation.h
// // ZYDatabaseOperation.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/9. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <Foundation/Foundation.h> #import "ZYDatabaseCRUDCondition.h" #import "FMResultSet.h" typedef void (^ZYDatabaseOperationQuerySuccessBlock) (FMResultSet *resultSet); typedef void (^ZYDatabaseOperationUpdateSuccessBlock) (void); typedef void (^ZYDatabaseOperationFaildBlock) (NSError *error); @interface ZYDatabaseOperation : NSObject @property (nonatomic,readonly)NSString *dbPath; @property (nonatomic,strong)ZYDatabaseCRUDCondition *actionCondition; @property (nonatomic,copy)ZYDatabaseOperationQuerySuccessBlock QuerySuccess; @property (nonatomic,copy)ZYDatabaseOperationUpdateSuccessBlock updateSuccess; @property (nonatomic,copy)ZYDatabaseOperationFaildBlock faild; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendCellStyle.h
// // GJGCChatFirendCellStyle.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-11-10. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> @interface GJGCChatFriendCellStyle : NSObject + (NSString *)imageTag; + (NSDictionary *)formateSimpleTextMessage:(NSString *)messageText; + (NSAttributedString *)formateAudioDuration:(NSString *)duration; /* 灰度消息提醒 */ + (NSAttributedString *)formateMinMessage:(NSString *)msg; + (NSAttributedString *)formateGroupChatSenderName:(NSString *)senderName; + (NSAttributedString *)formatePostTitle:(NSString *)postTitle; /* 群新人欢迎card 样式 */ /** * 标题样式 */ + (NSAttributedString *)formateTitleString:(NSString *)title; /* 年轻女性名字标签风格 */ + (NSAttributedString *)formateYoungWomenNameString:(NSString *)name; /* 名字标签风格 */ + (NSAttributedString *)formateNameString:(NSString *)name; /* 男年龄标签 */ + (NSAttributedString *)formateManAge:(NSString *)manAge; /* 女年龄标签 */ + (NSAttributedString *)formateWomenAge:(NSString *)womenAge; /* 星座标签 */ + (NSAttributedString *)formateStarName:(NSString *)starName; /* 群主召唤card样式 */ + (NSAttributedString *)formateGroupCallTitle:(NSString *)title; + (NSAttributedString *)formateGroupCallContent:(NSString *)content; /* 接受群主召唤card样式 */ + (NSAttributedString *)formateAcceptGroupCallContent:(NSString *)content; /* 漂流瓶样式 */ + (NSAttributedString *)formateDriftBottleContent:(NSString *)content; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendMiniMessageModel.h
<filename>ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendMiniMessageModel.h // // GJGCMessageExtendMiniMessageModel.h // ZYChat // // Created by ZYVincent on 16/6/29. // Copyright © 2016年 ZYProSoft. All rights reserved. // #import "JSONModel.h" @interface GJGCMessageExtendMiniMessageModel : JSONModel @property (nonatomic,strong)NSString *displayText; @property (nonatomic,strong)NSString *notSupportDisplayText; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Cell/GJGCInformationMemeberShowCell.h
// // GJGCInformationMemeberShowCell.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-11-6. // Copyright (c) 2014年 ZYV. All rights reserved. // #import "GJGCInformationTextCell.h" @interface GJGCInformationMemeberShowCell : GJGCInformationTextCell @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/SystemNoti/GJGCChatAuthorizAskCell.h
// // GJGCChatAuthorizAskCell.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-11-3. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import "GJGCChatSystemNotiBaseCell.h" #import "GJGCChatSystemNotiModel.h" #import "GJCURoundCornerButton.h" #import "GJGCChatSystemNotiRoleGroupView.h" #import "GJGCChatSystemNotiRolePersonView.h" #import "GJGCCommonHeadView.h" @interface GJGCChatAuthorizAskCell : GJGCChatSystemNotiBaseCell /** * 整个角色名片点击时候的效果 */ @property (nonatomic,strong)GJCURoundCornerButton *roleViewTapBackButton; @property (nonatomic,strong)GJCURoundCornerButton *applyButton; @property (nonatomic,strong)GJCURoundCornerButton *rejectButton; @property (nonatomic,strong)GJGCChatSystemNotiRoleGroupView *groupView; @property (nonatomic,strong)GJGCChatSystemNotiRolePersonView *personView; @property (nonatomic,strong)UIImageView *sepreteLine; @property (nonatomic,strong)GJCFCoreTextContentView *nameLabel; @property (nonatomic,strong)GJGCCommonHeadView *headView; @property (nonatomic,strong)GJCFCoreTextContentView *applyAuthorizLabel; @property (nonatomic,strong)GJCFCoreTextContentView *applyAuthorizReasonLabel; @property (nonatomic,assign)CGFloat headMargin; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/GJGCChatInputPanel/GJGCChatInputExpandEmojiPanel.h
// // GJGCChatInputExpandEmojiPanel.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-10-28. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> @interface GJGCChatInputExpandEmojiPanel : UIView @property (nonatomic,strong)NSString *panelIdentifier; - (void)reserved; - (instancetype)initWithFrameForCommentBarStyle:(CGRect)frame; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoGroupRoleContentCell.h
<filename>ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoGroupRoleContentCell.h // // GJGCInfoGroupRoleContentCell.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/21. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import "GJGCInfoRoleContentCell.h" @interface GJGCInfoGroupRoleContentCell : GJGCInfoRoleContentCell @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoRoleContentCell.h
// // GJGCInfoRoleContentCell.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/21. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import "GJGCInfoBaseListBaseCell.h" @interface GJGCInfoRoleContentCell : GJGCInfoBaseListBaseCell @property (nonatomic,strong)GJGCCommonHeadView *headView; @property (nonatomic,strong)UILabel *titleLabel; @property (nonatomic,strong)UILabel *descLabel; @property (nonatomic,strong)UILabel *timeLabel; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupLabelsSheetDataManager.h
// // GJGCCreateGroupLabelsSheetDataManager.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/20. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import "BTActionSheetDataManager.h" @interface GJGCCreateGroupLabelsSheetDataManager : BTActionSheetDataManager @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoUserRoleContentCell.h
// // GJGCInfoUserRoleContentCell.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/21. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import "GJGCInfoRoleContentCell.h" @interface GJGCInfoUserRoleContentCell : GJGCInfoRoleContentCell @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Cell/GJGCInformationGroupShowItem.h
<gh_stars>1000+ // // GJGCGroupShowItem.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-11-6. // Copyright (c) 2014年 ZYV. All rights reserved. // #import <UIKit/UIKit.h> #import "GJGCCommonHeadView.h" @interface GJGCInformationGroupShowItemModel : NSObject @property (nonatomic,strong)NSAttributedString *name; @property (nonatomic,strong)NSString *headUrl; @property (nonatomic,assign)long long groupId; @end @interface GJGCInformationGroupShowItem : UIButton @property (nonatomic,strong)GJGCCommonHeadView *headView; @property (nonatomic,strong)GJCFCoreTextContentView *nameLabel; @property (nonatomic,strong)UIImageView *seprateLine; @property (nonatomic,assign)BOOL showBottomSeprateLine; - (void)setGroupItem:(GJGCInformationGroupShowItemModel *)contentModel; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsHeaderView.h
// // GJGCContactsHeaderView.h // ZYChat // // Created by ZYVincent on 16/8/9. // Copyright © 2016年 ZYProSoft. All rights reserved. // #import <UIKit/UIKit.h> @class GJGCContactsHeaderView; @protocol GJGCContactsHeaderViewDelegate <NSObject> - (void)contactsHeaderViewDidTapped:(GJGCContactsHeaderView *)headerView; @end @interface GJGCContactsHeaderView : UIView @property (nonatomic,assign)NSInteger section; @property (nonatomic,weak)id<GJGCContactsHeaderViewDelegate> delegate; - (void)setTitle:(NSString *)title withCount:(NSString *)count isExpand:(BOOL)isExpand; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupMemberCountSheetDataManager.h
<filename>ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupMemberCountSheetDataManager.h // // GJGCCreateGroupMemberCountSheetDataManager.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/20. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import "BTActionSheetDataManager.h" @interface GJGCCreateGroupMemberCountSheetDataManager : BTActionSheetDataManager @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoBaseListBaseCell.h
// // GJGCInfoBaseListBaseCell.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/21. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <UIKit/UIKit.h> #import "GJGCInfoBaseListContentModel.h" @interface GJGCInfoBaseListBaseCell : UITableViewCell @property (nonatomic,strong)UIImageView *bottomLine; - (void)setContentModel:(GJGCInfoBaseListContentModel *)contentModel; - (CGFloat)cellHeight; - (void)downloadImageWithContentModel:(GJGCInfoBaseListContentModel *)contentModel; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupContentModel.h
// // GJGCCreateGroupContentModel.h // ZYChat // // Created by ZYVincent on 15/9/21. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <Foundation/Foundation.h> #import "GJGCCreateGroupConst.h" @interface GJGCCreateGroupContentModel : NSObject @property (nonatomic,assign)GJGCCreateGroupContentType contentType; @property (nonatomic,assign)GJGCCreateGroupCellSeprateLineStyle seprateStyle; @property (nonatomic,strong)NSString *tagName; @property (nonatomic,assign)BOOL isShowDetailIndicator; @property (nonatomic,strong)NSString *content; @property (nonatomic,assign)CGFloat contentHeight; @property (nonatomic,assign)BOOL isMutilContent; @property (nonatomic,assign)BOOL isPhoneNumberInputLimit; @property (nonatomic,assign)BOOL isNumberInputLimit; @property (nonatomic,assign)NSInteger maxInputLength; @property (nonatomic,strong)NSString *placeHolder; #pragma mark - 环信群组相关信息 @property (nonatomic,strong)NSNumber *groupStyle; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/GJGCChatInputPanel/GJGCChatInputPanel.h
// // GJGCChatInputPanel.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-10-28. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <UIKit/UIKit.h> #import "GJGCChatInputBar.h" #import "GJGCChatInputConst.h" #import "GJGCChatInputExpandMenuPanelConfigModel.h" #import "GJGCChatInputPanelDelegate.h" #import "GJGCChatInputExpandEmojiPanel.h" #import "GJGCChatInputExpandMenuPanel.h" @class GJGCChatInputPanel; typedef void (^GJGCChatInputPanelKeyboardFrameChangeBlock) (GJGCChatInputPanel *panel,CGRect keyboardBeginFrame,CGRect keyboardEndFrame,NSTimeInterval duration,BOOL isPanelReserve); typedef void (^GJGCChatInputPanelRecordStateChangeBlock) (GJGCChatInputPanel *panel,BOOL isRecording); typedef void (^GJGCChatInputPanelInputTextViewHeightChangedBlock) (GJGCChatInputPanel *panel,CGFloat changeDelta); @interface GJGCChatInputPanel : UIView @property (nonatomic,weak)id<GJGCChatInputPanelDelegate> delegate; @property (nonatomic,readonly)NSString *messageDraft; @property (nonatomic,copy)GJGCChatInputBarDidChangeActionBlock actionChangeBlock; @property (nonatomic,copy)GJGCChatInputPanelRecordStateChangeBlock recordStateChangeBlock; @property (nonatomic,assign)BOOL isFullState; @property (nonatomic,assign)CGFloat inputBarHeight; @property (nonatomic,readonly)GJGCChatInputBarActionType currentActionType; @property (nonatomic,assign)GJGCChatInputBarActionType disableActionType; @property (nonatomic,readonly)NSString *panelIndentifier; @property (nonatomic,strong)NSString *inputBarTextViewPlaceHolder; - (instancetype)initWithPanelDelegate:(id<GJGCChatInputPanelDelegate>)aDelegate; - (instancetype)initForCommentBarWithPanelDelegate:(id<GJGCChatInputPanelDelegate>)aDelegate; - (void)configInputPanelKeyboardFrameChange:(GJGCChatInputPanelKeyboardFrameChangeBlock)changeBlock; - (void)configInputPanelRecordStateChange:(GJGCChatInputPanelRecordStateChangeBlock)recordChangeBlock; - (void)configInputPanelInputTextViewHeightChangedBlock:(GJGCChatInputPanelInputTextViewHeightChangedBlock)heightChangeBlock; - (void)reserveState; - (void)reserveCommentState; - (void)recordRightStartLimit; - (BOOL)isInputTextFirstResponse; - (void)becomeFirstResponse; - (void)inputBarRegsionFirstResponse; - (void)setLastMessageDraft:(NSString *)msgDraft; - (void)startKeyboardObserve; - (void)removeKeyboardObserve; - (void)appendFocusOnOther:(NSString *)otherName; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsNameCell.h
<reponame>AnriKaede/ZY2017IM // // GJGCContactsNameCell.h // ZYChat // // Created by ZYVincent on 16/8/9. // Copyright © 2016年 ZYProSoft. All rights reserved. // #import "GJGCContactsBaseCell.h" @interface GJGCContactsNameCell : GJGCContactsBaseCell @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Dependcy/GJCUImageBrowser/View/GJCUImageBrowserScrollView.h
// // GJCFImageBrowserScrollView.h // GJCommonFoundation // // Created by ZYVincent QQ:1003081775 on 14-10-30. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <UIKit/UIKit.h> #import "GJCUImageBrowserItemViewController.h" #import "GJCUAsyncImageView.h" @interface GJCUImageBrowserScrollView : UIScrollView /* 用来显示当前图片的 */ @property (nonatomic,strong)UIImageView *contentImageView; /* 图片数据源 */ @property (nonatomic,weak)id<GJCUImageBrowserItemViewControllerDataSource> dataSource; /* 当前索引 */ @property (nonatomic,assign)NSInteger index; /** * 是否正在下载 */ @property (nonatomic,assign)BOOL isDownloading; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Cell/GJGCInformationGroupPhotoBoxCell.h
<reponame>AnriKaede/ZY2017IM // // GJGCInformationGroupPhotoBoxCell.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-11-6. // Copyright (c) 2014年 ZYV. All rights reserved. // #import "GJGCInformationBaseCell.h" #import "GJGCInformationPhotoBox.h" #import "GJGCInformationCellContentModel.h" @interface GJGCInformationGroupPhotoBoxCell : GJGCInformationBaseCell @property (nonatomic,strong)GJGCInformationPhotoBox *photoBox; @property (nonatomic,strong)GJCFCoreTextContentView *nameLabel; @property (nonatomic,strong)GJCFCoreTextContentView *distanceLabel; @property (nonatomic,assign)CGFloat contentBordMargin; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/MemberList/GJGCGroupMemberListDataManager.h
// // GJGCGroupMemberListDataManager.h // ZYChat // // Created by ZYVincent on 15/11/24. // Copyright (c) 2015年 ZYProSoft. All rights reserved. // #import "GJGCInfoBaseListDataManager.h" @interface GJGCGroupMemberListDataManager : GJGCInfoBaseListDataManager @property (nonatomic,strong)NSString *groupId; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/ViewController/GJGCInformationBaseViewController.h
// // GJGCInformationBaseViewController.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-11-6. // Copyright (c) 2014年 ZYV. All rights reserved. // #import "GJGCBaseViewController.h" #import "GJGCInformationBaseDataSourceManager.h" #import "GJGCInformationBaseCell.h" #import "GJGCInformationBaseCellDelegate.h" @interface GJGCInformationBaseViewController : GJGCBaseViewController<GJGCInformationBaseCellDelegate,UITableViewDataSource,UITableViewDelegate> @property (nonatomic,strong)UITableView *informationListTable; @property (nonatomic,strong)GJGCInformationBaseDataSourceManager *dataSourceManager; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/BTActionSheetViewController/BTActionSheetDataManager.h
// // BTActionSheetDataManager.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/9/2. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <Foundation/Foundation.h> #import "BTActionSheetBaseContentModel.h" #import "BTActionSheetConst.h" #import "BTActionSheetBaseCell.h" @class BTActionSheetDataManager; @protocol BTActionSheetDataManagerDelegate <NSObject> - (void)dataManagerRequireRefresh:(BTActionSheetDataManager *)dataManager; - (void)dataManagerRequireRefresh:(BTActionSheetDataManager *)dataManager reloadAtIndexPaths:(NSArray *)indexPaths; @end @interface BTActionSheetDataManager : NSObject @property (nonatomic,weak)id<BTActionSheetDataManagerDelegate> delegate; @property (nonatomic,readonly)NSInteger totalCount; @property (nonatomic,strong)NSArray *selectedItems; @property (nonatomic,assign)BOOL isMutilSelect; - (Class)cellClassAtIndexPath:(NSIndexPath *)indexPath; - (NSString *)cellIdentifierAtIndexPath:(NSIndexPath *)indexPath; - (BTActionSheetBaseContentModel *)contentModelAtIndexPath:(NSIndexPath *)indexPath; - (CGFloat)contentHeightAtIndexPath:(NSIndexPath *)indexPath; - (void)addContentModel:(BTActionSheetBaseContentModel *)contentModel; - (void)changeSelectedStateAtIndexPath:(NSIndexPath *)indexPath; - (NSArray *)selectedModels; - (void)requestContentList; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/InfoBaseList/GJGCInfoBaseListConst.h
<reponame>AnriKaede/ZY2017IM // // GJGCInfoBaseListConst.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/21. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <Foundation/Foundation.h> /** * 列表内容类型 */ typedef NS_ENUM(NSUInteger, GJGCInfoBaseListContentType){ /** * 角色展示 */ GJGCInfoBaseListContentTypeUserRole, /** * 群角色展示 */ GJGCInfoBaseListContentTypeGroupRole, }; @interface GJGCInfoBaseListConst : NSObject + (Class)cellClassForContentType:(GJGCInfoBaseListContentType)contentType; + (NSString *)cellIdentifierForContentType:(GJGCInfoBaseListContentType)contentType; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCCommonHeadView.h
// // GJGCCommonHeadView.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-10-28. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import <UIKit/UIKit.h> typedef enum : NSUInteger { GJGCCommonHeadViewTypeNone,//未定义 GJGCCommonHeadViewTypePGGroup,//群 GJGCCommonHeadViewTypeContact,//联系人 GJGCCommonHeadViewTypePostContact,//帖子联系人 } GJGCCommonHeadViewType; @interface GJGCCommonHeadView : UIButton @property (nonatomic,strong)NSString *userId; - (void)setHeadUrl:(NSString *)url; - (void)setHeadUrl:(NSString *)url headViewType:(GJGCCommonHeadViewType)headViewType; - (void)setHeadImage:(UIImage *)image; - (void)setHiddenImageView:(BOOL)hidden; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Service/RelationManager/ZYUserDatabaseManager.h
// // ZYUserDatabaseManager.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/17. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <Foundation/Foundation.h> #import "ZYUserModel.h" #import "ZYDatabaseManager.h" @interface ZYUserDatabaseManager : NSObject - (BOOL)createUserTable; - (void)insertUsers:(NSArray *)users; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendMusicShareCell.h
// // GJGCChatFriendMusicShareCell.h // ZYChat // // Created by ZYVincent on 15/11/25. // Copyright (c) 2015年 ZYProSoft. All rights reserved. // #import "GJGCChatFriendBaseCell.h" @interface GJGCChatFriendMusicShareCell : GJGCChatFriendBaseCell - (void)startDownloadAction; - (void)playAudioAction; - (void)updateMeter:(CGFloat)meter; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Theme/ZYThemeUitil.h
// // ZYThemeUitil.h // ZYChat // // Created by ZYVincent on 16/12/18. // Copyright © 2016年 ZYProSoft. All rights reserved. // #import <Foundation/Foundation.h> #pragma mark - ThemeIconName #define kThemeRecentNavBar @"recent_nav" #define kThemeRecentTabBar @"recent_tab" #define kThemeRecentListBg @"recent_list" #define kThemeSquareNavBar @"square_nav" #define kThemeSquareTabBar @"square_tab" #define kThemeSquareListBg @"square_list" #define kThemeHomeNavBar @"home_nav" #define kThemeHomeTabBar @"home_tab" #define kThemeHomeListBg @"home_list" #define kThemeChatLisgBg @"chat_list_bg" #define ZYThemeImage(imgName) [ZYThemeUitil themeImage:imgName] typedef NS_ENUM(NSUInteger, ZYResourceType) { ZYResourceTypeRecent, ZYResourceTypeSquare, ZYResourceTypeHome, ZYResourceTypeChat, }; @interface ZYThemeUitil : NSObject + (void)setThemeFolder:(NSString *)folderName; + (UIImage *)themeImage:(NSString *)imageName; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Cell/GJGCInformationTextAndIconCell.h
// // GJGCInformationTextAndIconCell.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-11-6. // Copyright (c) 2014年 ZYV. All rights reserved. // #import "GJGCInformationTextCell.h" @interface GJGCInformationTextAndIconCell : GJGCInformationTextCell @property (nonatomic,strong)UIImageView *iconImgView; @property (nonatomic,strong)GJGCCommonHeadView *headView; @property (nonatomic,copy) void(^textAndIconCellHeaderClickBlock)(void); @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/WallPaper/MJRefresh/MJRefresh.h
<filename>ZYChat-EaseMob/ZYChat/WallPaper/MJRefresh/MJRefresh.h /** * 代码地址: https://github.com/CoderMJLee/MJRefresh * 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000 * 友情提示: 遇到一些小问题, 最好及时下载最新的代码试试 */ #import "UIScrollView+MJRefresh.h" /** MJ友情提示: 1. 添加头部控件的方法 [self.tableView addHeaderWithTarget:self action:@selector(headerRereshing)]; 或者 [self.tableView addHeaderWithCallback:^{ }]; 2. 添加尾部控件的方法 [self.tableView addFooterWithTarget:self action:@selector(footerRereshing)]; 或者 [self.tableView addFooterWithCallback:^{ }]; 3. 可以在MJRefreshConst.h和MJRefreshConst.m文件中自定义显示的文字内容和文字颜色 4. 本框架兼容iOS6\iOS7,iPhone\iPad横竖屏 5.自动进入刷新状态 1> [self.tableView headerBeginRefreshing]; 2> [self.tableView footerBeginRefreshing]; 6.结束刷新 1> [self.tableView headerEndRefreshing]; 2> [self.tableView footerEndRefreshing]; */
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/PersonInformation/GJGCPersonInformationViewController.h
// // GJGCPersonInformationViewController.h // ZYChat // // Created by ZYVincent on 15/11/22. // Copyright (c) 2015年 ZYProSoft. All rights reserved. // #import "GJGCInformationBaseViewController.h" #import "GJGCMessageExtendModel.h" @interface GJGCPersonInformationViewController : GJGCInformationBaseViewController - (instancetype)initWithExtendUser:(GJGCMessageExtendUserModel *)aUser withUserId:(NSString *)userId; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/Service/DataCenter/ZYDataCenterRequestCondition.h
<reponame>AnriKaede/ZY2017IM // // ZYDataCenterRequestCondition.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/11/6. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import <Foundation/Foundation.h> #import "ZYDataCenterInterface.h" #import "ZYNetWorkConst.h" @interface ZYDataCenterRequestCondition : NSObject @property (nonatomic,assign)ZYDataCenterRequestType requestType; @property (nonatomic,assign)ZYNetworkRequestMethod requestMethod; @property (nonatomic,strong)NSDictionary *getParams; @property (nonatomic,strong)NSDictionary *postParams; @property (nonatomic,strong)NSString *thirdServerHost; @property (nonatomic,strong)NSString *thirdServerInterface; @property (nonatomic,strong)NSDictionary *headerValues; @property (nonatomic,assign)BOOL isThirdPartRequest; - (void)addGetParams:(NSDictionary *)params; - (void)addPostParams:(NSDictionary *)params; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatViewController.h
// // GJGCRecentChatViewController.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 15/7/11. // Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved. // #import "GJGCBaseViewController.h" @interface GJGCRecentChatViewController : GJGCBaseViewController - (NSArray *)allConversationModels; @end
AnriKaede/ZY2017IM
ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendSendFlowerCell.h
// // GJGCChatFriendSendFlowerCell.h // ZYChat // // Created by ZYVincent on 16/5/15. // Copyright © 2016年 ZYProSoft. All rights reserved. // #import "GJGCChatFriendBaseCell.h" @interface GJGCChatFriendSendFlowerCell : GJGCChatFriendBaseCell @end