Skip to content

Commit d5a41ff

Browse files
authored
Merge pull request #342 from MesserLab/multispecies
Time to merge multispecies down
2 parents 37e4b93 + bdd03d4 commit d5a41ff

599 files changed

Lines changed: 35785 additions & 24117 deletions

File tree

Some content is hidden

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

.github/workflows/tests.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
/usr/share/miniconda/envs/anaconda-client-env
5555
~/osx-conda
5656
~/.profile
57-
key: ${{ runner.os }}-${{ matrix.python}}-conda-v11-${{ hashFiles('treerec/tests/conda-requirements.txt') }}-${{ hashFiles('treerec/tests/pip-requirements.txt') }}
57+
key: ${{ runner.os }}-${{ matrix.python }}-conda-v13-${{ hashFiles('treerec/tests/conda-requirements.txt') }}-${{ hashFiles('treerec/tests/pip-requirements.txt') }}
5858

5959
- name: Install Conda
6060
uses: conda-incubator/setup-miniconda@v2
@@ -90,10 +90,15 @@ jobs:
9090
sudo cp -r ~/osx-conda /usr/local/miniconda/envs/anaconda-client-env
9191
9292
- name: Install pyslim
93+
shell: bash -l {0}
9394
run: |
95+
# TODO: uncomment when pyslim 1.0 on conda
9496
source ~/.profile
95-
conda activate anaconda-client-env
96-
pip install pyslim
97+
# conda activate anaconda-client-env
98+
# pip install pyslim
99+
git clone https://github.com/tskit-dev/pyslim.git
100+
cd pyslim
101+
pip3 install .
97102
98103
- name: Build (Debug)
99104
run: |
@@ -258,7 +263,11 @@ jobs:
258263
- name: Install pyslim
259264
shell: bash -l {0}
260265
run: |
261-
conda install -c conda-forge pyslim
266+
# TODO: uncomment when pyslim 1.0 is on conda
267+
# conda install -c conda-forge pyslim
268+
git clone https://github.com/tskit-dev/pyslim.git
269+
cd pyslim
270+
pip3 install .
262271
263272
- name: Debug
264273
run: |

CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ endif(NOT CMAKE_BUILD_TYPE)
6868
option(BUILD_SLIMGUI "Build the Qt5-based GUI for SLiM" OFF)
6969

7070

71+
# obtain the Git commit SHA-1; see ./cmake/_README.txt and https://stackoverflow.com/a/4318642/2752221
72+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
73+
include(GetGitRevisionDescription)
74+
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
75+
#message("GIT_SHA1 is ${GIT_SHA1}")
76+
77+
7178
# Use the flags below for [all / Debug / Release] builds; these flags are built in to cmake
7279
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wno-attributes -Wunused-label -Wimplicit -Wunused-variable -Wunused-value -Wno-pragmas -Wempty-body -Wshadow -Wparentheses -Wmissing-prototypes -Wswitch -Wpointer-sign -Wsign-compare -Wstrict-prototypes -Wno-sign-conversion -Wuninitialized")
7380
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -Wunused-label -Wunused-variable -Wunused-value -Wno-pragmas -Wempty-body -Wshadow -Wparentheses -Wswitch -Wsign-compare -Wno-sign-conversion -Wuninitialized")
@@ -82,6 +89,8 @@ if(WIN32)
8289
"${PROJECT_SOURCE_DIR}/core/slim_globals.cpp"
8390
"${PROJECT_SOURCE_DIR}/core/slim_sim_eidos.cpp"
8491
"${PROJECT_SOURCE_DIR}/core/slim_sim.cpp"
92+
"${PROJECT_SOURCE_DIR}/core/species.cpp"
93+
"${PROJECT_SOURCE_DIR}/core/species_eidos.cpp"
8594
"${PROJECT_SOURCE_DIR}/core/subpopulation.cpp"
8695
"${PROJECT_SOURCE_DIR}/eidos/eidos_functions.cpp"
8796
"${PROJECT_SOURCE_DIR}/eidos/eidos_globals.cpp"
@@ -179,8 +188,14 @@ if(WIN32)
179188
target_link_libraries(${TARGET_NAME} PUBLIC gnu)
180189
endif()
181190

