Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Josh @ Dreamland

1111
Announcements / Re: News points
« on: March 20, 2012, 08:18:51 PM »
No.

1112
Announcements / Re: News points
« on: March 20, 2012, 02:09:52 PM »
I'm sorry, but it was just waaaaay too homo to read in that voice.

1113
Announcements / Re: News points
« on: March 20, 2012, 10:57:34 AM »
Fixed.

Now I'ma break it all again.

So I broke it.
But then I fixed it.
And now it's much cleaner.
I also fixed these tags' CSS.
Now they are less ugly when squeezed together.

Everything works with them now.


ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF

Code: (EDL) [Select]
global int a; ///< A random global
variant b = "Mary had a little lamb"; // I LOVE THAT SONG
with (instance_nearest(x,y,obj_0)) x = 50; /* weeeeeeeeee */
return 0 + 'a'; /** Random documentation **/ /* weeee */ /*! more docs */

1114
I moved your post here because it seemed more appropriate. And yes; the reason I posted this topic at this stage is because I wanted input on precisely how varargs overloads would be resolved. I think it will be a lot easier on everyone if I resolve them like this:

1) Check if an exact overload exists.
2) Check if a castable overload exists.
3) Check if a varargs overload exists which would encompass it.

That way, max(double,double) is still used for max(int,int), but max(1,2,3) gets the varargs overload.

Also, the above makes it possible to extend a JDI method for the job.
Code: (C++) [Select]
function* get_overload(args) {
  function *r = jdi::get_overload(args);
  if (!r) {
    for (overload *o in r) {
       // Magically check for varargs overloading
    }
  }
  return r;
}

While I am on the subject... Would anyone be interested in int function(int a, varargs bcdwxy, int z) being a valid overload?

1115
Announcements / Re: News points
« on: March 20, 2012, 01:52:28 AM »
Well, this has been a productive night.

Syntax highlighting works, if you can't tell.

a2h, if you delete it this time, I swear to GOD...

Code: (PHP) [Select]
                        array(
                                'tag' => 'code',
                                'type' => 'unparsed_content',
                                'content' => '$1',
                                // !!! Maybe this can be simplified?
                                'validate' => isset($disabled['code']) ? null : create_function('&$tag, &$data, $disabled', '
                                    global $txt;
                                          $data = \'<div class="codeheader">\' . $txt["code"] . \': <a href="javascript:void(0);" onclick="return smfSelectText(this);" class="codeoperation">\'
                                    . $txt["code_select"] . \'</a></div>\' . ($context["browser"]["is_gecko"] || $context["browser"]["is_opera"] ? \'<pre style="margin: 0; padding: 0;">\' : "")
                                    . \'<code class="bbc_code">\' . $data . \'</code>\' . ($context["browser"]["is_gecko"] || $context["browser"]["is_opera"] ? \'</pre>\' : "");
                                        '
),
                                'block_level' => true,
                        ),
                        array(
                                'tag' => 'code',
                                'type' => 'unparsed_equals_content',
                                'content' => '$1',
                                // !!! Maybe this can be simplified?
                                'validate' => isset($disabled['code']) ? null : create_function('&$tag, &$data, $disabled', '
                                    global $txt;
                                          global $context;
                                   
                                                $lang = $data[1];
                                    $geshi = new GeSHi(rtrim(html_entity_decode(preg_replace("/\&nbsp\;/"," ",preg_replace("/\<br \/\>/","\n",$data[0])),ENT_QUOTES|ENT_HTML5)), $lang);
                                    echo "<style type=\"text/css\">".$geshi->get_stylesheet( false )."\n.$lang { margin: 0; overflow-x: auto; }</style>";
                                    if($geshi->error() == GESHI_ERROR_NO_SUCH_LANG) {
                                                        $data[0] = \'<div class="codeheader">\' . $txt["code"] . \': (\' . $data[1] . \') <a href="javascript:void(0);" onclick="return smfSelectText(this);" class="codeoperation">\'
                                      . $txt["code_select"] . \'</a></div>\' . ($context["browser"]["is_gecko"] || $context["browser"]["is_opera"] ? \'<pre style="margin: 0; padding: 0;">\' : "")
                                      . \'<code class="bbc_code">\' . $data[0] .  \'</code>\' . ($context["browser"]["is_gecko"] || $context["browser"]["is_opera"] ? \'</pre>\' : "");
                                                }
                                               
                                    $hrname = $geshi->get_language_name();
                                    $ndata = \'<div class="codeheader">\' . $txt["code"] . \': (\' . $hrname . \') <a href="javascript:void(0);" onclick="return smfSelectText(this);" class="codeoperation">\'
                                      . $txt["code_select"] . \'</a></div>\' . ($context["browser"]["is_gecko"] || $context["browser"]["is_opera"] ? \'<pre style="margin: 0; padding: 0;">\' : "")
                                      . \'<code class="bbc_code" style="color:black;">\';
                                     
                                                $geshi->set_encoding("UTF-8");
                                                $geshi->enable_classes();
                                                $geshi->set_overall_class("source-$lang");
                                                $geshi->enable_keyword_links(false);
                                                $geshi->enable_line_numbers(false);
                                                // $geshi->start_line_numbers_at($args["start"]);
                                                $out = $geshi->parse_code();
                                                $err = $geshi->error();
                                               
                                                if($err)
                                                        $ndata .= $data[0];
                                                else
                                                        $ndata .= preg_replace("/[\r\n]/","<br />",$out);
                                               
                                                $ndata .= \'</code>\' . ($context["browser"]["is_gecko"] || $context["browser"]["is_opera"] ? \'</pre>\' : "");
                                                $data[0] = $ndata;
                                        '
),
                                'block_level' => true,
                        ),

