//
//  PST2CharString.h
//  GSFontTools
//
//  Created by Georg Seifert on 31.07.11.
//  Copyright 2011 schriftgestaltung.de. All rights reserved.
//

#import <GSFontTools/PSByteCodeBase.h>

#import <GSFontTools/CFFPrivateDict.h>

NS_ASSUME_NONNULL_BEGIN

@interface PST2CharString : PSByteCodeBase

@property (nonatomic, strong, nullable) NSMutableArray *program;
@property (nonatomic, strong, nullable) NSData *bytecode;
@property (nonatomic, strong) CFFPrivateDict *privateDict;
@property (nonatomic, strong) CFFGlobalSubrsIndex *globalSubrs;
@property (nonatomic, assign) NSInteger width;
@property (nonatomic, assign) int fdSelectIndex;

- (instancetype)initWithBytecode:(nullable NSData *)byteCode
		   privateDict:(nullable CFFPrivateDict *)privateDict
		   globalSubrs:(nullable CFFGlobalSubrsIndex *)globalSubrs;

- (void)decompile;

- (void)compile:(CFFVersion)version;
//- (instancetype)initWithFile:(GSFileData *)file privateDict:(PrivateDict *)privateDict globalSubrs:(GlobalSubrsIndex *)globalSubrs;

+ (NSString *)operatorNameForOpcode:(int)op;

- (void)toXML:(GSXMLWriter *)writer;

- (void)fromXML:(NSString *)name attrs:(NSDictionary *)attrs content:(id)content;

- (BOOL)needsDecompilation;

- (nullable id)getTokenAtPos:(NSUInteger *)pos;

- (NSData *)getBytesAtPos:(NSUInteger *)idx length:(NSUInteger)length;

@end

NS_ASSUME_NONNULL_END
