semicolon symbol always removed need to keep it

Andro's icon

So with this line
vec2 res = vec2(320.,240.) ;


it comes out

vec2 res = vec2(320.,240.)
when i put it into the text object (or any other to be honest)

I need to keep the semicolon. Everything I tried removes it.
I can't do it inside the source material as thats over 400 lines of glsl and it would break my other work in other software. So it needs to happen in the patch.

Anybody got a fix ?

Max Gardener's icon

Type "Entering text and special characters in Max" into the text field in the upper right-hand corner of your patcher window and read what opens in your Documentation Browser. Erudition will be found there.

Andro's icon

Hi Max, sadly thats not true. I've read that section since Monday morning, countless times, its amazing that Max actually still uses things that are reserved in the world of code like float, " " and ;

And if it the answer is there I just haven't found it yet after trying everything I can come up with.
I have been busy with these kind of problems for 4 days straight.
As i stated going into my GLSL scripts and modifying them for Max is not an option as they are used by multiple applications.

heres a patch to show my problem. If you or anyone can add some Erudition there that would be all kinds of awesome.

Max Patch
Copy patch and select New From Clipboard in Max.

Max Gardener's icon

So this doesn't work for you?

Max Patch
Copy patch and select New From Clipboard in Max.

Robin Parmar's icon

I do understand that Max has horrid rules regarding special characters. But everything works fine if the string has quotes around it. I would make sure that's the case before it gets into Max. Then you can do all the following.

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon

if you dont like to use quote marks inside text (or before pasting) , why not ignore the loss of the semicolon and do

tosymbol
sprintf %s;
fromsymbol

afterwards?

Andro's icon

Hi Max and Robin,
This doesn't work for me .
As I already stated 2 times changing the source material is not an option. There are over 50 files ranging from 10 to 400 lines of code, that can all be stitched together. So your proposal won't work.

Going through all those files, making a duplicate copy (as they're also used by other programs), adding quotations to every single line, and then keeping track of that would go against all that programming, code and automation stands for. Plus this is 2017, this software should just be able to pass data through to another object "unaltered".

And making a shader stitcher which i can share as a package falls through the roof because every user would have to add quotation marks to every line of code with a text editor.
Thanks anyway.

Roman, your solution also won't work some functions are written with a few lines and then the ; symbol. Throwing one at the end of everything would break the GLSL script. example:


// Sign function that doesn't return 0
float sgn(float x) {
return (x<0)?-1:1;
}

So the float word throws pretty much every object in max, the semicolon is on line 3.
Therefore that won't work.

I'm going to make a new post, put my patch in there which is very close and see if anyone can help out with that. Basically Max msp is very unfriendly to data in the realm of GLSL. I do get it. When Max was made certain keywords were reserved, no GPU's back then.
Then we get GLSL and the two have conflicts. I've seen countless posts the last few days where users have to bend over backwards to just keep data intact. And thats the heart of it i suppose, max is a program used to make, drive and later data. Cycling 74 as a company is surprisingly quiet about it though.

Its just a shame that the user has little freedom with actually defining how the data is managed.
I know that Max objects listen to certain kinds of messages like list, float etc.. But this info is so scattered around so many forum posts and parts of the documentation that at one point its hard to believe that I started this on Monday and 5 days later I can't merge a few pieces of text even after multiple attempts to help me by the community.
That someone thought it was a good idea to reserve a line break symbol ;
that is used in all code languages truly blows my mind..)

To me this is a serious flaw in Max and its data flow that needs to be addressed.

Considering I only use Jitter to do real time graphics not being able to handle, merge and parse GLSL data is a serious problem for my creativity and workflow.
Please believe me , every time I've asked for help here I have truly tried my best to do everything i can think of to make it work.

Massive thanks to everyone who tried to help. I'll be starting a new post with all the problems that I'm hitting, test data and my actual patch.



Robin Parmar's icon

"As I already stated 2 times changing the source material is not an option. There are over 50 files ranging from 10 to 400 lines of code, that can all be stitched together. So your proposal won't work. "

You write as though scripting doesn't exist. A Python program would handle this just fine, collating multiple copies in a jiffy. Since Max won't do it, you need to do it outside Max. This is your only option and it's not difficult.

Yes, the character handling is a serious flaw in Max. All the symbol/list/message handling is rather ugly. So stop banging your head against the wall. :-)

Batch the sucker if you don't need real-time. Use a watched folder with a sentinel file, if near real-time is OK. Or use serial, UDP, or some other transport mechanism if the solution must be continuous and fluid.

Andro's icon

Hi Robin,

Some people use Max for the visual node manner of programming. So not every user will want to script their own software. Thats why they buy a program like Max. Its one of its main selling points.
I don't believe for one moment i act or say like scripting doesn't exist, imagine how this is for a new Max user, who has no scripting background. What then ? Try approaching it from that angle as this work isn't only about something for myself but the community of Jitter users. To just say, learn python is not a simple thing thats achieved in a day for myself and other max users ;-)

Last time I checked its not that Max can't do it, it's just not a simple thing to do in Max. Thats fine. Thats why we try and see whats possible and whats not, and if we're stuck we reach out for help in the forums.
Also so other people in the future can learn from others experiences.
And last but not least, the goal was to make a package for other Max users. This will be very tricky if I have to do stuff in python or other 3rd party software. Yes it has to be near real time.
Work in Max patch, alter text file, recompile, work on. Thats how Max works when you work with max only objects, rock n roll programming, fast prototype results.

Yes, its been a frustrating week but that's okay, all my findings are now on a forum and can save other users a lot of time and effort.
Maybe its also important to be able to highlight shortcomings in the current software for a small group of users and see if something can be done to improve the situation, this is why I made a reference to the merge object in Touch designer, it has one argument, how many inlets.
You plug all your text/data into each inlet, the outlet throws it all out as one big file all formatting and data intact.
This is something that Max and jitter sorely misses so its also hopefully something that cycling 74 hears from its user base and thinks this is a common problem we need to address.
And to be honest, I have it almost working outside of the semicolon problem, and I am kind of stubborn and determined not to give up on something I invested so much time in.

heres the new forum post with multiple problems highlighted that are not at all clear to a new user,and my patch which almost works.

https://cycling74.com/forums/merging-together-multiple-text-files-for-glsl-episode-7

Robin Parmar's icon

Yes, I can see you are stubborn on this matter. :-)

Yes, I would love to see Max improved. I teach the software and am well aware of how newcomers approach it.

However, I also teach that one should use the right too for the job. By no means is Max a good text processor. Nor will it ever be. How are code pages handled, for example?

Yes, I do think everyone should be able to pick up Python and learn a thing or two. It's far easier and more consistent than Max, for one!

And, yes, I do hope the semicolon problem is fixed eventually.

Best of luck!

Andro's icon

Thanks !

11OLSEN's icon

[filein] is reading files on the lowest level possible (bytes). As no fileout object exists you could make one for example as mxj. I used this combination in the styleRemover tool which parses max patches and writes new files. Don't know if this could help in your situation but as I understood you try to combine multiple files to one and save as new file, right? https://cycling74.com/tools/styleremover