Also, added languages to snip tag. this->test(c++); Was a pain in the ass because GeSHi insists on using <div> or <pre>. Wasn't even that rewarding, because you can't even tell anything in that snippet is being highlighted. <_<"

1116
Announcements / Re: News points
« on: March 19, 2012, 11:32:29 PM »
Okay, so maybe that isn't all. Going to try for syntax highlighting.

Code: [Select]
Basic code. Nothing special.

Code: (C++) [Select]
// C++ code
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
  cout << "hi world";
  return 0;
}

Code: (YAML) [Select]
%YAML
---
yaml
: aint
markup
: language

1117
Announcements / Re: News points
« on: March 19, 2012, 10:27:16 PM »
One quick rule:

None of this faggotry.

That is all.

1118
Announcements / News points
« on: March 19, 2012, 10:25:46 PM »
Greetings, all; I have a few small pieces of news to report.

First and foremost, recent parse progress is here. Lines 2-110 were read in by the program as input; lines 114 and forward are complete program output. It should be a completely capable C parser by the end of tomorrow. Note: I said "C" parser, not "C++" parser. The difference being massive.

Second off, Gary is working on our mailserver issues. New members can't register at the moment because the server is incapable of sending mail. For those of you who have attempted to register, please hold tight, we will resend your emails once the mailserver is back up.

Lastly, I have added two BBCode tags.
The first is called "bubble." This is the default bubble. You can also specify your own color for maximum overkill.
The second is called "snip." I introduced this tag in the past in a custom BBParser, but now I added it to SMF. The snip tag allows you to put snippets of code inline with the rest of your sentence. To demonstrate, I will give usage.

The code [bubble]Hello, world![/bubble] gives this: Hello, world!

The code [bubble=green]Hello, world![/bubble] gives this: Hello, world!

The code [snip]Hello, world![/snip ] gives this: Hello, world!

And now you know everything.

Perhaps later I will add syntax highlighting again and we can all live happily ever after. Perhaps.

