How to correctly import modules from a file? - sml

My question has 3 parts:
Given a file .sig with a signature, how to import it correctly into a file .sml specifying a structure implementation?
Given a file .sml specifying a structure implementation, how to correctly import it into other .sml files?
Where can I find more information on structuring SML projects? Simple websearch didn't help.
I was told that open SomeStructure is not a safe way. I am new to ML-family idioms, hence the question. Thanks.

OK, I finally found this example, which is about module management in the SML project:
How to import from another file in SML, with a path relative to the importer?

Related

Can GraphEngine TSL-files import other TSL-files?

can TSL-files import other TSL-files?
Imagine a struct that is outsourced in file "b.tsl" and
another file would like to use it.
I've looked up the official web page and parts of the web,
but didn't find something.. Is there any option available?
Kind regards
Seargent
Yes, importing other TSL files is possible in GraphEngine, by just placing include $PathToTheDir$\b.tsl; at the beginning of the TSL file.
If the TSL files are in the same GraphEngine modeling project,
no explicit importing is necessary for them. Multiple TSL files are permitted, and they can be recognized by each other. My suggestion is just splitting the cell and struct definitions into different TSL files (the TSL filenames don't matter), adding a TSL file to the project is much convenient in my opinion.

How to open an FBX file from my UE4 project's interface

I've created an interface for my UE4 project that has an import button. What I want it to do is to access FBX files in the user's desktop and opens the one the user selects.
I've written a c++ code that searches for FBX files in the desktop and returns their names, if found.
I'm kind of confused/stuck at this moment, and don't know exactly how to continue. My question is:
Shall I open the FBX file using c++ or blueprints?
It would be much appreciated if you could elaborate more on the approach you suggest.
Thank you
What I want it to do is to access FBX files in the user's desktop and opens the one the user selects.
"Opening something" does not actually tell us what you want to do.
Open the file with The default application for the file type?
Load the mesh somewhere into RAM?
Spawn objects in UE4 with the mesh?
Who knows what opening means. Opening the file in maya will be quite different from opening it with a hex editor.
Specify what your programm should do.
Shall I open the FBX file using c++ or blueprints?
Appart from what you can add to what I said above this questions answer will be purely subjective if BP is actually capable of doing what you want. IF you are doing good in c++ I suggest to stick with it for file operations.
Here Epics documentation on asset references, this should fit for people finding this thread and probably for you.
https://docs.unrealengine.com/latest/INT/Programming/Assets/ReferencingAssets/index.html
Just use UStaticMesh instead of the filetype used in the examples.
Here a UE4 wiki example implementation of what you could mean:
https://wiki.unrealengine.com/Dynamic_Load_Object
Shall I open the FBX file using c++ or blueprints? It would be much appreciated if you could elaborate more on the approach you suggest.
Yes, you can use the thirdparty libray to import the FBX, such as assimp
https://github.com/assimp/assimp
In the mean time, instead of use static mesh, you could use precedure mesh instead.

XLS/XLSX to CSV in c++

I've been given a project in which I need to import data from CSV, XLS and XLSX files, do some processing, then write the results to a database.
I'm working on a project that's been going on for a while and there are several import functions already that use a very nice object to handle opening files with all sorts of separators and such. And this object is key to the processing that I need to perform.
Since a CSV is basically a textfile with a different extension this object opens it perfectly and I've managed to complete most of the processing and testing with the object and values stored within.
But now I need to add the XLS and XLSX support. And since this object is now pretty much central to the processing I figured the easiest way to fit XLS and XLSX files in would be to convert them to CSV, then import that.
Any help would be appreciated and I'll try answer questions if it's necessary, but since the request is just for some way to convert from one file type to another and nothing more insightful I don't think it's really necessary to add any snippets just yet.
Your options in terms of C++ libraries:
OpenXLSX - https://github.com/troldal/OpenXLSX
XLNT - https://github.com/tfussell/xlnt
Or you could give "XLSX I/O" a try. It's a small C library.
"XLSX I/O" - https://github.com/brechtsanders/xlsxio
Don't forget to add the usual extern "C", when calling C functions from C++.
The repo contains basic xlsx-to-csv (and csv-to-xlsx) examples, which should get you started: https://github.com/brechtsanders/xlsxio/blob/master/src/xlsxio_xlsx2csv.c
Maybe this will help:
http://www.codeproject.com/Articles/42504/ExcelFormat-Library
Also you can use libraries from Open/Libre Office project.

import file as variable in compilation(CPP)

I have a CPP file which depends on having a vary large string being declared at the start of the file. I would like to be able to import this string from a text file, and include as a variable during compilation. Please could a shell script and relevant C/++ code be provided.
You can declare this string in a header file and include this file.
You can't do that without external help.
There're plenty of so-called "binary to header" scripts and programs out there. As an example, https://github.com/dparnell/bin2h (just a top hit from a search engine).
EDIT: Also, take a look at How to use bin2h?.

In a SConstruct, how do you get what 'scons --tree=all' would print out?

This stackoverflow question shows how to get a list of all the dependencies for one or more targets. How do you get the same thing from within a SConstruct file?
Edit:
That is, as an Object or something. You could always recursively call scons -tree=all and grab stdout from that process, but I don't want a hack. I'd like access to the dependency object scons is using.
The best way to get this information is to just look at the source for SCons. You're looking for the file SCons/Script/Main.py, and in particular for the TreePrinter class. The basic idea is that all SCons nodes contain within themselves all the relevant details for reconstructing the dependancy graph.
The simplest test case I could think of is:
import os
env = Environment(ENV = os.environ)
app = env.Program('dummy', 'main.cpp')
for item in app:
for child in item.all_children():
print child
The code for doing this isn't really that complicated, but I certainly wouldn't want to rely on it not changing (it isn't part of the public interface for SCons).
I do not think that is possible from within the code. The code in the SConstruct file is the code that generates the tree. So the tree cannot be provided before all the code in the SConstruct file is executed. On the other hand I think it should be possible to get the object you mention within python, if you have the patience to look through the Scons code to see how they operate their --tree option. But you will have to wait until the tree is generated before you access it.