Skip to content

Commit f57b01c

Browse files
committed
Initial checkin.
1 parent 099a846 commit f57b01c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4883
-0
lines changed
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleIconFile</key>
8+
<string></string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>${PRODUCT_NAME}</string>
15+
<key>CFBundlePackageType</key>
16+
<string>BNDL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>CFPlugInDynamicRegisterFunction</key>
24+
<string></string>
25+
<key>CFPlugInDynamicRegistration</key>
26+
<string>NO</string>
27+
<key>CFPlugInFactories</key>
28+
<dict>
29+
<key>00000000-0000-0000-0000-000000000000</key>
30+
<string>MyFactoryFunction</string>
31+
</dict>
32+
<key>CFPlugInTypes</key>
33+
<dict>
34+
<key>00000000-0000-0000-0000-000000000000</key>
35+
<array>
36+
<string>00000000-0000-0000-0000-000000000000</string>
37+
</array>
38+
</dict>
39+
<key>CFPlugInUnloadFunction</key>
40+
<string></string>
41+
<key>NSHumanReadableCopyright</key>
42+
<string>Copyright © 2014 MathChat.</string>
43+
</dict>
44+
</plist>
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//
2+
// Prefix header
3+
//
4+
// The contents of this file are implicitly included at the beginning of every source file.
5+
//
6+
7+
#ifdef __OBJC__
8+
#import <Cocoa/Cocoa.h>
9+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* Localized versions of Info.plist keys */
2+

MathFontBundle/latinmodern-math.otf

716 KB
Binary file not shown.

build_multiplatform.sh

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/sh
2+
3+
set -e
4+
set +u
5+
# Avoid recursively calling this script.
6+
if [[ $MC_MASTER_SCRIPT_RUNNING ]]
7+
then
8+
exit 0
9+
fi
10+
set -u
11+
export MC_MASTER_SCRIPT_RUNNING=1
12+
13+
MC_TARGET_NAME="IosMath"
14+
MC_INPUT_STATIC_LIB="lib${MC_TARGET_NAME}.a"
15+
16+
function build_static_library {
17+
# Will rebuild the static library as specified
18+
# build_static_library sdk
19+
xcrun xcodebuild -project "${PROJECT_DIR}/${PROJECT_NAME}.xcodeproj" \
20+
-target "${MC_TARGET_NAME}" \
21+
-configuration "${CONFIGURATION}" \
22+
-sdk "${1}" \
23+
ONLY_ACTIVE_ARCH=NO \
24+
BUILD_DIR="${BUILD_DIR}" \
25+
OBJROOT="${OBJROOT}" \
26+
BUILD_ROOT="${BUILD_ROOT}" \
27+
SYMROOT="${SYMROOT}" $ACTION
28+
}
29+
30+
function make_fat_library {
31+
# Will smash 2 static libs together
32+
# make_fat_library in1 in2 out
33+
xcrun lipo -create "${1}" "${2}" -output "${3}"
34+
}
35+
36+
37+
# 1 - Extract the platform (iphoneos/iphonesimulator) from the SDK name
38+
if [[ "$SDK_NAME" =~ ([A-Za-z]+) ]]; then
39+
MC_SDK_PLATFORM=${BASH_REMATCH[1]}
40+
else
41+
echo "Could not find platform name from SDK_NAME: $SDK_NAME"
42+
exit 1
43+
fi
44+
45+
# 2 - Extract the version from the SDK
46+
if [[ "$SDK_NAME" =~ ([0-9]+.*$) ]]; then
47+
MC_SDK_VERSION=${BASH_REMATCH[1]}
48+
else
49+
echo "Could not find sdk version from SDK_NAME: $SDK_NAME"
50+
exit 1
51+
fi
52+
53+
# 3 - Determine the other platform
54+
if [ "$MC_SDK_PLATFORM" == "iphoneos" ]; then
55+
MC_OTHER_PLATFORM=iphonesimulator
56+
else
57+
MC_OTHER_PLATFORM=iphoneos
58+
fi
59+
60+
# 4 - Find the build directory
61+
if [[ "$BUILT_PRODUCTS_DIR" =~ (.*)$MC_SDK_PLATFORM$ ]]; then
62+
MC_OTHER_BUILT_PRODUCTS_DIR="${BASH_REMATCH[1]}${MC_OTHER_PLATFORM}"
63+
else
64+
echo "Could not find platform name from build products directory: $BUILT_PRODUCTS_DIR"
65+
exit 1
66+
fi
67+
68+
# Build the other platform.
69+
build_static_library "${MC_OTHER_PLATFORM}${MC_SDK_VERSION}"
70+
71+
# If we're currently building for iphonesimulator, then need to rebuild
72+
# to ensure that we get both i386 and x86_64
73+
if [ "$MC_SDK_PLATFORM" == "iphonesimulator" ]; then
74+
build_static_library "${SDK_NAME}"
75+
fi
76+
77+
# Join the 2 static libs into 1 and push into the .framework
78+
make_fat_library "${BUILT_PRODUCTS_DIR}/${MC_INPUT_STATIC_LIB}" \
79+
"${MC_OTHER_BUILT_PRODUCTS_DIR}/${MC_INPUT_STATIC_LIB}" \
80+
"${HOME}/Desktop/${MC_INPUT_STATIC_LIB}"