191+
# SLIM
182192
set(TARGET_NAME slim)
183193
file(GLOB_RECURSE SLIM_SOURCES ${PROJECT_SOURCE_DIR}/core/*.cpp ${PROJECT_SOURCE_DIR}/eidos/*.cpp)
194+
195+
# use the Git commit SHA-1 obtained above
196+
configure_file("${PROJECT_SOURCE_DIR}/cmake/GitSHA1.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp" @ONLY)
197+
list(APPEND SLIM_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp" ${PROJECT_SOURCE_DIR}/cmake/GitSHA1.h)
198+
184199
add_executable(${TARGET_NAME} ${SLIM_SOURCES})
185200
target_include_directories(${TARGET_NAME} PRIVATE ${GSL_INCLUDES} "${PROJECT_SOURCE_DIR}/core" "${PROJECT_SOURCE_DIR}/eidos")
186201
target_link_libraries(${TARGET_NAME} PUBLIC gsl eidos_zlib tables)
@@ -191,6 +206,7 @@ if(WIN32)
191206
target_link_libraries(${TARGET_NAME} PUBLIC gnu)
192207
endif()
193208

209+
# EIDOS
194210
set(TARGET_NAME eidos)
195211
file(GLOB_RECURSE EIDOS_SOURCES ${PROJECT_SOURCE_DIR}/eidos/*.cpp ${PROJECT_SOURCE_DIR}/eidostool/*.cpp)
196212
add_executable(${TARGET_NAME} ${EIDOS_SOURCES})
@@ -241,4 +257,3 @@ else()
241257
endif()
242258
install(TARGETS ${TARGET_NAME} DESTINATION bin)
243259
endif(BUILD_SLIMGUI)
244-

EidosScribe/EidosCocoaExtra.mm

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,6 @@ + (NSDictionary *)eidosBaseAttributes:(NSDictionary *)baseAttrs withHyperlink:(N
411411
@end
412412

413413

414-
@interface NSObject (EidosSplitViewExtensions)
415-
- (void)respondToSizeChangeForSplitView:(NSSplitView *)splitView;
416-
@end
417-
418414
@implementation NSSplitView (EidosAdditions)
419415

420416
- (void)eidosRestoreAutosavedPositionsWithName:(NSString *)autosaveName
@@ -449,15 +445,6 @@ - (void)eidosRestoreAutosavedPositionsWithName:(NSString *)autosaveName
449445
}
450446
}
451447
}
452-
453-
// Notify our delegate of the resize. Note that this is not an NSSplitViewDelegate method; we're doing our own thing here
454-
NSObject *delegate = [self delegate];
455-
456-
if (delegate)
457-
{
458-
if ([delegate respondsToSelector:@selector(respondToSizeChangeForSplitView:)])
459-
[delegate respondToSizeChangeForSplitView:self];
460-
}
461448
}
462449

463450
@end

EidosScribe/EidosConsoleWindowControllerDelegate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
// If provided, this context object will be handed to EidosInterpreter objects created by the console
4747
// controller when interpreting Eidos code; the context can then be obtained by Context implementations
48-
// of functions and method using GetEidosContext(), to recover the context object for their own use
48+
// of functions and method using EidosInterpreter::Context(), to recover the context object for their own use
4949
- (EidosContext *)eidosConsoleWindowControllerEidosContext:(EidosConsoleWindowController *)eidosConsoleController;
5050

5151
// This allows the Context to append its own welcome message to the console window on startup

EidosScribe/EidosHelpController.mm

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ - (void)addTopicsFromRTFFile:(NSString *)rtfFile underHeading:(NSString *)topLev
434434

435435
//NSLog(@"topic function name: %@, line: %@", callName, line);
436436

437-
// check for a built-in function signature that matches and substitute it in
437+
// Check for a built-in function signature that matches and substitute it in
438438
if (functionList)
439439
{
440440
std::string function_name([callName UTF8String]);
@@ -485,7 +485,7 @@ - (void)addTopicsFromRTFFile:(NSString *)rtfFile underHeading:(NSString *)topLev
485485

486486
//NSLog(@"topic method name: %@, line: %@", callName, line);
487487

488-
// check for a built-in method signature that matches and substitute it in
488+
// Check for a built-in method signature that matches and substitute it in
489489
if (methodList)
490490
{
491491
std::string method_name([callName UTF8String]);
@@ -513,6 +513,10 @@ - (void)addTopicsFromRTFFile:(NSString *)rtfFile underHeading:(NSString *)topLev
513513
}
514514
else
515515
{
516+
// BCH 3 April 2022: I don't think there's any reason why we can't have more than one method with the same name,
517+
// but with different signatures, as long as they are not in the same class; we can't handle overloading, but
518+
// method lookup is within-class. So this code could be generalized as the property lookup code below was; I just
519+
// haven't bothered to do so.
516520
NSLog(@"*** method signature mismatch:\nold: %@\nnew: %@", oldSignatureString, newSignatureString);
517521
}
518522
}
@@ -536,41 +540,46 @@ - (void)addTopicsFromRTFFile:(NSString *)rtfFile underHeading:(NSString *)topLev
536540

537541
//NSLog(@"topic property name: %@, line: %@", callName, line);
538542

539-
// check for a built-in property signature that matches and substitute it in
543+
// Check for a built-in property signature that matches and substitute it in. Note that we accept a match from any property in any class
544+
// API as long as the signature matches; we do not rigorously check that the API within a given class matches between signature and doc.
545+
// This is mostly not a problem because it is quite rare for the same property name to be used with more than one signature.
540546
if (propertyList)
541547
{
542548
std::string property_name([callName UTF8String]);
543-
EidosPropertySignature_CSP property_signature = nullptr;
549+
bool found_match = false, found_mismatch = false;
550+
NSString *oldSignatureString = nullptr;
551+
NSString *newSignatureString = nullptr;
544552

545553
for (auto signature_iter = propertyList->begin(); signature_iter != propertyList->end(); signature_iter++)
546554
if ((*signature_iter)->property_name_.compare(property_name) == 0)
547555
{
548-
property_signature = *signature_iter;
549-
break;
550-
}
551-
552-
if (property_signature)
553-
{
554-
NSAttributedString *attrSig = [NSAttributedString eidosAttributedStringForPropertySignature:property_signature.get() size:11.0];
555-
NSString *oldSignatureString = [lineAttrString string];
556-
NSString *newSignatureString = [attrSig string];
557-
558-
if ([oldSignatureString isEqualToString:newSignatureString])
559-
{
560-
//NSLog(@"signature match for method %@", callName);
556+
EidosPropertySignature_CSP candidate_signature = *signature_iter;
557+
NSAttributedString *attrSig = [NSAttributedString eidosAttributedStringForPropertySignature:candidate_signature.get() size:11.0];
561558

562-
// Replace the signature line from the RTF file with the syntax-colored version
563-
lineAttrString = attrSig;
564-
}
565-
else
566-
{
567-
NSLog(@"*** property signature mismatch:\nold: %@\nnew: %@", oldSignatureString, newSignatureString);
559+
oldSignatureString = [lineAttrString string];
560+
newSignatureString = [attrSig string];
561+
562+
if ([oldSignatureString isEqualToString:newSignatureString])
563+
{
564+
//NSLog(@"signature match for method %@", callName);
565+
566+
// Replace the signature line from the RTF file with the syntax-colored version
567+
lineAttrString = attrSig;
568+
found_match = true;
569+
break;
570+
}
571+
else
572+
{
573+
// If we find a mismatched signature but no matching signature, that's probably an error in either the doc or
574+
// the signature, unless we find a match later on with a different signature for the same property name.
575+
found_mismatch = true;
576+
}
568577
}
569-
}
570-
else
571-
{
578+
579+
if (found_mismatch && !found_match)
580+
NSLog(@"*** property signature mismatch:\nold: %@\nnew: %@", oldSignatureString, newSignatureString);
581+
else if (!found_match)
572582
NSLog(@"*** no property signature found for property name %@", callName);
573-
}
574583
}
575584

576585
topicItemKey = [NSString stringWithFormat:@"%@ %@", callName, readOnlyName];
@@ -1253,6 +1262,7 @@ - (void)drawRow:(NSInteger)rowIndex clipRect:(NSRect)clipRect
12531262
@"\u00A0addRecombinant()",
12541263
@"\u00A0addSelfed()",
12551264
@"\u00A0removeSubpopulation()",
1265+
@"\u00A0killIndividuals()",
12561266
@"\u00A0takeMigrants()",
12571267
@"8. reproduction() callbacks",
12581268
@"10. survival() callbacks"

0 commit comments

Comments
 (0)