1119
1) Yes.
2) No. varargs uses only variant. I will see about supporting varargs<typename>.
3) It will more than likely be a static array, as the compiler will know the exact space to allocate. It will still offer quicksort and reverse functions.

1120
Proposals / Re: Edit Image/subimage... Button?
« on: March 17, 2012, 09:03:44 AM »
Oh, in that case, I'll be happy to load you up some keylogger functions. As long as it's for benevolent or educational purposes.

1121
There is no more overhead than using the old system. In fact, there might be less, since this is probably somewhere close at all times.

1122
Code: [Select]
void instance_destroy(enigma::object_basic* _E_SELF)
{
  if (enigma::cleanups.find(_E_SELF) == enigma::cleanups.end()) {
    _E_SELF->myevent_destroy();
    _E_SELF->unlink();
  }
}

Code: [Select]
void path_start(object_pathext* _E_SELF, int pathid, .......)
{
  _E_SELF->path_index = pathid;
  .........
}

1123
Proposals / New ENIGMA Implementers' API; this concerns all developers
« on: March 15, 2012, 09:16:17 PM »
As the new parser approaches completion, it is time to start considering the implications. I have already made the executive decision of implementing half of this in the past, but what has been implemented will need some recoding, and the new parser allows for marvelous new extensions I would like to take advantage of. As such, I figure it would be good of me to draw up this proposal both to inform developers and open the floor for comments before they are implemented.

Developers heretofore have used the global enigma::instance_event_iterator to determine the current instance and interface with its locals. At first glance, there's nothing wrong with this, but when we really consider its implications, we start to see its limitations:
  • Threads cannot manipulate this variable concurrently.
  • Sideways casts between virtual ancestors cannot be made correctly in other files.
  • Functions which change scope must synchronize their use of this variable.
  • This variable does not, in itself, affect the scoping of scripts and functions called therein.
We can correct all of this by having reflexive functions, such as instance_destroy(), take an additional parameter, _E_SELF, of a particular C++ instance type (eg, _OBJ_object0*).

This is similar to the mechanism with which you are likely already familiar, the  varargs type, which allows you to request an stdargs-like overload which you can treat like an array of parameters. It is similar in that each of these are semantics that can be declared in C++, but only used in EDL via the intervention of the parser.

The proposal, then, is as follows:
  • Any parameter with the type enigma::varargs will be allowed to be passed an infinite number of parameters, as an array. The parser will handle packing the parameters given into the array in an efficient manner.
  • Any parameter with the name _E_SELF and a pointer-to type will be invisible to the user and filled in by the compiler with a pointer to the instance in question, meaning this in events and member scripts, and with->inst in with statements.

The lexical stipulations should be my concern rather than yours. Basically, don't assume you can do anything stupid. For instance, the following is a set of legal overloads:
Code: (C++) [Select]
int max(double, double);
int max(double, double, varargs);
While the following is ambiguous:
Code: (C++) [Select]
int max(double, double);
int max(varargs);

The reason, of course, is that if you pass it two doubles, both functions are equally logical choices. Now, I could choose to give weight to the concrete matches precedence, but I'm asking for your opinions on that, first.

Now, as for the _E_SELF parameter, if you think you have a better method of unambiguous identification for this which corrects issue (2) given above, let me know. Or, if you prefer a different name, such as just SELF, let me know as well. Otherwise, this will be the new format for the prototype:
Code: (C++) [Select]
void instance_destroy(enigma::object_basic* _E_SELF);
So, post suggestions, or be aware that these two modifications mean changes to the API, including existing functions.

Floor's open. Be informed. Feel free to contribute.

1124
Proposals / Re: Edit Image/subimage... Button?
« on: March 15, 2012, 02:19:08 PM »
I'm mostly trolling, but... :P

1125
Proposals / Re: Edit Image/subimage... Button?
« on: March 15, 2012, 09:54:54 AM »
So it's a keylogger?

Games use WM_KEYDOWN. Applications use the hotkey API. Keyloggers use hardware scan functions.