iosMath.xcodeproj/project.pbxproj

+877
Large diffs are not rendered by default.

iosMath.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

iosMath/IosMath.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// IosMath.h
3+
// iosMath
4+
//
5+
// Created by MARIO ANDHIKA on 8/28/15.
6+
// Copyright (C) 2015 MathChat
7+
//
8+
// This software may be modified and distributed under the terms of the
9+
// MIT license. See the LICENSE file for details.
10+
11+
#import <IosMath/MTMathUILabel.h>
12+
#import <IosMath/MTMathListDisplay.h>
13+
#import <IosMath/MTMathList.h>
14+
#import <IosMath/MTMathListBuilder.h>

iosMath/iosMathLib-Prefix.pch

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//
2+
// Prefix header for all source files of the 'iosMathLib' target in the 'iosMathLib' project
3+
//
4+
5+
#ifdef __OBJC__
6+
#import <Foundation/Foundation.h>
7+
#endif

iosMath/lib/MTMathAtomFactory.h

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//
2+
// MathAtomFactory.h
3+
// iosMath
4+
//
5+
// Created by Kostub Deshmukh on 8/28/13.
6+
// Copyright (C) 2013 MathChat
7+
//
8+
// This software may be modified and distributed under the terms of the
9+
// MIT license. See the LICENSE file for details.
10+
//
11+
12+
#import <Foundation/Foundation.h>
13+
14+
#import "MTMathList.h"
15+
16+
FOUNDATION_EXPORT NSString *const MTSymbolMultiplication;
17+
FOUNDATION_EXPORT NSString *const MTSymbolDivision;
18+
FOUNDATION_EXPORT NSString *const MTSymbolFractionSlash;
19+
FOUNDATION_EXPORT NSString *const MTSymbolWhiteSquare;
20+
FOUNDATION_EXPORT NSString *const MTSymbolBlackSquare;
21+
FOUNDATION_EXPORT NSString *const MTSymbolLessEqual;
22+
FOUNDATION_EXPORT NSString *const MTSymbolGreaterEqual;
23+
FOUNDATION_EXPORT NSString *const MTSymbolNotEqual;
24+
FOUNDATION_EXPORT NSString *const MTSymbolSquareRoot;
25+
FOUNDATION_EXPORT NSString *const MTSymbolCubeRoot;
26+
FOUNDATION_EXPORT NSString *const MTSymbolInfinity;
27+
FOUNDATION_EXPORT NSString *const MTSymbolAngle;
28+
FOUNDATION_EXPORT NSString *const MTSymbolDegree;
29+
30+
@interface MTMathAtomFactory : NSObject
31+
32+
+ (MTRadical *)placeholderSquareRoot;
33+
34+
+ (MTMathAtom*) times; // \times or *
35+
36+
+ (MTMathAtom*) divide; // \div or /
37+
38+
+ (MTMathAtom*) placeholder;
39+
40+
+ (MTFraction*) placeholderFraction;
41+
42+
+ (MTMathAtom *)openParens;
43+
44+
+ (MTMathAtom *)closeParens;
45+
46+
+ (MTMathAtom *) operatorWithName:(NSString*) name;
47+
48+
+ (MTRadical*) placeholderRadical;
49+
50+
@end

