repo_name
stringlengths 6
97
| path
stringlengths 3
341
| text
stringlengths 8
1.02M
|
---|---|---|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Dependcy/WechatShortVideo/CALayer+AddUIColor.h | //
// CALayer+AddUIColor.h
// SCRecorderPack
//
// Created by AliThink on 15/8/17.
// Copyright (c) 2015年 AliThink. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
@interface CALayer (AddUIColor)
- (void)setBorderColorFromUIColor:(UIColor *)color;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/GJGCChatInputPanel/GJGCIconSeprateButton.h | <reponame>AnriKaede/ZY2017IM<gh_stars>1000+
//
// GJGCIconSeprateButton.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-26.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GJGCIconSeprateImageView.h"
@class GJGCIconSeprateButton;
typedef void (^GJGCIconSeprateButtonDidTapedBlock) (GJGCIconSeprateButton *button);
@interface GJGCIconSeprateButton : UIView
@property (nonatomic,strong)UIButton *backButton;
@property (nonatomic,strong)GJGCIconSeprateImageView *iconView;
@property (nonatomic,getter=isSelected)BOOL selected;
@property (nonatomic,copy)GJGCIconSeprateButtonDidTapedBlock tapBlock;
- (instancetype)initWithFrame:(CGRect)frame withSelectedIcon:(UIImage *)selectIcon withNormalIcon:(UIImage *)normalIcon;
/**
* 选中态图片
*/
@property (nonatomic,strong)UIImage *selectedStateImage;
/**
* 常态图片
*/
@property (nonatomic,strong)UIImage *normalStateImage;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/WallPaper/controller/WallPaperViewController.h | <gh_stars>1000+
//
// ViewController.h
// 瀑布流demo
//
// Created by yuxin on 15/6/6.
// Copyright (c) 2015年 yuxin. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GJGCBaseViewController.h"
typedef void (^WallPaperDidFinishChooseImageBlock) (NSString *imageUrl);
@interface WallPaperViewController : GJGCBaseViewController
@property (nonatomic,copy)WallPaperDidFinishChooseImageBlock resultBlock;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Dependcy/GJCFAssetsPicker/View/GJCFAssetsPickerScrollView.h | //
// GJAssetsPickerScrollView.h
// GJAssetsPickerViewController
//
// Created by ZYVincent QQ:1003081775 on 14-9-8.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GJCFAssetsPickerPreviewItemViewController.h"
/* 支持缩放的UIScrollView */
@interface GJCFAssetsPickerScrollView : UIScrollView<UIScrollViewDelegate>
/* 用来显示当前图片的 */
@property (nonatomic,strong)UIImageView *contentImageView;
/* 图片数据源 */
@property (nonatomic,weak)id<GJCFAssetsPickerPreviewItemViewControllerDataSource> dataSource;
/* 当前索引 */
@property (nonatomic,assign)NSInteger index;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/GroupInfoExtend/GJGCGroupInfoExtendModel.h | //
// GJGCGroupInfoExtendModel.h
// ZYChat
//
// Created by ZYVincent on 15/11/20.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "JSONModel.h"
#import "GJGCGroupInfoExtendConst.h"
@interface GJGCGroupInfoExtendModel : JSONModel
@property (nonatomic,strong)NSString *name;
@property (nonatomic,strong)NSString *simpleDescription;
@property (nonatomic,strong)NSString *headUrl;
@property (nonatomic,strong)NSString *address;
@property (nonatomic,strong)NSString *labels;
@property (nonatomic,strong)NSString *level;
@property (nonatomic,strong)NSString *company;
@property (nonatomic,strong)NSString *addTime;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/GJGCChatInputPanel/GJGCChatInputRecordAudioTipView.h | <filename>ZYChat-EaseMob/ZYChat/GJGCChatInputPanel/GJGCChatInputRecordAudioTipView.h<gh_stars>1000+
//
// GJGCChatInputRecordAudioTipView.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-10-29.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GJGCChatInputRecordAudioTipView : UIView
@property (nonatomic,strong)UIImage *voiceMicImage;
@property (nonatomic,strong)UIImage *voiceSoundMeterImage;
@property (nonatomic,strong)UIImage *voiceCancelImage;
@property (nonatomic,assign)BOOL isTooShortRecordDuration;
@property (nonatomic,assign)BOOL isTooLongRecordDuration;
@property (nonatomic,assign)CGFloat soundMeter;
@property (nonatomic,assign)CGFloat leftMargin;
@property (nonatomic,assign)CGFloat innerMargin;
@property (nonatomic,assign)BOOL willCancel;
@property (nonatomic,strong)NSString *minRecordTimeErrorTitle;
@property (nonatomic,strong)NSString *maxRecordTimeErrorTitle;
@property (nonatomic,strong)NSString *upToCancelRecordTitle;
@property (nonatomic,strong)NSString *releaseToCancelRecordTitle;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsBaseCell.h | //
// GJGCContactsCell.h
// ZYChat
//
// Created by ZYVincent on 16/8/8.
// Copyright © 2016年 ZYProSoft. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GJGCContactsContentModel.h"
@interface GJGCContactsBaseCell : UITableViewCell
@property (nonatomic,strong)UIImageView *bottomLine;
- (void)setContentModel:(GJGCContactsContentModel *)contentModel;
- (CGFloat)cellHeight;
- (void)downloadImageWithConententModel:(GJGCContactsContentModel *)contentModel;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsDataManager.h | <reponame>AnriKaede/ZY2017IM<filename>ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsDataManager.h
//
// GJGCContactsDataManager.h
// ZYChat
//
// Created by ZYVincent on 16/8/8.
// Copyright © 2016年 ZYProSoft. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GJGCContactsContentModel.h"
#import "GJGCContactsConst.h"
#import "GJGCContactsSectionModel.h"
@protocol GJGCContactsDataManagerDelegate <NSObject>
- (void)dataManagerRequireRefreshSection:(NSInteger)section;
- (void)dataManagerrequireRefreshNow;
@end
@interface GJGCContactsDataManager : NSObject
@property (nonatomic,weak)id<GJGCContactsDataManagerDelegate> delegate;
@property (nonatomic,readonly)NSInteger totalSection;
- (void)updateSectionIsChangeExpandStateAtSection:(NSInteger)section;
- (GJGCContactsSectionModel *)sectionModelAtSectionIndex:(NSInteger)section;
- (NSInteger)rowCountsInSection:(NSInteger)section;
- (CGFloat)contentHeightAtIndexPath:(NSIndexPath *)indexPath;
- (Class)cellClassAtIndexPath:(NSIndexPath*)indexPath;
- (NSString *)cellIdentifierAtIndexPath:(NSIndexPath *)indexPath;
- (GJGCContactsContentModel *)contentModelAtIndexPath:(NSIndexPath *)indexPath;
- (void)requireContactsList;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupCellDelegate.h | //
// BTUploadMemberCellDelegate.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/9/21.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import <Foundation/Foundation.h>
@class GJGCCreateGroupBaseCell;
@protocol GJGCCreateGroupCellDelegate <NSObject>
- (void)inputTextCellDidTriggleMaxLengthInputLimit:(GJGCCreateGroupBaseCell *)inputTextCell maxLength:(NSInteger)maxLength;
- (void)inputTextCellDidBeginEdit:(GJGCCreateGroupBaseCell *)inputTextCell;
- (void)inputTextCell:(GJGCCreateGroupBaseCell *)inputTextCell didUpdateContent:(NSString *)content;
- (void)inputTextCellDidTapOnReturnButton:(GJGCCreateGroupBaseCell *)inputTextCell didUpdateContent:(NSString *)content;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatDataManager.h | //
// GJGCRecentChatDataManager.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/11/18.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GJGCRecentChatModel.h"
#import "GJGCRecentChatTitleView.h"
@class GJGCRecentChatDataManager;
@protocol GJGCRecentChatDataManagerDelegate <NSObject>
- (void)dataManagerRequireRefresh:(GJGCRecentChatDataManager *)dataManager;
- (void)dataManagerRequireRefresh:(GJGCRecentChatDataManager *)dataManager requireDeletePaths:(NSArray *)paths;
- (void)dataManager:(GJGCRecentChatDataManager *)dataManager requireUpdateTitleViewState:(GJGCRecentChatConnectState)connectState;
- (BOOL)dataManagerRequireKnownViewIsShowing:(GJGCRecentChatDataManager *)dataManager;
@end
@interface GJGCRecentChatDataManager : NSObject
@property (nonatomic,readonly)NSInteger totalCount;
@property (nonatomic,weak)id<GJGCRecentChatDataManagerDelegate> delegate;
- (GJGCRecentChatModel *)contentModelAtIndexPath:(NSIndexPath *)indexPath;
- (CGFloat)contentHeightAtIndexPath:(NSIndexPath *)indexPath;
- (void)deleteConversationAtIndexPath:(NSIndexPath *)indexPath;
- (void)loadRecentConversations;
- (NSArray *)allConversationModels;
+ (BOOL)isConversationHasBeenExist:(NSString *)chatter;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCMutilTextInputViewController.h | //
// GJGCMutilTextInputViewController.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/11/20.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "GJGCBaseViewController.h"
@class GJGCMutilTextInputViewController;
@protocol GJGCMutilTextInputViewControllerDelegate <NSObject>
- (void)mutilTextInputViewController:(GJGCMutilTextInputViewController *)inputViewController didFinishInputText:(NSString *)text;
@end
@interface GJGCMutilTextInputViewController : GJGCBaseViewController
@property (nonatomic,weak)id<GJGCMutilTextInputViewControllerDelegate> delegate;
@property (nonatomic,assign)NSInteger userType;
@property (nonatomic,strong)NSString *paramString;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayerBar.h | <reponame>AnriKaede/ZY2017IM
//
// GJGCMusicPlayerBar.h
// ZYChat
//
// Created by ZYVincent on 16/12/18.
// Copyright © 2016年 ZYProSoft. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GJCFAudioPlayer.h"
#import "GJGCMusicSharePlayer.h"
@protocol GJGCMusicPlayerBarDelegate <NSObject>
- (void)didTappedMusicPlayerBar;
@end
@interface GJGCMusicPlayerBar : UIView<GJCFAudioPlayerDelegate>
@property (nonatomic,weak)id<GJGCMusicPlayerBarDelegate> delegate;
+ (GJGCMusicPlayerBar *)currentMusicBar;
- (void)startMove;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/GJGCChatInputPanel/GJGCChatInputExpandMenuPanelItem.h | //
// GJGCChatInputExpandMenuPanelItem.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"
@class GJGCChatInputExpandMenuPanelItem;
typedef void (^GJGCChatInputExpandMenuPanelItemDidTapedBlock) (GJGCChatInputExpandMenuPanelItem *item);
@interface GJGCChatInputExpandMenuPanelItem : UIControl
@property (nonatomic,assign)NSInteger index;
@property (nonatomic,strong)NSDictionary *userInfo;
@property (nonatomic,assign)GJGCChatInputMenuPanelActionType actionType;
+ (GJGCChatInputExpandMenuPanelItem *)itemWithTitle:(NSString *)title withIconImageNormal:(UIImage *)iconImageNormal withIconImageHighlight:(UIImage *)iconImageHighlight withActionType:(GJGCChatInputMenuPanelActionType)actionType withTapBlock:(GJGCChatInputExpandMenuPanelItemDidTapedBlock)tapBlock;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendGroupModel.h | //
// GJGCMessageExtendGroupModel.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/11/22.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "JSONModel.h"
@interface GJGCMessageExtendGroupModel : JSONModel
@property (nonatomic,strong)NSString *groupHeadThumb;
@property (nonatomic,strong)NSString *groupName;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Cell/GJGCInformationLevelCell.h | <filename>ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Cell/GJGCInformationLevelCell.h
//
// GJGCInformationLevelCell.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-6.
// Copyright (c) 2014年 ZYV. All rights reserved.
//
#import "GJGCInformationTextCell.h"
#import "GJGCLevelView.h"
@interface GJGCInformationLevelCell : GJGCInformationTextCell
@property (nonatomic,strong)GJGCLevelView *levelView;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/WallPaper/view/ZWCollectionViewCell.h | <gh_stars>1000+
//
// ZWCollectionViewCell.h
// 瀑布流demo
//
// Created by yuxin on 15/6/6.
// Copyright (c) 2015年 yuxin. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "shopModel.h"
@interface ZWCollectionViewCell : UICollectionViewCell
@property(nonatomic,retain)shopModel * shop;
@property (weak, nonatomic) IBOutlet UIImageView *shopImage;
@property (weak, nonatomic) IBOutlet UILabel *shopName;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendPostMessageCell.h | //
// GJGCChatFriendPostMessageCell.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-12-11.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import "GJGCChatFriendImageMessageCell.h"
@interface GJGCChatFriendPostMessageCell : GJGCChatFriendImageMessageCell
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Service/Database/ZYDatabaseColunmCondition.h | <filename>ZYChat-EaseMob/ZYChat/Service/Database/ZYDatabaseColunmCondition.h
//
// ZYDatabaseColunmCondition.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 "ZYDatabaseConst.h"
@interface ZYDatabaseColunmCondition : NSObject
@property (nonatomic,assign)BOOL isPrimary;
@property (nonatomic,assign)BOOL isAutoIncrease;
@property (nonatomic,assign)ZYDatabaseValueType valueType;
@property (nonatomic,assign)NSInteger limitLength;
@property (nonatomic,strong)NSString *colunmName;
@property (nonatomic,strong)NSString *defaultValue;
@property (nonatomic,assign)BOOL isNotNull;
@property (nonatomic,readonly)NSString *sqlString;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendBaseCell.h | //
// GJGCChatFirendBaseCell.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-10.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import "GJGCChatBaseCell.h"
#import "GJGCChatFriendContentModel.h"
#define simpleContentDiffHeight 8
#define simpleContentDiffWidth 7
@interface GJGCChatFriendBaseCell : GJGCChatBaseCell
@property (nonatomic,strong)GJGCCommonHeadView *headView;
@property (nonatomic,strong)UIImageView *bubbleBackImageView;
@property (nonatomic,strong)GJCFCoreTextContentView *timeLabel;
@property (nonatomic,strong)GJCFCoreTextContentView *nameLabel;
@property (nonatomic,assign)CGFloat contentBordMargin;
@property (nonatomic,assign)CGFloat cellMargin;
@property (nonatomic,assign)BOOL isFromSelf;
@property (nonatomic,strong)UIButton *statusButton;
@property (nonatomic,assign)GJGCChatFriendSendMessageStatus sendStatus;
@property (nonatomic,assign)CGFloat statusButtonOffsetAudioDuration;
@property (nonatomic,assign)BOOL isGroupChat;
@property (nonatomic,assign)NSInteger faildType;
@property (nonatomic,strong)NSString *faildReason;
@property (nonatomic,assign)GJGCChatFriendTalkType talkType;
@property (nonatomic,assign)GJGCChatFriendContentType contentType;
@property (nonatomic,strong)UIImageView *sexIconView;
- (void)adjustContent;
- (NSArray *)myAudioPlayIndicatorImages;
- (NSArray *)otherAudioPlayIndicatorImages;
- (void)startSendingAnimation;
- (void)successSendingAnimation;
- (void)faildSendingAnimation;
- (void)faildWithType:(NSInteger)faildType andReason:(NSString *)reason;
- (void)goToShowLongPressMenu:(UILongPressGestureRecognizer *)sender;
- (void)copyContent:(UIMenuItem *)item;
- (void)deleteMessage:(UIMenuItem *)item;
- (void)reSendMessage;
- (void)faildDownloadAction;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Dependcy/GJCFUitils/QuickCacheUitil/GJCFQuickCacheUitil.h | //
// GJCFQuickCacheUitil.h
// GJCommonFoundation
//
// Created by ZYVincent QQ:1003081775 on 14-10-16.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface GJCFQuickCacheUitil : NSObject
+ (BOOL)isNullObject:(id)anObject;
+ (BOOL)checkValue:(id)value key:(id)key;
+ (void)userDefaultCache:(id<NSCoding>)value key:(id)key;
+ (void)userDefaultRemove:(id)key;
+ (id)userDefaultGetValue:(id)key;
+ (BOOL)userDefaultEmptyValue:(id)key;
+ (void)systemMemoryCacheSet:(id<NSCoding>)value key:(id)key;
+ (void)systemMemoryCacheRemove:(id)key;
+ (id)systemMemoryCacheGetValue:(id)key;
+ (BOOL)writeFileData:(NSData*)data toPath:(NSString *)path;
+ (BOOL)systemMemoryCacheEmptyValue:(id)key;
+ (NSFileManager *)fileManager;
+ (BOOL)fileExist:(NSString*)path;
+ (BOOL)directoryExist:(NSString*)dirPath;
+ (BOOL)createDirectory:(NSString*)dirPath;
+ (NSData *)readFromFile:(NSString *)path;
+ (BOOL)deleteFileAtPath:(NSString *)filePath;
+ (BOOL)deleteDirectoryAtPath:(NSString *)dirPath;
+ (BOOL)copyFileFromPath:(NSString *)fromPath toPath:(NSString *)toPath isRemoveOld:(BOOL)isRemove;
+ (BOOL)archieveObject:(id<NSCoding>)anObject toFilePath:(NSString *)toPath;
+ (id)unarchieveFromPath:(NSString *)filePath;
+ (NSString *)documentDirectory;
+ (NSString *)cacheDirectory;
+ (NSString *)documentDirectoryPath:(NSString *)file;
+ (NSString *)cacheDirectoryPath:(NSString *)file;
+ (BOOL)cacheDirectorySave:(id<NSCoding>)anObject withFileName:(NSString *)file;
+ (BOOL)cacheDirectoryDelete:(NSString *)file;
+ (BOOL)documentDirectorySave:(id<NSCoding>)anObject withFileName:(NSString *)file;
+ (BOOL)documentDirectoryDelete:(NSString *)file;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendContentWebPageModel.h | //
// GJGCMessageExtendContentWebPageModel.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/11/20.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "JSONModel.h"
#import "GJGCMessageExtendConst.h"
@interface GJGCMessageExtendContentWebPageModel : JSONModel
@property (nonatomic,strong)NSString *displayText;
@property (nonatomic,strong)NSString *protocolVersion;
@property (nonatomic,strong)NSString *notSupportDisplayText;
@property (nonatomic,strong)NSString *url;
@property (nonatomic,strong)NSString *sumary;
@property (nonatomic,strong)NSString *title;
@property (nonatomic,strong)NSString *time;
@property (nonatomic,strong)NSString *source;
@property (nonatomic,strong)NSString *thumbImageBase64;
@property (nonatomic,strong)NSString *thumbImageUrl;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatFriendTalkModel.h | <filename>ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatFriendTalkModel.h
//
// GJGCChatFriendTalkModel.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-24.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GJGCChatFriendContentModel.h"
#import "GJGCGroupInfoExtendModel.h"
#define GJGCTalkTypeString(talkType) [GJGCChatFriendTalkModel talkTypeString:talkType]
@interface GJGCChatFriendTalkModel : NSObject
@property (nonatomic,copy)NSString *toId;
@property (nonatomic,copy)NSString *toUserName;
@property (nonatomic,assign)GJGCChatFriendTalkType talkType;
@property (nonatomic,strong)NSArray *msgArray;
@property (nonatomic,assign)NSInteger msgCount;
@property (nonatomic,strong)EMConversation *conversation;
@property (nonatomic,strong)GJGCMessageExtendGroupModel *groupInfo;
+ (NSString *)talkTypeString:(GJGCChatFriendTalkType)talkType;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/PublicGroup/GJGCPublicGroupListViewController.h | <filename>ZYChat-EaseMob/ZYChat/Square/PublicGroup/GJGCPublicGroupListViewController.h<gh_stars>1000+
//
// GJGCPublicGroupListViewController.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/11/20.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "GJGCInfoBaseListViewController.h"
#import "GJGCPulicGroupListDataManager.h"
@interface GJGCPublicGroupListViewController : GJGCInfoBaseListViewController
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/GroupInformation/GJGCGroupInformationViewController.h | <gh_stars>1000+
//
// GJGCGroupInformationViewController.h
// ZYChat
//
// Created by ZYVincent on 15/11/22.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "GJGCInformationBaseViewController.h"
@interface GJGCGroupInformationViewController : GJGCInformationBaseViewController
- (instancetype)initWithGroupId:(NSString *)groupId;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/BTActionSheetViewController/BTActionSheetDatePicker.h | <reponame>AnriKaede/ZY2017IM
//
// BTActionSheetDatePicker.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/9/9.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BTActionSheetDatePicker : UIView
@property (nonatomic,strong)NSDate *selectedDate;
- (instancetype)initWithFrame:(CGRect)frame withSelectedDate:(NSDate *)aDate withStartDate:(NSDate *)sDate withEndDate:(NSDate *)eDate;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Dependcy/GJCFAssetsPicker/ViewController/GJCFAlbumsViewController.h | //
// GJAlbumsViewController.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"
@class GJCFAlbumsViewController;
@protocol GJCFAlbumsViewControllerDelegate <NSObject>
@optional
/* 相册视图需要使用自定义的风格 */
- (GJCFAssetsPickerStyle*)albumsViewControllerShouldUseCustomStyle:(GJCFAlbumsViewController*)albumsViewController;
@end
@interface GJCFAlbumsViewController : UIViewController
@property (nonatomic,weak)id<GJCFAlbumsViewControllerDelegate> delegate;
/* 相册使用的过滤设置 */
@property (nonatomic,strong)ALAssetsFilter *assetsFilter;
/* 多选的最大数量 */
@property (nonatomic,assign)NSUInteger mutilSelectLimitCount;
/* 图片选择列表,每一行有多少列 */
@property (nonatomic,assign)NSUInteger photoControllerColums;
/*
* 用来传递外层已经选中的Assets,用于加载新的Assets选择列表的时候,直接赋成选中状态,已实现
* 但是目前需求和效率问题限制,调用暂时无效
*/
@property (nonatomic,strong)NSArray *shouldInitSelectedStateAssetArray;
/*
* 推入默认的相册
*/
- (void)pushDefaultAlbums;
/*
* 注册自定义的相册详情类
*/
- (void)registPhotoViewControllerClass:(Class)aPhotoViewControllerClass;
/*
* 注册自定义的相册Cell,不带自定义高度
*/
- (void)registAlbumsCustomCellClass:(Class)aAlbumsCustomCellClass;
/*
* 注册自定义的相册Cell,设置自定义高度
*/
- (void)registAlbumsCustomCellClass:(Class)aAlbumsCustomCellClass withCellHeight:(CGFloat)cellHeight;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsSectionModel.h | //
// GJGCContactsSectionModel.h
// ZYChat
//
// Created by ZYVincent on 16/8/9.
// Copyright © 2016年 ZYProSoft. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface GJGCContactsSectionModel : NSObject
@property (nonatomic,strong)NSMutableArray *rowData;
@property (nonatomic,assign)BOOL isExpand;
@property (nonatomic,readonly)NSInteger showCount;
@property (nonatomic,strong)NSString *sectionTitle;
@property (nonatomic,readonly)NSString *countString;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsContentModel.h | <gh_stars>1000+
//
// GJGCContactsContentModel.h
// ZYChat
//
// Created by ZYVincent on 16/8/8.
// Copyright © 2016年 ZYProSoft. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GJGCContactsConst.h"
#import "GJGCMessageExtendGroupModel.h"
@interface GJGCContactsContentModel : NSObject
@property (nonatomic,assign)BOOL isGroupChat;
@property (nonatomic,strong)NSString *groupId;
@property (nonatomic,strong)NSString *nickname;
@property (nonatomic,strong)NSString *userId;
@property (nonatomic,strong)NSString *headThumb;
@property (nonatomic,strong)NSString *mobile;
@property (nonatomic,assign)GJGCContactsContentType contentType;
@property (nonatomic,assign)CGFloat contentHeight;
@property (nonatomic,strong)NSString *summary;
@property (nonatomic,strong)GJGCMessageExtendGroupModel *groupInfo;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/WallPaper/MJRefresh/UIView+MJExtension.h | <gh_stars>1000+
//
// UIView+Extension.h
// MJRefreshExample
//
// Created by <NAME> on 14-5-28.
// Copyright (c) 2014年 itcast. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (MJExtension)
@property (assign, nonatomic) CGFloat mj_x;
@property (assign, nonatomic) CGFloat mj_y;
@property (assign, nonatomic) CGFloat mj_width;
@property (assign, nonatomic) CGFloat mj_height;
@property (assign, nonatomic) CGSize mj_size;
@property (assign, nonatomic) CGPoint mj_origin;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/RecentContactList/GJGCRecentContactListViewController.h | //
// GJGCRecentContactListViewController.h
// ZYChat
//
// Created by ZYVincent on 15/11/24.
// Copyright (c) 2015年 ZYProSoft. All rights reserved.
//
#import "GJGCInfoBaseListViewController.h"
#import "GJGCRecentChatForwardContentModel.h"
@interface GJGCRecentContactListViewController : GJGCInfoBaseListViewController
- (instancetype)initWithForwardContent:(GJGCRecentChatForwardContentModel *)contentModel;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupDetailChooseCell.h | <reponame>AnriKaede/ZY2017IM
//
// BTUploadMemberSingleChooseCell.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/9/21.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "GJGCCreateGroupBaseCell.h"
@interface GJGCCreateGroupDetailChooseCell : GJGCCreateGroupBaseCell
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Service/RelationManager/ZYPrivateChatDataManager.h | <filename>ZYChat-EaseMob/ZYChat/Service/RelationManager/ZYPrivateChatDataManager.h
//
// ZYPrivateChatDataManager.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 "ZYChatConversation.h"
@interface ZYPrivateChatDataManager : NSObject
- (void)createConversation:(ZYChatConversation *)conversation;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Theme/UITableView+Theme.h | //
// UITableView+Theme.h
// ZYChat
//
// Created by ZYVincent on 16/12/18.
// Copyright © 2016年 ZYProSoft. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UITableView (Theme)
- (void)setResourceType:(ZYResourceType)type;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupViewController.h | //
// BTUploadMemberViewController.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/9/21.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "GJGCBaseViewController.h"
@interface GJGCCreateGroupViewController : GJGCBaseViewController
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Dependcy/FileUploadManager/GJCFFileUploadManager.h | //
// GJCFFileUploadManager.h
// GJCommonFoundation
//
// Created by ZYVincent QQ:1003081775 on 14-9-12.
// Copyright (c) 2014年 Z<EMAIL>. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GJCFFileUploadTask.h"
/* 文件上传进度,该block会在子线程调用,请务必将UI更新代码放在主线执行 */
typedef void (^GJCFFileUploadManagerUpdateTaskProgressBlock) (GJCFFileUploadTask *updateTask,CGFloat progressValue);
/* 文件上传完成,该block会在子线程调用,请务必将UI更新代码放在主线执行 */
typedef void (^GJCFFileUploadManagerTaskCompletionBlock) (GJCFFileUploadTask *task,NSDictionary *resultDict);
/* 文件上传失败,该block会在子线程调用,请务必将UI更新代码放在主线执行 */
typedef void (^GJCFFileUploadManagerTaskFaildBlock) (GJCFFileUploadTask *task,NSError *error);
/* 文件上传组件 */
@interface GJCFFileUploadManager : NSObject
/*
* 默认是前台执行的上传任务的进度block
*/
@property (nonatomic,copy)GJCFFileUploadManagerUpdateTaskProgressBlock progressBlock;
/*
* 默认是前台执行的上传任务的完成block
*/
@property (nonatomic,copy)GJCFFileUploadManagerTaskCompletionBlock completionBlock;
/*
* 默认是前台执行的上传任务的失败block
*/
@property (nonatomic,copy)GJCFFileUploadManagerTaskFaildBlock faildBlock;
/* 有这个可以更好的提示block实现*/
- (void)setCompletionBlock:(GJCFFileUploadManagerTaskCompletionBlock)completionBlock;
/* 有这个可以更好的提示block实现*/
- (void)setProgressBlock:(GJCFFileUploadManagerUpdateTaskProgressBlock)progressBlock;
/* 有这个可以更好的提示block实现*/
- (void)setFaildBlock:(GJCFFileUploadManagerTaskFaildBlock)faildBlock;
/*
* 为某个观察对象建立成功观察状态block
*/
- (void)setCompletionBlock:(GJCFFileUploadManagerTaskCompletionBlock)completionBlock forObserver:(NSObject*)observer;
/*
* 为某个观察对象建立进度观察状态block
*/
- (void)setProgressBlock:(GJCFFileUploadManagerUpdateTaskProgressBlock)progressBlock forObserver:(NSObject*)observer;
/*
* 为某个观察对象建立失败观察状态block
*/
- (void)setFaildBlock:(GJCFFileUploadManagerTaskFaildBlock)faildBlock forObserver:(NSObject*)observer;
/*
* 设定当前前台的观察者,这个观察者可以实现观察三个进度的block
*/
- (void)setCurrentObserver:(NSObject*)observer;
/*
* 重要注释:谨慎使用单例共享模式
*
* 为了更好的实现上传组件对任务的观察,并且不让观察者因为更新UI问题而造成观察者引用计数加1却无法在Dealloc的时候减1的情况
*
* 单例模式下设定前台的观察任务block的时候,请注意观察这个任务是否当前观察者想处理的任务
*
* 通过 GJCFFileUploadTask 的方法,判断自己是否这个任务的观察者 : - (BOOL)taskIsObservedByUniqueIdentifier:(NSString*)uniqueId;
*
* 请谨慎按照下面的规范使用单例模式
*
*/
/* ========================= 单例模式下任务观察范例 ========================= */
/* 创建观察者弱引用指针,避免引用计数加1,导致无法释放
__weak typeof(self)weakSelf = self;
任务执行成功
[[GJCFFileUploadManager shareUploadManager] setCompletionBlock:^(GJCFFileUploadTask *task,NSDictionary *resultDict){
NSLog(@"GJImageUpload sucess:%@",resultDict[@"result"]);
NSDictionary *result = resultDict[@"result"];
//采用弱引用指针调用对应响应的方法
[weakSelf updateUIByCompletion:task result:result];
}];
任务执行进度
[[GJCFFileUploadManager shareUploadManager]setProgressBlock:^(GJCFFileUploadTask *updateTask,CGFloat progressValue){
//采用弱引用指针调用对应响应的方法
[weakSelf updateUIByProgress:updateTask percent:progressValue];
}];
任务执行失败
[[GJCFFileUploadManager shareUploadManager] setFaildBlock:^(GJCFFileUploadTask *task,NSError *error){
//采用弱引用指针调用对应响应的方法
[weakSelf updateUIByFaild:task faild:error];
}];*/
/* ====================================================================== */
/* 单例共享 */
+ (GJCFFileUploadManager *)shareUploadManager;
/* ========================= 非单例模式下任务观察范例 ========================= */
/*
创建自身弱引用指针,避免循环引用问题
__weak typeof(self)weakSelf = self;
[self.fileUploadManager setProgressBlock:^(GJCFFileUploadTask *updateTask,CGFloat progressValue){
weakSelf.xxx = @"xxx";
}];
[self.fileUploadManager setCompletionBlock:^(GJCFFileUploadTask *task,NSDictionary *resultDict){
weakSelf.xxx = @"xxx";
}];
[self.fileUploadManager setFaildBlock:^(GJCFFileUploadTask *task,NSError *error){
weakSelf.xxx = @"xxx";
}];
*/
/* ====================================================================== */
/*
* 非单例模式初始化
*
* 如果作为成员变量使用,编译器会主动触发循环引用警告,可以更容易更早的注意到循环引用问题
*
*/
- (instancetype)initWithOwner:(id)owner;
/*
* 设置当前文件上传服务的默认地址
*/
- (void)setDefaultHostUrl:(NSString*)url;
/*
* 设置文件上传的请求路径
*/
- (void)setDefaultUploadPath:(NSString*)path;
/*
* 设置文件上传时候的默认参数
*/
- (void)setDefaultRequestParams:(NSDictionary*)parma;
/*
* 设置文件上传时候的默认HttpHeader
*/
- (void)setDefaultRequestHeader:(NSDictionary*)requestHeaders;
/*
* 添加指定文件上传时候的默认HttpHeader
*/
- (void)addRequestHeader:(NSDictionary*)requestHeaders;
/*
* 添加文件上传时候的默认参数
*/
- (void)addRequestParams:(NSDictionary*)parmas;
/*
* 添加一个上传任务
*/
- (void)addTask:(GJCFFileUploadTask *)aTask;
/*
* 仅仅退出一个上传任务
*/
- (void)cancelTaskOnly:(NSString *)aTaskIdentifier;
/*
* 退出并且清除上传任务
*/
- (void)cancelTaskAndRemove:(NSString *)aTaskIdentifier;
/*
* 退出所有正在上传的任务
*/
- (void)cancelAllExcutingTask;
/*
* 清除所有任务
*/
- (void)removeAllTask;
/*
* 清除所有失败了的任务
*/
- (void)removeAllFaildTask;
/*
* 根据任务Id重新尝试上传
*/
- (void)tryDoTaskByUniqueIdentifier:(NSString*)uniqueIdentifier;
/*
* 尝试上传所有没有成功的任务
*/
- (void)tryDoAllUnSuccessTask;
/*
* 将所有失败的上传任务归档
*/
- (void)persistAllFaildAndCanceledTask;
/*
* 清除当前视图的Block观察
*/
- (void)clearCurrentObserveBlocks;
/*
* 清除某个观察者的block引用
*/
- (void)clearBlockForObserver:(NSObject*)observer;
/*
* 观察者唯一标识生成方法
*/
+ (NSString*)uniqueKeyForObserver:(NSObject*)observer;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/UserList/ZYUserListDataManager.h | //
// ZYUserListDataManager.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 "ZYUserListContentModel.h"
@class ZYUserListDataManager;
@protocol ZYUserListDataManagerDelegate <NSObject>
- (void)dataManagerRequireRefresh:(ZYUserListDataManager *)dataManager;
@end
@interface ZYUserListDataManager : NSObject
@property (nonatomic,weak)id<ZYUserListDataManagerDelegate> delegate;
@property (nonatomic,readonly)NSInteger totalCount;
- (ZYUserListContentModel *)contentModelAtIndexPath:(NSIndexPath *)indexPath;
- (void)requestUserList;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/SystemNoti/GJGCChatSystemActiveGuideCell.h | <reponame>AnriKaede/ZY2017IM
//
// GJGCChatSystemActiveGuideCell.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-10.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import "GJGCChatSystemNotiBaseCell.h"
#import "GJCURoundCornerButton.h"
@interface GJGCChatSystemActiveGuideCell : GJGCChatSystemNotiBaseCell
@property (nonatomic,strong)GJCFCoreTextContentView *titleLabel;
@property (nonatomic,strong)GJCUAsyncImageView *activeImageView;
@property (nonatomic,strong)GJCURoundCornerButton *acceptButton;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Dependcy/FLAnimatedImage/FLAnimatedImageView.h | <reponame>AnriKaede/ZY2017IM<filename>ZYChat-EaseMob/ZYChat/Dependcy/FLAnimatedImage/FLAnimatedImageView.h
//
// FLAnimatedImageView.h
// Flipboard
//
// Created by <NAME> on 7/8/13.
// Copyright (c) 2013-2015 Flipboard. All rights reserved.
//
#import <UIKit/UIKit.h>
@class FLAnimatedImage;
@protocol GJGCAnimatedImageViewDebugDelegate;
//
// An `FLAnimatedImageView` can take an `FLAnimatedImage` and plays it automatically when in view hierarchy and stops when removed.
// The animation can also be controlled with the `UIImageView` methods `-start/stop/isAnimating`.
// It is a fully compatible `UIImageView` subclass and can be used as a drop-in component to work with existing code paths expecting to display a `UIImage`.
// Under the hood it uses a `CADisplayLink` for playback, which can be inspected with `currentFrame` & `currentFrameIndex`.
//
@interface FLAnimatedImageView : UIImageView
// Setting `[UIImageView.image]` to a non-`nil` value clears out existing `animatedImage`.
// And vice versa, setting `animatedImage` will initially populate the `[UIImageView.image]` to its `posterImage` and then start animating and hold `currentFrame`.
@property (nonatomic, strong) FLAnimatedImage *animatedImage;
@property (nonatomic, strong, readonly) UIImage *currentFrame;
@property (nonatomic, assign, readonly) NSUInteger currentFrameIndex;
#if defined(DEBUG) && DEBUG
// Only intended to report internal state for debugging
@property (nonatomic, weak) id<GJGCAnimatedImageViewDebugDelegate> debug_delegate;
#endif
@end
#if defined(DEBUG) && DEBUG
@protocol GJGCAnimatedImageViewDebugDelegate <NSObject>
@optional
- (void)debug_animatedImageView:(FLAnimatedImageView *)animatedImageView waitingForFrame:(NSUInteger)index duration:(NSTimeInterval)duration;
@end
#endif
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCCommonAttributedStringStyle.h | //
// GJGCCommonAttributedStringStyle.h
// ZYChat
// 公共样式
// Created by ZYVincent QQ:1003081775 on 14/11/25.
// Copyright (c) 2014年 ZYV. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface GJGCCommonAttributedStringStyle : NSObject
/**
* 群style
*
* @param content <#content description#>
*
* @return <#return value description#>
*/
+ (NSAttributedString *)getGroupAttributedString:(NSString *)content;
/**
* 群类型style
*
* @param content <#content description#>
*
* @return <#return value description#>
*/
+ (NSAttributedString *)getGroupTypeAttributedString:(NSString *)content;
/**
* 老乡标识style
*
* @param content <#content description#>
*
* @return <#return value description#>
*/
+ (NSAttributedString *)getFolksTypeAttributedString:(NSString *)content;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsViewController.h | //
// GJGCContactsViewController.h
// ZYChat
//
// Created by ZYVincent on 16/8/8.
// Copyright © 2016年 ZYProSoft. All rights reserved.
//
#import "GJGCBaseViewController.h"
@interface GJGCContactsViewController : GJGCBaseViewController
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Friend/GJGCChatFriendDataSourceManager.h | //
// GJGCChatFriendDataSourceManager.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-12.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import "GJGCChatDetailDataSourceManager.h"
@interface GJGCChatFriendDataSourceManager : GJGCChatDetailDataSourceManager
@property (nonatomic,readonly)BOOL isMyFriend;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/FileUitil/GJCFAudioFileUitil.h | //
// GJCFAudioFileUitil.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"
@interface GJCFAudioFileUitil : NSObject
/* 设置本地缓存路径 */
+ (void)setupAudioFileLocalStorePath:(GJCFAudioModel*)audioFile;
/* 设置一个临时转编码文件的缓存地址 */
+ (void)setupAudioFileTempEncodeFilePath:(GJCFAudioModel*)audioFile;
/* 直接将一个文件的临时编码文件复制到本地缓存文件路径 */
+ (BOOL)saveAudioTempEncodeFileToLocalCacheDir:(GJCFAudioModel*)audioFile;
/* 远程地址和本地wav文件建立关系 */
+ (BOOL)createRemoteUrl:(NSString*)remoteUrl relationWithLocalWavPath:(NSString*)localWavPath;
/* 删掉一个对应关系 */
+ (BOOL)deleteShipForRemoteUrl:(NSString *)remoteUrl;
/* 检测本地有没有对应的wav文件,避免重复下载 */
+ (NSString *)localWavPathForRemoteUrl:(NSString *)remoteUrl;
/* 删除临时转码文件 */
+ (BOOL)deleteTempEncodeFileWithPath:(NSString *)tempEncodeFilePath;
/* 删除对应地址的Wav文件 */
+ (BOOL)deleteWavFileByUrl:(NSString *)remoteUrl;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupBaseCell.h | //
// BTUploadMemberBaseCell.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/9/21.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GJGCCreateGroupContentModel.h"
#import "GJGCCreateGroupCellDelegate.h"
@interface GJGCCreateGroupBaseCell : UITableViewCell
@property (nonatomic,weak)id<GJGCCreateGroupCellDelegate> delegate;
@property (nonatomic,strong)UILabel *tagLabel;
@property (nonatomic,strong)UIImageView *arrowImageView;
@property (nonatomic,strong)UIImageView *seprateLine;
@property (nonatomic,strong)UIImageView *bottomLine;
@property (nonatomic,assign)NSInteger maxInputLength;
- (NSString *)contentValue;
- (void)setContentModel:(GJGCCreateGroupContentModel *)contentModel;
- (CGFloat)cellHeight;
- (void)resignInputFirstResponse;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Record/GJCFAudioRecordSettings.h | <filename>ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Record/GJCFAudioRecordSettings.h
//
// GJCFAudioRecordSettings.h
// GJCommonFoundation
//
// Created by ZYVincent QQ:1003081775 on 14-9-16.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@interface GJCFAudioRecordSettings : NSObject
//采样率
@property (nonatomic,assign)CGFloat sampleRate;
/*
kAudioFormatLinearPCM = 'lpcm',
kAudioFormatAC3 = 'ac-3',
kAudioFormat60958AC3 = 'cac3',
kAudioFormatAppleIMA4 = 'ima4',
kAudioFormatMPEG4AAC = 'aac ',
kAudioFormatMPEG4CELP = 'celp',
kAudioFormatMPEG4HVXC = 'hvxc',
kAudioFormatMPEG4TwinVQ = 'twvq',
kAudioFormatMACE3 = 'MAC3',
kAudioFormatMACE6 = 'MAC6',
kAudioFormatULaw = 'ulaw',
kAudioFormatALaw = 'alaw',
kAudioFormatQDesign = 'QDMC',
kAudioFormatQDesign2 = 'QDM2',
kAudioFormatQUALCOMM = 'Qclp',
kAudioFormatMPEGLayer1 = '.mp1',
kAudioFormatMPEGLayer2 = '.mp2',
kAudioFormatMPEGLayer3 = '.mp3',
kAudioFormatTimeCode = 'time',
kAudioFormatMIDIStream = 'midi',
kAudioFormatParameterValueStream = 'apvs',
kAudioFormatAppleLossless = 'alac',
kAudioFormatMPEG4AAC_HE = 'aach',
kAudioFormatMPEG4AAC_LD = 'aacl',
kAudioFormatMPEG4AAC_ELD = 'aace',
kAudioFormatMPEG4AAC_ELD_SBR = 'aacf',
kAudioFormatMPEG4AAC_ELD_V2 = 'aacg',
kAudioFormatMPEG4AAC_HE_V2 = 'aacp',
kAudioFormatMPEG4AAC_Spatial = 'aacs',
kAudioFormatAMR = 'samr',
kAudioFormatAudible = 'AUDB',
kAudioFormatiLBC = 'ilbc',
kAudioFormatDVIIntelIMA = 0x6D730011,
kAudioFormatMicrosoftGSM = 0x6D730031,
kAudioFormatAES3 = 'aes3'
*/
@property (nonatomic,assign)NSInteger Formate;
//采样位数 默认 16 /* value is an integer, one of: 8, 16, 24, 32 */
@property (nonatomic,assign)NSInteger LinearPCMBitDepth;
//通道的数目
@property (nonatomic,assign)NSInteger numberOfChnnels;
//大端还是小端 是内存的组织方式
@property (nonatomic,assign)BOOL LinearPCMIsBigEndian;
//采样信号是整数还是浮点数
@property (nonatomic,assign)BOOL LinearPCMIsFloat;
/* 返回目前的设置的字典 */
@property (nonatomic,readonly)NSDictionary *settingDict;
/*
AVAudioQualityMin = 0,
AVAudioQualityLow = 0x20,
AVAudioQualityMedium = 0x40,
AVAudioQualityHigh = 0x60,
AVAudioQualityMax = 0x7F
*/
//音频编码质量
@property (nonatomic,assign)NSInteger EncoderAudioQuality;
+ (GJCFAudioRecordSettings *)defaultQualitySetting;
+ (GJCFAudioRecordSettings *)lowQualitySetting;
+ (GJCFAudioRecordSettings *)highQualitySetting;
+ (GJCFAudioRecordSettings *)MaxQualitySetting;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/DriftBottle/GJGCDrfitBottleDetailViewController.h | //
// GJGCDrfitBottleDetailViewController.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/7/1.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "GJGCBaseViewController.h"
@interface GJGCDrfitBottleDetailViewController : GJGCBaseViewController
- (instancetype)initWithThumbImage:(UIImage *)aImage withImageUrl:(NSString *)aImageUrl withContentString:(NSString *)aString;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupLabelsSheetViewController.h | <reponame>AnriKaede/ZY2017IM
//
// GJGCCreateGroupLabelsSheetViewController.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/11/20.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "BTActionSheetViewController.h"
@interface GJGCCreateGroupLabelsSheetViewController : BTActionSheetViewController
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/GJGCChatInputPanel/GJGCChatInputBarItem.h | //
// GJGCCommonInputBarControlItem.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-10-28.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import <UIKit/UIKit.h>
@class GJGCChatInputBarItem;
/**
* 按钮状态变化
*
* @param item 被点击的按钮
* @param changeToState 改变到的状态
*/
typedef void (^GJGCChatInputBarControlItemStateChangeEventBlock) (GJGCChatInputBarItem *item, BOOL changeToState);
/**
* 权限block
*
* @param item
*/
typedef BOOL (^GJGCChatInputBarControlItemAuthorizedBlock) (GJGCChatInputBarItem *item);
@interface GJGCChatInputBarItem : UIView
/**
* 是否选中
*/
@property (nonatomic,assign,getter=isSelected)BOOL selected;
- (instancetype)initWithSelectedIcon:(UIImage *)selectedIcon withNormalIcon:(UIImage *)normalIcon;
/**
* 设置状态变化观察
*
* @param eventBlock 需要设置的block
*/
- (void)configStateChangeEventBlock:(GJGCChatInputBarControlItemStateChangeEventBlock)eventBlock;
/**
* 监视是否可以调用
*
* @param authorizeBlock
*/
- (void)configAuthorizeBlock:(GJGCChatInputBarControlItemAuthorizedBlock)authorizBlock;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Cell/GJGCInformationMemberShowItem.h | //
// GJGCInformationMemberShowItem.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-21.
// Copyright (c) 2014年 ZYV. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GJGCInformationMemberShowItem : UIButton
@property (nonatomic,strong)GJGCCommonHeadView *headView;
- (void)setHeadUrl:(NSString *)url isMemeber:(BOOL)isMember;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/MainTab/BTTabBarRootController.h | <reponame>AnriKaede/ZY2017IM
//
// BTTabBarRootController.h
// BabyTrip
//
// Created by ZYVincent on 15/7/18.
// Copyright (c) 2015年 ZYProSoft. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BTTabBarRootController : UITabBarController
- (void)hiddenTabBar;
- (void)showTabBar;
- (NSArray *)recentConversations;
- (void)pushChatVC:(GJGCBaseViewController *)viewController;
- (void)selectAtIndex:(NSInteger)index thenPushVC:(GJGCBaseViewController *)viewController;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Cell/GJGCInformationCellConstans.h | //
// GJGCInformationCellConstans.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-6.
// Copyright (c) 2014年 ZYV. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* 资料cell类型
*/
typedef NS_ENUM(NSUInteger, GJGCInformationContentType) {
/**
* 基本内容cell
*/
GJGCInformationContentTypeBaseTextContent,
/**
* 等级cell
*/
GJGCInformationContentTypeLevelType,
/**
* 个人加入的最近三个群组
*/
GJGCInformationContentTypeGroupShow,
/**
* 群成员三个
*/
GJGCInformationContentTypeMemberShow,
/**
* 文本内容带右侧icon
*/
GJGCInformationContentTypeBaseTextAndIcon,
/**
* 个人相册展示
*/
GJGCInformationContentTypePersonPhotoBox,
/**
* 群组相册展示
*/
GJGCInformationContentTypeGroupPhotoBox,
/**
* 动态展示
*/
GJGCInformationContentTypeFeedList,
/**
* 群组头像信息
*/
GJGCInformationContentTypeGroupHeadInfo,
};
@interface GJGCInformationCellConstans : NSObject
+ (NSString *)identifierForContentType:(GJGCInformationContentType)contentType;
+ (Class)classForContentType:(GJGCInformationContentType)contentType;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Login/HALoginViewController.h | <filename>ZYChat-EaseMob/ZYChat/Login/HALoginViewController.h
//
// HALoginViewController.h
// HelloAsk
//
// Created by ZYVincent on 15-9-4.
// Copyright (c) 2015年 ZYProSoft. All rights reserved.
//
#import "GJGCBaseViewController.h"
typedef NS_ENUM(NSInteger, JxbLoginShowType) {
JxbLoginShowType_NONE,
JxbLoginShowType_USER,
JxbLoginShowType_PASS
};
@interface HALoginViewController : GJGCBaseViewController
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/GroupInformation/GJGCGroupPersonInformationShowMap.h | //
// GJGCGroupPersonInformationShowMap.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-10.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GJGCInformationCellContentModel.h"
@interface GJGCGroupPersonInformationShowMap : NSObject
+ (GJGCInformationCellContentModel *)itemWithContentValueBaseText:(NSString *)textContent tagName:(NSString *)tagName;
+ (GJGCInformationCellContentModel *)itemWithContentValueSummaryText:(NSString *)summaryContent tagName:(NSString *)tagName;
+ (GJGCInformationCellContentModel *)itemWithTextAndIcon:(NSString *)text icon:(NSString *)iconName tagName:(NSString *)tagName;
+ (GJGCInformationCellContentModel *)itemWithLevelValue:(NSString *)level tagName:(NSString *)tagName;
+ (GJGCInformationCellContentModel *)itemWithPersonPhotoBox:(NSArray *)photoUrls name:(NSString *)name distance:(NSString *)distance time:(NSString *)time
sex:(NSString *)sex age:(NSString *)age starName:(NSString *)starName helloCount:(NSString *)helloCount expandLabels:(NSString *)expandLabels
labelColorType:(NSString *)labelColorType;
+ (GJGCInformationCellContentModel *)itemWithGroupPhotoBox:(NSArray *)photoUrls name:(NSString *)name distance:(NSString *)distance tagName:(NSString *)tagName;
+ (GJGCInformationCellContentModel *)itemWithGroupShow:(NSArray *)groupInfoArray text:(NSString *)text tagName:(NSString *)tagName;
+ (GJGCInformationCellContentModel *)itemWithMemberShow:(NSArray *)memberInfoArray text:(NSString *)text tagName:(NSString *)tagName;
+ (GJGCInformationCellContentModel *)itemWithProvinceId:(NSInteger )provinceId withCityId:(NSInteger )cityId withDistrictId:(NSInteger)districtId withTagName:(NSString *)tagName;
+ (GJGCInformationCellContentModel *)itemWithDistrictId:(NSString *)districtName streetId:(NSString *)streetName withTagName:(NSString *)tagName;
+ (GJGCInformationCellContentModel *)itemWithFeedListCount:(NSInteger)count imageUrl:(NSString *)imageUrl content:(NSString *)content tagName:(NSString *)tagName;
/**
* 行业
*/
+ (GJGCInformationCellContentModel *)itemWithCompany:(NSString *)company withTagName:(NSString *)tagName;
/**
* 个人资料页面, 重新划分区域,分割风格
*
* @param informationArray
*/
+ (void)resetSubSectionForPersonInformationArray:(NSArray *)informationArray;
/**
* 群组资料页面区域重新划分
*
* @param informationArray
*/
+ (void)resetSubSectionForGroupInformationArray:(NSArray *)informationArray;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Cell/GJGCInformationFeedListCell.h | <reponame>AnriKaede/ZY2017IM<filename>ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Cell/GJGCInformationFeedListCell.h<gh_stars>1000+
//
// GJGCInformationFeedListCell.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/7/1.
// Copyright (c) 2015年 ZYV. All rights reserved.
//
#import "GJGCInformationTextCell.h"
@interface GJGCInformationFeedListCell : GJGCInformationTextCell
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/SystemNoti/GJGCChatSystemNotiCellStyle.h | <gh_stars>1000+
//
// GJGCChatSystemNotiCellStyle.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-6.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface GJGCChatSystemNotiCellStyle : NSObject
/* 头像宽度 */
+ (CGFloat)headViewWidth;
/* 两个消息时间戳字符串转化 */
+ (NSString *)timeAgoStringByLastMsgTime:(long long)lastDateTime lastMsgTime:(long long)lastTimeStamp;
/* 时间标签 */
+ (NSAttributedString *)formateTime:(NSString *)timeString;
/* 助手时间 */
+ (NSAttributedString*)formateSystemNotiTime:(long long)time;
/* 基础内容展示标签 */
+ (NSAttributedString *)formateBaseContent:(NSString *)baseContent;
/* 名字标签风格 */
+ (NSAttributedString *)formateNameString:(NSString *)name;
/* 男年龄标签 */
+ (NSAttributedString *)formateManAge:(NSString *)manAge;
/* 女年龄标签 */
+ (NSAttributedString *)formateWomenAge:(NSString *)womenAge;
/* 星座标签 */
+ (NSAttributedString *)formateStarName:(NSString *)starName;
/* 群组成员标签风格 */
+ (NSAttributedString *)formateGroupMember:(NSString *)memberCount;
/* 群组等级标签 */
+ (NSAttributedString *)formateGroupLevel:(NSString *)levelString;
/* 申请通知信息标签 */
+ (NSAttributedString *)formateApplyTip:(NSString *)applyTip;
/* 申请理由标签 */
+ (NSAttributedString *)formateApplyReason:(NSString *)applyReason;
/* 按钮 */
+ (NSAttributedString *)formateButtonTitle:(NSString *)buttonTitle;
/* 活动卡片内容颜色 */
+ (NSAttributedString *)formateActiveDescription:(NSString *)description;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Dependcy/GJCURoundCornerView/TKRoundedView.h | <reponame>AnriKaede/ZY2017IM
//
// TKRoundedView.h
// TKRoundedView
//
// Created by <NAME> on 1/6/13.
// Copyright (c) 2013 <NAME>. All rights reserved.
//
typedef NS_OPTIONS(NSUInteger, TKRoundedCorner) {
TKRoundedCornerNone = 0,
TKRoundedCornerTopRight = 1 << 0,
TKRoundedCornerBottomRight = 1 << 1,
TKRoundedCornerBottomLeft = 1 << 2,
TKRoundedCornerTopLeft = 1 << 3,
};
typedef NS_OPTIONS(NSUInteger, TKDrawnBorderSides) {
TKDrawnBorderSidesNone = 0,
TKDrawnBorderSidesRight = 1 << 0,
TKDrawnBorderSidesLeft = 1 << 1,
TKDrawnBorderSidesTop = 1 << 2,
TKDrawnBorderSidesBottom = 1 << 3,
};
typedef NS_ENUM(NSInteger, TKGradientDirection) {
TKGradientDirectionHorizontal,
TKGradientDirectionVertical,
TKGradientDirectionUp,
TKGradientDirectionDown,
};
extern const TKRoundedCorner TKRoundedCornerAll;
extern const TKDrawnBorderSides TKDrawnBorderSidesAll;
UIImage * TKRoundedCornerImage(CGSize size,
TKRoundedCorner corners,
TKDrawnBorderSides drawnBorders,
UIColor *fillColor,
UIColor *borderColor,
CGFloat borderWidth,
CGFloat cornerRadius);
@interface TKRoundedView : UIView
/* Which borders should be drawn - default TKDrawnBordersSidesAll - only not rounded borders can *NOT* be drawn atm */
@property (nonatomic, assign) TKDrawnBorderSides drawnBordersSides;
/* Which corners should be rounded - default TKRoundedCornerAll */
@property (nonatomic, assign) TKRoundedCorner roundedCorners;
/* Fill color of the figure - default white */
@property (nonatomic, strong) UIColor *fillColor;
/* Stroke color for the figure, default is light gray */
@property (nonatomic, strong) UIColor *borderColor;
/* Border line width, default 1.0f */
@property (nonatomic, assign) CGFloat borderWidth;
/* Corners radius , default 15.0f */
@property (nonatomic, assign) CGFloat cornerRadius;
/* Direction of the gradient [options -, |, /, \] (if there will be a gradient drawn), default vertical */
@property (nonatomic, assign) TKGradientDirection gradientDirection;
/* NSArray of NSDictionaries with NSNumber with color's locations and the UIColor object, default nil */
@property (nonatomic, strong) NSArray *gradientColorsAndLocations;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupConst.h | //
// GJGCCreateGroupConst.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/9/21.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* 分割线风格
*/
typedef NS_ENUM(NSUInteger, GJGCCreateGroupCellSeprateLineStyle){
/**
* 顶部没底部没
*/
GJGCCreateGroupCellSeprateLineStyleTopNoneBottomNone,
/**
* 顶部没,底部有
*/
GJGCCreateGroupCellSeprateLineStyleTopNoneBottomShow,
/**
* 顶部有,底部没
*/
GJGCCreateGroupCellSeprateLineStyleTopShowBottomNone,
/**
* 顶部有,底部有
*/
GJGCCreateGroupCellSeprateLineStyleTopShowBottomShow,
};
/**
* 创建群组表单内容
*/
typedef NS_ENUM(NSUInteger, GJGCCreateGroupContentType) {
/**
* 群名字
*/
GJGCCreateGroupContentTypeSubject,
/**
* 群简介
*/
GJGCCreateGroupContentTypeDescription,
/**
* 群位置
*/
GJGCCreateGroupContentTypeLocation,
/**
* 群标签
*/
GJGCCreateGroupContentTypeLabels,
/**
* 群地址
*/
GJGCCreateGroupContentTypeAddress,
/**
* 群头像
*/
GJGCCreateGroupContentTypeHeadThumb,
/**
* 群人数选择
*/
GJGCCreateGroupContentTypeMemberCount,
/**
* 群组类型
*/
GJGCCreateGroupContentTypeGroupType,
/**
* 公司组织
*/
GJGCCreateGroupContentTypeCompany,
};
@interface GJGCCreateGroupConst : NSObject
+ (Class)cellClassForContentType:(GJGCCreateGroupContentType)contentType;
+ (NSString *)cellIdentifierForContentType:(GJGCCreateGroupContentType)contentType;
+ (NSString *)levelForGroupMemberCount:(NSInteger )groupMemberCount;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/DriftBottle/GJGCDriftBottleImageScrollView.h | <filename>ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/DriftBottle/GJGCDriftBottleImageScrollView.h
//
// GJGCDriftBottleImageScrollView.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/7/1.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GJGCDriftBottleImageScrollView : UIScrollView
- (UIImage *)contentImage;
- (void)setNeedShowImage:(UIImage *)aImage;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/SystemNoti/GJGCChatSystemNotiBaseCell.h | <reponame>AnriKaede/ZY2017IM
//
// GJGCChatBaseCell.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-10-17.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GJGCCommonFontColorStyle.h"
#import "GJGCChatBaseCell.h"
#import "GJCFCoreTextContentView.h"
@interface GJGCChatSystemNotiBaseCell : GJGCChatBaseCell
@property (nonatomic,strong)GJCFCoreTextContentView *timeLabel;
@property (nonatomic,assign)CGFloat timeContentMargin;
@property (nonatomic,strong)GJCFCoreTextContentView *contentLabel;
@property (nonatomic,strong)UIImageView *accessoryIndicator;
@property (nonatomic,strong)UIImageView *stateContentView;
@property (nonatomic,assign)BOOL showAccesoryIndicator;
@property (nonatomic,assign)CGFloat contentBordMargin;
@property (nonatomic,assign)CGFloat contentInnerMargin;
- (CGFloat)cellHeight;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupTypeSheetDataManager.h | <filename>ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupTypeSheetDataManager.h<gh_stars>1000+
//
// GJGCCreateGroupTypeSheetDataManager.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/11/20.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import "BTActionSheetDataManager.h"
@interface GJGCCreateGroupTypeSheetDataManager : BTActionSheetDataManager
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Base/GJGCInformationBaseModel.h | <reponame>AnriKaede/ZY2017IM<filename>ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Base/GJGCInformationBaseModel.h
//
// GJGCInformationBaseModel.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-6.
// Copyright (c) 2014年 ZYV. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GJGCInformationCellConstans.h"
/**
* 分割线类型
*/
typedef NS_ENUM(NSUInteger, GJGCInformationSeprateLineStyle) {
/**
* 上面全分割,底部短分割
*/
GJGCInformationSeprateLineStyleTopFullBottomShort,
/**
* 上面无分割,底部短分割
*/
GJGCInformationSeprateLineStyleTopNoneBottomShort,
/**
* 上面无分割,底部全分割
*/
GJGCInformationSeprateLineStyleTopNoneBottomFull,
/**
* 上面和底部全分割
*/
GJGCInformationSeprateLineStyleTopFullBottomFull,
/**
* 上面全分割,底部无分割
*/
GJGCInformationSeprateLineStyleTopFullBottomNone,
};
@interface GJGCInformationBaseModel : NSObject
#pragma mark - 样式控制属性
@property (nonatomic,assign)CGFloat topLineMargin;
@property (nonatomic,assign)CGFloat baseLineMargin;
@property (nonatomic,assign)GJGCInformationSeprateLineStyle seprateStyle;
@property (nonatomic,assign)GJGCInformationContentType baseContentType;
@property (nonatomic,strong)NSString *iconImageName;
@property (nonatomic,assign)BOOL shouldShowIndicator;
@property (nonatomic,assign)CGFloat contentHeight;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Base/GJGCInformationBaseCell.h | //
// GJGCInformationBaseCell.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-6.
// Copyright (c) 2014年 ZYV. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GJGCInformationBaseModel.h"
#import "GJGCInformationBaseCellDelegate.h"
@interface GJGCInformationBaseCell : UITableViewCell
@property (nonatomic,weak)id<GJGCInformationBaseCellDelegate> delegate;
@property (nonatomic,assign)GJGCInformationSeprateLineStyle seprateStyle;
@property (nonatomic,strong)UIImageView *baseSeprateLine;
@property (nonatomic,strong)UIImageView *accessoryIndicatorView;
@property (nonatomic,strong)UIImageView *topSeprateLine;
@property (nonatomic,assign)CGFloat baseSeprateLineShortMargin;
@property (nonatomic,assign)CGFloat baseLineToCellBottomMargin;
@property (nonatomic,assign)CGFloat topLineToCellTopMargin;
@property (nonatomic,strong)UIImageView *baseContentView;
- (void)setContentInformationModel:(GJGCInformationBaseModel *)contentModel;
- (CGFloat)heightForInformationModel:(GJGCInformationBaseModel *)contentModel;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Network/GJCFFileUploadTask+GJCFAudioUpload.h | <gh_stars>1000+
//
// GJCFFileUploadTask+GJCFAudioUpload.h
// GJCommonFoundation
//
// Created by ZYVincent QQ:1003081775 on 14-9-18.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import "GJCFFileUploadTask.h"
#import "GJCFAudioModel.h"
@protocol GJCFAudioUploadTaskDelegate <NSObject>
@required
/* 将任务返回的结果绑定成为一个文件model,怎么绑定通过这个协议让使用者自己实现 */
- (GJCFAudioModel *)uploadTask:(GJCFFileUploadTask *)task formateReturnResult:(NSDictionary *)resultDict;
@end
@interface GJCFFileUploadTask (GJCFAudioUpload)
+ (GJCFFileUploadTask *)taskWithAudioFile:(GJCFAudioModel*)audioFile withObserver:(NSObject*)observer withTaskIdentifier:(NSString **)taskIdentifier;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/UITableViewCell/Cell/GJGCInformationPhotoBox.h | //
// GJGCInformationPhotoBox.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 14-11-6.
// Copyright (c) 2014年 ZYV. All rights reserved.
//
#import <UIKit/UIKit.h>
@class GJGCInformationPhotoBox;
@protocol GJGCInformationPhotoBoxDelegate <NSObject>
- (void)photoBoxDidTapAtIndex:(NSInteger)index;
@end
@interface GJGCInformationPhotoBox : UIView
@property (nonatomic,weak)id<GJGCInformationPhotoBoxDelegate> delegate;
@property (nonatomic,assign)CGFloat contentMargin;
- (void)setContentPhotoBoxUrls:(NSArray *)photoUrls;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatModel.h | //
// GJGCRecentChatModel.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/7/11.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GJGCGroupInfoExtendModel.h"
@interface GJGCRecentChatModel : NSObject
@property (nonatomic,strong)NSString *headUrl;
@property (nonatomic,strong)NSAttributedString *name;
@property (nonatomic,strong)NSAttributedString *time;
@property (nonatomic,strong)NSString *content;
@property (nonatomic,assign)CGFloat contentHeight;
@property (nonatomic,strong)NSString *toId;
@property (nonatomic,assign)BOOL isGroupChat;
@property (nonatomic,assign)CGSize contentSize;
@property (nonatomic,assign)NSInteger unReadCount;
@property (nonatomic,strong)EMConversation *conversation;
@property (nonatomic,strong)GJGCMessageExtendGroupModel *groupInfo;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/Base/GJGCChatContentBaseModel.h | //
// GJGCChatContentBaseModel.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"
/**
* 发送消息状态
*/
typedef NS_ENUM(NSUInteger, GJGCChatFriendSendMessageStatus) {
/**
* 发送失败
*/
GJGCChatFriendSendMessageStatusFaild = 0,
/**
* 发送成功
*/
GJGCChatFriendSendMessageStatusSuccess = 1,
/**
* 发送中
*/
GJGCChatFriendSendMessageStatusSending = 2,
};
/**
* 对话类型
*/
typedef NS_ENUM(NSUInteger, GJGCChatFriendTalkType) {
/**
* 单聊
*/
GJGCChatFriendTalkTypePrivate,
/**
* 群聊
*/
GJGCChatFriendTalkTypeGroup,
/**
* 帖子聊天
*/
GJGCChatFriendTalkTypePost,
/**
* 帖子系统
*/
GJGCChatFriendTalkTypePostSystem,
/**
* 系统助手
*/
GJGCChatFriendTalkSystemAssist
};
@interface GJGCChatContentBaseModel : NSObject
@property (nonatomic,readonly)NSString *uniqueIdentifier;
@property (nonatomic,readwrite)NSInteger contentSourceIndex;
@property (nonatomic,assign)long long sendTime;
/**
* 是否时间区间的模型
*/
@property (nonatomic,assign)BOOL isTimeSubModel;
/**
* 绑定的时间块的唯一标示
*/
@property (nonatomic,strong)NSString *timeSubIdentifier;
/**
* 某个时间块下面有多少条消息
*/
@property (nonatomic,assign)NSInteger timeSubMsgCount;
@property (nonatomic,strong)NSAttributedString *timeString;
@property (nonatomic,strong)NSString *faildReason;
@property (nonatomic,assign)NSInteger faildType;
@property (nonatomic,assign)GJGCChatFriendTalkType talkType;
@property (nonatomic,strong)NSString *toId;
@property (nonatomic,strong)NSString *toUserName;
@property (nonatomic,strong)NSString *senderId;
@property (nonatomic,strong)NSString *sessionId;
/**
* 消息最基础的类型区分
*/
@property (nonatomic,assign)GJGCChatBaseMessageType baseMessageType;
/**
* 内容高度
*/
@property (nonatomic,assign)CGFloat contentHeight;
/**
* 具体内容大小
*/
@property (nonatomic,assign)CGSize contentSize;
/**
* 本地消息id
*/
@property (nonatomic,strong)NSString *localMsgId;
/**
* 消息发送状态
*/
@property (nonatomic,assign)GJGCChatFriendSendMessageStatus sendStatus;
- (NSComparisonResult)compareContent:(GJGCChatContentBaseModel *)contentModel;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/AppWall/GJGCAppWallAreaSheetViewController.h | <gh_stars>1000+
//
// GJGCAppWallAreaSheetViewController.h
// ZYChat
//
// Created by ZYVincent on 15/11/26.
// Copyright (c) 2015年 ZYProSoft. All rights reserved.
//
#import "BTActionSheetViewController.h"
@interface GJGCAppWallAreaSheetViewController : BTActionSheetViewController
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Square/CreateGroup/GJGCCreateGroupDataManager.h | //
// GJGCCreateGroupDataManager.h
// ZYChat
//
// Created by ZYVincent QQ:1003081775 on 15/9/21.
// Copyright (c) 2015年 ZYProSoft. QQ群:219357847 All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GJGCCreateGroupContentModel.h"
@class GJGCCreateGroupDataManager;
@protocol GJGCCreateGroupDataManagerDelegate <NSObject>
- (void)dataManagerRequireRefresh:(GJGCCreateGroupDataManager *)dataManager;
- (void)dataManagerRequireRefresh:(GJGCCreateGroupDataManager *)dataManager reloadAtIndexPaths:(NSArray *)indexPaths;
- (void)dataManager:(GJGCCreateGroupDataManager *)dataManager showErrorMessage:(NSString *)message;
- (void)dataManagerDidCreateGroupSuccess:(GJGCCreateGroupDataManager *)dataManager;
@end
@interface GJGCCreateGroupDataManager : NSObject
@property (nonatomic,weak)id<GJGCCreateGroupDataManagerDelegate> delegate;
@property (nonatomic,readonly)NSInteger totalCount;
- (GJGCCreateGroupContentModel *)contentModelAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)cellIdentifierAtIndexPath:(NSIndexPath *)indexPath;
- (Class)cellClassAtIndexPath:(NSIndexPath *)indexPath;
- (void)updateTextContentWith:(NSString *)contentValue forIndexPath:(NSIndexPath *)indexPath;
- (void)updateSimpleDescription:(NSString *)description;
- (void)updateMemberCount:(NSString *)memberCount;
- (void)updateLabels:(NSString *)labels;
- (void)updateAddress:(NSString *)address;
- (void)updateHeadUrl:(NSString *)headUrl;
- (void)updateGroupType:(NSNumber *)type display:(NSString *)display;
- (void)uploadGroupInfoAction;
- (void)createMemberList;
@end
|
AnriKaede/ZY2017IM | ZYChat-EaseMob/ZYChat/Dependcy/GJCFUitils/DispatchCenterUitil/GJCFDispatchCenterUitil.h | <gh_stars>1000+
//
// GJCFDispatchCenterUitil.h
// GJCommonFoundation
//
// Created by ZYVincent QQ:1003081775 on 14-10-16.
// Copyright (c) 2014年 ZYProSoft. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface GJCFDispatchCenterUitil : NSObject
+ (void)asyncMainQueue:(dispatch_block_t)block;
+ (void)asyncMainQueue:(dispatch_block_t)block delay:(NSTimeInterval)second;
+ (void)asyncGlobalBackgroundQueue:(dispatch_block_t)block;
+ (void)asyncGlobalBackgroundQueue:(dispatch_block_t)block delay:(NSTimeInterval)second;
+ (void)asyncGlobalHighQueue:(dispatch_block_t)block ;
+ (void)asyncGlobalHighQueue:(dispatch_block_t)block delay:(NSTimeInterval)second;
+ (void)asyncGlobalLowQueue:(dispatch_block_t)block;
+ (void)asyncGlobalLowQueue:(dispatch_block_t)block delay:(NSTimeInterval)second;
+ (void)asyncGlobalDefaultQueue:(dispatch_block_t)block;
+ (void)asyncGlobalDefaultQueue:(dispatch_block_t)block delay:(NSTimeInterval)second;
+ (void)asyncQueue:(dispatch_queue_t)queue action:(dispatch_block_t)block delay:(NSTimeInterval)second;
+ (void)dispatchOnce:(dispatch_once_t)onceToken action:(dispatch_block_t)block;
+ (dispatch_queue_t)createQueueWithName:(NSString *)name isSerial:(BOOL)isSerial;
@end
|
straywriter/bgfx | External/bx/include/bx/sort.h | /*
* Copyright 2010-2021 <NAME>. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
#ifndef BX_SORT_H_HEADER_GUARD
#define BX_SORT_H_HEADER_GUARD
#include "bx.h"
namespace bx
{
///
typedef int32_t (*ComparisonFn)(const void* _lhs, const void* _rhs);
///
void quickSort(
void* _data
, uint32_t _num
, uint32_t _stride
, const ComparisonFn _fn
);
///
void radixSort(
uint32_t* _keys
, uint32_t* _tempKeys
, uint32_t _size
);
///
template <typename Ty>
void radixSort(
uint32_t* _keys
, uint32_t* _tempKeys
, Ty* _values
, Ty* _tempValues
, uint32_t _size
);
///
void radixSort(
uint64_t* _keys
, uint64_t* _tempKeys
, uint32_t _size
);
///
template <typename Ty>
void radixSort(
uint64_t* _keys
, uint64_t* _tempKeys
, Ty* _values
, Ty* _tempValues
, uint32_t _size
);
} // namespace bx
#include "inline/sort.inl"
#endif // BX_SORT_H_HEADER_GUARD
|
straywriter/bgfx | Example/RenderExample/common/nanovg/nanovg_bgfx.h | /*
* Copyright 2011-2021 <NAME>. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#ifndef NANOVG_BGFX_H_HEADER_GUARD
#define NANOVG_BGFX_H_HEADER_GUARD
#include <Render/bgfx.h>
namespace bx { struct AllocatorI; }
struct NVGcontext;
struct NVGLUframebuffer
{
NVGcontext* ctx;
bgfx::FrameBufferHandle handle;
int image;
bgfx::ViewId viewId;
};
///
NVGcontext* nvgCreate(int32_t _edgeaa, bgfx::ViewId _viewId, bx::AllocatorI* _allocator);
///
NVGcontext* nvgCreate(int32_t _edgeaa, bgfx::ViewId _viewId);
///
void nvgDelete(NVGcontext* _ctx);
///
void nvgSetViewId(NVGcontext* _ctx, bgfx::ViewId _viewId);
///
uint16_t nvgGetViewId(struct NVGcontext* _ctx);
// Helper functions to create bgfx framebuffer to render to.
// Example:
// float scale = 2;
// NVGLUframebuffer* fb = nvgluCreateFramebuffer(ctx, 100 * scale, 100 * scale, 0);
// nvgluSetViewFramebuffer(VIEW_ID, fb);
// nvgluBindFramebuffer(fb);
// nvgBeginFrame(ctx, 100, 100, scale);
// // renders anything offscreen
// nvgEndFrame(ctx);
// nvgluBindFramebuffer(NULL);
//
// // Pastes the framebuffer rendering.
// nvgBeginFrame(ctx, 1024, 768, scale);
// NVGpaint paint = nvgImagePattern(ctx, 0, 0, 100, 100, 0, fb->image, 1);
// nvgBeginPath(ctx);
// nvgRect(ctx, 0, 0, 100, 100);
// nvgFillPaint(ctx, paint);
// nvgFill(ctx);
// nvgEndFrame(ctx);
///
NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* _ctx, int32_t _width, int32_t _height, int32_t _imageFlags, bgfx::ViewId _viewId);
///
NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* _ctx, int32_t _width, int32_t _height, int32_t _imageFlags);
///
NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* _ctx, int32_t _imageFlags, bgfx::ViewId _viewId);
///
NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* _ctx, int32_t _imageFlags);
///
void nvgluBindFramebuffer(NVGLUframebuffer* _framebuffer);
///
void nvgluDeleteFramebuffer(NVGLUframebuffer* _framebuffer);
///
void nvgluSetViewFramebuffer(bgfx::ViewId _viewId, NVGLUframebuffer* _framebuffer);
#endif // NANOVG_BGFX_H_HEADER_GUARD
|
straywriter/bgfx | External/bx/include/bx/endian.h | /*
* Copyright 2010-2021 <NAME>. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
#ifndef BX_ENDIAN_H_HEADER_GUARD
#define BX_ENDIAN_H_HEADER_GUARD
#include "bx.h"
namespace bx
{
///
int16_t endianSwap(int16_t _in);
///
uint16_t endianSwap(uint16_t _in);
///
int32_t endianSwap(int32_t _in);
///
uint32_t endianSwap(uint32_t _in);
///
int64_t endianSwap(int64_t _in);
///
uint64_t endianSwap(uint64_t _in);
/// Input argument is encoded as little endian, convert it if neccessary
/// depending on host CPU endianess.
template <typename Ty>
Ty toLittleEndian(const Ty _in);
/// Input argument is encoded as big endian, convert it if neccessary
/// depending on host CPU endianess.
template <typename Ty>
Ty toBigEndian(const Ty _in);
/// If _littleEndian is true, converts input argument to from little endian
/// to host CPU endiness.
template <typename Ty>
Ty toHostEndian(const Ty _in, bool _fromLittleEndian);
} // namespace bx
#include "inline/endian.inl"
#endif // BX_ENDIAN_H_HEADER_GUARD
|
straywriter/bgfx | External/bx/include/bx/thread.h | <gh_stars>1000+
/*
* Copyright 2010-2021 <NAME>. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
#ifndef BX_THREAD_H_HEADER_GUARD
#define BX_THREAD_H_HEADER_GUARD
#include "allocator.h"
#include "mpscqueue.h"
#if BX_CONFIG_SUPPORTS_THREADING
namespace bx
{
///
typedef int32_t (*ThreadFn)(class Thread* _self, void* _userData);
///
class Thread
{
BX_CLASS(Thread
, NO_COPY
, NO_ASSIGNMENT
);
public:
///
Thread();
///
virtual ~Thread();
/// Create and initialize thread.
///
/// @param[in] _fn Thread function.
/// @param[in] _userData User data passed to thread function.
/// @param[in] _stackSize Stack size, if zero is passed it will use OS default thread stack
/// size.
/// @param[in] _name Thread name used by debugger.
/// @returns True if thread is created, otherwise returns false.
///
bool init(ThreadFn _fn, void* _userData = NULL, uint32_t _stackSize = 0, const char* _name = NULL);
///
void shutdown();
///
bool isRunning() const;
///
int32_t getExitCode() const;
///
void setThreadName(const char* _name);
///
void push(void* _ptr);
///
void* pop();
private:
friend struct ThreadInternal;
int32_t entry();
BX_ALIGN_DECL(16, uint8_t) m_internal[64];
ThreadFn m_fn;
void* m_userData;
MpScUnboundedBlockingQueue<void> m_queue;
Semaphore m_sem;
uint32_t m_stackSize;
int32_t m_exitCode;
bool m_running;
};
///
class TlsData
{
public:
///
TlsData();
///
~TlsData();
///
void* get() const;
///
void set(void* _ptr);
private:
BX_ALIGN_DECL(16, uint8_t) m_internal[64];
};
} // namespace bx
#endif
#endif // BX_THREAD_H_HEADER_GUARD
|
straywriter/bgfx | External/bx/include/bx/config.h | /*
* Copyright 2010-2021 <NAME>. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
#ifndef BX_CONFIG_H_HEADER_GUARD
#define BX_CONFIG_H_HEADER_GUARD
#include "bx.h"
#ifndef BX_CONFIG_ALLOCATOR_DEBUG
# define BX_CONFIG_ALLOCATOR_DEBUG 0
#endif // BX_CONFIG_DEBUG_ALLOC
#ifndef BX_CONFIG_SUPPORTS_THREADING
# define BX_CONFIG_SUPPORTS_THREADING !(0 \
|| BX_PLATFORM_EMSCRIPTEN \
)
#endif // BX_CONFIG_SUPPORTS_THREADING
#endif // BX_CONFIG_H_HEADER_GUARD
|
straywriter/bgfx | External/bx/include/bx/timer.h | <filename>External/bx/include/bx/timer.h<gh_stars>1000+
/*
* Copyright 2010-2021 <NAME>. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
#ifndef BX_TIMER_H_HEADER_GUARD
#define BX_TIMER_H_HEADER_GUARD
#include "bx.h"
namespace bx
{
///
int64_t getHPCounter();
///
int64_t getHPFrequency();
} // namespace bx
#endif // BX_TIMER_H_HEADER_GUARD
|
straywriter/bgfx | External/bx/include/bx/simd_t.h | /*
* Copyright 2010-2021 <NAME>. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
#ifndef BX_SIMD_T_H_HEADER_GUARD
#define BX_SIMD_T_H_HEADER_GUARD
#include "bx.h"
#define BX_SIMD_FORCE_INLINE BX_FORCE_INLINE
#define BX_SIMD_INLINE inline
#define BX_SIMD_AVX 0
#define BX_SIMD_LANGEXT 0
#define BX_SIMD_NEON 0
#define BX_SIMD_SSE 0
#define BX_CONFIG_SUPPORTS_SIMD 0
#if defined(__AVX__) || defined(__AVX2__)
# include <immintrin.h>
# undef BX_SIMD_AVX
# define BX_SIMD_AVX 1
#endif //
#if defined(__SSE2__) || (BX_COMPILER_MSVC && (BX_ARCH_64BIT || _M_IX86_FP >= 2) )
# include <emmintrin.h> // __m128i
# if defined(__SSE4_1__)
# include <smmintrin.h>
# endif // defined(__SSE4_1__)
# include <xmmintrin.h> // __m128
# undef BX_SIMD_SSE
# define BX_SIMD_SSE 1
#elif defined(__ARM_NEON__) && (!BX_COMPILER_CLANG || BX_CLANG_HAS_EXTENSION(attribute_ext_vector_type) )
# include <arm_neon.h>
# undef BX_SIMD_NEON
# define BX_SIMD_NEON 1
#elif BX_COMPILER_CLANG \
&& !BX_PLATFORM_EMSCRIPTEN \
&& !BX_PLATFORM_IOS \
&& BX_CLANG_HAS_EXTENSION(attribute_ext_vector_type)
# undef BX_SIMD_LANGEXT
# define BX_SIMD_LANGEXT 1
#endif //
namespace bx
{
#define ELEMx 0
#define ELEMy 1
#define ELEMz 2
#define ELEMw 3
#define BX_SIMD128_IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
template<typename Ty> \
Ty simd_swiz_##_x##_y##_z##_w(Ty _a);
#include "inline/simd128_swizzle.inl"
#undef BX_SIMD128_IMPLEMENT_SWIZZLE
#undef ELEMw
#undef ELEMz
#undef ELEMy
#undef ELEMx
#define BX_SIMD128_IMPLEMENT_TEST(_xyzw) \
template<typename Ty> \
BX_SIMD_FORCE_INLINE bool simd_test_any_##_xyzw(Ty _test); \
\
template<typename Ty> \
BX_SIMD_FORCE_INLINE bool simd_test_all_##_xyzw(Ty _test)
BX_SIMD128_IMPLEMENT_TEST(x );
BX_SIMD128_IMPLEMENT_TEST(y );
BX_SIMD128_IMPLEMENT_TEST(xy );
BX_SIMD128_IMPLEMENT_TEST(z );
BX_SIMD128_IMPLEMENT_TEST(xz );
BX_SIMD128_IMPLEMENT_TEST(yz );
BX_SIMD128_IMPLEMENT_TEST(xyz );
BX_SIMD128_IMPLEMENT_TEST(w );
BX_SIMD128_IMPLEMENT_TEST(xw );
BX_SIMD128_IMPLEMENT_TEST(yw );
BX_SIMD128_IMPLEMENT_TEST(xyw );
BX_SIMD128_IMPLEMENT_TEST(zw );
BX_SIMD128_IMPLEMENT_TEST(xzw );
BX_SIMD128_IMPLEMENT_TEST(yzw );
BX_SIMD128_IMPLEMENT_TEST(xyzw);
#undef BX_SIMD128_IMPLEMENT_TEST
template<typename Ty>
Ty simd_shuf_xyAB(Ty _a, Ty _b);
template<typename Ty>
Ty simd_shuf_ABxy(Ty _a, Ty _b);
template<typename Ty>
Ty simd_shuf_CDzw(Ty _a, Ty _b);
template<typename Ty>
Ty simd_shuf_zwCD(Ty _a, Ty _b);
template<typename Ty>
Ty simd_shuf_xAyB(Ty _a, Ty _b);
template<typename Ty>
Ty simd_shuf_AxBy(Ty _a, Ty _b);
template<typename Ty>
Ty simd_shuf_zCwD(Ty _a, Ty _b);
template<typename Ty>
Ty simd_shuf_CzDw(Ty _a, Ty _b);
template<typename Ty>
float simd_x(Ty _a);
template<typename Ty>
float simd_y(Ty _a);
template<typename Ty>
float simd_z(Ty _a);
template<typename Ty>
float simd_w(Ty _a);
template<typename Ty>
Ty simd_ld(const void* _ptr);
template<typename Ty>
void simd_st(void* _ptr, Ty _a);
template<typename Ty>
void simd_stx(void* _ptr, Ty _a);
template<typename Ty>
void simd_stream(void* _ptr, Ty _a);
template<typename Ty>
Ty simd_ld(float _x, float _y, float _z, float _w);
template<typename Ty>
Ty simd_ld(float _x, float _y, float _z, float _w, float _a, float _b, float _c, float _d);
template<typename Ty>
Ty simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w);
template<typename Ty>
Ty simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w, uint32_t _a, uint32_t _b, uint32_t _c, uint32_t _d);
template<typename Ty>
Ty simd_splat(const void* _ptr);
template<typename Ty>
Ty simd_splat(float _a);
template<typename Ty>
Ty simd_isplat(uint32_t _a);
template<typename Ty>
Ty simd_zero();
template<typename Ty>
Ty simd_itof(Ty _a);
template<typename Ty>
Ty simd_ftoi(Ty _a);
template<typename Ty>
Ty simd_round(Ty _a);
template<typename Ty>
Ty simd_add(Ty _a, Ty _b);
template<typename Ty>
Ty simd_sub(Ty _a, Ty _b);
template<typename Ty>
Ty simd_mul(Ty _a, Ty _b);
template<typename Ty>
Ty simd_div(Ty _a, Ty _b);
template<typename Ty>
Ty simd_rcp_est(Ty _a);
template<typename Ty>
Ty simd_sqrt(Ty _a);
template<typename Ty>
Ty simd_rsqrt_est(Ty _a);
template<typename Ty>
Ty simd_dot3(Ty _a, Ty _b);
template<typename Ty>
Ty simd_dot(Ty _a, Ty _b);
template<typename Ty>
Ty simd_cmpeq(Ty _a, Ty _b);
template<typename Ty>
Ty simd_cmpneq(Ty _a, Ty _b);
template<typename Ty>
Ty simd_cmplt(Ty _a, Ty _b);
template<typename Ty>
Ty simd_cmple(Ty _a, Ty _b);
template<typename Ty>
Ty simd_cmpgt(Ty _a, Ty _b);
template<typename Ty>
Ty simd_cmpge(Ty _a, Ty _b);
template<typename Ty>
Ty simd_min(Ty _a, Ty _b);
template<typename Ty>
Ty simd_max(Ty _a, Ty _b);
template<typename Ty>
Ty simd_and(Ty _a, Ty _b);
template<typename Ty>
Ty simd_andc(Ty _a, Ty _b);
template<typename Ty>
Ty simd_or(Ty _a, Ty _b);
template<typename Ty>
Ty simd_xor(Ty _a, Ty _b);
template<typename Ty>
Ty simd_sll(Ty _a, int _count);
template<typename Ty>
Ty simd_srl(Ty _a, int _count);
template<typename Ty>
Ty simd_sra(Ty _a, int _count);
template<typename Ty>
Ty simd_icmpeq(Ty _a, Ty _b);
template<typename Ty>
Ty simd_icmplt(Ty _a, Ty _b);
template<typename Ty>
Ty simd_icmpgt(Ty _a, Ty _b);
template<typename Ty>
Ty simd_imin(Ty _a, Ty _b);
template<typename Ty>
Ty simd_imax(Ty _a, Ty _b);
template<typename Ty>
Ty simd_iadd(Ty _a, Ty _b);
template<typename Ty>
Ty simd_isub(Ty _a, Ty _b);
template<typename Ty>
Ty simd_shuf_xAzC(Ty _a, Ty _b);
template<typename Ty>
Ty simd_shuf_yBwD(Ty _a, Ty _b);
template<typename Ty>
Ty simd_rcp(Ty _a);
template<typename Ty>
Ty simd_orx(Ty _a);
template<typename Ty>
Ty simd_orc(Ty _a, Ty _b);
template<typename Ty>
Ty simd_neg(Ty _a);
template<typename Ty>
Ty simd_madd(Ty _a, Ty _b, Ty _c);
template<typename Ty>
Ty simd_nmsub(Ty _a, Ty _b, Ty _c);
template<typename Ty>
Ty simd_div_nr(Ty _a, Ty _b);
template<typename Ty>
Ty simd_selb(Ty _mask, Ty _a, Ty _b);
template<typename Ty>
Ty simd_sels(Ty _test, Ty _a, Ty _b);
template<typename Ty>
Ty simd_not(Ty _a);
template<typename Ty>
Ty simd_abs(Ty _a);
template<typename Ty>
Ty simd_clamp(Ty _a, Ty _min, Ty _max);
template<typename Ty>
Ty simd_lerp(Ty _a, Ty _b, Ty _s);
template<typename Ty>
Ty simd_rsqrt(Ty _a);
template<typename Ty>
Ty simd_rsqrt_nr(Ty _a);
template<typename Ty>
Ty simd_rsqrt_carmack(Ty _a);
template<typename Ty>
Ty simd_sqrt_nr(Ty _a);
template<typename Ty>
Ty simd_log2(Ty _a);
template<typename Ty>
Ty simd_exp2(Ty _a);
template<typename Ty>
Ty simd_pow(Ty _a, Ty _b);
template<typename Ty>
Ty simd_cross3(Ty _a, Ty _b);
template<typename Ty>
Ty simd_normalize3(Ty _a);
template<typename Ty>
Ty simd_ceil(Ty _a);
template<typename Ty>
Ty simd_floor(Ty _a);
template<typename Ty>
Ty simd_shuf_xAzC_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_shuf_yBwD_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_madd_ni(Ty _a, Ty _b, Ty _c);
template<typename Ty>
Ty simd_nmsub_ni(Ty _a, Ty _b, Ty _c);
template<typename Ty>
Ty simd_div_nr_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_rcp_ni(Ty _a);
template<typename Ty>
Ty simd_orx_ni(Ty _a);
template<typename Ty>
Ty simd_orc_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_neg_ni(Ty _a);
template<typename Ty>
Ty simd_selb_ni(Ty _mask, Ty _a, Ty _b);
template<typename Ty>
Ty simd_sels_ni(Ty _test, Ty _a, Ty _b);
template<typename Ty>
Ty simd_not_ni(Ty _a);
template<typename Ty>
Ty simd_cmpneq_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_min_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_max_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_abs_ni(Ty _a);
template<typename Ty>
Ty simd_imin_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_imax_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_clamp_ni(Ty _a, Ty _min, Ty _max);
template<typename Ty>
Ty simd_lerp_ni(Ty _a, Ty _b, Ty _s);
template<typename Ty>
Ty simd_sqrt_nr_ni(Ty _a);
template<typename Ty>
Ty simd_sqrt_nr1_ni(Ty _a);
template<typename Ty>
Ty simd_rsqrt_ni(Ty _a);
template<typename Ty>
Ty simd_rsqrt_nr_ni(Ty _a);
template<typename Ty>
Ty simd_rsqrt_carmack_ni(Ty _a);
template<typename Ty>
Ty simd_log2_ni(Ty _a);
template<typename Ty>
Ty simd_exp2_ni(Ty _a);
template<typename Ty>
Ty simd_pow_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_dot3_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_cross3_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_normalize3_ni(Ty _a);
template<typename Ty>
Ty simd_dot_ni(Ty _a, Ty _b);
template<typename Ty>
Ty simd_ceil_ni(Ty _a);
template<typename Ty>
Ty simd_floor_ni(Ty _a);
template<typename Ty>
Ty simd_round_ni(Ty _a);
template<typename Ty>
bool simd_test_any_ni(Ty _a);
template<typename Ty>
bool simd_test_all_ni(Ty _a);
#if BX_SIMD_AVX
typedef __m256 simd256_avx_t;
#endif // BX_SIMD_SSE
#if BX_SIMD_LANGEXT
union simd128_langext_t
{
float __attribute__((vector_size(16))) vf;
int32_t __attribute__((vector_size(16))) vi;
uint32_t __attribute__((vector_size(16))) vu;
float fxyzw[4];
int32_t ixyzw[4];
uint32_t uxyzw[4];
};
#endif // BX_SIMD_LANGEXT
#if BX_SIMD_NEON
typedef float32x4_t simd128_neon_t;
#endif // BX_SIMD_NEON
#if BX_SIMD_SSE
typedef __m128 simd128_sse_t;
#endif // BX_SIMD_SSE
} // namespace bx
#if BX_SIMD_AVX
# include "inline/simd256_avx.inl"
#endif // BX_SIMD_AVX
#if BX_SIMD_LANGEXT
# include "inline/simd128_langext.inl"
#endif // BX_SIMD_LANGEXT
#if BX_SIMD_NEON
# include "inline/simd128_neon.inl"
#endif // BX_SIMD_NEON
#if BX_SIMD_SSE
# include "inline/simd128_sse.inl"
#endif // BX_SIMD_SSE
#if ( BX_SIMD_LANGEXT \
|| BX_SIMD_NEON \
|| BX_SIMD_SSE \
|| BX_SIMD_AVX \
)
# undef BX_CONFIG_SUPPORTS_SIMD
# define BX_CONFIG_SUPPORTS_SIMD 1
#endif // BX_SIMD_*
namespace bx
{
union simd128_ref_t
{
float fxyzw[4];
int32_t ixyzw[4];
uint32_t uxyzw[4];
};
#ifndef BX_SIMD_WARN_REFERENCE_IMPL
# define BX_SIMD_WARN_REFERENCE_IMPL 0
#endif // BX_SIMD_WARN_REFERENCE_IMPL
#if !BX_CONFIG_SUPPORTS_SIMD
# if BX_SIMD_WARN_REFERENCE_IMPL
# pragma message("*** Using SIMD128 reference implementation! ***")
# endif // BX_SIMD_WARN_REFERENCE_IMPL
typedef simd128_ref_t simd128_t;
#endif // BX_SIMD_REFERENCE
struct simd256_ref_t
{
#if BX_COMPILER_MSVC
typedef simd128_ref_t type;
#else
typedef simd128_t type;
#endif // BX_COMPILER_MSVC
type simd128_0;
type simd128_1;
};
#if !BX_SIMD_AVX
# if BX_SIMD_WARN_REFERENCE_IMPL
# pragma message("*** Using SIMD256 reference implementation! ***")
# endif // BX_SIMD_WARN_REFERENCE_IMPL
typedef simd256_ref_t simd256_t;
#endif // !BX_SIMD_AVX
simd128_t simd_zero();
simd128_t simd_ld(const void* _ptr);
simd128_t simd_ld(float _x, float _y, float _z, float _w);
simd128_t simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w);
simd128_t simd_splat(const void* _ptr);
simd128_t simd_splat(float _a);
simd128_t simd_isplat(uint32_t _a);
} // namespace bx
#include "inline/simd128_ref.inl"
#include "inline/simd256_ref.inl"
#include "inline/simd_ni.inl"
#endif // BX_SIMD_T_H_HEADER_GUARD
|
robojamison/hello-git | lib/pocketsphinx/test/unit/test_ps_reinit.c | #include <pocketsphinx.h>
#include <stdio.h>
#include <string.h>
#include "test_macros.h"
int
main(int argc, char *argv[])
{
ps_decoder_t *ps;
cmd_ln_t *config;
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", DATADIR "/tidigits/hmm",
"-dict", DATADIR "/tidigits/lm/tidigits.dic",
NULL));
TEST_ASSERT(ps = ps_init(config));
cmd_ln_free_r(config);
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-dict", MODELDIR "/en-us/cmudict-en-us.dict",
NULL));
TEST_EQUAL(0, ps_reinit(ps, config));
/* Reinit when adding words */
ps_add_word(ps, "foobie", "F UW B IY", FALSE);
ps_add_word(ps, "hellosomething", "HH EH L OW S", TRUE);
ps_free(ps);
cmd_ln_free_r(config);
return 0;
}
|
robojamison/hello-git | lib/pocketsphinx/test/unit/test_ps_lattice.c | #include <pocketsphinx.h>
#include <stdio.h>
#include <string.h>
#include "pocketsphinx_internal.h"
#include "ps_lattice_internal.h"
#include "test_macros.h"
#include "ps_test.c"
int
test_nodes_and_stuff(ps_lattice_t *dag)
{
ps_latnode_iter_t *itor;
ps_latlink_iter_t *litor;
ps_latnode_t *forward = NULL;
TEST_ASSERT(itor = ps_latnode_iter(dag));
while ((itor = ps_latnode_iter_next(itor))) {
int16 sf, fef, lef;
ps_latnode_t *node;
float64 post;
node = ps_latnode_iter_node(itor);
sf = ps_latnode_times(node, &fef, &lef);
post = logmath_exp(ps_lattice_get_logmath(dag),
ps_latnode_prob(dag, node, NULL));
if (post > 0.0001)
printf("%s %s %d -> (%d,%d) %f\n",
ps_latnode_baseword(dag, node),
ps_latnode_word(dag, node),
sf, fef, lef, post);
if (0 == strcmp(ps_latnode_baseword(dag, node), "forward"))
forward = node;
}
TEST_ASSERT(forward);
printf("FORWARD entries:\n");
for (litor = ps_latnode_entries(forward);
litor; litor = ps_latlink_iter_next(litor)) {
ps_latlink_t *link = ps_latlink_iter_link(litor);
int16 sf, ef;
float64 post;
int32 ascr;
ef = ps_latlink_times(link, &sf);
post = logmath_exp(ps_lattice_get_logmath(dag),
ps_latlink_prob(dag, link, &ascr));
if (post > 0.0001)
printf("%s %d -> %d prob %f ascr %d\n",
ps_latlink_baseword(dag, link),
sf, ef, post, ascr);
}
printf("FORWARD exits:\n");
for (litor = ps_latnode_exits(forward);
litor; litor = ps_latlink_iter_next(litor)) {
ps_latlink_t *link = ps_latlink_iter_link(litor);
int16 sf, ef;
float64 post;
int32 ascr;
ef = ps_latlink_times(link, &sf);
post = logmath_exp(ps_lattice_get_logmath(dag),
ps_latlink_prob(dag, link, &ascr));
if (post > 0.0001)
printf("%d -> %d prob %f ascr %d\n",
sf, ef, post, ascr);
}
return 0;
}
int
test_remaining_nodes(ps_lattice_t *dag) {
ps_latnode_iter_t *itor;
ps_latlink_iter_t *litor;
int count, lcount;
count = 0;
lcount = 0;
for (itor = ps_latnode_iter(dag); itor; itor = ps_latnode_iter_next(itor)) {
ps_latnode_t* node = ps_latnode_iter_node(itor);
for (litor = ps_latnode_entries(node);
litor; litor = ps_latlink_iter_next(litor)) {
lcount++;
}
count++;
}
TEST_ASSERT(count == 3);
TEST_ASSERT(lcount == 2);
printf("Remaining %d nodes %d links\n", count, lcount);
return 0;
}
int
main(int argc, char *argv[])
{
ps_decoder_t *ps;
ps_lattice_t *dag;
cmd_ln_t *config;
FILE *rawfh;
char const *hyp;
int32 score;
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-lm", MODELDIR "/en-us/en-us.lm.dmp",
"-dict", MODELDIR "/en-us/cmudict-en-us.dict",
"-fwdtree", "yes",
"-fwdflat", "no",
"-bestpath", "no",
"-input_endian", "little",
"-samprate", "16000", NULL));
TEST_ASSERT(ps = ps_init(config));
TEST_ASSERT(rawfh = fopen(DATADIR "/goforward.raw", "rb"));
ps_decode_raw(ps, rawfh, -1);
fclose(rawfh);
hyp = ps_get_hyp(ps, &score);
printf("FWDFLAT: %s (%d)\n", hyp, score);
TEST_ASSERT(dag = ps_get_lattice(ps));
ps_lattice_bestpath(dag, ps_get_lm(ps, PS_DEFAULT_SEARCH), 1.0, 1.0/15.0);
score = ps_lattice_posterior(dag, ps_get_lm(ps, PS_DEFAULT_SEARCH), 1.0/15.0);
printf("P(S|O) = %d\n", score);
test_nodes_and_stuff(dag);
ps_lattice_posterior_prune(dag, logmath_log(ps_lattice_get_logmath(dag), 1e-2));
test_nodes_and_stuff(dag);
TEST_EQUAL(0, ps_lattice_write(dag, "goforward.lat"));
dag = ps_lattice_read(ps, "goforward.lat");
TEST_ASSERT(dag);
ps_lattice_bestpath(dag, ps_get_lm(ps, PS_DEFAULT_SEARCH), 1.0, 1.0/15.0);
score = ps_lattice_posterior(dag, ps_get_lm(ps, PS_DEFAULT_SEARCH), 1.0/15.0);
printf("P(S|O) = %d\n", score);
test_nodes_and_stuff(dag);
ps_lattice_free(dag);
ps_free(ps);
cmd_ln_free_r(config);
/* Now test standalone lattices. */
dag = ps_lattice_read(NULL, "goforward.lat");
TEST_ASSERT(dag);
test_nodes_and_stuff(dag);
ps_lattice_free(dag);
/* Test stripping the unreachable nodes. */
dag = ps_lattice_read(NULL, DATADIR "/unreachable.lat");
TEST_ASSERT(dag);
ps_lattice_delete_unreachable(dag);
test_remaining_nodes(dag);
ps_lattice_free(dag);
return 0;
}
|
robojamison/hello-git | lib/pocketsphinx/test/unit/test_ps_nbest.c | #include <pocketsphinx.h>
#include <stdio.h>
#include <string.h>
#include "pocketsphinx_internal.h"
#include "test_macros.h"
#include "ps_test.c"
int
main(int argc, char *argv[])
{
ps_decoder_t *ps;
ps_nbest_t *nbest;
cmd_ln_t *config;
FILE *rawfh;
char const *hyp;
int32 score, n;
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-lm", MODELDIR "/en-us/en-us.lm.dmp",
"-dict", MODELDIR "/en-us/cmudict-en-us.dict",
"-fwdtree", "yes",
"-fwdflat", "yes",
"-bestpath", "yes",
"-input_endian", "little",
"-samprate", "16000", NULL));
TEST_ASSERT(ps = ps_init(config));
TEST_ASSERT(rawfh = fopen(DATADIR "/goforward.raw", "rb"));
ps_decode_raw(ps, rawfh, -1);
fclose(rawfh);
hyp = ps_get_hyp(ps, &score);
printf("BESTPATH: %s (%d)\n", hyp, score);
TEST_ASSERT(nbest = ps_nbest(ps, 0, -1, NULL, NULL));
n = 1;
while (nbest && (nbest = ps_nbest_next(nbest))) {
ps_seg_t *seg;
hyp = ps_nbest_hyp(nbest, &score);
printf("NBEST %d: %s (%d)\n", n, hyp, score);
for (seg = ps_nbest_seg(nbest, &score); seg;
seg = ps_seg_next(seg)) {
char const *word;
int sf, ef;
word = ps_seg_word(seg);
ps_seg_frames(seg, &sf, &ef);
printf("%s %d %d\n", word, sf, ef);
}
if (n == 10)
break;
++n;
}
if (nbest)
ps_nbest_free(nbest);
ps_free(ps);
cmd_ln_free_r(config);
return 0;
}
|
robojamison/hello-git | lib/pocketsphinx/test/unit/test_jsgf.c | <filename>lib/pocketsphinx/test/unit/test_jsgf.c
#include <pocketsphinx.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <sphinxbase/jsgf.h>
#include <sphinxbase/fsg_model.h>
#include "pocketsphinx_internal.h"
#include "fsg_search_internal.h"
#include "test_macros.h"
int
main(int argc, char *argv[])
{
ps_decoder_t *ps;
cmd_ln_t *config;
acmod_t *acmod;
fsg_search_t *fsgs;
jsgf_t *jsgf;
jsgf_rule_t *rule;
fsg_model_t *fsg;
ps_seg_t *seg;
ps_lattice_t *dag;
FILE *rawfh;
char const *hyp;
int32 score, prob;
clock_t c;
int i;
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-dict", DATADIR "/turtle.dic",
"-input_endian", "little",
"-samprate", "16000", NULL));
TEST_ASSERT(ps = ps_init(config));
jsgf = jsgf_parse_file(DATADIR "/goforward.gram", NULL);
TEST_ASSERT(jsgf);
rule = jsgf_get_rule(jsgf, "goforward.move2");
TEST_ASSERT(rule);
fsg = jsgf_build_fsg(jsgf, rule, ps->lmath, 7.5);
TEST_ASSERT(fsg);
fsg_model_write(fsg, stdout);
ps_set_fsg(ps, "goforward.move2", fsg);
ps_set_search(ps, "goforward.move2");
acmod = ps->acmod;
fsgs = (fsg_search_t *) fsg_search_init(fsg, config, acmod, ps->dict, ps->d2p);
setbuf(stdout, NULL);
c = clock();
for (i = 0; i < 5; ++i) {
int16 buf[2048];
size_t nread;
int16 const *bptr;
int nfr;
int is_final;
TEST_ASSERT(rawfh = fopen(DATADIR "/goforward.raw", "rb"));
TEST_EQUAL(0, acmod_start_utt(acmod));
fsg_search_start(ps_search_base(fsgs));
is_final = FALSE;
while (!feof(rawfh)) {
nread = fread(buf, sizeof(*buf), 2048, rawfh);
bptr = buf;
while ((nfr = acmod_process_raw(acmod, &bptr, &nread, FALSE)) > 0) {
while (acmod->n_feat_frame > 0) {
fsg_search_step(ps_search_base(fsgs),
acmod->output_frame);
acmod_advance(acmod);
}
}
hyp = fsg_search_hyp(ps_search_base(fsgs), &score, &is_final);
printf("FSG: %s (%d) frame %d final %s\n", hyp, score, acmod->output_frame, is_final ? "FINAL" : "");
TEST_EQUAL (is_final, (acmod->output_frame > 86));
}
fsg_search_finish(ps_search_base(fsgs));
hyp = fsg_search_hyp(ps_search_base(fsgs), &score, NULL);
printf("FSG: %s (%d)\n", hyp, score);
TEST_ASSERT(acmod_end_utt(acmod) >= 0);
fclose(rawfh);
}
TEST_EQUAL(0, strcmp("go forward ten meters",
fsg_search_hyp(ps_search_base(fsgs), &score, NULL)));
ps->search = (ps_search_t *)fsgs;
for (seg = ps_seg_iter(ps, &score); seg;
seg = ps_seg_next(seg)) {
char const *word;
int sf, ef;
word = ps_seg_word(seg);
ps_seg_frames(seg, &sf, &ef);
printf("%s %d %d\n", word, sf, ef);
}
c = clock() - c;
printf("5 * fsg search in %.2f sec\n", (double)c / CLOCKS_PER_SEC);
dag = ps_get_lattice(ps);
ps_lattice_write(dag, "test_jsgf.lat");
jsgf_grammar_free(jsgf);
fsg_search_free(ps_search_base(fsgs));
ps_free(ps);
cmd_ln_free_r(config);
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-dict", DATADIR "/turtle.dic",
"-jsgf", DATADIR "/goforward.gram",
"-input_endian", "little",
"-samprate", "16000", NULL));
TEST_ASSERT(ps = ps_init(config));
TEST_ASSERT(rawfh = fopen(DATADIR "/goforward.raw", "rb"));
ps_decode_raw(ps, rawfh, -1);
hyp = ps_get_hyp(ps, &score);
prob = ps_get_prob(ps);
printf("%s (%d, %d)\n", hyp, score, prob);
TEST_EQUAL(0, strcmp("go forward ten meters", hyp));
ps_free(ps);
fclose(rawfh);
cmd_ln_free_r(config);
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-dict", DATADIR "/turtle.dic",
"-jsgf", DATADIR "/goforward.gram",
"-toprule", "goforward.move2",
"-input_endian", "little",
"-samprate", "16000", NULL));
TEST_ASSERT(ps = ps_init(config));
TEST_ASSERT(rawfh = fopen(DATADIR "/goforward.raw", "rb"));
ps_decode_raw(ps, rawfh, -1);
hyp = ps_get_hyp(ps, &score);
prob = ps_get_prob(ps);
printf("%s (%d, %d)\n", hyp, score, prob);
TEST_EQUAL(0, strcmp("go forward ten meters", hyp));
ps_free(ps);
cmd_ln_free_r(config);
fclose(rawfh);
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-dict", DATADIR "/turtle.dic",
"-jsgf", DATADIR "/defective.gram",
NULL));
TEST_ASSERT(NULL == ps_init(config));
cmd_ln_free_r(config);
return 0;
}
|
robojamison/hello-git | lib/sphinxbase/src/libsphinxbase/lm/lm3g_templates.c | <gh_stars>1-10
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* ====================================================================
* Copyright (c) 1999-2007 Carnegie Mellon University. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* This work was supported in part by funding from the Defense Advanced
* Research Projects Agency and the National Science Foundation of the
* United States of America, and the CMU Sphinx Speech Consortium.
*
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
* NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
*/
/*
* \file lm3g_templates.c Core Sphinx 3-gram code used in
* DMP/DMP32/ARPA (for now) model code.
*/
#include <assert.h>
/* Locate a specific bigram within a bigram list */
#define BINARY_SEARCH_THRESH 16
static int32
find_bg(bigram_t * bg, int32 n, int32 w)
{
int32 i, b, e;
/* Binary search until segment size < threshold */
b = 0;
e = n;
while (e - b > BINARY_SEARCH_THRESH) {
i = (b + e) >> 1;
if (bg[i].wid < w)
b = i + 1;
else if (bg[i].wid > w)
e = i;
else
return i;
}
/* Linear search within narrowed segment */
for (i = b; (i < e) && (bg[i].wid != w); i++);
return ((i < e) ? i : -1);
}
static int32
lm3g_bg_score(NGRAM_MODEL_TYPE *model,
int32 lw1, int32 lw2, int32 *n_used)
{
int32 i, n, b, score;
bigram_t *bg;
if (lw1 < 0 || model->base.n < 2) {
*n_used = 1;
return model->lm3g.unigrams[lw2].prob1.l;
}
b = FIRST_BG(model, lw1);
n = FIRST_BG(model, lw1 + 1) - b;
bg = model->lm3g.bigrams + b;
if ((i = find_bg(bg, n, lw2)) >= 0) {
/* Access mode = bigram */
*n_used = 2;
score = model->lm3g.prob2[bg[i].prob2].l;
}
else {
/* Access mode = unigram */
*n_used = 1;
score = model->lm3g.unigrams[lw1].bo_wt1.l + model->lm3g.unigrams[lw2].prob1.l;
}
return (score);
}
static void
load_tginfo(NGRAM_MODEL_TYPE *model, int32 lw1, int32 lw2)
{
int32 i, n, b, t;
bigram_t *bg;
tginfo_t *tginfo;
/* First allocate space for tg information for bg lw1,lw2 */
tginfo = (tginfo_t *) listelem_malloc(model->lm3g.le);
tginfo->w1 = lw1;
tginfo->tg = NULL;
tginfo->next = model->lm3g.tginfo[lw2];
model->lm3g.tginfo[lw2] = tginfo;
/* Locate bigram lw1,lw2 */
b = model->lm3g.unigrams[lw1].bigrams;
n = model->lm3g.unigrams[lw1 + 1].bigrams - b;
bg = model->lm3g.bigrams + b;
if ((n > 0) && ((i = find_bg(bg, n, lw2)) >= 0)) {
tginfo->bowt = model->lm3g.bo_wt2[bg[i].bo_wt2].l;
/* Find t = Absolute first trigram index for bigram lw1,lw2 */
b += i; /* b = Absolute index of bigram lw1,lw2 on disk */
t = FIRST_TG(model, b);
tginfo->tg = model->lm3g.trigrams + t;
/* Find #tg for bigram w1,w2 */
tginfo->n_tg = FIRST_TG(model, b + 1) - t;
}
else { /* No bigram w1,w2 */
tginfo->bowt = 0;
tginfo->n_tg = 0;
}
}
/* Similar to find_bg */
static int32
find_tg(trigram_t * tg, int32 n, uint32 w)
{
int32 i, b, e;
b = 0;
e = n;
while (e - b > BINARY_SEARCH_THRESH) {
i = (b + e) >> 1;
if (tg[i].wid < w)
b = i + 1;
else if (tg[i].wid > w)
e = i;
else
return i;
}
for (i = b; (i < e) && (tg[i].wid != w); i++);
return ((i < e) ? i : -1);
}
static int32
lm3g_tg_score(NGRAM_MODEL_TYPE *model, int32 lw1,
int32 lw2, int32 lw3, int32 *n_used)
{
ngram_model_t *base = &model->base;
int32 i, n, score;
trigram_t *tg;
tginfo_t *tginfo, *prev_tginfo;
if ((base->n < 3) || (lw1 < 0) || (lw2 < 0))
return (lm3g_bg_score(model, lw2, lw3, n_used));
prev_tginfo = NULL;
for (tginfo = model->lm3g.tginfo[lw2]; tginfo; tginfo = tginfo->next) {
if (tginfo->w1 == lw1)
break;
prev_tginfo = tginfo;
}
if (!tginfo) {
load_tginfo(model, lw1, lw2);
tginfo = model->lm3g.tginfo[lw2];
}
else if (prev_tginfo) {
prev_tginfo->next = tginfo->next;
tginfo->next = model->lm3g.tginfo[lw2];
model->lm3g.tginfo[lw2] = tginfo;
}
tginfo->used = 1;
/* Trigrams for w1,w2 now pointed to by tginfo */
n = tginfo->n_tg;
tg = tginfo->tg;
if ((i = find_tg(tg, n, lw3)) >= 0) {
/* Access mode = trigram */
*n_used = 3;
score = model->lm3g.prob3[tg[i].prob3].l;
}
else {
score = tginfo->bowt + lm3g_bg_score(model, lw2, lw3, n_used);
}
return (score);
}
static int32
lm3g_template_score(ngram_model_t *base, int32 wid,
int32 *history, int32 n_hist,
int32 *n_used)
{
NGRAM_MODEL_TYPE *model = (NGRAM_MODEL_TYPE *)base;
switch (n_hist) {
case 0:
/* Access mode: unigram */
*n_used = 1;
return model->lm3g.unigrams[wid].prob1.l;
case 1:
return lm3g_bg_score(model, history[0], wid, n_used);
case 2:
default:
/* Anything greater than 2 is the same as a trigram for now. */
return lm3g_tg_score(model, history[1], history[0], wid, n_used);
}
}
static int32
lm3g_template_raw_score(ngram_model_t *base, int32 wid,
int32 *history, int32 n_hist,
int32 *n_used)
{
NGRAM_MODEL_TYPE *model = (NGRAM_MODEL_TYPE *)base;
int32 score;
switch (n_hist) {
case 0:
/* Access mode: unigram */
*n_used = 1;
/* Undo insertion penalty. */
score = model->lm3g.unigrams[wid].prob1.l - base->log_wip;
/* Undo language weight. */
score = (int32)(score / base->lw);
/* Undo unigram interpolation */
if (strcmp(base->word_str[wid], "<s>") != 0) { /* FIXME: configurable start_sym */
/* This operation is numerically unstable, so try to avoid it
* as possible */
if (base->log_uniform + base->log_uniform_weight > logmath_get_zero(base->lmath)) {
score = logmath_log(base->lmath,
logmath_exp(base->lmath, score)
- logmath_exp(base->lmath,
base->log_uniform + base->log_uniform_weight));
}
}
return score;
case 1:
score = lm3g_bg_score(model, history[0], wid, n_used);
break;
case 2:
default:
/* Anything greater than 2 is the same as a trigram for now. */
score = lm3g_tg_score(model, history[1], history[0], wid, n_used);
break;
}
/* FIXME (maybe): This doesn't undo unigram weighting in backoff cases. */
return (int32)((score - base->log_wip) / base->lw);
}
static int32
lm3g_template_add_ug(ngram_model_t *base,
int32 wid, int32 lweight)
{
NGRAM_MODEL_TYPE *model = (NGRAM_MODEL_TYPE *)base;
return lm3g_add_ug(base, &model->lm3g, wid, lweight);
}
static void
lm3g_template_flush(ngram_model_t *base)
{
NGRAM_MODEL_TYPE *model = (NGRAM_MODEL_TYPE *)base;
lm3g_tginfo_reset(base, &model->lm3g);
}
typedef struct lm3g_iter_s {
ngram_iter_t base;
unigram_t *ug;
bigram_t *bg;
trigram_t *tg;
} lm3g_iter_t;
static ngram_iter_t *
lm3g_template_iter(ngram_model_t *base, int32 wid,
int32 *history, int32 n_hist)
{
NGRAM_MODEL_TYPE *model = (NGRAM_MODEL_TYPE *)base;
lm3g_iter_t *itor = (lm3g_iter_t *)ckd_calloc(1, sizeof(*itor));
ngram_iter_init((ngram_iter_t *)itor, base, n_hist, FALSE);
if (n_hist == 0) {
/* Unigram is the easiest. */
itor->ug = model->lm3g.unigrams + wid;
return (ngram_iter_t *)itor;
}
else if (n_hist == 1) {
int32 i, n, b;
/* Find the bigram, as in bg_score above (duplicate code...) */
itor->ug = model->lm3g.unigrams + history[0];
b = FIRST_BG(model, history[0]);
n = FIRST_BG(model, history[0] + 1) - b;
itor->bg = model->lm3g.bigrams + b;
/* If no such bigram exists then fail. */
if ((i = find_bg(itor->bg, n, wid)) < 0) {
ngram_iter_free((ngram_iter_t *)itor);
return NULL;
}
itor->bg += i;
return (ngram_iter_t *)itor;
}
else if (n_hist == 2) {
int32 i, n;
tginfo_t *tginfo, *prev_tginfo;
/* Find the trigram, as in tg_score above (duplicate code...) */
itor->ug = model->lm3g.unigrams + history[1];
prev_tginfo = NULL;
for (tginfo = model->lm3g.tginfo[history[0]];
tginfo; tginfo = tginfo->next) {
if (tginfo->w1 == history[1])
break;
prev_tginfo = tginfo;
}
if (!tginfo) {
load_tginfo(model, history[1], history[0]);
tginfo = model->lm3g.tginfo[history[0]];
}
else if (prev_tginfo) {
prev_tginfo->next = tginfo->next;
tginfo->next = model->lm3g.tginfo[history[0]];
model->lm3g.tginfo[history[0]] = tginfo;
}
tginfo->used = 1;
/* Trigrams for w1,w2 now pointed to by tginfo */
n = tginfo->n_tg;
itor->tg = tginfo->tg;
if ((i = find_tg(itor->tg, n, wid)) >= 0) {
itor->tg += i;
/* Now advance the bigram pointer accordingly. FIXME:
* Note that we actually already found the relevant bigram
* in load_tginfo. */
itor->bg = model->lm3g.bigrams;
while (FIRST_TG(model, (itor->bg - model->lm3g.bigrams + 1))
<= (itor->tg - model->lm3g.trigrams))
++itor->bg;
return (ngram_iter_t *)itor;
}
else {
ngram_iter_free((ngram_iter_t *)itor);
return (ngram_iter_t *)NULL;
}
}
else {
/* Should not happen. */
assert(n_hist == 0); /* Guaranteed to fail. */
ngram_iter_free((ngram_iter_t *)itor);
return NULL;
}
}
static ngram_iter_t *
lm3g_template_mgrams(ngram_model_t *base, int m)
{
NGRAM_MODEL_TYPE *model = (NGRAM_MODEL_TYPE *)base;
lm3g_iter_t *itor = (lm3g_iter_t *)ckd_calloc(1, sizeof(*itor));
ngram_iter_init((ngram_iter_t *)itor, base, m, FALSE);
itor->ug = model->lm3g.unigrams;
itor->bg = model->lm3g.bigrams;
itor->tg = model->lm3g.trigrams;
/* Advance bigram pointer to match first trigram. */
if (m > 1 && base->n_counts[1] > 1) {
while (FIRST_TG(model, (itor->bg - model->lm3g.bigrams + 1))
<= (itor->tg - model->lm3g.trigrams))
++itor->bg;
}
/* Advance unigram pointer to match first bigram. */
if (m > 0 && base->n_counts[0] > 1) {
while (itor->ug[1].bigrams <= (itor->bg - model->lm3g.bigrams))
++itor->ug;
}
return (ngram_iter_t *)itor;
}
static ngram_iter_t *
lm3g_template_successors(ngram_iter_t *bitor)
{
NGRAM_MODEL_TYPE *model = (NGRAM_MODEL_TYPE *)bitor->model;
lm3g_iter_t *from = (lm3g_iter_t *)bitor;
lm3g_iter_t *itor = (lm3g_iter_t *)ckd_calloc(1, sizeof(*itor));
itor->ug = from->ug;
switch (bitor->m) {
case 0:
/* Next itor bigrams is the same as this itor bigram or
itor bigrams is more than total count. This means no successors */
if (((itor->ug + 1) - model->lm3g.unigrams < bitor->model->n_counts[0] &&
itor->ug->bigrams == (itor->ug + 1)->bigrams) ||
itor->ug->bigrams == bitor->model->n_counts[1])
goto done;
/* Start iterating from first bigram successor of from->ug. */
itor->bg = model->lm3g.bigrams + itor->ug->bigrams;
break;
case 1:
itor->bg = from->bg;
/* This indicates no successors */
if (((itor->bg + 1) - model->lm3g.bigrams < bitor->model->n_counts[1] &&
FIRST_TG (model, itor->bg - model->lm3g.bigrams) ==
FIRST_TG (model, (itor->bg + 1) - model->lm3g.bigrams)) ||
FIRST_TG (model, itor->bg - model->lm3g.bigrams) == bitor->model->n_counts[2])
goto done;
/* Start iterating from first trigram successor of from->bg. */
itor->tg = (model->lm3g.trigrams
+ FIRST_TG(model, (itor->bg - model->lm3g.bigrams)));
#if 0
printf("%s %s => %d (%s)\n",
model->base.word_str[itor->ug - model->lm3g.unigrams],
model->base.word_str[itor->bg->wid],
FIRST_TG(model, (itor->bg - model->lm3g.bigrams)),
model->base.word_str[itor->tg->wid]);
#endif
break;
case 2:
default:
/* All invalid! */
goto done;
}
ngram_iter_init((ngram_iter_t *)itor, bitor->model, bitor->m + 1, TRUE);
return (ngram_iter_t *)itor;
done:
ckd_free(itor);
return NULL;
}
static int32 const *
lm3g_template_iter_get(ngram_iter_t *base,
int32 *out_score, int32 *out_bowt)
{
NGRAM_MODEL_TYPE *model = (NGRAM_MODEL_TYPE *)base->model;
lm3g_iter_t *itor = (lm3g_iter_t *)base;
base->wids[0] = itor->ug - model->lm3g.unigrams;
if (itor->bg) base->wids[1] = itor->bg->wid;
if (itor->tg) base->wids[2] = itor->tg->wid;
#if 0
printf("itor_get: %d %d %d\n", base->wids[0], base->wids[1], base->wids[2]);
#endif
switch (base->m) {
case 0:
*out_score = itor->ug->prob1.l;
*out_bowt = itor->ug->bo_wt1.l;
break;
case 1:
*out_score = model->lm3g.prob2[itor->bg->prob2].l;
if (model->lm3g.bo_wt2)
*out_bowt = model->lm3g.bo_wt2[itor->bg->bo_wt2].l;
else
*out_bowt = 0;
break;
case 2:
*out_score = model->lm3g.prob3[itor->tg->prob3].l;
*out_bowt = 0;
break;
default: /* Should not happen. */
return NULL;
}
return base->wids;
}
static ngram_iter_t *
lm3g_template_iter_next(ngram_iter_t *base)
{
NGRAM_MODEL_TYPE *model = (NGRAM_MODEL_TYPE *)base->model;
lm3g_iter_t *itor = (lm3g_iter_t *)base;
switch (base->m) {
case 0:
++itor->ug;
/* Check for end condition. */
if (itor->ug - model->lm3g.unigrams >= base->model->n_counts[0])
goto done;
break;
case 1:
++itor->bg;
/* Check for end condition. */
if (itor->bg - model->lm3g.bigrams >= base->model->n_counts[1])
goto done;
/* Advance unigram pointer if necessary in order to get one
* that points to this bigram. */
while (itor->bg - model->lm3g.bigrams >= itor->ug[1].bigrams) {
/* Stop if this is a successor iterator, since we don't
* want a new unigram. */
if (base->successor)
goto done;
++itor->ug;
if (itor->ug == model->lm3g.unigrams + base->model->n_counts[0]) {
E_ERROR("Bigram %d has no valid unigram parent\n",
itor->bg - model->lm3g.bigrams);
goto done;
}
}
break;
case 2:
++itor->tg;
/* Check for end condition. */
if (itor->tg - model->lm3g.trigrams >= base->model->n_counts[2])
goto done;
/* Advance bigram pointer if necessary. */
while (itor->tg - model->lm3g.trigrams >=
FIRST_TG(model, (itor->bg - model->lm3g.bigrams + 1))) {
if (base->successor)
goto done;
++itor->bg;
if (itor->bg == model->lm3g.bigrams + base->model->n_counts[1]) {
E_ERROR("Trigram %d has no valid bigram parent\n",
itor->tg - model->lm3g.trigrams);
goto done;
}
}
/* Advance unigram pointer if necessary. */
while (itor->bg - model->lm3g.bigrams >= itor->ug[1].bigrams) {
++itor->ug;
if (itor->ug == model->lm3g.unigrams + base->model->n_counts[0]) {
E_ERROR("Trigram %d has no valid unigram parent\n",
itor->tg - model->lm3g.trigrams);
goto done;
}
}
break;
default: /* Should not happen. */
goto done;
}
return (ngram_iter_t *)itor;
done:
ngram_iter_free(base);
return NULL;
}
static void
lm3g_template_iter_free(ngram_iter_t *base)
{
ckd_free(base);
}
|
robojamison/hello-git | lib/sphinxbase/src/libsphinxad/ad_jack.c | <filename>lib/sphinxbase/src/libsphinxad/ad_jack.c
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* ====================================================================
* Copyright (c) 2011 <NAME>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY <NAME> ``AS IS'' AND
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
* NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <limits.h>
#include "prim_type.h"
#include "ad.h"
#include <jack/jack.h>
#include <jack/jack.h>
#include <jack/ringbuffer.h>
#ifdef HAVE_SAMPLERATE_H
#include <samplerate.h>
#endif
#define DEFAULT_DEVICE "system:capture_1"
#define BUFFER_SIZE 352800
struct ad_rec_s {
jack_client_t *client;
jack_port_t *input_port;
jack_port_t *output_port;
jack_ringbuffer_t* rbuffer;
jack_default_audio_sample_t* sample_buffer;
int32 recording;
int32 sps;
int32 bps;
#ifdef HAVE_SAMPLERATE_H
SRC_STATE *resample_state;
jack_default_audio_sample_t *resample_buffer;
#endif
};
/* #define MIC_SPEAKER_PASSTHROUGH_DEBUG */
const size_t sample_size = sizeof(jack_default_audio_sample_t);
const size_t int16_range_over_two = (-SHRT_MIN + SHRT_MAX) / 2.0;
int
process (jack_nframes_t nframes, void *arg)
{
ad_rec_t *handle = (ad_rec_t *) arg;
size_t buffer_size = jack_ringbuffer_write_space (handle->rbuffer);
jack_default_audio_sample_t *in = (jack_default_audio_sample_t *) jack_port_get_buffer (handle->input_port, nframes);
if (buffer_size <= 0) {
fprintf(stderr, "JACK: buffer is full. Deactivating JACK client.\n");
return 1;
}
/* Write to jack ringbuffer which should be thread safe */
jack_ringbuffer_write (handle->rbuffer, (char*) in, sample_size * nframes);
#ifdef MIC_SPEAKER_PASSTHROUGH_DEBUG
jack_default_audio_sample_t *out = (jack_default_audio_sample_t *) jack_port_get_buffer (handle->output_port, nframes);
/* Output mic output to speakers (Just for testing) */
memcpy (out, in, sample_size * nframes);
#endif
return 0;
}
void
error (const char *desc)
{
fprintf (stderr, "JACK error: %s\n", desc);
}
void
jack_shutdown (void *arg)
{
exit(1);
}
int
srate (jack_nframes_t nframes, void *arg)
{
printf ("JACK: The sample rate is now %u/sec\n", nframes);
return 0;
}
ad_rec_t *
ad_open_dev(const char *dev, int32 sps)
{
ad_rec_t *handle;
const char **ports;
#ifdef HAVE_SAMPLERATE_H
int resample_error;
double samplerates_ratio;
jack_nframes_t jack_samplerate;
#endif
if (dev == NULL) {
dev = DEFAULT_DEVICE;
}
printf("JACK: Setting default device: %s\n", dev);
if ((handle = (ad_rec_t *) calloc(1, sizeof(ad_rec_t))) == NULL) {
fprintf(stderr, "calloc(%d) failed\n", (int)sizeof(ad_rec_t));
abort();
}
/* Tell the JACK server to call error() whenever it
experiences an error.
*/
jack_set_error_function (error);
/* Try to become a client of the JACK server */
if ((handle->client = jack_client_open ("jack_ad", (jack_options_t)0, NULL)) == 0) {
fprintf (stderr, "jack server not running?\n");
return NULL;
}
#ifdef HAVE_SAMPLERATE_H
handle->resample_buffer = malloc(BUFFER_SIZE);
jack_samplerate = jack_get_sample_rate(handle->client);
samplerates_ratio = (double)((double)jack_samplerate / (double)sps);
handle->rbuffer = jack_ringbuffer_create((int)((double)BUFFER_SIZE * samplerates_ratio));
handle->sample_buffer = malloc((int)((double)BUFFER_SIZE * samplerates_ratio));
#else
handle->rbuffer = jack_ringbuffer_create(BUFFER_SIZE);
handle->sample_buffer = malloc(BUFFER_SIZE);
#endif
if(handle->rbuffer == NULL) {
fprintf (stderr, "Failed to create jack ringbuffer\n");
return NULL;
}
/* Tell the JACK server to call `process()' whenever
there is work to be done.
*/
jack_set_process_callback (handle->client, process, handle);
/* Tell the JACK server to call `srate()' whenever
the sample rate of the system changes.
*/
jack_set_sample_rate_callback (handle->client, srate, 0);
/* Tell the JACK server to call `jack_shutdown()' if
it ever shuts down, either entirely, or if it
just decides to stop calling us.
*/
jack_on_shutdown (handle->client, jack_shutdown, 0);
/* Create the input port */
if((handle->input_port = jack_port_register (handle->client, "jack_ad_input", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0)) == 0) {
fprintf (stderr, "cannot register input port!\n");
return NULL;
}
if((handle->output_port = jack_port_register (handle->client, "jack_ad_output", JACK_DEFAULT_AUDIO_TYPE, JackPortIsPhysical|JackPortIsOutput, 0)) == 0) {
fprintf (stderr, "cannot register output port!\n");
return NULL;
}
/* Tell the JACK server that we are ready to start */
if (jack_activate (handle->client)) {
fprintf (stderr, "cannot activate client");
return NULL;
}
/* Connect the ports. Note: you can't do this before
the client is activated, because we can't allow
connections to be made to clients that aren't
running.
*/
if ((ports = jack_get_ports (handle->client, dev, NULL, JackPortIsOutput)) == NULL) {
fprintf(stderr, "Cannot find any physical capture ports\n");
return NULL;
}
if (jack_connect (handle->client, ports[0], jack_port_name (handle->input_port))) {
fprintf (stderr, "cannot connect input ports\n");
return NULL;
}
free (ports);
#ifdef MIC_SPEAKER_PASSTHROUGH_DEBUG
int i;
if ((ports = jack_get_ports (handle->client, "system:playback", NULL,
JackPortIsPhysical|JackPortIsInput)) == NULL) {
fprintf(stderr, "Cannot find any physical playback ports\n");
return NULL;
}
for (i = 0; ports[i] != NULL; i++) {
if (jack_connect (handle->client, jack_port_name (handle->output_port), ports[i])) {
fprintf (stderr, "cannot connect output ports\n");
}
}
free (ports);
#endif
#ifdef HAVE_SAMPLERATE_H
/* Initialize the sample rate converter. */
if ((handle->resample_state = src_new (SRC_SINC_BEST_QUALITY, 1, &resample_error)) == NULL) {
fprintf (stderr, "Error : src_new() failed: %s\n", src_strerror(resample_error));
return NULL;
}
#endif
handle->recording = 0;
handle->sps = sps;
handle->bps = sizeof(int16);
/* Give the jack process callback time to run ? */
sleep (1);
return (ad_rec_t *) handle;
}
ad_rec_t *
ad_open_sps(int32 sps)
{
/* Ignored the sps has to set for the jackd server */
return ad_open_dev(DEFAULT_DEVICE, sps);
}
ad_rec_t *
ad_open(void)
{
return ad_open_sps(DEFAULT_SAMPLES_PER_SEC);
}
int32
ad_close(ad_rec_t * handle)
{
free (handle->sample_buffer);
#ifdef HAVE_SAMPLERATE_H
free (handle->resample_buffer);
#endif
jack_ringbuffer_free (handle->rbuffer);
jack_client_close (handle->client);
free(handle);
return 0;
}
int32
ad_start_rec(ad_rec_t * handle)
{
if (handle->recording)
return AD_ERR_GEN;
handle->recording = 1;
return 0;
}
int32
ad_stop_rec(ad_rec_t * handle)
{
handle->recording = 0;
return 0;
}
int32
ad_read(ad_rec_t * handle, int16 * buf, int32 max)
{
int i;
#ifdef HAVE_SAMPLERATE_H
int resample_error;
#endif
if (!handle->recording)
return AD_EOF;
size_t length = sample_size * max;
#ifdef HAVE_SAMPLERATE_H
/* Resample the data from the sample rate set in the jack server to that required
* by sphinx */
length = jack_ringbuffer_peek (handle->rbuffer, (char*) handle->sample_buffer, length);
size_t length_in_samples = length / sample_size;
if(handle->resample_state == NULL)
return AD_EOF;
/* We will try to downsample if jackd is running at a higher sample rate */
jack_nframes_t jack_samplerate = jack_get_sample_rate(handle->client);
SRC_DATA data;
data.data_in = handle->sample_buffer;
data.input_frames = length_in_samples;
data.data_out = handle->resample_buffer;
data.output_frames = BUFFER_SIZE / sample_size;
data.src_ratio = (float) handle->sps / jack_samplerate;
data.end_of_input = 0;
if ((resample_error = src_process(handle->resample_state, &data)) != 0) {
fprintf (stderr, "resample error %s\n", src_strerror (resample_error));
return 1;
}
for(i = 0; i < data.output_frames_gen; i++) {
buf[i] = (int16) (int16_range_over_two * (handle->resample_buffer[i] + 1.0) + SHRT_MIN);
}
jack_ringbuffer_read_advance(handle->rbuffer, data.input_frames_used * sample_size);
if(length == 0 && (!handle->recording)) {
return AD_EOF;
}
return data.output_frames_gen;
#else
length = jack_ringbuffer_read (handle->rbuffer, (char*) handle->sample_buffer, length);
size_t length_in_samples = length / sample_size;
for(i = 0; i < length_in_samples; i++) {
buf[i] = (int16) (int16_range_over_two * (handle->sample_buffer[i] + 1.0) + SHRT_MIN);
}
if(length == 0 && (!handle->recording)) {
return AD_EOF;
}
return length_in_samples;
#endif
}
|
robojamison/hello-git | lib/pocketsphinx/test/unit/test_mllr.c | #include <pocketsphinx.h>
#include <stdio.h>
#include <string.h>
#include "pocketsphinx_internal.h"
#include "test_macros.h"
#include "ps_test.c"
int
main(int argc, char *argv[])
{
cmd_ln_t *config;
ps_decoder_t *ps;
FILE *rawfh;
char const *hyp;
int32 score;
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", DATADIR "/an4_ci_cont",
"-lm", DATADIR "/turtle.lm.dmp",
"-dict", DATADIR "/turtle.dic",
"-mllr", DATADIR "/mllr_matrices",
"-samprate", "16000", NULL));
TEST_ASSERT(ps = ps_init(config));
TEST_ASSERT(rawfh = fopen(DATADIR "/goforward.raw", "rb"));
ps_decode_raw(ps, rawfh, -1);
fclose(rawfh);
hyp = ps_get_hyp(ps, &score);
printf("FWDFLAT: %s (%d)\n", hyp, score);
ps_free(ps);
cmd_ln_free_r(config);
return 0;
}
|
robojamison/hello-git | lib/pocketsphinx/test/unit/test_lm_read.c | #include <stdio.h>
#include <string.h>
#include <pocketsphinx.h>
#include "test_macros.h"
int
main(int argc, char *argv[])
{
char const *hyp;
ps_decoder_t *ps;
cmd_ln_t *config;
ngram_model_t *lm;
FILE *rawfh;
int32 score;
/* First decode it with the crappy WSJ language model. */
TEST_ASSERT(config =
cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-lm", MODELDIR "/en-us/en-us.lm.dmp",
"-dict", DATADIR "/defective.dic",
"-dictcase", "yes",
"-input_endian", "little",
"-samprate", "16000", NULL));
TEST_ASSERT(ps = ps_init(config));
TEST_ASSERT(rawfh = fopen(DATADIR "/goforward.raw", "rb"));
ps_decode_raw(ps, rawfh, -1);
hyp = ps_get_hyp(ps, &score);
printf("%s (%d)\n", hyp, score);
TEST_EQUAL(0, strcmp(hyp, "go forward ten years"));
/* Now load the turtle language model. */
lm = ngram_model_read(config, DATADIR "/turtle.lm.dmp",
NGRAM_AUTO, ps_get_logmath(ps));
ps_set_lm(ps, "turtle", lm);
ps_set_search(ps, "turtle");
clearerr(rawfh);
fseek(rawfh, 0, SEEK_SET);
TEST_ASSERT(ps_decode_raw(ps, rawfh, -1));
hyp = ps_get_hyp(ps, &score);
printf("%s (%d)\n", hyp, score);
/* Oops! It's still not correct, because METERS isn't in the
* dictionary that we originally loaded. */
TEST_EQUAL(0, strcmp(hyp, "go forward ten degrees"));
/* So let's add it to the dictionary. */
ps_add_word(ps, "foobie", "F UW B IY", FALSE);
ps_add_word(ps, "meters", "M IY T ER Z", TRUE);
/* And try again. */
clearerr(rawfh);
fseek(rawfh, 0, SEEK_SET);
TEST_ASSERT(ps_decode_raw(ps, rawfh, -1));
hyp = ps_get_hyp(ps, &score);
TEST_ASSERT(hyp);
printf("%s (%d)\n", hyp, score);
ps_lattice_write(ps_get_lattice(ps), "meters.lat");
/* Bingo! */
TEST_EQUAL(0, strcmp(hyp, "go forward ten meters"));
/* Now let's test dictionary switching. */
TEST_EQUAL(-1,
ps_load_dict(ps, DATADIR "/turtle_missing_file.dic",
NULL, NULL));
/* Now let's test dictionary switching. */
TEST_EQUAL(0, ps_load_dict(ps, DATADIR "/turtle.dic",
NULL, NULL));
/* And try again. */
clearerr(rawfh);
fseek(rawfh, 0, SEEK_SET);
TEST_ASSERT(ps_decode_raw(ps, rawfh, -1));
hyp = ps_get_hyp(ps, &score);
printf("%s (%d)\n", hyp, score);
TEST_EQUAL(0, strcmp(hyp, "go forward ten meters"));
/* Try switching back again just to make sure. */
TEST_EQUAL(0, ps_load_dict(ps, DATADIR "/defective.dic", NULL, NULL));
clearerr(rawfh);
fseek(rawfh, 0, SEEK_SET);
TEST_ASSERT(ps_decode_raw(ps, rawfh, -1));
hyp = ps_get_hyp(ps, &score);
printf("%s (%d)\n", hyp, score);
TEST_EQUAL(0, strcmp(hyp, "go forward ten degrees"));
fclose(rawfh);
ps_free(ps);
cmd_ln_free_r(config);
return 0;
}
|
robojamison/hello-git | lib/sphinxbase/src/libsphinxbase/util/cmd_ln.c | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* ====================================================================
* Copyright (c) 1999-2004 Carnegie Mellon University. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* This work was supported in part by funding from the Defense Advanced
* Research Projects Agency and the National Science Foundation of the
* United States of America, and the CMU Sphinx Speech Consortium.
*
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
* NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
*/
/*
* cmd_ln.c -- Command line argument parsing.
*
* **********************************************
* CMU ARPA Speech Project
*
* Copyright (c) 1999 Carnegie Mellon University.
* ALL RIGHTS RESERVED.
* **********************************************
*
* HISTORY
*
* 10-Sep-1998 <NAME> (<EMAIL>) at Carnegie Mellon University
* Changed strcasecmp() call in cmp_name() to strcmp_nocase() call.
*
* 15-Jul-1997 <NAME> (<EMAIL>) at Carnegie Mellon University
* Added required arguments handling.
*
* 07-Dec-96 <NAME> (<EMAIL>) at Carnegie Mellon University
* Created, based on Eric's implementation. Basically, combined several
* functions into one, eliminated validation, and simplified the interface.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#ifdef _MSC_VER
#pragma warning (disable: 4996 4018)
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "sphinxbase/cmd_ln.h"
#include "sphinxbase/err.h"
#include "sphinxbase/ckd_alloc.h"
#include "sphinxbase/hash_table.h"
#include "sphinxbase/case.h"
#include "sphinxbase/strfuncs.h"
typedef struct cmd_ln_val_s {
anytype_t val;
int type;
} cmd_ln_val_t;
struct cmd_ln_s {
int refcount;
hash_table_t *ht;
char **f_argv;
uint32 f_argc;
};
/** Global command-line, for non-reentrant API. */
cmd_ln_t *global_cmdln;
static void
arg_dump_r(cmd_ln_t *, FILE *, arg_t const *, int32);
static cmd_ln_t *
parse_options(cmd_ln_t *, const arg_t *, int32, char* [], int32);
/*
* Find max length of name and default fields in the given defn array.
* Return #items in defn array.
*/
static int32
arg_strlen(const arg_t * defn, int32 * namelen, int32 * deflen)
{
int32 i, l;
*namelen = *deflen = 0;
for (i = 0; defn[i].name; i++) {
l = strlen(defn[i].name);
if (*namelen < l)
*namelen = l;
if (defn[i].deflt)
l = strlen(defn[i].deflt);
else
l = strlen("(null)");
/* E_INFO("string default, %s , name %s, length %d\n",defn[i].deflt,defn[i].name,l); */
if (*deflen < l)
*deflen = l;
}
return i;
}
static int32
cmp_name(const void *a, const void *b)
{
return (strcmp_nocase
((* (arg_t**) a)->name,
(* (arg_t**) b)->name));
}
static arg_t const **
arg_sort(const arg_t * defn, int32 n)
{
const arg_t ** pos;
int32 i;
pos = (arg_t const **) ckd_calloc(n, sizeof(arg_t *));
for (i = 0; i < n; ++i)
pos[i] = &defn[i];
qsort(pos, n, sizeof(arg_t *), cmp_name);
return pos;
}
static size_t
strnappend(char **dest, size_t *dest_allocation,
const char *source, size_t n)
{
size_t source_len, required_allocation;
if (dest == NULL || dest_allocation == NULL)
return -1;
if (*dest == NULL && *dest_allocation != 0)
return -1;
if (source == NULL)
return *dest_allocation;
source_len = strlen(source);
if (n && n < source_len)
source_len = n;
required_allocation = (*dest ? strlen(*dest) : 0) + source_len + 1;
if (*dest_allocation < required_allocation) {
if (*dest_allocation == 0) {
*dest = (char *)ckd_calloc(required_allocation * 2, 1);
} else {
*dest = (char *)ckd_realloc(*dest, required_allocation * 2);
}
*dest_allocation = required_allocation * 2;
}
strncat(*dest, source, source_len);
return *dest_allocation;
}
static size_t
strappend(char **dest, size_t *dest_allocation,
const char *source)
{
return strnappend(dest, dest_allocation, source, 0);
}
static char*
arg_resolve_env(const char *str)
{
char *resolved_str = NULL;
char env_name[100];
const char *env_val;
size_t alloced = 0;
const char *i = str, *j;
/* calculate required resolved_str size */
do {
j = strstr(i, "$(");
if (j != NULL) {
if (j != i) {
strnappend(&resolved_str, &alloced, i, j - i);
i = j;
}
j = strchr(i + 2, ')');
if (j != NULL) {
if (j - (i + 2) < 100) {
strncpy(env_name, i + 2, j - (i + 2));
env_name[j - (i + 2)] = '\0';
#if !defined(_WIN32_WCE)
env_val = getenv(env_name);
if (env_val)
strappend(&resolved_str, &alloced, env_val);
#else
env_val = 0;
#endif
}
i = j + 1;
} else {
/* unclosed, copy and skip */
j = i + 2;
strnappend(&resolved_str, &alloced, i, j - i);
i = j;
}
} else {
strappend(&resolved_str, &alloced, i);
}
} while(j != NULL);
return resolved_str;
}
static void
arg_dump_r(cmd_ln_t *cmdln, FILE *fp, const arg_t * defn, int32 doc)
{
arg_t const **pos;
int32 i, n;
size_t l;
int32 namelen, deflen;
anytype_t *vp;
char const **array;
/* No definitions, do nothing. */
if (defn == NULL || fp == NULL)
return;
/* Find max lengths of name and default value fields, and #entries in defn */
n = arg_strlen(defn, &namelen, &deflen);
/* E_INFO("String length %d. Name length %d, Default Length %d\n",n, namelen, deflen); */
namelen = namelen & 0xfffffff8; /* Previous tab position */
deflen = deflen & 0xfffffff8; /* Previous tab position */
fprintf(fp, "[NAME]");
for (l = strlen("[NAME]"); l < namelen; l += 8)
fprintf(fp, "\t");
fprintf(fp, "\t[DEFLT]");
for (l = strlen("[DEFLT]"); l < deflen; l += 8)
fprintf(fp, "\t");
if (doc) {
fprintf(fp, "\t[DESCR]\n");
}
else {
fprintf(fp, "\t[VALUE]\n");
}
/* Print current configuration, sorted by name */
pos = arg_sort(defn, n);
for (i = 0; i < n; i++) {
fprintf(fp, "%s", pos[i]->name);
for (l = strlen(pos[i]->name); l < namelen; l += 8)
fprintf(fp, "\t");
fprintf(fp, "\t");
if (pos[i]->deflt) {
fprintf(fp, "%s", pos[i]->deflt);
l = strlen(pos[i]->deflt);
}
else
l = 0;
for (; l < deflen; l += 8)
fprintf(fp, "\t");
fprintf(fp, "\t");
if (doc) {
if (pos[i]->doc)
fprintf(fp, "%s", pos[i]->doc);
}
else {
vp = cmd_ln_access_r(cmdln, pos[i]->name);
if (vp) {
switch (pos[i]->type) {
case ARG_INTEGER:
case REQARG_INTEGER:
fprintf(fp, "%ld", vp->i);
break;
case ARG_FLOATING:
case REQARG_FLOATING:
fprintf(fp, "%e", vp->fl);
break;
case ARG_STRING:
case REQARG_STRING:
if (vp->ptr)
fprintf(fp, "%s", (char *)vp->ptr);
break;
case ARG_STRING_LIST:
array = (char const**)vp->ptr;
if (array)
for (l = 0; array[l] != 0; l++) {
fprintf(fp, "%s,", array[l]);
}
break;
case ARG_BOOLEAN:
case REQARG_BOOLEAN:
fprintf(fp, "%s", vp->i ? "yes" : "no");
break;
default:
E_ERROR("Unknown argument type: %d\n", pos[i]->type);
}
}
}
fprintf(fp, "\n");
}
ckd_free(pos);
fprintf(fp, "\n");
}
static char **
parse_string_list(const char *str)
{
int count, i, j;
const char *p;
char **result;
p = str;
count = 1;
while (*p) {
if (*p == ',')
count++;
p++;
}
/* Should end with NULL */
result = (char **) ckd_calloc(count + 1, sizeof(char *));
p = str;
for (i = 0; i < count; i++) {
for (j = 0; p[j] != ',' && p[j] != 0; j++);
result[i] = (char *)ckd_calloc(j + 1, sizeof(char));
strncpy( result[i], p, j);
p = p + j + 1;
}
return result;
}
static cmd_ln_val_t *
cmd_ln_val_init(int t, const char *str)
{
cmd_ln_val_t *v;
anytype_t val;
char *e_str;
if (!str) {
/* For lack of a better default value. */
memset(&val, 0, sizeof(val));
}
else {
int valid = 1;
e_str = arg_resolve_env(str);
switch (t) {
case ARG_INTEGER:
case REQARG_INTEGER:
if (sscanf(e_str, "%ld", &val.i) != 1)
valid = 0;
break;
case ARG_FLOATING:
case REQARG_FLOATING:
if (e_str == NULL || e_str[0] == 0)
valid = 0;
val.fl = atof_c(e_str);
break;
case ARG_BOOLEAN:
case REQARG_BOOLEAN:
if ((e_str[0] == 'y') || (e_str[0] == 't') ||
(e_str[0] == 'Y') || (e_str[0] == 'T') || (e_str[0] == '1')) {
val.i = TRUE;
}
else if ((e_str[0] == 'n') || (e_str[0] == 'f') ||
(e_str[0] == 'N') || (e_str[0] == 'F') |
(e_str[0] == '0')) {
val.i = FALSE;
}
else {
E_ERROR("Unparsed boolean value '%s'\n", str);
valid = 0;
}
break;
case ARG_STRING:
case REQARG_STRING:
val.ptr = ckd_salloc(e_str);
break;
case ARG_STRING_LIST:
val.ptr = parse_string_list(e_str);
break;
default:
E_ERROR("Unknown argument type: %d\n", t);
valid = 0;
}
ckd_free(e_str);
if (valid == 0)
return NULL;
}
v = (cmd_ln_val_t *)ckd_calloc(1, sizeof(*v));
memcpy(v, &val, sizeof(val));
v->type = t;
return v;
}
/*
* Handles option parsing for cmd_ln_parse_file_r() and cmd_ln_init()
* also takes care of storing argv.
* DO NOT call it from cmd_ln_parse_r()
*/
static cmd_ln_t *
parse_options(cmd_ln_t *cmdln, const arg_t *defn, int32 argc, char* argv[], int32 strict)
{
cmd_ln_t *new_cmdln;
new_cmdln = cmd_ln_parse_r(cmdln, defn, argc, argv, strict);
/* If this failed then clean up and return NULL. */
if (new_cmdln == NULL) {
int32 i;
for (i = 0; i < argc; ++i)
ckd_free(argv[i]);
ckd_free(argv);
return NULL;
}
/* Otherwise, we need to add the contents of f_argv to the new object. */
if (new_cmdln == cmdln) {
/* If we are adding to a previously passed-in cmdln, then
* store our allocated strings in its f_argv. */
new_cmdln->f_argv = (char **)ckd_realloc(new_cmdln->f_argv,
(new_cmdln->f_argc + argc)
* sizeof(*new_cmdln->f_argv));
memcpy(new_cmdln->f_argv + new_cmdln->f_argc, argv,
argc * sizeof(*argv));
ckd_free(argv);
new_cmdln->f_argc += argc;
}
else {
/* Otherwise, store f_argc and f_argv. */
new_cmdln->f_argc = argc;
new_cmdln->f_argv = argv;
}
return new_cmdln;
}
void
cmd_ln_val_free(cmd_ln_val_t *val)
{
int i;
if (val->type & ARG_STRING_LIST) {
char ** array = (char **)val->val.ptr;
if (array) {
for (i = 0; array[i] != NULL; i++) {
ckd_free(array[i]);
}
ckd_free(array);
}
}
if (val->type & ARG_STRING)
ckd_free(val->val.ptr);
ckd_free(val);
}
cmd_ln_t *
cmd_ln_get(void)
{
return global_cmdln;
}
void
cmd_ln_appl_enter(int argc, char *argv[],
const char *default_argfn,
const arg_t * defn)
{
/* Look for default or specified arguments file */
const char *str;
str = NULL;
if ((argc == 2) && (strcmp(argv[1], "help") == 0)) {
cmd_ln_print_help(stderr, defn);
exit(1);
}
if ((argc == 2) && (argv[1][0] != '-'))
str = argv[1];
else if (argc == 1) {
FILE *fp;
E_INFO("Looking for default argument file: %s\n", default_argfn);
if ((fp = fopen(default_argfn, "r")) == NULL) {
E_INFO("Can't find default argument file %s.\n",
default_argfn);
}
else {
str = default_argfn;
}
if (fp != NULL)
fclose(fp);
}
if (str) {
/* Build command line argument list from file */
E_INFO("Parsing command lines from file %s\n", str);
if (cmd_ln_parse_file(defn, str, TRUE)) {
E_INFOCONT("Usage:\n");
E_INFOCONT("\t%s argument-list, or\n", argv[0]);
E_INFOCONT("\t%s [argument-file] (default file: . %s)\n\n",
argv[0], default_argfn);
cmd_ln_print_help(stderr, defn);
exit(1);
}
}
else {
cmd_ln_parse(defn, argc, argv, TRUE);
}
}
void
cmd_ln_appl_exit()
{
cmd_ln_free();
}
cmd_ln_t *
cmd_ln_parse_r(cmd_ln_t *inout_cmdln, const arg_t * defn, int32 argc, char *argv[], int strict)
{
int32 i, j, n, argstart;
hash_table_t *defidx = NULL;
cmd_ln_t *cmdln;
/* Construct command-line object */
if (inout_cmdln == NULL) {
cmdln = (cmd_ln_t*)ckd_calloc(1, sizeof(*cmdln));
cmdln->refcount = 1;
}
else
cmdln = inout_cmdln;
/* Build a hash table for argument definitions */
defidx = hash_table_new(50, 0);
if (defn) {
for (n = 0; defn[n].name; n++) {
void *v;
v = hash_table_enter(defidx, defn[n].name, (void *)&defn[n]);
if (strict && (v != &defn[n])) {
E_ERROR("Duplicate argument name in definition: %s\n", defn[n].name);
goto error;
}
}
}
else {
/* No definitions. */
n = 0;
}
/* Allocate memory for argument values */
if (cmdln->ht == NULL)
cmdln->ht = hash_table_new(n, 0 /* argument names are case-sensitive */ );
/* skip argv[0] if it doesn't start with dash */
argstart = 0;
if (argc > 0 && argv[0][0] != '-') {
argstart = 1;
}
/* Parse command line arguments (name-value pairs) */
for (j = argstart; j < argc; j += 2) {
arg_t *argdef;
cmd_ln_val_t *val;
void *v;
if (hash_table_lookup(defidx, argv[j], &v) < 0) {
if (strict) {
E_ERROR("Unknown argument name '%s'\n", argv[j]);
goto error;
}
else if (defn == NULL)
v = NULL;
else
continue;
}
argdef = (arg_t *)v;
/* Enter argument value */
if (j + 1 >= argc) {
cmd_ln_print_help_r(cmdln, stderr, defn);
E_ERROR("Argument value for '%s' missing\n", argv[j]);
goto error;
}
if (argdef == NULL)
val = cmd_ln_val_init(ARG_STRING, argv[j + 1]);
else {
if ((val = cmd_ln_val_init(argdef->type, argv[j + 1])) == NULL) {
cmd_ln_print_help_r(cmdln, stderr, defn);
E_ERROR("Bad argument value for %s: %s\n", argv[j],
argv[j + 1]);
goto error;
}
}
if ((v = hash_table_enter(cmdln->ht, argv[j], (void *)val)) !=
(void *)val)
{
if (strict) {
cmd_ln_val_free(val);
E_ERROR("Duplicate argument name in arguments: %s\n",
argdef->name);
goto error;
}
else {
v = hash_table_replace(cmdln->ht, argv[j], (void *)val);
cmd_ln_val_free((cmd_ln_val_t *)v);
}
}
}
/* Fill in default values, if any, for unspecified arguments */
for (i = 0; i < n; i++) {
cmd_ln_val_t *val;
void *v;
if (hash_table_lookup(cmdln->ht, defn[i].name, &v) < 0) {
if ((val = cmd_ln_val_init(defn[i].type, defn[i].deflt)) == NULL) {
E_ERROR
("Bad default argument value for %s: %s\n",
defn[i].name, defn[i].deflt);
goto error;
}
hash_table_enter(cmdln->ht, defn[i].name, (void *)val);
}
}
/* Check for required arguments; exit if any missing */
j = 0;
for (i = 0; i < n; i++) {
if (defn[i].type & ARG_REQUIRED) {
void *v;
if (hash_table_lookup(cmdln->ht, defn[i].name, &v) != 0)
E_ERROR("Missing required argument %s\n", defn[i].name);
}
}
if (j > 0) {
cmd_ln_print_help_r(cmdln, stderr, defn);
goto error;
}
if (strict && argc == 1) {
E_ERROR("No arguments given, available options are:\n");
cmd_ln_print_help_r(cmdln, stderr, defn);
if (defidx)
hash_table_free(defidx);
if (inout_cmdln == NULL)
cmd_ln_free_r(cmdln);
return NULL;
}
#ifndef _WIN32_WCE
/* Set up logging. We need to do this earlier because we want to dump
* the information to the configured log, not to the stderr. */
if (cmd_ln_exists_r(cmdln, "-logfn") && cmd_ln_str_r(cmdln, "-logfn")) {
if (err_set_logfile(cmd_ln_str_r(cmdln, "-logfn")) < 0)
E_FATAL_SYSTEM("cannot redirect log output");
}
/* Echo command line */
E_INFO("Parsing command line:\n");
for (i = 0; i < argc; i++) {
if (argv[i][0] == '-')
E_INFOCONT("\\\n\t");
E_INFOCONT("%s ", argv[i]);
}
E_INFOCONT("\n\n");
/* Print configuration */
E_INFOCONT("Current configuration:\n");
arg_dump_r(cmdln, err_get_logfp(), defn, 0);
#endif
hash_table_free(defidx);
return cmdln;
error:
if (defidx)
hash_table_free(defidx);
if (inout_cmdln == NULL)
cmd_ln_free_r(cmdln);
E_ERROR("Failed to parse arguments list\n");
return NULL;
}
cmd_ln_t *
cmd_ln_init(cmd_ln_t *inout_cmdln, const arg_t *defn, int32 strict, ...)
{
va_list args;
const char *arg, *val;
char **f_argv;
int32 f_argc;
va_start(args, strict);
f_argc = 0;
while ((arg = va_arg(args, const char *))) {
++f_argc;
val = va_arg(args, const char*);
if (val == NULL) {
E_ERROR("Number of arguments must be even!\n");
return NULL;
}
++f_argc;
}
va_end(args);
/* Now allocate f_argv */
f_argv = (char**)ckd_calloc(f_argc, sizeof(*f_argv));
va_start(args, strict);
f_argc = 0;
while ((arg = va_arg(args, const char *))) {
f_argv[f_argc] = ckd_salloc(arg);
++f_argc;
val = va_arg(args, const char*);
f_argv[f_argc] = ckd_salloc(val);
++f_argc;
}
va_end(args);
return parse_options(inout_cmdln, defn, f_argc, f_argv, strict);
}
int
cmd_ln_parse(const arg_t * defn, int32 argc, char *argv[], int strict)
{
cmd_ln_t *cmdln;
cmdln = cmd_ln_parse_r(global_cmdln, defn, argc, argv, strict);
if (cmdln == NULL) {
/* Old, bogus behaviour... */
E_ERROR("Failed to parse arguments list, forced exit\n");
exit(-1);
}
/* Initialize global_cmdln if not present. */
if (global_cmdln == NULL) {
global_cmdln = cmdln;
}
return 0;
}
cmd_ln_t *
cmd_ln_parse_file_r(cmd_ln_t *inout_cmdln, const arg_t * defn, const char *filename, int32 strict)
{
FILE *file;
int argc;
int argv_size;
char *str;
int arg_max_length = 512;
int len = 0;
int quoting, ch;
char **f_argv;
int rv = 0;
const char separator[] = " \t\r\n";
if ((file = fopen(filename, "r")) == NULL) {
E_ERROR("Cannot open configuration file %s for reading\n",
filename);
return NULL;
}
ch = fgetc(file);
/* Skip to the next interesting character */
for (; ch != EOF && strchr(separator, ch); ch = fgetc(file)) ;
if (ch == EOF) {
fclose(file);
return NULL;
}
/*
* Initialize default argv, argc, and argv_size.
*/
argv_size = 10;
argc = 0;
f_argv = (char **)ckd_calloc(argv_size, sizeof(char *));
/* Silently make room for \0 */
str = (char* )ckd_calloc(arg_max_length + 1, sizeof(char));
quoting = 0;
do {
/* Handle arguments that are commented out */
if (len == 0 && argc % 2 == 0) {
while (ch == '#') {
/* Skip everything until newline */
for (ch = fgetc(file); ch != EOF && ch != '\n'; ch = fgetc(file)) ;
/* Skip to the next interesting character */
for (ch = fgetc(file); ch != EOF && strchr(separator, ch); ch = fgetc(file)) ;
}
/* Check if we are at the last line (without anything interesting in it) */
if (ch == EOF)
break;
}
/* Handle quoted arguments */
if (ch == '"' || ch == '\'') {
if (quoting == ch) /* End a quoted section with the same type */
quoting = 0;
else if (quoting) {
E_ERROR("Nesting quotations is not supported!\n");
rv = 1;
break;
}
else
quoting = ch; /* Start a quoted section */
}
else if (ch == EOF || (!quoting && strchr(separator, ch))) {
/* Reallocate argv so it is big enough to contain all the arguments */
if (argc >= argv_size) {
char **tmp_argv;
if (!(tmp_argv =
(char **)ckd_realloc(f_argv, argv_size * 2 * sizeof(char *)))) {
rv = 1;
break;
}
f_argv = tmp_argv;
argv_size *= 2;
}
/* Add the string to the list of arguments */
f_argv[argc] = ckd_salloc(str);
len = 0;
str[0] = '\0';
argc++;
if (quoting)
E_WARN("Unclosed quotation, having EOF close it...\n");
/* Skip to the next interesting character */
for (; ch != EOF && strchr(separator, ch); ch = fgetc(file)) ;
if (ch == EOF)
break;
/* We already have the next character */
continue;
}
else {
if (len >= arg_max_length) {
/* Make room for more chars (including the \0 !) */
char *tmp_str = str;
if ((tmp_str = (char *)ckd_realloc(str, (1 + arg_max_length * 2) * sizeof(char))) == NULL) {
rv = 1;
break;
}
str = tmp_str;
arg_max_length *= 2;
}
/* Add the char to the argument string */
str[len++] = ch;
/* Always null terminate */
str[len] = '\0';
}
ch = fgetc(file);
} while (1);
fclose(file);
ckd_free(str);
if (rv) {
for (ch = 0; ch < argc; ++ch)
ckd_free(f_argv[ch]);
ckd_free(f_argv);
return NULL;
}
return parse_options(inout_cmdln, defn, argc, f_argv, strict);
}
int
cmd_ln_parse_file(const arg_t * defn, const char *filename, int32 strict)
{
cmd_ln_t *cmdln;
cmdln = cmd_ln_parse_file_r(global_cmdln, defn, filename, strict);
if (cmdln == NULL) {
return -1;
}
/* Initialize global_cmdln if not present. */
if (global_cmdln == NULL) {
global_cmdln = cmdln;
}
return 0;
}
void
cmd_ln_print_help_r(cmd_ln_t *cmdln, FILE *fp, arg_t const* defn)
{
if (defn == NULL)
return;
fprintf(fp, "Arguments list definition:\n");
arg_dump_r(cmdln, fp, defn, 1);
}
int
cmd_ln_exists_r(cmd_ln_t *cmdln, const char *name)
{
void *val;
if (cmdln == NULL)
return FALSE;
return (hash_table_lookup(cmdln->ht, name, &val) == 0);
}
anytype_t *
cmd_ln_access_r(cmd_ln_t *cmdln, const char *name)
{
void *val;
if (hash_table_lookup(cmdln->ht, name, &val) < 0) {
E_ERROR("Unknown argument: %s\n", name);
return NULL;
}
return (anytype_t *)val;
}
char const *
cmd_ln_str_r(cmd_ln_t *cmdln, char const *name)
{
anytype_t *val;
val = cmd_ln_access_r(cmdln, name);
if (val == NULL)
return NULL;
return (char const *)val->ptr;
}
char const **
cmd_ln_str_list_r(cmd_ln_t *cmdln, char const *name)
{
anytype_t *val;
val = cmd_ln_access_r(cmdln, name);
if (val == NULL)
return NULL;
return (char const **)val->ptr;
}
long
cmd_ln_int_r(cmd_ln_t *cmdln, char const *name)
{
anytype_t *val;
val = cmd_ln_access_r(cmdln, name);
if (val == NULL)
return 0L;
return val->i;
}
double
cmd_ln_float_r(cmd_ln_t *cmdln, char const *name)
{
anytype_t *val;
val = cmd_ln_access_r(cmdln, name);
if (val == NULL)
return 0.0;
return val->fl;
}
void
cmd_ln_set_str_r(cmd_ln_t *cmdln, char const *name, char const *str)
{
anytype_t *val;
val = cmd_ln_access_r(cmdln, name);
if (val == NULL) {
E_ERROR("Unknown argument: %s\n", name);
return;
}
ckd_free(val->ptr);
if (str == NULL)
val->ptr = NULL;
else
val->ptr = ckd_salloc(str);
}
void
cmd_ln_set_int_r(cmd_ln_t *cmdln, char const *name, long iv)
{
anytype_t *val;
val = cmd_ln_access_r(cmdln, name);
if (val == NULL) {
E_ERROR("Unknown argument: %s\n", name);
return;
}
val->i = iv;
}
void
cmd_ln_set_float_r(cmd_ln_t *cmdln, char const *name, double fv)
{
anytype_t *val;
val = cmd_ln_access_r(cmdln, name);
if (val == NULL) {
E_ERROR("Unknown argument: %s\n", name);
return;
}
val->fl = fv;
}
cmd_ln_t *
cmd_ln_retain(cmd_ln_t *cmdln)
{
++cmdln->refcount;
return cmdln;
}
int
cmd_ln_free_r(cmd_ln_t *cmdln)
{
if (cmdln == NULL)
return 0;
if (--cmdln->refcount > 0)
return cmdln->refcount;
if (cmdln->ht) {
glist_t entries;
gnode_t *gn;
int32 n;
entries = hash_table_tolist(cmdln->ht, &n);
for (gn = entries; gn; gn = gnode_next(gn)) {
hash_entry_t *e = (hash_entry_t *)gnode_ptr(gn);
cmd_ln_val_free((cmd_ln_val_t *)e->val);
}
glist_free(entries);
hash_table_free(cmdln->ht);
cmdln->ht = NULL;
}
if (cmdln->f_argv) {
int32 i;
for (i = 0; i < cmdln->f_argc; ++i) {
ckd_free(cmdln->f_argv[i]);
}
ckd_free(cmdln->f_argv);
cmdln->f_argv = NULL;
cmdln->f_argc = 0;
}
ckd_free(cmdln);
return 0;
}
void
cmd_ln_free(void)
{
cmd_ln_free_r(global_cmdln);
global_cmdln = NULL;
}
/* vim: set ts=4 sw=4: */
|
hidenorly/m5stickv_hello_world | main/src/main.c | /* Copyright 2019 hidenorly
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <bsp.h>
#include <sysctl.h>
#include "uart.h"
#include "FreeRTOS.h"
#include "task.h"
#include "boards.h"
#include "lcd.h"
void hello_core(void)
{
uint64_t core = current_coreid();
printf("Core %ld Hello world\n", core);
}
int core_task_scheduler_enable(void *ctx)
{
hello_core();
vTaskStartScheduler();
while(1);
}
void task_func1(void* arg)
{
while(1)
{
printf("task1\r\n");
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
void task_func2(void* arg)
{
while(1)
{
printf("task2\r\n");
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
void setup(void)
{
sysctl_pll_set_freq(SYSCTL_PLL0, 800000000);
boards_init();
// UART1 with baud rate 115200 , 8 data bits , 1 stop bit , no parity
uart_init(UART_DEVICE_1);
uart_config(UART_DEVICE_1, 115200, UART_BITWIDTH_8BIT, UART_STOP_1, UART_PARITY_NONE);
}
void setup_lcd(uint16_t fillColor, lcd_dir_t lcdDirection)
{
fpioa_set_function(21, FUNC_GPIOHS0 + RST_GPIONUM);
fpioa_set_function(20, FUNC_GPIOHS0 + DCX_GPIONUM);
fpioa_set_function(22, FUNC_SPI0_SS0+LCD_SPI_SLAVE_SELECT);
fpioa_set_function(19, FUNC_SPI0_SCLK);
fpioa_set_function(18, FUNC_SPI0_D0);
lcd_init(CONFIG_LCD_DEFAULT_FREQ, false, 52, 40, 40, 52, true, CONFIG_LCD_DEFAULT_WIDTH, CONFIG_LCD_DEFAULT_HEIGHT);
lcd_set_direction(lcdDirection);
lcd_clear(fillColor);
}
int main(void)
{
setup();
setup_lcd(BLACK, DIR_YX_LRUD);
lcd_draw_string(0,0, "hello world", WHITE);
// enable 2nd core (=core1)
register_core1(core_task_scheduler_enable, NULL);
xTaskCreateAtProcessor(0, task_func1, "1", 256, NULL, tskIDLE_PRIORITY+1, NULL );
xTaskCreateAtProcessor(1, task_func2, "2", 256, NULL, tskIDLE_PRIORITY+1, NULL );
core_task_scheduler_enable(NULL); // infinite loop
return 0;
}
|
sadawi/MarkovKit | MarkovKit/MarkovKit.h | <reponame>sadawi/MarkovKit
//
// MarkovKit.h
// MarkovKit
//
// Created by <NAME> on 12/17/15.
// Copyright © 2015 <NAME>. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for MarkovKit.
FOUNDATION_EXPORT double MarkovKitVersionNumber;
//! Project version string for MarkovKit.
FOUNDATION_EXPORT const unsigned char MarkovKitVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <MarkovKit/PublicHeader.h>
|
richgel999/DirectXTex | DirectXTex/BCDirectCompute.h | //-------------------------------------------------------------------------------------
// BCDirectCompute.h
//
// Direct3D 11 Compute Shader BC Compressor
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//-------------------------------------------------------------------------------------
#pragma once
namespace DirectX
{
class GPUCompressBC
{
public:
GPUCompressBC() throw();
HRESULT Initialize(_In_ ID3D11Device* pDevice);
HRESULT Prepare(size_t width, size_t height, DWORD flags, DXGI_FORMAT format, float alphaWeight);
HRESULT Compress(const Image& srcImage, const Image& destImage);
DXGI_FORMAT GetSourceFormat() const { return m_srcformat; }
private:
DXGI_FORMAT m_bcformat;
DXGI_FORMAT m_srcformat;
float m_alphaWeight;
bool m_bc7_mode02;
bool m_bc7_mode137;
size_t m_width;
size_t m_height;
Microsoft::WRL::ComPtr<ID3D11Device> m_device;
Microsoft::WRL::ComPtr<ID3D11DeviceContext> m_context;
Microsoft::WRL::ComPtr<ID3D11Buffer> m_err1;
Microsoft::WRL::ComPtr<ID3D11UnorderedAccessView> m_err1UAV;
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_err1SRV;
Microsoft::WRL::ComPtr<ID3D11Buffer> m_err2;
Microsoft::WRL::ComPtr<ID3D11UnorderedAccessView> m_err2UAV;
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_err2SRV;
Microsoft::WRL::ComPtr<ID3D11Buffer> m_output;
Microsoft::WRL::ComPtr<ID3D11Buffer> m_outputCPU;
Microsoft::WRL::ComPtr<ID3D11UnorderedAccessView> m_outputUAV;
Microsoft::WRL::ComPtr<ID3D11Buffer> m_constBuffer;
// Compute shader library
Microsoft::WRL::ComPtr<ID3D11ComputeShader> m_BC6H_tryModeG10CS;
Microsoft::WRL::ComPtr<ID3D11ComputeShader> m_BC6H_tryModeLE10CS;
Microsoft::WRL::ComPtr<ID3D11ComputeShader> m_BC6H_encodeBlockCS;
Microsoft::WRL::ComPtr<ID3D11ComputeShader> m_BC7_tryMode456CS;
Microsoft::WRL::ComPtr<ID3D11ComputeShader> m_BC7_tryMode137CS;
Microsoft::WRL::ComPtr<ID3D11ComputeShader> m_BC7_tryMode02CS;
Microsoft::WRL::ComPtr<ID3D11ComputeShader> m_BC7_encodeBlockCS;
};
} // namespace
|
lbwanghr/RobotXC | RobotXC/include/CommonTool.h | #ifndef __COMMON_TOOL_H__
#define __COMMON_TOOL_H__
namespace HciExampleComon{
//设置控制台打印颜色
void SetSpecialConsoleTextAttribute();
//恢复控制台打印颜色
void SetOriginalConsoleTextAttribute();
//控制台打印UTF8字符(windows转化为GBK)
void PrintUtf8String(char *pUTF8Str);
//转码函数
int UTF8ToGBK(unsigned char * pUTF8Str,unsigned char ** pGBKStr);
int GBKToUTF8(unsigned char * pGBKStr,unsigned char ** pUTF8Str);
//转码内存释放函数
void FreeConvertResult(unsigned char * pConvertResult);
}
#endif // __FILE_UTIL_H__
|
BlackFenec/AdventOfCode2019 | AdventOfCode/DaySix.h | <reponame>BlackFenec/AdventOfCode2019
#ifndef DAYSIX_H_
#define DAYSIX_H_
#include <string>
#include "Node.h"
class DaySix
{
private:
static int OrbitCount(Node* node, int lastLevel);
public :
static int GetTotalNumberOfOrbits(std::string map);
static int FirstChallenge(std::string filename);
};
#endif |
BlackFenec/AdventOfCode2019 | AdventOfCode/Node.h | <reponame>BlackFenec/AdventOfCode2019
#ifndef NODE_H_
#define NODE_H_
#include <string>
#include <list>
class Node
{
private:
std::string value;
std::list<Node*> childs;
public:
Node(std::string newValue)
{
value = newValue;
childs = std::list<Node*>();
}
void AddChild(Node* node) { childs.push_back(node); }
std::list<Node*> GetChilds() { return childs; }
std::string GetValue() { return value; }
};
#endif |
BlackFenec/AdventOfCode2019 | AdventOfCode/Tree.h | #ifndef TREE_H_
#define TREE_H_
#include "Node.h"
class Tree
{
private:
Node* root;
bool InsertNode(Node* node, std::string parent, std::string newValue);
public:
Node* GetRoot() { return root; }
bool InsertNewNode(std::string parent, std::string newValue);
};
#endif |
BlackFenec/AdventOfCode2019 | AdventOfCode/DayOne.h | #ifndef DAYONE_H_
#define DAYONE_H_
#include <string>
class DayOne
{
public :
static int ComputeFuelFromMass(int mass);
static int ComputeEntireFuelForModule(int moduleMass);
static int FirstChallenge(std::string filename);
static int SecondChallenge(std::string filename);
};
#endif |
BlackFenec/AdventOfCode2019 | AdventOfCode/DayTwo.h | <filename>AdventOfCode/DayTwo.h
#ifndef DAYTWO_H_
#define DAYTWO_H_
#include <string>
class DayTwo
{
public:
static std::string ExecuteProgram(std::string program, int firstPositionValue, int secondPositionValue);
static std::string FirstChallenge(std::string filename, int firstPositionValue, int secondPositionValue);
static int SecondChallenge(std::string filename, std::string expectedOutput);
};
#endif |
BlackFenec/AdventOfCode2019 | AdventOfCode/DayFour.h | #ifndef DAYFOUR_H_
#define DAYFOUR_H_
#include <string>
class DayFour
{
private :
static bool HasSameAdjacentDigits(std::string password, bool hasSameAdjacentDigitsTwoOnly);
static bool DigitsNeverDecrease(std::string password);
public:
static bool IsValidPassword(std::string password, bool hasSameAdjacentDigitsTwoOnly);
static int FirstChallenge(std::string minimum, std::string maximum);
static int SecondChallenge(std::string minimum, std::string maximum);
};
#endif |
BlackFenec/AdventOfCode2019 | AdventOfCode/DayThree.h | <gh_stars>0
#ifndef DAYTHREE_H_
#define DAYTHREE_H_
#include <string>
#include <map>
class DayThree
{
private :
static std::map<std::string, int> firstPath;
static int closest;
static void ManageWire(std::string wire, bool isFirst, bool useManhattanDistance);
public :
static int ClosestIntersection(std::string firstWire, std::string secondWire);
static int FirstChallenge(std::string filename);
static int SecondChallenge(std::string filename);
static int MinimumSteps(std::string firstWire, std::string secondWire);
};
#endif |
BlackFenec/AdventOfCode2019 | AdventOfCode/DayFive.h | #ifndef DAYFIVE_H_
#define DAYFIVE_H_
class DayFive
{
public:
};
#endif |
Mu-L/MINGW-packages | mingw-w64-swig/pathtools.h | <filename>mingw-w64-swig/pathtools.h
/*
.Some useful path tools.
.ASCII only for now.
.Written by <NAME> in 2014.
.Licensed under CC0 (and anything.
.else you need to license it under).
.No warranties whatsoever.
.email: <<EMAIL>>.
*/
#ifndef PATHTOOLS_H
#define PATHTOOLS_H
#include <unistd.h>
#if defined(__APPLE__)
#include <stdlib.h>
#else
#include <malloc.h>
#endif
#include <stdio.h>
char * malloc_copy_string(char const * original);
/* In-place replaces any '\' with '/' and any '//' with '/' */
void sanitise_path(char * path);
/* Uses a host OS specific function to determine the path of the executable,
if IMPLEMENT_SYS_GET_EXECUTABLE_PATH is defined, otherwise uses argv0. */
int get_executable_path(char const * argv0, char * result, ssize_t max_size);
#if defined(_WIN32)
int get_dll_path(char * result, unsigned long max_size);
#endif
/* Where possible, in-place removes occourances of '.' and 'path/..' */
void simplify_path(char * path);
/* Allocates (via malloc) and returns the path to get from from to to. */
char * get_relative_path(char const * from, char const * to);
size_t split_path_list(char const * path_list, char split_char, char *** arr);
/* Advances path along by the amount that removes n prefix folders. */
char const *
strip_n_prefix_folders(char const * path, size_t n);
/* NULL terminates path to remove n suffix folders. */
void
strip_n_suffix_folders(char * path, size_t n);
char const * get_relocated_path (char const * from, char const * to, char const * actual_from);
char * get_relocated_path_list(char const * from, char const * to_path_list);
char * get_relocated_path_list_lib(char const * from, char const * to_path_list);
char * single_path_relocation(const char *from, const char *to);
char * single_path_relocation_lib(const char *from, const char *to);
char * pathlist_relocation(const char *from_path, const char *to_path_list);
char * pathlist_relocation_lib(const char *from_path, const char *to_path_list);
#endif /* PATHTOOLS_H */
|
LandonMorrison/BlackJackRepo | BlackJack/BlackJack/VingtEtUn.h | <reponame>LandonMorrison/BlackJackRepo
/*************************************************
* Author: <NAME>
* File Name: VingtEtUn.h
* Date Created: 3/6/2020
* Modifications:
*
*************************************************/
#ifndef VINGTETUN_H
#define VINGTETUN_H
#include "VingtEtUnDealer.h"
/***********************************
* Class: VingtEtUn
*
* Purpose: This is the game class for Vingt Et Un otherwise known as 21 or Blackjack
*
* Manager Functions:
* VingtEtUn()
* Default CTor.
* ~VingtEtUn()
* DTor
*
* Game Functions:
*
*
***********************************/
class VingtEtUn
{
public:
// Manager Functions
VingtEtUn();
~VingtEtUn();
// Game Functions
void PlayGame();
void PlayRound();
void DealRound();
void InsuranceChecks();
void CheckForNaturals();
void CheckForSplits();
void CheckForDoubleDowns();
void PlayerTurns();
void DealerTurn();
// Utilities
void InsurancePayouts();
void PayOut(int playerOffset, int handOffset, float multiplier);
private:
// Data Members
Player* m_players = nullptr;
Dealer m_dealer;
int m_numPlayers = 0;
Deck m_deck;
int PlayAgains = 0;
};
#endif |
LandonMorrison/BlackJackRepo | BlackJack/BlackJack/VingtEtUnCard.h | /*************************************************
* Author: <NAME>
* File Name: VingtEtUnCard.h
* Date Created: 3/6/2020
* Modifications: 3/8/2020 - changed from Card to VingtEtUnCard
*
*************************************************/
#ifndef CARD_H
#define CARD_H
#include <iostream>
#include <windows.h>
#include <time.h>
enum class RANK { ACE = 1, DEUCE, TREY, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING };
enum class SUIT { SPADES, HEARTS, CLUBS, DIAMONDS };
/***********************************
* Class: Card
*
* Purpose: This class creates a card with a rank and suit that is face up
*
* Manager Functions:
* Card(RANK RankIn = ACE, SUIT SuitIn = SPADES)
* Overloaded CTor that will default to ACE of SPADES if given no arguments
* Card(const Card& copy)
* Copy CTor called when passed by value, returned by value, or instantiated with an object of the same type.
* Card(Card&& temp) noexcept
* Move CTor called to create an object using values from a temporary object.
* Card& operator = (const Card& rhs)
* Copy Assignment Operator used to define how the "=" operator should function when both the lhs and rhs string objects have
* been initialized prior to assignment.
* Card& operator = (Card&& temp) noexcept
* Move Assignement Operator used when the rhs is a temporary object such as a function return that will go out of scope
* when the line finishes.
* ~Card()
* DTor for releasing any memory allocated by Card.
*
***********************************/
class Card
{
public:
// Manager Functions
Card(RANK RankIn = RANK::ACE, SUIT SuitIn = SUIT::SPADES);
Card(const Card& copy);
Card(Card&& tmep) noexcept;
Card& operator=(const Card& rhs);
Card& operator=(Card&& temprhs) noexcept;
~Card();
// Card Functions
int CalculateCardScore();
// Setters and Getters
void SetRank(RANK InRank);
void SetSuit(SUIT InSuit);
void SetFaceUp(bool FaceUpIn);
void SetScore(int ScoreIn);
const RANK GetRank() const;
const SUIT GetSuit() const;
const bool GetFaceUp() const;
const int GetScore() const;
// Utilities
void Display() const;
private:
// Data Members
RANK m_rank = RANK::ACE;
SUIT m_suit = SUIT::SPADES;
bool m_faceUp = true;
int m_score = 11;
};
#endif |
LandonMorrison/BlackJackRepo | BlackJack/BlackJack/VingtEtUnHand.h | /*************************************************
* Author: <NAME>
* File Name: VingtEtUnHand.h
* Date Created: 3/6/2020
* Modifications: 3/8/2020 - changed from Hand to VingtEtUnHand
*
*************************************************/
#ifndef HAND_H
#define HAND_H
#include "VingtEtUnDeck.h"
/***********************************
* Class: VingtEtUnHand
*
* Purpose: This class creates a hand of cards for VingtEtUn.
*
* Manager Functions:
* Hand()
* Default CTor creates an empty hand.
* Hand(const Hand& copy)
* Copy CTor called when passed by value, returned by value, or instantiated with an object of the same type.
* Hand(Hand&& temp) noexcept
* Move CTor called to create an object using values from a temporary object.
* Hand& operator = (const Hand& rhs)
* Copy Assignment Operator used to define how the "=" operator should function when both the lhs and rhs string objects have
* been initialized prior to assignment.
* Hand& operator = (Hand&& temp) noexcept
* Move Assignement Operator used when the rhs is a temporary object such as a function return that will go out of scope
* when the line finishes.
* ~Hand()
* DTor for releasing any memory allocated by Hand.
*
* Hand Functions:
* Card Discard(int offset)
* Specific to VingtEtUn, returns a temporary copy of the card at the given offset to be added to the deck's discard pile
* and then deletes the card from the hand.
*
***********************************/
class Hand
{
public:
// Manager Functions
Hand();
Hand(const Hand& copy);
Hand(Hand&& temp) noexcept;
Hand& operator=(const Hand& rhs);
Hand& operator=(Hand&& temp) noexcept;
~Hand();
// Hand Functions
void AddCard(Card CardIn);
Card Discard(int offset);
int CalculateHandScore();
// Getters and Setters
const int GetHandSize() const;
const Card GetCard(int offset) const;
const bool GetIsInPlay() const;
void SetIsInPlay(bool PlayIn);
// Utilities
void Display();
void FlipCard(int offset, bool FaceUp);
private:
// Data Members
Card* m_cards = nullptr;
int m_handSize = 0;
int m_handScore = 0;
bool isInPlay = false;
// Internal Utilities
void PrintAscci(int ascii) const;
void PrintCards() const;
void PrintTops() const;
void PrintTopChars() const;
void PrintMids() const;
void PrintBotChars() const;
void PrintBots() const;
};
#endif |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.