iosMath/lib/MTMathAtomFactory.m

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
//
2+
// MathAtomFactory.m
3+
// iosMath
4+
//
5+
// Created by Kostub Deshmukh on 8/28/13.
6+
// Copyright (C) 2013 MathChat
7+
//
8+
// This software may be modified and distributed under the terms of the
9+
// MIT license. See the LICENSE file for details.
10+
//
11+
12+
#import "MTMathAtomFactory.h"
13+
14+
15+
NSString *const MTSymbolMultiplication = @"\u00D7";
16+
NSString *const MTSymbolDivision = @"\u00F7";
17+
NSString *const MTSymbolFractionSlash = @"\u2044";
18+
NSString *const MTSymbolWhiteSquare = @"\u25A1";
19+
NSString *const MTSymbolBlackSquare = @"\u25A0";
20+
NSString *const MTSymbolLessEqual = @"\u2264";
21+
NSString *const MTSymbolGreaterEqual = @"\u2265";
22+
NSString *const MTSymbolNotEqual = @"\u2260";
23+
NSString *const MTSymbolSquareRoot = @"\u221A"; // \sqrt
24+
NSString *const MTSymbolCubeRoot = @"\u221B";
25+
NSString *const MTSymbolInfinity = @"\u221E"; // \infty
26+
NSString *const MTSymbolAngle = @"\u2220"; // \angle
27+
NSString *const MTSymbolDegree = @"\u00B0"; // \circ
28+
29+
@implementation MTMathAtomFactory
30+
31+
+ (MTMathAtom *)times
32+
{
33+
return [MTMathAtom atomWithType:kMTMathAtomBinaryOperator value:MTSymbolMultiplication];
34+
}
35+
36+
+ (MTMathAtom *)divide
37+
{
38+
return [MTMathAtom atomWithType:kMTMathAtomBinaryOperator value:MTSymbolDivision];
39+
}
40+
41+
+ (MTMathAtom *)placeholder
42+
{
43+
return [MTMathAtom atomWithType:kMTMathAtomPlaceholder value:MTSymbolWhiteSquare];
44+
}
45+
46+
+ (MTMathAtom *)openParens
47+
{
48+
return [MTMathAtom atomWithType:kMTMathAtomOpen value:@"("];
49+
}
50+
51+
+ (MTMathAtom *)closeParens
52+
{
53+
return [MTMathAtom atomWithType:kMTMathAtomClose value:@")"];
54+
}
55+
56+
+ (MTFraction *)placeholderFraction
57+
{
58+
MTFraction *frac = [MTFraction new];
59+
frac.numerator = [MTMathList new];
60+
[frac.numerator addAtom:[self placeholder]];
61+
frac.denominator = [MTMathList new];
62+
[frac.denominator addAtom:[self placeholder]];
63+
return frac;
64+
}
65+
66+
+ (MTRadical*) placeholderRadical
67+
{
68+
MTRadical* rad = [MTRadical new];
69+
rad.degree = [MTMathList new];
70+
rad.radicand = [MTMathList new];
71+
[rad.degree addAtom:self.placeholder];
72+
[rad.radicand addAtom:self.placeholder];
73+
return rad;
74+
}
75+
76+
+ (MTMathAtom *)placeholderSquareRoot
77+
{
78+
MTRadical *rad = [MTRadical new];
79+
rad.radicand = [MTMathList new];
80+
[rad.radicand addAtom:[self placeholder]];
81+
return rad;
82+
}
83+
84+
+ (MTMathAtom *)operatorWithName:(NSString *)name
85+
{
86+
return [MTMathAtom atomWithType:kMTMathAtomLargeOperator value:name];
87+
}
88+
89+
@end

0 commit comments

Comments
 (0)